当前位置: 首页>>代码示例>>PHP>>正文


PHP force_ssl_login函数代码示例

本文整理汇总了PHP中force_ssl_login函数的典型用法代码示例。如果您正苦于以下问题:PHP force_ssl_login函数的具体用法?PHP force_ssl_login怎么用?PHP force_ssl_login使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了force_ssl_login函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: 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

示例2: pmpro_besecure

function pmpro_besecure()
{
    global $besecure, $post;
    //check the post option
    if (!is_admin() && !empty($post->ID) && !$besecure) {
        $besecure = get_post_meta($post->ID, "besecure", true);
    }
    //if forcing ssl on admin, be secure in admin and login page
    if (!$besecure && force_ssl_admin() && (is_admin() || pmpro_is_login_page())) {
        $besecure = true;
    }
    //if forcing ssl on login, be secure on the login page
    if (!$besecure && force_ssl_login() && pmpro_is_login_page()) {
        $besecure = true;
    }
    $besecure = apply_filters("pmpro_besecure", $besecure);
    $use_ssl = pmpro_getOption("use_ssl");
    if ($use_ssl == 1) {
        if ($besecure && (empty($_SERVER['HTTPS']) || $_SERVER['HTTPS'] == "off" || $_SERVER['HTTPS'] == "false")) {
            //need to be secure
            wp_redirect("https://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
            exit;
        } elseif (!$besecure && !empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != "off" && $_SERVER['HTTPS'] != "false") {
            //don't need to be secure
            wp_redirect("http://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
            exit;
        }
    }
}
开发者ID:mathieuhays,项目名称:paid-memberships-pro,代码行数:29,代码来源:https.php

示例3: 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

示例4: 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

示例5: 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

示例6: 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

示例7: 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

示例8: 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

示例9: run

 /**
  */
 public function run()
 {
     if ($this->getIsOption('disable_file_editing', 'Y')) {
         if (!defined('DISALLOW_FILE_EDIT')) {
             define('DISALLOW_FILE_EDIT', true);
         }
         add_filter('user_has_cap', array($this, 'disableFileEditing'), 0, 3);
     }
     $sWpVersionMask = $this->getOption('mask_wordpress_version');
     if (!empty($sWpVersionMask)) {
         global $wp_version;
         $wp_version = $sWpVersionMask;
         // 			add_filter( 'bloginfo', array( $this, 'maskWordpressVersion' ), 1, 2 );
         // 			add_filter( 'bloginfo_url', array( $this, 'maskWordpressVersion' ), 1, 2 );
     }
     if (false && $this->getOption('action_reset_auth_salts') == 'Y') {
         add_action('init', array($this, 'resetAuthKeysSalts'), 1);
     }
     if ($this->getIsOption('force_ssl_login', 'Y') && function_exists('force_ssl_login')) {
         if (!defined('FORCE_SSL_LOGIN')) {
             define('FORCE_SSL_LOGIN', true);
         }
         force_ssl_login(true);
     }
     if ($this->getIsOption('force_ssl_admin', 'Y') && function_exists('force_ssl_admin')) {
         if (!defined('FORCE_SSL_ADMIN')) {
             define('FORCE_SSL_ADMIN', true);
         }
         force_ssl_admin(true);
     }
     if ($this->getIsOption('hide_wordpress_generator_tag', 'Y')) {
         remove_action('wp_head', 'wp_generator');
     }
     if ($this->getIsOption('block_author_discovery', 'Y')) {
         // jump in right before add_action( 'template_redirect', 'redirect_canonical' );
         add_action('wp', array($this, 'interceptCanonicalRedirects'), 9);
     }
     if ($this->getIsOption('disable_xmlrpc', 'Y')) {
         add_filter('xmlrpc_enabled', '__return_false', 1000);
     }
 }
开发者ID:Wikipraca,项目名称:Wikipraca-WikiSquare,代码行数:43,代码来源:lockdown.php

示例10: site_url

 function site_url($path = '', $scheme = null)
 {
     // should the list of allowed schemes be maintained elsewhere?
     $orig_scheme = $scheme;
     if (!in_array($scheme, array('http', 'https'))) {
         if ('login_post' == $scheme && (force_ssl_login() || force_ssl_admin())) {
             $scheme = 'https';
         } elseif ('login' == $scheme && force_ssl_admin()) {
             $scheme = 'https';
         } elseif ('admin' == $scheme && force_ssl_admin()) {
             $scheme = 'https';
         } else {
             $scheme = is_ssl() ? 'https' : 'http';
         }
     }
     $url = str_replace('http://', "{$scheme}://", get_option('siteurl'));
     if (!empty($path) && is_string($path) && strpos($path, '..') === false) {
         $url .= '/' . ltrim($path, '/');
     }
     return apply_filters('site_url', $url, $path, $orig_scheme);
 }
开发者ID:slaFFik,项目名称:l10n-ru,代码行数:21,代码来源:compat.php

示例11: process_form

 function process_form()
 {
     $this->error = new WP_Error();
     if (is_user_logged_in()) {
         do_action('app_login');
     }
     if (!isset($_POST['login'])) {
         return;
     }
     if (empty($_POST['log'])) {
         $this->error->add('empty_username', __('<strong>ERROR</strong>: The username field is empty.', APP_TD));
     }
     if (empty($_POST['pwd'])) {
         $this->error->add('empty_password', __('<strong>ERROR</strong>: The password field is empty.', APP_TD));
     }
     if ($this->error->get_error_code()) {
         return;
     }
     if (isset($_REQUEST['redirect_to'])) {
         $redirect_to = $_REQUEST['redirect_to'];
     } else {
         $redirect_to = admin_url('index.php');
     }
     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)) {
         wp_safe_redirect($redirect_to);
         exit;
     }
     $this->error = $user;
 }
开发者ID:TopLineMediaTeam,项目名称:horseshow,代码行数:36,代码来源:views-login.php

示例12: calculate_instructions_url

 protected function calculate_instructions_url($refresh = 'n')
 {
     return add_query_arg(array('garedirect' => urlencode($this->get_login_url()), 'gaorigin' => urlencode((is_ssl() || force_ssl_login() || force_ssl_admin() ? 'https://' : 'http://') . $_SERVER['HTTP_HOST'] . '/'), 'ganotms' => is_multisite() ? 'false' : 'true', 'gar' => urlencode($refresh), 'utm_source' => 'Admin%20Instructions', 'utm_medium' => 'freemium', 'utm_campaign' => 'Freemium'), $this->get_wpglogincom_baseurl());
 }
开发者ID:ankitatechie,项目名称:heroku-deployment,代码行数:4,代码来源:core_google_apps_login.php

示例13: network_site_url

/**
 * Retrieve the site url for the current network.
 *
 * Returns the site url with the appropriate protocol,  'https' if
 * is_ssl() and 'http' otherwise. If $scheme is 'http' or 'https', is_ssl() is
 * overridden.
 *
 * @package WordPress
 * @since 3.0.0
 *
 * @param string $path Optional. Path relative to the site url.
 * @param string $scheme Optional. Scheme to give the site url context. Currently 'http','https', 'login', 'login_post', or 'admin'.
 * @return string Site url link with optional path appended.
*/
function network_site_url($path = '', $scheme = null)
{
    global $current_site;
    if (!is_multisite()) {
        return site_url($path, $scheme);
    }
    $orig_scheme = $scheme;
    if (!in_array($scheme, array('http', 'https'))) {
        if (('login_post' == $scheme || 'rpc' == $scheme) && (force_ssl_login() || force_ssl_admin())) {
            $scheme = 'https';
        } elseif ('login' == $scheme && force_ssl_admin()) {
            $scheme = 'https';
        } elseif ('admin' == $scheme && force_ssl_admin()) {
            $scheme = 'https';
        } else {
            $scheme = is_ssl() ? 'https' : 'http';
        }
    }
    $url = $scheme . '://' . $current_site->domain . $current_site->path;
    if (!empty($path) && is_string($path) && strpos($path, '..') === false) {
        $url .= ltrim($path, '/');
    }
    return apply_filters('network_site_url', $url, $path, $orig_scheme);
}
开发者ID:vpatrinica,项目名称:jfdesign,代码行数:38,代码来源:link-template.php

示例14: set_url_scheme

/**
 * Set the scheme for a URL
 *
 * @since 3.4.0
 *
 * @param string $url Absolute url that includes a scheme
 * @param string $scheme Optional. Scheme to give $url. Currently 'http', 'https', 'login', 'login_post', 'admin', or 'relative'.
 * @return string $url URL with chosen scheme.
 */
function set_url_scheme($url, $scheme = null)
{
    $orig_scheme = $scheme;
    if (!in_array($scheme, array('http', 'https', 'relative'))) {
        if (('login_post' == $scheme || 'rpc' == $scheme) && (force_ssl_login() || force_ssl_admin())) {
            $scheme = 'https';
        } elseif ('login' == $scheme && force_ssl_admin()) {
            $scheme = 'https';
        } elseif ('admin' == $scheme && force_ssl_admin()) {
            $scheme = 'https';
        } else {
            $scheme = is_ssl() ? 'https' : 'http';
        }
    }
    if ('relative' == $scheme) {
        $url = preg_replace('#^.+://[^/]*#', '', $url);
    } else {
        $url = preg_replace('#^.+://#', $scheme . '://', $url);
    }
    return apply_filters('set_url_scheme', $url, $scheme, $orig_scheme);
}
开发者ID:mostafiz93,项目名称:PrintfScanf,代码行数:30,代码来源:link-template.php

示例15: bb_set_auth_cookie

 function bb_set_auth_cookie($user_id, $remember = false, $schemes = false)
 {
     global $wp_auth_object;
     if ($remember) {
         $expiration = $expire = time() + 1209600;
     } else {
         $expiration = time() + 172800;
         $expire = 0;
     }
     if (true === $schemes) {
         $schemes = array('secure_auth', 'logged_in');
     } elseif (!is_array($schemes)) {
         $schemes = array();
         if (force_ssl_login() || force_ssl_admin()) {
             $schemes[] = 'secure_auth';
         }
         if (!(force_ssl_login() && force_ssl_admin())) {
             $schemes[] = 'auth';
         }
         $schemes[] = 'logged_in';
     }
     $schemes = array_unique($schemes);
     foreach ($schemes as $scheme) {
         $wp_auth_object->set_auth_cookie($user_id, $expiration, $expire, $scheme);
     }
 }
开发者ID:abc2mit,项目名称:abc2mit.github.io,代码行数:26,代码来源:functions.bb-pluggable.php


注:本文中的force_ssl_login函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。