示例#1
0
 /**
  * Constructor
  *
  * @access public
  * @param string $content 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.
  * @see StringParser_Node_Text::content
  */
 function StringParser_Node_Text($content, $occurredAt = -1)
 {
     parent::StringParser_Node($occurredAt);
     $this->content = $content;
 }
 /**
  * Determines whether a criterium matches this node
  *
  * @access public
  * @param string $criterium 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
  */
 function matchesCriterium($criterium, $value)
 {
     if ($criterium == 'tagName') {
         return $value == $this->_name;
     }
     if ($criterium == 'needsTextNodeModification') {
         return ($this->getFlag('opentag.before.newline', 'integer', BBCODE_NEWLINE_PARSE) != BBCODE_NEWLINE_PARSE || $this->getFlag('opentag.after.newline', 'integer', BBCODE_NEWLINE_PARSE) != BBCODE_NEWLINE_PARSE || $this->_hadCloseTag && ($this->getFlag('closetag.before.newline', 'integer', BBCODE_NEWLINE_PARSE) != BBCODE_NEWLINE_PARSE || $this->getFlag('closetag.after.newline', 'integer', BBCODE_NEWLINE_PARSE) != BBCODE_NEWLINE_PARSE)) == (bool) $value;
     }
     if (substr($criterium, 0, 5) == 'flag:') {
         $criterium = substr($criterium, 5);
         return $this->getFlag($criterium) == $value;
     }
     if (substr($criterium, 0, 6) == '!flag:') {
         $criterium = substr($criterium, 6);
         return $this->getFlag($criterium) != $value;
     }
     if (substr($criterium, 0, 6) == 'flag=:') {
         $criterium = substr($criterium, 6);
         return $this->getFlag($criterium) === $value;
     }
     if (substr($criterium, 0, 7) == '!flag=:') {
         $criterium = substr($criterium, 7);
         return $this->getFlag($criterium) !== $value;
     }
     return parent::matchesCriterium($criterium, $value);
 }
示例#3
0
 function __construct($content, $occurredAt = -1)
 {
     parent::__construct($occurredAt);
     $this->content = $content;
 }