本文整理汇总了PHP中w3_get_domain_url函数的典型用法代码示例。如果您正苦于以下问题:PHP w3_get_domain_url函数的具体用法?PHP w3_get_domain_url怎么用?PHP w3_get_domain_url使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了w3_get_domain_url函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: flush_post
/**
* Flushes post cache
*
* @param integer $post_id
* @return boolean
*/
function flush_post($post_id = null)
{
if (!$post_id) {
$post_id = $this->_detect_post_id();
}
if ($post_id) {
$uris = array();
$domain_url = w3_get_domain_url();
$feeds = $this->_config->get_array('pgcache.purge.feed.types');
if ($this->_config->get_boolean('pgcache.purge.terms') || $this->_config->get_boolean('pgcache.purge.feed.terms')) {
$taxonomies = get_post_taxonomies($post_id);
$terms = nxt_get_post_terms($post_id, $taxonomies);
}
switch (true) {
case $this->_config->get_boolean('pgcache.purge.author'):
case $this->_config->get_boolean('pgcache.purge.archive.daily'):
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);
}
/**
* Home URL
*/
if ($this->_config->get_boolean('pgcache.purge.home')) {
$home_path = w3_get_home_path();
$site_path = w3_get_site_path();
$uris[] = $home_path;
if ($site_path != $home_path) {
$uris[] = $site_path;
}
}
/**
* Post URL
*/
if ($this->_config->get_boolean('pgcache.purge.post')) {
$post_link = post_permalink($post_id);
$post_uri = str_replace($domain_url, '', $post_link);
$uris[] = $post_uri;
}
/**
* Post comments URLs
*/
if ($this->_config->get_boolean('pgcache.purge.comments') && function_exists('get_comments_pagenum_link')) {
$comments_number = get_comments_number($post_id);
$comments_per_page = get_option('comments_per_page');
$comments_pages_number = @ceil($comments_number / $comments_per_page);
for ($pagenum = 1; $pagenum <= $comments_pages_number; $pagenum++) {
$comments_pagenum_link = $this->_get_comments_pagenum_link($post_id, $pagenum);
$comments_pagenum_uri = str_replace($domain_url, '', $comments_pagenum_link);
$uris[] = $comments_pagenum_uri;
}
}
/**
* Post author URLs
*/
if ($this->_config->get_boolean('pgcache.purge.author') && $post) {
$posts_number = count_user_posts($post->post_author);
$posts_per_page = get_option('posts_per_page');
$posts_pages_number = @ceil($posts_number / $posts_per_page);
$author_link = get_author_link(false, $post->post_author);
$author_uri = str_replace($domain_url, '', $author_link);
for ($pagenum = 1; $pagenum <= $posts_pages_number; $pagenum++) {
$author_pagenum_link = $this->_get_pagenum_link($author_uri, $pagenum);
$author_pagenum_uri = str_replace($domain_url, '', $author_pagenum_link);
$uris[] = $author_pagenum_uri;
}
}
/**
* Post terms URLs
*/
if ($this->_config->get_boolean('pgcache.purge.terms')) {
$posts_per_page = get_option('posts_per_page');
foreach ($terms as $term) {
$term_link = get_term_link($term, $term->taxonomy);
$term_uri = str_replace($domain_url, '', $term_link);
$posts_pages_number = @ceil($term->count / $posts_per_page);
for ($pagenum = 1; $pagenum <= $posts_pages_number; $pagenum++) {
$term_pagenum_link = $this->_get_pagenum_link($term_uri, $pagenum);
$term_pagenum_uri = str_replace($domain_url, '', $term_pagenum_link);
$uris[] = $term_pagenum_uri;
}
}
}
/**
* Daily archive URLs
*/
if ($this->_config->get_boolean('pgcache.purge.archive.daily') && $post) {
$post_date = strtotime($post->post_date);
$post_year = gmdate('Y', $post_date);
$post_month = gmdate('m', $post_date);
$post_day = gmdate('d', $post_date);
$posts_per_page = get_option('posts_per_page');
$posts_number = $this->_get_archive_posts_count($post_year, $post_month, $post_day);
//.........这里部分代码省略.........
开发者ID:nxtclass,项目名称:NXTClass,代码行数:101,代码来源:PgCacheFlush.php
示例2: action_support_form
/**
* Support form action
*
* @return void
*/
function action_support_form()
{
global $current_user;
w3_require_once(W3TC_LIB_W3_DIR . '/Request.php');
$name = '';
$email = '';
$request_type = W3_Request::get_string('request_type');
if (!isset($this->_request_types[$request_type])) {
$request_type = 'bug_report';
}
if (is_a($current_user, 'WP_User')) {
if ($current_user->first_name) {
$name = $current_user->first_name;
}
if ($current_user->last_name) {
$name .= ($name != '' ? ' ' : '') . $current_user->last_name;
}
if ($name == 'admin') {
$name = '';
}
if ($current_user->user_email) {
$email = $current_user->user_email;
}
}
$theme = w3tc_get_current_theme();
$template_files = isset($theme['Template Files']) ? (array) $theme['Template Files'] : array();
$ajax = W3_Request::get_boolean('ajax');
$request_id = W3_Request::get_string('request_id', date('YmdHi'));
$payment = W3_Request::get_boolean('payment');
$url = W3_Request::get_string('url', w3_get_domain_url());
$name = W3_Request::get_string('name', $name);
$email = W3_Request::get_string('email', $email);
$twitter = W3_Request::get_string('twitter');
$phone = W3_Request::get_string('phone');
$subject = W3_Request::get_string('subject');
$description = W3_Request::get_string('description');
$templates = W3_Request::get_array('templates');
$forum_url = W3_Request::get_string('forum_url');
$wp_login = W3_Request::get_string('wp_login');
$wp_password = W3_Request::get_string('wp_password');
$ftp_host = W3_Request::get_string('ftp_host');
$ftp_login = W3_Request::get_string('ftp_login');
$ftp_password = W3_Request::get_string('ftp_password');
$subscribe_releases = W3_Request::get_string('subscribe_releases');
$subscribe_customer = W3_Request::get_string('subscribe_customer');
include W3TC_INC_DIR . '/options/support/form.php';
}
开发者ID:easinewe,项目名称:Avec2016,代码行数:52,代码来源:SupportActionsAdmin.php
示例3: w3_get_domain_url_regexp
/**
* Returns domain url regexp
*
* @return string
*/
function w3_get_domain_url_regexp()
{
$domain_url = w3_get_domain_url();
$regexp = w3_get_url_regexp($domain_url);
return $regexp;
}
开发者ID:nuevomediagroup,项目名称:nmg-code,代码行数:11,代码来源:define.php
示例4: __construct
/**
* @param null $domain_url
* @param null $home_url
*/
function __construct($domain_url = null, $home_url = null)
{
$this->domain_url = $domain_url ? $domain_url : w3_get_domain_url();
$this->home_url = $home_url ? $home_url : w3_get_home_url();
}
开发者ID:getupcloud,项目名称:wordpress-ex,代码行数:9,代码来源:PageUrls.php
示例5: relative_path_to_url
/**
* Takes a root relative path and converts to a full uri
* @param $path
* @return string
*/
function relative_path_to_url($path)
{
$cdnuri = $this->docroot_filename_to_uri(ltrim($path, "/"));
return rtrim(w3_get_domain_url(), "/") . '/' . $cdnuri;
}
开发者ID:gumbysgoo,项目名称:bestilblomster,代码行数:10,代码来源:CdnCommon.php
示例6: purge_all
/**
* Purge CDN completely
* @param $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')) {
w3_require_once(W3TC_LIB_NETDNA_DIR . '/NetDNA.php');
}
$api = new NetDNA($this->_config['alias'], $this->_config['consumerkey'], $this->_config['consumersecret']);
$results = array();
$local_path = $remote_path = '';
$domain_is_valid = 0;
$found_domain = false;
try {
if ($this->_config['zone_id'] != 0) {
$zone_id = $this->_config['zone_id'];
} else {
$zone_id = $api->get_zone_id(w3_get_home_url());
}
if ($zone_id == 0) {
$zone_id = $api->get_zone_id(w3_get_domain_url());
}
if ($zone_id == 0) {
$zone_id = $api->get_zone_id(str_replace('://', '://www.', w3_get_domain_url()));
}
if ($zone_id == 0 || is_null($zone_id)) {
if (w3_get_domain_url() == w3_get_home_url()) {
$results[] = $this->_get_result($local_path, $remote_path, W3TC_CDN_RESULT_ERROR, sprintf(__('No zones match site: %s.', 'w3-total-cache'), trim(w3_get_home_url(), '/')));
} else {
$results[] = $this->_get_result($local_path, $remote_path, W3TC_CDN_RESULT_ERROR, sprintf(__('No zones match site: %s or %s.', 'w3-total-cache'), trim(w3_get_home_url(), '/'), trim(w3_get_domain_url(), '/')));
}
return !$this->_is_error($results);
}
$pullzone = json_decode($api->get('/zones/pull.json/' . $zone_id));
try {
if (preg_match("(200|201)", $pullzone->code)) {
$custom_domains_full = json_decode($api->get('/zones/pull/' . $pullzone->data->pullzone->id . '/customdomains.json'));
$custom_domains = array();
foreach ($custom_domains_full->data->customdomains as $custom_domain_full) {
$custom_domains[] = $custom_domain_full->custom_domain;
}
$local_path = 'all';
$remote_path = 'all';
$domain_is_valid = 0;
$found_domain = false;
if ($pullzone->data->pullzone->name . '.' . $this->_config['alias'] . '.' . W3TC_CDN_NETDNA_URL === $this->get_domain($local_path) || in_array($this->get_domain($local_path), $custom_domains)) {
try {
$params = array('file' => '/' . $local_path);
$file_purge = json_decode($api->delete('/zones/pull.json/' . $pullzone->data->pullzone->id . '/cache'));
if (preg_match("(200|201)", $file_purge->code)) {
$results[] = $this->_get_result($local_path, $remote_path, W3TC_CDN_RESULT_OK, __('OK', 'w3-total-cache'));
} else {
if (preg_match("(401|500)", $file_purge->code)) {
$results[] = $this->_get_result($local_path, $remote_path, 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($local_path, $remote_path, W3TC_CDN_RESULT_ERROR, __('Failed with error code ', 'w3-total-cache') . $file_purge->code);
}
}
$found_domain = true;
} catch (CurlException $e) {
$results[] = $this->_get_result($local_path, $remote_path, W3TC_CDN_RESULT_HALT, sprintf(__('Unable to purge (%s).', 'w3-total-cache'), $e->getMessage()));
}
} else {
$results[] = $this->_get_result($local_path, $remote_path, W3TC_CDN_RESULT_ERROR, sprintf(__('No registered CNAMEs match %s.', 'w3-total-cache'), $this->get_domain($local_path)));
return !$this->_is_error($results);
}
} else {
if (preg_match("(401|500)", $pullzone->code)) {
$results[] = $this->_get_result($local_path, $remote_path, W3TC_CDN_RESULT_ERROR, sprintf(__('Failed with error code %s. Please check your alias, consumer key, and private key.', 'w3-total-cache'), $pullzone->code));
} else {
$results[] = $this->_get_result($local_path, $remote_path, W3TC_CDN_RESULT_ERROR, __('Failed with error code ', 'w3-total-cache') . $pullzone->code);
}
}
} catch (CurlException $e) {
$results[] = $this->_get_result($local_path, $remote_path, W3TC_CDN_RESULT_HALT, sprintf(__('Unable to purge (%s).', 'w3-total-cache'), $e->getMessage()));
}
} catch (CurlException $e) {
$results[] = $this->_get_result($local_path, $remote_path, W3TC_CDN_RESULT_HALT, __('Failure to pull zone: ', 'w3-total-cache') . $e->getMessage());
}
if ($domain_is_valid > 0 && !$found_domain) {
$results[] = $this->_get_result($local_path, $remote_path, W3TC_CDN_RESULT_ERROR, __('No zones match custom domain.', 'w3-total-cache'));
} elseif (!$found_domain) {
$results[] = $this->_get_result($local_path, $remote_path, W3TC_CDN_RESULT_ERROR, sprintf(__('No zones match site: %s.', 'w3-total-cache'), trim(w3_get_home_url(), '/')));
}
return !$this->_is_error($results);
}
开发者ID:rongandat,项目名称:sallumeh,代码行数:96,代码来源:Netdna.php
示例7: w3_translate_file
/**
* Translates URL to local path
* @param string $url
* @return string
*/
function w3_translate_file($url)
{
if (!w3_is_url($url)) {
$url = w3_get_domain_url() . '/' . ltrim($url, '/\\');
}
$site_url_regexp = '~' . w3_get_site_url_regexp() . '~i';
if (preg_match($site_url_regexp, $url) && strstr($url, '?') === false) {
$url = preg_replace($site_url_regexp, '', $url);
$url = w3_get_site_path() . ltrim($url, '/\\');
}
$url = ltrim($url, '/');
return $url;
}
开发者ID:alx,项目名称:SBek-Arak,代码行数:18,代码来源:define.php
示例8: flush_post
//.........这里部分代码省略.........
if ($this->_config->get_boolean('pgcache.purge.home') && $front_page == 'posts' || $this->_config->get_boolean('pgcache.purge.front_page')) {
$global_urls = array_merge($global_urls, $purge_urls->get_frontpage_urls($limit_post_pages));
}
/**
* Home (Post page) URL
*/
if ($this->_config->get_boolean('pgcache.purge.home') && $front_page != 'posts') {
$global_urls = array_merge($global_urls, $purge_urls->get_postpage_urls($limit_post_pages));
}
/**
* Post URL
*/
if ($this->_config->get_boolean('pgcache.purge.post')) {
$full_urls = array_merge($full_urls, $purge_urls->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, $purge_urls->get_post_comments_urls($post_id));
}
/**
* Post author URLs
*/
if ($this->_config->get_boolean('pgcache.purge.author') && $post) {
$full_urls = array_merge($full_urls, $purge_urls->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, $purge_urls->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, $purge_urls->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, $purge_urls->get_montly_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, $purge_urls->get_yearly_archive_urls($post, $limit_post_pages));
}
/**
* Feed URLs
*/
if ($this->_config->get_boolean('pgcache.purge.feed.blog')) {
$global_urls = array_merge($global_urls, $purge_urls->get_feed_urls($feeds));
}
if ($this->_config->get_boolean('pgcache.purge.feed.comments')) {
$full_urls = array_merge($full_urls, $purge_urls->get_feed_comments_urls($post_id, $feeds));
}
if ($this->_config->get_boolean('pgcache.purge.feed.author') && $post) {
$full_urls = array_merge($full_urls, $purge_urls->get_feed_author_urls($post->post_author, $feeds));
}
if ($this->_config->get_boolean('pgcache.purge.feed.terms')) {
$full_urls = array_merge($full_urls, $purge_urls->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, $purge_urls->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[] = w3_get_domain_url() . '/' . trim($sitemap_regex, "^\$");
}
if ($this->_do_flush_global_urls()) {
$full_urls = array_merge($global_urls, $full_urls);
} elseif ($this->_flushes == 0) {
$this->_repeated_urls = $global_urls;
}
/**
* Flush cache
*/
if (count($full_urls)) {
$this->_flushes++;
foreach ($full_urls as $url) {
if (!in_array($url, $this->_repeated_urls) && !in_array($url, $this->_flushed_urls)) {
$this->_flushed_urls[] = $url;
$this->flush_url($url);
} elseif (!in_array($url, $this->_repeated_urls)) {
$this->_repeated_urls[] = $url;
}
}
}
return true;
}
return false;
}
开发者ID:marqui678,项目名称:finalchance.Panopta,代码行数:101,代码来源:VarnishFlush.php
示例9: get_server_info
/**
* Returns server info
*/
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;
}
}
$w3tc_config = (array) @(include W3TC_CONFIG_PATH);
$mysql_version = (array) $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];
}
return array('wp' => array('version' => $wp_version, 'db_version' => $wp_db_version, 'w3tc_version' => W3TC_VERSION, 'url' => w3_get_domain_url(), 'path' => ABSPATH, 'email' => get_option('admin_email'), 'upload_info' => (array) w3_upload_info(), 'theme' => get_theme(get_current_theme()), 'plugins' => $wordpress_plugins_active, 'wp_cache' => defined('WP_CACHE') ? 'true' : 'false'), 'mysql' => array('version' => $mysql_version, 'variables' => $mysql_variables));
}
开发者ID:alx,项目名称:SBek-Arak,代码行数:22,代码来源:TotalCache.php
示例10: w3_get_domain_url_regexp
/**
* Returns domain url regexp
*
* @return string
*/
function w3_get_domain_url_regexp()
{
$domain_url = w3_get_domain_url();
$domain = preg_replace('~https?://~i', '', $domain_url);
$regexp = 'https?://' . w3_preg_quote($domain);
return $regexp;
}
开发者ID:TheReaCompany,项目名称:pooplog,代码行数:12,代码来源:define.php
注:本文中的w3_get_domain_url函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论