function parse() { global $User; if (!in_array('code', $this->forbidden_tags)) { $this->_pick_up_tag('code', '=[A-Za-z0-9#+-]+(?:,[01]){0,2}'); } if (!in_array('html', $this->forbidden_tags) && $User->check_auth($this->html_auth, 1)) { $this->_pick_up_tag('html'); } $this->_prepare_content(); $this->_parse_tinymce_formatting(); if (!in_array('table', $this->forbidden_tags)) { $this->_parse_tables(); } $this->_parse_smilies(); $this->_parse_bbcode_tags(); $this->_correct(); if (!empty($this->array_tags['html'])) { $this->array_tags['html'] = array_map(create_function('$string', 'return str_replace("[html]", "<!-- START HTML -->\\n", str_replace("[/html]", "\\n<!-- END HTML -->", $string));'), $this->array_tags['html']); $this->array_tags['html'] = array_map(array('TinyMCEParser', '_clear_html_and_code_tag'), $this->array_tags['html']); $this->_reimplant_tag('html'); } parent::parse(); if (!empty($this->array_tags['code'])) { $this->array_tags['code'] = array_map(create_function('$string', 'return preg_replace(\'`^\\[code(=.+)?\\](.+)\\[/code\\]$`isU\', \'[[CODE$1]]$2[[/CODE]]\', htmlspecialchars($string, ENT_NOQUOTES, \'ISO-8859-1\'));'), $this->array_tags['code']); $this->array_tags['code'] = array_map(array('TinyMCEParser', '_clear_html_and_code_tag'), $this->array_tags['code']); $this->_reimplant_tag('code'); } }
function parse() { global $User; if (!in_array('code', $this->forbidden_tags)) { $this->_pick_up_tag('code', '=[A-Za-z0-9#+-]+(?:,[01]){0,2}'); } if (!in_array('html', $this->forbidden_tags) && $User->check_auth($this->html_auth, 1)) { $this->_pick_up_tag('html'); } $this->content = ' ' . $this->content . ' '; $this->_protect_content(); $this->_parse_smilies(); $this->content = nl2br($this->content); $this->_parse_simple_tags(); if (!in_array('table', $this->forbidden_tags) && strpos($this->content, '[table') !== false) { $this->_parse_table(); } if (!in_array('list', $this->forbidden_tags) && strpos($this->content, '[list') !== false) { $this->_parse_list(); } if (!empty($this->array_tags['html'])) { $this->array_tags['html'] = array_map(create_function('$string', 'return str_replace("[html]", "<!-- START HTML -->\\n", str_replace("[/html]", "\\n<!-- END HTML -->", $string));'), $this->array_tags['html']); $this->_reimplant_tag('html'); } parent::parse(); if (!empty($this->array_tags['code'])) { $this->array_tags['code'] = array_map(create_function('$string', 'return preg_replace(\'`^\\[code(=.+)?\\](.+)\\[/code\\]$`isU\', \'[[CODE$1]]$2[[/CODE]]\', htmlspecialchars($string, ENT_NOQUOTES, \'ISO-8859-1\'));'), $this->array_tags['code']); $this->_reimplant_tag('code'); } }
function _split_imbricated_tag(&$content, $tag, $attributes) { $content = ContentParser::_preg_split_safe_recurse($content, $tag, $attributes); $nbr_occur = count($content); for ($i = 0; $i < $nbr_occur; $i++) { if ($i % 3 === 2 && preg_match('`\\[' . $tag . '(?:' . $attributes . ')?\\].+\\[/' . $tag . '\\]`s', $content[$i])) { ContentParser::_split_imbricated_tag($content[$i], $tag, $attributes); } } }
static function parse_loop($page, $dir, $loop_html) { $files = Helpers::list_files($dir, '/^\\d+?\\./', true); $path = $page->link_path . preg_replace(array('/\\.\\.\\/content\\//', '/^\\d+?\\./'), '', $dir); $html = ''; foreach ($files as $key => $file) { // for each page within this category... $replacements = array('/@url/' => $path . '/' . preg_replace('/^\\d+?\\./', '', $file) . '/', '/@thumb/' => $page->link_path . 'content/' . self::check_thumb($dir, $file)); // create a MockPageInCategory to give us access to all the variables inside this PageInCategory $c = new ContentParser(); $category_page = new MockPageInCategory(preg_replace('/\\.\\.\\/content\\//', '', $dir), $file); $replacements = array_merge($replacements, $c->parse($category_page)); $html .= preg_replace(array_keys($replacements), array_values($replacements), $loop_html); } return $html; }