PluginProbe
Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) / 1.7.0.6
Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) v1.7.0.6
1.8.13.1 1.8.13 1.8.12.3 1.8.12.2 1.8.12.1 1.8.12 1.8.11.3 1.8.11.2 1.8.11.1 1.8.11 1.6.6 1.6.60 1.6.7 1.6.8 1.6.9 1.7.0 1.7.0.1 1.7.0.11 1.7.0.12 1.7.0.14 1.7.0.2 1.7.0.3 1.7.0.5 1.7.0.6 1.7.0.7 All 212 releases
charitable / includes / endpoints / class-charitable-login-endpoint.php

class-charitable-login-endpoint.php in Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) 1.7.0.6, at includes/endpoints/class-charitable-login-endpoint.php

113 lines 2.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Login endpoint.
4 *
5 * @package Charitable/Classes/Charitable_Login_Endpoint
6 * @author David Bisset
7 * @copyright Copyright (c) 2022, WP Charitable LLC
8 * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
9 * @since 1.5.0
10 * @version 1.6.37
11 */
12
13 if ( ! defined( 'ABSPATH' ) ) {
14 exit;
15 }
16
17 if ( ! class_exists( 'Charitable_Login_Endpoint' ) ) :
18
19 /**
20 * Charitable_Login_Endpoint
21 *
22 * @since 1.5.0
23 */
24 class Charitable_Login_Endpoint extends Charitable_Endpoint {
25
26 /** Endpoint ID. */
27 const ID = 'login';
28
29 /** The endpoint's priority in terms of when it should be loaded. */
30 const PRIORITY = 20;
31
32 /**
33 * Object instantiation.
34 *
35 * @since 1.5.4
36 */
37 public function __construct() {
38 $this->cacheable = false;
39 }
40
41 /**
42 * Return the endpoint ID.
43 *
44 * @since 1.5.0
45 *
46 * @return string
47 */
48 public static function get_endpoint_id() {
49 return self::ID;
50 }
51
52 /**
53 * Add rewrite rules for the endpoint.
54 *
55 * @since 1.5.0
56 */
57 public function setup_rewrite_rules() {}
58
59 /**
60 * Return the endpoint URL.
61 *
62 * @since 1.5.0
63 *
64 * @global WP_Rewrite $wp_rewrite
65 * @param array $args Mixed arguments.
66 * @return string
67 */
68 public function get_page_url( $args = array() ) {
69 $page = charitable_get_option( 'login_page', 'wp' );
70
71 return 'wp' == $page ? wp_login_url() : get_permalink( $page );
72 }
73
74 /**
75 * Return whether we are currently viewing the endpoint.
76 *
77 * @since 1.5.0
78 *
79 * @global WP_Post $post
80 * @param array $args Mixed arguments.
81 * @return boolean
82 */
83 public function is_page( $args = array() ) {
84 global $post, $wp_query;
85
86 $page = charitable_get_option( 'login_page', 'wp' );
87 $strict = ! array_key_exists( 'strict', $args ) || $args['strict'];
88
89 if ( 'wp' == $page ) {
90 return $strict ? false : wp_login_url() == charitable_get_current_url();
91 }
92
93 if ( is_object( $post ) ) {
94 return $page == $post->ID;
95 }
96
97 return false;
98 }
99
100 /**
101 * Get the nav menu object.
102 *
103 * @since 1.6.29
104 *
105 * @return object
106 */
107 public function nav_menu_object() {
108 return $this->get_nav_menu_object( __( 'Log In', 'charitable' ) );
109 }
110 }
111
112 endif;
113