本文整理汇总了PHP中Util_Environment::home_domain_root_url方法的典型用法代码示例。如果您正苦于以下问题:PHP Util_Environment::home_domain_root_url方法的具体用法?PHP Util_Environment::home_domain_root_url怎么用?PHP Util_Environment::home_domain_root_url使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Util_Environment
的用法示例。
在下文中一共展示了Util_Environment::home_domain_root_url方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: purge_all
/**
* Purge CDN completely
*
* @param unknown $results
* @return bool
*/
function purge_all(&$results)
{
if (empty($this->_config['authorization_key'])) {
$results = $this->_get_results(array(), W3TC_CDN_RESULT_HALT, __('Empty Authorization Key.', 'w3-total-cache'));
return false;
}
if (empty($this->_config['alias']) || empty($this->_config['consumerkey']) || empty($this->_config['consumersecret'])) {
$results = $this->_get_results(array(), W3TC_CDN_RESULT_HALT, __('Malformed Authorization Key.', 'w3-total-cache'));
return false;
}
if (!class_exists('NetDNA')) {
require_once W3TC_LIB_NETDNA_DIR . '/NetDNA.php';
}
$api = new \NetDNA($this->_config['alias'], $this->_config['consumerkey'], $this->_config['consumersecret']);
$results = array();
try {
if ($this->_config['zone_id'] != 0) {
$zone_id = $this->_config['zone_id'];
} else {
$zone_id = $api->get_zone_id(get_home_url());
}
if ($zone_id == 0) {
$zone_id = $api->get_zone_id(Util_Environment::home_domain_root_url());
}
if ($zone_id == 0) {
$zone_id = $api->get_zone_id(str_replace('://', '://www.', Util_Environment::home_domain_root_url()));
}
if ($zone_id == 0 || is_null($zone_id)) {
if (Util_Environment::home_domain_root_url() == get_home_url()) {
$results[] = $this->_get_result('', '', W3TC_CDN_RESULT_ERROR, sprintf(__('No zones match site: %s.', 'w3-total-cache'), trim(get_home_url(), '/')));
} else {
$results[] = $this->_get_result('', '', W3TC_CDN_RESULT_ERROR, sprintf(__('No zones match site: %s or %s.', 'w3-total-cache'), trim(get_home_url(), '/'), trim(Util_Environment::home_domain_root_url(), '/')));
}
return !$this->_is_error($results);
}
$file_purge = json_decode($api->delete('/zones/pull.json/' . $zone_id . '/cache'));
if (preg_match("(200|201)", $file_purge->code)) {
$results[] = $this->_get_result('', '', W3TC_CDN_RESULT_OK, __('OK', 'w3-total-cache'));
} else {
if (preg_match("(401|500)", $file_purge->code)) {
$results[] = $this->_get_result('', '', W3TC_CDN_RESULT_ERROR, sprintf(__('Failed with error code %s. Please check your alias, consumer key, and private key.', 'w3-total-cache'), $file_purge->code));
} else {
$results[] = $this->_get_result('', '', W3TC_CDN_RESULT_ERROR, __('Failed with error code ', 'w3-total-cache') . $file_purge->code);
}
}
} catch (W3tcWpHttpException $e) {
$results[] = $this->_get_result('', '', W3TC_CDN_RESULT_HALT, __('Failure to pull zone: ', 'w3-total-cache') . $e->getMessage());
}
return !$this->_is_error($results);
}
示例2: get_groups
/**
* Returns minify groups
*
* @param string $theme
* @param string $template
* @param string $type
* @return array
*/
function get_groups($theme, $template, $type)
{
$result = array();
switch ($type) {
case 'css':
$groups = $this->_config->get_array('minify.css.groups');
break;
case 'js':
$groups = $this->_config->get_array('minify.js.groups');
break;
default:
return $result;
}
if (isset($groups[$theme]['default'])) {
$locations = (array) $groups[$theme]['default'];
} else {
$locations = array();
}
if ($template != 'default' && isset($groups[$theme][$template])) {
$locations = array_merge_recursive($locations, (array) $groups[$theme][$template]);
}
foreach ($locations as $location => $config) {
if (!empty($config['files'])) {
foreach ((array) $config['files'] as $url) {
if (!Util_Environment::is_url($url)) {
$url = Util_Environment::home_domain_root_url() . '/' . ltrim($url, '/');
}
$file = Util_Environment::url_to_docroot_filename($url);
if (Util_Environment::is_url($file)) {
$precached_file = $this->_precache_file($file, $type);
if ($precached_file) {
$result[$location][$file] = $precached_file;
} else {
Minify_Core::debug_error(sprintf('Unable to cache remote file: "%s"', $file));
}
} else {
$path = Util_Environment::document_root() . '/' . $file;
if (file_exists($path)) {
$result[$location][$file] = '//' . $file;
} else {
Minify_Core::debug_error(sprintf('File "%s" doesn\'t exist', $path));
}
}
}
}
}
return $result;
}
示例3: relative_path_to_url
/**
* Takes a root relative path and converts to a full uri
*
* @param unknown $path
* @return string
*/
function relative_path_to_url($path)
{
$cdnuri = $this->docroot_filename_to_uri(ltrim($path, "/"));
return rtrim(Util_Environment::home_domain_root_url(), "/") . '/' . $cdnuri;
}
示例4: get_server_info
/**
* Returns server info
*
* @return array
*/
private function get_server_info()
{
global $wp_version, $wp_db_version, $wpdb;
$wordpress_plugins = get_plugins();
$wordpress_plugins_active = array();
foreach ($wordpress_plugins as $wordpress_plugin_file => $wordpress_plugin) {
if (is_plugin_active($wordpress_plugin_file)) {
$wordpress_plugins_active[$wordpress_plugin_file] = $wordpress_plugin;
}
}
$mysql_version = $wpdb->get_var('SELECT VERSION()');
$mysql_variables_result = (array) $wpdb->get_results('SHOW VARIABLES', ARRAY_N);
$mysql_variables = array();
foreach ($mysql_variables_result as $mysql_variables_row) {
$mysql_variables[$mysql_variables_row[0]] = $mysql_variables_row[1];
}
$server_info = array('w3tc' => array('version' => W3TC_VERSION, 'server' => !empty($_SERVER['SERVER_SOFTWARE']) ? $_SERVER['SERVER_SOFTWARE'] : 'Unknown', 'dir' => W3TC_DIR, 'cache_dir' => W3TC_CACHE_DIR, 'blog_id' => Util_Environment::blog_id(), 'home_domain_root_url' => Util_Environment::home_domain_root_url(), 'home_url_maybe_https' => Util_Environment::home_url_maybe_https(), 'site_path' => Util_Environment::site_path(), 'document_root' => Util_Environment::document_root(), 'site_root' => Util_Environment::site_root(), 'site_url_uri' => Util_Environment::site_url_uri(), 'home_url_host' => Util_Environment::home_url_host(), 'home_url_uri' => Util_Environment::home_url_uri(), 'network_home_url_uri' => Util_Environment::network_home_url_uri(), 'host_port' => Util_Environment::host_port(), 'host' => Util_Environment::host(), 'wp_config_path' => Util_Environment::wp_config_path()), 'wp' => array('version' => $wp_version, 'db_version' => $wp_db_version, 'abspath' => ABSPATH, 'home' => get_option('home'), 'siteurl' => get_option('siteurl'), 'email' => get_option('admin_email'), 'upload_info' => (array) Util_Http::upload_info(), 'theme' => Util_Theme::get_current_theme(), 'wp_cache' => defined('WP_CACHE') && WP_CACHE ? 'true' : 'false', 'plugins' => $wordpress_plugins_active), 'mysql' => array('version' => $mysql_version, 'variables' => $mysql_variables));
return $server_info;
}
示例5: flush_post
//.........这里部分代码省略.........
case $this->_config->get_boolean('pgcache.purge.archive.monthly'):
case $this->_config->get_boolean('pgcache.purge.archive.yearly'):
case $this->_config->get_boolean('pgcache.purge.feed.author'):
$post = get_post($post_id);
}
$front_page = get_option('show_on_front');
/**
* Home (Frontpage) URL
*/
if ($this->_config->get_boolean('pgcache.purge.home') && $front_page == 'posts' || $this->_config->get_boolean('pgcache.purge.front_page')) {
$full_urls = array_merge($full_urls, Util_PageUrls::get_frontpage_urls($limit_post_pages));
}
/**
* Home (Post page) URL
*/
if ($this->_config->get_boolean('pgcache.purge.home') && $front_page != 'posts') {
$full_urls = array_merge($full_urls, Util_PageUrls::get_postpage_urls($limit_post_pages));
}
/**
* Post URL
*/
if ($this->_config->get_boolean('pgcache.purge.post')) {
$full_urls = array_merge($full_urls, Util_PageUrls::get_post_urls($post_id));
}
/**
* Post comments URLs
*/
if ($this->_config->get_boolean('pgcache.purge.comments') && function_exists('get_comments_pagenum_link')) {
$full_urls = array_merge($full_urls, Util_PageUrls::get_post_comments_urls($post_id));
}
/**
* Post author URLs
*/
if ($this->_config->get_boolean('pgcache.purge.author') && $post) {
$full_urls = array_merge($full_urls, Util_PageUrls::get_post_author_urls($post->post_author, $limit_post_pages));
}
/**
* Post terms URLs
*/
if ($this->_config->get_boolean('pgcache.purge.terms')) {
$full_urls = array_merge($full_urls, Util_PageUrls::get_post_terms_urls($terms, $limit_post_pages));
}
/**
* Daily archive URLs
*/
if ($this->_config->get_boolean('pgcache.purge.archive.daily') && $post) {
$full_urls = array_merge($full_urls, Util_PageUrls::get_daily_archive_urls($post, $limit_post_pages));
}
/**
* Monthly archive URLs
*/
if ($this->_config->get_boolean('pgcache.purge.archive.monthly') && $post) {
$full_urls = array_merge($full_urls, Util_PageUrls::get_monthly_archive_urls($post, $limit_post_pages));
}
/**
* Yearly archive URLs
*/
if ($this->_config->get_boolean('pgcache.purge.archive.yearly') && $post) {
$full_urls = array_merge($full_urls, Util_PageUrls::get_yearly_archive_urls($post, $limit_post_pages));
}
/**
* Feed URLs
*/
if ($this->_config->get_boolean('pgcache.purge.feed.blog')) {
$full_urls = array_merge($full_urls, Util_PageUrls::get_feed_urls($feeds));
}
if ($this->_config->get_boolean('pgcache.purge.feed.comments')) {
$full_urls = array_merge($full_urls, Util_PageUrls::get_feed_comments_urls($post_id, $feeds));
}
if ($this->_config->get_boolean('pgcache.purge.feed.author') && $post) {
$full_urls = array_merge($full_urls, Util_PageUrls::get_feed_author_urls($post->post_author, $feeds));
}
if ($this->_config->get_boolean('pgcache.purge.feed.terms')) {
$full_urls = array_merge($full_urls, Util_PageUrls::get_feed_terms_urls($terms, $feeds));
}
/**
* Purge selected pages
*/
if ($this->_config->get_array('pgcache.purge.pages')) {
$pages = $this->_config->get_array('pgcache.purge.pages');
$full_urls = array_merge($full_urls, Util_PageUrls::get_pages_urls($pages));
}
if ($this->_config->get_string('pgcache.purge.sitemap_regex')) {
$sitemap_regex = $this->_config->get_string('pgcache.purge.sitemap_regex');
$full_urls[] = Util_Environment::home_domain_root_url() . '/' . trim($sitemap_regex, "^\$");
}
/**
* Queue flush
*/
if (count($full_urls)) {
foreach ($full_urls as $url) {
$this->queued_urls[$url] = '*';
}
// add mirror urls
$this->queued_urls = Util_PageUrls::complement_with_mirror_urls($this->queued_urls);
}
return true;
}
return false;
}
示例6: home_domain_root_url_regexp
/**
* Returns domain url regexp
*
* @return string
*/
public static function home_domain_root_url_regexp()
{
$domain_url = Util_Environment::home_domain_root_url();
$regexp = Util_Environment::get_url_regexp($domain_url);
return $regexp;
}
示例7: get_yearly_archive_urls
/**
* Return full urls for yearly archive pages based on provided post
*
* @param unknown $post
* @param int $limit_post_pages default is 10
* @return array
*/
public static function get_yearly_archive_urls($post, $limit_post_pages = 10)
{
static $yearly_archive_urls = array();
$post_type = $post->post_type;
$archive_slug = self::_get_archive_slug($post);
$key = md5($post->ID . ',' . $limit_post_pages);
if (!isset($yearly_archive_urls[$key])) {
$full_urls = array();
$post_date = strtotime($post->post_date);
$post_year = gmdate('Y', $post_date);
$posts_per_page = get_option('posts_per_page');
$posts_number = self::get_archive_posts_count($post_year, '', '', $post_type);
$posts_pages_number = @ceil($posts_number / $posts_per_page);
if ($limit_post_pages > 0 && $posts_pages_number > $limit_post_pages) {
$posts_pages_number = $limit_post_pages;
}
$year_link = get_year_link($post_year);
$year_uri = $archive_slug . str_replace(Util_Environment::home_domain_root_url(), '', $year_link);
for ($pagenum = 1; $pagenum <= $posts_pages_number; $pagenum++) {
$year_pagenum_link = self::get_pagenum_link($year_uri, $pagenum);
$full_urls[] = $year_pagenum_link;
}
$yearly_archive_urls[$key] = $full_urls;
}
return $yearly_archive_urls[$key];
}