PluginProbe
Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) / 1.7.0.5
Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) v1.7.0.5
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-registration-endpoint.php

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

105 lines 2.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Registration endpoint.
4 *
5 * @package Charitable/Classes/Charitable_Registration_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_Registration_Endpoint' ) ) :
18
19 /**
20 * Charitable_Registration_Endpoint
21 *
22 * @since 1.5.0
23 */
24 class Charitable_Registration_Endpoint extends Charitable_Endpoint {
25
26 /** Endpoint ID. */
27 const ID = 'registration';
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 * Return the endpoint URL.
54 *
55 * @since 1.5.0
56 *
57 * @global WP_Rewrite $wp_rewrite
58 * @param array $args Mixed args.
59 * @return string
60 */
61 public function get_page_url( $args = array() ) {
62 $page = charitable_get_option( 'registration_page', 'wp' );
63
64 return 'wp' == $page ? wp_registration_url() : get_permalink( $page );
65 }
66
67 /**
68 * Return whether we are currently viewing the endpoint.
69 *
70 * @since 1.5.0
71 *
72 * @global WP_Post $post
73 * @param array $args Mixed args.
74 * @return boolean
75 */
76 public function is_page( $args = array() ) {
77 global $post;
78
79 $page = charitable_get_option( 'registration_page', 'wp' );
80
81 if ( 'wp' == $page ) {
82 return wp_registration_url() == charitable_get_current_url();
83 }
84
85 if ( is_object( $post ) ) {
86 return $page == $post->ID;
87 }
88
89 return false;
90 }
91
92 /**
93 * Get the nav menu object.
94 *
95 * @since 1.6.29
96 *
97 * @return object
98 */
99 public function nav_menu_object() {
100 return $this->get_nav_menu_object( __( 'Register', 'charitable' ) );
101 }
102 }
103
104 endif;
105