@@ -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> |
@@ -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 | |
@@ -25,10 +25,10 @@ discard block |
||
25 | 25 | ?> |
26 | 26 | |
27 | 27 | <div class="give-debug-report-wrapper"> |
28 | - <p class="give-debug-report-text"><?php echo sprintf(__( 'Please copy and paste this information in your ticket when contacting support:', 'give' )); ?> </p> |
|
28 | + <p class="give-debug-report-text"><?php echo sprintf(__('Please copy and paste this information in your ticket when contacting support:', 'give')); ?> </p> |
|
29 | 29 | <div class="give-debug-report-actions"> |
30 | - <a class="button-primary js-give-debug-report-button" href="#"><?php _e( 'Get System Report', 'give' ); ?></a> |
|
31 | - <a class="button-secondary docs" href="http://docs.givewp.com/settings-system-info" target="_blank"><?php _e( 'Understanding the System Report', 'give' ); ?> <span class="dashicons dashicons-external"></span></a> |
|
30 | + <a class="button-primary js-give-debug-report-button" href="#"><?php _e('Get System Report', 'give'); ?></a> |
|
31 | + <a class="button-secondary docs" href="http://docs.givewp.com/settings-system-info" target="_blank"><?php _e('Understanding the System Report', 'give'); ?> <span class="dashicons dashicons-external"></span></a> |
|
32 | 32 | </div> |
33 | 33 | <div class="give-debug-report js-give-debug-report"> |
34 | 34 | <textarea readonly="readonly"></textarea> |
@@ -38,56 +38,56 @@ discard block |
||
38 | 38 | <table class="give-status-table widefat" cellspacing="0" id="status"> |
39 | 39 | <thead> |
40 | 40 | <tr> |
41 | - <th colspan="3" data-export-label="WordPress Environment"><h2><?php _e( 'WordPress Environment', 'give' ); ?></h2></th> |
|
41 | + <th colspan="3" data-export-label="WordPress Environment"><h2><?php _e('WordPress Environment', 'give'); ?></h2></th> |
|
42 | 42 | </tr> |
43 | 43 | </thead> |
44 | 44 | <tbody> |
45 | 45 | <tr> |
46 | - <td data-export-label="Home URL"><?php _e( 'Home URL', 'give' ); ?>:</td> |
|
47 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'The URL of your site\'s homepage.', 'give' ) ); ?></td> |
|
48 | - <td><?php form_option( 'home' ); ?></td> |
|
46 | + <td data-export-label="Home URL"><?php _e('Home URL', 'give'); ?>:</td> |
|
47 | + <td class="help"><?php echo Give()->tooltips->render_help(__('The URL of your site\'s homepage.', 'give')); ?></td> |
|
48 | + <td><?php form_option('home'); ?></td> |
|
49 | 49 | </tr> |
50 | 50 | <tr> |
51 | - <td data-export-label="Site URL"><?php _e( 'Site URL', 'give' ); ?>:</td> |
|
52 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'The root URL of your site.', 'give' ) ); ?></td> |
|
53 | - <td><?php form_option( 'siteurl' ); ?></td> |
|
51 | + <td data-export-label="Site URL"><?php _e('Site URL', 'give'); ?>:</td> |
|
52 | + <td class="help"><?php echo Give()->tooltips->render_help(__('The root URL of your site.', 'give')); ?></td> |
|
53 | + <td><?php form_option('siteurl'); ?></td> |
|
54 | 54 | </tr> |
55 | 55 | <tr> |
56 | - <td data-export-label="WP Version"><?php _e( 'WP Version', 'give' ); ?>:</td> |
|
57 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'The version of WordPress installed on your site.', 'give' ) ); ?></td> |
|
58 | - <td><?php bloginfo( 'version' ); ?></td> |
|
56 | + <td data-export-label="WP Version"><?php _e('WP Version', 'give'); ?>:</td> |
|
57 | + <td class="help"><?php echo Give()->tooltips->render_help(__('The version of WordPress installed on your site.', 'give')); ?></td> |
|
58 | + <td><?php bloginfo('version'); ?></td> |
|
59 | 59 | </tr> |
60 | 60 | <tr> |
61 | - <td data-export-label="WP Multisite"><?php _e( 'WP Multisite', 'give' ); ?>:</td> |
|
62 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'Whether or not you have WordPress Multisite enabled.', 'give' ) ); ?></td> |
|
63 | - <td><?php if ( is_multisite() ) echo '<span class="dashicons dashicons-yes"></span>'; else echo '–'; ?></td> |
|
61 | + <td data-export-label="WP Multisite"><?php _e('WP Multisite', 'give'); ?>:</td> |
|
62 | + <td class="help"><?php echo Give()->tooltips->render_help(__('Whether or not you have WordPress Multisite enabled.', 'give')); ?></td> |
|
63 | + <td><?php if (is_multisite()) echo '<span class="dashicons dashicons-yes"></span>'; else echo '–'; ?></td> |
|
64 | 64 | |
65 | 65 | </tr> |
66 | 66 | <tr> |
67 | - <td data-export-label="WP Memory Limit"><?php _e( 'WP Memory Limit', 'give' ); ?>:</td> |
|
68 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'The maximum amount of memory (RAM) that your site can use at one time.', 'give' ) ); ?></td> |
|
67 | + <td data-export-label="WP Memory Limit"><?php _e('WP Memory Limit', 'give'); ?>:</td> |
|
68 | + <td class="help"><?php echo Give()->tooltips->render_help(__('The maximum amount of memory (RAM) that your site can use at one time.', 'give')); ?></td> |
|
69 | 69 | <td> |
70 | 70 | <?php |
71 | - $memory = give_let_to_num( WP_MEMORY_LIMIT ); |
|
71 | + $memory = give_let_to_num(WP_MEMORY_LIMIT); |
|
72 | 72 | |
73 | - if ( function_exists( 'memory_get_usage' ) ) { |
|
74 | - $system_memory = give_let_to_num( @ini_get( 'memory_limit' ) ); |
|
75 | - $memory = max( $memory, $system_memory ); |
|
73 | + if (function_exists('memory_get_usage')) { |
|
74 | + $system_memory = give_let_to_num(@ini_get('memory_limit')); |
|
75 | + $memory = max($memory, $system_memory); |
|
76 | 76 | } |
77 | 77 | |
78 | - if ( $memory < 67108864 ) { |
|
79 | - 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>'; |
|
78 | + if ($memory < 67108864) { |
|
79 | + 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>'; |
|
80 | 80 | } else { |
81 | - echo '<mark class="yes">' . size_format( $memory ) . '</mark>'; |
|
81 | + echo '<mark class="yes">'.size_format($memory).'</mark>'; |
|
82 | 82 | } |
83 | 83 | ?> |
84 | 84 | </td> |
85 | 85 | </tr> |
86 | 86 | <tr> |
87 | - <td data-export-label="WP Debug Mode"><?php _e( 'WP Debug Mode', 'give' ); ?>:</td> |
|
88 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'Displays whether or not WordPress is in Debug Mode.', 'give' ) ); ?></td> |
|
87 | + <td data-export-label="WP Debug Mode"><?php _e('WP Debug Mode', 'give'); ?>:</td> |
|
88 | + <td class="help"><?php echo Give()->tooltips->render_help(__('Displays whether or not WordPress is in Debug Mode.', 'give')); ?></td> |
|
89 | 89 | <td> |
90 | - <?php if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) : ?> |
|
90 | + <?php if (defined('WP_DEBUG') && WP_DEBUG) : ?> |
|
91 | 91 | <mark class="yes"><span class="dashicons dashicons-yes"></span></mark> |
92 | 92 | <?php else : ?> |
93 | 93 | <mark class="no">–</mark> |
@@ -95,10 +95,10 @@ discard block |
||
95 | 95 | </td> |
96 | 96 | </tr> |
97 | 97 | <tr> |
98 | - <td data-export-label="WP Cron"><?php _e( 'WP Cron', 'give' ); ?>:</td> |
|
99 | - <td class="help"><?php echo Give()->tooltips->render( __( 'Displays whether or not WP Cron Jobs are enabled.', 'give' ) ); ?></td> |
|
98 | + <td data-export-label="WP Cron"><?php _e('WP Cron', 'give'); ?>:</td> |
|
99 | + <td class="help"><?php echo Give()->tooltips->render(__('Displays whether or not WP Cron Jobs are enabled.', 'give')); ?></td> |
|
100 | 100 | <td> |
101 | - <?php if ( defined( 'DISABLE_WP_CRON' ) && DISABLE_WP_CRON ) : ?> |
|
101 | + <?php if (defined('DISABLE_WP_CRON') && DISABLE_WP_CRON) : ?> |
|
102 | 102 | <mark class="no">–</mark> |
103 | 103 | <?php else : ?> |
104 | 104 | <mark class="yes"><span class="dashicons dashicons-yes"></span></mark> |
@@ -106,55 +106,55 @@ discard block |
||
106 | 106 | </td> |
107 | 107 | </tr> |
108 | 108 | <tr> |
109 | - <td data-export-label="Language"><?php _e( 'Language', 'give' ); ?>:</td> |
|
110 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'The current language used by WordPress. Default = English', 'give' ) ); ?></td> |
|
109 | + <td data-export-label="Language"><?php _e('Language', 'give'); ?>:</td> |
|
110 | + <td class="help"><?php echo Give()->tooltips->render_help(__('The current language used by WordPress. Default = English', 'give')); ?></td> |
|
111 | 111 | <td><?php echo get_locale(); ?></td> |
112 | 112 | </tr> |
113 | 113 | <tr> |
114 | - <td data-export-label="Permalink Structure"><?php _e( 'Permalink Structure', 'give' ); ?>:</td> |
|
115 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'The permalink structure as defined in Settings.', 'give' ) ); ?></td> |
|
116 | - <td><?php echo esc_html( get_option( 'permalink_structure', __( 'Default', 'give' ) ) ); ?></td> |
|
114 | + <td data-export-label="Permalink Structure"><?php _e('Permalink Structure', 'give'); ?>:</td> |
|
115 | + <td class="help"><?php echo Give()->tooltips->render_help(__('The permalink structure as defined in Settings.', 'give')); ?></td> |
|
116 | + <td><?php echo esc_html(get_option('permalink_structure', __('Default', 'give'))); ?></td> |
|
117 | 117 | </tr> |
118 | 118 | <tr> |
119 | - <td data-export-label="Show on Front"><?php _e( 'Show on Front', 'give' ); ?>:</td> |
|
120 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'Whether your front page is set to show posts or a static page.', 'give' ) ); ?></td> |
|
121 | - <td><?php echo esc_html( get_option( 'show_on_front', '–' ) ); ?></td> |
|
119 | + <td data-export-label="Show on Front"><?php _e('Show on Front', 'give'); ?>:</td> |
|
120 | + <td class="help"><?php echo Give()->tooltips->render_help(__('Whether your front page is set to show posts or a static page.', 'give')); ?></td> |
|
121 | + <td><?php echo esc_html(get_option('show_on_front', '–')); ?></td> |
|
122 | 122 | </tr> |
123 | - <?php if ( 'page' === get_option( 'show_on_front' ) ) : ?> |
|
123 | + <?php if ('page' === get_option('show_on_front')) : ?> |
|
124 | 124 | <?php |
125 | - $front_page_id = absint( get_option( 'page_on_front' ) ); |
|
126 | - $blog_page_id = absint( get_option( 'page_for_posts' ) ); |
|
125 | + $front_page_id = absint(get_option('page_on_front')); |
|
126 | + $blog_page_id = absint(get_option('page_for_posts')); |
|
127 | 127 | ?> |
128 | 128 | <tr> |
129 | - <td data-export-label="Page on Front"><?php _e( 'Page on Front', 'give' ); ?>:</td> |
|
130 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'The page set to display as your front page.', 'give' ) ); ?></td> |
|
131 | - <td><?php echo 0 !== $front_page_id ? esc_html( get_the_title( $front_page_id ) . ' (#' . $front_page_id . ')' ) : __( 'Unset', 'give' ); ?></td> |
|
129 | + <td data-export-label="Page on Front"><?php _e('Page on Front', 'give'); ?>:</td> |
|
130 | + <td class="help"><?php echo Give()->tooltips->render_help(__('The page set to display as your front page.', 'give')); ?></td> |
|
131 | + <td><?php echo 0 !== $front_page_id ? esc_html(get_the_title($front_page_id).' (#'.$front_page_id.')') : __('Unset', 'give'); ?></td> |
|
132 | 132 | </tr> |
133 | 133 | <tr> |
134 | - <td data-export-label="Page for Posts"><?php _e( 'Page for Posts', 'give' ); ?>:</td> |
|
135 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'The page set to display your posts.', 'give' ) ); ?></td> |
|
136 | - <td><?php echo 0 !== $blog_page_id ? esc_html( get_the_title( $blog_page_id ) . ' (#' . $blog_page_id . ')' ) : __( 'Unset', 'give' ); ?></td> |
|
134 | + <td data-export-label="Page for Posts"><?php _e('Page for Posts', 'give'); ?>:</td> |
|
135 | + <td class="help"><?php echo Give()->tooltips->render_help(__('The page set to display your posts.', 'give')); ?></td> |
|
136 | + <td><?php echo 0 !== $blog_page_id ? esc_html(get_the_title($blog_page_id).' (#'.$blog_page_id.')') : __('Unset', 'give'); ?></td> |
|
137 | 137 | </tr> |
138 | - <?php endif;?> |
|
138 | + <?php endif; ?> |
|
139 | 139 | <tr> |
140 | - <td data-export-label="Table Prefix Length"><?php _e( 'Table Prefix Length', 'give' ); ?>:</td> |
|
141 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'The length of the table prefix used in your WordPress database.', 'give' ) ); ?></td> |
|
142 | - <td><?php echo esc_html( strlen( $wpdb->prefix ) ); ?></td> |
|
140 | + <td data-export-label="Table Prefix Length"><?php _e('Table Prefix Length', 'give'); ?>:</td> |
|
141 | + <td class="help"><?php echo Give()->tooltips->render_help(__('The length of the table prefix used in your WordPress database.', 'give')); ?></td> |
|
142 | + <td><?php echo esc_html(strlen($wpdb->prefix)); ?></td> |
|
143 | 143 | </tr> |
144 | 144 | <tr> |
145 | - <td data-export-label="Table Prefix Status"><?php _e( 'Table Prefix Status', 'give' ); ?>:</td> |
|
146 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'The status of the table prefix used in your WordPress database.', 'give' ) ); ?></td> |
|
147 | - <td><?php echo strlen( $wpdb->prefix ) > 16 ? esc_html( 'Error: Too long', 'give' ) : esc_html( 'Acceptable', 'give' ); ?></td> |
|
145 | + <td data-export-label="Table Prefix Status"><?php _e('Table Prefix Status', 'give'); ?>:</td> |
|
146 | + <td class="help"><?php echo Give()->tooltips->render_help(__('The status of the table prefix used in your WordPress database.', 'give')); ?></td> |
|
147 | + <td><?php echo strlen($wpdb->prefix) > 16 ? esc_html('Error: Too long', 'give') : esc_html('Acceptable', 'give'); ?></td> |
|
148 | 148 | </tr> |
149 | 149 | <tr> |
150 | - <td data-export-label="Admin AJAX"><?php _e( 'Admin AJAX', 'give' ); ?>:</td> |
|
151 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'Whether Admin AJAX is accessible.', 'give' ) ); ?></td> |
|
152 | - <td><?php echo give_test_ajax_works() ? __( 'Accessible', 'give' ) : __( 'Inaccessible', 'give' ); ?></td> |
|
150 | + <td data-export-label="Admin AJAX"><?php _e('Admin AJAX', 'give'); ?>:</td> |
|
151 | + <td class="help"><?php echo Give()->tooltips->render_help(__('Whether Admin AJAX is accessible.', 'give')); ?></td> |
|
152 | + <td><?php echo give_test_ajax_works() ? __('Accessible', 'give') : __('Inaccessible', 'give'); ?></td> |
|
153 | 153 | </tr> |
154 | 154 | <tr> |
155 | - <td data-export-label="Registered Post Statuses"><?php _e( 'Registered Post Statuses', 'give' ); ?>:</td> |
|
156 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'A list of all registered post statuses.', 'give' ) ); ?></td> |
|
157 | - <td><?php echo esc_html( implode( ', ', get_post_stati() ) ); ?></td> |
|
155 | + <td data-export-label="Registered Post Statuses"><?php _e('Registered Post Statuses', 'give'); ?>:</td> |
|
156 | + <td class="help"><?php echo Give()->tooltips->render_help(__('A list of all registered post statuses.', 'give')); ?></td> |
|
157 | + <td><?php echo esc_html(implode(', ', get_post_stati())); ?></td> |
|
158 | 158 | </tr> |
159 | 159 | </tbody> |
160 | 160 | </table> |
@@ -162,97 +162,97 @@ discard block |
||
162 | 162 | <table class="give-status-table widefat" cellspacing="0"> |
163 | 163 | <thead> |
164 | 164 | <tr> |
165 | - <th colspan="3" data-export-label="Server Environment"><h2><?php _e( 'Server Environment', 'give' ); ?></h2></th> |
|
165 | + <th colspan="3" data-export-label="Server Environment"><h2><?php _e('Server Environment', 'give'); ?></h2></th> |
|
166 | 166 | </tr> |
167 | 167 | </thead> |
168 | 168 | <tbody> |
169 | 169 | <tr> |
170 | - <td data-export-label="Hosting Provider"><?php _e( 'Hosting Provider', 'give' ); ?>:</td> |
|
171 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'The hosting provider for this WordPress installation.', 'give' ) ); ?></td> |
|
172 | - <td><?php echo give_get_host() ? esc_html( give_get_host() ) : __( 'Unknown', 'give' ); ?></td> |
|
170 | + <td data-export-label="Hosting Provider"><?php _e('Hosting Provider', 'give'); ?>:</td> |
|
171 | + <td class="help"><?php echo Give()->tooltips->render_help(__('The hosting provider for this WordPress installation.', 'give')); ?></td> |
|
172 | + <td><?php echo give_get_host() ? esc_html(give_get_host()) : __('Unknown', 'give'); ?></td> |
|
173 | 173 | </tr> |
174 | 174 | <tr> |
175 | - <td data-export-label="TLS Connection"><?php _e( 'TLS Connection', 'give' ); ?>:</td> |
|
176 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'Most payment gateway APIs only support connections using the TLS 1.2 security protocol.', 'give' ) ); ?></td> |
|
175 | + <td data-export-label="TLS Connection"><?php _e('TLS Connection', 'give'); ?>:</td> |
|
176 | + <td class="help"><?php echo Give()->tooltips->render_help(__('Most payment gateway APIs only support connections using the TLS 1.2 security protocol.', 'give')); ?></td> |
|
177 | 177 | <td> |
178 | 178 | <?php |
179 | - $tls_check = wp_remote_post( 'https://www.howsmyssl.com/a/check' ); |
|
180 | - if ( ! is_wp_error( $tls_check ) ) { |
|
181 | - $tls_check = json_decode( wp_remote_retrieve_body( $tls_check ) ); |
|
179 | + $tls_check = wp_remote_post('https://www.howsmyssl.com/a/check'); |
|
180 | + if ( ! is_wp_error($tls_check)) { |
|
181 | + $tls_check = json_decode(wp_remote_retrieve_body($tls_check)); |
|
182 | 182 | /* translators: %s: SSL connection response */ |
183 | - printf( __('Connection uses %s', 'give'), esc_html( $tls_check->tls_version )) ; |
|
183 | + printf(__('Connection uses %s', 'give'), esc_html($tls_check->tls_version)); |
|
184 | 184 | } |
185 | 185 | ?> |
186 | 186 | </td> |
187 | 187 | </tr> |
188 | 188 | <tr> |
189 | - <td data-export-label="TLS Connection"><?php _e( 'TLS Rating', 'give' ); ?>:</td> |
|
190 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'The server\'s connection as rated by https://www.howsmyssl.com/', 'give' ) ); ?></td> |
|
189 | + <td data-export-label="TLS Connection"><?php _e('TLS Rating', 'give'); ?>:</td> |
|
190 | + <td class="help"><?php echo Give()->tooltips->render_help(__('The server\'s connection as rated by https://www.howsmyssl.com/', 'give')); ?></td> |
|
191 | 191 | <td> |
192 | 192 | <?php |
193 | - if ( ! is_wp_error( $tls_check ) ) { |
|
194 | - esc_html_e( $tls_check->rating); |
|
193 | + if ( ! is_wp_error($tls_check)) { |
|
194 | + esc_html_e($tls_check->rating); |
|
195 | 195 | } |
196 | 196 | ?> |
197 | 197 | </td> |
198 | 198 | </tr> |
199 | 199 | <tr> |
200 | - <td data-export-label="Server Info"><?php _e( 'Server Info', 'give' ); ?>:</td> |
|
201 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'Information about the web server that is currently hosting your site.', 'give' ) ); ?></td> |
|
202 | - <td><?php echo esc_html( $_SERVER['SERVER_SOFTWARE'] ); ?></td> |
|
200 | + <td data-export-label="Server Info"><?php _e('Server Info', 'give'); ?>:</td> |
|
201 | + <td class="help"><?php echo Give()->tooltips->render_help(__('Information about the web server that is currently hosting your site.', 'give')); ?></td> |
|
202 | + <td><?php echo esc_html($_SERVER['SERVER_SOFTWARE']); ?></td> |
|
203 | 203 | </tr> |
204 | 204 | <tr> |
205 | - <td data-export-label="PHP Version"><?php _e( 'PHP Version', 'give' ); ?>:</td> |
|
206 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'The version of PHP installed on your hosting server.', 'give' ) ); ?></td> |
|
205 | + <td data-export-label="PHP Version"><?php _e('PHP Version', 'give'); ?>:</td> |
|
206 | + <td class="help"><?php echo Give()->tooltips->render_help(__('The version of PHP installed on your hosting server.', 'give')); ?></td> |
|
207 | 207 | <td> |
208 | 208 | <?php |
209 | 209 | // Check if phpversion function exists. |
210 | - if ( function_exists( 'phpversion' ) ) { |
|
210 | + if (function_exists('phpversion')) { |
|
211 | 211 | $php_version = phpversion(); |
212 | 212 | |
213 | - if ( version_compare( $php_version, '5.6', '<' ) ) { |
|
214 | - 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>'; |
|
213 | + if (version_compare($php_version, '5.6', '<')) { |
|
214 | + 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>'; |
|
215 | 215 | } else { |
216 | - echo '<mark class="yes">' . esc_html( $php_version ) . '</mark>'; |
|
216 | + echo '<mark class="yes">'.esc_html($php_version).'</mark>'; |
|
217 | 217 | } |
218 | 218 | } else { |
219 | - _e( "Couldn't determine PHP version because phpversion() doesn't exist.", 'give' ); |
|
219 | + _e("Couldn't determine PHP version because phpversion() doesn't exist.", 'give'); |
|
220 | 220 | } |
221 | 221 | ?></td> |
222 | 222 | </tr> |
223 | - <?php if ( function_exists( 'ini_get' ) ) : ?> |
|
223 | + <?php if (function_exists('ini_get')) : ?> |
|
224 | 224 | <tr> |
225 | - <td data-export-label="PHP Post Max Size"><?php _e( 'PHP Post Max Size', 'give' ); ?>:</td> |
|
226 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'The largest filesize that can be contained in one post.', 'give' ) ); ?></td> |
|
227 | - <td><?php echo size_format( give_let_to_num( ini_get( 'post_max_size' ) ) ); ?></td> |
|
225 | + <td data-export-label="PHP Post Max Size"><?php _e('PHP Post Max Size', 'give'); ?>:</td> |
|
226 | + <td class="help"><?php echo Give()->tooltips->render_help(__('The largest filesize that can be contained in one post.', 'give')); ?></td> |
|
227 | + <td><?php echo size_format(give_let_to_num(ini_get('post_max_size'))); ?></td> |
|
228 | 228 | </tr> |
229 | 229 | <tr> |
230 | - <td data-export-label="PHP Time Limit"><?php _e( 'PHP Time Limit', 'give' ); ?>:</td> |
|
231 | - <td class="help"><?php echo Give() ->tooltips->render_help( __( 'The amount of time (in seconds) that your site will spend on a single operation before timing out (to avoid server lockups).', 'give' ) ); ?></td> |
|
232 | - <td><?php echo ini_get( 'max_execution_time' ); ?></td> |
|
230 | + <td data-export-label="PHP Time Limit"><?php _e('PHP Time Limit', 'give'); ?>:</td> |
|
231 | + <td class="help"><?php echo Give() ->tooltips->render_help(__('The amount of time (in seconds) that your site will spend on a single operation before timing out (to avoid server lockups).', 'give')); ?></td> |
|
232 | + <td><?php echo ini_get('max_execution_time'); ?></td> |
|
233 | 233 | </tr> |
234 | 234 | <tr> |
235 | - <td data-export-label="PHP Max Input Vars"><?php _e( 'PHP Max Input Vars', 'give' ); ?>:</td> |
|
236 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'The maximum number of variables your server can use for a single function to avoid overloads.', 'give' ) ); ?></td> |
|
237 | - <td><?php echo ini_get( 'max_input_vars' ); ?></td> |
|
235 | + <td data-export-label="PHP Max Input Vars"><?php _e('PHP Max Input Vars', 'give'); ?>:</td> |
|
236 | + <td class="help"><?php echo Give()->tooltips->render_help(__('The maximum number of variables your server can use for a single function to avoid overloads.', 'give')); ?></td> |
|
237 | + <td><?php echo ini_get('max_input_vars'); ?></td> |
|
238 | 238 | </tr> |
239 | 239 | <tr> |
240 | - <td data-export-label="PHP Max Upload Size"><?php _e( 'PHP Max Upload Size', 'give' ); ?>:</td> |
|
241 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'The largest filesize that can be uploaded to your WordPress installation.', 'give' ) ); ?></td> |
|
242 | - <td><?php echo size_format( wp_max_upload_size() ); ?></td> |
|
240 | + <td data-export-label="PHP Max Upload Size"><?php _e('PHP Max Upload Size', 'give'); ?>:</td> |
|
241 | + <td class="help"><?php echo Give()->tooltips->render_help(__('The largest filesize that can be uploaded to your WordPress installation.', 'give')); ?></td> |
|
242 | + <td><?php echo size_format(wp_max_upload_size()); ?></td> |
|
243 | 243 | </tr> |
244 | 244 | <tr> |
245 | - <td data-export-label="cURL Version"><?php _e( 'cURL Version', 'give' ); ?>:</td> |
|
246 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'The version of cURL installed on your server.', 'give' ) ); ?></td> |
|
245 | + <td data-export-label="cURL Version"><?php _e('cURL Version', 'give'); ?>:</td> |
|
246 | + <td class="help"><?php echo Give()->tooltips->render_help(__('The version of cURL installed on your server.', 'give')); ?></td> |
|
247 | 247 | <td> |
248 | 248 | <?php |
249 | - if ( function_exists( 'curl_version' ) ) { |
|
249 | + if (function_exists('curl_version')) { |
|
250 | 250 | $curl_version = curl_version(); |
251 | 251 | |
252 | - if ( version_compare( $curl_version['version'], '7.40', '<' ) ) { |
|
253 | - 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>'; |
|
252 | + if (version_compare($curl_version['version'], '7.40', '<')) { |
|
253 | + 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>'; |
|
254 | 254 | } else { |
255 | - echo '<mark class="yes">' . esc_html( $curl_version['version'] . ', ' . $curl_version['ssl_version'] ) . '</mark>'; |
|
255 | + echo '<mark class="yes">'.esc_html($curl_version['version'].', '.$curl_version['ssl_version']).'</mark>'; |
|
256 | 256 | } |
257 | 257 | } else { |
258 | 258 | echo '&ndash'; |
@@ -261,42 +261,42 @@ discard block |
||
261 | 261 | </td> |
262 | 262 | </tr> |
263 | 263 | <tr> |
264 | - <td data-export-label="SUHOSIN Installed"><?php _e( 'SUHOSIN Installed', 'give' ); ?>:</td> |
|
265 | - <td class="help"><?php echo Give()->tooltips->render_help( __( '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' ) ); ?></td> |
|
266 | - <td><?php echo extension_loaded( 'suhosin' ) ? '<span class="dashicons dashicons-yes"></span>' : '–'; ?></td> |
|
264 | + <td data-export-label="SUHOSIN Installed"><?php _e('SUHOSIN Installed', 'give'); ?>:</td> |
|
265 | + <td class="help"><?php echo Give()->tooltips->render_help(__('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')); ?></td> |
|
266 | + <td><?php echo extension_loaded('suhosin') ? '<span class="dashicons dashicons-yes"></span>' : '–'; ?></td> |
|
267 | 267 | </tr> |
268 | 268 | <?php endif; |
269 | 269 | |
270 | - if ( $wpdb->use_mysqli ) { |
|
271 | - $ver = mysqli_get_server_info( $wpdb->dbh ); |
|
270 | + if ($wpdb->use_mysqli) { |
|
271 | + $ver = mysqli_get_server_info($wpdb->dbh); |
|
272 | 272 | } else { |
273 | 273 | $ver = mysql_get_server_info(); |
274 | 274 | } |
275 | 275 | |
276 | - if ( ! empty( $wpdb->is_mysql ) && ! stristr( $ver, 'MariaDB' ) ) : ?> |
|
276 | + if ( ! empty($wpdb->is_mysql) && ! stristr($ver, 'MariaDB')) : ?> |
|
277 | 277 | <tr> |
278 | - <td data-export-label="MySQL Version"><?php _e( 'MySQL Version', 'give' ); ?>:</td> |
|
279 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'The version of MySQL installed on your hosting server.', 'give' ) ); ?></td> |
|
278 | + <td data-export-label="MySQL Version"><?php _e('MySQL Version', 'give'); ?>:</td> |
|
279 | + <td class="help"><?php echo Give()->tooltips->render_help(__('The version of MySQL installed on your hosting server.', 'give')); ?></td> |
|
280 | 280 | <td> |
281 | 281 | <?php |
282 | 282 | $mysql_version = $wpdb->db_version(); |
283 | 283 | |
284 | - if ( version_compare( $mysql_version, '5.6', '<' ) ) { |
|
285 | - 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>'; |
|
284 | + if (version_compare($mysql_version, '5.6', '<')) { |
|
285 | + 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>'; |
|
286 | 286 | } else { |
287 | - echo '<mark class="yes">' . esc_html( $mysql_version ) . '</mark>'; |
|
287 | + echo '<mark class="yes">'.esc_html($mysql_version).'</mark>'; |
|
288 | 288 | } |
289 | 289 | ?> |
290 | 290 | </td> |
291 | 291 | </tr> |
292 | 292 | <?php endif; ?> |
293 | 293 | <tr> |
294 | - <td data-export-label="Default Timezone is UTC"><?php _e( 'Default Timezone is UTC', 'give' ); ?>:</td> |
|
295 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'The default timezone for your server.', 'give' ) ); ?></td> |
|
294 | + <td data-export-label="Default Timezone is UTC"><?php _e('Default Timezone is UTC', 'give'); ?>:</td> |
|
295 | + <td class="help"><?php echo Give()->tooltips->render_help(__('The default timezone for your server.', 'give')); ?></td> |
|
296 | 296 | <td><?php |
297 | 297 | $default_timezone = date_default_timezone_get(); |
298 | - if ( 'UTC' !== $default_timezone ) { |
|
299 | - echo '<mark class="error"><span class="dashicons dashicons-warning"></span> ' . sprintf( __( 'Default timezone is %s - it should be UTC', 'give' ), $default_timezone ) . '</mark>'; |
|
298 | + if ('UTC' !== $default_timezone) { |
|
299 | + echo '<mark class="error"><span class="dashicons dashicons-warning"></span> '.sprintf(__('Default timezone is %s - it should be UTC', 'give'), $default_timezone).'</mark>'; |
|
300 | 300 | } else { |
301 | 301 | echo '<mark class="yes"><span class="dashicons dashicons-yes"></span></mark>'; |
302 | 302 | } ?> |
@@ -307,119 +307,119 @@ discard block |
||
307 | 307 | |
308 | 308 | // fsockopen/cURL. |
309 | 309 | $posting['fsockopen_curl']['name'] = 'fsockopen/cURL'; |
310 | - $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' ); |
|
310 | + $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'); |
|
311 | 311 | |
312 | - if ( function_exists( 'fsockopen' ) || function_exists( 'curl_init' ) ) { |
|
312 | + if (function_exists('fsockopen') || function_exists('curl_init')) { |
|
313 | 313 | $posting['fsockopen_curl']['success'] = true; |
314 | 314 | } else { |
315 | 315 | $posting['fsockopen_curl']['success'] = false; |
316 | - $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' ); |
|
316 | + $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'); |
|
317 | 317 | } |
318 | 318 | |
319 | 319 | // SOAP. |
320 | 320 | $posting['soap_client']['name'] = 'SoapClient'; |
321 | - $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' ); |
|
321 | + $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'); |
|
322 | 322 | |
323 | - if ( class_exists( 'SoapClient' ) ) { |
|
323 | + if (class_exists('SoapClient')) { |
|
324 | 324 | $posting['soap_client']['success'] = true; |
325 | 325 | } else { |
326 | 326 | $posting['soap_client']['success'] = false; |
327 | - $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>' ); |
|
327 | + $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>'); |
|
328 | 328 | } |
329 | 329 | |
330 | 330 | // DOMDocument. |
331 | 331 | $posting['dom_document']['name'] = 'DOMDocument'; |
332 | - $posting['dom_document']['help'] = __( 'HTML/Multipart emails use DOMDocument to generate inline CSS in templates.', 'give' ); |
|
332 | + $posting['dom_document']['help'] = __('HTML/Multipart emails use DOMDocument to generate inline CSS in templates.', 'give'); |
|
333 | 333 | |
334 | - if ( class_exists( 'DOMDocument' ) ) { |
|
334 | + if (class_exists('DOMDocument')) { |
|
335 | 335 | $posting['dom_document']['success'] = true; |
336 | 336 | } else { |
337 | 337 | $posting['dom_document']['success'] = false; |
338 | - $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>' ); |
|
338 | + $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>'); |
|
339 | 339 | } |
340 | 340 | |
341 | 341 | // gzip. |
342 | 342 | $posting['gzip']['name'] = 'gzip'; |
343 | - $posting['gzip']['help'] = __( 'gzip is used for file compression and decompression.', 'give' ); |
|
343 | + $posting['gzip']['help'] = __('gzip is used for file compression and decompression.', 'give'); |
|
344 | 344 | |
345 | - if ( is_callable( 'gzopen' ) ) { |
|
345 | + if (is_callable('gzopen')) { |
|
346 | 346 | $posting['gzip']['success'] = true; |
347 | 347 | } else { |
348 | 348 | $posting['gzip']['success'] = false; |
349 | - $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>' ); |
|
349 | + $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>'); |
|
350 | 350 | } |
351 | 351 | |
352 | 352 | |
353 | 353 | // GD Graphics Library. |
354 | 354 | $posting['gd']['name'] = 'GD Graphics Library'; |
355 | - $posting['gd']['help'] = __( 'GD Graphics Library is used for dynamically manipulating images.', 'give' ); |
|
356 | - $posting['gd']['success'] = extension_loaded( 'gd' ) && function_exists( 'gd_info' ) ? true : false; |
|
355 | + $posting['gd']['help'] = __('GD Graphics Library is used for dynamically manipulating images.', 'give'); |
|
356 | + $posting['gd']['success'] = extension_loaded('gd') && function_exists('gd_info') ? true : false; |
|
357 | 357 | |
358 | 358 | // Multibyte String. |
359 | 359 | $posting['mbstring']['name'] = 'Multibyte String'; |
360 | - $posting['mbstring']['help'] = __( 'Multibyte String (mbstring) is used to convert character encoding, like for emails or converting characters to lowercase.', 'give' ); |
|
360 | + $posting['mbstring']['help'] = __('Multibyte String (mbstring) is used to convert character encoding, like for emails or converting characters to lowercase.', 'give'); |
|
361 | 361 | |
362 | - if ( extension_loaded( 'mbstring' ) ) { |
|
362 | + if (extension_loaded('mbstring')) { |
|
363 | 363 | $posting['mbstring']['success'] = true; |
364 | 364 | } else { |
365 | 365 | $posting['mbstring']['success'] = false; |
366 | - $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>' ); |
|
366 | + $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>'); |
|
367 | 367 | } |
368 | 368 | |
369 | 369 | // WP Remote Post Check. |
370 | - $posting['wp_remote_post']['name'] = __( 'Remote Post', 'give' ); |
|
371 | - $posting['wp_remote_post']['help'] = __( 'PayPal uses this method of communicating when sending back transaction information.', 'give' ); |
|
370 | + $posting['wp_remote_post']['name'] = __('Remote Post', 'give'); |
|
371 | + $posting['wp_remote_post']['help'] = __('PayPal uses this method of communicating when sending back transaction information.', 'give'); |
|
372 | 372 | |
373 | - $response = wp_safe_remote_post( 'https://www.paypal.com/cgi-bin/webscr', array( |
|
373 | + $response = wp_safe_remote_post('https://www.paypal.com/cgi-bin/webscr', array( |
|
374 | 374 | 'timeout' => 60, |
375 | - 'user-agent' => 'Give/' . GIVE_VERSION, |
|
375 | + 'user-agent' => 'Give/'.GIVE_VERSION, |
|
376 | 376 | 'httpversion' => '1.1', |
377 | 377 | 'body' => array( |
378 | 378 | 'cmd' => '_notify-validate', |
379 | 379 | ), |
380 | - ) ); |
|
380 | + )); |
|
381 | 381 | |
382 | - if ( ! is_wp_error( $response ) && $response['response']['code'] >= 200 && $response['response']['code'] < 300 ) { |
|
382 | + if ( ! is_wp_error($response) && $response['response']['code'] >= 200 && $response['response']['code'] < 300) { |
|
383 | 383 | $posting['wp_remote_post']['success'] = true; |
384 | 384 | } else { |
385 | - $posting['wp_remote_post']['note'] = __( 'wp_remote_post() failed. PayPal IPN won\'t work with your server. Contact your hosting provider.', 'give' ); |
|
386 | - if ( is_wp_error( $response ) ) { |
|
387 | - $posting['wp_remote_post']['note'] .= ' ' . sprintf( __( 'Error: %s', 'give' ), sanitize_text_field( $response->get_error_message() ) ); |
|
385 | + $posting['wp_remote_post']['note'] = __('wp_remote_post() failed. PayPal IPN won\'t work with your server. Contact your hosting provider.', 'give'); |
|
386 | + if (is_wp_error($response)) { |
|
387 | + $posting['wp_remote_post']['note'] .= ' '.sprintf(__('Error: %s', 'give'), sanitize_text_field($response->get_error_message())); |
|
388 | 388 | } else { |
389 | - $posting['wp_remote_post']['note'] .= ' ' . sprintf( __( 'Status code: %s', 'give' ), sanitize_text_field( $response['response']['code'] ) ); |
|
389 | + $posting['wp_remote_post']['note'] .= ' '.sprintf(__('Status code: %s', 'give'), sanitize_text_field($response['response']['code'])); |
|
390 | 390 | } |
391 | 391 | $posting['wp_remote_post']['success'] = false; |
392 | 392 | } |
393 | 393 | |
394 | 394 | // WP Remote Get Check. |
395 | - $posting['wp_remote_get']['name'] = __( 'Remote Get', 'give' ); |
|
396 | - $posting['wp_remote_get']['help'] = __( 'Give plugins may use this method of communication when checking for plugin updates.', 'give' ); |
|
395 | + $posting['wp_remote_get']['name'] = __('Remote Get', 'give'); |
|
396 | + $posting['wp_remote_get']['help'] = __('Give plugins may use this method of communication when checking for plugin updates.', 'give'); |
|
397 | 397 | |
398 | - $response = wp_safe_remote_get( 'https://woocommerce.com/wc-api/product-key-api?request=ping&network=' . ( is_multisite() ? '1' : '0' ) ); |
|
398 | + $response = wp_safe_remote_get('https://woocommerce.com/wc-api/product-key-api?request=ping&network='.(is_multisite() ? '1' : '0')); |
|
399 | 399 | |
400 | - if ( ! is_wp_error( $response ) && $response['response']['code'] >= 200 && $response['response']['code'] < 300 ) { |
|
400 | + if ( ! is_wp_error($response) && $response['response']['code'] >= 200 && $response['response']['code'] < 300) { |
|
401 | 401 | $posting['wp_remote_get']['success'] = true; |
402 | 402 | } else { |
403 | - $posting['wp_remote_get']['note'] = __( 'wp_remote_get() failed. The Give plugin updater won\'t work with your server. Contact your hosting provider.', 'give' ); |
|
404 | - if ( is_wp_error( $response ) ) { |
|
405 | - $posting['wp_remote_get']['note'] .= ' ' . sprintf( __( 'Error: %s', 'give' ), give_clean( $response->get_error_message() ) ); |
|
403 | + $posting['wp_remote_get']['note'] = __('wp_remote_get() failed. The Give plugin updater won\'t work with your server. Contact your hosting provider.', 'give'); |
|
404 | + if (is_wp_error($response)) { |
|
405 | + $posting['wp_remote_get']['note'] .= ' '.sprintf(__('Error: %s', 'give'), give_clean($response->get_error_message())); |
|
406 | 406 | } else { |
407 | - $posting['wp_remote_get']['note'] .= ' ' . sprintf( __( 'Status code: %s', 'give' ), give_clean( $response['response']['code'] ) ); |
|
407 | + $posting['wp_remote_get']['note'] .= ' '.sprintf(__('Status code: %s', 'give'), give_clean($response['response']['code'])); |
|
408 | 408 | } |
409 | 409 | $posting['wp_remote_get']['success'] = false; |
410 | 410 | } |
411 | 411 | |
412 | - $posting = apply_filters( 'give_debug_posting', $posting ); |
|
412 | + $posting = apply_filters('give_debug_posting', $posting); |
|
413 | 413 | |
414 | - foreach ( $posting as $post ) { |
|
415 | - $mark = ! empty( $post['success'] ) ? 'yes' : 'error'; |
|
414 | + foreach ($posting as $post) { |
|
415 | + $mark = ! empty($post['success']) ? 'yes' : 'error'; |
|
416 | 416 | ?> |
417 | 417 | <tr> |
418 | - <td data-export-label="<?php echo esc_html( $post['name'] ); ?>"><?php echo esc_html( $post['name'] ); ?>:</td> |
|
419 | - <td class="help"><?php echo Give()->tooltips->render_help( esc_attr( isset( $post['help'] ) ? $post['help'] : '' ) ); ?></td> |
|
418 | + <td data-export-label="<?php echo esc_html($post['name']); ?>"><?php echo esc_html($post['name']); ?>:</td> |
|
419 | + <td class="help"><?php echo Give()->tooltips->render_help(esc_attr(isset($post['help']) ? $post['help'] : '')); ?></td> |
|
420 | 420 | <td> |
421 | 421 | <mark class="<?php echo $mark; ?>"> |
422 | - <?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'] ) : ''; ?> |
|
422 | + <?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']) : ''; ?> |
|
423 | 423 | </mark> |
424 | 424 | </td> |
425 | 425 | </tr> |
@@ -432,41 +432,41 @@ discard block |
||
432 | 432 | <table class="give-status-table widefat" cellspacing="0"> |
433 | 433 | <thead> |
434 | 434 | <tr> |
435 | - <th colspan="3" data-export-label="Give Configuration"><h2><?php _e( 'Give Configuration', 'give' ); ?></h2></th> |
|
435 | + <th colspan="3" data-export-label="Give Configuration"><h2><?php _e('Give Configuration', 'give'); ?></h2></th> |
|
436 | 436 | </tr> |
437 | 437 | </thead> |
438 | 438 | <tbody> |
439 | 439 | <tr> |
440 | - <td data-export-label="Give Version"><?php _e( 'Give Version', 'give' ); ?>:</td> |
|
441 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'The version of Give installed on your site.', 'give' ) ); ?></td> |
|
442 | - <td><?php echo esc_html( GIVE_VERSION ); ?></td> |
|
440 | + <td data-export-label="Give Version"><?php _e('Give Version', 'give'); ?>:</td> |
|
441 | + <td class="help"><?php echo Give()->tooltips->render_help(__('The version of Give installed on your site.', 'give')); ?></td> |
|
442 | + <td><?php echo esc_html(GIVE_VERSION); ?></td> |
|
443 | 443 | </tr> |
444 | 444 | <tr> |
445 | - <td data-export-label="Give Cache"><?php _e( 'Give Cache', 'give' ); ?>:</td> |
|
446 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'Whether cache is enabled in Give settings.', 'give' ) ); ?></td> |
|
447 | - <td><?php echo give_is_setting_enabled( give_get_option('cache', 'enabled' ) ) ? __( 'Enabled', 'give' ) : __( 'Disabled', 'give' ); ?></td> |
|
445 | + <td data-export-label="Give Cache"><?php _e('Give Cache', 'give'); ?>:</td> |
|
446 | + <td class="help"><?php echo Give()->tooltips->render_help(__('Whether cache is enabled in Give settings.', 'give')); ?></td> |
|
447 | + <td><?php echo give_is_setting_enabled(give_get_option('cache', 'enabled')) ? __('Enabled', 'give') : __('Disabled', 'give'); ?></td> |
|
448 | 448 | </tr> |
449 | 449 | <tr> |
450 | - <td data-export-label="Database Updates"><?php _e( 'Database Updates', 'give' ); ?>:</td> |
|
451 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'This will show the number of pending database updates.', 'give' ) ); ?></td> |
|
450 | + <td data-export-label="Database Updates"><?php _e('Database Updates', 'give'); ?>:</td> |
|
451 | + <td class="help"><?php echo Give()->tooltips->render_help(__('This will show the number of pending database updates.', 'give')); ?></td> |
|
452 | 452 | <td> |
453 | 453 | <?php |
454 | - $updates_text = __( 'All DB Updates Completed.', 'give' ); |
|
454 | + $updates_text = __('All DB Updates Completed.', 'give'); |
|
455 | 455 | $pending_updates = $give_updates->get_total_new_db_update_count(); |
456 | 456 | $total_updates = $give_updates->get_total_db_update_count(); |
457 | 457 | |
458 | - if( $pending_updates === $total_updates ) { |
|
458 | + if ($pending_updates === $total_updates) { |
|
459 | 459 | |
460 | 460 | // When all the db updates are pending. |
461 | 461 | $updates_text = sprintf( |
462 | - __( '%1$s updates still need to run.', 'give' ), |
|
462 | + __('%1$s updates still need to run.', 'give'), |
|
463 | 463 | $total_updates |
464 | 464 | ); |
465 | - } elseif( $pending_updates > 0 ) { |
|
465 | + } elseif ($pending_updates > 0) { |
|
466 | 466 | |
467 | 467 | // When some of the db updates are completed and some are pending. |
468 | 468 | $updates_text = sprintf( |
469 | - __( '%1$s of %2$s updates still need to run.', 'give' ), |
|
469 | + __('%1$s of %2$s updates still need to run.', 'give'), |
|
470 | 470 | $pending_updates, |
471 | 471 | $total_updates |
472 | 472 | ); |
@@ -477,144 +477,143 @@ discard block |
||
477 | 477 | </td> |
478 | 478 | </tr> |
479 | 479 | <tr> |
480 | - <td data-export-label="Give Cache"><?php _e( 'Give Cache', 'give' ); ?>:</td> |
|
481 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'Whether cache is enabled in Give settings.', 'give' ) ); ?></td> |
|
482 | - <td><?php echo give_is_setting_enabled( give_get_option('cache', 'enabled' ) ) ? __( 'Enabled', 'give' ) : __( 'Disabled', 'give' ); ?></td> |
|
480 | + <td data-export-label="Give Cache"><?php _e('Give Cache', 'give'); ?>:</td> |
|
481 | + <td class="help"><?php echo Give()->tooltips->render_help(__('Whether cache is enabled in Give settings.', 'give')); ?></td> |
|
482 | + <td><?php echo give_is_setting_enabled(give_get_option('cache', 'enabled')) ? __('Enabled', 'give') : __('Disabled', 'give'); ?></td> |
|
483 | 483 | </tr> |
484 | 484 | <tr> |
485 | - <td data-export-label="Give Cache"><?php _e( 'Give Emails', 'give' ); ?>:</td> |
|
486 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'Whether emails is enabled in Give settings.', 'give' ) ); ?></td> |
|
485 | + <td data-export-label="Give Cache"><?php _e('Give Emails', 'give'); ?>:</td> |
|
486 | + <td class="help"><?php echo Give()->tooltips->render_help(__('Whether emails is enabled in Give settings.', 'give')); ?></td> |
|
487 | 487 | <td> |
488 | 488 | <?php |
489 | 489 | /* @var Give_Email_Notification $email_notification */ |
490 | - if( $email_notifications = Give_Email_Notifications::get_instance()->get_email_notifications() ) { |
|
490 | + if ($email_notifications = Give_Email_Notifications::get_instance()->get_email_notifications()) { |
|
491 | 491 | ob_start(); |
492 | 492 | |
493 | - foreach ( Give_Email_Notifications::get_instance()->get_email_notifications() as $email_notification ) { |
|
494 | - $status = Give_Email_Notification_Util::is_email_notification_active( $email_notification ) ? |
|
495 | - 'yes' : |
|
496 | - 'error'; |
|
493 | + foreach (Give_Email_Notifications::get_instance()->get_email_notifications() as $email_notification) { |
|
494 | + $status = Give_Email_Notification_Util::is_email_notification_active($email_notification) ? |
|
495 | + 'yes' : 'error'; |
|
497 | 496 | |
498 | 497 | echo sprintf( |
499 | 498 | '<li><mark class="%1$s"><span class="dashicons dashicons-%2$s"></mark></span>%3$s</li>', |
500 | - Give_Email_Notification_Util::is_email_notification_active( $email_notification ) ? 'yes' : 'error', |
|
501 | - Give_Email_Notification_Util::is_email_notification_active( $email_notification ) ? 'yes' : 'no-alt', |
|
499 | + Give_Email_Notification_Util::is_email_notification_active($email_notification) ? 'yes' : 'error', |
|
500 | + Give_Email_Notification_Util::is_email_notification_active($email_notification) ? 'yes' : 'no-alt', |
|
502 | 501 | $email_notification->config['label'] |
503 | 502 | ); |
504 | 503 | } |
505 | 504 | |
506 | - echo sprintf( '<ul>%s</ul>', ob_get_clean() ); |
|
505 | + echo sprintf('<ul>%s</ul>', ob_get_clean()); |
|
507 | 506 | } |
508 | 507 | ?> |
509 | 508 | </td> |
510 | 509 | </tr> |
511 | 510 | <tr> |
512 | - <td data-export-label="Upgraded From"><?php _e( 'Upgraded From', 'give' ); ?>:</td> |
|
513 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'The version of Give installed prior to the last update.', 'give' ) ); ?></td> |
|
514 | - <td><?php echo esc_html( get_option( 'give_version_upgraded_from', '–' ) ); ?></td> |
|
511 | + <td data-export-label="Upgraded From"><?php _e('Upgraded From', 'give'); ?>:</td> |
|
512 | + <td class="help"><?php echo Give()->tooltips->render_help(__('The version of Give installed prior to the last update.', 'give')); ?></td> |
|
513 | + <td><?php echo esc_html(get_option('give_version_upgraded_from', '–')); ?></td> |
|
515 | 514 | </tr> |
516 | 515 | <tr> |
517 | - <td data-export-label="Test Mode"><?php _e( 'Test Mode', 'give' ); ?>:</td> |
|
518 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'Whether Test Mode is enabled in Give settings.', 'give' ) ); ?></td> |
|
519 | - <td><?php echo give_is_test_mode() ? __( 'Enabled', 'give' ) : __( 'Disabled', 'give' ); ?></td> |
|
516 | + <td data-export-label="Test Mode"><?php _e('Test Mode', 'give'); ?>:</td> |
|
517 | + <td class="help"><?php echo Give()->tooltips->render_help(__('Whether Test Mode is enabled in Give settings.', 'give')); ?></td> |
|
518 | + <td><?php echo give_is_test_mode() ? __('Enabled', 'give') : __('Disabled', 'give'); ?></td> |
|
520 | 519 | </tr> |
521 | 520 | <tr> |
522 | - <td data-export-label="Currency Code"><?php _e( 'Currency Code', 'give' ); ?>:</td> |
|
523 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'The currency code selected in Give settings.', 'give' ) ); ?></td> |
|
524 | - <td><?php echo esc_html( give_get_currency() ); ?></td> |
|
521 | + <td data-export-label="Currency Code"><?php _e('Currency Code', 'give'); ?>:</td> |
|
522 | + <td class="help"><?php echo Give()->tooltips->render_help(__('The currency code selected in Give settings.', 'give')); ?></td> |
|
523 | + <td><?php echo esc_html(give_get_currency()); ?></td> |
|
525 | 524 | </tr> |
526 | 525 | <tr> |
527 | - <td data-export-label="Currency Position"><?php _e( 'Currency Position', 'give' ); ?>:</td> |
|
528 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'The currency position selected in Give settings.', 'give' ) ); ?></td> |
|
529 | - <td><?php echo 'before' === give_get_option( 'currency_position' ) ? __( 'Before', 'give' ) : __( 'After', 'give' ); ?></td> |
|
526 | + <td data-export-label="Currency Position"><?php _e('Currency Position', 'give'); ?>:</td> |
|
527 | + <td class="help"><?php echo Give()->tooltips->render_help(__('The currency position selected in Give settings.', 'give')); ?></td> |
|
528 | + <td><?php echo 'before' === give_get_option('currency_position') ? __('Before', 'give') : __('After', 'give'); ?></td> |
|
530 | 529 | </tr> |
531 | 530 | <tr> |
532 | - <td data-export-label="Decimal Separator"><?php _e( 'Decimal Separator', 'give' ); ?>:</td> |
|
533 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'The decimal separator defined in Give settings.', 'give' ) ); ?></td> |
|
534 | - <td><?php echo esc_html( give_get_price_decimal_separator() ); ?></td> |
|
531 | + <td data-export-label="Decimal Separator"><?php _e('Decimal Separator', 'give'); ?>:</td> |
|
532 | + <td class="help"><?php echo Give()->tooltips->render_help(__('The decimal separator defined in Give settings.', 'give')); ?></td> |
|
533 | + <td><?php echo esc_html(give_get_price_decimal_separator()); ?></td> |
|
535 | 534 | </tr> |
536 | 535 | <tr> |
537 | - <td data-export-label="Thousands Separator"><?php _e( 'Thousands Separator', 'give' ); ?>:</td> |
|
538 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'The thousands separator defined in Give settings.', 'give' ) ); ?></td> |
|
539 | - <td><?php echo esc_html( give_get_price_thousand_separator() ); ?></td> |
|
536 | + <td data-export-label="Thousands Separator"><?php _e('Thousands Separator', 'give'); ?>:</td> |
|
537 | + <td class="help"><?php echo Give()->tooltips->render_help(__('The thousands separator defined in Give settings.', 'give')); ?></td> |
|
538 | + <td><?php echo esc_html(give_get_price_thousand_separator()); ?></td> |
|
540 | 539 | </tr> |
541 | 540 | <tr> |
542 | - <td data-export-label="Success Page"><?php _e( 'Success Page', 'give' ); ?>:</td> |
|
543 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'The page where donors land following a successful transaction.', 'give' ) ); ?></td> |
|
544 | - <td><?php echo ! empty( $give_options['success_page'] ) ? esc_url( get_permalink( $give_options['success_page'] ) ) : '–'; ?></td> |
|
541 | + <td data-export-label="Success Page"><?php _e('Success Page', 'give'); ?>:</td> |
|
542 | + <td class="help"><?php echo Give()->tooltips->render_help(__('The page where donors land following a successful transaction.', 'give')); ?></td> |
|
543 | + <td><?php echo ! empty($give_options['success_page']) ? esc_url(get_permalink($give_options['success_page'])) : '–'; ?></td> |
|
545 | 544 | </tr> |
546 | 545 | <tr> |
547 | - <td data-export-label="Failure Page"><?php _e( 'Failure Page', 'give' ); ?>:</td> |
|
548 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'The page where donors land following a failed transaction.', 'give' ) ); ?></td> |
|
549 | - <td><?php echo ! empty( $give_options['failure_page'] ) ? esc_url( get_permalink( $give_options['failure_page'] ) ) : '–'; ?></td> |
|
546 | + <td data-export-label="Failure Page"><?php _e('Failure Page', 'give'); ?>:</td> |
|
547 | + <td class="help"><?php echo Give()->tooltips->render_help(__('The page where donors land following a failed transaction.', 'give')); ?></td> |
|
548 | + <td><?php echo ! empty($give_options['failure_page']) ? esc_url(get_permalink($give_options['failure_page'])) : '–'; ?></td> |
|
550 | 549 | </tr> |
551 | 550 | <tr> |
552 | - <td data-export-label="Donation History Page"><?php _e( 'Donation History Page', 'give' ); ?>:</td> |
|
553 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'The page where past donations are listed.', 'give' ) ); ?></td> |
|
554 | - <td><?php echo ! empty( $give_options['history_page'] ) ? esc_url( get_permalink( $give_options['history_page'] ) ) : '–'; ?></td> |
|
551 | + <td data-export-label="Donation History Page"><?php _e('Donation History Page', 'give'); ?>:</td> |
|
552 | + <td class="help"><?php echo Give()->tooltips->render_help(__('The page where past donations are listed.', 'give')); ?></td> |
|
553 | + <td><?php echo ! empty($give_options['history_page']) ? esc_url(get_permalink($give_options['history_page'])) : '–'; ?></td> |
|
555 | 554 | </tr> |
556 | 555 | <tr> |
557 | - <td data-export-label="Give Forms Slug"><?php _e( 'Give Forms Slug', 'give' ); ?>:</td> |
|
558 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'The slug used for Give donation forms.', 'give' ) ); ?></td> |
|
559 | - <td><?php echo esc_html( defined( 'GIVE_SLUG' ) ? '/' . GIVE_SLUG . '/' : '/donations/' ); ?></td> |
|
556 | + <td data-export-label="Give Forms Slug"><?php _e('Give Forms Slug', 'give'); ?>:</td> |
|
557 | + <td class="help"><?php echo Give()->tooltips->render_help(__('The slug used for Give donation forms.', 'give')); ?></td> |
|
558 | + <td><?php echo esc_html(defined('GIVE_SLUG') ? '/'.GIVE_SLUG.'/' : '/donations/'); ?></td> |
|
560 | 559 | </tr> |
561 | 560 | <?php |
562 | 561 | $active_gateways = give_get_enabled_payment_gateways(); |
563 | 562 | $enabled_gateways = $default_gateway = ''; |
564 | 563 | |
565 | - if ( $active_gateways ) { |
|
566 | - $default_gateway_is_active = give_is_gateway_active( give_get_default_gateway( null ) ); |
|
564 | + if ($active_gateways) { |
|
565 | + $default_gateway_is_active = give_is_gateway_active(give_get_default_gateway(null)); |
|
567 | 566 | |
568 | - if ( $default_gateway_is_active ) { |
|
569 | - $default_gateway = give_get_default_gateway( null ); |
|
570 | - $default_gateway = $active_gateways[ $default_gateway ]['admin_label']; |
|
567 | + if ($default_gateway_is_active) { |
|
568 | + $default_gateway = give_get_default_gateway(null); |
|
569 | + $default_gateway = $active_gateways[$default_gateway]['admin_label']; |
|
571 | 570 | } else { |
572 | - $default_gateway = __( 'Test Donation', 'give' ); |
|
571 | + $default_gateway = __('Test Donation', 'give'); |
|
573 | 572 | } |
574 | 573 | |
575 | 574 | $gateways = array(); |
576 | 575 | |
577 | - foreach ( $active_gateways as $gateway ) { |
|
576 | + foreach ($active_gateways as $gateway) { |
|
578 | 577 | $gateways[] = $gateway['admin_label']; |
579 | 578 | } |
580 | 579 | |
581 | - $enabled_gateways = implode( ', ', $gateways ); |
|
580 | + $enabled_gateways = implode(', ', $gateways); |
|
582 | 581 | } |
583 | 582 | ?> |
584 | 583 | <tr> |
585 | - <td data-export-label="Enabled Payment Gateways"><?php _e( 'Enabled Payment Gateways', 'give' ); ?>:</td> |
|
586 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'All payment gateways enabled in Give settings.', 'give' ) ); ?></td> |
|
587 | - <td><?php echo esc_html( ! empty( $enabled_gateways ) ? $enabled_gateways : '–' ); ?></td> |
|
584 | + <td data-export-label="Enabled Payment Gateways"><?php _e('Enabled Payment Gateways', 'give'); ?>:</td> |
|
585 | + <td class="help"><?php echo Give()->tooltips->render_help(__('All payment gateways enabled in Give settings.', 'give')); ?></td> |
|
586 | + <td><?php echo esc_html( ! empty($enabled_gateways) ? $enabled_gateways : '–'); ?></td> |
|
588 | 587 | </tr> |
589 | 588 | <tr> |
590 | - <td data-export-label="Default Payment Gateway"><?php _e( 'Default Payment Gateway', 'give' ); ?>:</td> |
|
591 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'The default payment gateway selected in Give settings.', 'give' ) ); ?></td> |
|
592 | - <td><?php echo esc_html( ! empty( $default_gateway ) ? $default_gateway : '–' ); ?></td> |
|
589 | + <td data-export-label="Default Payment Gateway"><?php _e('Default Payment Gateway', 'give'); ?>:</td> |
|
590 | + <td class="help"><?php echo Give()->tooltips->render_help(__('The default payment gateway selected in Give settings.', 'give')); ?></td> |
|
591 | + <td><?php echo esc_html( ! empty($default_gateway) ? $default_gateway : '–'); ?></td> |
|
593 | 592 | </tr> |
594 | 593 | <tr> |
595 | - <td data-export-label="PayPal IPN Verification"><?php _e( 'PayPal IPN Verification', 'give' ); ?>:</td> |
|
596 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'Whether admins requires verification of IPN notifications with PayPal.', 'give' ) ); ?></td> |
|
597 | - <td><?php echo 'enabled' === give_get_option( 'paypal_verification' ) ? __( 'Enabled', 'give' ) : __( 'Disabled', 'give' ); ?></td> |
|
594 | + <td data-export-label="PayPal IPN Verification"><?php _e('PayPal IPN Verification', 'give'); ?>:</td> |
|
595 | + <td class="help"><?php echo Give()->tooltips->render_help(__('Whether admins requires verification of IPN notifications with PayPal.', 'give')); ?></td> |
|
596 | + <td><?php echo 'enabled' === give_get_option('paypal_verification') ? __('Enabled', 'give') : __('Disabled', 'give'); ?></td> |
|
598 | 597 | </tr> |
599 | 598 | <tr> |
600 | - <td data-export-label="PayPal IPN Notifications"><?php _e( 'PayPal IPN Notifications', 'give' ); ?>:</td> |
|
601 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'Displays whether when last PayPal IPN is received with which donation or transaction.', 'give' ) ); ?></td> |
|
599 | + <td data-export-label="PayPal IPN Notifications"><?php _e('PayPal IPN Notifications', 'give'); ?>:</td> |
|
600 | + <td class="help"><?php echo Give()->tooltips->render_help(__('Displays whether when last PayPal IPN is received with which donation or transaction.', 'give')); ?></td> |
|
602 | 601 | <td> |
603 | 602 | <?php |
604 | - $last_paypal_ipn_received = get_option( 'give_last_paypal_ipn_received' ); |
|
605 | - if ( is_array( $last_paypal_ipn_received ) && count( $last_paypal_ipn_received ) > 0 ) { |
|
603 | + $last_paypal_ipn_received = get_option('give_last_paypal_ipn_received'); |
|
604 | + if (is_array($last_paypal_ipn_received) && count($last_paypal_ipn_received) > 0) { |
|
606 | 605 | $donation_id = $last_paypal_ipn_received['payment_id']; |
607 | - $ipn_timestamp = give_get_meta( $donation_id, 'give_last_paypal_ipn_received', true ); |
|
608 | - $transaction_url = 'https://history.paypal.com/cgi-bin/webscr?cmd=_history-details-from-hub&id=' . $last_paypal_ipn_received['transaction_id']; |
|
609 | - $donation_url = site_url() . '/wp-admin/edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&id=' . $donation_id; |
|
606 | + $ipn_timestamp = give_get_meta($donation_id, 'give_last_paypal_ipn_received', true); |
|
607 | + $transaction_url = 'https://history.paypal.com/cgi-bin/webscr?cmd=_history-details-from-hub&id='.$last_paypal_ipn_received['transaction_id']; |
|
608 | + $donation_url = site_url().'/wp-admin/edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&id='.$donation_id; |
|
610 | 609 | echo sprintf( |
611 | - __( 'IPN received for <a href="%s">#%s</a> ( <a href="%s" target="_blank">%s</a> ) on %s at %s. Status %s', 'give' ), |
|
610 | + __('IPN received for <a href="%s">#%s</a> ( <a href="%s" target="_blank">%s</a> ) on %s at %s. Status %s', 'give'), |
|
612 | 611 | $donation_url, |
613 | 612 | $donation_id, |
614 | 613 | $transaction_url, |
615 | 614 | $last_paypal_ipn_received['transaction_id'], |
616 | - date_i18n( 'm/d/Y', $ipn_timestamp ), |
|
617 | - date_i18n( 'H:i', $ipn_timestamp ), |
|
615 | + date_i18n('m/d/Y', $ipn_timestamp), |
|
616 | + date_i18n('H:i', $ipn_timestamp), |
|
618 | 617 | $last_paypal_ipn_received['auth_status'] |
619 | 618 | ); |
620 | 619 | } else { |
@@ -624,9 +623,9 @@ discard block |
||
624 | 623 | </td> |
625 | 624 | </tr> |
626 | 625 | <tr> |
627 | - <td data-export-label="Donor Email Access"><?php _e( 'Donor Email Access', 'give' ); ?>:</td> |
|
628 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'Whether donors can access their donation history using only email.', 'give' ) ); ?></td> |
|
629 | - <td><?php echo 'enabled' === give_get_option( 'email_access' ) ? __( 'Enabled', 'give' ) : __( 'Disabled', 'give' ); ?></td> |
|
626 | + <td data-export-label="Donor Email Access"><?php _e('Donor Email Access', 'give'); ?>:</td> |
|
627 | + <td class="help"><?php echo Give()->tooltips->render_help(__('Whether donors can access their donation history using only email.', 'give')); ?></td> |
|
628 | + <td><?php echo 'enabled' === give_get_option('email_access') ? __('Enabled', 'give') : __('Disabled', 'give'); ?></td> |
|
630 | 629 | </tr> |
631 | 630 | </tbody> |
632 | 631 | </table> |
@@ -634,45 +633,45 @@ discard block |
||
634 | 633 | <table class="give-status-table widefat" cellspacing="0"> |
635 | 634 | <thead> |
636 | 635 | <tr> |
637 | - <th colspan="3" data-export-label="Session Configuration"><h2><?php _e( 'Session Configuration', 'give' ); ?></h2></th> |
|
636 | + <th colspan="3" data-export-label="Session Configuration"><h2><?php _e('Session Configuration', 'give'); ?></h2></th> |
|
638 | 637 | </tr> |
639 | 638 | </thead> |
640 | 639 | <tbody> |
641 | 640 | <tr> |
642 | - <td data-export-label="Give Use Sessions"><?php _e( 'Give Use Sessions', 'give' ); ?>:</td> |
|
643 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'Whether PHP sessions are enforced, enabled, or disabled.', 'give' ) ); ?></td> |
|
644 | - <td><?php echo defined( 'GIVE_USE_PHP_SESSIONS' ) && GIVE_USE_PHP_SESSIONS ? __( 'Enforced', 'give' ) : ( Give()->session->use_php_sessions() ? __( 'Enabled', 'give' ) : __( 'Disabled', 'give' ) ); ?></td> |
|
641 | + <td data-export-label="Give Use Sessions"><?php _e('Give Use Sessions', 'give'); ?>:</td> |
|
642 | + <td class="help"><?php echo Give()->tooltips->render_help(__('Whether PHP sessions are enforced, enabled, or disabled.', 'give')); ?></td> |
|
643 | + <td><?php echo defined('GIVE_USE_PHP_SESSIONS') && GIVE_USE_PHP_SESSIONS ? __('Enforced', 'give') : (Give()->session->use_php_sessions() ? __('Enabled', 'give') : __('Disabled', 'give')); ?></td> |
|
645 | 644 | </tr> |
646 | 645 | <tr> |
647 | - <td data-export-label="Session"><?php _e( 'Session', 'give' ); ?>:</td> |
|
648 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'Whether a PHP session is currently set.', 'give' ) ); ?></td> |
|
649 | - <td><?php echo isset( $_SESSION ) ? __( 'Enabled', 'give' ) : __( 'Disabled', 'give' ); ?></td> |
|
646 | + <td data-export-label="Session"><?php _e('Session', 'give'); ?>:</td> |
|
647 | + <td class="help"><?php echo Give()->tooltips->render_help(__('Whether a PHP session is currently set.', 'give')); ?></td> |
|
648 | + <td><?php echo isset($_SESSION) ? __('Enabled', 'give') : __('Disabled', 'give'); ?></td> |
|
650 | 649 | </tr> |
651 | - <?php if ( isset( $_SESSION ) ) { ?> |
|
650 | + <?php if (isset($_SESSION)) { ?> |
|
652 | 651 | <tr> |
653 | - <td data-export-label="Session Name"><?php _e( 'Session Name', 'give' ); ?>:</td> |
|
654 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'The name of the current PHP session.', 'give' ) ); ?></td> |
|
655 | - <td><?php echo esc_html( ini_get( 'session.name' ) ); ?></td> |
|
652 | + <td data-export-label="Session Name"><?php _e('Session Name', 'give'); ?>:</td> |
|
653 | + <td class="help"><?php echo Give()->tooltips->render_help(__('The name of the current PHP session.', 'give')); ?></td> |
|
654 | + <td><?php echo esc_html(ini_get('session.name')); ?></td> |
|
656 | 655 | </tr> |
657 | 656 | <tr> |
658 | - <td data-export-label="Cookie Path"><?php _e( 'Cookie Path', 'give' ); ?>:</td> |
|
659 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'The cookie path of the current PHP session.', 'give' ) ); ?></td> |
|
660 | - <td><?php echo esc_html( ini_get( 'session.cookie_path' ) ); ?></td> |
|
657 | + <td data-export-label="Cookie Path"><?php _e('Cookie Path', 'give'); ?>:</td> |
|
658 | + <td class="help"><?php echo Give()->tooltips->render_help(__('The cookie path of the current PHP session.', 'give')); ?></td> |
|
659 | + <td><?php echo esc_html(ini_get('session.cookie_path')); ?></td> |
|
661 | 660 | </tr> |
662 | 661 | <tr> |
663 | - <td data-export-label="Save Path"><?php _e( 'Save Path', 'give' ); ?>:</td> |
|
664 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'The save path of the current PHP session.', 'give' ) ); ?></td> |
|
665 | - <td><?php echo esc_html( ini_get( 'session.save_path' ) ); ?></td> |
|
662 | + <td data-export-label="Save Path"><?php _e('Save Path', 'give'); ?>:</td> |
|
663 | + <td class="help"><?php echo Give()->tooltips->render_help(__('The save path of the current PHP session.', 'give')); ?></td> |
|
664 | + <td><?php echo esc_html(ini_get('session.save_path')); ?></td> |
|
666 | 665 | </tr> |
667 | 666 | <tr> |
668 | - <td data-export-label="Use Cookies"><?php _e( 'Use Cookies', 'give' ); ?>:</td> |
|
669 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'Whether the current PHP session is set to use cookies.', 'give' ) ); ?></td> |
|
670 | - <td><?php echo ini_get( 'session.use_cookies' ) ? __( 'Enabled', 'give' ) : __( 'Disabled', 'give' ); ?></td> |
|
667 | + <td data-export-label="Use Cookies"><?php _e('Use Cookies', 'give'); ?>:</td> |
|
668 | + <td class="help"><?php echo Give()->tooltips->render_help(__('Whether the current PHP session is set to use cookies.', 'give')); ?></td> |
|
669 | + <td><?php echo ini_get('session.use_cookies') ? __('Enabled', 'give') : __('Disabled', 'give'); ?></td> |
|
671 | 670 | </tr> |
672 | 671 | <tr> |
673 | - <td data-export-label="Use Only Cookies"><?php _e( 'Use Only Cookies', 'give' ); ?>:</td> |
|
674 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'Whether the current PHP session is set to use only cookies.', 'give' ) ); ?></td> |
|
675 | - <td><?php echo ini_get( 'session.use_only_cookies' ) ? __( 'Enabled', 'give' ) : __( 'Disabled', 'give' ); ?></td> |
|
672 | + <td data-export-label="Use Only Cookies"><?php _e('Use Only Cookies', 'give'); ?>:</td> |
|
673 | + <td class="help"><?php echo Give()->tooltips->render_help(__('Whether the current PHP session is set to use only cookies.', 'give')); ?></td> |
|
674 | + <td><?php echo ini_get('session.use_only_cookies') ? __('Enabled', 'give') : __('Disabled', 'give'); ?></td> |
|
676 | 675 | </tr> |
677 | 676 | <?php } ?> |
678 | 677 | </tbody> |
@@ -681,13 +680,13 @@ discard block |
||
681 | 680 | <table class="give-status-table widefat" cellspacing="0"> |
682 | 681 | <thead> |
683 | 682 | <tr> |
684 | - <th colspan="3" data-export-label="Active Give Add-ons"><h2><?php _e( 'Active Give Add-ons', 'give' ); ?></h2></th> |
|
683 | + <th colspan="3" data-export-label="Active Give Add-ons"><h2><?php _e('Active Give Add-ons', 'give'); ?></h2></th> |
|
685 | 684 | </tr> |
686 | 685 | </thead> |
687 | 686 | <tbody> |
688 | 687 | <?php |
689 | - foreach ( $plugins as $plugin_data ) { |
|
690 | - if ( 'active' != $plugin_data['Status'] || 'add-on' != $plugin_data['Type'] ) { |
|
688 | + foreach ($plugins as $plugin_data) { |
|
689 | + if ('active' != $plugin_data['Status'] || 'add-on' != $plugin_data['Type']) { |
|
691 | 690 | continue; |
692 | 691 | } |
693 | 692 | |
@@ -695,40 +694,40 @@ discard block |
||
695 | 694 | $author_name = $plugin_data['Author']; |
696 | 695 | |
697 | 696 | // Link the plugin name to the plugin URL if available. |
698 | - if ( ! empty( $plugin_data['PluginURI'] ) ) { |
|
697 | + if ( ! empty($plugin_data['PluginURI'])) { |
|
699 | 698 | $plugin_name = sprintf( |
700 | 699 | '<a href="%s" title="%s">%s</a>', |
701 | - esc_url( $plugin_data['PluginURI'] ), |
|
702 | - esc_attr__( 'Visit plugin homepage', 'give' ), |
|
700 | + esc_url($plugin_data['PluginURI']), |
|
701 | + esc_attr__('Visit plugin homepage', 'give'), |
|
703 | 702 | $plugin_name |
704 | 703 | ); |
705 | 704 | } |
706 | 705 | |
707 | 706 | // Link the author name to the author URL if available. |
708 | - if ( ! empty( $plugin_data['AuthorURI'] ) ) { |
|
707 | + if ( ! empty($plugin_data['AuthorURI'])) { |
|
709 | 708 | $author_name = sprintf( |
710 | 709 | '<a href="%s" title="%s">%s</a>', |
711 | - esc_url( $plugin_data['AuthorURI'] ), |
|
712 | - esc_attr__( 'Visit author homepage', 'give' ), |
|
710 | + esc_url($plugin_data['AuthorURI']), |
|
711 | + esc_attr__('Visit author homepage', 'give'), |
|
713 | 712 | $author_name |
714 | 713 | ); |
715 | 714 | } |
716 | 715 | ?> |
717 | 716 | <tr> |
718 | - <td><?php echo wp_kses( $plugin_name, wp_kses_allowed_html( 'post' ) ); ?></td> |
|
717 | + <td><?php echo wp_kses($plugin_name, wp_kses_allowed_html('post')); ?></td> |
|
719 | 718 | <td class="help"> </td> |
720 | 719 | <td> |
721 | 720 | <?php |
722 | - if ( true === $plugin_data['License'] ) { |
|
723 | - echo '<mark class="yes"><span class="dashicons dashicons-yes"></span></mark> ' . __( 'Licensed', 'give' ); |
|
721 | + if (true === $plugin_data['License']) { |
|
722 | + echo '<mark class="yes"><span class="dashicons dashicons-yes"></span></mark> '.__('Licensed', 'give'); |
|
724 | 723 | } else { |
725 | - echo '<mark class="error"><span class="dashicons dashicons-no-alt"></span></mark> ' . __( 'Unlicensed', 'give' ); |
|
724 | + echo '<mark class="error"><span class="dashicons dashicons-no-alt"></span></mark> '.__('Unlicensed', 'give'); |
|
726 | 725 | } |
727 | 726 | |
728 | 727 | echo ' – ' |
729 | - . sprintf( _x( 'by %s', 'by author', 'give' ), wp_kses( $author_name, wp_kses_allowed_html( 'post' ) ) ) |
|
728 | + . sprintf(_x('by %s', 'by author', 'give'), wp_kses($author_name, wp_kses_allowed_html('post'))) |
|
730 | 729 | . ' – ' |
731 | - . esc_html( $plugin_data['Version'] ); |
|
730 | + . esc_html($plugin_data['Version']); |
|
732 | 731 | ?> |
733 | 732 | </td> |
734 | 733 | </tr> |
@@ -741,18 +740,18 @@ discard block |
||
741 | 740 | <table class="give-status-table widefat" cellspacing="0"> |
742 | 741 | <thead> |
743 | 742 | <tr> |
744 | - <th colspan="3" data-export-label="Other Active Plugins"><h2><?php _e( 'Other Active Plugins', 'give' ); ?></h2></th> |
|
743 | + <th colspan="3" data-export-label="Other Active Plugins"><h2><?php _e('Other Active Plugins', 'give'); ?></h2></th> |
|
745 | 744 | </tr> |
746 | 745 | </thead> |
747 | 746 | <tbody> |
748 | 747 | <?php |
749 | - foreach ( $plugins as $plugin_data ) { |
|
750 | - if ( 'active' != $plugin_data['Status'] || 'other' != $plugin_data['Type'] ) { |
|
748 | + foreach ($plugins as $plugin_data) { |
|
749 | + if ('active' != $plugin_data['Status'] || 'other' != $plugin_data['Type']) { |
|
751 | 750 | continue; |
752 | 751 | } |
753 | 752 | |
754 | 753 | // Do not show Give core plugin. |
755 | - if ( 'Give - Donation Plugin' === $plugin_data['Name'] ) { |
|
754 | + if ('Give - Donation Plugin' === $plugin_data['Name']) { |
|
756 | 755 | continue; |
757 | 756 | } |
758 | 757 | |
@@ -760,29 +759,29 @@ discard block |
||
760 | 759 | $author_name = $plugin_data['Author']; |
761 | 760 | |
762 | 761 | // Link the plugin name to the plugin URL if available. |
763 | - if ( ! empty( $plugin_data['PluginURI'] ) ) { |
|
762 | + if ( ! empty($plugin_data['PluginURI'])) { |
|
764 | 763 | $plugin_name = sprintf( |
765 | 764 | '<a href="%s" title="%s">%s</a>', |
766 | - esc_url( $plugin_data['PluginURI'] ), |
|
767 | - esc_attr__( 'Visit plugin homepage', 'give' ), |
|
765 | + esc_url($plugin_data['PluginURI']), |
|
766 | + esc_attr__('Visit plugin homepage', 'give'), |
|
768 | 767 | $plugin_name |
769 | 768 | ); |
770 | 769 | } |
771 | 770 | |
772 | 771 | // Link the author name to the author URL if available. |
773 | - if ( ! empty( $plugin_data['AuthorURI'] ) ) { |
|
772 | + if ( ! empty($plugin_data['AuthorURI'])) { |
|
774 | 773 | $author_name = sprintf( |
775 | 774 | '<a href="%s" title="%s">%s</a>', |
776 | - esc_url( $plugin_data['AuthorURI'] ), |
|
777 | - esc_attr__( 'Visit author homepage', 'give' ), |
|
775 | + esc_url($plugin_data['AuthorURI']), |
|
776 | + esc_attr__('Visit author homepage', 'give'), |
|
778 | 777 | $author_name |
779 | 778 | ); |
780 | 779 | } |
781 | 780 | ?> |
782 | 781 | <tr> |
783 | - <td><?php echo wp_kses( $plugin_name, wp_kses_allowed_html( 'post' ) ); ?></td> |
|
782 | + <td><?php echo wp_kses($plugin_name, wp_kses_allowed_html('post')); ?></td> |
|
784 | 783 | <td class="help"> </td> |
785 | - <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> |
|
784 | + <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> |
|
786 | 785 | </tr> |
787 | 786 | <?php |
788 | 787 | } |
@@ -793,13 +792,13 @@ discard block |
||
793 | 792 | <table class="give-status-table widefat" cellspacing="0"> |
794 | 793 | <thead> |
795 | 794 | <tr> |
796 | - <th colspan="3" data-export-label="Inactive Plugins"><h2><?php _e( 'Inactive Plugins', 'give' ); ?></h2></th> |
|
795 | + <th colspan="3" data-export-label="Inactive Plugins"><h2><?php _e('Inactive Plugins', 'give'); ?></h2></th> |
|
797 | 796 | </tr> |
798 | 797 | </thead> |
799 | 798 | <tbody> |
800 | 799 | <?php |
801 | - foreach ( $plugins as $plugin_data ) { |
|
802 | - if ( 'inactive' != $plugin_data['Status'] ) { |
|
800 | + foreach ($plugins as $plugin_data) { |
|
801 | + if ('inactive' != $plugin_data['Status']) { |
|
803 | 802 | continue; |
804 | 803 | } |
805 | 804 | |
@@ -807,29 +806,29 @@ discard block |
||
807 | 806 | $author_name = $plugin_data['Author']; |
808 | 807 | |
809 | 808 | // Link the plugin name to the plugin URL if available. |
810 | - if ( ! empty( $plugin_data['PluginURI'] ) ) { |
|
809 | + if ( ! empty($plugin_data['PluginURI'])) { |
|
811 | 810 | $plugin_name = sprintf( |
812 | 811 | '<a href="%s" title="%s">%s</a>', |
813 | - esc_url( $plugin_data['PluginURI'] ), |
|
814 | - esc_attr__( 'Visit plugin homepage', 'give' ), |
|
812 | + esc_url($plugin_data['PluginURI']), |
|
813 | + esc_attr__('Visit plugin homepage', 'give'), |
|
815 | 814 | $plugin_name |
816 | 815 | ); |
817 | 816 | } |
818 | 817 | |
819 | 818 | // Link the author name to the author URL if available. |
820 | - if ( ! empty( $plugin_data['AuthorURI'] ) ) { |
|
819 | + if ( ! empty($plugin_data['AuthorURI'])) { |
|
821 | 820 | $author_name = sprintf( |
822 | 821 | '<a href="%s" title="%s">%s</a>', |
823 | - esc_url( $plugin_data['AuthorURI'] ), |
|
824 | - esc_attr__( 'Visit author homepage', 'give' ), |
|
822 | + esc_url($plugin_data['AuthorURI']), |
|
823 | + esc_attr__('Visit author homepage', 'give'), |
|
825 | 824 | $author_name |
826 | 825 | ); |
827 | 826 | } |
828 | 827 | ?> |
829 | 828 | <tr> |
830 | - <td><?php echo wp_kses( $plugin_name, wp_kses_allowed_html( 'post' ) ); ?></td> |
|
829 | + <td><?php echo wp_kses($plugin_name, wp_kses_allowed_html('post')); ?></td> |
|
831 | 830 | <td class="help"> </td> |
832 | - <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> |
|
831 | + <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> |
|
833 | 832 | </tr> |
834 | 833 | <?php |
835 | 834 | } |
@@ -839,38 +838,38 @@ discard block |
||
839 | 838 | |
840 | 839 | <?php |
841 | 840 | $active_mu_plugins = (array) get_mu_plugins(); |
842 | -if ( ! empty( $active_mu_plugins ) ) { |
|
841 | +if ( ! empty($active_mu_plugins)) { |
|
843 | 842 | ?> |
844 | 843 | <table class="give-status-table widefat" cellspacing="0"> |
845 | 844 | <thead> |
846 | 845 | <tr> |
847 | - <th colspan="3" data-export-label="Active MU Plugins"><h2><?php _e( 'Active MU Plugins', 'give' ); ?></h2></th> |
|
846 | + <th colspan="3" data-export-label="Active MU Plugins"><h2><?php _e('Active MU Plugins', 'give'); ?></h2></th> |
|
848 | 847 | </tr> |
849 | 848 | </thead> |
850 | 849 | <tbody> |
851 | 850 | <?php |
852 | 851 | |
853 | - foreach ( $active_mu_plugins as $mu_plugin_data ) { |
|
854 | - if ( ! empty( $mu_plugin_data['Name'] ) ) { |
|
852 | + foreach ($active_mu_plugins as $mu_plugin_data) { |
|
853 | + if ( ! empty($mu_plugin_data['Name'])) { |
|
855 | 854 | // Link the plugin name to the plugin URL if available. |
856 | - $plugin_name = esc_html( $mu_plugin_data['Name'] ); |
|
855 | + $plugin_name = esc_html($mu_plugin_data['Name']); |
|
857 | 856 | |
858 | - if ( ! empty( $mu_plugin_data['PluginURI'] ) ) { |
|
857 | + if ( ! empty($mu_plugin_data['PluginURI'])) { |
|
859 | 858 | $plugin_name = sprintf( |
860 | 859 | '<a href="%s" title="%s">%s</a>', |
861 | - esc_url( $mu_plugin_data['PluginURI'] ), |
|
862 | - esc_attr__( 'Visit plugin homepage', 'give' ), |
|
860 | + esc_url($mu_plugin_data['PluginURI']), |
|
861 | + esc_attr__('Visit plugin homepage', 'give'), |
|
863 | 862 | $plugin_name |
864 | 863 | ); |
865 | 864 | } |
866 | 865 | |
867 | 866 | // Link the author name to the author URL if available. |
868 | - $author_name = esc_html( $mu_plugin_data['Author'] ); |
|
867 | + $author_name = esc_html($mu_plugin_data['Author']); |
|
869 | 868 | |
870 | - if ( ! empty( $mu_plugin_data['AuthorURI'] ) ) { |
|
869 | + if ( ! empty($mu_plugin_data['AuthorURI'])) { |
|
871 | 870 | $author_name = sprintf( |
872 | 871 | '<a href="%s">%s</a>', |
873 | - esc_url( $mu_plugin_data['AuthorURI'] ), |
|
872 | + esc_url($mu_plugin_data['AuthorURI']), |
|
874 | 873 | $author_name |
875 | 874 | ); |
876 | 875 | } |
@@ -878,7 +877,7 @@ discard block |
||
878 | 877 | <tr> |
879 | 878 | <td><?php echo $plugin_name; ?></td> |
880 | 879 | <td class="help"> </td> |
881 | - <td><?php echo sprintf( _x( 'by %s', 'by author', 'give' ), $author_name ) . ' – ' . esc_html( $mu_plugin_data['Version'] ); ?></td> |
|
880 | + <td><?php echo sprintf(_x('by %s', 'by author', 'give'), $author_name).' – '.esc_html($mu_plugin_data['Version']); ?></td> |
|
882 | 881 | </tr> |
883 | 882 | <?php |
884 | 883 | } |
@@ -891,53 +890,53 @@ discard block |
||
891 | 890 | <table class="give-status-table widefat" cellspacing="0"> |
892 | 891 | <thead> |
893 | 892 | <tr> |
894 | - <th colspan="3" data-export-label="Theme"><h2><?php _e( 'Theme', 'give' ); ?></h2></th> |
|
893 | + <th colspan="3" data-export-label="Theme"><h2><?php _e('Theme', 'give'); ?></h2></th> |
|
895 | 894 | </tr> |
896 | 895 | </thead> |
897 | 896 | <?php |
898 | - include_once( ABSPATH . 'wp-admin/includes/theme-install.php' ); |
|
897 | + include_once(ABSPATH.'wp-admin/includes/theme-install.php'); |
|
899 | 898 | $active_theme = wp_get_theme(); |
900 | 899 | ?> |
901 | 900 | <tbody> |
902 | 901 | <tr> |
903 | - <td data-export-label="Name"><?php _e( 'Name', 'give' ); ?>:</td> |
|
904 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'The name of the current active theme.', 'give' ) ); ?></td> |
|
905 | - <td><?php echo esc_html( $active_theme->Name ); ?></td> |
|
902 | + <td data-export-label="Name"><?php _e('Name', 'give'); ?>:</td> |
|
903 | + <td class="help"><?php echo Give()->tooltips->render_help(__('The name of the current active theme.', 'give')); ?></td> |
|
904 | + <td><?php echo esc_html($active_theme->Name); ?></td> |
|
906 | 905 | </tr> |
907 | 906 | <tr> |
908 | - <td data-export-label="Version"><?php _e( 'Version', 'give' ); ?>:</td> |
|
909 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'The installed version of the current active theme.', 'give' ) ); ?></td> |
|
910 | - <td><?php echo esc_html( $active_theme->Version ); ?></td> |
|
907 | + <td data-export-label="Version"><?php _e('Version', 'give'); ?>:</td> |
|
908 | + <td class="help"><?php echo Give()->tooltips->render_help(__('The installed version of the current active theme.', 'give')); ?></td> |
|
909 | + <td><?php echo esc_html($active_theme->Version); ?></td> |
|
911 | 910 | </tr> |
912 | 911 | <tr> |
913 | - <td data-export-label="Author URL"><?php _e( 'Author URL', 'give' ); ?>:</td> |
|
914 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'The theme developer\'s URL.', 'give' ) ); ?></td> |
|
912 | + <td data-export-label="Author URL"><?php _e('Author URL', 'give'); ?>:</td> |
|
913 | + <td class="help"><?php echo Give()->tooltips->render_help(__('The theme developer\'s URL.', 'give')); ?></td> |
|
915 | 914 | <td><?php echo $active_theme->{'Author URI'}; ?></td> |
916 | 915 | </tr> |
917 | 916 | <tr> |
918 | - <td data-export-label="Child Theme"><?php _e( 'Child Theme', 'give' ); ?>:</td> |
|
919 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'Whether the current theme is a child theme.', 'give' ) ); ?></td> |
|
917 | + <td data-export-label="Child Theme"><?php _e('Child Theme', 'give'); ?>:</td> |
|
918 | + <td class="help"><?php echo Give()->tooltips->render_help(__('Whether the current theme is a child theme.', 'give')); ?></td> |
|
920 | 919 | <td><?php |
921 | - 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' ); |
|
920 | + 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'); |
|
922 | 921 | ?></td> |
923 | 922 | </tr> |
924 | 923 | <?php |
925 | - if( is_child_theme() ) { |
|
926 | - $parent_theme = wp_get_theme( $active_theme->Template ); |
|
924 | + if (is_child_theme()) { |
|
925 | + $parent_theme = wp_get_theme($active_theme->Template); |
|
927 | 926 | ?> |
928 | 927 | <tr> |
929 | - <td data-export-label="Parent Theme Name"><?php _e( 'Parent Theme Name', 'give' ); ?>:</td> |
|
930 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'The name of the parent theme.', 'give' ) ); ?></td> |
|
931 | - <td><?php echo esc_html( $parent_theme->Name ); ?></td> |
|
928 | + <td data-export-label="Parent Theme Name"><?php _e('Parent Theme Name', 'give'); ?>:</td> |
|
929 | + <td class="help"><?php echo Give()->tooltips->render_help(__('The name of the parent theme.', 'give')); ?></td> |
|
930 | + <td><?php echo esc_html($parent_theme->Name); ?></td> |
|
932 | 931 | </tr> |
933 | 932 | <tr> |
934 | - <td data-export-label="Parent Theme Version"><?php _e( 'Parent Theme Version', 'give' ); ?>:</td> |
|
935 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'The installed version of the parent theme.', 'give' ) ); ?></td> |
|
936 | - <td><?php echo esc_html( $parent_theme->Version ); ?></td> |
|
933 | + <td data-export-label="Parent Theme Version"><?php _e('Parent Theme Version', 'give'); ?>:</td> |
|
934 | + <td class="help"><?php echo Give()->tooltips->render_help(__('The installed version of the parent theme.', 'give')); ?></td> |
|
935 | + <td><?php echo esc_html($parent_theme->Version); ?></td> |
|
937 | 936 | </tr> |
938 | 937 | <tr> |
939 | - <td data-export-label="Parent Theme Author URL"><?php _e( 'Parent Theme Author URL', 'give' ); ?>:</td> |
|
940 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'The parent theme developers URL.', 'give' ) ); ?></td> |
|
938 | + <td data-export-label="Parent Theme Author URL"><?php _e('Parent Theme Author URL', 'give'); ?>:</td> |
|
939 | + <td class="help"><?php echo Give()->tooltips->render_help(__('The parent theme developers URL.', 'give')); ?></td> |
|
941 | 940 | <td><?php echo $parent_theme->{'Author URI'}; ?></td> |
942 | 941 | </tr> |
943 | 942 | <?php } ?> |
@@ -60,7 +60,12 @@ discard block |
||
60 | 60 | <tr> |
61 | 61 | <td data-export-label="WP Multisite"><?php _e( 'WP Multisite', 'give' ); ?>:</td> |
62 | 62 | <td class="help"><?php echo Give()->tooltips->render_help( __( 'Whether or not you have WordPress Multisite enabled.', 'give' ) ); ?></td> |
63 | - <td><?php if ( is_multisite() ) echo '<span class="dashicons dashicons-yes"></span>'; else echo '–'; ?></td> |
|
63 | + <td><?php if ( is_multisite() ) { |
|
64 | + echo '<span class="dashicons dashicons-yes"></span>'; |
|
65 | +} else { |
|
66 | + echo '–'; |
|
67 | +} |
|
68 | +?></td> |
|
64 | 69 | |
65 | 70 | </tr> |
66 | 71 | <tr> |
@@ -89,9 +94,12 @@ discard block |
||
89 | 94 | <td> |
90 | 95 | <?php if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) : ?> |
91 | 96 | <mark class="yes"><span class="dashicons dashicons-yes"></span></mark> |
92 | - <?php else : ?> |
|
97 | + <?php else { |
|
98 | + : ?> |
|
93 | 99 | <mark class="no">–</mark> |
94 | - <?php endif; ?> |
|
100 | + <?php endif; |
|
101 | +} |
|
102 | +?> |
|
95 | 103 | </td> |
96 | 104 | </tr> |
97 | 105 | <tr> |
@@ -100,9 +108,12 @@ discard block |
||
100 | 108 | <td> |
101 | 109 | <?php if ( defined( 'DISABLE_WP_CRON' ) && DISABLE_WP_CRON ) : ?> |
102 | 110 | <mark class="no">–</mark> |
103 | - <?php else : ?> |
|
111 | + <?php else { |
|
112 | + : ?> |
|
104 | 113 | <mark class="yes"><span class="dashicons dashicons-yes"></span></mark> |
105 | - <?php endif; ?> |
|
114 | + <?php endif; |
|
115 | +} |
|
116 | +?> |
|
106 | 117 | </td> |
107 | 118 | </tr> |
108 | 119 | <tr> |
@@ -918,7 +918,7 @@ |
||
918 | 918 | * @access public |
919 | 919 | * |
920 | 920 | * @param string $meta_key Metadata name. Default is empty. |
921 | - * @param mixed $meta_value Optional. Metadata value. Default is empty. |
|
921 | + * @param string $meta_value Optional. Metadata value. Default is empty. |
|
922 | 922 | * |
923 | 923 | * @return bool False for failure. True for success. |
924 | 924 | */ |
@@ -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 | |
@@ -149,32 +149,32 @@ discard block |
||
149 | 149 | * @param bool $_id_or_email |
150 | 150 | * @param bool $by_user_id |
151 | 151 | */ |
152 | - public function __construct( $_id_or_email = false, $by_user_id = false ) { |
|
152 | + public function __construct($_id_or_email = false, $by_user_id = false) { |
|
153 | 153 | |
154 | 154 | $this->db = Give()->donors; |
155 | 155 | |
156 | 156 | if ( |
157 | 157 | false === $_id_or_email |
158 | - || ( is_numeric( $_id_or_email ) && (int) $_id_or_email !== absint( $_id_or_email ) ) |
|
158 | + || (is_numeric($_id_or_email) && (int) $_id_or_email !== absint($_id_or_email)) |
|
159 | 159 | ) { |
160 | 160 | return false; |
161 | 161 | } |
162 | 162 | |
163 | - $by_user_id = is_bool( $by_user_id ) ? $by_user_id : false; |
|
163 | + $by_user_id = is_bool($by_user_id) ? $by_user_id : false; |
|
164 | 164 | |
165 | - if ( is_numeric( $_id_or_email ) ) { |
|
165 | + if (is_numeric($_id_or_email)) { |
|
166 | 166 | $field = $by_user_id ? 'user_id' : 'id'; |
167 | 167 | } else { |
168 | 168 | $field = 'email'; |
169 | 169 | } |
170 | 170 | |
171 | - $donor = $this->db->get_donor_by( $field, $_id_or_email ); |
|
171 | + $donor = $this->db->get_donor_by($field, $_id_or_email); |
|
172 | 172 | |
173 | - if ( empty( $donor ) || ! is_object( $donor ) ) { |
|
173 | + if (empty($donor) || ! is_object($donor)) { |
|
174 | 174 | return false; |
175 | 175 | } |
176 | 176 | |
177 | - $this->setup_donor( $donor ); |
|
177 | + $this->setup_donor($donor); |
|
178 | 178 | |
179 | 179 | } |
180 | 180 | |
@@ -190,19 +190,19 @@ discard block |
||
190 | 190 | * |
191 | 191 | * @return bool If the setup was successful or not. |
192 | 192 | */ |
193 | - private function setup_donor( $donor ) { |
|
193 | + private function setup_donor($donor) { |
|
194 | 194 | |
195 | - if ( ! is_object( $donor ) ) { |
|
195 | + if ( ! is_object($donor)) { |
|
196 | 196 | return false; |
197 | 197 | } |
198 | 198 | |
199 | 199 | // Get cached donors. |
200 | - $donor_vars = Give_Cache::get_group( $donor->id, 'give-donors' ); |
|
200 | + $donor_vars = Give_Cache::get_group($donor->id, 'give-donors'); |
|
201 | 201 | |
202 | - if( is_null( $donor_vars ) ){ |
|
203 | - foreach ( $donor as $key => $value ) { |
|
202 | + if (is_null($donor_vars)) { |
|
203 | + foreach ($donor as $key => $value) { |
|
204 | 204 | |
205 | - switch ( $key ) { |
|
205 | + switch ($key) { |
|
206 | 206 | |
207 | 207 | case 'notes': |
208 | 208 | $this->$key = $this->get_notes(); |
@@ -216,20 +216,20 @@ discard block |
||
216 | 216 | } |
217 | 217 | |
218 | 218 | // Get donor's all email including primary email. |
219 | - $this->emails = (array) $this->get_meta( 'additional_email', false ); |
|
220 | - $this->emails = array( 'primary' => $this->email ) + $this->emails; |
|
219 | + $this->emails = (array) $this->get_meta('additional_email', false); |
|
220 | + $this->emails = array('primary' => $this->email) + $this->emails; |
|
221 | 221 | |
222 | 222 | $this->setup_address(); |
223 | 223 | |
224 | - Give_Cache::set_group( $donor->id, get_object_vars( $this ), 'give-donors' ); |
|
225 | - } else{ |
|
226 | - foreach ( $donor_vars as $donor_var => $value ) { |
|
224 | + Give_Cache::set_group($donor->id, get_object_vars($this), 'give-donors'); |
|
225 | + } else { |
|
226 | + foreach ($donor_vars as $donor_var => $value) { |
|
227 | 227 | $this->$donor_var = $value; |
228 | 228 | } |
229 | 229 | } |
230 | 230 | |
231 | 231 | // Donor ID and email are the only things that are necessary, make sure they exist. |
232 | - if ( ! empty( $this->id ) && ! empty( $this->email ) ) { |
|
232 | + if ( ! empty($this->id) && ! empty($this->email)) { |
|
233 | 233 | return true; |
234 | 234 | } |
235 | 235 | |
@@ -262,18 +262,18 @@ discard block |
||
262 | 262 | ARRAY_N |
263 | 263 | ); |
264 | 264 | |
265 | - if ( empty( $addresses ) ) { |
|
265 | + if (empty($addresses)) { |
|
266 | 266 | return $this->address; |
267 | 267 | } |
268 | 268 | |
269 | - foreach ( $addresses as $address ) { |
|
270 | - $address[0] = str_replace( '_give_donor_address_', '', $address[0] ); |
|
271 | - $address[0] = explode( '_', $address[0] ); |
|
269 | + foreach ($addresses as $address) { |
|
270 | + $address[0] = str_replace('_give_donor_address_', '', $address[0]); |
|
271 | + $address[0] = explode('_', $address[0]); |
|
272 | 272 | |
273 | - if ( 3 === count( $address[0] ) ) { |
|
274 | - $this->address[ $address[0][0] ][ $address[0][2] ][ $address[0][1] ] = $address[1]; |
|
273 | + if (3 === count($address[0])) { |
|
274 | + $this->address[$address[0][0]][$address[0][2]][$address[0][1]] = $address[1]; |
|
275 | 275 | } else { |
276 | - $this->address[ $address[0][0] ][ $address[0][1] ] = $address[1]; |
|
276 | + $this->address[$address[0][0]][$address[0][1]] = $address[1]; |
|
277 | 277 | } |
278 | 278 | } |
279 | 279 | } |
@@ -287,16 +287,16 @@ discard block |
||
287 | 287 | * |
288 | 288 | * @return mixed|\WP_Error |
289 | 289 | */ |
290 | - public function __get( $key ) { |
|
290 | + public function __get($key) { |
|
291 | 291 | |
292 | - if ( method_exists( $this, 'get_' . $key ) ) { |
|
292 | + if (method_exists($this, 'get_'.$key)) { |
|
293 | 293 | |
294 | - return call_user_func( array( $this, 'get_' . $key ) ); |
|
294 | + return call_user_func(array($this, 'get_'.$key)); |
|
295 | 295 | |
296 | 296 | } else { |
297 | 297 | |
298 | 298 | /* translators: %s: property key */ |
299 | - return new WP_Error( 'give-donor-invalid-property', sprintf( esc_html__( 'Can\'t get property %s.', 'give' ), $key ) ); |
|
299 | + return new WP_Error('give-donor-invalid-property', sprintf(esc_html__('Can\'t get property %s.', 'give'), $key)); |
|
300 | 300 | |
301 | 301 | } |
302 | 302 | |
@@ -312,9 +312,9 @@ discard block |
||
312 | 312 | * |
313 | 313 | * @return bool|int False if not a valid creation, donor ID if user is found or valid creation. |
314 | 314 | */ |
315 | - public function create( $data = array() ) { |
|
315 | + public function create($data = array()) { |
|
316 | 316 | |
317 | - if ( $this->id != 0 || empty( $data ) ) { |
|
317 | + if ($this->id != 0 || empty($data)) { |
|
318 | 318 | return false; |
319 | 319 | } |
320 | 320 | |
@@ -322,15 +322,15 @@ discard block |
||
322 | 322 | 'payment_ids' => '', |
323 | 323 | ); |
324 | 324 | |
325 | - $args = wp_parse_args( $data, $defaults ); |
|
326 | - $args = $this->sanitize_columns( $args ); |
|
325 | + $args = wp_parse_args($data, $defaults); |
|
326 | + $args = $this->sanitize_columns($args); |
|
327 | 327 | |
328 | - if ( empty( $args['email'] ) || ! is_email( $args['email'] ) ) { |
|
328 | + if (empty($args['email']) || ! is_email($args['email'])) { |
|
329 | 329 | return false; |
330 | 330 | } |
331 | 331 | |
332 | - if ( ! empty( $args['payment_ids'] ) && is_array( $args['payment_ids'] ) ) { |
|
333 | - $args['payment_ids'] = implode( ',', array_unique( array_values( $args['payment_ids'] ) ) ); |
|
332 | + if ( ! empty($args['payment_ids']) && is_array($args['payment_ids'])) { |
|
333 | + $args['payment_ids'] = implode(',', array_unique(array_values($args['payment_ids']))); |
|
334 | 334 | } |
335 | 335 | |
336 | 336 | /** |
@@ -340,18 +340,18 @@ discard block |
||
340 | 340 | * |
341 | 341 | * @param array $args Donor attributes. |
342 | 342 | */ |
343 | - do_action( 'give_donor_pre_create', $args ); |
|
343 | + do_action('give_donor_pre_create', $args); |
|
344 | 344 | |
345 | 345 | $created = false; |
346 | 346 | |
347 | 347 | // The DB class 'add' implies an update if the donor being asked to be created already exists |
348 | - if ( $this->db->add( $data ) ) { |
|
348 | + if ($this->db->add($data)) { |
|
349 | 349 | |
350 | 350 | // We've successfully added/updated the donor, reset the class vars with the new data |
351 | - $donor = $this->db->get_donor_by( 'email', $args['email'] ); |
|
351 | + $donor = $this->db->get_donor_by('email', $args['email']); |
|
352 | 352 | |
353 | 353 | // Setup the donor data with the values from DB |
354 | - $this->setup_donor( $donor ); |
|
354 | + $this->setup_donor($donor); |
|
355 | 355 | |
356 | 356 | $created = $this->id; |
357 | 357 | } |
@@ -364,7 +364,7 @@ discard block |
||
364 | 364 | * @param bool|int $created False if not a valid creation, donor ID if user is found or valid creation. |
365 | 365 | * @param array $args Customer attributes. |
366 | 366 | */ |
367 | - do_action( 'give_donor_post_create', $created, $args ); |
|
367 | + do_action('give_donor_post_create', $created, $args); |
|
368 | 368 | |
369 | 369 | return $created; |
370 | 370 | |
@@ -380,13 +380,13 @@ discard block |
||
380 | 380 | * |
381 | 381 | * @return bool If the update was successful or not. |
382 | 382 | */ |
383 | - public function update( $data = array() ) { |
|
383 | + public function update($data = array()) { |
|
384 | 384 | |
385 | - if ( empty( $data ) ) { |
|
385 | + if (empty($data)) { |
|
386 | 386 | return false; |
387 | 387 | } |
388 | 388 | |
389 | - $data = $this->sanitize_columns( $data ); |
|
389 | + $data = $this->sanitize_columns($data); |
|
390 | 390 | |
391 | 391 | /** |
392 | 392 | * Fires before updating donors. |
@@ -396,15 +396,15 @@ discard block |
||
396 | 396 | * @param int $donor_id Donor id. |
397 | 397 | * @param array $data Donor attributes. |
398 | 398 | */ |
399 | - do_action( 'give_donor_pre_update', $this->id, $data ); |
|
399 | + do_action('give_donor_pre_update', $this->id, $data); |
|
400 | 400 | |
401 | 401 | $updated = false; |
402 | 402 | |
403 | - if ( $this->db->update( $this->id, $data ) ) { |
|
403 | + if ($this->db->update($this->id, $data)) { |
|
404 | 404 | |
405 | - $donor = $this->db->get_donor_by( 'id', $this->id ); |
|
405 | + $donor = $this->db->get_donor_by('id', $this->id); |
|
406 | 406 | |
407 | - $this->setup_donor( $donor ); |
|
407 | + $this->setup_donor($donor); |
|
408 | 408 | |
409 | 409 | $updated = true; |
410 | 410 | } |
@@ -418,7 +418,7 @@ discard block |
||
418 | 418 | * @param int $donor_id Donor id. |
419 | 419 | * @param array $data Donor attributes. |
420 | 420 | */ |
421 | - do_action( 'give_donor_post_update', $updated, $this->id, $data ); |
|
421 | + do_action('give_donor_post_update', $updated, $this->id, $data); |
|
422 | 422 | |
423 | 423 | return $updated; |
424 | 424 | } |
@@ -436,27 +436,27 @@ discard block |
||
436 | 436 | * |
437 | 437 | * @return bool If the attachment was successfully. |
438 | 438 | */ |
439 | - public function attach_payment( $payment_id = 0, $update_stats = true ) { |
|
439 | + public function attach_payment($payment_id = 0, $update_stats = true) { |
|
440 | 440 | |
441 | - if ( empty( $payment_id ) ) { |
|
441 | + if (empty($payment_id)) { |
|
442 | 442 | return false; |
443 | 443 | } |
444 | 444 | |
445 | - if ( empty( $this->payment_ids ) ) { |
|
445 | + if (empty($this->payment_ids)) { |
|
446 | 446 | |
447 | 447 | $new_payment_ids = $payment_id; |
448 | 448 | |
449 | 449 | } else { |
450 | 450 | |
451 | - $payment_ids = array_map( 'absint', explode( ',', $this->payment_ids ) ); |
|
451 | + $payment_ids = array_map('absint', explode(',', $this->payment_ids)); |
|
452 | 452 | |
453 | - if ( in_array( $payment_id, $payment_ids ) ) { |
|
453 | + if (in_array($payment_id, $payment_ids)) { |
|
454 | 454 | $update_stats = false; |
455 | 455 | } |
456 | 456 | |
457 | 457 | $payment_ids[] = $payment_id; |
458 | 458 | |
459 | - $new_payment_ids = implode( ',', array_unique( array_values( $payment_ids ) ) ); |
|
459 | + $new_payment_ids = implode(',', array_unique(array_values($payment_ids))); |
|
460 | 460 | |
461 | 461 | } |
462 | 462 | |
@@ -468,20 +468,20 @@ discard block |
||
468 | 468 | * @param int $payment_id Payment id. |
469 | 469 | * @param int $donor_id Customer id. |
470 | 470 | */ |
471 | - do_action( 'give_donor_pre_attach_payment', $payment_id, $this->id ); |
|
471 | + do_action('give_donor_pre_attach_payment', $payment_id, $this->id); |
|
472 | 472 | |
473 | - $payment_added = $this->update( array( 'payment_ids' => $new_payment_ids ) ); |
|
473 | + $payment_added = $this->update(array('payment_ids' => $new_payment_ids)); |
|
474 | 474 | |
475 | - if ( $payment_added ) { |
|
475 | + if ($payment_added) { |
|
476 | 476 | |
477 | 477 | $this->payment_ids = $new_payment_ids; |
478 | 478 | |
479 | 479 | // We added this payment successfully, increment the stats |
480 | - if ( $update_stats ) { |
|
481 | - $payment_amount = give_donation_amount( $payment_id, array( 'type' => 'stats' ) ); |
|
480 | + if ($update_stats) { |
|
481 | + $payment_amount = give_donation_amount($payment_id, array('type' => 'stats')); |
|
482 | 482 | |
483 | - if ( ! empty( $payment_amount ) ) { |
|
484 | - $this->increase_value( $payment_amount ); |
|
483 | + if ( ! empty($payment_amount)) { |
|
484 | + $this->increase_value($payment_amount); |
|
485 | 485 | } |
486 | 486 | |
487 | 487 | $this->increase_purchase_count(); |
@@ -497,7 +497,7 @@ discard block |
||
497 | 497 | * @param int $payment_id Payment id. |
498 | 498 | * @param int $donor_id Donor id. |
499 | 499 | */ |
500 | - do_action( 'give_donor_post_attach_payment', $payment_added, $payment_id, $this->id ); |
|
500 | + do_action('give_donor_post_attach_payment', $payment_added, $payment_id, $this->id); |
|
501 | 501 | |
502 | 502 | return $payment_added; |
503 | 503 | } |
@@ -515,33 +515,33 @@ discard block |
||
515 | 515 | * |
516 | 516 | * @return boolean If the removal was successful. |
517 | 517 | */ |
518 | - public function remove_payment( $payment_id = 0, $update_stats = true ) { |
|
518 | + public function remove_payment($payment_id = 0, $update_stats = true) { |
|
519 | 519 | |
520 | - if ( empty( $payment_id ) ) { |
|
520 | + if (empty($payment_id)) { |
|
521 | 521 | return false; |
522 | 522 | } |
523 | 523 | |
524 | - $payment = new Give_Payment( $payment_id ); |
|
524 | + $payment = new Give_Payment($payment_id); |
|
525 | 525 | |
526 | - if ( 'publish' !== $payment->status && 'revoked' !== $payment->status ) { |
|
526 | + if ('publish' !== $payment->status && 'revoked' !== $payment->status) { |
|
527 | 527 | $update_stats = false; |
528 | 528 | } |
529 | 529 | |
530 | 530 | $new_payment_ids = ''; |
531 | 531 | |
532 | - if ( ! empty( $this->payment_ids ) ) { |
|
532 | + if ( ! empty($this->payment_ids)) { |
|
533 | 533 | |
534 | - $payment_ids = array_map( 'absint', explode( ',', $this->payment_ids ) ); |
|
534 | + $payment_ids = array_map('absint', explode(',', $this->payment_ids)); |
|
535 | 535 | |
536 | - $pos = array_search( $payment_id, $payment_ids ); |
|
537 | - if ( false === $pos ) { |
|
536 | + $pos = array_search($payment_id, $payment_ids); |
|
537 | + if (false === $pos) { |
|
538 | 538 | return false; |
539 | 539 | } |
540 | 540 | |
541 | - unset( $payment_ids[ $pos ] ); |
|
542 | - $payment_ids = array_filter( $payment_ids ); |
|
541 | + unset($payment_ids[$pos]); |
|
542 | + $payment_ids = array_filter($payment_ids); |
|
543 | 543 | |
544 | - $new_payment_ids = implode( ',', array_unique( array_values( $payment_ids ) ) ); |
|
544 | + $new_payment_ids = implode(',', array_unique(array_values($payment_ids))); |
|
545 | 545 | |
546 | 546 | } |
547 | 547 | |
@@ -553,20 +553,20 @@ discard block |
||
553 | 553 | * @param int $payment_id Payment id. |
554 | 554 | * @param int $donor_id Customer id. |
555 | 555 | */ |
556 | - do_action( 'give_donor_pre_remove_payment', $payment_id, $this->id ); |
|
556 | + do_action('give_donor_pre_remove_payment', $payment_id, $this->id); |
|
557 | 557 | |
558 | - $payment_removed = $this->update( array( 'payment_ids' => $new_payment_ids ) ); |
|
558 | + $payment_removed = $this->update(array('payment_ids' => $new_payment_ids)); |
|
559 | 559 | |
560 | - if ( $payment_removed ) { |
|
560 | + if ($payment_removed) { |
|
561 | 561 | |
562 | 562 | $this->payment_ids = $new_payment_ids; |
563 | 563 | |
564 | - if ( $update_stats ) { |
|
564 | + if ($update_stats) { |
|
565 | 565 | // We removed this payment successfully, decrement the stats |
566 | - $payment_amount = give_donation_amount( $payment_id ); |
|
566 | + $payment_amount = give_donation_amount($payment_id); |
|
567 | 567 | |
568 | - if ( ! empty( $payment_amount ) ) { |
|
569 | - $this->decrease_value( $payment_amount ); |
|
568 | + if ( ! empty($payment_amount)) { |
|
569 | + $this->decrease_value($payment_amount); |
|
570 | 570 | } |
571 | 571 | |
572 | 572 | $this->decrease_donation_count(); |
@@ -582,7 +582,7 @@ discard block |
||
582 | 582 | * @param int $payment_id Payment id. |
583 | 583 | * @param int $donor_id Donor id. |
584 | 584 | */ |
585 | - do_action( 'give_donor_post_remove_payment', $payment_removed, $payment_id, $this->id ); |
|
585 | + do_action('give_donor_post_remove_payment', $payment_removed, $payment_id, $this->id); |
|
586 | 586 | |
587 | 587 | return $payment_removed; |
588 | 588 | |
@@ -598,10 +598,10 @@ discard block |
||
598 | 598 | * |
599 | 599 | * @return int The donation count. |
600 | 600 | */ |
601 | - public function increase_purchase_count( $count = 1 ) { |
|
601 | + public function increase_purchase_count($count = 1) { |
|
602 | 602 | |
603 | 603 | // Make sure it's numeric and not negative. |
604 | - if ( ! is_numeric( $count ) || $count != absint( $count ) ) { |
|
604 | + if ( ! is_numeric($count) || $count != absint($count)) { |
|
605 | 605 | return false; |
606 | 606 | } |
607 | 607 | |
@@ -615,9 +615,9 @@ discard block |
||
615 | 615 | * @param int $count The number to increase by. |
616 | 616 | * @param int $donor_id Donor id. |
617 | 617 | */ |
618 | - do_action( 'give_donor_pre_increase_donation_count', $count, $this->id ); |
|
618 | + do_action('give_donor_pre_increase_donation_count', $count, $this->id); |
|
619 | 619 | |
620 | - if ( $this->update( array( 'purchase_count' => $new_total ) ) ) { |
|
620 | + if ($this->update(array('purchase_count' => $new_total))) { |
|
621 | 621 | $this->purchase_count = $new_total; |
622 | 622 | } |
623 | 623 | |
@@ -630,7 +630,7 @@ discard block |
||
630 | 630 | * @param int $count The number increased by. |
631 | 631 | * @param int $donor_id Donor id. |
632 | 632 | */ |
633 | - do_action( 'give_donor_post_increase_donation_count', $this->purchase_count, $count, $this->id ); |
|
633 | + do_action('give_donor_post_increase_donation_count', $this->purchase_count, $count, $this->id); |
|
634 | 634 | |
635 | 635 | return $this->purchase_count; |
636 | 636 | } |
@@ -645,16 +645,16 @@ discard block |
||
645 | 645 | * |
646 | 646 | * @return mixed If successful, the new count, otherwise false. |
647 | 647 | */ |
648 | - public function decrease_donation_count( $count = 1 ) { |
|
648 | + public function decrease_donation_count($count = 1) { |
|
649 | 649 | |
650 | 650 | // Make sure it's numeric and not negative |
651 | - if ( ! is_numeric( $count ) || $count != absint( $count ) ) { |
|
651 | + if ( ! is_numeric($count) || $count != absint($count)) { |
|
652 | 652 | return false; |
653 | 653 | } |
654 | 654 | |
655 | 655 | $new_total = (int) $this->purchase_count - (int) $count; |
656 | 656 | |
657 | - if ( $new_total < 0 ) { |
|
657 | + if ($new_total < 0) { |
|
658 | 658 | $new_total = 0; |
659 | 659 | } |
660 | 660 | |
@@ -666,9 +666,9 @@ discard block |
||
666 | 666 | * @param int $count The number to decrease by. |
667 | 667 | * @param int $donor_id Customer id. |
668 | 668 | */ |
669 | - do_action( 'give_donor_pre_decrease_donation_count', $count, $this->id ); |
|
669 | + do_action('give_donor_pre_decrease_donation_count', $count, $this->id); |
|
670 | 670 | |
671 | - if ( $this->update( array( 'purchase_count' => $new_total ) ) ) { |
|
671 | + if ($this->update(array('purchase_count' => $new_total))) { |
|
672 | 672 | $this->purchase_count = $new_total; |
673 | 673 | } |
674 | 674 | |
@@ -681,7 +681,7 @@ discard block |
||
681 | 681 | * @param int $count The number decreased by. |
682 | 682 | * @param int $donor_id Donor id. |
683 | 683 | */ |
684 | - do_action( 'give_donor_post_decrease_donation_count', $this->purchase_count, $count, $this->id ); |
|
684 | + do_action('give_donor_post_decrease_donation_count', $this->purchase_count, $count, $this->id); |
|
685 | 685 | |
686 | 686 | return $this->purchase_count; |
687 | 687 | } |
@@ -696,9 +696,9 @@ discard block |
||
696 | 696 | * |
697 | 697 | * @return mixed If successful, the new value, otherwise false. |
698 | 698 | */ |
699 | - public function increase_value( $value = 0.00 ) { |
|
699 | + public function increase_value($value = 0.00) { |
|
700 | 700 | |
701 | - $new_value = floatval( $this->purchase_value ) + $value; |
|
701 | + $new_value = floatval($this->purchase_value) + $value; |
|
702 | 702 | |
703 | 703 | /** |
704 | 704 | * Fires before increasing donor lifetime value. |
@@ -708,9 +708,9 @@ discard block |
||
708 | 708 | * @param float $value The value to increase by. |
709 | 709 | * @param int $donor_id Customer id. |
710 | 710 | */ |
711 | - do_action( 'give_donor_pre_increase_value', $value, $this->id ); |
|
711 | + do_action('give_donor_pre_increase_value', $value, $this->id); |
|
712 | 712 | |
713 | - if ( $this->update( array( 'purchase_value' => $new_value ) ) ) { |
|
713 | + if ($this->update(array('purchase_value' => $new_value))) { |
|
714 | 714 | $this->purchase_value = $new_value; |
715 | 715 | } |
716 | 716 | |
@@ -723,7 +723,7 @@ discard block |
||
723 | 723 | * @param float $value The value increased by. |
724 | 724 | * @param int $donor_id Donor id. |
725 | 725 | */ |
726 | - do_action( 'give_donor_post_increase_value', $this->purchase_value, $value, $this->id ); |
|
726 | + do_action('give_donor_post_increase_value', $this->purchase_value, $value, $this->id); |
|
727 | 727 | |
728 | 728 | return $this->purchase_value; |
729 | 729 | } |
@@ -738,11 +738,11 @@ discard block |
||
738 | 738 | * |
739 | 739 | * @return mixed If successful, the new value, otherwise false. |
740 | 740 | */ |
741 | - public function decrease_value( $value = 0.00 ) { |
|
741 | + public function decrease_value($value = 0.00) { |
|
742 | 742 | |
743 | - $new_value = floatval( $this->purchase_value ) - $value; |
|
743 | + $new_value = floatval($this->purchase_value) - $value; |
|
744 | 744 | |
745 | - if ( $new_value < 0 ) { |
|
745 | + if ($new_value < 0) { |
|
746 | 746 | $new_value = 0.00; |
747 | 747 | } |
748 | 748 | |
@@ -754,9 +754,9 @@ discard block |
||
754 | 754 | * @param float $value The value to decrease by. |
755 | 755 | * @param int $donor_id Donor id. |
756 | 756 | */ |
757 | - do_action( 'give_donor_pre_decrease_value', $value, $this->id ); |
|
757 | + do_action('give_donor_pre_decrease_value', $value, $this->id); |
|
758 | 758 | |
759 | - if ( $this->update( array( 'purchase_value' => $new_value ) ) ) { |
|
759 | + if ($this->update(array('purchase_value' => $new_value))) { |
|
760 | 760 | $this->purchase_value = $new_value; |
761 | 761 | } |
762 | 762 | |
@@ -769,7 +769,7 @@ discard block |
||
769 | 769 | * @param float $value The value decreased by. |
770 | 770 | * @param int $donor_id Donor id. |
771 | 771 | */ |
772 | - do_action( 'give_donor_post_decrease_value', $this->purchase_value, $value, $this->id ); |
|
772 | + do_action('give_donor_post_decrease_value', $this->purchase_value, $value, $this->id); |
|
773 | 773 | |
774 | 774 | return $this->purchase_value; |
775 | 775 | } |
@@ -788,7 +788,7 @@ discard block |
||
788 | 788 | * |
789 | 789 | * @return mixed If successful, the new donation stat value, otherwise false. |
790 | 790 | */ |
791 | - public function update_donation_value( $curr_amount, $new_amount ) { |
|
791 | + public function update_donation_value($curr_amount, $new_amount) { |
|
792 | 792 | /** |
793 | 793 | * Payment total difference value can be: |
794 | 794 | * zero (in case amount not change) |
@@ -798,15 +798,15 @@ discard block |
||
798 | 798 | $payment_total_diff = $new_amount - $curr_amount; |
799 | 799 | |
800 | 800 | // We do not need to update donation stat if donation did not change. |
801 | - if ( ! $payment_total_diff ) { |
|
801 | + if ( ! $payment_total_diff) { |
|
802 | 802 | return false; |
803 | 803 | } |
804 | 804 | |
805 | - if ( $payment_total_diff > 0 ) { |
|
806 | - $this->increase_value( $payment_total_diff ); |
|
805 | + if ($payment_total_diff > 0) { |
|
806 | + $this->increase_value($payment_total_diff); |
|
807 | 807 | } else { |
808 | 808 | // Pass payment total difference as +ve value to decrease amount from user lifetime stat. |
809 | - $this->decrease_value( - $payment_total_diff ); |
|
809 | + $this->decrease_value( -$payment_total_diff ); |
|
810 | 810 | } |
811 | 811 | |
812 | 812 | return $this->purchase_value; |
@@ -823,15 +823,15 @@ discard block |
||
823 | 823 | * |
824 | 824 | * @return array The notes requested. |
825 | 825 | */ |
826 | - public function get_notes( $length = 20, $paged = 1 ) { |
|
826 | + public function get_notes($length = 20, $paged = 1) { |
|
827 | 827 | |
828 | - $length = is_numeric( $length ) ? $length : 20; |
|
829 | - $offset = is_numeric( $paged ) && $paged != 1 ? ( ( absint( $paged ) - 1 ) * $length ) : 0; |
|
828 | + $length = is_numeric($length) ? $length : 20; |
|
829 | + $offset = is_numeric($paged) && $paged != 1 ? ((absint($paged) - 1) * $length) : 0; |
|
830 | 830 | |
831 | 831 | $all_notes = $this->get_raw_notes(); |
832 | - $notes_array = array_reverse( array_filter( explode( "\n\n", $all_notes ) ) ); |
|
832 | + $notes_array = array_reverse(array_filter(explode("\n\n", $all_notes))); |
|
833 | 833 | |
834 | - $desired_notes = array_slice( $notes_array, $offset, $length ); |
|
834 | + $desired_notes = array_slice($notes_array, $offset, $length); |
|
835 | 835 | |
836 | 836 | return $desired_notes; |
837 | 837 | |
@@ -848,9 +848,9 @@ discard block |
||
848 | 848 | public function get_notes_count() { |
849 | 849 | |
850 | 850 | $all_notes = $this->get_raw_notes(); |
851 | - $notes_array = array_reverse( array_filter( explode( "\n\n", $all_notes ) ) ); |
|
851 | + $notes_array = array_reverse(array_filter(explode("\n\n", $all_notes))); |
|
852 | 852 | |
853 | - return count( $notes_array ); |
|
853 | + return count($notes_array); |
|
854 | 854 | |
855 | 855 | } |
856 | 856 | |
@@ -863,7 +863,7 @@ discard block |
||
863 | 863 | * |
864 | 864 | * @return string|float |
865 | 865 | */ |
866 | - public function get_total_donation_amount( $args = array() ) { |
|
866 | + public function get_total_donation_amount($args = array()) { |
|
867 | 867 | |
868 | 868 | /** |
869 | 869 | * Filter total donation amount. |
@@ -874,7 +874,7 @@ discard block |
||
874 | 874 | * @param integer $donor_id Donor ID. |
875 | 875 | * @param array $args Pass additional data. |
876 | 876 | */ |
877 | - return apply_filters( 'give_get_total_donation_amount', $this->purchase_value, $this->id, $args ); |
|
877 | + return apply_filters('give_get_total_donation_amount', $this->purchase_value, $this->id, $args); |
|
878 | 878 | } |
879 | 879 | |
880 | 880 | /** |
@@ -887,22 +887,22 @@ discard block |
||
887 | 887 | * |
888 | 888 | * @return string|boolean The new note if added successfully, false otherwise. |
889 | 889 | */ |
890 | - public function add_note( $note = '' ) { |
|
890 | + public function add_note($note = '') { |
|
891 | 891 | |
892 | - $note = trim( $note ); |
|
893 | - if ( empty( $note ) ) { |
|
892 | + $note = trim($note); |
|
893 | + if (empty($note)) { |
|
894 | 894 | return false; |
895 | 895 | } |
896 | 896 | |
897 | 897 | $notes = $this->get_raw_notes(); |
898 | 898 | |
899 | - if ( empty( $notes ) ) { |
|
899 | + if (empty($notes)) { |
|
900 | 900 | $notes = ''; |
901 | 901 | } |
902 | 902 | |
903 | - $note_string = date_i18n( 'F j, Y H:i:s', current_time( 'timestamp' ) ) . ' - ' . $note; |
|
904 | - $new_note = apply_filters( 'give_customer_add_note_string', $note_string ); |
|
905 | - $notes .= "\n\n" . $new_note; |
|
903 | + $note_string = date_i18n('F j, Y H:i:s', current_time('timestamp')).' - '.$note; |
|
904 | + $new_note = apply_filters('give_customer_add_note_string', $note_string); |
|
905 | + $notes .= "\n\n".$new_note; |
|
906 | 906 | |
907 | 907 | /** |
908 | 908 | * Fires before donor note is added. |
@@ -912,11 +912,11 @@ discard block |
||
912 | 912 | * @param string $new_note New note to add. |
913 | 913 | * @param int $donor_id Donor id. |
914 | 914 | */ |
915 | - do_action( 'give_donor_pre_add_note', $new_note, $this->id ); |
|
915 | + do_action('give_donor_pre_add_note', $new_note, $this->id); |
|
916 | 916 | |
917 | - $updated = $this->update( array( 'notes' => $notes ) ); |
|
917 | + $updated = $this->update(array('notes' => $notes)); |
|
918 | 918 | |
919 | - if ( $updated ) { |
|
919 | + if ($updated) { |
|
920 | 920 | $this->notes = $this->get_notes(); |
921 | 921 | } |
922 | 922 | |
@@ -929,7 +929,7 @@ discard block |
||
929 | 929 | * @param string $new_note New note added. |
930 | 930 | * @param int $donor_id Donor id. |
931 | 931 | */ |
932 | - do_action( 'give_donor_post_add_note', $this->notes, $new_note, $this->id ); |
|
932 | + do_action('give_donor_post_add_note', $this->notes, $new_note, $this->id); |
|
933 | 933 | |
934 | 934 | // Return the formatted note, so we can test, as well as update any displays |
935 | 935 | return $new_note; |
@@ -946,7 +946,7 @@ discard block |
||
946 | 946 | */ |
947 | 947 | private function get_raw_notes() { |
948 | 948 | |
949 | - $all_notes = $this->db->get_column( 'notes', $this->id ); |
|
949 | + $all_notes = $this->db->get_column('notes', $this->id); |
|
950 | 950 | |
951 | 951 | return $all_notes; |
952 | 952 | |
@@ -963,8 +963,8 @@ discard block |
||
963 | 963 | * |
964 | 964 | * @return mixed Will be an array if $single is false. Will be value of meta data field if $single is true. |
965 | 965 | */ |
966 | - public function get_meta( $meta_key = '', $single = true ) { |
|
967 | - return Give()->donor_meta->get_meta( $this->id, $meta_key, $single ); |
|
966 | + public function get_meta($meta_key = '', $single = true) { |
|
967 | + return Give()->donor_meta->get_meta($this->id, $meta_key, $single); |
|
968 | 968 | } |
969 | 969 | |
970 | 970 | /** |
@@ -979,8 +979,8 @@ discard block |
||
979 | 979 | * |
980 | 980 | * @return bool False for failure. True for success. |
981 | 981 | */ |
982 | - public function add_meta( $meta_key = '', $meta_value, $unique = false ) { |
|
983 | - return Give()->donor_meta->add_meta( $this->id, $meta_key, $meta_value, $unique ); |
|
982 | + public function add_meta($meta_key = '', $meta_value, $unique = false) { |
|
983 | + return Give()->donor_meta->add_meta($this->id, $meta_key, $meta_value, $unique); |
|
984 | 984 | } |
985 | 985 | |
986 | 986 | /** |
@@ -995,8 +995,8 @@ discard block |
||
995 | 995 | * |
996 | 996 | * @return bool False on failure, true if success. |
997 | 997 | */ |
998 | - public function update_meta( $meta_key = '', $meta_value, $prev_value = '' ) { |
|
999 | - return Give()->donor_meta->update_meta( $this->id, $meta_key, $meta_value, $prev_value ); |
|
998 | + public function update_meta($meta_key = '', $meta_value, $prev_value = '') { |
|
999 | + return Give()->donor_meta->update_meta($this->id, $meta_key, $meta_value, $prev_value); |
|
1000 | 1000 | } |
1001 | 1001 | |
1002 | 1002 | /** |
@@ -1010,8 +1010,8 @@ discard block |
||
1010 | 1010 | * |
1011 | 1011 | * @return bool False for failure. True for success. |
1012 | 1012 | */ |
1013 | - public function delete_meta( $meta_key = '', $meta_value = '' ) { |
|
1014 | - return Give()->donor_meta->delete_meta( $this->id, $meta_key, $meta_value ); |
|
1013 | + public function delete_meta($meta_key = '', $meta_value = '') { |
|
1014 | + return Give()->donor_meta->delete_meta($this->id, $meta_key, $meta_value); |
|
1015 | 1015 | } |
1016 | 1016 | |
1017 | 1017 | /** |
@@ -1024,51 +1024,51 @@ discard block |
||
1024 | 1024 | * |
1025 | 1025 | * @return array The sanitized data, based off column defaults. |
1026 | 1026 | */ |
1027 | - private function sanitize_columns( $data ) { |
|
1027 | + private function sanitize_columns($data) { |
|
1028 | 1028 | |
1029 | 1029 | $columns = $this->db->get_columns(); |
1030 | 1030 | $default_values = $this->db->get_column_defaults(); |
1031 | 1031 | |
1032 | - foreach ( $columns as $key => $type ) { |
|
1032 | + foreach ($columns as $key => $type) { |
|
1033 | 1033 | |
1034 | 1034 | // Only sanitize data that we were provided |
1035 | - if ( ! array_key_exists( $key, $data ) ) { |
|
1035 | + if ( ! array_key_exists($key, $data)) { |
|
1036 | 1036 | continue; |
1037 | 1037 | } |
1038 | 1038 | |
1039 | - switch ( $type ) { |
|
1039 | + switch ($type) { |
|
1040 | 1040 | |
1041 | 1041 | case '%s': |
1042 | - if ( 'email' == $key ) { |
|
1043 | - $data[ $key ] = sanitize_email( $data[ $key ] ); |
|
1044 | - } elseif ( 'notes' == $key ) { |
|
1045 | - $data[ $key ] = strip_tags( $data[ $key ] ); |
|
1042 | + if ('email' == $key) { |
|
1043 | + $data[$key] = sanitize_email($data[$key]); |
|
1044 | + } elseif ('notes' == $key) { |
|
1045 | + $data[$key] = strip_tags($data[$key]); |
|
1046 | 1046 | } else { |
1047 | - $data[ $key ] = sanitize_text_field( $data[ $key ] ); |
|
1047 | + $data[$key] = sanitize_text_field($data[$key]); |
|
1048 | 1048 | } |
1049 | 1049 | break; |
1050 | 1050 | |
1051 | 1051 | case '%d': |
1052 | - if ( ! is_numeric( $data[ $key ] ) || (int) $data[ $key ] !== absint( $data[ $key ] ) ) { |
|
1053 | - $data[ $key ] = $default_values[ $key ]; |
|
1052 | + if ( ! is_numeric($data[$key]) || (int) $data[$key] !== absint($data[$key])) { |
|
1053 | + $data[$key] = $default_values[$key]; |
|
1054 | 1054 | } else { |
1055 | - $data[ $key ] = absint( $data[ $key ] ); |
|
1055 | + $data[$key] = absint($data[$key]); |
|
1056 | 1056 | } |
1057 | 1057 | break; |
1058 | 1058 | |
1059 | 1059 | case '%f': |
1060 | 1060 | // Convert what was given to a float |
1061 | - $value = floatval( $data[ $key ] ); |
|
1061 | + $value = floatval($data[$key]); |
|
1062 | 1062 | |
1063 | - if ( ! is_float( $value ) ) { |
|
1064 | - $data[ $key ] = $default_values[ $key ]; |
|
1063 | + if ( ! is_float($value)) { |
|
1064 | + $data[$key] = $default_values[$key]; |
|
1065 | 1065 | } else { |
1066 | - $data[ $key ] = $value; |
|
1066 | + $data[$key] = $value; |
|
1067 | 1067 | } |
1068 | 1068 | break; |
1069 | 1069 | |
1070 | 1070 | default: |
1071 | - $data[ $key ] = sanitize_text_field( $data[ $key ] ); |
|
1071 | + $data[$key] = sanitize_text_field($data[$key]); |
|
1072 | 1072 | break; |
1073 | 1073 | |
1074 | 1074 | } |
@@ -1088,33 +1088,33 @@ discard block |
||
1088 | 1088 | * |
1089 | 1089 | * @return bool If the email was added successfully |
1090 | 1090 | */ |
1091 | - public function add_email( $email = '', $primary = false ) { |
|
1092 | - if ( ! is_email( $email ) ) { |
|
1091 | + public function add_email($email = '', $primary = false) { |
|
1092 | + if ( ! is_email($email)) { |
|
1093 | 1093 | return false; |
1094 | 1094 | } |
1095 | - $existing = new Give_Donor( $email ); |
|
1095 | + $existing = new Give_Donor($email); |
|
1096 | 1096 | |
1097 | - if ( $existing->id > 0 ) { |
|
1097 | + if ($existing->id > 0) { |
|
1098 | 1098 | // Email address already belongs to another donor |
1099 | 1099 | return false; |
1100 | 1100 | } |
1101 | 1101 | |
1102 | - if ( email_exists( $email ) ) { |
|
1103 | - $user = get_user_by( 'email', $email ); |
|
1104 | - if ( $user->ID != $this->user_id ) { |
|
1102 | + if (email_exists($email)) { |
|
1103 | + $user = get_user_by('email', $email); |
|
1104 | + if ($user->ID != $this->user_id) { |
|
1105 | 1105 | return false; |
1106 | 1106 | } |
1107 | 1107 | } |
1108 | 1108 | |
1109 | - do_action( 'give_donor_pre_add_email', $email, $this->id, $this ); |
|
1109 | + do_action('give_donor_pre_add_email', $email, $this->id, $this); |
|
1110 | 1110 | |
1111 | 1111 | // Add is used to ensure duplicate emails are not added |
1112 | - $ret = (bool) $this->add_meta( 'additional_email', $email ); |
|
1112 | + $ret = (bool) $this->add_meta('additional_email', $email); |
|
1113 | 1113 | |
1114 | - do_action( 'give_donor_post_add_email', $email, $this->id, $this ); |
|
1114 | + do_action('give_donor_post_add_email', $email, $this->id, $this); |
|
1115 | 1115 | |
1116 | - if ( $ret && true === $primary ) { |
|
1117 | - $this->set_primary_email( $email ); |
|
1116 | + if ($ret && true === $primary) { |
|
1117 | + $this->set_primary_email($email); |
|
1118 | 1118 | } |
1119 | 1119 | |
1120 | 1120 | return $ret; |
@@ -1130,16 +1130,16 @@ discard block |
||
1130 | 1130 | * |
1131 | 1131 | * @return bool If the email was removed successfully. |
1132 | 1132 | */ |
1133 | - public function remove_email( $email = '' ) { |
|
1134 | - if ( ! is_email( $email ) ) { |
|
1133 | + public function remove_email($email = '') { |
|
1134 | + if ( ! is_email($email)) { |
|
1135 | 1135 | return false; |
1136 | 1136 | } |
1137 | 1137 | |
1138 | - do_action( 'give_donor_pre_remove_email', $email, $this->id, $this ); |
|
1138 | + do_action('give_donor_pre_remove_email', $email, $this->id, $this); |
|
1139 | 1139 | |
1140 | - $ret = (bool) $this->delete_meta( 'additional_email', $email ); |
|
1140 | + $ret = (bool) $this->delete_meta('additional_email', $email); |
|
1141 | 1141 | |
1142 | - do_action( 'give_donor_post_remove_email', $email, $this->id, $this ); |
|
1142 | + do_action('give_donor_post_remove_email', $email, $this->id, $this); |
|
1143 | 1143 | |
1144 | 1144 | return $ret; |
1145 | 1145 | } |
@@ -1156,16 +1156,16 @@ discard block |
||
1156 | 1156 | * |
1157 | 1157 | * @return bool If the email was set as primary successfully. |
1158 | 1158 | */ |
1159 | - public function set_primary_email( $new_primary_email = '' ) { |
|
1160 | - if ( ! is_email( $new_primary_email ) ) { |
|
1159 | + public function set_primary_email($new_primary_email = '') { |
|
1160 | + if ( ! is_email($new_primary_email)) { |
|
1161 | 1161 | return false; |
1162 | 1162 | } |
1163 | 1163 | |
1164 | - do_action( 'give_donor_pre_set_primary_email', $new_primary_email, $this->id, $this ); |
|
1164 | + do_action('give_donor_pre_set_primary_email', $new_primary_email, $this->id, $this); |
|
1165 | 1165 | |
1166 | - $existing = new Give_Donor( $new_primary_email ); |
|
1166 | + $existing = new Give_Donor($new_primary_email); |
|
1167 | 1167 | |
1168 | - if ( $existing->id > 0 && (int) $existing->id !== (int) $this->id ) { |
|
1168 | + if ($existing->id > 0 && (int) $existing->id !== (int) $this->id) { |
|
1169 | 1169 | // This email belongs to another donor. |
1170 | 1170 | return false; |
1171 | 1171 | } |
@@ -1173,21 +1173,21 @@ discard block |
||
1173 | 1173 | $old_email = $this->email; |
1174 | 1174 | |
1175 | 1175 | // Update donor record with new email. |
1176 | - $update = $this->update( array( 'email' => $new_primary_email ) ); |
|
1176 | + $update = $this->update(array('email' => $new_primary_email)); |
|
1177 | 1177 | |
1178 | 1178 | // Remove new primary from list of additional emails. |
1179 | - $remove = $this->remove_email( $new_primary_email ); |
|
1179 | + $remove = $this->remove_email($new_primary_email); |
|
1180 | 1180 | |
1181 | 1181 | // Add old email to additional emails list. |
1182 | - $add = $this->add_email( $old_email ); |
|
1182 | + $add = $this->add_email($old_email); |
|
1183 | 1183 | |
1184 | 1184 | $ret = $update && $remove && $add; |
1185 | 1185 | |
1186 | - if ( $ret ) { |
|
1186 | + if ($ret) { |
|
1187 | 1187 | $this->email = $new_primary_email; |
1188 | 1188 | } |
1189 | 1189 | |
1190 | - do_action( 'give_donor_post_set_primary_email', $new_primary_email, $this->id, $this ); |
|
1190 | + do_action('give_donor_post_set_primary_email', $new_primary_email, $this->id, $this); |
|
1191 | 1191 | |
1192 | 1192 | return $ret; |
1193 | 1193 | } |
@@ -1202,17 +1202,17 @@ discard block |
||
1202 | 1202 | * |
1203 | 1203 | * @return bool |
1204 | 1204 | */ |
1205 | - private function is_valid_address( $address ) { |
|
1205 | + private function is_valid_address($address) { |
|
1206 | 1206 | $is_valid_address = true; |
1207 | 1207 | |
1208 | 1208 | // Address ready to process even if only one value set. |
1209 | - foreach ( $address as $address_type => $value ) { |
|
1209 | + foreach ($address as $address_type => $value) { |
|
1210 | 1210 | // @todo: Handle state field validation on basis of country. |
1211 | - if( in_array( $address_type, array( 'line2', 'state' )) ) { |
|
1211 | + if (in_array($address_type, array('line2', 'state'))) { |
|
1212 | 1212 | continue; |
1213 | 1213 | } |
1214 | 1214 | |
1215 | - if ( empty( $value ) ) { |
|
1215 | + if (empty($value)) { |
|
1216 | 1216 | $is_valid_address = false; |
1217 | 1217 | break; |
1218 | 1218 | } |
@@ -1239,30 +1239,27 @@ discard block |
||
1239 | 1239 | * |
1240 | 1240 | * @return bool |
1241 | 1241 | */ |
1242 | - public function add_address( $address_type, $address ) { |
|
1242 | + public function add_address($address_type, $address) { |
|
1243 | 1243 | // Bailout. |
1244 | - if ( empty( $address_type ) || ! $this->is_valid_address( $address ) || ! $this->id ) { |
|
1244 | + if (empty($address_type) || ! $this->is_valid_address($address) || ! $this->id) { |
|
1245 | 1245 | return false; |
1246 | 1246 | } |
1247 | 1247 | |
1248 | 1248 | // Check if multiple address exist or not and set params. |
1249 | 1249 | $multi_address_id = null; |
1250 | - if( $is_multi_address = ( false !== strpos( $address_type, '[]' ) ) ) { |
|
1251 | - $address_type = $is_multi_address ? |
|
1252 | - str_replace( '[]', '', $address_type ) : |
|
1253 | - $address_type; |
|
1254 | - } elseif ( $is_multi_address = ( false !== strpos( $address_type, '_' ) ) ){ |
|
1255 | - $multi_address_id = $is_multi_address ? |
|
1256 | - array_pop( explode( '_', $address_type ) ) : |
|
1257 | - $address_type; |
|
1258 | - |
|
1259 | - $address_type = $is_multi_address ? |
|
1260 | - array_shift( explode( '_', $address_type ) ) : |
|
1261 | - $address_type; |
|
1250 | + if ($is_multi_address = (false !== strpos($address_type, '[]'))) { |
|
1251 | + $address_type = $is_multi_address ? |
|
1252 | + str_replace('[]', '', $address_type) : $address_type; |
|
1253 | + } elseif ($is_multi_address = (false !== strpos($address_type, '_'))) { |
|
1254 | + $multi_address_id = $is_multi_address ? |
|
1255 | + array_pop(explode('_', $address_type)) : $address_type; |
|
1256 | + |
|
1257 | + $address_type = $is_multi_address ? |
|
1258 | + array_shift(explode('_', $address_type)) : $address_type; |
|
1262 | 1259 | } |
1263 | 1260 | |
1264 | 1261 | // Bailout: do not save duplicate orders |
1265 | - if( $this->is_address_exist( $address_type, $address ) ) { |
|
1262 | + if ($this->is_address_exist($address_type, $address)) { |
|
1266 | 1263 | return false; |
1267 | 1264 | } |
1268 | 1265 | |
@@ -1284,8 +1281,8 @@ discard block |
||
1284 | 1281 | $meta_key_prefix = "_give_donor_address_{$address_type}_{address_name}"; |
1285 | 1282 | $meta_type = Give()->donor_meta->meta_type; |
1286 | 1283 | |
1287 | - if ( $is_multi_address ) { |
|
1288 | - if ( is_null( $multi_address_id ) ) { |
|
1284 | + if ($is_multi_address) { |
|
1285 | + if (is_null($multi_address_id)) { |
|
1289 | 1286 | // Get latest address key to set multi address id. |
1290 | 1287 | $multi_address_id = $wpdb->get_var( |
1291 | 1288 | $wpdb->prepare( |
@@ -1302,10 +1299,10 @@ discard block |
||
1302 | 1299 | ) |
1303 | 1300 | ); |
1304 | 1301 | |
1305 | - if( ! empty( $multi_address_id ) ) { |
|
1306 | - $multi_address_id = absint( substr( strrchr( $multi_address_id, '_' ), 1 ) ); |
|
1302 | + if ( ! empty($multi_address_id)) { |
|
1303 | + $multi_address_id = absint(substr(strrchr($multi_address_id, '_'), 1)); |
|
1307 | 1304 | $multi_address_id++; |
1308 | - } else{ |
|
1305 | + } else { |
|
1309 | 1306 | $multi_address_id = 0; |
1310 | 1307 | } |
1311 | 1308 | } |
@@ -1314,9 +1311,9 @@ discard block |
||
1314 | 1311 | } |
1315 | 1312 | |
1316 | 1313 | // Save donor address. |
1317 | - foreach ( $address as $type => $value ) { |
|
1318 | - $meta_key = str_replace( '{address_name}', $type, $meta_key_prefix ); |
|
1319 | - Give()->donor_meta->update_meta( $this->id, $meta_key, $value ); |
|
1314 | + foreach ($address as $type => $value) { |
|
1315 | + $meta_key = str_replace('{address_name}', $type, $meta_key_prefix); |
|
1316 | + Give()->donor_meta->update_meta($this->id, $meta_key, $value); |
|
1320 | 1317 | } |
1321 | 1318 | |
1322 | 1319 | $this->setup_address(); |
@@ -1335,23 +1332,21 @@ discard block |
||
1335 | 1332 | * |
1336 | 1333 | * @return bool |
1337 | 1334 | */ |
1338 | - public function remove_address( $address_id ) { |
|
1335 | + public function remove_address($address_id) { |
|
1339 | 1336 | global $wpdb; |
1340 | 1337 | |
1341 | 1338 | // Get address type. |
1342 | - $is_multi_address = false !== strpos( $address_id, '_' ) ? true : false; |
|
1339 | + $is_multi_address = false !== strpos($address_id, '_') ? true : false; |
|
1343 | 1340 | |
1344 | - $address_type = false !== strpos( $address_id, '_' ) ? |
|
1345 | - array_shift( explode( '_', $address_id ) ) : |
|
1346 | - $address_id; |
|
1341 | + $address_type = false !== strpos($address_id, '_') ? |
|
1342 | + array_shift(explode('_', $address_id)) : $address_id; |
|
1347 | 1343 | |
1348 | - $address_count = false !== strpos( $address_id, '_' ) ? |
|
1349 | - array_pop( explode( '_', $address_id ) ) : |
|
1350 | - null; |
|
1344 | + $address_count = false !== strpos($address_id, '_') ? |
|
1345 | + array_pop(explode('_', $address_id)) : null; |
|
1351 | 1346 | |
1352 | 1347 | // Set meta key prefix. |
1353 | 1348 | $meta_key_prefix = "_give_donor_address_{$address_type}_%"; |
1354 | - if ( $is_multi_address && is_numeric( $address_count ) ) { |
|
1349 | + if ($is_multi_address && is_numeric($address_count)) { |
|
1355 | 1350 | $meta_key_prefix .= "_{$address_count}"; |
1356 | 1351 | } |
1357 | 1352 | |
@@ -1388,23 +1383,21 @@ discard block |
||
1388 | 1383 | * |
1389 | 1384 | * @return bool |
1390 | 1385 | */ |
1391 | - public function update_address( $address_id, $address ) { |
|
1386 | + public function update_address($address_id, $address) { |
|
1392 | 1387 | global $wpdb; |
1393 | 1388 | |
1394 | 1389 | // Get address type. |
1395 | - $is_multi_address = false !== strpos( $address_id, '_' ) ? true : false; |
|
1390 | + $is_multi_address = false !== strpos($address_id, '_') ? true : false; |
|
1396 | 1391 | |
1397 | - $address_type = false !== strpos( $address_id, '_' ) ? |
|
1398 | - array_shift( explode( '_', $address_id ) ) : |
|
1399 | - $address_id; |
|
1392 | + $address_type = false !== strpos($address_id, '_') ? |
|
1393 | + array_shift(explode('_', $address_id)) : $address_id; |
|
1400 | 1394 | |
1401 | - $address_count = false !== strpos( $address_id, '_' ) ? |
|
1402 | - array_pop( explode( '_', $address_id ) ) : |
|
1403 | - null; |
|
1395 | + $address_count = false !== strpos($address_id, '_') ? |
|
1396 | + array_pop(explode('_', $address_id)) : null; |
|
1404 | 1397 | |
1405 | 1398 | // Set meta key prefix. |
1406 | 1399 | $meta_key_prefix = "_give_donor_address_{$address_type}_%"; |
1407 | - if ( $is_multi_address && is_numeric( $address_count ) ) { |
|
1400 | + if ($is_multi_address && is_numeric($address_count)) { |
|
1408 | 1401 | $meta_key_prefix .= "_{$address_count}"; |
1409 | 1402 | } |
1410 | 1403 | |
@@ -1425,12 +1418,12 @@ discard block |
||
1425 | 1418 | ); |
1426 | 1419 | |
1427 | 1420 | // Return result. |
1428 | - if( ! count( $row_affected ) ) { |
|
1421 | + if ( ! count($row_affected)) { |
|
1429 | 1422 | return false; |
1430 | 1423 | } |
1431 | 1424 | |
1432 | 1425 | // Update address. |
1433 | - if( ! $this->add_address( $address_id, $address ) ) { |
|
1426 | + if ( ! $this->add_address($address_id, $address)) { |
|
1434 | 1427 | return false; |
1435 | 1428 | } |
1436 | 1429 | |
@@ -1449,39 +1442,39 @@ discard block |
||
1449 | 1442 | * |
1450 | 1443 | * @return bool|null |
1451 | 1444 | */ |
1452 | - public function is_address_exist( $current_address_type, $current_address ) { |
|
1445 | + public function is_address_exist($current_address_type, $current_address) { |
|
1453 | 1446 | $status = false; |
1454 | 1447 | |
1455 | 1448 | // Bailout. |
1456 | - if( empty( $current_address_type ) || empty( $current_address ) ) { |
|
1449 | + if (empty($current_address_type) || empty($current_address)) { |
|
1457 | 1450 | return null; |
1458 | 1451 | } |
1459 | 1452 | |
1460 | 1453 | // Bailout. |
1461 | - if( empty( $this->address ) || empty( $this->address[ $current_address_type ] ) ) { |
|
1454 | + if (empty($this->address) || empty($this->address[$current_address_type])) { |
|
1462 | 1455 | return $status; |
1463 | 1456 | } |
1464 | 1457 | |
1465 | 1458 | // Get address. |
1466 | - $address = $this->address[ $current_address_type ]; |
|
1459 | + $address = $this->address[$current_address_type]; |
|
1467 | 1460 | |
1468 | - switch ( true ){ |
|
1461 | + switch (true) { |
|
1469 | 1462 | |
1470 | 1463 | // Single address. |
1471 | - case is_string( end( $address ) ) : |
|
1472 | - $status = $this->is_address_match( $current_address, $address ); |
|
1464 | + case is_string(end($address)) : |
|
1465 | + $status = $this->is_address_match($current_address, $address); |
|
1473 | 1466 | break; |
1474 | 1467 | |
1475 | 1468 | // Multi address. |
1476 | - case is_array( end( $address ) ): |
|
1469 | + case is_array(end($address)): |
|
1477 | 1470 | // Compare address. |
1478 | - foreach ( $address as $saved_address ) { |
|
1479 | - if( empty( $saved_address ) ) { |
|
1471 | + foreach ($address as $saved_address) { |
|
1472 | + if (empty($saved_address)) { |
|
1480 | 1473 | continue; |
1481 | 1474 | } |
1482 | 1475 | |
1483 | 1476 | // Exit loop immediately if address exist. |
1484 | - if( $status = $this->is_address_match( $current_address, $saved_address ) ) { |
|
1477 | + if ($status = $this->is_address_match($current_address, $saved_address)) { |
|
1485 | 1478 | break; |
1486 | 1479 | } |
1487 | 1480 | } |
@@ -1502,10 +1495,10 @@ discard block |
||
1502 | 1495 | * |
1503 | 1496 | * @return bool |
1504 | 1497 | */ |
1505 | - private function is_address_match( $address_1, $address_2 ) { |
|
1506 | - $result = array_diff( $address_1, $address_2 ); |
|
1498 | + private function is_address_match($address_1, $address_2) { |
|
1499 | + $result = array_diff($address_1, $address_2); |
|
1507 | 1500 | |
1508 | - return empty( $result ); |
|
1501 | + return empty($result); |
|
1509 | 1502 | } |
1510 | 1503 | |
1511 | 1504 | /** |
@@ -1515,22 +1508,22 @@ discard block |
||
1515 | 1508 | * @since 2.0 |
1516 | 1509 | * @return object |
1517 | 1510 | */ |
1518 | - public function split_donor_name( $id ) { |
|
1519 | - $first_name = $last_name = ''; |
|
1520 | - $donor = new Give_Donor( $id ); |
|
1511 | + public function split_donor_name($id) { |
|
1512 | + $first_name = $last_name = ''; |
|
1513 | + $donor = new Give_Donor($id); |
|
1521 | 1514 | |
1522 | - $split_donor_name = explode( ' ', $donor->name, 2 ); |
|
1515 | + $split_donor_name = explode(' ', $donor->name, 2); |
|
1523 | 1516 | |
1524 | 1517 | // Check for existence of first name after split of donor name. |
1525 | - if( is_array( $split_donor_name ) && ! empty( $split_donor_name[0] ) ) { |
|
1518 | + if (is_array($split_donor_name) && ! empty($split_donor_name[0])) { |
|
1526 | 1519 | $first_name = $split_donor_name[0]; |
1527 | 1520 | } |
1528 | 1521 | |
1529 | 1522 | // Check for existence of last name after split of donor name. |
1530 | - if( is_array( $split_donor_name ) && ! empty( $split_donor_name[1] ) ) { |
|
1523 | + if (is_array($split_donor_name) && ! empty($split_donor_name[1])) { |
|
1531 | 1524 | $last_name = $split_donor_name[1]; |
1532 | 1525 | } |
1533 | - return (object) array( 'first_name' => $first_name, 'last_name' => $last_name ); |
|
1526 | + return (object) array('first_name' => $first_name, 'last_name' => $last_name); |
|
1534 | 1527 | } |
1535 | 1528 | |
1536 | 1529 | /** |
@@ -1540,9 +1533,9 @@ discard block |
||
1540 | 1533 | * @return string |
1541 | 1534 | */ |
1542 | 1535 | public function get_first_name() { |
1543 | - $first_name = $this->get_meta( '_give_donor_first_name'); |
|
1544 | - if( ! $first_name ) { |
|
1545 | - $first_name = $this->split_donor_name( $this->id )->first_name; |
|
1536 | + $first_name = $this->get_meta('_give_donor_first_name'); |
|
1537 | + if ( ! $first_name) { |
|
1538 | + $first_name = $this->split_donor_name($this->id)->first_name; |
|
1546 | 1539 | } |
1547 | 1540 | |
1548 | 1541 | return $first_name; |
@@ -1555,14 +1548,14 @@ discard block |
||
1555 | 1548 | * @return string |
1556 | 1549 | */ |
1557 | 1550 | public function get_last_name() { |
1558 | - $first_name = $this->get_meta( '_give_donor_first_name'); |
|
1559 | - $last_name = $this->get_meta( '_give_donor_last_name'); |
|
1551 | + $first_name = $this->get_meta('_give_donor_first_name'); |
|
1552 | + $last_name = $this->get_meta('_give_donor_last_name'); |
|
1560 | 1553 | |
1561 | 1554 | // This condition will prevent unnecessary splitting of donor name to fetch last name. |
1562 | - if( ! $first_name && ! $last_name ) { |
|
1563 | - $last_name = $this->split_donor_name( $this->id )->last_name; |
|
1555 | + if ( ! $first_name && ! $last_name) { |
|
1556 | + $last_name = $this->split_donor_name($this->id)->last_name; |
|
1564 | 1557 | } |
1565 | 1558 | |
1566 | - return ( $last_name ) ? $last_name : ''; |
|
1559 | + return ($last_name) ? $last_name : ''; |
|
1567 | 1560 | } |
1568 | 1561 | } |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | * |
41 | 41 | * @since 1.8 |
42 | 42 | * |
43 | - * @return bool |
|
43 | + * @return false|null |
|
44 | 44 | */ |
45 | 45 | function give_redirect_to_clean_url_admin_pages() { |
46 | 46 | // Give admin pages. |
@@ -992,7 +992,7 @@ discard block |
||
992 | 992 | * @access public |
993 | 993 | * @since 2.0 |
994 | 994 | * |
995 | - * @return bool |
|
995 | + * @return false|null |
|
996 | 996 | */ |
997 | 997 | function give_update_donor_name_on_user_update( $user_id = 0 ) { |
998 | 998 | |
@@ -1032,7 +1032,7 @@ discard block |
||
1032 | 1032 | * @param int $user_id User ID. |
1033 | 1033 | * @param WP_User|bool $old_user_data User data. |
1034 | 1034 | * |
1035 | - * @return bool |
|
1035 | + * @return false|null |
|
1036 | 1036 | */ |
1037 | 1037 | function give_update_donor_email_on_user_update( $user_id = 0, $old_user_data = false ) { |
1038 | 1038 |
@@ -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,19 +20,19 @@ discard block |
||
20 | 20 | * @since 1.8 |
21 | 21 | */ |
22 | 22 | function give_load_wp_editor() { |
23 | - if ( ! isset( $_POST['wp_editor'] ) ) { |
|
23 | + if ( ! isset($_POST['wp_editor'])) { |
|
24 | 24 | die(); |
25 | 25 | } |
26 | 26 | |
27 | - $wp_editor = json_decode( base64_decode( $_POST['wp_editor'] ), true ); |
|
27 | + $wp_editor = json_decode(base64_decode($_POST['wp_editor']), true); |
|
28 | 28 | $wp_editor[2]['textarea_name'] = $_POST['textarea_name']; |
29 | 29 | |
30 | - wp_editor( $wp_editor[0], $_POST['wp_editor_id'], $wp_editor[2] ); |
|
30 | + wp_editor($wp_editor[0], $_POST['wp_editor_id'], $wp_editor[2]); |
|
31 | 31 | |
32 | 32 | die(); |
33 | 33 | } |
34 | 34 | |
35 | -add_action( 'wp_ajax_give_load_wp_editor', 'give_load_wp_editor' ); |
|
35 | +add_action('wp_ajax_give_load_wp_editor', 'give_load_wp_editor'); |
|
36 | 36 | |
37 | 37 | |
38 | 38 | /** |
@@ -52,13 +52,13 @@ discard block |
||
52 | 52 | ); |
53 | 53 | |
54 | 54 | // Get current page. |
55 | - $current_page = isset( $_GET['page'] ) ? esc_attr( $_GET['page'] ) : ''; |
|
55 | + $current_page = isset($_GET['page']) ? esc_attr($_GET['page']) : ''; |
|
56 | 56 | |
57 | 57 | // Bailout. |
58 | 58 | if ( |
59 | - empty( $current_page ) |
|
60 | - || empty( $_GET['_wp_http_referer'] ) |
|
61 | - || ! in_array( $current_page, $give_pages ) |
|
59 | + empty($current_page) |
|
60 | + || empty($_GET['_wp_http_referer']) |
|
61 | + || ! in_array($current_page, $give_pages) |
|
62 | 62 | ) { |
63 | 63 | return false; |
64 | 64 | } |
@@ -68,21 +68,21 @@ discard block |
||
68 | 68 | * |
69 | 69 | * @since 1.8 |
70 | 70 | */ |
71 | - $redirect = apply_filters( "give_validate_{$current_page}", true ); |
|
71 | + $redirect = apply_filters("give_validate_{$current_page}", true); |
|
72 | 72 | |
73 | - if ( $redirect ) { |
|
73 | + if ($redirect) { |
|
74 | 74 | // Redirect. |
75 | 75 | wp_redirect( |
76 | 76 | remove_query_arg( |
77 | - array( '_wp_http_referer', '_wpnonce' ), |
|
78 | - wp_unslash( $_SERVER['REQUEST_URI'] ) |
|
77 | + array('_wp_http_referer', '_wpnonce'), |
|
78 | + wp_unslash($_SERVER['REQUEST_URI']) |
|
79 | 79 | ) |
80 | 80 | ); |
81 | 81 | exit; |
82 | 82 | } |
83 | 83 | } |
84 | 84 | |
85 | -add_action( 'admin_init', 'give_redirect_to_clean_url_admin_pages' ); |
|
85 | +add_action('admin_init', 'give_redirect_to_clean_url_admin_pages'); |
|
86 | 86 | |
87 | 87 | |
88 | 88 | /** |
@@ -96,25 +96,25 @@ discard block |
||
96 | 96 | */ |
97 | 97 | function give_hide_outdated_php_notice() { |
98 | 98 | |
99 | - if ( ! isset( $_POST['_give_hide_outdated_php_notices_shortly'] ) ) { |
|
99 | + if ( ! isset($_POST['_give_hide_outdated_php_notices_shortly'])) { |
|
100 | 100 | give_die(); |
101 | 101 | } |
102 | 102 | |
103 | 103 | // Transient key name. |
104 | 104 | $transient_key = "_give_hide_outdated_php_notices_shortly"; |
105 | 105 | |
106 | - if ( Give_Cache::get( $transient_key, true ) ) { |
|
106 | + if (Give_Cache::get($transient_key, true)) { |
|
107 | 107 | return; |
108 | 108 | } |
109 | 109 | |
110 | 110 | // Hide notice for 24 hours. |
111 | - Give_Cache::set( $transient_key, true, DAY_IN_SECONDS, true ); |
|
111 | + Give_Cache::set($transient_key, true, DAY_IN_SECONDS, true); |
|
112 | 112 | |
113 | 113 | give_die(); |
114 | 114 | |
115 | 115 | } |
116 | 116 | |
117 | -add_action( 'wp_ajax_give_hide_outdated_php_notice', 'give_hide_outdated_php_notice' ); |
|
117 | +add_action('wp_ajax_give_hide_outdated_php_notice', 'give_hide_outdated_php_notice'); |
|
118 | 118 | |
119 | 119 | /** |
120 | 120 | * Register admin notices. |
@@ -123,27 +123,27 @@ discard block |
||
123 | 123 | */ |
124 | 124 | function _give_register_admin_notices() { |
125 | 125 | // Bailout. |
126 | - if ( ! is_admin() ) { |
|
126 | + if ( ! is_admin()) { |
|
127 | 127 | return; |
128 | 128 | } |
129 | 129 | |
130 | 130 | // Bulk action notices. |
131 | 131 | if ( |
132 | - isset( $_GET['action'] ) && |
|
133 | - ! empty( $_GET['action'] ) |
|
132 | + isset($_GET['action']) && |
|
133 | + ! empty($_GET['action']) |
|
134 | 134 | ) { |
135 | 135 | |
136 | 136 | // Add payment bulk notice. |
137 | 137 | if ( |
138 | - current_user_can( 'edit_give_payments' ) && |
|
139 | - isset( $_GET['payment'] ) && |
|
140 | - ! empty( $_GET['payment'] ) |
|
138 | + current_user_can('edit_give_payments') && |
|
139 | + isset($_GET['payment']) && |
|
140 | + ! empty($_GET['payment']) |
|
141 | 141 | ) { |
142 | - $payment_count = isset( $_GET['payment'] ) ? count( $_GET['payment'] ) : 0; |
|
142 | + $payment_count = isset($_GET['payment']) ? count($_GET['payment']) : 0; |
|
143 | 143 | |
144 | - switch ( $_GET['action'] ) { |
|
144 | + switch ($_GET['action']) { |
|
145 | 145 | case 'delete': |
146 | - Give()->notices->register_notice( array( |
|
146 | + Give()->notices->register_notice(array( |
|
147 | 147 | 'id' => 'bulk_action_delete', |
148 | 148 | 'type' => 'updated', |
149 | 149 | 'description' => sprintf( |
@@ -155,12 +155,12 @@ discard block |
||
155 | 155 | ), |
156 | 156 | $payment_count ), |
157 | 157 | 'show' => true, |
158 | - ) ); |
|
158 | + )); |
|
159 | 159 | |
160 | 160 | break; |
161 | 161 | |
162 | 162 | case 'resend-receipt': |
163 | - Give()->notices->register_notice( array( |
|
163 | + Give()->notices->register_notice(array( |
|
164 | 164 | 'id' => 'bulk_action_resend_receipt', |
165 | 165 | 'type' => 'updated', |
166 | 166 | 'description' => sprintf( |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | $payment_count |
174 | 174 | ), |
175 | 175 | 'show' => true, |
176 | - ) ); |
|
176 | + )); |
|
177 | 177 | break; |
178 | 178 | |
179 | 179 | case 'set-status-publish' : |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | case 'set-status-cancelled' : |
186 | 186 | case 'set-status-abandoned' : |
187 | 187 | case 'set-status-preapproval' : |
188 | - Give()->notices->register_notice( array( |
|
188 | + Give()->notices->register_notice(array( |
|
189 | 189 | 'id' => 'bulk_action_status_change', |
190 | 190 | 'type' => 'updated', |
191 | 191 | 'description' => _n( |
@@ -195,251 +195,251 @@ discard block |
||
195 | 195 | 'give' |
196 | 196 | ), |
197 | 197 | 'show' => true, |
198 | - ) ); |
|
198 | + )); |
|
199 | 199 | break; |
200 | 200 | } |
201 | 201 | } |
202 | 202 | } |
203 | 203 | |
204 | 204 | // Add give message notices. |
205 | - if ( ! empty( $_GET['give-message'] ) ) { |
|
205 | + if ( ! empty($_GET['give-message'])) { |
|
206 | 206 | // Donation reports errors. |
207 | - if ( current_user_can( 'view_give_reports' ) ) { |
|
208 | - switch ( $_GET['give-message'] ) { |
|
207 | + if (current_user_can('view_give_reports')) { |
|
208 | + switch ($_GET['give-message']) { |
|
209 | 209 | case 'donation_deleted' : |
210 | - Give()->notices->register_notice( array( |
|
210 | + Give()->notices->register_notice(array( |
|
211 | 211 | 'id' => 'give-donation-deleted', |
212 | 212 | 'type' => 'updated', |
213 | - 'description' => __( 'The donation has been deleted.', 'give' ), |
|
213 | + 'description' => __('The donation has been deleted.', 'give'), |
|
214 | 214 | 'show' => true, |
215 | - ) ); |
|
215 | + )); |
|
216 | 216 | break; |
217 | 217 | case 'email_sent' : |
218 | - Give()->notices->register_notice( array( |
|
218 | + Give()->notices->register_notice(array( |
|
219 | 219 | 'id' => 'give-payment-sent', |
220 | 220 | 'type' => 'updated', |
221 | - 'description' => __( 'The donation receipt has been resent.', 'give' ), |
|
221 | + 'description' => __('The donation receipt has been resent.', 'give'), |
|
222 | 222 | 'show' => true, |
223 | - ) ); |
|
223 | + )); |
|
224 | 224 | break; |
225 | 225 | case 'refreshed-reports' : |
226 | - Give()->notices->register_notice( array( |
|
226 | + Give()->notices->register_notice(array( |
|
227 | 227 | 'id' => 'give-refreshed-reports', |
228 | 228 | 'type' => 'updated', |
229 | - 'description' => __( 'The reports cache has been cleared.', 'give' ), |
|
229 | + 'description' => __('The reports cache has been cleared.', 'give'), |
|
230 | 230 | 'show' => true, |
231 | - ) ); |
|
231 | + )); |
|
232 | 232 | break; |
233 | 233 | case 'donation-note-deleted' : |
234 | - Give()->notices->register_notice( array( |
|
234 | + Give()->notices->register_notice(array( |
|
235 | 235 | 'id' => 'give-donation-note-deleted', |
236 | 236 | 'type' => 'updated', |
237 | - 'description' => __( 'The donation note has been deleted.', 'give' ), |
|
237 | + 'description' => __('The donation note has been deleted.', 'give'), |
|
238 | 238 | 'show' => true, |
239 | - ) ); |
|
239 | + )); |
|
240 | 240 | break; |
241 | 241 | } |
242 | 242 | } |
243 | 243 | |
244 | 244 | // Give settings notices and errors. |
245 | - if ( current_user_can( 'manage_give_settings' ) ) { |
|
246 | - switch ( $_GET['give-message'] ) { |
|
245 | + if (current_user_can('manage_give_settings')) { |
|
246 | + switch ($_GET['give-message']) { |
|
247 | 247 | case 'settings-imported' : |
248 | - Give()->notices->register_notice( array( |
|
248 | + Give()->notices->register_notice(array( |
|
249 | 249 | 'id' => 'give-settings-imported', |
250 | 250 | 'type' => 'updated', |
251 | - 'description' => __( 'The settings have been imported.', 'give' ), |
|
251 | + 'description' => __('The settings have been imported.', 'give'), |
|
252 | 252 | 'show' => true, |
253 | - ) ); |
|
253 | + )); |
|
254 | 254 | break; |
255 | 255 | case 'api-key-generated' : |
256 | - Give()->notices->register_notice( array( |
|
256 | + Give()->notices->register_notice(array( |
|
257 | 257 | 'id' => 'give-api-key-generated', |
258 | 258 | 'type' => 'updated', |
259 | - 'description' => __( 'API keys have been generated.', 'give' ), |
|
259 | + 'description' => __('API keys have been generated.', 'give'), |
|
260 | 260 | 'show' => true, |
261 | - ) ); |
|
261 | + )); |
|
262 | 262 | break; |
263 | 263 | case 'api-key-exists' : |
264 | - Give()->notices->register_notice( array( |
|
264 | + Give()->notices->register_notice(array( |
|
265 | 265 | 'id' => 'give-api-key-exists', |
266 | 266 | 'type' => 'updated', |
267 | - 'description' => __( 'The specified user already has API keys.', 'give' ), |
|
267 | + 'description' => __('The specified user already has API keys.', 'give'), |
|
268 | 268 | 'show' => true, |
269 | - ) ); |
|
269 | + )); |
|
270 | 270 | break; |
271 | 271 | case 'api-key-regenerated' : |
272 | - Give()->notices->register_notice( array( |
|
272 | + Give()->notices->register_notice(array( |
|
273 | 273 | 'id' => 'give-api-key-regenerated', |
274 | 274 | 'type' => 'updated', |
275 | - 'description' => __( 'API keys have been regenerated.', 'give' ), |
|
275 | + 'description' => __('API keys have been regenerated.', 'give'), |
|
276 | 276 | 'show' => true, |
277 | - ) ); |
|
277 | + )); |
|
278 | 278 | break; |
279 | 279 | case 'api-key-revoked' : |
280 | - Give()->notices->register_notice( array( |
|
280 | + Give()->notices->register_notice(array( |
|
281 | 281 | 'id' => 'give-api-key-revoked', |
282 | 282 | 'type' => 'updated', |
283 | - 'description' => __( 'API keys have been revoked.', 'give' ), |
|
283 | + 'description' => __('API keys have been revoked.', 'give'), |
|
284 | 284 | 'show' => true, |
285 | - ) ); |
|
285 | + )); |
|
286 | 286 | break; |
287 | 287 | case 'sent-test-email' : |
288 | - Give()->notices->register_notice( array( |
|
288 | + Give()->notices->register_notice(array( |
|
289 | 289 | 'id' => 'give-sent-test-email', |
290 | 290 | 'type' => 'updated', |
291 | - 'description' => __( 'The test email has been sent.', 'give' ), |
|
291 | + 'description' => __('The test email has been sent.', 'give'), |
|
292 | 292 | 'show' => true, |
293 | - ) ); |
|
293 | + )); |
|
294 | 294 | break; |
295 | 295 | case 'matched-success-failure-page': |
296 | - Give()->notices->register_notice( array( |
|
296 | + Give()->notices->register_notice(array( |
|
297 | 297 | 'id' => 'give-matched-success-failure-page', |
298 | 298 | 'type' => 'updated', |
299 | - 'description' => __( 'You cannot set the success and failed pages to the same page', 'give' ), |
|
299 | + 'description' => __('You cannot set the success and failed pages to the same page', 'give'), |
|
300 | 300 | 'show' => true, |
301 | - ) ); |
|
301 | + )); |
|
302 | 302 | break; |
303 | 303 | } |
304 | 304 | } |
305 | 305 | // Payments errors. |
306 | - if ( current_user_can( 'edit_give_payments' ) ) { |
|
307 | - switch ( $_GET['give-message'] ) { |
|
306 | + if (current_user_can('edit_give_payments')) { |
|
307 | + switch ($_GET['give-message']) { |
|
308 | 308 | case 'note-added' : |
309 | - Give()->notices->register_notice( array( |
|
309 | + Give()->notices->register_notice(array( |
|
310 | 310 | 'id' => 'give-note-added', |
311 | 311 | 'type' => 'updated', |
312 | - 'description' => __( 'The donation note has been added.', 'give' ), |
|
312 | + 'description' => __('The donation note has been added.', 'give'), |
|
313 | 313 | 'show' => true, |
314 | - ) ); |
|
314 | + )); |
|
315 | 315 | break; |
316 | 316 | case 'payment-updated' : |
317 | - Give()->notices->register_notice( array( |
|
317 | + Give()->notices->register_notice(array( |
|
318 | 318 | 'id' => 'give-payment-updated', |
319 | 319 | 'type' => 'updated', |
320 | - 'description' => __( 'The donation has been updated.', 'give' ), |
|
320 | + 'description' => __('The donation has been updated.', 'give'), |
|
321 | 321 | 'show' => true, |
322 | - ) ); |
|
322 | + )); |
|
323 | 323 | break; |
324 | 324 | } |
325 | 325 | } |
326 | 326 | |
327 | 327 | // Donor Notices. |
328 | - if ( current_user_can( 'edit_give_payments' ) ) { |
|
329 | - switch ( $_GET['give-message'] ) { |
|
328 | + if (current_user_can('edit_give_payments')) { |
|
329 | + switch ($_GET['give-message']) { |
|
330 | 330 | case 'donor-deleted' : |
331 | - Give()->notices->register_notice( array( |
|
331 | + Give()->notices->register_notice(array( |
|
332 | 332 | 'id' => 'give-donor-deleted', |
333 | 333 | 'type' => 'updated', |
334 | - 'description' => __( 'The selected donor(s) has been deleted.', 'give' ), |
|
334 | + 'description' => __('The selected donor(s) has been deleted.', 'give'), |
|
335 | 335 | 'show' => true, |
336 | - ) ); |
|
336 | + )); |
|
337 | 337 | break; |
338 | 338 | |
339 | 339 | case 'donor-donations-deleted' : |
340 | - Give()->notices->register_notice( array( |
|
340 | + Give()->notices->register_notice(array( |
|
341 | 341 | 'id' => 'give-donor-donations-deleted', |
342 | 342 | 'type' => 'updated', |
343 | - 'description' => __( 'The selected donor(s) and its associated donations has been deleted.', 'give' ), |
|
343 | + 'description' => __('The selected donor(s) and its associated donations has been deleted.', 'give'), |
|
344 | 344 | 'show' => true, |
345 | - ) ); |
|
345 | + )); |
|
346 | 346 | break; |
347 | 347 | |
348 | 348 | case 'confirm-delete-donor' : |
349 | - Give()->notices->register_notice( array( |
|
349 | + Give()->notices->register_notice(array( |
|
350 | 350 | 'id' => 'give-confirm-delete-donor', |
351 | 351 | 'type' => 'updated', |
352 | - 'description' => __( 'You must confirm to delete the selected donor(s).', 'give' ), |
|
352 | + 'description' => __('You must confirm to delete the selected donor(s).', 'give'), |
|
353 | 353 | 'show' => true, |
354 | - ) ); |
|
354 | + )); |
|
355 | 355 | break; |
356 | 356 | |
357 | 357 | case 'invalid-donor-id' : |
358 | - Give()->notices->register_notice( array( |
|
358 | + Give()->notices->register_notice(array( |
|
359 | 359 | 'id' => 'give-invalid-donor-id', |
360 | 360 | 'type' => 'updated', |
361 | - 'description' => __( 'Invalid Donor ID.', 'give' ), |
|
361 | + 'description' => __('Invalid Donor ID.', 'give'), |
|
362 | 362 | 'show' => true, |
363 | - ) ); |
|
363 | + )); |
|
364 | 364 | break; |
365 | 365 | |
366 | 366 | case 'donor-delete-failed' : |
367 | - Give()->notices->register_notice( array( |
|
367 | + Give()->notices->register_notice(array( |
|
368 | 368 | 'id' => 'give-donor-delete-failed', |
369 | 369 | 'type' => 'error', |
370 | - 'description' => __( 'Unable to delete selected donor(s).', 'give' ), |
|
370 | + 'description' => __('Unable to delete selected donor(s).', 'give'), |
|
371 | 371 | 'show' => true, |
372 | - ) ); |
|
372 | + )); |
|
373 | 373 | break; |
374 | 374 | |
375 | 375 | case 'email-added' : |
376 | - Give()->notices->register_notice( array( |
|
376 | + Give()->notices->register_notice(array( |
|
377 | 377 | 'id' => 'give-donor-email-added', |
378 | 378 | 'type' => 'updated', |
379 | - 'description' => __( 'Donor email added.', 'give' ), |
|
379 | + 'description' => __('Donor email added.', 'give'), |
|
380 | 380 | 'show' => true, |
381 | - ) ); |
|
381 | + )); |
|
382 | 382 | break; |
383 | 383 | |
384 | 384 | case 'email-removed' : |
385 | - Give()->notices->register_notice( array( |
|
385 | + Give()->notices->register_notice(array( |
|
386 | 386 | 'id' => 'give-donor-email-removed', |
387 | 387 | 'type' => 'updated', |
388 | - 'description' => __( 'Donor email removed.', 'give' ), |
|
388 | + 'description' => __('Donor email removed.', 'give'), |
|
389 | 389 | 'show' => true, |
390 | - ) ); |
|
390 | + )); |
|
391 | 391 | break; |
392 | 392 | |
393 | 393 | case 'email-remove-failed' : |
394 | - Give()->notices->register_notice( array( |
|
394 | + Give()->notices->register_notice(array( |
|
395 | 395 | 'id' => 'give-donor-email-remove-failed', |
396 | 396 | 'type' => 'updated', |
397 | - 'description' => __( 'Failed to remove donor email.', 'give' ), |
|
397 | + 'description' => __('Failed to remove donor email.', 'give'), |
|
398 | 398 | 'show' => true, |
399 | - ) ); |
|
399 | + )); |
|
400 | 400 | break; |
401 | 401 | |
402 | 402 | case 'primary-email-updated' : |
403 | - Give()->notices->register_notice( array( |
|
403 | + Give()->notices->register_notice(array( |
|
404 | 404 | 'id' => 'give-donor-primary-email-updated', |
405 | 405 | 'type' => 'updated', |
406 | - 'description' => __( 'Primary email updated for donor.', 'give' ), |
|
406 | + 'description' => __('Primary email updated for donor.', 'give'), |
|
407 | 407 | 'show' => true, |
408 | - ) ); |
|
408 | + )); |
|
409 | 409 | break; |
410 | 410 | |
411 | 411 | case 'primary-email-failed' : |
412 | - Give()->notices->register_notice( array( |
|
412 | + Give()->notices->register_notice(array( |
|
413 | 413 | 'id' => 'give-donor-primary-email-failed', |
414 | 414 | 'type' => 'updated', |
415 | - 'description' => __( 'Failed to set primary email.', 'give' ), |
|
415 | + 'description' => __('Failed to set primary email.', 'give'), |
|
416 | 416 | 'show' => true, |
417 | - ) ); |
|
417 | + )); |
|
418 | 418 | break; |
419 | 419 | |
420 | 420 | case 'reconnect-user' : |
421 | - Give()->notices->register_notice( array( |
|
421 | + Give()->notices->register_notice(array( |
|
422 | 422 | 'id' => 'give-donor-reconnect-user', |
423 | 423 | 'type' => 'updated', |
424 | - 'description' => __( 'User has been successfully connected with Donor.', 'give' ), |
|
424 | + 'description' => __('User has been successfully connected with Donor.', 'give'), |
|
425 | 425 | 'show' => true, |
426 | - ) ); |
|
426 | + )); |
|
427 | 427 | break; |
428 | 428 | |
429 | 429 | case 'profile-updated' : |
430 | - Give()->notices->register_notice( array( |
|
430 | + Give()->notices->register_notice(array( |
|
431 | 431 | 'id' => 'give-donor-profile-updated', |
432 | 432 | 'type' => 'updated', |
433 | - 'description' => __( 'Donor information updated successfully.', 'give' ), |
|
433 | + 'description' => __('Donor information updated successfully.', 'give'), |
|
434 | 434 | 'show' => true, |
435 | - ) ); |
|
435 | + )); |
|
436 | 436 | break; |
437 | 437 | } |
438 | 438 | } |
439 | 439 | } |
440 | 440 | } |
441 | 441 | |
442 | -add_action( 'admin_notices', '_give_register_admin_notices', - 1 ); |
|
442 | +add_action('admin_notices', '_give_register_admin_notices', - 1); |
|
443 | 443 | |
444 | 444 | |
445 | 445 | /** |
@@ -449,31 +449,30 @@ discard block |
||
449 | 449 | * |
450 | 450 | * @return bool |
451 | 451 | */ |
452 | -function _give_show_test_mode_notice_in_admin_bar( $wp_admin_bar ) { |
|
453 | - $is_test_mode = ! empty( $_POST['test_mode'] ) ? |
|
454 | - give_is_setting_enabled( $_POST['test_mode'] ) : |
|
455 | - give_is_test_mode(); |
|
452 | +function _give_show_test_mode_notice_in_admin_bar($wp_admin_bar) { |
|
453 | + $is_test_mode = ! empty($_POST['test_mode']) ? |
|
454 | + give_is_setting_enabled($_POST['test_mode']) : give_is_test_mode(); |
|
456 | 455 | |
457 | 456 | if ( |
458 | - ! current_user_can( 'view_give_reports' ) || |
|
457 | + ! current_user_can('view_give_reports') || |
|
459 | 458 | ! $is_test_mode |
460 | 459 | ) { |
461 | 460 | return false; |
462 | 461 | } |
463 | 462 | |
464 | 463 | // Add the main site admin menu item. |
465 | - $wp_admin_bar->add_menu( array( |
|
464 | + $wp_admin_bar->add_menu(array( |
|
466 | 465 | 'id' => 'give-test-notice', |
467 | - 'href' => admin_url( 'edit.php?post_type=give_forms&page=give-settings&tab=gateways' ), |
|
466 | + 'href' => admin_url('edit.php?post_type=give_forms&page=give-settings&tab=gateways'), |
|
468 | 467 | 'parent' => 'top-secondary', |
469 | - 'title' => __( 'Give Test Mode Active', 'give' ), |
|
470 | - 'meta' => array( 'class' => 'give-test-mode-active' ), |
|
471 | - ) ); |
|
468 | + 'title' => __('Give Test Mode Active', 'give'), |
|
469 | + 'meta' => array('class' => 'give-test-mode-active'), |
|
470 | + )); |
|
472 | 471 | |
473 | 472 | return true; |
474 | 473 | } |
475 | 474 | |
476 | -add_action( 'admin_bar_menu', '_give_show_test_mode_notice_in_admin_bar', 1000, 1 ); |
|
475 | +add_action('admin_bar_menu', '_give_show_test_mode_notice_in_admin_bar', 1000, 1); |
|
477 | 476 | |
478 | 477 | /** |
479 | 478 | * Add Link to Import page in from donation archive and donation single page |
@@ -482,12 +481,12 @@ discard block |
||
482 | 481 | */ |
483 | 482 | function give_import_page_link_callback() { |
484 | 483 | ?> |
485 | - <a href="<?php echo esc_url( give_import_page_url() ); ?>" |
|
486 | - class="page-import-action page-title-action"><?php _e( 'Import Donations', 'give' ); ?></a> |
|
484 | + <a href="<?php echo esc_url(give_import_page_url()); ?>" |
|
485 | + class="page-import-action page-title-action"><?php _e('Import Donations', 'give'); ?></a> |
|
487 | 486 | |
488 | 487 | <?php |
489 | 488 | // Check if view donation single page only. |
490 | - if ( ! empty( $_REQUEST['view'] ) && 'view-payment-details' === (string) give_clean( $_REQUEST['view'] ) && 'give-payment-history' === give_clean( $_REQUEST['page'] ) ) { |
|
489 | + if ( ! empty($_REQUEST['view']) && 'view-payment-details' === (string) give_clean($_REQUEST['view']) && 'give-payment-history' === give_clean($_REQUEST['page'])) { |
|
491 | 490 | ?> |
492 | 491 | <style type="text/css"> |
493 | 492 | .wrap #transaction-details-heading { |
@@ -498,7 +497,7 @@ discard block |
||
498 | 497 | } |
499 | 498 | } |
500 | 499 | |
501 | -add_action( 'give_payments_page_top', 'give_import_page_link_callback', 11 ); |
|
500 | +add_action('give_payments_page_top', 'give_import_page_link_callback', 11); |
|
502 | 501 | |
503 | 502 | /** |
504 | 503 | * Load donation import ajax callback |
@@ -510,9 +509,9 @@ discard block |
||
510 | 509 | */ |
511 | 510 | function give_donation_import_callback() { |
512 | 511 | $import_setting = array(); |
513 | - $fields = isset( $_POST['fields'] ) ? $_POST['fields'] : null; |
|
512 | + $fields = isset($_POST['fields']) ? $_POST['fields'] : null; |
|
514 | 513 | |
515 | - parse_str( $fields ); |
|
514 | + parse_str($fields); |
|
516 | 515 | |
517 | 516 | $import_setting['create_user'] = $create_user; |
518 | 517 | $import_setting['mode'] = $mode; |
@@ -521,57 +520,57 @@ discard block |
||
521 | 520 | $import_setting['delete_csv'] = $delete_csv; |
522 | 521 | |
523 | 522 | // Parent key id. |
524 | - $main_key = maybe_unserialize( $main_key ); |
|
525 | - |
|
526 | - $current = absint( $_REQUEST['current'] ); |
|
527 | - $total_ajax = absint( $_REQUEST['total_ajax'] ); |
|
528 | - $start = absint( $_REQUEST['start'] ); |
|
529 | - $end = absint( $_REQUEST['end'] ); |
|
530 | - $next = absint( $_REQUEST['next'] ); |
|
531 | - $total = absint( $_REQUEST['total'] ); |
|
532 | - $per_page = absint( $_REQUEST['per_page'] ); |
|
533 | - if ( empty( $delimiter ) ) { |
|
523 | + $main_key = maybe_unserialize($main_key); |
|
524 | + |
|
525 | + $current = absint($_REQUEST['current']); |
|
526 | + $total_ajax = absint($_REQUEST['total_ajax']); |
|
527 | + $start = absint($_REQUEST['start']); |
|
528 | + $end = absint($_REQUEST['end']); |
|
529 | + $next = absint($_REQUEST['next']); |
|
530 | + $total = absint($_REQUEST['total']); |
|
531 | + $per_page = absint($_REQUEST['per_page']); |
|
532 | + if (empty($delimiter)) { |
|
534 | 533 | $delimiter = ','; |
535 | 534 | } |
536 | 535 | |
537 | 536 | // Processing done here. |
538 | - $raw_data = give_get_donation_data_from_csv( $csv, $start, $end, $delimiter ); |
|
539 | - $raw_key = maybe_unserialize( $mapto ); |
|
537 | + $raw_data = give_get_donation_data_from_csv($csv, $start, $end, $delimiter); |
|
538 | + $raw_key = maybe_unserialize($mapto); |
|
540 | 539 | |
541 | 540 | // Prevent normal emails. |
542 | - remove_action( 'give_complete_donation', 'give_trigger_donation_receipt', 999 ); |
|
543 | - remove_action( 'give_insert_user', 'give_new_user_notification', 10 ); |
|
544 | - remove_action( 'give_insert_payment', 'give_payment_save_page_data' ); |
|
545 | - |
|
546 | - $current_key = $start; |
|
547 | - foreach ( $raw_data as $row_data ) { |
|
548 | - $import_setting['donation_key'] = $current_key; |
|
549 | - give_save_import_donation_to_db( $raw_key, $row_data, $main_key, $import_setting ); |
|
541 | + remove_action('give_complete_donation', 'give_trigger_donation_receipt', 999); |
|
542 | + remove_action('give_insert_user', 'give_new_user_notification', 10); |
|
543 | + remove_action('give_insert_payment', 'give_payment_save_page_data'); |
|
544 | + |
|
545 | + $current_key = $start; |
|
546 | + foreach ($raw_data as $row_data) { |
|
547 | + $import_setting['donation_key'] = $current_key; |
|
548 | + give_save_import_donation_to_db($raw_key, $row_data, $main_key, $import_setting); |
|
550 | 549 | $current_key++; |
551 | 550 | } |
552 | 551 | |
553 | 552 | // Check if function exists or not. |
554 | - if ( function_exists( 'give_payment_save_page_data' ) ) { |
|
555 | - add_action( 'give_insert_payment', 'give_payment_save_page_data' ); |
|
553 | + if (function_exists('give_payment_save_page_data')) { |
|
554 | + add_action('give_insert_payment', 'give_payment_save_page_data'); |
|
556 | 555 | } |
557 | - add_action( 'give_insert_user', 'give_new_user_notification', 10, 2 ); |
|
558 | - add_action( 'give_complete_donation', 'give_trigger_donation_receipt', 999 ); |
|
556 | + add_action('give_insert_user', 'give_new_user_notification', 10, 2); |
|
557 | + add_action('give_complete_donation', 'give_trigger_donation_receipt', 999); |
|
559 | 558 | |
560 | - if ( $next == false ) { |
|
559 | + if ($next == false) { |
|
561 | 560 | $json_data = array( |
562 | 561 | 'success' => true, |
563 | - 'message' => __( 'All donation uploaded successfully!', 'give' ), |
|
562 | + 'message' => __('All donation uploaded successfully!', 'give'), |
|
564 | 563 | ); |
565 | 564 | } else { |
566 | 565 | $index_start = $start; |
567 | 566 | $index_end = $end; |
568 | 567 | $last = false; |
569 | 568 | $next = true; |
570 | - if ( $next ) { |
|
569 | + if ($next) { |
|
571 | 570 | $index_start = $index_start + $per_page; |
572 | - $index_end = $per_page + ( $index_start - 1 ); |
|
571 | + $index_end = $per_page + ($index_start - 1); |
|
573 | 572 | } |
574 | - if ( $index_end >= $total ) { |
|
573 | + if ($index_end >= $total) { |
|
575 | 574 | $index_end = $total; |
576 | 575 | $last = true; |
577 | 576 | } |
@@ -585,27 +584,27 @@ discard block |
||
585 | 584 | ); |
586 | 585 | } |
587 | 586 | |
588 | - $url = give_import_page_url( array( |
|
587 | + $url = give_import_page_url(array( |
|
589 | 588 | 'step' => '4', |
590 | 589 | 'importer-type' => 'import_donations', |
591 | 590 | 'csv' => $csv, |
592 | 591 | 'total' => $total, |
593 | 592 | 'delete_csv' => $import_setting['delete_csv'], |
594 | - 'success' => ( isset( $json_data['success'] ) ? $json_data['success'] : '' ), |
|
595 | - ) ); |
|
593 | + 'success' => (isset($json_data['success']) ? $json_data['success'] : ''), |
|
594 | + )); |
|
596 | 595 | $json_data['url'] = $url; |
597 | 596 | |
598 | - $current ++; |
|
597 | + $current++; |
|
599 | 598 | $json_data['current'] = $current; |
600 | 599 | |
601 | - $percentage = ( 100 / ( $total_ajax + 1 ) ) * $current; |
|
600 | + $percentage = (100 / ($total_ajax + 1)) * $current; |
|
602 | 601 | $json_data['percentage'] = $percentage; |
603 | 602 | |
604 | - $json_data = apply_filters( 'give_import_ajax_responces', $json_data, $fields ); |
|
605 | - wp_die( json_encode( $json_data ) ); |
|
603 | + $json_data = apply_filters('give_import_ajax_responces', $json_data, $fields); |
|
604 | + wp_die(json_encode($json_data)); |
|
606 | 605 | } |
607 | 606 | |
608 | -add_action( 'wp_ajax_give_donation_import', 'give_donation_import_callback' ); |
|
607 | +add_action('wp_ajax_give_donation_import', 'give_donation_import_callback'); |
|
609 | 608 | |
610 | 609 | /** |
611 | 610 | * Load core settings import ajax callback |
@@ -617,8 +616,8 @@ discard block |
||
617 | 616 | */ |
618 | 617 | |
619 | 618 | function give_core_settings_import_callback() { |
620 | - $fields = isset( $_POST['fields'] ) ? $_POST['fields'] : null; |
|
621 | - parse_str( $fields, $fields ); |
|
619 | + $fields = isset($_POST['fields']) ? $_POST['fields'] : null; |
|
620 | + parse_str($fields, $fields); |
|
622 | 621 | |
623 | 622 | $json_data['success'] = false; |
624 | 623 | |
@@ -633,22 +632,22 @@ discard block |
||
633 | 632 | * |
634 | 633 | * @return array $fields |
635 | 634 | */ |
636 | - $fields = (array) apply_filters( 'give_import_core_settings_fields', $fields ); |
|
635 | + $fields = (array) apply_filters('give_import_core_settings_fields', $fields); |
|
637 | 636 | |
638 | - $file_name = ( ! empty( $fields['file_name'] ) ? give_clean( $fields['file_name'] ) : false ); |
|
637 | + $file_name = ( ! empty($fields['file_name']) ? give_clean($fields['file_name']) : false); |
|
639 | 638 | |
640 | - if ( ! empty( $file_name ) ) { |
|
641 | - $type = ( ! empty( $fields['type'] ) ? give_clean( $fields['type'] ) : 'merge' ); |
|
639 | + if ( ! empty($file_name)) { |
|
640 | + $type = ( ! empty($fields['type']) ? give_clean($fields['type']) : 'merge'); |
|
642 | 641 | |
643 | 642 | // Get the json data from the file and then alter it in array format |
644 | - $json_string = give_get_core_settings_json( $file_name ); |
|
645 | - $json_to_array = json_decode( $json_string, true ); |
|
643 | + $json_string = give_get_core_settings_json($file_name); |
|
644 | + $json_to_array = json_decode($json_string, true); |
|
646 | 645 | |
647 | 646 | // get the current settign from the options table. |
648 | - $host_give_options = get_option( 'give_settings', array() ); |
|
647 | + $host_give_options = get_option('give_settings', array()); |
|
649 | 648 | |
650 | 649 | // Save old settins for backup. |
651 | - update_option( 'give_settings_old', $host_give_options ); |
|
650 | + update_option('give_settings_old', $host_give_options); |
|
652 | 651 | |
653 | 652 | /** |
654 | 653 | * Filter to Modify Core Settings that are being going to get import in options table as give settings. |
@@ -664,9 +663,9 @@ discard block |
||
664 | 663 | * |
665 | 664 | * @return array $json_to_array Setting that are being going to get imported |
666 | 665 | */ |
667 | - $json_to_array = (array) apply_filters( 'give_import_core_settings_data', $json_to_array, $type, $host_give_options, $fields ); |
|
666 | + $json_to_array = (array) apply_filters('give_import_core_settings_data', $json_to_array, $type, $host_give_options, $fields); |
|
668 | 667 | |
669 | - update_option( 'give_settings', $json_to_array ); |
|
668 | + update_option('give_settings', $json_to_array); |
|
670 | 669 | |
671 | 670 | $json_data['success'] = true; |
672 | 671 | } |
@@ -682,16 +681,16 @@ discard block |
||
682 | 681 | * |
683 | 682 | * @return array $url |
684 | 683 | */ |
685 | - $json_data['url'] = give_import_page_url( (array) apply_filters( 'give_import_core_settings_success_url', array( |
|
686 | - 'step' => ( empty( $json_data['success'] ) ? '1' : '3' ), |
|
684 | + $json_data['url'] = give_import_page_url((array) apply_filters('give_import_core_settings_success_url', array( |
|
685 | + 'step' => (empty($json_data['success']) ? '1' : '3'), |
|
687 | 686 | 'importer-type' => 'import_core_setting', |
688 | - 'success' => ( empty( $json_data['success'] ) ? '0' : '1' ), |
|
689 | - ) ) ); |
|
687 | + 'success' => (empty($json_data['success']) ? '0' : '1'), |
|
688 | + ))); |
|
690 | 689 | |
691 | - wp_send_json( $json_data ); |
|
690 | + wp_send_json($json_data); |
|
692 | 691 | } |
693 | 692 | |
694 | -add_action( 'wp_ajax_give_core_settings_import', 'give_core_settings_import_callback' ); |
|
693 | +add_action('wp_ajax_give_core_settings_import', 'give_core_settings_import_callback'); |
|
695 | 694 | |
696 | 695 | /** |
697 | 696 | * Initializes blank slate content if a list table is empty. |
@@ -703,7 +702,7 @@ discard block |
||
703 | 702 | $blank_slate->init(); |
704 | 703 | } |
705 | 704 | |
706 | -add_action( 'current_screen', 'give_blank_slate' ); |
|
705 | +add_action('current_screen', 'give_blank_slate'); |
|
707 | 706 | |
708 | 707 | /** |
709 | 708 | * Validate Fields of User Profile |
@@ -716,24 +715,24 @@ discard block |
||
716 | 715 | * |
717 | 716 | * @return mixed |
718 | 717 | */ |
719 | -function give_validate_user_profile( $errors, $update, $user ) { |
|
718 | +function give_validate_user_profile($errors, $update, $user) { |
|
720 | 719 | |
721 | - if ( ! empty( $_POST['action'] ) && ( 'adduser' === $_POST['action'] || 'createuser' === $_POST['action'] ) ) { |
|
720 | + if ( ! empty($_POST['action']) && ('adduser' === $_POST['action'] || 'createuser' === $_POST['action'])) { |
|
722 | 721 | return; |
723 | 722 | } |
724 | 723 | |
725 | - if ( ! empty( $user->ID ) ) { |
|
726 | - $donor = Give()->donors->get_donor_by( 'user_id', $user->ID ); |
|
724 | + if ( ! empty($user->ID)) { |
|
725 | + $donor = Give()->donors->get_donor_by('user_id', $user->ID); |
|
727 | 726 | |
728 | - if ( $donor ) { |
|
727 | + if ($donor) { |
|
729 | 728 | // If Donor is attached with User, then validate first name. |
730 | - if ( empty( $_POST['first_name'] ) ) { |
|
729 | + if (empty($_POST['first_name'])) { |
|
731 | 730 | $errors->add( |
732 | 731 | 'empty_first_name', |
733 | 732 | sprintf( |
734 | 733 | '<strong>%1$s:</strong> %2$s', |
735 | - __( 'ERROR', 'give' ), |
|
736 | - __( 'Please enter your first name.', 'give' ) |
|
734 | + __('ERROR', 'give'), |
|
735 | + __('Please enter your first name.', 'give') |
|
737 | 736 | ) |
738 | 737 | ); |
739 | 738 | } |
@@ -742,7 +741,7 @@ discard block |
||
742 | 741 | |
743 | 742 | } |
744 | 743 | |
745 | -add_action( 'user_profile_update_errors', 'give_validate_user_profile', 10, 3 ); |
|
744 | +add_action('user_profile_update_errors', 'give_validate_user_profile', 10, 3); |
|
746 | 745 | |
747 | 746 | /** |
748 | 747 | * Show Donor Information on User Profile Page. |
@@ -751,19 +750,19 @@ discard block |
||
751 | 750 | * |
752 | 751 | * @since 2.0 |
753 | 752 | */ |
754 | -function give_donor_information_profile_fields( $user ) { |
|
755 | - $donor = Give()->donors->get_donor_by( 'user_id', $user->ID ); |
|
753 | +function give_donor_information_profile_fields($user) { |
|
754 | + $donor = Give()->donors->get_donor_by('user_id', $user->ID); |
|
756 | 755 | |
757 | 756 | // Display Donor Information, only if donor is attached with User. |
758 | - if ( ! empty( $donor->user_id ) ) { |
|
757 | + if ( ! empty($donor->user_id)) { |
|
759 | 758 | ?> |
760 | 759 | <table class="form-table"> |
761 | 760 | <tbody> |
762 | 761 | <tr> |
763 | - <th scope="row"><?php _e( 'Donor', 'give' ); ?></th> |
|
762 | + <th scope="row"><?php _e('Donor', 'give'); ?></th> |
|
764 | 763 | <td> |
765 | - <a href="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $donor->id ); ?>"> |
|
766 | - <?php _e( 'View Donor Information', 'give' ); ?> |
|
764 | + <a href="<?php echo admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$donor->id); ?>"> |
|
765 | + <?php _e('View Donor Information', 'give'); ?> |
|
767 | 766 | </a> |
768 | 767 | </td> |
769 | 768 | </tr> |
@@ -773,7 +772,7 @@ discard block |
||
773 | 772 | } |
774 | 773 | } |
775 | 774 | |
776 | -add_action( 'personal_options', 'give_donor_information_profile_fields' ); |
|
775 | +add_action('personal_options', 'give_donor_information_profile_fields'); |
|
777 | 776 | /** |
778 | 777 | * Get Array of WP User Roles. |
779 | 778 | * |
@@ -785,8 +784,8 @@ discard block |
||
785 | 784 | $user_roles = array(); |
786 | 785 | |
787 | 786 | // Loop through User Roles. |
788 | - foreach ( get_editable_roles() as $role_name => $role_info ): |
|
789 | - $user_roles[ $role_name ] = $role_info['name']; |
|
787 | + foreach (get_editable_roles() as $role_name => $role_info): |
|
788 | + $user_roles[$role_name] = $role_info['name']; |
|
790 | 789 | endforeach; |
791 | 790 | |
792 | 791 | return $user_roles; |
@@ -803,44 +802,42 @@ discard block |
||
803 | 802 | function __give_ajax_donor_manage_addresses() { |
804 | 803 | // Bailout. |
805 | 804 | if ( |
806 | - empty( $_POST['form'] ) || |
|
807 | - empty( $_POST['donorID'] ) |
|
805 | + empty($_POST['form']) || |
|
806 | + empty($_POST['donorID']) |
|
808 | 807 | ) { |
809 | - wp_send_json_error( array( 'error' => 1 ) ); |
|
808 | + wp_send_json_error(array('error' => 1)); |
|
810 | 809 | } |
811 | 810 | |
812 | - $post = give_clean( wp_parse_args( $_POST ) ); |
|
813 | - $donorID = absint( $post['donorID'] ); |
|
814 | - $form_data = give_clean( wp_parse_args( $post['form'] ) ); |
|
815 | - $is_multi_address_type = ( 'billing' === $form_data['address-id'] || false !== strpos( $form_data['address-id'], '_' ) ); |
|
816 | - $address_type = false !== strpos( $form_data['address-id'], '_' ) ? |
|
817 | - array_shift( explode( '_', $form_data['address-id'] ) ) : |
|
818 | - $form_data['address-id']; |
|
819 | - $address_id = false !== strpos( $form_data['address-id'], '_' ) ? |
|
820 | - array_pop( explode( '_', $form_data['address-id'] ) ) : |
|
821 | - null; |
|
811 | + $post = give_clean(wp_parse_args($_POST)); |
|
812 | + $donorID = absint($post['donorID']); |
|
813 | + $form_data = give_clean(wp_parse_args($post['form'])); |
|
814 | + $is_multi_address_type = ('billing' === $form_data['address-id'] || false !== strpos($form_data['address-id'], '_')); |
|
815 | + $address_type = false !== strpos($form_data['address-id'], '_') ? |
|
816 | + array_shift(explode('_', $form_data['address-id'])) : $form_data['address-id']; |
|
817 | + $address_id = false !== strpos($form_data['address-id'], '_') ? |
|
818 | + array_pop(explode('_', $form_data['address-id'])) : null; |
|
822 | 819 | $response_data = array( |
823 | 820 | 'action' => $form_data['address-action'], |
824 | 821 | 'id' => $form_data['address-id'], |
825 | 822 | ); |
826 | 823 | |
827 | 824 | // Security check. |
828 | - if ( ! wp_verify_nonce( $form_data['_wpnonce'], 'give-manage-donor-addresses' ) ) { |
|
829 | - wp_send_json_error( array( |
|
825 | + if ( ! wp_verify_nonce($form_data['_wpnonce'], 'give-manage-donor-addresses')) { |
|
826 | + wp_send_json_error(array( |
|
830 | 827 | 'error' => 1, |
831 | 828 | 'error_msg' => wp_sprintf( |
832 | 829 | '<div class="notice notice-error"><p>%s</p></div>', |
833 | - __( 'Error: Security issue.', 'give' ) |
|
830 | + __('Error: Security issue.', 'give') |
|
834 | 831 | ) |
835 | 832 | ) |
836 | 833 | ); |
837 | 834 | } |
838 | 835 | |
839 | - $donor = new Give_Donor( $donorID ); |
|
836 | + $donor = new Give_Donor($donorID); |
|
840 | 837 | |
841 | 838 | // Verify donor. |
842 | - if ( ! $donor->id ) { |
|
843 | - wp_send_json_error( array( 'error' => 3 ) ); |
|
839 | + if ( ! $donor->id) { |
|
840 | + wp_send_json_error(array('error' => 3)); |
|
844 | 841 | } |
845 | 842 | |
846 | 843 | // Unset all data except address. |
@@ -851,57 +848,55 @@ discard block |
||
851 | 848 | ); |
852 | 849 | |
853 | 850 | // Process action. |
854 | - switch ( $response_data['action'] ) { |
|
851 | + switch ($response_data['action']) { |
|
855 | 852 | |
856 | 853 | case 'add': |
857 | - if ( ! $donor->add_address( "{$address_type}[]", $form_data ) ) { |
|
858 | - wp_send_json_error( array( |
|
854 | + if ( ! $donor->add_address("{$address_type}[]", $form_data)) { |
|
855 | + wp_send_json_error(array( |
|
859 | 856 | 'error' => 1, |
860 | 857 | 'error_msg' => wp_sprintf( |
861 | 858 | '<div class="notice notice-error"><p>%s</p></div>', |
862 | - __( 'Error: Unable to save the address. Please check if address already exist.', 'give' ) |
|
859 | + __('Error: Unable to save the address. Please check if address already exist.', 'give') |
|
863 | 860 | ) |
864 | 861 | ) |
865 | 862 | ); |
866 | 863 | } |
867 | 864 | |
868 | - $total_addresses = count( $donor->address[ $address_type ] ); |
|
865 | + $total_addresses = count($donor->address[$address_type]); |
|
869 | 866 | |
870 | 867 | $address_index = $is_multi_address_type ? |
871 | - $total_addresses - 1 : |
|
872 | - $address_type; |
|
868 | + $total_addresses - 1 : $address_type; |
|
873 | 869 | |
874 | 870 | $address_id = $is_multi_address_type ? |
875 | - end( array_keys( $donor->address[ $address_type ] ) ) : |
|
876 | - $address_type; |
|
871 | + end(array_keys($donor->address[$address_type])) : $address_type; |
|
877 | 872 | |
878 | 873 | $response_data['address_html'] = __give_get_format_address( |
879 | - end( $donor->address['billing'] ), |
|
874 | + end($donor->address['billing']), |
|
880 | 875 | array( |
881 | 876 | // We can add only billing address from donor screen. |
882 | 877 | 'type' => 'billing', |
883 | 878 | 'id' => $address_id, |
884 | - 'index' => ++ $address_index, |
|
879 | + 'index' => ++$address_index, |
|
885 | 880 | ) |
886 | 881 | ); |
887 | - $response_data['success_msg'] = wp_sprintf( |
|
882 | + $response_data['success_msg'] = wp_sprintf( |
|
888 | 883 | '<div class="notice updated"><p>%s</p></div>', |
889 | - __( 'Successfully added a new address to the donor.', 'give' ) |
|
884 | + __('Successfully added a new address to the donor.', 'give') |
|
890 | 885 | ); |
891 | 886 | |
892 | - if ( $is_multi_address_type ) { |
|
887 | + if ($is_multi_address_type) { |
|
893 | 888 | $response_data['id'] = "{$response_data['id']}_{$address_index}"; |
894 | 889 | } |
895 | 890 | |
896 | 891 | break; |
897 | 892 | |
898 | 893 | case 'remove': |
899 | - if ( ! $donor->remove_address( $response_data['id'] ) ) { |
|
900 | - wp_send_json_error( array( |
|
894 | + if ( ! $donor->remove_address($response_data['id'])) { |
|
895 | + wp_send_json_error(array( |
|
901 | 896 | 'error' => 2, |
902 | 897 | 'error_msg' => wp_sprintf( |
903 | 898 | '<div class="notice notice-error"><p>%s</p></div>', |
904 | - __( 'Error: Unable to delete address.', 'give' ) |
|
899 | + __('Error: Unable to delete address.', 'give') |
|
905 | 900 | ) |
906 | 901 | ) |
907 | 902 | ); |
@@ -909,18 +904,18 @@ discard block |
||
909 | 904 | |
910 | 905 | $response_data['success_msg'] = wp_sprintf( |
911 | 906 | '<div class="notice updated"><p>%s</p></div>', |
912 | - __( 'Successfully removed a address of donor.', 'give' ) |
|
907 | + __('Successfully removed a address of donor.', 'give') |
|
913 | 908 | ); |
914 | 909 | |
915 | 910 | break; |
916 | 911 | |
917 | 912 | case 'update': |
918 | - if ( ! $donor->update_address( $response_data['id'], $form_data ) ) { |
|
919 | - wp_send_json_error( array( |
|
913 | + if ( ! $donor->update_address($response_data['id'], $form_data)) { |
|
914 | + wp_send_json_error(array( |
|
920 | 915 | 'error' => 3, |
921 | 916 | 'error_msg' => wp_sprintf( |
922 | 917 | '<div class="notice notice-error"><p>%s</p></div>', |
923 | - __( 'Error: Unable to update address. Please check if address already exist.', 'give' ) |
|
918 | + __('Error: Unable to update address. Please check if address already exist.', 'give') |
|
924 | 919 | ) |
925 | 920 | ) |
926 | 921 | ); |
@@ -928,26 +923,25 @@ discard block |
||
928 | 923 | |
929 | 924 | $response_data['address_html'] = __give_get_format_address( |
930 | 925 | $is_multi_address_type ? |
931 | - $donor->address[ $address_type ][ $address_id ] : |
|
932 | - $donor->address[ $address_type ], |
|
926 | + $donor->address[$address_type][$address_id] : $donor->address[$address_type], |
|
933 | 927 | array( |
934 | 928 | 'type' => $address_type, |
935 | 929 | 'id' => $address_id, |
936 | 930 | 'index' => $address_id, |
937 | 931 | ) |
938 | 932 | ); |
939 | - $response_data['success_msg'] = wp_sprintf( |
|
933 | + $response_data['success_msg'] = wp_sprintf( |
|
940 | 934 | '<div class="notice updated"><p>%s</p></div>', |
941 | - __( 'Successfully updated a address of donor', 'give' ) |
|
935 | + __('Successfully updated a address of donor', 'give') |
|
942 | 936 | ); |
943 | 937 | |
944 | 938 | break; |
945 | 939 | } |
946 | 940 | |
947 | - wp_send_json_success( $response_data ); |
|
941 | + wp_send_json_success($response_data); |
|
948 | 942 | } |
949 | 943 | |
950 | -add_action( 'wp_ajax_donor_manage_addresses', '__give_ajax_donor_manage_addresses' ); |
|
944 | +add_action('wp_ajax_donor_manage_addresses', '__give_ajax_donor_manage_addresses'); |
|
951 | 945 | |
952 | 946 | /** |
953 | 947 | * Admin donor billing address label |
@@ -958,13 +952,13 @@ discard block |
||
958 | 952 | * |
959 | 953 | * @return string |
960 | 954 | */ |
961 | -function __give_donor_billing_address_label( $address_label ) { |
|
962 | - $address_label = __( 'Billing Address', 'give' ); |
|
955 | +function __give_donor_billing_address_label($address_label) { |
|
956 | + $address_label = __('Billing Address', 'give'); |
|
963 | 957 | |
964 | 958 | return $address_label; |
965 | 959 | } |
966 | 960 | |
967 | -add_action( 'give_donor_billing_address_label', '__give_donor_billing_address_label' ); |
|
961 | +add_action('give_donor_billing_address_label', '__give_donor_billing_address_label'); |
|
968 | 962 | |
969 | 963 | /** |
970 | 964 | * Admin donor personal address label |
@@ -975,13 +969,13 @@ discard block |
||
975 | 969 | * |
976 | 970 | * @return string |
977 | 971 | */ |
978 | -function __give_donor_personal_address_label( $address_label ) { |
|
979 | - $address_label = __( 'Personal Address', 'give' ); |
|
972 | +function __give_donor_personal_address_label($address_label) { |
|
973 | + $address_label = __('Personal Address', 'give'); |
|
980 | 974 | |
981 | 975 | return $address_label; |
982 | 976 | } |
983 | 977 | |
984 | -add_action( 'give_donor_personal_address_label', '__give_donor_personal_address_label' ); |
|
978 | +add_action('give_donor_personal_address_label', '__give_donor_personal_address_label'); |
|
985 | 979 | |
986 | 980 | /** |
987 | 981 | * Update Donor Information when User Profile is updated from admin. |
@@ -994,32 +988,32 @@ discard block |
||
994 | 988 | * |
995 | 989 | * @return bool |
996 | 990 | */ |
997 | -function give_update_donor_name_on_user_update( $user_id = 0 ) { |
|
991 | +function give_update_donor_name_on_user_update($user_id = 0) { |
|
998 | 992 | |
999 | - if ( current_user_can( 'edit_user', $user_id ) ) { |
|
993 | + if (current_user_can('edit_user', $user_id)) { |
|
1000 | 994 | |
1001 | - $donor = new Give_Donor( $user_id, true ); |
|
995 | + $donor = new Give_Donor($user_id, true); |
|
1002 | 996 | |
1003 | 997 | // Bailout, if donor doesn't exists. |
1004 | - if ( ! $donor ) { |
|
998 | + if ( ! $donor) { |
|
1005 | 999 | return false; |
1006 | 1000 | } |
1007 | 1001 | |
1008 | 1002 | // Get User First name and Last name. |
1009 | - $first_name = ( $_POST['first_name'] ) ? give_clean( $_POST['first_name'] ) : get_user_meta( $user_id, 'first_name', true ); |
|
1010 | - $last_name = ( $_POST['last_name'] ) ? give_clean( $_POST['last_name'] ) : get_user_meta( $user_id, 'last_name', true ); |
|
1011 | - $full_name = strip_tags( wp_unslash( trim( "{$first_name} {$last_name}" ) ) ); |
|
1003 | + $first_name = ($_POST['first_name']) ? give_clean($_POST['first_name']) : get_user_meta($user_id, 'first_name', true); |
|
1004 | + $last_name = ($_POST['last_name']) ? give_clean($_POST['last_name']) : get_user_meta($user_id, 'last_name', true); |
|
1005 | + $full_name = strip_tags(wp_unslash(trim("{$first_name} {$last_name}"))); |
|
1012 | 1006 | |
1013 | 1007 | // Assign User First name and Last name to Donor. |
1014 | - Give()->donors->update( $donor->id, array( 'name' => $full_name ) ); |
|
1015 | - Give()->donor_meta->update_meta( $donor->id, '_give_donor_first_name', $first_name ); |
|
1016 | - Give()->donor_meta->update_meta( $donor->id, '_give_donor_last_name', $last_name ); |
|
1008 | + Give()->donors->update($donor->id, array('name' => $full_name)); |
|
1009 | + Give()->donor_meta->update_meta($donor->id, '_give_donor_first_name', $first_name); |
|
1010 | + Give()->donor_meta->update_meta($donor->id, '_give_donor_last_name', $last_name); |
|
1017 | 1011 | |
1018 | 1012 | } |
1019 | 1013 | } |
1020 | 1014 | |
1021 | -add_action( 'edit_user_profile_update', 'give_update_donor_name_on_user_update', 10 ); |
|
1022 | -add_action( 'personal_options_update', 'give_update_donor_name_on_user_update', 10 ); |
|
1015 | +add_action('edit_user_profile_update', 'give_update_donor_name_on_user_update', 10); |
|
1016 | +add_action('personal_options_update', 'give_update_donor_name_on_user_update', 10); |
|
1023 | 1017 | |
1024 | 1018 | |
1025 | 1019 | /** |
@@ -1034,29 +1028,29 @@ discard block |
||
1034 | 1028 | * |
1035 | 1029 | * @return bool |
1036 | 1030 | */ |
1037 | -function give_update_donor_email_on_user_update( $user_id = 0, $old_user_data = false ) { |
|
1031 | +function give_update_donor_email_on_user_update($user_id = 0, $old_user_data = false) { |
|
1038 | 1032 | |
1039 | - $donor = new Give_Donor( $user_id, true ); |
|
1033 | + $donor = new Give_Donor($user_id, true); |
|
1040 | 1034 | |
1041 | - if ( ! $donor ) { |
|
1035 | + if ( ! $donor) { |
|
1042 | 1036 | return false; |
1043 | 1037 | } |
1044 | 1038 | |
1045 | - $user = get_userdata( $user_id ); |
|
1039 | + $user = get_userdata($user_id); |
|
1046 | 1040 | |
1047 | - if ( ! empty( $user ) && $user->user_email !== $donor->email ) { |
|
1041 | + if ( ! empty($user) && $user->user_email !== $donor->email) { |
|
1048 | 1042 | |
1049 | - $success = Give()->donors->update( $donor->id, array( 'email' => $user->user_email ) ); |
|
1043 | + $success = Give()->donors->update($donor->id, array('email' => $user->user_email)); |
|
1050 | 1044 | |
1051 | - if ( $success ) { |
|
1045 | + if ($success) { |
|
1052 | 1046 | // Update some payment meta if we need to |
1053 | - $payments_array = explode( ',', $donor->payment_ids ); |
|
1047 | + $payments_array = explode(',', $donor->payment_ids); |
|
1054 | 1048 | |
1055 | - if ( ! empty( $payments_array ) ) { |
|
1049 | + if ( ! empty($payments_array)) { |
|
1056 | 1050 | |
1057 | - foreach ( $payments_array as $payment_id ) { |
|
1051 | + foreach ($payments_array as $payment_id) { |
|
1058 | 1052 | |
1059 | - give_update_payment_meta( $payment_id, 'email', $user->user_email ); |
|
1053 | + give_update_payment_meta($payment_id, 'email', $user->user_email); |
|
1060 | 1054 | |
1061 | 1055 | } |
1062 | 1056 | |
@@ -1070,7 +1064,7 @@ discard block |
||
1070 | 1064 | * @param WP_User $user WordPress User object. |
1071 | 1065 | * @param Give_Donor $donor Give donor object. |
1072 | 1066 | */ |
1073 | - do_action( 'give_update_donor_email_on_user_update', $user, $donor ); |
|
1067 | + do_action('give_update_donor_email_on_user_update', $user, $donor); |
|
1074 | 1068 | |
1075 | 1069 | } |
1076 | 1070 | |
@@ -1078,4 +1072,4 @@ discard block |
||
1078 | 1072 | |
1079 | 1073 | } |
1080 | 1074 | |
1081 | -add_action( 'profile_update', 'give_update_donor_email_on_user_update', 10, 2 ); |
|
1082 | 1075 | \ No newline at end of file |
1076 | +add_action('profile_update', 'give_update_donor_email_on_user_update', 10, 2); |
|
1083 | 1077 | \ No newline at end of file |
@@ -89,7 +89,7 @@ |
||
89 | 89 | * Connect and Reconnect Donor with User profile. |
90 | 90 | * @todo $address is unnecessary param because we are store address to user. |
91 | 91 | * |
92 | - * @param object $donor Donor Object. |
|
92 | + * @param Give_Donor $donor Donor Object. |
|
93 | 93 | * @param array $donor_data Donor Post Variables. |
94 | 94 | * @param array $address Address Information. |
95 | 95 | * |
@@ -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,7 +23,7 @@ discard block |
||
23 | 23 | * |
24 | 24 | * @return array The altered list of views. |
25 | 25 | */ |
26 | -function give_register_default_donor_views( $views ) { |
|
26 | +function give_register_default_donor_views($views) { |
|
27 | 27 | |
28 | 28 | $default_views = array( |
29 | 29 | 'overview' => 'give_donor_view', |
@@ -31,11 +31,11 @@ discard block |
||
31 | 31 | 'notes' => 'give_donor_notes_view', |
32 | 32 | ); |
33 | 33 | |
34 | - return array_merge( $views, $default_views ); |
|
34 | + return array_merge($views, $default_views); |
|
35 | 35 | |
36 | 36 | } |
37 | 37 | |
38 | -add_filter( 'give_donor_views', 'give_register_default_donor_views', 1, 1 ); |
|
38 | +add_filter('give_donor_views', 'give_register_default_donor_views', 1, 1); |
|
39 | 39 | |
40 | 40 | /** |
41 | 41 | * Register a tab for the single donor view. |
@@ -46,23 +46,23 @@ discard block |
||
46 | 46 | * |
47 | 47 | * @return array The altered list of tabs |
48 | 48 | */ |
49 | -function give_register_default_donor_tabs( $tabs ) { |
|
49 | +function give_register_default_donor_tabs($tabs) { |
|
50 | 50 | |
51 | 51 | $default_tabs = array( |
52 | 52 | 'overview' => array( |
53 | 53 | 'dashicon' => 'dashicons-admin-users', |
54 | - 'title' => __( 'Donor Profile', 'give' ), |
|
54 | + 'title' => __('Donor Profile', 'give'), |
|
55 | 55 | ), |
56 | 56 | 'notes' => array( |
57 | 57 | 'dashicon' => 'dashicons-admin-comments', |
58 | - 'title' => __( 'Donor Notes', 'give' ), |
|
58 | + 'title' => __('Donor Notes', 'give'), |
|
59 | 59 | ), |
60 | 60 | ); |
61 | 61 | |
62 | - return array_merge( $tabs, $default_tabs ); |
|
62 | + return array_merge($tabs, $default_tabs); |
|
63 | 63 | } |
64 | 64 | |
65 | -add_filter( 'give_donor_tabs', 'give_register_default_donor_tabs', 1, 1 ); |
|
65 | +add_filter('give_donor_tabs', 'give_register_default_donor_tabs', 1, 1); |
|
66 | 66 | |
67 | 67 | /** |
68 | 68 | * Register the Delete icon as late as possible so it's at the bottom. |
@@ -73,17 +73,17 @@ discard block |
||
73 | 73 | * |
74 | 74 | * @return array The altered list of tabs, with 'delete' at the bottom. |
75 | 75 | */ |
76 | -function give_register_delete_donor_tab( $tabs ) { |
|
76 | +function give_register_delete_donor_tab($tabs) { |
|
77 | 77 | |
78 | 78 | $tabs['delete'] = array( |
79 | 79 | 'dashicon' => 'dashicons-trash', |
80 | - 'title' => __( 'Delete Donor', 'give' ), |
|
80 | + 'title' => __('Delete Donor', 'give'), |
|
81 | 81 | ); |
82 | 82 | |
83 | 83 | return $tabs; |
84 | 84 | } |
85 | 85 | |
86 | -add_filter( 'give_donor_tabs', 'give_register_delete_donor_tab', PHP_INT_MAX, 1 ); |
|
86 | +add_filter('give_donor_tabs', 'give_register_delete_donor_tab', PHP_INT_MAX, 1); |
|
87 | 87 | |
88 | 88 | /** |
89 | 89 | * Connect and Reconnect Donor with User profile. |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | * |
98 | 98 | * @return array |
99 | 99 | */ |
100 | -function give_connect_user_donor_profile( $donor, $donor_data, $address ) { |
|
100 | +function give_connect_user_donor_profile($donor, $donor_data, $address) { |
|
101 | 101 | |
102 | 102 | $donor_id = $donor->id; |
103 | 103 | $previous_user_id = $donor->user_id; |
@@ -111,31 +111,31 @@ discard block |
||
111 | 111 | * |
112 | 112 | * @since 1.0 |
113 | 113 | */ |
114 | - do_action( 'give_pre_edit_donor', $donor_id, $donor_data, $address ); |
|
114 | + do_action('give_pre_edit_donor', $donor_id, $donor_data, $address); |
|
115 | 115 | |
116 | 116 | $output = array(); |
117 | 117 | |
118 | - if ( $donor->update( $donor_data ) ) { |
|
118 | + if ($donor->update($donor_data)) { |
|
119 | 119 | |
120 | 120 | // Create and Update Donor First Name and Last Name in Meta Fields. |
121 | - $donor->update_meta( '_give_donor_first_name', $donor_data['first_name'] ); |
|
122 | - $donor->update_meta( '_give_donor_last_name', $donor_data['last_name'] ); |
|
121 | + $donor->update_meta('_give_donor_first_name', $donor_data['first_name']); |
|
122 | + $donor->update_meta('_give_donor_last_name', $donor_data['last_name']); |
|
123 | 123 | |
124 | 124 | // Fetch disconnected user id, if exists. |
125 | - $disconnected_user_id = $donor->get_meta( '_give_disconnected_user_id', true ); |
|
125 | + $disconnected_user_id = $donor->get_meta('_give_disconnected_user_id', true); |
|
126 | 126 | |
127 | 127 | // Flag User and Donor Disconnection. |
128 | - delete_user_meta( $disconnected_user_id, '_give_is_donor_disconnected' ); |
|
128 | + delete_user_meta($disconnected_user_id, '_give_is_donor_disconnected'); |
|
129 | 129 | |
130 | 130 | // Check whether the disconnected user id and the reconnected user id are same or not. |
131 | 131 | // If both are same then delete user id store in donor meta. |
132 | - if( $donor_data['user_id'] === $disconnected_user_id ) { |
|
133 | - delete_user_meta( $disconnected_user_id, '_give_disconnected_donor_id' ); |
|
134 | - $donor->delete_meta( '_give_disconnected_user_id' ); |
|
132 | + if ($donor_data['user_id'] === $disconnected_user_id) { |
|
133 | + delete_user_meta($disconnected_user_id, '_give_disconnected_donor_id'); |
|
134 | + $donor->delete_meta('_give_disconnected_user_id'); |
|
135 | 135 | } |
136 | 136 | |
137 | 137 | $output['success'] = true; |
138 | - $donor_data = array_merge( $donor_data, $address ); |
|
138 | + $donor_data = array_merge($donor_data, $address); |
|
139 | 139 | $output['customer_info'] = $donor_data; |
140 | 140 | |
141 | 141 | } else { |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | * |
153 | 153 | * @since 1.0 |
154 | 154 | */ |
155 | - do_action( 'give_post_edit_donor', $donor_id, $donor_data ); |
|
155 | + do_action('give_post_edit_donor', $donor_id, $donor_data); |
|
156 | 156 | |
157 | 157 | |
158 | 158 | return $output; |
@@ -600,7 +600,7 @@ |
||
600 | 600 | * |
601 | 601 | * @param int $form_id |
602 | 602 | * |
603 | - * @return array|string |
|
603 | + * @return string |
|
604 | 604 | */ |
605 | 605 | public function get_preview_email_recipient( $form_id = null ) { |
606 | 606 | $recipients = $this->get_recipient( $form_id ); |
@@ -12,11 +12,11 @@ discard block |
||
12 | 12 | */ |
13 | 13 | |
14 | 14 | // Exit if access directly. |
15 | -if ( ! defined( 'ABSPATH' ) ) { |
|
15 | +if ( ! defined('ABSPATH')) { |
|
16 | 16 | exit; |
17 | 17 | } |
18 | 18 | |
19 | -if ( ! class_exists( 'Give_Email_Notification' ) ) : |
|
19 | +if ( ! class_exists('Give_Email_Notification')) : |
|
20 | 20 | |
21 | 21 | /** |
22 | 22 | * Give_Email_Notification |
@@ -93,14 +93,14 @@ discard block |
||
93 | 93 | * |
94 | 94 | * @return Give_Email_Notification |
95 | 95 | */ |
96 | - public static function get_instance( $email_notification_id = '' ) { |
|
96 | + public static function get_instance($email_notification_id = '') { |
|
97 | 97 | $class = ''; |
98 | 98 | |
99 | - if ( ! empty( $email_notification_id ) ) { |
|
99 | + if ( ! empty($email_notification_id)) { |
|
100 | 100 | /* @var Give_Email_Notification $class */ |
101 | - foreach ( self::$singleton as $class ) { |
|
102 | - if ( $email_notification_id === $class->config['id'] ) { |
|
103 | - $class = get_class( $class ); |
|
101 | + foreach (self::$singleton as $class) { |
|
102 | + if ($email_notification_id === $class->config['id']) { |
|
103 | + $class = get_class($class); |
|
104 | 104 | break; |
105 | 105 | } |
106 | 106 | } |
@@ -108,11 +108,11 @@ discard block |
||
108 | 108 | $class = get_called_class(); |
109 | 109 | } |
110 | 110 | |
111 | - if ( ! empty( $class ) && ( ! array_key_exists( $class, self::$singleton ) || is_null( self::$singleton[ $class ] ) ) ) { |
|
112 | - self::$singleton[ $class ] = new $class(); |
|
111 | + if ( ! empty($class) && ( ! array_key_exists($class, self::$singleton) || is_null(self::$singleton[$class]))) { |
|
112 | + self::$singleton[$class] = new $class(); |
|
113 | 113 | } |
114 | 114 | |
115 | - return ( isset( self::$singleton[ $class ] ) ? self::$singleton[ $class ] : null ); |
|
115 | + return (isset(self::$singleton[$class]) ? self::$singleton[$class] : null); |
|
116 | 116 | } |
117 | 117 | |
118 | 118 | /** |
@@ -123,35 +123,35 @@ discard block |
||
123 | 123 | * |
124 | 124 | * @param array $config |
125 | 125 | */ |
126 | - public function load( $config ) { |
|
126 | + public function load($config) { |
|
127 | 127 | // Set notification configuration. |
128 | - $this->config = wp_parse_args( $config, $this->config ); |
|
128 | + $this->config = wp_parse_args($config, $this->config); |
|
129 | 129 | |
130 | 130 | // Set email preview header status. |
131 | 131 | $this->config['has_preview_header'] = $this->config['has_preview'] && $this->config['has_preview_header'] ? true : false; |
132 | 132 | |
133 | 133 | // Set email content type |
134 | - $this->config['content_type'] = empty( $this->config['content_type'] ) || ! in_array( $this->config['content_type'], array( |
|
134 | + $this->config['content_type'] = empty($this->config['content_type']) || ! in_array($this->config['content_type'], array( |
|
135 | 135 | 'text/html', |
136 | 136 | 'text/plain', |
137 | - ) ) |
|
137 | + )) |
|
138 | 138 | ? Give()->emails->get_content_type() |
139 | 139 | : $this->config['content_type']; |
140 | - $this->config['content_type'] = give_get_option( Give_Email_Setting_Field::get_prefix( $this ) . 'email_content_type', $this->config['content_type'] ); |
|
140 | + $this->config['content_type'] = give_get_option(Give_Email_Setting_Field::get_prefix($this).'email_content_type', $this->config['content_type']); |
|
141 | 141 | |
142 | 142 | // Set email template type. |
143 | - $this->config['email_template'] = empty( $this->config['email_template'] ) |
|
144 | - ? give_get_option( 'email_template' ) |
|
143 | + $this->config['email_template'] = empty($this->config['email_template']) |
|
144 | + ? give_get_option('email_template') |
|
145 | 145 | : $this->config['email_template']; |
146 | 146 | |
147 | 147 | // Set recipient group name. |
148 | - $this->config['recipient_group_name'] = empty( $this->config['recipient_group_name'] ) |
|
149 | - ? ( ! Give_Email_Notification_Util::has_recipient_field( $this ) ? __( 'Donor', 'give' ) : '' ) |
|
148 | + $this->config['recipient_group_name'] = empty($this->config['recipient_group_name']) |
|
149 | + ? ( ! Give_Email_Notification_Util::has_recipient_field($this) ? __('Donor', 'give') : '') |
|
150 | 150 | : $this->config['recipient_group_name']; |
151 | 151 | |
152 | 152 | // Non notification status editable notice. |
153 | - $this->config['notices']['non-notification-status-editable'] = empty( $this->config['notices']['non-notification-status-editable'] ) |
|
154 | - ? __( 'You can not edit notification status from here.', 'give' ) |
|
153 | + $this->config['notices']['non-notification-status-editable'] = empty($this->config['notices']['non-notification-status-editable']) |
|
154 | + ? __('You can not edit notification status from here.', 'give') |
|
155 | 155 | : $this->config['notices']['non-notification-status-editable']; |
156 | 156 | |
157 | 157 | /** |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | * @param array Give_Email_Notification::config |
163 | 163 | * @param Give_Email_Notification $this |
164 | 164 | */ |
165 | - $this->config = apply_filters( 'give_email_api_notification_config', $this->config, $this ); |
|
165 | + $this->config = apply_filters('give_email_api_notification_config', $this->config, $this); |
|
166 | 166 | |
167 | 167 | // Setup filters. |
168 | 168 | $this->setup_filters(); |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | */ |
178 | 178 | private function setup_filters() { |
179 | 179 | // Apply filter only for current email notification section. |
180 | - if ( give_get_current_setting_section() === $this->config['id'] ) { |
|
180 | + if (give_get_current_setting_section() === $this->config['id']) { |
|
181 | 181 | // Initialize email context for email notification. |
182 | 182 | $this->config['email_tag_context'] = apply_filters( |
183 | 183 | "give_{$this->config['id']}_email_tag_context", |
@@ -187,23 +187,23 @@ discard block |
||
187 | 187 | } |
188 | 188 | |
189 | 189 | // Setup setting fields. |
190 | - if( $this->config['show_on_emails_setting_page'] ) { |
|
191 | - add_filter( 'give_get_settings_emails', array( $this, 'add_setting_fields' ), 10, 2 ); |
|
190 | + if ($this->config['show_on_emails_setting_page']) { |
|
191 | + add_filter('give_get_settings_emails', array($this, 'add_setting_fields'), 10, 2); |
|
192 | 192 | } |
193 | 193 | |
194 | - if ( $this->config['form_metabox_setting'] ) { |
|
194 | + if ($this->config['form_metabox_setting']) { |
|
195 | 195 | add_filter( |
196 | 196 | 'give_email_notification_options_metabox_fields', |
197 | - array( $this, 'add_metabox_setting_field' ), |
|
197 | + array($this, 'add_metabox_setting_field'), |
|
198 | 198 | 10, |
199 | 199 | 2 |
200 | 200 | ); |
201 | 201 | } |
202 | 202 | |
203 | - if( $this->config['has_recipient_field'] ) { |
|
203 | + if ($this->config['has_recipient_field']) { |
|
204 | 204 | add_action( |
205 | 205 | "give_save__give_{$this->config['id']}_recipient", |
206 | - array( $this, 'validate_form_recipient_field_value' ), |
|
206 | + array($this, 'validate_form_recipient_field_value'), |
|
207 | 207 | 10, |
208 | 208 | 3 |
209 | 209 | ); |
@@ -241,8 +241,8 @@ discard block |
||
241 | 241 | * |
242 | 242 | * @return array |
243 | 243 | */ |
244 | - public function add_section( $sections ) { |
|
245 | - $sections[ $this->config['id'] ] = $this->config['label']; |
|
244 | + public function add_section($sections) { |
|
245 | + $sections[$this->config['id']] = $this->config['label']; |
|
246 | 246 | |
247 | 247 | return $sections; |
248 | 248 | } |
@@ -256,7 +256,7 @@ discard block |
||
256 | 256 | * |
257 | 257 | * @return bool |
258 | 258 | */ |
259 | - public function hide_section( $hide_section ) { |
|
259 | + public function hide_section($hide_section) { |
|
260 | 260 | $hide_section = true; |
261 | 261 | |
262 | 262 | return $hide_section; |
@@ -272,8 +272,8 @@ discard block |
||
272 | 272 | * |
273 | 273 | * @return array |
274 | 274 | */ |
275 | - public function add_setting_fields( $settings ) { |
|
276 | - if ( $this->config['id'] === give_get_current_setting_section() ) { |
|
275 | + public function add_setting_fields($settings) { |
|
276 | + if ($this->config['id'] === give_get_current_setting_section()) { |
|
277 | 277 | $settings = $this->get_setting_fields(); |
278 | 278 | } |
279 | 279 | |
@@ -291,8 +291,8 @@ discard block |
||
291 | 291 | * |
292 | 292 | * @return array |
293 | 293 | */ |
294 | - public function get_setting_fields( $form_id = null ) { |
|
295 | - return Give_Email_Setting_Field::get_setting_fields( $this, $form_id ); |
|
294 | + public function get_setting_fields($form_id = null) { |
|
295 | + return Give_Email_Setting_Field::get_setting_fields($this, $form_id); |
|
296 | 296 | } |
297 | 297 | |
298 | 298 | |
@@ -307,13 +307,13 @@ discard block |
||
307 | 307 | * |
308 | 308 | * @return array |
309 | 309 | */ |
310 | - public function add_metabox_setting_field( $settings, $form_id ) { |
|
310 | + public function add_metabox_setting_field($settings, $form_id) { |
|
311 | 311 | |
312 | - if( Give_Email_Notification_Util::is_email_notification_active( $this ) ) { |
|
312 | + if (Give_Email_Notification_Util::is_email_notification_active($this)) { |
|
313 | 313 | $settings[] = array( |
314 | 314 | 'id' => $this->config['id'], |
315 | 315 | 'title' => $this->config['label'], |
316 | - 'fields' => $this->get_setting_fields( $form_id ), |
|
316 | + 'fields' => $this->get_setting_fields($form_id), |
|
317 | 317 | ); |
318 | 318 | } |
319 | 319 | |
@@ -331,7 +331,7 @@ discard block |
||
331 | 331 | * |
332 | 332 | * @return array |
333 | 333 | */ |
334 | - public function get_extra_setting_fields( $form_id = null ) { |
|
334 | + public function get_extra_setting_fields($form_id = null) { |
|
335 | 335 | return array(); |
336 | 336 | } |
337 | 337 | |
@@ -348,11 +348,11 @@ discard block |
||
348 | 348 | * |
349 | 349 | * @return string|array |
350 | 350 | */ |
351 | - public function get_recipient( $form_id = null ) { |
|
352 | - if ( empty( $this->recipient_email ) && $this->config['has_recipient_field'] ) { |
|
351 | + public function get_recipient($form_id = null) { |
|
352 | + if (empty($this->recipient_email) && $this->config['has_recipient_field']) { |
|
353 | 353 | $this->recipient_email = Give_Email_Notification_Util::get_value( |
354 | 354 | $this, |
355 | - Give_Email_Setting_Field::get_prefix( $this, $form_id ) . 'recipient', |
|
355 | + Give_Email_Setting_Field::get_prefix($this, $form_id).'recipient', |
|
356 | 356 | $form_id |
357 | 357 | ); |
358 | 358 | |
@@ -363,7 +363,7 @@ discard block |
||
363 | 363 | * @since 1.0 |
364 | 364 | * @deprecated 2.0 |
365 | 365 | */ |
366 | - $this->recipient_email = apply_filters( 'give_admin_notice_emails', $this->recipient_email, $this, $form_id ); |
|
366 | + $this->recipient_email = apply_filters('give_admin_notice_emails', $this->recipient_email, $this, $form_id); |
|
367 | 367 | } |
368 | 368 | |
369 | 369 | /** |
@@ -393,10 +393,10 @@ discard block |
||
393 | 393 | * |
394 | 394 | * @return bool |
395 | 395 | */ |
396 | - public function get_notification_status( $form_id = null ) { |
|
397 | - $notification_status = empty( $form_id ) |
|
398 | - ? give_get_option( "{$this->config['id']}_notification", $this->config['notification_status'] ) |
|
399 | - : give_get_meta( $form_id, Give_Email_Setting_Field::get_prefix( $this, $form_id ) . 'notification', true, 'global' ); |
|
396 | + public function get_notification_status($form_id = null) { |
|
397 | + $notification_status = empty($form_id) |
|
398 | + ? give_get_option("{$this->config['id']}_notification", $this->config['notification_status']) |
|
399 | + : give_get_meta($form_id, Give_Email_Setting_Field::get_prefix($this, $form_id).'notification', true, 'global'); |
|
400 | 400 | |
401 | 401 | /** |
402 | 402 | * Filter the notification status. |
@@ -421,11 +421,11 @@ discard block |
||
421 | 421 | * |
422 | 422 | * @return string |
423 | 423 | */ |
424 | - function get_email_subject( $form_id = null ) { |
|
424 | + function get_email_subject($form_id = null) { |
|
425 | 425 | $subject = wp_strip_all_tags( |
426 | 426 | Give_Email_Notification_Util::get_value( |
427 | 427 | $this, |
428 | - Give_Email_Setting_Field::get_prefix( $this, $form_id ) . 'email_subject', |
|
428 | + Give_Email_Setting_Field::get_prefix($this, $form_id).'email_subject', |
|
429 | 429 | $form_id, |
430 | 430 | $this->config['default_email_subject'] |
431 | 431 | ) |
@@ -454,10 +454,10 @@ discard block |
||
454 | 454 | * |
455 | 455 | * @return string |
456 | 456 | */ |
457 | - public function get_email_message( $form_id = null ) { |
|
457 | + public function get_email_message($form_id = null) { |
|
458 | 458 | $message = Give_Email_Notification_Util::get_value( |
459 | 459 | $this, |
460 | - Give_Email_Setting_Field::get_prefix( $this, $form_id ) . 'email_message', |
|
460 | + Give_Email_Setting_Field::get_prefix($this, $form_id).'email_message', |
|
461 | 461 | $form_id, |
462 | 462 | $this->config['default_email_message'] |
463 | 463 | ); |
@@ -486,10 +486,10 @@ discard block |
||
486 | 486 | * |
487 | 487 | * @return string |
488 | 488 | */ |
489 | - public function get_email_content_type( $form_id ) { |
|
489 | + public function get_email_content_type($form_id) { |
|
490 | 490 | $content_type = Give_Email_Notification_Util::get_value( |
491 | 491 | $this, |
492 | - Give_Email_Setting_Field::get_prefix( $this, $form_id ) . 'email_content_type', |
|
492 | + Give_Email_Setting_Field::get_prefix($this, $form_id).'email_content_type', |
|
493 | 493 | $form_id, |
494 | 494 | $this->config['content_type'] |
495 | 495 | ); |
@@ -517,15 +517,14 @@ discard block |
||
517 | 517 | * |
518 | 518 | * @return string |
519 | 519 | */ |
520 | - public function get_email_template( $form_id ) { |
|
521 | - $email_template = give_get_meta( $form_id, '_give_email_template', true ); |
|
520 | + public function get_email_template($form_id) { |
|
521 | + $email_template = give_get_meta($form_id, '_give_email_template', true); |
|
522 | 522 | $email_template = Give_Email_Notification_Util::get_value( |
523 | 523 | $this, |
524 | - Give_Email_Setting_Field::get_prefix( $this, $form_id ) .'email_template', |
|
524 | + Give_Email_Setting_Field::get_prefix($this, $form_id).'email_template', |
|
525 | 525 | $form_id, |
526 | - ! empty( $email_template ) && Give_Email_Notification_Util::can_use_form_email_options( $this, $form_id ) ? |
|
527 | - $email_template : |
|
528 | - $this->config['email_template'] |
|
526 | + ! empty($email_template) && Give_Email_Notification_Util::can_use_form_email_options($this, $form_id) ? |
|
527 | + $email_template : $this->config['email_template'] |
|
529 | 528 | ); |
530 | 529 | |
531 | 530 | /** |
@@ -552,34 +551,34 @@ discard block |
||
552 | 551 | * |
553 | 552 | * @return array |
554 | 553 | */ |
555 | - public function get_allowed_email_tags( $formatted = false ) { |
|
554 | + public function get_allowed_email_tags($formatted = false) { |
|
556 | 555 | // Get all email tags. |
557 | 556 | $email_tags = Give()->email_tags->get_tags(); |
558 | 557 | |
559 | 558 | // Skip if all email template tags context setup exit. |
560 | - if ( $this->config['email_tag_context'] && 'all' !== $this->config['email_tag_context'] ) { |
|
561 | - if ( is_array( $this->config['email_tag_context'] ) ) { |
|
562 | - foreach ( $email_tags as $index => $email_tag ) { |
|
563 | - if ( in_array( $email_tag['context'], $this->config['email_tag_context'] ) ) { |
|
559 | + if ($this->config['email_tag_context'] && 'all' !== $this->config['email_tag_context']) { |
|
560 | + if (is_array($this->config['email_tag_context'])) { |
|
561 | + foreach ($email_tags as $index => $email_tag) { |
|
562 | + if (in_array($email_tag['context'], $this->config['email_tag_context'])) { |
|
564 | 563 | continue; |
565 | 564 | } |
566 | 565 | |
567 | - unset( $email_tags[ $index ] ); |
|
566 | + unset($email_tags[$index]); |
|
568 | 567 | } |
569 | 568 | } else { |
570 | - foreach ( $email_tags as $index => $email_tag ) { |
|
571 | - if ( $this->config['email_tag_context'] === $email_tag['context'] ) { |
|
569 | + foreach ($email_tags as $index => $email_tag) { |
|
570 | + if ($this->config['email_tag_context'] === $email_tag['context']) { |
|
572 | 571 | continue; |
573 | 572 | } |
574 | 573 | |
575 | - unset( $email_tags[ $index ] ); |
|
574 | + unset($email_tags[$index]); |
|
576 | 575 | } |
577 | 576 | } |
578 | 577 | } |
579 | 578 | |
580 | - if ( count( $email_tags ) && $formatted ) : ob_start() ?> |
|
579 | + if (count($email_tags) && $formatted) : ob_start() ?> |
|
581 | 580 | <div class="give-email-tags-wrap"> |
582 | - <?php foreach ( $email_tags as $email_tag ) : ?> |
|
581 | + <?php foreach ($email_tags as $email_tag) : ?> |
|
583 | 582 | <span class="give_<?php echo $email_tag['tag']; ?>_tag"> |
584 | 583 | <code>{<?php echo $email_tag['tag']; ?>}</code> - <?php echo $email_tag['description']; ?> |
585 | 584 | </span> |
@@ -602,8 +601,8 @@ discard block |
||
602 | 601 | * |
603 | 602 | * @return array|string |
604 | 603 | */ |
605 | - public function get_preview_email_recipient( $form_id = null ) { |
|
606 | - $recipients = $this->get_recipient( $form_id ); |
|
604 | + public function get_preview_email_recipient($form_id = null) { |
|
605 | + $recipients = $this->get_recipient($form_id); |
|
607 | 606 | |
608 | 607 | /** |
609 | 608 | * Filter the preview email recipients. |
@@ -613,7 +612,7 @@ discard block |
||
613 | 612 | * @param string|array $recipients List of recipients. |
614 | 613 | * @param Give_Email_Notification $this |
615 | 614 | */ |
616 | - $recipients = apply_filters( 'give_get_preview_email_recipient', $recipients, $this, $form_id ); |
|
615 | + $recipients = apply_filters('give_get_preview_email_recipient', $recipients, $this, $form_id); |
|
617 | 616 | |
618 | 617 | return $recipients; |
619 | 618 | } |
@@ -628,13 +627,13 @@ discard block |
||
628 | 627 | * |
629 | 628 | * @return array |
630 | 629 | */ |
631 | - public function get_email_attachments( $form_id = null ) { |
|
630 | + public function get_email_attachments($form_id = null) { |
|
632 | 631 | /** |
633 | 632 | * Filter the attachment. |
634 | 633 | * |
635 | 634 | * @since 2.0 |
636 | 635 | */ |
637 | - return apply_filters( "give_{$this->config['id']}_get_email_attachments", array(), $this, $form_id ); |
|
636 | + return apply_filters("give_{$this->config['id']}_get_email_attachments", array(), $this, $form_id); |
|
638 | 637 | } |
639 | 638 | |
640 | 639 | |
@@ -646,37 +645,37 @@ discard block |
||
646 | 645 | */ |
647 | 646 | public function send_preview_email() { |
648 | 647 | // Get form id |
649 | - $form_id = ! empty( $_GET['form_id'] ) ? absint( $_GET['form_id'] ) : null; |
|
648 | + $form_id = ! empty($_GET['form_id']) ? absint($_GET['form_id']) : null; |
|
650 | 649 | |
651 | 650 | // setup email data. |
652 | 651 | $this->setup_email_data(); |
653 | 652 | |
654 | 653 | $attachments = $this->get_email_attachments(); |
655 | - $message = $this->preview_email_template_tags( $this->get_email_message( $form_id ) ); |
|
656 | - $subject = $this->preview_email_template_tags( $this->get_email_subject( $form_id ) ); |
|
657 | - $content_type = $this->get_email_content_type( $form_id ); |
|
654 | + $message = $this->preview_email_template_tags($this->get_email_message($form_id)); |
|
655 | + $subject = $this->preview_email_template_tags($this->get_email_subject($form_id)); |
|
656 | + $content_type = $this->get_email_content_type($form_id); |
|
658 | 657 | |
659 | 658 | // Setup email content type. |
660 | - Give()->emails->__set( 'content_type', $content_type ); |
|
661 | - Give()->emails->__set( 'html', true ); |
|
659 | + Give()->emails->__set('content_type', $content_type); |
|
660 | + Give()->emails->__set('html', true); |
|
662 | 661 | |
663 | 662 | // Setup email template |
664 | - Give()->emails->__set( 'template', $this->get_email_template( $form_id ) ); |
|
663 | + Give()->emails->__set('template', $this->get_email_template($form_id)); |
|
665 | 664 | |
666 | 665 | // Format plain content type email. |
667 | - if ( 'text/plain' === $content_type ) { |
|
668 | - Give()->emails->__set( 'html', false ); |
|
669 | - Give()->emails->__set( 'template', 'none' ); |
|
670 | - $message = strip_tags( $message ); |
|
666 | + if ('text/plain' === $content_type) { |
|
667 | + Give()->emails->__set('html', false); |
|
668 | + Give()->emails->__set('template', 'none'); |
|
669 | + $message = strip_tags($message); |
|
671 | 670 | } |
672 | 671 | |
673 | - if ( Give_Email_Notification_Util::can_use_form_email_options( $this, $form_id ) ) { |
|
672 | + if (Give_Email_Notification_Util::can_use_form_email_options($this, $form_id)) { |
|
674 | 673 | Give()->emails->form_id = $form_id; |
675 | - Give()->emails->from_name = give_get_meta( $form_id, '_give_from_name', true ); |
|
676 | - Give()->emails->from_address = give_get_meta( $form_id, '_give_from_email', true ); |
|
674 | + Give()->emails->from_name = give_get_meta($form_id, '_give_from_name', true); |
|
675 | + Give()->emails->from_address = give_get_meta($form_id, '_give_from_email', true); |
|
677 | 676 | } |
678 | 677 | |
679 | - return Give()->emails->send( $this->get_preview_email_recipient( $form_id ), $subject, $message, $attachments ); |
|
678 | + return Give()->emails->send($this->get_preview_email_recipient($form_id), $subject, $message, $attachments); |
|
680 | 679 | } |
681 | 680 | |
682 | 681 | |
@@ -697,7 +696,7 @@ discard block |
||
697 | 696 | * |
698 | 697 | * @return bool |
699 | 698 | */ |
700 | - public function send_email_notification( $email_tag_args = array() ) { |
|
699 | + public function send_email_notification($email_tag_args = array()) { |
|
701 | 700 | // Add email content type email tags. |
702 | 701 | $email_tag_args['email_content_type'] = $this->config['content_type']; |
703 | 702 | |
@@ -706,16 +705,16 @@ discard block |
||
706 | 705 | * |
707 | 706 | * @since 2.0 |
708 | 707 | */ |
709 | - $email_tag_args = apply_filters( "give_{$this->config['id']}_email_tag_args", $email_tag_args, $this ); |
|
708 | + $email_tag_args = apply_filters("give_{$this->config['id']}_email_tag_args", $email_tag_args, $this); |
|
710 | 709 | |
711 | 710 | // Get form id. |
712 | - $form_id = ! empty( $email_tag_args['form_id'] ) |
|
713 | - ? absint( $email_tag_args['form_id'] ) |
|
714 | - : ( ! empty( $email_tag_args['payment_id'] ) ? give_get_payment_form_id( $email_tag_args['payment_id'] ) : null ); |
|
711 | + $form_id = ! empty($email_tag_args['form_id']) |
|
712 | + ? absint($email_tag_args['form_id']) |
|
713 | + : ( ! empty($email_tag_args['payment_id']) ? give_get_payment_form_id($email_tag_args['payment_id']) : null); |
|
715 | 714 | |
716 | 715 | |
717 | 716 | // Do not send email if notification is disable. |
718 | - if ( ! Give_Email_Notification_Util::is_email_notification_active( $this, $form_id ) ) { |
|
717 | + if ( ! Give_Email_Notification_Util::is_email_notification_active($this, $form_id)) { |
|
719 | 718 | return false; |
720 | 719 | } |
721 | 720 | |
@@ -724,41 +723,41 @@ discard block |
||
724 | 723 | * |
725 | 724 | * @since 2.0 |
726 | 725 | */ |
727 | - do_action( "give_{$this->config['id']}_email_send_before", $this, $form_id ); |
|
726 | + do_action("give_{$this->config['id']}_email_send_before", $this, $form_id); |
|
728 | 727 | |
729 | 728 | $attachments = $this->get_email_attachments(); |
730 | - $message = give_do_email_tags( $this->get_email_message( $form_id ), $email_tag_args ); |
|
731 | - $subject = give_do_email_tags( $this->get_email_subject( $form_id ), $email_tag_args ); |
|
732 | - $content_type = $this->get_email_content_type( $form_id ); |
|
729 | + $message = give_do_email_tags($this->get_email_message($form_id), $email_tag_args); |
|
730 | + $subject = give_do_email_tags($this->get_email_subject($form_id), $email_tag_args); |
|
731 | + $content_type = $this->get_email_content_type($form_id); |
|
733 | 732 | |
734 | 733 | // Setup email content type. |
735 | - Give()->emails->__set( 'content_type', $content_type ); |
|
736 | - Give()->emails->__set( 'html', true ); |
|
734 | + Give()->emails->__set('content_type', $content_type); |
|
735 | + Give()->emails->__set('html', true); |
|
737 | 736 | |
738 | 737 | // Set email template. |
739 | - Give()->emails->__set( 'template', $this->get_email_template( $form_id ) ); |
|
738 | + Give()->emails->__set('template', $this->get_email_template($form_id)); |
|
740 | 739 | |
741 | - if ( 'text/plain' === $content_type ) { |
|
742 | - Give()->emails->__set( 'html', false ); |
|
743 | - Give()->emails->__set( 'template', 'none' ); |
|
744 | - $message = strip_tags( $message ); |
|
740 | + if ('text/plain' === $content_type) { |
|
741 | + Give()->emails->__set('html', false); |
|
742 | + Give()->emails->__set('template', 'none'); |
|
743 | + $message = strip_tags($message); |
|
745 | 744 | } |
746 | 745 | |
747 | - if ( Give_Email_Notification_Util::can_use_form_email_options( $this, $form_id ) ) { |
|
746 | + if (Give_Email_Notification_Util::can_use_form_email_options($this, $form_id)) { |
|
748 | 747 | Give()->emails->form_id = $form_id; |
749 | - Give()->emails->from_name = give_get_meta( $form_id, '_give_from_name', true ); |
|
750 | - Give()->emails->from_address = give_get_meta( $form_id, '_give_from_email', true ); |
|
748 | + Give()->emails->from_name = give_get_meta($form_id, '_give_from_name', true); |
|
749 | + Give()->emails->from_address = give_get_meta($form_id, '_give_from_email', true); |
|
751 | 750 | } |
752 | 751 | |
753 | 752 | // Send email. |
754 | - $email_status = Give()->emails->send( $this->get_recipient( $form_id ), $subject, $message, $attachments ); |
|
753 | + $email_status = Give()->emails->send($this->get_recipient($form_id), $subject, $message, $attachments); |
|
755 | 754 | |
756 | 755 | /** |
757 | 756 | * Fire action after after email send. |
758 | 757 | * |
759 | 758 | * @since 2.0 |
760 | 759 | */ |
761 | - do_action( "give_{$this->config['id']}_email_send_after", $email_status, $this, $form_id ); |
|
760 | + do_action("give_{$this->config['id']}_email_send_after", $email_status, $this, $form_id); |
|
762 | 761 | |
763 | 762 | return $email_status; |
764 | 763 | } |
@@ -773,67 +772,67 @@ discard block |
||
773 | 772 | * |
774 | 773 | * @return string |
775 | 774 | */ |
776 | - public function preview_email_template_tags( $message ) { |
|
775 | + public function preview_email_template_tags($message) { |
|
777 | 776 | // Set Payment. |
778 | - $payment_id = give_check_variable( give_clean( $_GET ), 'isset_empty', 0, 'preview_id' ); |
|
779 | - $payment = $payment_id ? new Give_Payment( $payment_id ) : new stdClass(); |
|
777 | + $payment_id = give_check_variable(give_clean($_GET), 'isset_empty', 0, 'preview_id'); |
|
778 | + $payment = $payment_id ? new Give_Payment($payment_id) : new stdClass(); |
|
780 | 779 | |
781 | 780 | // Set donor. |
782 | 781 | $user_id = $payment_id |
783 | 782 | ? $payment->user_id |
784 | - : give_check_variable( give_clean( $_GET ), 'isset_empty', 0, 'user_id' ); |
|
783 | + : give_check_variable(give_clean($_GET), 'isset_empty', 0, 'user_id'); |
|
785 | 784 | $user_id = $user_id ? $user_id : wp_get_current_user()->ID; |
786 | 785 | |
787 | 786 | // Set receipt. |
788 | - $receipt_id = strtolower( md5( uniqid() ) ); |
|
787 | + $receipt_id = strtolower(md5(uniqid())); |
|
789 | 788 | |
790 | - $receipt_link_url = esc_url( add_query_arg( array( |
|
789 | + $receipt_link_url = esc_url(add_query_arg(array( |
|
791 | 790 | 'payment_key' => $receipt_id, |
792 | - ), give_get_history_page_uri() ) ); |
|
791 | + ), give_get_history_page_uri())); |
|
793 | 792 | |
794 | 793 | $receipt_link = sprintf( |
795 | 794 | '<a href="%1$s">%2$s</a>', |
796 | 795 | $receipt_link_url, |
797 | - esc_html__( 'View the receipt in your browser »', 'give' ) |
|
796 | + esc_html__('View the receipt in your browser »', 'give') |
|
798 | 797 | ); |
799 | 798 | |
800 | 799 | // Set default values for tags. |
801 | 800 | $this->config['preview_email_tags_values'] = wp_parse_args( |
802 | 801 | $this->config['preview_email_tags_values'], |
803 | 802 | array( |
804 | - 'name' => give_email_tag_first_name( array( |
|
803 | + 'name' => give_email_tag_first_name(array( |
|
805 | 804 | 'payment_id' => $payment_id, |
806 | 805 | 'user_id' => $user_id, |
807 | - ) ), |
|
808 | - 'fullname' => give_email_tag_fullname( array( |
|
806 | + )), |
|
807 | + 'fullname' => give_email_tag_fullname(array( |
|
809 | 808 | 'payment_id' => $payment_id, |
810 | 809 | 'user_id' => $user_id, |
811 | - ) ), |
|
812 | - 'username' => give_email_tag_username( array( |
|
810 | + )), |
|
811 | + 'username' => give_email_tag_username(array( |
|
813 | 812 | 'payment_id' => $payment_id, |
814 | 813 | 'user_id' => $user_id, |
815 | - ) ), |
|
816 | - 'user_email' => give_email_tag_user_email( array( |
|
814 | + )), |
|
815 | + 'user_email' => give_email_tag_user_email(array( |
|
817 | 816 | 'payment_id' => $payment_id, |
818 | 817 | 'user_id' => $user_id, |
819 | - ) ), |
|
820 | - 'payment_total' => $payment_id ? give_email_tag_payment_total( array( 'payment_id' => $payment_id ) ) : give_currency_filter( '10.50' ), |
|
821 | - 'amount' => $payment_id ? give_email_tag_amount( array( 'payment_id' => $payment_id ) ) : give_currency_filter( '10.50' ), |
|
822 | - 'price' => $payment_id ? give_email_tag_price( array( 'payment_id' => $payment_id ) ) : give_currency_filter( '10.50' ), |
|
823 | - 'payment_method' => $payment_id ? give_email_tag_payment_method( array( 'payment_id' => $payment_id ) ) : __( 'PayPal', 'give' ), |
|
818 | + )), |
|
819 | + 'payment_total' => $payment_id ? give_email_tag_payment_total(array('payment_id' => $payment_id)) : give_currency_filter('10.50'), |
|
820 | + 'amount' => $payment_id ? give_email_tag_amount(array('payment_id' => $payment_id)) : give_currency_filter('10.50'), |
|
821 | + 'price' => $payment_id ? give_email_tag_price(array('payment_id' => $payment_id)) : give_currency_filter('10.50'), |
|
822 | + 'payment_method' => $payment_id ? give_email_tag_payment_method(array('payment_id' => $payment_id)) : __('PayPal', 'give'), |
|
824 | 823 | 'receipt_id' => $receipt_id, |
825 | - 'payment_id' => $payment_id ? $payment_id : rand( 2000, 2050 ), |
|
824 | + 'payment_id' => $payment_id ? $payment_id : rand(2000, 2050), |
|
826 | 825 | 'receipt_link_url' => $receipt_link_url, |
827 | 826 | 'receipt_link' => $receipt_link, |
828 | - 'date' => $payment_id ? date( give_date_format(), strtotime( $payment->date ) ) : date( give_date_format(), current_time( 'timestamp' ) ), |
|
829 | - 'donation' => $payment_id ? give_email_tag_donation( array( 'payment_id' => $payment_id ) ) : esc_html__( 'Sample Donation Form Title', 'give' ), |
|
830 | - 'form_title' => $payment_id ? give_email_tag_form_title( array( 'payment_id' => $payment_id ) ) : esc_html__( 'Sample Donation Form Title - Sample Donation Level', 'give' ), |
|
831 | - 'sitename' => $payment_id ? give_email_tag_sitename( array( 'payment_id' => $payment_id ) ) : get_bloginfo( 'name' ), |
|
827 | + 'date' => $payment_id ? date(give_date_format(), strtotime($payment->date)) : date(give_date_format(), current_time('timestamp')), |
|
828 | + 'donation' => $payment_id ? give_email_tag_donation(array('payment_id' => $payment_id)) : esc_html__('Sample Donation Form Title', 'give'), |
|
829 | + 'form_title' => $payment_id ? give_email_tag_form_title(array('payment_id' => $payment_id)) : esc_html__('Sample Donation Form Title - Sample Donation Level', 'give'), |
|
830 | + 'sitename' => $payment_id ? give_email_tag_sitename(array('payment_id' => $payment_id)) : get_bloginfo('name'), |
|
832 | 831 | 'pdf_receipt' => sprintf( |
833 | 832 | '<a href="#">%s</a>', |
834 | - __( 'Download Receipt', 'give' ) |
|
833 | + __('Download Receipt', 'give') |
|
835 | 834 | ), |
836 | - 'billing_address' => $payment_id ? give_email_tag_billing_address( array( 'payment_id' => $payment_id ) ) : '', |
|
835 | + 'billing_address' => $payment_id ? give_email_tag_billing_address(array('payment_id' => $payment_id)) : '', |
|
837 | 836 | 'email_access_link' => sprintf( |
838 | 837 | '<a href="%1$s">%2$s</a>', |
839 | 838 | add_query_arg( |
@@ -842,20 +841,20 @@ discard block |
||
842 | 841 | ), |
843 | 842 | give_get_history_page_uri() |
844 | 843 | ), |
845 | - __( 'View your donation history »', 'give' ) |
|
844 | + __('View your donation history »', 'give') |
|
846 | 845 | ), |
847 | - 'reset_password_link' => $user_id ? give_email_tag_reset_password_link( array( 'user_id' => $user_id ), $payment_id ) : '', |
|
846 | + 'reset_password_link' => $user_id ? give_email_tag_reset_password_link(array('user_id' => $user_id), $payment_id) : '', |
|
848 | 847 | ) |
849 | 848 | ); |
850 | 849 | |
851 | 850 | // Decode tags. |
852 | - foreach ( $this->config['preview_email_tags_values'] as $preview_tag => $value ) { |
|
853 | - if ( isset( $this->config['preview_email_tags_values'][ $preview_tag ] ) ) { |
|
854 | - $message = str_replace( "{{$preview_tag}}", $this->config['preview_email_tags_values'][ $preview_tag ], $message ); |
|
851 | + foreach ($this->config['preview_email_tags_values'] as $preview_tag => $value) { |
|
852 | + if (isset($this->config['preview_email_tags_values'][$preview_tag])) { |
|
853 | + $message = str_replace("{{$preview_tag}}", $this->config['preview_email_tags_values'][$preview_tag], $message); |
|
855 | 854 | } |
856 | 855 | } |
857 | 856 | |
858 | - return apply_filters( 'give_email_preview_template_tags', $message ); |
|
857 | + return apply_filters('give_email_preview_template_tags', $message); |
|
859 | 858 | } |
860 | 859 | |
861 | 860 | /** |
@@ -880,17 +879,17 @@ discard block |
||
880 | 879 | * @param $post_id |
881 | 880 | * |
882 | 881 | */ |
883 | - public function validate_form_recipient_field_value( $form_meta_key, $form_meta_value, $post_id ) { |
|
882 | + public function validate_form_recipient_field_value($form_meta_key, $form_meta_value, $post_id) { |
|
884 | 883 | // Get valid emails. |
885 | - $new_form_meta_value = array_filter( $form_meta_value, function ( $value ) { |
|
886 | - return ! empty( $value['email'] ) && is_email( $value['email'] ); |
|
884 | + $new_form_meta_value = array_filter($form_meta_value, function($value) { |
|
885 | + return ! empty($value['email']) && is_email($value['email']); |
|
887 | 886 | } ); |
888 | 887 | |
889 | 888 | // Remove duplicate emails from array. |
890 | 889 | $email_arr = array(); |
891 | - foreach ( $new_form_meta_value as $index => $email ) { |
|
892 | - if( in_array( $email['email'], $email_arr ) ) { |
|
893 | - unset( $new_form_meta_value[$index] ); |
|
890 | + foreach ($new_form_meta_value as $index => $email) { |
|
891 | + if (in_array($email['email'], $email_arr)) { |
|
892 | + unset($new_form_meta_value[$index]); |
|
894 | 893 | continue; |
895 | 894 | } |
896 | 895 | |
@@ -899,25 +898,25 @@ discard block |
||
899 | 898 | |
900 | 899 | $update = false; |
901 | 900 | |
902 | - if ( empty( $new_form_meta_value ) ) { |
|
901 | + if (empty($new_form_meta_value)) { |
|
903 | 902 | // Set default recipient. |
904 | 903 | $form_meta_value = array( |
905 | 904 | array( |
906 | - 'email' => get_bloginfo( 'admin_email' ) |
|
905 | + 'email' => get_bloginfo('admin_email') |
|
907 | 906 | ), |
908 | 907 | ); |
909 | 908 | |
910 | 909 | $update = true; |
911 | 910 | |
912 | - } elseif ( count( $new_form_meta_value ) !== count( $form_meta_value ) ) { |
|
911 | + } elseif (count($new_form_meta_value) !== count($form_meta_value)) { |
|
913 | 912 | // Filter recipient emails. |
914 | 913 | $form_meta_value = $new_form_meta_value; |
915 | 914 | |
916 | 915 | $update = true; |
917 | 916 | } |
918 | 917 | |
919 | - if( $update ) { |
|
920 | - give_update_meta( $post_id, $form_meta_key, $form_meta_value ); |
|
918 | + if ($update) { |
|
919 | + give_update_meta($post_id, $form_meta_key, $form_meta_value); |
|
921 | 920 | } |
922 | 921 | } |
923 | 922 | } |
@@ -120,7 +120,7 @@ |
||
120 | 120 | * @param string $email_preview_header |
121 | 121 | * @param Give_Donor_Register_Email $email |
122 | 122 | * |
123 | - * @return bool |
|
123 | + * @return string|null |
|
124 | 124 | */ |
125 | 125 | public function email_preview_header( $email_preview_header, $email ) { |
126 | 126 | // Bailout. |
@@ -10,11 +10,11 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if access directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
17 | -if ( ! class_exists( 'Give_Donor_Register_Email' ) ) : |
|
17 | +if ( ! class_exists('Give_Donor_Register_Email')) : |
|
18 | 18 | |
19 | 19 | /** |
20 | 20 | * Give_Donor_Register_Email |
@@ -31,34 +31,34 @@ discard block |
||
31 | 31 | * @since 2.0 |
32 | 32 | */ |
33 | 33 | public function init() { |
34 | - $this->load( array( |
|
34 | + $this->load(array( |
|
35 | 35 | 'id' => 'donor-register', |
36 | - 'label' => __( 'User Registration Information', 'give' ), |
|
37 | - 'description' => __( 'Sent to the donor when they register for an account on the site.', 'give' ), |
|
36 | + 'label' => __('User Registration Information', 'give'), |
|
37 | + 'description' => __('Sent to the donor when they register for an account on the site.', 'give'), |
|
38 | 38 | 'notification_status' => 'enabled', |
39 | 39 | 'email_tag_contex' => 'donor', |
40 | 40 | 'form_metabox_setting' => false, |
41 | - 'recipient_group_name' => __( 'Donor', 'give' ), |
|
42 | - 'email_tag_context' => array( 'donor', 'general' ), |
|
41 | + 'recipient_group_name' => __('Donor', 'give'), |
|
42 | + 'email_tag_context' => array('donor', 'general'), |
|
43 | 43 | 'default_email_subject' => sprintf( |
44 | 44 | /* translators: %s: site name */ |
45 | - esc_attr__( '[%s] Your username and password', 'give' ), |
|
46 | - get_bloginfo( 'name' ) |
|
45 | + esc_attr__('[%s] Your username and password', 'give'), |
|
46 | + get_bloginfo('name') |
|
47 | 47 | ), |
48 | 48 | 'default_email_message' => $this->get_default_email_message(), |
49 | - ) ); |
|
49 | + )); |
|
50 | 50 | |
51 | 51 | // Setup action hook. |
52 | 52 | add_action( |
53 | 53 | "give_{$this->config['id']}_email_notification", |
54 | - array( $this, 'setup_email_notification' ), |
|
54 | + array($this, 'setup_email_notification'), |
|
55 | 55 | 10, |
56 | 56 | 2 |
57 | 57 | ); |
58 | 58 | |
59 | 59 | add_filter( |
60 | 60 | 'give_email_preview_header', |
61 | - array( $this, 'email_preview_header' ), |
|
61 | + array($this, 'email_preview_header'), |
|
62 | 62 | 10, |
63 | 63 | 2 |
64 | 64 | ); |
@@ -73,13 +73,13 @@ discard block |
||
73 | 73 | * @return string |
74 | 74 | */ |
75 | 75 | function get_default_email_message() { |
76 | - $message = esc_attr__( 'Username: {username}', 'give' ) . "\r\n\r\n"; |
|
76 | + $message = esc_attr__('Username: {username}', 'give')."\r\n\r\n"; |
|
77 | 77 | |
78 | - $message .= __( 'To reset your password, simply click the link below which will take you to a web page where you can create a new password.', 'give' ) . "\r\n"; |
|
79 | - $message .= '{reset_password_link}' . "\r\n\r\n"; |
|
78 | + $message .= __('To reset your password, simply click the link below which will take you to a web page where you can create a new password.', 'give')."\r\n"; |
|
79 | + $message .= '{reset_password_link}'."\r\n\r\n"; |
|
80 | 80 | |
81 | - $message .= __( 'After resetting password, Please login to your account with link below.', 'give' ) . "\r\n"; |
|
82 | - $message .= '<a href="' . wp_login_url() . '"> ' . esc_attr__( 'Click Here to Login »', 'give' ) . '</a>' . "\r\n"; |
|
81 | + $message .= __('After resetting password, Please login to your account with link below.', 'give')."\r\n"; |
|
82 | + $message .= '<a href="'.wp_login_url().'"> '.esc_attr__('Click Here to Login »', 'give').'</a>'."\r\n"; |
|
83 | 83 | |
84 | 84 | /** |
85 | 85 | * Filter the default email message |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | * @since 2.0 |
99 | 99 | */ |
100 | 100 | public function setup_email_data() { |
101 | - Give()->emails->__set( 'heading', esc_html__( 'New User Registration', 'give' ) ); |
|
101 | + Give()->emails->__set('heading', esc_html__('New User Registration', 'give')); |
|
102 | 102 | } |
103 | 103 | |
104 | 104 | /** |
@@ -112,13 +112,13 @@ discard block |
||
112 | 112 | * |
113 | 113 | * @return string |
114 | 114 | */ |
115 | - public function setup_email_notification( $user_id, $user_data ) { |
|
115 | + public function setup_email_notification($user_id, $user_data) { |
|
116 | 116 | $this->setup_email_data(); |
117 | 117 | |
118 | 118 | $this->recipient_email = $user_data['user_email']; |
119 | - $this->send_email_notification( array( |
|
119 | + $this->send_email_notification(array( |
|
120 | 120 | 'user_id' => $user_id, |
121 | - ) ); |
|
121 | + )); |
|
122 | 122 | } |
123 | 123 | |
124 | 124 | /** |
@@ -132,42 +132,42 @@ discard block |
||
132 | 132 | * |
133 | 133 | * @return bool |
134 | 134 | */ |
135 | - public function email_preview_header( $email_preview_header, $email ) { |
|
135 | + public function email_preview_header($email_preview_header, $email) { |
|
136 | 136 | // Bailout. |
137 | - if ( $this->config['id'] !== $email->config['id'] ) { |
|
137 | + if ($this->config['id'] !== $email->config['id']) { |
|
138 | 138 | return $email_preview_header; |
139 | 139 | } |
140 | 140 | |
141 | 141 | // Payment receipt switcher |
142 | - $user_id = give_check_variable( give_clean( $_GET ), 'isset', 0, 'user_id' ); |
|
142 | + $user_id = give_check_variable(give_clean($_GET), 'isset', 0, 'user_id'); |
|
143 | 143 | |
144 | 144 | // Get payments. |
145 | 145 | $donors = new Give_API(); |
146 | - $donors = give_check_variable( $donors->get_donors(), 'empty', array(), 'donors' ); |
|
146 | + $donors = give_check_variable($donors->get_donors(), 'empty', array(), 'donors'); |
|
147 | 147 | $options = array(); |
148 | 148 | |
149 | 149 | // Default option. |
150 | - $options[0] = esc_html__( 'No donor(s) found.', 'give' ); |
|
150 | + $options[0] = esc_html__('No donor(s) found.', 'give'); |
|
151 | 151 | |
152 | 152 | // Provide nice human readable options. |
153 | - if ( $donors ) { |
|
154 | - $options[0] = esc_html__( '- Select a donor -', 'give' ); |
|
155 | - foreach ( $donors as $donor ) { |
|
153 | + if ($donors) { |
|
154 | + $options[0] = esc_html__('- Select a donor -', 'give'); |
|
155 | + foreach ($donors as $donor) { |
|
156 | 156 | // Exclude customers for which wp user not exist. |
157 | - if ( ! $donor['info']['user_id'] ) { |
|
157 | + if ( ! $donor['info']['user_id']) { |
|
158 | 158 | continue; |
159 | 159 | } |
160 | - $options[ $donor['info']['user_id'] ] = esc_html( '#' . $donor['info']['donor_id'] . ' - ' . $donor['info']['email'] ); |
|
160 | + $options[$donor['info']['user_id']] = esc_html('#'.$donor['info']['donor_id'].' - '.$donor['info']['email']); |
|
161 | 161 | } |
162 | 162 | } |
163 | 163 | |
164 | - $request_url_data = wp_parse_url( $_SERVER['REQUEST_URI'] ); |
|
164 | + $request_url_data = wp_parse_url($_SERVER['REQUEST_URI']); |
|
165 | 165 | $query = $request_url_data['query']; |
166 | 166 | |
167 | 167 | // Remove user id query param if set from request url. |
168 | - $query = remove_query_arg( array( 'user_id' ), $query ); |
|
168 | + $query = remove_query_arg(array('user_id'), $query); |
|
169 | 169 | |
170 | - $request_url = home_url( '/?' . str_replace( '', '', $query ) ); |
|
170 | + $request_url = home_url('/?'.str_replace('', '', $query)); |
|
171 | 171 | ?> |
172 | 172 | |
173 | 173 | <!-- Start constructing HTML output.--> |
@@ -185,12 +185,12 @@ discard block |
||
185 | 185 | </script> |
186 | 186 | |
187 | 187 | <label for="give_preview_email_user_id" style="font-size:12px;color:#333;margin:0 4px 0 0;"> |
188 | - <?php echo esc_html__( 'Preview email with a donor:', 'give' ); ?> |
|
188 | + <?php echo esc_html__('Preview email with a donor:', 'give'); ?> |
|
189 | 189 | </label> |
190 | 190 | |
191 | 191 | <?php |
192 | 192 | // The select field with 100 latest transactions |
193 | - echo Give()->html->select( array( |
|
193 | + echo Give()->html->select(array( |
|
194 | 194 | 'name' => 'preview_email_user_id', |
195 | 195 | 'selected' => $user_id, |
196 | 196 | 'id' => 'give_preview_email_user_id', |
@@ -200,7 +200,7 @@ discard block |
||
200 | 200 | 'select_atts' => 'onchange="change_preview()"', |
201 | 201 | 'show_option_all' => false, |
202 | 202 | 'show_option_none' => false, |
203 | - ) ); |
|
203 | + )); |
|
204 | 204 | ?> |
205 | 205 | </div> |
206 | 206 | <?php |
@@ -178,7 +178,7 @@ |
||
178 | 178 | * @param Give_Email_Notification $email |
179 | 179 | * @param int $form_id |
180 | 180 | * |
181 | - * @return string |
|
181 | + * @return boolean |
|
182 | 182 | */ |
183 | 183 | public static function is_email_notification_active( Give_Email_Notification $email, $form_id = null ) { |
184 | 184 | $notification_status = $email->get_notification_status( $form_id ); |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | */ |
13 | 13 | |
14 | 14 | // Exit if access directly. |
15 | -if ( ! defined( 'ABSPATH' ) ) { |
|
15 | +if ( ! defined('ABSPATH')) { |
|
16 | 16 | exit; |
17 | 17 | } |
18 | 18 | |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | * @return static |
47 | 47 | */ |
48 | 48 | static function get_instance() { |
49 | - if ( null === static::$instance ) { |
|
49 | + if (null === static::$instance) { |
|
50 | 50 | self::$instance = new static(); |
51 | 51 | } |
52 | 52 | |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | * |
65 | 65 | * @return bool |
66 | 66 | */ |
67 | - public static function has_preview( Give_Email_Notification $email ) { |
|
67 | + public static function has_preview(Give_Email_Notification $email) { |
|
68 | 68 | return $email->config['has_preview']; |
69 | 69 | } |
70 | 70 | |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | * |
79 | 79 | * @return bool |
80 | 80 | */ |
81 | - public static function has_recipient_field( Give_Email_Notification $email ) { |
|
81 | + public static function has_recipient_field(Give_Email_Notification $email) { |
|
82 | 82 | return $email->config['has_recipient_field']; |
83 | 83 | } |
84 | 84 | |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | * |
93 | 93 | * @return bool |
94 | 94 | */ |
95 | - public static function is_notification_status_editable( Give_Email_Notification $email ) { |
|
95 | + public static function is_notification_status_editable(Give_Email_Notification $email) { |
|
96 | 96 | $user_can_edit = $email->config['notification_status_editable']; |
97 | 97 | |
98 | 98 | return (bool) $user_can_edit; |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | * |
109 | 109 | * @return bool |
110 | 110 | */ |
111 | - public static function is_content_type_editable( Give_Email_Notification $email ) { |
|
111 | + public static function is_content_type_editable(Give_Email_Notification $email) { |
|
112 | 112 | return $email->config['content_type_editable']; |
113 | 113 | } |
114 | 114 | |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | * |
123 | 123 | * @return bool |
124 | 124 | */ |
125 | - public static function is_email_preview_has_header( Give_Email_Notification $email ) { |
|
125 | + public static function is_email_preview_has_header(Give_Email_Notification $email) { |
|
126 | 126 | return $email->config['has_preview_header']; |
127 | 127 | } |
128 | 128 | |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | * |
137 | 137 | * @return bool |
138 | 138 | */ |
139 | - public static function is_email_preview( Give_Email_Notification $email ) { |
|
139 | + public static function is_email_preview(Give_Email_Notification $email) { |
|
140 | 140 | return $email->config['has_preview']; |
141 | 141 | } |
142 | 142 | |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | * |
151 | 151 | * @return bool |
152 | 152 | */ |
153 | - public static function is_show_on_emails_setting_page( Give_Email_Notification $email ){ |
|
153 | + public static function is_show_on_emails_setting_page(Give_Email_Notification $email) { |
|
154 | 154 | return $email->config['show_on_emails_setting_page']; |
155 | 155 | } |
156 | 156 | |
@@ -165,8 +165,8 @@ discard block |
||
165 | 165 | * |
166 | 166 | * @return bool |
167 | 167 | */ |
168 | - public static function can_use_form_email_options( Give_Email_Notification $email, $form_id = null ){ |
|
169 | - return give_is_setting_enabled( give_get_meta( $form_id, '_give_email_options', true ) ); |
|
168 | + public static function can_use_form_email_options(Give_Email_Notification $email, $form_id = null) { |
|
169 | + return give_is_setting_enabled(give_get_meta($form_id, '_give_email_options', true)); |
|
170 | 170 | } |
171 | 171 | |
172 | 172 | /** |
@@ -180,13 +180,13 @@ discard block |
||
180 | 180 | * |
181 | 181 | * @return string |
182 | 182 | */ |
183 | - public static function is_email_notification_active( Give_Email_Notification $email, $form_id = null ) { |
|
184 | - $notification_status = $email->get_notification_status( $form_id ); |
|
183 | + public static function is_email_notification_active(Give_Email_Notification $email, $form_id = null) { |
|
184 | + $notification_status = $email->get_notification_status($form_id); |
|
185 | 185 | |
186 | 186 | |
187 | - $notification_status = empty( $form_id ) |
|
188 | - ? give_is_setting_enabled( $notification_status ) |
|
189 | - : give_is_setting_enabled( give_get_option( "{$email->config['id']}_notification", $email->config['notification_status'] ) ) && give_is_setting_enabled( $notification_status, array( 'enabled', 'global' ) ); |
|
187 | + $notification_status = empty($form_id) |
|
188 | + ? give_is_setting_enabled($notification_status) |
|
189 | + : give_is_setting_enabled(give_get_option("{$email->config['id']}_notification", $email->config['notification_status'])) && give_is_setting_enabled($notification_status, array('enabled', 'global')); |
|
190 | 190 | // To check if email notification is active or not on a per-form basis, email notification must be globally active—otherwise it will be considered disabled. |
191 | 191 | |
192 | 192 | return $notification_status; |
@@ -203,8 +203,8 @@ discard block |
||
203 | 203 | $is_preview = false; |
204 | 204 | |
205 | 205 | if ( |
206 | - current_user_can( 'manage_give_settings' ) |
|
207 | - && ! empty( $_GET['give_action'] ) |
|
206 | + current_user_can('manage_give_settings') |
|
207 | + && ! empty($_GET['give_action']) |
|
208 | 208 | && 'preview_email' === $_GET['give_action'] |
209 | 209 | ) { |
210 | 210 | $is_preview = true; |
@@ -224,8 +224,8 @@ discard block |
||
224 | 224 | $is_preview = false; |
225 | 225 | |
226 | 226 | if ( |
227 | - current_user_can( 'manage_give_settings' ) |
|
228 | - && ! empty( $_GET['give_action'] ) |
|
227 | + current_user_can('manage_give_settings') |
|
228 | + && ! empty($_GET['give_action']) |
|
229 | 229 | && 'send_preview_email' === $_GET['give_action'] |
230 | 230 | ) { |
231 | 231 | $is_preview = true; |
@@ -245,13 +245,13 @@ discard block |
||
245 | 245 | * |
246 | 246 | * @return string |
247 | 247 | */ |
248 | - public static function get_formatted_email_type( $content_type ) { |
|
248 | + public static function get_formatted_email_type($content_type) { |
|
249 | 249 | $email_contents = array( |
250 | - 'text/html' => __( 'HTML', 'give' ), |
|
251 | - 'text/plain' => __( 'Plain', 'give' ), |
|
250 | + 'text/html' => __('HTML', 'give'), |
|
251 | + 'text/plain' => __('Plain', 'give'), |
|
252 | 252 | ); |
253 | 253 | |
254 | - return $email_contents[ $content_type ]; |
|
254 | + return $email_contents[$content_type]; |
|
255 | 255 | } |
256 | 256 | |
257 | 257 | |
@@ -268,40 +268,40 @@ discard block |
||
268 | 268 | * |
269 | 269 | * @return mixed |
270 | 270 | */ |
271 | - public static function get_value( Give_Email_Notification $email, $option_name, $form_id = null, $default = false ) { |
|
271 | + public static function get_value(Give_Email_Notification $email, $option_name, $form_id = null, $default = false) { |
|
272 | 272 | // If form id set then option name can be contain _give_ prefix which is only used for meta key, |
273 | 273 | // So make sure you are using correct option name. |
274 | - $global_option_name = ( 0 === strpos( $option_name, '_give_' ) |
|
275 | - ? str_replace( '_give_', '', $option_name ) |
|
276 | - : $option_name ); |
|
277 | - $option_value = give_get_option( $global_option_name, $default ); |
|
274 | + $global_option_name = (0 === strpos($option_name, '_give_') |
|
275 | + ? str_replace('_give_', '', $option_name) |
|
276 | + : $option_name); |
|
277 | + $option_value = give_get_option($global_option_name, $default); |
|
278 | 278 | |
279 | 279 | if ( |
280 | - ! empty( $form_id ) |
|
280 | + ! empty($form_id) |
|
281 | 281 | && give_is_setting_enabled( |
282 | 282 | give_get_meta( |
283 | 283 | $form_id, |
284 | - Give_Email_Setting_Field::get_prefix( $email, $form_id ) . 'notification', |
|
284 | + Give_Email_Setting_Field::get_prefix($email, $form_id).'notification', |
|
285 | 285 | true, |
286 | 286 | 'global' |
287 | 287 | ) |
288 | 288 | ) |
289 | 289 | ) { |
290 | - $option_value = get_post_meta( $form_id, $option_name, true ); |
|
290 | + $option_value = get_post_meta($form_id, $option_name, true); |
|
291 | 291 | |
292 | 292 | // Get only email field value from recipients setting. |
293 | - if( Give_Email_Setting_Field::get_prefix( $email, $form_id ) . 'recipient' === $option_name ) { |
|
294 | - $option_value = wp_list_pluck( $option_value, 'email' ); |
|
293 | + if (Give_Email_Setting_Field::get_prefix($email, $form_id).'recipient' === $option_name) { |
|
294 | + $option_value = wp_list_pluck($option_value, 'email'); |
|
295 | 295 | } |
296 | 296 | } |
297 | 297 | |
298 | - $option_value = empty( $option_value ) ? $default : $option_value; |
|
298 | + $option_value = empty($option_value) ? $default : $option_value; |
|
299 | 299 | |
300 | 300 | /** |
301 | 301 | * Filter the setting value |
302 | 302 | * |
303 | 303 | * @since 2.0 |
304 | 304 | */ |
305 | - return apply_filters( 'give_email_setting_value', $option_value, $option_name, $email, $form_id, $default ); |
|
305 | + return apply_filters('give_email_setting_value', $option_value, $option_name, $email, $form_id, $default); |
|
306 | 306 | } |
307 | 307 | } |
@@ -231,7 +231,7 @@ discard block |
||
231 | 231 | * |
232 | 232 | * @since 2.0 |
233 | 233 | * @access public |
234 | - * @return bool|null |
|
234 | + * @return false|null |
|
235 | 235 | */ |
236 | 236 | public function preview_email() { |
237 | 237 | // Bailout. |
@@ -369,7 +369,7 @@ discard block |
||
369 | 369 | * |
370 | 370 | * @since 2.0 |
371 | 371 | * @access public |
372 | - * @return bool|null |
|
372 | + * @return false|null |
|
373 | 373 | */ |
374 | 374 | public function send_preview_email() { |
375 | 375 | // Bailout. |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | * @return static |
53 | 53 | */ |
54 | 54 | static function get_instance() { |
55 | - if ( null === static::$instance ) { |
|
55 | + if (null === static::$instance) { |
|
56 | 56 | self::$instance = new static(); |
57 | 57 | } |
58 | 58 | |
@@ -66,31 +66,31 @@ discard block |
||
66 | 66 | */ |
67 | 67 | public function init() { |
68 | 68 | // Load files. |
69 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/emails/ajax-handler.php'; |
|
70 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/emails/class-email-setting-field.php'; |
|
71 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/emails/filters.php'; |
|
69 | + require_once GIVE_PLUGIN_DIR.'includes/admin/emails/ajax-handler.php'; |
|
70 | + require_once GIVE_PLUGIN_DIR.'includes/admin/emails/class-email-setting-field.php'; |
|
71 | + require_once GIVE_PLUGIN_DIR.'includes/admin/emails/filters.php'; |
|
72 | 72 | |
73 | 73 | // Load email notifications. |
74 | 74 | $this->add_emails_notifications(); |
75 | 75 | |
76 | - add_filter( 'give_metabox_form_data_settings', array( $this, 'add_metabox_setting_fields' ), 10, 2 ); |
|
77 | - add_action( 'init', array( $this, 'preview_email' ) ); |
|
78 | - add_action( 'init', array( $this, 'send_preview_email' ) ); |
|
79 | - add_action( 'init', array( $this, 'validate_settings' ) ); |
|
76 | + add_filter('give_metabox_form_data_settings', array($this, 'add_metabox_setting_fields'), 10, 2); |
|
77 | + add_action('init', array($this, 'preview_email')); |
|
78 | + add_action('init', array($this, 'send_preview_email')); |
|
79 | + add_action('init', array($this, 'validate_settings')); |
|
80 | 80 | |
81 | 81 | /* @var Give_Email_Notification $email */ |
82 | - foreach ( $this->get_email_notifications() as $email ) { |
|
82 | + foreach ($this->get_email_notifications() as $email) { |
|
83 | 83 | // Setup email section. |
84 | - if( Give_Email_Notification_Util::is_show_on_emails_setting_page( $email ) ) { |
|
85 | - add_filter( 'give_get_sections_emails', array( $email, 'add_section' ) ); |
|
86 | - add_filter( "give_hide_section_{$email->config['id']}_on_emails_page", array( $email, 'hide_section' ) ); |
|
84 | + if (Give_Email_Notification_Util::is_show_on_emails_setting_page($email)) { |
|
85 | + add_filter('give_get_sections_emails', array($email, 'add_section')); |
|
86 | + add_filter("give_hide_section_{$email->config['id']}_on_emails_page", array($email, 'hide_section')); |
|
87 | 87 | } |
88 | 88 | |
89 | 89 | // Setup email preview. |
90 | - if ( Give_Email_Notification_Util::is_email_preview_has_header( $email ) ) { |
|
91 | - add_action( "give_{$email->config['id']}_email_preview", array( $this, 'email_preview_header' ) ); |
|
92 | - add_filter( "give_{$email->config['id']}_email_preview_data", array( $this, 'email_preview_data' ) ); |
|
93 | - add_filter( "give_{$email->config['id']}_email_preview_message", array( $this, 'email_preview_message' ), 1, 2 ); |
|
90 | + if (Give_Email_Notification_Util::is_email_preview_has_header($email)) { |
|
91 | + add_action("give_{$email->config['id']}_email_preview", array($this, 'email_preview_header')); |
|
92 | + add_filter("give_{$email->config['id']}_email_preview_data", array($this, 'email_preview_data')); |
|
93 | + add_filter("give_{$email->config['id']}_email_preview_message", array($this, 'email_preview_message'), 1, 2); |
|
94 | 94 | } |
95 | 95 | } |
96 | 96 | } |
@@ -107,63 +107,63 @@ discard block |
||
107 | 107 | * |
108 | 108 | * @return array |
109 | 109 | */ |
110 | - public function add_metabox_setting_fields( $settings, $post_id ) { |
|
110 | + public function add_metabox_setting_fields($settings, $post_id) { |
|
111 | 111 | $emails = $this->get_email_notifications(); |
112 | 112 | |
113 | 113 | // Bailout. |
114 | - if ( empty( $emails ) ) { |
|
114 | + if (empty($emails)) { |
|
115 | 115 | return $settings; |
116 | 116 | } |
117 | 117 | |
118 | 118 | // Email notification setting. |
119 | 119 | $settings['email_notification_options'] = array( |
120 | 120 | 'id' => 'email_notification_options', |
121 | - 'title' => __( 'Email Notification', 'give' ), |
|
121 | + 'title' => __('Email Notification', 'give'), |
|
122 | 122 | 'fields' => array( |
123 | 123 | array( |
124 | - 'name' => __( 'Email Options', 'give' ), |
|
125 | - 'description' => __( '', 'give' ), |
|
124 | + 'name' => __('Email Options', 'give'), |
|
125 | + 'description' => __('', 'give'), |
|
126 | 126 | 'id' => '_give_email_options', |
127 | 127 | 'type' => 'radio_inline', |
128 | 128 | 'default' => 'global', |
129 | 129 | 'options' => array( |
130 | - 'global' => __( 'Global Options' ), |
|
131 | - 'enabled' => __( 'Customize', 'give' ), |
|
130 | + 'global' => __('Global Options'), |
|
131 | + 'enabled' => __('Customize', 'give'), |
|
132 | 132 | ), |
133 | 133 | ), |
134 | 134 | array( |
135 | 135 | 'id' => '_give_email_template', |
136 | - 'name' => esc_html__( 'Email Template', 'give' ), |
|
137 | - 'desc' => esc_html__( 'Choose your template from the available registered template types.', 'give' ), |
|
136 | + 'name' => esc_html__('Email Template', 'give'), |
|
137 | + 'desc' => esc_html__('Choose your template from the available registered template types.', 'give'), |
|
138 | 138 | 'type' => 'select', |
139 | 139 | 'default' => 'default', |
140 | 140 | 'options' => give_get_email_templates(), |
141 | 141 | ), |
142 | 142 | array( |
143 | 143 | 'id' => '_give_email_logo', |
144 | - 'name' => esc_html__( 'Logo', 'give' ), |
|
145 | - 'desc' => esc_html__( 'Upload or choose a logo to be displayed at the top of the donation receipt emails. Displayed on HTML emails only.', 'give' ), |
|
144 | + 'name' => esc_html__('Logo', 'give'), |
|
145 | + 'desc' => esc_html__('Upload or choose a logo to be displayed at the top of the donation receipt emails. Displayed on HTML emails only.', 'give'), |
|
146 | 146 | 'type' => 'file', |
147 | 147 | ), |
148 | 148 | array( |
149 | 149 | 'id' => '_give_from_name', |
150 | - 'name' => esc_html__( 'From Name', 'give' ), |
|
151 | - 'desc' => esc_html__( 'The name which appears in the "From" field in all Give donation emails.', 'give' ), |
|
152 | - 'default' => get_bloginfo( 'name' ), |
|
150 | + 'name' => esc_html__('From Name', 'give'), |
|
151 | + 'desc' => esc_html__('The name which appears in the "From" field in all Give donation emails.', 'give'), |
|
152 | + 'default' => get_bloginfo('name'), |
|
153 | 153 | 'type' => 'text', |
154 | 154 | ), |
155 | 155 | array( |
156 | 156 | 'id' => '_give_from_email', |
157 | - 'name' => esc_html__( 'From Email', 'give' ), |
|
158 | - 'desc' => esc_html__( 'Email address from which all Give emails are sent from. This will act as the "from" and "reply-to" email address.', 'give' ), |
|
159 | - 'default' => get_bloginfo( 'admin_email' ), |
|
157 | + 'name' => esc_html__('From Email', 'give'), |
|
158 | + 'desc' => esc_html__('Email address from which all Give emails are sent from. This will act as the "from" and "reply-to" email address.', 'give'), |
|
159 | + 'default' => get_bloginfo('admin_email'), |
|
160 | 160 | 'type' => 'text', |
161 | 161 | ), |
162 | 162 | array( |
163 | 163 | 'name' => 'email_notification_docs', |
164 | 164 | 'type' => 'docs_link', |
165 | 165 | 'url' => 'http://docs.givewp.com/email-notification', |
166 | - 'title' => __( 'Email Notification', 'give' ), |
|
166 | + 'title' => __('Email Notification', 'give'), |
|
167 | 167 | ), |
168 | 168 | ), |
169 | 169 | |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | * |
173 | 173 | * @since 2.0 |
174 | 174 | */ |
175 | - 'sub-fields' => apply_filters( 'give_email_notification_options_metabox_fields', array(), $post_id ), |
|
175 | + 'sub-fields' => apply_filters('give_email_notification_options_metabox_fields', array(), $post_id), |
|
176 | 176 | ); |
177 | 177 | |
178 | 178 | return $settings; |
@@ -186,13 +186,13 @@ discard block |
||
186 | 186 | */ |
187 | 187 | private function add_emails_notifications() { |
188 | 188 | $this->emails = array( |
189 | - include GIVE_PLUGIN_DIR . 'includes/admin/emails/class-new-donation-email.php', |
|
190 | - include GIVE_PLUGIN_DIR . 'includes/admin/emails/class-donation-receipt-email.php', |
|
191 | - include GIVE_PLUGIN_DIR . 'includes/admin/emails/class-new-offline-donation-email.php', |
|
192 | - include GIVE_PLUGIN_DIR . 'includes/admin/emails/class-offline-donation-instruction-email.php', |
|
193 | - include GIVE_PLUGIN_DIR . 'includes/admin/emails/class-new-donor-register-email.php', |
|
194 | - include GIVE_PLUGIN_DIR . 'includes/admin/emails/class-donor-register-email.php', |
|
195 | - include GIVE_PLUGIN_DIR . 'includes/admin/emails/class-email-access-email.php', |
|
189 | + include GIVE_PLUGIN_DIR.'includes/admin/emails/class-new-donation-email.php', |
|
190 | + include GIVE_PLUGIN_DIR.'includes/admin/emails/class-donation-receipt-email.php', |
|
191 | + include GIVE_PLUGIN_DIR.'includes/admin/emails/class-new-offline-donation-email.php', |
|
192 | + include GIVE_PLUGIN_DIR.'includes/admin/emails/class-offline-donation-instruction-email.php', |
|
193 | + include GIVE_PLUGIN_DIR.'includes/admin/emails/class-new-donor-register-email.php', |
|
194 | + include GIVE_PLUGIN_DIR.'includes/admin/emails/class-donor-register-email.php', |
|
195 | + include GIVE_PLUGIN_DIR.'includes/admin/emails/class-email-access-email.php', |
|
196 | 196 | ); |
197 | 197 | |
198 | 198 | /** |
@@ -200,15 +200,15 @@ discard block |
||
200 | 200 | * |
201 | 201 | * @since 2.0 |
202 | 202 | */ |
203 | - $this->emails = apply_filters( 'give_email_notifications', $this->emails, $this ); |
|
203 | + $this->emails = apply_filters('give_email_notifications', $this->emails, $this); |
|
204 | 204 | |
205 | 205 | // Bailout. |
206 | - if ( empty( $this->emails ) ) { |
|
206 | + if (empty($this->emails)) { |
|
207 | 207 | return; |
208 | 208 | } |
209 | 209 | |
210 | 210 | // Initiate email notifications. |
211 | - foreach ( $this->emails as $email ) { |
|
211 | + foreach ($this->emails as $email) { |
|
212 | 212 | $email->init(); |
213 | 213 | } |
214 | 214 | } |
@@ -235,41 +235,41 @@ discard block |
||
235 | 235 | */ |
236 | 236 | public function preview_email() { |
237 | 237 | // Bailout. |
238 | - if ( ! Give_Email_Notification_Util::can_preview_email() ) { |
|
238 | + if ( ! Give_Email_Notification_Util::can_preview_email()) { |
|
239 | 239 | return false; |
240 | 240 | } |
241 | 241 | |
242 | 242 | // Security check. |
243 | - give_validate_nonce( $_GET['_wpnonce'], 'give-preview-email' ); |
|
243 | + give_validate_nonce($_GET['_wpnonce'], 'give-preview-email'); |
|
244 | 244 | |
245 | 245 | // Get email type. |
246 | - $email_type = isset( $_GET['email_type'] ) ? esc_attr( $_GET['email_type'] ) : ''; |
|
246 | + $email_type = isset($_GET['email_type']) ? esc_attr($_GET['email_type']) : ''; |
|
247 | 247 | |
248 | 248 | /* @var Give_Email_Notification $email */ |
249 | - foreach ( $this->get_email_notifications() as $email ) { |
|
250 | - if ( $email_type !== $email->config['id'] ) { |
|
249 | + foreach ($this->get_email_notifications() as $email) { |
|
250 | + if ($email_type !== $email->config['id']) { |
|
251 | 251 | continue; |
252 | 252 | } |
253 | 253 | |
254 | 254 | // Set form id. |
255 | - $form_id = empty( $_GET['form_id'] ) ? null : absint( $_GET['form_id'] ); |
|
255 | + $form_id = empty($_GET['form_id']) ? null : absint($_GET['form_id']); |
|
256 | 256 | |
257 | 257 | // Call setup email data to apply filter and other thing to email. |
258 | 258 | $email->setup_email_data(); |
259 | 259 | |
260 | 260 | // Decode message. |
261 | - $email_message = $email->preview_email_template_tags( $email->get_email_message( $form_id ) ); |
|
261 | + $email_message = $email->preview_email_template_tags($email->get_email_message($form_id)); |
|
262 | 262 | |
263 | 263 | // Set email template. |
264 | - Give()->emails->html = true; |
|
265 | - Give()->emails->__set( 'template', $email->get_email_template( $form_id ) ); |
|
264 | + Give()->emails->html = true; |
|
265 | + Give()->emails->__set('template', $email->get_email_template($form_id)); |
|
266 | 266 | |
267 | - if ( 'text/plain' === $email->config['content_type'] ) { |
|
267 | + if ('text/plain' === $email->config['content_type']) { |
|
268 | 268 | // Give()->emails->__set( 'html', false ); |
269 | - Give()->emails->__set( 'template', 'none' ); |
|
269 | + Give()->emails->__set('template', 'none'); |
|
270 | 270 | } |
271 | 271 | |
272 | - if ( $email_message = Give()->emails->build_email( $email_message ) ) { |
|
272 | + if ($email_message = Give()->emails->build_email($email_message)) { |
|
273 | 273 | |
274 | 274 | /** |
275 | 275 | * Filter the email preview data |
@@ -278,14 +278,14 @@ discard block |
||
278 | 278 | * |
279 | 279 | * @param array |
280 | 280 | */ |
281 | - $email_preview_data = apply_filters( "give_{$email_type}_email_preview_data", array() ); |
|
281 | + $email_preview_data = apply_filters("give_{$email_type}_email_preview_data", array()); |
|
282 | 282 | |
283 | 283 | /** |
284 | 284 | * Fire the give_{$email_type}_email_preview action |
285 | 285 | * |
286 | 286 | * @since 2.0 |
287 | 287 | */ |
288 | - do_action( "give_{$email_type}_email_preview", $email ); |
|
288 | + do_action("give_{$email_type}_email_preview", $email); |
|
289 | 289 | |
290 | 290 | /** |
291 | 291 | * Filter the email message |
@@ -296,7 +296,7 @@ discard block |
||
296 | 296 | * @param array $email_preview_data |
297 | 297 | * @param Give_Email_Notification $email |
298 | 298 | */ |
299 | - echo apply_filters( "give_{$email_type}_email_preview_message", $email_message, $email_preview_data, $email ); |
|
299 | + echo apply_filters("give_{$email_type}_email_preview_message", $email_message, $email_preview_data, $email); |
|
300 | 300 | |
301 | 301 | exit(); |
302 | 302 | } |
@@ -312,7 +312,7 @@ discard block |
||
312 | 312 | * |
313 | 313 | * @param Give_Email_Notification $email |
314 | 314 | */ |
315 | - public function email_preview_header( $email ) { |
|
315 | + public function email_preview_header($email) { |
|
316 | 316 | /** |
317 | 317 | * Filter the all email preview headers. |
318 | 318 | * |
@@ -320,7 +320,7 @@ discard block |
||
320 | 320 | * |
321 | 321 | * @param Give_Email_Notification $email |
322 | 322 | */ |
323 | - $email_preview_header = apply_filters( 'give_email_preview_header', give_get_preview_email_header(), $email ); |
|
323 | + $email_preview_header = apply_filters('give_email_preview_header', give_get_preview_email_header(), $email); |
|
324 | 324 | |
325 | 325 | echo $email_preview_header; |
326 | 326 | } |
@@ -335,9 +335,9 @@ discard block |
||
335 | 335 | * |
336 | 336 | * @return array |
337 | 337 | */ |
338 | - public function email_preview_data( $email_preview_data ) { |
|
339 | - $email_preview_data['payment_id'] = absint( give_check_variable( give_clean( $_GET ), 'isset', 0, 'preview_id' ) ); |
|
340 | - $email_preview_data['user_id'] = absint( give_check_variable( give_clean( $_GET ), 'isset', 0, 'user_id' ) ); |
|
338 | + public function email_preview_data($email_preview_data) { |
|
339 | + $email_preview_data['payment_id'] = absint(give_check_variable(give_clean($_GET), 'isset', 0, 'preview_id')); |
|
340 | + $email_preview_data['user_id'] = absint(give_check_variable(give_clean($_GET), 'isset', 0, 'user_id')); |
|
341 | 341 | |
342 | 342 | return $email_preview_data; |
343 | 343 | } |
@@ -353,12 +353,12 @@ discard block |
||
353 | 353 | * |
354 | 354 | * @return string |
355 | 355 | */ |
356 | - public function email_preview_message( $email_message, $email_preview_data ) { |
|
356 | + public function email_preview_message($email_message, $email_preview_data) { |
|
357 | 357 | if ( |
358 | - ! empty( $email_preview_data['payment_id'] ) |
|
359 | - || ! empty( $email_preview_data['user_id'] ) |
|
358 | + ! empty($email_preview_data['payment_id']) |
|
359 | + || ! empty($email_preview_data['user_id']) |
|
360 | 360 | ) { |
361 | - $email_message = give_do_email_tags( $email_message, $email_preview_data ); |
|
361 | + $email_message = give_do_email_tags($email_message, $email_preview_data); |
|
362 | 362 | } |
363 | 363 | |
364 | 364 | return $email_message; |
@@ -373,26 +373,26 @@ discard block |
||
373 | 373 | */ |
374 | 374 | public function send_preview_email() { |
375 | 375 | // Bailout. |
376 | - if ( ! Give_Email_Notification_Util::can_send_preview_email() ) { |
|
376 | + if ( ! Give_Email_Notification_Util::can_send_preview_email()) { |
|
377 | 377 | return false; |
378 | 378 | } |
379 | 379 | |
380 | 380 | // Security check. |
381 | - give_validate_nonce( $_GET['_wpnonce'], 'give-send-preview-email' ); |
|
381 | + give_validate_nonce($_GET['_wpnonce'], 'give-send-preview-email'); |
|
382 | 382 | |
383 | 383 | // Get email type. |
384 | - $email_type = give_check_variable( give_clean( $_GET ), 'isset', '', 'email_type' ); |
|
384 | + $email_type = give_check_variable(give_clean($_GET), 'isset', '', 'email_type'); |
|
385 | 385 | |
386 | 386 | /* @var Give_Email_Notification $email */ |
387 | - foreach ( $this->get_email_notifications() as $email ) { |
|
388 | - if ( $email_type === $email->config['id'] && Give_Email_Notification_Util::is_email_preview( $email ) ) { |
|
387 | + foreach ($this->get_email_notifications() as $email) { |
|
388 | + if ($email_type === $email->config['id'] && Give_Email_Notification_Util::is_email_preview($email)) { |
|
389 | 389 | $email->send_preview_email(); |
390 | 390 | break; |
391 | 391 | } |
392 | 392 | } |
393 | 393 | |
394 | 394 | // Remove the test email query arg. |
395 | - wp_redirect( remove_query_arg( 'give_action' ) ); |
|
395 | + wp_redirect(remove_query_arg('give_action')); |
|
396 | 396 | exit; |
397 | 397 | } |
398 | 398 | |
@@ -404,7 +404,7 @@ discard block |
||
404 | 404 | * @access public |
405 | 405 | */ |
406 | 406 | public function load() { |
407 | - add_action( 'init', array( $this, 'init' ), -1 ); |
|
407 | + add_action('init', array($this, 'init'), -1); |
|
408 | 408 | } |
409 | 409 | |
410 | 410 | |
@@ -419,7 +419,7 @@ discard block |
||
419 | 419 | if ( |
420 | 420 | ! Give_Admin_Settings::is_saving_settings() || |
421 | 421 | 'emails' !== give_get_current_setting_tab() || |
422 | - ! isset( $_GET['section'] ) |
|
422 | + ! isset($_GET['section']) |
|
423 | 423 | ) { |
424 | 424 | return; |
425 | 425 | } |
@@ -427,18 +427,18 @@ discard block |
||
427 | 427 | // Get email type. |
428 | 428 | $email_type = give_get_current_setting_section(); |
429 | 429 | |
430 | - if ( ! empty( $_POST["{$email_type}_recipient"] ) ) { |
|
431 | - $_POST["{$email_type}_recipient"] = array_unique( array_filter( $_POST["{$email_type}_recipient"] ) ); |
|
430 | + if ( ! empty($_POST["{$email_type}_recipient"])) { |
|
431 | + $_POST["{$email_type}_recipient"] = array_unique(array_filter($_POST["{$email_type}_recipient"])); |
|
432 | 432 | } |
433 | 433 | } |
434 | 434 | } |
435 | 435 | |
436 | 436 | // Helper class. |
437 | -require_once GIVE_PLUGIN_DIR . 'includes/admin/emails/abstract-email-notification.php'; |
|
438 | -require_once GIVE_PLUGIN_DIR . 'includes/admin/emails/class-email-notification-util.php'; |
|
437 | +require_once GIVE_PLUGIN_DIR.'includes/admin/emails/abstract-email-notification.php'; |
|
438 | +require_once GIVE_PLUGIN_DIR.'includes/admin/emails/class-email-notification-util.php'; |
|
439 | 439 | |
440 | 440 | // Add backward compatibility. |
441 | -require_once GIVE_PLUGIN_DIR . 'includes/admin/emails/backward-compatibility.php'; |
|
441 | +require_once GIVE_PLUGIN_DIR.'includes/admin/emails/backward-compatibility.php'; |
|
442 | 442 | |
443 | 443 | /** |
444 | 444 | * Initialize functionality. |
@@ -528,7 +528,7 @@ discard block |
||
528 | 528 | /** |
529 | 529 | * Get donor email html. |
530 | 530 | * |
531 | - * @param object $payment Contains all the data of the payment. |
|
531 | + * @param Give_Payment $payment Contains all the data of the payment. |
|
532 | 532 | * |
533 | 533 | * @access public |
534 | 534 | * @since 1.0 |
@@ -556,7 +556,7 @@ discard block |
||
556 | 556 | /** |
557 | 557 | * Get Row Actions |
558 | 558 | * |
559 | - * @param object $payment Payment Data. |
|
559 | + * @param Give_Payment $payment Payment Data. |
|
560 | 560 | * |
561 | 561 | * @since 1.6 |
562 | 562 | * |
@@ -677,7 +677,7 @@ discard block |
||
677 | 677 | /** |
678 | 678 | * Get donor html. |
679 | 679 | * |
680 | - * @param object $payment Contains all the data of the payment. |
|
680 | + * @param Give_Payment $payment Contains all the data of the payment. |
|
681 | 681 | * |
682 | 682 | * @access public |
683 | 683 | * @since 1.0 |
@@ -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 | /** |
@@ -136,15 +136,15 @@ discard block |
||
136 | 136 | // Set parent defaults. |
137 | 137 | parent::__construct( |
138 | 138 | array( |
139 | - 'singular' => give_get_forms_label_singular(), // Singular name of the listed records. |
|
140 | - 'plural' => give_get_forms_label_plural(), // Plural name of the listed records. |
|
141 | - 'ajax' => false, // Does this table support ajax? |
|
139 | + 'singular' => give_get_forms_label_singular(), // Singular name of the listed records. |
|
140 | + 'plural' => give_get_forms_label_plural(), // Plural name of the listed records. |
|
141 | + 'ajax' => false, // Does this table support ajax? |
|
142 | 142 | ) |
143 | 143 | ); |
144 | 144 | |
145 | 145 | $this->process_bulk_action(); |
146 | 146 | $this->get_payment_counts(); |
147 | - $this->base_url = admin_url( 'edit.php?post_type=give_forms&page=give-payment-history' ); |
|
147 | + $this->base_url = admin_url('edit.php?post_type=give_forms&page=give-payment-history'); |
|
148 | 148 | } |
149 | 149 | |
150 | 150 | /** |
@@ -153,31 +153,31 @@ discard block |
||
153 | 153 | * @return void |
154 | 154 | */ |
155 | 155 | public function advanced_filters() { |
156 | - $start_date = isset( $_GET['start-date'] ) ? sanitize_text_field( $_GET['start-date'] ) : null; |
|
157 | - $end_date = isset( $_GET['end-date'] ) ? sanitize_text_field( $_GET['end-date'] ) : null; |
|
158 | - $status = isset( $_GET['status'] ) ? sanitize_text_field( $_GET['status'] ) : ''; |
|
159 | - $donor = isset( $_GET['donor'] ) ? sanitize_text_field( $_GET['donor'] ) : ''; |
|
160 | - $search = isset( $_GET['s'] ) ? sanitize_text_field( $_GET['s'] ) : ''; |
|
161 | - $form_id = ! empty( $_GET['form_id'] ) ? absint( $_GET['form_id'] ) : 0; |
|
156 | + $start_date = isset($_GET['start-date']) ? sanitize_text_field($_GET['start-date']) : null; |
|
157 | + $end_date = isset($_GET['end-date']) ? sanitize_text_field($_GET['end-date']) : null; |
|
158 | + $status = isset($_GET['status']) ? sanitize_text_field($_GET['status']) : ''; |
|
159 | + $donor = isset($_GET['donor']) ? sanitize_text_field($_GET['donor']) : ''; |
|
160 | + $search = isset($_GET['s']) ? sanitize_text_field($_GET['s']) : ''; |
|
161 | + $form_id = ! empty($_GET['form_id']) ? absint($_GET['form_id']) : 0; |
|
162 | 162 | ?> |
163 | 163 | <div id="give-payment-filters" class="give-filters"> |
164 | - <?php $this->search_box( __( 'Search', 'give' ), 'give-payments' ); ?> |
|
164 | + <?php $this->search_box(__('Search', 'give'), 'give-payments'); ?> |
|
165 | 165 | <div id="give-payment-date-filters"> |
166 | 166 | <div class="give-filter give-filter-half"> |
167 | 167 | <label for="start-date" |
168 | - class="give-start-date-label"><?php _e( 'Start Date', 'give' ); ?></label> |
|
168 | + class="give-start-date-label"><?php _e('Start Date', 'give'); ?></label> |
|
169 | 169 | <input type="text" id="start-date" name="start-date" class="give_datepicker" |
170 | 170 | value="<?php echo $start_date; ?>" placeholder="mm/dd/yyyy"/> |
171 | 171 | </div> |
172 | 172 | <div class="give-filter give-filter-half"> |
173 | - <label for="end-date" class="give-end-date-label"><?php _e( 'End Date', 'give' ); ?></label> |
|
173 | + <label for="end-date" class="give-end-date-label"><?php _e('End Date', 'give'); ?></label> |
|
174 | 174 | <input type="text" id="end-date" name="end-date" class="give_datepicker" |
175 | 175 | value="<?php echo $end_date; ?>" placeholder="mm/dd/yyyy"/> |
176 | 176 | </div> |
177 | 177 | </div> |
178 | 178 | <div id="give-payment-form-filter" class="give-filter"> |
179 | 179 | <label for="give-donation-forms-filter" |
180 | - class="give-donation-forms-filter-label"><?php _e( 'Form', 'give' ); ?></label> |
|
180 | + class="give-donation-forms-filter-label"><?php _e('Form', 'give'); ?></label> |
|
181 | 181 | <?php |
182 | 182 | // Filter Donations by Donation Forms. |
183 | 183 | echo Give()->html->forms_dropdown( |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | 'class' => 'give-donation-forms-filter', |
188 | 188 | 'selected' => $form_id, // Make sure to have $form_id set to 0, if there is no selection. |
189 | 189 | 'chosen' => true, |
190 | - 'number' => - 1, |
|
190 | + 'number' => -1, |
|
191 | 191 | ) |
192 | 192 | ); |
193 | 193 | ?> |
@@ -199,21 +199,21 @@ discard block |
||
199 | 199 | * |
200 | 200 | * @since 1.8.18 |
201 | 201 | */ |
202 | - do_action( 'give_payment_table_advanced_filters' ); |
|
202 | + do_action('give_payment_table_advanced_filters'); |
|
203 | 203 | ?> |
204 | 204 | |
205 | - <?php if ( ! empty( $status ) ) : ?> |
|
206 | - <input type="hidden" name="status" value="<?php echo esc_attr( $status ); ?>"/> |
|
205 | + <?php if ( ! empty($status)) : ?> |
|
206 | + <input type="hidden" name="status" value="<?php echo esc_attr($status); ?>"/> |
|
207 | 207 | <?php endif; ?> |
208 | 208 | |
209 | 209 | <div class="give-filter"> |
210 | - <?php submit_button( __( 'Apply', 'give' ), 'secondary', '', false ); ?> |
|
210 | + <?php submit_button(__('Apply', 'give'), 'secondary', '', false); ?> |
|
211 | 211 | <?php |
212 | 212 | // Clear active filters button. |
213 | - if ( ! empty( $start_date ) || ! empty( $end_date ) || ! empty( $donor ) || ! empty( $search ) || ! empty( $status ) || ! empty( $form_id ) ) : |
|
213 | + if ( ! empty($start_date) || ! empty($end_date) || ! empty($donor) || ! empty($search) || ! empty($status) || ! empty($form_id)) : |
|
214 | 214 | ?> |
215 | - <a href="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-payment-history' ); ?>" |
|
216 | - class="button give-clear-filters-button"><?php _e( 'Clear Filters', 'give' ); ?></a> |
|
215 | + <a href="<?php echo admin_url('edit.php?post_type=give_forms&page=give-payment-history'); ?>" |
|
216 | + class="button give-clear-filters-button"><?php _e('Clear Filters', 'give'); ?></a> |
|
217 | 217 | <?php endif; ?> |
218 | 218 | </div> |
219 | 219 | </div> |
@@ -232,18 +232,18 @@ discard block |
||
232 | 232 | * |
233 | 233 | * @return void |
234 | 234 | */ |
235 | - public function search_box( $text, $input_id ) { |
|
236 | - if ( empty( $_REQUEST['s'] ) && ! $this->has_items() ) { |
|
235 | + public function search_box($text, $input_id) { |
|
236 | + if (empty($_REQUEST['s']) && ! $this->has_items()) { |
|
237 | 237 | return; |
238 | 238 | } |
239 | 239 | |
240 | - $input_id = $input_id . '-search-input'; |
|
240 | + $input_id = $input_id.'-search-input'; |
|
241 | 241 | |
242 | - if ( ! empty( $_REQUEST['orderby'] ) ) { |
|
243 | - echo '<input type="hidden" name="orderby" value="' . esc_attr( $_REQUEST['orderby'] ) . '" />'; |
|
242 | + if ( ! empty($_REQUEST['orderby'])) { |
|
243 | + echo '<input type="hidden" name="orderby" value="'.esc_attr($_REQUEST['orderby']).'" />'; |
|
244 | 244 | } |
245 | - if ( ! empty( $_REQUEST['order'] ) ) { |
|
246 | - echo '<input type="hidden" name="order" value="' . esc_attr( $_REQUEST['order'] ) . '" />'; |
|
245 | + if ( ! empty($_REQUEST['order'])) { |
|
246 | + echo '<input type="hidden" name="order" value="'.esc_attr($_REQUEST['order']).'" />'; |
|
247 | 247 | } |
248 | 248 | ?> |
249 | 249 | <div class="give-filter give-filter-search" role="search"> |
@@ -255,13 +255,13 @@ discard block |
||
255 | 255 | * |
256 | 256 | * @since 1.7 |
257 | 257 | */ |
258 | - do_action( 'give_payment_history_search' ); |
|
258 | + do_action('give_payment_history_search'); |
|
259 | 259 | ?> |
260 | 260 | <label class="screen-reader-text" for="<?php echo $input_id ?>"><?php echo $text; ?>:</label> |
261 | 261 | <input type="search" id="<?php echo $input_id ?>" name="s" value="<?php _admin_search_query(); ?>"/> |
262 | - <?php submit_button( $text, 'button', false, false, array( |
|
262 | + <?php submit_button($text, 'button', false, false, array( |
|
263 | 263 | 'ID' => 'search-submit', |
264 | - ) ); ?><br/> |
|
264 | + )); ?><br/> |
|
265 | 265 | </div> |
266 | 266 | <?php |
267 | 267 | } |
@@ -276,48 +276,48 @@ discard block |
||
276 | 276 | */ |
277 | 277 | public function get_views() { |
278 | 278 | |
279 | - $current = isset( $_GET['status'] ) ? $_GET['status'] : ''; |
|
279 | + $current = isset($_GET['status']) ? $_GET['status'] : ''; |
|
280 | 280 | $views = array(); |
281 | 281 | $tabs = array( |
282 | 282 | 'all' => array( |
283 | 283 | 'total_count', |
284 | - __( 'All', 'give' ), |
|
284 | + __('All', 'give'), |
|
285 | 285 | ), |
286 | 286 | 'publish' => array( |
287 | 287 | 'complete_count', |
288 | - __( 'Completed', 'give' ), |
|
288 | + __('Completed', 'give'), |
|
289 | 289 | ), |
290 | 290 | 'pending' => array( |
291 | 291 | 'pending_count', |
292 | - __( 'Pending', 'give' ), |
|
292 | + __('Pending', 'give'), |
|
293 | 293 | ), |
294 | 294 | 'processing' => array( |
295 | 295 | 'processing_count', |
296 | - __( 'Processing', 'give' ), |
|
296 | + __('Processing', 'give'), |
|
297 | 297 | ), |
298 | 298 | 'refunded' => array( |
299 | 299 | 'refunded_count', |
300 | - __( 'Refunded', 'give' ), |
|
300 | + __('Refunded', 'give'), |
|
301 | 301 | ), |
302 | 302 | 'revoked' => array( |
303 | 303 | 'revoked_count', |
304 | - __( 'Revoked', 'give' ), |
|
304 | + __('Revoked', 'give'), |
|
305 | 305 | ), |
306 | 306 | 'failed' => array( |
307 | 307 | 'failed_count', |
308 | - __( 'Failed', 'give' ), |
|
308 | + __('Failed', 'give'), |
|
309 | 309 | ), |
310 | 310 | 'cancelled' => array( |
311 | 311 | 'cancelled_count', |
312 | - __( 'Cancelled', 'give' ), |
|
312 | + __('Cancelled', 'give'), |
|
313 | 313 | ), |
314 | 314 | 'abandoned' => array( |
315 | 315 | 'abandoned_count', |
316 | - __( 'Abandoned', 'give' ), |
|
316 | + __('Abandoned', 'give'), |
|
317 | 317 | ), |
318 | 318 | 'preapproval' => array( |
319 | 319 | 'preapproval_count', |
320 | - __( 'Preapproval Pending', 'give' ), |
|
320 | + __('Preapproval Pending', 'give'), |
|
321 | 321 | ), |
322 | 322 | ); |
323 | 323 | |
@@ -326,12 +326,12 @@ discard block |
||
326 | 326 | * |
327 | 327 | * @since 1.8.18 |
328 | 328 | */ |
329 | - $args = (array) apply_filters( 'give_payments_table_status_remove_query_arg', array( 'paged', '_wpnonce', '_wp_http_referer' ) ); |
|
329 | + $args = (array) apply_filters('give_payments_table_status_remove_query_arg', array('paged', '_wpnonce', '_wp_http_referer')); |
|
330 | 330 | |
331 | 331 | // Build URL. |
332 | - $staus_url = remove_query_arg( $args ); |
|
332 | + $staus_url = remove_query_arg($args); |
|
333 | 333 | |
334 | - foreach ( $tabs as $key => $tab ) { |
|
334 | + foreach ($tabs as $key => $tab) { |
|
335 | 335 | $count_key = $tab[0]; |
336 | 336 | $name = $tab[1]; |
337 | 337 | $count = $this->$count_key; |
@@ -346,16 +346,15 @@ discard block |
||
346 | 346 | * |
347 | 347 | * @since 1.8.12 |
348 | 348 | */ |
349 | - if ( 'all' === $key || $key === $current || apply_filters( 'give_payments_table_show_all_status', 0 < $count, $key, $count ) ) { |
|
349 | + if ('all' === $key || $key === $current || apply_filters('give_payments_table_show_all_status', 0 < $count, $key, $count)) { |
|
350 | 350 | |
351 | 351 | $staus_url = 'all' === $key ? |
352 | - add_query_arg( array( 'status' => false ), $staus_url ) : |
|
353 | - add_query_arg( array( 'status' => $key ), $staus_url ); |
|
352 | + add_query_arg(array('status' => false), $staus_url) : add_query_arg(array('status' => $key), $staus_url); |
|
354 | 353 | |
355 | - $views[ $key ] = sprintf( |
|
354 | + $views[$key] = sprintf( |
|
356 | 355 | '<a href="%s"%s>%s <span class="count">(%s)</span></a>', |
357 | - esc_url( $staus_url ), |
|
358 | - ( ( 'all' === $key && empty( $current ) ) ) ? ' class="current"' : ( $current == $key ? 'class="current"' : '' ), |
|
356 | + esc_url($staus_url), |
|
357 | + (('all' === $key && empty($current))) ? ' class="current"' : ($current == $key ? 'class="current"' : ''), |
|
359 | 358 | $name, |
360 | 359 | $count |
361 | 360 | ); |
@@ -370,7 +369,7 @@ discard block |
||
370 | 369 | * @param array $views |
371 | 370 | * @param Give_Payment_History_Table |
372 | 371 | */ |
373 | - return apply_filters( 'give_payments_table_views', $views, $this ); |
|
372 | + return apply_filters('give_payments_table_views', $views, $this); |
|
374 | 373 | } |
375 | 374 | |
376 | 375 | /** |
@@ -384,18 +383,18 @@ discard block |
||
384 | 383 | public function get_columns() { |
385 | 384 | $columns = array( |
386 | 385 | 'cb' => '<input type="checkbox" />', // Render a checkbox instead of text. |
387 | - 'donation' => __( 'Donation', 'give' ), |
|
388 | - 'donation_form' => __( 'Donation Form', 'give' ), |
|
389 | - 'status' => __( 'Status', 'give' ), |
|
390 | - 'date' => __( 'Date', 'give' ), |
|
391 | - 'amount' => __( 'Amount', 'give' ), |
|
386 | + 'donation' => __('Donation', 'give'), |
|
387 | + 'donation_form' => __('Donation Form', 'give'), |
|
388 | + 'status' => __('Status', 'give'), |
|
389 | + 'date' => __('Date', 'give'), |
|
390 | + 'amount' => __('Amount', 'give'), |
|
392 | 391 | ); |
393 | 392 | |
394 | - if ( current_user_can( 'view_give_payments' ) ) { |
|
395 | - $columns['details'] = __( 'Details', 'give' ); |
|
393 | + if (current_user_can('view_give_payments')) { |
|
394 | + $columns['details'] = __('Details', 'give'); |
|
396 | 395 | } |
397 | 396 | |
398 | - return apply_filters( 'give_payments_table_columns', $columns ); |
|
397 | + return apply_filters('give_payments_table_columns', $columns); |
|
399 | 398 | } |
400 | 399 | |
401 | 400 | /** |
@@ -408,14 +407,14 @@ discard block |
||
408 | 407 | */ |
409 | 408 | public function get_sortable_columns() { |
410 | 409 | $columns = array( |
411 | - 'donation' => array( 'ID', true ), |
|
412 | - 'donation_form' => array( 'donation_form', false ), |
|
413 | - 'status' => array( 'status', false ), |
|
414 | - 'amount' => array( 'amount', false ), |
|
415 | - 'date' => array( 'date', false ), |
|
410 | + 'donation' => array('ID', true), |
|
411 | + 'donation_form' => array('donation_form', false), |
|
412 | + 'status' => array('status', false), |
|
413 | + 'amount' => array('amount', false), |
|
414 | + 'date' => array('date', false), |
|
416 | 415 | ); |
417 | 416 | |
418 | - return apply_filters( 'give_payments_table_sortable_columns', $columns ); |
|
417 | + return apply_filters('give_payments_table_sortable_columns', $columns); |
|
419 | 418 | } |
420 | 419 | |
421 | 420 | /** |
@@ -441,43 +440,43 @@ discard block |
||
441 | 440 | * |
442 | 441 | * @return string Column Name |
443 | 442 | */ |
444 | - public function column_default( $payment, $column_name ) { |
|
443 | + public function column_default($payment, $column_name) { |
|
445 | 444 | |
446 | - $single_donation_url = esc_url( add_query_arg( 'id', $payment->ID, admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details' ) ) ); |
|
447 | - $row_actions = $this->get_row_actions( $payment ); |
|
445 | + $single_donation_url = esc_url(add_query_arg('id', $payment->ID, admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details'))); |
|
446 | + $row_actions = $this->get_row_actions($payment); |
|
448 | 447 | $value = ''; |
449 | 448 | |
450 | - switch ( $column_name ) { |
|
449 | + switch ($column_name) { |
|
451 | 450 | case 'donation' : |
452 | - if ( current_user_can( 'view_give_payments' ) ) { |
|
453 | - $value = Give()->tooltips->render_link( array( |
|
454 | - 'label' => sprintf( __( 'View Donation #%s', 'give' ), $payment->ID ), |
|
451 | + if (current_user_can('view_give_payments')) { |
|
452 | + $value = Give()->tooltips->render_link(array( |
|
453 | + 'label' => sprintf(__('View Donation #%s', 'give'), $payment->ID), |
|
455 | 454 | 'tag_content' => "#$payment->ID", |
456 | 455 | 'link' => $single_donation_url, |
457 | - ) ); |
|
456 | + )); |
|
458 | 457 | } else { |
459 | 458 | $value = "#{$payment->ID}"; |
460 | 459 | } |
461 | 460 | |
462 | 461 | $value .= sprintf( |
463 | 462 | ' %1$s %2$s<br>', |
464 | - __( 'by', 'give' ), |
|
465 | - $this->get_donor( $payment ) |
|
463 | + __('by', 'give'), |
|
464 | + $this->get_donor($payment) |
|
466 | 465 | ); |
467 | 466 | |
468 | - $value .= $this->get_donor_email( $payment ); |
|
469 | - $value .= $this->row_actions( $row_actions ); |
|
467 | + $value .= $this->get_donor_email($payment); |
|
468 | + $value .= $this->row_actions($row_actions); |
|
470 | 469 | break; |
471 | 470 | |
472 | 471 | case 'amount': |
473 | - $amount = ! empty( $payment->total ) ? $payment->total : 0; |
|
474 | - $value = give_donation_amount( $payment, true ); |
|
475 | - $value .= sprintf( '<br><small>%1$s %2$s</small>', __( 'via', 'give' ), give_get_gateway_admin_label( $payment->gateway ) ); |
|
472 | + $amount = ! empty($payment->total) ? $payment->total : 0; |
|
473 | + $value = give_donation_amount($payment, true); |
|
474 | + $value .= sprintf('<br><small>%1$s %2$s</small>', __('via', 'give'), give_get_gateway_admin_label($payment->gateway)); |
|
476 | 475 | break; |
477 | 476 | |
478 | 477 | case 'donation_form': |
479 | - $form_title = empty( $payment->form_title ) ? sprintf( __( 'Untitled (#%s)', 'give' ), $payment->form_id ) : $payment->form_title; |
|
480 | - $value = '<a href="' . admin_url( 'post.php?post=' . $payment->form_id . '&action=edit' ) . '">' . $form_title . '</a>'; |
|
478 | + $form_title = empty($payment->form_title) ? sprintf(__('Untitled (#%s)', 'give'), $payment->form_id) : $payment->form_title; |
|
479 | + $value = '<a href="'.admin_url('post.php?post='.$payment->form_id.'&action=edit').'">'.$form_title.'</a>'; |
|
481 | 480 | $level = give_get_donation_form_title( |
482 | 481 | $payment, |
483 | 482 | array( |
@@ -485,44 +484,44 @@ discard block |
||
485 | 484 | ) |
486 | 485 | ); |
487 | 486 | |
488 | - if ( ! empty( $level ) ) { |
|
487 | + if ( ! empty($level)) { |
|
489 | 488 | $value .= $level; |
490 | 489 | } |
491 | 490 | |
492 | 491 | break; |
493 | 492 | |
494 | 493 | case 'date': |
495 | - $date = strtotime( $payment->date ); |
|
496 | - $value = date_i18n( give_date_format(), $date ); |
|
494 | + $date = strtotime($payment->date); |
|
495 | + $value = date_i18n(give_date_format(), $date); |
|
497 | 496 | break; |
498 | 497 | |
499 | 498 | case 'status': |
500 | - $value = $this->get_payment_status( $payment ); |
|
499 | + $value = $this->get_payment_status($payment); |
|
501 | 500 | break; |
502 | 501 | |
503 | 502 | |
504 | 503 | case 'details' : |
505 | - if ( current_user_can( 'view_give_payments' ) ) { |
|
506 | - $value = Give()->tooltips->render_link( array( |
|
507 | - 'label' => sprintf( __( 'View Donation #%s', 'give' ), $payment->ID ), |
|
504 | + if (current_user_can('view_give_payments')) { |
|
505 | + $value = Give()->tooltips->render_link(array( |
|
506 | + 'label' => sprintf(__('View Donation #%s', 'give'), $payment->ID), |
|
508 | 507 | 'tag_content' => '<span class="dashicons dashicons-visibility"></span>', |
509 | 508 | 'link' => $single_donation_url, |
510 | 509 | 'attributes' => array( |
511 | 510 | 'class' => 'give-payment-details-link button button-small', |
512 | 511 | ), |
513 | - ) ); |
|
512 | + )); |
|
514 | 513 | |
515 | 514 | $value = "<div class=\"give-payment-details-link-wrap\">{$value}</div>"; |
516 | 515 | } |
517 | 516 | break; |
518 | 517 | |
519 | 518 | default: |
520 | - $value = isset( $payment->$column_name ) ? $payment->$column_name : ''; |
|
519 | + $value = isset($payment->$column_name) ? $payment->$column_name : ''; |
|
521 | 520 | break; |
522 | 521 | |
523 | 522 | }// End switch(). |
524 | 523 | |
525 | - return apply_filters( 'give_payments_table_column', $value, $payment->ID, $column_name ); |
|
524 | + return apply_filters('give_payments_table_column', $value, $payment->ID, $column_name); |
|
526 | 525 | } |
527 | 526 | |
528 | 527 | /** |
@@ -535,22 +534,22 @@ discard block |
||
535 | 534 | * |
536 | 535 | * @return string Data shown in the Email column |
537 | 536 | */ |
538 | - public function get_donor_email( $payment ) { |
|
537 | + public function get_donor_email($payment) { |
|
539 | 538 | |
540 | - $email = give_get_payment_user_email( $payment->ID ); |
|
539 | + $email = give_get_payment_user_email($payment->ID); |
|
541 | 540 | |
542 | - if ( empty( $email ) ) { |
|
543 | - $email = __( '(unknown)', 'give' ); |
|
541 | + if (empty($email)) { |
|
542 | + $email = __('(unknown)', 'give'); |
|
544 | 543 | } |
545 | 544 | |
546 | 545 | |
547 | - $value = Give()->tooltips->render_link( array( |
|
546 | + $value = Give()->tooltips->render_link(array( |
|
548 | 547 | 'link' => "mailto:{$email}", |
549 | - 'label' => __( 'Email donor', 'give' ), |
|
548 | + 'label' => __('Email donor', 'give'), |
|
550 | 549 | 'tag_content' => $email, |
551 | - ) ); |
|
550 | + )); |
|
552 | 551 | |
553 | - return apply_filters( 'give_payments_table_column', $value, $payment->ID, 'email' ); |
|
552 | + return apply_filters('give_payments_table_column', $value, $payment->ID, 'email'); |
|
554 | 553 | } |
555 | 554 | |
556 | 555 | /** |
@@ -562,18 +561,18 @@ discard block |
||
562 | 561 | * |
563 | 562 | * @return array $actions |
564 | 563 | */ |
565 | - function get_row_actions( $payment ) { |
|
564 | + function get_row_actions($payment) { |
|
566 | 565 | |
567 | 566 | $actions = array(); |
568 | - $email = give_get_payment_user_email( $payment->ID ); |
|
567 | + $email = give_get_payment_user_email($payment->ID); |
|
569 | 568 | |
570 | 569 | // Add search term string back to base URL. |
571 | - $search_terms = ( isset( $_GET['s'] ) ? trim( $_GET['s'] ) : '' ); |
|
572 | - if ( ! empty( $search_terms ) ) { |
|
573 | - $this->base_url = add_query_arg( 's', $search_terms, $this->base_url ); |
|
570 | + $search_terms = (isset($_GET['s']) ? trim($_GET['s']) : ''); |
|
571 | + if ( ! empty($search_terms)) { |
|
572 | + $this->base_url = add_query_arg('s', $search_terms, $this->base_url); |
|
574 | 573 | } |
575 | 574 | |
576 | - if ( give_is_payment_complete( $payment->ID ) && ! empty( $email ) ) { |
|
575 | + if (give_is_payment_complete($payment->ID) && ! empty($email)) { |
|
577 | 576 | |
578 | 577 | $actions['email_links'] = sprintf( |
579 | 578 | '<a class="resend-single-donation-receipt" href="%1$s" aria-label="%2$s">%3$s</a>', wp_nonce_url( |
@@ -583,12 +582,12 @@ discard block |
||
583 | 582 | 'purchase_id' => $payment->ID, |
584 | 583 | ), $this->base_url |
585 | 584 | ), 'give_payment_nonce' |
586 | - ), sprintf( __( 'Resend Donation %s Receipt', 'give' ), $payment->ID ), __( 'Resend Receipt', 'give' ) |
|
585 | + ), sprintf(__('Resend Donation %s Receipt', 'give'), $payment->ID), __('Resend Receipt', 'give') |
|
587 | 586 | ); |
588 | 587 | |
589 | 588 | } |
590 | 589 | |
591 | - if ( current_user_can( 'view_give_payments' ) ) { |
|
590 | + if (current_user_can('view_give_payments')) { |
|
592 | 591 | $actions['delete'] = sprintf( |
593 | 592 | '<a class="delete-single-donation" href="%1$s" aria-label="%2$s">%3$s</a>', |
594 | 593 | wp_nonce_url( |
@@ -598,11 +597,11 @@ discard block |
||
598 | 597 | 'purchase_id' => $payment->ID, |
599 | 598 | ), $this->base_url |
600 | 599 | ), 'give_donation_nonce' |
601 | - ), sprintf( __( 'Delete Donation %s', 'give' ), $payment->ID ), __( 'Delete', 'give' ) |
|
600 | + ), sprintf(__('Delete Donation %s', 'give'), $payment->ID), __('Delete', 'give') |
|
602 | 601 | ); |
603 | 602 | } |
604 | 603 | |
605 | - return apply_filters( 'give_payment_row_actions', $actions, $payment ); |
|
604 | + return apply_filters('give_payment_row_actions', $actions, $payment); |
|
606 | 605 | } |
607 | 606 | |
608 | 607 | |
@@ -616,30 +615,30 @@ discard block |
||
616 | 615 | * |
617 | 616 | * @return string Data shown in the Email column |
618 | 617 | */ |
619 | - function get_payment_status( $payment ) { |
|
618 | + function get_payment_status($payment) { |
|
620 | 619 | $value = sprintf( |
621 | 620 | '<div class="give-donation-status status-%1$s"><span class="give-donation-status-icon"></span> %2$s</div>', |
622 | - sanitize_title( give_get_payment_status( $payment, true ) ), |
|
623 | - give_get_payment_status( $payment, true ) |
|
621 | + sanitize_title(give_get_payment_status($payment, true)), |
|
622 | + give_get_payment_status($payment, true) |
|
624 | 623 | ); |
625 | 624 | |
626 | - if ( $payment->mode == 'test' ) { |
|
627 | - $value .= Give()->tooltips->render_span( array( |
|
628 | - 'label' => __( 'This donation was made in test mode.', 'give' ), |
|
629 | - 'tag_content' => __( 'Test', 'give' ), |
|
625 | + if ($payment->mode == 'test') { |
|
626 | + $value .= Give()->tooltips->render_span(array( |
|
627 | + 'label' => __('This donation was made in test mode.', 'give'), |
|
628 | + 'tag_content' => __('Test', 'give'), |
|
630 | 629 | 'attributes' => array( |
631 | 630 | 'class' => 'give-item-label give-item-label-orange give-test-mode-transactions-label', |
632 | 631 | ), |
633 | 632 | |
634 | 633 | |
635 | - ) ); |
|
634 | + )); |
|
636 | 635 | } |
637 | 636 | |
638 | - if ( true === $payment->import && true === (bool) apply_filters( 'give_payment_show_importer_label', false ) ) { |
|
637 | + if (true === $payment->import && true === (bool) apply_filters('give_payment_show_importer_label', false)) { |
|
639 | 638 | $value .= sprintf( |
640 | 639 | ' <span class="give-item-label give-item-label-orange give-test-mode-transactions-label" data-tooltip="%1$s">%2$s</span>', |
641 | - __( 'This donation was imported.', 'give' ), |
|
642 | - __( 'Import', 'give' ) |
|
640 | + __('This donation was imported.', 'give'), |
|
641 | + __('Import', 'give') |
|
643 | 642 | ); |
644 | 643 | } |
645 | 644 | |
@@ -656,8 +655,8 @@ discard block |
||
656 | 655 | * |
657 | 656 | * @return string Displays a checkbox. |
658 | 657 | */ |
659 | - public function column_cb( $payment ) { |
|
660 | - return sprintf( '<input type="checkbox" name="%1$s[]" value="%2$s" />', 'payment', $payment->ID ); |
|
658 | + public function column_cb($payment) { |
|
659 | + return sprintf('<input type="checkbox" name="%1$s[]" value="%2$s" />', 'payment', $payment->ID); |
|
661 | 660 | } |
662 | 661 | |
663 | 662 | /** |
@@ -670,8 +669,8 @@ discard block |
||
670 | 669 | * |
671 | 670 | * @return string Displays a checkbox. |
672 | 671 | */ |
673 | - public function get_payment_id( $payment ) { |
|
674 | - return '<span class="give-payment-id">' . give_get_payment_number( $payment->ID ) . '</span>'; |
|
672 | + public function get_payment_id($payment) { |
|
673 | + return '<span class="give-payment-id">'.give_get_payment_number($payment->ID).'</span>'; |
|
675 | 674 | } |
676 | 675 | |
677 | 676 | /** |
@@ -684,32 +683,32 @@ discard block |
||
684 | 683 | * |
685 | 684 | * @return string Data shown in the User column |
686 | 685 | */ |
687 | - public function get_donor( $payment ) { |
|
686 | + public function get_donor($payment) { |
|
688 | 687 | |
689 | - $donor_id = give_get_payment_donor_id( $payment->ID ); |
|
690 | - $donor_billing_name = give_get_donor_name_by( $payment->ID, 'donation' ); |
|
691 | - $donor_name = give_get_donor_name_by( $donor_id, 'donor' ); |
|
688 | + $donor_id = give_get_payment_donor_id($payment->ID); |
|
689 | + $donor_billing_name = give_get_donor_name_by($payment->ID, 'donation'); |
|
690 | + $donor_name = give_get_donor_name_by($donor_id, 'donor'); |
|
692 | 691 | |
693 | 692 | $value = ''; |
694 | - if ( ! empty( $donor_id ) ) { |
|
693 | + if ( ! empty($donor_id)) { |
|
695 | 694 | |
696 | 695 | // Check whether the donor name and WP_User name is same or not. |
697 | - if ( sanitize_title( $donor_billing_name ) !== sanitize_title( $donor_name ) ) { |
|
698 | - $value .= $donor_billing_name . ' ('; |
|
696 | + if (sanitize_title($donor_billing_name) !== sanitize_title($donor_name)) { |
|
697 | + $value .= $donor_billing_name.' ('; |
|
699 | 698 | } |
700 | 699 | |
701 | - $value .= '<a href="' . esc_url( admin_url( "edit.php?post_type=give_forms&page=give-donors&view=overview&id=$donor_id" ) ) . '">' . $donor_name . '</a>'; |
|
700 | + $value .= '<a href="'.esc_url(admin_url("edit.php?post_type=give_forms&page=give-donors&view=overview&id=$donor_id")).'">'.$donor_name.'</a>'; |
|
702 | 701 | |
703 | 702 | // Check whether the donor name and WP_User name is same or not. |
704 | - if ( sanitize_title( $donor_billing_name ) != sanitize_title( $donor_name ) ) { |
|
703 | + if (sanitize_title($donor_billing_name) != sanitize_title($donor_name)) { |
|
705 | 704 | $value .= ')'; |
706 | 705 | } |
707 | 706 | } else { |
708 | - $email = give_get_payment_user_email( $payment->ID ); |
|
709 | - $value .= '<a href="' . esc_url( admin_url( "edit.php?post_type=give_forms&page=give-payment-history&s=$email" ) ) . '">' . __( '(donor missing)', 'give' ) . '</a>'; |
|
707 | + $email = give_get_payment_user_email($payment->ID); |
|
708 | + $value .= '<a href="'.esc_url(admin_url("edit.php?post_type=give_forms&page=give-payment-history&s=$email")).'">'.__('(donor missing)', 'give').'</a>'; |
|
710 | 709 | } |
711 | 710 | |
712 | - return apply_filters( 'give_payments_table_column', $value, $payment->ID, 'donor' ); |
|
711 | + return apply_filters('give_payments_table_column', $value, $payment->ID, 'donor'); |
|
713 | 712 | } |
714 | 713 | |
715 | 714 | /** |
@@ -722,20 +721,20 @@ discard block |
||
722 | 721 | */ |
723 | 722 | public function get_bulk_actions() { |
724 | 723 | $actions = array( |
725 | - 'delete' => __( 'Delete', 'give' ), |
|
726 | - 'set-status-publish' => __( 'Set To Completed', 'give' ), |
|
727 | - 'set-status-pending' => __( 'Set To Pending', 'give' ), |
|
728 | - 'set-status-processing' => __( 'Set To Processing', 'give' ), |
|
729 | - 'set-status-refunded' => __( 'Set To Refunded', 'give' ), |
|
730 | - 'set-status-revoked' => __( 'Set To Revoked', 'give' ), |
|
731 | - 'set-status-failed' => __( 'Set To Failed', 'give' ), |
|
732 | - 'set-status-cancelled' => __( 'Set To Cancelled', 'give' ), |
|
733 | - 'set-status-abandoned' => __( 'Set To Abandoned', 'give' ), |
|
734 | - 'set-status-preapproval' => __( 'Set To Preapproval', 'give' ), |
|
735 | - 'resend-receipt' => __( 'Resend Email Receipts', 'give' ), |
|
724 | + 'delete' => __('Delete', 'give'), |
|
725 | + 'set-status-publish' => __('Set To Completed', 'give'), |
|
726 | + 'set-status-pending' => __('Set To Pending', 'give'), |
|
727 | + 'set-status-processing' => __('Set To Processing', 'give'), |
|
728 | + 'set-status-refunded' => __('Set To Refunded', 'give'), |
|
729 | + 'set-status-revoked' => __('Set To Revoked', 'give'), |
|
730 | + 'set-status-failed' => __('Set To Failed', 'give'), |
|
731 | + 'set-status-cancelled' => __('Set To Cancelled', 'give'), |
|
732 | + 'set-status-abandoned' => __('Set To Abandoned', 'give'), |
|
733 | + 'set-status-preapproval' => __('Set To Preapproval', 'give'), |
|
734 | + 'resend-receipt' => __('Resend Email Receipts', 'give'), |
|
736 | 735 | ); |
737 | 736 | |
738 | - return apply_filters( 'give_payments_table_bulk_actions', $actions ); |
|
737 | + return apply_filters('give_payments_table_bulk_actions', $actions); |
|
739 | 738 | } |
740 | 739 | |
741 | 740 | /** |
@@ -747,59 +746,59 @@ discard block |
||
747 | 746 | * @return void |
748 | 747 | */ |
749 | 748 | public function process_bulk_action() { |
750 | - $ids = isset( $_GET['payment'] ) ? $_GET['payment'] : false; |
|
749 | + $ids = isset($_GET['payment']) ? $_GET['payment'] : false; |
|
751 | 750 | $action = $this->current_action(); |
752 | 751 | |
753 | - if ( ! is_array( $ids ) ) { |
|
754 | - $ids = array( $ids ); |
|
752 | + if ( ! is_array($ids)) { |
|
753 | + $ids = array($ids); |
|
755 | 754 | } |
756 | 755 | |
757 | - if ( empty( $action ) ) { |
|
756 | + if (empty($action)) { |
|
758 | 757 | return; |
759 | 758 | } |
760 | 759 | |
761 | - foreach ( $ids as $id ) { |
|
760 | + foreach ($ids as $id) { |
|
762 | 761 | |
763 | 762 | // Detect when a bulk action is being triggered. |
764 | - switch ( $this->current_action() ) { |
|
763 | + switch ($this->current_action()) { |
|
765 | 764 | |
766 | 765 | case 'delete': |
767 | - give_delete_donation( $id ); |
|
766 | + give_delete_donation($id); |
|
768 | 767 | break; |
769 | 768 | |
770 | 769 | case 'set-status-publish': |
771 | - give_update_payment_status( $id, 'publish' ); |
|
770 | + give_update_payment_status($id, 'publish'); |
|
772 | 771 | break; |
773 | 772 | |
774 | 773 | case 'set-status-pending': |
775 | - give_update_payment_status( $id, 'pending' ); |
|
774 | + give_update_payment_status($id, 'pending'); |
|
776 | 775 | break; |
777 | 776 | |
778 | 777 | case 'set-status-processing': |
779 | - give_update_payment_status( $id, 'processing' ); |
|
778 | + give_update_payment_status($id, 'processing'); |
|
780 | 779 | break; |
781 | 780 | |
782 | 781 | case 'set-status-refunded': |
783 | - give_update_payment_status( $id, 'refunded' ); |
|
782 | + give_update_payment_status($id, 'refunded'); |
|
784 | 783 | break; |
785 | 784 | case 'set-status-revoked': |
786 | - give_update_payment_status( $id, 'revoked' ); |
|
785 | + give_update_payment_status($id, 'revoked'); |
|
787 | 786 | break; |
788 | 787 | |
789 | 788 | case 'set-status-failed': |
790 | - give_update_payment_status( $id, 'failed' ); |
|
789 | + give_update_payment_status($id, 'failed'); |
|
791 | 790 | break; |
792 | 791 | |
793 | 792 | case 'set-status-cancelled': |
794 | - give_update_payment_status( $id, 'cancelled' ); |
|
793 | + give_update_payment_status($id, 'cancelled'); |
|
795 | 794 | break; |
796 | 795 | |
797 | 796 | case 'set-status-abandoned': |
798 | - give_update_payment_status( $id, 'abandoned' ); |
|
797 | + give_update_payment_status($id, 'abandoned'); |
|
799 | 798 | break; |
800 | 799 | |
801 | 800 | case 'set-status-preapproval': |
802 | - give_update_payment_status( $id, 'preapproval' ); |
|
801 | + give_update_payment_status($id, 'preapproval'); |
|
803 | 802 | break; |
804 | 803 | |
805 | 804 | case 'resend-receipt': |
@@ -808,7 +807,7 @@ discard block |
||
808 | 807 | * |
809 | 808 | * @since 2.0 |
810 | 809 | */ |
811 | - do_action( 'give_donation-receipt_email_notification', $id ); |
|
810 | + do_action('give_donation-receipt_email_notification', $id); |
|
812 | 811 | break; |
813 | 812 | }// End switch(). |
814 | 813 | |
@@ -820,7 +819,7 @@ discard block |
||
820 | 819 | * |
821 | 820 | * @since 1.7 |
822 | 821 | */ |
823 | - do_action( 'give_payments_table_do_bulk_action', $id, $this->current_action() ); |
|
822 | + do_action('give_payments_table_do_bulk_action', $id, $this->current_action()); |
|
824 | 823 | }// End foreach(). |
825 | 824 | |
826 | 825 | } |
@@ -837,32 +836,32 @@ discard block |
||
837 | 836 | |
838 | 837 | $args = array(); |
839 | 838 | |
840 | - if ( isset( $_GET['user'] ) ) { |
|
841 | - $args['user'] = urldecode( $_GET['user'] ); |
|
842 | - } elseif ( isset( $_GET['donor'] ) ) { |
|
843 | - $args['donor'] = absint( $_GET['donor'] ); |
|
844 | - } elseif ( isset( $_GET['s'] ) ) { |
|
845 | - $is_user = strpos( $_GET['s'], strtolower( 'user:' ) ) !== false; |
|
846 | - if ( $is_user ) { |
|
847 | - $args['user'] = absint( trim( str_replace( 'user:', '', strtolower( $_GET['s'] ) ) ) ); |
|
848 | - unset( $args['s'] ); |
|
839 | + if (isset($_GET['user'])) { |
|
840 | + $args['user'] = urldecode($_GET['user']); |
|
841 | + } elseif (isset($_GET['donor'])) { |
|
842 | + $args['donor'] = absint($_GET['donor']); |
|
843 | + } elseif (isset($_GET['s'])) { |
|
844 | + $is_user = strpos($_GET['s'], strtolower('user:')) !== false; |
|
845 | + if ($is_user) { |
|
846 | + $args['user'] = absint(trim(str_replace('user:', '', strtolower($_GET['s'])))); |
|
847 | + unset($args['s']); |
|
849 | 848 | } else { |
850 | - $args['s'] = sanitize_text_field( $_GET['s'] ); |
|
849 | + $args['s'] = sanitize_text_field($_GET['s']); |
|
851 | 850 | } |
852 | 851 | } |
853 | 852 | |
854 | - if ( ! empty( $_GET['start-date'] ) ) { |
|
855 | - $args['start-date'] = urldecode( $_GET['start-date'] ); |
|
853 | + if ( ! empty($_GET['start-date'])) { |
|
854 | + $args['start-date'] = urldecode($_GET['start-date']); |
|
856 | 855 | } |
857 | 856 | |
858 | - if ( ! empty( $_GET['end-date'] ) ) { |
|
859 | - $args['end-date'] = urldecode( $_GET['end-date'] ); |
|
857 | + if ( ! empty($_GET['end-date'])) { |
|
858 | + $args['end-date'] = urldecode($_GET['end-date']); |
|
860 | 859 | } |
861 | 860 | |
862 | - $args['form_id'] = ! empty( $_GET['form_id'] ) ? absint( $_GET['form_id'] ) : null; |
|
863 | - $args['gateway'] = ! empty( $_GET['gateway'] ) ? give_clean( $_GET['gateway'] ) : null; |
|
861 | + $args['form_id'] = ! empty($_GET['form_id']) ? absint($_GET['form_id']) : null; |
|
862 | + $args['gateway'] = ! empty($_GET['gateway']) ? give_clean($_GET['gateway']) : null; |
|
864 | 863 | |
865 | - $payment_count = give_count_payments( $args ); |
|
864 | + $payment_count = give_count_payments($args); |
|
866 | 865 | $this->complete_count = $payment_count->publish; |
867 | 866 | $this->pending_count = $payment_count->pending; |
868 | 867 | $this->processing_count = $payment_count->processing; |
@@ -873,7 +872,7 @@ discard block |
||
873 | 872 | $this->abandoned_count = $payment_count->abandoned; |
874 | 873 | $this->preapproval_count = $payment_count->preapproval; |
875 | 874 | |
876 | - foreach ( $payment_count as $count ) { |
|
875 | + foreach ($payment_count as $count) { |
|
877 | 876 | $this->total_count += $count; |
878 | 877 | } |
879 | 878 | |
@@ -891,25 +890,25 @@ discard block |
||
891 | 890 | public function payments_data() { |
892 | 891 | |
893 | 892 | $per_page = $this->per_page; |
894 | - $orderby = isset( $_GET['orderby'] ) ? urldecode( $_GET['orderby'] ) : 'ID'; |
|
895 | - $order = isset( $_GET['order'] ) ? $_GET['order'] : 'DESC'; |
|
896 | - $user = isset( $_GET['user'] ) ? $_GET['user'] : null; |
|
897 | - $donor = isset( $_GET['donor'] ) ? $_GET['donor'] : null; |
|
898 | - $status = isset( $_GET['status'] ) ? $_GET['status'] : give_get_payment_status_keys(); |
|
899 | - $meta_key = isset( $_GET['meta_key'] ) ? $_GET['meta_key'] : null; |
|
900 | - $year = isset( $_GET['year'] ) ? $_GET['year'] : null; |
|
901 | - $month = isset( $_GET['m'] ) ? $_GET['m'] : null; |
|
902 | - $day = isset( $_GET['day'] ) ? $_GET['day'] : null; |
|
903 | - $search = isset( $_GET['s'] ) ? sanitize_text_field( $_GET['s'] ) : null; |
|
904 | - $start_date = isset( $_GET['start-date'] ) ? sanitize_text_field( $_GET['start-date'] ) : null; |
|
905 | - $end_date = isset( $_GET['end-date'] ) ? sanitize_text_field( $_GET['end-date'] ) : $start_date; |
|
906 | - $form_id = ! empty( $_GET['form_id'] ) ? absint( $_GET['form_id'] ) : null; |
|
907 | - $gateway = ! empty( $_GET['gateway'] ) ? give_clean( $_GET['gateway'] ) : null; |
|
893 | + $orderby = isset($_GET['orderby']) ? urldecode($_GET['orderby']) : 'ID'; |
|
894 | + $order = isset($_GET['order']) ? $_GET['order'] : 'DESC'; |
|
895 | + $user = isset($_GET['user']) ? $_GET['user'] : null; |
|
896 | + $donor = isset($_GET['donor']) ? $_GET['donor'] : null; |
|
897 | + $status = isset($_GET['status']) ? $_GET['status'] : give_get_payment_status_keys(); |
|
898 | + $meta_key = isset($_GET['meta_key']) ? $_GET['meta_key'] : null; |
|
899 | + $year = isset($_GET['year']) ? $_GET['year'] : null; |
|
900 | + $month = isset($_GET['m']) ? $_GET['m'] : null; |
|
901 | + $day = isset($_GET['day']) ? $_GET['day'] : null; |
|
902 | + $search = isset($_GET['s']) ? sanitize_text_field($_GET['s']) : null; |
|
903 | + $start_date = isset($_GET['start-date']) ? sanitize_text_field($_GET['start-date']) : null; |
|
904 | + $end_date = isset($_GET['end-date']) ? sanitize_text_field($_GET['end-date']) : $start_date; |
|
905 | + $form_id = ! empty($_GET['form_id']) ? absint($_GET['form_id']) : null; |
|
906 | + $gateway = ! empty($_GET['gateway']) ? give_clean($_GET['gateway']) : null; |
|
908 | 907 | |
909 | 908 | $args = array( |
910 | 909 | 'output' => 'payments', |
911 | 910 | 'number' => $per_page, |
912 | - 'page' => isset( $_GET['paged'] ) ? $_GET['paged'] : null, |
|
911 | + 'page' => isset($_GET['paged']) ? $_GET['paged'] : null, |
|
913 | 912 | 'orderby' => $orderby, |
914 | 913 | 'order' => $order, |
915 | 914 | 'user' => $user, |
@@ -926,9 +925,9 @@ discard block |
||
926 | 925 | 'give_forms' => $form_id, |
927 | 926 | ); |
928 | 927 | |
929 | - if ( is_string( $search ) && false !== strpos( $search, 'txn:' ) ) { |
|
928 | + if (is_string($search) && false !== strpos($search, 'txn:')) { |
|
930 | 929 | $args['search_in_notes'] = true; |
931 | - $args['s'] = trim( str_replace( 'txn:', '', $args['s'] ) ); |
|
930 | + $args['s'] = trim(str_replace('txn:', '', $args['s'])); |
|
932 | 931 | } |
933 | 932 | |
934 | 933 | /** |
@@ -936,9 +935,9 @@ discard block |
||
936 | 935 | * |
937 | 936 | * @since 1.8.18 |
938 | 937 | */ |
939 | - $args = (array) apply_filters( 'give_payment_table_payments_query', $args ); |
|
938 | + $args = (array) apply_filters('give_payment_table_payments_query', $args); |
|
940 | 939 | |
941 | - $p_query = new Give_Payments_Query( $args ); |
|
940 | + $p_query = new Give_Payments_Query($args); |
|
942 | 941 | |
943 | 942 | return $p_query->get_payments(); |
944 | 943 | |
@@ -959,17 +958,17 @@ discard block |
||
959 | 958 | */ |
960 | 959 | public function prepare_items() { |
961 | 960 | |
962 | - wp_reset_vars( array( 'action', 'payment', 'orderby', 'order', 's' ) ); |
|
961 | + wp_reset_vars(array('action', 'payment', 'orderby', 'order', 's')); |
|
963 | 962 | |
964 | 963 | $columns = $this->get_columns(); |
965 | 964 | $hidden = array(); // No hidden columns. |
966 | 965 | $sortable = $this->get_sortable_columns(); |
967 | 966 | $data = $this->payments_data(); |
968 | - $status = isset( $_GET['status'] ) ? $_GET['status'] : 'any'; |
|
967 | + $status = isset($_GET['status']) ? $_GET['status'] : 'any'; |
|
969 | 968 | |
970 | - $this->_column_headers = array( $columns, $hidden, $sortable ); |
|
969 | + $this->_column_headers = array($columns, $hidden, $sortable); |
|
971 | 970 | |
972 | - switch ( $status ) { |
|
971 | + switch ($status) { |
|
973 | 972 | case 'publish': |
974 | 973 | $total_items = $this->complete_count; |
975 | 974 | break; |
@@ -1002,8 +1001,8 @@ discard block |
||
1002 | 1001 | break; |
1003 | 1002 | default: |
1004 | 1003 | // Retrieve the count of the non-default-Give status. |
1005 | - $count = wp_count_posts( 'give_payment' ); |
|
1006 | - $total_items = isset( $count->{$status} ) ? $count->{$status} : 0; |
|
1004 | + $count = wp_count_posts('give_payment'); |
|
1005 | + $total_items = isset($count->{$status} ) ? $count->{$status} : 0; |
|
1007 | 1006 | break; |
1008 | 1007 | } |
1009 | 1008 | |
@@ -1014,7 +1013,7 @@ discard block |
||
1014 | 1013 | * |
1015 | 1014 | * @since 1.8.19 |
1016 | 1015 | */ |
1017 | - $total_items = (int) apply_filters( 'give_payment_table_pagination_total_count', $total_items, $this ); |
|
1016 | + $total_items = (int) apply_filters('give_payment_table_pagination_total_count', $total_items, $this); |
|
1018 | 1017 | |
1019 | 1018 | $this->set_pagination_args( |
1020 | 1019 | array( |
@@ -1022,7 +1021,7 @@ discard block |
||
1022 | 1021 | // We have to calculate the total number of items. |
1023 | 1022 | 'per_page' => $this->per_page, |
1024 | 1023 | // We have to determine how many items to show on a page. |
1025 | - 'total_pages' => ceil( $total_items / $this->per_page ), |
|
1024 | + 'total_pages' => ceil($total_items / $this->per_page), |
|
1026 | 1025 | // We have to calculate the total number of pages. |
1027 | 1026 | ) |
1028 | 1027 | ); |