本文整理汇总了PHP中force_ssl_admin函数的典型用法代码示例。如果您正苦于以下问题:PHP force_ssl_admin函数的具体用法?PHP force_ssl_admin怎么用?PHP force_ssl_admin使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了force_ssl_admin函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: pmpro_login_redirect
function pmpro_login_redirect($redirect_to, $request, $user)
{
global $wpdb;
//is a user logging in?
if (!empty($user->ID)) {
//logging in, let's figure out where to send them
if (pmpro_isAdmin($user->ID)) {
//admins go to dashboard
$redirect_to = get_bloginfo("url") . "/wp-admin/";
} elseif (strpos($redirect_to, "checkout") !== false) {
//if the redirect url includes the word checkout, leave it alone
} elseif ($wpdb->get_var("SELECT membership_id FROM {$wpdb->pmpro_memberships_users} WHERE status = 'active' AND user_id = '" . $user->ID . "' LIMIT 1")) {
//if logged in and a member, send to wherever they were going
} else {
//not a member, send to subscription page
$redirect_to = pmpro_url("levels");
}
} else {
//not logging in (login form) so return what was given
}
//let's strip the https if force_ssl_login is set, but force_ssl_admin is not
if (force_ssl_login() && !force_ssl_admin()) {
$redirect_to = str_replace("https:", "http:", $redirect_to);
}
return apply_filters("pmpro_login_redirect_url", $redirect_to, $request, $user);
}
开发者ID:Tanya-atsocial,项目名称:paid-memberships-pro,代码行数:26,代码来源:login.php
示例2: fx_ssl_active
/**
* Check if SSL enabled
* @since 0.1.0
*/
function fx_ssl_active()
{
if (force_ssl_admin() && get_option('fx-ssl', false) && fx_ssl_is_https(get_option('home')) && fx_ssl_is_https(get_option('siteurl'))) {
return true;
}
return false;
}
开发者ID:turtlepod,项目名称:fx-ssl,代码行数:11,代码来源:functions.php
示例3: init
function init()
{
load_theme_textdomain('p2', get_template_directory() . '/languages');
add_filter('the_content', 'make_clickable');
if (isset($_REQUEST['p2ajax'])) {
require_once P2_INC_PATH . '/ajax.php';
P2Ajax::dispatch();
die;
}
if (function_exists('is_site_admin') && !is_site_admin()) {
return;
}
$is_media_upload = isset($_REQUEST['p2-upload']);
// don't redirect to https version when uploading files, since the domain may be different
// and we don't have SSL certificates for blog domain, only for admin
if ($is_media_upload && isset($GLOBALS['pagenow']) && 'media-upload.php' == $GLOBALS['pagenow']) {
force_ssl_admin(is_ssl());
add_filter('get_user_option_use_ssl', returner(false));
}
if ($is_media_upload) {
add_filter('flash_uploader', returner(false));
add_filter('auth_redirect_scheme', returner('logged_in'));
add_filter('admin_url', array('P2', 'url_filter'));
add_filter('includes_url', array('P2', 'url_filter'));
add_filter('script_loader_src', array('P2', 'url_filter'));
add_filter('wp_get_attachment_url', lambda('$url', 'str_replace(get_bloginfo("url")."/", site_url("/"), $url);'), 11);
add_filter('media_upload_form_url', lambda('$url', 'add_query_arg( array( "p2-upload" => "true" ), $url );'));
}
}
开发者ID:alx,项目名称:pressmark,代码行数:29,代码来源:p2.php
示例4: test_bp_core_ajax_url
function test_bp_core_ajax_url()
{
$forced = force_ssl_admin();
// (1) HTTPS off
force_ssl_admin(false);
$_SERVER['HTTPS'] = 'off';
// (1a) Front-end
$this->go_to('/');
$this->assertEquals(bp_core_ajax_url(), get_site_url(bp_get_root_blog_id(), '/wp-admin/admin-ajax.php', 'http'));
// (1b) Dashboard
$this->go_to('/wp-admin');
$this->assertEquals(bp_core_ajax_url(), get_site_url(bp_get_root_blog_id(), '/wp-admin/admin-ajax.php', 'http'));
// (2) FORCE_SSL_ADMIN
force_ssl_admin(true);
// (2a) Front-end
$this->go_to('/');
$this->assertEquals(bp_core_ajax_url(), get_site_url(bp_get_root_blog_id(), '/wp-admin/admin-ajax.php', 'http'));
// (2b) Dashboard
$this->go_to('/wp-admin');
$this->assertEquals(bp_core_ajax_url(), get_site_url(bp_get_root_blog_id(), '/wp-admin/admin-ajax.php', 'https'));
force_ssl_admin($forced);
// (3) Multisite, root blog other than 1
if (is_multisite()) {
$original_root_blog = bp_get_root_blog_id();
$blog_id = $this->factory->blog->create(array('path' => '/path' . rand() . time() . '/'));
buddypress()->root_blog_id = $blog_id;
$blog_url = get_blog_option($blog_id, 'siteurl');
$this->go_to(trailingslashit($blog_url));
buddypress()->root_blog_id = $original_root_blog;
$ajax_url = bp_core_ajax_url();
$this->go_to('/');
$this->assertEquals($blog_url . '/wp-admin/admin-ajax.php', $ajax_url);
}
}
开发者ID:JeroenNouws,项目名称:BuddyPress,代码行数:34,代码来源:url.php
示例5: settings_field_ssl
/**
* Enable Private Site
* @since 0.1.0
*/
public function settings_field_ssl()
{
/* Check if feature is supported. */
if (is_ssl() && force_ssl_admin() && fx_ssl_is_https(get_option('home')) && fx_ssl_is_https(get_option('siteurl'))) {
$disabled = '';
$option = get_option($this->option_name, false);
} else {
$disabled = ' disabled=disabled';
$option = false;
// always false if requirement not met.
}
?>
<label for="fx_ssl_enable">
<input type="checkbox" value="1" id="fx_ssl_enable" name="<?php
echo esc_attr($this->option_name);
?>
" <?php
checked($option);
echo $disabled;
?>
> <?php
_ex('Redirect all pages to HTTPS', 'settings page', 'fx-ssl');
?>
</label>
<?php
}
开发者ID:turtlepod,项目名称:fx-ssl,代码行数:30,代码来源:settings.php
示例6: jr_process_login_form
function jr_process_login_form()
{
global $posted;
if (isset($_REQUEST['redirect_to'])) {
$redirect_to = $_REQUEST['redirect_to'];
} else {
$redirect_to = admin_url();
}
if (is_ssl() && force_ssl_login() && !force_ssl_admin() && 0 !== strpos($redirect_to, 'https') && 0 === strpos($redirect_to, 'http')) {
$secure_cookie = false;
} else {
$secure_cookie = '';
}
$user = wp_signon('', $secure_cookie);
$redirect_to = apply_filters('login_redirect', $redirect_to, isset($_REQUEST['redirect_to']) ? $_REQUEST['redirect_to'] : '', $user);
if (!is_wp_error($user)) {
if (user_can($user, 'manage_options')) {
$redirect_to = admin_url();
}
wp_safe_redirect($redirect_to);
exit;
}
$errors = $user;
return $errors;
}
开发者ID:besimhu,项目名称:legacy,代码行数:25,代码来源:login-process.php
示例7: app_process_login_form
function app_process_login_form()
{
global $posted;
if (isset($_REQUEST['redirect_to'])) {
$redirect_to = $_REQUEST['redirect_to'];
} else {
$redirect_to = admin_url();
}
if (is_ssl() && force_ssl_login() && !force_ssl_admin() && 0 !== strpos($redirect_to, 'https') && 0 === strpos($redirect_to, 'http')) {
$secure_cookie = false;
} else {
$secure_cookie = '';
}
$user = wp_signon('', $secure_cookie);
$redirect_to = apply_filters('login_redirect', $redirect_to, isset($_REQUEST['redirect_to']) ? $_REQUEST['redirect_to'] : '', $user);
if (!is_wp_error($user)) {
// automatically redirect admins to the WP back-end
if (user_can($user, 'manage_options')) {
$redirect_to = admin_url('admin.php?page=admin-options.php');
}
// otherwise redirect them to the hidden post url
wp_safe_redirect($redirect_to);
exit;
}
$errors = $user;
return $errors;
}
开发者ID:ugurbastan,项目名称:swe-574-group4,代码行数:27,代码来源:login-process.php
示例8: 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');
}
开发者ID:kraftbj,项目名称:Press-This,代码行数:17,代码来源:press-this.php
示例9: wc_yotpo_redirect
function wc_yotpo_redirect()
{
if (get_option('wc_yotpo_just_installed', false)) {
delete_option('wc_yotpo_just_installed');
wp_redirect(is_ssl() || force_ssl_admin() || force_ssl_login() ? str_replace('http:', 'https:', admin_url('admin.php?page=woocommerce-yotpo-settings-page')) : str_replace('https:', 'http:', admin_url('admin.php?page=woocommerce-yotpo-settings-page')));
exit;
}
}
开发者ID:brian3t,项目名称:orchidmate,代码行数:8,代码来源:wc_yotpo.php
示例10: always_https_redirect
function always_https_redirect()
{
//if FORCE_SSL_ADMIN is true and we're not over HTTPS
if (force_ssl_admin() && !is_ssl()) {
//redirect to https version of the page
wp_redirect("https://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
exit;
}
}
开发者ID:Cywaithaka,项目名称:bwawwp,代码行数:9,代码来源:example-03.php
示例11: fx_ssl_activation
/**
* Runs only when the plugin is activated.
* @since 0.1.0
*/
function fx_ssl_activation()
{
/* Add notice. */
if (is_ssl() && force_ssl_admin() && fx_ssl_is_https(get_bloginfo('url')) && fx_ssl_is_https(get_bloginfo('wpurl'))) {
set_transient('fx_ssl_notice', 'success', 5);
if (get_option('fx-ssl', false)) {
set_transient('fx_ssl_notice', 'active', 5);
}
} else {
set_transient('fx_ssl_notice', 'fail', 5);
}
}
开发者ID:turtlepod,项目名称:fx-ssl,代码行数:16,代码来源:fx-ssl.php
示例12: force_ssl
/**
* Checks wether protocol is HTTPS and redirects user to secure connection if not
*/
protected function force_ssl()
{
if (force_ssl_admin() && !is_ssl()) {
if (0 === strpos($_SERVER['REQUEST_URI'], 'http')) {
wp_redirect(preg_replace('|^http://|', 'https://', $_SERVER['REQUEST_URI']));
die;
} else {
wp_redirect('https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
die;
}
}
}
开发者ID:ryan2407,项目名称:Vision,代码行数:15,代码来源:controller.php
示例13: woocommerce_sidebar_login_ajax_process
/**
* Process ajax login
*
* @access public
* @return void
*/
function woocommerce_sidebar_login_ajax_process()
{
check_ajax_referer('woocommerce-sidebar-login-action', 'security');
// Get post data
$creds = array();
$creds['user_login'] = esc_attr($_REQUEST['user_login']);
$creds['user_password'] = esc_attr($_REQUEST['user_password']);
$creds['remember'] = 'forever';
$redirect_to = esc_attr($_REQUEST['redirect_to']);
// Check for Secure Cookie
$secure_cookie = '';
// If the user wants ssl but the session is not ssl, force a secure cookie.
if (!force_ssl_admin()) {
$user_name = sanitize_user($creds['user_login']);
if ($user = get_user_by('login', $user_name)) {
if (get_user_option('use_ssl', $user->ID)) {
$secure_cookie = true;
force_ssl_admin(true);
}
}
}
if (force_ssl_admin()) {
$secure_cookie = true;
}
if ($secure_cookie == '' && force_ssl_login()) {
$secure_cookie = false;
}
// Login
$user = wp_signon($creds, $secure_cookie);
// Redirect filter
if ($secure_cookie && strstr($redirect_to, 'wp-admin')) {
$redirect_to = str_replace('http:', 'https:', $redirect_to);
}
// Result
$result = array();
if (!is_wp_error($user)) {
$result['success'] = 1;
$result['redirect'] = $redirect_to;
} else {
$result['success'] = 0;
if ($user->errors) {
foreach ($user->errors as $error) {
$result['error'] = $error[0];
break;
}
} else {
$result['error'] = __('Please enter your username and password to login.', 'woocommerce');
}
}
header('content-type: application/json; charset=utf-8');
echo $_GET['callback'] . '(' . json_encode($result) . ')';
die;
}
开发者ID:vjdesign,项目名称:fontaine,代码行数:59,代码来源:woocommerce-ajax.php
示例14: ft_current_url
/**
* current_url function.
*
* @access public
* @param string $url (default: '')
* @return void
*/
function ft_current_url($url = '')
{
$pageURL = force_ssl_admin() ? 'https://' : 'http://';
$pageURL .= esc_attr($_SERVER['HTTP_HOST']);
$pageURL .= esc_attr($_SERVER['REQUEST_URI']);
if ($url != "nologout") {
if (!strpos($pageURL, '_login=')) {
$rand_string = md5(uniqid(rand(), true));
$rand_string = substr($rand_string, 0, 10);
$pageURL = add_query_arg('_login', $rand_string, $pageURL);
}
}
return esc_url_raw($pageURL);
}
开发者ID:Kafia,项目名称:Mark-WordPress-Theme-,代码行数:21,代码来源:general.php
示例15: auth_redirect
function auth_redirect()
{
// Checks if a user is logged in, if not redirects them to the login page
if (is_ssl() || force_ssl_admin()) {
$secure = true;
} else {
$secure = false;
}
// If https is required and request is http, redirect
if ($secure && !is_ssl() && false !== strpos($_SERVER['REQUEST_URI'], 'wp-admin')) {
if (0 === strpos($_SERVER['REQUEST_URI'], 'http')) {
wp_redirect(preg_replace('|^http://|', 'https://', $_SERVER['REQUEST_URI']));
exit;
} else {
wp_redirect('https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
exit;
}
}
if ($user_id = wp_validate_auth_cookie()) {
do_action('auth_redirect', $user_id);
// If the user wants ssl but the session is not ssl, redirect.
if (!$secure && get_user_option('use_ssl', $user_id) && false !== strpos($_SERVER['REQUEST_URI'], 'wp-admin')) {
if (0 === strpos($_SERVER['REQUEST_URI'], 'http')) {
wp_redirect(preg_replace('|^http://|', 'https://', $_SERVER['REQUEST_URI']));
exit;
} else {
wp_redirect('https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
exit;
}
}
return;
// The cookie is good so we're done
}
// The cookie is no good so force login
nocache_headers();
if (OPENSSO_ENABLED) {
// Redirect to OpenSSO login page then return here
$login_url = OPENSSO_BASE_URL . '?goto=' . urlencode(opensso_full_url());
} else {
if (is_ssl()) {
$proto = 'https://';
} else {
$proto = 'http://';
}
$redirect = strpos($_SERVER['REQUEST_URI'], '/options.php') && wp_get_referer() ? wp_get_referer() : $proto . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
$login_url = wp_login_url($redirect);
}
wp_redirect($login_url);
exit;
}
开发者ID:GajendraNaidu,项目名称:openam,代码行数:50,代码来源:opensso.php
示例16: woocommerce_sidebar_login_ajax_process
function woocommerce_sidebar_login_ajax_process()
{
check_ajax_referer('woocommerce-sidebar-login-action', 'security');
// Get post data
$creds = array();
$creds['user_login'] = esc_attr($_POST['user_login']);
$creds['user_password'] = esc_attr($_POST['user_password']);
$creds['remember'] = 'forever';
$redirect_to = esc_attr($_POST['redirect_to']);
// Check for Secure Cookie
$secure_cookie = '';
// If the user wants ssl but the session is not ssl, force a secure cookie.
if (!empty($_POST['log']) && !force_ssl_admin()) {
$user_name = sanitize_user($_POST['log']);
if ($user = get_user_by('login', $user_name)) {
if (get_user_option('use_ssl', $user->ID)) {
$secure_cookie = true;
force_ssl_admin(true);
}
}
}
if (!$secure_cookie && is_ssl() && force_ssl_login() && !force_ssl_admin() && 0 !== strpos($redirect_to, 'https') && 0 === strpos($redirect_to, 'http')) {
$secure_cookie = false;
}
// Login
$user = wp_signon($creds, $secure_cookie);
// Redirect filter
if ($secure_cookie && false !== strpos($redirect_to, 'wp-admin')) {
$redirect_to = preg_replace('|^http://|', 'https://', $redirect_to);
}
// Result
$result = array();
if (!is_wp_error($user)) {
$result['success'] = 1;
$result['redirect'] = $redirect_to;
} else {
$result['success'] = 0;
foreach ($user->errors as $error) {
$result['error'] = $error[0];
break;
}
}
echo json_encode($result);
die;
}
开发者ID:bidhanbaral,项目名称:fotodep_store,代码行数:45,代码来源:woocommerce-ajax.php
示例17: make_link
function make_link($_action, $_dir, $_item = NULL, $_order = NULL, $_srt = NULL, $_lang = NULL)
{
// make link to next page
if ($_action == "" || $_action == NULL) {
$_action = "list";
}
if ($_dir == "") {
$_dir = NULL;
}
if ($_item == "") {
$_item = NULL;
}
if ($_order == NULL) {
$_order = $GLOBALS["order"];
}
if ($_srt == NULL) {
$_srt = $GLOBALS["srt"];
}
if ($_lang == NULL) {
$_lang = isset($GLOBALS["lang"]) ? $GLOBALS["lang"] : NULL;
}
$link = $GLOBALS["script_name"] . "?page=miwoftp&option=com_miwoftp&action=" . $_action;
/*Detect if the site has SSL enabled and switch all links to https --- Added by Shane Gadsby <[email protected]> || https://github.com/schme16*/
if (force_ssl_admin()) {
$link = str_replace("http://", "https://", $link, $temp = 1);
}
if ($_dir != NULL) {
$link .= "&dir=" . urlencode($_dir);
}
if ($_item != NULL) {
$link .= "&item=" . urlencode($_item);
}
if ($_order != NULL) {
$link .= "&order=" . $_order;
}
if ($_srt != NULL) {
$link .= "&srt=" . $_srt;
}
if ($_lang != NULL) {
$link .= "&lang=" . $_lang;
}
return $link;
}
开发者ID:morovan,项目名称:granitpiestany.sk,代码行数:43,代码来源:fun_extra.php
示例18: logon
static function logon($username)
{
$secure_cookie = '';
if (!empty($username) && !force_ssl_admin()) {
$usn = sanitize_user($username);
if ($user = get_user_by('login', $usn)) {
if (get_user_option('use_ssl', $user->ID)) {
$secure_cookie = true;
force_ssl_admin(true);
}
}
}
$reauth = empty($_REQUEST['reauth']) ? false : true;
$user = wp_signon('', $secure_cookie);
if (!is_wp_error($user) && !$reauth) {
return $user->ID;
}
return false;
}
开发者ID:quangnpd,项目名称:jobshop_web,代码行数:19,代码来源:class.user.php
示例19: go_to
public function go_to($url)
{
$GLOBALS['_SERVER']['REQUEST_URI'] = $url = str_replace(network_home_url(), '', $url);
$_GET = $_POST = array();
foreach (array('query_string', 'id', 'postdata', 'authordata', 'day', 'currentmonth', 'page', 'pages', 'multipage', 'more', 'numpages', 'pagenow') as $v) {
if (isset($GLOBALS[$v])) {
unset($GLOBALS[$v]);
}
}
$parts = parse_url($url);
if (isset($parts['scheme'])) {
$req = $parts['path'];
if (isset($parts['query'])) {
$req .= '?' . $parts['query'];
parse_str($parts['query'], $_GET);
}
} else {
$req = $url;
}
if (!isset($parts['query'])) {
$parts['query'] = '';
}
// Scheme
if (0 === strpos($req, '/wp-admin') && force_ssl_admin()) {
$_SERVER['HTTPS'] = 'on';
} else {
unset($_SERVER['HTTPS']);
}
$_SERVER['REQUEST_URI'] = $req;
unset($_SERVER['PATH_INFO']);
$this->flush_cache();
unset($GLOBALS['wp_query'], $GLOBALS['wp_the_query']);
$GLOBALS['wp_the_query'] = new WP_Query();
$GLOBALS['wp_query'] =& $GLOBALS['wp_the_query'];
$GLOBALS['wp'] = new WP();
foreach ($GLOBALS['wp']->public_query_vars as $v) {
unset($GLOBALS[$v]);
}
foreach ($GLOBALS['wp']->private_query_vars as $v) {
unset($GLOBALS[$v]);
}
$GLOBALS['wp']->main($parts['query']);
}
开发者ID:Borgoroth,项目名称:Event-Organiser,代码行数:43,代码来源:testcase.php
示例20: auth_redirect
function auth_redirect()
{
// Checks if a user is logged in, if not redirects them to the login page
$secure = is_ssl() || force_ssl_admin();
$secure = apply_filters('secure_auth_redirect', $secure);
// If https is required and request is http, redirect
if ($secure && !is_ssl() && false !== strpos($_SERVER['REQUEST_URI'], 'wp-admin')) {
if (0 === strpos($_SERVER['REQUEST_URI'], 'http')) {
wp_redirect(set_url_scheme($_SERVER['REQUEST_URI'], 'https'));
exit;
} else {
wp_redirect('https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
exit;
}
}
if (is_user_admin()) {
$scheme = 'logged_in';
} else {
$scheme = apply_filters('auth_redirect_scheme', '');
}
if ($user_id = wp_validate_auth_cookie('', $scheme)) {
do_action('auth_redirect', $user_id);
// If the user wants ssl but the session is not ssl, redirect.
if (!$secure && get_user_option('use_ssl', $user_id) && false !== strpos($_SERVER['REQUEST_URI'], 'wp-admin')) {
if (0 === strpos($_SERVER['REQUEST_URI'], 'http')) {
wp_redirect(set_url_scheme($_SERVER['REQUEST_URI'], 'https'));
exit;
} else {
wp_redirect('https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
exit;
}
}
return;
// The cookie is good so we're done
}
// The cookie is no good so force login
nocache_headers();
$redirect = strpos($_SERVER['REQUEST_URI'], '/options.php') && wp_get_referer() ? wp_get_referer() : set_url_scheme('http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
// Change login url
$login_url = Maestrano::sso()->getInitPath();
wp_redirect($login_url);
exit;
}
开发者ID:Alpha7Sg,项目名称:wordpress-custom,代码行数:43,代码来源:maestrano.php
注:本文中的force_ssl_admin函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论