コード例 #1
0
ファイル: debugger.php プロジェクト: snitchashor/wp-united
 public function get_stats()
 {
     $wpuCache = WPU_Cache::getInstance();
     $endTime = explode(' ', microtime());
     $endTime = $endTime[1] + $endTime[0];
     $pageLoad = round($endTime - $this->scriptTime, 4) . " seconds";
     $memUsage = function_exists('memory_get_peak_usage') ? round(memory_get_peak_usage() / 1024, 0) . "kB" : function_exists('memory_get_usage') ? round(memory_get_usage() / 1024, 0) . "kB" : "[Not supported on your server]";
     return "<p style='clear: both;background-color: #999999;color: #ffffff !important;display: block;'><strong style='text-decoration: underline;'>WP-United Statistics </strong><br />Script Time: " . $pageLoad . "<br />Memory usage: " . $memUsage . "<br />" . $wpuCache->get_logged_actions() . "</p>";
 }
コード例 #2
0
/** 
*
* 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();
}
コード例 #3
0
ファイル: style-fixer.php プロジェクト: snitchashor/wp-united
$pos = request_var('pos', 'outer') == 'inner' ? 'inner' : 'outer';
$pkg = request_var('pkg', 'wp') == 'phpbb' ? 'phpbb' : 'wp';
$islandBlock = request_var('island', 0) == 1;
$cssFileToFix = request_var('style', 0);
$useTV = -1;
if (isset($_GET['tv']) && $pos == 'inner') {
    $useTV = request_var('tv', -1);
}
// require file late, so it doesn't load beore phpBB $config etc
require $phpbb_root_path . 'includes/hooks/hook_wp-united.' . $phpEx;
if (!isset($wpUnited) || !$wpUnited->get_plugin_path() || !file_exists($wpUnited->get_plugin_path()) || !$wpUnited->is_enabled()) {
    die('not setup properly');
}
// We load the bare minimum to get our data
require $wpUnited->get_plugin_path() . 'functions-css-magic.php';
$wpuCache = WPU_Cache::getInstance();
$cssFileToFix = $wpUnited->get_style_key($cssFileToFix);
/*
 * Some rudimentary additional security
 */
$cssFileToFix = str_replace("http:", "", $cssFileToFix);
$cssFileToFix = str_replace("//", "", $cssFileToFix);
$cssFileToFix = str_replace("@", "", $cssFileToFix);
$cssFileToFix = str_replace(".php", "", $cssFileToFix);
/**
 * Some stylesheets to ignore -- not uccrently used. Add terms here to prevent CSS Magic processing
 */
$ignoreMe = false;
$ignores = array();
foreach ($ignores as $ignore) {
    if (stristr($cssFileToFix, $ignore)) {
コード例 #4
0
 /**
  * Loads up the WordPress install, to just before the point that the template would be shown
  */
 public function enter_wp_integration()
 {
     global $wpUnited;
     //Tell phpBB that we're in WordPress. This controls the branching of the duplicate functions get_userdata and make_clickable
     $GLOBALS['IN_WORDPRESS'] = 1;
     $wpuCache = WPU_Cache::getInstance();
     /**
      * @since v0.8.0
      */
     foreach ($this->varsToUnsetAndRestore as $value) {
         if (isset($GLOBALS['value'])) {
             $this->sleepingVars[$value] = $GLOBALS[$value];
         }
     }
     // This is not strictly necessary, but it cleans up the vars we know are important to WP, or unsets variables we want to explicity get rid of.
     $toUnset = array_merge($this->varsToUnsetAndRestore, $this->varsToUnset);
     foreach ($toUnset as $varNames) {
         if (isset($GLOBALS[$varNames])) {
             unset($GLOBALS[$varNames]);
         }
     }
     //Override site cookie path if set in options.php
     if (defined('WP_ROOT_COOKIE') && WP_ROOT_COOKIE) {
         define('SITECOOKIEPATH', '/');
         define('COOKIEPATH', '/');
     }
     // do nothing if WP is already loaded
     if ($this->wpLoaded) {
         $this->prepare('$GLOBALS[\'phpbbForum\']->background();');
         return FALSE;
     }
     $this->wpLoaded = true;
     //Which version of WordPress are we about to load?
     global $wp_version;
     require $wpUnited->get_wp_path() . 'wp-includes/version.php';
     $this->wpVersion = $wp_version;
     global $user;
     // Added realpath to account for symlinks --
     //otherwise it is inconsistent with __FILE__ in WP, which causes plugin inconsistencies.
     $realAbsPath = realpath($wpUnited->get_wp_path());
     $realAbsPath = $realAbsPath[strlen($realAbsPath) - 1] == "/" ? $realAbsPath : $realAbsPath . "/";
     define('ABSPATH', $realAbsPath);
     //require_once($wpUnited->get_plugin_path() . 'plugin-fixer.php');
     if (!$this->core_cache_ready()) {
         // Now wp-config can be moved one level up, so we try that as well:
         $wpConfigLoc = !@file_exists($wpUnited->get_wp_path() . 'wp-config.php') ? $wpUnited->get_wp_path() . '../wp-config.php' : $wpUnited->get_wp_path() . 'wp-config.php';
         $cConf = file_get_contents($wpConfigLoc);
         $cSet = file_get_contents($wpUnited->get_wp_path() . 'wp-settings.php');
         //Handle the make clickable conflict
         if (@file_exists($wpUnited->get_wp_path() . 'wp-includes/formatting.php')) {
             $fName = 'formatting.php';
         } else {
             trigger_error($user->lang['Function_Duplicate']);
         }
         $cFor = file_get_contents($wpUnited->get_wp_path() . "wp-includes/{$fName}");
         $cFor = '?' . '>' . trim(str_replace('function make_clickable', 'function wp_make_clickable', $cFor)) . '[EOF]';
         $finds = array('require (ABSPATH . WPINC . ' . "'/{$fName}", 'require( ABSPATH . WPINC . ' . "'/{$fName}");
         $cSet = str_replace($finds, "{$cFor} // ", $cSet);
         unset($cFor);
         // Fix plugins
         if ($wpUnited->get_setting('pluginFixes')) {
             $strCompat = 'true';
             //($this->wpu_compat) ? "true" : "false";
             // Must-use Plugins
             $token = 'foreach ( wp_get_mu_plugins() as $mu_plugin ) {';
             if (strstr($cSet, $token)) {
                 $cSet = str_replace($token, '$GLOBALS[\'wpuMuPluginFixer\'] = new WPU_WP_Plugins(WPMU_PLUGIN_DIR, \'wpuMuPluginFixer\', \'' . $this->wpu_ver . '\', \'' . $this->wpVersion . '\', ' . $strCompat . ');' . "\n\n" . $token, $cSet);
                 $cSet = str_replace('include_once( $mu_plugin );', ' include_once( $GLOBALS[\'wpuMuPluginFixer\']->fix($mu_plugin, true));', $cSet);
             }
             // Multisite Plugins
             $token = 'foreach( wp_get_active_network_plugins() as $network_plugin )';
             if (strstr($cSet, $token)) {
                 $cSet = str_replace($token, '$GLOBALS[\'wpuMsPluginFixer\'] = new WPU_WP_Plugins(WPMU_PLUGIN_DIR, \'wpuMsPluginFixer\', \'' . $this->wpu_ver . '\', \'' . $this->wpVersion . '\', ' . $strCompat . ');' . "\n\n" . $token, $cSet);
                 $cSet = str_replace('include_once( $network_plugin );', ' include_once( $GLOBALS[\'wpuMsPluginFixer\']->fix($network_plugin, true));', $cSet);
             }
             //WP Plugins
             $token = 'foreach ( wp_get_active_and_valid_plugins() as $plugin )';
             if (strstr($cSet, $token)) {
                 $cSet = str_replace($token, '$GLOBALS[\'wpuPluginFixer\'] = new WPU_WP_Plugins(WP_PLUGIN_DIR, \'wpuPluginFixer\', \'' . $this->wpu_ver . '\', \'' . $this->wpVersion . '\', ' . $strCompat . ');' . "\n\n" . $token, $cSet);
                 $cSet = str_replace('include_once( $plugin );', ' include_once($GLOBALS[\'wpuPluginFixer\']->fix($plugin, true));', $cSet);
             }
             // Theme functions
             $token = 'if ( ! defined( \'WP_INSTALLING\' ) || \'wp-activate.php\' === $pagenow ) {';
             if (strstr($cSet, $token)) {
                 $cSet = str_replace($token, 'global $wpuStyleFixer; $wpuStyleFixer = new WPU_WP_Plugins(STYLESHEETPATH, \'wpuThemeFixer\', \'' . $this->wpu_ver . '\', \'' . $this->wpVersion . '\', ' . $strCompat . ');' . "\n" . 'global $wpuThemeFixer; $wpuThemeFixer = new WPU_WP_Plugins(TEMPLATEPATH, \'themes\', \'' . $this->wpu_ver . '\', \'' . $this->wpVersion . '\', ' . $strCompat . ');' . "\n\n" . $token, $cSet);
                 $cSet = str_replace('include( STYLESHEETPATH . \'/functions.php\' );', ' include_once($wpuStyleFixer->fix(STYLESHEETPATH . \'/functions.php\', true));', $cSet);
                 $cSet = str_replace('include( TEMPLATEPATH . \'/functions.php\' );', ' include_once($wpuThemeFixer->fix(TEMPLATEPATH . \'/functions.php\', true));', $cSet);
             }
         }
         /**
          * We want to defer initialisation of WP to later, so we wrap the last portion into a callable function
          */
         $cSet = str_replace(array('$wp->init()', '$GLOBALS[\'wp\']->init()'), 'function wpu_deferred_wp_load() { $GLOBALS[\'wp\']->init()', $cSet);
         $cSet = '?' . '>' . trim($cSet) . '[EOF]';
         $cConf = trim($cConf) . '[EOF]';
         //The callable function is closed here, in case any trailing content has been added to wp-config after the call to wp-settings.
         $cConf = str_replace('require_once', $cSet . ' // ', $cConf) . "\n" . '}' . '?' . '>';
         // replace EOFs  -- some versions of WP have closing ? >, others don't
         // We do it here to prevent expensive preg_replaces
         $cConf = str_replace(array('?' . '>[EOF]', '[EOF]'), array('?' . '><' . '?php ', ''), $cConf);
         $this->prepare($content = '?' . '>' . trim($cConf) . '<' . '?php');
         unset($cConf, $cSet);
         if ($wpuCache->core_cache_enabled()) {
             $wpuCache->save_to_core_cache($content, $this->wpVersion, $this->wpu_compat);
         }
     } else {
         $this->prepare('require_once(\'' . $wpuCache->coreCacheLoc . '\');');
     }
     if (defined('WPU_BOARD_DISABLED')) {
         $this->prepare('wp_die(\'' . WPU_BOARD_DISABLED . '\', \'' . $GLOBALS['user']->lang['BOARD_DISABLED'] . '\');');
     }
     return true;
 }
コード例 #5
0
ファイル: phpbb.php プロジェクト: snitchashor/wp-united
    /**
     * transmits new settings from the WP settings panel to phpBB
     */
    public function synchronise_settings($dataToStore)
    {
        global $wpUnited, $cache, $user, $auth, $config, $db, $phpbb_root_path, $phpEx;
        if (empty($dataToStore)) {
            echo "No settings to process";
            return false;
        }
        $fStateChanged = $this->foreground();
        $adminLog = array();
        $adminLog[] = __('Receiving settings from WP-United...', 'wp-united');
        /**
         * MySQL will not allow duplicate column names, so we can suppress errors (we still check anyway)
         */
        $db->sql_return_on_error(true);
        if (!array_key_exists('user_wpuint_id', $user->data)) {
            $sql = 'ALTER TABLE ' . USERS_TABLE . ' 
				  ADD user_wpuint_id VARCHAR(10) NULL DEFAULT NULL';
            @$db->sql_query($sql);
            $adminLog[] = __('Modified USERS Table (Integration ID)', 'wp-united');
        }
        if (!array_key_exists('user_wpublog_id', $user->data)) {
            $sql = 'ALTER TABLE ' . USERS_TABLE . ' 
				ADD user_wpublog_id VARCHAR(10) NULL DEFAULT NULL';
            @$db->sql_query($sql);
            $adminLog[] = __('Modified USERS Table (Blog ID)', 'wp-united');
        }
        //Add an x-posting column to topics
        $sql = 'SELECT * FROM ' . TOPICS_TABLE;
        $result = $db->sql_query_limit($sql, 1);
        $row = (array) $db->sql_fetchrow($result);
        $db->sql_freeresult($result);
        if (!array_key_exists('topic_wpu_xpost', $row)) {
            $sql = 'ALTER TABLE ' . TOPICS_TABLE . ' 
				ADD topic_wpu_xpost VARCHAR(10) NULL DEFAULT NULL';
            @$db->sql_query($sql);
            // Add new columns
            $sql = 'ALTER TABLE ' . POSTS_TABLE . ' 
				ADD post_wpu_xpost_parent VARCHAR(10) NULL DEFAULT NULL, 
				ADD post_wpu_xpost_meta1 VARCHAR(255) NULL DEFAULT NULL, 
				ADD post_wpu_xpost_meta2 VARCHAR(255) NULL DEFAULT NULL';
            @$db->sql_query($sql);
            $adminLog[] = __('Modified TOPICS and POSTS Tables (Cross-Posting ability)', 'wp-united');
        }
        $db->sql_return_on_error(false);
        $adminLog[] = __('Adding WP-United Permissions', 'wp-united');
        // Setup $auth_admin class so we can add permission options
        include_once $phpbb_root_path . 'includes/acp/auth.' . $phpEx;
        $auth_admin = new auth_admin();
        // Add permissions
        $auth_admin->acl_add_option(array('local' => array('f_wpu_xpost', 'f_wpu_xpost_comment'), 'global' => array('u_wpu_subscriber', 'u_wpu_contributor', 'u_wpu_author', 'm_wpu_editor', 'a_wpu_administrator')));
        $adminLog[] = __('Storing the new WP-United settings', 'wp-united');
        // this stores the passed-in settings object, which is a bit brittle
        // TODO: ask $wpUnited->settings to store/reload itself, without making it public
        $this->clear_settings();
        $sql = array();
        $sql[] = array('config_name' => 'wpu_location', 'config_value' => $wpUnited->get_plugin_path());
        $dataIn = base64_encode(gzcompress(serialize($dataToStore)));
        $currPtr = 1;
        $chunkStart = 0;
        while ($chunkStart < strlen($dataIn)) {
            $sql[] = array('config_name' => "wpu_settings_{$currPtr}", 'config_value' => substr($dataIn, $chunkStart, 255));
            $chunkStart = $chunkStart + 255;
            $currPtr++;
        }
        $db->sql_multi_insert(CONFIG_TABLE, $sql);
        $cache->destroy('config');
        if ($wpUnited->get_setting('integrateLogin') && $wpUnited->get_setting('avatarsync')) {
            if (!$config['allow_avatar'] || !$config['allow_avatar_remote']) {
                $adminLog[] = __('Updating avatar settings', 'wp-united');
                $sql = 'UPDATE ' . CONFIG_TABLE . ' 
					SET config_value = 1
					WHERE ' . $db->sql_in_set('config_name', array('allow_avatar', 'allow_avatar_remote'));
                $db->sql_query($sql);
                $cache->destroy('config');
            }
        }
        // clear out the WP-United cache on settings change
        $adminLog[] = __('Purging the WP-United cache', 'wp-united');
        $wpuCache = WPU_Cache::getInstance();
        $wpuCache->purge();
        $adminLog[] = __('Completed successfully', 'wp-united');
        // Save the admin log in a nice dropdown in phpBB admin log.
        // Requires a bit of template hacking using JS since we don't want to have to do a mod edit for new script
        // generate unique ID for details ID
        $randSeed = rand(0, 99999);
        $bodyContent = '<div style="display: none; border: 1px solid #cccccc; background-color: #ccccff; padding: 3px;" id="wpulogdets' . $randSeed . '">';
        $bodyContent .= implode("<br />\n\n", $adminLog) . '</div>';
        $ln = "*}<span class='wpulog'><script type=\"text/javascript\">// <![CDATA[\n\t\tvar d = document;\n\t\tfunction wputgl{$randSeed}() {\n\t\t\tvar l = d.getElementById('wpulogdets{$randSeed}');\n\t\t\tvar p = d.getElementById('wpulogexp{$randSeed}'); var n = p.firstChild.nodeValue;\n\t\t\tl.style.display = (n == '-') ? 'none' : 'block';\n\t\t\tp.firstChild.nodeValue = (n == '-') ? '+' : '-';\n\t\t\treturn false;\n\t\t}\n\t\tif(typeof wpual == 'undefined') {\n\t\t\tvar wpual = window.onload;\n\t\t\twindow.onload = function() {\n\t\t\t\tif (typeof wpual == 'function') wpual();\n\t\t\t\ttry {\n\t\t\t\t\tvar hs = d.getElementsByClassName('wpulog');\n\t\t\t\t\tfor(h in hs) {var p = hs[h].parentNode; p.firstChild.nodeValue = ''; p.lastChild.nodeValue = '';}\n\t\t\t\t} catch(e) {}\t  \n\t\t\t};\n\t\t}\n\t\t// ]]>\n\t\t</script>";
        $ln .= '<strong><a href="#" onclick="return wputgl' . $randSeed . '();" title="click to see details">' . __('Changed WP-United Settings (click for details)', 'wp-united') . '<span id="wpulogexp' . $randSeed . '">+</span></a></strong>' . $bodyContent . '</span>{*';
        add_log('admin', $ln);
        $cache->purge();
        $this->restore_state($fStateChanged);
        return true;
    }
コード例 #6
0
function apply_template_voodoo(&$cssMagic, $tplVoodooKey)
{
    $wpuCache = WPU_Cache::getInstance();
    $templateVoodoo = $wpuCache->get_template_voodoo($tplVoodooKey);
    if (empty($templateVoodoo)) {
        return false;
    }
    if (isset($templateVoodoo['classes']) && isset($templateVoodoo['ids'])) {
        $classDupes = $templateVoodoo['classes'];
        $idDupes = $templateVoodoo['ids'];
        $finds = array();
        $repl = array();
        foreach ($classDupes as $classDupe) {
            $finds[] = $classDupe;
            $repl[] = ".wpu" . substr($classDupe, 1);
        }
        foreach ($idDupes as $idDupe) {
            $finds[] = $idDupe;
            $repl[] = "#wpu" . substr($idDupe, 1);
        }
        $cssMagic->modifyKeys($finds, $repl);
    }
    return true;
}
コード例 #7
0
ファイル: wpu-actions.php プロジェクト: snitchashor/wp-united
 /**
  * Simple call to cache purge. We include it here so that phpBB core edits are static
  */
 public function purge_cache()
 {
     global $wpUnited, $phpEx;
     if (isset($wpUnited) && is_object($wpUnited) && $wpUnited->is_enabled()) {
         $wpuCache = WPU_Cache::getInstance();
         $wpuCache->purge();
     }
 }
コード例 #8
0
ファイル: plugin-main.php プロジェクト: snitchashor/wp-united
 /**
  * Clears phpbb's cache of WP header/footer.
  * We need to do this whenever the main WP theme is changed,
  * because when WordPress header/footer cache are called from phpBB, we have
  * no way of knowing what the theme should be a WordPress is not invoked
  * @return void
  */
 public function clear_header_cache()
 {
     $wpuCache = WPU_Cache::getInstance();
     $wpuCache->template_purge();
 }
コード例 #9
0
/**
 * Work-around for plugins that force exit.
 * Some plugins include an exit() command after outputting content.
 *
 *  In the Integration Class, we can try to detect these, and insert a wpu_complete()
 * prior to the exit(). 
 * 
 * This function tries to complete the remaining tasks as best possile so that
 * WordPress still appears inside the phpBB header/footer in these circumstances.
 */
function wpu_complete()
{
    global $wpUnited, $wpUtdInt;
    $wpuCache = WPU_Cache::getInstance();
    $wpUnited->set_wp_content(ob_get_contents());
    ob_end_clean();
    // clean up, go back to normal :-)
    if (!$wpuCache->use_template_cache()) {
        $wpUtdInt->exit_wp_integration();
        $wpUtdInt = null;
        unset($wpUtdInt);
    }
    require $wpUnited->get_plugin_path() . 'template-integrator.php';
}