Optional parameter bug fixed. Deprecated curly braces syntax fixed. Thanks for reporting both, Matthias :)

This commit is contained in:
azett 2020-09-06 11:12:22 +02:00
parent e65bb9c549
commit 04900d4154
2 changed files with 580 additions and 491 deletions

View File

@ -383,7 +383,10 @@ function theme_def_feed_comments_link($str, $feed, $id) {
return BLOG_BASEURL . "?x=entry:$id;comments:1;feed:{$feed}"; return BLOG_BASEURL . "?x=entry:$id;comments:1;feed:{$feed}";
} }
function theme_comments_feed_link($feed = 'rss2', $id) { function theme_comments_feed_link($feed, $id) {
if (empty($feed)) {
$feed = 'rss2';
}
return apply_filters('post_comments_feed_link', '', $feed, $id); return apply_filters('post_comments_feed_link', '', $feed, $id);
} }

View File

@ -37,21 +37,25 @@
/** /**
* String parser mode: Search for the next character * String parser mode: Search for the next character
*
* @see StringParser::_parserMode * @see StringParser::_parserMode
*/ */
define('STRINGPARSER_MODE_SEARCH', 1); define('STRINGPARSER_MODE_SEARCH', 1);
/** /**
* String parser mode: Look at each character of the string * String parser mode: Look at each character of the string
*
* @see StringParser::_parserMode * @see StringParser::_parserMode
*/ */
define('STRINGPARSER_MODE_LOOP', 2); define('STRINGPARSER_MODE_LOOP', 2);
/** /**
* Filter type: Prefilter * Filter type: Prefilter
*
* @see StringParser::addFilter, StringParser::_prefilters * @see StringParser::addFilter, StringParser::_prefilters
*/ */
define('STRINGPARSER_FILTER_PRE', 1); define('STRINGPARSER_FILTER_PRE', 1);
/** /**
* Filter type: Postfilter * Filter type: Postfilter
*
* @see StringParser::addFilter, StringParser::_postfilters * @see StringParser::addFilter, StringParser::_postfilters
*/ */
define('STRINGPARSER_FILTER_POST', 2); define('STRINGPARSER_FILTER_POST', 2);
@ -64,6 +68,7 @@ define ('STRINGPARSER_FILTER_POST', 2);
* @package stringparser * @package stringparser
*/ */
class StringParser { class StringParser {
/** /**
* String parser mode * String parser mode
* *
@ -87,6 +92,7 @@ class StringParser {
/** /**
* Raw text * Raw text
*
* @access protected * @access protected
* @var string * @var string
*/ */
@ -94,6 +100,7 @@ class StringParser {
/** /**
* Parse stack * Parse stack
*
* @access protected * @access protected
* @var array * @var array
*/ */
@ -101,6 +108,7 @@ class StringParser {
/** /**
* Current position in raw text * Current position in raw text
*
* @access protected * @access protected
* @var integer * @var integer
*/ */
@ -108,6 +116,7 @@ class StringParser {
/** /**
* Root node * Root node
*
* @access protected * @access protected
* @var mixed * @var mixed
*/ */
@ -115,6 +124,7 @@ class StringParser {
/** /**
* Length of the text * Length of the text
*
* @access protected * @access protected
* @var integer * @var integer
*/ */
@ -143,6 +153,7 @@ class StringParser {
/** /**
* Characters or strings to look for * Characters or strings to look for
*
* @access protected * @access protected
* @var array * @var array
*/ */
@ -168,6 +179,7 @@ class StringParser {
/** /**
* Current parser status * Current parser status
*
* @access protected * @access protected
* @var int * @var int
*/ */
@ -175,6 +187,7 @@ class StringParser {
/** /**
* Prefilters * Prefilters
*
* @access protected * @access protected
* @var array * @var array
*/ */
@ -182,6 +195,7 @@ class StringParser {
/** /**
* Postfilters * Postfilters
*
* @access protected * @access protected
* @var array * @var array
*/ */
@ -189,6 +203,7 @@ class StringParser {
/** /**
* Recently reparsed? * Recently reparsed?
*
* @access protected * @access protected
* @var bool * @var bool
*/ */
@ -209,8 +224,10 @@ class StringParser {
* Add a filter * Add a filter
* *
* @access public * @access public
* @param int $type The type of the filter * @param int $type
* @param mixed $callback The callback to call * The type of the filter
* @param mixed $callback
* The callback to call
* @return bool * @return bool
* @see STRINGPARSER_FILTER_PRE, STRINGPARSER_FILTER_POST * @see STRINGPARSER_FILTER_PRE, STRINGPARSER_FILTER_POST
*/ */
@ -238,7 +255,8 @@ class StringParser {
* Remove all filters * Remove all filters
* *
* @access public * @access public
* @param int $type The type of the filter or 0 for all * @param int $type
* The type of the filter or 0 for all
* @return bool * @return bool
* @see STRINGPARSER_FILTER_PRE, STRINGPARSER_FILTER_POST * @see STRINGPARSER_FILTER_PRE, STRINGPARSER_FILTER_POST
*/ */
@ -264,7 +282,8 @@ class StringParser {
* This function parses the text * This function parses the text
* *
* @access public * @access public
* @param string $text The text to parse * @param string $text
* The text to parse
* @return mixed Either the root object of the tree if no output method * @return mixed Either the root object of the tree if no output method
* is defined, the tree reoutput to e.g. a string or false * is defined, the tree reoutput to e.g. a string or false
* if an internal error occured, such as a parse error if * if an internal error occured, such as a parse error if
@ -410,6 +429,7 @@ class StringParser {
/** /**
* Abstract method: Manipulate the tree * Abstract method: Manipulate the tree
*
* @access protected * @access protected
* @return bool * @return bool
*/ */
@ -419,6 +439,7 @@ class StringParser {
/** /**
* Abstract method: Output tree * Abstract method: Output tree
*
* @access protected * @access protected
* @return bool * @return bool
*/ */
@ -462,7 +483,7 @@ class StringParser {
// if yes, how should this be achieved? Another member of // if yes, how should this be achieved? Another member of
// StringParser_Node? // StringParser_Node?
$this->_setStatus(0); $this->_setStatus(0);
$res = $this->_appendText ($this->_text{$topelem->occurredAt}); $res = $this->_appendText($this->_text [$topelem->occurredAt]);
if (!$res) { if (!$res) {
return false; return false;
} }
@ -475,6 +496,7 @@ class StringParser {
/** /**
* Abstract method: Close remaining blocks * Abstract method: Close remaining blocks
*
* @access protected * @access protected
*/ */
function _closeRemainingBlocks() { function _closeRemainingBlocks() {
@ -497,6 +519,7 @@ class StringParser {
/** /**
* Abstract method: Initialize the parser * Abstract method: Initialize the parser
*
* @access protected * @access protected
*/ */
function _parserInit() { function _parserInit() {
@ -505,6 +528,7 @@ class StringParser {
/** /**
* Abstract method: Set a specific status * Abstract method: Set a specific status
*
* @access protected * @access protected
*/ */
function _setStatus($status) { function _setStatus($status) {
@ -519,9 +543,12 @@ class StringParser {
/** /**
* Abstract method: Handle status * Abstract method: Handle status
*
* @access protected * @access protected
* @param int $status The current status * @param int $status
* @param string $needle The needle that was found * The current status
* @param string $needle
* The needle that was found
* @return bool * @return bool
*/ */
function _handleStatus($status, $needle) { function _handleStatus($status, $needle) {
@ -532,6 +559,7 @@ class StringParser {
/** /**
* Search mode loop * Search mode loop
*
* @access protected * @access protected
* @return bool * @return bool
*/ */
@ -571,7 +599,7 @@ class StringParser {
return false; return false;
} }
if (!$res) { if (!$res) {
$res = $this->_appendText ($this->_text{$this->_cpos}); $res = $this->_appendText($this->_text [$this->_cpos]);
if (!$res) { if (!$res) {
return false; return false;
} }
@ -606,63 +634,64 @@ class StringParser {
function _loop() { function _loop() {
// HACK: This method ist not yet implemented correctly, the code below // HACK: This method ist not yet implemented correctly, the code below
// DOES NOT WORK! Do not use! // DOES NOT WORK! Do not use!
return false; return false;
/* /*
while ($this->_cpos < $this->_length) { * while ($this->_cpos < $this->_length) {
$needle = $this->_strDetect ($this->_charactersSearch, $this->_cpos); * $needle = $this->_strDetect ($this->_charactersSearch, $this->_cpos);
*
if ($needle === false) { * if ($needle === false) {
// not found => see if character is allowed * // not found => see if character is allowed
if (!in_array ($this->_text{$this->_cpos}, $this->_charactersAllowed)) { * if (!in_array ($this->_text{$this->_cpos}, $this->_charactersAllowed)) {
if ($strict) { * if ($strict) {
return false; * return false;
} * }
// ignore * // ignore
continue; * continue;
} * }
// lot's of FIXMES * // lot's of FIXMES
$res = $this->_appendText ($this->_text{$this->_cpos}); * $res = $this->_appendText ($this->_text{$this->_cpos});
if (!$res) { * if (!$res) {
return false; * return false;
} * }
} * }
*
// get subtext * // get subtext
$subtext = substr ($this->_text, $offset, $offset - $this->_cpos); * $subtext = substr ($this->_text, $offset, $offset - $this->_cpos);
$res = $this->_appendText ($subtext); * $res = $this->_appendText ($subtext);
if (!$res) { * if (!$res) {
return false; * return false;
} * }
$this->_cpos = $subtext; * $this->_cpos = $subtext;
$res = $this->_handleStatus ($this->_status, $needle); * $res = $this->_handleStatus ($this->_status, $needle);
if (!$res && $strict) { * if (!$res && $strict) {
return false; * return false;
} * }
} * }
// original status 0 => no problem * // original status 0 => no problem
if (!$this->_status) { * if (!$this->_status) {
return true; * return true;
} * }
// not in original status? strict mode? * // not in original status? strict mode?
if ($this->strict) { * if ($this->strict) {
return false; * return false;
} * }
// break up parsing operation of current node * // break up parsing operation of current node
$res = $this->_reparseAfterCurrentBlock (); * $res = $this->_reparseAfterCurrentBlock ();
if (!$res) { * if (!$res) {
return false; * return false;
} * }
// this will not cause an infinite loop because * // this will not cause an infinite loop because
// _reparseAfterCurrentBlock will increase _cpos by one! * // _reparseAfterCurrentBlock will increase _cpos by one!
return $this->_loop (); * return $this->_loop ();
*/ */
} }
/** /**
* Abstract method Append text depending on current status * Abstract method Append text depending on current status
*
* @access protected * @access protected
* @param string $text The text to append * @param string $text
* The text to append
* @return bool On success, the function returns true, else false * @return bool On success, the function returns true, else false
*/ */
function _appendText($text) { function _appendText($text) {
@ -675,8 +704,10 @@ class StringParser {
/** /**
* Append text to last text child of current top parser stack node * Append text to last text child of current top parser stack node
*
* @access protected * @access protected
* @param string $text The text to append * @param string $text
* The text to append
* @return bool On success, the function returns true, else false * @return bool On success, the function returns true, else false
*/ */
function _appendToLastTextChild($text) { function _appendToLastTextChild($text) {
@ -689,7 +720,8 @@ class StringParser {
/** /**
* Searches {@link StringParser::_text _text} for every needle that is * Searches {@link StringParser::_text _text} for every needle that is
* specified by using the {@link PHP_MANUAL#strpos strpos} function. It * specified by using the {@link PHP_MANUAL#strpos strpos} function.
* It
* returns an associative array with the key <code>'needle'</code> * returns an associative array with the key <code>'needle'</code>
* pointing at the string that was found first and the key * pointing at the string that was found first and the key
* <code>'offset'</code> pointing at the offset at which the string was * <code>'offset'</code> pointing at the offset at which the string was
@ -717,15 +749,22 @@ class StringParser {
} }
} }
return array ($cur_needle, $cur_offset, 'needle' => $cur_needle, 'offset' => $cur_offset); return array(
$cur_needle,
$cur_offset,
'needle' => $cur_needle,
'offset' => $cur_offset
);
} }
/** /**
* Detects a string at the current position * Detects a string at the current position
* *
* @access protected * @access protected
* @param array $needles The strings that are to be detected * @param array $needles
* @param int $offset The current offset * The strings that are to be detected
* @param int $offset
* The current offset
* @return mixed The string that was detected or the needle * @return mixed The string that was detected or the needle
*/ */
function _strDetect($needles, $offset) { function _strDetect($needles, $offset) {
@ -738,12 +777,12 @@ class StringParser {
return false; return false;
} }
/** /**
* Adds a node to the current parse stack * Adds a node to the current parse stack
* *
* @access protected * @access protected
* @param object $node The node that is to be added * @param object $node
* The node that is to be added
* @return bool True on success, else false. * @return bool True on success, else false.
* @see StringParser_Node, StringParser::_stack * @see StringParser_Node, StringParser::_stack
*/ */
@ -783,7 +822,10 @@ class StringParser {
} }
$method = array_shift($args); $method = array_shift($args);
$stack_count = count($this->_stack); $stack_count = count($this->_stack);
$method = array (&$this->_stack[$stack_count-1], $method); $method = array(
&$this->_stack [$stack_count - 1],
$method
);
if (!is_callable($method)) { if (!is_callable($method)) {
return; // oops? return; // oops?
} }
@ -800,29 +842,35 @@ class StringParser {
$stack_count = count($this->_stack); $stack_count = count($this->_stack);
return $this->_stack [$stack_count - 1]->$var; return $this->_stack [$stack_count - 1]->$var;
} }
} }
/** /**
* Node type: Unknown node * Node type: Unknown node
*
* @see StringParser_Node::_type * @see StringParser_Node::_type
*/ */
define('STRINGPARSER_NODE_UNKNOWN', 0); define('STRINGPARSER_NODE_UNKNOWN', 0);
/** /**
* Node type: Root node * Node type: Root node
*
* @see StringParser_Node::_type * @see StringParser_Node::_type
*/ */
define('STRINGPARSER_NODE_ROOT', 1); define('STRINGPARSER_NODE_ROOT', 1);
/** /**
* Node type: Text node * Node type: Text node
*
* @see StringParser_Node::_type * @see StringParser_Node::_type
*/ */
define('STRINGPARSER_NODE_TEXT', 2); define('STRINGPARSER_NODE_TEXT', 2);
/** /**
* Global value that is a counter of string parser node ids. Compare it to a * Global value that is a counter of string parser node ids.
* Compare it to a
* sequence in databases. * sequence in databases.
*
* @var int * @var int
*/ */
$GLOBALS ['__STRINGPARSER_NODE_ID'] = 0; $GLOBALS ['__STRINGPARSER_NODE_ID'] = 0;
@ -839,6 +887,7 @@ $GLOBALS['__STRINGPARSER_NODE_ID'] = 0;
* @package stringparser * @package stringparser
*/ */
class StringParser_Node { class StringParser_Node {
/** /**
* The type of this node. * The type of this node.
* *
@ -909,7 +958,8 @@ class StringParser_Node {
* assigns it. * assigns it.
* *
* @access public * @access public
* @param int $occurredAt The position in the text where this node * @param int $occurredAt
* The position in the text where this node
* occurred at. If not determinable, it is -1. * occurred at. If not determinable, it is -1.
* @global __STRINGPARSER_NODE_ID * @global __STRINGPARSER_NODE_ID
*/ */
@ -934,7 +984,8 @@ class StringParser_Node {
* Prepend a node * Prepend a node
* *
* @access public * @access public
* @param object $node The node to be prepended. * @param object $node
* The node to be prepended.
* @return bool On success, the function returns true, else false. * @return bool On success, the function returns true, else false.
*/ */
function prependChild(&$node) { function prependChild(&$node) {
@ -975,8 +1026,10 @@ class StringParser_Node {
/** /**
* Append text to last text child * Append text to last text child
*
* @access public * @access public
* @param string $text The text to append * @param string $text
* The text to append
* @return bool On success, the function returns true, else false * @return bool On success, the function returns true, else false
*/ */
function appendToLastTextChild($text) { function appendToLastTextChild($text) {
@ -998,7 +1051,8 @@ class StringParser_Node {
* property of the node that is to be appended. * property of the node that is to be appended.
* *
* @access public * @access public
* @param object $node The node that is to be appended. * @param object $node
* The node that is to be appended.
* @return bool On success, the function returns true, else false. * @return bool On success, the function returns true, else false.
*/ */
function appendChild(&$node) { function appendChild(&$node) {
@ -1032,8 +1086,10 @@ class StringParser_Node {
* Insert a node before another node * Insert a node before another node
* *
* @access public * @access public
* @param object $node The node to be inserted. * @param object $node
* @param object $reference The reference node where the new node is * The node to be inserted.
* @param object $reference
* The reference node where the new node is
* to be inserted before. * to be inserted before.
* @return bool On success, the function returns true, else false. * @return bool On success, the function returns true, else false.
*/ */
@ -1084,8 +1140,10 @@ class StringParser_Node {
* Insert a node after another node * Insert a node after another node
* *
* @access public * @access public
* @param object $node The node to be inserted. * @param object $node
* @param object $reference The reference node where the new node is * The node to be inserted.
* @param object $reference
* The reference node where the new node is
* to be inserted after. * to be inserted after.
* @return bool On success, the function returns true, else false. * @return bool On success, the function returns true, else false.
*/ */
@ -1141,10 +1199,12 @@ class StringParser_Node {
* return false. * return false.
* *
* @access public * @access public
* @param mixed $child The child to destroy; either an integer * @param mixed $child
* The child to destroy; either an integer
* specifying the index of the child or a reference * specifying the index of the child or a reference
* to the child itself. * to the child itself.
* @param bool $destroy Destroy the child afterwards. * @param bool $destroy
* Destroy the child afterwards.
* @return bool On success, the function returns true, else false. * @return bool On success, the function returns true, else false.
*/ */
function removeChild(&$child, $destroy = false) { function removeChild(&$child, $destroy = false) {
@ -1178,8 +1238,7 @@ class StringParser_Node {
} }
// inkonsistency // inkonsistency
if ($this->_children[$child]->_parent === null || if ($this->_children [$child]->_parent === null || $this->_children [$child]->_parent->_id != $this->_id) {
$this->_children[$child]->_parent->_id != $this->_id) {
return false; return false;
} }
@ -1187,7 +1246,8 @@ class StringParser_Node {
// as $object->_parent is a reference to $this! // as $object->_parent is a reference to $this!
// because of this, we have to unset the variable to remove // because of this, we have to unset the variable to remove
// the reference and then redeclare the variable // the reference and then redeclare the variable
unset ($object->_parent); $object->_parent = null; unset($object->_parent);
$object->_parent = null;
// we have to unset it because else it will be overridden in // we have to unset it because else it will be overridden in
// in the loop // in the loop
@ -1248,7 +1308,8 @@ class StringParser_Node {
* *
* @access public * @access public
* @static * @static
* @param object $node The node to destroy * @param object $node
* The node to destroy
* @return bool True on success, else false. * @return bool True on success, else false.
*/ */
static function destroyNode(&$node) { static function destroyNode(&$node) {
@ -1304,7 +1365,8 @@ class StringParser_Node {
* node. * node.
* *
* @access protected * @access protected
* @param mixed $child The node to look for. * @param mixed $child
* The node to look for.
* @return mixed The index of the child node on success, else false. * @return mixed The index of the child node on success, else false.
*/ */
function _findChild(&$child) { function _findChild(&$child) {
@ -1326,7 +1388,8 @@ class StringParser_Node {
* Checks equality of this node and another node * Checks equality of this node and another node
* *
* @access public * @access public
* @param mixed $node The node to be compared with * @param mixed $node
* The node to be compared with
* @return bool True if the other node equals to this node, else false. * @return bool True if the other node equals to this node, else false.
*/ */
function equals(&$node) { function equals(&$node) {
@ -1337,8 +1400,10 @@ class StringParser_Node {
* Determines whether a criterium matches this node * Determines whether a criterium matches this node
* *
* @access public * @access public
* @param string $criterium The criterium that is to be checked * @param string $criterium
* @param mixed $value The value that is to be compared * The criterium that is to be checked
* @param mixed $value
* The value that is to be compared
* @return bool True if this node matches that criterium * @return bool True if this node matches that criterium
*/ */
function matchesCriterium($criterium, $value) { function matchesCriterium($criterium, $value) {
@ -1351,8 +1416,10 @@ class StringParser_Node {
* This may be used to implement getElementsByTagName etc. * This may be used to implement getElementsByTagName etc.
* *
* @access public * @access public
* @param string $criterium The criterium that is to be checked * @param string $criterium
* @param mixed $value The value that is to be compared * The criterium that is to be checked
* @param mixed $value
* The value that is to be compared
* @return array All subnodes that match this criterium * @return array All subnodes that match this criterium
*/ */
function &getNodesByCriterium($criterium, $value) { function &getNodesByCriterium($criterium, $value) {
@ -1381,8 +1448,10 @@ class StringParser_Node {
* Similar to getNodesByCriterium * Similar to getNodesByCriterium
* *
* @access public * @access public
* @param string $criterium The criterium that is to be checked * @param string $criterium
* @param mixed $value The value that is to be compared * The criterium that is to be checked
* @param mixed $value
* The value that is to be compared
* @return int The number of subnodes that match this criterium * @return int The number of subnodes that match this criterium
*/ */
function getNodeCountByCriterium($criterium, $value) { function getNodeCountByCriterium($criterium, $value) {
@ -1403,9 +1472,12 @@ class StringParser_Node {
* This dumps a tree of nodes * This dumps a tree of nodes
* *
* @access public * @access public
* @param string $prefix The prefix that is to be used for indentation * @param string $prefix
* @param string $linesep The line separator * The prefix that is to be used for indentation
* @param int $level The initial level of indentation * @param string $linesep
* The line separator
* @param int $level
* The initial level of indentation
* @return string * @return string
*/ */
function dump($prefix = " ", $linesep = "\n", $level = 0) { function dump($prefix = " ", $linesep = "\n", $level = 0) {
@ -1428,6 +1500,7 @@ class StringParser_Node {
} }
return (string) $this->_type; return (string) $this->_type;
} }
} }
/** /**
@ -1436,6 +1509,7 @@ class StringParser_Node {
* @package stringparser * @package stringparser
*/ */
class StringParser_Node_Root extends StringParser_Node { class StringParser_Node_Root extends StringParser_Node {
/** /**
* The type of this node. * The type of this node.
* *
@ -1446,6 +1520,7 @@ class StringParser_Node_Root extends StringParser_Node {
* @see STRINGPARSER_NODE_ROOT * @see STRINGPARSER_NODE_ROOT
*/ */
var $_type = STRINGPARSER_NODE_ROOT; var $_type = STRINGPARSER_NODE_ROOT;
} }
/** /**
@ -1454,6 +1529,7 @@ class StringParser_Node_Root extends StringParser_Node {
* @package stringparser * @package stringparser
*/ */
class StringParser_Node_Text extends StringParser_Node { class StringParser_Node_Text extends StringParser_Node {
/** /**
* The type of this node. * The type of this node.
* *
@ -1475,6 +1551,7 @@ class StringParser_Node_Text extends StringParser_Node {
/** /**
* The content of this node * The content of this node
*
* @access public * @access public
* @var string * @var string
*/ */
@ -1484,8 +1561,10 @@ class StringParser_Node_Text extends StringParser_Node {
* Constructor * Constructor
* *
* @access public * @access public
* @param string $content The initial content of this element * @param string $content
* @param int $occurredAt The position in the text where this node * The initial content of this element
* @param int $occurredAt
* The position in the text where this node
* occurred at. If not determinable, it is -1. * occurred at. If not determinable, it is -1.
* @see StringParser_Node_Text::content * @see StringParser_Node_Text::content
*/ */
@ -1498,7 +1577,8 @@ class StringParser_Node_Text extends StringParser_Node {
* Append text to content * Append text to content
* *
* @access public * @access public
* @param string $text The text to append * @param string $text
* The text to append
* @see StringParser_Node_Text::content * @see StringParser_Node_Text::content
*/ */
function appendText($text) { function appendText($text) {
@ -1509,8 +1589,10 @@ class StringParser_Node_Text extends StringParser_Node {
* Set a flag * Set a flag
* *
* @access public * @access public
* @param string $name The name of the flag * @param string $name
* @param mixed $value The value of the flag * The name of the flag
* @param mixed $value
* The value of the flag
*/ */
function setFlag($name, $value) { function setFlag($name, $value) {
$this->_flags [$name] = $value; $this->_flags [$name] = $value;
@ -1521,9 +1603,12 @@ class StringParser_Node_Text extends StringParser_Node {
* Get Flag * Get Flag
* *
* @access public * @access public
* @param string $flag The requested flag * @param string $flag
* @param string $type The requested type of the return value * The requested flag
* @param mixed $default The default return value * @param string $type
* The requested type of the return value
* @param mixed $default
* The default return value
*/ */
function getFlag($flag, $type = 'mixed', $default = null) { function getFlag($flag, $type = 'mixed', $default = null) {
if (!isset($this->_flags [$flag])) { if (!isset($this->_flags [$flag])) {
@ -1542,6 +1627,7 @@ class StringParser_Node_Text extends StringParser_Node {
function _dumpToString() { function _dumpToString() {
return "text \"" . substr(preg_replace('/\s+/', ' ', $this->content), 0, 40) . "\" [f:" . preg_replace('/\s+/', ' ', join(':', array_keys($this->_flags))) . "]"; return "text \"" . substr(preg_replace('/\s+/', ' ', $this->content), 0, 40) . "\" [f:" . preg_replace('/\s+/', ' ', join(':', array_keys($this->_flags))) . "]";
} }
} }
?> ?>