cvs: pear /Text_Wiki/Text Wiki.php

From: Date: Fri, 27 Oct 2006 18:42:52 +0000
Subject: cvs: pear /Text_Wiki/Text Wiki.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-42833@lists.php.net to get a copy of this message
justinpatrin Fri Oct 27 18:42:52 2006 UTC Modified files: /pear/Text_Wiki/Text Wiki.php Log: Add balanced token checking http://cvs.php.net/viewvc.cgi/pear/Text_Wiki/Text/Wiki.php?r1=1.49&r2=1.50&diff_format=u Index: pear/Text_Wiki/Text/Wiki.php diff -u pear/Text_Wiki/Text/Wiki.php:1.49 pear/Text_Wiki/Text/Wiki.php:1.50 --- pear/Text_Wiki/Text/Wiki.php:1.49 Sat Oct 21 05:56:28 2006 +++ pear/Text_Wiki/Text/Wiki.php Fri Oct 27 18:42:52 2006 @@ -9,7 +9,7 @@ * @package Text_Wiki * @author Paul M. Jones <pmjones@php.net> * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 - * @version CVS: $Id: Wiki.php,v 1.49 2006/10/21 05:56:28 justinpatrin Exp $ + * @version CVS: $Id: Wiki.php,v 1.50 2006/10/27 18:42:52 justinpatrin Exp $ * @link http://pear.php.net/package/Text_Wiki */ @@ -1029,6 +1029,7 @@ } else { // pass through the parsed source text character by character $this->_block = ''; + $tokenStack = array(); $k = strlen($this->source); for ($i = 0; $i < $k; $i++) { @@ -1046,6 +1047,18 @@ $this->_block = ''; } + if (isset($opts['type'])) { + if ($opts['type'] == 'start') { + array_push($tokenStack, $rule); + } elseif ($opts['type'] == 'end') { + if ($tokenStack[count($tokenStack) - 1] != $rule) { + return Text_Wiki::error('Unbalanced tokens, check your syntax'); + } else { + array_pop($tokenStack); + } + } + } + // yes, get the replacement text for the delimited // token number and unset the flag. $key = (int)$key;

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