本文整理汇总了PHP中force_ssl_content函数的典型用法代码示例。如果您正苦于以下问题:PHP force_ssl_content函数的具体用法?PHP force_ssl_content怎么用?PHP force_ssl_content使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了force_ssl_content函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: set_url_scheme
/**
* Sets the URL to https or http, depending on availability and related WP config settings/APIs.
*
* @since 4.2
*
* @param $url string
*
* @return string
*/
public function set_url_scheme($url)
{
$current_user = get_current_user();
if (function_exists('force_ssl_admin') && force_ssl_admin() || function_exists('force_ssl_login') && force_ssl_login() || function_exists('force_ssl_content') && force_ssl_content() || function_exists('is_ssl') && is_ssl() || !empty($current_user->use_ssl)) {
return set_url_scheme($url, 'https');
}
return set_url_scheme($url, 'http');
}
示例2: filter_SSL
/**
* Formats an String URL to use HTTPS if HTTP is found.
* Useful as a filter.
*
* @since 2.8.5
**/
function filter_SSL($url)
{
if (!is_string($url)) {
return get_bloginfo('url');
}
//return home blog url with proper scheme
$arrURL = parse_url($url);
if (force_ssl_content() && is_ssl()) {
if ('http' === $arrURL['scheme'] && 'https' !== $arrURL['scheme']) {
$url = str_replace($arrURL['scheme'], 'https', $url);
}
}
return $url;
}
示例3: filter_SSL
/**
* Formats a URL to use https.
*
* Useful as a filter.
*
* @since 2.8.5
*
* @param string URL
* @return string URL with https as the scheme
*/
function filter_SSL($url)
{
if (!is_string($url)) {
return get_bloginfo('url');
}
// Return home blog url with proper scheme
if (force_ssl_content() && is_ssl()) {
$url = set_url_scheme($url, 'https');
}
return $url;
}