| 1 |
<?php |
| 2 |
/** |
| 3 |
* Sets up Charitable templates for specific views. |
| 4 |
* |
| 5 |
* @version 1.0.0 |
| 6 |
* @package Charitable/Classes/Charitable_Templates |
| 7 |
* @author David Bisset |
| 8 |
* @copyright Copyright (c) 2023, WP Charitable LLC |
| 9 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License |
| 10 |
*/ |
| 11 |
|
| 12 |
if ( ! defined( 'ABSPATH' ) ) { |
| 13 |
exit; |
| 14 |
} // Exit if accessed directly |
| 15 |
|
| 16 |
if ( ! class_exists( 'Charitable_Templates' ) ) : |
| 17 |
|
| 18 |
/** |
| 19 |
* Charitable_Templates |
| 20 |
* |
| 21 |
* @since 1.0.0 |
| 22 |
*/ |
| 23 |
class Charitable_Templates { |
| 24 |
|
| 25 |
/** |
| 26 |
* The single instance of this class. |
| 27 |
* |
| 28 |
* @var Charitable_Templates|null |
| 29 |
*/ |
| 30 |
private static $instance = null; |
| 31 |
|
| 32 |
/** |
| 33 |
* Returns and/or create the single instance of this class. |
| 34 |
* |
| 35 |
* @since 1.2.0 |
| 36 |
* |
| 37 |
* @return Charitable_Templates |
| 38 |
*/ |
| 39 |
public static function get_instance() { |
| 40 |
if ( is_null( self::$instance ) ) { |
| 41 |
self::$instance = new self(); |
| 42 |
} |
| 43 |
|
| 44 |
return self::$instance; |
| 45 |
} |
| 46 |
|
| 47 |
/** |
| 48 |
* Set up the class. |
| 49 |
* |
| 50 |
* Note that the only way to instantiate an object is with the charitable_start method, |
| 51 |
* which can only be called during the start phase. In other words, don't try |
| 52 |
* to instantiate this object. |
| 53 |
* |
| 54 |
* @since 1.0.0 |
| 55 |
*/ |
| 56 |
private function __construct() { |
| 57 |
/* If you want to unhook any of the callbacks attached above, use this hook. */ |
| 58 |
do_action( 'charitable_templates_start', $this ); |
| 59 |
} |
| 60 |
|
| 61 |
/***********************************************/ |
| 62 |
/* HERE BE DEPRECATED METHODS |
| 63 |
/***********************************************/ |
| 64 |
|
| 65 |
/** |
| 66 |
* @deprecated 1.5.0 |
| 67 |
*/ |
| 68 |
public function template_loader( $template ) { |
| 69 |
charitable_get_deprecated()->deprecated_function( |
| 70 |
__METHOD__, |
| 71 |
'1.5.0', |
| 72 |
'Charitable_Endpoints::template_loader()' |
| 73 |
); |
| 74 |
|
| 75 |
return charitable()->endpoints()->template_loader( $template ); |
| 76 |
} |
| 77 |
|
| 78 |
/** |
| 79 |
* @deprecated 1.5.0 |
| 80 |
*/ |
| 81 |
protected function get_donation_receipt_template( $template ) { |
| 82 |
charitable_get_deprecated()->deprecated_function( |
| 83 |
__METHOD__, |
| 84 |
'1.5.0', |
| 85 |
'Charitable_Donation_Receipt_Endpoint::get_template()' |
| 86 |
); |
| 87 |
|
| 88 |
return charitable()->endpoints()->get_endpoint_template( 'donation_receipt', $template ); |
| 89 |
} |
| 90 |
|
| 91 |
/** |
| 92 |
* @deprecated 1.5.0 |
| 93 |
*/ |
| 94 |
protected function get_donation_processing_template( $template ) { |
| 95 |
charitable_get_deprecated()->deprecated_function( |
| 96 |
__METHOD__, |
| 97 |
'1.5.0', |
| 98 |
'Charitable_Donation_Processing_Endpoint::get_template()' |
| 99 |
); |
| 100 |
|
| 101 |
return charitable()->endpoints()->get_endpoint_template( 'donation_processing', $template ); |
| 102 |
} |
| 103 |
|
| 104 |
/** |
| 105 |
* @deprecated 1.5.0 |
| 106 |
*/ |
| 107 |
protected function get_donate_template( $template ) { |
| 108 |
charitable_get_deprecated()->deprecated_function( |
| 109 |
__METHOD__, |
| 110 |
'1.5.0', |
| 111 |
'Charitable_Campaign_Donation_Endpoint::get_template()' |
| 112 |
); |
| 113 |
|
| 114 |
return charitable()->endpoints()->get_endpoint_template( 'campaign_donation', $template ); |
| 115 |
} |
| 116 |
|
| 117 |
/** |
| 118 |
* @deprecated 1.5.0 |
| 119 |
*/ |
| 120 |
protected function get_widget_template( $template ) { |
| 121 |
charitable_get_deprecated()->deprecated_function( |
| 122 |
__METHOD__, |
| 123 |
'1.5.0', |
| 124 |
'Charitable_Campaign_Widget_Endpoint::get_template()' |
| 125 |
); |
| 126 |
|
| 127 |
return charitable()->endpoints()->get_endpoint_template( 'campaign_widget', $template ); |
| 128 |
} |
| 129 |
|
| 130 |
/** |
| 131 |
* @deprecated 1.5.0 |
| 132 |
*/ |
| 133 |
protected function get_email_template( $template ) { |
| 134 |
charitable_get_deprecated()->deprecated_function( |
| 135 |
__METHOD__, |
| 136 |
'1.5.0', |
| 137 |
'Charitable_Email_Preview_Endpoint::get_template()' |
| 138 |
); |
| 139 |
|
| 140 |
return charitable()->endpoints()->get_endpoint_template( 'email_preview', $template ); |
| 141 |
} |
| 142 |
|
| 143 |
/** |
| 144 |
* @deprecated 1.5.0 |
| 145 |
*/ |
| 146 |
protected function get_forgot_password_template( $template ) { |
| 147 |
charitable_get_deprecated()->deprecated_function( |
| 148 |
__METHOD__, |
| 149 |
'1.5.0', |
| 150 |
'Charitable_Forgot_Password_Endpoint::get_template()' |
| 151 |
); |
| 152 |
|
| 153 |
return charitable()->endpoints()->get_endpoint_template( 'forgot_password', $template ); |
| 154 |
} |
| 155 |
|
| 156 |
/** |
| 157 |
* @deprecated 1.5.0 |
| 158 |
*/ |
| 159 |
protected function get_reset_password_template( $template ) { |
| 160 |
charitable_get_deprecated()->deprecated_function( |
| 161 |
__METHOD__, |
| 162 |
'1.5.0', |
| 163 |
'Charitable_Reset_Password_Endpoint::get_template()' |
| 164 |
); |
| 165 |
|
| 166 |
return charitable()->endpoints()->get_endpoint_template( 'reset_password', $template ); |
| 167 |
} |
| 168 |
|
| 169 |
/** |
| 170 |
* @deprecated 1.3.0 |
| 171 |
*/ |
| 172 |
public function add_donation_page_body_class( $classes ) { |
| 173 |
charitable_get_deprecated()->deprecated_function( |
| 174 |
__METHOD__, |
| 175 |
'1.3.0', |
| 176 |
'charitable_add_body_classes()' |
| 177 |
); |
| 178 |
|
| 179 |
return $classes; |
| 180 |
} |
| 181 |
|
| 182 |
/** |
| 183 |
* @deprecated 1.3.0 |
| 184 |
*/ |
| 185 |
public function add_widget_page_body_class( $classes ) { |
| 186 |
charitable_get_deprecated()->deprecated_function( |
| 187 |
__METHOD__, |
| 188 |
'1.3.0', |
| 189 |
'charitable_add_body_classes()' |
| 190 |
); |
| 191 |
|
| 192 |
return $classes; |
| 193 |
} |
| 194 |
|
| 195 |
/** |
| 196 |
* @deprecated 1.3.0 |
| 197 |
*/ |
| 198 |
public function remove_admin_bar_from_widget_template() { |
| 199 |
charitable_get_deprecated()->deprecated_function( |
| 200 |
__METHOD__, |
| 201 |
'1.3.0', |
| 202 |
'charitable_hide_admin_bar()' |
| 203 |
); |
| 204 |
|
| 205 |
return charitable_hide_admin_bar(); |
| 206 |
} |
| 207 |
|
| 208 |
/** |
| 209 |
* @deprecated 1.3.0 |
| 210 |
*/ |
| 211 |
public function donation_receipt_template( $template ) { |
| 212 |
charitable_get_deprecated()->deprecated_function( |
| 213 |
__METHOD__, |
| 214 |
'1.3.0', |
| 215 |
'Charitable_Templates::template_loader() or Charitable_Templates::get_donation_receipt_template()' |
| 216 |
); |
| 217 |
|
| 218 |
return $this->get_donation_receipt_template( $template ); |
| 219 |
} |
| 220 |
|
| 221 |
/** |
| 222 |
* @deprecated 1.3.0 |
| 223 |
*/ |
| 224 |
public function donation_processing_template( $template ) { |
| 225 |
charitable_get_deprecated()->deprecated_function( |
| 226 |
__METHOD__, |
| 227 |
'1.3.0', |
| 228 |
'Charitable_Templates::template_loader() or Charitable_Templates::get_donation_processing_template()' |
| 229 |
); |
| 230 |
|
| 231 |
return $this->get_donation_processing_template( $template ); |
| 232 |
} |
| 233 |
|
| 234 |
/** |
| 235 |
* @deprecated 1.3.0 |
| 236 |
*/ |
| 237 |
public function donate_template( $template ) { |
| 238 |
charitable_get_deprecated()->deprecated_function( |
| 239 |
__METHOD__, |
| 240 |
'1.3.0', |
| 241 |
'Charitable_Templates::template_loader() or Charitable_Templates::get_donate_template()' |
| 242 |
); |
| 243 |
|
| 244 |
return $this->get_donate_template( $template ); |
| 245 |
} |
| 246 |
|
| 247 |
/** |
| 248 |
* @deprecated 1.3.0 |
| 249 |
*/ |
| 250 |
public function widget_template( $template ) { |
| 251 |
charitable_get_deprecated()->deprecated_function( |
| 252 |
__METHOD__, |
| 253 |
'1.3.0', |
| 254 |
'Charitable_Templates::template_loader() or Charitable_Templates::get_widget_template()' |
| 255 |
); |
| 256 |
|
| 257 |
return $this->get_widget_template( $template ); |
| 258 |
} |
| 259 |
|
| 260 |
/** |
| 261 |
* @deprecated 1.3.0 |
| 262 |
*/ |
| 263 |
public function email_template( $template ) { |
| 264 |
charitable_get_deprecated()->deprecated_function( |
| 265 |
__METHOD__, |
| 266 |
'1.3.0', |
| 267 |
'Charitable_Templates::template_loader() or Charitable_Templates::get_email_template()' |
| 268 |
); |
| 269 |
|
| 270 |
return $this->get_email_template( $template ); |
| 271 |
} |
| 272 |
} |
| 273 |
|
| 274 |
endif; // End class_exists check |
| 275 |
|