本文整理汇总了PHP中w3_is_https函数的典型用法代码示例。如果您正苦于以下问题:PHP w3_is_https函数的具体用法?PHP w3_is_https怎么用?PHP w3_is_https使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了w3_is_https函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: flush
/**
* Flush varnish cache
*/
function flush()
{
if (!is_network_admin()) {
$this->_purge(w3_get_home_url() . '/.*');
} else {
global $wpdb;
$protocall = w3_is_https() ? 'https://' : 'http://';
// If WPMU Domain Mapping plugin is installed and active
if (defined('SUNRISE_LOADED') && SUNRISE_LOADED && isset($wpdb->dmtable) && !empty($wpdb->dmtable)) {
$blogs = $wpdb->get_results("SELECT {$wpdb->blogs}.domain, {$wpdb->blogs}.path, {$wpdb->dmtable}.domain AS mapped_domain\n FROM {$wpdb->dmtable}\n RIGHT JOIN {$wpdb->blogs} ON {$wpdb->dmtable}.blog_id = {$wpdb->blogs}.blog_id\n WHERE site_id = {$wpdb->siteid}\n AND spam = 0\n AND deleted = 0\n AND archived = '0'\n ");
foreach ($blogs as $blog) {
if (!isset($blog->mapped_domain)) {
$url = $protocall . $blog->domain . (strlen($blog->path) > 1 ? '/' . trim($blog->path, '/') : '') . '/.*';
} else {
$url = $protocall . $blog->mapped_domain . '/.*';
}
$this->_purge($url);
}
} else {
if (!w3_is_subdomain_install()) {
$this->_purge(w3_get_home_url() . '/.*');
} else {
$blogs = $wpdb->get_results("\n SELECT domain, path\n FROM {$wpdb->blogs}\n WHERE site_id = '{$wpdb->siteid}'\n AND spam = 0\n AND deleted = 0\n AND archived = '0'\n ");
foreach ($blogs as $blog) {
$url = $protocall . $blog->domain . (strlen($blog->path) > 1 ? '/' . trim($blog->path, '/') : '') . '/.*';
$this->_purge($url);
}
}
}
}
}
示例2: w3_download
/**
* Downloads URL into a file
*
* @param string $url
* @param string $file
* @return boolean
*/
function w3_download($url, $file)
{
if (strpos($url, '//') === 0) {
$url = (w3_is_https() ? 'https:' : 'http:') . $url;
}
$response = w3_http_get($url);
if (!is_wp_error($response) && $response['response']['code'] == 200) {
return @file_put_contents($file, $response['body']);
}
return false;
}
示例3: action_widget_latest_ajax
/**
* Prints latest widget contents
*
* @return void
*/
function action_widget_latest_ajax()
{
// load content of feed
global $wp_version;
$items = array();
$items_count = $this->_config->get_integer('widget.latest.items');
if ($wp_version >= 2.8) {
include_once ABSPATH . WPINC . '/feed.php';
$feed = fetch_feed(W3TC_FEED_URL);
if (!is_wp_error($feed)) {
$feed_items = $feed->get_items(0, $items_count);
foreach ($feed_items as $feed_item) {
$items[] = array('link' => $feed_item->get_link(), 'title' => $feed_item->get_title(), 'description' => $feed_item->get_description());
}
}
} else {
include_once ABSPATH . WPINC . '/rss.php';
$rss = fetch_rss(W3TC_FEED_URL);
if (is_object($rss)) {
$items = array_slice($rss->items, 0, $items_count);
}
}
// Removes feedburner tracking images when site is https
if (w3_is_https()) {
$total = sizeof($items);
for ($i = 0; $i < $total; $i++) {
if (isset($items[$i]['description'])) {
$items[$i]['description'] = preg_replace('/<img[^>]+src[^>]+W3TOTALCACHE[^>]+>/', '', $items[$i]['description']);
}
}
}
ob_start();
include W3TC_INC_DIR . '/widget/latest_ajax.php';
// Default lifetime in cache of 12 hours (same as the feeds)
set_transient($this->_widget_latest_cache_key(), ob_get_flush(), 43200);
die;
}
示例4: w3_get_url_ssl
/**
* Returns SSL URL if current connection is https
* @param string $url
* @return string
*/
function w3_get_url_ssl($url)
{
if (w3_is_https()) {
$url = str_replace('http://', 'https://', $url);
}
return $url;
}
示例5: w3_download
/**
* Downloads data to a file
*
* @param string $url
* @param string $file
* @return boolean
*/
function w3_download($url, $file)
{
if (strpos($url, '//') === 0) {
$url = (w3_is_https() ? 'https:' : 'http:') . $url;
}
$data = w3_http_get($url);
if ($data !== false) {
return @file_put_contents($file, $data);
}
return false;
}
示例6: _get_scheme
/**
* Returns scheme
*
* @return string
*/
function _get_scheme()
{
switch ($this->_config['ssl']) {
default:
case 'auto':
$scheme = w3_is_https() ? 'https' : 'http';
break;
case 'enabled':
$scheme = 'https';
break;
case 'disabled':
$scheme = 'http';
break;
case 'rejected':
$scheme = 'http';
break;
}
return $scheme;
}
示例7: _get_encryption
/**
* Returns current encryption
*
* @return string
*/
function _get_encryption()
{
if (w3_is_https()) {
return 'ssl';
}
return '';
}
示例8: can_cdn
/**
* Check if we can do CDN logic
* @return boolean
*/
function can_cdn()
{
/**
* Skip if admin
*/
if (defined('WP_ADMIN')) {
$this->cdn_reject_reason = 'wp-admin';
return false;
}
/**
* Check for WPMU's and WP's 3.0 short init
*/
if (defined('SHORTINIT') && SHORTINIT) {
$this->cdn_reject_reason = 'Short init';
return false;
}
/**
* Check User agent
*/
if (!$this->check_ua()) {
$this->cdn_reject_reason = 'user agent is rejected';
return false;
}
/**
* Check request URI
*/
if (!$this->check_request_uri()) {
$this->cdn_reject_reason = 'request URI is rejected';
return false;
}
/**
* Do not replace urls if SSL and SSL support is do not replace
*/
if (w3_is_https() && $this->_config->get_boolean('cdn.reject.ssl')) {
$this->cdn_reject_reason = 'SSL is rejected';
return false;
}
return true;
}
示例9: w3_get_site_url_ssl
/**
* Returns SSL site url
*
* @return string
*/
function w3_get_site_url_ssl()
{
$site_url = w3_get_site_url();
if (w3_is_https()) {
$site_url = str_replace('http:', 'https:', $site_url);
}
return $site_url;
}
示例10: format_url
/**
* Formats object URL
*
* @param string $path
* @return string
*/
function format_url($path)
{
$domain = $this->get_domain();
if ($domain) {
$url = sprintf('%s://%s%s', w3_is_https() ? 'https' : 'http', $domain, $path);
return $url;
}
return false;
}