/** * Parses path * * @param string $path * @return mixed */ function w3_parse_path($path) { $path = str_replace(array('%BLOG_ID%', '%POST_ID%', '%BLOGNAME%', '%HOST%', '%DOMAIN%', '%BASE_PATH%'), array(isset($GLOBALS['blog_id']) ? (int) $GLOBALS['blog_id'] : 0, isset($GLOBALS['post_id']) ? (int) $GLOBALS['post_id'] : 0, w3_get_blogname(), w3_get_host(), w3_get_domain(w3_get_host()), trim(w3_get_base_path(), '/')), $path); return $path; }
/** * Returns cache key * * @param string $sql * @return string */ function _get_cache_key($sql) { $blogname = w3_get_blogname(); if ($blogname == '') { $blogname = $_SERVER['HTTP_HOST']; } return sprintf('w3tc_%s_sql_%s', md5($blogname), md5($sql)); }
/** * Returns page key * * @param string $request_uri * @param string $compression * @return string */ function _get_page_key($request_uri, $compression) { if ($this->_config->get_string('pgcache.engine') == 'file_pgcache') { $key = preg_replace('~[/\\\\]+~', '/', $key); $key = preg_replace('~\\?.*$~', '', $request_uri); $key = str_replace(w3_get_site_path(), '/', $key); $key = str_replace('/index.php', '/', $key); if ($key == '') { $key = '/'; } if (substr($key, -1) == '/') { $key .= '_default_.html'; } $key = ltrim($key, '/'); if (!empty($compression)) { $key .= '.' . $compression; } } else { $blogname = w3_get_blogname(); if ($blogname == '') { $blogname = $_SERVER['HTTP_HOST']; } $key = sprintf('w3tc_%s_page_%s', md5($blogname), md5($request_uri)); if (!empty($compression)) { $key .= '_' . $compression; } } return $key; }
define('W3TC_FEED_URL', 'http://feeds.feedburner.com/W3TOTALCACHE'); define('W3TC_README_URL', 'http://plugins.trac.wordpress.org/browser/w3-total-cache/trunk/readme.txt?format=txt'); define('W3TC_TWITTER_STATUS', 'I just optimized my #wordpress blog\'s #performance using the W3 Total Cache #plugin by @w3edge. Check it out! http://j.mp/A69xX'); define('W3TC_SUPPORT_US_TIMEOUT', 2592000); define('W3TC_PHP5', PHP_VERSION >= 5); define('W3TC_WIN', strtoupper(substr(PHP_OS, 0, 3)) === 'WIN'); defined('W3TC_DIR') || define('W3TC_DIR', realpath(dirname(__FILE__) . '/..')); define('W3TC_FILE', 'w3-total-cache/w3-total-cache.php'); define('W3TC_LIB_DIR', W3TC_DIR . '/lib'); define('W3TC_LIB_W3_DIR', W3TC_LIB_DIR . '/W3'); define('W3TC_LIB_MINIFY_DIR', W3TC_LIB_DIR . '/Minify'); define('W3TC_PLUGINS_DIR', W3TC_DIR . '/plugins'); define('W3TC_INSTALL_DIR', W3TC_DIR . '/wp-content'); define('W3TC_INSTALL_MINIFY_DIR', W3TC_INSTALL_DIR . '/w3tc/min'); $GLOBALS['w3_reserved_blognames'] = array('page', 'comments', 'blog', 'wp-admin', 'wp-includes', 'wp-content', 'files', 'feed'); define('W3TC_BLOGNAME', w3_get_blogname()); define('W3TC_PREFIX', W3TC_BLOGNAME != '' ? '-' . W3TC_BLOGNAME : ''); defined('WP_CONTENT_DIR') || define('WP_CONTENT_DIR', realpath(W3TC_DIR . '/../..')); define('WP_CONTENT_DIR_NAME', basename(WP_CONTENT_DIR)); define('W3TC_CONTENT_DIR_NAME', WP_CONTENT_DIR_NAME . '/w3tc' . W3TC_PREFIX); define('W3TC_CONTENT_DIR', ABSPATH . W3TC_CONTENT_DIR_NAME); define('W3TC_CONTENT_MINIFY_DIR_NAME', W3TC_CONTENT_DIR_NAME . '/min'); define('W3TC_CONTENT_MINIFY_DIR', ABSPATH . W3TC_CONTENT_DIR_NAME . '/min'); define('W3TC_CACHE_FILE_DBCACHE_DIR', W3TC_CONTENT_DIR . '/dbcache'); define('W3TC_CACHE_FILE_PGCACHE_DIR', W3TC_CONTENT_DIR . '/pgcache'); define('W3TC_CACHE_FILE_MINIFY_DIR', W3TC_CONTENT_DIR . '/min'); define('W3TC_LOG_DIR', W3TC_CONTENT_DIR . '/log'); define('W3TC_TMP_DIR', W3TC_CONTENT_DIR . '/tmp'); define('W3TC_CONFIG_PATH', WP_CONTENT_DIR . '/w3-total-cache-config' . W3TC_PREFIX . '.php'); define('W3TC_CONFIG_MASTER_PATH', WP_CONTENT_DIR . '/w3-total-cache-config.php'); define('W3TC_MINIFY_LOG_FILE', W3TC_LOG_DIR . '/minify.log');