cvs: pear /Text_Wiki/Text Wiki.php

From: Date: Sun, 06 Jun 2004 22:39:28 +0000
Subject: cvs: pear /Text_Wiki/Text Wiki.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-20292@lists.php.net to get a copy of this message
pmjones Sun Jun 6 18:39:28 2004 EDT Modified files: /pear/Text_Wiki/Text Wiki.php Log: fixed insertRule() so that it inserts properly when a second argument is passed http://cvs.php.net/diff.php/pear/Text_Wiki/Text/Wiki.php?r1=1.8&r2=1.9&ty=u Index: pear/Text_Wiki/Text/Wiki.php diff -u pear/Text_Wiki/Text/Wiki.php:1.8 pear/Text_Wiki/Text/Wiki.php:1.9 --- pear/Text_Wiki/Text/Wiki.php:1.8 Sun Jun 6 11:55:00 2004 +++ pear/Text_Wiki/Text/Wiki.php Sun Jun 6 18:39:28 2004 @@ -19,7 +19,7 @@ * This is the "master" class for handling the management and convenience * functions to transform Wiki-formatted text. * -* $Id: Wiki.php,v 1.8 2004/06/06 15:55:00 pmjones Exp $ +* $Id: Wiki.php,v 1.9 2004/06/06 22:39:28 pmjones Exp $ * * @author Paul M. Jones <pmjones@ciaweb.net> * @@ -616,7 +616,7 @@ // in the list of rules. this means we're trying to insert after // a target key, but the target key isn't there. if (! is_null($tgt) && $tgt != '' && - ! in_array($name, $this->rules)) { + ! in_array($tgt, $this->rules)) { return false; } @@ -630,27 +630,26 @@ // save a copy of the current rules, then reset the rule set // so we can insert in the proper place later. - $tmp = $this->rules; - $this->rules = array(); - // where to insert the rule? if ($tgt == '') { // insert at the beginning - $this->rules[] = $name; - foreach ($tmp as $key => $val) { - $this->rules[$key] = $val; - } + array_unshift($this->rules, $name); return true; - } else { - // insert after the named rule - foreach ($tmp as $key => $val) { - $this->rules[] = $val; - if ($key == $tgt) { - $this->rules[] = $name; - } + } + + // insert after the named rule + $tmp = $this->rules; + $this->rules = array(); + + foreach ($tmp as $val) { + $this->rules[] = $val; + if ($val == $tgt) { + $this->rules[] = $name; } } + return true; + }

« previous php.pear.cvs (#20292) next »