PluginProbe
Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) / 1.8.13
Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) v1.8.13
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
← All changes | includes/public/class-charitable-ghost-page.php +131 -129 1.6.7 → 1.8.13 View file →
@@ -5,155 +5,157 @@
5 5 * This is based on the IT_Exchange_Casper class in iThemes Exchange.
6 6 *
7 7 * @version 1.0.0
8 8 * @package Charitable/Classes/Charitable_Ghost_Page
9 - * @author Eric Daams
10 - * @copyright Copyright (c) 2018, Studio 164a
9 + * @author David Bisset
10 + * @copyright Copyright (c) 2023, WP Charitable LLC
11 11 * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
12 12 */
13 13
14 14 // Exit if accessed directly.
15 -if ( ! defined( 'ABSPATH' ) ) { exit; }
15 +if ( ! defined( 'ABSPATH' ) ) {
16 + exit;
17 +}
16 18
17 19 if ( ! class_exists( 'Charitable_Ghost_Page' ) ) :
18 20
19 - /**
20 - * Charitable_Ghost_Page class.
21 - *
22 - * It is used when viewing a frontend Charitable view other than a campaign.
23 - *
24 - * @since 1.0.0
25 - */
26 - class Charitable_Ghost_Page {
21 + /**
22 + * Charitable_Ghost_Page class.
23 + *
24 + * It is used when viewing a frontend Charitable view other than a campaign.
25 + *
26 + * @since 1.0.0
27 + */
28 + class Charitable_Ghost_Page {
27 29
28 - /**
29 - * @var string $current_view The current Charitable frontend view. Should never be campaign.
30 - * @since 1.0.0
31 - */
32 - private $current_view;
30 + /**
31 + * @var string $current_view The current Charitable frontend view. Should never be campaign.
32 + * @since 1.0.0
33 + */
34 + private $current_view;
33 35
34 - /**
35 - * @var array $args
36 - * @since 1.0.0
37 - */
38 - private $args;
36 + /**
37 + * @var array $args
38 + * @since 1.0.0
39 + */
40 + private $args;
39 41
40 - /**
41 - * @var WP_Query $wp_query
42 - * @since 1.0.0
43 - */
44 - private $wp_query;
42 + /**
43 + * @var WP_Query $wp_query
44 + * @since 1.0.0
45 + */
46 + private $wp_query;
45 47
46 - /**
47 - * Constructor. Sets $current_view and $wp_query properties.
48 - *
49 - * @since 1.0.0
50 - *
51 - * @param string $current_view
52 - * @param array $args
53 - */
54 - public function __construct( $current_view, $args = array() ) {
55 - if ( 'campaign' == $current_view ) {
56 - throw new Exception( 'Charitable_Ghost_Page should not be constructed when $current_view is "campaign".' );
57 - }
58 -
59 - $this->current_view = $current_view;
48 + /**
49 + * Constructor. Sets $current_view and $wp_query properties.
50 + *
51 + * @since 1.0.0
52 + *
53 + * @param string $current_view
54 + * @param array $args
55 + */
56 + public function __construct( $current_view, $args = array() ) {
57 + if ( 'campaign' == $current_view ) {
58 + throw new Exception( 'Charitable_Ghost_Page should not be constructed when $current_view is "campaign".' );
59 + }
60 60
61 - $defaults = array(
62 - 'title' => '',
63 - 'content' => ''
64 - );
61 + $this->current_view = $current_view;
65 62
66 - $this->args = wp_parse_args( $args, $defaults );
67 - $this->modify_wp_query();
63 + $defaults = array(
64 + 'title' => '',
65 + 'content' => ''
66 + );
68 67
69 - /* Remove wpautop filter on Ghost pages */
70 - remove_filter( 'the_content', 'wpautop' );
71 - }
68 + $this->args = wp_parse_args( $args, $defaults );
69 + $this->modify_wp_query();
72 70
73 - /**
74 - * Modifies the WP Query.
75 - *
76 - * @since 1.0.0
77 - *
78 - * @return void
79 - */
80 - private function modify_wp_query() {
81 - $wp_query = $GLOBALS['wp_query'];
71 + /* Remove wpautop filter on Ghost pages */
72 + remove_filter( 'the_content', 'wpautop' );
73 + }
82 74
83 - $wp_query->posts_per_page = 1;
84 - $wp_query->nopaging = true;
85 - $wp_query->post_count = 1;
75 + /**
76 + * Modifies the WP Query.
77 + *
78 + * @since 1.0.0
79 + *
80 + * @return void
81 + */
82 + private function modify_wp_query() {
83 + $wp_query = $GLOBALS['wp_query'];
86 84
87 - // If we don't have a post, load an empty one
88 - if ( empty( $wp_query->post ) ) {
89 - $wp_query->post = new WP_Post( new stdClass() );
90 - }
85 + $wp_query->posts_per_page = 1;
86 + $wp_query->nopaging = true;
87 + $wp_query->post_count = 1;
91 88
92 - $wp_query->post->ID = 0;
93 - $wp_query->post->post_date = current_time( 'mysql' );
94 - $wp_query->post->post_date_gmt = current_time( 'mysql', 1 );
95 - $wp_query->post->post_content = $this->args[ 'content' ];
96 - $wp_query->post->post_title = $this->args[ 'title' ];
97 - $wp_query->post->post_excerpt = '';
98 - $wp_query->post->post_status = 'publish';
99 - $wp_query->post->comment_status = false;
100 - $wp_query->post->ping_status = false;
101 - $wp_query->post->post_password = '';
102 - $wp_query->post->post_name = 'charitable-ghost-' . $this->current_view;
103 - $wp_query->post->to_ping = '';
104 - $wp_query->post->pinged = '';
105 - $wp_query->post->post_modified = $wp_query->post->post_date;
106 - $wp_query->post->post_modified_gmt = $wp_query->post->post_date_gmt;
107 - $wp_query->post->post_content_filtered = '';
108 - $wp_query->post->post_parent = 0;
109 - $wp_query->post->guid = get_home_url() . '/' . $this->get_guid();
110 - $wp_query->post->menu_order = 0;
111 - $wp_query->post->post_type = 'page';
112 - $wp_query->post->post_mime_type = '';
113 - $wp_query->post->comment_count = 0;
114 - $wp_query->post->filter = 'raw';
89 + // If we don't have a post, load an empty one
90 + if ( empty( $wp_query->post ) ) {
91 + $wp_query->post = new WP_Post( new stdClass() );
92 + }
115 93
116 - $wp_query->posts = array( $wp_query->post );
117 - $wp_query->found_posts = 1;
118 - $wp_query->is_single = false; //false -- so comments_template() doesn't add comments
119 - $wp_query->is_preview = false;
120 - $wp_query->is_page = false; //false -- so comments_template() doesn't add comments
121 - $wp_query->is_archive = false;
122 - $wp_query->is_date = false;
123 - $wp_query->is_year = false;
124 - $wp_query->is_month = false;
125 - $wp_query->is_day = false;
126 - $wp_query->is_time = false;
127 - $wp_query->is_author = false;
128 - $wp_query->is_category = false;
129 - $wp_query->is_tag = false;
130 - $wp_query->is_tax = false;
131 - $wp_query->is_search = false;
132 - $wp_query->is_feed = false;
133 - $wp_query->is_comment_feed = false;
134 - $wp_query->is_trackback = false;
135 - $wp_query->is_home = false;
136 - $wp_query->is_404 = false;
137 - $wp_query->is_comments_popup = false;
138 - $wp_query->is_paged = false;
139 - $wp_query->is_admin = false;
140 - $wp_query->is_attachment = false;
141 - $wp_query->is_singular = false;
142 - $wp_query->is_posts_page = false;
143 - $wp_query->is_post_type_archive = false;
144 -
145 - $GLOBALS['wp_query'] = $wp_query;
146 - }
94 + $wp_query->post->ID = 0;
95 + $wp_query->post->post_date = current_time( 'mysql' );
96 + $wp_query->post->post_date_gmt = current_time( 'mysql', 1 );
97 + $wp_query->post->post_content = $this->args['content'];
98 + $wp_query->post->post_title = $this->args['title'];
99 + $wp_query->post->post_excerpt = '';
100 + $wp_query->post->post_status = 'publish';
101 + $wp_query->post->comment_status = false;
102 + $wp_query->post->ping_status = false;
103 + $wp_query->post->post_password = '';
104 + $wp_query->post->post_name = 'charitable-ghost-' . $this->current_view;
105 + $wp_query->post->to_ping = '';
106 + $wp_query->post->pinged = '';
107 + $wp_query->post->post_modified = $wp_query->post->post_date;
108 + $wp_query->post->post_modified_gmt = $wp_query->post->post_date_gmt;
109 + $wp_query->post->post_content_filtered = '';
110 + $wp_query->post->post_parent = 0;
111 + $wp_query->post->guid = get_home_url() . '/' . $this->get_guid();
112 + $wp_query->post->menu_order = 0;
113 + $wp_query->post->post_type = 'page';
114 + $wp_query->post->post_mime_type = '';
115 + $wp_query->post->comment_count = 0;
116 + $wp_query->post->filter = 'raw';
147 117
148 - /**
149 - * Creates a guid based on the current view.
150 - *
151 - * @since 1.0.0
152 - *
153 - * @return string
154 - */
155 - private function get_guid() {
156 - }
157 - }
118 + $wp_query->posts = array( $wp_query->post );
119 + $wp_query->found_posts = 1;
120 + $wp_query->is_single = false; //false -- so comments_template() doesn't add comments
121 + $wp_query->is_preview = false;
122 + $wp_query->is_page = true; //false -- so comments_template() doesn't add comments
123 + $wp_query->is_archive = false;
124 + $wp_query->is_date = false;
125 + $wp_query->is_year = false;
126 + $wp_query->is_month = false;
127 + $wp_query->is_day = false;
128 + $wp_query->is_time = false;
129 + $wp_query->is_author = false;
130 + $wp_query->is_category = false;
131 + $wp_query->is_tag = false;
132 + $wp_query->is_tax = false;
133 + $wp_query->is_search = false;
134 + $wp_query->is_feed = false;
135 + $wp_query->is_comment_feed = false;
136 + $wp_query->is_trackback = false;
137 + $wp_query->is_home = false;
138 + $wp_query->is_404 = false;
139 + $wp_query->is_comments_popup = false;
140 + $wp_query->is_paged = false;
141 + $wp_query->is_admin = false;
142 + $wp_query->is_attachment = false;
143 + $wp_query->is_singular = true;
144 + $wp_query->is_posts_page = false;
145 + $wp_query->is_post_type_archive = false;
146 +
147 + $GLOBALS['wp_query'] = $wp_query;
148 + }
149 +
150 + /**
151 + * Creates a guid based on the current view.
152 + *
153 + * @since 1.0.0
154 + *
155 + * @return string
156 + */
157 + private function get_guid() {
158 + }
159 + }
158 160
159 161 endif;