function html2xhtml($html)
{
    process_pagebreak_commands($html);
    // Remove SCRIPT tags from the page being processed, as script content may
    // mess the firther html-parsing utilities
    $html = process_script($html);
    // Remove STYLE tags for the same reason and store them in the temporary variable
    // later they will be added back to HEAD section
    $styles = process_style($html);
    // Convert HTML character references to their Unicode analogues
    process_character_references($html);
    remove_comments($html);
    fix_attrs_spaces($html);
    $html = quote_attrs($html);
    $html = escape_attrs_entities($html);
    $html = lowercase_tags($html);
    $html = lowercase_closing_tags($html);
    $html = fix_closing_tags($html);
    $html = close_tag("area", $html);
    $html = close_tag("base", $html);
    $html = close_tag("basefont", $html);
    $html = close_tag("br", $html);
    $html = close_tag("col", $html);
    $html = close_tag("embed", $html);
    $html = close_tag("frame", $html);
    $html = close_tag("hr", $html);
    $html = close_tag("img", $html);
    $html = close_tag("input", $html);
    $html = close_tag("isindex", $html);
    $html = close_tag("link", $html);
    $html = close_tag("meta", $html);
    $html = close_tag("param", $html);
    $html = make_attr_value("checked", $html);
    $html = make_attr_value("compact", $html);
    $html = make_attr_value("declare", $html);
    $html = make_attr_value("defer", $html);
    $html = make_attr_value("disabled", $html);
    $html = make_attr_value("ismap", $html);
    $html = make_attr_value("multiple", $html);
    $html = make_attr_value("nohref", $html);
    $html = make_attr_value("noresize", $html);
    $html = make_attr_value("noshade", $html);
    $html = make_attr_value("nowrap", $html);
    $html = make_attr_value("readonly", $html);
    $html = make_attr_value("selected", $html);
    $html = process_html($html);
    $html = process_body($html);
    $html = process_head($html);
    $html = process_p($html);
    $html = escape_amp($html);
    $html = escape_lt($html);
    $html = escape_gt($html);
    $html = escape_textarea_content($html);
    process_tables($html, 0);
    process_lists($html, 0);
    process_deflists($html, 0);
    process_selects($html, 0);
    $html = fix_tags($html);
    $html = fix_attrs($html);
    $html = insert_styles($html, $styles);
    return $html;
}
/** 
*
* WP-United Main Integration  -- template portion
*
* @package WP-United
* @version $Id: 0.9.1.5  2012/12/28 John Wells (Jhong) Exp $
* @copyright (c) 2006-2013 wp-united.com
* @license http://opensource.org/licenses/gpl-license.php GNU Public License  
* @author John Wells
* 
* Here we modify and integrate templates as necessary. 
* 
*/
function wpu_integrate_templates()
{
    global $wpuNoHead, $wpUnited, $wpUnited, $wpuSetWPSignature;
    $wpuCache = WPU_Cache::getInstance();
    $wpuSetWPSignature = '';
    $bodyClass = '';
    $bodyDetails = '';
    if ($wpuCache->use_template_cache() || $wpUnited->ran_patched_wordpress()) {
        wpu_get_wordpress();
    }
    /**
     *  Just output WordPress if $wpuNoHead or if an ajax call, etc.
     */
    $content = $wpUnited->get_wp_content();
    if (!stristr($content, '<body')) {
        $wpuNoHead = true;
    }
    if ($wpuNoHead) {
        wpu_output_page($content);
    }
    if (!$wpUnited->should_do_action('template-p-in-w') && $wpUnited->get_setting('showHdrFtr') != 'FWD') {
        return;
    }
    /**
     * Get phpBB header/footer
     */
    if ($wpUnited->should_do_action('template-w-in-p') && !$wpuNoHead) {
        wpu_process_phpbb();
    }
    wpu_fix_wp_template();
    $wpUnited->add_boilerplate();
    /** 
     * Make modifications to inner content, and extract items for interleaving into outer content <head>
     */
    if ($wpUnited->should_do_action('template-p-in-w') || $wpUnited->get_setting('showHdrFtr') == 'FWD') {
        // phpBB is inner:
        //Get ltr, rtl & bgcolor, etc, from the body tag
        preg_match('/<body[^>]+>/i', $wpUnited->get_inner_content(), $pfBodyMatches);
        if (isset($pfBodyMatches[0])) {
            $bodyDetails = trim(str_replace(array('<body', '>'), '', $pfBodyMatches[0]));
            preg_match('/class\\s*=\\s*"[^"]+"/', $bodyDetails, $bodyClass);
            if (isset($bodyClass[0])) {
                $bodyDetails = str_replace($bodyClass[0], "", $bodyDetails);
                $bodyClass = trim(str_replace(array('class', '=', '"'), '', $bodyClass[0]));
            }
        }
        // process_remove_head removes the <head> during the process, leaving us with an insertable body (hehe).
        $wpUnited->set_inner_headinfo(process_remove_head($wpUnited->get_inner_content()));
        $innerContent = $wpUnited->get_inner_content();
        // get any signature added by WordPress after /html, e.g. WP_CUSTOMIZER_SIGNATURE  (... ffs)
        if ($wpUnited->should_do_action('template-w-in-p')) {
            preg_match('/<\\/html>(.*)/i', $innerContent, $sigs);
            if (is_array($sigs) && isset($sigs[1])) {
                $wpuSetWPSignature = $sigs[1];
                $innerContent = str_replace('</html>' . $sigs[1], '</html>', $innerContent);
            }
        }
        $wpUnited->set_inner_content(process_body($innerContent));
    }
    if ($wpUnited->should_do_action('template-p-in-w')) {
        //  Now we modify parts of the outer head -- changing the <html> tag and the title
        $outerContent = $wpUnited->get_outer_content();
        // First look for lang and direction attributes
        preg_match('/<html[^>]+>/i', $outerContent, $outerHtmlTag);
        if (isset($outerHrmlTag[0]) && $outerHtmlTag[0]) {
            $repl = '';
            global $user;
            if (stristr($outerHtmlTag[0], 'lang=') === false) {
                $repl = 'lang="' . $user->lang['USER_LANG'] . '" ';
            }
            if (stristr($outerHtmlTag[0], 'dir=') === false) {
                $repl = 'dir="' . $user->lang['DIRECTION'] . '" ';
            }
            // This only works on PHP 5:
            $outerContent = str_ireplace('<html', '<html ' . $repl, $outerContent);
        }
        // Now we replace the outer title with phpBB title
        $wpUnited->set_outer_content(preg_replace('/<title>[^<]*<\\/title>/i', '<title><!--[**PAGE_TITLE**]--></title>', $outerContent));
    }
    // So, we generate the phpBB outer page if required, then we're all set.
    if ($wpUnited->get_setting('cssMagic')) {
        require $wpUnited->get_plugin_path() . 'css-magic.php';
        require $wpUnited->get_plugin_path() . 'functions-css-magic.php';
        wpu_css_magic();
    }
    //Wrap inner content in CSS Magic, padding, etc.
    $padding = '';
    if ($wpUnited->should_do_action('template-p-in-w') && $wpUnited->get_setting('phpbbPadding') != 'NOT_SET') {
        $pad = explode('-', $wpUnited->get_setting('phpbbPadding'));
        $padding = 'padding: ' . (int) $pad[0] . 'px ' . (int) $pad[1] . 'px ' . (int) $pad[2] . 'px ' . (int) $pad[3] . 'px;';
    }
    if ($wpUnited->get_setting('cssMagic')) {
        $wpuOutputPreStr = '<div id="wpucssmagic" style="' . $padding . 'margin: 0;"><div class="wpucssmagic"><div class="' . $bodyClass . '" ' . $bodyDetails . '>';
        $wpuOutputPostStr = '</div></div></div>';
    } else {
        $wpuOutputPreStr = '<div style="' . $padding . ' margin: 0px;" class="' . $bodyClass . '" ' . $bodyDetails . '>';
        $wpuOutputPostStr = '</div>';
    }
    // If the WP theme didn't set the head marker, do it now
    if (!DISABLE_PHPBB_CSS) {
        $headMarker = '<!--[**HEAD_MARKER**]-->';
        if (PHPBB_CSS_FIRST) {
            $wpUnited->set_outer_content(str_replace('</title>', '</title>' . "\n\n" . $headMarker . "\n\n", $wpUnited->get_outer_content()));
        } else {
            if (strstr($wpUnited->get_outer_content(), $headMarker) === false) {
                $headMarker = '</head>';
                $wpUnited->set_inner_headinfo($wpUnited->get_inner_headinfo() . "\n\n</head>");
            }
        }
        $wpUnited->set_outer_content(str_replace($headMarker, $wpUnited->get_inner_headinfo(), $wpUnited->get_outer_content()));
    }
    $wpUnited->set_outer_content(str_replace('<!--[**INNER_CONTENT**]-->', $wpuOutputPreStr . $wpUnited->get_inner_content() . $wpuOutputPostStr, $wpUnited->get_outer_content()));
    $wpUnited->clear_inner_content();
    wpu_output_page($wpUnited->get_outer_content());
    $wpUnited->clear_outer_content();
}
    $wpuAbs->add_template_switch('PHPBB_BASE', $scriptPath);
    //Char Encoding
    if ('PHPBB2' == $wpuAbs->ver) {
        if ($wpSettings['charEncoding'] == 'MATCH_WP') {
            $lang['ENCODING'] = get_option('blog_charset');
        }
    }
    if ('PHPBB2' == $wpuAbs->ver) {
        include $phpbb_root_path . 'includes/page_header.' . $phpEx;
    } else {
        global $wpu_page_title;
        page_header($wpu_page_title);
    }
    //free memory
    unset($wpHdrInfo);
    $retWpInc = process_body($retWpInc);
    // include page structure for phpBB
    $wpuAbs->add_template_switch('S_SHOW_HDR_FTR', TRUE);
}
//Some login/logout links are hard-coded into the WP templates. We fix them here:
if (!empty($wpSettings['integrateLogin'])) {
    if ($wpuAbs->ver == 'PHPBB2') {
        $login_link = 'login.' . $phpEx . '?redirect=wp-united-blog&amp;sid=' . $phpbb_sid . '&amp;d=';
    } else {
        $login_link = 'ucp.' . $phpEx . '?mode=login&amp;sid=' . $phpbb_sid . '&amp;redirect=';
    }
    // only phpBB3 can redirect properly
    $retWpInc = str_replace("{$siteurl}/wp-login.php?redirect_to=", $scriptPath . $login_link, $retWpInc);
    $retWpInc = str_replace("{$siteurl}/wp-login.php?redirect_to=", $scriptPath . $login_link, $retWpInc);
    $retWpInc = str_replace("{$siteurl}/wp-login.php?action=logout", $scriptPath . $logout_link, $retWpInc);
}
Example #4
0
if($uu->id)
{

// 1. split into sections based by '++'
// 2. trim whitespace
// 3. convert from markdown to html
function process_body($b)
{
	$b = trim($b);
	$b = Markdown::defaultTransform($b);
	return $b;
}
$body = $item["body"];
$body_arr = explode("++", $body);
for($i = 0; $i < count($body_arr); $i++)
	$body_arr[$i] = process_body($body_arr[$i]);


?>
<div id="report"><?
	$i = 0;
	foreach($body_arr as $b)
	{
		if($i % 2 == 0)
		{ ?><div class="column-container"><? }
		?><div class="twocolumn"><? echo $b; ?></div><?
		if($i % 2 != 0)
		{ ?></div><? }
		$i++;
	}
?></div><?
Example #5
0
use Michelf\Markdown;
// 1. split into sections based by '++'
// 2. trim whitespace
// 3. convert from markdown to html
function process_body($b)
{
    $columns = explode("++", $b);
    foreach ($columns as &$b) {
        $b = trim($b);
        $b = Markdown::defaultTransform($b);
    }
    return $columns;
}
$objects = $oo->get($uu->id);
$body = $objects["body"];
$columns = process_body($body);
$media = $oo->media($uu->id);
if ($show_menu) {
    ?>
<section id="body" class="hidden"><?php 
} else {
    ?>
<section id="body" class="visible"><?php 
}
?>
<div id="breadcrumbs">
		<ul class="nav-level">
			<li><?php 
if (!$uu->id) {
    ?>
 O-R-G is a small software company.<a href="*">*&nbsp;</a><?php