PluginProbe
Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) / 1.6.22
Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) v1.6.22
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 1.7.0.9 1.8.0 All 210 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.6.22, at includes/endpoints/class-charitable-registration-endpoint.php

89 lines 1.7 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 Eric Daams
7 * @copyright Copyright (c) 2019, Studio 164a
8 * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
9 * @since 1.5.0
10 * @version 1.5.4
11 */
12
13 if ( ! defined( 'ABSPATH' ) ) { exit; } // Exit if accessed directly
14
15 if ( ! class_exists( 'Charitable_Registration_Endpoint' ) ) :
16
17 /**
18 * Charitable_Registration_Endpoint
19 *
20 * @since 1.5.0
21 */
22 class Charitable_Registration_Endpoint extends Charitable_Endpoint {
23
24 /** Endpoint ID. */
25 const ID = 'registration';
26
27 /**
28 * Object instantiation.
29 *
30 * @since 1.5.4
31 */
32 public function __construct() {
33 $this->cacheable = false;
34 }
35
36 /**
37 * Return the endpoint ID.
38 *
39 * @since 1.5.0
40 *
41 * @return string
42 */
43 public static function get_endpoint_id() {
44 return self::ID;
45 }
46
47 /**
48 * Return the endpoint URL.
49 *
50 * @since 1.5.0
51 *
52 * @global WP_Rewrite $wp_rewrite
53 * @param array $args Mixed args.
54 * @return string
55 */
56 public function get_page_url( $args = array() ) {
57 $page = charitable_get_option( 'registration_page', 'wp' );
58
59 return 'wp' == $page ? wp_registration_url() : get_permalink( $page );
60 }
61
62 /**
63 * Return whether we are currently viewing the endpoint.
64 *
65 * @since 1.5.0
66 *
67 * @global WP_Post $post
68 * @param array $args Mixed args.
69 * @return boolean
70 */
71 public function is_page( $args = array() ) {
72 global $post;
73
74 $page = charitable_get_option( 'registration_page', 'wp' );
75
76 if ( 'wp' == $page ) {
77 return wp_registration_url() == charitable_get_current_url();
78 }
79
80 if ( is_object( $post ) ) {
81 return $page == $post->ID;
82 }
83
84 return false;
85 }
86 }
87
88 endif;
89