@@ -9,11 +9,11 @@ discard block |
||
9 | 9 | * @since 1.8 |
10 | 10 | */ |
11 | 11 | |
12 | -if ( ! defined( 'ABSPATH' ) ) { |
|
12 | +if ( ! defined('ABSPATH')) { |
|
13 | 13 | exit; // Exit if accessed directly |
14 | 14 | } |
15 | 15 | |
16 | -if ( ! class_exists( 'Give_Settings_System_Info' ) ) : |
|
16 | +if ( ! class_exists('Give_Settings_System_Info')) : |
|
17 | 17 | |
18 | 18 | /** |
19 | 19 | * Give_Settings_System_Info. |
@@ -43,15 +43,15 @@ discard block |
||
43 | 43 | */ |
44 | 44 | public function __construct() { |
45 | 45 | $this->id = 'system-info'; |
46 | - $this->label = esc_html__( 'System Info', 'give' ); |
|
46 | + $this->label = esc_html__('System Info', 'give'); |
|
47 | 47 | |
48 | - add_filter( 'give-tools_tabs_array', array( $this, 'add_settings_page' ), 20 ); |
|
49 | - add_action( "give-tools_settings_{$this->id}_page", array( $this, 'output' ) ); |
|
48 | + add_filter('give-tools_tabs_array', array($this, 'add_settings_page'), 20); |
|
49 | + add_action("give-tools_settings_{$this->id}_page", array($this, 'output')); |
|
50 | 50 | |
51 | 51 | // Do not use main form for this tab. |
52 | - if( give_get_current_setting_tab() === $this->id ) { |
|
53 | - add_action( "give-tools_open_form", '__return_empty_string' ); |
|
54 | - add_action( "give-tools_close_form", '__return_empty_string' ); |
|
52 | + if (give_get_current_setting_tab() === $this->id) { |
|
53 | + add_action("give-tools_open_form", '__return_empty_string'); |
|
54 | + add_action("give-tools_close_form", '__return_empty_string'); |
|
55 | 55 | } |
56 | 56 | } |
57 | 57 | |
@@ -62,8 +62,8 @@ discard block |
||
62 | 62 | * @param array $pages Lst of pages. |
63 | 63 | * @return array |
64 | 64 | */ |
65 | - public function add_settings_page( $pages ) { |
|
66 | - $pages[ $this->id ] = $this->label; |
|
65 | + public function add_settings_page($pages) { |
|
66 | + $pages[$this->id] = $this->label; |
|
67 | 67 | |
68 | 68 | return $pages; |
69 | 69 | } |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | */ |
77 | 77 | public function output() { |
78 | 78 | $GLOBALS['give_hide_save_button'] = true; |
79 | - include_once( 'views/html-admin-page-system-info.php' ); |
|
79 | + include_once('views/html-admin-page-system-info.php'); |
|
80 | 80 | } |
81 | 81 | } |
82 | 82 |
@@ -586,9 +586,9 @@ |
||
586 | 586 | } |
587 | 587 | |
588 | 588 | echo ' – ' |
589 | - . sprintf( _x( 'by %s', 'by author', 'give' ), wp_kses( $author_name, wp_kses_allowed_html( 'post' ) ) ) |
|
590 | - . ' – ' |
|
591 | - . esc_html( $plugin_data['Version'] ); |
|
589 | + . sprintf( _x( 'by %s', 'by author', 'give' ), wp_kses( $author_name, wp_kses_allowed_html( 'post' ) ) ) |
|
590 | + . ' – ' |
|
591 | + . esc_html( $plugin_data['Version'] ); |
|
592 | 592 | ?> |
593 | 593 | </td> |
594 | 594 | </tr> |
@@ -57,7 +57,12 @@ discard block |
||
57 | 57 | <tr> |
58 | 58 | <td data-export-label="WP Multisite"><?php _e( 'WP Multisite', 'give' ); ?>:</td> |
59 | 59 | <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'Whether or not you have WordPress Multisite enabled.', 'give' ) ); ?>"></span></td> |
60 | - <td><?php if ( is_multisite() ) echo '<span class="dashicons dashicons-yes"></span>'; else echo '–'; ?></td> |
|
60 | + <td><?php if ( is_multisite() ) { |
|
61 | + echo '<span class="dashicons dashicons-yes"></span>'; |
|
62 | +} else { |
|
63 | + echo '–'; |
|
64 | +} |
|
65 | +?></td> |
|
61 | 66 | </tr> |
62 | 67 | <tr> |
63 | 68 | <td data-export-label="WP Memory Limit"><?php _e( 'WP Memory Limit', 'give' ); ?>:</td> |
@@ -85,9 +90,12 @@ discard block |
||
85 | 90 | <td> |
86 | 91 | <?php if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) : ?> |
87 | 92 | <mark class="yes"><span class="dashicons dashicons-yes"></span></mark> |
88 | - <?php else : ?> |
|
93 | + <?php else { |
|
94 | + : ?> |
|
89 | 95 | <mark class="no">–</mark> |
90 | - <?php endif; ?> |
|
96 | + <?php endif; |
|
97 | +} |
|
98 | +?> |
|
91 | 99 | </td> |
92 | 100 | </tr> |
93 | 101 | <tr> |
@@ -96,9 +104,12 @@ discard block |
||
96 | 104 | <td> |
97 | 105 | <?php if ( defined( 'DISABLE_WP_CRON' ) && DISABLE_WP_CRON ) : ?> |
98 | 106 | <mark class="no">–</mark> |
99 | - <?php else : ?> |
|
107 | + <?php else { |
|
108 | + : ?> |
|
100 | 109 | <mark class="yes"><span class="dashicons dashicons-yes"></span></mark> |
101 | - <?php endif; ?> |
|
110 | + <?php endif; |
|
111 | +} |
|
112 | +?> |
|
102 | 113 | </td> |
103 | 114 | </tr> |
104 | 115 | <tr> |
@@ -3,7 +3,7 @@ discard block |
||
3 | 3 | * Admin View: System Info |
4 | 4 | */ |
5 | 5 | |
6 | -if ( ! defined( 'ABSPATH' ) ) { |
|
6 | +if ( ! defined('ABSPATH')) { |
|
7 | 7 | exit; |
8 | 8 | } |
9 | 9 | |
@@ -22,10 +22,10 @@ discard block |
||
22 | 22 | ?> |
23 | 23 | |
24 | 24 | <div class="give-debug-report-wrapper updated"> |
25 | - <p><?php _e( 'Please copy and paste this information in your ticket when contacting support:', 'give' ); ?> </p> |
|
25 | + <p><?php _e('Please copy and paste this information in your ticket when contacting support:', 'give'); ?> </p> |
|
26 | 26 | <p class="submit"> |
27 | - <a class="button-primary js-give-debug-report-button" href="#"><?php _e( 'Get System Report', 'give' ); ?></a> |
|
28 | - <a class="button-secondary docs" href="http://docs.givewp.com/settings-system-info" target="_blank"><?php _e( 'Understanding the System Report', 'give' ); ?></a> |
|
27 | + <a class="button-primary js-give-debug-report-button" href="#"><?php _e('Get System Report', 'give'); ?></a> |
|
28 | + <a class="button-secondary docs" href="http://docs.givewp.com/settings-system-info" target="_blank"><?php _e('Understanding the System Report', 'give'); ?></a> |
|
29 | 29 | </p> |
30 | 30 | <div class="give-debug-report js-give-debug-report"> |
31 | 31 | <textarea readonly="readonly"></textarea> |
@@ -35,55 +35,55 @@ discard block |
||
35 | 35 | <table class="give-status-table widefat" cellspacing="0" id="status"> |
36 | 36 | <thead> |
37 | 37 | <tr> |
38 | - <th colspan="3" data-export-label="WordPress Environment"><h2><?php _e( 'WordPress Environment', 'give' ); ?></h2></th> |
|
38 | + <th colspan="3" data-export-label="WordPress Environment"><h2><?php _e('WordPress Environment', 'give'); ?></h2></th> |
|
39 | 39 | </tr> |
40 | 40 | </thead> |
41 | 41 | <tbody> |
42 | 42 | <tr> |
43 | - <td data-export-label="Home URL"><?php _e( 'Home URL', 'give' ); ?>:</td> |
|
44 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'The URL of your site\'s homepage.', 'give' ) ); ?>"></span></td> |
|
45 | - <td><?php form_option( 'home' ); ?></td> |
|
43 | + <td data-export-label="Home URL"><?php _e('Home URL', 'give'); ?>:</td> |
|
44 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('The URL of your site\'s homepage.', 'give')); ?>"></span></td> |
|
45 | + <td><?php form_option('home'); ?></td> |
|
46 | 46 | </tr> |
47 | 47 | <tr> |
48 | - <td data-export-label="Site URL"><?php _e( 'Site URL', 'give' ); ?>:</td> |
|
49 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'The root URL of your site.', 'give' ) ); ?>"></span></td> |
|
50 | - <td><?php form_option( 'siteurl' ); ?></td> |
|
48 | + <td data-export-label="Site URL"><?php _e('Site URL', 'give'); ?>:</td> |
|
49 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('The root URL of your site.', 'give')); ?>"></span></td> |
|
50 | + <td><?php form_option('siteurl'); ?></td> |
|
51 | 51 | </tr> |
52 | 52 | <tr> |
53 | - <td data-export-label="WP Version"><?php _e( 'WP Version', 'give' ); ?>:</td> |
|
54 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'The version of WordPress installed on your site.', 'give' ) ); ?>"></span></td> |
|
53 | + <td data-export-label="WP Version"><?php _e('WP Version', 'give'); ?>:</td> |
|
54 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('The version of WordPress installed on your site.', 'give')); ?>"></span></td> |
|
55 | 55 | <td><?php bloginfo('version'); ?></td> |
56 | 56 | </tr> |
57 | 57 | <tr> |
58 | - <td data-export-label="WP Multisite"><?php _e( 'WP Multisite', 'give' ); ?>:</td> |
|
59 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'Whether or not you have WordPress Multisite enabled.', 'give' ) ); ?>"></span></td> |
|
60 | - <td><?php if ( is_multisite() ) echo '<span class="dashicons dashicons-yes"></span>'; else echo '–'; ?></td> |
|
58 | + <td data-export-label="WP Multisite"><?php _e('WP Multisite', 'give'); ?>:</td> |
|
59 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('Whether or not you have WordPress Multisite enabled.', 'give')); ?>"></span></td> |
|
60 | + <td><?php if (is_multisite()) echo '<span class="dashicons dashicons-yes"></span>'; else echo '–'; ?></td> |
|
61 | 61 | </tr> |
62 | 62 | <tr> |
63 | - <td data-export-label="WP Memory Limit"><?php _e( 'WP Memory Limit', 'give' ); ?>:</td> |
|
64 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'The maximum amount of memory (RAM) that your site can use at one time.', 'give' ) ); ?>"></span></td> |
|
63 | + <td data-export-label="WP Memory Limit"><?php _e('WP Memory Limit', 'give'); ?>:</td> |
|
64 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('The maximum amount of memory (RAM) that your site can use at one time.', 'give')); ?>"></span></td> |
|
65 | 65 | <td> |
66 | 66 | <?php |
67 | - $memory = give_let_to_num( WP_MEMORY_LIMIT ); |
|
67 | + $memory = give_let_to_num(WP_MEMORY_LIMIT); |
|
68 | 68 | |
69 | - if ( function_exists( 'memory_get_usage' ) ) { |
|
70 | - $system_memory = give_let_to_num( @ini_get( 'memory_limit' ) ); |
|
71 | - $memory = max( $memory, $system_memory ); |
|
69 | + if (function_exists('memory_get_usage')) { |
|
70 | + $system_memory = give_let_to_num(@ini_get('memory_limit')); |
|
71 | + $memory = max($memory, $system_memory); |
|
72 | 72 | } |
73 | 73 | |
74 | - if ( $memory < 67108864 ) { |
|
75 | - echo '<mark class="error"><span class="dashicons dashicons-warning"></span> ' . sprintf( __( '%s - We recommend setting memory to at least 64 MB. See: %s', 'give' ), size_format( $memory ), '<a href="https://codex.wordpress.org/Editing_wp-config.php#Increasing_memory_allocated_to_PHP" target="_blank">' . __( 'Increasing memory allocated to PHP', 'give' ) . '</a>' ) . '</mark>'; |
|
74 | + if ($memory < 67108864) { |
|
75 | + echo '<mark class="error"><span class="dashicons dashicons-warning"></span> '.sprintf(__('%s - We recommend setting memory to at least 64 MB. See: %s', 'give'), size_format($memory), '<a href="https://codex.wordpress.org/Editing_wp-config.php#Increasing_memory_allocated_to_PHP" target="_blank">'.__('Increasing memory allocated to PHP', 'give').'</a>').'</mark>'; |
|
76 | 76 | } else { |
77 | - echo '<mark class="yes">' . size_format( $memory ) . '</mark>'; |
|
77 | + echo '<mark class="yes">'.size_format($memory).'</mark>'; |
|
78 | 78 | } |
79 | 79 | ?> |
80 | 80 | </td> |
81 | 81 | </tr> |
82 | 82 | <tr> |
83 | - <td data-export-label="WP Debug Mode"><?php _e( 'WP Debug Mode', 'give' ); ?>:</td> |
|
84 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'Displays whether or not WordPress is in Debug Mode.', 'give' ) ); ?>"></span></td> |
|
83 | + <td data-export-label="WP Debug Mode"><?php _e('WP Debug Mode', 'give'); ?>:</td> |
|
84 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('Displays whether or not WordPress is in Debug Mode.', 'give')); ?>"></span></td> |
|
85 | 85 | <td> |
86 | - <?php if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) : ?> |
|
86 | + <?php if (defined('WP_DEBUG') && WP_DEBUG) : ?> |
|
87 | 87 | <mark class="yes"><span class="dashicons dashicons-yes"></span></mark> |
88 | 88 | <?php else : ?> |
89 | 89 | <mark class="no">–</mark> |
@@ -91,10 +91,10 @@ discard block |
||
91 | 91 | </td> |
92 | 92 | </tr> |
93 | 93 | <tr> |
94 | - <td data-export-label="WP Cron"><?php _e( 'WP Cron', 'give' ); ?>:</td> |
|
95 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'Displays whether or not WP Cron Jobs are enabled.', 'give' ) ); ?>"></span></td> |
|
94 | + <td data-export-label="WP Cron"><?php _e('WP Cron', 'give'); ?>:</td> |
|
95 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('Displays whether or not WP Cron Jobs are enabled.', 'give')); ?>"></span></td> |
|
96 | 96 | <td> |
97 | - <?php if ( defined( 'DISABLE_WP_CRON' ) && DISABLE_WP_CRON ) : ?> |
|
97 | + <?php if (defined('DISABLE_WP_CRON') && DISABLE_WP_CRON) : ?> |
|
98 | 98 | <mark class="no">–</mark> |
99 | 99 | <?php else : ?> |
100 | 100 | <mark class="yes"><span class="dashicons dashicons-yes"></span></mark> |
@@ -102,55 +102,55 @@ discard block |
||
102 | 102 | </td> |
103 | 103 | </tr> |
104 | 104 | <tr> |
105 | - <td data-export-label="Language"><?php _e( 'Language', 'give' ); ?>:</td> |
|
106 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'The current language used by WordPress. Default = English', 'give' ) ); ?>"></span></td> |
|
105 | + <td data-export-label="Language"><?php _e('Language', 'give'); ?>:</td> |
|
106 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('The current language used by WordPress. Default = English', 'give')); ?>"></span></td> |
|
107 | 107 | <td><?php echo get_locale(); ?></td> |
108 | 108 | </tr> |
109 | 109 | <tr> |
110 | - <td data-export-label="Permalink Structure"><?php _e( 'Permalink Structure', 'give' ); ?>:</td> |
|
111 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'The permalink structure as defined in Settings.', 'give' ) ); ?>"></span></td> |
|
112 | - <td><?php echo esc_html( get_option( 'permalink_structure', __( 'Default', 'give' ) ) ); ?></td> |
|
110 | + <td data-export-label="Permalink Structure"><?php _e('Permalink Structure', 'give'); ?>:</td> |
|
111 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('The permalink structure as defined in Settings.', 'give')); ?>"></span></td> |
|
112 | + <td><?php echo esc_html(get_option('permalink_structure', __('Default', 'give'))); ?></td> |
|
113 | 113 | </tr> |
114 | 114 | <tr> |
115 | - <td data-export-label="Show on Front"><?php _e( 'Show on Front', 'give' ); ?>:</td> |
|
116 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'Whether your front page is set to show posts or a static page.', 'give' ) ); ?>"></span></td> |
|
117 | - <td><?php echo esc_html( get_option( 'show_on_front', '–' ) ); ?></td> |
|
115 | + <td data-export-label="Show on Front"><?php _e('Show on Front', 'give'); ?>:</td> |
|
116 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('Whether your front page is set to show posts or a static page.', 'give')); ?>"></span></td> |
|
117 | + <td><?php echo esc_html(get_option('show_on_front', '–')); ?></td> |
|
118 | 118 | </tr> |
119 | - <?php if ( 'page' === get_option( 'show_on_front' ) ) : ?> |
|
119 | + <?php if ('page' === get_option('show_on_front')) : ?> |
|
120 | 120 | <?php |
121 | - $front_page_id = absint( get_option( 'page_on_front' ) ); |
|
122 | - $blog_page_id = absint( get_option( 'page_for_posts' ) ); |
|
121 | + $front_page_id = absint(get_option('page_on_front')); |
|
122 | + $blog_page_id = absint(get_option('page_for_posts')); |
|
123 | 123 | ?> |
124 | 124 | <tr> |
125 | - <td data-export-label="Page on Front"><?php _e( 'Page on Front', 'give' ); ?>:</td> |
|
126 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'The page set to display as your front page.', 'give' ) ); ?>"></span></td> |
|
127 | - <td><?php echo 0 !== $front_page_id ? esc_html( get_the_title( $front_page_id ) . ' (#' . $front_page_id . ')' ) : __( 'Unset', 'give' ); ?></td> |
|
125 | + <td data-export-label="Page on Front"><?php _e('Page on Front', 'give'); ?>:</td> |
|
126 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('The page set to display as your front page.', 'give')); ?>"></span></td> |
|
127 | + <td><?php echo 0 !== $front_page_id ? esc_html(get_the_title($front_page_id).' (#'.$front_page_id.')') : __('Unset', 'give'); ?></td> |
|
128 | 128 | </tr> |
129 | 129 | <tr> |
130 | - <td data-export-label="Page for Posts"><?php _e( 'Page for Posts', 'give' ); ?>:</td> |
|
131 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'The page set to display your posts.', 'give' ) ); ?>"></span></td> |
|
132 | - <td><?php echo 0 !== $blog_page_id ? esc_html( get_the_title( $blog_page_id ) . ' (#' . $blog_page_id . ')' ) : __( 'Unset', 'give' ); ?></td> |
|
130 | + <td data-export-label="Page for Posts"><?php _e('Page for Posts', 'give'); ?>:</td> |
|
131 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('The page set to display your posts.', 'give')); ?>"></span></td> |
|
132 | + <td><?php echo 0 !== $blog_page_id ? esc_html(get_the_title($blog_page_id).' (#'.$blog_page_id.')') : __('Unset', 'give'); ?></td> |
|
133 | 133 | </tr> |
134 | - <?php endif;?> |
|
134 | + <?php endif; ?> |
|
135 | 135 | <tr> |
136 | - <td data-export-label="Table Prefix Length"><?php _e( 'Table Prefix Length', 'give' ); ?>:</td> |
|
137 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'The length of the table prefix used in your WordPress database.', 'give' ) ); ?>"></span></td> |
|
138 | - <td><?php echo esc_html( strlen( $wpdb->prefix ) ); ?></td> |
|
136 | + <td data-export-label="Table Prefix Length"><?php _e('Table Prefix Length', 'give'); ?>:</td> |
|
137 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('The length of the table prefix used in your WordPress database.', 'give')); ?>"></span></td> |
|
138 | + <td><?php echo esc_html(strlen($wpdb->prefix)); ?></td> |
|
139 | 139 | </tr> |
140 | 140 | <tr> |
141 | - <td data-export-label="Table Prefix Status"><?php _e( 'Table Prefix Status', 'give' ); ?>:</td> |
|
142 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'The status of the table prefix used in your WordPress database.', 'give' ) ); ?>"></span></td> |
|
143 | - <td><?php echo strlen( $wpdb->prefix ) > 16 ? esc_html( 'Error: Too long', 'give' ) : esc_html( 'Acceptable', 'give' ); ?></td> |
|
141 | + <td data-export-label="Table Prefix Status"><?php _e('Table Prefix Status', 'give'); ?>:</td> |
|
142 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('The status of the table prefix used in your WordPress database.', 'give')); ?>"></span></td> |
|
143 | + <td><?php echo strlen($wpdb->prefix) > 16 ? esc_html('Error: Too long', 'give') : esc_html('Acceptable', 'give'); ?></td> |
|
144 | 144 | </tr> |
145 | 145 | <tr> |
146 | - <td data-export-label="Admin AJAX"><?php _e( 'Admin AJAX', 'give' ); ?>:</td> |
|
147 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'Whether Admin AJAX is accessible.', 'give' ) ); ?>"></span></td> |
|
148 | - <td><?php echo give_test_ajax_works() ? __( 'Accessible', 'give' ) : __( 'Inaccessible', 'give' ); ?></td> |
|
146 | + <td data-export-label="Admin AJAX"><?php _e('Admin AJAX', 'give'); ?>:</td> |
|
147 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('Whether Admin AJAX is accessible.', 'give')); ?>"></span></td> |
|
148 | + <td><?php echo give_test_ajax_works() ? __('Accessible', 'give') : __('Inaccessible', 'give'); ?></td> |
|
149 | 149 | </tr> |
150 | 150 | <tr> |
151 | - <td data-export-label="Registered Post Stati"><?php _e( 'Registered Post Stati', 'give' ); ?>:</td> |
|
152 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'A list of all registered post stati.', 'give' ) ); ?>"></span></td> |
|
153 | - <td><?php echo esc_html( implode( ', ', get_post_stati() ) ); ?></td> |
|
151 | + <td data-export-label="Registered Post Stati"><?php _e('Registered Post Stati', 'give'); ?>:</td> |
|
152 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('A list of all registered post stati.', 'give')); ?>"></span></td> |
|
153 | + <td><?php echo esc_html(implode(', ', get_post_stati())); ?></td> |
|
154 | 154 | </tr> |
155 | 155 | </tbody> |
156 | 156 | </table> |
@@ -158,71 +158,71 @@ discard block |
||
158 | 158 | <table class="give-status-table widefat" cellspacing="0"> |
159 | 159 | <thead> |
160 | 160 | <tr> |
161 | - <th colspan="3" data-export-label="Server Environment"><h2><?php _e( 'Server Environment', 'give' ); ?></h2></th> |
|
161 | + <th colspan="3" data-export-label="Server Environment"><h2><?php _e('Server Environment', 'give'); ?></h2></th> |
|
162 | 162 | </tr> |
163 | 163 | </thead> |
164 | 164 | <tbody> |
165 | 165 | <tr> |
166 | - <td data-export-label="Hosting Provider"><?php _e( 'Hosting Provider', 'give' ); ?>:</td> |
|
167 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'The hosting provider for this WordPress installation.', 'give' ) ); ?>"></span></td> |
|
168 | - <td><?php echo give_get_host() ? esc_html( give_get_host() ) : __( 'Unknown', 'give' ); ?></td> |
|
166 | + <td data-export-label="Hosting Provider"><?php _e('Hosting Provider', 'give'); ?>:</td> |
|
167 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('The hosting provider for this WordPress installation.', 'give')); ?>"></span></td> |
|
168 | + <td><?php echo give_get_host() ? esc_html(give_get_host()) : __('Unknown', 'give'); ?></td> |
|
169 | 169 | </tr> |
170 | 170 | <tr> |
171 | - <td data-export-label="Server Info"><?php _e( 'Server Info', 'give' ); ?>:</td> |
|
172 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'Information about the web server that is currently hosting your site.', 'give' ) ); ?>"></span></td> |
|
173 | - <td><?php echo esc_html( $_SERVER['SERVER_SOFTWARE'] ); ?></td> |
|
171 | + <td data-export-label="Server Info"><?php _e('Server Info', 'give'); ?>:</td> |
|
172 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('Information about the web server that is currently hosting your site.', 'give')); ?>"></span></td> |
|
173 | + <td><?php echo esc_html($_SERVER['SERVER_SOFTWARE']); ?></td> |
|
174 | 174 | </tr> |
175 | 175 | <tr> |
176 | - <td data-export-label="PHP Version"><?php _e( 'PHP Version', 'give' ); ?>:</td> |
|
177 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'The version of PHP installed on your hosting server.', 'give' ) ); ?>"></span></td> |
|
176 | + <td data-export-label="PHP Version"><?php _e('PHP Version', 'give'); ?>:</td> |
|
177 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('The version of PHP installed on your hosting server.', 'give')); ?>"></span></td> |
|
178 | 178 | <td><?php |
179 | 179 | // Check if phpversion function exists. |
180 | - if ( function_exists( 'phpversion' ) ) { |
|
180 | + if (function_exists('phpversion')) { |
|
181 | 181 | $php_version = phpversion(); |
182 | 182 | |
183 | - if ( version_compare( $php_version, '5.6', '<' ) ) { |
|
184 | - echo '<mark class="error"><span class="dashicons dashicons-warning"></span> ' . sprintf( __( '%s - We recommend a minimum PHP version of 5.6. See: %s', 'give' ), esc_html( $php_version ), '<a href="http://docs.givewp.com/settings-system-info" target="_blank">' . __( 'PHP Requirements in Give', 'give' ) . '</a>' ) . '</mark>'; |
|
183 | + if (version_compare($php_version, '5.6', '<')) { |
|
184 | + echo '<mark class="error"><span class="dashicons dashicons-warning"></span> '.sprintf(__('%s - We recommend a minimum PHP version of 5.6. See: %s', 'give'), esc_html($php_version), '<a href="http://docs.givewp.com/settings-system-info" target="_blank">'.__('PHP Requirements in Give', 'give').'</a>').'</mark>'; |
|
185 | 185 | } else { |
186 | - echo '<mark class="yes">' . esc_html( $php_version ) . '</mark>'; |
|
186 | + echo '<mark class="yes">'.esc_html($php_version).'</mark>'; |
|
187 | 187 | } |
188 | 188 | } else { |
189 | - _e( "Couldn't determine PHP version because phpversion() doesn't exist.", 'give' ); |
|
189 | + _e("Couldn't determine PHP version because phpversion() doesn't exist.", 'give'); |
|
190 | 190 | } |
191 | 191 | ?></td> |
192 | 192 | </tr> |
193 | - <?php if ( function_exists( 'ini_get' ) ) : ?> |
|
193 | + <?php if (function_exists('ini_get')) : ?> |
|
194 | 194 | <tr> |
195 | - <td data-export-label="PHP Post Max Size"><?php _e( 'PHP Post Max Size', 'give' ); ?>:</td> |
|
196 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'The largest filesize that can be contained in one post.', 'give' ) ); ?>"></span></td> |
|
197 | - <td><?php echo size_format( give_let_to_num( ini_get( 'post_max_size' ) ) ); ?></td> |
|
195 | + <td data-export-label="PHP Post Max Size"><?php _e('PHP Post Max Size', 'give'); ?>:</td> |
|
196 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('The largest filesize that can be contained in one post.', 'give')); ?>"></span></td> |
|
197 | + <td><?php echo size_format(give_let_to_num(ini_get('post_max_size'))); ?></td> |
|
198 | 198 | </tr> |
199 | 199 | <tr> |
200 | - <td data-export-label="PHP Time Limit"><?php _e( 'PHP Time Limit', 'give' ); ?>:</td> |
|
201 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'The amount of time (in seconds) that your site will spend on a single operation before timing out (to avoid server lockups).', 'give' ) ); ?>"></span></td> |
|
202 | - <td><?php echo ini_get( 'max_execution_time' ); ?></td> |
|
200 | + <td data-export-label="PHP Time Limit"><?php _e('PHP Time Limit', 'give'); ?>:</td> |
|
201 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('The amount of time (in seconds) that your site will spend on a single operation before timing out (to avoid server lockups).', 'give')); ?>"></span></td> |
|
202 | + <td><?php echo ini_get('max_execution_time'); ?></td> |
|
203 | 203 | </tr> |
204 | 204 | <tr> |
205 | - <td data-export-label="PHP Max Input Vars"><?php _e( 'PHP Max Input Vars', 'give' ); ?>:</td> |
|
206 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'The maximum number of variables your server can use for a single function to avoid overloads.', 'give' ) ); ?>"></span></td> |
|
207 | - <td><?php echo ini_get( 'max_input_vars' ); ?></td> |
|
205 | + <td data-export-label="PHP Max Input Vars"><?php _e('PHP Max Input Vars', 'give'); ?>:</td> |
|
206 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('The maximum number of variables your server can use for a single function to avoid overloads.', 'give')); ?>"></span></td> |
|
207 | + <td><?php echo ini_get('max_input_vars'); ?></td> |
|
208 | 208 | </tr> |
209 | 209 | <tr> |
210 | - <td data-export-label="PHP Max Upload Size"><?php _e( 'PHP Max Upload Size', 'give' ); ?>:</td> |
|
211 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'The largest filesize that can be uploaded to your WordPress installation.', 'give' ) ); ?>"></span></td> |
|
212 | - <td><?php echo size_format( wp_max_upload_size() ); ?></td> |
|
210 | + <td data-export-label="PHP Max Upload Size"><?php _e('PHP Max Upload Size', 'give'); ?>:</td> |
|
211 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('The largest filesize that can be uploaded to your WordPress installation.', 'give')); ?>"></span></td> |
|
212 | + <td><?php echo size_format(wp_max_upload_size()); ?></td> |
|
213 | 213 | </tr> |
214 | 214 | <tr> |
215 | - <td data-export-label="cURL Version"><?php _e( 'cURL Version', 'give' ); ?>:</td> |
|
216 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'The version of cURL installed on your server.', 'give' ) ); ?>"></span></td> |
|
215 | + <td data-export-label="cURL Version"><?php _e('cURL Version', 'give'); ?>:</td> |
|
216 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('The version of cURL installed on your server.', 'give')); ?>"></span></td> |
|
217 | 217 | <td> |
218 | 218 | <?php |
219 | - if ( function_exists( 'curl_version' ) ) { |
|
219 | + if (function_exists('curl_version')) { |
|
220 | 220 | $curl_version = curl_version(); |
221 | 221 | |
222 | - if ( version_compare( $curl_version['version'], '7.40', '<' ) ) { |
|
223 | - echo '<mark class="error"><span class="dashicons dashicons-warning"></span> ' . sprintf( __( '%s - We recommend a minimum cURL version of 7.40.', 'give' ), esc_html( $curl_version['version'] . ', ' . $curl_version['ssl_version'] ) ) . '</mark>'; |
|
222 | + if (version_compare($curl_version['version'], '7.40', '<')) { |
|
223 | + echo '<mark class="error"><span class="dashicons dashicons-warning"></span> '.sprintf(__('%s - We recommend a minimum cURL version of 7.40.', 'give'), esc_html($curl_version['version'].', '.$curl_version['ssl_version'])).'</mark>'; |
|
224 | 224 | } else { |
225 | - echo '<mark class="yes">' . esc_html( $curl_version['version'] . ', ' . $curl_version['ssl_version'] ) . '</mark>'; |
|
225 | + echo '<mark class="yes">'.esc_html($curl_version['version'].', '.$curl_version['ssl_version']).'</mark>'; |
|
226 | 226 | } |
227 | 227 | } else { |
228 | 228 | echo '&ndash'; |
@@ -231,42 +231,42 @@ discard block |
||
231 | 231 | </td> |
232 | 232 | </tr> |
233 | 233 | <tr> |
234 | - <td data-export-label="SUHOSIN Installed"><?php _e( 'SUHOSIN Installed', 'give' ); ?>:</td> |
|
235 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'Suhosin is an advanced protection system for PHP installations. It was designed to protect your servers on the one hand against a number of well known problems in PHP applications and on the other hand against potential unknown vulnerabilities within these applications or the PHP core itself. If enabled on your server, Suhosin may need to be configured to increase its data submission limits.', 'give' ) ); ?>"></span></td> |
|
236 | - <td><?php echo extension_loaded( 'suhosin' ) ? '<span class="dashicons dashicons-yes"></span>' : '–'; ?></td> |
|
234 | + <td data-export-label="SUHOSIN Installed"><?php _e('SUHOSIN Installed', 'give'); ?>:</td> |
|
235 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('Suhosin is an advanced protection system for PHP installations. It was designed to protect your servers on the one hand against a number of well known problems in PHP applications and on the other hand against potential unknown vulnerabilities within these applications or the PHP core itself. If enabled on your server, Suhosin may need to be configured to increase its data submission limits.', 'give')); ?>"></span></td> |
|
236 | + <td><?php echo extension_loaded('suhosin') ? '<span class="dashicons dashicons-yes"></span>' : '–'; ?></td> |
|
237 | 237 | </tr> |
238 | 238 | <?php endif; |
239 | 239 | |
240 | - if ( $wpdb->use_mysqli ) { |
|
241 | - $ver = mysqli_get_server_info( $wpdb->dbh ); |
|
240 | + if ($wpdb->use_mysqli) { |
|
241 | + $ver = mysqli_get_server_info($wpdb->dbh); |
|
242 | 242 | } else { |
243 | 243 | $ver = mysql_get_server_info(); |
244 | 244 | } |
245 | 245 | |
246 | - if ( ! empty( $wpdb->is_mysql ) && ! stristr( $ver, 'MariaDB' ) ) : ?> |
|
246 | + if ( ! empty($wpdb->is_mysql) && ! stristr($ver, 'MariaDB')) : ?> |
|
247 | 247 | <tr> |
248 | - <td data-export-label="MySQL Version"><?php _e( 'MySQL Version', 'give' ); ?>:</td> |
|
249 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'The version of MySQL installed on your hosting server.', 'give' ) ); ?>"></span></td> |
|
248 | + <td data-export-label="MySQL Version"><?php _e('MySQL Version', 'give'); ?>:</td> |
|
249 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('The version of MySQL installed on your hosting server.', 'give')); ?>"></span></td> |
|
250 | 250 | <td> |
251 | 251 | <?php |
252 | 252 | $mysql_version = $wpdb->db_version(); |
253 | 253 | |
254 | - if ( version_compare( $mysql_version, '5.6', '<' ) ) { |
|
255 | - echo '<mark class="error"><span class="dashicons dashicons-warning"></span> ' . sprintf( __( '%s - We recommend a minimum MySQL version of 5.6. See: %s', 'give' ), esc_html( $mysql_version ), '<a href="https://wordpress.org/about/requirements/" target="_blank">' . __( 'WordPress Requirements', 'give' ) . '</a>' ) . '</mark>'; |
|
254 | + if (version_compare($mysql_version, '5.6', '<')) { |
|
255 | + echo '<mark class="error"><span class="dashicons dashicons-warning"></span> '.sprintf(__('%s - We recommend a minimum MySQL version of 5.6. See: %s', 'give'), esc_html($mysql_version), '<a href="https://wordpress.org/about/requirements/" target="_blank">'.__('WordPress Requirements', 'give').'</a>').'</mark>'; |
|
256 | 256 | } else { |
257 | - echo '<mark class="yes">' . esc_html( $mysql_version ) . '</mark>'; |
|
257 | + echo '<mark class="yes">'.esc_html($mysql_version).'</mark>'; |
|
258 | 258 | } |
259 | 259 | ?> |
260 | 260 | </td> |
261 | 261 | </tr> |
262 | 262 | <?php endif; ?> |
263 | 263 | <tr> |
264 | - <td data-export-label="Default Timezone is UTC"><?php _e( 'Default Timezone is UTC', 'give' ); ?>:</td> |
|
265 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'The default timezone for your server.', 'give' ) ); ?>"></span></td> |
|
264 | + <td data-export-label="Default Timezone is UTC"><?php _e('Default Timezone is UTC', 'give'); ?>:</td> |
|
265 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('The default timezone for your server.', 'give')); ?>"></span></td> |
|
266 | 266 | <td><?php |
267 | 267 | $default_timezone = date_default_timezone_get(); |
268 | - if ( 'UTC' !== $default_timezone ) { |
|
269 | - echo '<mark class="error"><span class="dashicons dashicons-warning"></span> ' . sprintf( __( 'Default timezone is %s - it should be UTC', 'give' ), $default_timezone ) . '</mark>'; |
|
268 | + if ('UTC' !== $default_timezone) { |
|
269 | + echo '<mark class="error"><span class="dashicons dashicons-warning"></span> '.sprintf(__('Default timezone is %s - it should be UTC', 'give'), $default_timezone).'</mark>'; |
|
270 | 270 | } else { |
271 | 271 | echo '<mark class="yes"><span class="dashicons dashicons-yes"></span></mark>'; |
272 | 272 | } ?> |
@@ -277,118 +277,118 @@ discard block |
||
277 | 277 | |
278 | 278 | // fsockopen/cURL. |
279 | 279 | $posting['fsockopen_curl']['name'] = 'fsockopen/cURL'; |
280 | - $posting['fsockopen_curl']['help'] = __( 'Payment gateways can use cURL to communicate with remote servers to authorize payments, other plugins may also use it when communicating with remote services.', 'give' ); |
|
280 | + $posting['fsockopen_curl']['help'] = __('Payment gateways can use cURL to communicate with remote servers to authorize payments, other plugins may also use it when communicating with remote services.', 'give'); |
|
281 | 281 | |
282 | - if ( function_exists( 'fsockopen' ) || function_exists( 'curl_init' ) ) { |
|
282 | + if (function_exists('fsockopen') || function_exists('curl_init')) { |
|
283 | 283 | $posting['fsockopen_curl']['success'] = true; |
284 | 284 | } else { |
285 | 285 | $posting['fsockopen_curl']['success'] = false; |
286 | - $posting['fsockopen_curl']['note'] = __( 'Your server does not have fsockopen or cURL enabled - PayPal IPN and other scripts which communicate with other servers will not work. Contact your hosting provider.', 'give' ); |
|
286 | + $posting['fsockopen_curl']['note'] = __('Your server does not have fsockopen or cURL enabled - PayPal IPN and other scripts which communicate with other servers will not work. Contact your hosting provider.', 'give'); |
|
287 | 287 | } |
288 | 288 | |
289 | 289 | // SOAP. |
290 | 290 | $posting['soap_client']['name'] = 'SoapClient'; |
291 | - $posting['soap_client']['help'] = __( 'Some webservices like shipping use SOAP to get information from remote servers, for example, live shipping quotes from FedEx require SOAP to be installed.', 'give' ); |
|
291 | + $posting['soap_client']['help'] = __('Some webservices like shipping use SOAP to get information from remote servers, for example, live shipping quotes from FedEx require SOAP to be installed.', 'give'); |
|
292 | 292 | |
293 | - if ( class_exists( 'SoapClient' ) ) { |
|
293 | + if (class_exists('SoapClient')) { |
|
294 | 294 | $posting['soap_client']['success'] = true; |
295 | 295 | } else { |
296 | 296 | $posting['soap_client']['success'] = false; |
297 | - $posting['soap_client']['note'] = sprintf( __( 'Your server does not have the %s class enabled - some gateway plugins which use SOAP may not work as expected.', 'give' ), '<a href="https://php.net/manual/en/class.soapclient.php">SoapClient</a>' ); |
|
297 | + $posting['soap_client']['note'] = sprintf(__('Your server does not have the %s class enabled - some gateway plugins which use SOAP may not work as expected.', 'give'), '<a href="https://php.net/manual/en/class.soapclient.php">SoapClient</a>'); |
|
298 | 298 | } |
299 | 299 | |
300 | 300 | // DOMDocument. |
301 | 301 | $posting['dom_document']['name'] = 'DOMDocument'; |
302 | - $posting['dom_document']['help'] = __( 'HTML/Multipart emails use DOMDocument to generate inline CSS in templates.', 'give' ); |
|
302 | + $posting['dom_document']['help'] = __('HTML/Multipart emails use DOMDocument to generate inline CSS in templates.', 'give'); |
|
303 | 303 | |
304 | - if ( class_exists( 'DOMDocument' ) ) { |
|
304 | + if (class_exists('DOMDocument')) { |
|
305 | 305 | $posting['dom_document']['success'] = true; |
306 | 306 | } else { |
307 | 307 | $posting['dom_document']['success'] = false; |
308 | - $posting['dom_document']['note'] = sprintf( __( 'Your server does not have the %s class enabled - HTML/Multipart emails, and also some extensions, will not work without DOMDocument.', 'give' ), '<a href="https://php.net/manual/en/class.domdocument.php">DOMDocument</a>' ); |
|
308 | + $posting['dom_document']['note'] = sprintf(__('Your server does not have the %s class enabled - HTML/Multipart emails, and also some extensions, will not work without DOMDocument.', 'give'), '<a href="https://php.net/manual/en/class.domdocument.php">DOMDocument</a>'); |
|
309 | 309 | } |
310 | 310 | |
311 | 311 | // gzip. |
312 | 312 | $posting['gzip']['name'] = 'gzip'; |
313 | - $posting['gzip']['help'] = __( 'gzip is used for file compression and decompression.', 'give' ); |
|
313 | + $posting['gzip']['help'] = __('gzip is used for file compression and decompression.', 'give'); |
|
314 | 314 | |
315 | - if ( is_callable( 'gzopen' ) ) { |
|
315 | + if (is_callable('gzopen')) { |
|
316 | 316 | $posting['gzip']['success'] = true; |
317 | 317 | } else { |
318 | 318 | $posting['gzip']['success'] = false; |
319 | - $posting['gzip']['note'] = sprintf( __( 'Your server does not support the %s function - this is used for file compression and decompression.', 'give' ), '<a href="https://php.net/manual/en/zlib.installation.php">gzopen</a>' ); |
|
319 | + $posting['gzip']['note'] = sprintf(__('Your server does not support the %s function - this is used for file compression and decompression.', 'give'), '<a href="https://php.net/manual/en/zlib.installation.php">gzopen</a>'); |
|
320 | 320 | } |
321 | 321 | |
322 | 322 | // GD Graphics Library. |
323 | 323 | $posting['gd']['name'] = 'GD Graphics Library'; |
324 | - $posting['gd']['help'] = __( 'GD Graphics Library is used for dynamically manipulating images.', 'give' ); |
|
325 | - $posting['gd']['success'] = extension_loaded( 'gd' ) && function_exists( 'gd_info' ) ? true : false; |
|
324 | + $posting['gd']['help'] = __('GD Graphics Library is used for dynamically manipulating images.', 'give'); |
|
325 | + $posting['gd']['success'] = extension_loaded('gd') && function_exists('gd_info') ? true : false; |
|
326 | 326 | |
327 | 327 | // Multibyte String. |
328 | 328 | $posting['mbstring']['name'] = 'Multibyte String'; |
329 | - $posting['mbstring']['help'] = __( 'Multibyte String (mbstring) is used to convert character encoding, like for emails or converting characters to lowercase.', 'give' ); |
|
329 | + $posting['mbstring']['help'] = __('Multibyte String (mbstring) is used to convert character encoding, like for emails or converting characters to lowercase.', 'give'); |
|
330 | 330 | |
331 | - if ( extension_loaded( 'mbstring' ) ) { |
|
331 | + if (extension_loaded('mbstring')) { |
|
332 | 332 | $posting['mbstring']['success'] = true; |
333 | 333 | } else { |
334 | 334 | $posting['mbstring']['success'] = false; |
335 | - $posting['mbstring']['note'] = sprintf( __( 'Your server does not support the %s functions - this is required for better character encoding. Some fallbacks will be used instead for it.', 'give' ), '<a href="https://php.net/manual/en/mbstring.installation.php">mbstring</a>' ); |
|
335 | + $posting['mbstring']['note'] = sprintf(__('Your server does not support the %s functions - this is required for better character encoding. Some fallbacks will be used instead for it.', 'give'), '<a href="https://php.net/manual/en/mbstring.installation.php">mbstring</a>'); |
|
336 | 336 | } |
337 | 337 | |
338 | 338 | // WP Remote Post Check. |
339 | - $posting['wp_remote_post']['name'] = __( 'Remote Post', 'give'); |
|
340 | - $posting['wp_remote_post']['help'] = __( 'PayPal uses this method of communicating when sending back transaction information.', 'give' ); |
|
339 | + $posting['wp_remote_post']['name'] = __('Remote Post', 'give'); |
|
340 | + $posting['wp_remote_post']['help'] = __('PayPal uses this method of communicating when sending back transaction information.', 'give'); |
|
341 | 341 | |
342 | - $response = wp_safe_remote_post( 'https://www.paypal.com/cgi-bin/webscr', array( |
|
342 | + $response = wp_safe_remote_post('https://www.paypal.com/cgi-bin/webscr', array( |
|
343 | 343 | 'timeout' => 60, |
344 | - 'user-agent' => 'Give/' . GIVE_VERSION, |
|
344 | + 'user-agent' => 'Give/'.GIVE_VERSION, |
|
345 | 345 | 'httpversion' => '1.1', |
346 | 346 | 'body' => array( |
347 | 347 | 'cmd' => '_notify-validate' |
348 | 348 | ) |
349 | - ) ); |
|
349 | + )); |
|
350 | 350 | |
351 | - if ( ! is_wp_error( $response ) && $response['response']['code'] >= 200 && $response['response']['code'] < 300 ) { |
|
351 | + if ( ! is_wp_error($response) && $response['response']['code'] >= 200 && $response['response']['code'] < 300) { |
|
352 | 352 | $posting['wp_remote_post']['success'] = true; |
353 | 353 | } else { |
354 | - $posting['wp_remote_post']['note'] = __( 'wp_remote_post() failed. PayPal IPN won\'t work with your server. Contact your hosting provider.', 'give' ); |
|
355 | - if ( is_wp_error( $response ) ) { |
|
356 | - $posting['wp_remote_post']['note'] .= ' ' . sprintf( __( 'Error: %s', 'give' ), sanitize_text_field( $response->get_error_message() ) ); |
|
354 | + $posting['wp_remote_post']['note'] = __('wp_remote_post() failed. PayPal IPN won\'t work with your server. Contact your hosting provider.', 'give'); |
|
355 | + if (is_wp_error($response)) { |
|
356 | + $posting['wp_remote_post']['note'] .= ' '.sprintf(__('Error: %s', 'give'), sanitize_text_field($response->get_error_message())); |
|
357 | 357 | } else { |
358 | - $posting['wp_remote_post']['note'] .= ' ' . sprintf( __( 'Status code: %s', 'give' ), sanitize_text_field( $response['response']['code'] ) ); |
|
358 | + $posting['wp_remote_post']['note'] .= ' '.sprintf(__('Status code: %s', 'give'), sanitize_text_field($response['response']['code'])); |
|
359 | 359 | } |
360 | 360 | $posting['wp_remote_post']['success'] = false; |
361 | 361 | } |
362 | 362 | |
363 | 363 | // WP Remote Get Check. |
364 | - $posting['wp_remote_get']['name'] = __( 'Remote Get', 'give'); |
|
365 | - $posting['wp_remote_get']['help'] = __( 'Give plugins may use this method of communication when checking for plugin updates.', 'give' ); |
|
364 | + $posting['wp_remote_get']['name'] = __('Remote Get', 'give'); |
|
365 | + $posting['wp_remote_get']['help'] = __('Give plugins may use this method of communication when checking for plugin updates.', 'give'); |
|
366 | 366 | |
367 | - $response = wp_safe_remote_get( 'https://woocommerce.com/wc-api/product-key-api?request=ping&network=' . ( is_multisite() ? '1' : '0' ) ); |
|
367 | + $response = wp_safe_remote_get('https://woocommerce.com/wc-api/product-key-api?request=ping&network='.(is_multisite() ? '1' : '0')); |
|
368 | 368 | |
369 | - if ( ! is_wp_error( $response ) && $response['response']['code'] >= 200 && $response['response']['code'] < 300 ) { |
|
369 | + if ( ! is_wp_error($response) && $response['response']['code'] >= 200 && $response['response']['code'] < 300) { |
|
370 | 370 | $posting['wp_remote_get']['success'] = true; |
371 | 371 | } else { |
372 | - $posting['wp_remote_get']['note'] = __( 'wp_remote_get() failed. The WooCommerce plugin updater won\'t work with your server. Contact your hosting provider.', 'give' ); |
|
373 | - if ( is_wp_error( $response ) ) { |
|
374 | - $posting['wp_remote_get']['note'] .= ' ' . sprintf( __( 'Error: %s', 'give' ), give_clean( $response->get_error_message() ) ); |
|
372 | + $posting['wp_remote_get']['note'] = __('wp_remote_get() failed. The WooCommerce plugin updater won\'t work with your server. Contact your hosting provider.', 'give'); |
|
373 | + if (is_wp_error($response)) { |
|
374 | + $posting['wp_remote_get']['note'] .= ' '.sprintf(__('Error: %s', 'give'), give_clean($response->get_error_message())); |
|
375 | 375 | } else { |
376 | - $posting['wp_remote_get']['note'] .= ' ' . sprintf( __( 'Status code: %s', 'give' ), give_clean( $response['response']['code'] ) ); |
|
376 | + $posting['wp_remote_get']['note'] .= ' '.sprintf(__('Status code: %s', 'give'), give_clean($response['response']['code'])); |
|
377 | 377 | } |
378 | 378 | $posting['wp_remote_get']['success'] = false; |
379 | 379 | } |
380 | 380 | |
381 | - $posting = apply_filters( 'woocommerce_debug_posting', $posting ); |
|
381 | + $posting = apply_filters('woocommerce_debug_posting', $posting); |
|
382 | 382 | |
383 | - foreach ( $posting as $post ) { |
|
384 | - $mark = ! empty( $post['success'] ) ? 'yes' : 'error'; |
|
383 | + foreach ($posting as $post) { |
|
384 | + $mark = ! empty($post['success']) ? 'yes' : 'error'; |
|
385 | 385 | ?> |
386 | 386 | <tr> |
387 | - <td data-export-label="<?php echo esc_html( $post['name'] ); ?>"><?php echo esc_html( $post['name'] ); ?>:</td> |
|
388 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( isset( $post['help'] ) ? $post['help'] : '' ); ?>"></span></td> |
|
387 | + <td data-export-label="<?php echo esc_html($post['name']); ?>"><?php echo esc_html($post['name']); ?>:</td> |
|
388 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(isset($post['help']) ? $post['help'] : ''); ?>"></span></td> |
|
389 | 389 | <td> |
390 | 390 | <mark class="<?php echo $mark; ?>"> |
391 | - <?php echo ! empty( $post['success'] ) ? '<span class="dashicons dashicons-yes"></span>' : '<span class="dashicons dashicons-no-alt"></span>'; ?> <?php echo ! empty( $post['note'] ) ? wp_kses_data( $post['note'] ) : ''; ?> |
|
391 | + <?php echo ! empty($post['success']) ? '<span class="dashicons dashicons-yes"></span>' : '<span class="dashicons dashicons-no-alt"></span>'; ?> <?php echo ! empty($post['note']) ? wp_kses_data($post['note']) : ''; ?> |
|
392 | 392 | </mark> |
393 | 393 | </td> |
394 | 394 | </tr> |
@@ -401,102 +401,102 @@ discard block |
||
401 | 401 | <table class="give-status-table widefat" cellspacing="0"> |
402 | 402 | <thead> |
403 | 403 | <tr> |
404 | - <th colspan="3" data-export-label="Give Configuration"><h2><?php _e( 'Give Configuration', 'give' ); ?></h2></th> |
|
404 | + <th colspan="3" data-export-label="Give Configuration"><h2><?php _e('Give Configuration', 'give'); ?></h2></th> |
|
405 | 405 | </tr> |
406 | 406 | </thead> |
407 | 407 | <tbody> |
408 | 408 | <tr> |
409 | - <td data-export-label="Give Version"><?php _e( 'Give Version', 'give' ); ?>:</td> |
|
410 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'The version of Give installed on your site.', 'give' ) ); ?>"></span></td> |
|
411 | - <td><?php echo esc_html( GIVE_VERSION ); ?></td> |
|
409 | + <td data-export-label="Give Version"><?php _e('Give Version', 'give'); ?>:</td> |
|
410 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('The version of Give installed on your site.', 'give')); ?>"></span></td> |
|
411 | + <td><?php echo esc_html(GIVE_VERSION); ?></td> |
|
412 | 412 | </tr> |
413 | 413 | <tr> |
414 | - <td data-export-label="Upgraded From"><?php _e( 'Upgraded From', 'give' ); ?>:</td> |
|
415 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'The version of Give installed prior to the last update.', 'give' ) ); ?>"></span></td> |
|
416 | - <td><?php echo esc_html( get_option( 'give_version_upgraded_from', '–' ) ); ?></td> |
|
414 | + <td data-export-label="Upgraded From"><?php _e('Upgraded From', 'give'); ?>:</td> |
|
415 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('The version of Give installed prior to the last update.', 'give')); ?>"></span></td> |
|
416 | + <td><?php echo esc_html(get_option('give_version_upgraded_from', '–')); ?></td> |
|
417 | 417 | </tr> |
418 | 418 | <tr> |
419 | - <td data-export-label="Test Mode"><?php _e( 'Test Mode', 'give' ); ?>:</td> |
|
420 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'Whether Test Mode is enabled in Give settings.', 'give' ) ); ?>"></span></td> |
|
421 | - <td><?php echo give_is_test_mode() ? __( 'Enabled', 'give' ) : __( 'Disabled', 'give' ); ?></td> |
|
419 | + <td data-export-label="Test Mode"><?php _e('Test Mode', 'give'); ?>:</td> |
|
420 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('Whether Test Mode is enabled in Give settings.', 'give')); ?>"></span></td> |
|
421 | + <td><?php echo give_is_test_mode() ? __('Enabled', 'give') : __('Disabled', 'give'); ?></td> |
|
422 | 422 | </tr> |
423 | 423 | <tr> |
424 | - <td data-export-label="Currency Code"><?php _e( 'Currency Code', 'give' ); ?>:</td> |
|
425 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'The currency code selected in Give settings.', 'give' ) ); ?>"></span></td> |
|
426 | - <td><?php echo esc_html( give_get_currency() ); ?></td> |
|
424 | + <td data-export-label="Currency Code"><?php _e('Currency Code', 'give'); ?>:</td> |
|
425 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('The currency code selected in Give settings.', 'give')); ?>"></span></td> |
|
426 | + <td><?php echo esc_html(give_get_currency()); ?></td> |
|
427 | 427 | </tr> |
428 | 428 | <tr> |
429 | - <td data-export-label="Currency Position"><?php _e( 'Currency Position', 'give' ); ?>:</td> |
|
430 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'The currency position selected in Give settings.', 'give' ) ); ?>"></span></td> |
|
431 | - <td><?php echo 'before' === give_get_option( 'currency_position' ) ? __( 'Before', 'give' ) : __( 'After', 'give' ); ?></td> |
|
429 | + <td data-export-label="Currency Position"><?php _e('Currency Position', 'give'); ?>:</td> |
|
430 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('The currency position selected in Give settings.', 'give')); ?>"></span></td> |
|
431 | + <td><?php echo 'before' === give_get_option('currency_position') ? __('Before', 'give') : __('After', 'give'); ?></td> |
|
432 | 432 | </tr> |
433 | 433 | <tr> |
434 | - <td data-export-label="Decimal Separator"><?php _e( 'Decimal Separator', 'give' ); ?>:</td> |
|
435 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'The decimal separator defined in Give settings.', 'give' ) ); ?>"></span></td> |
|
436 | - <td><?php echo esc_html( give_get_option( 'decimal_separator', '.' ) ); ?></td> |
|
434 | + <td data-export-label="Decimal Separator"><?php _e('Decimal Separator', 'give'); ?>:</td> |
|
435 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('The decimal separator defined in Give settings.', 'give')); ?>"></span></td> |
|
436 | + <td><?php echo esc_html(give_get_option('decimal_separator', '.')); ?></td> |
|
437 | 437 | </tr> |
438 | 438 | <tr> |
439 | - <td data-export-label="Thousands Separator"><?php _e( 'Thousands Separator', 'give' ); ?>:</td> |
|
440 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'The thousands separator defined in Give settings.', 'give' ) ); ?>"></span></td> |
|
441 | - <td><?php echo esc_html( give_get_option( 'thousands_separator', ',' ) ); ?></td> |
|
439 | + <td data-export-label="Thousands Separator"><?php _e('Thousands Separator', 'give'); ?>:</td> |
|
440 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('The thousands separator defined in Give settings.', 'give')); ?>"></span></td> |
|
441 | + <td><?php echo esc_html(give_get_option('thousands_separator', ',')); ?></td> |
|
442 | 442 | </tr> |
443 | 443 | <tr> |
444 | - <td data-export-label="Success Page"><?php _e( 'Success Page', 'give' ); ?>:</td> |
|
445 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'The page where donors land following a successful transaction.', 'give' ) ); ?>"></span></td> |
|
446 | - <td><?php echo ! empty( $give_options['success_page'] ) ? esc_url( get_permalink( $give_options['success_page'] ) ) : '–'; ?></td> |
|
444 | + <td data-export-label="Success Page"><?php _e('Success Page', 'give'); ?>:</td> |
|
445 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('The page where donors land following a successful transaction.', 'give')); ?>"></span></td> |
|
446 | + <td><?php echo ! empty($give_options['success_page']) ? esc_url(get_permalink($give_options['success_page'])) : '–'; ?></td> |
|
447 | 447 | </tr> |
448 | 448 | <tr> |
449 | - <td data-export-label="Failure Page"><?php _e( 'Failure Page', 'give' ); ?>:</td> |
|
450 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'The page where donors land following a failed transaction.', 'give' ) ); ?>"></span></td> |
|
451 | - <td><?php echo ! empty( $give_options['failure_page'] ) ? esc_url( get_permalink( $give_options['failure_page'] ) ) : '–'; ?></td> |
|
449 | + <td data-export-label="Failure Page"><?php _e('Failure Page', 'give'); ?>:</td> |
|
450 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('The page where donors land following a failed transaction.', 'give')); ?>"></span></td> |
|
451 | + <td><?php echo ! empty($give_options['failure_page']) ? esc_url(get_permalink($give_options['failure_page'])) : '–'; ?></td> |
|
452 | 452 | </tr> |
453 | 453 | <tr> |
454 | - <td data-export-label="Give Forms Slug"><?php _e( 'Give Forms Slug', 'give' ); ?>:</td> |
|
455 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'The slug used for Give donation forms.', 'give' ) ); ?>"></span></td> |
|
456 | - <td><?php echo esc_html( defined( 'GIVE_SLUG' ) ? '/' . GIVE_SLUG . '/' : '/donations/' ); ?></td> |
|
454 | + <td data-export-label="Give Forms Slug"><?php _e('Give Forms Slug', 'give'); ?>:</td> |
|
455 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('The slug used for Give donation forms.', 'give')); ?>"></span></td> |
|
456 | + <td><?php echo esc_html(defined('GIVE_SLUG') ? '/'.GIVE_SLUG.'/' : '/donations/'); ?></td> |
|
457 | 457 | </tr> |
458 | 458 | <?php |
459 | 459 | $active_gateways = give_get_enabled_payment_gateways(); |
460 | 460 | $enabled_gateways = $default_gateway = ''; |
461 | 461 | |
462 | - if ( $active_gateways ) { |
|
463 | - $default_gateway_is_active = give_is_gateway_active( give_get_default_gateway( null ) ); |
|
462 | + if ($active_gateways) { |
|
463 | + $default_gateway_is_active = give_is_gateway_active(give_get_default_gateway(null)); |
|
464 | 464 | |
465 | - if ( $default_gateway_is_active ) { |
|
466 | - $default_gateway = give_get_default_gateway( null ); |
|
467 | - $default_gateway = $active_gateways[ $default_gateway ]['admin_label']; |
|
465 | + if ($default_gateway_is_active) { |
|
466 | + $default_gateway = give_get_default_gateway(null); |
|
467 | + $default_gateway = $active_gateways[$default_gateway]['admin_label']; |
|
468 | 468 | } else { |
469 | - $default_gateway = __( 'Test Donation', 'give' ); |
|
469 | + $default_gateway = __('Test Donation', 'give'); |
|
470 | 470 | } |
471 | 471 | |
472 | 472 | $gateways = array(); |
473 | 473 | |
474 | - foreach ( $active_gateways as $gateway ) { |
|
474 | + foreach ($active_gateways as $gateway) { |
|
475 | 475 | $gateways[] = $gateway['admin_label']; |
476 | 476 | } |
477 | 477 | |
478 | - $enabled_gateways = implode( ', ', $gateways ); |
|
478 | + $enabled_gateways = implode(', ', $gateways); |
|
479 | 479 | } |
480 | 480 | ?> |
481 | 481 | <tr> |
482 | - <td data-export-label="Enabled Payment Gateways"><?php _e( 'Enabled Payment Gateways', 'give' ); ?>:</td> |
|
483 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'All payment gateways enabled in Give settings.', 'give' ) ); ?>"></span></td> |
|
484 | - <td><?php echo esc_html( ! empty( $enabled_gateways ) ? $enabled_gateways : '–' ); ?></td> |
|
482 | + <td data-export-label="Enabled Payment Gateways"><?php _e('Enabled Payment Gateways', 'give'); ?>:</td> |
|
483 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('All payment gateways enabled in Give settings.', 'give')); ?>"></span></td> |
|
484 | + <td><?php echo esc_html( ! empty($enabled_gateways) ? $enabled_gateways : '–'); ?></td> |
|
485 | 485 | </tr> |
486 | 486 | <tr> |
487 | - <td data-export-label="Default Payment Gateway"><?php _e( 'Default Payment Gateway', 'give' ); ?>:</td> |
|
488 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'The default payment gateway selected in Give settings.', 'give' ) ); ?>"></span></td> |
|
489 | - <td><?php echo esc_html( ! empty( $default_gateway ) ? $default_gateway : '–' ); ?></td> |
|
487 | + <td data-export-label="Default Payment Gateway"><?php _e('Default Payment Gateway', 'give'); ?>:</td> |
|
488 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('The default payment gateway selected in Give settings.', 'give')); ?>"></span></td> |
|
489 | + <td><?php echo esc_html( ! empty($default_gateway) ? $default_gateway : '–'); ?></td> |
|
490 | 490 | </tr> |
491 | 491 | <tr> |
492 | - <td data-export-label="Admin Email Notifications"><?php _e( 'Admin Email Notifications', 'give' ); ?>:</td> |
|
493 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'Whether admins receive email notifications of transactions.', 'give' ) ); ?>"></span></td> |
|
494 | - <td><?php echo 'enabled' === give_get_option( 'admin_notices' ) ? __( 'Enabled', 'give' ) : __( 'Disabled', 'give' ); ?></td> |
|
492 | + <td data-export-label="Admin Email Notifications"><?php _e('Admin Email Notifications', 'give'); ?>:</td> |
|
493 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('Whether admins receive email notifications of transactions.', 'give')); ?>"></span></td> |
|
494 | + <td><?php echo 'enabled' === give_get_option('admin_notices') ? __('Enabled', 'give') : __('Disabled', 'give'); ?></td> |
|
495 | 495 | </tr> |
496 | 496 | <tr> |
497 | - <td data-export-label="Donor Email Access"><?php _e( 'Donor Email Access', 'give' ); ?>:</td> |
|
498 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'Whether donors can access their donation history using only email.', 'give' ) ); ?>"></span></td> |
|
499 | - <td><?php echo 'enabled' === give_get_option( 'email_access' ) ? __( 'Enabled', 'give' ) : __( 'Disabled', 'give' ); ?></td> |
|
497 | + <td data-export-label="Donor Email Access"><?php _e('Donor Email Access', 'give'); ?>:</td> |
|
498 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('Whether donors can access their donation history using only email.', 'give')); ?>"></span></td> |
|
499 | + <td><?php echo 'enabled' === give_get_option('email_access') ? __('Enabled', 'give') : __('Disabled', 'give'); ?></td> |
|
500 | 500 | </tr> |
501 | 501 | </tbody> |
502 | 502 | </table> |
@@ -504,45 +504,45 @@ discard block |
||
504 | 504 | <table class="give-status-table widefat" cellspacing="0"> |
505 | 505 | <thead> |
506 | 506 | <tr> |
507 | - <th colspan="3" data-export-label="Session Configuration"><h2><?php _e( 'Session Configuration', 'give' ); ?></h2></th> |
|
507 | + <th colspan="3" data-export-label="Session Configuration"><h2><?php _e('Session Configuration', 'give'); ?></h2></th> |
|
508 | 508 | </tr> |
509 | 509 | </thead> |
510 | 510 | <tbody> |
511 | 511 | <tr> |
512 | - <td data-export-label="Give Use Sessions"><?php _e( 'Give Use Sessions', 'give' ); ?>:</td> |
|
513 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'Whether PHP sessions are enforced, enabled, or disabled.', 'give' ) ); ?>"></span></td> |
|
514 | - <td><?php echo defined( 'GIVE_USE_PHP_SESSIONS' ) && GIVE_USE_PHP_SESSIONS ? __( 'Enforced', 'give' ) : ( Give()->session->use_php_sessions() ? __( 'Enabled', 'give' ) : __( 'Disabled', 'give' ) ); ?></td> |
|
512 | + <td data-export-label="Give Use Sessions"><?php _e('Give Use Sessions', 'give'); ?>:</td> |
|
513 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('Whether PHP sessions are enforced, enabled, or disabled.', 'give')); ?>"></span></td> |
|
514 | + <td><?php echo defined('GIVE_USE_PHP_SESSIONS') && GIVE_USE_PHP_SESSIONS ? __('Enforced', 'give') : (Give()->session->use_php_sessions() ? __('Enabled', 'give') : __('Disabled', 'give')); ?></td> |
|
515 | 515 | </tr> |
516 | 516 | <tr> |
517 | - <td data-export-label="Session"><?php _e( 'Session', 'give' ); ?>:</td> |
|
518 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'Whether a PHP session is currently set.', 'give' ) ); ?>"></span></td> |
|
519 | - <td><?php echo isset( $_SESSION ) ? __( 'Enabled', 'give' ) : __( 'Disabled', 'give' ); ?></td> |
|
517 | + <td data-export-label="Session"><?php _e('Session', 'give'); ?>:</td> |
|
518 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('Whether a PHP session is currently set.', 'give')); ?>"></span></td> |
|
519 | + <td><?php echo isset($_SESSION) ? __('Enabled', 'give') : __('Disabled', 'give'); ?></td> |
|
520 | 520 | </tr> |
521 | - <?php if ( isset( $_SESSION ) ) { ?> |
|
521 | + <?php if (isset($_SESSION)) { ?> |
|
522 | 522 | <tr> |
523 | - <td data-export-label="Session Name"><?php _e( 'Session Name', 'give' ); ?>:</td> |
|
524 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'The name of the current PHP session.', 'give' ) ); ?>"></span></td> |
|
525 | - <td><?php echo esc_html( ini_get( 'session.name' ) ); ?></td> |
|
523 | + <td data-export-label="Session Name"><?php _e('Session Name', 'give'); ?>:</td> |
|
524 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('The name of the current PHP session.', 'give')); ?>"></span></td> |
|
525 | + <td><?php echo esc_html(ini_get('session.name')); ?></td> |
|
526 | 526 | </tr> |
527 | 527 | <tr> |
528 | - <td data-export-label="Cookie Path"><?php _e( 'Cookie Path', 'give' ); ?>:</td> |
|
529 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'The cookie path of the current PHP session.', 'give' ) ); ?>"></span></td> |
|
530 | - <td><?php echo esc_html( ini_get( 'session.cookie_path' ) ); ?></td> |
|
528 | + <td data-export-label="Cookie Path"><?php _e('Cookie Path', 'give'); ?>:</td> |
|
529 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('The cookie path of the current PHP session.', 'give')); ?>"></span></td> |
|
530 | + <td><?php echo esc_html(ini_get('session.cookie_path')); ?></td> |
|
531 | 531 | </tr> |
532 | 532 | <tr> |
533 | - <td data-export-label="Save Path"><?php _e( 'Save Path', 'give' ); ?>:</td> |
|
534 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'The save path of the current PHP session.', 'give' ) ); ?>"></span></td> |
|
535 | - <td><?php echo esc_html( ini_get( 'session.save_path' ) ); ?></td> |
|
533 | + <td data-export-label="Save Path"><?php _e('Save Path', 'give'); ?>:</td> |
|
534 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('The save path of the current PHP session.', 'give')); ?>"></span></td> |
|
535 | + <td><?php echo esc_html(ini_get('session.save_path')); ?></td> |
|
536 | 536 | </tr> |
537 | 537 | <tr> |
538 | - <td data-export-label="Use Cookies"><?php _e( 'Use Cookies', 'give' ); ?>:</td> |
|
539 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'Whether the current PHP session is set to use cookies.', 'give' ) ); ?>"></span></td> |
|
540 | - <td><?php echo ini_get( 'session.use_cookies' ) ? __( 'Enabled', 'give' ) : __( 'Disabled', 'give' ); ?></td> |
|
538 | + <td data-export-label="Use Cookies"><?php _e('Use Cookies', 'give'); ?>:</td> |
|
539 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('Whether the current PHP session is set to use cookies.', 'give')); ?>"></span></td> |
|
540 | + <td><?php echo ini_get('session.use_cookies') ? __('Enabled', 'give') : __('Disabled', 'give'); ?></td> |
|
541 | 541 | </tr> |
542 | 542 | <tr> |
543 | - <td data-export-label="Use Only Cookies"><?php _e( 'Use Only Cookies', 'give' ); ?>:</td> |
|
544 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'Whether the current PHP session is set to use only cookies.', 'give' ) ); ?>"></span></td> |
|
545 | - <td><?php echo ini_get( 'session.use_only_cookies' ) ? __( 'Enabled', 'give' ) : __( 'Disabled', 'give' ); ?></td> |
|
543 | + <td data-export-label="Use Only Cookies"><?php _e('Use Only Cookies', 'give'); ?>:</td> |
|
544 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('Whether the current PHP session is set to use only cookies.', 'give')); ?>"></span></td> |
|
545 | + <td><?php echo ini_get('session.use_only_cookies') ? __('Enabled', 'give') : __('Disabled', 'give'); ?></td> |
|
546 | 546 | </tr> |
547 | 547 | <?php } ?> |
548 | 548 | </tbody> |
@@ -551,13 +551,13 @@ discard block |
||
551 | 551 | <table class="give-status-table widefat" cellspacing="0"> |
552 | 552 | <thead> |
553 | 553 | <tr> |
554 | - <th colspan="3" data-export-label="Active Give Add-ons"><h2><?php _e( 'Active Give Add-ons', 'give' ); ?></h2></th> |
|
554 | + <th colspan="3" data-export-label="Active Give Add-ons"><h2><?php _e('Active Give Add-ons', 'give'); ?></h2></th> |
|
555 | 555 | </tr> |
556 | 556 | </thead> |
557 | 557 | <tbody> |
558 | 558 | <?php |
559 | - foreach ( $plugins as $plugin_data ) { |
|
560 | - if ( 'active' != $plugin_data['Status'] || 'add-on' != $plugin_data['Type'] ) { |
|
559 | + foreach ($plugins as $plugin_data) { |
|
560 | + if ('active' != $plugin_data['Status'] || 'add-on' != $plugin_data['Type']) { |
|
561 | 561 | continue; |
562 | 562 | } |
563 | 563 | |
@@ -565,30 +565,30 @@ discard block |
||
565 | 565 | $author_name = $plugin_data['Author']; |
566 | 566 | |
567 | 567 | // Link the plugin name to the plugin URL if available. |
568 | - if ( ! empty( $plugin_data['PluginURI'] ) ) { |
|
569 | - $plugin_name = '<a href="' . esc_url( $plugin_data['PluginURI'] ) . '" title="' . esc_attr__( 'Visit plugin homepage' , 'give' ) . '">' . $plugin_name . '</a>'; |
|
568 | + if ( ! empty($plugin_data['PluginURI'])) { |
|
569 | + $plugin_name = '<a href="'.esc_url($plugin_data['PluginURI']).'" title="'.esc_attr__('Visit plugin homepage', 'give').'">'.$plugin_name.'</a>'; |
|
570 | 570 | } |
571 | 571 | |
572 | 572 | // Link the author name to the author URL if available. |
573 | - if ( ! empty( $plugin_data['AuthorURI'] ) ) { |
|
574 | - $author_name = '<a href="' . esc_url( $plugin_data['AuthorURI'] ) . '" title="' . esc_attr__( 'Visit author homepage' , 'give' ) . '">' . $author_name . '</a>'; |
|
573 | + if ( ! empty($plugin_data['AuthorURI'])) { |
|
574 | + $author_name = '<a href="'.esc_url($plugin_data['AuthorURI']).'" title="'.esc_attr__('Visit author homepage', 'give').'">'.$author_name.'</a>'; |
|
575 | 575 | } |
576 | 576 | ?> |
577 | 577 | <tr> |
578 | - <td><?php echo wp_kses( $plugin_name, wp_kses_allowed_html( 'post' ) ); ?></td> |
|
578 | + <td><?php echo wp_kses($plugin_name, wp_kses_allowed_html('post')); ?></td> |
|
579 | 579 | <td class="help"> </td> |
580 | 580 | <td> |
581 | 581 | <?php |
582 | - if ( true === $plugin_data['License'] ) { |
|
583 | - echo '<mark class="yes"><span class="dashicons dashicons-yes"></span></mark> ' . __( 'Licensed', 'give' ); |
|
582 | + if (true === $plugin_data['License']) { |
|
583 | + echo '<mark class="yes"><span class="dashicons dashicons-yes"></span></mark> '.__('Licensed', 'give'); |
|
584 | 584 | } else { |
585 | - echo '<mark class="error"><span class="dashicons dashicons-no-alt"></span></mark> ' . __( 'Unlicensed', 'give' ); |
|
585 | + echo '<mark class="error"><span class="dashicons dashicons-no-alt"></span></mark> '.__('Unlicensed', 'give'); |
|
586 | 586 | } |
587 | 587 | |
588 | 588 | echo ' – ' |
589 | - . sprintf( _x( 'by %s', 'by author', 'give' ), wp_kses( $author_name, wp_kses_allowed_html( 'post' ) ) ) |
|
589 | + . sprintf(_x('by %s', 'by author', 'give'), wp_kses($author_name, wp_kses_allowed_html('post'))) |
|
590 | 590 | . ' – ' |
591 | - . esc_html( $plugin_data['Version'] ); |
|
591 | + . esc_html($plugin_data['Version']); |
|
592 | 592 | ?> |
593 | 593 | </td> |
594 | 594 | </tr> |
@@ -601,18 +601,18 @@ discard block |
||
601 | 601 | <table class="give-status-table widefat" cellspacing="0"> |
602 | 602 | <thead> |
603 | 603 | <tr> |
604 | - <th colspan="3" data-export-label="Other Active Plugins"><h2><?php _e( 'Other Active Plugins', 'give' ); ?></h2></th> |
|
604 | + <th colspan="3" data-export-label="Other Active Plugins"><h2><?php _e('Other Active Plugins', 'give'); ?></h2></th> |
|
605 | 605 | </tr> |
606 | 606 | </thead> |
607 | 607 | <tbody> |
608 | 608 | <?php |
609 | - foreach ( $plugins as $plugin_data ) { |
|
610 | - if ( 'active' != $plugin_data['Status'] || 'other' != $plugin_data['Type'] ) { |
|
609 | + foreach ($plugins as $plugin_data) { |
|
610 | + if ('active' != $plugin_data['Status'] || 'other' != $plugin_data['Type']) { |
|
611 | 611 | continue; |
612 | 612 | } |
613 | 613 | |
614 | 614 | // Do not show Give core plugin. |
615 | - if ( 'Give - Donation Plugin' === $plugin_data['Name'] ) { |
|
615 | + if ('Give - Donation Plugin' === $plugin_data['Name']) { |
|
616 | 616 | continue; |
617 | 617 | } |
618 | 618 | |
@@ -620,19 +620,19 @@ discard block |
||
620 | 620 | $author_name = $plugin_data['Author']; |
621 | 621 | |
622 | 622 | // Link the plugin name to the plugin URL if available. |
623 | - if ( ! empty( $plugin_data['PluginURI'] ) ) { |
|
624 | - $plugin_name = '<a href="' . esc_url( $plugin_data['PluginURI'] ) . '" title="' . esc_attr__( 'Visit plugin homepage' , 'give' ) . '">' . $plugin_name . '</a>'; |
|
623 | + if ( ! empty($plugin_data['PluginURI'])) { |
|
624 | + $plugin_name = '<a href="'.esc_url($plugin_data['PluginURI']).'" title="'.esc_attr__('Visit plugin homepage', 'give').'">'.$plugin_name.'</a>'; |
|
625 | 625 | } |
626 | 626 | |
627 | 627 | // Link the author name to the author URL if available. |
628 | - if ( ! empty( $plugin_data['AuthorURI'] ) ) { |
|
629 | - $author_name = '<a href="' . esc_url( $plugin_data['AuthorURI'] ) . '" title="' . esc_attr__( 'Visit author homepage' , 'give' ) . '">' . $author_name . '</a>'; |
|
628 | + if ( ! empty($plugin_data['AuthorURI'])) { |
|
629 | + $author_name = '<a href="'.esc_url($plugin_data['AuthorURI']).'" title="'.esc_attr__('Visit author homepage', 'give').'">'.$author_name.'</a>'; |
|
630 | 630 | } |
631 | 631 | ?> |
632 | 632 | <tr> |
633 | - <td><?php echo wp_kses( $plugin_name, wp_kses_allowed_html( 'post' ) ); ?></td> |
|
633 | + <td><?php echo wp_kses($plugin_name, wp_kses_allowed_html('post')); ?></td> |
|
634 | 634 | <td class="help"> </td> |
635 | - <td><?php echo sprintf( _x( 'by %s', 'by author', 'give' ), wp_kses( $author_name, wp_kses_allowed_html( 'post' ) ) ) . ' – ' . esc_html( $plugin_data['Version'] ); ?></td> |
|
635 | + <td><?php echo sprintf(_x('by %s', 'by author', 'give'), wp_kses($author_name, wp_kses_allowed_html('post'))).' – '.esc_html($plugin_data['Version']); ?></td> |
|
636 | 636 | </tr> |
637 | 637 | <?php |
638 | 638 | } |
@@ -643,13 +643,13 @@ discard block |
||
643 | 643 | <table class="give-status-table widefat" cellspacing="0"> |
644 | 644 | <thead> |
645 | 645 | <tr> |
646 | - <th colspan="3" data-export-label="Inactive Plugins"><h2><?php _e( 'Inactive Plugins', 'give' ); ?></h2></th> |
|
646 | + <th colspan="3" data-export-label="Inactive Plugins"><h2><?php _e('Inactive Plugins', 'give'); ?></h2></th> |
|
647 | 647 | </tr> |
648 | 648 | </thead> |
649 | 649 | <tbody> |
650 | 650 | <?php |
651 | - foreach ( $plugins as $plugin_data ) { |
|
652 | - if ( 'inactive' != $plugin_data['Status'] ) { |
|
651 | + foreach ($plugins as $plugin_data) { |
|
652 | + if ('inactive' != $plugin_data['Status']) { |
|
653 | 653 | continue; |
654 | 654 | } |
655 | 655 | |
@@ -657,19 +657,19 @@ discard block |
||
657 | 657 | $author_name = $plugin_data['Author']; |
658 | 658 | |
659 | 659 | // Link the plugin name to the plugin URL if available. |
660 | - if ( ! empty( $plugin_data['PluginURI'] ) ) { |
|
661 | - $plugin_name = '<a href="' . esc_url( $plugin_data['PluginURI'] ) . '" title="' . esc_attr__( 'Visit plugin homepage' , 'give' ) . '">' . $plugin_name . '</a>'; |
|
660 | + if ( ! empty($plugin_data['PluginURI'])) { |
|
661 | + $plugin_name = '<a href="'.esc_url($plugin_data['PluginURI']).'" title="'.esc_attr__('Visit plugin homepage', 'give').'">'.$plugin_name.'</a>'; |
|
662 | 662 | } |
663 | 663 | |
664 | 664 | // Link the author name to the author URL if available. |
665 | - if ( ! empty( $plugin_data['AuthorURI'] ) ) { |
|
666 | - $author_name = '<a href="' . esc_url( $plugin_data['AuthorURI'] ) . '" title="' . esc_attr__( 'Visit author homepage' , 'give' ) . '">' . $author_name . '</a>'; |
|
665 | + if ( ! empty($plugin_data['AuthorURI'])) { |
|
666 | + $author_name = '<a href="'.esc_url($plugin_data['AuthorURI']).'" title="'.esc_attr__('Visit author homepage', 'give').'">'.$author_name.'</a>'; |
|
667 | 667 | } |
668 | 668 | ?> |
669 | 669 | <tr> |
670 | - <td><?php echo wp_kses( $plugin_name, wp_kses_allowed_html( 'post' ) ); ?></td> |
|
670 | + <td><?php echo wp_kses($plugin_name, wp_kses_allowed_html('post')); ?></td> |
|
671 | 671 | <td class="help"> </td> |
672 | - <td><?php echo sprintf( _x( 'by %s', 'by author', 'give' ), wp_kses( $author_name, wp_kses_allowed_html( 'post' ) ) ) . ' – ' . esc_html( $plugin_data['Version'] ); ?></td> |
|
672 | + <td><?php echo sprintf(_x('by %s', 'by author', 'give'), wp_kses($author_name, wp_kses_allowed_html('post'))).' – '.esc_html($plugin_data['Version']); ?></td> |
|
673 | 673 | </tr> |
674 | 674 | <?php |
675 | 675 | } |
@@ -679,37 +679,37 @@ discard block |
||
679 | 679 | |
680 | 680 | <?php |
681 | 681 | $active_mu_plugins = (array) get_mu_plugins(); |
682 | -if ( ! empty( $active_mu_plugins ) ) { |
|
682 | +if ( ! empty($active_mu_plugins)) { |
|
683 | 683 | ?> |
684 | 684 | <table class="give-status-table widefat" cellspacing="0"> |
685 | 685 | <thead> |
686 | 686 | <tr> |
687 | - <th colspan="3" data-export-label="Active MU Plugins"><h2><?php _e( 'Active MU Plugins', 'give' ); ?></h2></th> |
|
687 | + <th colspan="3" data-export-label="Active MU Plugins"><h2><?php _e('Active MU Plugins', 'give'); ?></h2></th> |
|
688 | 688 | </tr> |
689 | 689 | </thead> |
690 | 690 | <tbody> |
691 | 691 | <?php |
692 | 692 | |
693 | - foreach ( $active_mu_plugins as $mu_plugin_data ) { |
|
694 | - if ( ! empty( $mu_plugin_data['Name'] ) ) { |
|
693 | + foreach ($active_mu_plugins as $mu_plugin_data) { |
|
694 | + if ( ! empty($mu_plugin_data['Name'])) { |
|
695 | 695 | // Link the plugin name to the plugin URL if available. |
696 | - $plugin_name = esc_html( $mu_plugin_data['Name'] ); |
|
696 | + $plugin_name = esc_html($mu_plugin_data['Name']); |
|
697 | 697 | |
698 | - if ( ! empty( $mu_plugin_data['PluginURI'] ) ) { |
|
699 | - $plugin_name = '<a href="' . esc_url( $mu_plugin_data['PluginURI'] ) . '" title="' . esc_attr__( 'Visit plugin homepage' , 'give' ) . '">' . $plugin_name . '</a>'; |
|
698 | + if ( ! empty($mu_plugin_data['PluginURI'])) { |
|
699 | + $plugin_name = '<a href="'.esc_url($mu_plugin_data['PluginURI']).'" title="'.esc_attr__('Visit plugin homepage', 'give').'">'.$plugin_name.'</a>'; |
|
700 | 700 | } |
701 | 701 | |
702 | 702 | // Link the author name to the author URL if available. |
703 | - $author_name = esc_html( $mu_plugin_data['Author'] ); |
|
703 | + $author_name = esc_html($mu_plugin_data['Author']); |
|
704 | 704 | |
705 | - if ( ! empty( $mu_plugin_data['AuthorURI'] ) ) { |
|
706 | - $author_name = '<a href="' . esc_url( $mu_plugin_data['AuthorURI'] ) . '">' . $author_name . '</a>'; |
|
705 | + if ( ! empty($mu_plugin_data['AuthorURI'])) { |
|
706 | + $author_name = '<a href="'.esc_url($mu_plugin_data['AuthorURI']).'">'.$author_name.'</a>'; |
|
707 | 707 | } |
708 | 708 | ?> |
709 | 709 | <tr> |
710 | 710 | <td><?php echo $plugin_name; ?></td> |
711 | 711 | <td class="help"> </td> |
712 | - <td><?php echo sprintf( _x( 'by %s', 'by author', 'give' ), $author_name ) . ' – ' . esc_html( $mu_plugin_data['Version'] ); ?></td> |
|
712 | + <td><?php echo sprintf(_x('by %s', 'by author', 'give'), $author_name).' – '.esc_html($mu_plugin_data['Version']); ?></td> |
|
713 | 713 | </tr> |
714 | 714 | <?php |
715 | 715 | } |
@@ -722,53 +722,53 @@ discard block |
||
722 | 722 | <table class="give-status-table widefat" cellspacing="0"> |
723 | 723 | <thead> |
724 | 724 | <tr> |
725 | - <th colspan="3" data-export-label="Theme"><h2><?php _e( 'Theme', 'give' ); ?></h2></th> |
|
725 | + <th colspan="3" data-export-label="Theme"><h2><?php _e('Theme', 'give'); ?></h2></th> |
|
726 | 726 | </tr> |
727 | 727 | </thead> |
728 | 728 | <?php |
729 | - include_once( ABSPATH . 'wp-admin/includes/theme-install.php' ); |
|
729 | + include_once(ABSPATH.'wp-admin/includes/theme-install.php'); |
|
730 | 730 | $active_theme = wp_get_theme(); |
731 | 731 | ?> |
732 | 732 | <tbody> |
733 | 733 | <tr> |
734 | - <td data-export-label="Name"><?php _e( 'Name', 'give' ); ?>:</td> |
|
735 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'The name of the current active theme.', 'give' ) ); ?>"></span></td> |
|
736 | - <td><?php echo esc_html( $active_theme->Name ); ?></td> |
|
734 | + <td data-export-label="Name"><?php _e('Name', 'give'); ?>:</td> |
|
735 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('The name of the current active theme.', 'give')); ?>"></span></td> |
|
736 | + <td><?php echo esc_html($active_theme->Name); ?></td> |
|
737 | 737 | </tr> |
738 | 738 | <tr> |
739 | - <td data-export-label="Version"><?php _e( 'Version', 'give' ); ?>:</td> |
|
740 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'The installed version of the current active theme.', 'give' ) ); ?>"></span></td> |
|
741 | - <td><?php echo esc_html( $active_theme->Version ); ?></td> |
|
739 | + <td data-export-label="Version"><?php _e('Version', 'give'); ?>:</td> |
|
740 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('The installed version of the current active theme.', 'give')); ?>"></span></td> |
|
741 | + <td><?php echo esc_html($active_theme->Version); ?></td> |
|
742 | 742 | </tr> |
743 | 743 | <tr> |
744 | - <td data-export-label="Author URL"><?php _e( 'Author URL', 'give' ); ?>:</td> |
|
745 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'The theme developer\'s URL.', 'give' ) ); ?>"></span></td> |
|
744 | + <td data-export-label="Author URL"><?php _e('Author URL', 'give'); ?>:</td> |
|
745 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('The theme developer\'s URL.', 'give')); ?>"></span></td> |
|
746 | 746 | <td><?php echo $active_theme->{'Author URI'}; ?></td> |
747 | 747 | </tr> |
748 | 748 | <tr> |
749 | - <td data-export-label="Child Theme"><?php _e( 'Child Theme', 'give' ); ?>:</td> |
|
750 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'Whether the current theme is a child theme.', 'give' ) ); ?>"></span></td> |
|
749 | + <td data-export-label="Child Theme"><?php _e('Child Theme', 'give'); ?>:</td> |
|
750 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('Whether the current theme is a child theme.', 'give')); ?>"></span></td> |
|
751 | 751 | <td><?php |
752 | - echo is_child_theme() ? __( 'Yes', 'give' ) : __( 'No', 'give' ) . ' – ' . sprintf( __( 'If you\'re modifying Give on a parent theme you didn\'t build personally, then we recommend using a child theme. See: <a href="%s" target="_blank">How to Create a Child Theme</a>', 'give' ), 'https://codex.wordpress.org/Child_Themes' ); |
|
752 | + echo is_child_theme() ? __('Yes', 'give') : __('No', 'give').' – '.sprintf(__('If you\'re modifying Give on a parent theme you didn\'t build personally, then we recommend using a child theme. See: <a href="%s" target="_blank">How to Create a Child Theme</a>', 'give'), 'https://codex.wordpress.org/Child_Themes'); |
|
753 | 753 | ?></td> |
754 | 754 | </tr> |
755 | 755 | <?php |
756 | - if( is_child_theme() ) { |
|
757 | - $parent_theme = wp_get_theme( $active_theme->Template ); |
|
756 | + if (is_child_theme()) { |
|
757 | + $parent_theme = wp_get_theme($active_theme->Template); |
|
758 | 758 | ?> |
759 | 759 | <tr> |
760 | - <td data-export-label="Parent Theme Name"><?php _e( 'Parent Theme Name', 'give' ); ?>:</td> |
|
761 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'The name of the parent theme.', 'give' ) ); ?>"></span></td> |
|
762 | - <td><?php echo esc_html( $parent_theme->Name ); ?></td> |
|
760 | + <td data-export-label="Parent Theme Name"><?php _e('Parent Theme Name', 'give'); ?>:</td> |
|
761 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('The name of the parent theme.', 'give')); ?>"></span></td> |
|
762 | + <td><?php echo esc_html($parent_theme->Name); ?></td> |
|
763 | 763 | </tr> |
764 | 764 | <tr> |
765 | - <td data-export-label="Parent Theme Version"><?php _e( 'Parent Theme Version', 'give' ); ?>:</td> |
|
766 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'The installed version of the parent theme.', 'give' ) ); ?>"></span></td> |
|
767 | - <td><?php echo esc_html( $parent_theme->Version ); ?></td> |
|
765 | + <td data-export-label="Parent Theme Version"><?php _e('Parent Theme Version', 'give'); ?>:</td> |
|
766 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('The installed version of the parent theme.', 'give')); ?>"></span></td> |
|
767 | + <td><?php echo esc_html($parent_theme->Version); ?></td> |
|
768 | 768 | </tr> |
769 | 769 | <tr> |
770 | - <td data-export-label="Parent Theme Author URL"><?php _e( 'Parent Theme Author URL', 'give' ); ?>:</td> |
|
771 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'The parent theme developers URL.', 'give' ) ); ?>"></span></td> |
|
770 | + <td data-export-label="Parent Theme Author URL"><?php _e('Parent Theme Author URL', 'give'); ?>:</td> |
|
771 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('The parent theme developers URL.', 'give')); ?>"></span></td> |
|
772 | 772 | <td><?php echo $parent_theme->{'Author URI'}; ?></td> |
773 | 773 | </tr> |
774 | 774 | <?php } ?> |
@@ -10,13 +10,13 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
17 | 17 | // Load WP_List_Table if not loaded |
18 | -if ( ! class_exists( 'WP_List_Table' ) ) { |
|
19 | - require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php'; |
|
18 | +if ( ! class_exists('WP_List_Table')) { |
|
19 | + require_once ABSPATH.'wp-admin/includes/class-wp-list-table.php'; |
|
20 | 20 | } |
21 | 21 | |
22 | 22 | /** |
@@ -50,13 +50,13 @@ discard block |
||
50 | 50 | global $status, $page; |
51 | 51 | |
52 | 52 | // Set parent defaults |
53 | - parent::__construct( array( |
|
54 | - 'singular' => give_get_forms_label_singular(), // Singular name of the listed records |
|
55 | - 'plural' => give_get_forms_label_plural(), // Plural name of the listed records |
|
53 | + parent::__construct(array( |
|
54 | + 'singular' => give_get_forms_label_singular(), // Singular name of the listed records |
|
55 | + 'plural' => give_get_forms_label_plural(), // Plural name of the listed records |
|
56 | 56 | 'ajax' => false // Does this table support ajax? |
57 | - ) ); |
|
57 | + )); |
|
58 | 58 | |
59 | - add_action( 'give_report_view_actions', array( $this, 'category_filter' ) ); |
|
59 | + add_action('give_report_view_actions', array($this, 'category_filter')); |
|
60 | 60 | $this->query(); |
61 | 61 | |
62 | 62 | } |
@@ -72,18 +72,18 @@ discard block |
||
72 | 72 | * |
73 | 73 | * @return string Column Name |
74 | 74 | */ |
75 | - public function column_default( $item, $column_name ) { |
|
76 | - switch ( $column_name ) { |
|
75 | + public function column_default($item, $column_name) { |
|
76 | + switch ($column_name) { |
|
77 | 77 | case 'earnings' : |
78 | - return give_currency_filter( give_format_amount( $item[ $column_name ] ) ); |
|
78 | + return give_currency_filter(give_format_amount($item[$column_name])); |
|
79 | 79 | case 'average_sales' : |
80 | - return round( $item[ $column_name ] ); |
|
80 | + return round($item[$column_name]); |
|
81 | 81 | case 'average_earnings' : |
82 | - return give_currency_filter( give_format_amount( $item[ $column_name ] ) ); |
|
82 | + return give_currency_filter(give_format_amount($item[$column_name])); |
|
83 | 83 | case 'details' : |
84 | - return '<a href="' . admin_url( 'edit.php?post_type=give_forms&page=give-reports&tab=forms&form-id=' . $item['ID'] ) . '">' . esc_html__( 'View Detailed Report', 'give' ) . '</a>'; |
|
84 | + return '<a href="'.admin_url('edit.php?post_type=give_forms&page=give-reports&tab=forms&form-id='.$item['ID']).'">'.esc_html__('View Detailed Report', 'give').'</a>'; |
|
85 | 85 | default: |
86 | - return $item[ $column_name ]; |
|
86 | + return $item[$column_name]; |
|
87 | 87 | } |
88 | 88 | } |
89 | 89 | |
@@ -96,12 +96,12 @@ discard block |
||
96 | 96 | */ |
97 | 97 | public function get_columns() { |
98 | 98 | $columns = array( |
99 | - 'title' => esc_html__( 'Form', 'give' ), |
|
100 | - 'sales' => esc_html__( 'Donations', 'give' ), |
|
101 | - 'earnings' => esc_html__( 'Income', 'give' ), |
|
102 | - 'average_sales' => esc_html__( 'Monthly Average Donations', 'give' ), |
|
103 | - 'average_earnings' => esc_html__( 'Monthly Average Income', 'give' ), |
|
104 | - 'details' => esc_html__( 'Detailed Report', 'give' ) |
|
99 | + 'title' => esc_html__('Form', 'give'), |
|
100 | + 'sales' => esc_html__('Donations', 'give'), |
|
101 | + 'earnings' => esc_html__('Income', 'give'), |
|
102 | + 'average_sales' => esc_html__('Monthly Average Donations', 'give'), |
|
103 | + 'average_earnings' => esc_html__('Monthly Average Income', 'give'), |
|
104 | + 'details' => esc_html__('Detailed Report', 'give') |
|
105 | 105 | ); |
106 | 106 | |
107 | 107 | return $columns; |
@@ -116,9 +116,9 @@ discard block |
||
116 | 116 | */ |
117 | 117 | public function get_sortable_columns() { |
118 | 118 | return array( |
119 | - 'title' => array( 'title', true ), |
|
120 | - 'sales' => array( 'sales', false ), |
|
121 | - 'earnings' => array( 'earnings', false ), |
|
119 | + 'title' => array('title', true), |
|
120 | + 'sales' => array('sales', false), |
|
121 | + 'earnings' => array('earnings', false), |
|
122 | 122 | ); |
123 | 123 | } |
124 | 124 | |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | * @return int Current page number |
131 | 131 | */ |
132 | 132 | public function get_paged() { |
133 | - return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1; |
|
133 | + return isset($_GET['paged']) ? absint($_GET['paged']) : 1; |
|
134 | 134 | } |
135 | 135 | |
136 | 136 | |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | * @return int Category ID |
143 | 143 | */ |
144 | 144 | public function get_category() { |
145 | - return isset( $_GET['category'] ) ? absint( $_GET['category'] ) : 0; |
|
145 | + return isset($_GET['category']) ? absint($_GET['category']) : 0; |
|
146 | 146 | } |
147 | 147 | |
148 | 148 | |
@@ -155,8 +155,8 @@ discard block |
||
155 | 155 | */ |
156 | 156 | public function get_total_forms() { |
157 | 157 | $total = 0; |
158 | - $counts = wp_count_posts( 'give_forms', 'readable' ); |
|
159 | - foreach ( $counts as $status => $count ) { |
|
158 | + $counts = wp_count_posts('give_forms', 'readable'); |
|
159 | + foreach ($counts as $status => $count) { |
|
160 | 160 | $total += $count; |
161 | 161 | } |
162 | 162 | |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | * @since 1.0 |
171 | 171 | * @return void |
172 | 172 | */ |
173 | - public function bulk_actions( $which = '' ) { |
|
173 | + public function bulk_actions($which = '') { |
|
174 | 174 | |
175 | 175 | } |
176 | 176 | |
@@ -182,27 +182,27 @@ discard block |
||
182 | 182 | * |
183 | 183 | * @param string $which |
184 | 184 | */ |
185 | - protected function display_tablenav( $which ) { |
|
185 | + protected function display_tablenav($which) { |
|
186 | 186 | |
187 | - if ( 'top' === $which ) { |
|
188 | - wp_nonce_field( 'bulk-' . $this->_args['plural'] ); |
|
187 | + if ('top' === $which) { |
|
188 | + wp_nonce_field('bulk-'.$this->_args['plural']); |
|
189 | 189 | } |
190 | 190 | ?> |
191 | - <div class="tablenav give-clearfix <?php echo esc_attr( $which ); ?>"> |
|
191 | + <div class="tablenav give-clearfix <?php echo esc_attr($which); ?>"> |
|
192 | 192 | |
193 | - <?php if ( 'top' === $which ) { ?> |
|
193 | + <?php if ('top' === $which) { ?> |
|
194 | 194 | <h3 class="alignleft reports-earnings-title"> |
195 | - <span><?php esc_html_e( 'Donation Forms Report', 'give' ); ?></span> |
|
195 | + <span><?php esc_html_e('Donation Forms Report', 'give'); ?></span> |
|
196 | 196 | </h3> |
197 | 197 | <?php } ?> |
198 | 198 | |
199 | 199 | <div class="alignright tablenav-right"> |
200 | 200 | <div class="actions bulkactions"> |
201 | - <?php $this->bulk_actions( $which ); ?> |
|
201 | + <?php $this->bulk_actions($which); ?> |
|
202 | 202 | </div> |
203 | 203 | <?php |
204 | - $this->extra_tablenav( $which ); |
|
205 | - $this->pagination( $which ); |
|
204 | + $this->extra_tablenav($which); |
|
205 | + $this->pagination($which); |
|
206 | 206 | ?> |
207 | 207 | </div> |
208 | 208 | |
@@ -222,9 +222,9 @@ discard block |
||
222 | 222 | */ |
223 | 223 | public function category_filter() { |
224 | 224 | |
225 | - $categories = get_terms( 'form_category' ); |
|
226 | - if ( $categories && ! is_wp_error( $categories ) ) { |
|
227 | - echo Give()->html->category_dropdown( 'category', $this->get_category() ); |
|
225 | + $categories = get_terms('form_category'); |
|
226 | + if ($categories && ! is_wp_error($categories)) { |
|
227 | + echo Give()->html->category_dropdown('category', $this->get_category()); |
|
228 | 228 | } |
229 | 229 | } |
230 | 230 | |
@@ -238,8 +238,8 @@ discard block |
||
238 | 238 | */ |
239 | 239 | public function query() { |
240 | 240 | |
241 | - $orderby = isset( $_GET['orderby'] ) ? $_GET['orderby'] : 'title'; |
|
242 | - $order = isset( $_GET['order'] ) ? $_GET['order'] : 'DESC'; |
|
241 | + $orderby = isset($_GET['orderby']) ? $_GET['orderby'] : 'title'; |
|
242 | + $order = isset($_GET['order']) ? $_GET['order'] : 'DESC'; |
|
243 | 243 | $category = $this->get_category(); |
244 | 244 | |
245 | 245 | $args = array( |
@@ -252,7 +252,7 @@ discard block |
||
252 | 252 | 'suppress_filters' => true |
253 | 253 | ); |
254 | 254 | |
255 | - if ( ! empty( $category ) ) { |
|
255 | + if ( ! empty($category)) { |
|
256 | 256 | $args['tax_query'] = array( |
257 | 257 | array( |
258 | 258 | 'taxonomy' => 'form_category', |
@@ -261,7 +261,7 @@ discard block |
||
261 | 261 | ); |
262 | 262 | } |
263 | 263 | |
264 | - switch ( $orderby ) : |
|
264 | + switch ($orderby) : |
|
265 | 265 | case 'title' : |
266 | 266 | $args['orderby'] = 'title'; |
267 | 267 | break; |
@@ -277,9 +277,9 @@ discard block |
||
277 | 277 | break; |
278 | 278 | endswitch; |
279 | 279 | |
280 | - $args = apply_filters( 'give_form_reports_prepare_items_args', $args, $this ); |
|
280 | + $args = apply_filters('give_form_reports_prepare_items_args', $args, $this); |
|
281 | 281 | |
282 | - $this->products = new WP_Query( $args ); |
|
282 | + $this->products = new WP_Query($args); |
|
283 | 283 | |
284 | 284 | } |
285 | 285 | |
@@ -295,15 +295,15 @@ discard block |
||
295 | 295 | |
296 | 296 | $give_forms = $this->products->posts; |
297 | 297 | |
298 | - if ( $give_forms ) { |
|
299 | - foreach ( $give_forms as $form ) { |
|
298 | + if ($give_forms) { |
|
299 | + foreach ($give_forms as $form) { |
|
300 | 300 | $reports_data[] = array( |
301 | 301 | 'ID' => $form, |
302 | - 'title' => get_the_title( $form ), |
|
303 | - 'sales' => give_get_form_sales_stats( $form ), |
|
304 | - 'earnings' => give_get_form_earnings_stats( $form ), |
|
305 | - 'average_sales' => give_get_average_monthly_form_sales( $form ), |
|
306 | - 'average_earnings' => give_get_average_monthly_form_earnings( $form ) |
|
302 | + 'title' => get_the_title($form), |
|
303 | + 'sales' => give_get_form_sales_stats($form), |
|
304 | + 'earnings' => give_get_form_earnings_stats($form), |
|
305 | + 'average_sales' => give_get_average_monthly_form_sales($form), |
|
306 | + 'average_earnings' => give_get_average_monthly_form_earnings($form) |
|
307 | 307 | ); |
308 | 308 | } |
309 | 309 | } |
@@ -331,7 +331,7 @@ discard block |
||
331 | 331 | |
332 | 332 | $sortable = $this->get_sortable_columns(); |
333 | 333 | |
334 | - $this->_column_headers = array( $columns, $hidden, $sortable ); |
|
334 | + $this->_column_headers = array($columns, $hidden, $sortable); |
|
335 | 335 | |
336 | 336 | $data = $this->reports_data(); |
337 | 337 | |
@@ -339,10 +339,10 @@ discard block |
||
339 | 339 | |
340 | 340 | $this->items = $data; |
341 | 341 | |
342 | - $this->set_pagination_args( array( |
|
342 | + $this->set_pagination_args(array( |
|
343 | 343 | 'total_items' => $total_items, |
344 | 344 | 'per_page' => $this->per_page, |
345 | - 'total_pages' => ceil( $total_items / $this->per_page ) |
|
345 | + 'total_pages' => ceil($total_items / $this->per_page) |
|
346 | 346 | ) |
347 | 347 | ); |
348 | 348 | } |
@@ -814,12 +814,12 @@ |
||
814 | 814 | ) ), 'give-refresh-reports' ); |
815 | 815 | |
816 | 816 | echo '<a href="' |
817 | - . esc_url_raw( $url ) |
|
818 | - . '" data-tooltip="'. esc_attr__( 'Clicking this will clear the reports cache.', 'give' ) |
|
819 | - . '" data-tooltip-my-position="right center" data-tooltip-target-position="left center" class="button alignright give-admin-button give-tooltip">' |
|
820 | - . '<span class="give-admin-button-icon give-admin-button-icon-update"></span>' |
|
821 | - . esc_html__( 'Refresh Report Data', 'give' ) |
|
822 | - . '</a>'; |
|
817 | + . esc_url_raw( $url ) |
|
818 | + . '" data-tooltip="'. esc_attr__( 'Clicking this will clear the reports cache.', 'give' ) |
|
819 | + . '" data-tooltip-my-position="right center" data-tooltip-target-position="left center" class="button alignright give-admin-button give-tooltip">' |
|
820 | + . '<span class="give-admin-button-icon give-admin-button-icon-update"></span>' |
|
821 | + . esc_html__( 'Refresh Report Data', 'give' ) |
|
822 | + . '</a>'; |
|
823 | 823 | |
824 | 824 | } |
825 | 825 |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | $dates = give_get_report_dates(); |
26 | 26 | |
27 | 27 | // Determine graph options |
28 | - switch ( $dates['range'] ) : |
|
28 | + switch ($dates['range']) : |
|
29 | 29 | case 'today' : |
30 | 30 | case 'yesterday' : |
31 | 31 | $day_by_day = true; |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | $day_by_day = false; |
38 | 38 | break; |
39 | 39 | case 'other' : |
40 | - if ( $dates['m_end'] - $dates['m_start'] >= 2 || $dates['year_end'] > $dates['year'] && ( $dates['m_start'] != '12' && $dates['m_end'] != '1' ) ) { |
|
40 | + if ($dates['m_end'] - $dates['m_start'] >= 2 || $dates['year_end'] > $dates['year'] && ($dates['m_start'] != '12' && $dates['m_end'] != '1')) { |
|
41 | 41 | $day_by_day = false; |
42 | 42 | } else { |
43 | 43 | $day_by_day = true; |
@@ -49,61 +49,61 @@ discard block |
||
49 | 49 | endswitch; |
50 | 50 | |
51 | 51 | $earnings_totals = 0.00; // Total earnings for time period shown |
52 | - $sales_totals = 0; // Total sales for time period shown |
|
52 | + $sales_totals = 0; // Total sales for time period shown |
|
53 | 53 | |
54 | 54 | $earnings_data = array(); |
55 | 55 | $sales_data = array(); |
56 | 56 | |
57 | - if ( $dates['range'] == 'today' || $dates['range'] == 'yesterday' ) { |
|
57 | + if ($dates['range'] == 'today' || $dates['range'] == 'yesterday') { |
|
58 | 58 | // Hour by hour |
59 | 59 | $hour = 1; |
60 | - $month = date( 'n', current_time( 'timestamp' ) ); |
|
61 | - while ( $hour <= 23 ) : |
|
60 | + $month = date('n', current_time('timestamp')); |
|
61 | + while ($hour <= 23) : |
|
62 | 62 | |
63 | - $sales = give_get_sales_by_date( $dates['day'], $month, $dates['year'], $hour ); |
|
64 | - $earnings = give_get_earnings_by_date( $dates['day'], $month, $dates['year'], $hour ); |
|
63 | + $sales = give_get_sales_by_date($dates['day'], $month, $dates['year'], $hour); |
|
64 | + $earnings = give_get_earnings_by_date($dates['day'], $month, $dates['year'], $hour); |
|
65 | 65 | |
66 | 66 | $sales_totals += $sales; |
67 | 67 | $earnings_totals += $earnings; |
68 | 68 | |
69 | - $date = mktime( $hour, 0, 0, $month, $dates['day'], $dates['year'] ) * 1000; |
|
70 | - $sales_data[] = array( $date, $sales ); |
|
71 | - $earnings_data[] = array( $date, $earnings ); |
|
69 | + $date = mktime($hour, 0, 0, $month, $dates['day'], $dates['year']) * 1000; |
|
70 | + $sales_data[] = array($date, $sales); |
|
71 | + $earnings_data[] = array($date, $earnings); |
|
72 | 72 | |
73 | - $hour ++; |
|
73 | + $hour++; |
|
74 | 74 | endwhile; |
75 | 75 | |
76 | - } elseif ( $dates['range'] == 'this_week' || $dates['range'] == 'last_week' ) { |
|
76 | + } elseif ($dates['range'] == 'this_week' || $dates['range'] == 'last_week') { |
|
77 | 77 | |
78 | 78 | // Day by day |
79 | 79 | $day = $dates['day']; |
80 | 80 | $day_end = $dates['day_end']; |
81 | 81 | $month = $dates['m_start']; |
82 | - while ( $day <= $day_end ) : |
|
83 | - $sales = give_get_sales_by_date( $day, $month, $dates['year'] ); |
|
82 | + while ($day <= $day_end) : |
|
83 | + $sales = give_get_sales_by_date($day, $month, $dates['year']); |
|
84 | 84 | $sales_totals += $sales; |
85 | 85 | |
86 | - $earnings = give_get_earnings_by_date( $day, $month, $dates['year'] ); |
|
86 | + $earnings = give_get_earnings_by_date($day, $month, $dates['year']); |
|
87 | 87 | $earnings_totals += $earnings; |
88 | 88 | |
89 | - $date = mktime( 0, 0, 0, $month, $day, $dates['year'] ) * 1000; |
|
90 | - $sales_data[] = array( $date, $sales ); |
|
91 | - $earnings_data[] = array( $date, $earnings ); |
|
92 | - $day ++; |
|
89 | + $date = mktime(0, 0, 0, $month, $day, $dates['year']) * 1000; |
|
90 | + $sales_data[] = array($date, $sales); |
|
91 | + $earnings_data[] = array($date, $earnings); |
|
92 | + $day++; |
|
93 | 93 | endwhile; |
94 | 94 | |
95 | 95 | } else { |
96 | 96 | |
97 | 97 | $y = $dates['year']; |
98 | - while ( $y <= $dates['year_end'] ) : |
|
98 | + while ($y <= $dates['year_end']) : |
|
99 | 99 | |
100 | - if ( $dates['year'] == $dates['year_end'] ) { |
|
100 | + if ($dates['year'] == $dates['year_end']) { |
|
101 | 101 | $month_start = $dates['m_start']; |
102 | 102 | $month_end = $dates['m_end']; |
103 | - } elseif ( $y == $dates['year'] ) { |
|
103 | + } elseif ($y == $dates['year']) { |
|
104 | 104 | $month_start = $dates['m_start']; |
105 | 105 | $month_end = 12; |
106 | - } elseif ( $y == $dates['year_end'] ) { |
|
106 | + } elseif ($y == $dates['year_end']) { |
|
107 | 107 | $month_start = 1; |
108 | 108 | $month_end = $dates['m_end']; |
109 | 109 | } else { |
@@ -112,48 +112,48 @@ discard block |
||
112 | 112 | } |
113 | 113 | |
114 | 114 | $i = $month_start; |
115 | - while ( $i <= $month_end ) : |
|
115 | + while ($i <= $month_end) : |
|
116 | 116 | |
117 | - if ( $day_by_day ) { |
|
117 | + if ($day_by_day) { |
|
118 | 118 | |
119 | - if ( $i == $month_end ) { |
|
119 | + if ($i == $month_end) { |
|
120 | 120 | |
121 | 121 | $num_of_days = $dates['day_end']; |
122 | 122 | |
123 | 123 | } else { |
124 | 124 | |
125 | - $num_of_days = cal_days_in_month( CAL_GREGORIAN, $i, $y ); |
|
125 | + $num_of_days = cal_days_in_month(CAL_GREGORIAN, $i, $y); |
|
126 | 126 | |
127 | 127 | } |
128 | 128 | |
129 | 129 | $d = $dates['day']; |
130 | 130 | |
131 | - while ( $d <= $num_of_days ) : |
|
131 | + while ($d <= $num_of_days) : |
|
132 | 132 | |
133 | - $sales = give_get_sales_by_date( $d, $i, $y ); |
|
133 | + $sales = give_get_sales_by_date($d, $i, $y); |
|
134 | 134 | $sales_totals += $sales; |
135 | 135 | |
136 | - $earnings = give_get_earnings_by_date( $d, $i, $y ); |
|
136 | + $earnings = give_get_earnings_by_date($d, $i, $y); |
|
137 | 137 | $earnings_totals += $earnings; |
138 | 138 | |
139 | - $date = mktime( 0, 0, 0, $i, $d, $y ) * 1000; |
|
140 | - $sales_data[] = array( $date, $sales ); |
|
141 | - $earnings_data[] = array( $date, $earnings ); |
|
142 | - $d ++; |
|
139 | + $date = mktime(0, 0, 0, $i, $d, $y) * 1000; |
|
140 | + $sales_data[] = array($date, $sales); |
|
141 | + $earnings_data[] = array($date, $earnings); |
|
142 | + $d++; |
|
143 | 143 | |
144 | 144 | endwhile; |
145 | 145 | |
146 | 146 | } else { |
147 | 147 | |
148 | - $sales = give_get_sales_by_date( null, $i, $y ); |
|
148 | + $sales = give_get_sales_by_date(null, $i, $y); |
|
149 | 149 | $sales_totals += $sales; |
150 | 150 | |
151 | - $earnings = give_get_earnings_by_date( null, $i, $y ); |
|
151 | + $earnings = give_get_earnings_by_date(null, $i, $y); |
|
152 | 152 | $earnings_totals += $earnings; |
153 | 153 | |
154 | - if ( $i == $month_end ) { |
|
154 | + if ($i == $month_end) { |
|
155 | 155 | |
156 | - $num_of_days = cal_days_in_month( CAL_GREGORIAN, $i, $y ); |
|
156 | + $num_of_days = cal_days_in_month(CAL_GREGORIAN, $i, $y); |
|
157 | 157 | |
158 | 158 | } else { |
159 | 159 | |
@@ -161,24 +161,24 @@ discard block |
||
161 | 161 | |
162 | 162 | } |
163 | 163 | |
164 | - $date = mktime( 0, 0, 0, $i, $num_of_days, $y ) * 1000; |
|
165 | - $sales_data[] = array( $date, $sales ); |
|
166 | - $earnings_data[] = array( $date, $earnings ); |
|
164 | + $date = mktime(0, 0, 0, $i, $num_of_days, $y) * 1000; |
|
165 | + $sales_data[] = array($date, $sales); |
|
166 | + $earnings_data[] = array($date, $earnings); |
|
167 | 167 | |
168 | 168 | } |
169 | 169 | |
170 | - $i ++; |
|
170 | + $i++; |
|
171 | 171 | |
172 | 172 | endwhile; |
173 | 173 | |
174 | - $y ++; |
|
174 | + $y++; |
|
175 | 175 | endwhile; |
176 | 176 | |
177 | 177 | } |
178 | 178 | |
179 | 179 | $data = array( |
180 | - esc_html__( 'Income', 'give' ) => $earnings_data, |
|
181 | - esc_html__( 'Donations', 'give' ) => $sales_data |
|
180 | + esc_html__('Income', 'give') => $earnings_data, |
|
181 | + esc_html__('Donations', 'give') => $sales_data |
|
182 | 182 | ); |
183 | 183 | |
184 | 184 | // start our own output buffer |
@@ -191,12 +191,12 @@ discard block |
||
191 | 191 | <div class="inside"> |
192 | 192 | <?php give_reports_graph_controls(); ?> |
193 | 193 | <?php |
194 | - $graph = new Give_Graph( $data ); |
|
195 | - $graph->set( 'x_mode', 'time' ); |
|
196 | - $graph->set( 'multiple_y_axes', true ); |
|
194 | + $graph = new Give_Graph($data); |
|
195 | + $graph->set('x_mode', 'time'); |
|
196 | + $graph->set('multiple_y_axes', true); |
|
197 | 197 | $graph->display(); |
198 | 198 | |
199 | - if ( 'this_month' == $dates['range'] ) { |
|
199 | + if ('this_month' == $dates['range']) { |
|
200 | 200 | $estimated = give_estimated_monthly_stats(); |
201 | 201 | } |
202 | 202 | ?> |
@@ -205,21 +205,21 @@ discard block |
||
205 | 205 | <table class="widefat reports-table alignleft" style="max-width:450px"> |
206 | 206 | <tbody> |
207 | 207 | <tr> |
208 | - <th scope="row"><strong><?php esc_html_e( 'Total income for period:', 'give' ); ?></strong></th> |
|
209 | - <td><?php echo give_currency_filter( give_format_amount( $earnings_totals ) ); ?></td> |
|
208 | + <th scope="row"><strong><?php esc_html_e('Total income for period:', 'give'); ?></strong></th> |
|
209 | + <td><?php echo give_currency_filter(give_format_amount($earnings_totals)); ?></td> |
|
210 | 210 | </tr> |
211 | 211 | <tr class="alternate"> |
212 | - <th scope="row"><strong><?php esc_html_e( 'Total donations for period:', 'give' ); ?><strong></th> |
|
212 | + <th scope="row"><strong><?php esc_html_e('Total donations for period:', 'give'); ?><strong></th> |
|
213 | 213 | <td><?php echo $sales_totals; ?></td> |
214 | 214 | </tr> |
215 | - <?php if ( 'this_month' == $dates['range'] ) : ?> |
|
215 | + <?php if ('this_month' == $dates['range']) : ?> |
|
216 | 216 | <tr> |
217 | - <th scope="row"><strong><?php esc_html_e( 'Estimated monthly income:', 'give' ); ?></strong></th> |
|
218 | - <td><?php echo give_currency_filter( give_format_amount( $estimated['earnings'] ) ); ?></td> |
|
217 | + <th scope="row"><strong><?php esc_html_e('Estimated monthly income:', 'give'); ?></strong></th> |
|
218 | + <td><?php echo give_currency_filter(give_format_amount($estimated['earnings'])); ?></td> |
|
219 | 219 | </tr> |
220 | 220 | <tr class="alternate"> |
221 | - <th scope="row"><strong><?php esc_html_e( 'Estimated monthly donations:', 'give' ); ?></strong></th> |
|
222 | - <td><?php echo floor( $estimated['sales'] ); ?></td> |
|
221 | + <th scope="row"><strong><?php esc_html_e('Estimated monthly donations:', 'give'); ?></strong></th> |
|
222 | + <td><?php echo floor($estimated['sales']); ?></td> |
|
223 | 223 | </tr> |
224 | 224 | <?php endif; ?> |
225 | 225 | </table> |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | * |
233 | 233 | * @since 1.0 |
234 | 234 | */ |
235 | - do_action( 'give_reports_graph_additional_stats' ); |
|
235 | + do_action('give_reports_graph_additional_stats'); |
|
236 | 236 | ?> |
237 | 237 | |
238 | 238 | </div> |
@@ -251,12 +251,12 @@ discard block |
||
251 | 251 | * @since 1.0 |
252 | 252 | * @return void |
253 | 253 | */ |
254 | -function give_reports_graph_of_form( $form_id = 0 ) { |
|
254 | +function give_reports_graph_of_form($form_id = 0) { |
|
255 | 255 | // Retrieve the queried dates |
256 | 256 | $dates = give_get_report_dates(); |
257 | 257 | |
258 | 258 | // Determine graph options |
259 | - switch ( $dates['range'] ) : |
|
259 | + switch ($dates['range']) : |
|
260 | 260 | case 'today' : |
261 | 261 | case 'yesterday' : |
262 | 262 | $day_by_day = true; |
@@ -274,7 +274,7 @@ discard block |
||
274 | 274 | $day_by_day = false; |
275 | 275 | break; |
276 | 276 | case 'other' : |
277 | - if ( $dates['m_end'] - $dates['m_start'] >= 2 || $dates['year_end'] > $dates['year'] ) { |
|
277 | + if ($dates['m_end'] - $dates['m_start'] >= 2 || $dates['year_end'] > $dates['year']) { |
|
278 | 278 | $day_by_day = false; |
279 | 279 | } else { |
280 | 280 | $day_by_day = true; |
@@ -286,75 +286,75 @@ discard block |
||
286 | 286 | endswitch; |
287 | 287 | |
288 | 288 | $earnings_totals = (float) 0.00; // Total earnings for time period shown |
289 | - $sales_totals = 0; // Total sales for time period shown |
|
289 | + $sales_totals = 0; // Total sales for time period shown |
|
290 | 290 | |
291 | 291 | $earnings_data = array(); |
292 | 292 | $sales_data = array(); |
293 | 293 | $stats = new Give_Payment_Stats; |
294 | 294 | |
295 | - if ( $dates['range'] == 'today' || $dates['range'] == 'yesterday' ) { |
|
295 | + if ($dates['range'] == 'today' || $dates['range'] == 'yesterday') { |
|
296 | 296 | |
297 | 297 | // Hour by hour |
298 | 298 | $month = $dates['m_start']; |
299 | 299 | $hour = 1; |
300 | 300 | $minute = 0; |
301 | 301 | $second = 0; |
302 | - while ( $hour <= 23 ) : |
|
302 | + while ($hour <= 23) : |
|
303 | 303 | |
304 | - if ( $hour == 23 ) { |
|
304 | + if ($hour == 23) { |
|
305 | 305 | $minute = $second = 59; |
306 | 306 | } |
307 | 307 | |
308 | - $date = mktime( $hour, $minute, $second, $month, $dates['day'], $dates['year'] ); |
|
309 | - $date_end = mktime( $hour + 1, $minute, $second, $month, $dates['day'], $dates['year'] ); |
|
308 | + $date = mktime($hour, $minute, $second, $month, $dates['day'], $dates['year']); |
|
309 | + $date_end = mktime($hour + 1, $minute, $second, $month, $dates['day'], $dates['year']); |
|
310 | 310 | |
311 | - $sales = $stats->get_sales( $form_id, $date, $date_end ); |
|
311 | + $sales = $stats->get_sales($form_id, $date, $date_end); |
|
312 | 312 | $sales_totals += $sales; |
313 | 313 | |
314 | - $earnings = $stats->get_earnings( $form_id, $date, $date_end ); |
|
314 | + $earnings = $stats->get_earnings($form_id, $date, $date_end); |
|
315 | 315 | $earnings_totals += $earnings; |
316 | 316 | |
317 | - $sales_data[] = array( $date * 1000, $sales ); |
|
318 | - $earnings_data[] = array( $date * 1000, $earnings ); |
|
317 | + $sales_data[] = array($date * 1000, $sales); |
|
318 | + $earnings_data[] = array($date * 1000, $earnings); |
|
319 | 319 | |
320 | - $hour ++; |
|
320 | + $hour++; |
|
321 | 321 | endwhile; |
322 | 322 | |
323 | - } elseif ( $dates['range'] == 'this_week' || $dates['range'] == 'last_week' ) { |
|
323 | + } elseif ($dates['range'] == 'this_week' || $dates['range'] == 'last_week') { |
|
324 | 324 | |
325 | 325 | //Day by day |
326 | 326 | $day = $dates['day']; |
327 | 327 | $day_end = $dates['day_end']; |
328 | 328 | $month = $dates['m_start']; |
329 | - while ( $day <= $day_end ) : |
|
329 | + while ($day <= $day_end) : |
|
330 | 330 | |
331 | - $date = mktime( 0, 0, 0, $month, $day, $dates['year'] ); |
|
332 | - $date_end = mktime( 0, 0, 0, $month, $day + 1, $dates['year'] ); |
|
333 | - $sales = $stats->get_sales( $form_id, $date, $date_end ); |
|
331 | + $date = mktime(0, 0, 0, $month, $day, $dates['year']); |
|
332 | + $date_end = mktime(0, 0, 0, $month, $day + 1, $dates['year']); |
|
333 | + $sales = $stats->get_sales($form_id, $date, $date_end); |
|
334 | 334 | $sales_totals += $sales; |
335 | 335 | |
336 | - $earnings = $stats->get_earnings( $form_id, $date, $date_end ); |
|
336 | + $earnings = $stats->get_earnings($form_id, $date, $date_end); |
|
337 | 337 | $earnings_totals += $earnings; |
338 | 338 | |
339 | - $sales_data[] = array( $date * 1000, $sales ); |
|
340 | - $earnings_data[] = array( $date * 1000, $earnings ); |
|
339 | + $sales_data[] = array($date * 1000, $sales); |
|
340 | + $earnings_data[] = array($date * 1000, $earnings); |
|
341 | 341 | |
342 | - $day ++; |
|
342 | + $day++; |
|
343 | 343 | endwhile; |
344 | 344 | |
345 | 345 | } else { |
346 | 346 | |
347 | 347 | $y = $dates['year']; |
348 | 348 | |
349 | - while ( $y <= $dates['year_end'] ) : |
|
349 | + while ($y <= $dates['year_end']) : |
|
350 | 350 | |
351 | 351 | $last_year = false; |
352 | 352 | |
353 | - if ( $dates['year'] == $dates['year_end'] ) { |
|
353 | + if ($dates['year'] == $dates['year_end']) { |
|
354 | 354 | $month_start = $dates['m_start']; |
355 | 355 | $month_end = $dates['m_end']; |
356 | 356 | $last_year = true; |
357 | - } elseif ( $y == $dates['year'] ) { |
|
357 | + } elseif ($y == $dates['year']) { |
|
358 | 358 | $month_start = $dates['m_start']; |
359 | 359 | $month_end = 12; |
360 | 360 | } else { |
@@ -363,76 +363,76 @@ discard block |
||
363 | 363 | } |
364 | 364 | |
365 | 365 | $i = $month_start; |
366 | - while ( $i <= $month_end ) : |
|
366 | + while ($i <= $month_end) : |
|
367 | 367 | |
368 | - if ( $day_by_day ) { |
|
368 | + if ($day_by_day) { |
|
369 | 369 | |
370 | - if ( $i == $month_end && $last_year ) { |
|
370 | + if ($i == $month_end && $last_year) { |
|
371 | 371 | |
372 | 372 | $num_of_days = $dates['day_end']; |
373 | 373 | |
374 | 374 | } else { |
375 | 375 | |
376 | - $num_of_days = cal_days_in_month( CAL_GREGORIAN, $i, $y ); |
|
376 | + $num_of_days = cal_days_in_month(CAL_GREGORIAN, $i, $y); |
|
377 | 377 | |
378 | 378 | } |
379 | 379 | |
380 | 380 | $d = $dates['day']; |
381 | - while ( $d <= $num_of_days ) : |
|
381 | + while ($d <= $num_of_days) : |
|
382 | 382 | |
383 | - $date = mktime( 0, 0, 0, $i, $d, $y ); |
|
384 | - $end_date = mktime( 23, 59, 59, $i, $d, $y ); |
|
383 | + $date = mktime(0, 0, 0, $i, $d, $y); |
|
384 | + $end_date = mktime(23, 59, 59, $i, $d, $y); |
|
385 | 385 | |
386 | - $sales = $stats->get_sales( $form_id, $date, $end_date ); |
|
386 | + $sales = $stats->get_sales($form_id, $date, $end_date); |
|
387 | 387 | $sales_totals += $sales; |
388 | 388 | |
389 | - $earnings = $stats->get_earnings( $form_id, $date, $end_date ); |
|
389 | + $earnings = $stats->get_earnings($form_id, $date, $end_date); |
|
390 | 390 | $earnings_totals += $earnings; |
391 | 391 | |
392 | - $sales_data[] = array( $date * 1000, $sales ); |
|
393 | - $earnings_data[] = array( $date * 1000, $earnings ); |
|
394 | - $d ++; |
|
392 | + $sales_data[] = array($date * 1000, $sales); |
|
393 | + $earnings_data[] = array($date * 1000, $earnings); |
|
394 | + $d++; |
|
395 | 395 | |
396 | 396 | endwhile; |
397 | 397 | |
398 | 398 | } else { |
399 | 399 | |
400 | - $num_of_days = cal_days_in_month( CAL_GREGORIAN, $i, $y ); |
|
400 | + $num_of_days = cal_days_in_month(CAL_GREGORIAN, $i, $y); |
|
401 | 401 | |
402 | - $date = mktime( 0, 0, 0, $i, 1, $y ); |
|
403 | - $end_date = mktime( 23, 59, 59, $i, $num_of_days, $y ); |
|
402 | + $date = mktime(0, 0, 0, $i, 1, $y); |
|
403 | + $end_date = mktime(23, 59, 59, $i, $num_of_days, $y); |
|
404 | 404 | |
405 | - $sales = $stats->get_sales( $form_id, $date, $end_date ); |
|
405 | + $sales = $stats->get_sales($form_id, $date, $end_date); |
|
406 | 406 | $sales_totals += $sales; |
407 | 407 | |
408 | - $earnings = $stats->get_earnings( $form_id, $date, $end_date ); |
|
408 | + $earnings = $stats->get_earnings($form_id, $date, $end_date); |
|
409 | 409 | $earnings_totals += $earnings; |
410 | 410 | |
411 | - $sales_data[] = array( $date * 1000, $sales ); |
|
412 | - $earnings_data[] = array( $date * 1000, $earnings ); |
|
411 | + $sales_data[] = array($date * 1000, $sales); |
|
412 | + $earnings_data[] = array($date * 1000, $earnings); |
|
413 | 413 | |
414 | 414 | } |
415 | 415 | |
416 | - $i ++; |
|
416 | + $i++; |
|
417 | 417 | |
418 | 418 | endwhile; |
419 | 419 | |
420 | - $y ++; |
|
420 | + $y++; |
|
421 | 421 | endwhile; |
422 | 422 | |
423 | 423 | } |
424 | 424 | |
425 | 425 | $data = array( |
426 | - esc_html__( 'Income', 'give' ) => $earnings_data, |
|
427 | - esc_html__( 'Donations', 'give' ) => $sales_data |
|
426 | + esc_html__('Income', 'give') => $earnings_data, |
|
427 | + esc_html__('Donations', 'give') => $sales_data |
|
428 | 428 | ); |
429 | 429 | |
430 | 430 | ?> |
431 | 431 | <h3><span><?php |
432 | 432 | printf( |
433 | 433 | /* translators: %s: form title */ |
434 | - esc_html__( 'Income Report for %s', 'give' ), |
|
435 | - get_the_title( $form_id ) |
|
434 | + esc_html__('Income Report for %s', 'give'), |
|
435 | + get_the_title($form_id) |
|
436 | 436 | ); |
437 | 437 | ?></span></h3> |
438 | 438 | <div id="give-dashboard-widgets-wrap"> |
@@ -441,9 +441,9 @@ discard block |
||
441 | 441 | <div class="inside"> |
442 | 442 | <?php give_reports_graph_controls(); ?> |
443 | 443 | <?php |
444 | - $graph = new Give_Graph( $data ); |
|
445 | - $graph->set( 'x_mode', 'time' ); |
|
446 | - $graph->set( 'multiple_y_axes', true ); |
|
444 | + $graph = new Give_Graph($data); |
|
445 | + $graph->set('x_mode', 'time'); |
|
446 | + $graph->set('multiple_y_axes', true); |
|
447 | 447 | $graph->display(); |
448 | 448 | ?> |
449 | 449 | </div> |
@@ -452,20 +452,20 @@ discard block |
||
452 | 452 | <table class="widefat reports-table alignleft" style="max-width:450px"> |
453 | 453 | <tbody> |
454 | 454 | <tr> |
455 | - <th scope="row"><strong><?php esc_html_e( 'Total income for period:', 'give' ); ?></strong></th> |
|
456 | - <td><?php echo give_currency_filter( give_format_amount( $earnings_totals ) ); ?></td> |
|
455 | + <th scope="row"><strong><?php esc_html_e('Total income for period:', 'give'); ?></strong></th> |
|
456 | + <td><?php echo give_currency_filter(give_format_amount($earnings_totals)); ?></td> |
|
457 | 457 | </tr> |
458 | 458 | <tr class="alternate"> |
459 | - <th scope="row"><strong><?php esc_html_e( 'Total donations for period:', 'give' ); ?></strong></th> |
|
459 | + <th scope="row"><strong><?php esc_html_e('Total donations for period:', 'give'); ?></strong></th> |
|
460 | 460 | <td><?php echo $sales_totals; ?></td> |
461 | 461 | </tr> |
462 | 462 | <tr> |
463 | - <th scope="row"><strong><?php esc_html_e( 'Average monthly income:', 'give' ); ?></strong></th> |
|
464 | - <td><?php echo give_currency_filter( give_format_amount( give_get_average_monthly_form_earnings( $form_id ) ) ); ?></td> |
|
463 | + <th scope="row"><strong><?php esc_html_e('Average monthly income:', 'give'); ?></strong></th> |
|
464 | + <td><?php echo give_currency_filter(give_format_amount(give_get_average_monthly_form_earnings($form_id))); ?></td> |
|
465 | 465 | </tr> |
466 | 466 | <tr class="alternate"> |
467 | - <th scope="row"><strong><?php esc_html_e( 'Average monthly donations:', 'give' ); ?></strong></th> |
|
468 | - <td><?php echo number_format( give_get_average_monthly_form_sales( $form_id ), 0 ); ?></td> |
|
467 | + <th scope="row"><strong><?php esc_html_e('Average monthly donations:', 'give'); ?></strong></th> |
|
468 | + <td><?php echo number_format(give_get_average_monthly_form_sales($form_id), 0); ?></td> |
|
469 | 469 | </tr> |
470 | 470 | </tbody> |
471 | 471 | </table> |
@@ -484,26 +484,26 @@ discard block |
||
484 | 484 | * @return void |
485 | 485 | */ |
486 | 486 | function give_reports_graph_controls() { |
487 | - $date_options = apply_filters( 'give_report_date_options', array( |
|
488 | - 'today' => esc_html__( 'Today', 'give' ), |
|
489 | - 'yesterday' => esc_html__( 'Yesterday', 'give' ), |
|
490 | - 'this_week' => esc_html__( 'This Week', 'give' ), |
|
491 | - 'last_week' => esc_html__( 'Last Week', 'give' ), |
|
492 | - 'this_month' => esc_html__( 'This Month', 'give' ), |
|
493 | - 'last_month' => esc_html__( 'Last Month', 'give' ), |
|
494 | - 'this_quarter' => esc_html__( 'This Quarter', 'give' ), |
|
495 | - 'last_quarter' => esc_html__( 'Last Quarter', 'give' ), |
|
496 | - 'this_year' => esc_html__( 'This Year', 'give' ), |
|
497 | - 'last_year' => esc_html__( 'Last Year', 'give' ), |
|
498 | - 'other' => esc_html__( 'Custom', 'give' ) |
|
499 | - ) ); |
|
487 | + $date_options = apply_filters('give_report_date_options', array( |
|
488 | + 'today' => esc_html__('Today', 'give'), |
|
489 | + 'yesterday' => esc_html__('Yesterday', 'give'), |
|
490 | + 'this_week' => esc_html__('This Week', 'give'), |
|
491 | + 'last_week' => esc_html__('Last Week', 'give'), |
|
492 | + 'this_month' => esc_html__('This Month', 'give'), |
|
493 | + 'last_month' => esc_html__('Last Month', 'give'), |
|
494 | + 'this_quarter' => esc_html__('This Quarter', 'give'), |
|
495 | + 'last_quarter' => esc_html__('Last Quarter', 'give'), |
|
496 | + 'this_year' => esc_html__('This Year', 'give'), |
|
497 | + 'last_year' => esc_html__('Last Year', 'give'), |
|
498 | + 'other' => esc_html__('Custom', 'give') |
|
499 | + )); |
|
500 | 500 | |
501 | 501 | $dates = give_get_report_dates(); |
502 | 502 | $display = $dates['range'] == 'other' ? '' : 'display: none;'; |
503 | - $tab = isset( $_GET['tab'] ) ? sanitize_text_field( $_GET['tab'] ) : 'earnings'; |
|
503 | + $tab = isset($_GET['tab']) ? sanitize_text_field($_GET['tab']) : 'earnings'; |
|
504 | 504 | |
505 | - if ( empty( $dates['day_end'] ) ) { |
|
506 | - $dates['day_end'] = cal_days_in_month( CAL_GREGORIAN, date( 'n' ), date( 'Y' ) ); |
|
505 | + if (empty($dates['day_end'])) { |
|
506 | + $dates['day_end'] = cal_days_in_month(CAL_GREGORIAN, date('n'), date('Y')); |
|
507 | 507 | } |
508 | 508 | |
509 | 509 | /** |
@@ -511,7 +511,7 @@ discard block |
||
511 | 511 | * |
512 | 512 | * @since 1.0 |
513 | 513 | */ |
514 | - do_action( 'give_report_graph_controls_before' ); |
|
514 | + do_action('give_report_graph_controls_before'); |
|
515 | 515 | ?> |
516 | 516 | <form id="give-graphs-filter" method="get"> |
517 | 517 | <div class="tablenav top"> |
@@ -519,56 +519,56 @@ discard block |
||
519 | 519 | |
520 | 520 | <input type="hidden" name="post_type" value="give_forms" /> |
521 | 521 | <input type="hidden" name="page" value="give-reports" /> |
522 | - <input type="hidden" name="tab" value="<?php echo esc_attr( $tab ); ?>" /> |
|
522 | + <input type="hidden" name="tab" value="<?php echo esc_attr($tab); ?>" /> |
|
523 | 523 | |
524 | - <?php if ( isset( $_GET['form-id'] ) ) : ?> |
|
525 | - <input type="hidden" name="form-id" value="<?php echo absint( $_GET['form-id'] ); ?>" /> |
|
524 | + <?php if (isset($_GET['form-id'])) : ?> |
|
525 | + <input type="hidden" name="form-id" value="<?php echo absint($_GET['form-id']); ?>" /> |
|
526 | 526 | <?php endif; ?> |
527 | 527 | |
528 | 528 | <div id="give-graphs-date-options-wrap"> |
529 | 529 | <select id="give-graphs-date-options" name="range"> |
530 | - <?php foreach ( $date_options as $key => $option ) : ?> |
|
531 | - <option value="<?php echo esc_attr( $key ); ?>"<?php selected( $key, $dates['range'] ); ?>><?php echo esc_html( $option ); ?></option> |
|
530 | + <?php foreach ($date_options as $key => $option) : ?> |
|
531 | + <option value="<?php echo esc_attr($key); ?>"<?php selected($key, $dates['range']); ?>><?php echo esc_html($option); ?></option> |
|
532 | 532 | <?php endforeach; ?> |
533 | 533 | </select> |
534 | 534 | |
535 | - <div id="give-date-range-options" style="<?php echo esc_attr( $display ); ?>"> |
|
536 | - <span class="screen-reader-text"><?php esc_html_e( 'From', 'give' ); ?> </span> |
|
535 | + <div id="give-date-range-options" style="<?php echo esc_attr($display); ?>"> |
|
536 | + <span class="screen-reader-text"><?php esc_html_e('From', 'give'); ?> </span> |
|
537 | 537 | <select id="give-graphs-month-start" name="m_start" aria-label="Start Month"> |
538 | - <?php for ( $i = 1; $i <= 12; $i ++ ) : ?> |
|
539 | - <option value="<?php echo absint( $i ); ?>" <?php echo esc_attr( selected( $i, $dates['m_start'] ) ); ?>><?php echo esc_html( give_month_num_to_name( $i ) ); ?></option> |
|
538 | + <?php for ($i = 1; $i <= 12; $i++) : ?> |
|
539 | + <option value="<?php echo absint($i); ?>" <?php echo esc_attr(selected($i, $dates['m_start'])); ?>><?php echo esc_html(give_month_num_to_name($i)); ?></option> |
|
540 | 540 | <?php endfor; ?> |
541 | 541 | </select> |
542 | 542 | <select id="give-graphs-day-start" name="day" aria-label="Start Day"> |
543 | - <?php for ( $i = 1; $i <= 31; $i ++ ) : ?> |
|
544 | - <option value="<?php echo absint( $i ); ?>" <?php echo esc_attr( selected( $i, $dates['day'] ) ); ?>><?php echo esc_html( $i ); ?></option> |
|
543 | + <?php for ($i = 1; $i <= 31; $i++) : ?> |
|
544 | + <option value="<?php echo absint($i); ?>" <?php echo esc_attr(selected($i, $dates['day'])); ?>><?php echo esc_html($i); ?></option> |
|
545 | 545 | <?php endfor; ?> |
546 | 546 | </select> |
547 | 547 | <select id="give-graphs-year-start" name="year" aria-label="Start Year"> |
548 | - <?php for ( $i = 2007; $i <= date( 'Y' ); $i ++ ) : ?> |
|
549 | - <option value="<?php echo absint( $i ); ?>" <?php echo esc_attr( selected( $i, $dates['year'] ) ); ?>><?php echo esc_html( $i ); ?></option> |
|
548 | + <?php for ($i = 2007; $i <= date('Y'); $i++) : ?> |
|
549 | + <option value="<?php echo absint($i); ?>" <?php echo esc_attr(selected($i, $dates['year'])); ?>><?php echo esc_html($i); ?></option> |
|
550 | 550 | <?php endfor; ?> |
551 | 551 | </select> |
552 | - <span class="screen-reader-text"><?php esc_html_e( 'To', 'give' ); ?> </span> |
|
552 | + <span class="screen-reader-text"><?php esc_html_e('To', 'give'); ?> </span> |
|
553 | 553 | <span>–</span> |
554 | 554 | <select id="give-graphs-month-end" name="m_end" aria-label="End Month"> |
555 | - <?php for ( $i = 1; $i <= 12; $i ++ ) : ?> |
|
556 | - <option value="<?php echo absint( $i ); ?>" <?php echo esc_attr( selected( $i, $dates['m_end'] ) ); ?>><?php echo esc_html( give_month_num_to_name( $i ) ); ?></option> |
|
555 | + <?php for ($i = 1; $i <= 12; $i++) : ?> |
|
556 | + <option value="<?php echo absint($i); ?>" <?php echo esc_attr(selected($i, $dates['m_end'])); ?>><?php echo esc_html(give_month_num_to_name($i)); ?></option> |
|
557 | 557 | <?php endfor; ?> |
558 | 558 | </select> |
559 | 559 | <select id="give-graphs-day-end" name="day_end" aria-label="End Day"> |
560 | - <?php for ( $i = 1; $i <= 31; $i ++ ) : ?> |
|
561 | - <option value="<?php echo absint( $i ); ?>" <?php echo esc_attr( selected( $i, $dates['day_end'] ) ); ?>><?php echo esc_html( $i ); ?></option> |
|
560 | + <?php for ($i = 1; $i <= 31; $i++) : ?> |
|
561 | + <option value="<?php echo absint($i); ?>" <?php echo esc_attr(selected($i, $dates['day_end'])); ?>><?php echo esc_html($i); ?></option> |
|
562 | 562 | <?php endfor; ?> |
563 | 563 | </select> |
564 | 564 | <select id="give-graphs-year-end" name="year_end" aria-label="End Year"> |
565 | - <?php for ( $i = 2007; $i <= date( 'Y' ); $i ++ ) : ?> |
|
566 | - <option value="<?php echo absint( $i ); ?>" <?php echo esc_attr( selected( $i, $dates['year_end'] ) ); ?>><?php echo esc_html( $i ); ?></option> |
|
565 | + <?php for ($i = 2007; $i <= date('Y'); $i++) : ?> |
|
566 | + <option value="<?php echo absint($i); ?>" <?php echo esc_attr(selected($i, $dates['year_end'])); ?>><?php echo esc_html($i); ?></option> |
|
567 | 567 | <?php endfor; ?> |
568 | 568 | </select> |
569 | 569 | </div> |
570 | 570 | |
571 | - <input type="submit" class="button-secondary" value="<?php esc_attr_e( 'Filter', 'give' ); ?>" /> |
|
571 | + <input type="submit" class="button-secondary" value="<?php esc_attr_e('Filter', 'give'); ?>" /> |
|
572 | 572 | </div> |
573 | 573 | |
574 | 574 | <input type="hidden" name="give_action" value="filter_reports" /> |
@@ -581,7 +581,7 @@ discard block |
||
581 | 581 | * |
582 | 582 | * @since 1.0 |
583 | 583 | */ |
584 | - do_action( 'give_report_graph_controls_after' ); |
|
584 | + do_action('give_report_graph_controls_after'); |
|
585 | 585 | } |
586 | 586 | |
587 | 587 | /** |
@@ -596,65 +596,65 @@ discard block |
||
596 | 596 | function give_get_report_dates() { |
597 | 597 | $dates = array(); |
598 | 598 | |
599 | - $current_time = current_time( 'timestamp' ); |
|
599 | + $current_time = current_time('timestamp'); |
|
600 | 600 | |
601 | - $dates['range'] = isset( $_GET['range'] ) ? $_GET['range'] : 'this_month'; |
|
602 | - $dates['year'] = isset( $_GET['year'] ) ? $_GET['year'] : date( 'Y' ); |
|
603 | - $dates['year_end'] = isset( $_GET['year_end'] ) ? $_GET['year_end'] : date( 'Y' ); |
|
604 | - $dates['m_start'] = isset( $_GET['m_start'] ) ? $_GET['m_start'] : 1; |
|
605 | - $dates['m_end'] = isset( $_GET['m_end'] ) ? $_GET['m_end'] : 12; |
|
606 | - $dates['day'] = isset( $_GET['day'] ) ? $_GET['day'] : 1; |
|
607 | - $dates['day_end'] = isset( $_GET['day_end'] ) ? $_GET['day_end'] : cal_days_in_month( CAL_GREGORIAN, $dates['m_end'], $dates['year'] ); |
|
601 | + $dates['range'] = isset($_GET['range']) ? $_GET['range'] : 'this_month'; |
|
602 | + $dates['year'] = isset($_GET['year']) ? $_GET['year'] : date('Y'); |
|
603 | + $dates['year_end'] = isset($_GET['year_end']) ? $_GET['year_end'] : date('Y'); |
|
604 | + $dates['m_start'] = isset($_GET['m_start']) ? $_GET['m_start'] : 1; |
|
605 | + $dates['m_end'] = isset($_GET['m_end']) ? $_GET['m_end'] : 12; |
|
606 | + $dates['day'] = isset($_GET['day']) ? $_GET['day'] : 1; |
|
607 | + $dates['day_end'] = isset($_GET['day_end']) ? $_GET['day_end'] : cal_days_in_month(CAL_GREGORIAN, $dates['m_end'], $dates['year']); |
|
608 | 608 | |
609 | 609 | // Modify dates based on predefined ranges |
610 | - switch ( $dates['range'] ) : |
|
610 | + switch ($dates['range']) : |
|
611 | 611 | |
612 | 612 | case 'this_month' : |
613 | - $dates['m_start'] = date( 'n', $current_time ); |
|
614 | - $dates['m_end'] = date( 'n', $current_time ); |
|
613 | + $dates['m_start'] = date('n', $current_time); |
|
614 | + $dates['m_end'] = date('n', $current_time); |
|
615 | 615 | $dates['day'] = 1; |
616 | - $dates['day_end'] = cal_days_in_month( CAL_GREGORIAN, $dates['m_end'], $dates['year'] ); |
|
617 | - $dates['year'] = date( 'Y' ); |
|
618 | - $dates['year_end'] = date( 'Y' ); |
|
616 | + $dates['day_end'] = cal_days_in_month(CAL_GREGORIAN, $dates['m_end'], $dates['year']); |
|
617 | + $dates['year'] = date('Y'); |
|
618 | + $dates['year_end'] = date('Y'); |
|
619 | 619 | break; |
620 | 620 | |
621 | 621 | case 'last_month' : |
622 | - if ( date( 'n' ) == 1 ) { |
|
622 | + if (date('n') == 1) { |
|
623 | 623 | $dates['m_start'] = 12; |
624 | 624 | $dates['m_end'] = 12; |
625 | - $dates['year'] = date( 'Y', $current_time ) - 1; |
|
626 | - $dates['year_end'] = date( 'Y', $current_time ) - 1; |
|
625 | + $dates['year'] = date('Y', $current_time) - 1; |
|
626 | + $dates['year_end'] = date('Y', $current_time) - 1; |
|
627 | 627 | } else { |
628 | - $dates['m_start'] = date( 'n' ) - 1; |
|
629 | - $dates['m_end'] = date( 'n' ) - 1; |
|
628 | + $dates['m_start'] = date('n') - 1; |
|
629 | + $dates['m_end'] = date('n') - 1; |
|
630 | 630 | $dates['year_end'] = $dates['year']; |
631 | 631 | } |
632 | - $dates['day_end'] = cal_days_in_month( CAL_GREGORIAN, $dates['m_end'], $dates['year'] ); |
|
632 | + $dates['day_end'] = cal_days_in_month(CAL_GREGORIAN, $dates['m_end'], $dates['year']); |
|
633 | 633 | break; |
634 | 634 | |
635 | 635 | case 'today' : |
636 | - $dates['day'] = date( 'd', $current_time ); |
|
637 | - $dates['m_start'] = date( 'n', $current_time ); |
|
638 | - $dates['m_end'] = date( 'n', $current_time ); |
|
639 | - $dates['year'] = date( 'Y', $current_time ); |
|
636 | + $dates['day'] = date('d', $current_time); |
|
637 | + $dates['m_start'] = date('n', $current_time); |
|
638 | + $dates['m_end'] = date('n', $current_time); |
|
639 | + $dates['year'] = date('Y', $current_time); |
|
640 | 640 | break; |
641 | 641 | |
642 | 642 | case 'yesterday' : |
643 | 643 | |
644 | - $year = date( 'Y', $current_time ); |
|
645 | - $month = date( 'n', $current_time ); |
|
646 | - $day = date( 'd', $current_time ); |
|
644 | + $year = date('Y', $current_time); |
|
645 | + $month = date('n', $current_time); |
|
646 | + $day = date('d', $current_time); |
|
647 | 647 | |
648 | - if ( $month == 1 && $day == 1 ) { |
|
648 | + if ($month == 1 && $day == 1) { |
|
649 | 649 | |
650 | 650 | $year -= 1; |
651 | 651 | $month = 12; |
652 | - $day = cal_days_in_month( CAL_GREGORIAN, $month, $year ); |
|
652 | + $day = cal_days_in_month(CAL_GREGORIAN, $month, $year); |
|
653 | 653 | |
654 | - } elseif ( $month > 1 && $day == 1 ) { |
|
654 | + } elseif ($month > 1 && $day == 1) { |
|
655 | 655 | |
656 | 656 | $month -= 1; |
657 | - $day = cal_days_in_month( CAL_GREGORIAN, $month, $year ); |
|
657 | + $day = cal_days_in_month(CAL_GREGORIAN, $month, $year); |
|
658 | 658 | |
659 | 659 | } else { |
660 | 660 | |
@@ -670,91 +670,91 @@ discard block |
||
670 | 670 | break; |
671 | 671 | |
672 | 672 | case 'this_week' : |
673 | - $dates['day'] = date( 'd', $current_time - ( date( 'w', $current_time ) - 1 ) * 60 * 60 * 24 ) - 1; |
|
674 | - $dates['day'] += get_option( 'start_of_week' ); |
|
673 | + $dates['day'] = date('d', $current_time - (date('w', $current_time) - 1) * 60 * 60 * 24) - 1; |
|
674 | + $dates['day'] += get_option('start_of_week'); |
|
675 | 675 | $dates['day_end'] = $dates['day'] + 6; |
676 | - $dates['m_start'] = date( 'n', $current_time ); |
|
677 | - $dates['m_end'] = date( 'n', $current_time ); |
|
678 | - $dates['year'] = date( 'Y', $current_time ); |
|
676 | + $dates['m_start'] = date('n', $current_time); |
|
677 | + $dates['m_end'] = date('n', $current_time); |
|
678 | + $dates['year'] = date('Y', $current_time); |
|
679 | 679 | break; |
680 | 680 | |
681 | 681 | case 'last_week' : |
682 | - $dates['day'] = date( 'd', $current_time - ( date( 'w' ) - 1 ) * 60 * 60 * 24 ) - 8; |
|
683 | - $dates['day'] += get_option( 'start_of_week' ); |
|
682 | + $dates['day'] = date('d', $current_time - (date('w') - 1) * 60 * 60 * 24) - 8; |
|
683 | + $dates['day'] += get_option('start_of_week'); |
|
684 | 684 | $dates['day_end'] = $dates['day'] + 6; |
685 | - $dates['year'] = date( 'Y' ); |
|
686 | - |
|
687 | - if ( date( 'j', $current_time ) <= 7 ) { |
|
688 | - $dates['m_start'] = date( 'n', $current_time ) - 1; |
|
689 | - $dates['m_end'] = date( 'n', $current_time ) - 1; |
|
690 | - if ( $dates['m_start'] <= 1 ) { |
|
691 | - $dates['year'] = date( 'Y', $current_time ) - 1; |
|
692 | - $dates['year_end'] = date( 'Y', $current_time ) - 1; |
|
685 | + $dates['year'] = date('Y'); |
|
686 | + |
|
687 | + if (date('j', $current_time) <= 7) { |
|
688 | + $dates['m_start'] = date('n', $current_time) - 1; |
|
689 | + $dates['m_end'] = date('n', $current_time) - 1; |
|
690 | + if ($dates['m_start'] <= 1) { |
|
691 | + $dates['year'] = date('Y', $current_time) - 1; |
|
692 | + $dates['year_end'] = date('Y', $current_time) - 1; |
|
693 | 693 | } |
694 | 694 | } else { |
695 | - $dates['m_start'] = date( 'n', $current_time ); |
|
696 | - $dates['m_end'] = date( 'n', $current_time ); |
|
695 | + $dates['m_start'] = date('n', $current_time); |
|
696 | + $dates['m_end'] = date('n', $current_time); |
|
697 | 697 | } |
698 | 698 | break; |
699 | 699 | |
700 | 700 | case 'this_quarter' : |
701 | - $month_now = date( 'n', $current_time ); |
|
701 | + $month_now = date('n', $current_time); |
|
702 | 702 | |
703 | - if ( $month_now <= 3 ) { |
|
703 | + if ($month_now <= 3) { |
|
704 | 704 | |
705 | 705 | $dates['m_start'] = 1; |
706 | 706 | $dates['m_end'] = 4; |
707 | - $dates['year'] = date( 'Y', $current_time ); |
|
707 | + $dates['year'] = date('Y', $current_time); |
|
708 | 708 | |
709 | - } else if ( $month_now <= 6 ) { |
|
709 | + } else if ($month_now <= 6) { |
|
710 | 710 | |
711 | 711 | $dates['m_start'] = 4; |
712 | 712 | $dates['m_end'] = 7; |
713 | - $dates['year'] = date( 'Y', $current_time ); |
|
713 | + $dates['year'] = date('Y', $current_time); |
|
714 | 714 | |
715 | - } else if ( $month_now <= 9 ) { |
|
715 | + } else if ($month_now <= 9) { |
|
716 | 716 | |
717 | 717 | $dates['m_start'] = 7; |
718 | 718 | $dates['m_end'] = 10; |
719 | - $dates['year'] = date( 'Y', $current_time ); |
|
719 | + $dates['year'] = date('Y', $current_time); |
|
720 | 720 | |
721 | 721 | } else { |
722 | 722 | |
723 | 723 | $dates['m_start'] = 10; |
724 | 724 | $dates['m_end'] = 1; |
725 | - $dates['year'] = date( 'Y', $current_time ); |
|
726 | - $dates['year_end'] = date( 'Y', $current_time ) + 1; |
|
725 | + $dates['year'] = date('Y', $current_time); |
|
726 | + $dates['year_end'] = date('Y', $current_time) + 1; |
|
727 | 727 | |
728 | 728 | } |
729 | 729 | break; |
730 | 730 | |
731 | 731 | case 'last_quarter' : |
732 | - $month_now = date( 'n' ); |
|
732 | + $month_now = date('n'); |
|
733 | 733 | |
734 | - if ( $month_now <= 3 ) { |
|
734 | + if ($month_now <= 3) { |
|
735 | 735 | |
736 | 736 | $dates['m_start'] = 10; |
737 | 737 | $dates['m_end'] = 12; |
738 | - $dates['year'] = date( 'Y', $current_time ) - 1; // Previous year |
|
739 | - $dates['year_end'] = date( 'Y', $current_time ) - 1; // Previous year |
|
738 | + $dates['year'] = date('Y', $current_time) - 1; // Previous year |
|
739 | + $dates['year_end'] = date('Y', $current_time) - 1; // Previous year |
|
740 | 740 | |
741 | - } else if ( $month_now <= 6 ) { |
|
741 | + } else if ($month_now <= 6) { |
|
742 | 742 | |
743 | 743 | $dates['m_start'] = 1; |
744 | 744 | $dates['m_end'] = 3; |
745 | - $dates['year'] = date( 'Y', $current_time ); |
|
745 | + $dates['year'] = date('Y', $current_time); |
|
746 | 746 | |
747 | - } else if ( $month_now <= 9 ) { |
|
747 | + } else if ($month_now <= 9) { |
|
748 | 748 | |
749 | 749 | $dates['m_start'] = 4; |
750 | 750 | $dates['m_end'] = 6; |
751 | - $dates['year'] = date( 'Y', $current_time ); |
|
751 | + $dates['year'] = date('Y', $current_time); |
|
752 | 752 | |
753 | 753 | } else { |
754 | 754 | |
755 | 755 | $dates['m_start'] = 7; |
756 | 756 | $dates['m_end'] = 9; |
757 | - $dates['year'] = date( 'Y', $current_time ); |
|
757 | + $dates['year'] = date('Y', $current_time); |
|
758 | 758 | |
759 | 759 | } |
760 | 760 | break; |
@@ -762,19 +762,19 @@ discard block |
||
762 | 762 | case 'this_year' : |
763 | 763 | $dates['m_start'] = 1; |
764 | 764 | $dates['m_end'] = 12; |
765 | - $dates['year'] = date( 'Y', $current_time ); |
|
765 | + $dates['year'] = date('Y', $current_time); |
|
766 | 766 | break; |
767 | 767 | |
768 | 768 | case 'last_year' : |
769 | 769 | $dates['m_start'] = 1; |
770 | 770 | $dates['m_end'] = 12; |
771 | - $dates['year'] = date( 'Y', $current_time ) - 1; |
|
772 | - $dates['year_end'] = date( 'Y', $current_time ) - 1; |
|
771 | + $dates['year'] = date('Y', $current_time) - 1; |
|
772 | + $dates['year_end'] = date('Y', $current_time) - 1; |
|
773 | 773 | break; |
774 | 774 | |
775 | 775 | endswitch; |
776 | 776 | |
777 | - return apply_filters( 'give_report_dates', $dates ); |
|
777 | + return apply_filters('give_report_dates', $dates); |
|
778 | 778 | } |
779 | 779 | |
780 | 780 | /** |
@@ -785,18 +785,18 @@ discard block |
||
785 | 785 | * |
786 | 786 | * @param $data |
787 | 787 | */ |
788 | -function give_parse_report_dates( $data ) { |
|
788 | +function give_parse_report_dates($data) { |
|
789 | 789 | $dates = give_get_report_dates(); |
790 | 790 | |
791 | 791 | $view = give_get_reporting_view(); |
792 | - $tab = isset( $_GET['tab'] ) ? sanitize_text_field( $_GET['tab'] ) : 'earnings'; |
|
793 | - $id = isset( $_GET['form-id'] ) ? $_GET['form-id'] : null; |
|
792 | + $tab = isset($_GET['tab']) ? sanitize_text_field($_GET['tab']) : 'earnings'; |
|
793 | + $id = isset($_GET['form-id']) ? $_GET['form-id'] : null; |
|
794 | 794 | |
795 | - wp_redirect( add_query_arg( $dates, admin_url( 'edit.php?post_type=give_forms&page=give-reports&tab=' . esc_attr( $tab ) . '&view=' . esc_attr( $view ) . '&form-id=' . absint( $id ) ) ) ); |
|
795 | + wp_redirect(add_query_arg($dates, admin_url('edit.php?post_type=give_forms&page=give-reports&tab='.esc_attr($tab).'&view='.esc_attr($view).'&form-id='.absint($id)))); |
|
796 | 796 | give_die(); |
797 | 797 | } |
798 | 798 | |
799 | -add_action( 'give_filter_reports', 'give_parse_report_dates' ); |
|
799 | +add_action('give_filter_reports', 'give_parse_report_dates'); |
|
800 | 800 | |
801 | 801 | |
802 | 802 | /** |
@@ -808,22 +808,22 @@ discard block |
||
808 | 808 | */ |
809 | 809 | function give_reports_refresh_button() { |
810 | 810 | |
811 | - $url = wp_nonce_url( add_query_arg( array( |
|
811 | + $url = wp_nonce_url(add_query_arg(array( |
|
812 | 812 | 'give_action' => 'refresh_reports_transients', |
813 | 813 | 'give-message' => 'refreshed-reports' |
814 | - ) ), 'give-refresh-reports' ); |
|
814 | + )), 'give-refresh-reports'); |
|
815 | 815 | |
816 | 816 | echo '<a href="' |
817 | - . esc_url_raw( $url ) |
|
818 | - . '" data-tooltip="'. esc_attr__( 'Clicking this will clear the reports cache.', 'give' ) |
|
817 | + . esc_url_raw($url) |
|
818 | + . '" data-tooltip="'.esc_attr__('Clicking this will clear the reports cache.', 'give') |
|
819 | 819 | . '" data-tooltip-my-position="right center" data-tooltip-target-position="left center" class="button alignright give-admin-button give-tooltip">' |
820 | 820 | . '<span class="give-admin-button-icon give-admin-button-icon-update"></span>' |
821 | - . esc_html__( 'Refresh Report Data', 'give' ) |
|
821 | + . esc_html__('Refresh Report Data', 'give') |
|
822 | 822 | . '</a>'; |
823 | 823 | |
824 | 824 | } |
825 | 825 | |
826 | -add_action( 'give_reports_graph_additional_stats', 'give_reports_refresh_button' ); |
|
826 | +add_action('give_reports_graph_additional_stats', 'give_reports_refresh_button'); |
|
827 | 827 | |
828 | 828 | /** |
829 | 829 | * Trigger the refresh of reports transients |
@@ -834,20 +834,20 @@ discard block |
||
834 | 834 | * |
835 | 835 | * @return void |
836 | 836 | */ |
837 | -function give_run_refresh_reports_transients( $data ) { |
|
837 | +function give_run_refresh_reports_transients($data) { |
|
838 | 838 | |
839 | - if ( ! wp_verify_nonce( $data['_wpnonce'], 'give-refresh-reports' ) ) { |
|
839 | + if ( ! wp_verify_nonce($data['_wpnonce'], 'give-refresh-reports')) { |
|
840 | 840 | return; |
841 | 841 | } |
842 | 842 | |
843 | 843 | // Monthly stats. |
844 | - Give_Cache::delete( Give_Cache::get_key( 'give_estimated_monthly_stats' ) ); |
|
844 | + Give_Cache::delete(Give_Cache::get_key('give_estimated_monthly_stats')); |
|
845 | 845 | |
846 | 846 | // Total earning. |
847 | - delete_option( 'give_earnings_total' ); |
|
847 | + delete_option('give_earnings_total'); |
|
848 | 848 | |
849 | 849 | // @todo: Refresh only range related stat cache |
850 | 850 | give_delete_donation_stats(); |
851 | 851 | } |
852 | 852 | |
853 | -add_action( 'give_refresh_reports_transients', 'give_run_refresh_reports_transients' ); |
|
854 | 853 | \ No newline at end of file |
854 | +add_action('give_refresh_reports_transients', 'give_run_refresh_reports_transients'); |
|
855 | 855 | \ No newline at end of file |
@@ -10,13 +10,13 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
17 | 17 | // Load WP_List_Table if not loaded |
18 | -if ( ! class_exists( 'WP_List_Table' ) ) { |
|
19 | - require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php'; |
|
18 | +if ( ! class_exists('WP_List_Table')) { |
|
19 | + require_once ABSPATH.'wp-admin/includes/class-wp-list-table.php'; |
|
20 | 20 | } |
21 | 21 | |
22 | 22 | /** |
@@ -45,11 +45,11 @@ discard block |
||
45 | 45 | global $status, $page; |
46 | 46 | |
47 | 47 | // Set parent defaults |
48 | - parent::__construct( array( |
|
49 | - 'singular' => give_get_forms_label_singular(), // Singular name of the listed records |
|
50 | - 'plural' => give_get_forms_label_plural(), // Plural name of the listed records |
|
48 | + parent::__construct(array( |
|
49 | + 'singular' => give_get_forms_label_singular(), // Singular name of the listed records |
|
50 | + 'plural' => give_get_forms_label_plural(), // Plural name of the listed records |
|
51 | 51 | 'ajax' => false // Does this table support ajax? |
52 | - ) ); |
|
52 | + )); |
|
53 | 53 | |
54 | 54 | } |
55 | 55 | |
@@ -64,10 +64,10 @@ discard block |
||
64 | 64 | * |
65 | 65 | * @return string Column Name |
66 | 66 | */ |
67 | - public function column_default( $item, $column_name ) { |
|
68 | - switch ( $column_name ) { |
|
67 | + public function column_default($item, $column_name) { |
|
68 | + switch ($column_name) { |
|
69 | 69 | default: |
70 | - return $item[ $column_name ]; |
|
70 | + return $item[$column_name]; |
|
71 | 71 | } |
72 | 72 | } |
73 | 73 | |
@@ -80,11 +80,11 @@ discard block |
||
80 | 80 | */ |
81 | 81 | public function get_columns() { |
82 | 82 | $columns = array( |
83 | - 'label' => esc_attr__( 'Gateway', 'give' ), |
|
84 | - 'complete_sales' => esc_attr__( 'Complete Transactions', 'give' ), |
|
85 | - 'pending_sales' => esc_attr__( 'Pending / Failed Transactions', 'give' ), |
|
86 | - 'total_sales' => esc_attr__( 'Total Transactions', 'give' ), |
|
87 | - 'total_donations' => esc_attr__( 'Total Donated', 'give' ) |
|
83 | + 'label' => esc_attr__('Gateway', 'give'), |
|
84 | + 'complete_sales' => esc_attr__('Complete Transactions', 'give'), |
|
85 | + 'pending_sales' => esc_attr__('Pending / Failed Transactions', 'give'), |
|
86 | + 'total_sales' => esc_attr__('Total Transactions', 'give'), |
|
87 | + 'total_donations' => esc_attr__('Total Donated', 'give') |
|
88 | 88 | ); |
89 | 89 | |
90 | 90 | return $columns; |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | * @return int Current page number |
100 | 100 | */ |
101 | 101 | public function get_paged() { |
102 | - return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1; |
|
102 | + return isset($_GET['paged']) ? absint($_GET['paged']) : 1; |
|
103 | 103 | } |
104 | 104 | |
105 | 105 | |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | * @since 1.0 |
111 | 111 | * @return void |
112 | 112 | */ |
113 | - public function bulk_actions( $which = '' ) { |
|
113 | + public function bulk_actions($which = '') { |
|
114 | 114 | |
115 | 115 | } |
116 | 116 | |
@@ -122,27 +122,27 @@ discard block |
||
122 | 122 | * |
123 | 123 | * @param string $which |
124 | 124 | */ |
125 | - protected function display_tablenav( $which ) { |
|
125 | + protected function display_tablenav($which) { |
|
126 | 126 | |
127 | - if ( 'top' === $which ) { |
|
128 | - wp_nonce_field( 'bulk-' . $this->_args['plural'] ); |
|
127 | + if ('top' === $which) { |
|
128 | + wp_nonce_field('bulk-'.$this->_args['plural']); |
|
129 | 129 | } |
130 | 130 | ?> |
131 | - <div class="tablenav gateways-report-tablenav give-clearfix <?php echo esc_attr( $which ); ?>"> |
|
131 | + <div class="tablenav gateways-report-tablenav give-clearfix <?php echo esc_attr($which); ?>"> |
|
132 | 132 | |
133 | - <?php if ( 'top' === $which ) { ?> |
|
133 | + <?php if ('top' === $which) { ?> |
|
134 | 134 | <h3 class="alignleft reports-earnings-title"> |
135 | - <span><?php esc_html_e( 'Donation Methods Report', 'give' ); ?></span> |
|
135 | + <span><?php esc_html_e('Donation Methods Report', 'give'); ?></span> |
|
136 | 136 | </h3> |
137 | 137 | <?php } ?> |
138 | 138 | |
139 | 139 | <div class="alignright tablenav-right"> |
140 | 140 | <div class="actions bulkactions"> |
141 | - <?php $this->bulk_actions( $which ); ?> |
|
141 | + <?php $this->bulk_actions($which); ?> |
|
142 | 142 | </div> |
143 | 143 | <?php |
144 | - $this->extra_tablenav( $which ); |
|
145 | - $this->pagination( $which ); |
|
144 | + $this->extra_tablenav($which); |
|
145 | + $this->pagination($which); |
|
146 | 146 | ?> |
147 | 147 | </div> |
148 | 148 | |
@@ -167,18 +167,18 @@ discard block |
||
167 | 167 | $gateways = give_get_payment_gateways(); |
168 | 168 | $stats = new Give_Payment_Stats(); |
169 | 169 | |
170 | - foreach ( $gateways as $gateway_id => $gateway ) { |
|
170 | + foreach ($gateways as $gateway_id => $gateway) { |
|
171 | 171 | |
172 | - $complete_count = give_count_sales_by_gateway( $gateway_id, 'publish' ); |
|
173 | - $pending_count = give_count_sales_by_gateway( $gateway_id, array( 'pending', 'failed' ) ); |
|
172 | + $complete_count = give_count_sales_by_gateway($gateway_id, 'publish'); |
|
173 | + $pending_count = give_count_sales_by_gateway($gateway_id, array('pending', 'failed')); |
|
174 | 174 | |
175 | 175 | $reports_data[] = array( |
176 | 176 | 'ID' => $gateway_id, |
177 | 177 | 'label' => $gateway['admin_label'], |
178 | - 'complete_sales' => give_format_amount( $complete_count, false ), |
|
179 | - 'pending_sales' => give_format_amount( $pending_count, false ), |
|
180 | - 'total_sales' => give_format_amount( $complete_count + $pending_count, false ), |
|
181 | - 'total_donations' => give_currency_filter( give_format_amount( $stats->get_earnings( 0, 0, 0, $gateway_id ) ) ) |
|
178 | + 'complete_sales' => give_format_amount($complete_count, false), |
|
179 | + 'pending_sales' => give_format_amount($pending_count, false), |
|
180 | + 'total_sales' => give_format_amount($complete_count + $pending_count, false), |
|
181 | + 'total_donations' => give_currency_filter(give_format_amount($stats->get_earnings(0, 0, 0, $gateway_id))) |
|
182 | 182 | ); |
183 | 183 | } |
184 | 184 | |
@@ -200,7 +200,7 @@ discard block |
||
200 | 200 | $columns = $this->get_columns(); |
201 | 201 | $hidden = array(); // No hidden columns |
202 | 202 | $sortable = $this->get_sortable_columns(); |
203 | - $this->_column_headers = array( $columns, $hidden, $sortable ); |
|
203 | + $this->_column_headers = array($columns, $hidden, $sortable); |
|
204 | 204 | $this->items = $this->reports_data(); |
205 | 205 | |
206 | 206 | } |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | * @since 1.0 |
21 | 21 | * @return void |
22 | 22 | */ |
23 | -add_action( 'give_manual_cc_form', '__return_false' ); |
|
23 | +add_action('give_manual_cc_form', '__return_false'); |
|
24 | 24 | |
25 | 25 | /** |
26 | 26 | * Processes the donation data and uses the Manual Payment gateway to record |
@@ -32,17 +32,17 @@ discard block |
||
32 | 32 | * |
33 | 33 | * @return void |
34 | 34 | */ |
35 | -function give_manual_payment( $purchase_data ) { |
|
35 | +function give_manual_payment($purchase_data) { |
|
36 | 36 | |
37 | - if ( ! wp_verify_nonce( $purchase_data['gateway_nonce'], 'give-gateway' ) ) { |
|
38 | - wp_die( esc_html__( 'Nonce verification failed.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
37 | + if ( ! wp_verify_nonce($purchase_data['gateway_nonce'], 'give-gateway')) { |
|
38 | + wp_die(esc_html__('Nonce verification failed.', 'give'), esc_html__('Error', 'give'), array('response' => 403)); |
|
39 | 39 | } |
40 | 40 | |
41 | 41 | //Create payment_data array |
42 | 42 | $payment_data = array( |
43 | 43 | 'price' => $purchase_data['price'], |
44 | 44 | 'give_form_title' => $purchase_data['post_data']['give-form-title'], |
45 | - 'give_form_id' => intval( $purchase_data['post_data']['give-form-id'] ), |
|
45 | + 'give_form_id' => intval($purchase_data['post_data']['give-form-id']), |
|
46 | 46 | 'give_price_id' => isset($purchase_data['post_data']['give-price-id']) ? $purchase_data['post_data']['give-price-id'] : '', |
47 | 47 | 'date' => $purchase_data['date'], |
48 | 48 | 'user_email' => $purchase_data['user_email'], |
@@ -52,24 +52,24 @@ discard block |
||
52 | 52 | 'status' => 'pending' |
53 | 53 | ); |
54 | 54 | // Record the pending payment |
55 | - $payment = give_insert_payment( $payment_data ); |
|
55 | + $payment = give_insert_payment($payment_data); |
|
56 | 56 | |
57 | - if ( $payment ) { |
|
58 | - give_update_payment_status( $payment, 'publish' ); |
|
57 | + if ($payment) { |
|
58 | + give_update_payment_status($payment, 'publish'); |
|
59 | 59 | give_send_to_success_page(); |
60 | 60 | } else { |
61 | 61 | give_record_gateway_error( |
62 | - esc_html__( 'Payment Error', 'give' ), |
|
62 | + esc_html__('Payment Error', 'give'), |
|
63 | 63 | sprintf( |
64 | 64 | /* translators: %s: payment data */ |
65 | - esc_html__( 'The payment creation failed while processing a manual (free or test) donation. Payment data: %s', 'give' ), |
|
66 | - json_encode( $payment_data ) |
|
65 | + esc_html__('The payment creation failed while processing a manual (free or test) donation. Payment data: %s', 'give'), |
|
66 | + json_encode($payment_data) |
|
67 | 67 | ), |
68 | 68 | $payment |
69 | 69 | ); |
70 | 70 | // If errors are present, send the user back to the donation page so they can be corrected |
71 | - give_send_back_to_checkout( '?payment-mode=' . $purchase_data['post_data']['give-gateway'] ); |
|
71 | + give_send_back_to_checkout('?payment-mode='.$purchase_data['post_data']['give-gateway']); |
|
72 | 72 | } |
73 | 73 | } |
74 | 74 | |
75 | -add_action( 'give_gateway_manual', 'give_manual_payment' ); |
|
75 | +add_action('give_gateway_manual', 'give_manual_payment'); |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | */ |
10 | 10 | |
11 | 11 | // Exit if accessed directly. |
12 | -if ( ! defined( 'ABSPATH' ) ) { |
|
12 | +if ( ! defined('ABSPATH')) { |
|
13 | 13 | exit; |
14 | 14 | } |
15 | 15 | |
@@ -23,10 +23,10 @@ discard block |
||
23 | 23 | */ |
24 | 24 | public function __construct() { |
25 | 25 | |
26 | - $this->shortcode['title'] = esc_html__( 'Donation Form Goal', 'give' ); |
|
27 | - $this->shortcode['label'] = esc_html__( 'Donation Form Goal', 'give' ); |
|
26 | + $this->shortcode['title'] = esc_html__('Donation Form Goal', 'give'); |
|
27 | + $this->shortcode['label'] = esc_html__('Donation Form Goal', 'give'); |
|
28 | 28 | |
29 | - parent::__construct( 'give_goal' ); |
|
29 | + parent::__construct('give_goal'); |
|
30 | 30 | } |
31 | 31 | |
32 | 32 | /** |
@@ -38,8 +38,8 @@ discard block |
||
38 | 38 | |
39 | 39 | $create_form_link = sprintf( |
40 | 40 | /* translators: %s: create new form URL */ |
41 | - __( '<a href="%s">Create</a> a new Donation Form.', 'give' ), |
|
42 | - admin_url( 'post-new.php?post_type=give_forms' ) |
|
41 | + __('<a href="%s">Create</a> a new Donation Form.', 'give'), |
|
42 | + admin_url('post-new.php?post_type=give_forms') |
|
43 | 43 | ); |
44 | 44 | |
45 | 45 | return array( |
@@ -49,35 +49,35 @@ discard block |
||
49 | 49 | 'post_type' => 'give_forms', |
50 | 50 | ), |
51 | 51 | 'name' => 'id', |
52 | - 'tooltip' => esc_attr__( 'Select a Donation Form', 'give' ), |
|
53 | - 'placeholder' => '- ' . esc_attr__( 'Select a Donation Form', 'give' ) . ' -', |
|
52 | + 'tooltip' => esc_attr__('Select a Donation Form', 'give'), |
|
53 | + 'placeholder' => '- '.esc_attr__('Select a Donation Form', 'give').' -', |
|
54 | 54 | 'required' => array( |
55 | - 'alert' => esc_html__( 'You must first select a Form!', 'give' ), |
|
56 | - 'error' => sprintf( '<p class="strong">%s</p><p class="no-margin">%s</p>', esc_html__( 'No forms found.', 'give' ), $create_form_link ), |
|
55 | + 'alert' => esc_html__('You must first select a Form!', 'give'), |
|
56 | + 'error' => sprintf('<p class="strong">%s</p><p class="no-margin">%s</p>', esc_html__('No forms found.', 'give'), $create_form_link), |
|
57 | 57 | ), |
58 | 58 | ), |
59 | 59 | array( |
60 | 60 | 'type' => 'container', |
61 | - 'html' => sprintf( '<p class="strong margin-top">%s</p>', esc_html__( 'Optional settings', 'give' ) ), |
|
61 | + 'html' => sprintf('<p class="strong margin-top">%s</p>', esc_html__('Optional settings', 'give')), |
|
62 | 62 | ), |
63 | 63 | array( |
64 | 64 | 'type' => 'listbox', |
65 | 65 | 'name' => 'show_text', |
66 | - 'label' => esc_attr__( 'Show Text:', 'give' ), |
|
67 | - 'tooltip' => esc_attr__( 'This text displays the amount of income raised compared to the goal.', 'give' ), |
|
66 | + 'label' => esc_attr__('Show Text:', 'give'), |
|
67 | + 'tooltip' => esc_attr__('This text displays the amount of income raised compared to the goal.', 'give'), |
|
68 | 68 | 'options' => array( |
69 | - 'true' => esc_html__( 'Show', 'give' ), |
|
70 | - 'false' => esc_html__( 'Hide', 'give' ), |
|
69 | + 'true' => esc_html__('Show', 'give'), |
|
70 | + 'false' => esc_html__('Hide', 'give'), |
|
71 | 71 | ), |
72 | 72 | ), |
73 | 73 | array( |
74 | 74 | 'type' => 'listbox', |
75 | 75 | 'name' => 'show_bar', |
76 | - 'label' => esc_attr__( 'Show Progress Bar:', 'give' ), |
|
77 | - 'tooltip' => esc_attr__( 'Do you want to display the goal\'s progress bar?', 'give' ), |
|
76 | + 'label' => esc_attr__('Show Progress Bar:', 'give'), |
|
77 | + 'tooltip' => esc_attr__('Do you want to display the goal\'s progress bar?', 'give'), |
|
78 | 78 | 'options' => array( |
79 | - 'true' => esc_html__( 'Show', 'give' ), |
|
80 | - 'false' => esc_html__( 'Hide', 'give' ), |
|
79 | + 'true' => esc_html__('Show', 'give'), |
|
80 | + 'false' => esc_html__('Hide', 'give'), |
|
81 | 81 | ), |
82 | 82 | ), |
83 | 83 | ); |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | * @param $end_date string|bool The end date for which we'd like to filter our sale stats. If false, we'll use the default end date of `this_month` |
37 | 37 | * @param $status string|array The sale status(es) to count. Only valid when retrieving global stats |
38 | 38 | * |
39 | - * @return float|int Total amount of donations based on the passed arguments. |
|
39 | + * @return string Total amount of donations based on the passed arguments. |
|
40 | 40 | */ |
41 | 41 | public function get_sales( $form_id = 0, $start_date = false, $end_date = false, $status = 'publish' ) { |
42 | 42 | |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | * @param $end_date string|bool The end date for which we'd like to filter the donations stats. If false, method will use the default end date of `this_month`. |
100 | 100 | * @param $gateway_id string|bool The gateway to get earnings for such as 'paypal' or 'stripe'. |
101 | 101 | * |
102 | - * @return float|int Total amount of donations based on the passed arguments. |
|
102 | + * @return string Total amount of donations based on the passed arguments. |
|
103 | 103 | */ |
104 | 104 | public function get_earnings( $form_id = 0, $start_date = false, $end_date = false, $gateway_id = false ) { |
105 | 105 | |
@@ -219,7 +219,7 @@ discard block |
||
219 | 219 | * @param $end_date string|bool The end date for which we'd like to filter our sale stats. If false, we'll use the default end date of `this_month` |
220 | 220 | * @param $gateway_id string|bool The gateway to get earnings for such as 'paypal' or 'stripe' |
221 | 221 | * |
222 | - * @return float|int Total amount of donations based on the passed arguments. |
|
222 | + * @return string Total amount of donations based on the passed arguments. |
|
223 | 223 | */ |
224 | 224 | public function get_earnings_cache_key( $form_id = 0, $start_date = false, $end_date = false, $gateway_id = false ) { |
225 | 225 |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -38,35 +38,35 @@ discard block |
||
38 | 38 | * |
39 | 39 | * @return float|int Total amount of donations based on the passed arguments. |
40 | 40 | */ |
41 | - public function get_sales( $form_id = 0, $start_date = false, $end_date = false, $status = 'publish' ) { |
|
41 | + public function get_sales($form_id = 0, $start_date = false, $end_date = false, $status = 'publish') { |
|
42 | 42 | |
43 | - $this->setup_dates( $start_date, $end_date ); |
|
43 | + $this->setup_dates($start_date, $end_date); |
|
44 | 44 | |
45 | 45 | // Make sure start date is valid |
46 | - if ( is_wp_error( $this->start_date ) ) { |
|
46 | + if (is_wp_error($this->start_date)) { |
|
47 | 47 | return $this->start_date; |
48 | 48 | } |
49 | 49 | |
50 | 50 | // Make sure end date is valid |
51 | - if ( is_wp_error( $this->end_date ) ) { |
|
51 | + if (is_wp_error($this->end_date)) { |
|
52 | 52 | return $this->end_date; |
53 | 53 | } |
54 | 54 | |
55 | - if ( empty( $form_id ) ) { |
|
55 | + if (empty($form_id)) { |
|
56 | 56 | |
57 | 57 | // Global sale stats |
58 | - add_filter( 'give_count_payments_where', array( $this, 'count_where' ) ); |
|
58 | + add_filter('give_count_payments_where', array($this, 'count_where')); |
|
59 | 59 | |
60 | - if ( is_array( $status ) ) { |
|
60 | + if (is_array($status)) { |
|
61 | 61 | $count = 0; |
62 | - foreach ( $status as $payment_status ) { |
|
62 | + foreach ($status as $payment_status) { |
|
63 | 63 | $count += give_count_payments()->$payment_status; |
64 | 64 | } |
65 | 65 | } else { |
66 | 66 | $count = give_count_payments()->$status; |
67 | 67 | } |
68 | 68 | |
69 | - remove_filter( 'give_count_payments_where', array( $this, 'count_where' ) ); |
|
69 | + remove_filter('give_count_payments_where', array($this, 'count_where')); |
|
70 | 70 | |
71 | 71 | } else { |
72 | 72 | |
@@ -75,11 +75,11 @@ discard block |
||
75 | 75 | // Product specific stats |
76 | 76 | global $give_logs; |
77 | 77 | |
78 | - add_filter( 'posts_where', array( $this, 'payments_where' ) ); |
|
78 | + add_filter('posts_where', array($this, 'payments_where')); |
|
79 | 79 | |
80 | - $count = $give_logs->get_log_count( $form_id, 'sale' ); |
|
80 | + $count = $give_logs->get_log_count($form_id, 'sale'); |
|
81 | 81 | |
82 | - remove_filter( 'posts_where', array( $this, 'payments_where' ) ); |
|
82 | + remove_filter('posts_where', array($this, 'payments_where')); |
|
83 | 83 | |
84 | 84 | } |
85 | 85 | |
@@ -101,31 +101,31 @@ discard block |
||
101 | 101 | * |
102 | 102 | * @return float|int Total amount of donations based on the passed arguments. |
103 | 103 | */ |
104 | - public function get_earnings( $form_id = 0, $start_date = false, $end_date = false, $gateway_id = false ) { |
|
104 | + public function get_earnings($form_id = 0, $start_date = false, $end_date = false, $gateway_id = false) { |
|
105 | 105 | |
106 | 106 | global $wpdb; |
107 | 107 | |
108 | - $this->setup_dates( $start_date, $end_date ); |
|
108 | + $this->setup_dates($start_date, $end_date); |
|
109 | 109 | |
110 | 110 | // Make sure start date is valid |
111 | - if ( is_wp_error( $this->start_date ) ) { |
|
111 | + if (is_wp_error($this->start_date)) { |
|
112 | 112 | return $this->start_date; |
113 | 113 | } |
114 | 114 | |
115 | 115 | // Make sure end date is valid |
116 | - if ( is_wp_error( $this->end_date ) ) { |
|
116 | + if (is_wp_error($this->end_date)) { |
|
117 | 117 | return $this->end_date; |
118 | 118 | } |
119 | 119 | |
120 | - add_filter( 'posts_where', array( $this, 'payments_where' ) ); |
|
120 | + add_filter('posts_where', array($this, 'payments_where')); |
|
121 | 121 | |
122 | - if ( empty( $form_id ) ) { |
|
122 | + if (empty($form_id)) { |
|
123 | 123 | |
124 | 124 | // Global earning stats |
125 | 125 | $args = array( |
126 | 126 | 'post_type' => 'give_payment', |
127 | 127 | 'nopaging' => true, |
128 | - 'post_status' => array( 'publish' ), |
|
128 | + 'post_status' => array('publish'), |
|
129 | 129 | 'fields' => 'ids', |
130 | 130 | 'update_post_term_cache' => false, |
131 | 131 | 'suppress_filters' => false, |
@@ -137,24 +137,24 @@ discard block |
||
137 | 137 | ); |
138 | 138 | |
139 | 139 | //Filter by Gateway ID meta_key |
140 | - if ( $gateway_id !== false ) { |
|
140 | + if ($gateway_id !== false) { |
|
141 | 141 | $args['meta_key'] = '_give_payment_gateway'; |
142 | 142 | $args['meta_value'] = $gateway_id; |
143 | 143 | } |
144 | 144 | |
145 | - $args = apply_filters( 'give_stats_earnings_args', $args ); |
|
146 | - $key = Give_Cache::get_key( 'give_stats', $args ); |
|
147 | - $earnings = Give_Cache::get( $key ); |
|
145 | + $args = apply_filters('give_stats_earnings_args', $args); |
|
146 | + $key = Give_Cache::get_key('give_stats', $args); |
|
147 | + $earnings = Give_Cache::get($key); |
|
148 | 148 | |
149 | - if ( false === $earnings ) { |
|
150 | - $sales = get_posts( $args ); |
|
149 | + if (false === $earnings) { |
|
150 | + $sales = get_posts($args); |
|
151 | 151 | $earnings = 0; |
152 | - if ( $sales ) { |
|
153 | - $sales = implode( ',', array_map('intval', $sales ) ); |
|
154 | - $earnings += $wpdb->get_var( "SELECT SUM(meta_value) FROM $wpdb->postmeta WHERE meta_key = '_give_payment_total' AND post_id IN({$sales})" ); |
|
152 | + if ($sales) { |
|
153 | + $sales = implode(',', array_map('intval', $sales)); |
|
154 | + $earnings += $wpdb->get_var("SELECT SUM(meta_value) FROM $wpdb->postmeta WHERE meta_key = '_give_payment_total' AND post_id IN({$sales})"); |
|
155 | 155 | } |
156 | 156 | // Cache the results for one hour |
157 | - Give_Cache::set( $key, $earnings, HOUR_IN_SECONDS ); |
|
157 | + Give_Cache::set($key, $earnings, HOUR_IN_SECONDS); |
|
158 | 158 | } |
159 | 159 | |
160 | 160 | } else { |
@@ -174,37 +174,37 @@ discard block |
||
174 | 174 | 'give_transient_type' => 'give_earnings', |
175 | 175 | // This is not a valid query arg, but is used for cache keying |
176 | 176 | ); |
177 | - $args = apply_filters( 'give_stats_earnings_args', $args ); |
|
178 | - $key = Give_Cache::get_key( 'give_stats', $args ); |
|
177 | + $args = apply_filters('give_stats_earnings_args', $args); |
|
178 | + $key = Give_Cache::get_key('give_stats', $args); |
|
179 | 179 | //Set transient for faster stats |
180 | - $earnings = Give_Cache::get( $key ); |
|
180 | + $earnings = Give_Cache::get($key); |
|
181 | 181 | |
182 | - if ( false === $earnings ) { |
|
182 | + if (false === $earnings) { |
|
183 | 183 | |
184 | 184 | $this->timestamp = false; |
185 | - $log_ids = $give_logs->get_connected_logs( $args, 'sale' ); |
|
185 | + $log_ids = $give_logs->get_connected_logs($args, 'sale'); |
|
186 | 186 | $earnings = 0; |
187 | 187 | |
188 | - if ( $log_ids ) { |
|
189 | - $log_ids = implode( ',', array_map('intval', $log_ids ) ); |
|
190 | - $payment_ids = $wpdb->get_col( "SELECT meta_value FROM $wpdb->postmeta WHERE meta_key='_give_log_payment_id' AND post_id IN ($log_ids);" ); |
|
188 | + if ($log_ids) { |
|
189 | + $log_ids = implode(',', array_map('intval', $log_ids)); |
|
190 | + $payment_ids = $wpdb->get_col("SELECT meta_value FROM $wpdb->postmeta WHERE meta_key='_give_log_payment_id' AND post_id IN ($log_ids);"); |
|
191 | 191 | |
192 | - foreach ( $payment_ids as $payment_id ) { |
|
193 | - $earnings += give_get_payment_amount( $payment_id ); |
|
192 | + foreach ($payment_ids as $payment_id) { |
|
193 | + $earnings += give_get_payment_amount($payment_id); |
|
194 | 194 | } |
195 | 195 | |
196 | 196 | } |
197 | 197 | |
198 | 198 | // Cache the results for one hour |
199 | - Give_Cache::set( $key, $earnings, 60 * 60 ); |
|
199 | + Give_Cache::set($key, $earnings, 60 * 60); |
|
200 | 200 | } |
201 | 201 | } |
202 | 202 | |
203 | 203 | //remove our filter |
204 | - remove_filter( 'posts_where', array( $this, 'payments_where' ) ); |
|
204 | + remove_filter('posts_where', array($this, 'payments_where')); |
|
205 | 205 | |
206 | 206 | //return earnings |
207 | - return round( $earnings, give_currency_decimal_filter() ); |
|
207 | + return round($earnings, give_currency_decimal_filter()); |
|
208 | 208 | |
209 | 209 | } |
210 | 210 | |
@@ -221,29 +221,29 @@ discard block |
||
221 | 221 | * |
222 | 222 | * @return float|int Total amount of donations based on the passed arguments. |
223 | 223 | */ |
224 | - public function get_earnings_cache_key( $form_id = 0, $start_date = false, $end_date = false, $gateway_id = false ) { |
|
224 | + public function get_earnings_cache_key($form_id = 0, $start_date = false, $end_date = false, $gateway_id = false) { |
|
225 | 225 | |
226 | - $this->setup_dates( $start_date, $end_date ); |
|
226 | + $this->setup_dates($start_date, $end_date); |
|
227 | 227 | |
228 | 228 | // Make sure start date is valid |
229 | - if ( is_wp_error( $this->start_date ) ) { |
|
229 | + if (is_wp_error($this->start_date)) { |
|
230 | 230 | return $this->start_date; |
231 | 231 | } |
232 | 232 | |
233 | 233 | // Make sure end date is valid |
234 | - if ( is_wp_error( $this->end_date ) ) { |
|
234 | + if (is_wp_error($this->end_date)) { |
|
235 | 235 | return $this->end_date; |
236 | 236 | } |
237 | 237 | |
238 | - add_filter( 'posts_where', array( $this, 'payments_where' ) ); |
|
238 | + add_filter('posts_where', array($this, 'payments_where')); |
|
239 | 239 | |
240 | - if ( empty( $form_id ) ) { |
|
240 | + if (empty($form_id)) { |
|
241 | 241 | |
242 | 242 | // Global earning stats |
243 | 243 | $args = array( |
244 | 244 | 'post_type' => 'give_payment', |
245 | 245 | 'nopaging' => true, |
246 | - 'post_status' => array( 'publish' ), |
|
246 | + 'post_status' => array('publish'), |
|
247 | 247 | 'fields' => 'ids', |
248 | 248 | 'update_post_term_cache' => false, |
249 | 249 | 'suppress_filters' => false, |
@@ -255,13 +255,13 @@ discard block |
||
255 | 255 | ); |
256 | 256 | |
257 | 257 | //Filter by Gateway ID meta_key |
258 | - if ( $gateway_id !== false ) { |
|
258 | + if ($gateway_id !== false) { |
|
259 | 259 | $args['meta_key'] = '_give_payment_gateway'; |
260 | 260 | $args['meta_value'] = $gateway_id; |
261 | 261 | } |
262 | 262 | |
263 | - $args = apply_filters( 'give_stats_earnings_args', $args ); |
|
264 | - $key = Give_Cache::get_key( 'give_stats', $args ); |
|
263 | + $args = apply_filters('give_stats_earnings_args', $args); |
|
264 | + $key = Give_Cache::get_key('give_stats', $args); |
|
265 | 265 | |
266 | 266 | } else { |
267 | 267 | |
@@ -281,12 +281,12 @@ discard block |
||
281 | 281 | // This is not a valid query arg, but is used for cache keying |
282 | 282 | ); |
283 | 283 | |
284 | - $args = apply_filters( 'give_stats_earnings_args', $args ); |
|
285 | - $key = Give_Cache::get_key( 'give_stats', $args ); |
|
284 | + $args = apply_filters('give_stats_earnings_args', $args); |
|
285 | + $key = Give_Cache::get_key('give_stats', $args); |
|
286 | 286 | } |
287 | 287 | |
288 | 288 | //remove our filter |
289 | - remove_filter( 'posts_where', array( $this, 'payments_where' ) ); |
|
289 | + remove_filter('posts_where', array($this, 'payments_where')); |
|
290 | 290 | |
291 | 291 | //return earnings |
292 | 292 | return $key; |
@@ -303,16 +303,16 @@ discard block |
||
303 | 303 | * |
304 | 304 | * @return array Best selling forms |
305 | 305 | */ |
306 | - public function get_best_selling( $number = 10 ) { |
|
306 | + public function get_best_selling($number = 10) { |
|
307 | 307 | |
308 | 308 | global $wpdb; |
309 | 309 | |
310 | - $give_forms = $wpdb->get_results( $wpdb->prepare( |
|
310 | + $give_forms = $wpdb->get_results($wpdb->prepare( |
|
311 | 311 | "SELECT post_id as form_id, max(meta_value) as sales |
312 | 312 | FROM $wpdb->postmeta WHERE meta_key='_give_form_sales' AND meta_value > 0 |
313 | 313 | GROUP BY meta_value+0 |
314 | 314 | DESC LIMIT %d;", $number |
315 | - ) ); |
|
315 | + )); |
|
316 | 316 | |
317 | 317 | return $give_forms; |
318 | 318 | } |
@@ -527,7 +527,7 @@ discard block |
||
527 | 527 | * and redirect back to the donor interface for feedback |
528 | 528 | * |
529 | 529 | * @since 1.7 |
530 | - * @return bool|null |
|
530 | + * @return false|null |
|
531 | 531 | */ |
532 | 532 | function give_remove_donor_email() { |
533 | 533 | if ( empty( $_GET['id'] ) || ! is_numeric( $_GET['id'] ) ) { |
@@ -568,7 +568,7 @@ discard block |
||
568 | 568 | * and redirect back to the donor interface for feedback |
569 | 569 | * |
570 | 570 | * @since 1.7 |
571 | - * @return bool|null |
|
571 | + * @return false|null |
|
572 | 572 | */ |
573 | 573 | function give_set_donor_primary_email() { |
574 | 574 | if ( empty( $_GET['id'] ) || ! is_numeric( $_GET['id'] ) ) { |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -23,15 +23,15 @@ discard block |
||
23 | 23 | * |
24 | 24 | * @return array $output Response messages |
25 | 25 | */ |
26 | -function give_edit_customer( $args ) { |
|
26 | +function give_edit_customer($args) { |
|
27 | 27 | |
28 | - $customer_edit_role = apply_filters( 'give_edit_customers_role', 'edit_give_payments' ); |
|
28 | + $customer_edit_role = apply_filters('give_edit_customers_role', 'edit_give_payments'); |
|
29 | 29 | |
30 | - if ( ! is_admin() || ! current_user_can( $customer_edit_role ) ) { |
|
31 | - wp_die( esc_html__( 'You do not have permission to edit this donor.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
30 | + if ( ! is_admin() || ! current_user_can($customer_edit_role)) { |
|
31 | + wp_die(esc_html__('You do not have permission to edit this donor.', 'give'), esc_html__('Error', 'give'), array('response' => 403)); |
|
32 | 32 | } |
33 | 33 | |
34 | - if ( empty( $args ) ) { |
|
34 | + if (empty($args)) { |
|
35 | 35 | return; |
36 | 36 | } |
37 | 37 | |
@@ -39,12 +39,12 @@ discard block |
||
39 | 39 | $customer_id = (int) $args['customerinfo']['id']; |
40 | 40 | $nonce = $args['_wpnonce']; |
41 | 41 | |
42 | - if ( ! wp_verify_nonce( $nonce, 'edit-customer' ) ) { |
|
43 | - wp_die( esc_html__( 'Cheatin’ uh?', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 400 ) ); |
|
42 | + if ( ! wp_verify_nonce($nonce, 'edit-customer')) { |
|
43 | + wp_die(esc_html__('Cheatin’ uh?', 'give'), esc_html__('Error', 'give'), array('response' => 400)); |
|
44 | 44 | } |
45 | 45 | |
46 | - $customer = new Give_Customer( $customer_id ); |
|
47 | - if ( empty( $customer->id ) ) { |
|
46 | + $customer = new Give_Customer($customer_id); |
|
47 | + if (empty($customer->id)) { |
|
48 | 48 | return false; |
49 | 49 | } |
50 | 50 | |
@@ -53,70 +53,70 @@ discard block |
||
53 | 53 | 'user_id' => 0, |
54 | 54 | ); |
55 | 55 | |
56 | - $customer_info = wp_parse_args( $customer_info, $defaults ); |
|
56 | + $customer_info = wp_parse_args($customer_info, $defaults); |
|
57 | 57 | |
58 | - if ( (int) $customer_info['user_id'] != (int) $customer->user_id ) { |
|
58 | + if ((int) $customer_info['user_id'] != (int) $customer->user_id) { |
|
59 | 59 | |
60 | 60 | // Make sure we don't already have this user attached to a customer |
61 | - if ( ! empty( $customer_info['user_id'] ) && false !== Give()->customers->get_customer_by( 'user_id', $customer_info['user_id'] ) ) { |
|
62 | - give_set_error( 'give-invalid-customer-user_id', sprintf( esc_html__( 'The User ID %d is already associated with a different donor.', 'give' ), $customer_info['user_id'] ) ); |
|
61 | + if ( ! empty($customer_info['user_id']) && false !== Give()->customers->get_customer_by('user_id', $customer_info['user_id'])) { |
|
62 | + give_set_error('give-invalid-customer-user_id', sprintf(esc_html__('The User ID %d is already associated with a different donor.', 'give'), $customer_info['user_id'])); |
|
63 | 63 | } |
64 | 64 | |
65 | 65 | // Make sure it's actually a user |
66 | - $user = get_user_by( 'id', $customer_info['user_id'] ); |
|
67 | - if ( ! empty( $customer_info['user_id'] ) && false === $user ) { |
|
68 | - give_set_error( 'give-invalid-user_id', sprintf( esc_html__( 'The User ID %d does not exist. Please assign an existing user.', 'give' ), $customer_info['user_id'] ) ); |
|
66 | + $user = get_user_by('id', $customer_info['user_id']); |
|
67 | + if ( ! empty($customer_info['user_id']) && false === $user) { |
|
68 | + give_set_error('give-invalid-user_id', sprintf(esc_html__('The User ID %d does not exist. Please assign an existing user.', 'give'), $customer_info['user_id'])); |
|
69 | 69 | } |
70 | 70 | } |
71 | 71 | |
72 | 72 | // Record this for later |
73 | 73 | $previous_user_id = $customer->user_id; |
74 | 74 | |
75 | - if ( give_get_errors() ) { |
|
75 | + if (give_get_errors()) { |
|
76 | 76 | return; |
77 | 77 | } |
78 | 78 | |
79 | 79 | // Setup the customer address, if present |
80 | 80 | $address = array(); |
81 | - if ( intval( $customer_info['user_id'] ) > 0 ) { |
|
81 | + if (intval($customer_info['user_id']) > 0) { |
|
82 | 82 | |
83 | - $current_address = get_user_meta( $customer_info['user_id'], '_give_user_address', true ); |
|
83 | + $current_address = get_user_meta($customer_info['user_id'], '_give_user_address', true); |
|
84 | 84 | |
85 | - if ( false === $current_address ) { |
|
86 | - $address['line1'] = isset( $customer_info['line1'] ) ? $customer_info['line1'] : ''; |
|
87 | - $address['line2'] = isset( $customer_info['line2'] ) ? $customer_info['line2'] : ''; |
|
88 | - $address['city'] = isset( $customer_info['city'] ) ? $customer_info['city'] : ''; |
|
89 | - $address['country'] = isset( $customer_info['country'] ) ? $customer_info['country'] : ''; |
|
90 | - $address['zip'] = isset( $customer_info['zip'] ) ? $customer_info['zip'] : ''; |
|
91 | - $address['state'] = isset( $customer_info['state'] ) ? $customer_info['state'] : ''; |
|
85 | + if (false === $current_address) { |
|
86 | + $address['line1'] = isset($customer_info['line1']) ? $customer_info['line1'] : ''; |
|
87 | + $address['line2'] = isset($customer_info['line2']) ? $customer_info['line2'] : ''; |
|
88 | + $address['city'] = isset($customer_info['city']) ? $customer_info['city'] : ''; |
|
89 | + $address['country'] = isset($customer_info['country']) ? $customer_info['country'] : ''; |
|
90 | + $address['zip'] = isset($customer_info['zip']) ? $customer_info['zip'] : ''; |
|
91 | + $address['state'] = isset($customer_info['state']) ? $customer_info['state'] : ''; |
|
92 | 92 | } else { |
93 | - $current_address = wp_parse_args( $current_address, array( |
|
93 | + $current_address = wp_parse_args($current_address, array( |
|
94 | 94 | 'line1', |
95 | 95 | 'line2', |
96 | 96 | 'city', |
97 | 97 | 'zip', |
98 | 98 | 'state', |
99 | 99 | 'country', |
100 | - ) ); |
|
101 | - $address['line1'] = isset( $customer_info['line1'] ) ? $customer_info['line1'] : $current_address['line1']; |
|
102 | - $address['line2'] = isset( $customer_info['line2'] ) ? $customer_info['line2'] : $current_address['line2']; |
|
103 | - $address['city'] = isset( $customer_info['city'] ) ? $customer_info['city'] : $current_address['city']; |
|
104 | - $address['country'] = isset( $customer_info['country'] ) ? $customer_info['country'] : $current_address['country']; |
|
105 | - $address['zip'] = isset( $customer_info['zip'] ) ? $customer_info['zip'] : $current_address['zip']; |
|
106 | - $address['state'] = isset( $customer_info['state'] ) ? $customer_info['state'] : $current_address['state']; |
|
100 | + )); |
|
101 | + $address['line1'] = isset($customer_info['line1']) ? $customer_info['line1'] : $current_address['line1']; |
|
102 | + $address['line2'] = isset($customer_info['line2']) ? $customer_info['line2'] : $current_address['line2']; |
|
103 | + $address['city'] = isset($customer_info['city']) ? $customer_info['city'] : $current_address['city']; |
|
104 | + $address['country'] = isset($customer_info['country']) ? $customer_info['country'] : $current_address['country']; |
|
105 | + $address['zip'] = isset($customer_info['zip']) ? $customer_info['zip'] : $current_address['zip']; |
|
106 | + $address['state'] = isset($customer_info['state']) ? $customer_info['state'] : $current_address['state']; |
|
107 | 107 | } |
108 | 108 | } |
109 | 109 | |
110 | 110 | // Sanitize the inputs |
111 | 111 | $customer_data = array(); |
112 | - $customer_data['name'] = strip_tags( stripslashes( $customer_info['name'] ) ); |
|
112 | + $customer_data['name'] = strip_tags(stripslashes($customer_info['name'])); |
|
113 | 113 | $customer_data['user_id'] = $customer_info['user_id']; |
114 | 114 | |
115 | - $customer_data = apply_filters( 'give_edit_customer_info', $customer_data, $customer_id ); |
|
116 | - $address = apply_filters( 'give_edit_customer_address', $address, $customer_id ); |
|
115 | + $customer_data = apply_filters('give_edit_customer_info', $customer_data, $customer_id); |
|
116 | + $address = apply_filters('give_edit_customer_address', $address, $customer_id); |
|
117 | 117 | |
118 | - $customer_data = array_map( 'sanitize_text_field', $customer_data ); |
|
119 | - $address = array_map( 'sanitize_text_field', $address ); |
|
118 | + $customer_data = array_map('sanitize_text_field', $customer_data); |
|
119 | + $address = array_map('sanitize_text_field', $address); |
|
120 | 120 | |
121 | 121 | /** |
122 | 122 | * Fires before editing customer. |
@@ -127,27 +127,27 @@ discard block |
||
127 | 127 | * @param array $customer_data The customer data. |
128 | 128 | * @param array $address The customer address. |
129 | 129 | */ |
130 | - do_action( 'give_pre_edit_customer', $customer_id, $customer_data, $address ); |
|
130 | + do_action('give_pre_edit_customer', $customer_id, $customer_data, $address); |
|
131 | 131 | |
132 | 132 | $output = array(); |
133 | 133 | |
134 | - if ( $customer->update( $customer_data ) ) { |
|
134 | + if ($customer->update($customer_data)) { |
|
135 | 135 | |
136 | - if ( ! empty( $customer->user_id ) && $customer->user_id > 0 ) { |
|
137 | - update_user_meta( $customer->user_id, '_give_user_address', $address ); |
|
136 | + if ( ! empty($customer->user_id) && $customer->user_id > 0) { |
|
137 | + update_user_meta($customer->user_id, '_give_user_address', $address); |
|
138 | 138 | } |
139 | 139 | |
140 | 140 | // Update some donation meta if we need to |
141 | - $payments_array = explode( ',', $customer->payment_ids ); |
|
141 | + $payments_array = explode(',', $customer->payment_ids); |
|
142 | 142 | |
143 | - if ( $customer->user_id != $previous_user_id ) { |
|
144 | - foreach ( $payments_array as $payment_id ) { |
|
145 | - give_update_payment_meta( $payment_id, '_give_payment_user_id', $customer->user_id ); |
|
143 | + if ($customer->user_id != $previous_user_id) { |
|
144 | + foreach ($payments_array as $payment_id) { |
|
145 | + give_update_payment_meta($payment_id, '_give_payment_user_id', $customer->user_id); |
|
146 | 146 | } |
147 | 147 | } |
148 | 148 | |
149 | 149 | $output['success'] = true; |
150 | - $customer_data = array_merge( $customer_data, $address ); |
|
150 | + $customer_data = array_merge($customer_data, $address); |
|
151 | 151 | $output['customer_info'] = $customer_data; |
152 | 152 | |
153 | 153 | } else { |
@@ -164,11 +164,11 @@ discard block |
||
164 | 164 | * @param int $customer_id The ID of the customer. |
165 | 165 | * @param array $customer_data The customer data. |
166 | 166 | */ |
167 | - do_action( 'give_post_edit_customer', $customer_id, $customer_data ); |
|
167 | + do_action('give_post_edit_customer', $customer_id, $customer_data); |
|
168 | 168 | |
169 | - if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) { |
|
170 | - header( 'Content-Type: application/json' ); |
|
171 | - echo json_encode( $output ); |
|
169 | + if (defined('DOING_AJAX') && DOING_AJAX) { |
|
170 | + header('Content-Type: application/json'); |
|
171 | + echo json_encode($output); |
|
172 | 172 | wp_die(); |
173 | 173 | } |
174 | 174 | |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | |
177 | 177 | } |
178 | 178 | |
179 | -add_action( 'give_edit-customer', 'give_edit_customer', 10, 1 ); |
|
179 | +add_action('give_edit-customer', 'give_edit_customer', 10, 1); |
|
180 | 180 | |
181 | 181 | /** |
182 | 182 | * Save a customer note being added |
@@ -187,36 +187,36 @@ discard block |
||
187 | 187 | * |
188 | 188 | * @return int The Note ID that was saved, or 0 if nothing was saved |
189 | 189 | */ |
190 | -function give_customer_save_note( $args ) { |
|
190 | +function give_customer_save_note($args) { |
|
191 | 191 | |
192 | - $customer_view_role = apply_filters( 'give_view_customers_role', 'view_give_reports' ); |
|
192 | + $customer_view_role = apply_filters('give_view_customers_role', 'view_give_reports'); |
|
193 | 193 | |
194 | - if ( ! is_admin() || ! current_user_can( $customer_view_role ) ) { |
|
195 | - wp_die( esc_html__( 'You do not have permission to edit this donor.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
194 | + if ( ! is_admin() || ! current_user_can($customer_view_role)) { |
|
195 | + wp_die(esc_html__('You do not have permission to edit this donor.', 'give'), esc_html__('Error', 'give'), array('response' => 403)); |
|
196 | 196 | } |
197 | 197 | |
198 | - if ( empty( $args ) ) { |
|
198 | + if (empty($args)) { |
|
199 | 199 | return; |
200 | 200 | } |
201 | 201 | |
202 | - $customer_note = trim( sanitize_text_field( $args['customer_note'] ) ); |
|
202 | + $customer_note = trim(sanitize_text_field($args['customer_note'])); |
|
203 | 203 | $customer_id = (int) $args['customer_id']; |
204 | 204 | $nonce = $args['add_customer_note_nonce']; |
205 | 205 | |
206 | - if ( ! wp_verify_nonce( $nonce, 'add-customer-note' ) ) { |
|
207 | - wp_die( esc_html__( 'Cheatin’ uh?', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 400 ) ); |
|
206 | + if ( ! wp_verify_nonce($nonce, 'add-customer-note')) { |
|
207 | + wp_die(esc_html__('Cheatin’ uh?', 'give'), esc_html__('Error', 'give'), array('response' => 400)); |
|
208 | 208 | } |
209 | 209 | |
210 | - if ( empty( $customer_note ) ) { |
|
211 | - give_set_error( 'empty-customer-note', esc_html__( 'A note is required.', 'give' ) ); |
|
210 | + if (empty($customer_note)) { |
|
211 | + give_set_error('empty-customer-note', esc_html__('A note is required.', 'give')); |
|
212 | 212 | } |
213 | 213 | |
214 | - if ( give_get_errors() ) { |
|
214 | + if (give_get_errors()) { |
|
215 | 215 | return; |
216 | 216 | } |
217 | 217 | |
218 | - $customer = new Give_Customer( $customer_id ); |
|
219 | - $new_note = $customer->add_note( $customer_note ); |
|
218 | + $customer = new Give_Customer($customer_id); |
|
219 | + $new_note = $customer->add_note($customer_note); |
|
220 | 220 | |
221 | 221 | /** |
222 | 222 | * Fires before inserting customer note. |
@@ -226,22 +226,22 @@ discard block |
||
226 | 226 | * @param int $customer_id The ID of the customer. |
227 | 227 | * @param string $new_note Note content. |
228 | 228 | */ |
229 | - do_action( 'give_pre_insert_customer_note', $customer_id, $new_note ); |
|
229 | + do_action('give_pre_insert_customer_note', $customer_id, $new_note); |
|
230 | 230 | |
231 | - if ( ! empty( $new_note ) && ! empty( $customer->id ) ) { |
|
231 | + if ( ! empty($new_note) && ! empty($customer->id)) { |
|
232 | 232 | |
233 | 233 | ob_start(); |
234 | 234 | ?> |
235 | 235 | <div class="customer-note-wrapper dashboard-comment-wrap comment-item"> |
236 | 236 | <span class="note-content-wrap"> |
237 | - <?php echo stripslashes( $new_note ); ?> |
|
237 | + <?php echo stripslashes($new_note); ?> |
|
238 | 238 | </span> |
239 | 239 | </div> |
240 | 240 | <?php |
241 | 241 | $output = ob_get_contents(); |
242 | 242 | ob_end_clean(); |
243 | 243 | |
244 | - if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) { |
|
244 | + if (defined('DOING_AJAX') && DOING_AJAX) { |
|
245 | 245 | echo $output; |
246 | 246 | exit; |
247 | 247 | } |
@@ -254,7 +254,7 @@ discard block |
||
254 | 254 | |
255 | 255 | } |
256 | 256 | |
257 | -add_action( 'give_add-customer-note', 'give_customer_save_note', 10, 1 ); |
|
257 | +add_action('give_add-customer-note', 'give_customer_save_note', 10, 1); |
|
258 | 258 | |
259 | 259 | /** |
260 | 260 | * Delete a customer |
@@ -265,37 +265,37 @@ discard block |
||
265 | 265 | * |
266 | 266 | * @return int Whether it was a successful deletion |
267 | 267 | */ |
268 | -function give_customer_delete( $args ) { |
|
268 | +function give_customer_delete($args) { |
|
269 | 269 | |
270 | - $customer_edit_role = apply_filters( 'give_edit_customers_role', 'edit_give_payments' ); |
|
270 | + $customer_edit_role = apply_filters('give_edit_customers_role', 'edit_give_payments'); |
|
271 | 271 | |
272 | - if ( ! is_admin() || ! current_user_can( $customer_edit_role ) ) { |
|
273 | - wp_die( esc_html__( 'You do not have permission to delete donors.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
272 | + if ( ! is_admin() || ! current_user_can($customer_edit_role)) { |
|
273 | + wp_die(esc_html__('You do not have permission to delete donors.', 'give'), esc_html__('Error', 'give'), array('response' => 403)); |
|
274 | 274 | } |
275 | 275 | |
276 | - if ( empty( $args ) ) { |
|
276 | + if (empty($args)) { |
|
277 | 277 | return; |
278 | 278 | } |
279 | 279 | |
280 | 280 | $customer_id = (int) $args['customer_id']; |
281 | - $confirm = ! empty( $args['give-customer-delete-confirm'] ) ? true : false; |
|
282 | - $remove_data = ! empty( $args['give-customer-delete-records'] ) ? true : false; |
|
281 | + $confirm = ! empty($args['give-customer-delete-confirm']) ? true : false; |
|
282 | + $remove_data = ! empty($args['give-customer-delete-records']) ? true : false; |
|
283 | 283 | $nonce = $args['_wpnonce']; |
284 | 284 | |
285 | - if ( ! wp_verify_nonce( $nonce, 'delete-customer' ) ) { |
|
286 | - wp_die( esc_html__( 'Cheatin’ uh?', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 400 ) ); |
|
285 | + if ( ! wp_verify_nonce($nonce, 'delete-customer')) { |
|
286 | + wp_die(esc_html__('Cheatin’ uh?', 'give'), esc_html__('Error', 'give'), array('response' => 400)); |
|
287 | 287 | } |
288 | 288 | |
289 | - if ( ! $confirm ) { |
|
290 | - give_set_error( 'customer-delete-no-confirm', esc_html__( 'Please confirm you want to delete this donor.', 'give' ) ); |
|
289 | + if ( ! $confirm) { |
|
290 | + give_set_error('customer-delete-no-confirm', esc_html__('Please confirm you want to delete this donor.', 'give')); |
|
291 | 291 | } |
292 | 292 | |
293 | - if ( give_get_errors() ) { |
|
294 | - wp_redirect( admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $customer_id ) ); |
|
293 | + if (give_get_errors()) { |
|
294 | + wp_redirect(admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$customer_id)); |
|
295 | 295 | exit; |
296 | 296 | } |
297 | 297 | |
298 | - $customer = new Give_Customer( $customer_id ); |
|
298 | + $customer = new Give_Customer($customer_id); |
|
299 | 299 | |
300 | 300 | /** |
301 | 301 | * Fires before deleting customer. |
@@ -306,50 +306,50 @@ discard block |
||
306 | 306 | * @param bool $confirm Delete confirmation. |
307 | 307 | * @param bool $remove_data Records delete confirmation. |
308 | 308 | */ |
309 | - do_action( 'give_pre_delete_customer', $customer_id, $confirm, $remove_data ); |
|
309 | + do_action('give_pre_delete_customer', $customer_id, $confirm, $remove_data); |
|
310 | 310 | |
311 | - if ( $customer->id > 0 ) { |
|
311 | + if ($customer->id > 0) { |
|
312 | 312 | |
313 | - $payments_array = explode( ',', $customer->payment_ids ); |
|
314 | - $success = Give()->customers->delete( $customer->id ); |
|
313 | + $payments_array = explode(',', $customer->payment_ids); |
|
314 | + $success = Give()->customers->delete($customer->id); |
|
315 | 315 | |
316 | - if ( $success ) { |
|
316 | + if ($success) { |
|
317 | 317 | |
318 | - if ( $remove_data ) { |
|
318 | + if ($remove_data) { |
|
319 | 319 | |
320 | 320 | // Remove all donations, logs, etc |
321 | - foreach ( $payments_array as $payment_id ) { |
|
322 | - give_delete_purchase( $payment_id ); |
|
321 | + foreach ($payments_array as $payment_id) { |
|
322 | + give_delete_purchase($payment_id); |
|
323 | 323 | } |
324 | 324 | } else { |
325 | 325 | |
326 | 326 | // Just set the donations to customer_id of 0 |
327 | - foreach ( $payments_array as $payment_id ) { |
|
328 | - give_update_payment_meta( $payment_id, '_give_payment_customer_id', 0 ); |
|
327 | + foreach ($payments_array as $payment_id) { |
|
328 | + give_update_payment_meta($payment_id, '_give_payment_customer_id', 0); |
|
329 | 329 | } |
330 | 330 | } |
331 | 331 | |
332 | - $redirect = admin_url( 'edit.php?post_type=give_forms&page=give-donors&give-message=customer-deleted' ); |
|
332 | + $redirect = admin_url('edit.php?post_type=give_forms&page=give-donors&give-message=customer-deleted'); |
|
333 | 333 | |
334 | 334 | } else { |
335 | 335 | |
336 | - give_set_error( 'give-donor-delete-failed', esc_html__( 'Error deleting donor.', 'give' ) ); |
|
337 | - $redirect = admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=delete&id=' . $customer_id ); |
|
336 | + give_set_error('give-donor-delete-failed', esc_html__('Error deleting donor.', 'give')); |
|
337 | + $redirect = admin_url('edit.php?post_type=give_forms&page=give-donors&view=delete&id='.$customer_id); |
|
338 | 338 | |
339 | 339 | } |
340 | 340 | } else { |
341 | 341 | |
342 | - give_set_error( 'give-customer-delete-invalid-id', esc_html__( 'Invalid Donor ID.', 'give' ) ); |
|
343 | - $redirect = admin_url( 'edit.php?post_type=give_forms&page=give-donors' ); |
|
342 | + give_set_error('give-customer-delete-invalid-id', esc_html__('Invalid Donor ID.', 'give')); |
|
343 | + $redirect = admin_url('edit.php?post_type=give_forms&page=give-donors'); |
|
344 | 344 | |
345 | 345 | } |
346 | 346 | |
347 | - wp_redirect( $redirect ); |
|
347 | + wp_redirect($redirect); |
|
348 | 348 | exit; |
349 | 349 | |
350 | 350 | } |
351 | 351 | |
352 | -add_action( 'give_delete-customer', 'give_customer_delete', 10, 1 ); |
|
352 | +add_action('give_delete-customer', 'give_customer_delete', 10, 1); |
|
353 | 353 | |
354 | 354 | /** |
355 | 355 | * Disconnect a user ID from a donor |
@@ -360,27 +360,27 @@ discard block |
||
360 | 360 | * |
361 | 361 | * @return bool If the disconnect was successful |
362 | 362 | */ |
363 | -function give_disconnect_customer_user_id( $args ) { |
|
363 | +function give_disconnect_customer_user_id($args) { |
|
364 | 364 | |
365 | - $customer_edit_role = apply_filters( 'give_edit_customers_role', 'edit_give_payments' ); |
|
365 | + $customer_edit_role = apply_filters('give_edit_customers_role', 'edit_give_payments'); |
|
366 | 366 | |
367 | - if ( ! is_admin() || ! current_user_can( $customer_edit_role ) ) { |
|
368 | - wp_die( esc_html__( 'You do not have permission to edit this donor.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
367 | + if ( ! is_admin() || ! current_user_can($customer_edit_role)) { |
|
368 | + wp_die(esc_html__('You do not have permission to edit this donor.', 'give'), esc_html__('Error', 'give'), array('response' => 403)); |
|
369 | 369 | } |
370 | 370 | |
371 | - if ( empty( $args ) ) { |
|
371 | + if (empty($args)) { |
|
372 | 372 | return; |
373 | 373 | } |
374 | 374 | |
375 | 375 | $customer_id = (int) $args['customer_id']; |
376 | 376 | $nonce = $args['_wpnonce']; |
377 | 377 | |
378 | - if ( ! wp_verify_nonce( $nonce, 'edit-customer' ) ) { |
|
379 | - wp_die( esc_html__( 'Cheatin’ uh?', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 400 ) ); |
|
378 | + if ( ! wp_verify_nonce($nonce, 'edit-customer')) { |
|
379 | + wp_die(esc_html__('Cheatin’ uh?', 'give'), esc_html__('Error', 'give'), array('response' => 400)); |
|
380 | 380 | } |
381 | 381 | |
382 | - $customer = new Give_Customer( $customer_id ); |
|
383 | - if ( empty( $customer->id ) ) { |
|
382 | + $customer = new Give_Customer($customer_id); |
|
383 | + if (empty($customer->id)) { |
|
384 | 384 | return false; |
385 | 385 | } |
386 | 386 | |
@@ -394,16 +394,16 @@ discard block |
||
394 | 394 | * @param int $customer_id The ID of the customer. |
395 | 395 | * @param int $user_id The ID of the user. |
396 | 396 | */ |
397 | - do_action( 'give_pre_customer_disconnect_user_id', $customer_id, $user_id ); |
|
397 | + do_action('give_pre_customer_disconnect_user_id', $customer_id, $user_id); |
|
398 | 398 | |
399 | 399 | $output = array(); |
400 | - $customer_args = array( 'user_id' => 0 ); |
|
400 | + $customer_args = array('user_id' => 0); |
|
401 | 401 | |
402 | - if ( $customer->update( $customer_args ) ) { |
|
402 | + if ($customer->update($customer_args)) { |
|
403 | 403 | global $wpdb; |
404 | 404 | |
405 | - if ( ! empty( $customer->payment_ids ) ) { |
|
406 | - $wpdb->query( "UPDATE $wpdb->postmeta SET meta_value = 0 WHERE meta_key = '_give_payment_user_id' AND post_id IN ( $customer->payment_ids )" ); |
|
405 | + if ( ! empty($customer->payment_ids)) { |
|
406 | + $wpdb->query("UPDATE $wpdb->postmeta SET meta_value = 0 WHERE meta_key = '_give_payment_user_id' AND post_id IN ( $customer->payment_ids )"); |
|
407 | 407 | } |
408 | 408 | |
409 | 409 | $output['success'] = true; |
@@ -411,7 +411,7 @@ discard block |
||
411 | 411 | } else { |
412 | 412 | |
413 | 413 | $output['success'] = false; |
414 | - give_set_error( 'give-disconnect-user-fail', esc_html__( 'Failed to disconnect user from donor.', 'give' ) ); |
|
414 | + give_set_error('give-disconnect-user-fail', esc_html__('Failed to disconnect user from donor.', 'give')); |
|
415 | 415 | } |
416 | 416 | |
417 | 417 | /** |
@@ -421,11 +421,11 @@ discard block |
||
421 | 421 | * |
422 | 422 | * @param int $customer_id The ID of the customer. |
423 | 423 | */ |
424 | - do_action( 'give_post_customer_disconnect_user_id', $customer_id ); |
|
424 | + do_action('give_post_customer_disconnect_user_id', $customer_id); |
|
425 | 425 | |
426 | - if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) { |
|
427 | - header( 'Content-Type: application/json' ); |
|
428 | - echo json_encode( $output ); |
|
426 | + if (defined('DOING_AJAX') && DOING_AJAX) { |
|
427 | + header('Content-Type: application/json'); |
|
428 | + echo json_encode($output); |
|
429 | 429 | wp_die(); |
430 | 430 | } |
431 | 431 | |
@@ -433,7 +433,7 @@ discard block |
||
433 | 433 | |
434 | 434 | } |
435 | 435 | |
436 | -add_action( 'give_disconnect-userid', 'give_disconnect_customer_user_id', 10, 1 ); |
|
436 | +add_action('give_disconnect-userid', 'give_disconnect_customer_user_id', 10, 1); |
|
437 | 437 | |
438 | 438 | /** |
439 | 439 | * Add an email address to the donor from within the admin and log a donor note |
@@ -444,82 +444,82 @@ discard block |
||
444 | 444 | * |
445 | 445 | * @return mixed If DOING_AJAX echos out JSON, otherwise returns array of success (bool) and message (string) |
446 | 446 | */ |
447 | -function give_add_donor_email( $args ) { |
|
448 | - $customer_edit_role = apply_filters( 'give_edit_customers_role', 'edit_give_payments' ); |
|
447 | +function give_add_donor_email($args) { |
|
448 | + $customer_edit_role = apply_filters('give_edit_customers_role', 'edit_give_payments'); |
|
449 | 449 | |
450 | - if ( ! is_admin() || ! current_user_can( $customer_edit_role ) ) { |
|
451 | - wp_die( esc_html__( 'You do not have permission to edit this donor.', 'edit' ) ); |
|
450 | + if ( ! is_admin() || ! current_user_can($customer_edit_role)) { |
|
451 | + wp_die(esc_html__('You do not have permission to edit this donor.', 'edit')); |
|
452 | 452 | } |
453 | 453 | |
454 | 454 | $output = array(); |
455 | - if ( empty( $args ) || empty( $args['email'] ) || empty( $args['customer_id'] ) ) { |
|
455 | + if (empty($args) || empty($args['email']) || empty($args['customer_id'])) { |
|
456 | 456 | $output['success'] = false; |
457 | - if ( empty( $args['email'] ) ) { |
|
458 | - $output['message'] = esc_html__( 'Email address is required.', 'give' ); |
|
459 | - } elseif ( empty( $args['customer_id'] ) ) { |
|
460 | - $output['message'] = esc_html__( 'Customer ID is required.', 'give' ); |
|
457 | + if (empty($args['email'])) { |
|
458 | + $output['message'] = esc_html__('Email address is required.', 'give'); |
|
459 | + } elseif (empty($args['customer_id'])) { |
|
460 | + $output['message'] = esc_html__('Customer ID is required.', 'give'); |
|
461 | 461 | } else { |
462 | - $output['message'] = esc_html__( 'An error has occurred. Please try again.', 'give' ); |
|
462 | + $output['message'] = esc_html__('An error has occurred. Please try again.', 'give'); |
|
463 | 463 | } |
464 | - } elseif ( ! wp_verify_nonce( $args['_wpnonce'], 'give_add_donor_email' ) ) { |
|
464 | + } elseif ( ! wp_verify_nonce($args['_wpnonce'], 'give_add_donor_email')) { |
|
465 | 465 | $output = array( |
466 | 466 | 'success' => false, |
467 | - 'message' => esc_html__( 'Nonce verification failed.', 'give' ), |
|
467 | + 'message' => esc_html__('Nonce verification failed.', 'give'), |
|
468 | 468 | ); |
469 | - } elseif ( ! is_email( $args['email'] ) ) { |
|
469 | + } elseif ( ! is_email($args['email'])) { |
|
470 | 470 | $output = array( |
471 | 471 | 'success' => false, |
472 | - 'message' => esc_html__( 'Invalid email.', 'give' ), |
|
472 | + 'message' => esc_html__('Invalid email.', 'give'), |
|
473 | 473 | ); |
474 | 474 | } else { |
475 | - $email = sanitize_email( $args['email'] ); |
|
475 | + $email = sanitize_email($args['email']); |
|
476 | 476 | $customer_id = (int) $args['customer_id']; |
477 | 477 | $primary = 'true' === $args['primary'] ? true : false; |
478 | - $customer = new Give_Customer( $customer_id ); |
|
479 | - if ( false === $customer->add_email( $email, $primary ) ) { |
|
480 | - if ( in_array( $email, $customer->emails ) ) { |
|
478 | + $customer = new Give_Customer($customer_id); |
|
479 | + if (false === $customer->add_email($email, $primary)) { |
|
480 | + if (in_array($email, $customer->emails)) { |
|
481 | 481 | $output = array( |
482 | 482 | 'success' => false, |
483 | - 'message' => esc_html__( 'Email already associated with this donor.', 'give' ), |
|
483 | + 'message' => esc_html__('Email already associated with this donor.', 'give'), |
|
484 | 484 | ); |
485 | 485 | } else { |
486 | 486 | $output = array( |
487 | 487 | 'success' => false, |
488 | - 'message' => esc_html__( 'Email address is already associated with another donor.', 'give' ), |
|
488 | + 'message' => esc_html__('Email address is already associated with another donor.', 'give'), |
|
489 | 489 | ); |
490 | 490 | } |
491 | 491 | } else { |
492 | - $redirect = admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $customer_id . '&give-message=email-added' ); |
|
492 | + $redirect = admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$customer_id.'&give-message=email-added'); |
|
493 | 493 | $output = array( |
494 | 494 | 'success' => true, |
495 | - 'message' => esc_html__( 'Email successfully added to donor.', 'give' ), |
|
495 | + 'message' => esc_html__('Email successfully added to donor.', 'give'), |
|
496 | 496 | 'redirect' => $redirect, |
497 | 497 | ); |
498 | 498 | |
499 | 499 | $user = wp_get_current_user(); |
500 | - $user_login = ! empty( $user->user_login ) ? $user->user_login : esc_html__( 'System', 'give' ); |
|
501 | - $customer_note = sprintf( __( 'Email address %1$s added by %2$s', 'give' ), $email, $user_login ); |
|
502 | - $customer->add_note( $customer_note ); |
|
500 | + $user_login = ! empty($user->user_login) ? $user->user_login : esc_html__('System', 'give'); |
|
501 | + $customer_note = sprintf(__('Email address %1$s added by %2$s', 'give'), $email, $user_login); |
|
502 | + $customer->add_note($customer_note); |
|
503 | 503 | |
504 | - if ( $primary ) { |
|
505 | - $customer_note = sprintf( __( 'Email address %1$s set as primary by %2$s', 'give' ), $email, $user_login ); |
|
506 | - $customer->add_note( $customer_note ); |
|
504 | + if ($primary) { |
|
505 | + $customer_note = sprintf(__('Email address %1$s set as primary by %2$s', 'give'), $email, $user_login); |
|
506 | + $customer->add_note($customer_note); |
|
507 | 507 | } |
508 | 508 | } |
509 | 509 | } |
510 | 510 | |
511 | - do_action( 'give_post_add_customer_email', $customer_id, $args ); |
|
511 | + do_action('give_post_add_customer_email', $customer_id, $args); |
|
512 | 512 | |
513 | - if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) { |
|
514 | - header( 'Content-Type: application/json' ); |
|
515 | - echo json_encode( $output ); |
|
513 | + if (defined('DOING_AJAX') && DOING_AJAX) { |
|
514 | + header('Content-Type: application/json'); |
|
515 | + echo json_encode($output); |
|
516 | 516 | wp_die(); |
517 | 517 | } |
518 | 518 | |
519 | 519 | return $output; |
520 | 520 | } |
521 | 521 | |
522 | -add_action( 'give_add_donor_email', 'give_add_donor_email', 10, 1 ); |
|
522 | +add_action('give_add_donor_email', 'give_add_donor_email', 10, 1); |
|
523 | 523 | |
524 | 524 | |
525 | 525 | /** |
@@ -530,37 +530,37 @@ discard block |
||
530 | 530 | * @return bool|null |
531 | 531 | */ |
532 | 532 | function give_remove_donor_email() { |
533 | - if ( empty( $_GET['id'] ) || ! is_numeric( $_GET['id'] ) ) { |
|
533 | + if (empty($_GET['id']) || ! is_numeric($_GET['id'])) { |
|
534 | 534 | return false; |
535 | 535 | } |
536 | - if ( empty( $_GET['email'] ) || ! is_email( $_GET['email'] ) ) { |
|
536 | + if (empty($_GET['email']) || ! is_email($_GET['email'])) { |
|
537 | 537 | return false; |
538 | 538 | } |
539 | - if ( empty( $_GET['_wpnonce'] ) ) { |
|
539 | + if (empty($_GET['_wpnonce'])) { |
|
540 | 540 | return false; |
541 | 541 | } |
542 | 542 | |
543 | 543 | $nonce = $_GET['_wpnonce']; |
544 | - if ( ! wp_verify_nonce( $nonce, 'give-remove-donor-email' ) ) { |
|
545 | - wp_die( esc_html__( 'Nonce verification failed', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
544 | + if ( ! wp_verify_nonce($nonce, 'give-remove-donor-email')) { |
|
545 | + wp_die(esc_html__('Nonce verification failed', 'give'), esc_html__('Error', 'give'), array('response' => 403)); |
|
546 | 546 | } |
547 | 547 | |
548 | - $customer = new Give_Customer( $_GET['id'] ); |
|
549 | - if ( $customer->remove_email( $_GET['email'] ) ) { |
|
550 | - $url = add_query_arg( 'give-message', 'email-removed', admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $customer->id ) ); |
|
548 | + $customer = new Give_Customer($_GET['id']); |
|
549 | + if ($customer->remove_email($_GET['email'])) { |
|
550 | + $url = add_query_arg('give-message', 'email-removed', admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$customer->id)); |
|
551 | 551 | $user = wp_get_current_user(); |
552 | - $user_login = ! empty( $user->user_login ) ? $user->user_login : esc_html__( 'System', 'give' ); |
|
553 | - $customer_note = sprintf( __( 'Email address %1$s removed by %2$s', 'give' ), $_GET['email'], $user_login ); |
|
554 | - $customer->add_note( $customer_note ); |
|
552 | + $user_login = ! empty($user->user_login) ? $user->user_login : esc_html__('System', 'give'); |
|
553 | + $customer_note = sprintf(__('Email address %1$s removed by %2$s', 'give'), $_GET['email'], $user_login); |
|
554 | + $customer->add_note($customer_note); |
|
555 | 555 | } else { |
556 | - $url = add_query_arg( 'give-message', 'email-remove-failed', admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $customer->id ) ); |
|
556 | + $url = add_query_arg('give-message', 'email-remove-failed', admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$customer->id)); |
|
557 | 557 | } |
558 | 558 | |
559 | - wp_safe_redirect( $url ); |
|
559 | + wp_safe_redirect($url); |
|
560 | 560 | exit; |
561 | 561 | } |
562 | 562 | |
563 | -add_action( 'give_remove_donor_email', 'give_remove_donor_email', 10 ); |
|
563 | +add_action('give_remove_donor_email', 'give_remove_donor_email', 10); |
|
564 | 564 | |
565 | 565 | |
566 | 566 | /** |
@@ -571,39 +571,39 @@ discard block |
||
571 | 571 | * @return bool|null |
572 | 572 | */ |
573 | 573 | function give_set_donor_primary_email() { |
574 | - if ( empty( $_GET['id'] ) || ! is_numeric( $_GET['id'] ) ) { |
|
574 | + if (empty($_GET['id']) || ! is_numeric($_GET['id'])) { |
|
575 | 575 | return false; |
576 | 576 | } |
577 | 577 | |
578 | - if ( empty( $_GET['email'] ) || ! is_email( $_GET['email'] ) ) { |
|
578 | + if (empty($_GET['email']) || ! is_email($_GET['email'])) { |
|
579 | 579 | return false; |
580 | 580 | } |
581 | 581 | |
582 | - if ( empty( $_GET['_wpnonce'] ) ) { |
|
582 | + if (empty($_GET['_wpnonce'])) { |
|
583 | 583 | return false; |
584 | 584 | } |
585 | 585 | |
586 | 586 | $nonce = $_GET['_wpnonce']; |
587 | 587 | |
588 | - if ( ! wp_verify_nonce( $nonce, 'give-set-donor-primary-email' ) ) { |
|
589 | - wp_die( esc_html__( 'Nonce verification failed', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
588 | + if ( ! wp_verify_nonce($nonce, 'give-set-donor-primary-email')) { |
|
589 | + wp_die(esc_html__('Nonce verification failed', 'give'), esc_html__('Error', 'give'), array('response' => 403)); |
|
590 | 590 | } |
591 | 591 | |
592 | - $donor = new Give_Customer( $_GET['id'] ); |
|
592 | + $donor = new Give_Customer($_GET['id']); |
|
593 | 593 | |
594 | - if ( $donor->set_primary_email( $_GET['email'] ) ) { |
|
595 | - $url = add_query_arg( 'give-message', 'primary-email-updated', admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $donor->id ) ); |
|
594 | + if ($donor->set_primary_email($_GET['email'])) { |
|
595 | + $url = add_query_arg('give-message', 'primary-email-updated', admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$donor->id)); |
|
596 | 596 | $user = wp_get_current_user(); |
597 | - $user_login = ! empty( $user->user_login ) ? $user->user_login : esc_html__( 'System', 'give' ); |
|
598 | - $donor_note = sprintf( __( 'Email address %1$s set as primary by %2$s', 'give' ), $_GET['email'], $user_login ); |
|
597 | + $user_login = ! empty($user->user_login) ? $user->user_login : esc_html__('System', 'give'); |
|
598 | + $donor_note = sprintf(__('Email address %1$s set as primary by %2$s', 'give'), $_GET['email'], $user_login); |
|
599 | 599 | |
600 | - $donor->add_note( $donor_note ); |
|
600 | + $donor->add_note($donor_note); |
|
601 | 601 | } else { |
602 | - $url = add_query_arg( 'give-message', 'primary-email-failed', admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $donor->id ) ); |
|
602 | + $url = add_query_arg('give-message', 'primary-email-failed', admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$donor->id)); |
|
603 | 603 | } |
604 | 604 | |
605 | - wp_safe_redirect( $url ); |
|
605 | + wp_safe_redirect($url); |
|
606 | 606 | exit; |
607 | 607 | } |
608 | 608 | |
609 | -add_action( 'give_set_donor_primary_email', 'give_set_donor_primary_email', 10 ); |
|
609 | +add_action('give_set_donor_primary_email', 'give_set_donor_primary_email', 10); |