'extra_lines_after' => 2, // extra line breaks after for block-level elements 'replace_phrase' => 'featured_replacement_code' // name of the phrase to replace with ), 'php' => array( 'extra_lines_after' => 2, 'replace_phrase' => 'featured_replacement_php' ), 'html' => array( 'extra_lines_after' => 2, 'replace_phrase' => 'featured_replacement_html' ) ); /** * Constructor. Sets up the tag list. * * @param vB_Registry Reference to registry object * @param array List of tags to parse * @param boolean Whether to append custom tags (they will not be parsed anyway) */ function vB_BbCodeParser_Blog_Snippet_Featured(&$registry, $tag_list = array(), $append_custom_tags = true) { parent::vB_BbCodeParser_Blog_Snippet($registry, $tag_list, $append_custom_tags); // change all unparsable tags to use the unparsable callback foreach (array_keys($this->undisplayable_tags) AS $remove) { if (isset($this->tag_list['option']["$remove"])) { $this->tag_list['option']["$remove"]['callback'] = 'handle_undisplayable_tag'; unset($this->tag_list['option']["$remove"]['html']); } if (isset($this->tag_list['no_option']["$remove"])) { $this->tag_list['no_option']["$remove"]['callback'] = 'handle_undisplayable_tag'; unset($this->tag_list['no_option']["$remove"]['html']); } } } /** * Parse an input string with BB code to a final output string of HTML * * @param string Input Text (BB code) * @param bool Whether to parse smilies * @param bool Whether to parse img (for the video bbcodes) * @param bool Whether to allow HTML (for smilies) * * @return string Ouput Text (HTML) */ function parse_bbcode($input_text, $do_smilies, $do_imgcode, $do_html = false) { global $vbulletin; $temp = $vbulletin->options['wordwrap']; $vbulletin->options['wordwrap'] = $vbulletin->options['blog_wordwrap']; if ($this->parse_userinfo['permissions']['vbblog_entry_permissions'] & $this->registry->bf_ugp_vbblog_entry_permissions['blog_allowhtml']) { $input_text = strip_tags($input_text, '
'); } $output = $this->parse_array( $this->make_snippet( $this->fix_tags($this->build_parse_array($input_text)), vbstrlen($input_text) ), $do_smilies, $do_imgcode, $do_html ); $vbulletin->options['wordwrap'] = $temp; return $output; } /** * Handles tags that would be unsuitable for the featured blog display, * mainly because of width constraints (due to the profile picture). * * @param string Text (ignored) * @param string Option (ignored) * * @return string Placeholder HTML */ function handle_undisplayable_tag($text, $option = '') { global $vbphrase; $tag_info = $this->undisplayable_tags[$this->current_tag['name']]; $output = ''; if (!empty($tag_info['extra_lines_before'])) { $output .= str_repeat("
\n", $tag_info['extra_lines_before']); } $output .= $vbphrase["$tag_info[replace_phrase]"]; if (!empty($tag_info['extra_lines_after'])) { $output .= str_repeat("
\n", $tag_info['extra_lines_after']); } return $output; } /** * Handles a [url] tag. Creates a link to another web page. * * @param string If tag has option, the displayable name. Else, the URL. * @param string If tag has option, the URL. * * @return string HTML representation of the tag. */ function handle_bbcode_url($text, $link) { global $vbphrase; $rightlink = trim($link); if (empty($rightlink)) { // no option -- use param $rightlink = trim($text); } $rightlink = str_replace(array('`', '"', "'", '['), array('`', '"', ''', '['), $this->strip_smilies($rightlink)); // remove double spaces -- fixes issues with wordwrap $rightlink = str_replace(' ', '', $rightlink); if (!preg_match('#^[a-z0-9]+(?$text"; } /** * Handles an [img] tag. * * @param string The text to search for an image in. * @param string Whether to parse matching images into pictures or just links. * * @return string HTML representation of the tag. */ function handle_bbcode_img($bbcode, $do_imgcode, $has_img_code = false) { global $vbphrase; if (($has_img_code & BBCODE_HAS_ATTACH) AND preg_match_all('#\[attach(?:=(.*))?\](\d+)\[/attach\]#i', $bbcode, $matches)) { $attachmentids = array(); foreach($matches[2] AS $key => $attachmentid) { $full = $align = false; $match = explode('|', $matches[1]["$key"]); if ($match[0] == 'right' OR $match[0] == 'left') { $align = $match[0]; } else if ($match[1] == 'right' OR $match[1] == 'left') { $align = $match[1]; } if ($match[0] == 'full' OR $match[1] == 'full') { $full = true; } if (!$full AND !$align) { $continue; }