/** * Perform rendering */ function RenderItemAsHtml(&$params) { #echo '<hr style="border:1em solid blue;" />'; $this->use_auto_br = $this->Settings->get('br'); $this->add_p_in_block = $this->Settings->get('add_p_in_block'); $this->skip_tags = preg_split('~\\s+~', $this->Settings->get('skip_tags'), -1, PREG_SPLIT_NO_EMPTY); $content =& $params['data']; $content = preg_replace("~(\r\n|\r)~", "\n", $content); // cross-platform newlines // Handle blocks, splitted by content separators: [teaserbreak] or [pagebreak] $content_parts = split_outcode(array('[teaserbreak]', '[pagebreak]'), $content, true); $content_parts[] = ''; $content = ''; for ($i = 0; $i < count($content_parts); $i = $i + 2) { $content .= $this->handle_blocks($content_parts[$i]); $content .= $content_parts[$i + 1]; } return true; }
/** * Get content parts (split by "[teaserbreak]"). * * @param array 'disppage', 'format' * @return array Array of content parts */ function get_content_parts($params) { // Make sure we are not missing any param: $params = array_merge(array('disppage' => '#', 'format' => 'htmlbody'), $params); $content_page = $this->get_content_page($params['disppage'], $params['format']); // cannot include format_to_output() because of the magic below.. eg '[teaserbreak]' will get stripped in "xml" $content_parts = split_outcode('[teaserbreak]', $content_page); // Balance HTML tags $content_parts = array_map('balance_tags', $content_parts); return $content_parts; }