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


PHP auth_redirect函数代码示例

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


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

示例1: template_redirect

 /**
  * Output the POS template
  */
 public function template_redirect()
 {
     // check is pos
     if (!is_pos('template')) {
         return;
     }
     // check auth
     if (!is_user_logged_in()) {
         add_filter('login_url', array($this, 'login_url'));
         auth_redirect();
     }
     // check privileges
     if (!current_user_can('access_woocommerce_pos')) {
         /* translators: wordpress */
         wp_die(__('You do not have sufficient permissions to access this page.'));
     }
     // disable cache plugins
     $this->no_cache();
     // last chance before template is rendered
     do_action('woocommerce_pos_template_redirect');
     // add head & footer actions
     add_action('woocommerce_pos_head', array($this, 'head'));
     add_action('woocommerce_pos_footer', array($this, 'footer'));
     // now show the page
     include 'views/template.php';
     exit;
 }
开发者ID:rt-sistemas,项目名称:WooCommerce-POS,代码行数:30,代码来源:class-wc-pos-template.php

示例2: login_redirect

/**
 * Redirected den Besucher zur Login page, aber nur, wenn dieser nicht eingelogged ist.
 */
function login_redirect()
{
    if (!is_user_logged_in()) {
        auth_redirect();
        //https://codex.wordpress.org/Function_Reference/auth_redirect
    }
}
开发者ID:JanUrb,项目名称:Web-SystemeFL-WP,代码行数:10,代码来源:Doku-mummy-plugin.php

示例3: fx_private_site_please_log_in

/**
 * Redirects users that are not logged in to the 'wp-login.php' page.
 * This function is taken from Private Site Feature in "Members" Plugin.
 *
 * @since  0.1.0
 * @author Justin Tadlock <justin@justintadlock.com>
 * @copyright Copyright (c) 2009 - 2016, Justin Tadlock
 */
function fx_private_site_please_log_in()
{
    /* Check if the private site feature is active and if the user is not logged in. */
    if (true === fx_private_site_get_option('enable', false) && !is_user_logged_in()) {
        /* Hook */
        do_action('fx_private_site_before_auth_redirect');
        /* If using BuddyPress and on the register page, don't do anything. */
        if (function_exists('bp_is_activation_page') && bp_is_activation_page()) {
            return;
        }
        if (function_exists('bp_is_register_page') && bp_is_register_page()) {
            return;
        }
        /* WooCommerce: Whitelist My Account Page */
        if (class_exists('WooCommerce')) {
            $myaccount_page_id = get_option('woocommerce_myaccount_page_id');
            if ($myaccount_page_id && is_page($myaccount_page_id)) {
                return;
            }
        }
        /* Redirect to the login page. */
        auth_redirect();
        exit;
    }
}
开发者ID:turtlepod,项目名称:fx-private-site,代码行数:33,代码来源:functions.php

示例4: template_files

 public function template_files($template_path)
 {
     global $post;
     if ($post) {
         if ('question' == get_post_type() || is_tax('question_category') || ap_opt('base_page') == $post->ID || ap_opt('ask_page') == $post->ID || ap_opt('edit_page') == $post->ID || ap_opt('a_edit_page') == $post->ID || ap_opt('categories_page') == $post->ID || ap_opt('tags_page') == $post->ID || ap_opt('users_page') == $post->ID) {
             $template_path = ap_get_theme_location('index.php');
         }
     }
     if (is_tax('question_category') || is_tax('question_tags')) {
         $template_path = ap_get_theme_location('index.php');
     }
     if ('answer' == get_post_type()) {
         if (is_single()) {
             global $post;
             wp_redirect(get_permalink($post->post_parent));
             exit;
         }
     }
     if ($post && ap_opt('ask_page') == $post->ID) {
         if (!is_user_logged_in()) {
             auth_redirect();
         }
     }
     return $template_path;
 }
开发者ID:jessor,项目名称:anspress,代码行数:25,代码来源:anspress-theme.php

示例5: i4_force_login

 /**
  * Forces Login by redirecting to the login page by using the pluggable core function that redirects to
  * the page trying to be accessed after the user has logged in
  *
  */
 public function i4_force_login()
 {
     if (!is_user_logged_in()) {
         //Redirect the user if they are not authenticated
         auth_redirect();
     }
 }
开发者ID:NeilToor,项目名称:i4web-lms,代码行数:12,代码来源:class-i4-force-login.php

示例6: aioi_template_redirect

 public function aioi_template_redirect()
 {
     if (substr($_SERVER['REQUEST_URI'], 0, 16) == '/wp-activate.php') {
         return;
     }
     if (substr($_SERVER['REQUEST_URI'], 0, 11) == '/robots.txt') {
         return;
     }
     $options = $this->get_option_aioi();
     if (!$options['aioi_privatesite']) {
         return;
     }
     // We do want a private site
     if (!is_user_logged_in()) {
         auth_redirect();
     } else {
         if (is_multisite()) {
             $this->handle_private_loggedin_multisite($options);
         } else {
             // Bar access to users with no role
             $user = wp_get_current_user();
             if (!$user || !is_array($user->roles) || count($user->roles) == 0) {
                 wp_logout();
                 $output = '<p>' . esc_html('You attempted to login to the site, but you do not have any permissions. If you believe you should have access, please contact your administrator.') . '</p>';
                 wp_die($output);
             }
         }
     }
 }
开发者ID:Friends-School-Atlanta,项目名称:Deployable-WordPress,代码行数:29,代码来源:core_all_in_one_intranet.php

示例7: aceify_force_login

function aceify_force_login()
{
    global $post;
    if ((is_single() || is_front_page() || is_page()) && !is_page('login') && !is_user_logged_in()) {
        auth_redirect();
    }
}
开发者ID:acegoulet,项目名称:wp_starter_template,代码行数:7,代码来源:misc_functions.php

示例8: enforce_privacy_redirect

 /**
  * Check if privacy enforcement is enabled, and redirect users that aren't
  * logged in.
  */
 function enforce_privacy_redirect()
 {
     if ($this->settings->enforce_privacy && !is_user_logged_in()) {
         // our client endpoint relies on the wp admind ajax endpoint
         if (!defined('DOING_AJAX') || !DOING_AJAX || !isset($_GET['action']) || $_GET['action'] != 'openid-connect-authorize') {
             auth_redirect();
         }
     }
 }
开发者ID:NicholasBentley,项目名称:openid-connect-generic,代码行数:13,代码来源:openid-connect-generic.php

示例9: fl_check_user

/**
 * force_login() - checks if a wp_user is logged in. If not, it redirects them to the login page
 * 
 * will redirect to the login page if not
 **/
function fl_check_user()
{
    $current_file_name = basename($_SERVER['REQUEST_URI'], ".php");
    /* supposing filetype .php*/
    $fname = substr($current_file_name, 0, 8);
    if (!is_user_logged_in() && $fname != "wp-login") {
        auth_redirect();
    }
}
开发者ID:rpupkin77,项目名称:wp-force-login,代码行数:14,代码来源:force-login.php

示例10: default_action

 /**
  *  set default action
  */
 public function default_action()
 {
     require_once ABSPATH . 'wp-admin/includes/admin.php';
     auth_redirect();
     if (!empty($_POST['task']) && $_POST['task'] == 'contactform.export' && !empty($_POST['form_id'])) {
         self::task_export();
     }
     exit;
 }
开发者ID:webeau,项目名称:WR-ContactForm,代码行数:12,代码来源:contactform-export.php

示例11: default_action

    /**
     *  set default action
     */
    public function default_action()
    {
        require_once ABSPATH . 'wp-admin/includes/admin.php';
        auth_redirect();
        header('Content-Type: application/javascript');
        $jsHook = array();
        $jsHook['button-addnew-action'] = '$("#wpbody-content .jsn-form-title-heading h2").after(
			            $("<div/>", {"class":"contactform-add-new"}).append(
			                $("<a/>", {"text":"Add New", "href":"javascript:void(0);"})

			            ).append(
			                $("<ul/>", {"class":"contactform-sample-form"}).append(
			                    $("<li/>").append(
			                        $("<a/>", {"class":"", "href":"post-new.php?post_type=wr_cf_post_type", "text":"Blank Form"})
			                    )
			                )
			            )
			        );';
        $jsHook = apply_filters('wr_contactform_js_forms_hook', $jsHook);
        $javascript = '(function ($) {
			    $(function () {
					$(".jsn-modal-overlay,.jsn-modal-indicator").remove();
	                $("body").append($("<div/>", {
	                    "class":"jsn-modal-overlay",
	                    "style":"z-index: 1000; display: inline;"
	                })).append($("<div/>", {
	                    "class":"jsn-modal-indicator",
	                    "style":"display:block"
	                })).addClass("jsn-loading-page");
			        $("#wpbody-content h2 .add-new-h2").hide();
			        $("#search-submit").val(\'Search Forms\');
			        $("#wpbody-content h2 .add-new-h2").parent().after(
			            $("<div/>", {"class":"jsn-form-title-heading"})
			        );
			        $("#wpbody-content h2 .add-new-h2").parent().appendTo($("div.jsn-form-title-heading"));
			        ' . implode('', $jsHook) . '
			        $("#wpbody-content .contactform-add-new > a").click(function () {
			            if ($(".contactform-add-new").hasClass("active")) {
			                $(".contactform-add-new").removeClass("active");
			            } else {
			                $(".contactform-add-new").addClass("active");
			            }
			            return false;
			        });
			        $(document).click(function () {
			            $(".contactform-add-new").removeClass("active");
			        });
			        setTimeout(function () {
		                $("#wpbody-content").show();
			            $(".jsn-modal-overlay,.jsn-modal-indicator").remove();
		           }, 500);
			    });
			})(jQuery);';
        echo '' . $javascript;
        exit;
    }
开发者ID:webeau,项目名称:WR-ContactForm,代码行数:59,代码来源:contactform-js-forms.php

示例12: handle_request

 /**
  * Handle request to authorization page
  *
  * Handles response from {@see render_page}, then exits to avoid output from
  * default wp-login handlers.
  */
 public function handle_request()
 {
     // Ensure visitors are logged in before serving authorization page
     auth_redirect();
     $response = $this->render_page();
     if (is_wp_error($response)) {
         $this->display_error($response);
     }
     exit;
 }
开发者ID:inderpreet99,项目名称:OAuth1,代码行数:16,代码来源:class-wp-rest-oauth1-ui.php

示例13: controller

 /**
  * load only on Gmedia admin pages
  */
 public function controller()
 {
     $this->user_options = self::user_options();
     $view = $this->gmediablank ? '_frame' : '';
     $this->display_mode = $this->user_options["display_mode_gmedia{$view}"];
     if (!$this->page || strpos($this->page, 'GrandMedia') === false) {
         return;
     }
     auth_redirect();
     $this->processor();
 }
开发者ID:pasyuk,项目名称:grand-media,代码行数:14,代码来源:class.processor.php

示例14: members_please_log_in

/**
 * Redirects users that are not logged in to the 'wp-login.php' page.
 *
 * @since 0.1.0
 * @uses is_user_logged_in() Checks if the current user is logged in.
 * @uses auth_redirect() Redirects people that are not logged in to the login page.
 */
function members_please_log_in()
{
    /* Check if the private blog feature is active. */
    if (members_get_setting('private_blog')) {
        /* If using BuddyPress and on the register page, don't do anything. */
        if (function_exists('bp_is_current_component') && bp_is_current_component('register')) {
            return;
        } elseif (!is_user_logged_in()) {
            auth_redirect();
        }
    }
}
开发者ID:fwelections,项目名称:fwelections,代码行数:19,代码来源:private-site.php

示例15: __construct

 /**
  *
  */
 public function __construct($i_action, array $i_params)
 {
     $this->parse_get();
     $this->parse_post();
     $this->id = $this->get_id();
     $this->action = $i_action;
     $this->params = $i_params;
     $this->vars = (object) $this->vars;
     if ($this->validate_user_access() === false) {
         header('HTTP/1.1 403 Forbidden');
         \auth_redirect();
     }
 }
开发者ID:rommelsantor,项目名称:RawMVC,代码行数:16,代码来源:controller.php


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