/** * Parse the context content and replace wikiformatting * @return string $content */ function parse($txt, $args = array()) { if ($args) { foreach ($args as $index => $value) { $this->{$index} = $value; } } $txt = preg_replace_callback('/{{{(.*)}}}/siU', array(&$this, '__callbackMonospace'), $txt); $txt = preg_replace_callback("/^(={1,3})(.*)(={1,3})/m", array(&$this, '__callbackHeading'), $txt); $txt = preg_replace_callback('/(?<=^|\\n| )([\\!]?[A-Z]{1}[a-z]+([A-Z]{1}[a-z]+)+)/', array(&$this, '__callbackCamelCase'), $txt); // Underline $txt = preg_replace('/__(.*)__/iU', '<u>\\1</u>', $txt); // Deleting, strike through $txt = preg_replace('/~~(.*)~~/iU', '<del>\\1</del>', $txt); // Super text $txt = preg_replace('/\\^(.*)\\^/iU', '<sup>\\1</sup>', $txt); // Sub text $txt = preg_replace('/,,(.*),,/iU', '<sub>\\1</sub>', $txt); // Bold-Italic text $txt = preg_replace('/\'\'\'\'(.*)\'\'\'\'/iU', '<strong><em>\\1</em></strong>', $txt); // Bold text $txt = preg_replace('/\'\'\'(.*)\'\'\'/iU', '<strong>\\1</strong>', $txt); // Italic text $txt = preg_replace('/\'\'(.*)\'\'/iU', '<em>\\1</em>', $txt); $txt = preg_replace_callback("/\\[(http[s]?:\\/\\/.*)\\]/siU", array(&$this, '__callbackLink'), $txt); $txt = preg_replace_callback("/\\[img:(http[s]?:\\/\\/.*)\\]/siU", array(&$this, '__callbackImage'), $txt); $txt = preg_replace_callback("/\\[wiki:(.*)\\]/siU", array(&$this, '__callbackWiki'), $txt); // Horizontal Ruler $txt = preg_replace('/----/iU', '<hr size="1">', $txt); // $txt = preg_replace_callback("/[\!]?\{([0-9]+)\}|[\!]?report:([0-9]+)/siU", array(&$this,'__replaceReportLink'), $txt); // $txt = preg_replace_callback("/[\!]?#([0-9]+)|[\!]?topic:([0-9]+)/siU", array(&$this,'__replaceTopicLink'), $txt); // Line end. Hard enter $txt = preg_replace("/\\[\\[BR\\]\\]/siU", '<br />', $txt); $txt = preg_replace_callback("/(\\!)?\\[\\[([a-z0-9_]+)(\\(.*\\))?\\]\\]/siU", array(&$this, '__callbackPotion'), $txt); if (preg_match('/^([ ]+)\\*.*$/m', $txt)) { $txt = $this->__callbackUL($txt); } if (preg_match('/^([ ]+)(\\d+|a|i)\\..*$/m', $txt)) { $txt = $this->__callbackOL($txt); } return parent::parse($txt, array()); }