< script >< link > tag is pulled out from the header of html contents. function get_mod_header($contents) { $pattern = "]*?>(.*)<\/head>"; preg_match("/".$pattern."/s", $contents, $head_matches); $head_str = $head_matches[1]; $pattern = "]*?>(.*)<\/style>"; preg_match("/".$pattern."/s", $head_str, $style_matches); if (empty($style_matches[0])) $style = ''; else $style = $style_matches[0]; $pattern = ""; preg_match_all("/".$pattern."/", $head_str, $link_match,PREG_PATTERN_ORDER); $links = $link_match[0]; $link_str =''; foreach ( $links as $link){ ob_start(); echo $link . "\n"; $link_str .= ob_get_contents(); ob_end_clean(); } $pattern = "]*?>(.*)<\/script>"; preg_match_all("/".$pattern."/s", $head_str, $script_match,PREG_PATTERN_ORDER); $scripts = $script_match[0]; $script_str =''; foreach ( $scripts as $script){ if (($GLOBALS["xoopsModuleConfig"]['use_d3forum'] != 1) || (strpos($script,'function wpopen') ===false)) $script_str .= $script; } return $link_str."\n".$style . "\n" . $script_str ."\n"; } // get sidebar rendaring function get_sidebar_rander($name = null) { $templates = array(); if ( isset($name) ) $templates[] = "sidebar-{$name}.php"; $templates[] = "sidebar.php"; $link= locate_template($templates, false); if ('' == $link) $link = get_theme_root() . '/default/sidebar.php'; ob_start(); require($link); $sidebar = ob_get_contents(); ob_end_clean(); return $sidebar; } // < body > tag is pulled out from the header of html contents. function get_body($contents) { $xpess_config = new XPressME_Class(); $pattern = "]*?>(.*)<\/body>"; preg_match("/".$pattern."/s", $contents, $body_matches); $body = $body_matches[1]; if (!$xpess_config->is_theme_sidebar_disp){ $side_panel = get_sidebar_rander(); $body = str_replace($side_panel,'',$body); } return $body; } //Making of module header function get_xpress_module_header($contents) { global $xoopsTpl; if( defined( 'XOOPS_CUBE_LEGACY' ) ) { $preload_make_module_header = $xoopsTpl->get_template_vars('xoops_module_header'); } else { $preload_make_module_header = ''; } if (! empty($preload_make_module_header)){ $preload_make_module_header = ' ' . $preload_make_module_header . ' '; } $wp_module_header = ' ' . get_mod_header($contents) . ' '; return $preload_make_module_header . $wp_module_header; } //rendering for the module header and the body function xpress_render($contents){ global $xoops_config , $xoopsTpl; include $xoops_config->xoops_root_path ."/header.php"; $page_title = $GLOBALS["xoopsModule"]->getVar("name")." ".wp_title('»', false); $xoopsTpl->assign('xoops_module_header', get_xpress_module_header($contents)); $xoopsTpl->assign('xoops_pagetitle', $page_title); $xoopsTpl->assign('xpress_body_contents', get_body($contents)); echo get_body($contents); require_once( ABSPATH .'/include/xpress_breadcrumbs.php' ); include $xoops_config->xoops_root_path . '/footer.php'; } ?>