/** * * Constructor. We override the Text_Wiki_Rule constructor so we can * explicitly comment each part of the $regex property. * * @access public * * @param object &$obj The calling "parent" Text_Wiki object. * * @param string $name The token name to use for this rule. * */ function Text_Wiki_Rule_wikilink(&$obj, $name) { parent::Text_Wiki_Rule($obj, $name); if (isset($this->_conf['numbers']) && $this->_conf['numbers']) { // allow numbers as "lowercase letters" in the regex $this->regex = "(!?" . "[A-Z]" . "[A-Za-z0-9]*" . "[a-z0-9]+" . "[A-Z]" . "[A-Za-z0-9]*" . ")" . "((\\#" . "[A-Za-z]" . "(" . "[-A-Za-z0-9_:.]*" . "[-A-Za-z0-9_]" . ")?)?)"; // end subpatterns (/4)(/3)(/2) } else { // no numbers allowed in the regex $this->regex = "(!?" . "[A-Z]" . "[A-Za-z]*" . "[a-z]+" . "[A-Z]" . "[A-Za-z]*" . ")" . "((\\#" . "[A-Za-z]" . "(" . "[-A-Za-z0-9_:.]*" . "[-A-Za-z0-9_]" . ")?)?)"; // end subpatterns (/4)(/3)(/2) } }
/** * * Constructor. Overrides the Text_Wiki_Rule constructor so that we * can set the $regex property dynamically (we need to include the * Text_Wiki $delim character. * * @param object &$obj The calling "parent" Text_Wiki object. * * @param string $name The token name to use for this rule. * */ function Text_Wiki_Rule_delimiter(&$obj, $name) { parent::Text_Wiki_Rule($obj, $name); $this->regex = '/' . $this->_wiki->delim . '/'; }
/** * * Constructor. We override the Text_Wiki_Rule constructor so we can * explicitly comment each part of the $regex property. * * @access public * * @param object &$obj The calling "parent" Text_Wiki object. * * @param string $name The token name to use for this rule. * */ function Text_Wiki_Rule_wikilink(&$obj, $name) { parent::Text_Wiki_Rule($obj, $name); $this->regex = "(!?" . "[A-Z]" . "[A-Za-z]*" . "[a-z]+" . "[A-Z]" . "[A-Za-z]*" . ")" . "((\\#" . "[A-Za-z]" . "(" . "[-A-Za-z0-9_:.]*" . "[-A-Za-z0-9_]" . ")?)?)"; // end subpatterns (/4)(/3)(/2) }
function Text_Wiki_Rule_url(&$obj, $name) { parent::Text_Wiki_Rule($obj, $name); $this->regex = "(http:\\/\\/|https:\\/\\/|ftp:\\/\\/|gopher:\\/\\/|news:\\/\\/|mailto:)" . "(" . "[^ \\/\"\\'{$this->_wiki->delim}]*\\/" . ")*" . "[^ \\t\\n\\/\"\\'{$this->_wiki->delim}]*" . "[A-Za-z0-9\\/?=&~_]"; }
/** * * Constructor. We override the Text_Wiki_Rule constructor so we can * explicitly comment each part of the $regex property. * * @access public * * @param object &$obj The calling "parent" Text_Wiki object. * * @param string $name The token name to use for this rule. * */ function Text_Wiki_Rule_freelink(&$obj, $name) { parent::Text_Wiki_Rule($obj, $name); $this->regex = '/' . "\\(\\(" . "(" . "[-A-Za-z0-9 _+\\/.,;:!?'\"\\[\\]\\{\\}&À-ÿ]+" . ")" . "(" . "\\|" . "[-A-Za-z0-9 _+\\/.,;:!?'\"\\[\\]\\{\\}&À-ÿ]+" . ")?" . "(" . "\\#" . "[A-Za-z]" . "[-A-Za-z0-9_:.]*" . ")?" . "()\\)\\)" . '/'; // END regex }
/** * * Custom parsing (have to process heading entries first). * * @access public * * @see Text_Wiki::parse() * */ function parse() { $this->_getEntries(); parent::parse(); }