@@ -40,11 +40,11 @@ discard block |
||
40 | 40 | */ |
41 | 41 | |
42 | 42 | // Exit if accessed directly |
43 | -if ( ! defined( 'ABSPATH' ) ) { |
|
43 | +if ( ! defined('ABSPATH')) { |
|
44 | 44 | exit; |
45 | 45 | } |
46 | 46 | |
47 | -if ( ! class_exists( 'Give' ) ) : |
|
47 | +if ( ! class_exists('Give')) : |
|
48 | 48 | /** |
49 | 49 | * Main Give Class |
50 | 50 | * |
@@ -159,11 +159,11 @@ discard block |
||
159 | 159 | * @return Give |
160 | 160 | */ |
161 | 161 | public static function instance() { |
162 | - if ( ! isset( self::$instance ) && ! ( self::$instance instanceof Give ) ) { |
|
162 | + if ( ! isset(self::$instance) && ! (self::$instance instanceof Give)) { |
|
163 | 163 | self::$instance = new Give; |
164 | 164 | self::$instance->setup_constants(); |
165 | 165 | |
166 | - add_action( 'plugins_loaded', array( self::$instance, 'load_textdomain' ) ); |
|
166 | + add_action('plugins_loaded', array(self::$instance, 'load_textdomain')); |
|
167 | 167 | |
168 | 168 | self::$instance->includes(); |
169 | 169 | self::$instance->roles = new Give_Roles(); |
@@ -196,7 +196,7 @@ discard block |
||
196 | 196 | */ |
197 | 197 | public function __clone() { |
198 | 198 | // Cloning instances of the class is forbidden |
199 | - _doing_it_wrong( __FUNCTION__, __( 'Cheatin’ huh?', 'give' ), '1.0' ); |
|
199 | + _doing_it_wrong(__FUNCTION__, __('Cheatin’ huh?', 'give'), '1.0'); |
|
200 | 200 | } |
201 | 201 | |
202 | 202 | /** |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | */ |
209 | 209 | public function __wakeup() { |
210 | 210 | // Unserializing instances of the class is forbidden |
211 | - _doing_it_wrong( __FUNCTION__, __( 'Cheatin’ huh?', 'give' ), '1.0' ); |
|
211 | + _doing_it_wrong(__FUNCTION__, __('Cheatin’ huh?', 'give'), '1.0'); |
|
212 | 212 | } |
213 | 213 | |
214 | 214 | /** |
@@ -221,33 +221,33 @@ discard block |
||
221 | 221 | private function setup_constants() { |
222 | 222 | |
223 | 223 | // Plugin version |
224 | - if ( ! defined( 'GIVE_VERSION' ) ) { |
|
225 | - define( 'GIVE_VERSION', '1.4' ); |
|
224 | + if ( ! defined('GIVE_VERSION')) { |
|
225 | + define('GIVE_VERSION', '1.4'); |
|
226 | 226 | } |
227 | 227 | |
228 | 228 | // Plugin Folder Path |
229 | - if ( ! defined( 'GIVE_PLUGIN_DIR' ) ) { |
|
230 | - define( 'GIVE_PLUGIN_DIR', plugin_dir_path( __FILE__ ) ); |
|
229 | + if ( ! defined('GIVE_PLUGIN_DIR')) { |
|
230 | + define('GIVE_PLUGIN_DIR', plugin_dir_path(__FILE__)); |
|
231 | 231 | } |
232 | 232 | |
233 | 233 | // Plugin Folder URL |
234 | - if ( ! defined( 'GIVE_PLUGIN_URL' ) ) { |
|
235 | - define( 'GIVE_PLUGIN_URL', plugin_dir_url( __FILE__ ) ); |
|
234 | + if ( ! defined('GIVE_PLUGIN_URL')) { |
|
235 | + define('GIVE_PLUGIN_URL', plugin_dir_url(__FILE__)); |
|
236 | 236 | } |
237 | 237 | |
238 | 238 | // Plugin Basename aka: "give/give.php" |
239 | - if ( ! defined( 'GIVE_PLUGIN_BASENAME' ) ) { |
|
240 | - define( 'GIVE_PLUGIN_BASENAME', plugin_basename( __FILE__ ) ); |
|
239 | + if ( ! defined('GIVE_PLUGIN_BASENAME')) { |
|
240 | + define('GIVE_PLUGIN_BASENAME', plugin_basename(__FILE__)); |
|
241 | 241 | } |
242 | 242 | |
243 | 243 | // Plugin Root File |
244 | - if ( ! defined( 'GIVE_PLUGIN_FILE' ) ) { |
|
245 | - define( 'GIVE_PLUGIN_FILE', __FILE__ ); |
|
244 | + if ( ! defined('GIVE_PLUGIN_FILE')) { |
|
245 | + define('GIVE_PLUGIN_FILE', __FILE__); |
|
246 | 246 | } |
247 | 247 | |
248 | 248 | // Make sure CAL_GREGORIAN is defined |
249 | - if ( ! defined( 'CAL_GREGORIAN' ) ) { |
|
250 | - define( 'CAL_GREGORIAN', 1 ); |
|
249 | + if ( ! defined('CAL_GREGORIAN')) { |
|
250 | + define('CAL_GREGORIAN', 1); |
|
251 | 251 | } |
252 | 252 | } |
253 | 253 | |
@@ -261,107 +261,107 @@ discard block |
||
261 | 261 | private function includes() { |
262 | 262 | global $give_options; |
263 | 263 | |
264 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/register-settings.php'; |
|
264 | + require_once GIVE_PLUGIN_DIR.'includes/admin/register-settings.php'; |
|
265 | 265 | $give_options = give_get_settings(); |
266 | 266 | |
267 | - require_once GIVE_PLUGIN_DIR . 'includes/post-types.php'; |
|
268 | - require_once GIVE_PLUGIN_DIR . 'includes/scripts.php'; |
|
269 | - require_once GIVE_PLUGIN_DIR . 'includes/ajax-functions.php'; |
|
270 | - require_once GIVE_PLUGIN_DIR . 'includes/actions.php'; |
|
271 | - require_once GIVE_PLUGIN_DIR . 'includes/api/class-give-api.php'; |
|
272 | - |
|
273 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-roles.php'; |
|
274 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-template-loader.php'; |
|
275 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-donate-form.php'; |
|
276 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-db.php'; |
|
277 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-customers.php'; |
|
278 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-customer.php'; |
|
279 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-stats.php'; |
|
280 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-session.php'; |
|
281 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-html-elements.php'; |
|
282 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-logging.php'; |
|
283 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-license-handler.php'; |
|
284 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-cron.php'; |
|
285 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-email-access.php'; |
|
286 | - |
|
287 | - require_once GIVE_PLUGIN_DIR . 'includes/country-functions.php'; |
|
288 | - require_once GIVE_PLUGIN_DIR . 'includes/template-functions.php'; |
|
289 | - require_once GIVE_PLUGIN_DIR . 'includes/misc-functions.php'; |
|
290 | - require_once GIVE_PLUGIN_DIR . 'includes/forms/functions.php'; |
|
291 | - require_once GIVE_PLUGIN_DIR . 'includes/forms/template.php'; |
|
292 | - require_once GIVE_PLUGIN_DIR . 'includes/forms/widget.php'; |
|
293 | - require_once GIVE_PLUGIN_DIR . 'includes/shortcodes.php'; |
|
294 | - require_once GIVE_PLUGIN_DIR . 'includes/formatting.php'; |
|
295 | - require_once GIVE_PLUGIN_DIR . 'includes/price-functions.php'; |
|
296 | - require_once GIVE_PLUGIN_DIR . 'includes/error-tracking.php'; |
|
297 | - require_once GIVE_PLUGIN_DIR . 'includes/process-purchase.php'; |
|
298 | - require_once GIVE_PLUGIN_DIR . 'includes/login-register.php'; |
|
299 | - require_once GIVE_PLUGIN_DIR . 'includes/user-functions.php'; |
|
300 | - require_once GIVE_PLUGIN_DIR . 'includes/plugin-compatibility.php'; |
|
301 | - require_once GIVE_PLUGIN_DIR . 'includes/deprecated-functions.php'; |
|
302 | - |
|
303 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/functions.php'; |
|
304 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/actions.php'; |
|
305 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/class-payment-stats.php'; |
|
306 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/class-payments-query.php'; |
|
307 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/class-donators-gravatars.php'; |
|
308 | - |
|
309 | - require_once GIVE_PLUGIN_DIR . 'includes/gateways/functions.php'; |
|
310 | - require_once GIVE_PLUGIN_DIR . 'includes/gateways/actions.php'; |
|
311 | - require_once GIVE_PLUGIN_DIR . 'includes/gateways/paypal-standard.php'; |
|
312 | - require_once GIVE_PLUGIN_DIR . 'includes/gateways/offline-donations.php'; |
|
313 | - require_once GIVE_PLUGIN_DIR . 'includes/gateways/manual.php'; |
|
314 | - |
|
315 | - require_once GIVE_PLUGIN_DIR . 'includes/emails/class-give-emails.php'; |
|
316 | - require_once GIVE_PLUGIN_DIR . 'includes/emails/class-give-email-tags.php'; |
|
317 | - require_once GIVE_PLUGIN_DIR . 'includes/emails/functions.php'; |
|
318 | - require_once GIVE_PLUGIN_DIR . 'includes/emails/template.php'; |
|
319 | - require_once GIVE_PLUGIN_DIR . 'includes/emails/actions.php'; |
|
320 | - |
|
321 | - if ( is_admin() || ( defined( 'WP_CLI' ) && WP_CLI ) ) { |
|
322 | - |
|
323 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-footer.php'; |
|
324 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/welcome.php'; |
|
325 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-pages.php'; |
|
326 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/class-admin-notices.php'; |
|
327 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/class-api-keys-table.php'; |
|
328 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-actions.php'; |
|
329 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/system-info.php'; |
|
330 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/export-functions.php'; |
|
331 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/add-ons.php'; |
|
332 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/plugins.php'; |
|
333 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/dashboard-widgets.php'; |
|
334 | - |
|
335 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/payments/actions.php'; |
|
336 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/payments/payments-history.php'; |
|
337 | - |
|
338 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/customers/customers.php'; |
|
339 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/customers/customer-functions.php'; |
|
340 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/customers/customer-actions.php'; |
|
341 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/forms/metabox.php'; |
|
342 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/forms/dashboard-columns.php'; |
|
343 | - |
|
344 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/reports.php'; |
|
345 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/pdf-reports.php'; |
|
346 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/class-give-graph.php'; |
|
347 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/graphing.php'; |
|
348 | - |
|
349 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/abstract-shortcode-generator.php'; |
|
350 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/class-shortcode-button.php'; |
|
351 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-form.php'; |
|
352 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-goal.php'; |
|
353 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-login.php'; |
|
354 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-register.php'; |
|
355 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-profile-editor.php'; |
|
356 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-donation-history.php'; |
|
357 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-receipt.php'; |
|
358 | - |
|
359 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/upgrades/upgrade-functions.php'; |
|
360 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/upgrades/upgrades.php'; |
|
267 | + require_once GIVE_PLUGIN_DIR.'includes/post-types.php'; |
|
268 | + require_once GIVE_PLUGIN_DIR.'includes/scripts.php'; |
|
269 | + require_once GIVE_PLUGIN_DIR.'includes/ajax-functions.php'; |
|
270 | + require_once GIVE_PLUGIN_DIR.'includes/actions.php'; |
|
271 | + require_once GIVE_PLUGIN_DIR.'includes/api/class-give-api.php'; |
|
272 | + |
|
273 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-roles.php'; |
|
274 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-template-loader.php'; |
|
275 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-donate-form.php'; |
|
276 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-db.php'; |
|
277 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-db-customers.php'; |
|
278 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-customer.php'; |
|
279 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-stats.php'; |
|
280 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-session.php'; |
|
281 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-html-elements.php'; |
|
282 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-logging.php'; |
|
283 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-license-handler.php'; |
|
284 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-cron.php'; |
|
285 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-email-access.php'; |
|
286 | + |
|
287 | + require_once GIVE_PLUGIN_DIR.'includes/country-functions.php'; |
|
288 | + require_once GIVE_PLUGIN_DIR.'includes/template-functions.php'; |
|
289 | + require_once GIVE_PLUGIN_DIR.'includes/misc-functions.php'; |
|
290 | + require_once GIVE_PLUGIN_DIR.'includes/forms/functions.php'; |
|
291 | + require_once GIVE_PLUGIN_DIR.'includes/forms/template.php'; |
|
292 | + require_once GIVE_PLUGIN_DIR.'includes/forms/widget.php'; |
|
293 | + require_once GIVE_PLUGIN_DIR.'includes/shortcodes.php'; |
|
294 | + require_once GIVE_PLUGIN_DIR.'includes/formatting.php'; |
|
295 | + require_once GIVE_PLUGIN_DIR.'includes/price-functions.php'; |
|
296 | + require_once GIVE_PLUGIN_DIR.'includes/error-tracking.php'; |
|
297 | + require_once GIVE_PLUGIN_DIR.'includes/process-purchase.php'; |
|
298 | + require_once GIVE_PLUGIN_DIR.'includes/login-register.php'; |
|
299 | + require_once GIVE_PLUGIN_DIR.'includes/user-functions.php'; |
|
300 | + require_once GIVE_PLUGIN_DIR.'includes/plugin-compatibility.php'; |
|
301 | + require_once GIVE_PLUGIN_DIR.'includes/deprecated-functions.php'; |
|
302 | + |
|
303 | + require_once GIVE_PLUGIN_DIR.'includes/payments/functions.php'; |
|
304 | + require_once GIVE_PLUGIN_DIR.'includes/payments/actions.php'; |
|
305 | + require_once GIVE_PLUGIN_DIR.'includes/payments/class-payment-stats.php'; |
|
306 | + require_once GIVE_PLUGIN_DIR.'includes/payments/class-payments-query.php'; |
|
307 | + require_once GIVE_PLUGIN_DIR.'includes/payments/class-donators-gravatars.php'; |
|
308 | + |
|
309 | + require_once GIVE_PLUGIN_DIR.'includes/gateways/functions.php'; |
|
310 | + require_once GIVE_PLUGIN_DIR.'includes/gateways/actions.php'; |
|
311 | + require_once GIVE_PLUGIN_DIR.'includes/gateways/paypal-standard.php'; |
|
312 | + require_once GIVE_PLUGIN_DIR.'includes/gateways/offline-donations.php'; |
|
313 | + require_once GIVE_PLUGIN_DIR.'includes/gateways/manual.php'; |
|
314 | + |
|
315 | + require_once GIVE_PLUGIN_DIR.'includes/emails/class-give-emails.php'; |
|
316 | + require_once GIVE_PLUGIN_DIR.'includes/emails/class-give-email-tags.php'; |
|
317 | + require_once GIVE_PLUGIN_DIR.'includes/emails/functions.php'; |
|
318 | + require_once GIVE_PLUGIN_DIR.'includes/emails/template.php'; |
|
319 | + require_once GIVE_PLUGIN_DIR.'includes/emails/actions.php'; |
|
320 | + |
|
321 | + if (is_admin() || (defined('WP_CLI') && WP_CLI)) { |
|
322 | + |
|
323 | + require_once GIVE_PLUGIN_DIR.'includes/admin/admin-footer.php'; |
|
324 | + require_once GIVE_PLUGIN_DIR.'includes/admin/welcome.php'; |
|
325 | + require_once GIVE_PLUGIN_DIR.'includes/admin/admin-pages.php'; |
|
326 | + require_once GIVE_PLUGIN_DIR.'includes/admin/class-admin-notices.php'; |
|
327 | + require_once GIVE_PLUGIN_DIR.'includes/admin/class-api-keys-table.php'; |
|
328 | + require_once GIVE_PLUGIN_DIR.'includes/admin/admin-actions.php'; |
|
329 | + require_once GIVE_PLUGIN_DIR.'includes/admin/system-info.php'; |
|
330 | + require_once GIVE_PLUGIN_DIR.'includes/admin/export-functions.php'; |
|
331 | + require_once GIVE_PLUGIN_DIR.'includes/admin/add-ons.php'; |
|
332 | + require_once GIVE_PLUGIN_DIR.'includes/admin/plugins.php'; |
|
333 | + require_once GIVE_PLUGIN_DIR.'includes/admin/dashboard-widgets.php'; |
|
334 | + |
|
335 | + require_once GIVE_PLUGIN_DIR.'includes/admin/payments/actions.php'; |
|
336 | + require_once GIVE_PLUGIN_DIR.'includes/admin/payments/payments-history.php'; |
|
337 | + |
|
338 | + require_once GIVE_PLUGIN_DIR.'includes/admin/customers/customers.php'; |
|
339 | + require_once GIVE_PLUGIN_DIR.'includes/admin/customers/customer-functions.php'; |
|
340 | + require_once GIVE_PLUGIN_DIR.'includes/admin/customers/customer-actions.php'; |
|
341 | + require_once GIVE_PLUGIN_DIR.'includes/admin/forms/metabox.php'; |
|
342 | + require_once GIVE_PLUGIN_DIR.'includes/admin/forms/dashboard-columns.php'; |
|
343 | + |
|
344 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/reports.php'; |
|
345 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/pdf-reports.php'; |
|
346 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/class-give-graph.php'; |
|
347 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/graphing.php'; |
|
348 | + |
|
349 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/abstract-shortcode-generator.php'; |
|
350 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/class-shortcode-button.php'; |
|
351 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-form.php'; |
|
352 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-goal.php'; |
|
353 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-login.php'; |
|
354 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-register.php'; |
|
355 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-profile-editor.php'; |
|
356 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-donation-history.php'; |
|
357 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-receipt.php'; |
|
358 | + |
|
359 | + require_once GIVE_PLUGIN_DIR.'includes/admin/upgrades/upgrade-functions.php'; |
|
360 | + require_once GIVE_PLUGIN_DIR.'includes/admin/upgrades/upgrades.php'; |
|
361 | 361 | |
362 | 362 | } |
363 | 363 | |
364 | - require_once GIVE_PLUGIN_DIR . 'includes/install.php'; |
|
364 | + require_once GIVE_PLUGIN_DIR.'includes/install.php'; |
|
365 | 365 | |
366 | 366 | } |
367 | 367 | |
@@ -374,26 +374,26 @@ discard block |
||
374 | 374 | */ |
375 | 375 | public function load_textdomain() { |
376 | 376 | // Set filter for Give's languages directory |
377 | - $give_lang_dir = dirname( plugin_basename( GIVE_PLUGIN_FILE ) ) . '/languages/'; |
|
378 | - $give_lang_dir = apply_filters( 'give_languages_directory', $give_lang_dir ); |
|
377 | + $give_lang_dir = dirname(plugin_basename(GIVE_PLUGIN_FILE)).'/languages/'; |
|
378 | + $give_lang_dir = apply_filters('give_languages_directory', $give_lang_dir); |
|
379 | 379 | |
380 | 380 | // Traditional WordPress plugin locale filter |
381 | - $locale = apply_filters( 'plugin_locale', get_locale(), 'give' ); |
|
382 | - $mofile = sprintf( '%1$s-%2$s.mo', 'give', $locale ); |
|
381 | + $locale = apply_filters('plugin_locale', get_locale(), 'give'); |
|
382 | + $mofile = sprintf('%1$s-%2$s.mo', 'give', $locale); |
|
383 | 383 | |
384 | 384 | // Setup paths to current locale file |
385 | - $mofile_local = $give_lang_dir . $mofile; |
|
386 | - $mofile_global = WP_LANG_DIR . '/give/' . $mofile; |
|
385 | + $mofile_local = $give_lang_dir.$mofile; |
|
386 | + $mofile_global = WP_LANG_DIR.'/give/'.$mofile; |
|
387 | 387 | |
388 | - if ( file_exists( $mofile_global ) ) { |
|
388 | + if (file_exists($mofile_global)) { |
|
389 | 389 | // Look in global /wp-content/languages/give folder |
390 | - load_textdomain( 'give', $mofile_global ); |
|
391 | - } elseif ( file_exists( $mofile_local ) ) { |
|
390 | + load_textdomain('give', $mofile_global); |
|
391 | + } elseif (file_exists($mofile_local)) { |
|
392 | 392 | // Look in local location from filter `give_languages_directory` |
393 | - load_textdomain( 'give', $mofile_local ); |
|
393 | + load_textdomain('give', $mofile_local); |
|
394 | 394 | } else { |
395 | 395 | // Load the default language files packaged up w/ Give |
396 | - load_plugin_textdomain( 'give', false, $give_lang_dir ); |
|
396 | + load_plugin_textdomain('give', false, $give_lang_dir); |
|
397 | 397 | } |
398 | 398 | } |
399 | 399 | } |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | * @since 1.4 |
11 | 11 | */ |
12 | 12 | |
13 | -defined( 'ABSPATH' ) or exit; |
|
13 | +defined('ABSPATH') or exit; |
|
14 | 14 | |
15 | 15 | /** |
16 | 16 | * Class Give_Email_Access |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | function __construct() { |
31 | 31 | |
32 | 32 | // get it started |
33 | - add_action( 'init', array( $this, 'init' ) ); |
|
33 | + add_action('init', array($this, 'init')); |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | |
@@ -39,30 +39,30 @@ discard block |
||
39 | 39 | */ |
40 | 40 | function init() { |
41 | 41 | |
42 | - $is_enabled = give_get_option( 'email_access' ); |
|
42 | + $is_enabled = give_get_option('email_access'); |
|
43 | 43 | |
44 | 44 | //Non-logged in users only |
45 | - if ( is_user_logged_in() || $is_enabled !== 'on' || is_admin() ) { |
|
45 | + if (is_user_logged_in() || $is_enabled !== 'on' || is_admin()) { |
|
46 | 46 | return; |
47 | 47 | } |
48 | 48 | |
49 | 49 | //Are db columns setup? |
50 | - $is_setup = give_get_option( 'email_access_installed' ); |
|
51 | - if ( empty( $is_setup ) ) { |
|
50 | + $is_setup = give_get_option('email_access_installed'); |
|
51 | + if (empty($is_setup)) { |
|
52 | 52 | $this->create_columns(); |
53 | 53 | } |
54 | 54 | |
55 | 55 | // Timeouts |
56 | - $this->verify_throttle = apply_filters( 'give_nl_verify_throttle', 300 ); |
|
57 | - $this->token_expiration = apply_filters( 'give_nl_token_expiration', 7200 ); |
|
56 | + $this->verify_throttle = apply_filters('give_nl_verify_throttle', 300); |
|
57 | + $this->token_expiration = apply_filters('give_nl_token_expiration', 7200); |
|
58 | 58 | |
59 | 59 | // Setup login |
60 | 60 | $this->check_for_token(); |
61 | 61 | |
62 | - if ( $this->token_exists ) { |
|
63 | - add_filter( 'give_can_view_receipt', '__return_true' ); |
|
64 | - add_filter( 'give_user_pending_verification', '__return_false' ); |
|
65 | - add_filter( 'give_get_users_purchases_args', array( $this, 'users_purchases_args' ) ); |
|
62 | + if ($this->token_exists) { |
|
63 | + add_filter('give_can_view_receipt', '__return_true'); |
|
64 | + add_filter('give_user_pending_verification', '__return_false'); |
|
65 | + add_filter('give_get_users_purchases_args', array($this, 'users_purchases_args')); |
|
66 | 66 | } |
67 | 67 | } |
68 | 68 | |
@@ -73,24 +73,24 @@ discard block |
||
73 | 73 | * |
74 | 74 | * @return bool |
75 | 75 | */ |
76 | - function can_send_email( $customer_id ) { |
|
76 | + function can_send_email($customer_id) { |
|
77 | 77 | global $wpdb; |
78 | 78 | |
79 | 79 | // Prevent multiple emails within X minutes |
80 | - $throttle = date( 'Y-m-d H:i:s', time() - $this->verify_throttle ); |
|
80 | + $throttle = date('Y-m-d H:i:s', time() - $this->verify_throttle); |
|
81 | 81 | |
82 | 82 | // Does a user row exist? |
83 | 83 | $exists = (int) $wpdb->get_var( |
84 | - $wpdb->prepare( "SELECT COUNT(*) FROM {$wpdb->prefix}give_customers WHERE id = %d", $customer_id ) |
|
84 | + $wpdb->prepare("SELECT COUNT(*) FROM {$wpdb->prefix}give_customers WHERE id = %d", $customer_id) |
|
85 | 85 | ); |
86 | 86 | |
87 | - if ( 0 < $exists ) { |
|
87 | + if (0 < $exists) { |
|
88 | 88 | $row_id = (int) $wpdb->get_var( |
89 | - $wpdb->prepare( "SELECT id FROM {$wpdb->prefix}give_customers WHERE id = %d AND (verify_throttle < %s OR verify_key = '') LIMIT 1", $customer_id, $throttle ) |
|
89 | + $wpdb->prepare("SELECT id FROM {$wpdb->prefix}give_customers WHERE id = %d AND (verify_throttle < %s OR verify_key = '') LIMIT 1", $customer_id, $throttle) |
|
90 | 90 | ); |
91 | 91 | |
92 | - if ( $row_id < 1 ) { |
|
93 | - give_set_error( 'give_email_access_attempts_exhausted', __( 'Please wait a few minutes before requesting a new email access link.', 'give' ) ); |
|
92 | + if ($row_id < 1) { |
|
93 | + give_set_error('give_email_access_attempts_exhausted', __('Please wait a few minutes before requesting a new email access link.', 'give')); |
|
94 | 94 | |
95 | 95 | return false; |
96 | 96 | } |
@@ -106,38 +106,38 @@ discard block |
||
106 | 106 | * @param $customer_id |
107 | 107 | * @param $email |
108 | 108 | */ |
109 | - function send_email( $customer_id, $email ) { |
|
109 | + function send_email($customer_id, $email) { |
|
110 | 110 | |
111 | - $verify_key = wp_generate_password( 20, false ); |
|
111 | + $verify_key = wp_generate_password(20, false); |
|
112 | 112 | |
113 | 113 | // Generate a new verify key |
114 | - $this->set_verify_key( $customer_id, $email, $verify_key ); |
|
114 | + $this->set_verify_key($customer_id, $email, $verify_key); |
|
115 | 115 | |
116 | 116 | // Get the purchase history URL |
117 | - $page_id = give_get_option( 'history_page' ); |
|
117 | + $page_id = give_get_option('history_page'); |
|
118 | 118 | |
119 | - $access_url = add_query_arg( array( |
|
119 | + $access_url = add_query_arg(array( |
|
120 | 120 | 'give_nl' => $verify_key, |
121 | - ), get_permalink( $page_id ) ); |
|
121 | + ), get_permalink($page_id)); |
|
122 | 122 | |
123 | 123 | //Nice subject and message |
124 | - $subject = apply_filters( 'give_email_access_token_subject', sprintf( __( 'Your Access Link to %1$s', 'give' ), get_bloginfo( 'name' ) ) ); |
|
124 | + $subject = apply_filters('give_email_access_token_subject', sprintf(__('Your Access Link to %1$s', 'give'), get_bloginfo('name'))); |
|
125 | 125 | |
126 | - $message = __( 'You or someone in your organization requested an access link be sent to this email address. This is a temporary access link for you to view your donation information. Click on the link below to view:', 'give' ) . "\n\n"; |
|
126 | + $message = __('You or someone in your organization requested an access link be sent to this email address. This is a temporary access link for you to view your donation information. Click on the link below to view:', 'give')."\n\n"; |
|
127 | 127 | |
128 | - $message .= '<a href="' . esc_url( $access_url ) . '" target="_blank">' . __( 'Access My Donation Details', 'give' ) . ' »</a>'; |
|
128 | + $message .= '<a href="'.esc_url($access_url).'" target="_blank">'.__('Access My Donation Details', 'give').' »</a>'; |
|
129 | 129 | |
130 | 130 | $message .= "\n\n"; |
131 | 131 | $message .= "\n\n"; |
132 | - $message .= __( 'Sincerely,', 'give' ); |
|
133 | - $message .= "\n" . get_bloginfo( 'name' ) . "\n"; |
|
132 | + $message .= __('Sincerely,', 'give'); |
|
133 | + $message .= "\n".get_bloginfo('name')."\n"; |
|
134 | 134 | |
135 | - $message = apply_filters( 'give_email_access_token_message', $message ); |
|
135 | + $message = apply_filters('give_email_access_token_message', $message); |
|
136 | 136 | |
137 | 137 | |
138 | 138 | // Send the email |
139 | - Give()->emails->__set( 'heading', apply_filters( 'give_email_access_token_heading', __( 'Your Access Link', 'give' ) ) ); |
|
140 | - Give()->emails->send( $email, $subject, $message ); |
|
139 | + Give()->emails->__set('heading', apply_filters('give_email_access_token_heading', __('Your Access Link', 'give'))); |
|
140 | + Give()->emails->send($email, $subject, $message); |
|
141 | 141 | |
142 | 142 | } |
143 | 143 | |
@@ -147,24 +147,24 @@ discard block |
||
147 | 147 | */ |
148 | 148 | function check_for_token() { |
149 | 149 | |
150 | - $token = isset( $_GET['give_nl'] ) ? $_GET['give_nl'] : ''; |
|
150 | + $token = isset($_GET['give_nl']) ? $_GET['give_nl'] : ''; |
|
151 | 151 | |
152 | 152 | // Check for cookie |
153 | - if ( empty( $token ) ) { |
|
154 | - $token = isset( $_COOKIE['give_nl'] ) ? $_COOKIE['give_nl'] : ''; |
|
153 | + if (empty($token)) { |
|
154 | + $token = isset($_COOKIE['give_nl']) ? $_COOKIE['give_nl'] : ''; |
|
155 | 155 | } |
156 | 156 | |
157 | - if ( ! empty( $token ) ) { |
|
158 | - if ( ! $this->is_valid_token( $token ) ) { |
|
159 | - if ( ! $this->is_valid_verify_key( $token ) ) { |
|
157 | + if ( ! empty($token)) { |
|
158 | + if ( ! $this->is_valid_token($token)) { |
|
159 | + if ( ! $this->is_valid_verify_key($token)) { |
|
160 | 160 | return; |
161 | 161 | } |
162 | 162 | } |
163 | 163 | |
164 | 164 | $this->token_exists = true; |
165 | 165 | // Set cookie |
166 | - $lifetime = current_time( 'timestamp' ) + Give()->session->set_expiration_time(); |
|
167 | - @setcookie( 'give_nl', $token, $lifetime, COOKIEPATH, COOKIE_DOMAIN, false ); |
|
166 | + $lifetime = current_time('timestamp') + Give()->session->set_expiration_time(); |
|
167 | + @setcookie('give_nl', $token, $lifetime, COOKIEPATH, COOKIE_DOMAIN, false); |
|
168 | 168 | } |
169 | 169 | } |
170 | 170 | |
@@ -175,18 +175,18 @@ discard block |
||
175 | 175 | * |
176 | 176 | * @return bool |
177 | 177 | */ |
178 | - function is_valid_token( $token ) { |
|
178 | + function is_valid_token($token) { |
|
179 | 179 | |
180 | 180 | global $wpdb; |
181 | 181 | |
182 | 182 | // Make sure token isn't expired |
183 | - $expires = date( 'Y-m-d H:i:s', time() - $this->token_expiration ); |
|
183 | + $expires = date('Y-m-d H:i:s', time() - $this->token_expiration); |
|
184 | 184 | |
185 | 185 | $email = $wpdb->get_var( |
186 | - $wpdb->prepare( "SELECT email FROM {$wpdb->prefix}give_customers WHERE token = %s AND verify_throttle >= %s LIMIT 1", $token, $expires ) |
|
186 | + $wpdb->prepare("SELECT email FROM {$wpdb->prefix}give_customers WHERE token = %s AND verify_throttle >= %s LIMIT 1", $token, $expires) |
|
187 | 187 | ); |
188 | 188 | |
189 | - if ( ! empty( $email ) ) { |
|
189 | + if ( ! empty($email)) { |
|
190 | 190 | $this->token_email = $email; |
191 | 191 | $this->token = $token; |
192 | 192 | |
@@ -194,8 +194,8 @@ discard block |
||
194 | 194 | } |
195 | 195 | |
196 | 196 | //Set error only if email access form isn't being submitted |
197 | - if ( ! isset( $_POST['give_email'] ) && ! isset( $_POST['_wpnonce'] ) ) { |
|
198 | - give_set_error( 'give_email_token_expired', apply_filters( 'give_email_token_expired_message', 'Sorry, your access token has expired. Please request a new one below:', 'give' ) ); |
|
197 | + if ( ! isset($_POST['give_email']) && ! isset($_POST['_wpnonce'])) { |
|
198 | + give_set_error('give_email_token_expired', apply_filters('give_email_token_expired_message', 'Sorry, your access token has expired. Please request a new one below:', 'give')); |
|
199 | 199 | } |
200 | 200 | |
201 | 201 | |
@@ -210,25 +210,25 @@ discard block |
||
210 | 210 | * @param $email |
211 | 211 | * @param $verify_key |
212 | 212 | */ |
213 | - function set_verify_key( $customer_id, $email, $verify_key ) { |
|
213 | + function set_verify_key($customer_id, $email, $verify_key) { |
|
214 | 214 | global $wpdb; |
215 | 215 | |
216 | - $now = date( 'Y-m-d H:i:s' ); |
|
216 | + $now = date('Y-m-d H:i:s'); |
|
217 | 217 | |
218 | 218 | // Insert or update? |
219 | 219 | $row_id = (int) $wpdb->get_var( |
220 | - $wpdb->prepare( "SELECT id FROM {$wpdb->prefix}give_customers WHERE id = %d LIMIT 1", $customer_id ) |
|
220 | + $wpdb->prepare("SELECT id FROM {$wpdb->prefix}give_customers WHERE id = %d LIMIT 1", $customer_id) |
|
221 | 221 | ); |
222 | 222 | |
223 | 223 | // Update |
224 | - if ( ! empty( $row_id ) ) { |
|
224 | + if ( ! empty($row_id)) { |
|
225 | 225 | $wpdb->query( |
226 | - $wpdb->prepare( "UPDATE {$wpdb->prefix}give_customers SET verify_key = %s, verify_throttle = %s WHERE id = %d LIMIT 1", $verify_key, $now, $row_id ) |
|
226 | + $wpdb->prepare("UPDATE {$wpdb->prefix}give_customers SET verify_key = %s, verify_throttle = %s WHERE id = %d LIMIT 1", $verify_key, $now, $row_id) |
|
227 | 227 | ); |
228 | 228 | } // Insert |
229 | 229 | else { |
230 | 230 | $wpdb->query( |
231 | - $wpdb->prepare( "INSERT INTO {$wpdb->prefix}give_customers ( verify_key, verify_throttle) VALUES (%s, %s)", $verify_key, $now ) |
|
231 | + $wpdb->prepare("INSERT INTO {$wpdb->prefix}give_customers ( verify_key, verify_throttle) VALUES (%s, %s)", $verify_key, $now) |
|
232 | 232 | ); |
233 | 233 | } |
234 | 234 | } |
@@ -240,20 +240,20 @@ discard block |
||
240 | 240 | * |
241 | 241 | * @return bool |
242 | 242 | */ |
243 | - function is_valid_verify_key( $token ) { |
|
243 | + function is_valid_verify_key($token) { |
|
244 | 244 | global $wpdb; |
245 | 245 | |
246 | 246 | // See if the verify_key exists |
247 | 247 | $row = $wpdb->get_row( |
248 | - $wpdb->prepare( "SELECT id, email FROM {$wpdb->prefix}give_customers WHERE verify_key = %s LIMIT 1", $token ) |
|
248 | + $wpdb->prepare("SELECT id, email FROM {$wpdb->prefix}give_customers WHERE verify_key = %s LIMIT 1", $token) |
|
249 | 249 | ); |
250 | 250 | |
251 | - $now = date( 'Y-m-d H:i:s' ); |
|
251 | + $now = date('Y-m-d H:i:s'); |
|
252 | 252 | |
253 | 253 | // Set token |
254 | - if ( ! empty( $row ) ) { |
|
254 | + if ( ! empty($row)) { |
|
255 | 255 | $wpdb->query( |
256 | - $wpdb->prepare( "UPDATE {$wpdb->prefix}give_customers SET verify_key = '', token = %s, verify_throttle = %s WHERE id = %d LIMIT 1", $token, $now, $row->id ) |
|
256 | + $wpdb->prepare("UPDATE {$wpdb->prefix}give_customers SET verify_key = '', token = %s, verify_throttle = %s WHERE id = %d LIMIT 1", $token, $now, $row->id) |
|
257 | 257 | ); |
258 | 258 | |
259 | 259 | $this->token_email = $row->email; |
@@ -272,7 +272,7 @@ discard block |
||
272 | 272 | * |
273 | 273 | * @return mixed |
274 | 274 | */ |
275 | - function users_purchases_args( $args ) { |
|
275 | + function users_purchases_args($args) { |
|
276 | 276 | $args['user'] = $this->token_email; |
277 | 277 | |
278 | 278 | return $args; |
@@ -289,11 +289,11 @@ discard block |
||
289 | 289 | global $wpdb; |
290 | 290 | |
291 | 291 | //Create columns in customers table |
292 | - $query = $wpdb->query( "ALTER TABLE {$wpdb->prefix}give_customers ADD `token` VARCHAR(255) CHARACTER SET utf8 NOT NULL, ADD `verify_key` VARCHAR(255) CHARACTER SET utf8 NOT NULL AFTER `token`, ADD `verify_throttle` DATETIME NOT NULL AFTER `verify_key`" ); |
|
292 | + $query = $wpdb->query("ALTER TABLE {$wpdb->prefix}give_customers ADD `token` VARCHAR(255) CHARACTER SET utf8 NOT NULL, ADD `verify_key` VARCHAR(255) CHARACTER SET utf8 NOT NULL AFTER `token`, ADD `verify_throttle` DATETIME NOT NULL AFTER `verify_key`"); |
|
293 | 293 | |
294 | 294 | //Columns added properly |
295 | - if ( $query ) { |
|
296 | - give_update_option( 'email_access_installed', 1 ); |
|
295 | + if ($query) { |
|
296 | + give_update_option('email_access_installed', 1); |
|
297 | 297 | } |
298 | 298 | |
299 | 299 | } |