@@ -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,60 +106,60 @@ 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', 'give' ); ?>:</td> |
|
141 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'The table prefix used in your WordPress database.', 'give' ) ); ?></td> |
|
142 | - <td><?php echo esc_html( $wpdb->prefix ); ?></td> |
|
140 | + <td data-export-label="Table Prefix Length"><?php _e('Table Prefix', 'give'); ?>:</td> |
|
141 | + <td class="help"><?php echo Give()->tooltips->render_help(__('The table prefix used in your WordPress database.', 'give')); ?></td> |
|
142 | + <td><?php echo esc_html($wpdb->prefix); ?></td> |
|
143 | 143 | </tr> |
144 | 144 | <tr> |
145 | - <td data-export-label="Table Prefix Length"><?php _e( 'Table Prefix Length', 'give' ); ?>:</td> |
|
146 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'The length of the table prefix used in your WordPress database.', 'give' ) ); ?></td> |
|
147 | - <td><?php echo esc_html( strlen( $wpdb->prefix ) ); ?></td> |
|
145 | + <td data-export-label="Table Prefix Length"><?php _e('Table Prefix Length', 'give'); ?>:</td> |
|
146 | + <td class="help"><?php echo Give()->tooltips->render_help(__('The length of the table prefix used in your WordPress database.', 'give')); ?></td> |
|
147 | + <td><?php echo esc_html(strlen($wpdb->prefix)); ?></td> |
|
148 | 148 | </tr> |
149 | 149 | <tr> |
150 | - <td data-export-label="Table Prefix Status"><?php _e( 'Table Prefix Status', 'give' ); ?>:</td> |
|
151 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'The status of the table prefix used in your WordPress database.', 'give' ) ); ?></td> |
|
152 | - <td><?php echo strlen( $wpdb->prefix ) > 16 ? esc_html( 'Error: Too long', 'give' ) : esc_html( 'Acceptable', 'give' ); ?></td> |
|
150 | + <td data-export-label="Table Prefix Status"><?php _e('Table Prefix Status', 'give'); ?>:</td> |
|
151 | + <td class="help"><?php echo Give()->tooltips->render_help(__('The status of the table prefix used in your WordPress database.', 'give')); ?></td> |
|
152 | + <td><?php echo strlen($wpdb->prefix) > 16 ? esc_html('Error: Too long', 'give') : esc_html('Acceptable', 'give'); ?></td> |
|
153 | 153 | </tr> |
154 | 154 | <tr> |
155 | - <td data-export-label="Admin AJAX"><?php _e( 'Admin AJAX', 'give' ); ?>:</td> |
|
156 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'Whether Admin AJAX is accessible.', 'give' ) ); ?></td> |
|
157 | - <td><?php echo give_test_ajax_works() ? __( 'Accessible', 'give' ) : __( 'Inaccessible', 'give' ); ?></td> |
|
155 | + <td data-export-label="Admin AJAX"><?php _e('Admin AJAX', 'give'); ?>:</td> |
|
156 | + <td class="help"><?php echo Give()->tooltips->render_help(__('Whether Admin AJAX is accessible.', 'give')); ?></td> |
|
157 | + <td><?php echo give_test_ajax_works() ? __('Accessible', 'give') : __('Inaccessible', 'give'); ?></td> |
|
158 | 158 | </tr> |
159 | 159 | <tr> |
160 | - <td data-export-label="Registered Post Statuses"><?php _e( 'Registered Post Statuses', 'give' ); ?>:</td> |
|
161 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'A list of all registered post statuses.', 'give' ) ); ?></td> |
|
162 | - <td><?php echo esc_html( implode( ', ', get_post_stati() ) ); ?></td> |
|
160 | + <td data-export-label="Registered Post Statuses"><?php _e('Registered Post Statuses', 'give'); ?>:</td> |
|
161 | + <td class="help"><?php echo Give()->tooltips->render_help(__('A list of all registered post statuses.', 'give')); ?></td> |
|
162 | + <td><?php echo esc_html(implode(', ', get_post_stati())); ?></td> |
|
163 | 163 | </tr> |
164 | 164 | </tbody> |
165 | 165 | </table> |
@@ -167,97 +167,97 @@ discard block |
||
167 | 167 | <table class="give-status-table widefat" cellspacing="0"> |
168 | 168 | <thead> |
169 | 169 | <tr> |
170 | - <th colspan="3" data-export-label="Server Environment"><h2><?php _e( 'Server Environment', 'give' ); ?></h2></th> |
|
170 | + <th colspan="3" data-export-label="Server Environment"><h2><?php _e('Server Environment', 'give'); ?></h2></th> |
|
171 | 171 | </tr> |
172 | 172 | </thead> |
173 | 173 | <tbody> |
174 | 174 | <tr> |
175 | - <td data-export-label="Hosting Provider"><?php _e( 'Hosting Provider', 'give' ); ?>:</td> |
|
176 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'The hosting provider for this WordPress installation.', 'give' ) ); ?></td> |
|
177 | - <td><?php echo give_get_host() ? esc_html( give_get_host() ) : __( 'Unknown', 'give' ); ?></td> |
|
175 | + <td data-export-label="Hosting Provider"><?php _e('Hosting Provider', 'give'); ?>:</td> |
|
176 | + <td class="help"><?php echo Give()->tooltips->render_help(__('The hosting provider for this WordPress installation.', 'give')); ?></td> |
|
177 | + <td><?php echo give_get_host() ? esc_html(give_get_host()) : __('Unknown', 'give'); ?></td> |
|
178 | 178 | </tr> |
179 | 179 | <tr> |
180 | - <td data-export-label="TLS Connection"><?php _e( 'TLS Connection', 'give' ); ?>:</td> |
|
181 | - <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> |
|
180 | + <td data-export-label="TLS Connection"><?php _e('TLS Connection', 'give'); ?>:</td> |
|
181 | + <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> |
|
182 | 182 | <td> |
183 | 183 | <?php |
184 | - $tls_check = wp_remote_post( 'https://www.howsmyssl.com/a/check' ); |
|
185 | - if ( ! is_wp_error( $tls_check ) ) { |
|
186 | - $tls_check = json_decode( wp_remote_retrieve_body( $tls_check ) ); |
|
184 | + $tls_check = wp_remote_post('https://www.howsmyssl.com/a/check'); |
|
185 | + if ( ! is_wp_error($tls_check)) { |
|
186 | + $tls_check = json_decode(wp_remote_retrieve_body($tls_check)); |
|
187 | 187 | /* translators: %s: SSL connection response */ |
188 | - printf( __('Connection uses %s', 'give'), esc_html( $tls_check->tls_version )) ; |
|
188 | + printf(__('Connection uses %s', 'give'), esc_html($tls_check->tls_version)); |
|
189 | 189 | } |
190 | 190 | ?> |
191 | 191 | </td> |
192 | 192 | </tr> |
193 | 193 | <tr> |
194 | - <td data-export-label="TLS Connection"><?php _e( 'TLS Rating', 'give' ); ?>:</td> |
|
195 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'The server\'s connection as rated by https://www.howsmyssl.com/', 'give' ) ); ?></td> |
|
194 | + <td data-export-label="TLS Connection"><?php _e('TLS Rating', 'give'); ?>:</td> |
|
195 | + <td class="help"><?php echo Give()->tooltips->render_help(__('The server\'s connection as rated by https://www.howsmyssl.com/', 'give')); ?></td> |
|
196 | 196 | <td> |
197 | 197 | <?php |
198 | - if ( ! is_wp_error( $tls_check ) ) { |
|
199 | - esc_html_e( $tls_check->rating); |
|
198 | + if ( ! is_wp_error($tls_check)) { |
|
199 | + esc_html_e($tls_check->rating); |
|
200 | 200 | } |
201 | 201 | ?> |
202 | 202 | </td> |
203 | 203 | </tr> |
204 | 204 | <tr> |
205 | - <td data-export-label="Server Info"><?php _e( 'Server Info', 'give' ); ?>:</td> |
|
206 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'Information about the web server that is currently hosting your site.', 'give' ) ); ?></td> |
|
207 | - <td><?php echo esc_html( $_SERVER['SERVER_SOFTWARE'] ); ?></td> |
|
205 | + <td data-export-label="Server Info"><?php _e('Server Info', 'give'); ?>:</td> |
|
206 | + <td class="help"><?php echo Give()->tooltips->render_help(__('Information about the web server that is currently hosting your site.', 'give')); ?></td> |
|
207 | + <td><?php echo esc_html($_SERVER['SERVER_SOFTWARE']); ?></td> |
|
208 | 208 | </tr> |
209 | 209 | <tr> |
210 | - <td data-export-label="PHP Version"><?php _e( 'PHP Version', 'give' ); ?>:</td> |
|
211 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'The version of PHP installed on your hosting server.', 'give' ) ); ?></td> |
|
210 | + <td data-export-label="PHP Version"><?php _e('PHP Version', 'give'); ?>:</td> |
|
211 | + <td class="help"><?php echo Give()->tooltips->render_help(__('The version of PHP installed on your hosting server.', 'give')); ?></td> |
|
212 | 212 | <td> |
213 | 213 | <?php |
214 | 214 | // Check if phpversion function exists. |
215 | - if ( function_exists( 'phpversion' ) ) { |
|
215 | + if (function_exists('phpversion')) { |
|
216 | 216 | $php_version = phpversion(); |
217 | 217 | |
218 | - if ( version_compare( $php_version, '5.6', '<' ) ) { |
|
219 | - 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>'; |
|
218 | + if (version_compare($php_version, '5.6', '<')) { |
|
219 | + 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>'; |
|
220 | 220 | } else { |
221 | - echo '<mark class="yes">' . esc_html( $php_version ) . '</mark>'; |
|
221 | + echo '<mark class="yes">'.esc_html($php_version).'</mark>'; |
|
222 | 222 | } |
223 | 223 | } else { |
224 | - _e( "Couldn't determine PHP version because phpversion() doesn't exist.", 'give' ); |
|
224 | + _e("Couldn't determine PHP version because phpversion() doesn't exist.", 'give'); |
|
225 | 225 | } |
226 | 226 | ?></td> |
227 | 227 | </tr> |
228 | - <?php if ( function_exists( 'ini_get' ) ) : ?> |
|
228 | + <?php if (function_exists('ini_get')) : ?> |
|
229 | 229 | <tr> |
230 | - <td data-export-label="PHP Post Max Size"><?php _e( 'PHP Post Max Size', 'give' ); ?>:</td> |
|
231 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'The largest filesize that can be contained in one post.', 'give' ) ); ?></td> |
|
232 | - <td><?php echo size_format( give_let_to_num( ini_get( 'post_max_size' ) ) ); ?></td> |
|
230 | + <td data-export-label="PHP Post Max Size"><?php _e('PHP Post Max Size', 'give'); ?>:</td> |
|
231 | + <td class="help"><?php echo Give()->tooltips->render_help(__('The largest filesize that can be contained in one post.', 'give')); ?></td> |
|
232 | + <td><?php echo size_format(give_let_to_num(ini_get('post_max_size'))); ?></td> |
|
233 | 233 | </tr> |
234 | 234 | <tr> |
235 | - <td data-export-label="PHP Time Limit"><?php _e( 'PHP Time Limit', 'give' ); ?>:</td> |
|
236 | - <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> |
|
237 | - <td><?php echo ini_get( 'max_execution_time' ); ?></td> |
|
235 | + <td data-export-label="PHP Time Limit"><?php _e('PHP Time Limit', 'give'); ?>:</td> |
|
236 | + <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> |
|
237 | + <td><?php echo ini_get('max_execution_time'); ?></td> |
|
238 | 238 | </tr> |
239 | 239 | <tr> |
240 | - <td data-export-label="PHP Max Input Vars"><?php _e( 'PHP Max Input Vars', 'give' ); ?>:</td> |
|
241 | - <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> |
|
242 | - <td><?php echo ini_get( 'max_input_vars' ); ?></td> |
|
240 | + <td data-export-label="PHP Max Input Vars"><?php _e('PHP Max Input Vars', 'give'); ?>:</td> |
|
241 | + <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> |
|
242 | + <td><?php echo ini_get('max_input_vars'); ?></td> |
|
243 | 243 | </tr> |
244 | 244 | <tr> |
245 | - <td data-export-label="PHP Max Upload Size"><?php _e( 'PHP Max Upload Size', 'give' ); ?>:</td> |
|
246 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'The largest filesize that can be uploaded to your WordPress installation.', 'give' ) ); ?></td> |
|
247 | - <td><?php echo size_format( wp_max_upload_size() ); ?></td> |
|
245 | + <td data-export-label="PHP Max Upload Size"><?php _e('PHP Max Upload Size', 'give'); ?>:</td> |
|
246 | + <td class="help"><?php echo Give()->tooltips->render_help(__('The largest filesize that can be uploaded to your WordPress installation.', 'give')); ?></td> |
|
247 | + <td><?php echo size_format(wp_max_upload_size()); ?></td> |
|
248 | 248 | </tr> |
249 | 249 | <tr> |
250 | - <td data-export-label="cURL Version"><?php _e( 'cURL Version', 'give' ); ?>:</td> |
|
251 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'The version of cURL installed on your server.', 'give' ) ); ?></td> |
|
250 | + <td data-export-label="cURL Version"><?php _e('cURL Version', 'give'); ?>:</td> |
|
251 | + <td class="help"><?php echo Give()->tooltips->render_help(__('The version of cURL installed on your server.', 'give')); ?></td> |
|
252 | 252 | <td> |
253 | 253 | <?php |
254 | - if ( function_exists( 'curl_version' ) ) { |
|
254 | + if (function_exists('curl_version')) { |
|
255 | 255 | $curl_version = curl_version(); |
256 | 256 | |
257 | - if ( version_compare( $curl_version['version'], '7.40', '<' ) ) { |
|
258 | - 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>'; |
|
257 | + if (version_compare($curl_version['version'], '7.40', '<')) { |
|
258 | + 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>'; |
|
259 | 259 | } else { |
260 | - echo '<mark class="yes">' . esc_html( $curl_version['version'] . ', ' . $curl_version['ssl_version'] ) . '</mark>'; |
|
260 | + echo '<mark class="yes">'.esc_html($curl_version['version'].', '.$curl_version['ssl_version']).'</mark>'; |
|
261 | 261 | } |
262 | 262 | } else { |
263 | 263 | echo '&ndash'; |
@@ -266,42 +266,42 @@ discard block |
||
266 | 266 | </td> |
267 | 267 | </tr> |
268 | 268 | <tr> |
269 | - <td data-export-label="SUHOSIN Installed"><?php _e( 'SUHOSIN Installed', 'give' ); ?>:</td> |
|
270 | - <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> |
|
271 | - <td><?php echo extension_loaded( 'suhosin' ) ? '<span class="dashicons dashicons-yes"></span>' : '–'; ?></td> |
|
269 | + <td data-export-label="SUHOSIN Installed"><?php _e('SUHOSIN Installed', 'give'); ?>:</td> |
|
270 | + <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> |
|
271 | + <td><?php echo extension_loaded('suhosin') ? '<span class="dashicons dashicons-yes"></span>' : '–'; ?></td> |
|
272 | 272 | </tr> |
273 | 273 | <?php endif; |
274 | 274 | |
275 | - if ( $wpdb->use_mysqli ) { |
|
276 | - $ver = mysqli_get_server_info( $wpdb->dbh ); |
|
275 | + if ($wpdb->use_mysqli) { |
|
276 | + $ver = mysqli_get_server_info($wpdb->dbh); |
|
277 | 277 | } else { |
278 | 278 | $ver = mysql_get_server_info(); |
279 | 279 | } |
280 | 280 | |
281 | - if ( ! empty( $wpdb->is_mysql ) && ! stristr( $ver, 'MariaDB' ) ) : ?> |
|
281 | + if ( ! empty($wpdb->is_mysql) && ! stristr($ver, 'MariaDB')) : ?> |
|
282 | 282 | <tr> |
283 | - <td data-export-label="MySQL Version"><?php _e( 'MySQL Version', 'give' ); ?>:</td> |
|
284 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'The version of MySQL installed on your hosting server.', 'give' ) ); ?></td> |
|
283 | + <td data-export-label="MySQL Version"><?php _e('MySQL Version', 'give'); ?>:</td> |
|
284 | + <td class="help"><?php echo Give()->tooltips->render_help(__('The version of MySQL installed on your hosting server.', 'give')); ?></td> |
|
285 | 285 | <td> |
286 | 286 | <?php |
287 | 287 | $mysql_version = $wpdb->db_version(); |
288 | 288 | |
289 | - if ( version_compare( $mysql_version, '5.6', '<' ) ) { |
|
290 | - 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>'; |
|
289 | + if (version_compare($mysql_version, '5.6', '<')) { |
|
290 | + 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>'; |
|
291 | 291 | } else { |
292 | - echo '<mark class="yes">' . esc_html( $mysql_version ) . '</mark>'; |
|
292 | + echo '<mark class="yes">'.esc_html($mysql_version).'</mark>'; |
|
293 | 293 | } |
294 | 294 | ?> |
295 | 295 | </td> |
296 | 296 | </tr> |
297 | 297 | <?php endif; ?> |
298 | 298 | <tr> |
299 | - <td data-export-label="Default Timezone is UTC"><?php _e( 'Default Timezone is UTC', 'give' ); ?>:</td> |
|
300 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'The default timezone for your server.', 'give' ) ); ?></td> |
|
299 | + <td data-export-label="Default Timezone is UTC"><?php _e('Default Timezone is UTC', 'give'); ?>:</td> |
|
300 | + <td class="help"><?php echo Give()->tooltips->render_help(__('The default timezone for your server.', 'give')); ?></td> |
|
301 | 301 | <td><?php |
302 | 302 | $default_timezone = date_default_timezone_get(); |
303 | - if ( 'UTC' !== $default_timezone ) { |
|
304 | - echo '<mark class="error"><span class="dashicons dashicons-warning"></span> ' . sprintf( __( 'Default timezone is %s - it should be UTC', 'give' ), $default_timezone ) . '</mark>'; |
|
303 | + if ('UTC' !== $default_timezone) { |
|
304 | + echo '<mark class="error"><span class="dashicons dashicons-warning"></span> '.sprintf(__('Default timezone is %s - it should be UTC', 'give'), $default_timezone).'</mark>'; |
|
305 | 305 | } else { |
306 | 306 | echo '<mark class="yes"><span class="dashicons dashicons-yes"></span></mark>'; |
307 | 307 | } ?> |
@@ -312,119 +312,119 @@ discard block |
||
312 | 312 | |
313 | 313 | // fsockopen/cURL. |
314 | 314 | $posting['fsockopen_curl']['name'] = 'fsockopen/cURL'; |
315 | - $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' ); |
|
315 | + $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'); |
|
316 | 316 | |
317 | - if ( function_exists( 'fsockopen' ) || function_exists( 'curl_init' ) ) { |
|
317 | + if (function_exists('fsockopen') || function_exists('curl_init')) { |
|
318 | 318 | $posting['fsockopen_curl']['success'] = true; |
319 | 319 | } else { |
320 | 320 | $posting['fsockopen_curl']['success'] = false; |
321 | - $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' ); |
|
321 | + $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'); |
|
322 | 322 | } |
323 | 323 | |
324 | 324 | // SOAP. |
325 | 325 | $posting['soap_client']['name'] = 'SoapClient'; |
326 | - $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' ); |
|
326 | + $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'); |
|
327 | 327 | |
328 | - if ( class_exists( 'SoapClient' ) ) { |
|
328 | + if (class_exists('SoapClient')) { |
|
329 | 329 | $posting['soap_client']['success'] = true; |
330 | 330 | } else { |
331 | 331 | $posting['soap_client']['success'] = false; |
332 | - $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>' ); |
|
332 | + $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>'); |
|
333 | 333 | } |
334 | 334 | |
335 | 335 | // DOMDocument. |
336 | 336 | $posting['dom_document']['name'] = 'DOMDocument'; |
337 | - $posting['dom_document']['help'] = __( 'HTML/Multipart emails use DOMDocument to generate inline CSS in templates.', 'give' ); |
|
337 | + $posting['dom_document']['help'] = __('HTML/Multipart emails use DOMDocument to generate inline CSS in templates.', 'give'); |
|
338 | 338 | |
339 | - if ( class_exists( 'DOMDocument' ) ) { |
|
339 | + if (class_exists('DOMDocument')) { |
|
340 | 340 | $posting['dom_document']['success'] = true; |
341 | 341 | } else { |
342 | 342 | $posting['dom_document']['success'] = false; |
343 | - $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>' ); |
|
343 | + $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>'); |
|
344 | 344 | } |
345 | 345 | |
346 | 346 | // gzip. |
347 | 347 | $posting['gzip']['name'] = 'gzip'; |
348 | - $posting['gzip']['help'] = __( 'gzip is used for file compression and decompression.', 'give' ); |
|
348 | + $posting['gzip']['help'] = __('gzip is used for file compression and decompression.', 'give'); |
|
349 | 349 | |
350 | - if ( is_callable( 'gzopen' ) ) { |
|
350 | + if (is_callable('gzopen')) { |
|
351 | 351 | $posting['gzip']['success'] = true; |
352 | 352 | } else { |
353 | 353 | $posting['gzip']['success'] = false; |
354 | - $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>' ); |
|
354 | + $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>'); |
|
355 | 355 | } |
356 | 356 | |
357 | 357 | |
358 | 358 | // GD Graphics Library. |
359 | 359 | $posting['gd']['name'] = 'GD Graphics Library'; |
360 | - $posting['gd']['help'] = __( 'GD Graphics Library is used for dynamically manipulating images.', 'give' ); |
|
361 | - $posting['gd']['success'] = extension_loaded( 'gd' ) && function_exists( 'gd_info' ) ? true : false; |
|
360 | + $posting['gd']['help'] = __('GD Graphics Library is used for dynamically manipulating images.', 'give'); |
|
361 | + $posting['gd']['success'] = extension_loaded('gd') && function_exists('gd_info') ? true : false; |
|
362 | 362 | |
363 | 363 | // Multibyte String. |
364 | 364 | $posting['mbstring']['name'] = 'Multibyte String'; |
365 | - $posting['mbstring']['help'] = __( 'Multibyte String (mbstring) is used to convert character encoding, like for emails or converting characters to lowercase.', 'give' ); |
|
365 | + $posting['mbstring']['help'] = __('Multibyte String (mbstring) is used to convert character encoding, like for emails or converting characters to lowercase.', 'give'); |
|
366 | 366 | |
367 | - if ( extension_loaded( 'mbstring' ) ) { |
|
367 | + if (extension_loaded('mbstring')) { |
|
368 | 368 | $posting['mbstring']['success'] = true; |
369 | 369 | } else { |
370 | 370 | $posting['mbstring']['success'] = false; |
371 | - $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>' ); |
|
371 | + $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>'); |
|
372 | 372 | } |
373 | 373 | |
374 | 374 | // WP Remote Post Check. |
375 | - $posting['wp_remote_post']['name'] = __( 'Remote Post', 'give' ); |
|
376 | - $posting['wp_remote_post']['help'] = __( 'PayPal uses this method of communicating when sending back transaction information.', 'give' ); |
|
375 | + $posting['wp_remote_post']['name'] = __('Remote Post', 'give'); |
|
376 | + $posting['wp_remote_post']['help'] = __('PayPal uses this method of communicating when sending back transaction information.', 'give'); |
|
377 | 377 | |
378 | - $response = wp_safe_remote_post( 'https://www.paypal.com/cgi-bin/webscr', array( |
|
378 | + $response = wp_safe_remote_post('https://www.paypal.com/cgi-bin/webscr', array( |
|
379 | 379 | 'timeout' => 60, |
380 | - 'user-agent' => 'Give/' . GIVE_VERSION, |
|
380 | + 'user-agent' => 'Give/'.GIVE_VERSION, |
|
381 | 381 | 'httpversion' => '1.1', |
382 | 382 | 'body' => array( |
383 | 383 | 'cmd' => '_notify-validate', |
384 | 384 | ), |
385 | - ) ); |
|
385 | + )); |
|
386 | 386 | |
387 | - if ( ! is_wp_error( $response ) && $response['response']['code'] >= 200 && $response['response']['code'] < 300 ) { |
|
387 | + if ( ! is_wp_error($response) && $response['response']['code'] >= 200 && $response['response']['code'] < 300) { |
|
388 | 388 | $posting['wp_remote_post']['success'] = true; |
389 | 389 | } else { |
390 | - $posting['wp_remote_post']['note'] = __( 'wp_remote_post() failed. PayPal IPN won\'t work with your server. Contact your hosting provider.', 'give' ); |
|
391 | - if ( is_wp_error( $response ) ) { |
|
392 | - $posting['wp_remote_post']['note'] .= ' ' . sprintf( __( 'Error: %s', 'give' ), sanitize_text_field( $response->get_error_message() ) ); |
|
390 | + $posting['wp_remote_post']['note'] = __('wp_remote_post() failed. PayPal IPN won\'t work with your server. Contact your hosting provider.', 'give'); |
|
391 | + if (is_wp_error($response)) { |
|
392 | + $posting['wp_remote_post']['note'] .= ' '.sprintf(__('Error: %s', 'give'), sanitize_text_field($response->get_error_message())); |
|
393 | 393 | } else { |
394 | - $posting['wp_remote_post']['note'] .= ' ' . sprintf( __( 'Status code: %s', 'give' ), sanitize_text_field( $response['response']['code'] ) ); |
|
394 | + $posting['wp_remote_post']['note'] .= ' '.sprintf(__('Status code: %s', 'give'), sanitize_text_field($response['response']['code'])); |
|
395 | 395 | } |
396 | 396 | $posting['wp_remote_post']['success'] = false; |
397 | 397 | } |
398 | 398 | |
399 | 399 | // WP Remote Get Check. |
400 | - $posting['wp_remote_get']['name'] = __( 'Remote Get', 'give' ); |
|
401 | - $posting['wp_remote_get']['help'] = __( 'Give plugins may use this method of communication when checking for plugin updates.', 'give' ); |
|
400 | + $posting['wp_remote_get']['name'] = __('Remote Get', 'give'); |
|
401 | + $posting['wp_remote_get']['help'] = __('Give plugins may use this method of communication when checking for plugin updates.', 'give'); |
|
402 | 402 | |
403 | - $response = wp_safe_remote_get( 'https://woocommerce.com/wc-api/product-key-api?request=ping&network=' . ( is_multisite() ? '1' : '0' ) ); |
|
403 | + $response = wp_safe_remote_get('https://woocommerce.com/wc-api/product-key-api?request=ping&network='.(is_multisite() ? '1' : '0')); |
|
404 | 404 | |
405 | - if ( ! is_wp_error( $response ) && $response['response']['code'] >= 200 && $response['response']['code'] < 300 ) { |
|
405 | + if ( ! is_wp_error($response) && $response['response']['code'] >= 200 && $response['response']['code'] < 300) { |
|
406 | 406 | $posting['wp_remote_get']['success'] = true; |
407 | 407 | } else { |
408 | - $posting['wp_remote_get']['note'] = __( 'wp_remote_get() failed. The Give plugin updater won\'t work with your server. Contact your hosting provider.', 'give' ); |
|
409 | - if ( is_wp_error( $response ) ) { |
|
410 | - $posting['wp_remote_get']['note'] .= ' ' . sprintf( __( 'Error: %s', 'give' ), give_clean( $response->get_error_message() ) ); |
|
408 | + $posting['wp_remote_get']['note'] = __('wp_remote_get() failed. The Give plugin updater won\'t work with your server. Contact your hosting provider.', 'give'); |
|
409 | + if (is_wp_error($response)) { |
|
410 | + $posting['wp_remote_get']['note'] .= ' '.sprintf(__('Error: %s', 'give'), give_clean($response->get_error_message())); |
|
411 | 411 | } else { |
412 | - $posting['wp_remote_get']['note'] .= ' ' . sprintf( __( 'Status code: %s', 'give' ), give_clean( $response['response']['code'] ) ); |
|
412 | + $posting['wp_remote_get']['note'] .= ' '.sprintf(__('Status code: %s', 'give'), give_clean($response['response']['code'])); |
|
413 | 413 | } |
414 | 414 | $posting['wp_remote_get']['success'] = false; |
415 | 415 | } |
416 | 416 | |
417 | - $posting = apply_filters( 'give_debug_posting', $posting ); |
|
417 | + $posting = apply_filters('give_debug_posting', $posting); |
|
418 | 418 | |
419 | - foreach ( $posting as $post ) { |
|
420 | - $mark = ! empty( $post['success'] ) ? 'yes' : 'error'; |
|
419 | + foreach ($posting as $post) { |
|
420 | + $mark = ! empty($post['success']) ? 'yes' : 'error'; |
|
421 | 421 | ?> |
422 | 422 | <tr> |
423 | - <td data-export-label="<?php echo esc_html( $post['name'] ); ?>"><?php echo esc_html( $post['name'] ); ?>:</td> |
|
424 | - <td class="help"><?php echo Give()->tooltips->render_help( esc_attr( isset( $post['help'] ) ? $post['help'] : '' ) ); ?></td> |
|
423 | + <td data-export-label="<?php echo esc_html($post['name']); ?>"><?php echo esc_html($post['name']); ?>:</td> |
|
424 | + <td class="help"><?php echo Give()->tooltips->render_help(esc_attr(isset($post['help']) ? $post['help'] : '')); ?></td> |
|
425 | 425 | <td> |
426 | 426 | <mark class="<?php echo $mark; ?>"> |
427 | - <?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'] ) : ''; ?> |
|
427 | + <?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']) : ''; ?> |
|
428 | 428 | </mark> |
429 | 429 | </td> |
430 | 430 | </tr> |
@@ -437,47 +437,47 @@ discard block |
||
437 | 437 | <table class="give-status-table widefat" cellspacing="0"> |
438 | 438 | <thead> |
439 | 439 | <tr> |
440 | - <th colspan="3" data-export-label="Give Configuration"><h2><?php _e( 'Give Configuration', 'give' ); ?></h2></th> |
|
440 | + <th colspan="3" data-export-label="Give Configuration"><h2><?php _e('Give Configuration', 'give'); ?></h2></th> |
|
441 | 441 | </tr> |
442 | 442 | </thead> |
443 | 443 | <tbody> |
444 | 444 | <tr> |
445 | - <td data-export-label="Give Version"><?php _e( 'Give Version', 'give' ); ?>:</td> |
|
446 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'The version of Give installed on your site.', 'give' ) ); ?></td> |
|
447 | - <td><?php echo esc_html( GIVE_VERSION ); ?></td> |
|
445 | + <td data-export-label="Give Version"><?php _e('Give Version', 'give'); ?>:</td> |
|
446 | + <td class="help"><?php echo Give()->tooltips->render_help(__('The version of Give installed on your site.', 'give')); ?></td> |
|
447 | + <td><?php echo esc_html(GIVE_VERSION); ?></td> |
|
448 | 448 | </tr> |
449 | 449 | <tr> |
450 | - <td data-export-label="Give Cache"><?php _e( 'Give Cache', 'give' ); ?>:</td> |
|
451 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'Whether cache is enabled in Give settings.', 'give' ) ); ?></td> |
|
452 | - <td><?php echo give_is_setting_enabled( give_get_option('cache', 'enabled' ) ) ? __( 'Enabled', 'give' ) : __( 'Disabled', 'give' ); ?></td> |
|
450 | + <td data-export-label="Give Cache"><?php _e('Give Cache', 'give'); ?>:</td> |
|
451 | + <td class="help"><?php echo Give()->tooltips->render_help(__('Whether cache is enabled in Give settings.', 'give')); ?></td> |
|
452 | + <td><?php echo give_is_setting_enabled(give_get_option('cache', 'enabled')) ? __('Enabled', 'give') : __('Disabled', 'give'); ?></td> |
|
453 | 453 | </tr> |
454 | 454 | <tr> |
455 | - <td data-export-label="Database Updates"><?php _e( 'Database Updates', 'give' ); ?>:</td> |
|
456 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'This will show the number of pending database updates.', 'give' ) ); ?></td> |
|
455 | + <td data-export-label="Database Updates"><?php _e('Database Updates', 'give'); ?>:</td> |
|
456 | + <td class="help"><?php echo Give()->tooltips->render_help(__('This will show the number of pending database updates.', 'give')); ?></td> |
|
457 | 457 | <td> |
458 | 458 | <?php |
459 | - $updates_text = __( 'All DB Updates Completed.', 'give' ); |
|
459 | + $updates_text = __('All DB Updates Completed.', 'give'); |
|
460 | 460 | $pending_updates = $give_updates->get_total_new_db_update_count(); |
461 | 461 | $total_updates = $give_updates->get_total_db_update_count(); |
462 | 462 | |
463 | - if( Give_Updates::$background_updater->is_paused_process() ) { |
|
463 | + if (Give_Updates::$background_updater->is_paused_process()) { |
|
464 | 464 | // When all the db updates are pending. |
465 | 465 | $updates_text = sprintf( |
466 | - __( '%1$s updates still need to run. (Paused) ', 'give' ), |
|
467 | - count( $give_updates->get_updates('database', 'new' ) ) |
|
466 | + __('%1$s updates still need to run. (Paused) ', 'give'), |
|
467 | + count($give_updates->get_updates('database', 'new')) |
|
468 | 468 | ); |
469 | - } elseif( $pending_updates === $total_updates ) { |
|
469 | + } elseif ($pending_updates === $total_updates) { |
|
470 | 470 | |
471 | 471 | // When all the db updates are pending. |
472 | 472 | $updates_text = sprintf( |
473 | - __( '%1$s updates still need to run.', 'give' ), |
|
473 | + __('%1$s updates still need to run.', 'give'), |
|
474 | 474 | $total_updates |
475 | 475 | ); |
476 | - } elseif( $pending_updates > 0 ) { |
|
476 | + } elseif ($pending_updates > 0) { |
|
477 | 477 | |
478 | 478 | // When some of the db updates are completed and some are pending. |
479 | 479 | $updates_text = sprintf( |
480 | - __( '%1$s of %2$s updates still need to run.', 'give' ), |
|
480 | + __('%1$s of %2$s updates still need to run.', 'give'), |
|
481 | 481 | $pending_updates, |
482 | 482 | $total_updates |
483 | 483 | ); |
@@ -488,144 +488,143 @@ discard block |
||
488 | 488 | </td> |
489 | 489 | </tr> |
490 | 490 | <tr> |
491 | - <td data-export-label="Give Cache"><?php _e( 'Give Cache', 'give' ); ?>:</td> |
|
492 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'Whether cache is enabled in Give settings.', 'give' ) ); ?></td> |
|
493 | - <td><?php echo give_is_setting_enabled( give_get_option('cache', 'enabled' ) ) ? __( 'Enabled', 'give' ) : __( 'Disabled', 'give' ); ?></td> |
|
491 | + <td data-export-label="Give Cache"><?php _e('Give Cache', 'give'); ?>:</td> |
|
492 | + <td class="help"><?php echo Give()->tooltips->render_help(__('Whether cache is enabled in Give settings.', 'give')); ?></td> |
|
493 | + <td><?php echo give_is_setting_enabled(give_get_option('cache', 'enabled')) ? __('Enabled', 'give') : __('Disabled', 'give'); ?></td> |
|
494 | 494 | </tr> |
495 | 495 | <tr> |
496 | - <td data-export-label="Give Cache"><?php _e( 'Give Emails', 'give' ); ?>:</td> |
|
497 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'Whether emails is enabled in Give settings.', 'give' ) ); ?></td> |
|
496 | + <td data-export-label="Give Cache"><?php _e('Give Emails', 'give'); ?>:</td> |
|
497 | + <td class="help"><?php echo Give()->tooltips->render_help(__('Whether emails is enabled in Give settings.', 'give')); ?></td> |
|
498 | 498 | <td> |
499 | 499 | <?php |
500 | 500 | /* @var Give_Email_Notification $email_notification */ |
501 | - if( $email_notifications = Give_Email_Notifications::get_instance()->get_email_notifications() ) { |
|
501 | + if ($email_notifications = Give_Email_Notifications::get_instance()->get_email_notifications()) { |
|
502 | 502 | ob_start(); |
503 | 503 | |
504 | - foreach ( Give_Email_Notifications::get_instance()->get_email_notifications() as $email_notification ) { |
|
505 | - $status = Give_Email_Notification_Util::is_email_notification_active( $email_notification ) ? |
|
506 | - 'yes' : |
|
507 | - 'error'; |
|
504 | + foreach (Give_Email_Notifications::get_instance()->get_email_notifications() as $email_notification) { |
|
505 | + $status = Give_Email_Notification_Util::is_email_notification_active($email_notification) ? |
|
506 | + 'yes' : 'error'; |
|
508 | 507 | |
509 | 508 | echo sprintf( |
510 | 509 | '<li><mark class="%1$s"><span class="dashicons dashicons-%2$s"></mark></span>%3$s</li>', |
511 | - Give_Email_Notification_Util::is_email_notification_active( $email_notification ) ? 'yes' : 'error', |
|
512 | - Give_Email_Notification_Util::is_email_notification_active( $email_notification ) ? 'yes' : 'no-alt', |
|
510 | + Give_Email_Notification_Util::is_email_notification_active($email_notification) ? 'yes' : 'error', |
|
511 | + Give_Email_Notification_Util::is_email_notification_active($email_notification) ? 'yes' : 'no-alt', |
|
513 | 512 | $email_notification->config['label'] |
514 | 513 | ); |
515 | 514 | } |
516 | 515 | |
517 | - echo sprintf( '<ul>%s</ul>', ob_get_clean() ); |
|
516 | + echo sprintf('<ul>%s</ul>', ob_get_clean()); |
|
518 | 517 | } |
519 | 518 | ?> |
520 | 519 | </td> |
521 | 520 | </tr> |
522 | 521 | <tr> |
523 | - <td data-export-label="Upgraded From"><?php _e( 'Upgraded From', 'give' ); ?>:</td> |
|
524 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'The version of Give installed prior to the last update.', 'give' ) ); ?></td> |
|
525 | - <td><?php echo esc_html( get_option( 'give_version_upgraded_from', '–' ) ); ?></td> |
|
522 | + <td data-export-label="Upgraded From"><?php _e('Upgraded From', 'give'); ?>:</td> |
|
523 | + <td class="help"><?php echo Give()->tooltips->render_help(__('The version of Give installed prior to the last update.', 'give')); ?></td> |
|
524 | + <td><?php echo esc_html(get_option('give_version_upgraded_from', '–')); ?></td> |
|
526 | 525 | </tr> |
527 | 526 | <tr> |
528 | - <td data-export-label="Test Mode"><?php _e( 'Test Mode', 'give' ); ?>:</td> |
|
529 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'Whether Test Mode is enabled in Give settings.', 'give' ) ); ?></td> |
|
530 | - <td><?php echo give_is_test_mode() ? __( 'Enabled', 'give' ) : __( 'Disabled', 'give' ); ?></td> |
|
527 | + <td data-export-label="Test Mode"><?php _e('Test Mode', 'give'); ?>:</td> |
|
528 | + <td class="help"><?php echo Give()->tooltips->render_help(__('Whether Test Mode is enabled in Give settings.', 'give')); ?></td> |
|
529 | + <td><?php echo give_is_test_mode() ? __('Enabled', 'give') : __('Disabled', 'give'); ?></td> |
|
531 | 530 | </tr> |
532 | 531 | <tr> |
533 | - <td data-export-label="Currency Code"><?php _e( 'Currency Code', 'give' ); ?>:</td> |
|
534 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'The currency code selected in Give settings.', 'give' ) ); ?></td> |
|
535 | - <td><?php echo esc_html( give_get_currency() ); ?></td> |
|
532 | + <td data-export-label="Currency Code"><?php _e('Currency Code', 'give'); ?>:</td> |
|
533 | + <td class="help"><?php echo Give()->tooltips->render_help(__('The currency code selected in Give settings.', 'give')); ?></td> |
|
534 | + <td><?php echo esc_html(give_get_currency()); ?></td> |
|
536 | 535 | </tr> |
537 | 536 | <tr> |
538 | - <td data-export-label="Currency Position"><?php _e( 'Currency Position', 'give' ); ?>:</td> |
|
539 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'The currency position selected in Give settings.', 'give' ) ); ?></td> |
|
540 | - <td><?php echo 'before' === give_get_option( 'currency_position' ) ? __( 'Before', 'give' ) : __( 'After', 'give' ); ?></td> |
|
537 | + <td data-export-label="Currency Position"><?php _e('Currency Position', 'give'); ?>:</td> |
|
538 | + <td class="help"><?php echo Give()->tooltips->render_help(__('The currency position selected in Give settings.', 'give')); ?></td> |
|
539 | + <td><?php echo 'before' === give_get_option('currency_position') ? __('Before', 'give') : __('After', 'give'); ?></td> |
|
541 | 540 | </tr> |
542 | 541 | <tr> |
543 | - <td data-export-label="Decimal Separator"><?php _e( 'Decimal Separator', 'give' ); ?>:</td> |
|
544 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'The decimal separator defined in Give settings.', 'give' ) ); ?></td> |
|
545 | - <td><?php echo esc_html( give_get_price_decimal_separator() ); ?></td> |
|
542 | + <td data-export-label="Decimal Separator"><?php _e('Decimal Separator', 'give'); ?>:</td> |
|
543 | + <td class="help"><?php echo Give()->tooltips->render_help(__('The decimal separator defined in Give settings.', 'give')); ?></td> |
|
544 | + <td><?php echo esc_html(give_get_price_decimal_separator()); ?></td> |
|
546 | 545 | </tr> |
547 | 546 | <tr> |
548 | - <td data-export-label="Thousands Separator"><?php _e( 'Thousands Separator', 'give' ); ?>:</td> |
|
549 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'The thousands separator defined in Give settings.', 'give' ) ); ?></td> |
|
550 | - <td><?php echo esc_html( give_get_price_thousand_separator() ); ?></td> |
|
547 | + <td data-export-label="Thousands Separator"><?php _e('Thousands Separator', 'give'); ?>:</td> |
|
548 | + <td class="help"><?php echo Give()->tooltips->render_help(__('The thousands separator defined in Give settings.', 'give')); ?></td> |
|
549 | + <td><?php echo esc_html(give_get_price_thousand_separator()); ?></td> |
|
551 | 550 | </tr> |
552 | 551 | <tr> |
553 | - <td data-export-label="Success Page"><?php _e( 'Success Page', 'give' ); ?>:</td> |
|
554 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'The page where donors land following a successful transaction.', 'give' ) ); ?></td> |
|
555 | - <td><?php echo ! empty( $give_options['success_page'] ) ? esc_url( get_permalink( $give_options['success_page'] ) ) : '–'; ?></td> |
|
552 | + <td data-export-label="Success Page"><?php _e('Success Page', 'give'); ?>:</td> |
|
553 | + <td class="help"><?php echo Give()->tooltips->render_help(__('The page where donors land following a successful transaction.', 'give')); ?></td> |
|
554 | + <td><?php echo ! empty($give_options['success_page']) ? esc_url(get_permalink($give_options['success_page'])) : '–'; ?></td> |
|
556 | 555 | </tr> |
557 | 556 | <tr> |
558 | - <td data-export-label="Failure Page"><?php _e( 'Failure Page', 'give' ); ?>:</td> |
|
559 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'The page where donors land following a failed transaction.', 'give' ) ); ?></td> |
|
560 | - <td><?php echo ! empty( $give_options['failure_page'] ) ? esc_url( get_permalink( $give_options['failure_page'] ) ) : '–'; ?></td> |
|
557 | + <td data-export-label="Failure Page"><?php _e('Failure Page', 'give'); ?>:</td> |
|
558 | + <td class="help"><?php echo Give()->tooltips->render_help(__('The page where donors land following a failed transaction.', 'give')); ?></td> |
|
559 | + <td><?php echo ! empty($give_options['failure_page']) ? esc_url(get_permalink($give_options['failure_page'])) : '–'; ?></td> |
|
561 | 560 | </tr> |
562 | 561 | <tr> |
563 | - <td data-export-label="Donation History Page"><?php _e( 'Donation History Page', 'give' ); ?>:</td> |
|
564 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'The page where past donations are listed.', 'give' ) ); ?></td> |
|
565 | - <td><?php echo ! empty( $give_options['history_page'] ) ? esc_url( get_permalink( $give_options['history_page'] ) ) : '–'; ?></td> |
|
562 | + <td data-export-label="Donation History Page"><?php _e('Donation History Page', 'give'); ?>:</td> |
|
563 | + <td class="help"><?php echo Give()->tooltips->render_help(__('The page where past donations are listed.', 'give')); ?></td> |
|
564 | + <td><?php echo ! empty($give_options['history_page']) ? esc_url(get_permalink($give_options['history_page'])) : '–'; ?></td> |
|
566 | 565 | </tr> |
567 | 566 | <tr> |
568 | - <td data-export-label="Give Forms Slug"><?php _e( 'Give Forms Slug', 'give' ); ?>:</td> |
|
569 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'The slug used for Give donation forms.', 'give' ) ); ?></td> |
|
570 | - <td><?php echo esc_html( defined( 'GIVE_SLUG' ) ? '/' . GIVE_SLUG . '/' : '/donations/' ); ?></td> |
|
567 | + <td data-export-label="Give Forms Slug"><?php _e('Give Forms Slug', 'give'); ?>:</td> |
|
568 | + <td class="help"><?php echo Give()->tooltips->render_help(__('The slug used for Give donation forms.', 'give')); ?></td> |
|
569 | + <td><?php echo esc_html(defined('GIVE_SLUG') ? '/'.GIVE_SLUG.'/' : '/donations/'); ?></td> |
|
571 | 570 | </tr> |
572 | 571 | <?php |
573 | 572 | $active_gateways = give_get_enabled_payment_gateways(); |
574 | 573 | $enabled_gateways = $default_gateway = ''; |
575 | 574 | |
576 | - if ( $active_gateways ) { |
|
577 | - $default_gateway_is_active = give_is_gateway_active( give_get_default_gateway( null ) ); |
|
575 | + if ($active_gateways) { |
|
576 | + $default_gateway_is_active = give_is_gateway_active(give_get_default_gateway(null)); |
|
578 | 577 | |
579 | - if ( $default_gateway_is_active ) { |
|
580 | - $default_gateway = give_get_default_gateway( null ); |
|
581 | - $default_gateway = $active_gateways[ $default_gateway ]['admin_label']; |
|
578 | + if ($default_gateway_is_active) { |
|
579 | + $default_gateway = give_get_default_gateway(null); |
|
580 | + $default_gateway = $active_gateways[$default_gateway]['admin_label']; |
|
582 | 581 | } else { |
583 | - $default_gateway = __( 'Test Donation', 'give' ); |
|
582 | + $default_gateway = __('Test Donation', 'give'); |
|
584 | 583 | } |
585 | 584 | |
586 | 585 | $gateways = array(); |
587 | 586 | |
588 | - foreach ( $active_gateways as $gateway ) { |
|
587 | + foreach ($active_gateways as $gateway) { |
|
589 | 588 | $gateways[] = $gateway['admin_label']; |
590 | 589 | } |
591 | 590 | |
592 | - $enabled_gateways = implode( ', ', $gateways ); |
|
591 | + $enabled_gateways = implode(', ', $gateways); |
|
593 | 592 | } |
594 | 593 | ?> |
595 | 594 | <tr> |
596 | - <td data-export-label="Enabled Payment Gateways"><?php _e( 'Enabled Payment Gateways', 'give' ); ?>:</td> |
|
597 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'All payment gateways enabled in Give settings.', 'give' ) ); ?></td> |
|
598 | - <td><?php echo esc_html( ! empty( $enabled_gateways ) ? $enabled_gateways : '–' ); ?></td> |
|
595 | + <td data-export-label="Enabled Payment Gateways"><?php _e('Enabled Payment Gateways', 'give'); ?>:</td> |
|
596 | + <td class="help"><?php echo Give()->tooltips->render_help(__('All payment gateways enabled in Give settings.', 'give')); ?></td> |
|
597 | + <td><?php echo esc_html( ! empty($enabled_gateways) ? $enabled_gateways : '–'); ?></td> |
|
599 | 598 | </tr> |
600 | 599 | <tr> |
601 | - <td data-export-label="Default Payment Gateway"><?php _e( 'Default Payment Gateway', 'give' ); ?>:</td> |
|
602 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'The default payment gateway selected in Give settings.', 'give' ) ); ?></td> |
|
603 | - <td><?php echo esc_html( ! empty( $default_gateway ) ? $default_gateway : '–' ); ?></td> |
|
600 | + <td data-export-label="Default Payment Gateway"><?php _e('Default Payment Gateway', 'give'); ?>:</td> |
|
601 | + <td class="help"><?php echo Give()->tooltips->render_help(__('The default payment gateway selected in Give settings.', 'give')); ?></td> |
|
602 | + <td><?php echo esc_html( ! empty($default_gateway) ? $default_gateway : '–'); ?></td> |
|
604 | 603 | </tr> |
605 | 604 | <tr> |
606 | - <td data-export-label="PayPal IPN Verification"><?php _e( 'PayPal IPN Verification', 'give' ); ?>:</td> |
|
607 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'Whether admins requires verification of IPN notifications with PayPal.', 'give' ) ); ?></td> |
|
608 | - <td><?php echo 'enabled' === give_get_option( 'paypal_verification' ) ? __( 'Enabled', 'give' ) : __( 'Disabled', 'give' ); ?></td> |
|
605 | + <td data-export-label="PayPal IPN Verification"><?php _e('PayPal IPN Verification', 'give'); ?>:</td> |
|
606 | + <td class="help"><?php echo Give()->tooltips->render_help(__('Whether admins requires verification of IPN notifications with PayPal.', 'give')); ?></td> |
|
607 | + <td><?php echo 'enabled' === give_get_option('paypal_verification') ? __('Enabled', 'give') : __('Disabled', 'give'); ?></td> |
|
609 | 608 | </tr> |
610 | 609 | <tr> |
611 | - <td data-export-label="PayPal IPN Notifications"><?php _e( 'PayPal IPN Notifications', 'give' ); ?>:</td> |
|
612 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'Displays whether when last PayPal IPN is received with which donation or transaction.', 'give' ) ); ?></td> |
|
610 | + <td data-export-label="PayPal IPN Notifications"><?php _e('PayPal IPN Notifications', 'give'); ?>:</td> |
|
611 | + <td class="help"><?php echo Give()->tooltips->render_help(__('Displays whether when last PayPal IPN is received with which donation or transaction.', 'give')); ?></td> |
|
613 | 612 | <td> |
614 | 613 | <?php |
615 | - $last_paypal_ipn_received = get_option( 'give_last_paypal_ipn_received' ); |
|
616 | - if ( is_array( $last_paypal_ipn_received ) && count( $last_paypal_ipn_received ) > 0 ) { |
|
614 | + $last_paypal_ipn_received = get_option('give_last_paypal_ipn_received'); |
|
615 | + if (is_array($last_paypal_ipn_received) && count($last_paypal_ipn_received) > 0) { |
|
617 | 616 | $donation_id = $last_paypal_ipn_received['payment_id']; |
618 | - $ipn_timestamp = give_get_meta( $donation_id, 'give_last_paypal_ipn_received', true ); |
|
619 | - $transaction_url = 'https://history.paypal.com/cgi-bin/webscr?cmd=_history-details-from-hub&id=' . $last_paypal_ipn_received['transaction_id']; |
|
620 | - $donation_url = site_url() . '/wp-admin/edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&id=' . $donation_id; |
|
617 | + $ipn_timestamp = give_get_meta($donation_id, 'give_last_paypal_ipn_received', true); |
|
618 | + $transaction_url = 'https://history.paypal.com/cgi-bin/webscr?cmd=_history-details-from-hub&id='.$last_paypal_ipn_received['transaction_id']; |
|
619 | + $donation_url = site_url().'/wp-admin/edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&id='.$donation_id; |
|
621 | 620 | echo sprintf( |
622 | - __( 'IPN received for <a href="%s">#%s</a> ( <a href="%s" target="_blank">%s</a> ) on %s at %s. Status %s', 'give' ), |
|
621 | + __('IPN received for <a href="%s">#%s</a> ( <a href="%s" target="_blank">%s</a> ) on %s at %s. Status %s', 'give'), |
|
623 | 622 | $donation_url, |
624 | 623 | $donation_id, |
625 | 624 | $transaction_url, |
626 | 625 | $last_paypal_ipn_received['transaction_id'], |
627 | - date_i18n( 'm/d/Y', $ipn_timestamp ), |
|
628 | - date_i18n( 'H:i', $ipn_timestamp ), |
|
626 | + date_i18n('m/d/Y', $ipn_timestamp), |
|
627 | + date_i18n('H:i', $ipn_timestamp), |
|
629 | 628 | $last_paypal_ipn_received['auth_status'] |
630 | 629 | ); |
631 | 630 | } else { |
@@ -635,9 +634,9 @@ discard block |
||
635 | 634 | </td> |
636 | 635 | </tr> |
637 | 636 | <tr> |
638 | - <td data-export-label="Donor Email Access"><?php _e( 'Donor Email Access', 'give' ); ?>:</td> |
|
639 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'Whether donors can access their donation history using only email.', 'give' ) ); ?></td> |
|
640 | - <td><?php echo 'enabled' === give_get_option( 'email_access' ) ? __( 'Enabled', 'give' ) : __( 'Disabled', 'give' ); ?></td> |
|
637 | + <td data-export-label="Donor Email Access"><?php _e('Donor Email Access', 'give'); ?>:</td> |
|
638 | + <td class="help"><?php echo Give()->tooltips->render_help(__('Whether donors can access their donation history using only email.', 'give')); ?></td> |
|
639 | + <td><?php echo 'enabled' === give_get_option('email_access') ? __('Enabled', 'give') : __('Disabled', 'give'); ?></td> |
|
641 | 640 | </tr> |
642 | 641 | </tbody> |
643 | 642 | </table> |
@@ -645,45 +644,45 @@ discard block |
||
645 | 644 | <table class="give-status-table widefat" cellspacing="0"> |
646 | 645 | <thead> |
647 | 646 | <tr> |
648 | - <th colspan="3" data-export-label="Session Configuration"><h2><?php _e( 'Session Configuration', 'give' ); ?></h2></th> |
|
647 | + <th colspan="3" data-export-label="Session Configuration"><h2><?php _e('Session Configuration', 'give'); ?></h2></th> |
|
649 | 648 | </tr> |
650 | 649 | </thead> |
651 | 650 | <tbody> |
652 | 651 | <tr> |
653 | - <td data-export-label="Give Use Sessions"><?php _e( 'Give Use Sessions', 'give' ); ?>:</td> |
|
654 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'Whether PHP sessions are enforced, enabled, or disabled.', 'give' ) ); ?></td> |
|
655 | - <td><?php echo defined( 'GIVE_USE_PHP_SESSIONS' ) && GIVE_USE_PHP_SESSIONS ? __( 'Enforced', 'give' ) : ( Give()->session->use_php_sessions() ? __( 'Enabled', 'give' ) : __( 'Disabled', 'give' ) ); ?></td> |
|
652 | + <td data-export-label="Give Use Sessions"><?php _e('Give Use Sessions', 'give'); ?>:</td> |
|
653 | + <td class="help"><?php echo Give()->tooltips->render_help(__('Whether PHP sessions are enforced, enabled, or disabled.', 'give')); ?></td> |
|
654 | + <td><?php echo defined('GIVE_USE_PHP_SESSIONS') && GIVE_USE_PHP_SESSIONS ? __('Enforced', 'give') : (Give()->session->use_php_sessions() ? __('Enabled', 'give') : __('Disabled', 'give')); ?></td> |
|
656 | 655 | </tr> |
657 | 656 | <tr> |
658 | - <td data-export-label="Session"><?php _e( 'Session', 'give' ); ?>:</td> |
|
659 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'Whether a PHP session is currently set.', 'give' ) ); ?></td> |
|
660 | - <td><?php echo isset( $_SESSION ) ? __( 'Enabled', 'give' ) : __( 'Disabled', 'give' ); ?></td> |
|
657 | + <td data-export-label="Session"><?php _e('Session', 'give'); ?>:</td> |
|
658 | + <td class="help"><?php echo Give()->tooltips->render_help(__('Whether a PHP session is currently set.', 'give')); ?></td> |
|
659 | + <td><?php echo isset($_SESSION) ? __('Enabled', 'give') : __('Disabled', 'give'); ?></td> |
|
661 | 660 | </tr> |
662 | - <?php if ( isset( $_SESSION ) ) { ?> |
|
661 | + <?php if (isset($_SESSION)) { ?> |
|
663 | 662 | <tr> |
664 | - <td data-export-label="Session Name"><?php _e( 'Session Name', 'give' ); ?>:</td> |
|
665 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'The name of the current PHP session.', 'give' ) ); ?></td> |
|
666 | - <td><?php echo esc_html( ini_get( 'session.name' ) ); ?></td> |
|
663 | + <td data-export-label="Session Name"><?php _e('Session Name', 'give'); ?>:</td> |
|
664 | + <td class="help"><?php echo Give()->tooltips->render_help(__('The name of the current PHP session.', 'give')); ?></td> |
|
665 | + <td><?php echo esc_html(ini_get('session.name')); ?></td> |
|
667 | 666 | </tr> |
668 | 667 | <tr> |
669 | - <td data-export-label="Cookie Path"><?php _e( 'Cookie Path', 'give' ); ?>:</td> |
|
670 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'The cookie path of the current PHP session.', 'give' ) ); ?></td> |
|
671 | - <td><?php echo esc_html( ini_get( 'session.cookie_path' ) ); ?></td> |
|
668 | + <td data-export-label="Cookie Path"><?php _e('Cookie Path', 'give'); ?>:</td> |
|
669 | + <td class="help"><?php echo Give()->tooltips->render_help(__('The cookie path of the current PHP session.', 'give')); ?></td> |
|
670 | + <td><?php echo esc_html(ini_get('session.cookie_path')); ?></td> |
|
672 | 671 | </tr> |
673 | 672 | <tr> |
674 | - <td data-export-label="Save Path"><?php _e( 'Save Path', 'give' ); ?>:</td> |
|
675 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'The save path of the current PHP session.', 'give' ) ); ?></td> |
|
676 | - <td><?php echo esc_html( ini_get( 'session.save_path' ) ); ?></td> |
|
673 | + <td data-export-label="Save Path"><?php _e('Save Path', 'give'); ?>:</td> |
|
674 | + <td class="help"><?php echo Give()->tooltips->render_help(__('The save path of the current PHP session.', 'give')); ?></td> |
|
675 | + <td><?php echo esc_html(ini_get('session.save_path')); ?></td> |
|
677 | 676 | </tr> |
678 | 677 | <tr> |
679 | - <td data-export-label="Use Cookies"><?php _e( 'Use Cookies', 'give' ); ?>:</td> |
|
680 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'Whether the current PHP session is set to use cookies.', 'give' ) ); ?></td> |
|
681 | - <td><?php echo ini_get( 'session.use_cookies' ) ? __( 'Enabled', 'give' ) : __( 'Disabled', 'give' ); ?></td> |
|
678 | + <td data-export-label="Use Cookies"><?php _e('Use Cookies', 'give'); ?>:</td> |
|
679 | + <td class="help"><?php echo Give()->tooltips->render_help(__('Whether the current PHP session is set to use cookies.', 'give')); ?></td> |
|
680 | + <td><?php echo ini_get('session.use_cookies') ? __('Enabled', 'give') : __('Disabled', 'give'); ?></td> |
|
682 | 681 | </tr> |
683 | 682 | <tr> |
684 | - <td data-export-label="Use Only Cookies"><?php _e( 'Use Only Cookies', 'give' ); ?>:</td> |
|
685 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'Whether the current PHP session is set to use only cookies.', 'give' ) ); ?></td> |
|
686 | - <td><?php echo ini_get( 'session.use_only_cookies' ) ? __( 'Enabled', 'give' ) : __( 'Disabled', 'give' ); ?></td> |
|
683 | + <td data-export-label="Use Only Cookies"><?php _e('Use Only Cookies', 'give'); ?>:</td> |
|
684 | + <td class="help"><?php echo Give()->tooltips->render_help(__('Whether the current PHP session is set to use only cookies.', 'give')); ?></td> |
|
685 | + <td><?php echo ini_get('session.use_only_cookies') ? __('Enabled', 'give') : __('Disabled', 'give'); ?></td> |
|
687 | 686 | </tr> |
688 | 687 | <?php } ?> |
689 | 688 | </tbody> |
@@ -692,13 +691,13 @@ discard block |
||
692 | 691 | <table class="give-status-table widefat" cellspacing="0"> |
693 | 692 | <thead> |
694 | 693 | <tr> |
695 | - <th colspan="3" data-export-label="Active Give Add-ons"><h2><?php _e( 'Active Give Add-ons', 'give' ); ?></h2></th> |
|
694 | + <th colspan="3" data-export-label="Active Give Add-ons"><h2><?php _e('Active Give Add-ons', 'give'); ?></h2></th> |
|
696 | 695 | </tr> |
697 | 696 | </thead> |
698 | 697 | <tbody> |
699 | 698 | <?php |
700 | - foreach ( $plugins as $plugin_data ) { |
|
701 | - if ( 'active' != $plugin_data['Status'] || 'add-on' != $plugin_data['Type'] ) { |
|
699 | + foreach ($plugins as $plugin_data) { |
|
700 | + if ('active' != $plugin_data['Status'] || 'add-on' != $plugin_data['Type']) { |
|
702 | 701 | continue; |
703 | 702 | } |
704 | 703 | |
@@ -706,40 +705,40 @@ discard block |
||
706 | 705 | $author_name = $plugin_data['Author']; |
707 | 706 | |
708 | 707 | // Link the plugin name to the plugin URL if available. |
709 | - if ( ! empty( $plugin_data['PluginURI'] ) ) { |
|
708 | + if ( ! empty($plugin_data['PluginURI'])) { |
|
710 | 709 | $plugin_name = sprintf( |
711 | 710 | '<a href="%s" title="%s">%s</a>', |
712 | - esc_url( $plugin_data['PluginURI'] ), |
|
713 | - esc_attr__( 'Visit plugin homepage', 'give' ), |
|
711 | + esc_url($plugin_data['PluginURI']), |
|
712 | + esc_attr__('Visit plugin homepage', 'give'), |
|
714 | 713 | $plugin_name |
715 | 714 | ); |
716 | 715 | } |
717 | 716 | |
718 | 717 | // Link the author name to the author URL if available. |
719 | - if ( ! empty( $plugin_data['AuthorURI'] ) ) { |
|
718 | + if ( ! empty($plugin_data['AuthorURI'])) { |
|
720 | 719 | $author_name = sprintf( |
721 | 720 | '<a href="%s" title="%s">%s</a>', |
722 | - esc_url( $plugin_data['AuthorURI'] ), |
|
723 | - esc_attr__( 'Visit author homepage', 'give' ), |
|
721 | + esc_url($plugin_data['AuthorURI']), |
|
722 | + esc_attr__('Visit author homepage', 'give'), |
|
724 | 723 | $author_name |
725 | 724 | ); |
726 | 725 | } |
727 | 726 | ?> |
728 | 727 | <tr> |
729 | - <td><?php echo wp_kses( $plugin_name, wp_kses_allowed_html( 'post' ) ); ?></td> |
|
728 | + <td><?php echo wp_kses($plugin_name, wp_kses_allowed_html('post')); ?></td> |
|
730 | 729 | <td class="help"> </td> |
731 | 730 | <td> |
732 | 731 | <?php |
733 | - if ( true === $plugin_data['License'] ) { |
|
734 | - echo '<mark class="yes"><span class="dashicons dashicons-yes"></span></mark> ' . __( 'Licensed', 'give' ); |
|
732 | + if (true === $plugin_data['License']) { |
|
733 | + echo '<mark class="yes"><span class="dashicons dashicons-yes"></span></mark> '.__('Licensed', 'give'); |
|
735 | 734 | } else { |
736 | - echo '<mark class="error"><span class="dashicons dashicons-no-alt"></span></mark> ' . __( 'Unlicensed', 'give' ); |
|
735 | + echo '<mark class="error"><span class="dashicons dashicons-no-alt"></span></mark> '.__('Unlicensed', 'give'); |
|
737 | 736 | } |
738 | 737 | |
739 | 738 | echo ' – ' |
740 | - . sprintf( _x( 'by %s', 'by author', 'give' ), wp_kses( $author_name, wp_kses_allowed_html( 'post' ) ) ) |
|
739 | + . sprintf(_x('by %s', 'by author', 'give'), wp_kses($author_name, wp_kses_allowed_html('post'))) |
|
741 | 740 | . ' – ' |
742 | - . esc_html( $plugin_data['Version'] ); |
|
741 | + . esc_html($plugin_data['Version']); |
|
743 | 742 | ?> |
744 | 743 | </td> |
745 | 744 | </tr> |
@@ -752,18 +751,18 @@ discard block |
||
752 | 751 | <table class="give-status-table widefat" cellspacing="0"> |
753 | 752 | <thead> |
754 | 753 | <tr> |
755 | - <th colspan="3" data-export-label="Other Active Plugins"><h2><?php _e( 'Other Active Plugins', 'give' ); ?></h2></th> |
|
754 | + <th colspan="3" data-export-label="Other Active Plugins"><h2><?php _e('Other Active Plugins', 'give'); ?></h2></th> |
|
756 | 755 | </tr> |
757 | 756 | </thead> |
758 | 757 | <tbody> |
759 | 758 | <?php |
760 | - foreach ( $plugins as $plugin_data ) { |
|
761 | - if ( 'active' != $plugin_data['Status'] || 'other' != $plugin_data['Type'] ) { |
|
759 | + foreach ($plugins as $plugin_data) { |
|
760 | + if ('active' != $plugin_data['Status'] || 'other' != $plugin_data['Type']) { |
|
762 | 761 | continue; |
763 | 762 | } |
764 | 763 | |
765 | 764 | // Do not show Give core plugin. |
766 | - if ( 'Give - Donation Plugin' === $plugin_data['Name'] ) { |
|
765 | + if ('Give - Donation Plugin' === $plugin_data['Name']) { |
|
767 | 766 | continue; |
768 | 767 | } |
769 | 768 | |
@@ -771,29 +770,29 @@ discard block |
||
771 | 770 | $author_name = $plugin_data['Author']; |
772 | 771 | |
773 | 772 | // Link the plugin name to the plugin URL if available. |
774 | - if ( ! empty( $plugin_data['PluginURI'] ) ) { |
|
773 | + if ( ! empty($plugin_data['PluginURI'])) { |
|
775 | 774 | $plugin_name = sprintf( |
776 | 775 | '<a href="%s" title="%s">%s</a>', |
777 | - esc_url( $plugin_data['PluginURI'] ), |
|
778 | - esc_attr__( 'Visit plugin homepage', 'give' ), |
|
776 | + esc_url($plugin_data['PluginURI']), |
|
777 | + esc_attr__('Visit plugin homepage', 'give'), |
|
779 | 778 | $plugin_name |
780 | 779 | ); |
781 | 780 | } |
782 | 781 | |
783 | 782 | // Link the author name to the author URL if available. |
784 | - if ( ! empty( $plugin_data['AuthorURI'] ) ) { |
|
783 | + if ( ! empty($plugin_data['AuthorURI'])) { |
|
785 | 784 | $author_name = sprintf( |
786 | 785 | '<a href="%s" title="%s">%s</a>', |
787 | - esc_url( $plugin_data['AuthorURI'] ), |
|
788 | - esc_attr__( 'Visit author homepage', 'give' ), |
|
786 | + esc_url($plugin_data['AuthorURI']), |
|
787 | + esc_attr__('Visit author homepage', 'give'), |
|
789 | 788 | $author_name |
790 | 789 | ); |
791 | 790 | } |
792 | 791 | ?> |
793 | 792 | <tr> |
794 | - <td><?php echo wp_kses( $plugin_name, wp_kses_allowed_html( 'post' ) ); ?></td> |
|
793 | + <td><?php echo wp_kses($plugin_name, wp_kses_allowed_html('post')); ?></td> |
|
795 | 794 | <td class="help"> </td> |
796 | - <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> |
|
795 | + <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> |
|
797 | 796 | </tr> |
798 | 797 | <?php |
799 | 798 | } |
@@ -804,13 +803,13 @@ discard block |
||
804 | 803 | <table class="give-status-table widefat" cellspacing="0"> |
805 | 804 | <thead> |
806 | 805 | <tr> |
807 | - <th colspan="3" data-export-label="Inactive Plugins"><h2><?php _e( 'Inactive Plugins', 'give' ); ?></h2></th> |
|
806 | + <th colspan="3" data-export-label="Inactive Plugins"><h2><?php _e('Inactive Plugins', 'give'); ?></h2></th> |
|
808 | 807 | </tr> |
809 | 808 | </thead> |
810 | 809 | <tbody> |
811 | 810 | <?php |
812 | - foreach ( $plugins as $plugin_data ) { |
|
813 | - if ( 'inactive' != $plugin_data['Status'] ) { |
|
811 | + foreach ($plugins as $plugin_data) { |
|
812 | + if ('inactive' != $plugin_data['Status']) { |
|
814 | 813 | continue; |
815 | 814 | } |
816 | 815 | |
@@ -818,29 +817,29 @@ discard block |
||
818 | 817 | $author_name = $plugin_data['Author']; |
819 | 818 | |
820 | 819 | // Link the plugin name to the plugin URL if available. |
821 | - if ( ! empty( $plugin_data['PluginURI'] ) ) { |
|
820 | + if ( ! empty($plugin_data['PluginURI'])) { |
|
822 | 821 | $plugin_name = sprintf( |
823 | 822 | '<a href="%s" title="%s">%s</a>', |
824 | - esc_url( $plugin_data['PluginURI'] ), |
|
825 | - esc_attr__( 'Visit plugin homepage', 'give' ), |
|
823 | + esc_url($plugin_data['PluginURI']), |
|
824 | + esc_attr__('Visit plugin homepage', 'give'), |
|
826 | 825 | $plugin_name |
827 | 826 | ); |
828 | 827 | } |
829 | 828 | |
830 | 829 | // Link the author name to the author URL if available. |
831 | - if ( ! empty( $plugin_data['AuthorURI'] ) ) { |
|
830 | + if ( ! empty($plugin_data['AuthorURI'])) { |
|
832 | 831 | $author_name = sprintf( |
833 | 832 | '<a href="%s" title="%s">%s</a>', |
834 | - esc_url( $plugin_data['AuthorURI'] ), |
|
835 | - esc_attr__( 'Visit author homepage', 'give' ), |
|
833 | + esc_url($plugin_data['AuthorURI']), |
|
834 | + esc_attr__('Visit author homepage', 'give'), |
|
836 | 835 | $author_name |
837 | 836 | ); |
838 | 837 | } |
839 | 838 | ?> |
840 | 839 | <tr> |
841 | - <td><?php echo wp_kses( $plugin_name, wp_kses_allowed_html( 'post' ) ); ?></td> |
|
840 | + <td><?php echo wp_kses($plugin_name, wp_kses_allowed_html('post')); ?></td> |
|
842 | 841 | <td class="help"> </td> |
843 | - <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> |
|
842 | + <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> |
|
844 | 843 | </tr> |
845 | 844 | <?php |
846 | 845 | } |
@@ -850,38 +849,38 @@ discard block |
||
850 | 849 | |
851 | 850 | <?php |
852 | 851 | $active_mu_plugins = (array) get_mu_plugins(); |
853 | -if ( ! empty( $active_mu_plugins ) ) { |
|
852 | +if ( ! empty($active_mu_plugins)) { |
|
854 | 853 | ?> |
855 | 854 | <table class="give-status-table widefat" cellspacing="0"> |
856 | 855 | <thead> |
857 | 856 | <tr> |
858 | - <th colspan="3" data-export-label="Active MU Plugins"><h2><?php _e( 'Active MU Plugins', 'give' ); ?></h2></th> |
|
857 | + <th colspan="3" data-export-label="Active MU Plugins"><h2><?php _e('Active MU Plugins', 'give'); ?></h2></th> |
|
859 | 858 | </tr> |
860 | 859 | </thead> |
861 | 860 | <tbody> |
862 | 861 | <?php |
863 | 862 | |
864 | - foreach ( $active_mu_plugins as $mu_plugin_data ) { |
|
865 | - if ( ! empty( $mu_plugin_data['Name'] ) ) { |
|
863 | + foreach ($active_mu_plugins as $mu_plugin_data) { |
|
864 | + if ( ! empty($mu_plugin_data['Name'])) { |
|
866 | 865 | // Link the plugin name to the plugin URL if available. |
867 | - $plugin_name = esc_html( $mu_plugin_data['Name'] ); |
|
866 | + $plugin_name = esc_html($mu_plugin_data['Name']); |
|
868 | 867 | |
869 | - if ( ! empty( $mu_plugin_data['PluginURI'] ) ) { |
|
868 | + if ( ! empty($mu_plugin_data['PluginURI'])) { |
|
870 | 869 | $plugin_name = sprintf( |
871 | 870 | '<a href="%s" title="%s">%s</a>', |
872 | - esc_url( $mu_plugin_data['PluginURI'] ), |
|
873 | - esc_attr__( 'Visit plugin homepage', 'give' ), |
|
871 | + esc_url($mu_plugin_data['PluginURI']), |
|
872 | + esc_attr__('Visit plugin homepage', 'give'), |
|
874 | 873 | $plugin_name |
875 | 874 | ); |
876 | 875 | } |
877 | 876 | |
878 | 877 | // Link the author name to the author URL if available. |
879 | - $author_name = esc_html( $mu_plugin_data['Author'] ); |
|
878 | + $author_name = esc_html($mu_plugin_data['Author']); |
|
880 | 879 | |
881 | - if ( ! empty( $mu_plugin_data['AuthorURI'] ) ) { |
|
880 | + if ( ! empty($mu_plugin_data['AuthorURI'])) { |
|
882 | 881 | $author_name = sprintf( |
883 | 882 | '<a href="%s">%s</a>', |
884 | - esc_url( $mu_plugin_data['AuthorURI'] ), |
|
883 | + esc_url($mu_plugin_data['AuthorURI']), |
|
885 | 884 | $author_name |
886 | 885 | ); |
887 | 886 | } |
@@ -889,7 +888,7 @@ discard block |
||
889 | 888 | <tr> |
890 | 889 | <td><?php echo $plugin_name; ?></td> |
891 | 890 | <td class="help"> </td> |
892 | - <td><?php echo sprintf( _x( 'by %s', 'by author', 'give' ), $author_name ) . ' – ' . esc_html( $mu_plugin_data['Version'] ); ?></td> |
|
891 | + <td><?php echo sprintf(_x('by %s', 'by author', 'give'), $author_name).' – '.esc_html($mu_plugin_data['Version']); ?></td> |
|
893 | 892 | </tr> |
894 | 893 | <?php |
895 | 894 | } |
@@ -902,53 +901,53 @@ discard block |
||
902 | 901 | <table class="give-status-table widefat" cellspacing="0"> |
903 | 902 | <thead> |
904 | 903 | <tr> |
905 | - <th colspan="3" data-export-label="Theme"><h2><?php _e( 'Theme', 'give' ); ?></h2></th> |
|
904 | + <th colspan="3" data-export-label="Theme"><h2><?php _e('Theme', 'give'); ?></h2></th> |
|
906 | 905 | </tr> |
907 | 906 | </thead> |
908 | 907 | <?php |
909 | - include_once( ABSPATH . 'wp-admin/includes/theme-install.php' ); |
|
908 | + include_once(ABSPATH.'wp-admin/includes/theme-install.php'); |
|
910 | 909 | $active_theme = wp_get_theme(); |
911 | 910 | ?> |
912 | 911 | <tbody> |
913 | 912 | <tr> |
914 | - <td data-export-label="Name"><?php _e( 'Name', 'give' ); ?>:</td> |
|
915 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'The name of the current active theme.', 'give' ) ); ?></td> |
|
916 | - <td><?php echo esc_html( $active_theme->Name ); ?></td> |
|
913 | + <td data-export-label="Name"><?php _e('Name', 'give'); ?>:</td> |
|
914 | + <td class="help"><?php echo Give()->tooltips->render_help(__('The name of the current active theme.', 'give')); ?></td> |
|
915 | + <td><?php echo esc_html($active_theme->Name); ?></td> |
|
917 | 916 | </tr> |
918 | 917 | <tr> |
919 | - <td data-export-label="Version"><?php _e( 'Version', 'give' ); ?>:</td> |
|
920 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'The installed version of the current active theme.', 'give' ) ); ?></td> |
|
921 | - <td><?php echo esc_html( $active_theme->Version ); ?></td> |
|
918 | + <td data-export-label="Version"><?php _e('Version', 'give'); ?>:</td> |
|
919 | + <td class="help"><?php echo Give()->tooltips->render_help(__('The installed version of the current active theme.', 'give')); ?></td> |
|
920 | + <td><?php echo esc_html($active_theme->Version); ?></td> |
|
922 | 921 | </tr> |
923 | 922 | <tr> |
924 | - <td data-export-label="Author URL"><?php _e( 'Author URL', 'give' ); ?>:</td> |
|
925 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'The theme developer\'s URL.', 'give' ) ); ?></td> |
|
923 | + <td data-export-label="Author URL"><?php _e('Author URL', 'give'); ?>:</td> |
|
924 | + <td class="help"><?php echo Give()->tooltips->render_help(__('The theme developer\'s URL.', 'give')); ?></td> |
|
926 | 925 | <td><?php echo $active_theme->{'Author URI'}; ?></td> |
927 | 926 | </tr> |
928 | 927 | <tr> |
929 | - <td data-export-label="Child Theme"><?php _e( 'Child Theme', 'give' ); ?>:</td> |
|
930 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'Whether the current theme is a child theme.', 'give' ) ); ?></td> |
|
928 | + <td data-export-label="Child Theme"><?php _e('Child Theme', 'give'); ?>:</td> |
|
929 | + <td class="help"><?php echo Give()->tooltips->render_help(__('Whether the current theme is a child theme.', 'give')); ?></td> |
|
931 | 930 | <td><?php |
932 | - 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' ); |
|
931 | + 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'); |
|
933 | 932 | ?></td> |
934 | 933 | </tr> |
935 | 934 | <?php |
936 | - if( is_child_theme() ) { |
|
937 | - $parent_theme = wp_get_theme( $active_theme->Template ); |
|
935 | + if (is_child_theme()) { |
|
936 | + $parent_theme = wp_get_theme($active_theme->Template); |
|
938 | 937 | ?> |
939 | 938 | <tr> |
940 | - <td data-export-label="Parent Theme Name"><?php _e( 'Parent Theme Name', 'give' ); ?>:</td> |
|
941 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'The name of the parent theme.', 'give' ) ); ?></td> |
|
942 | - <td><?php echo esc_html( $parent_theme->Name ); ?></td> |
|
939 | + <td data-export-label="Parent Theme Name"><?php _e('Parent Theme Name', 'give'); ?>:</td> |
|
940 | + <td class="help"><?php echo Give()->tooltips->render_help(__('The name of the parent theme.', 'give')); ?></td> |
|
941 | + <td><?php echo esc_html($parent_theme->Name); ?></td> |
|
943 | 942 | </tr> |
944 | 943 | <tr> |
945 | - <td data-export-label="Parent Theme Version"><?php _e( 'Parent Theme Version', 'give' ); ?>:</td> |
|
946 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'The installed version of the parent theme.', 'give' ) ); ?></td> |
|
947 | - <td><?php echo esc_html( $parent_theme->Version ); ?></td> |
|
944 | + <td data-export-label="Parent Theme Version"><?php _e('Parent Theme Version', 'give'); ?>:</td> |
|
945 | + <td class="help"><?php echo Give()->tooltips->render_help(__('The installed version of the parent theme.', 'give')); ?></td> |
|
946 | + <td><?php echo esc_html($parent_theme->Version); ?></td> |
|
948 | 947 | </tr> |
949 | 948 | <tr> |
950 | - <td data-export-label="Parent Theme Author URL"><?php _e( 'Parent Theme Author URL', 'give' ); ?>:</td> |
|
951 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'The parent theme developers URL.', 'give' ) ); ?></td> |
|
949 | + <td data-export-label="Parent Theme Author URL"><?php _e('Parent Theme Author URL', 'give'); ?>:</td> |
|
950 | + <td class="help"><?php echo Give()->tooltips->render_help(__('The parent theme developers URL.', 'give')); ?></td> |
|
952 | 951 | <td><?php echo $parent_theme->{'Author URI'}; ?></td> |
953 | 952 | </tr> |
954 | 953 | <?php } ?> |
@@ -11,11 +11,11 @@ discard block |
||
11 | 11 | * @since 1.8.17 |
12 | 12 | */ |
13 | 13 | |
14 | -if ( ! defined( 'ABSPATH' ) ) { |
|
14 | +if ( ! defined('ABSPATH')) { |
|
15 | 15 | exit; // Exit if accessed directly |
16 | 16 | } |
17 | 17 | |
18 | -if ( ! class_exists( 'Give_Import_Core_Settings' ) ) { |
|
18 | +if ( ! class_exists('Give_Import_Core_Settings')) { |
|
19 | 19 | |
20 | 20 | /** |
21 | 21 | * Give_Import_Core_Settings. |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | * @return static |
69 | 69 | */ |
70 | 70 | public static function get_instance() { |
71 | - if ( null === static::$instance ) { |
|
71 | + if (null === static::$instance) { |
|
72 | 72 | self::$instance = new static(); |
73 | 73 | } |
74 | 74 | |
@@ -95,26 +95,26 @@ discard block |
||
95 | 95 | * @return void |
96 | 96 | */ |
97 | 97 | private function setup_hooks() { |
98 | - if ( ! $this->is_donations_import_page() ) { |
|
98 | + if ( ! $this->is_donations_import_page()) { |
|
99 | 99 | return; |
100 | 100 | } |
101 | 101 | |
102 | 102 | // Do not render main import tools page. |
103 | - remove_action( 'give_admin_field_tools_import', array( 'Give_Settings_Import', 'render_import_field', ) ); |
|
103 | + remove_action('give_admin_field_tools_import', array('Give_Settings_Import', 'render_import_field',)); |
|
104 | 104 | |
105 | 105 | // Render donation import page |
106 | - add_action( 'give_admin_field_tools_import', array( $this, 'render_page' ) ); |
|
106 | + add_action('give_admin_field_tools_import', array($this, 'render_page')); |
|
107 | 107 | |
108 | 108 | // Print the HTML. |
109 | - add_action( 'give_tools_import_core_settings_form_start', array( $this, 'html' ), 10 ); |
|
109 | + add_action('give_tools_import_core_settings_form_start', array($this, 'html'), 10); |
|
110 | 110 | |
111 | 111 | // Run when form submit. |
112 | - add_action( 'give-tools_save_import', array( $this, 'save' ) ); |
|
112 | + add_action('give-tools_save_import', array($this, 'save')); |
|
113 | 113 | |
114 | - add_action( 'give-tools_update_notices', array( $this, 'update_notices' ), 11, 1 ); |
|
114 | + add_action('give-tools_update_notices', array($this, 'update_notices'), 11, 1); |
|
115 | 115 | |
116 | 116 | // Used to add submit button. |
117 | - add_action( 'give_tools_import_core_settings_form_end', array( $this, 'submit' ), 10 ); |
|
117 | + add_action('give_tools_import_core_settings_form_end', array($this, 'submit'), 10); |
|
118 | 118 | } |
119 | 119 | |
120 | 120 | /** |
@@ -126,9 +126,9 @@ discard block |
||
126 | 126 | * |
127 | 127 | * @return mixed |
128 | 128 | */ |
129 | - public function update_notices( $messages ) { |
|
130 | - if ( ! empty( $_GET['tab'] ) && 'import' === give_clean( $_GET['tab'] ) ) { |
|
131 | - unset( $messages['give-setting-updated'] ); |
|
129 | + public function update_notices($messages) { |
|
130 | + if ( ! empty($_GET['tab']) && 'import' === give_clean($_GET['tab'])) { |
|
131 | + unset($messages['give-setting-updated']); |
|
132 | 132 | } |
133 | 133 | |
134 | 134 | return $messages; |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | * @since 1.8.17 |
141 | 141 | */ |
142 | 142 | public function submit() { |
143 | - wp_nonce_field( 'give-save-settings', '_give-save-settings' ); |
|
143 | + wp_nonce_field('give-save-settings', '_give-save-settings'); |
|
144 | 144 | ?> |
145 | 145 | <input type="hidden" class="import-step" id="import-step" name="step" value="<?php echo $this->get_step(); ?>"/> |
146 | 146 | <input type="hidden" class="importer-type" value="<?php echo $this->importer_type; ?>"/> |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | id="<?php echo "step-{$step}"; ?>"> |
164 | 164 | <tbody> |
165 | 165 | <?php |
166 | - switch ( $this->get_step() ) { |
|
166 | + switch ($this->get_step()) { |
|
167 | 167 | case 1: |
168 | 168 | $this->render_upload_html(); |
169 | 169 | break; |
@@ -190,14 +190,14 @@ discard block |
||
190 | 190 | public function import_success() { |
191 | 191 | // Imported successfully |
192 | 192 | |
193 | - $success = (bool) ( isset( $_GET['success'] ) ? give_clean( $_GET['success'] ) : false ); |
|
194 | - $undo = (bool) ( isset( $_GET['undo'] ) ? give_clean( $_GET['undo'] ) : false ); |
|
193 | + $success = (bool) (isset($_GET['success']) ? give_clean($_GET['success']) : false); |
|
194 | + $undo = (bool) (isset($_GET['undo']) ? give_clean($_GET['undo']) : false); |
|
195 | 195 | $query_arg_setting = array( |
196 | 196 | 'post_type' => 'give_forms', |
197 | 197 | 'page' => 'give-settings', |
198 | 198 | ); |
199 | 199 | |
200 | - if ( $undo ) { |
|
200 | + if ($undo) { |
|
201 | 201 | $success = false; |
202 | 202 | } |
203 | 203 | |
@@ -210,30 +210,30 @@ discard block |
||
210 | 210 | 'undo' => 'true', |
211 | 211 | ); |
212 | 212 | |
213 | - $title = __( 'Settings Importing Completed!', 'give' ); |
|
214 | - if ( $success ) { |
|
213 | + $title = __('Settings Importing Completed!', 'give'); |
|
214 | + if ($success) { |
|
215 | 215 | $query_arg_success['undo'] = '1'; |
216 | 216 | $query_arg_success['step'] = '3'; |
217 | 217 | $query_arg_success['success'] = '1'; |
218 | - $text = __( 'Undo Importing', 'give' ); |
|
218 | + $text = __('Undo Importing', 'give'); |
|
219 | 219 | } else { |
220 | - if ( $undo ) { |
|
221 | - $host_give_options = get_option( 'give_settings_old', array() ); |
|
222 | - update_option( 'give_settings', $host_give_options ); |
|
223 | - $title = __( 'Undo of Setting Imported Completed!', 'give' ); |
|
220 | + if ($undo) { |
|
221 | + $host_give_options = get_option('give_settings_old', array()); |
|
222 | + update_option('give_settings', $host_give_options); |
|
223 | + $title = __('Undo of Setting Imported Completed!', 'give'); |
|
224 | 224 | } else { |
225 | - $title = __( 'Failed to import', 'give' ); |
|
225 | + $title = __('Failed to import', 'give'); |
|
226 | 226 | } |
227 | 227 | |
228 | - $text = __( 'Importing Again', 'give' ); |
|
228 | + $text = __('Importing Again', 'give'); |
|
229 | 229 | } |
230 | 230 | ?> |
231 | 231 | <tr valign="top" class="give-import-dropdown"> |
232 | 232 | <th colspan="2"> |
233 | 233 | <h2><?php echo $title; ?></h2> |
234 | 234 | <p> |
235 | - <a class="button button-large button-secondary" href="<?php echo add_query_arg( $query_arg_success, admin_url( 'edit.php' ) ); ?>"><?php echo $text; ?></a> |
|
236 | - <a class="button button-large button-secondary" href="<?php echo add_query_arg( $query_arg_setting, admin_url( 'edit.php' ) ); ?>"><?php echo __( 'View Settings', 'give' ); ?></a> |
|
235 | + <a class="button button-large button-secondary" href="<?php echo add_query_arg($query_arg_success, admin_url('edit.php')); ?>"><?php echo $text; ?></a> |
|
236 | + <a class="button button-large button-secondary" href="<?php echo add_query_arg($query_arg_setting, admin_url('edit.php')); ?>"><?php echo __('View Settings', 'give'); ?></a> |
|
237 | 237 | </p> |
238 | 238 | </th> |
239 | 239 | </tr> |
@@ -246,14 +246,14 @@ discard block |
||
246 | 246 | * @since 1.8.17 |
247 | 247 | */ |
248 | 248 | public function start_import() { |
249 | - $type = ( ! empty( $_GET['type'] ) ? give_clean( $_GET['type'] ) : 'replace' ); |
|
250 | - $file_name = ( ! empty( $_GET['file_name'] ) ? give_clean( $_GET['file_name'] ) : '' ); |
|
249 | + $type = ( ! empty($_GET['type']) ? give_clean($_GET['type']) : 'replace'); |
|
250 | + $file_name = ( ! empty($_GET['file_name']) ? give_clean($_GET['file_name']) : ''); |
|
251 | 251 | |
252 | 252 | ?> |
253 | 253 | <tr valign="top" class="give-import-dropdown"> |
254 | 254 | <th colspan="2"> |
255 | - <h2 id="give-import-title"><?php esc_html_e( 'Importing', 'give' ) ?></h2> |
|
256 | - <p class="give-field-description"><?php esc_html_e( 'Your settings are now being imported...', 'give' ) ?></p> |
|
255 | + <h2 id="give-import-title"><?php esc_html_e('Importing', 'give') ?></h2> |
|
256 | + <p class="give-field-description"><?php esc_html_e('Your settings are now being imported...', 'give') ?></p> |
|
257 | 257 | </th> |
258 | 258 | </tr> |
259 | 259 | |
@@ -286,14 +286,14 @@ discard block |
||
286 | 286 | $step = $this->get_step(); |
287 | 287 | ?> |
288 | 288 | <ol class="give-progress-steps"> |
289 | - <li class="<?php echo( 1 === $step ? 'active' : '' ); ?>"> |
|
290 | - <?php esc_html_e( 'Upload JSON file', 'give' ); ?> |
|
289 | + <li class="<?php echo(1 === $step ? 'active' : ''); ?>"> |
|
290 | + <?php esc_html_e('Upload JSON file', 'give'); ?> |
|
291 | 291 | </li> |
292 | - <li class="<?php echo( 2 === $step ? 'active' : '' ); ?>"> |
|
293 | - <?php esc_html_e( 'Import', 'give' ); ?> |
|
292 | + <li class="<?php echo(2 === $step ? 'active' : ''); ?>"> |
|
293 | + <?php esc_html_e('Import', 'give'); ?> |
|
294 | 294 | </li> |
295 | - <li class="<?php echo( 3 === $step ? 'active' : '' ); ?>"> |
|
296 | - <?php esc_html_e( 'Done!', 'give' ); ?> |
|
295 | + <li class="<?php echo(3 === $step ? 'active' : ''); ?>"> |
|
296 | + <?php esc_html_e('Done!', 'give'); ?> |
|
297 | 297 | </li> |
298 | 298 | </ol> |
299 | 299 | <?php |
@@ -307,14 +307,14 @@ discard block |
||
307 | 307 | * @return int $step on which step doest the import is on. |
308 | 308 | */ |
309 | 309 | public function get_step() { |
310 | - $step = (int) ( isset( $_REQUEST['step'] ) ? give_clean( $_REQUEST['step'] ) : 0 ); |
|
310 | + $step = (int) (isset($_REQUEST['step']) ? give_clean($_REQUEST['step']) : 0); |
|
311 | 311 | $on_step = 1; |
312 | 312 | |
313 | - if ( empty( $step ) || 1 === $step ) { |
|
313 | + if (empty($step) || 1 === $step) { |
|
314 | 314 | $on_step = 1; |
315 | - } elseif ( 2 === $step ) { |
|
315 | + } elseif (2 === $step) { |
|
316 | 316 | $on_step = 2; |
317 | - } elseif ( 3 === $step ) { |
|
317 | + } elseif (3 === $step) { |
|
318 | 318 | $on_step = 3; |
319 | 319 | } |
320 | 320 | |
@@ -327,7 +327,7 @@ discard block |
||
327 | 327 | * @since 1.8.17 |
328 | 328 | */ |
329 | 329 | public function render_page() { |
330 | - include_once GIVE_PLUGIN_DIR . 'includes/admin/tools/views/html-admin-page-import-core-settings.php'; |
|
330 | + include_once GIVE_PLUGIN_DIR.'includes/admin/tools/views/html-admin-page-import-core-settings.php'; |
|
331 | 331 | } |
332 | 332 | |
333 | 333 | /** |
@@ -339,28 +339,28 @@ discard block |
||
339 | 339 | * @return void |
340 | 340 | */ |
341 | 341 | public function render_upload_html() { |
342 | - $json = ( isset( $_POST['json'] ) ? give_clean( $_POST['json'] ) : '' ); |
|
343 | - $type = ( isset( $_POST['type'] ) ? give_clean( $_POST['type'] ) : 'merge' ); |
|
342 | + $json = (isset($_POST['json']) ? give_clean($_POST['json']) : ''); |
|
343 | + $type = (isset($_POST['type']) ? give_clean($_POST['type']) : 'merge'); |
|
344 | 344 | $step = $this->get_step(); |
345 | 345 | |
346 | 346 | ?> |
347 | 347 | <tr valign="top"> |
348 | 348 | <th colspan="2"> |
349 | - <h2 id="give-import-title"><?php esc_html_e( 'Import Core Settings from a JSON file', 'give' ) ?></h2> |
|
350 | - <p class="give-field-description"><?php esc_html_e( 'This tool allows you to import Give settings from another Give installation. Settings imported contain data from Give core as well as any of our Premium Add-ons.', 'give' ) ?></p> |
|
349 | + <h2 id="give-import-title"><?php esc_html_e('Import Core Settings from a JSON file', 'give') ?></h2> |
|
350 | + <p class="give-field-description"><?php esc_html_e('This tool allows you to import Give settings from another Give installation. Settings imported contain data from Give core as well as any of our Premium Add-ons.', 'give') ?></p> |
|
351 | 351 | </th> |
352 | 352 | </tr> |
353 | 353 | |
354 | 354 | <tr valign="top"> |
355 | 355 | <th scope="row" class="titledesc"> |
356 | - <label for="json"><?php esc_html_e( 'Choose a JSON file:', 'give' ) ?></label> |
|
356 | + <label for="json"><?php esc_html_e('Choose a JSON file:', 'give') ?></label> |
|
357 | 357 | </th> |
358 | 358 | <td class="give-forminp"> |
359 | 359 | <div class="give-field-wrap"> |
360 | 360 | <label for="json"> |
361 | 361 | <input type="file" name="json" class="give-upload-json-file" value="<?php echo $json; ?>" |
362 | 362 | accept=".json"> |
363 | - <p class="give-field-description"><?php esc_html_e( 'The file type must be JSON.', 'give' )?></p> |
|
363 | + <p class="give-field-description"><?php esc_html_e('The file type must be JSON.', 'give')?></p> |
|
364 | 364 | </label> |
365 | 365 | </div> |
366 | 366 | </td> |
@@ -369,20 +369,20 @@ discard block |
||
369 | 369 | $settings = array( |
370 | 370 | array( |
371 | 371 | 'id' => 'type', |
372 | - 'name' => __( 'Merge Type:', 'give' ), |
|
373 | - 'description' => __( 'Select "Merge" to retain existing settings, or "Replace" to overwrite with the settings from the JSON file', 'give' ), |
|
372 | + 'name' => __('Merge Type:', 'give'), |
|
373 | + 'description' => __('Select "Merge" to retain existing settings, or "Replace" to overwrite with the settings from the JSON file', 'give'), |
|
374 | 374 | 'default' => $type, |
375 | 375 | 'type' => 'radio_inline', |
376 | 376 | 'options' => array( |
377 | - 'merge' => __( 'Merge', 'give' ), |
|
378 | - 'replace' => __( 'Replace', 'give' ), |
|
377 | + 'merge' => __('Merge', 'give'), |
|
378 | + 'replace' => __('Replace', 'give'), |
|
379 | 379 | ), |
380 | 380 | ), |
381 | 381 | ); |
382 | 382 | |
383 | - $settings = apply_filters( 'give_import_core_setting_html', $settings ); |
|
383 | + $settings = apply_filters('give_import_core_setting_html', $settings); |
|
384 | 384 | |
385 | - Give_Admin_Settings::output_fields( $settings, 'give_settings' ); |
|
385 | + Give_Admin_Settings::output_fields($settings, 'give_settings'); |
|
386 | 386 | ?> |
387 | 387 | <tr valign="top"> |
388 | 388 | <th></th> |
@@ -390,7 +390,7 @@ discard block |
||
390 | 390 | <input type="submit" |
391 | 391 | class="button button-primary button-large button-secondary <?php echo "step-{$step}"; ?>" |
392 | 392 | id="recount-stats-submit" |
393 | - value="<?php esc_attr_e( 'Submit', 'give' ); ?>"/> |
|
393 | + value="<?php esc_attr_e('Submit', 'give'); ?>"/> |
|
394 | 394 | </th> |
395 | 395 | </tr> |
396 | 396 | <?php |
@@ -407,20 +407,20 @@ discard block |
||
407 | 407 | $step = $this->get_step(); |
408 | 408 | |
409 | 409 | // Validation for first step. |
410 | - if ( 1 === $step ) { |
|
411 | - $type = ( ! empty( $_REQUEST['type'] ) ? give_clean( $_REQUEST['type'] ) : 'replace' ); |
|
410 | + if (1 === $step) { |
|
411 | + $type = ( ! empty($_REQUEST['type']) ? give_clean($_REQUEST['type']) : 'replace'); |
|
412 | 412 | $core_settings = self::upload_widget_settings_file(); |
413 | - if ( ! empty( $core_settings['error'] ) ) { |
|
414 | - Give_Admin_Settings::add_error( 'give-import-csv', __( 'Please upload a valid JSON settings file.', 'give' ) ); |
|
413 | + if ( ! empty($core_settings['error'])) { |
|
414 | + Give_Admin_Settings::add_error('give-import-csv', __('Please upload a valid JSON settings file.', 'give')); |
|
415 | 415 | } else { |
416 | - $file_path = explode( '/', $core_settings['file'] ); |
|
417 | - $count = ( count( $file_path ) - 1 ); |
|
418 | - $url = give_import_page_url( (array) apply_filters( 'give_import_core_settings_importing_url', array( |
|
416 | + $file_path = explode('/', $core_settings['file']); |
|
417 | + $count = (count($file_path) - 1); |
|
418 | + $url = give_import_page_url((array) apply_filters('give_import_core_settings_importing_url', array( |
|
419 | 419 | 'step' => '2', |
420 | 420 | 'importer-type' => $this->importer_type, |
421 | 421 | 'type' => $type, |
422 | - 'file_name' => $file_path[ $count ], |
|
423 | - ) ) ); |
|
422 | + 'file_name' => $file_path[$count], |
|
423 | + ))); |
|
424 | 424 | |
425 | 425 | ?> |
426 | 426 | <script type="text/javascript"> |
@@ -438,7 +438,7 @@ discard block |
||
438 | 438 | * @return bool |
439 | 439 | */ |
440 | 440 | private function is_donations_import_page() { |
441 | - return 'import' === give_get_current_setting_tab() && isset( $_GET['importer-type'] ) && $this->importer_type === give_clean( $_GET['importer-type'] ); |
|
441 | + return 'import' === give_get_current_setting_tab() && isset($_GET['importer-type']) && $this->importer_type === give_clean($_GET['importer-type']); |
|
442 | 442 | } |
443 | 443 | |
444 | 444 | /** |
@@ -447,14 +447,14 @@ discard block |
||
447 | 447 | */ |
448 | 448 | public static function upload_widget_settings_file() { |
449 | 449 | $upload = false; |
450 | - if ( isset( $_FILES['json'] ) ) { |
|
451 | - add_filter( 'upload_mimes', array( __CLASS__, 'json_upload_mimes' ) ); |
|
450 | + if (isset($_FILES['json'])) { |
|
451 | + add_filter('upload_mimes', array(__CLASS__, 'json_upload_mimes')); |
|
452 | 452 | |
453 | - $upload = wp_handle_upload( $_FILES['json'], array( 'test_form' => false ) ); |
|
453 | + $upload = wp_handle_upload($_FILES['json'], array('test_form' => false)); |
|
454 | 454 | |
455 | - remove_filter( 'upload_mimes', array( __CLASS__, 'json_upload_mimes' ) ); |
|
455 | + remove_filter('upload_mimes', array(__CLASS__, 'json_upload_mimes')); |
|
456 | 456 | } else { |
457 | - Give_Admin_Settings::add_error( 'give-import-csv', __( 'Please upload or provide a valid JSON file.', 'give' ) ); |
|
457 | + Give_Admin_Settings::add_error('give-import-csv', __('Please upload or provide a valid JSON file.', 'give')); |
|
458 | 458 | } |
459 | 459 | |
460 | 460 | return $upload; |
@@ -465,7 +465,7 @@ discard block |
||
465 | 465 | * |
466 | 466 | * @param array $existing_mimes |
467 | 467 | */ |
468 | - public static function json_upload_mimes( $existing_mimes = array() ) { |
|
468 | + public static function json_upload_mimes($existing_mimes = array()) { |
|
469 | 469 | $existing_mimes['json'] = 'application/json'; |
470 | 470 | |
471 | 471 | return $existing_mimes; |
@@ -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 | |
@@ -28,21 +28,21 @@ discard block |
||
28 | 28 | * |
29 | 29 | * @return void |
30 | 30 | */ |
31 | -function give_complete_purchase( $payment_id, $new_status, $old_status ) { |
|
31 | +function give_complete_purchase($payment_id, $new_status, $old_status) { |
|
32 | 32 | |
33 | 33 | // Make sure that payments are only completed once. |
34 | - if ( $old_status == 'publish' || $old_status == 'complete' ) { |
|
34 | + if ($old_status == 'publish' || $old_status == 'complete') { |
|
35 | 35 | return; |
36 | 36 | } |
37 | 37 | |
38 | 38 | // Make sure the payment completion is only processed when new status is complete. |
39 | - if ( $new_status != 'publish' && $new_status != 'complete' ) { |
|
39 | + if ($new_status != 'publish' && $new_status != 'complete') { |
|
40 | 40 | return; |
41 | 41 | } |
42 | 42 | |
43 | - $payment = new Give_Payment( $payment_id ); |
|
43 | + $payment = new Give_Payment($payment_id); |
|
44 | 44 | |
45 | - $creation_date = get_post_field( 'post_date', $payment_id, 'raw' ); |
|
45 | + $creation_date = get_post_field('post_date', $payment_id, 'raw'); |
|
46 | 46 | $payment_meta = $payment->payment_meta; |
47 | 47 | $completed_date = $payment->completed_date; |
48 | 48 | $user_info = $payment->user_info; |
@@ -58,12 +58,12 @@ discard block |
||
58 | 58 | * |
59 | 59 | * @param int $payment_id The ID of the payment. |
60 | 60 | */ |
61 | - do_action( 'give_pre_complete_donation', $payment_id ); |
|
61 | + do_action('give_pre_complete_donation', $payment_id); |
|
62 | 62 | |
63 | 63 | // Ensure these actions only run once, ever. |
64 | - if ( empty( $completed_date ) ) { |
|
64 | + if (empty($completed_date)) { |
|
65 | 65 | |
66 | - give_record_donation_in_log( $form_id, $payment_id, $price_id, $creation_date ); |
|
66 | + give_record_donation_in_log($form_id, $payment_id, $price_id, $creation_date); |
|
67 | 67 | |
68 | 68 | /** |
69 | 69 | * Fires after logging donation record. |
@@ -74,29 +74,29 @@ discard block |
||
74 | 74 | * @param int $payment_id The ID number of the payment. |
75 | 75 | * @param array $payment_meta The payment meta. |
76 | 76 | */ |
77 | - do_action( 'give_complete_form_donation', $form_id, $payment_id, $payment_meta ); |
|
77 | + do_action('give_complete_form_donation', $form_id, $payment_id, $payment_meta); |
|
78 | 78 | |
79 | 79 | } |
80 | 80 | |
81 | 81 | // Increase the earnings for this form ID. |
82 | - give_increase_earnings( $form_id, $amount ); |
|
83 | - give_increase_donation_count( $form_id ); |
|
82 | + give_increase_earnings($form_id, $amount); |
|
83 | + give_increase_donation_count($form_id); |
|
84 | 84 | |
85 | 85 | // @todo: Refresh only range related stat cache |
86 | 86 | give_delete_donation_stats(); |
87 | 87 | |
88 | 88 | // Increase the donor's donation stats. |
89 | - $donor = new Give_Donor( $donor_id ); |
|
89 | + $donor = new Give_Donor($donor_id); |
|
90 | 90 | $donor->increase_purchase_count(); |
91 | - $donor->increase_value( $amount ); |
|
91 | + $donor->increase_value($amount); |
|
92 | 92 | |
93 | - give_increase_total_earnings( $amount ); |
|
93 | + give_increase_total_earnings($amount); |
|
94 | 94 | |
95 | 95 | // Ensure this action only runs once ever. |
96 | - if ( empty( $completed_date ) ) { |
|
96 | + if (empty($completed_date)) { |
|
97 | 97 | |
98 | 98 | // Save the completed date. |
99 | - $payment->completed_date = current_time( 'mysql' ); |
|
99 | + $payment->completed_date = current_time('mysql'); |
|
100 | 100 | $payment->save(); |
101 | 101 | |
102 | 102 | /** |
@@ -106,12 +106,12 @@ discard block |
||
106 | 106 | * |
107 | 107 | * @param int $payment_id The ID of the payment. |
108 | 108 | */ |
109 | - do_action( 'give_complete_donation', $payment_id ); |
|
109 | + do_action('give_complete_donation', $payment_id); |
|
110 | 110 | } |
111 | 111 | |
112 | 112 | } |
113 | 113 | |
114 | -add_action( 'give_update_payment_status', 'give_complete_purchase', 100, 3 ); |
|
114 | +add_action('give_update_payment_status', 'give_complete_purchase', 100, 3); |
|
115 | 115 | |
116 | 116 | |
117 | 117 | /** |
@@ -125,20 +125,20 @@ discard block |
||
125 | 125 | * |
126 | 126 | * @return void |
127 | 127 | */ |
128 | -function give_record_status_change( $payment_id, $new_status, $old_status ) { |
|
128 | +function give_record_status_change($payment_id, $new_status, $old_status) { |
|
129 | 129 | |
130 | 130 | // Get the list of statuses so that status in the payment note can be translated. |
131 | 131 | $stati = give_get_payment_statuses(); |
132 | - $old_status = isset( $stati[ $old_status ] ) ? $stati[ $old_status ] : $old_status; |
|
133 | - $new_status = isset( $stati[ $new_status ] ) ? $stati[ $new_status ] : $new_status; |
|
132 | + $old_status = isset($stati[$old_status]) ? $stati[$old_status] : $old_status; |
|
133 | + $new_status = isset($stati[$new_status]) ? $stati[$new_status] : $new_status; |
|
134 | 134 | |
135 | 135 | // translators: 1: old status 2: new status. |
136 | - $status_change = sprintf( esc_html__( 'Status changed from %1$s to %2$s.', 'give' ), $old_status, $new_status ); |
|
136 | + $status_change = sprintf(esc_html__('Status changed from %1$s to %2$s.', 'give'), $old_status, $new_status); |
|
137 | 137 | |
138 | - give_insert_payment_note( $payment_id, $status_change ); |
|
138 | + give_insert_payment_note($payment_id, $status_change); |
|
139 | 139 | } |
140 | 140 | |
141 | -add_action( 'give_update_payment_status', 'give_record_status_change', 100, 3 ); |
|
141 | +add_action('give_update_payment_status', 'give_record_status_change', 100, 3); |
|
142 | 142 | |
143 | 143 | |
144 | 144 | /** |
@@ -154,25 +154,25 @@ discard block |
||
154 | 154 | * |
155 | 155 | * @return void |
156 | 156 | */ |
157 | -function give_update_old_payments_with_totals( $data ) { |
|
158 | - if ( ! wp_verify_nonce( $data['_wpnonce'], 'give_upgrade_payments_nonce' ) ) { |
|
157 | +function give_update_old_payments_with_totals($data) { |
|
158 | + if ( ! wp_verify_nonce($data['_wpnonce'], 'give_upgrade_payments_nonce')) { |
|
159 | 159 | return; |
160 | 160 | } |
161 | 161 | |
162 | - if ( get_option( 'give_payment_totals_upgraded' ) ) { |
|
162 | + if (get_option('give_payment_totals_upgraded')) { |
|
163 | 163 | return; |
164 | 164 | } |
165 | 165 | |
166 | - $payments = give_get_payments( array( |
|
166 | + $payments = give_get_payments(array( |
|
167 | 167 | 'offset' => 0, |
168 | - 'number' => - 1, |
|
168 | + 'number' => -1, |
|
169 | 169 | 'mode' => 'all', |
170 | - ) ); |
|
170 | + )); |
|
171 | 171 | |
172 | - if ( $payments ) { |
|
173 | - foreach ( $payments as $payment ) { |
|
172 | + if ($payments) { |
|
173 | + foreach ($payments as $payment) { |
|
174 | 174 | |
175 | - $payment = new Give_Payment( $payment->ID ); |
|
175 | + $payment = new Give_Payment($payment->ID); |
|
176 | 176 | $meta = $payment->get_meta(); |
177 | 177 | |
178 | 178 | $payment->total = $meta['amount']; |
@@ -181,10 +181,10 @@ discard block |
||
181 | 181 | } |
182 | 182 | } |
183 | 183 | |
184 | - add_option( 'give_payment_totals_upgraded', 1 ); |
|
184 | + add_option('give_payment_totals_upgraded', 1); |
|
185 | 185 | } |
186 | 186 | |
187 | -add_action( 'give_upgrade_payments', 'give_update_old_payments_with_totals' ); |
|
187 | +add_action('give_upgrade_payments', 'give_update_old_payments_with_totals'); |
|
188 | 188 | |
189 | 189 | /** |
190 | 190 | * Mark Abandoned Donations |
@@ -198,17 +198,17 @@ discard block |
||
198 | 198 | function give_mark_abandoned_donations() { |
199 | 199 | $args = array( |
200 | 200 | 'status' => 'pending', |
201 | - 'number' => - 1, |
|
201 | + 'number' => -1, |
|
202 | 202 | 'output' => 'give_payments', |
203 | 203 | ); |
204 | 204 | |
205 | - add_filter( 'posts_where', 'give_filter_where_older_than_week' ); |
|
205 | + add_filter('posts_where', 'give_filter_where_older_than_week'); |
|
206 | 206 | |
207 | - $payments = give_get_payments( $args ); |
|
207 | + $payments = give_get_payments($args); |
|
208 | 208 | |
209 | - remove_filter( 'posts_where', 'give_filter_where_older_than_week' ); |
|
209 | + remove_filter('posts_where', 'give_filter_where_older_than_week'); |
|
210 | 210 | |
211 | - if ( $payments ) { |
|
211 | + if ($payments) { |
|
212 | 212 | /** |
213 | 213 | * Filter payment gateways: Used to set payment gateways which can be skip while transferring pending payment to abandon. |
214 | 214 | * |
@@ -216,13 +216,13 @@ discard block |
||
216 | 216 | * |
217 | 217 | * @param array $skip_payment_gateways Array of payment gateways |
218 | 218 | */ |
219 | - $skip_payment_gateways = apply_filters( 'give_mark_abandoned_donation_gateways', array( 'offline' ) ); |
|
219 | + $skip_payment_gateways = apply_filters('give_mark_abandoned_donation_gateways', array('offline')); |
|
220 | 220 | |
221 | - foreach ( $payments as $payment ) { |
|
222 | - $gateway = give_get_payment_gateway( $payment ); |
|
221 | + foreach ($payments as $payment) { |
|
222 | + $gateway = give_get_payment_gateway($payment); |
|
223 | 223 | |
224 | 224 | // Skip payment gateways. |
225 | - if ( in_array( $gateway, $skip_payment_gateways ) ) { |
|
225 | + if (in_array($gateway, $skip_payment_gateways)) { |
|
226 | 226 | continue; |
227 | 227 | } |
228 | 228 | |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | } |
233 | 233 | } |
234 | 234 | |
235 | -Give_Cron::add_weekly_event( 'give_mark_abandoned_donations' ); |
|
235 | +Give_Cron::add_weekly_event('give_mark_abandoned_donations'); |
|
236 | 236 | |
237 | 237 | |
238 | 238 | /** |
@@ -244,15 +244,15 @@ discard block |
||
244 | 244 | * |
245 | 245 | * @return void |
246 | 246 | */ |
247 | -function give_refresh_thismonth_stat_transients( $payment_ID ) { |
|
247 | +function give_refresh_thismonth_stat_transients($payment_ID) { |
|
248 | 248 | // Monthly stats. |
249 | - Give_Cache::delete( Give_Cache::get_key( 'give_estimated_monthly_stats' ) ); |
|
249 | + Give_Cache::delete(Give_Cache::get_key('give_estimated_monthly_stats')); |
|
250 | 250 | |
251 | 251 | // @todo: Refresh only range related stat cache |
252 | 252 | give_delete_donation_stats(); |
253 | 253 | } |
254 | 254 | |
255 | -add_action( 'save_post_give_payment', 'give_refresh_thismonth_stat_transients' ); |
|
255 | +add_action('save_post_give_payment', 'give_refresh_thismonth_stat_transients'); |
|
256 | 256 | |
257 | 257 | |
258 | 258 | /** |
@@ -268,12 +268,12 @@ discard block |
||
268 | 268 | * |
269 | 269 | * @return array |
270 | 270 | */ |
271 | -function give_bc_v20_get_payment_meta( $check, $object_id, $meta_key, $single ) { |
|
271 | +function give_bc_v20_get_payment_meta($check, $object_id, $meta_key, $single) { |
|
272 | 272 | // Bailout. |
273 | 273 | if ( |
274 | - 'give_payment' !== get_post_type( $object_id ) || |
|
274 | + 'give_payment' !== get_post_type($object_id) || |
|
275 | 275 | '_give_payment_meta' !== $meta_key || |
276 | - ! give_has_upgrade_completed( 'v20_upgrades_payment_metadata' ) |
|
276 | + ! give_has_upgrade_completed('v20_upgrades_payment_metadata') |
|
277 | 277 | ) { |
278 | 278 | return $check; |
279 | 279 | } |
@@ -281,73 +281,69 @@ discard block |
||
281 | 281 | $cache_key = "_give_payment_meta_{$object_id}"; |
282 | 282 | |
283 | 283 | // Get already calculate payment meta from cache. |
284 | - $payment_meta = Give_Cache::get_db_query( $cache_key ); |
|
284 | + $payment_meta = Give_Cache::get_db_query($cache_key); |
|
285 | 285 | |
286 | - if ( is_null( $payment_meta ) ) { |
|
286 | + if (is_null($payment_meta)) { |
|
287 | 287 | // Remove filter. |
288 | - remove_filter( 'get_post_metadata', 'give_bc_v20_get_payment_meta', 999 ); |
|
288 | + remove_filter('get_post_metadata', 'give_bc_v20_get_payment_meta', 999); |
|
289 | 289 | |
290 | - $donation = new Give_Payment( $object_id ); |
|
290 | + $donation = new Give_Payment($object_id); |
|
291 | 291 | |
292 | 292 | // Get all payment meta. |
293 | - $payment_meta = give_get_meta( $object_id ); |
|
293 | + $payment_meta = give_get_meta($object_id); |
|
294 | 294 | |
295 | 295 | // Set default value to array. |
296 | - if ( empty( $payment_meta ) ) { |
|
296 | + if (empty($payment_meta)) { |
|
297 | 297 | return $check; |
298 | 298 | } |
299 | 299 | |
300 | 300 | // Convert all meta key value to string instead of array |
301 | - array_walk( $payment_meta, function ( &$meta, $key ) { |
|
302 | - $meta = current( $meta ); |
|
301 | + array_walk($payment_meta, function(&$meta, $key) { |
|
302 | + $meta = current($meta); |
|
303 | 303 | } ); |
304 | 304 | |
305 | 305 | /** |
306 | 306 | * Add backward compatibility to old meta keys. |
307 | 307 | */ |
308 | 308 | // Donation key. |
309 | - $payment_meta['key'] = ! empty( $payment_meta['_give_payment_purchase_key'] ) ? $payment_meta['_give_payment_purchase_key'] : ''; |
|
309 | + $payment_meta['key'] = ! empty($payment_meta['_give_payment_purchase_key']) ? $payment_meta['_give_payment_purchase_key'] : ''; |
|
310 | 310 | |
311 | 311 | // Donation form. |
312 | - $payment_meta['form_title'] = ! empty( $payment_meta['_give_payment_form_title'] ) ? $payment_meta['_give_payment_form_title'] : ''; |
|
312 | + $payment_meta['form_title'] = ! empty($payment_meta['_give_payment_form_title']) ? $payment_meta['_give_payment_form_title'] : ''; |
|
313 | 313 | |
314 | 314 | // Donor email. |
315 | - $payment_meta['email'] = ! empty( $payment_meta['_give_payment_donor_email'] ) ? $payment_meta['_give_payment_donor_email'] : ''; |
|
316 | - $payment_meta['email'] = ! empty( $payment_meta['email'] ) ? |
|
317 | - $payment_meta['email'] : |
|
318 | - Give()->donors->get_column( 'email', $donation->donor_id ); |
|
315 | + $payment_meta['email'] = ! empty($payment_meta['_give_payment_donor_email']) ? $payment_meta['_give_payment_donor_email'] : ''; |
|
316 | + $payment_meta['email'] = ! empty($payment_meta['email']) ? |
|
317 | + $payment_meta['email'] : Give()->donors->get_column('email', $donation->donor_id); |
|
319 | 318 | |
320 | 319 | // Form id. |
321 | - $payment_meta['form_id'] = ! empty( $payment_meta['_give_payment_form_id'] ) ? $payment_meta['_give_payment_form_id'] : ''; |
|
320 | + $payment_meta['form_id'] = ! empty($payment_meta['_give_payment_form_id']) ? $payment_meta['_give_payment_form_id'] : ''; |
|
322 | 321 | |
323 | 322 | // Price id. |
324 | - $payment_meta['price_id'] = ! empty( $payment_meta['_give_payment_price_id'] ) ? $payment_meta['_give_payment_price_id'] : ''; |
|
323 | + $payment_meta['price_id'] = ! empty($payment_meta['_give_payment_price_id']) ? $payment_meta['_give_payment_price_id'] : ''; |
|
325 | 324 | |
326 | 325 | // Date. |
327 | - $payment_meta['date'] = ! empty( $payment_meta['_give_payment_date'] ) ? $payment_meta['_give_payment_date'] : ''; |
|
328 | - $payment_meta['date'] = ! empty( $payment_meta['date'] ) ? |
|
329 | - $payment_meta['date'] : |
|
330 | - get_post_field( 'post_date', $object_id ); |
|
326 | + $payment_meta['date'] = ! empty($payment_meta['_give_payment_date']) ? $payment_meta['_give_payment_date'] : ''; |
|
327 | + $payment_meta['date'] = ! empty($payment_meta['date']) ? |
|
328 | + $payment_meta['date'] : get_post_field('post_date', $object_id); |
|
331 | 329 | |
332 | 330 | |
333 | 331 | // Currency. |
334 | - $payment_meta['currency'] = ! empty( $payment_meta['_give_payment_currency'] ) ? $payment_meta['_give_payment_currency'] : ''; |
|
332 | + $payment_meta['currency'] = ! empty($payment_meta['_give_payment_currency']) ? $payment_meta['_give_payment_currency'] : ''; |
|
335 | 333 | |
336 | 334 | // Decode donor data. |
337 | - $donor_id = ! empty( $payment_meta['_give_payment_donor_id'] ) ? $payment_meta['_give_payment_donor_id'] : 0; |
|
338 | - $donor = new Give_Donor( $donor_id ); |
|
335 | + $donor_id = ! empty($payment_meta['_give_payment_donor_id']) ? $payment_meta['_give_payment_donor_id'] : 0; |
|
336 | + $donor = new Give_Donor($donor_id); |
|
339 | 337 | |
340 | 338 | // Donor first name. |
341 | - $donor_data['first_name'] = ! empty( $payment_meta['_give_donor_billing_first_name'] ) ? $payment_meta['_give_donor_billing_first_name'] : ''; |
|
342 | - $donor_data['first_name'] = ! empty( $donor_data['first_name'] ) ? |
|
343 | - $donor_data['first_name'] : |
|
344 | - $donor->get_first_name(); |
|
339 | + $donor_data['first_name'] = ! empty($payment_meta['_give_donor_billing_first_name']) ? $payment_meta['_give_donor_billing_first_name'] : ''; |
|
340 | + $donor_data['first_name'] = ! empty($donor_data['first_name']) ? |
|
341 | + $donor_data['first_name'] : $donor->get_first_name(); |
|
345 | 342 | |
346 | 343 | // Donor last name. |
347 | - $donor_data['last_name'] = ! empty( $payment_meta['_give_donor_billing_last_name'] ) ? $payment_meta['_give_donor_billing_last_name'] : ''; |
|
348 | - $donor_data['last_name'] = ! empty( $donor_data['last_name'] ) ? |
|
349 | - $donor_data['last_name'] : |
|
350 | - $donor->get_last_name(); |
|
344 | + $donor_data['last_name'] = ! empty($payment_meta['_give_donor_billing_last_name']) ? $payment_meta['_give_donor_billing_last_name'] : ''; |
|
345 | + $donor_data['last_name'] = ! empty($donor_data['last_name']) ? |
|
346 | + $donor_data['last_name'] : $donor->get_last_name(); |
|
351 | 347 | |
352 | 348 | // Donor email. |
353 | 349 | $donor_data['email'] = $payment_meta['email']; |
@@ -358,63 +354,63 @@ discard block |
||
358 | 354 | $donor_data['address'] = false; |
359 | 355 | |
360 | 356 | // Address1. |
361 | - $address1 = ! empty( $payment_meta['_give_donor_billing_address1'] ) ? $payment_meta['_give_donor_billing_address1'] : ''; |
|
362 | - if ( $address1 ) { |
|
357 | + $address1 = ! empty($payment_meta['_give_donor_billing_address1']) ? $payment_meta['_give_donor_billing_address1'] : ''; |
|
358 | + if ($address1) { |
|
363 | 359 | $donor_data['address']['line1'] = $address1; |
364 | 360 | } |
365 | 361 | |
366 | 362 | // Address2. |
367 | - $address2 = ! empty( $payment_meta['_give_donor_billing_address2'] ) ? $payment_meta['_give_donor_billing_address2'] : ''; |
|
368 | - if ( $address2 ) { |
|
363 | + $address2 = ! empty($payment_meta['_give_donor_billing_address2']) ? $payment_meta['_give_donor_billing_address2'] : ''; |
|
364 | + if ($address2) { |
|
369 | 365 | $donor_data['address']['line2'] = $address2; |
370 | 366 | } |
371 | 367 | |
372 | 368 | // City. |
373 | - $city = ! empty( $payment_meta['_give_donor_billing_city'] ) ? $payment_meta['_give_donor_billing_city'] : ''; |
|
374 | - if ( $city ) { |
|
369 | + $city = ! empty($payment_meta['_give_donor_billing_city']) ? $payment_meta['_give_donor_billing_city'] : ''; |
|
370 | + if ($city) { |
|
375 | 371 | $donor_data['address']['city'] = $city; |
376 | 372 | } |
377 | 373 | |
378 | 374 | // Zip. |
379 | - $zip = ! empty( $payment_meta['_give_donor_billing_zip'] ) ? $payment_meta['_give_donor_billing_zip'] : ''; |
|
380 | - if ( $zip ) { |
|
375 | + $zip = ! empty($payment_meta['_give_donor_billing_zip']) ? $payment_meta['_give_donor_billing_zip'] : ''; |
|
376 | + if ($zip) { |
|
381 | 377 | $donor_data['address']['zip'] = $zip; |
382 | 378 | } |
383 | 379 | |
384 | 380 | // State. |
385 | - $state = ! empty( $payment_meta['_give_donor_billing_state'] ) ? $payment_meta['_give_donor_billing_state'] : ''; |
|
386 | - if ( $state ) { |
|
381 | + $state = ! empty($payment_meta['_give_donor_billing_state']) ? $payment_meta['_give_donor_billing_state'] : ''; |
|
382 | + if ($state) { |
|
387 | 383 | $donor_data['address']['state'] = $state; |
388 | 384 | } |
389 | 385 | |
390 | 386 | // Country. |
391 | - $country = ! empty( $payment_meta['_give_donor_billing_country'] ) ? $payment_meta['_give_donor_billing_country'] : ''; |
|
392 | - if ( $country ) { |
|
387 | + $country = ! empty($payment_meta['_give_donor_billing_country']) ? $payment_meta['_give_donor_billing_country'] : ''; |
|
388 | + if ($country) { |
|
393 | 389 | $donor_data['address']['country'] = $country; |
394 | 390 | } |
395 | 391 | |
396 | 392 | $payment_meta['user_info'] = $donor_data; |
397 | 393 | |
398 | 394 | // Add filter |
399 | - add_filter( 'get_post_metadata', 'give_bc_v20_get_payment_meta', 999, 4 ); |
|
395 | + add_filter('get_post_metadata', 'give_bc_v20_get_payment_meta', 999, 4); |
|
400 | 396 | |
401 | 397 | // Set custom meta key into payment meta. |
402 | - if ( ! empty( $payment_meta['_give_payment_meta'] ) ) { |
|
403 | - $payment_meta = array_merge( maybe_unserialize( $payment_meta['_give_payment_meta'] ), $payment_meta ); |
|
398 | + if ( ! empty($payment_meta['_give_payment_meta'])) { |
|
399 | + $payment_meta = array_merge(maybe_unserialize($payment_meta['_give_payment_meta']), $payment_meta); |
|
404 | 400 | } |
405 | 401 | |
406 | 402 | // Set cache. |
407 | - Give_Cache::set_db_query( $cache_key, $payment_meta ); |
|
403 | + Give_Cache::set_db_query($cache_key, $payment_meta); |
|
408 | 404 | } |
409 | 405 | |
410 | - if ( $single ) { |
|
406 | + if ($single) { |
|
411 | 407 | /** |
412 | 408 | * Filter the payment meta |
413 | 409 | * Add custom meta key to payment meta |
414 | 410 | * |
415 | 411 | * @since 2.0 |
416 | 412 | */ |
417 | - $new_payment_meta[0] = apply_filters( 'give_get_payment_meta', $payment_meta, $object_id, $meta_key ); |
|
413 | + $new_payment_meta[0] = apply_filters('give_get_payment_meta', $payment_meta, $object_id, $meta_key); |
|
418 | 414 | |
419 | 415 | $payment_meta = $new_payment_meta; |
420 | 416 | } |
@@ -422,7 +418,7 @@ discard block |
||
422 | 418 | return $payment_meta; |
423 | 419 | } |
424 | 420 | |
425 | -add_filter( 'get_post_metadata', 'give_bc_v20_get_payment_meta', 999, 4 ); |
|
421 | +add_filter('get_post_metadata', 'give_bc_v20_get_payment_meta', 999, 4); |
|
426 | 422 | |
427 | 423 | /** |
428 | 424 | * Add meta in payment that store page id and page url. |
@@ -434,19 +430,19 @@ discard block |
||
434 | 430 | * |
435 | 431 | * @param int $payment_id Payment id for which the meta value should be updated. |
436 | 432 | */ |
437 | -function give_payment_save_page_data( $payment_id ) { |
|
438 | - $page_url = ( ! empty( $_REQUEST['give-current-url'] ) ? esc_url( $_REQUEST['give-current-url'] ) : false ); |
|
433 | +function give_payment_save_page_data($payment_id) { |
|
434 | + $page_url = ( ! empty($_REQUEST['give-current-url']) ? esc_url($_REQUEST['give-current-url']) : false); |
|
439 | 435 | |
440 | 436 | // Check $page_url is not empty. |
441 | - if ( $page_url ) { |
|
442 | - update_post_meta( $payment_id, '_give_current_url', $page_url ); |
|
443 | - $page_id = url_to_postid( $page_url ); |
|
437 | + if ($page_url) { |
|
438 | + update_post_meta($payment_id, '_give_current_url', $page_url); |
|
439 | + $page_id = url_to_postid($page_url); |
|
444 | 440 | // Check $page_id is not empty. |
445 | - if ( $page_id ) { |
|
446 | - update_post_meta( $payment_id, '_give_current_page_id', $page_id ); |
|
441 | + if ($page_id) { |
|
442 | + update_post_meta($payment_id, '_give_current_page_id', $page_id); |
|
447 | 443 | } |
448 | 444 | } |
449 | 445 | } |
450 | 446 | |
451 | 447 | // Fire when payment is save. |
452 | -add_action( 'give_insert_payment', 'give_payment_save_page_data' ); |
|
453 | 448 | \ No newline at end of file |
449 | +add_action('give_insert_payment', 'give_payment_save_page_data'); |
|
454 | 450 | \ No newline at end of file |
@@ -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 | |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | /* @var WPDB $wpdb */ |
51 | 51 | global $wpdb; |
52 | 52 | |
53 | - $wpdb->paymentmeta = $this->table_name = $wpdb->prefix . 'give_paymentmeta'; |
|
53 | + $wpdb->paymentmeta = $this->table_name = $wpdb->prefix.'give_paymentmeta'; |
|
54 | 54 | $this->primary_key = 'meta_id'; |
55 | 55 | $this->version = '1.0'; |
56 | 56 | |
@@ -84,6 +84,6 @@ discard block |
||
84 | 84 | * @return bool |
85 | 85 | */ |
86 | 86 | protected function is_custom_meta_table_active() { |
87 | - return give_has_upgrade_completed( 'v20_move_metadata_into_new_table' ); |
|
87 | + return give_has_upgrade_completed('v20_move_metadata_into_new_table'); |
|
88 | 88 | } |
89 | 89 | } |
@@ -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 | |
@@ -75,40 +75,40 @@ discard block |
||
75 | 75 | */ |
76 | 76 | function __construct() { |
77 | 77 | // Bailout. |
78 | - if ( empty( $this->supports ) || ! $this->is_custom_meta_table_active() ) { |
|
78 | + if (empty($this->supports) || ! $this->is_custom_meta_table_active()) { |
|
79 | 79 | return; |
80 | 80 | } |
81 | 81 | |
82 | - if ( in_array( 'add_post_metadata', $this->supports ) ) { |
|
83 | - add_filter( 'add_post_metadata', array( $this, '__add_meta' ), 0, 5 ); |
|
82 | + if (in_array('add_post_metadata', $this->supports)) { |
|
83 | + add_filter('add_post_metadata', array($this, '__add_meta'), 0, 5); |
|
84 | 84 | } |
85 | 85 | |
86 | - if ( in_array( 'get_post_metadata', $this->supports ) ) { |
|
87 | - add_filter( 'get_post_metadata', array( $this, '__get_meta' ), 0, 4 ); |
|
86 | + if (in_array('get_post_metadata', $this->supports)) { |
|
87 | + add_filter('get_post_metadata', array($this, '__get_meta'), 0, 4); |
|
88 | 88 | } |
89 | 89 | |
90 | - if ( in_array( 'update_post_metadata', $this->supports ) ) { |
|
91 | - add_filter( 'update_post_metadata', array( $this, '__update_meta' ), 0, 5 ); |
|
90 | + if (in_array('update_post_metadata', $this->supports)) { |
|
91 | + add_filter('update_post_metadata', array($this, '__update_meta'), 0, 5); |
|
92 | 92 | } |
93 | 93 | |
94 | - if ( in_array( 'delete_post_metadata', $this->supports ) ) { |
|
95 | - add_filter( 'delete_post_metadata', array( $this, '__delete_meta' ), 0, 5 ); |
|
94 | + if (in_array('delete_post_metadata', $this->supports)) { |
|
95 | + add_filter('delete_post_metadata', array($this, '__delete_meta'), 0, 5); |
|
96 | 96 | } |
97 | 97 | |
98 | - if ( in_array( 'posts_where', $this->supports ) ) { |
|
99 | - add_filter( 'posts_where', array( $this, '__rename_meta_table_name_in_query' ), 99999, 2 ); |
|
98 | + if (in_array('posts_where', $this->supports)) { |
|
99 | + add_filter('posts_where', array($this, '__rename_meta_table_name_in_query'), 99999, 2); |
|
100 | 100 | } |
101 | 101 | |
102 | - if ( in_array( 'posts_join', $this->supports ) ) { |
|
103 | - add_filter( 'posts_join', array( $this, '__rename_meta_table_name_in_query' ), 99999, 2 ); |
|
102 | + if (in_array('posts_join', $this->supports)) { |
|
103 | + add_filter('posts_join', array($this, '__rename_meta_table_name_in_query'), 99999, 2); |
|
104 | 104 | } |
105 | 105 | |
106 | - if ( in_array( 'posts_groupby', $this->supports ) ) { |
|
107 | - add_filter( 'posts_groupby', array( $this, '__rename_meta_table_name_in_query' ), 99999, 2 ); |
|
106 | + if (in_array('posts_groupby', $this->supports)) { |
|
107 | + add_filter('posts_groupby', array($this, '__rename_meta_table_name_in_query'), 99999, 2); |
|
108 | 108 | } |
109 | 109 | |
110 | - if ( in_array( 'posts_orderby', $this->supports ) ) { |
|
111 | - add_filter( 'posts_orderby', array( $this, '__rename_meta_table_name_in_query' ), 99999, 2 ); |
|
110 | + if (in_array('posts_orderby', $this->supports)) { |
|
111 | + add_filter('posts_orderby', array($this, '__rename_meta_table_name_in_query'), 99999, 2); |
|
112 | 112 | } |
113 | 113 | } |
114 | 114 | |
@@ -126,16 +126,16 @@ discard block |
||
126 | 126 | * @return mixed Will be an array if $single is false. Will be value of meta data field if $single |
127 | 127 | * is true. |
128 | 128 | */ |
129 | - public function get_meta( $id = 0, $meta_key = '', $single = false ) { |
|
130 | - $id = $this->sanitize_id( $id ); |
|
129 | + public function get_meta($id = 0, $meta_key = '', $single = false) { |
|
130 | + $id = $this->sanitize_id($id); |
|
131 | 131 | |
132 | 132 | // Bailout. |
133 | - if ( ! $this->is_valid_post_type( $id ) ) { |
|
133 | + if ( ! $this->is_valid_post_type($id)) { |
|
134 | 134 | return $this->check; |
135 | 135 | } |
136 | 136 | |
137 | - if ( $this->raw_result ) { |
|
138 | - if ( ! ( $value = get_metadata( $this->meta_type, $id, $meta_key, false ) ) ) { |
|
137 | + if ($this->raw_result) { |
|
138 | + if ( ! ($value = get_metadata($this->meta_type, $id, $meta_key, false))) { |
|
139 | 139 | $value = ''; |
140 | 140 | } |
141 | 141 | |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | $this->raw_result = false; |
144 | 144 | |
145 | 145 | } else { |
146 | - $value = get_metadata( $this->meta_type, $id, $meta_key, $single ); |
|
146 | + $value = get_metadata($this->meta_type, $id, $meta_key, $single); |
|
147 | 147 | } |
148 | 148 | |
149 | 149 | return $value; |
@@ -165,18 +165,18 @@ discard block |
||
165 | 165 | * |
166 | 166 | * @return int|bool False for failure. True for success. |
167 | 167 | */ |
168 | - public function add_meta( $id = 0, $meta_key = '', $meta_value, $unique = false ) { |
|
169 | - $id = $this->sanitize_id( $id ); |
|
168 | + public function add_meta($id = 0, $meta_key = '', $meta_value, $unique = false) { |
|
169 | + $id = $this->sanitize_id($id); |
|
170 | 170 | |
171 | 171 | // Bailout. |
172 | - if ( ! $this->is_valid_post_type( $id ) ) { |
|
172 | + if ( ! $this->is_valid_post_type($id)) { |
|
173 | 173 | return $this->check; |
174 | 174 | } |
175 | 175 | |
176 | - $meta_id = add_metadata( $this->meta_type, $id, $meta_key, $meta_value, $unique ); |
|
176 | + $meta_id = add_metadata($this->meta_type, $id, $meta_key, $meta_value, $unique); |
|
177 | 177 | |
178 | - if ( $meta_id ) { |
|
179 | - $this->delete_cache( $id ); |
|
178 | + if ($meta_id) { |
|
179 | + $this->delete_cache($id); |
|
180 | 180 | } |
181 | 181 | |
182 | 182 | return $meta_id; |
@@ -202,18 +202,18 @@ discard block |
||
202 | 202 | * |
203 | 203 | * @return int|bool False on failure, true if success. |
204 | 204 | */ |
205 | - public function update_meta( $id = 0, $meta_key = '', $meta_value, $prev_value = '' ) { |
|
206 | - $id = $this->sanitize_id( $id ); |
|
205 | + public function update_meta($id = 0, $meta_key = '', $meta_value, $prev_value = '') { |
|
206 | + $id = $this->sanitize_id($id); |
|
207 | 207 | |
208 | 208 | // Bailout. |
209 | - if ( ! $this->is_valid_post_type( $id ) ) { |
|
209 | + if ( ! $this->is_valid_post_type($id)) { |
|
210 | 210 | return $this->check; |
211 | 211 | } |
212 | 212 | |
213 | - $meta_id = update_metadata( $this->meta_type, $id, $meta_key, $meta_value, $prev_value ); |
|
213 | + $meta_id = update_metadata($this->meta_type, $id, $meta_key, $meta_value, $prev_value); |
|
214 | 214 | |
215 | - if ( $meta_id ) { |
|
216 | - $this->delete_cache( $id ); |
|
215 | + if ($meta_id) { |
|
216 | + $this->delete_cache($id); |
|
217 | 217 | } |
218 | 218 | |
219 | 219 | return $meta_id; |
@@ -236,18 +236,18 @@ discard block |
||
236 | 236 | * |
237 | 237 | * @return bool False for failure. True for success. |
238 | 238 | */ |
239 | - public function delete_meta( $id = 0, $meta_key = '', $meta_value = '', $delete_all = '' ) { |
|
240 | - $id = $this->sanitize_id( $id ); |
|
239 | + public function delete_meta($id = 0, $meta_key = '', $meta_value = '', $delete_all = '') { |
|
240 | + $id = $this->sanitize_id($id); |
|
241 | 241 | |
242 | 242 | // Bailout. |
243 | - if ( ! $this->is_valid_post_type( $id ) ) { |
|
243 | + if ( ! $this->is_valid_post_type($id)) { |
|
244 | 244 | return $this->check; |
245 | 245 | } |
246 | 246 | |
247 | - $is_meta_deleted = delete_metadata( $this->meta_type, $id, $meta_key, $meta_value, $delete_all ); |
|
247 | + $is_meta_deleted = delete_metadata($this->meta_type, $id, $meta_key, $meta_value, $delete_all); |
|
248 | 248 | |
249 | - if ( $is_meta_deleted ) { |
|
250 | - $this->delete_cache( $id ); |
|
249 | + if ($is_meta_deleted) { |
|
250 | + $this->delete_cache($id); |
|
251 | 251 | } |
252 | 252 | |
253 | 253 | return $is_meta_deleted; |
@@ -264,10 +264,10 @@ discard block |
||
264 | 264 | * |
265 | 265 | * @return string |
266 | 266 | */ |
267 | - public function __rename_meta_table_name_in_query( $clause, $wp_query ) { |
|
267 | + public function __rename_meta_table_name_in_query($clause, $wp_query) { |
|
268 | 268 | // Add new table to sql query. |
269 | - if ( $this->is_post_type_query( $wp_query ) && ! empty( $wp_query->meta_query->queries ) ) { |
|
270 | - $clause = $this->__rename_meta_table_name( $clause, current_filter() ); |
|
269 | + if ($this->is_post_type_query($wp_query) && ! empty($wp_query->meta_query->queries)) { |
|
270 | + $clause = $this->__rename_meta_table_name($clause, current_filter()); |
|
271 | 271 | } |
272 | 272 | |
273 | 273 | return $clause; |
@@ -282,39 +282,39 @@ discard block |
||
282 | 282 | * |
283 | 283 | * @return mixed |
284 | 284 | */ |
285 | - public function __rename_meta_table_name( $clause, $filter ){ |
|
285 | + public function __rename_meta_table_name($clause, $filter) { |
|
286 | 286 | global $wpdb; |
287 | 287 | |
288 | - $clause = str_replace( "{$wpdb->postmeta}.post_id", "{$this->table_name}.{$this->meta_type}_id", $clause ); |
|
289 | - $clause = str_replace( $wpdb->postmeta, $this->table_name, $clause ); |
|
288 | + $clause = str_replace("{$wpdb->postmeta}.post_id", "{$this->table_name}.{$this->meta_type}_id", $clause); |
|
289 | + $clause = str_replace($wpdb->postmeta, $this->table_name, $clause); |
|
290 | 290 | |
291 | - switch( $filter ) { |
|
291 | + switch ($filter) { |
|
292 | 292 | case 'posts_join': |
293 | - $joins = array( 'INNER JOIN', 'LEFT JOIN' ); |
|
293 | + $joins = array('INNER JOIN', 'LEFT JOIN'); |
|
294 | 294 | |
295 | - foreach ( $joins as $join ) { |
|
296 | - if( false !== strpos( $clause, $join ) ) { |
|
297 | - $clause = explode( $join, $clause ); |
|
295 | + foreach ($joins as $join) { |
|
296 | + if (false !== strpos($clause, $join)) { |
|
297 | + $clause = explode($join, $clause); |
|
298 | 298 | |
299 | - foreach ( $clause as $key => $clause_part ) { |
|
300 | - if( empty( $clause_part ) ) { |
|
299 | + foreach ($clause as $key => $clause_part) { |
|
300 | + if (empty($clause_part)) { |
|
301 | 301 | continue; |
302 | 302 | } |
303 | 303 | |
304 | - preg_match( '/' . $wpdb->prefix . 'give_' . $this->meta_type . 'meta AS (.*) ON/', $clause_part, $alias_table_name ); |
|
304 | + preg_match('/'.$wpdb->prefix.'give_'.$this->meta_type.'meta AS (.*) ON/', $clause_part, $alias_table_name); |
|
305 | 305 | |
306 | - if( isset( $alias_table_name[1] ) ) { |
|
307 | - $clause[$key] = str_replace( "{$alias_table_name[1]}.post_id", "{$alias_table_name[1]}.{$this->meta_type}_id", $clause_part ); |
|
306 | + if (isset($alias_table_name[1])) { |
|
307 | + $clause[$key] = str_replace("{$alias_table_name[1]}.post_id", "{$alias_table_name[1]}.{$this->meta_type}_id", $clause_part); |
|
308 | 308 | } |
309 | 309 | } |
310 | 310 | |
311 | - $clause = implode( "{$join} ", $clause ); |
|
311 | + $clause = implode("{$join} ", $clause); |
|
312 | 312 | } |
313 | 313 | } |
314 | 314 | break; |
315 | 315 | |
316 | 316 | case 'posts_where': |
317 | - $clause = str_replace( array( 'mt2.post_id', 'mt1.post_id' ), array( "mt2.{$this->meta_type}_id", "mt1.{$this->meta_type}_id" ), $clause ); |
|
317 | + $clause = str_replace(array('mt2.post_id', 'mt1.post_id'), array("mt2.{$this->meta_type}_id", "mt1.{$this->meta_type}_id"), $clause); |
|
318 | 318 | break; |
319 | 319 | } |
320 | 320 | |
@@ -332,19 +332,19 @@ discard block |
||
332 | 332 | * |
333 | 333 | * @return bool |
334 | 334 | */ |
335 | - protected function is_post_type_query( $wp_query ) { |
|
335 | + protected function is_post_type_query($wp_query) { |
|
336 | 336 | $status = false; |
337 | 337 | |
338 | 338 | // Check if it is payment query. |
339 | - if ( ! empty( $wp_query->query['post_type'] ) ) { |
|
339 | + if ( ! empty($wp_query->query['post_type'])) { |
|
340 | 340 | if ( |
341 | - is_string( $wp_query->query['post_type'] ) && |
|
341 | + is_string($wp_query->query['post_type']) && |
|
342 | 342 | $this->post_type === $wp_query->query['post_type'] |
343 | 343 | ) { |
344 | 344 | $status = true; |
345 | 345 | } elseif ( |
346 | - is_array( $wp_query->query['post_type'] ) && |
|
347 | - in_array( $this->post_type, $wp_query->query['post_type'] ) |
|
346 | + is_array($wp_query->query['post_type']) && |
|
347 | + in_array($this->post_type, $wp_query->query['post_type']) |
|
348 | 348 | ) { |
349 | 349 | $status = true; |
350 | 350 | } |
@@ -363,8 +363,8 @@ discard block |
||
363 | 363 | * |
364 | 364 | * @return bool |
365 | 365 | */ |
366 | - protected function is_valid_post_type( $ID ) { |
|
367 | - return $ID && ( $this->post_type === get_post_type( $ID ) ); |
|
366 | + protected function is_valid_post_type($ID) { |
|
367 | + return $ID && ($this->post_type === get_post_type($ID)); |
|
368 | 368 | } |
369 | 369 | |
370 | 370 | /** |
@@ -390,8 +390,8 @@ discard block |
||
390 | 390 | * |
391 | 391 | * @return void |
392 | 392 | */ |
393 | - private function delete_cache( $id, $meta_type = '' ) { |
|
394 | - $meta_type = empty( $meta_type ) ? $this->meta_type : $meta_type; |
|
393 | + private function delete_cache($id, $meta_type = '') { |
|
394 | + $meta_type = empty($meta_type) ? $this->meta_type : $meta_type; |
|
395 | 395 | |
396 | 396 | $group = array( |
397 | 397 | // 'form' => 'give-forms', |
@@ -401,8 +401,8 @@ discard block |
||
401 | 401 | // 'log' => 'give-logs', |
402 | 402 | ); |
403 | 403 | |
404 | - if ( array_key_exists( $meta_type, $group ) ) { |
|
405 | - Give_Cache::delete_group( $id, $group[ $meta_type ] ); |
|
404 | + if (array_key_exists($meta_type, $group)) { |
|
405 | + Give_Cache::delete_group($id, $group[$meta_type]); |
|
406 | 406 | } |
407 | 407 | } |
408 | 408 | |
@@ -417,8 +417,8 @@ discard block |
||
417 | 417 | * |
418 | 418 | * @return mixed |
419 | 419 | */ |
420 | - public function __call( $name, $arguments ) { |
|
421 | - switch ( $name ) { |
|
420 | + public function __call($name, $arguments) { |
|
421 | + switch ($name) { |
|
422 | 422 | case '__add_meta': |
423 | 423 | $this->check = $arguments[0]; |
424 | 424 | $id = $arguments[1]; |
@@ -427,11 +427,11 @@ discard block |
||
427 | 427 | $unique = $arguments[4]; |
428 | 428 | |
429 | 429 | // Bailout. |
430 | - if ( ! $this->is_valid_post_type( $id ) ) { |
|
430 | + if ( ! $this->is_valid_post_type($id)) { |
|
431 | 431 | return $this->check; |
432 | 432 | } |
433 | 433 | |
434 | - return $this->add_meta( $id, $meta_key, $meta_value, $unique ); |
|
434 | + return $this->add_meta($id, $meta_key, $meta_value, $unique); |
|
435 | 435 | |
436 | 436 | case '__get_meta': |
437 | 437 | $this->check = $arguments[0]; |
@@ -440,13 +440,13 @@ discard block |
||
440 | 440 | $single = $arguments[3]; |
441 | 441 | |
442 | 442 | // Bailout. |
443 | - if ( ! $this->is_valid_post_type( $id ) ) { |
|
443 | + if ( ! $this->is_valid_post_type($id)) { |
|
444 | 444 | return $this->check; |
445 | 445 | } |
446 | 446 | |
447 | 447 | $this->raw_result = true; |
448 | 448 | |
449 | - return $this->get_meta( $id, $meta_key, $single ); |
|
449 | + return $this->get_meta($id, $meta_key, $single); |
|
450 | 450 | |
451 | 451 | case '__update_meta': |
452 | 452 | $this->check = $arguments[0]; |
@@ -455,11 +455,11 @@ discard block |
||
455 | 455 | $meta_value = $arguments[3]; |
456 | 456 | |
457 | 457 | // Bailout. |
458 | - if ( ! $this->is_valid_post_type( $id ) ) { |
|
458 | + if ( ! $this->is_valid_post_type($id)) { |
|
459 | 459 | return $this->check; |
460 | 460 | } |
461 | 461 | |
462 | - return $this->update_meta( $id, $meta_key, $meta_value ); |
|
462 | + return $this->update_meta($id, $meta_key, $meta_value); |
|
463 | 463 | |
464 | 464 | case '__delete_meta': |
465 | 465 | $this->check = $arguments[0]; |
@@ -469,11 +469,11 @@ discard block |
||
469 | 469 | $delete_all = $arguments[3]; |
470 | 470 | |
471 | 471 | // Bailout. |
472 | - if ( ! $this->is_valid_post_type( $id ) ) { |
|
472 | + if ( ! $this->is_valid_post_type($id)) { |
|
473 | 473 | return $this->check; |
474 | 474 | } |
475 | 475 | |
476 | - return $this->delete_meta( $id, $meta_key, $meta_value, $delete_all ); |
|
476 | + return $this->delete_meta($id, $meta_key, $meta_value, $delete_all); |
|
477 | 477 | } |
478 | 478 | } |
479 | 479 | |
@@ -498,9 +498,9 @@ discard block |
||
498 | 498 | KEY meta_key (meta_key({$this->min_index_length})) |
499 | 499 | ) {$charset_collate};"; |
500 | 500 | |
501 | - require_once( ABSPATH . 'wp-admin/includes/upgrade.php' ); |
|
502 | - dbDelta( $sql ); |
|
501 | + require_once(ABSPATH.'wp-admin/includes/upgrade.php'); |
|
502 | + dbDelta($sql); |
|
503 | 503 | |
504 | - update_option( $this->table_name . '_db_version', $this->version ); |
|
504 | + update_option($this->table_name.'_db_version', $this->version); |
|
505 | 505 | } |
506 | 506 | } |
507 | 507 | \ No newline at end of file |
@@ -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 | |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | /* @var WPDB $wpdb */ |
51 | 51 | global $wpdb; |
52 | 52 | |
53 | - $wpdb->logmeta = $this->table_name = $wpdb->prefix . 'give_logmeta'; |
|
53 | + $wpdb->logmeta = $this->table_name = $wpdb->prefix.'give_logmeta'; |
|
54 | 54 | $this->primary_key = 'meta_id'; |
55 | 55 | $this->version = '1.0'; |
56 | 56 | |
@@ -86,18 +86,18 @@ discard block |
||
86 | 86 | * |
87 | 87 | * @return bool |
88 | 88 | */ |
89 | - public function delete_row( $log_id = 0 ) { |
|
89 | + public function delete_row($log_id = 0) { |
|
90 | 90 | /* @var WPDB $wpdb */ |
91 | 91 | global $wpdb; |
92 | 92 | |
93 | 93 | // Row ID must be positive integer |
94 | - $log_id = absint( $log_id ); |
|
94 | + $log_id = absint($log_id); |
|
95 | 95 | |
96 | - if ( empty( $log_id ) ) { |
|
96 | + if (empty($log_id)) { |
|
97 | 97 | return false; |
98 | 98 | } |
99 | 99 | |
100 | - if ( false === $wpdb->query( $wpdb->prepare( "DELETE FROM $this->table_name WHERE log_id = %d", $log_id ) ) ) { |
|
100 | + if (false === $wpdb->query($wpdb->prepare("DELETE FROM $this->table_name WHERE log_id = %d", $log_id))) { |
|
101 | 101 | return false; |
102 | 102 | } |
103 | 103 | |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | * |
115 | 115 | * @return bool |
116 | 116 | */ |
117 | - protected function is_valid_post_type( $ID ) { |
|
117 | + protected function is_valid_post_type($ID) { |
|
118 | 118 | return $ID && true; |
119 | 119 | } |
120 | 120 | } |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | */ |
12 | 12 | |
13 | 13 | // Exit if accessed directly. |
14 | -if ( ! defined( 'ABSPATH' ) ) { |
|
14 | +if ( ! defined('ABSPATH')) { |
|
15 | 15 | exit; |
16 | 16 | } |
17 | 17 | |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | * @return static |
54 | 54 | */ |
55 | 55 | public static function get_instance() { |
56 | - if ( ! isset( self::$instance ) && ! ( self::$instance instanceof Give_Cache ) ) { |
|
56 | + if ( ! isset(self::$instance) && ! (self::$instance instanceof Give_Cache)) { |
|
57 | 57 | self::$instance = new Give_Cache(); |
58 | 58 | } |
59 | 59 | |
@@ -68,17 +68,17 @@ discard block |
||
68 | 68 | */ |
69 | 69 | public function setup() { |
70 | 70 | // Currently enable cache only for backend. |
71 | - self::$instance->is_cache = give_is_setting_enabled( give_get_option( 'cache', 'enabled' ) ) && is_admin(); |
|
71 | + self::$instance->is_cache = give_is_setting_enabled(give_get_option('cache', 'enabled')) && is_admin(); |
|
72 | 72 | |
73 | 73 | // weekly delete all expired cache. |
74 | - Give_Cron::add_weekly_event( array( $this, 'delete_all_expired' ) ); |
|
74 | + Give_Cron::add_weekly_event(array($this, 'delete_all_expired')); |
|
75 | 75 | |
76 | - add_action( 'save_post_give_forms', array( $this, 'delete_form_related_cache' ) ); |
|
77 | - add_action( 'save_post_give_payment', array( $this, 'delete_payment_related_cache' ) ); |
|
78 | - add_action( 'give_deleted_give-donors_cache', array( $this, 'delete_donor_related_cache' ), 10, 3 ); |
|
79 | - add_action( 'give_deleted_give-donations_cache', array( $this, 'delete_donations_related_cache' ), 10, 3 ); |
|
76 | + add_action('save_post_give_forms', array($this, 'delete_form_related_cache')); |
|
77 | + add_action('save_post_give_payment', array($this, 'delete_payment_related_cache')); |
|
78 | + add_action('give_deleted_give-donors_cache', array($this, 'delete_donor_related_cache'), 10, 3); |
|
79 | + add_action('give_deleted_give-donations_cache', array($this, 'delete_donations_related_cache'), 10, 3); |
|
80 | 80 | |
81 | - add_action( 'give_save_settings_give_settings', array( $this, 'flush_cache' ) ); |
|
81 | + add_action('give_save_settings_give_settings', array($this, 'flush_cache')); |
|
82 | 82 | } |
83 | 83 | |
84 | 84 | /** |
@@ -92,18 +92,18 @@ discard block |
||
92 | 92 | * |
93 | 93 | * @return string |
94 | 94 | */ |
95 | - public static function get_key( $action, $query_args = null, $is_prefix = true ) { |
|
95 | + public static function get_key($action, $query_args = null, $is_prefix = true) { |
|
96 | 96 | // Bailout. |
97 | - if ( empty( $action ) ) { |
|
98 | - return new WP_Error( 'give_invalid_cache_key_action', __( 'Do not pass empty action to generate cache key.', 'give' ) ); |
|
97 | + if (empty($action)) { |
|
98 | + return new WP_Error('give_invalid_cache_key_action', __('Do not pass empty action to generate cache key.', 'give')); |
|
99 | 99 | } |
100 | 100 | |
101 | 101 | // Set cache key. |
102 | 102 | $cache_key = $is_prefix ? "give_cache_{$action}" : $action; |
103 | 103 | |
104 | 104 | // Bailout. |
105 | - if ( ! empty( $query_args ) ) { |
|
106 | - $cache_key = "{$cache_key}_" . substr( md5( serialize( $query_args ) ), 0, 15 ); |
|
105 | + if ( ! empty($query_args)) { |
|
106 | + $cache_key = "{$cache_key}_".substr(md5(serialize($query_args)), 0, 15); |
|
107 | 107 | } |
108 | 108 | |
109 | 109 | /** |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | * |
112 | 112 | * @since 2.0 |
113 | 113 | */ |
114 | - return apply_filters( 'give_get_cache_key', $cache_key, $action, $query_args ); |
|
114 | + return apply_filters('give_get_cache_key', $cache_key, $action, $query_args); |
|
115 | 115 | } |
116 | 116 | |
117 | 117 | /** |
@@ -125,26 +125,26 @@ discard block |
||
125 | 125 | * |
126 | 126 | * @return mixed |
127 | 127 | */ |
128 | - public static function get( $cache_key, $custom_key = false, $query_args = array() ) { |
|
129 | - if ( ! self::is_valid_cache_key( $cache_key ) ) { |
|
130 | - if ( ! $custom_key ) { |
|
131 | - return new WP_Error( 'give_invalid_cache_key', __( 'Cache key format should be give_cache_*', 'give' ) ); |
|
128 | + public static function get($cache_key, $custom_key = false, $query_args = array()) { |
|
129 | + if ( ! self::is_valid_cache_key($cache_key)) { |
|
130 | + if ( ! $custom_key) { |
|
131 | + return new WP_Error('give_invalid_cache_key', __('Cache key format should be give_cache_*', 'give')); |
|
132 | 132 | } |
133 | 133 | |
134 | - $cache_key = self::get_key( $cache_key, $query_args ); |
|
134 | + $cache_key = self::get_key($cache_key, $query_args); |
|
135 | 135 | } |
136 | 136 | |
137 | - $option = get_option( $cache_key ); |
|
137 | + $option = get_option($cache_key); |
|
138 | 138 | |
139 | 139 | // Backward compatibility (<1.8.7). |
140 | - if ( ! is_array( $option ) || empty( $option ) || ! array_key_exists( 'expiration', $option ) ) { |
|
140 | + if ( ! is_array($option) || empty($option) || ! array_key_exists('expiration', $option)) { |
|
141 | 141 | return $option; |
142 | 142 | } |
143 | 143 | |
144 | 144 | // Get current time. |
145 | - $current_time = current_time( 'timestamp', 1 ); |
|
145 | + $current_time = current_time('timestamp', 1); |
|
146 | 146 | |
147 | - if ( empty( $option['expiration'] ) || ( $current_time < $option['expiration'] ) ) { |
|
147 | + if (empty($option['expiration']) || ($current_time < $option['expiration'])) { |
|
148 | 148 | $option = $option['data']; |
149 | 149 | } else { |
150 | 150 | $option = false; |
@@ -166,23 +166,23 @@ discard block |
||
166 | 166 | * |
167 | 167 | * @return mixed |
168 | 168 | */ |
169 | - public static function set( $cache_key, $data, $expiration = null, $custom_key = false, $query_args = array() ) { |
|
170 | - if ( ! self::is_valid_cache_key( $cache_key ) ) { |
|
171 | - if ( ! $custom_key ) { |
|
172 | - return new WP_Error( 'give_invalid_cache_key', __( 'Cache key format should be give_cache_*', 'give' ) ); |
|
169 | + public static function set($cache_key, $data, $expiration = null, $custom_key = false, $query_args = array()) { |
|
170 | + if ( ! self::is_valid_cache_key($cache_key)) { |
|
171 | + if ( ! $custom_key) { |
|
172 | + return new WP_Error('give_invalid_cache_key', __('Cache key format should be give_cache_*', 'give')); |
|
173 | 173 | } |
174 | 174 | |
175 | - $cache_key = self::get_key( $cache_key, $query_args ); |
|
175 | + $cache_key = self::get_key($cache_key, $query_args); |
|
176 | 176 | } |
177 | 177 | |
178 | 178 | $option_value = array( |
179 | 179 | 'data' => $data, |
180 | - 'expiration' => ! is_null( $expiration ) |
|
181 | - ? ( $expiration + current_time( 'timestamp', 1 ) ) |
|
180 | + 'expiration' => ! is_null($expiration) |
|
181 | + ? ($expiration + current_time('timestamp', 1)) |
|
182 | 182 | : null, |
183 | 183 | ); |
184 | 184 | |
185 | - $result = update_option( $cache_key, $option_value, 'no' ); |
|
185 | + $result = update_option($cache_key, $option_value, 'no'); |
|
186 | 186 | |
187 | 187 | return $result; |
188 | 188 | } |
@@ -198,27 +198,27 @@ discard block |
||
198 | 198 | * |
199 | 199 | * @return bool|WP_Error |
200 | 200 | */ |
201 | - public static function delete( $cache_keys ) { |
|
201 | + public static function delete($cache_keys) { |
|
202 | 202 | $result = true; |
203 | 203 | $invalid_keys = array(); |
204 | 204 | |
205 | - if ( ! empty( $cache_keys ) ) { |
|
206 | - $cache_keys = is_array( $cache_keys ) ? $cache_keys : array( $cache_keys ); |
|
205 | + if ( ! empty($cache_keys)) { |
|
206 | + $cache_keys = is_array($cache_keys) ? $cache_keys : array($cache_keys); |
|
207 | 207 | |
208 | - foreach ( $cache_keys as $cache_key ) { |
|
209 | - if ( ! self::is_valid_cache_key( $cache_key ) ) { |
|
208 | + foreach ($cache_keys as $cache_key) { |
|
209 | + if ( ! self::is_valid_cache_key($cache_key)) { |
|
210 | 210 | $invalid_keys[] = $cache_key; |
211 | 211 | $result = false; |
212 | 212 | } |
213 | 213 | |
214 | - delete_option( $cache_key ); |
|
214 | + delete_option($cache_key); |
|
215 | 215 | } |
216 | 216 | } |
217 | 217 | |
218 | - if ( ! $result ) { |
|
218 | + if ( ! $result) { |
|
219 | 219 | $result = new WP_Error( |
220 | 220 | 'give_invalid_cache_key', |
221 | - __( 'Cache key format should be give_cache_*', 'give' ), |
|
221 | + __('Cache key format should be give_cache_*', 'give'), |
|
222 | 222 | $invalid_keys |
223 | 223 | ); |
224 | 224 | } |
@@ -239,7 +239,7 @@ discard block |
||
239 | 239 | * |
240 | 240 | * @return bool |
241 | 241 | */ |
242 | - public static function delete_all_expired( $force = false ) { |
|
242 | + public static function delete_all_expired($force = false) { |
|
243 | 243 | global $wpdb; |
244 | 244 | $options = $wpdb->get_results( |
245 | 245 | $wpdb->prepare( |
@@ -253,30 +253,30 @@ discard block |
||
253 | 253 | ); |
254 | 254 | |
255 | 255 | // Bailout. |
256 | - if ( empty( $options ) ) { |
|
256 | + if (empty($options)) { |
|
257 | 257 | return false; |
258 | 258 | } |
259 | 259 | |
260 | - $current_time = current_time( 'timestamp', 1 ); |
|
260 | + $current_time = current_time('timestamp', 1); |
|
261 | 261 | |
262 | 262 | // Delete log cache. |
263 | - foreach ( $options as $option ) { |
|
264 | - $option['option_value'] = maybe_unserialize( $option['option_value'] ); |
|
263 | + foreach ($options as $option) { |
|
264 | + $option['option_value'] = maybe_unserialize($option['option_value']); |
|
265 | 265 | |
266 | 266 | if ( |
267 | 267 | ( |
268 | - ! self::is_valid_cache_key( $option['option_name'] ) |
|
269 | - || ! is_array( $option['option_value'] ) // Backward compatibility (<1.8.7). |
|
270 | - || ! array_key_exists( 'expiration', $option['option_value'] ) // Backward compatibility (<1.8.7). |
|
271 | - || empty( $option['option_value']['expiration'] ) |
|
272 | - || ( $current_time < $option['option_value']['expiration'] ) |
|
268 | + ! self::is_valid_cache_key($option['option_name']) |
|
269 | + || ! is_array($option['option_value']) // Backward compatibility (<1.8.7). |
|
270 | + || ! array_key_exists('expiration', $option['option_value']) // Backward compatibility (<1.8.7). |
|
271 | + || empty($option['option_value']['expiration']) |
|
272 | + || ($current_time < $option['option_value']['expiration']) |
|
273 | 273 | ) |
274 | 274 | && ! $force |
275 | 275 | ) { |
276 | 276 | continue; |
277 | 277 | } |
278 | 278 | |
279 | - self::delete( $option['option_name'] ); |
|
279 | + self::delete($option['option_name']); |
|
280 | 280 | } |
281 | 281 | } |
282 | 282 | |
@@ -294,12 +294,12 @@ discard block |
||
294 | 294 | * |
295 | 295 | * @return array |
296 | 296 | */ |
297 | - public static function get_options_like( $option_name, $fields = false ) { |
|
297 | + public static function get_options_like($option_name, $fields = false) { |
|
298 | 298 | global $wpdb; |
299 | 299 | |
300 | 300 | $field_names = $fields ? 'option_name, option_value' : 'option_name'; |
301 | 301 | |
302 | - if ( $fields ) { |
|
302 | + if ($fields) { |
|
303 | 303 | $options = $wpdb->get_results( |
304 | 304 | $wpdb->prepare( |
305 | 305 | "SELECT {$field_names } |
@@ -323,10 +323,10 @@ discard block |
||
323 | 323 | ); |
324 | 324 | } |
325 | 325 | |
326 | - if ( ! empty( $options ) && $fields ) { |
|
327 | - foreach ( $options as $index => $option ) { |
|
328 | - $option['option_value'] = maybe_unserialize( $option['option_value'] ); |
|
329 | - $options[ $index ] = $option; |
|
326 | + if ( ! empty($options) && $fields) { |
|
327 | + foreach ($options as $index => $option) { |
|
328 | + $option['option_value'] = maybe_unserialize($option['option_value']); |
|
329 | + $options[$index] = $option; |
|
330 | 330 | } |
331 | 331 | } |
332 | 332 | |
@@ -343,8 +343,8 @@ discard block |
||
343 | 343 | * |
344 | 344 | * @return bool |
345 | 345 | */ |
346 | - public static function is_valid_cache_key( $cache_key ) { |
|
347 | - $is_valid = ( false !== strpos( $cache_key, 'give_cache_' ) ); |
|
346 | + public static function is_valid_cache_key($cache_key) { |
|
347 | + $is_valid = (false !== strpos($cache_key, 'give_cache_')); |
|
348 | 348 | |
349 | 349 | |
350 | 350 | /** |
@@ -352,7 +352,7 @@ discard block |
||
352 | 352 | * |
353 | 353 | * @since 2.0 |
354 | 354 | */ |
355 | - return apply_filters( 'give_is_valid_cache_key', $is_valid, $cache_key ); |
|
355 | + return apply_filters('give_is_valid_cache_key', $is_valid, $cache_key); |
|
356 | 356 | } |
357 | 357 | |
358 | 358 | |
@@ -367,14 +367,14 @@ discard block |
||
367 | 367 | * |
368 | 368 | * @return mixed |
369 | 369 | */ |
370 | - public static function get_group( $id, $group = '' ) { |
|
370 | + public static function get_group($id, $group = '') { |
|
371 | 371 | $cached_data = null; |
372 | 372 | |
373 | 373 | // Bailout. |
374 | - if ( self::$instance->is_cache && ! empty( $id ) ) { |
|
375 | - $group = self::$instance->filter_group_name( $group ); |
|
374 | + if (self::$instance->is_cache && ! empty($id)) { |
|
375 | + $group = self::$instance->filter_group_name($group); |
|
376 | 376 | |
377 | - $cached_data = wp_cache_get( $id, $group ); |
|
377 | + $cached_data = wp_cache_get($id, $group); |
|
378 | 378 | $cached_data = false !== $cached_data ? $cached_data : null; |
379 | 379 | } |
380 | 380 | |
@@ -394,17 +394,17 @@ discard block |
||
394 | 394 | * |
395 | 395 | * @return bool |
396 | 396 | */ |
397 | - public static function set_group( $id, $data, $group = '', $expire = 0 ) { |
|
397 | + public static function set_group($id, $data, $group = '', $expire = 0) { |
|
398 | 398 | $status = false; |
399 | 399 | |
400 | 400 | // Bailout. |
401 | - if ( ! self::$instance->is_cache || empty( $id ) ) { |
|
401 | + if ( ! self::$instance->is_cache || empty($id)) { |
|
402 | 402 | return $status; |
403 | 403 | } |
404 | 404 | |
405 | - $group = self::$instance->filter_group_name( $group ); |
|
405 | + $group = self::$instance->filter_group_name($group); |
|
406 | 406 | |
407 | - $status = wp_cache_set( $id, $data, $group, $expire ); |
|
407 | + $status = wp_cache_set($id, $data, $group, $expire); |
|
408 | 408 | |
409 | 409 | return $status; |
410 | 410 | } |
@@ -420,15 +420,15 @@ discard block |
||
420 | 420 | * |
421 | 421 | * @return bool |
422 | 422 | */ |
423 | - public static function set_db_query( $id, $data ) { |
|
423 | + public static function set_db_query($id, $data) { |
|
424 | 424 | $status = false; |
425 | 425 | |
426 | 426 | // Bailout. |
427 | - if ( ! self::$instance->is_cache || empty( $id ) ) { |
|
427 | + if ( ! self::$instance->is_cache || empty($id)) { |
|
428 | 428 | return $status; |
429 | 429 | } |
430 | 430 | |
431 | - return self::set_group( $id, $data, 'give-db-queries', 0 ); |
|
431 | + return self::set_group($id, $data, 'give-db-queries', 0); |
|
432 | 432 | } |
433 | 433 | |
434 | 434 | /** |
@@ -441,8 +441,8 @@ discard block |
||
441 | 441 | * |
442 | 442 | * @return mixed |
443 | 443 | */ |
444 | - public static function get_db_query( $id ) { |
|
445 | - return self::get_group( $id, 'give-db-queries' ); |
|
444 | + public static function get_db_query($id) { |
|
445 | + return self::get_group($id, 'give-db-queries'); |
|
446 | 446 | } |
447 | 447 | |
448 | 448 | /** |
@@ -457,20 +457,20 @@ discard block |
||
457 | 457 | * |
458 | 458 | * @return bool |
459 | 459 | */ |
460 | - public static function delete_group( $ids, $group = '', $expire = 0 ) { |
|
460 | + public static function delete_group($ids, $group = '', $expire = 0) { |
|
461 | 461 | $status = false; |
462 | 462 | |
463 | 463 | // Bailout. |
464 | - if ( ! self::$instance->is_cache || empty( $ids ) ) { |
|
464 | + if ( ! self::$instance->is_cache || empty($ids)) { |
|
465 | 465 | return $status; |
466 | 466 | } |
467 | 467 | |
468 | - $group = self::$instance->filter_group_name( $group ); |
|
468 | + $group = self::$instance->filter_group_name($group); |
|
469 | 469 | |
470 | 470 | // Delete single or multiple cache items from cache. |
471 | - if ( ! is_array( $ids ) ) { |
|
472 | - $status = wp_cache_delete( $ids, $group, $expire ); |
|
473 | - self::$instance->get_incrementer( true ); |
|
471 | + if ( ! is_array($ids)) { |
|
472 | + $status = wp_cache_delete($ids, $group, $expire); |
|
473 | + self::$instance->get_incrementer(true); |
|
474 | 474 | |
475 | 475 | /** |
476 | 476 | * Fire action when cache deleted for specific id. |
@@ -481,12 +481,12 @@ discard block |
||
481 | 481 | * @param string $group |
482 | 482 | * @param int $expire |
483 | 483 | */ |
484 | - do_action( "give_deleted_{$group}_cache", $ids, $group, $expire, $status ); |
|
484 | + do_action("give_deleted_{$group}_cache", $ids, $group, $expire, $status); |
|
485 | 485 | |
486 | 486 | } else { |
487 | - foreach ( $ids as $id ) { |
|
488 | - $status = wp_cache_delete( $id, $group, $expire ); |
|
489 | - self::$instance->get_incrementer( true ); |
|
487 | + foreach ($ids as $id) { |
|
488 | + $status = wp_cache_delete($id, $group, $expire); |
|
489 | + self::$instance->get_incrementer(true); |
|
490 | 490 | |
491 | 491 | /** |
492 | 492 | * Fire action when cache deleted for specific id . |
@@ -497,7 +497,7 @@ discard block |
||
497 | 497 | * @param string $group |
498 | 498 | * @param int $expire |
499 | 499 | */ |
500 | - do_action( "give_deleted_{$group}_cache", $id, $group, $expire, $status ); |
|
500 | + do_action("give_deleted_{$group}_cache", $id, $group, $expire, $status); |
|
501 | 501 | } |
502 | 502 | } |
503 | 503 | |
@@ -514,30 +514,30 @@ discard block |
||
514 | 514 | * |
515 | 515 | * @param int $form_id |
516 | 516 | */ |
517 | - public function delete_form_related_cache( $form_id ) { |
|
517 | + public function delete_form_related_cache($form_id) { |
|
518 | 518 | // If this is just a revision, don't send the email. |
519 | - if ( wp_is_post_revision( $form_id ) ) { |
|
519 | + if (wp_is_post_revision($form_id)) { |
|
520 | 520 | return; |
521 | 521 | } |
522 | 522 | |
523 | 523 | $donation_query = new Give_Payments_Query( |
524 | 524 | array( |
525 | - 'number' => - 1, |
|
525 | + 'number' => -1, |
|
526 | 526 | 'give_forms' => $form_id, |
527 | 527 | ) |
528 | 528 | ); |
529 | 529 | |
530 | 530 | $donations = $donation_query->get_payments(); |
531 | 531 | |
532 | - if ( ! empty( $donations ) ) { |
|
532 | + if ( ! empty($donations)) { |
|
533 | 533 | /* @var Give_Payment $donation */ |
534 | - foreach ( $donations as $donation ) { |
|
535 | - wp_cache_delete( $donation->ID, 'give-donations' ); |
|
536 | - wp_cache_delete( $donation->donor_id, 'give-donors' ); |
|
534 | + foreach ($donations as $donation) { |
|
535 | + wp_cache_delete($donation->ID, 'give-donations'); |
|
536 | + wp_cache_delete($donation->donor_id, 'give-donors'); |
|
537 | 537 | } |
538 | 538 | } |
539 | 539 | |
540 | - self::$instance->get_incrementer( true ); |
|
540 | + self::$instance->get_incrementer(true); |
|
541 | 541 | } |
542 | 542 | |
543 | 543 | /** |
@@ -549,22 +549,22 @@ discard block |
||
549 | 549 | * |
550 | 550 | * @param int $donation_id |
551 | 551 | */ |
552 | - public function delete_payment_related_cache( $donation_id ) { |
|
552 | + public function delete_payment_related_cache($donation_id) { |
|
553 | 553 | // If this is just a revision, don't send the email. |
554 | - if ( wp_is_post_revision( $donation_id ) ) { |
|
554 | + if (wp_is_post_revision($donation_id)) { |
|
555 | 555 | return; |
556 | 556 | } |
557 | 557 | |
558 | 558 | /* @var Give_Payment $donation */ |
559 | - $donation = new Give_Payment( $donation_id ); |
|
559 | + $donation = new Give_Payment($donation_id); |
|
560 | 560 | |
561 | - if ( $donation && $donation->donor_id ) { |
|
562 | - wp_cache_delete( $donation->donor_id, 'give-donors' ); |
|
561 | + if ($donation && $donation->donor_id) { |
|
562 | + wp_cache_delete($donation->donor_id, 'give-donors'); |
|
563 | 563 | } |
564 | 564 | |
565 | - wp_cache_delete( $donation->ID, 'give-donations' ); |
|
565 | + wp_cache_delete($donation->ID, 'give-donations'); |
|
566 | 566 | |
567 | - self::$instance->get_incrementer( true ); |
|
567 | + self::$instance->get_incrementer(true); |
|
568 | 568 | } |
569 | 569 | |
570 | 570 | /** |
@@ -578,17 +578,17 @@ discard block |
||
578 | 578 | * @param string $group |
579 | 579 | * @param int $expire |
580 | 580 | */ |
581 | - public function delete_donor_related_cache( $id, $group, $expire ) { |
|
582 | - $donor = new Give_Donor( $id ); |
|
583 | - $donation_ids = array_map( 'trim', (array) explode( ',', trim( $donor->payment_ids ) ) ); |
|
581 | + public function delete_donor_related_cache($id, $group, $expire) { |
|
582 | + $donor = new Give_Donor($id); |
|
583 | + $donation_ids = array_map('trim', (array) explode(',', trim($donor->payment_ids))); |
|
584 | 584 | |
585 | - if ( ! empty( $donation_ids ) ) { |
|
586 | - foreach ( $donation_ids as $donation ) { |
|
587 | - wp_cache_delete( $donation, 'give-donations' ); |
|
585 | + if ( ! empty($donation_ids)) { |
|
586 | + foreach ($donation_ids as $donation) { |
|
587 | + wp_cache_delete($donation, 'give-donations'); |
|
588 | 588 | } |
589 | 589 | } |
590 | 590 | |
591 | - self::$instance->get_incrementer( true ); |
|
591 | + self::$instance->get_incrementer(true); |
|
592 | 592 | } |
593 | 593 | |
594 | 594 | /** |
@@ -602,15 +602,15 @@ discard block |
||
602 | 602 | * @param string $group |
603 | 603 | * @param int $expire |
604 | 604 | */ |
605 | - public function delete_donations_related_cache( $id, $group, $expire ) { |
|
605 | + public function delete_donations_related_cache($id, $group, $expire) { |
|
606 | 606 | /* @var Give_Payment $donation */ |
607 | - $donation = new Give_Payment( $id ); |
|
607 | + $donation = new Give_Payment($id); |
|
608 | 608 | |
609 | - if ( $donation && $donation->donor_id ) { |
|
610 | - wp_cache_delete( $donation->donor_id, 'give-donors' ); |
|
609 | + if ($donation && $donation->donor_id) { |
|
610 | + wp_cache_delete($donation->donor_id, 'give-donors'); |
|
611 | 611 | } |
612 | 612 | |
613 | - self::$instance->get_incrementer( true ); |
|
613 | + self::$instance->get_incrementer(true); |
|
614 | 614 | } |
615 | 615 | |
616 | 616 | |
@@ -628,12 +628,12 @@ discard block |
||
628 | 628 | * |
629 | 629 | * @return string |
630 | 630 | */ |
631 | - private function get_incrementer( $refresh = false, $incrementer_key = 'give-cache-incrementer-db-queries' ) { |
|
632 | - $incrementer_value = wp_cache_get( $incrementer_key ); |
|
631 | + private function get_incrementer($refresh = false, $incrementer_key = 'give-cache-incrementer-db-queries') { |
|
632 | + $incrementer_value = wp_cache_get($incrementer_key); |
|
633 | 633 | |
634 | - if ( false === $incrementer_value || true === $refresh ) { |
|
635 | - $incrementer_value = microtime( true ); |
|
636 | - wp_cache_set( $incrementer_key, $incrementer_value ); |
|
634 | + if (false === $incrementer_value || true === $refresh) { |
|
635 | + $incrementer_value = microtime(true); |
|
636 | + wp_cache_set($incrementer_key, $incrementer_value); |
|
637 | 637 | } |
638 | 638 | |
639 | 639 | return $incrementer_value; |
@@ -650,11 +650,11 @@ discard block |
||
650 | 650 | public function flush_cache() { |
651 | 651 | if ( |
652 | 652 | Give_Admin_Settings::is_saving_settings() && |
653 | - isset( $_POST['cache'] ) && |
|
654 | - give_is_setting_enabled( give_clean( $_POST['cache'] ) ) |
|
653 | + isset($_POST['cache']) && |
|
654 | + give_is_setting_enabled(give_clean($_POST['cache'])) |
|
655 | 655 | ) { |
656 | - $this->get_incrementer( true ); |
|
657 | - $this->get_incrementer( true, 'give-cache-incrementer' ); |
|
656 | + $this->get_incrementer(true); |
|
657 | + $this->get_incrementer(true, 'give-cache-incrementer'); |
|
658 | 658 | } |
659 | 659 | } |
660 | 660 | |
@@ -669,11 +669,11 @@ discard block |
||
669 | 669 | * |
670 | 670 | * @return mixed |
671 | 671 | */ |
672 | - private function filter_group_name( $group ) { |
|
673 | - if ( ! empty( $group ) ) { |
|
674 | - $incrementer = self::$instance->get_incrementer( false, 'give-cache-incrementer' ); |
|
672 | + private function filter_group_name($group) { |
|
673 | + if ( ! empty($group)) { |
|
674 | + $incrementer = self::$instance->get_incrementer(false, 'give-cache-incrementer'); |
|
675 | 675 | |
676 | - if ( 'give-db-queries' === $group ) { |
|
676 | + if ('give-db-queries' === $group) { |
|
677 | 677 | $incrementer = self::$instance->get_incrementer(); |
678 | 678 | } |
679 | 679 |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | */ |
13 | 13 | |
14 | 14 | // Exit if accessed directly. |
15 | -if ( ! defined( 'ABSPATH' ) ) { |
|
15 | +if ( ! defined('ABSPATH')) { |
|
16 | 16 | exit; |
17 | 17 | } |
18 | 18 | |
@@ -26,31 +26,31 @@ discard block |
||
26 | 26 | */ |
27 | 27 | function give_test_ajax_works() { |
28 | 28 | // Handle ajax. |
29 | - if ( doing_action( 'wp_ajax_nopriv_give_test_ajax' ) ) { |
|
30 | - wp_die( 0, 200 ); |
|
29 | + if (doing_action('wp_ajax_nopriv_give_test_ajax')) { |
|
30 | + wp_die(0, 200); |
|
31 | 31 | } |
32 | 32 | |
33 | 33 | // Check if the Airplane Mode plugin is installed. |
34 | - if ( class_exists( 'Airplane_Mode_Core' ) ) { |
|
34 | + if (class_exists('Airplane_Mode_Core')) { |
|
35 | 35 | |
36 | 36 | $airplane = Airplane_Mode_Core::getInstance(); |
37 | 37 | |
38 | - if ( method_exists( $airplane, 'enabled' ) ) { |
|
38 | + if (method_exists($airplane, 'enabled')) { |
|
39 | 39 | |
40 | - if ( $airplane->enabled() ) { |
|
40 | + if ($airplane->enabled()) { |
|
41 | 41 | return true; |
42 | 42 | } |
43 | 43 | } else { |
44 | 44 | |
45 | - if ( 'on' === $airplane->check_status() ) { |
|
45 | + if ('on' === $airplane->check_status()) { |
|
46 | 46 | return true; |
47 | 47 | } |
48 | 48 | } |
49 | 49 | } |
50 | 50 | |
51 | - add_filter( 'block_local_requests', '__return_false' ); |
|
51 | + add_filter('block_local_requests', '__return_false'); |
|
52 | 52 | |
53 | - if ( Give_Cache::get( '_give_ajax_works', true ) ) { |
|
53 | + if (Give_Cache::get('_give_ajax_works', true)) { |
|
54 | 54 | return true; |
55 | 55 | } |
56 | 56 | |
@@ -62,41 +62,41 @@ discard block |
||
62 | 62 | ), |
63 | 63 | ); |
64 | 64 | |
65 | - $ajax = wp_remote_post( give_get_ajax_url(), $params ); |
|
65 | + $ajax = wp_remote_post(give_get_ajax_url(), $params); |
|
66 | 66 | |
67 | 67 | $works = true; |
68 | 68 | |
69 | - if ( is_wp_error( $ajax ) ) { |
|
69 | + if (is_wp_error($ajax)) { |
|
70 | 70 | |
71 | 71 | $works = false; |
72 | 72 | |
73 | 73 | } else { |
74 | 74 | |
75 | - if ( empty( $ajax['response'] ) ) { |
|
75 | + if (empty($ajax['response'])) { |
|
76 | 76 | $works = false; |
77 | 77 | } |
78 | 78 | |
79 | - if ( empty( $ajax['response']['code'] ) || 200 !== (int) $ajax['response']['code'] ) { |
|
79 | + if (empty($ajax['response']['code']) || 200 !== (int) $ajax['response']['code']) { |
|
80 | 80 | $works = false; |
81 | 81 | } |
82 | 82 | |
83 | - if ( empty( $ajax['response']['message'] ) || 'OK' !== $ajax['response']['message'] ) { |
|
83 | + if (empty($ajax['response']['message']) || 'OK' !== $ajax['response']['message']) { |
|
84 | 84 | $works = false; |
85 | 85 | } |
86 | 86 | |
87 | - if ( ! isset( $ajax['body'] ) || 0 !== (int) $ajax['body'] ) { |
|
87 | + if ( ! isset($ajax['body']) || 0 !== (int) $ajax['body']) { |
|
88 | 88 | $works = false; |
89 | 89 | } |
90 | 90 | } |
91 | 91 | |
92 | - if ( $works ) { |
|
93 | - Give_Cache::set( '_give_ajax_works', '1', DAY_IN_SECONDS, true ); |
|
92 | + if ($works) { |
|
93 | + Give_Cache::set('_give_ajax_works', '1', DAY_IN_SECONDS, true); |
|
94 | 94 | } |
95 | 95 | |
96 | - return apply_filters( 'give_test_ajax_works', $works ); |
|
96 | + return apply_filters('give_test_ajax_works', $works); |
|
97 | 97 | } |
98 | 98 | |
99 | -add_action( 'wp_ajax_nopriv_give_test_ajax', 'give_test_ajax_works' ); |
|
99 | +add_action('wp_ajax_nopriv_give_test_ajax', 'give_test_ajax_works'); |
|
100 | 100 | |
101 | 101 | /** |
102 | 102 | * Get AJAX URL |
@@ -107,21 +107,21 @@ discard block |
||
107 | 107 | * |
108 | 108 | * @return string |
109 | 109 | */ |
110 | -function give_get_ajax_url( $query = array() ) { |
|
111 | - $scheme = defined( 'FORCE_SSL_ADMIN' ) && FORCE_SSL_ADMIN ? 'https' : 'admin'; |
|
110 | +function give_get_ajax_url($query = array()) { |
|
111 | + $scheme = defined('FORCE_SSL_ADMIN') && FORCE_SSL_ADMIN ? 'https' : 'admin'; |
|
112 | 112 | |
113 | 113 | $current_url = give_get_current_page_url(); |
114 | - $ajax_url = admin_url( 'admin-ajax.php', $scheme ); |
|
114 | + $ajax_url = admin_url('admin-ajax.php', $scheme); |
|
115 | 115 | |
116 | - if ( preg_match( '/^https/', $current_url ) && ! preg_match( '/^https/', $ajax_url ) ) { |
|
117 | - $ajax_url = preg_replace( '/^http/', 'https', $ajax_url ); |
|
116 | + if (preg_match('/^https/', $current_url) && ! preg_match('/^https/', $ajax_url)) { |
|
117 | + $ajax_url = preg_replace('/^http/', 'https', $ajax_url); |
|
118 | 118 | } |
119 | 119 | |
120 | - if ( ! empty( $query ) ) { |
|
121 | - $ajax_url = add_query_arg( $query, $ajax_url ); |
|
120 | + if ( ! empty($query)) { |
|
121 | + $ajax_url = add_query_arg($query, $ajax_url); |
|
122 | 122 | } |
123 | 123 | |
124 | - return apply_filters( 'give_ajax_url', $ajax_url ); |
|
124 | + return apply_filters('give_ajax_url', $ajax_url); |
|
125 | 125 | } |
126 | 126 | |
127 | 127 | /** |
@@ -137,12 +137,12 @@ discard block |
||
137 | 137 | * |
138 | 138 | * @since 1.7 |
139 | 139 | */ |
140 | - do_action( 'give_donation_form_login_fields' ); |
|
140 | + do_action('give_donation_form_login_fields'); |
|
141 | 141 | |
142 | 142 | give_die(); |
143 | 143 | } |
144 | 144 | |
145 | -add_action( 'wp_ajax_nopriv_give_checkout_login', 'give_load_checkout_login_fields' ); |
|
145 | +add_action('wp_ajax_nopriv_give_checkout_login', 'give_load_checkout_login_fields'); |
|
146 | 146 | |
147 | 147 | /** |
148 | 148 | * Load Checkout Fields |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | * @return void |
153 | 153 | */ |
154 | 154 | function give_load_checkout_fields() { |
155 | - $form_id = isset( $_POST['form_id'] ) ? $_POST['form_id'] : ''; |
|
155 | + $form_id = isset($_POST['form_id']) ? $_POST['form_id'] : ''; |
|
156 | 156 | |
157 | 157 | ob_start(); |
158 | 158 | |
@@ -161,18 +161,18 @@ discard block |
||
161 | 161 | * |
162 | 162 | * @since 1.7 |
163 | 163 | */ |
164 | - do_action( 'give_donation_form_register_login_fields', $form_id ); |
|
164 | + do_action('give_donation_form_register_login_fields', $form_id); |
|
165 | 165 | |
166 | 166 | $fields = ob_get_clean(); |
167 | 167 | |
168 | - wp_send_json( array( |
|
169 | - 'fields' => wp_json_encode( $fields ), |
|
170 | - 'submit' => wp_json_encode( give_get_donation_form_submit_button( $form_id ) ), |
|
171 | - ) ); |
|
168 | + wp_send_json(array( |
|
169 | + 'fields' => wp_json_encode($fields), |
|
170 | + 'submit' => wp_json_encode(give_get_donation_form_submit_button($form_id)), |
|
171 | + )); |
|
172 | 172 | } |
173 | 173 | |
174 | -add_action( 'wp_ajax_nopriv_give_cancel_login', 'give_load_checkout_fields' ); |
|
175 | -add_action( 'wp_ajax_nopriv_give_checkout_register', 'give_load_checkout_fields' ); |
|
174 | +add_action('wp_ajax_nopriv_give_cancel_login', 'give_load_checkout_fields'); |
|
175 | +add_action('wp_ajax_nopriv_give_checkout_register', 'give_load_checkout_fields'); |
|
176 | 176 | |
177 | 177 | /** |
178 | 178 | * Get Form Title via AJAX (used only in WordPress Admin) |
@@ -182,9 +182,9 @@ discard block |
||
182 | 182 | * @return void |
183 | 183 | */ |
184 | 184 | function give_ajax_get_form_title() { |
185 | - if ( isset( $_POST['form_id'] ) ) { |
|
186 | - $title = get_the_title( $_POST['form_id'] ); |
|
187 | - if ( $title ) { |
|
185 | + if (isset($_POST['form_id'])) { |
|
186 | + $title = get_the_title($_POST['form_id']); |
|
187 | + if ($title) { |
|
188 | 188 | echo $title; |
189 | 189 | } else { |
190 | 190 | echo 'fail'; |
@@ -193,8 +193,8 @@ discard block |
||
193 | 193 | give_die(); |
194 | 194 | } |
195 | 195 | |
196 | -add_action( 'wp_ajax_give_get_form_title', 'give_ajax_get_form_title' ); |
|
197 | -add_action( 'wp_ajax_nopriv_give_get_form_title', 'give_ajax_get_form_title' ); |
|
196 | +add_action('wp_ajax_give_get_form_title', 'give_ajax_get_form_title'); |
|
197 | +add_action('wp_ajax_nopriv_give_get_form_title', 'give_ajax_get_form_title'); |
|
198 | 198 | |
199 | 199 | /** |
200 | 200 | * Retrieve a states drop down |
@@ -208,41 +208,41 @@ discard block |
||
208 | 208 | $show_field = true; |
209 | 209 | $states_require = true; |
210 | 210 | // Get the Country code from the $_POST. |
211 | - $country = sanitize_text_field( $_POST['country'] ); |
|
211 | + $country = sanitize_text_field($_POST['country']); |
|
212 | 212 | |
213 | 213 | // Get the field name from the $_POST. |
214 | - $field_name = sanitize_text_field( $_POST['field_name'] ); |
|
214 | + $field_name = sanitize_text_field($_POST['field_name']); |
|
215 | 215 | |
216 | - $label = __( 'State', 'give' ); |
|
216 | + $label = __('State', 'give'); |
|
217 | 217 | $states_label = give_get_states_label(); |
218 | 218 | |
219 | 219 | $default_state = ''; |
220 | - if ( $country === give_get_country() ) { |
|
220 | + if ($country === give_get_country()) { |
|
221 | 221 | $default_state = give_get_state(); |
222 | 222 | } |
223 | 223 | |
224 | 224 | // Check if $country code exists in the array key for states label. |
225 | - if ( array_key_exists( $country, $states_label ) ) { |
|
226 | - $label = $states_label[ $country ]; |
|
225 | + if (array_key_exists($country, $states_label)) { |
|
226 | + $label = $states_label[$country]; |
|
227 | 227 | } |
228 | 228 | |
229 | - if ( empty( $country ) ) { |
|
229 | + if (empty($country)) { |
|
230 | 230 | $country = give_get_country(); |
231 | 231 | } |
232 | 232 | |
233 | - $states = give_get_states( $country ); |
|
234 | - if ( ! empty( $states ) ) { |
|
235 | - $args = array( |
|
233 | + $states = give_get_states($country); |
|
234 | + if ( ! empty($states)) { |
|
235 | + $args = array( |
|
236 | 236 | 'name' => $field_name, |
237 | 237 | 'id' => $field_name, |
238 | - 'class' => $field_name . ' give-select', |
|
238 | + 'class' => $field_name.' give-select', |
|
239 | 239 | 'options' => $states, |
240 | 240 | 'show_option_all' => false, |
241 | 241 | 'show_option_none' => false, |
242 | 242 | 'placeholder' => $label, |
243 | 243 | 'selected' => $default_state, |
244 | 244 | ); |
245 | - $data = Give()->html->select( $args ); |
|
245 | + $data = Give()->html->select($args); |
|
246 | 246 | $states_found = true; |
247 | 247 | } else { |
248 | 248 | $data = 'nostates'; |
@@ -251,7 +251,7 @@ discard block |
||
251 | 251 | $no_states_country = give_no_states_country_list(); |
252 | 252 | |
253 | 253 | // Check if $country code exists in the array key. |
254 | - if ( array_key_exists( $country, $no_states_country ) ) { |
|
254 | + if (array_key_exists($country, $no_states_country)) { |
|
255 | 255 | $show_field = false; |
256 | 256 | } |
257 | 257 | |
@@ -259,7 +259,7 @@ discard block |
||
259 | 259 | $states_not_required_country_list = give_states_not_required_country_list(); |
260 | 260 | |
261 | 261 | // Check if $country code exists in the array key. |
262 | - if ( array_key_exists( $country, $states_not_required_country_list ) ) { |
|
262 | + if (array_key_exists($country, $states_not_required_country_list)) { |
|
263 | 263 | $states_require = false; |
264 | 264 | } |
265 | 265 | } |
@@ -272,11 +272,11 @@ discard block |
||
272 | 272 | 'data' => $data, |
273 | 273 | 'default_state' => $default_state, |
274 | 274 | ); |
275 | - wp_send_json( $response ); |
|
275 | + wp_send_json($response); |
|
276 | 276 | } |
277 | 277 | |
278 | -add_action( 'wp_ajax_give_get_states', 'give_ajax_get_states_field' ); |
|
279 | -add_action( 'wp_ajax_nopriv_give_get_states', 'give_ajax_get_states_field' ); |
|
278 | +add_action('wp_ajax_give_get_states', 'give_ajax_get_states_field'); |
|
279 | +add_action('wp_ajax_nopriv_give_get_states', 'give_ajax_get_states_field'); |
|
280 | 280 | |
281 | 281 | /** |
282 | 282 | * Retrieve donation forms via AJAX for chosen dropdown search field. |
@@ -288,19 +288,19 @@ discard block |
||
288 | 288 | function give_ajax_form_search() { |
289 | 289 | global $wpdb; |
290 | 290 | |
291 | - $search = esc_sql( sanitize_text_field( $_GET['s'] ) ); |
|
292 | - $excludes = ( isset( $_GET['current_id'] ) ? (array) $_GET['current_id'] : array() ); |
|
291 | + $search = esc_sql(sanitize_text_field($_GET['s'])); |
|
292 | + $excludes = (isset($_GET['current_id']) ? (array) $_GET['current_id'] : array()); |
|
293 | 293 | |
294 | 294 | $results = array(); |
295 | - if ( current_user_can( 'edit_give_forms' ) ) { |
|
296 | - $items = $wpdb->get_results( "SELECT ID,post_title FROM $wpdb->posts WHERE `post_type` = 'give_forms' AND `post_title` LIKE '%$search%' LIMIT 50" ); |
|
295 | + if (current_user_can('edit_give_forms')) { |
|
296 | + $items = $wpdb->get_results("SELECT ID,post_title FROM $wpdb->posts WHERE `post_type` = 'give_forms' AND `post_title` LIKE '%$search%' LIMIT 50"); |
|
297 | 297 | } else { |
298 | - $items = $wpdb->get_results( "SELECT ID,post_title FROM $wpdb->posts WHERE `post_type` = 'give_forms' AND `post_status` = 'publish' AND `post_title` LIKE '%$search%' LIMIT 50" ); |
|
298 | + $items = $wpdb->get_results("SELECT ID,post_title FROM $wpdb->posts WHERE `post_type` = 'give_forms' AND `post_status` = 'publish' AND `post_title` LIKE '%$search%' LIMIT 50"); |
|
299 | 299 | } |
300 | 300 | |
301 | - if ( $items ) { |
|
301 | + if ($items) { |
|
302 | 302 | |
303 | - foreach ( $items as $item ) { |
|
303 | + foreach ($items as $item) { |
|
304 | 304 | |
305 | 305 | $results[] = array( |
306 | 306 | 'id' => $item->ID, |
@@ -311,18 +311,18 @@ discard block |
||
311 | 311 | |
312 | 312 | $items[] = array( |
313 | 313 | 'id' => 0, |
314 | - 'name' => __( 'No forms found.', 'give' ), |
|
314 | + 'name' => __('No forms found.', 'give'), |
|
315 | 315 | ); |
316 | 316 | |
317 | 317 | } |
318 | 318 | |
319 | - echo json_encode( $results ); |
|
319 | + echo json_encode($results); |
|
320 | 320 | |
321 | 321 | give_die(); |
322 | 322 | } |
323 | 323 | |
324 | -add_action( 'wp_ajax_give_form_search', 'give_ajax_form_search' ); |
|
325 | -add_action( 'wp_ajax_nopriv_give_form_search', 'give_ajax_form_search' ); |
|
324 | +add_action('wp_ajax_give_form_search', 'give_ajax_form_search'); |
|
325 | +add_action('wp_ajax_nopriv_give_form_search', 'give_ajax_form_search'); |
|
326 | 326 | |
327 | 327 | /** |
328 | 328 | * Search the donors database via Ajax |
@@ -334,38 +334,38 @@ discard block |
||
334 | 334 | function give_ajax_donor_search() { |
335 | 335 | global $wpdb; |
336 | 336 | |
337 | - $search = esc_sql( sanitize_text_field( $_GET['s'] ) ); |
|
337 | + $search = esc_sql(sanitize_text_field($_GET['s'])); |
|
338 | 338 | $results = array(); |
339 | - if ( ! current_user_can( 'view_give_reports' ) ) { |
|
339 | + if ( ! current_user_can('view_give_reports')) { |
|
340 | 340 | $donors = array(); |
341 | 341 | } else { |
342 | - $donors = $wpdb->get_results( "SELECT id,name,email FROM $wpdb->donors WHERE `name` LIKE '%$search%' OR `email` LIKE '%$search%' LIMIT 50" ); |
|
342 | + $donors = $wpdb->get_results("SELECT id,name,email FROM $wpdb->donors WHERE `name` LIKE '%$search%' OR `email` LIKE '%$search%' LIMIT 50"); |
|
343 | 343 | } |
344 | 344 | |
345 | - if ( $donors ) { |
|
345 | + if ($donors) { |
|
346 | 346 | |
347 | - foreach ( $donors as $donor ) { |
|
347 | + foreach ($donors as $donor) { |
|
348 | 348 | |
349 | 349 | $results[] = array( |
350 | 350 | 'id' => $donor->id, |
351 | - 'name' => $donor->name . ' (' . $donor->email . ')', |
|
351 | + 'name' => $donor->name.' ('.$donor->email.')', |
|
352 | 352 | ); |
353 | 353 | } |
354 | 354 | } else { |
355 | 355 | |
356 | 356 | $donors[] = array( |
357 | 357 | 'id' => 0, |
358 | - 'name' => __( 'No donors found.', 'give' ), |
|
358 | + 'name' => __('No donors found.', 'give'), |
|
359 | 359 | ); |
360 | 360 | |
361 | 361 | } |
362 | 362 | |
363 | - echo json_encode( $results ); |
|
363 | + echo json_encode($results); |
|
364 | 364 | |
365 | 365 | give_die(); |
366 | 366 | } |
367 | 367 | |
368 | -add_action( 'wp_ajax_give_donor_search', 'give_ajax_donor_search' ); |
|
368 | +add_action('wp_ajax_give_donor_search', 'give_ajax_donor_search'); |
|
369 | 369 | |
370 | 370 | |
371 | 371 | /** |
@@ -377,39 +377,39 @@ discard block |
||
377 | 377 | */ |
378 | 378 | function give_ajax_search_users() { |
379 | 379 | |
380 | - if ( current_user_can( 'manage_give_settings' ) ) { |
|
380 | + if (current_user_can('manage_give_settings')) { |
|
381 | 381 | |
382 | - $search = esc_sql( sanitize_text_field( $_GET['s'] ) ); |
|
382 | + $search = esc_sql(sanitize_text_field($_GET['s'])); |
|
383 | 383 | |
384 | 384 | $get_users_args = array( |
385 | 385 | 'number' => 9999, |
386 | - 'search' => $search . '*', |
|
386 | + 'search' => $search.'*', |
|
387 | 387 | ); |
388 | 388 | |
389 | - $get_users_args = apply_filters( 'give_search_users_args', $get_users_args ); |
|
389 | + $get_users_args = apply_filters('give_search_users_args', $get_users_args); |
|
390 | 390 | |
391 | - $found_users = apply_filters( 'give_ajax_found_users', get_users( $get_users_args ), $search ); |
|
391 | + $found_users = apply_filters('give_ajax_found_users', get_users($get_users_args), $search); |
|
392 | 392 | $results = array(); |
393 | 393 | |
394 | - if ( $found_users ) { |
|
394 | + if ($found_users) { |
|
395 | 395 | |
396 | - foreach ( $found_users as $user ) { |
|
396 | + foreach ($found_users as $user) { |
|
397 | 397 | |
398 | 398 | $results[] = array( |
399 | 399 | 'id' => $user->ID, |
400 | - 'name' => esc_html( $user->user_login . ' (' . $user->user_email . ')' ), |
|
400 | + 'name' => esc_html($user->user_login.' ('.$user->user_email.')'), |
|
401 | 401 | ); |
402 | 402 | } |
403 | 403 | } else { |
404 | 404 | |
405 | 405 | $results[] = array( |
406 | 406 | 'id' => 0, |
407 | - 'name' => __( 'No users found.', 'give' ), |
|
407 | + 'name' => __('No users found.', 'give'), |
|
408 | 408 | ); |
409 | 409 | |
410 | 410 | } |
411 | 411 | |
412 | - echo json_encode( $results ); |
|
412 | + echo json_encode($results); |
|
413 | 413 | |
414 | 414 | }// End if(). |
415 | 415 | |
@@ -417,7 +417,7 @@ discard block |
||
417 | 417 | |
418 | 418 | } |
419 | 419 | |
420 | -add_action( 'wp_ajax_give_user_search', 'give_ajax_search_users' ); |
|
420 | +add_action('wp_ajax_give_user_search', 'give_ajax_search_users'); |
|
421 | 421 | |
422 | 422 | |
423 | 423 | /** |
@@ -429,32 +429,32 @@ discard block |
||
429 | 429 | */ |
430 | 430 | function give_check_for_form_price_variations() { |
431 | 431 | |
432 | - if ( ! current_user_can( 'edit_give_forms', get_current_user_id() ) ) { |
|
433 | - die( '-1' ); |
|
432 | + if ( ! current_user_can('edit_give_forms', get_current_user_id())) { |
|
433 | + die('-1'); |
|
434 | 434 | } |
435 | 435 | |
436 | - $form_id = intval( $_POST['form_id'] ); |
|
437 | - $form = get_post( $form_id ); |
|
436 | + $form_id = intval($_POST['form_id']); |
|
437 | + $form = get_post($form_id); |
|
438 | 438 | |
439 | - if ( 'give_forms' != $form->post_type ) { |
|
440 | - die( '-2' ); |
|
439 | + if ('give_forms' != $form->post_type) { |
|
440 | + die('-2'); |
|
441 | 441 | } |
442 | 442 | |
443 | - if ( give_has_variable_prices( $form_id ) ) { |
|
444 | - $variable_prices = give_get_variable_prices( $form_id ); |
|
443 | + if (give_has_variable_prices($form_id)) { |
|
444 | + $variable_prices = give_get_variable_prices($form_id); |
|
445 | 445 | |
446 | - if ( $variable_prices ) { |
|
446 | + if ($variable_prices) { |
|
447 | 447 | $ajax_response = '<select class="give_price_options_select give-select give-select" name="give_price_option">'; |
448 | 448 | |
449 | - if ( isset( $_POST['all_prices'] ) ) { |
|
450 | - $ajax_response .= '<option value="all">' . esc_html__( 'All Levels', 'give' ) . '</option>'; |
|
449 | + if (isset($_POST['all_prices'])) { |
|
450 | + $ajax_response .= '<option value="all">'.esc_html__('All Levels', 'give').'</option>'; |
|
451 | 451 | } |
452 | 452 | |
453 | - foreach ( $variable_prices as $key => $price ) { |
|
453 | + foreach ($variable_prices as $key => $price) { |
|
454 | 454 | |
455 | - $level_text = ! empty( $price['_give_text'] ) ? esc_html( $price['_give_text'] ) : give_currency_filter( give_format_amount( $price['_give_amount'], array( 'sanitize' => false ) ) ); |
|
455 | + $level_text = ! empty($price['_give_text']) ? esc_html($price['_give_text']) : give_currency_filter(give_format_amount($price['_give_amount'], array('sanitize' => false))); |
|
456 | 456 | |
457 | - $ajax_response .= '<option value="' . esc_attr( $price['_give_id']['level_id'] ) . '">' . $level_text . '</option>'; |
|
457 | + $ajax_response .= '<option value="'.esc_attr($price['_give_id']['level_id']).'">'.$level_text.'</option>'; |
|
458 | 458 | } |
459 | 459 | $ajax_response .= '</select>'; |
460 | 460 | echo $ajax_response; |
@@ -464,7 +464,7 @@ discard block |
||
464 | 464 | give_die(); |
465 | 465 | } |
466 | 466 | |
467 | -add_action( 'wp_ajax_give_check_for_form_price_variations', 'give_check_for_form_price_variations' ); |
|
467 | +add_action('wp_ajax_give_check_for_form_price_variations', 'give_check_for_form_price_variations'); |
|
468 | 468 | |
469 | 469 | |
470 | 470 | /** |
@@ -475,28 +475,28 @@ discard block |
||
475 | 475 | * @return void |
476 | 476 | */ |
477 | 477 | function give_check_for_form_price_variations_html() { |
478 | - if ( ! current_user_can( 'edit_give_payments', get_current_user_id() ) ) { |
|
478 | + if ( ! current_user_can('edit_give_payments', get_current_user_id())) { |
|
479 | 479 | wp_die(); |
480 | 480 | } |
481 | 481 | |
482 | - $form_id = ! empty( $_POST['form_id'] ) ? intval( $_POST['form_id'] ) : false; |
|
483 | - $payment_id = ! empty( $_POST['payment_id'] ) ? intval( $_POST['payment_id'] ) : false; |
|
484 | - if ( empty( $form_id ) || empty( $payment_id ) ) { |
|
482 | + $form_id = ! empty($_POST['form_id']) ? intval($_POST['form_id']) : false; |
|
483 | + $payment_id = ! empty($_POST['payment_id']) ? intval($_POST['payment_id']) : false; |
|
484 | + if (empty($form_id) || empty($payment_id)) { |
|
485 | 485 | wp_die(); |
486 | 486 | } |
487 | 487 | |
488 | - $form = get_post( $form_id ); |
|
489 | - if ( ! empty( $form->post_type ) && 'give_forms' != $form->post_type ) { |
|
488 | + $form = get_post($form_id); |
|
489 | + if ( ! empty($form->post_type) && 'give_forms' != $form->post_type) { |
|
490 | 490 | wp_die(); |
491 | 491 | } |
492 | 492 | |
493 | - if ( ! give_has_variable_prices( $form_id ) || ! $form_id ) { |
|
494 | - esc_html_e( 'n/a', 'give' ); |
|
493 | + if ( ! give_has_variable_prices($form_id) || ! $form_id) { |
|
494 | + esc_html_e('n/a', 'give'); |
|
495 | 495 | } else { |
496 | 496 | $prices_atts = array(); |
497 | - if ( $variable_prices = give_get_variable_prices( $form_id ) ) { |
|
498 | - foreach ( $variable_prices as $variable_price ) { |
|
499 | - $prices_atts[ $variable_price['_give_id']['level_id'] ] = give_format_amount( $variable_price['_give_amount'], array( 'sanitize' => false ) ); |
|
497 | + if ($variable_prices = give_get_variable_prices($form_id)) { |
|
498 | + foreach ($variable_prices as $variable_price) { |
|
499 | + $prices_atts[$variable_price['_give_id']['level_id']] = give_format_amount($variable_price['_give_amount'], array('sanitize' => false)); |
|
500 | 500 | } |
501 | 501 | } |
502 | 502 | |
@@ -507,12 +507,12 @@ discard block |
||
507 | 507 | 'chosen' => true, |
508 | 508 | 'show_option_all' => '', |
509 | 509 | 'show_option_none' => '', |
510 | - 'select_atts' => 'data-prices=' . esc_attr( json_encode( $prices_atts ) ), |
|
510 | + 'select_atts' => 'data-prices='.esc_attr(json_encode($prices_atts)), |
|
511 | 511 | ); |
512 | 512 | |
513 | - if ( $payment_id ) { |
|
513 | + if ($payment_id) { |
|
514 | 514 | // Payment object. |
515 | - $payment = new Give_Payment( $payment_id ); |
|
515 | + $payment = new Give_Payment($payment_id); |
|
516 | 516 | |
517 | 517 | // Payment meta. |
518 | 518 | $payment_meta = $payment->get_meta(); |
@@ -520,13 +520,13 @@ discard block |
||
520 | 520 | } |
521 | 521 | |
522 | 522 | // Render variable prices select tag html. |
523 | - give_get_form_variable_price_dropdown( $variable_price_dropdown_option, true ); |
|
523 | + give_get_form_variable_price_dropdown($variable_price_dropdown_option, true); |
|
524 | 524 | } |
525 | 525 | |
526 | 526 | give_die(); |
527 | 527 | } |
528 | 528 | |
529 | -add_action( 'wp_ajax_give_check_for_form_price_variations_html', 'give_check_for_form_price_variations_html' ); |
|
529 | +add_action('wp_ajax_give_check_for_form_price_variations_html', 'give_check_for_form_price_variations_html'); |
|
530 | 530 | |
531 | 531 | /** |
532 | 532 | * Send Confirmation Email For Complete Donation History Access. |
@@ -538,24 +538,24 @@ discard block |
||
538 | 538 | function give_confirm_email_for_donation_access() { |
539 | 539 | |
540 | 540 | // Verify Security using Nonce. |
541 | - if ( ! check_ajax_referer( 'give_ajax_nonce', 'nonce' ) ) { |
|
541 | + if ( ! check_ajax_referer('give_ajax_nonce', 'nonce')) { |
|
542 | 542 | return false; |
543 | 543 | } |
544 | 544 | |
545 | 545 | // Bail Out, if email is empty. |
546 | - if ( empty( $_POST['email'] ) ) { |
|
546 | + if (empty($_POST['email'])) { |
|
547 | 547 | return false; |
548 | 548 | } |
549 | 549 | |
550 | - $donor = Give()->donors->get_donor_by( 'email', give_clean( $_POST['email'] ) ); |
|
551 | - if ( Give()->email_access->can_send_email( $donor->id ) ) { |
|
550 | + $donor = Give()->donors->get_donor_by('email', give_clean($_POST['email'])); |
|
551 | + if (Give()->email_access->can_send_email($donor->id)) { |
|
552 | 552 | $return = array(); |
553 | - $email_sent = Give()->email_access->send_email( $donor->id, $donor->email ); |
|
553 | + $email_sent = Give()->email_access->send_email($donor->id, $donor->email); |
|
554 | 554 | |
555 | - if ( ! $email_sent ) { |
|
555 | + if ( ! $email_sent) { |
|
556 | 556 | $return['status'] = 'error'; |
557 | 557 | $return['message'] = Give()->notices->print_frontend_notice( |
558 | - __( 'Unable to send email. Please try again.', 'give' ), |
|
558 | + __('Unable to send email. Please try again.', 'give'), |
|
559 | 559 | false, |
560 | 560 | 'error' |
561 | 561 | ); |
@@ -563,7 +563,7 @@ discard block |
||
563 | 563 | |
564 | 564 | $return['status'] = 'success'; |
565 | 565 | $return['message'] = Give()->notices->print_frontend_notice( |
566 | - __( 'Please check your email and click on the link to access your complete donation history.', 'give' ), |
|
566 | + __('Please check your email and click on the link to access your complete donation history.', 'give'), |
|
567 | 567 | false, |
568 | 568 | 'success' |
569 | 569 | ); |
@@ -574,16 +574,16 @@ discard block |
||
574 | 574 | $return['status'] = 'error'; |
575 | 575 | $return['message'] = Give()->notices->print_frontend_notice( |
576 | 576 | sprintf( |
577 | - __( 'Too many access email requests detected. Please wait %s before requesting a new donation history access link.', 'give' ), |
|
578 | - sprintf( _n( '%s minute', '%s minutes', $value, 'give' ), $value ) |
|
577 | + __('Too many access email requests detected. Please wait %s before requesting a new donation history access link.', 'give'), |
|
578 | + sprintf(_n('%s minute', '%s minutes', $value, 'give'), $value) |
|
579 | 579 | ), |
580 | 580 | false, |
581 | 581 | 'error' |
582 | 582 | ); |
583 | 583 | } |
584 | 584 | |
585 | - echo json_encode( $return ); |
|
585 | + echo json_encode($return); |
|
586 | 586 | give_die(); |
587 | 587 | } |
588 | 588 | |
589 | -add_action( 'wp_ajax_nopriv_give_confirm_email_for_donations_access', 'give_confirm_email_for_donation_access' ); |
|
590 | 589 | \ No newline at end of file |
590 | +add_action('wp_ajax_nopriv_give_confirm_email_for_donations_access', 'give_confirm_email_for_donation_access'); |
|
591 | 591 | \ No newline at end of file |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | * @category Class |
12 | 12 | * @author WordImpress |
13 | 13 | */ |
14 | -if ( ! defined( 'ABSPATH' ) ) { |
|
14 | +if ( ! defined('ABSPATH')) { |
|
15 | 15 | exit; |
16 | 16 | } |
17 | 17 | |
@@ -54,12 +54,12 @@ discard block |
||
54 | 54 | * and data exists in the queue. |
55 | 55 | */ |
56 | 56 | public function handle_cron_healthcheck() { |
57 | - if ( $this->is_process_running() || $this->is_paused_process() ) { |
|
57 | + if ($this->is_process_running() || $this->is_paused_process()) { |
|
58 | 58 | // Background process already running. |
59 | 59 | return; |
60 | 60 | } |
61 | 61 | |
62 | - if ( $this->is_queue_empty() ) { |
|
62 | + if ($this->is_queue_empty()) { |
|
63 | 63 | // No data to process. |
64 | 64 | $this->clear_scheduled_event(); |
65 | 65 | |
@@ -73,8 +73,8 @@ discard block |
||
73 | 73 | * Schedule fallback event. |
74 | 74 | */ |
75 | 75 | protected function schedule_event() { |
76 | - if ( ! wp_next_scheduled( $this->cron_hook_identifier ) && ! $this->is_paused_process() ) { |
|
77 | - wp_schedule_event( time() + 10, $this->cron_interval_identifier, $this->cron_hook_identifier ); |
|
76 | + if ( ! wp_next_scheduled($this->cron_hook_identifier) && ! $this->is_paused_process()) { |
|
77 | + wp_schedule_event(time() + 10, $this->cron_interval_identifier, $this->cron_hook_identifier); |
|
78 | 78 | } |
79 | 79 | } |
80 | 80 | |
@@ -90,13 +90,13 @@ discard block |
||
90 | 90 | * |
91 | 91 | * @return mixed |
92 | 92 | */ |
93 | - protected function task( $update ) { |
|
93 | + protected function task($update) { |
|
94 | 94 | // Pause upgrade immediately if admin pausing upgrades. |
95 | - if( $this->is_paused_process() ) { |
|
95 | + if ($this->is_paused_process()) { |
|
96 | 96 | wp_die(); |
97 | 97 | } |
98 | 98 | |
99 | - if ( empty( $update ) ) { |
|
99 | + if (empty($update)) { |
|
100 | 100 | return false; |
101 | 101 | } |
102 | 102 | |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | 'update_info' => $update, |
111 | 111 | 'step' => 1, |
112 | 112 | 'update' => 1, |
113 | - 'heading' => sprintf( 'Update %s of {update_count}', 1 ), |
|
113 | + 'heading' => sprintf('Update %s of {update_count}', 1), |
|
114 | 114 | 'percentage' => $give_updates->percentage, |
115 | 115 | ) |
116 | 116 | ); |
@@ -118,22 +118,22 @@ discard block |
||
118 | 118 | // Continuously skip update if previous update does not complete yet. |
119 | 119 | if ( |
120 | 120 | $resume_update['update_info']['id'] !== $update['id'] && |
121 | - ! give_has_upgrade_completed( $resume_update['update_info']['id'] ) |
|
121 | + ! give_has_upgrade_completed($resume_update['update_info']['id']) |
|
122 | 122 | ) { |
123 | 123 | return $update; |
124 | 124 | } |
125 | 125 | |
126 | 126 | // Set params. |
127 | 127 | $resume_update['update_info'] = $update; |
128 | - $give_updates->step = absint( $resume_update['step'] ); |
|
129 | - $give_updates->update = absint( $resume_update['update'] ); |
|
130 | - $is_parent_update_completed = $give_updates->is_parent_updates_completed( $update ); |
|
128 | + $give_updates->step = absint($resume_update['step']); |
|
129 | + $give_updates->update = absint($resume_update['update']); |
|
130 | + $is_parent_update_completed = $give_updates->is_parent_updates_completed($update); |
|
131 | 131 | |
132 | 132 | |
133 | 133 | // Skip update if dependency update does not complete yet. |
134 | - if ( empty( $is_parent_update_completed ) ) { |
|
134 | + if (empty($is_parent_update_completed)) { |
|
135 | 135 | // @todo: set error when you have only one update with invalid dependency |
136 | - if ( ! is_null( $is_parent_update_completed ) ) { |
|
136 | + if ( ! is_null($is_parent_update_completed)) { |
|
137 | 137 | return $update; |
138 | 138 | } |
139 | 139 | |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | Give_Cache::disable(); |
145 | 145 | |
146 | 146 | // Run update. |
147 | - if ( is_array( $update['callback'] ) ) { |
|
147 | + if (is_array($update['callback'])) { |
|
148 | 148 | $update['callback'][0]->$update['callback'][1](); |
149 | 149 | } else { |
150 | 150 | $update['callback'](); |
@@ -153,21 +153,21 @@ discard block |
||
153 | 153 | // Set update info. |
154 | 154 | $doing_upgrade_args = array( |
155 | 155 | 'update_info' => $update, |
156 | - 'step' => ++ $give_updates->step, |
|
156 | + 'step' => ++$give_updates->step, |
|
157 | 157 | 'update' => $give_updates->update, |
158 | - 'heading' => sprintf( 'Update %s of %s', $give_updates->update, get_option( 'give_db_update_count' ) ), |
|
158 | + 'heading' => sprintf('Update %s of %s', $give_updates->update, get_option('give_db_update_count')), |
|
159 | 159 | 'percentage' => $give_updates->percentage, |
160 | 160 | 'total_percentage' => $give_updates->get_db_update_processing_percentage(), |
161 | 161 | ); |
162 | 162 | |
163 | 163 | // Cache upgrade. |
164 | - update_option( 'give_doing_upgrade', $doing_upgrade_args ); |
|
164 | + update_option('give_doing_upgrade', $doing_upgrade_args); |
|
165 | 165 | |
166 | 166 | // Enable cache. |
167 | 167 | Give_Cache::enable(); |
168 | 168 | |
169 | 169 | // Check if current update completed or not. |
170 | - if ( give_has_upgrade_completed( $update['id'] ) ) { |
|
170 | + if (give_has_upgrade_completed($update['id'])) { |
|
171 | 171 | return false; |
172 | 172 | } |
173 | 173 | |
@@ -181,21 +181,21 @@ discard block |
||
181 | 181 | * performed, or, call parent::complete(). |
182 | 182 | */ |
183 | 183 | protected function complete() { |
184 | - if( $this->is_paused_process() ) { |
|
184 | + if ($this->is_paused_process()) { |
|
185 | 185 | return false; |
186 | 186 | } |
187 | 187 | |
188 | 188 | parent::complete(); |
189 | 189 | |
190 | - delete_option( 'give_db_update_count' ); |
|
191 | - delete_option( 'give_doing_upgrade' ); |
|
192 | - add_option( 'give_show_db_upgrade_complete_notice', 1, '', 'no' ); |
|
190 | + delete_option('give_db_update_count'); |
|
191 | + delete_option('give_doing_upgrade'); |
|
192 | + add_option('give_show_db_upgrade_complete_notice', 1, '', 'no'); |
|
193 | 193 | |
194 | 194 | // Flush cache. |
195 | 195 | Give_Cache::get_instance()->flush_cache(); |
196 | 196 | |
197 | - if( $cache_keys = Give_Cache::get_options_like('') ) { |
|
198 | - Give_Cache::delete( $cache_keys ); |
|
197 | + if ($cache_keys = Give_Cache::get_options_like('')) { |
|
198 | + Give_Cache::delete($cache_keys); |
|
199 | 199 | } |
200 | 200 | } |
201 | 201 | |
@@ -205,19 +205,19 @@ discard block |
||
205 | 205 | * @return int |
206 | 206 | */ |
207 | 207 | protected function get_memory_limit() { |
208 | - if ( function_exists( 'ini_get' ) ) { |
|
209 | - $memory_limit = ini_get( 'memory_limit' ); |
|
208 | + if (function_exists('ini_get')) { |
|
209 | + $memory_limit = ini_get('memory_limit'); |
|
210 | 210 | } else { |
211 | 211 | // Sensible default. |
212 | 212 | $memory_limit = '128M'; |
213 | 213 | } |
214 | 214 | |
215 | - if ( ! $memory_limit || '-1' === $memory_limit ) { |
|
215 | + if ( ! $memory_limit || '-1' === $memory_limit) { |
|
216 | 216 | // Unlimited, set to 32GB. |
217 | 217 | $memory_limit = '32000M'; |
218 | 218 | } |
219 | 219 | |
220 | - return intval( $memory_limit ) * 1024 * 1024; |
|
220 | + return intval($memory_limit) * 1024 * 1024; |
|
221 | 221 | } |
222 | 222 | |
223 | 223 | /** |
@@ -230,17 +230,17 @@ discard block |
||
230 | 230 | // Don't lock up other requests while processing |
231 | 231 | session_write_close(); |
232 | 232 | |
233 | - if ( $this->is_process_running() || $this->is_paused_process() ) { |
|
233 | + if ($this->is_process_running() || $this->is_paused_process()) { |
|
234 | 234 | // Background process already running. |
235 | 235 | wp_die(); |
236 | 236 | } |
237 | 237 | |
238 | - if ( $this->is_queue_empty() ) { |
|
238 | + if ($this->is_queue_empty()) { |
|
239 | 239 | // No data to process. |
240 | 240 | wp_die(); |
241 | 241 | } |
242 | 242 | |
243 | - check_ajax_referer( $this->identifier, 'nonce' ); |
|
243 | + check_ajax_referer($this->identifier, 'nonce'); |
|
244 | 244 | |
245 | 245 | $this->handle(); |
246 | 246 | |
@@ -255,13 +255,13 @@ discard block |
||
255 | 255 | * @access public |
256 | 256 | * @return bool |
257 | 257 | */ |
258 | - public function is_paused_process(){ |
|
258 | + public function is_paused_process() { |
|
259 | 259 | // Not using get_option because i am facing some caching releated issue. |
260 | 260 | global $wpdb; |
261 | 261 | |
262 | - $options = $wpdb->get_results( "SELECT * FROM $wpdb->options WHERE option_name='give_paused_batches' LIMIT 1" ); |
|
262 | + $options = $wpdb->get_results("SELECT * FROM $wpdb->options WHERE option_name='give_paused_batches' LIMIT 1"); |
|
263 | 263 | |
264 | - return ! empty( $options ); |
|
264 | + return ! empty($options); |
|
265 | 265 | } |
266 | 266 | |
267 | 267 |