@@ -390,7 +390,7 @@ |
||
390 | 390 | * Example: <?php $give = Give(); ?> |
391 | 391 | * |
392 | 392 | * @since 1.0 |
393 | - * @return object - The one true Give Instance |
|
393 | + * @return Give - The one true Give Instance |
|
394 | 394 | */ |
395 | 395 | function Give() { |
396 | 396 | return Give::instance(); |
@@ -47,11 +47,11 @@ discard block |
||
47 | 47 | */ |
48 | 48 | |
49 | 49 | // Exit if accessed directly |
50 | -if ( ! defined( 'ABSPATH' ) ) { |
|
50 | +if ( ! defined('ABSPATH')) { |
|
51 | 51 | exit; |
52 | 52 | } |
53 | 53 | |
54 | -if ( ! class_exists( 'Give' ) ) : /** |
|
54 | +if ( ! class_exists('Give')) : /** |
|
55 | 55 | * Main Give Class |
56 | 56 | * |
57 | 57 | * @since 1.0 |
@@ -149,11 +149,11 @@ discard block |
||
149 | 149 | * @return Give |
150 | 150 | */ |
151 | 151 | public static function instance() { |
152 | - if ( ! isset( self::$instance ) && ! ( self::$instance instanceof Give ) ) { |
|
152 | + if ( ! isset(self::$instance) && ! (self::$instance instanceof Give)) { |
|
153 | 153 | self::$instance = new Give; |
154 | 154 | self::$instance->setup_constants(); |
155 | 155 | |
156 | - add_action( 'plugins_loaded', array( self::$instance, 'load_textdomain' ) ); |
|
156 | + add_action('plugins_loaded', array(self::$instance, 'load_textdomain')); |
|
157 | 157 | |
158 | 158 | self::$instance->includes(); |
159 | 159 | self::$instance->roles = new Give_Roles(); |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | */ |
185 | 185 | public function __clone() { |
186 | 186 | // Cloning instances of the class is forbidden |
187 | - _doing_it_wrong( __FUNCTION__, __( 'Cheatin’ huh?', 'give' ), '1.0' ); |
|
187 | + _doing_it_wrong(__FUNCTION__, __('Cheatin’ huh?', 'give'), '1.0'); |
|
188 | 188 | } |
189 | 189 | |
190 | 190 | /** |
@@ -196,7 +196,7 @@ discard block |
||
196 | 196 | */ |
197 | 197 | public function __wakeup() { |
198 | 198 | // Unserializing instances of the class is forbidden |
199 | - _doing_it_wrong( __FUNCTION__, __( 'Cheatin’ huh?', 'give' ), '1.0' ); |
|
199 | + _doing_it_wrong(__FUNCTION__, __('Cheatin’ huh?', 'give'), '1.0'); |
|
200 | 200 | } |
201 | 201 | |
202 | 202 | /** |
@@ -209,28 +209,28 @@ discard block |
||
209 | 209 | private function setup_constants() { |
210 | 210 | |
211 | 211 | // Plugin version |
212 | - if ( ! defined( 'GIVE_VERSION' ) ) { |
|
213 | - define( 'GIVE_VERSION', '1.3.1.1' ); |
|
212 | + if ( ! defined('GIVE_VERSION')) { |
|
213 | + define('GIVE_VERSION', '1.3.1.1'); |
|
214 | 214 | } |
215 | 215 | |
216 | 216 | // Plugin Folder Path |
217 | - if ( ! defined( 'GIVE_PLUGIN_DIR' ) ) { |
|
218 | - define( 'GIVE_PLUGIN_DIR', plugin_dir_path( __FILE__ ) ); |
|
217 | + if ( ! defined('GIVE_PLUGIN_DIR')) { |
|
218 | + define('GIVE_PLUGIN_DIR', plugin_dir_path(__FILE__)); |
|
219 | 219 | } |
220 | 220 | |
221 | 221 | // Plugin Folder URL |
222 | - if ( ! defined( 'GIVE_PLUGIN_URL' ) ) { |
|
223 | - define( 'GIVE_PLUGIN_URL', plugin_dir_url( __FILE__ ) ); |
|
222 | + if ( ! defined('GIVE_PLUGIN_URL')) { |
|
223 | + define('GIVE_PLUGIN_URL', plugin_dir_url(__FILE__)); |
|
224 | 224 | } |
225 | 225 | |
226 | 226 | // Plugin Root File |
227 | - if ( ! defined( 'GIVE_PLUGIN_FILE' ) ) { |
|
228 | - define( 'GIVE_PLUGIN_FILE', __FILE__ ); |
|
227 | + if ( ! defined('GIVE_PLUGIN_FILE')) { |
|
228 | + define('GIVE_PLUGIN_FILE', __FILE__); |
|
229 | 229 | } |
230 | 230 | |
231 | 231 | // Make sure CAL_GREGORIAN is defined |
232 | - if ( ! defined( 'CAL_GREGORIAN' ) ) { |
|
233 | - define( 'CAL_GREGORIAN', 1 ); |
|
232 | + if ( ! defined('CAL_GREGORIAN')) { |
|
233 | + define('CAL_GREGORIAN', 1); |
|
234 | 234 | } |
235 | 235 | } |
236 | 236 | |
@@ -244,102 +244,102 @@ discard block |
||
244 | 244 | private function includes() { |
245 | 245 | global $give_options; |
246 | 246 | |
247 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/register-settings.php'; |
|
247 | + require_once GIVE_PLUGIN_DIR.'includes/admin/register-settings.php'; |
|
248 | 248 | $give_options = give_get_settings(); |
249 | 249 | |
250 | - require_once GIVE_PLUGIN_DIR . 'includes/post-types.php'; |
|
251 | - require_once GIVE_PLUGIN_DIR . 'includes/scripts.php'; |
|
252 | - require_once GIVE_PLUGIN_DIR . 'includes/ajax-functions.php'; |
|
253 | - require_once GIVE_PLUGIN_DIR . 'includes/actions.php'; |
|
254 | - require_once GIVE_PLUGIN_DIR . 'includes/api/class-give-api.php'; |
|
255 | - |
|
256 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-roles.php'; |
|
257 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-template-loader.php'; |
|
258 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-donate-form.php'; |
|
259 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-db.php'; |
|
260 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-customers.php'; |
|
261 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-customer.php'; |
|
262 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-stats.php'; |
|
263 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-session.php'; |
|
264 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-html-elements.php'; |
|
265 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-logging.php'; |
|
266 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-license-handler.php'; |
|
267 | - |
|
268 | - require_once GIVE_PLUGIN_DIR . 'includes/country-functions.php'; |
|
269 | - require_once GIVE_PLUGIN_DIR . 'includes/template-functions.php'; |
|
270 | - require_once GIVE_PLUGIN_DIR . 'includes/misc-functions.php'; |
|
271 | - require_once GIVE_PLUGIN_DIR . 'includes/forms/functions.php'; |
|
272 | - require_once GIVE_PLUGIN_DIR . 'includes/forms/template.php'; |
|
273 | - require_once GIVE_PLUGIN_DIR . 'includes/forms/widget.php'; |
|
274 | - require_once GIVE_PLUGIN_DIR . 'includes/shortcodes.php'; |
|
275 | - require_once GIVE_PLUGIN_DIR . 'includes/formatting.php'; |
|
276 | - require_once GIVE_PLUGIN_DIR . 'includes/price-functions.php'; |
|
277 | - require_once GIVE_PLUGIN_DIR . 'includes/error-tracking.php'; |
|
278 | - require_once GIVE_PLUGIN_DIR . 'includes/process-purchase.php'; |
|
279 | - require_once GIVE_PLUGIN_DIR . 'includes/login-register.php'; |
|
280 | - require_once GIVE_PLUGIN_DIR . 'includes/user-functions.php'; |
|
281 | - |
|
282 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/functions.php'; |
|
283 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/actions.php'; |
|
284 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/class-payment-stats.php'; |
|
285 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/class-payments-query.php'; |
|
286 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/class-donators-gravatars.php'; |
|
287 | - |
|
288 | - require_once GIVE_PLUGIN_DIR . 'includes/gateways/functions.php'; |
|
289 | - require_once GIVE_PLUGIN_DIR . 'includes/gateways/actions.php'; |
|
290 | - require_once GIVE_PLUGIN_DIR . 'includes/gateways/paypal-standard.php'; |
|
291 | - require_once GIVE_PLUGIN_DIR . 'includes/gateways/offline-donations.php'; |
|
292 | - require_once GIVE_PLUGIN_DIR . 'includes/gateways/manual.php'; |
|
293 | - |
|
294 | - require_once GIVE_PLUGIN_DIR . 'includes/emails/class-give-emails.php'; |
|
295 | - require_once GIVE_PLUGIN_DIR . 'includes/emails/class-give-email-tags.php'; |
|
296 | - require_once GIVE_PLUGIN_DIR . 'includes/emails/functions.php'; |
|
297 | - require_once GIVE_PLUGIN_DIR . 'includes/emails/template.php'; |
|
298 | - require_once GIVE_PLUGIN_DIR . 'includes/emails/actions.php'; |
|
299 | - |
|
300 | - if ( is_admin() || ( defined( 'WP_CLI' ) && WP_CLI ) ) { |
|
301 | - |
|
302 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-footer.php'; |
|
303 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/welcome.php'; |
|
304 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-pages.php'; |
|
305 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/class-admin-notices.php'; |
|
306 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/class-api-keys-table.php'; |
|
307 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-actions.php'; |
|
308 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/system-info.php'; |
|
309 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/export-functions.php'; |
|
310 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/add-ons.php'; |
|
311 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/dashboard-widgets.php'; |
|
312 | - |
|
313 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/payments/actions.php'; |
|
314 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/payments/payments-history.php'; |
|
315 | - |
|
316 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/customers/customers.php'; |
|
317 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/customers/customer-functions.php'; |
|
318 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/customers/customer-actions.php'; |
|
319 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/forms/metabox.php'; |
|
320 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/forms/dashboard-columns.php'; |
|
321 | - |
|
322 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/reports.php'; |
|
323 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/pdf-reports.php'; |
|
324 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/class-give-graph.php'; |
|
325 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/graphing.php'; |
|
326 | - |
|
327 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/abstract-shortcode-generator.php'; |
|
328 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/class-shortcode-button.php'; |
|
329 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-form.php'; |
|
330 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-goal.php'; |
|
331 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-login.php'; |
|
332 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-register.php'; |
|
333 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-profile-editor.php'; |
|
334 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-donation-history.php'; |
|
335 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-receipt.php'; |
|
336 | - |
|
337 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/upgrades/upgrade-functions.php'; |
|
338 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/upgrades/upgrades.php'; |
|
250 | + require_once GIVE_PLUGIN_DIR.'includes/post-types.php'; |
|
251 | + require_once GIVE_PLUGIN_DIR.'includes/scripts.php'; |
|
252 | + require_once GIVE_PLUGIN_DIR.'includes/ajax-functions.php'; |
|
253 | + require_once GIVE_PLUGIN_DIR.'includes/actions.php'; |
|
254 | + require_once GIVE_PLUGIN_DIR.'includes/api/class-give-api.php'; |
|
255 | + |
|
256 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-roles.php'; |
|
257 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-template-loader.php'; |
|
258 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-donate-form.php'; |
|
259 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-db.php'; |
|
260 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-db-customers.php'; |
|
261 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-customer.php'; |
|
262 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-stats.php'; |
|
263 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-session.php'; |
|
264 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-html-elements.php'; |
|
265 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-logging.php'; |
|
266 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-license-handler.php'; |
|
267 | + |
|
268 | + require_once GIVE_PLUGIN_DIR.'includes/country-functions.php'; |
|
269 | + require_once GIVE_PLUGIN_DIR.'includes/template-functions.php'; |
|
270 | + require_once GIVE_PLUGIN_DIR.'includes/misc-functions.php'; |
|
271 | + require_once GIVE_PLUGIN_DIR.'includes/forms/functions.php'; |
|
272 | + require_once GIVE_PLUGIN_DIR.'includes/forms/template.php'; |
|
273 | + require_once GIVE_PLUGIN_DIR.'includes/forms/widget.php'; |
|
274 | + require_once GIVE_PLUGIN_DIR.'includes/shortcodes.php'; |
|
275 | + require_once GIVE_PLUGIN_DIR.'includes/formatting.php'; |
|
276 | + require_once GIVE_PLUGIN_DIR.'includes/price-functions.php'; |
|
277 | + require_once GIVE_PLUGIN_DIR.'includes/error-tracking.php'; |
|
278 | + require_once GIVE_PLUGIN_DIR.'includes/process-purchase.php'; |
|
279 | + require_once GIVE_PLUGIN_DIR.'includes/login-register.php'; |
|
280 | + require_once GIVE_PLUGIN_DIR.'includes/user-functions.php'; |
|
281 | + |
|
282 | + require_once GIVE_PLUGIN_DIR.'includes/payments/functions.php'; |
|
283 | + require_once GIVE_PLUGIN_DIR.'includes/payments/actions.php'; |
|
284 | + require_once GIVE_PLUGIN_DIR.'includes/payments/class-payment-stats.php'; |
|
285 | + require_once GIVE_PLUGIN_DIR.'includes/payments/class-payments-query.php'; |
|
286 | + require_once GIVE_PLUGIN_DIR.'includes/payments/class-donators-gravatars.php'; |
|
287 | + |
|
288 | + require_once GIVE_PLUGIN_DIR.'includes/gateways/functions.php'; |
|
289 | + require_once GIVE_PLUGIN_DIR.'includes/gateways/actions.php'; |
|
290 | + require_once GIVE_PLUGIN_DIR.'includes/gateways/paypal-standard.php'; |
|
291 | + require_once GIVE_PLUGIN_DIR.'includes/gateways/offline-donations.php'; |
|
292 | + require_once GIVE_PLUGIN_DIR.'includes/gateways/manual.php'; |
|
293 | + |
|
294 | + require_once GIVE_PLUGIN_DIR.'includes/emails/class-give-emails.php'; |
|
295 | + require_once GIVE_PLUGIN_DIR.'includes/emails/class-give-email-tags.php'; |
|
296 | + require_once GIVE_PLUGIN_DIR.'includes/emails/functions.php'; |
|
297 | + require_once GIVE_PLUGIN_DIR.'includes/emails/template.php'; |
|
298 | + require_once GIVE_PLUGIN_DIR.'includes/emails/actions.php'; |
|
299 | + |
|
300 | + if (is_admin() || (defined('WP_CLI') && WP_CLI)) { |
|
301 | + |
|
302 | + require_once GIVE_PLUGIN_DIR.'includes/admin/admin-footer.php'; |
|
303 | + require_once GIVE_PLUGIN_DIR.'includes/admin/welcome.php'; |
|
304 | + require_once GIVE_PLUGIN_DIR.'includes/admin/admin-pages.php'; |
|
305 | + require_once GIVE_PLUGIN_DIR.'includes/admin/class-admin-notices.php'; |
|
306 | + require_once GIVE_PLUGIN_DIR.'includes/admin/class-api-keys-table.php'; |
|
307 | + require_once GIVE_PLUGIN_DIR.'includes/admin/admin-actions.php'; |
|
308 | + require_once GIVE_PLUGIN_DIR.'includes/admin/system-info.php'; |
|
309 | + require_once GIVE_PLUGIN_DIR.'includes/admin/export-functions.php'; |
|
310 | + require_once GIVE_PLUGIN_DIR.'includes/admin/add-ons.php'; |
|
311 | + require_once GIVE_PLUGIN_DIR.'includes/admin/dashboard-widgets.php'; |
|
312 | + |
|
313 | + require_once GIVE_PLUGIN_DIR.'includes/admin/payments/actions.php'; |
|
314 | + require_once GIVE_PLUGIN_DIR.'includes/admin/payments/payments-history.php'; |
|
315 | + |
|
316 | + require_once GIVE_PLUGIN_DIR.'includes/admin/customers/customers.php'; |
|
317 | + require_once GIVE_PLUGIN_DIR.'includes/admin/customers/customer-functions.php'; |
|
318 | + require_once GIVE_PLUGIN_DIR.'includes/admin/customers/customer-actions.php'; |
|
319 | + require_once GIVE_PLUGIN_DIR.'includes/admin/forms/metabox.php'; |
|
320 | + require_once GIVE_PLUGIN_DIR.'includes/admin/forms/dashboard-columns.php'; |
|
321 | + |
|
322 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/reports.php'; |
|
323 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/pdf-reports.php'; |
|
324 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/class-give-graph.php'; |
|
325 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/graphing.php'; |
|
326 | + |
|
327 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/abstract-shortcode-generator.php'; |
|
328 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/class-shortcode-button.php'; |
|
329 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-form.php'; |
|
330 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-goal.php'; |
|
331 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-login.php'; |
|
332 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-register.php'; |
|
333 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-profile-editor.php'; |
|
334 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-donation-history.php'; |
|
335 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-receipt.php'; |
|
336 | + |
|
337 | + require_once GIVE_PLUGIN_DIR.'includes/admin/upgrades/upgrade-functions.php'; |
|
338 | + require_once GIVE_PLUGIN_DIR.'includes/admin/upgrades/upgrades.php'; |
|
339 | 339 | |
340 | 340 | } |
341 | 341 | |
342 | - require_once GIVE_PLUGIN_DIR . 'includes/install.php'; |
|
342 | + require_once GIVE_PLUGIN_DIR.'includes/install.php'; |
|
343 | 343 | |
344 | 344 | } |
345 | 345 | |
@@ -352,26 +352,26 @@ discard block |
||
352 | 352 | */ |
353 | 353 | public function load_textdomain() { |
354 | 354 | // Set filter for Give's languages directory |
355 | - $give_lang_dir = dirname( plugin_basename( GIVE_PLUGIN_FILE ) ) . '/languages/'; |
|
356 | - $give_lang_dir = apply_filters( 'give_languages_directory', $give_lang_dir ); |
|
355 | + $give_lang_dir = dirname(plugin_basename(GIVE_PLUGIN_FILE)).'/languages/'; |
|
356 | + $give_lang_dir = apply_filters('give_languages_directory', $give_lang_dir); |
|
357 | 357 | |
358 | 358 | // Traditional WordPress plugin locale filter |
359 | - $locale = apply_filters( 'plugin_locale', get_locale(), 'give' ); |
|
360 | - $mofile = sprintf( '%1$s-%2$s.mo', 'give', $locale ); |
|
359 | + $locale = apply_filters('plugin_locale', get_locale(), 'give'); |
|
360 | + $mofile = sprintf('%1$s-%2$s.mo', 'give', $locale); |
|
361 | 361 | |
362 | 362 | // Setup paths to current locale file |
363 | - $mofile_local = $give_lang_dir . $mofile; |
|
364 | - $mofile_global = WP_LANG_DIR . '/give/' . $mofile; |
|
363 | + $mofile_local = $give_lang_dir.$mofile; |
|
364 | + $mofile_global = WP_LANG_DIR.'/give/'.$mofile; |
|
365 | 365 | |
366 | - if ( file_exists( $mofile_global ) ) { |
|
366 | + if (file_exists($mofile_global)) { |
|
367 | 367 | // Look in global /wp-content/languages/give folder |
368 | - load_textdomain( 'give', $mofile_global ); |
|
369 | - } elseif ( file_exists( $mofile_local ) ) { |
|
368 | + load_textdomain('give', $mofile_global); |
|
369 | + } elseif (file_exists($mofile_local)) { |
|
370 | 370 | // Look in local /wp-content/plugins/give/languages/ folder |
371 | - load_textdomain( 'give', $mofile_local ); |
|
371 | + load_textdomain('give', $mofile_local); |
|
372 | 372 | } else { |
373 | 373 | // Load the default language files |
374 | - load_plugin_textdomain( 'give', false, $give_lang_dir ); |
|
374 | + load_plugin_textdomain('give', false, $give_lang_dir); |
|
375 | 375 | } |
376 | 376 | } |
377 | 377 | } |
@@ -37,7 +37,7 @@ |
||
37 | 37 | * |
38 | 38 | * Display admin bar when active |
39 | 39 | * |
40 | - * @return bool |
|
40 | + * @return false|null |
|
41 | 41 | */ |
42 | 42 | public function give_admin_bar_menu() { |
43 | 43 | global $wp_admin_bar; |
@@ -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 | |
@@ -27,9 +27,9 @@ discard block |
||
27 | 27 | * @since 1.0 |
28 | 28 | */ |
29 | 29 | public function __construct() { |
30 | - add_action( 'admin_notices', array( $this, 'show_notices' ) ); |
|
31 | - add_action( 'give_dismiss_notices', array( $this, 'dismiss_notices' ) ); |
|
32 | - add_action( 'admin_bar_menu', array( $this, 'give_admin_bar_menu' ), 1000 ); |
|
30 | + add_action('admin_notices', array($this, 'show_notices')); |
|
31 | + add_action('give_dismiss_notices', array($this, 'dismiss_notices')); |
|
32 | + add_action('admin_bar_menu', array($this, 'give_admin_bar_menu'), 1000); |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | |
@@ -42,18 +42,18 @@ discard block |
||
42 | 42 | public function give_admin_bar_menu() { |
43 | 43 | global $wp_admin_bar; |
44 | 44 | |
45 | - if ( ! give_is_test_mode() || ! current_user_can( 'view_give_reports' ) ) { |
|
45 | + if ( ! give_is_test_mode() || ! current_user_can('view_give_reports')) { |
|
46 | 46 | return false; |
47 | 47 | } |
48 | 48 | |
49 | 49 | //Add the main siteadmin menu item |
50 | - $wp_admin_bar->add_menu( array( |
|
50 | + $wp_admin_bar->add_menu(array( |
|
51 | 51 | 'id' => 'give-test-notice', |
52 | - 'href' => admin_url() . 'edit.php?post_type=give_forms&page=give-settings&tab=gateways', |
|
52 | + 'href' => admin_url().'edit.php?post_type=give_forms&page=give-settings&tab=gateways', |
|
53 | 53 | 'parent' => 'top-secondary', |
54 | - 'title' => __( 'Give Test Mode Active', 'give' ), |
|
55 | - 'meta' => array( 'class' => 'give-test-mode-active' ), |
|
56 | - ) ); |
|
54 | + 'title' => __('Give Test Mode Active', 'give'), |
|
55 | + 'meta' => array('class' => 'give-test-mode-active'), |
|
56 | + )); |
|
57 | 57 | |
58 | 58 | } |
59 | 59 | |
@@ -68,97 +68,97 @@ discard block |
||
68 | 68 | 'error' => array() |
69 | 69 | ); |
70 | 70 | |
71 | - if ( ! give_test_ajax_works() && ! get_user_meta( get_current_user_id(), '_give_admin_ajax_inaccessible_dismissed', true ) && current_user_can( 'manage_give_settings' ) ) { |
|
71 | + if ( ! give_test_ajax_works() && ! get_user_meta(get_current_user_id(), '_give_admin_ajax_inaccessible_dismissed', true) && current_user_can('manage_give_settings')) { |
|
72 | 72 | echo '<div class="error">'; |
73 | - echo '<p>' . __( 'Your site appears to be blocking the WordPress ajax interface. This may causes issues with Give.', 'give' ) . '</p>'; |
|
74 | - echo '<p>' . sprintf( __( 'Please see <a href="%s" target="_blank">this reference</a> for possible solutions.', 'give' ), 'https://givewp.com/documentation/core/troubleshooting/admin-ajax-blocked/' ) . '</p>'; |
|
75 | - echo '<p><a href="' . add_query_arg( array( |
|
73 | + echo '<p>'.__('Your site appears to be blocking the WordPress ajax interface. This may causes issues with Give.', 'give').'</p>'; |
|
74 | + echo '<p>'.sprintf(__('Please see <a href="%s" target="_blank">this reference</a> for possible solutions.', 'give'), 'https://givewp.com/documentation/core/troubleshooting/admin-ajax-blocked/').'</p>'; |
|
75 | + echo '<p><a href="'.add_query_arg(array( |
|
76 | 76 | 'give_action' => 'dismiss_notices', |
77 | 77 | 'give_notice' => 'admin_ajax_inaccessible' |
78 | - ) ) . '">' . __( 'Dismiss Notice', 'give' ) . '</a></p>'; |
|
78 | + )).'">'.__('Dismiss Notice', 'give').'</a></p>'; |
|
79 | 79 | echo '</div>'; |
80 | 80 | } |
81 | 81 | |
82 | 82 | |
83 | - if ( isset( $_GET['give-message'] ) ) { |
|
83 | + if (isset($_GET['give-message'])) { |
|
84 | 84 | |
85 | 85 | // Donation reports errors |
86 | - if ( current_user_can( 'view_give_reports' ) ) { |
|
87 | - switch ( $_GET['give-message'] ) { |
|
86 | + if (current_user_can('view_give_reports')) { |
|
87 | + switch ($_GET['give-message']) { |
|
88 | 88 | case 'payment_deleted' : |
89 | - $notices['updated']['give-payment-deleted'] = __( 'The payment has been deleted.', 'give' ); |
|
89 | + $notices['updated']['give-payment-deleted'] = __('The payment has been deleted.', 'give'); |
|
90 | 90 | break; |
91 | 91 | case 'email_sent' : |
92 | - $notices['updated']['give-payment-sent'] = __( 'The donation receipt has been resent.', 'give' ); |
|
92 | + $notices['updated']['give-payment-sent'] = __('The donation receipt has been resent.', 'give'); |
|
93 | 93 | break; |
94 | 94 | case 'refreshed-reports' : |
95 | - $notices['updated']['give-refreshed-reports'] = __( 'The reports cache has been cleared.', 'give' ); |
|
95 | + $notices['updated']['give-refreshed-reports'] = __('The reports cache has been cleared.', 'give'); |
|
96 | 96 | break; |
97 | 97 | case 'payment-note-deleted' : |
98 | - $notices['updated']['give-payment-note-deleted'] = __( 'The payment note has been deleted.', 'give' ); |
|
98 | + $notices['updated']['give-payment-note-deleted'] = __('The payment note has been deleted.', 'give'); |
|
99 | 99 | break; |
100 | 100 | } |
101 | 101 | } |
102 | 102 | |
103 | 103 | // Give settings notices and errors |
104 | - if ( current_user_can( 'manage_give_settings' ) ) { |
|
105 | - switch ( $_GET['give-message'] ) { |
|
104 | + if (current_user_can('manage_give_settings')) { |
|
105 | + switch ($_GET['give-message']) { |
|
106 | 106 | case 'settings-imported' : |
107 | - $notices['updated']['give-settings-imported'] = __( 'The settings have been imported.', 'give' ); |
|
107 | + $notices['updated']['give-settings-imported'] = __('The settings have been imported.', 'give'); |
|
108 | 108 | break; |
109 | 109 | case 'api-key-generated' : |
110 | - $notices['updated']['give-api-key-generated'] = __( 'API keys successfully generated.', 'give' ); |
|
110 | + $notices['updated']['give-api-key-generated'] = __('API keys successfully generated.', 'give'); |
|
111 | 111 | break; |
112 | 112 | case 'api-key-exists' : |
113 | - $notices['error']['give-api-key-exists'] = __( 'The specified user already has API keys.', 'give' ); |
|
113 | + $notices['error']['give-api-key-exists'] = __('The specified user already has API keys.', 'give'); |
|
114 | 114 | break; |
115 | 115 | case 'api-key-regenerated' : |
116 | - $notices['updated']['give-api-key-regenerated'] = __( 'API keys successfully regenerated.', 'give' ); |
|
116 | + $notices['updated']['give-api-key-regenerated'] = __('API keys successfully regenerated.', 'give'); |
|
117 | 117 | break; |
118 | 118 | case 'api-key-revoked' : |
119 | - $notices['updated']['give-api-key-revoked'] = __( 'API keys successfully revoked.', 'give' ); |
|
119 | + $notices['updated']['give-api-key-revoked'] = __('API keys successfully revoked.', 'give'); |
|
120 | 120 | break; |
121 | 121 | case 'sent-test-email' : |
122 | - $notices['updated']['give-sent-test-email'] = __( 'The test email has been sent.', 'give' ); |
|
122 | + $notices['updated']['give-sent-test-email'] = __('The test email has been sent.', 'give'); |
|
123 | 123 | break; |
124 | 124 | } |
125 | 125 | } |
126 | 126 | // Payments errors |
127 | - if ( current_user_can( 'edit_give_payments' ) ) { |
|
128 | - switch ( $_GET['give-message'] ) { |
|
127 | + if (current_user_can('edit_give_payments')) { |
|
128 | + switch ($_GET['give-message']) { |
|
129 | 129 | case 'note-added' : |
130 | - $notices['updated']['give-note-added'] = __( 'The payment note has been added successfully.', 'give' ); |
|
130 | + $notices['updated']['give-note-added'] = __('The payment note has been added successfully.', 'give'); |
|
131 | 131 | break; |
132 | 132 | case 'payment-updated' : |
133 | - $notices['updated']['give-payment-updated'] = __( 'The payment has been successfully updated.', 'give' ); |
|
133 | + $notices['updated']['give-payment-updated'] = __('The payment has been successfully updated.', 'give'); |
|
134 | 134 | break; |
135 | 135 | } |
136 | 136 | } |
137 | 137 | |
138 | 138 | // Customer Notices |
139 | - if ( current_user_can( 'edit_give_payments' ) ) { |
|
140 | - switch ( $_GET['give-message'] ) { |
|
139 | + if (current_user_can('edit_give_payments')) { |
|
140 | + switch ($_GET['give-message']) { |
|
141 | 141 | case 'customer-deleted' : |
142 | - $notices['updated']['give-customer-deleted'] = __( 'Donor successfully deleted', 'give' ); |
|
142 | + $notices['updated']['give-customer-deleted'] = __('Donor successfully deleted', 'give'); |
|
143 | 143 | break; |
144 | 144 | } |
145 | 145 | } |
146 | 146 | |
147 | 147 | } |
148 | 148 | |
149 | - if ( count( $notices['updated'] ) > 0 ) { |
|
150 | - foreach ( $notices['updated'] as $notice => $message ) { |
|
151 | - add_settings_error( 'give-notices', $notice, $message, 'updated' ); |
|
149 | + if (count($notices['updated']) > 0) { |
|
150 | + foreach ($notices['updated'] as $notice => $message) { |
|
151 | + add_settings_error('give-notices', $notice, $message, 'updated'); |
|
152 | 152 | } |
153 | 153 | } |
154 | 154 | |
155 | - if ( count( $notices['error'] ) > 0 ) { |
|
156 | - foreach ( $notices['error'] as $notice => $message ) { |
|
157 | - add_settings_error( 'give-notices', $notice, $message, 'error' ); |
|
155 | + if (count($notices['error']) > 0) { |
|
156 | + foreach ($notices['error'] as $notice => $message) { |
|
157 | + add_settings_error('give-notices', $notice, $message, 'error'); |
|
158 | 158 | } |
159 | 159 | } |
160 | 160 | |
161 | - settings_errors( 'give-notices' ); |
|
161 | + settings_errors('give-notices'); |
|
162 | 162 | } |
163 | 163 | |
164 | 164 | |
@@ -169,8 +169,8 @@ discard block |
||
169 | 169 | * @return void |
170 | 170 | */ |
171 | 171 | function give_admin_addons_notices() { |
172 | - add_settings_error( 'give-notices', 'give-addons-feed-error', __( 'There seems to be an issue with the server. Please try again in a few minutes.', 'give' ), 'error' ); |
|
173 | - settings_errors( 'give-notices' ); |
|
172 | + add_settings_error('give-notices', 'give-addons-feed-error', __('There seems to be an issue with the server. Please try again in a few minutes.', 'give'), 'error'); |
|
173 | + settings_errors('give-notices'); |
|
174 | 174 | } |
175 | 175 | |
176 | 176 | |
@@ -181,9 +181,9 @@ discard block |
||
181 | 181 | * @return void |
182 | 182 | */ |
183 | 183 | function dismiss_notices() { |
184 | - if ( isset( $_GET['give_notice'] ) ) { |
|
185 | - update_user_meta( get_current_user_id(), '_give_' . $_GET['give_notice'] . '_dismissed', 1 ); |
|
186 | - wp_redirect( remove_query_arg( array( 'give_action', 'give_notice' ) ) ); |
|
184 | + if (isset($_GET['give_notice'])) { |
|
185 | + update_user_meta(get_current_user_id(), '_give_'.$_GET['give_notice'].'_dismissed', 1); |
|
186 | + wp_redirect(remove_query_arg(array('give_action', 'give_notice'))); |
|
187 | 187 | exit; |
188 | 188 | } |
189 | 189 | } |
@@ -81,7 +81,6 @@ discard block |
||
81 | 81 | * @since 1.1 |
82 | 82 | * |
83 | 83 | * @param array $item Contains all the data of the keys |
84 | - * @param string $column_name The name of the column |
|
85 | 84 | * |
86 | 85 | * @return string Column Name |
87 | 86 | */ |
@@ -96,7 +95,6 @@ discard block |
||
96 | 95 | * @since 1.1 |
97 | 96 | * |
98 | 97 | * @param array $item Contains all the data of the keys |
99 | - * @param string $column_name The name of the column |
|
100 | 98 | * |
101 | 99 | * @return string Column Name |
102 | 100 | */ |
@@ -111,7 +109,6 @@ discard block |
||
111 | 109 | * @since 1.1 |
112 | 110 | * |
113 | 111 | * @param array $item Contains all the data of the keys |
114 | - * @param string $column_name The name of the column |
|
115 | 112 | * |
116 | 113 | * @return string Column Name |
117 | 114 | */ |
@@ -124,7 +121,7 @@ discard block |
||
124 | 121 | * |
125 | 122 | * @access public |
126 | 123 | * @since 1.1 |
127 | - * @return void |
|
124 | + * @return string |
|
128 | 125 | */ |
129 | 126 | public function column_user( $item ) { |
130 | 127 |
@@ -134,10 +134,10 @@ discard block |
||
134 | 134 | $actions['view'] = sprintf( |
135 | 135 | '<a href="%s">%s</a>', |
136 | 136 | esc_url( add_query_arg( array( 'view' => 'api_requests', |
137 | - 'post_type' => 'give_forms', |
|
138 | - 'page' => 'give-reports', |
|
139 | - 'tab' => 'logs', |
|
140 | - 's' => $item['email'] |
|
137 | + 'post_type' => 'give_forms', |
|
138 | + 'page' => 'give-reports', |
|
139 | + 'tab' => 'logs', |
|
140 | + 's' => $item['email'] |
|
141 | 141 | ), 'edit.php' ) ), |
142 | 142 | __( 'View API Log', 'give' ) |
143 | 143 | ); |
@@ -146,16 +146,16 @@ discard block |
||
146 | 146 | $actions['reissue'] = sprintf( |
147 | 147 | '<a href="%s" class="give-regenerate-api-key">%s</a>', |
148 | 148 | esc_url( wp_nonce_url( add_query_arg( array( 'user_id' => $item['id'], |
149 | - 'give_action' => 'process_api_key', |
|
150 | - 'give_api_process' => 'regenerate' |
|
149 | + 'give_action' => 'process_api_key', |
|
150 | + 'give_api_process' => 'regenerate' |
|
151 | 151 | ) ), 'give-api-nonce' ) ), |
152 | 152 | __( 'Reissue', 'give' ) |
153 | 153 | ); |
154 | 154 | $actions['revoke'] = sprintf( |
155 | 155 | '<a href="%s" class="give-revoke-api-key give-delete">%s</a>', |
156 | 156 | esc_url( wp_nonce_url( add_query_arg( array( 'user_id' => $item['id'], |
157 | - 'give_action' => 'process_api_key', |
|
158 | - 'give_api_process' => 'revoke' |
|
157 | + 'give_action' => 'process_api_key', |
|
158 | + 'give_api_process' => 'revoke' |
|
159 | 159 | ) ), 'give-api-nonce' ) ), |
160 | 160 | __( 'Revoke', 'give' ) |
161 | 161 | ); |
@@ -10,13 +10,13 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
17 | 17 | // Load WP_List_Table if not loaded |
18 | -if ( ! class_exists( 'WP_List_Table' ) ) { |
|
19 | - require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php'; |
|
18 | +if ( ! class_exists('WP_List_Table')) { |
|
19 | + require_once ABSPATH.'wp-admin/includes/class-wp-list-table.php'; |
|
20 | 20 | } |
21 | 21 | |
22 | 22 | /** |
@@ -50,11 +50,11 @@ discard block |
||
50 | 50 | global $status, $page; |
51 | 51 | |
52 | 52 | // Set parent defaults |
53 | - parent::__construct( array( |
|
54 | - 'singular' => __( 'API Key', 'give' ), // Singular name of the listed records |
|
55 | - 'plural' => __( 'API Keys', 'give' ), // Plural name of the listed records |
|
53 | + parent::__construct(array( |
|
54 | + 'singular' => __('API Key', 'give'), // Singular name of the listed records |
|
55 | + 'plural' => __('API Keys', 'give'), // Plural name of the listed records |
|
56 | 56 | 'ajax' => false // Does this table support ajax? |
57 | - ) ); |
|
57 | + )); |
|
58 | 58 | |
59 | 59 | $this->query(); |
60 | 60 | } |
@@ -70,8 +70,8 @@ discard block |
||
70 | 70 | * |
71 | 71 | * @return string Column Name |
72 | 72 | */ |
73 | - public function column_default( $item, $column_name ) { |
|
74 | - return $item[ $column_name ]; |
|
73 | + public function column_default($item, $column_name) { |
|
74 | + return $item[$column_name]; |
|
75 | 75 | } |
76 | 76 | |
77 | 77 | /** |
@@ -85,8 +85,8 @@ discard block |
||
85 | 85 | * |
86 | 86 | * @return string Column Name |
87 | 87 | */ |
88 | - public function column_key( $item ) { |
|
89 | - return '<input readonly="readonly" type="text" class="large-text" value="' . esc_attr( $item['key'] ) . '"/>'; |
|
88 | + public function column_key($item) { |
|
89 | + return '<input readonly="readonly" type="text" class="large-text" value="'.esc_attr($item['key']).'"/>'; |
|
90 | 90 | } |
91 | 91 | |
92 | 92 | /** |
@@ -100,8 +100,8 @@ discard block |
||
100 | 100 | * |
101 | 101 | * @return string Column Name |
102 | 102 | */ |
103 | - public function column_token( $item ) { |
|
104 | - return '<input readonly="readonly" type="text" class="large-text" value="' . esc_attr( $item['token'] ) . '"/>'; |
|
103 | + public function column_token($item) { |
|
104 | + return '<input readonly="readonly" type="text" class="large-text" value="'.esc_attr($item['token']).'"/>'; |
|
105 | 105 | } |
106 | 106 | |
107 | 107 | /** |
@@ -115,8 +115,8 @@ discard block |
||
115 | 115 | * |
116 | 116 | * @return string Column Name |
117 | 117 | */ |
118 | - public function column_secret( $item ) { |
|
119 | - return '<input readonly="readonly" type="text" class="large-text" value="' . esc_attr( $item['secret'] ) . '"/>'; |
|
118 | + public function column_secret($item) { |
|
119 | + return '<input readonly="readonly" type="text" class="large-text" value="'.esc_attr($item['secret']).'"/>'; |
|
120 | 120 | } |
121 | 121 | |
122 | 122 | /** |
@@ -126,43 +126,43 @@ discard block |
||
126 | 126 | * @since 1.1 |
127 | 127 | * @return void |
128 | 128 | */ |
129 | - public function column_user( $item ) { |
|
129 | + public function column_user($item) { |
|
130 | 130 | |
131 | 131 | $actions = array(); |
132 | 132 | |
133 | - if ( apply_filters( 'give_api_log_requests', true ) ) { |
|
133 | + if (apply_filters('give_api_log_requests', true)) { |
|
134 | 134 | $actions['view'] = sprintf( |
135 | 135 | '<a href="%s">%s</a>', |
136 | - esc_url( add_query_arg( array( 'view' => 'api_requests', |
|
136 | + esc_url(add_query_arg(array('view' => 'api_requests', |
|
137 | 137 | 'post_type' => 'give_forms', |
138 | 138 | 'page' => 'give-reports', |
139 | 139 | 'tab' => 'logs', |
140 | 140 | 's' => $item['email'] |
141 | - ), 'edit.php' ) ), |
|
142 | - __( 'View API Log', 'give' ) |
|
141 | + ), 'edit.php')), |
|
142 | + __('View API Log', 'give') |
|
143 | 143 | ); |
144 | 144 | } |
145 | 145 | |
146 | 146 | $actions['reissue'] = sprintf( |
147 | 147 | '<a href="%s" class="give-regenerate-api-key">%s</a>', |
148 | - esc_url( wp_nonce_url( add_query_arg( array( 'user_id' => $item['id'], |
|
148 | + esc_url(wp_nonce_url(add_query_arg(array('user_id' => $item['id'], |
|
149 | 149 | 'give_action' => 'process_api_key', |
150 | 150 | 'give_api_process' => 'regenerate' |
151 | - ) ), 'give-api-nonce' ) ), |
|
152 | - __( 'Reissue', 'give' ) |
|
151 | + )), 'give-api-nonce')), |
|
152 | + __('Reissue', 'give') |
|
153 | 153 | ); |
154 | - $actions['revoke'] = sprintf( |
|
154 | + $actions['revoke'] = sprintf( |
|
155 | 155 | '<a href="%s" class="give-revoke-api-key give-delete">%s</a>', |
156 | - esc_url( wp_nonce_url( add_query_arg( array( 'user_id' => $item['id'], |
|
156 | + esc_url(wp_nonce_url(add_query_arg(array('user_id' => $item['id'], |
|
157 | 157 | 'give_action' => 'process_api_key', |
158 | 158 | 'give_api_process' => 'revoke' |
159 | - ) ), 'give-api-nonce' ) ), |
|
160 | - __( 'Revoke', 'give' ) |
|
159 | + )), 'give-api-nonce')), |
|
160 | + __('Revoke', 'give') |
|
161 | 161 | ); |
162 | 162 | |
163 | - $actions = apply_filters( 'give_api_row_actions', array_filter( $actions ) ); |
|
163 | + $actions = apply_filters('give_api_row_actions', array_filter($actions)); |
|
164 | 164 | |
165 | - return sprintf( '%1$s %2$s', $item['user'], $this->row_actions( $actions ) ); |
|
165 | + return sprintf('%1$s %2$s', $item['user'], $this->row_actions($actions)); |
|
166 | 166 | } |
167 | 167 | |
168 | 168 | /** |
@@ -174,10 +174,10 @@ discard block |
||
174 | 174 | */ |
175 | 175 | public function get_columns() { |
176 | 176 | $columns = array( |
177 | - 'user' => __( 'Username', 'give' ), |
|
178 | - 'key' => __( 'Public Key', 'give' ), |
|
179 | - 'token' => __( 'Token', 'give' ), |
|
180 | - 'secret' => __( 'Secret Key', 'give' ) |
|
177 | + 'user' => __('Username', 'give'), |
|
178 | + 'key' => __('Public Key', 'give'), |
|
179 | + 'token' => __('Token', 'give'), |
|
180 | + 'secret' => __('Secret Key', 'give') |
|
181 | 181 | ); |
182 | 182 | |
183 | 183 | return $columns; |
@@ -190,20 +190,20 @@ discard block |
||
190 | 190 | * @since 1.1 |
191 | 191 | * @return void |
192 | 192 | */ |
193 | - function bulk_actions( $which = '' ) { |
|
193 | + function bulk_actions($which = '') { |
|
194 | 194 | // These aren't really bulk actions but this outputs the markup in the right place |
195 | 195 | static $give_api_is_bottom; |
196 | 196 | |
197 | - if ( $give_api_is_bottom ) { |
|
197 | + if ($give_api_is_bottom) { |
|
198 | 198 | return; |
199 | 199 | } |
200 | 200 | ?> |
201 | - <form method="post" action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-settings&tab=api' ); ?>"> |
|
201 | + <form method="post" action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-settings&tab=api'); ?>"> |
|
202 | 202 | <input type="hidden" name="give_action" value="process_api_key" /> |
203 | 203 | <input type="hidden" name="give_api_process" value="generate" /> |
204 | - <?php wp_nonce_field( 'give-api-nonce' ); ?> |
|
204 | + <?php wp_nonce_field('give-api-nonce'); ?> |
|
205 | 205 | <?php echo Give()->html->ajax_user_search(); ?> |
206 | - <?php submit_button( __( 'Generate New API Keys', 'give' ), 'secondary', 'submit', false ); ?> |
|
206 | + <?php submit_button(__('Generate New API Keys', 'give'), 'secondary', 'submit', false); ?> |
|
207 | 207 | </form> |
208 | 208 | <?php |
209 | 209 | $give_api_is_bottom = true; |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | * @return int Current page number |
218 | 218 | */ |
219 | 219 | public function get_paged() { |
220 | - return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1; |
|
220 | + return isset($_GET['paged']) ? absint($_GET['paged']) : 1; |
|
221 | 221 | } |
222 | 222 | |
223 | 223 | /** |
@@ -228,21 +228,21 @@ discard block |
||
228 | 228 | * @return void |
229 | 229 | */ |
230 | 230 | public function query() { |
231 | - $users = get_users( array( |
|
231 | + $users = get_users(array( |
|
232 | 232 | 'meta_value' => 'give_user_secret_key', |
233 | 233 | 'number' => $this->per_page, |
234 | - 'offset' => $this->per_page * ( $this->get_paged() - 1 ) |
|
235 | - ) ); |
|
236 | - $keys = array(); |
|
237 | - |
|
238 | - foreach ( $users as $user ) { |
|
239 | - $keys[ $user->ID ]['id'] = $user->ID; |
|
240 | - $keys[ $user->ID ]['email'] = $user->user_email; |
|
241 | - $keys[ $user->ID ]['user'] = '<a href="' . add_query_arg( 'user_id', $user->ID, 'user-edit.php' ) . '"><strong>' . $user->user_login . '</strong></a>'; |
|
242 | - |
|
243 | - $keys[ $user->ID ]['key'] = Give()->api->get_user_public_key( $user->ID ); |
|
244 | - $keys[ $user->ID ]['secret'] = Give()->api->get_user_secret_key( $user->ID ); |
|
245 | - $keys[ $user->ID ]['token'] = Give()->api->get_token( $user->ID ); |
|
234 | + 'offset' => $this->per_page * ($this->get_paged() - 1) |
|
235 | + )); |
|
236 | + $keys = array(); |
|
237 | + |
|
238 | + foreach ($users as $user) { |
|
239 | + $keys[$user->ID]['id'] = $user->ID; |
|
240 | + $keys[$user->ID]['email'] = $user->user_email; |
|
241 | + $keys[$user->ID]['user'] = '<a href="'.add_query_arg('user_id', $user->ID, 'user-edit.php').'"><strong>'.$user->user_login.'</strong></a>'; |
|
242 | + |
|
243 | + $keys[$user->ID]['key'] = Give()->api->get_user_public_key($user->ID); |
|
244 | + $keys[$user->ID]['secret'] = Give()->api->get_user_secret_key($user->ID); |
|
245 | + $keys[$user->ID]['token'] = Give()->api->get_token($user->ID); |
|
246 | 246 | } |
247 | 247 | |
248 | 248 | return $keys; |
@@ -259,13 +259,13 @@ discard block |
||
259 | 259 | public function total_items() { |
260 | 260 | global $wpdb; |
261 | 261 | |
262 | - if ( ! get_transient( 'give_total_api_keys' ) ) { |
|
263 | - $total_items = $wpdb->get_var( "SELECT count(user_id) FROM $wpdb->usermeta WHERE meta_value='give_user_secret_key'" ); |
|
262 | + if ( ! get_transient('give_total_api_keys')) { |
|
263 | + $total_items = $wpdb->get_var("SELECT count(user_id) FROM $wpdb->usermeta WHERE meta_value='give_user_secret_key'"); |
|
264 | 264 | |
265 | - set_transient( 'give_total_api_keys', $total_items, 60 * 60 ); |
|
265 | + set_transient('give_total_api_keys', $total_items, 60 * 60); |
|
266 | 266 | } |
267 | 267 | |
268 | - return get_transient( 'give_total_api_keys' ); |
|
268 | + return get_transient('give_total_api_keys'); |
|
269 | 269 | } |
270 | 270 | |
271 | 271 | /** |
@@ -281,7 +281,7 @@ discard block |
||
281 | 281 | $hidden = array(); // No hidden columns |
282 | 282 | $sortable = array(); // Not sortable... for now |
283 | 283 | |
284 | - $this->_column_headers = array( $columns, $hidden, $sortable, 'id' ); |
|
284 | + $this->_column_headers = array($columns, $hidden, $sortable, 'id'); |
|
285 | 285 | |
286 | 286 | $data = $this->query(); |
287 | 287 | |
@@ -289,10 +289,10 @@ discard block |
||
289 | 289 | |
290 | 290 | $this->items = $data; |
291 | 291 | |
292 | - $this->set_pagination_args( array( |
|
292 | + $this->set_pagination_args(array( |
|
293 | 293 | 'total_items' => $total_items, |
294 | 294 | 'per_page' => $this->per_page, |
295 | - 'total_pages' => ceil( $total_items / $this->per_page ) |
|
295 | + 'total_pages' => ceil($total_items / $this->per_page) |
|
296 | 296 | ) |
297 | 297 | ); |
298 | 298 | } |
@@ -67,7 +67,7 @@ |
||
67 | 67 | * @uses api_request() |
68 | 68 | * |
69 | 69 | * @param array $_transient_data Update array build by WordPress. |
70 | - * @return array Modified update array with custom plugin data. |
|
70 | + * @return stdClass Modified update array with custom plugin data. |
|
71 | 71 | */ |
72 | 72 | function check_update( $_transient_data ) { |
73 | 73 |
@@ -13,328 +13,328 @@ |
||
13 | 13 | * @version 1.6 |
14 | 14 | */ |
15 | 15 | class EDD_SL_Plugin_Updater { |
16 | - private $api_url = ''; |
|
17 | - private $api_data = array(); |
|
18 | - private $name = ''; |
|
19 | - private $slug = ''; |
|
20 | - |
|
21 | - /** |
|
22 | - * Class constructor. |
|
23 | - * |
|
24 | - * @uses plugin_basename() |
|
25 | - * @uses hook() |
|
26 | - * |
|
27 | - * @param string $_api_url The URL pointing to the custom API endpoint. |
|
28 | - * @param string $_plugin_file Path to the plugin file. |
|
29 | - * @param array $_api_data Optional data to send with API calls. |
|
30 | - * @return void |
|
31 | - */ |
|
32 | - function __construct( $_api_url, $_plugin_file, $_api_data = null ) { |
|
33 | - $this->api_url = trailingslashit( $_api_url ); |
|
34 | - $this->api_data = $_api_data; |
|
35 | - $this->name = plugin_basename( $_plugin_file ); |
|
36 | - $this->slug = basename( $_plugin_file, '.php' ); |
|
37 | - $this->version = $_api_data['version']; |
|
38 | - |
|
39 | - // Set up hooks. |
|
40 | - $this->init(); |
|
41 | - add_action( 'admin_init', array( $this, 'show_changelog' ) ); |
|
42 | - } |
|
43 | - |
|
44 | - /** |
|
45 | - * Set up WordPress filters to hook into WP's update process. |
|
46 | - * |
|
47 | - * @uses add_filter() |
|
48 | - * |
|
49 | - * @return void |
|
50 | - */ |
|
51 | - public function init() { |
|
16 | + private $api_url = ''; |
|
17 | + private $api_data = array(); |
|
18 | + private $name = ''; |
|
19 | + private $slug = ''; |
|
20 | + |
|
21 | + /** |
|
22 | + * Class constructor. |
|
23 | + * |
|
24 | + * @uses plugin_basename() |
|
25 | + * @uses hook() |
|
26 | + * |
|
27 | + * @param string $_api_url The URL pointing to the custom API endpoint. |
|
28 | + * @param string $_plugin_file Path to the plugin file. |
|
29 | + * @param array $_api_data Optional data to send with API calls. |
|
30 | + * @return void |
|
31 | + */ |
|
32 | + function __construct( $_api_url, $_plugin_file, $_api_data = null ) { |
|
33 | + $this->api_url = trailingslashit( $_api_url ); |
|
34 | + $this->api_data = $_api_data; |
|
35 | + $this->name = plugin_basename( $_plugin_file ); |
|
36 | + $this->slug = basename( $_plugin_file, '.php' ); |
|
37 | + $this->version = $_api_data['version']; |
|
38 | + |
|
39 | + // Set up hooks. |
|
40 | + $this->init(); |
|
41 | + add_action( 'admin_init', array( $this, 'show_changelog' ) ); |
|
42 | + } |
|
43 | + |
|
44 | + /** |
|
45 | + * Set up WordPress filters to hook into WP's update process. |
|
46 | + * |
|
47 | + * @uses add_filter() |
|
48 | + * |
|
49 | + * @return void |
|
50 | + */ |
|
51 | + public function init() { |
|
52 | 52 | |
53 | - add_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ) ); |
|
54 | - add_filter( 'plugins_api', array( $this, 'plugins_api_filter' ), 10, 3 ); |
|
53 | + add_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ) ); |
|
54 | + add_filter( 'plugins_api', array( $this, 'plugins_api_filter' ), 10, 3 ); |
|
55 | 55 | |
56 | - add_action( 'after_plugin_row_' . $this->name, array( $this, 'show_update_notification' ), 10, 2 ); |
|
57 | - } |
|
56 | + add_action( 'after_plugin_row_' . $this->name, array( $this, 'show_update_notification' ), 10, 2 ); |
|
57 | + } |
|
58 | 58 | |
59 | - /** |
|
60 | - * Check for Updates at the defined API endpoint and modify the update array. |
|
61 | - * |
|
62 | - * This function dives into the update API just when WordPress creates its update array, |
|
63 | - * then adds a custom API call and injects the custom plugin data retrieved from the API. |
|
64 | - * It is reassembled from parts of the native WordPress plugin update code. |
|
65 | - * See wp-includes/update.php line 121 for the original wp_update_plugins() function. |
|
66 | - * |
|
67 | - * @uses api_request() |
|
68 | - * |
|
69 | - * @param array $_transient_data Update array build by WordPress. |
|
70 | - * @return array Modified update array with custom plugin data. |
|
71 | - */ |
|
72 | - function check_update( $_transient_data ) { |
|
59 | + /** |
|
60 | + * Check for Updates at the defined API endpoint and modify the update array. |
|
61 | + * |
|
62 | + * This function dives into the update API just when WordPress creates its update array, |
|
63 | + * then adds a custom API call and injects the custom plugin data retrieved from the API. |
|
64 | + * It is reassembled from parts of the native WordPress plugin update code. |
|
65 | + * See wp-includes/update.php line 121 for the original wp_update_plugins() function. |
|
66 | + * |
|
67 | + * @uses api_request() |
|
68 | + * |
|
69 | + * @param array $_transient_data Update array build by WordPress. |
|
70 | + * @return array Modified update array with custom plugin data. |
|
71 | + */ |
|
72 | + function check_update( $_transient_data ) { |
|
73 | 73 | |
74 | - global $pagenow; |
|
74 | + global $pagenow; |
|
75 | 75 | |
76 | - if( ! is_object( $_transient_data ) ) { |
|
77 | - $_transient_data = new stdClass; |
|
78 | - } |
|
76 | + if( ! is_object( $_transient_data ) ) { |
|
77 | + $_transient_data = new stdClass; |
|
78 | + } |
|
79 | 79 | |
80 | - if( 'plugins.php' == $pagenow && is_multisite() ) { |
|
81 | - return $_transient_data; |
|
82 | - } |
|
80 | + if( 'plugins.php' == $pagenow && is_multisite() ) { |
|
81 | + return $_transient_data; |
|
82 | + } |
|
83 | 83 | |
84 | - if ( empty( $_transient_data->response ) || empty( $_transient_data->response[ $this->name ] ) ) { |
|
84 | + if ( empty( $_transient_data->response ) || empty( $_transient_data->response[ $this->name ] ) ) { |
|
85 | 85 | |
86 | - $version_info = $this->api_request( 'plugin_latest_version', array( 'slug' => $this->slug ) ); |
|
86 | + $version_info = $this->api_request( 'plugin_latest_version', array( 'slug' => $this->slug ) ); |
|
87 | 87 | |
88 | - if ( false !== $version_info && is_object( $version_info ) && isset( $version_info->new_version ) ) { |
|
88 | + if ( false !== $version_info && is_object( $version_info ) && isset( $version_info->new_version ) ) { |
|
89 | 89 | |
90 | - $this->did_check = true; |
|
90 | + $this->did_check = true; |
|
91 | 91 | |
92 | - if( version_compare( $this->version, $version_info->new_version, '<' ) ) { |
|
92 | + if( version_compare( $this->version, $version_info->new_version, '<' ) ) { |
|
93 | 93 | |
94 | - $_transient_data->response[ $this->name ] = $version_info; |
|
94 | + $_transient_data->response[ $this->name ] = $version_info; |
|
95 | 95 | |
96 | - } |
|
96 | + } |
|
97 | 97 | |
98 | - $_transient_data->last_checked = time(); |
|
99 | - $_transient_data->checked[ $this->name ] = $this->version; |
|
98 | + $_transient_data->last_checked = time(); |
|
99 | + $_transient_data->checked[ $this->name ] = $this->version; |
|
100 | 100 | |
101 | - } |
|
101 | + } |
|
102 | 102 | |
103 | - } |
|
103 | + } |
|
104 | 104 | |
105 | - return $_transient_data; |
|
106 | - } |
|
105 | + return $_transient_data; |
|
106 | + } |
|
107 | 107 | |
108 | - /** |
|
109 | - * show update nofication row -- needed for multisite subsites, because WP won't tell you otherwise! |
|
110 | - * |
|
111 | - * @param string $file |
|
112 | - * @param array $plugin |
|
113 | - */ |
|
114 | - public function show_update_notification( $file, $plugin ) { |
|
108 | + /** |
|
109 | + * show update nofication row -- needed for multisite subsites, because WP won't tell you otherwise! |
|
110 | + * |
|
111 | + * @param string $file |
|
112 | + * @param array $plugin |
|
113 | + */ |
|
114 | + public function show_update_notification( $file, $plugin ) { |
|
115 | 115 | |
116 | - if( ! current_user_can( 'update_plugins' ) ) { |
|
117 | - return; |
|
118 | - } |
|
116 | + if( ! current_user_can( 'update_plugins' ) ) { |
|
117 | + return; |
|
118 | + } |
|
119 | 119 | |
120 | - if( ! is_multisite() ) { |
|
121 | - return; |
|
122 | - } |
|
120 | + if( ! is_multisite() ) { |
|
121 | + return; |
|
122 | + } |
|
123 | 123 | |
124 | - if ( $this->name != $file ) { |
|
125 | - return; |
|
126 | - } |
|
124 | + if ( $this->name != $file ) { |
|
125 | + return; |
|
126 | + } |
|
127 | 127 | |
128 | - // Remove our filter on the site transient |
|
129 | - remove_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ), 10 ); |
|
128 | + // Remove our filter on the site transient |
|
129 | + remove_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ), 10 ); |
|
130 | 130 | |
131 | - $update_cache = get_site_transient( 'update_plugins' ); |
|
131 | + $update_cache = get_site_transient( 'update_plugins' ); |
|
132 | 132 | |
133 | - if ( ! is_object( $update_cache ) || empty( $update_cache->response ) || empty( $update_cache->response[ $this->name ] ) ) { |
|
133 | + if ( ! is_object( $update_cache ) || empty( $update_cache->response ) || empty( $update_cache->response[ $this->name ] ) ) { |
|
134 | 134 | |
135 | - $cache_key = md5( 'edd_plugin_' .sanitize_key( $this->name ) . '_version_info' ); |
|
136 | - $version_info = get_transient( $cache_key ); |
|
135 | + $cache_key = md5( 'edd_plugin_' .sanitize_key( $this->name ) . '_version_info' ); |
|
136 | + $version_info = get_transient( $cache_key ); |
|
137 | 137 | |
138 | - if( false === $version_info ) { |
|
138 | + if( false === $version_info ) { |
|
139 | 139 | |
140 | - $version_info = $this->api_request( 'plugin_latest_version', array( 'slug' => $this->slug ) ); |
|
140 | + $version_info = $this->api_request( 'plugin_latest_version', array( 'slug' => $this->slug ) ); |
|
141 | 141 | |
142 | - set_transient( $cache_key, $version_info, 3600 ); |
|
143 | - } |
|
142 | + set_transient( $cache_key, $version_info, 3600 ); |
|
143 | + } |
|
144 | 144 | |
145 | 145 | |
146 | - if( ! is_object( $version_info ) ) { |
|
147 | - return; |
|
148 | - } |
|
146 | + if( ! is_object( $version_info ) ) { |
|
147 | + return; |
|
148 | + } |
|
149 | 149 | |
150 | - if( version_compare( $this->version, $version_info->new_version, '<' ) ) { |
|
150 | + if( version_compare( $this->version, $version_info->new_version, '<' ) ) { |
|
151 | 151 | |
152 | - $update_cache->response[ $this->name ] = $version_info; |
|
152 | + $update_cache->response[ $this->name ] = $version_info; |
|
153 | 153 | |
154 | - } |
|
154 | + } |
|
155 | 155 | |
156 | - $update_cache->last_checked = time(); |
|
157 | - $update_cache->checked[ $this->name ] = $this->version; |
|
156 | + $update_cache->last_checked = time(); |
|
157 | + $update_cache->checked[ $this->name ] = $this->version; |
|
158 | 158 | |
159 | - set_site_transient( 'update_plugins', $update_cache ); |
|
159 | + set_site_transient( 'update_plugins', $update_cache ); |
|
160 | 160 | |
161 | - } else { |
|
161 | + } else { |
|
162 | 162 | |
163 | - $version_info = $update_cache->response[ $this->name ]; |
|
163 | + $version_info = $update_cache->response[ $this->name ]; |
|
164 | 164 | |
165 | - } |
|
165 | + } |
|
166 | 166 | |
167 | - // Restore our filter |
|
168 | - add_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ) ); |
|
167 | + // Restore our filter |
|
168 | + add_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ) ); |
|
169 | 169 | |
170 | - if ( ! empty( $update_cache->response[ $this->name ] ) && version_compare( $this->version, $version_info->new_version, '<' ) ) { |
|
170 | + if ( ! empty( $update_cache->response[ $this->name ] ) && version_compare( $this->version, $version_info->new_version, '<' ) ) { |
|
171 | 171 | |
172 | - // build a plugin list row, with update notification |
|
173 | - $wp_list_table = _get_list_table( 'WP_Plugins_List_Table' ); |
|
174 | - echo '<tr class="plugin-update-tr"><td colspan="' . $wp_list_table->get_column_count() . '" class="plugin-update colspanchange"><div class="update-message">'; |
|
172 | + // build a plugin list row, with update notification |
|
173 | + $wp_list_table = _get_list_table( 'WP_Plugins_List_Table' ); |
|
174 | + echo '<tr class="plugin-update-tr"><td colspan="' . $wp_list_table->get_column_count() . '" class="plugin-update colspanchange"><div class="update-message">'; |
|
175 | 175 | |
176 | - $changelog_link = self_admin_url( 'index.php?edd_sl_action=view_plugin_changelog&plugin=' . $this->name . '&slug=' . $this->slug . '&TB_iframe=true&width=772&height=911' ); |
|
176 | + $changelog_link = self_admin_url( 'index.php?edd_sl_action=view_plugin_changelog&plugin=' . $this->name . '&slug=' . $this->slug . '&TB_iframe=true&width=772&height=911' ); |
|
177 | 177 | |
178 | - if ( empty( $version_info->download_link ) ) { |
|
179 | - printf( |
|
180 | - __( 'There is a new version of %1$s available. <a target="_blank" class="thickbox" href="%2$s">View version %3$s details</a>.', 'edd' ), |
|
181 | - esc_html( $version_info->name ), |
|
182 | - esc_url( $changelog_link ), |
|
183 | - esc_html( $version_info->new_version ) |
|
184 | - ); |
|
185 | - } else { |
|
186 | - printf( |
|
187 | - __( 'There is a new version of %1$s available. <a target="_blank" class="thickbox" href="%2$s">View version %3$s details</a> or <a href="%4$s">update now</a>.', 'edd' ), |
|
188 | - esc_html( $version_info->name ), |
|
189 | - esc_url( $changelog_link ), |
|
190 | - esc_html( $version_info->new_version ), |
|
191 | - esc_url( wp_nonce_url( self_admin_url( 'update.php?action=upgrade-plugin&plugin=' ) . $this->name, 'upgrade-plugin_' . $this->name ) ) |
|
192 | - ); |
|
193 | - } |
|
178 | + if ( empty( $version_info->download_link ) ) { |
|
179 | + printf( |
|
180 | + __( 'There is a new version of %1$s available. <a target="_blank" class="thickbox" href="%2$s">View version %3$s details</a>.', 'edd' ), |
|
181 | + esc_html( $version_info->name ), |
|
182 | + esc_url( $changelog_link ), |
|
183 | + esc_html( $version_info->new_version ) |
|
184 | + ); |
|
185 | + } else { |
|
186 | + printf( |
|
187 | + __( 'There is a new version of %1$s available. <a target="_blank" class="thickbox" href="%2$s">View version %3$s details</a> or <a href="%4$s">update now</a>.', 'edd' ), |
|
188 | + esc_html( $version_info->name ), |
|
189 | + esc_url( $changelog_link ), |
|
190 | + esc_html( $version_info->new_version ), |
|
191 | + esc_url( wp_nonce_url( self_admin_url( 'update.php?action=upgrade-plugin&plugin=' ) . $this->name, 'upgrade-plugin_' . $this->name ) ) |
|
192 | + ); |
|
193 | + } |
|
194 | 194 | |
195 | - echo '</div></td></tr>'; |
|
196 | - } |
|
197 | - } |
|
195 | + echo '</div></td></tr>'; |
|
196 | + } |
|
197 | + } |
|
198 | 198 | |
199 | 199 | |
200 | - /** |
|
201 | - * Updates information on the "View version x.x details" page with custom data. |
|
202 | - * |
|
203 | - * @uses api_request() |
|
204 | - * |
|
205 | - * @param mixed $_data |
|
206 | - * @param string $_action |
|
207 | - * @param object $_args |
|
208 | - * @return object $_data |
|
209 | - */ |
|
210 | - function plugins_api_filter( $_data, $_action = '', $_args = null ) { |
|
200 | + /** |
|
201 | + * Updates information on the "View version x.x details" page with custom data. |
|
202 | + * |
|
203 | + * @uses api_request() |
|
204 | + * |
|
205 | + * @param mixed $_data |
|
206 | + * @param string $_action |
|
207 | + * @param object $_args |
|
208 | + * @return object $_data |
|
209 | + */ |
|
210 | + function plugins_api_filter( $_data, $_action = '', $_args = null ) { |
|
211 | 211 | |
212 | 212 | |
213 | - if ( $_action != 'plugin_information' ) { |
|
213 | + if ( $_action != 'plugin_information' ) { |
|
214 | 214 | |
215 | - return $_data; |
|
215 | + return $_data; |
|
216 | 216 | |
217 | - } |
|
217 | + } |
|
218 | 218 | |
219 | - if ( ! isset( $_args->slug ) || ( $_args->slug != $this->slug ) ) { |
|
219 | + if ( ! isset( $_args->slug ) || ( $_args->slug != $this->slug ) ) { |
|
220 | 220 | |
221 | - return $_data; |
|
221 | + return $_data; |
|
222 | 222 | |
223 | - } |
|
223 | + } |
|
224 | 224 | |
225 | - $to_send = array( |
|
226 | - 'slug' => $this->slug, |
|
227 | - 'is_ssl' => is_ssl(), |
|
228 | - 'fields' => array( |
|
229 | - 'banners' => false, // These will be supported soon hopefully |
|
230 | - 'reviews' => false |
|
231 | - ) |
|
232 | - ); |
|
225 | + $to_send = array( |
|
226 | + 'slug' => $this->slug, |
|
227 | + 'is_ssl' => is_ssl(), |
|
228 | + 'fields' => array( |
|
229 | + 'banners' => false, // These will be supported soon hopefully |
|
230 | + 'reviews' => false |
|
231 | + ) |
|
232 | + ); |
|
233 | 233 | |
234 | - $api_response = $this->api_request( 'plugin_information', $to_send ); |
|
234 | + $api_response = $this->api_request( 'plugin_information', $to_send ); |
|
235 | 235 | |
236 | - if ( false !== $api_response ) { |
|
237 | - $_data = $api_response; |
|
238 | - } |
|
236 | + if ( false !== $api_response ) { |
|
237 | + $_data = $api_response; |
|
238 | + } |
|
239 | 239 | |
240 | - return $_data; |
|
241 | - } |
|
240 | + return $_data; |
|
241 | + } |
|
242 | 242 | |
243 | 243 | |
244 | - /** |
|
245 | - * Disable SSL verification in order to prevent download update failures |
|
246 | - * |
|
247 | - * @param array $args |
|
248 | - * @param string $url |
|
249 | - * @return object $array |
|
250 | - */ |
|
251 | - function http_request_args( $args, $url ) { |
|
252 | - // If it is an https request and we are performing a package download, disable ssl verification |
|
253 | - if ( strpos( $url, 'https://' ) !== false && strpos( $url, 'edd_action=package_download' ) ) { |
|
254 | - $args['sslverify'] = false; |
|
255 | - } |
|
256 | - return $args; |
|
257 | - } |
|
244 | + /** |
|
245 | + * Disable SSL verification in order to prevent download update failures |
|
246 | + * |
|
247 | + * @param array $args |
|
248 | + * @param string $url |
|
249 | + * @return object $array |
|
250 | + */ |
|
251 | + function http_request_args( $args, $url ) { |
|
252 | + // If it is an https request and we are performing a package download, disable ssl verification |
|
253 | + if ( strpos( $url, 'https://' ) !== false && strpos( $url, 'edd_action=package_download' ) ) { |
|
254 | + $args['sslverify'] = false; |
|
255 | + } |
|
256 | + return $args; |
|
257 | + } |
|
258 | 258 | |
259 | - /** |
|
260 | - * Calls the API and, if successfull, returns the object delivered by the API. |
|
261 | - * |
|
262 | - * @uses get_bloginfo() |
|
263 | - * @uses wp_remote_post() |
|
264 | - * @uses is_wp_error() |
|
265 | - * |
|
266 | - * @param string $_action The requested action. |
|
267 | - * @param array $_data Parameters for the API action. |
|
268 | - * @return false||object |
|
269 | - */ |
|
270 | - private function api_request( $_action, $_data ) { |
|
271 | - |
|
272 | - global $wp_version; |
|
273 | - |
|
274 | - $data = array_merge( $this->api_data, $_data ); |
|
275 | - |
|
276 | - if ( $data['slug'] != $this->slug ) |
|
277 | - return; |
|
278 | - |
|
279 | - if ( empty( $data['license'] ) ) |
|
280 | - return; |
|
281 | - |
|
282 | - if( $this->api_url == home_url() ) { |
|
283 | - return false; // Don't allow a plugin to ping itself |
|
284 | - } |
|
285 | - |
|
286 | - $api_params = array( |
|
287 | - 'edd_action' => 'get_version', |
|
288 | - 'license' => $data['license'], |
|
289 | - 'item_name' => isset( $data['item_name'] ) ? $data['item_name'] : false, |
|
290 | - 'item_id' => isset( $data['item_id'] ) ? $data['item_id'] : false, |
|
291 | - 'slug' => $data['slug'], |
|
292 | - 'author' => $data['author'], |
|
293 | - 'url' => home_url() |
|
294 | - ); |
|
259 | + /** |
|
260 | + * Calls the API and, if successfull, returns the object delivered by the API. |
|
261 | + * |
|
262 | + * @uses get_bloginfo() |
|
263 | + * @uses wp_remote_post() |
|
264 | + * @uses is_wp_error() |
|
265 | + * |
|
266 | + * @param string $_action The requested action. |
|
267 | + * @param array $_data Parameters for the API action. |
|
268 | + * @return false||object |
|
269 | + */ |
|
270 | + private function api_request( $_action, $_data ) { |
|
271 | + |
|
272 | + global $wp_version; |
|
273 | + |
|
274 | + $data = array_merge( $this->api_data, $_data ); |
|
275 | + |
|
276 | + if ( $data['slug'] != $this->slug ) |
|
277 | + return; |
|
278 | + |
|
279 | + if ( empty( $data['license'] ) ) |
|
280 | + return; |
|
281 | + |
|
282 | + if( $this->api_url == home_url() ) { |
|
283 | + return false; // Don't allow a plugin to ping itself |
|
284 | + } |
|
285 | + |
|
286 | + $api_params = array( |
|
287 | + 'edd_action' => 'get_version', |
|
288 | + 'license' => $data['license'], |
|
289 | + 'item_name' => isset( $data['item_name'] ) ? $data['item_name'] : false, |
|
290 | + 'item_id' => isset( $data['item_id'] ) ? $data['item_id'] : false, |
|
291 | + 'slug' => $data['slug'], |
|
292 | + 'author' => $data['author'], |
|
293 | + 'url' => home_url() |
|
294 | + ); |
|
295 | 295 | |
296 | - $request = wp_remote_post( $this->api_url, array( 'timeout' => 15, 'sslverify' => false, 'body' => $api_params ) ); |
|
296 | + $request = wp_remote_post( $this->api_url, array( 'timeout' => 15, 'sslverify' => false, 'body' => $api_params ) ); |
|
297 | 297 | |
298 | - if ( ! is_wp_error( $request ) ) { |
|
299 | - $request = json_decode( wp_remote_retrieve_body( $request ) ); |
|
300 | - } |
|
298 | + if ( ! is_wp_error( $request ) ) { |
|
299 | + $request = json_decode( wp_remote_retrieve_body( $request ) ); |
|
300 | + } |
|
301 | 301 | |
302 | - if ( $request && isset( $request->sections ) ) { |
|
303 | - $request->sections = maybe_unserialize( $request->sections ); |
|
304 | - } else { |
|
305 | - $request = false; |
|
306 | - } |
|
302 | + if ( $request && isset( $request->sections ) ) { |
|
303 | + $request->sections = maybe_unserialize( $request->sections ); |
|
304 | + } else { |
|
305 | + $request = false; |
|
306 | + } |
|
307 | 307 | |
308 | - return $request; |
|
309 | - } |
|
308 | + return $request; |
|
309 | + } |
|
310 | 310 | |
311 | - public function show_changelog() { |
|
311 | + public function show_changelog() { |
|
312 | 312 | |
313 | 313 | |
314 | - if( empty( $_REQUEST['edd_sl_action'] ) || 'view_plugin_changelog' != $_REQUEST['edd_sl_action'] ) { |
|
315 | - return; |
|
316 | - } |
|
314 | + if( empty( $_REQUEST['edd_sl_action'] ) || 'view_plugin_changelog' != $_REQUEST['edd_sl_action'] ) { |
|
315 | + return; |
|
316 | + } |
|
317 | 317 | |
318 | - if( empty( $_REQUEST['plugin'] ) ) { |
|
319 | - return; |
|
320 | - } |
|
321 | - |
|
322 | - if( empty( $_REQUEST['slug'] ) ) { |
|
323 | - return; |
|
324 | - } |
|
325 | - |
|
326 | - if( ! current_user_can( 'update_plugins' ) ) { |
|
327 | - wp_die( __( 'You do not have permission to install plugin updates', 'edd' ), __( 'Error', 'edd' ), array( 'response' => 403 ) ); |
|
328 | - } |
|
329 | - |
|
330 | - $response = $this->api_request( 'plugin_latest_version', array( 'slug' => $_REQUEST['slug'] ) ); |
|
331 | - |
|
332 | - if( $response && isset( $response->sections['changelog'] ) ) { |
|
333 | - echo '<div style="background:#fff;padding:10px;">' . $response->sections['changelog'] . '</div>'; |
|
334 | - } |
|
335 | - |
|
336 | - |
|
337 | - exit; |
|
338 | - } |
|
318 | + if( empty( $_REQUEST['plugin'] ) ) { |
|
319 | + return; |
|
320 | + } |
|
321 | + |
|
322 | + if( empty( $_REQUEST['slug'] ) ) { |
|
323 | + return; |
|
324 | + } |
|
325 | + |
|
326 | + if( ! current_user_can( 'update_plugins' ) ) { |
|
327 | + wp_die( __( 'You do not have permission to install plugin updates', 'edd' ), __( 'Error', 'edd' ), array( 'response' => 403 ) ); |
|
328 | + } |
|
329 | + |
|
330 | + $response = $this->api_request( 'plugin_latest_version', array( 'slug' => $_REQUEST['slug'] ) ); |
|
331 | + |
|
332 | + if( $response && isset( $response->sections['changelog'] ) ) { |
|
333 | + echo '<div style="background:#fff;padding:10px;">' . $response->sections['changelog'] . '</div>'; |
|
334 | + } |
|
335 | + |
|
336 | + |
|
337 | + exit; |
|
338 | + } |
|
339 | 339 | |
340 | 340 | } |
@@ -4,7 +4,7 @@ discard block |
||
4 | 4 | //set_site_transient( 'update_plugins', null ); |
5 | 5 | |
6 | 6 | // Exit if accessed directly |
7 | -if ( ! defined( 'ABSPATH' ) ) exit; |
|
7 | +if ( ! defined('ABSPATH')) exit; |
|
8 | 8 | |
9 | 9 | /** |
10 | 10 | * Allows plugins to use their own update API. |
@@ -29,16 +29,16 @@ discard block |
||
29 | 29 | * @param array $_api_data Optional data to send with API calls. |
30 | 30 | * @return void |
31 | 31 | */ |
32 | - function __construct( $_api_url, $_plugin_file, $_api_data = null ) { |
|
33 | - $this->api_url = trailingslashit( $_api_url ); |
|
32 | + function __construct($_api_url, $_plugin_file, $_api_data = null) { |
|
33 | + $this->api_url = trailingslashit($_api_url); |
|
34 | 34 | $this->api_data = $_api_data; |
35 | - $this->name = plugin_basename( $_plugin_file ); |
|
36 | - $this->slug = basename( $_plugin_file, '.php' ); |
|
35 | + $this->name = plugin_basename($_plugin_file); |
|
36 | + $this->slug = basename($_plugin_file, '.php'); |
|
37 | 37 | $this->version = $_api_data['version']; |
38 | 38 | |
39 | 39 | // Set up hooks. |
40 | 40 | $this->init(); |
41 | - add_action( 'admin_init', array( $this, 'show_changelog' ) ); |
|
41 | + add_action('admin_init', array($this, 'show_changelog')); |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | /** |
@@ -50,10 +50,10 @@ discard block |
||
50 | 50 | */ |
51 | 51 | public function init() { |
52 | 52 | |
53 | - add_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ) ); |
|
54 | - add_filter( 'plugins_api', array( $this, 'plugins_api_filter' ), 10, 3 ); |
|
53 | + add_filter('pre_set_site_transient_update_plugins', array($this, 'check_update')); |
|
54 | + add_filter('plugins_api', array($this, 'plugins_api_filter'), 10, 3); |
|
55 | 55 | |
56 | - add_action( 'after_plugin_row_' . $this->name, array( $this, 'show_update_notification' ), 10, 2 ); |
|
56 | + add_action('after_plugin_row_'.$this->name, array($this, 'show_update_notification'), 10, 2); |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | /** |
@@ -69,34 +69,34 @@ discard block |
||
69 | 69 | * @param array $_transient_data Update array build by WordPress. |
70 | 70 | * @return array Modified update array with custom plugin data. |
71 | 71 | */ |
72 | - function check_update( $_transient_data ) { |
|
72 | + function check_update($_transient_data) { |
|
73 | 73 | |
74 | 74 | global $pagenow; |
75 | 75 | |
76 | - if( ! is_object( $_transient_data ) ) { |
|
76 | + if ( ! is_object($_transient_data)) { |
|
77 | 77 | $_transient_data = new stdClass; |
78 | 78 | } |
79 | 79 | |
80 | - if( 'plugins.php' == $pagenow && is_multisite() ) { |
|
80 | + if ('plugins.php' == $pagenow && is_multisite()) { |
|
81 | 81 | return $_transient_data; |
82 | 82 | } |
83 | 83 | |
84 | - if ( empty( $_transient_data->response ) || empty( $_transient_data->response[ $this->name ] ) ) { |
|
84 | + if (empty($_transient_data->response) || empty($_transient_data->response[$this->name])) { |
|
85 | 85 | |
86 | - $version_info = $this->api_request( 'plugin_latest_version', array( 'slug' => $this->slug ) ); |
|
86 | + $version_info = $this->api_request('plugin_latest_version', array('slug' => $this->slug)); |
|
87 | 87 | |
88 | - if ( false !== $version_info && is_object( $version_info ) && isset( $version_info->new_version ) ) { |
|
88 | + if (false !== $version_info && is_object($version_info) && isset($version_info->new_version)) { |
|
89 | 89 | |
90 | 90 | $this->did_check = true; |
91 | 91 | |
92 | - if( version_compare( $this->version, $version_info->new_version, '<' ) ) { |
|
92 | + if (version_compare($this->version, $version_info->new_version, '<')) { |
|
93 | 93 | |
94 | - $_transient_data->response[ $this->name ] = $version_info; |
|
94 | + $_transient_data->response[$this->name] = $version_info; |
|
95 | 95 | |
96 | 96 | } |
97 | 97 | |
98 | 98 | $_transient_data->last_checked = time(); |
99 | - $_transient_data->checked[ $this->name ] = $this->version; |
|
99 | + $_transient_data->checked[$this->name] = $this->version; |
|
100 | 100 | |
101 | 101 | } |
102 | 102 | |
@@ -111,84 +111,84 @@ discard block |
||
111 | 111 | * @param string $file |
112 | 112 | * @param array $plugin |
113 | 113 | */ |
114 | - public function show_update_notification( $file, $plugin ) { |
|
114 | + public function show_update_notification($file, $plugin) { |
|
115 | 115 | |
116 | - if( ! current_user_can( 'update_plugins' ) ) { |
|
116 | + if ( ! current_user_can('update_plugins')) { |
|
117 | 117 | return; |
118 | 118 | } |
119 | 119 | |
120 | - if( ! is_multisite() ) { |
|
120 | + if ( ! is_multisite()) { |
|
121 | 121 | return; |
122 | 122 | } |
123 | 123 | |
124 | - if ( $this->name != $file ) { |
|
124 | + if ($this->name != $file) { |
|
125 | 125 | return; |
126 | 126 | } |
127 | 127 | |
128 | 128 | // Remove our filter on the site transient |
129 | - remove_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ), 10 ); |
|
129 | + remove_filter('pre_set_site_transient_update_plugins', array($this, 'check_update'), 10); |
|
130 | 130 | |
131 | - $update_cache = get_site_transient( 'update_plugins' ); |
|
131 | + $update_cache = get_site_transient('update_plugins'); |
|
132 | 132 | |
133 | - if ( ! is_object( $update_cache ) || empty( $update_cache->response ) || empty( $update_cache->response[ $this->name ] ) ) { |
|
133 | + if ( ! is_object($update_cache) || empty($update_cache->response) || empty($update_cache->response[$this->name])) { |
|
134 | 134 | |
135 | - $cache_key = md5( 'edd_plugin_' .sanitize_key( $this->name ) . '_version_info' ); |
|
136 | - $version_info = get_transient( $cache_key ); |
|
135 | + $cache_key = md5('edd_plugin_'.sanitize_key($this->name).'_version_info'); |
|
136 | + $version_info = get_transient($cache_key); |
|
137 | 137 | |
138 | - if( false === $version_info ) { |
|
138 | + if (false === $version_info) { |
|
139 | 139 | |
140 | - $version_info = $this->api_request( 'plugin_latest_version', array( 'slug' => $this->slug ) ); |
|
140 | + $version_info = $this->api_request('plugin_latest_version', array('slug' => $this->slug)); |
|
141 | 141 | |
142 | - set_transient( $cache_key, $version_info, 3600 ); |
|
142 | + set_transient($cache_key, $version_info, 3600); |
|
143 | 143 | } |
144 | 144 | |
145 | 145 | |
146 | - if( ! is_object( $version_info ) ) { |
|
146 | + if ( ! is_object($version_info)) { |
|
147 | 147 | return; |
148 | 148 | } |
149 | 149 | |
150 | - if( version_compare( $this->version, $version_info->new_version, '<' ) ) { |
|
150 | + if (version_compare($this->version, $version_info->new_version, '<')) { |
|
151 | 151 | |
152 | - $update_cache->response[ $this->name ] = $version_info; |
|
152 | + $update_cache->response[$this->name] = $version_info; |
|
153 | 153 | |
154 | 154 | } |
155 | 155 | |
156 | 156 | $update_cache->last_checked = time(); |
157 | - $update_cache->checked[ $this->name ] = $this->version; |
|
157 | + $update_cache->checked[$this->name] = $this->version; |
|
158 | 158 | |
159 | - set_site_transient( 'update_plugins', $update_cache ); |
|
159 | + set_site_transient('update_plugins', $update_cache); |
|
160 | 160 | |
161 | 161 | } else { |
162 | 162 | |
163 | - $version_info = $update_cache->response[ $this->name ]; |
|
163 | + $version_info = $update_cache->response[$this->name]; |
|
164 | 164 | |
165 | 165 | } |
166 | 166 | |
167 | 167 | // Restore our filter |
168 | - add_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ) ); |
|
168 | + add_filter('pre_set_site_transient_update_plugins', array($this, 'check_update')); |
|
169 | 169 | |
170 | - if ( ! empty( $update_cache->response[ $this->name ] ) && version_compare( $this->version, $version_info->new_version, '<' ) ) { |
|
170 | + if ( ! empty($update_cache->response[$this->name]) && version_compare($this->version, $version_info->new_version, '<')) { |
|
171 | 171 | |
172 | 172 | // build a plugin list row, with update notification |
173 | - $wp_list_table = _get_list_table( 'WP_Plugins_List_Table' ); |
|
174 | - echo '<tr class="plugin-update-tr"><td colspan="' . $wp_list_table->get_column_count() . '" class="plugin-update colspanchange"><div class="update-message">'; |
|
173 | + $wp_list_table = _get_list_table('WP_Plugins_List_Table'); |
|
174 | + echo '<tr class="plugin-update-tr"><td colspan="'.$wp_list_table->get_column_count().'" class="plugin-update colspanchange"><div class="update-message">'; |
|
175 | 175 | |
176 | - $changelog_link = self_admin_url( 'index.php?edd_sl_action=view_plugin_changelog&plugin=' . $this->name . '&slug=' . $this->slug . '&TB_iframe=true&width=772&height=911' ); |
|
176 | + $changelog_link = self_admin_url('index.php?edd_sl_action=view_plugin_changelog&plugin='.$this->name.'&slug='.$this->slug.'&TB_iframe=true&width=772&height=911'); |
|
177 | 177 | |
178 | - if ( empty( $version_info->download_link ) ) { |
|
178 | + if (empty($version_info->download_link)) { |
|
179 | 179 | printf( |
180 | - __( 'There is a new version of %1$s available. <a target="_blank" class="thickbox" href="%2$s">View version %3$s details</a>.', 'edd' ), |
|
181 | - esc_html( $version_info->name ), |
|
182 | - esc_url( $changelog_link ), |
|
183 | - esc_html( $version_info->new_version ) |
|
180 | + __('There is a new version of %1$s available. <a target="_blank" class="thickbox" href="%2$s">View version %3$s details</a>.', 'edd'), |
|
181 | + esc_html($version_info->name), |
|
182 | + esc_url($changelog_link), |
|
183 | + esc_html($version_info->new_version) |
|
184 | 184 | ); |
185 | 185 | } else { |
186 | 186 | printf( |
187 | - __( 'There is a new version of %1$s available. <a target="_blank" class="thickbox" href="%2$s">View version %3$s details</a> or <a href="%4$s">update now</a>.', 'edd' ), |
|
188 | - esc_html( $version_info->name ), |
|
189 | - esc_url( $changelog_link ), |
|
190 | - esc_html( $version_info->new_version ), |
|
191 | - esc_url( wp_nonce_url( self_admin_url( 'update.php?action=upgrade-plugin&plugin=' ) . $this->name, 'upgrade-plugin_' . $this->name ) ) |
|
187 | + __('There is a new version of %1$s available. <a target="_blank" class="thickbox" href="%2$s">View version %3$s details</a> or <a href="%4$s">update now</a>.', 'edd'), |
|
188 | + esc_html($version_info->name), |
|
189 | + esc_url($changelog_link), |
|
190 | + esc_html($version_info->new_version), |
|
191 | + esc_url(wp_nonce_url(self_admin_url('update.php?action=upgrade-plugin&plugin=').$this->name, 'upgrade-plugin_'.$this->name)) |
|
192 | 192 | ); |
193 | 193 | } |
194 | 194 | |
@@ -207,16 +207,16 @@ discard block |
||
207 | 207 | * @param object $_args |
208 | 208 | * @return object $_data |
209 | 209 | */ |
210 | - function plugins_api_filter( $_data, $_action = '', $_args = null ) { |
|
210 | + function plugins_api_filter($_data, $_action = '', $_args = null) { |
|
211 | 211 | |
212 | 212 | |
213 | - if ( $_action != 'plugin_information' ) { |
|
213 | + if ($_action != 'plugin_information') { |
|
214 | 214 | |
215 | 215 | return $_data; |
216 | 216 | |
217 | 217 | } |
218 | 218 | |
219 | - if ( ! isset( $_args->slug ) || ( $_args->slug != $this->slug ) ) { |
|
219 | + if ( ! isset($_args->slug) || ($_args->slug != $this->slug)) { |
|
220 | 220 | |
221 | 221 | return $_data; |
222 | 222 | |
@@ -231,9 +231,9 @@ discard block |
||
231 | 231 | ) |
232 | 232 | ); |
233 | 233 | |
234 | - $api_response = $this->api_request( 'plugin_information', $to_send ); |
|
234 | + $api_response = $this->api_request('plugin_information', $to_send); |
|
235 | 235 | |
236 | - if ( false !== $api_response ) { |
|
236 | + if (false !== $api_response) { |
|
237 | 237 | $_data = $api_response; |
238 | 238 | } |
239 | 239 | |
@@ -248,9 +248,9 @@ discard block |
||
248 | 248 | * @param string $url |
249 | 249 | * @return object $array |
250 | 250 | */ |
251 | - function http_request_args( $args, $url ) { |
|
251 | + function http_request_args($args, $url) { |
|
252 | 252 | // If it is an https request and we are performing a package download, disable ssl verification |
253 | - if ( strpos( $url, 'https://' ) !== false && strpos( $url, 'edd_action=package_download' ) ) { |
|
253 | + if (strpos($url, 'https://') !== false && strpos($url, 'edd_action=package_download')) { |
|
254 | 254 | $args['sslverify'] = false; |
255 | 255 | } |
256 | 256 | return $args; |
@@ -267,40 +267,40 @@ discard block |
||
267 | 267 | * @param array $_data Parameters for the API action. |
268 | 268 | * @return false||object |
269 | 269 | */ |
270 | - private function api_request( $_action, $_data ) { |
|
270 | + private function api_request($_action, $_data) { |
|
271 | 271 | |
272 | 272 | global $wp_version; |
273 | 273 | |
274 | - $data = array_merge( $this->api_data, $_data ); |
|
274 | + $data = array_merge($this->api_data, $_data); |
|
275 | 275 | |
276 | - if ( $data['slug'] != $this->slug ) |
|
276 | + if ($data['slug'] != $this->slug) |
|
277 | 277 | return; |
278 | 278 | |
279 | - if ( empty( $data['license'] ) ) |
|
279 | + if (empty($data['license'])) |
|
280 | 280 | return; |
281 | 281 | |
282 | - if( $this->api_url == home_url() ) { |
|
282 | + if ($this->api_url == home_url()) { |
|
283 | 283 | return false; // Don't allow a plugin to ping itself |
284 | 284 | } |
285 | 285 | |
286 | 286 | $api_params = array( |
287 | 287 | 'edd_action' => 'get_version', |
288 | 288 | 'license' => $data['license'], |
289 | - 'item_name' => isset( $data['item_name'] ) ? $data['item_name'] : false, |
|
290 | - 'item_id' => isset( $data['item_id'] ) ? $data['item_id'] : false, |
|
289 | + 'item_name' => isset($data['item_name']) ? $data['item_name'] : false, |
|
290 | + 'item_id' => isset($data['item_id']) ? $data['item_id'] : false, |
|
291 | 291 | 'slug' => $data['slug'], |
292 | 292 | 'author' => $data['author'], |
293 | 293 | 'url' => home_url() |
294 | 294 | ); |
295 | 295 | |
296 | - $request = wp_remote_post( $this->api_url, array( 'timeout' => 15, 'sslverify' => false, 'body' => $api_params ) ); |
|
296 | + $request = wp_remote_post($this->api_url, array('timeout' => 15, 'sslverify' => false, 'body' => $api_params)); |
|
297 | 297 | |
298 | - if ( ! is_wp_error( $request ) ) { |
|
299 | - $request = json_decode( wp_remote_retrieve_body( $request ) ); |
|
298 | + if ( ! is_wp_error($request)) { |
|
299 | + $request = json_decode(wp_remote_retrieve_body($request)); |
|
300 | 300 | } |
301 | 301 | |
302 | - if ( $request && isset( $request->sections ) ) { |
|
303 | - $request->sections = maybe_unserialize( $request->sections ); |
|
302 | + if ($request && isset($request->sections)) { |
|
303 | + $request->sections = maybe_unserialize($request->sections); |
|
304 | 304 | } else { |
305 | 305 | $request = false; |
306 | 306 | } |
@@ -311,26 +311,26 @@ discard block |
||
311 | 311 | public function show_changelog() { |
312 | 312 | |
313 | 313 | |
314 | - if( empty( $_REQUEST['edd_sl_action'] ) || 'view_plugin_changelog' != $_REQUEST['edd_sl_action'] ) { |
|
314 | + if (empty($_REQUEST['edd_sl_action']) || 'view_plugin_changelog' != $_REQUEST['edd_sl_action']) { |
|
315 | 315 | return; |
316 | 316 | } |
317 | 317 | |
318 | - if( empty( $_REQUEST['plugin'] ) ) { |
|
318 | + if (empty($_REQUEST['plugin'])) { |
|
319 | 319 | return; |
320 | 320 | } |
321 | 321 | |
322 | - if( empty( $_REQUEST['slug'] ) ) { |
|
322 | + if (empty($_REQUEST['slug'])) { |
|
323 | 323 | return; |
324 | 324 | } |
325 | 325 | |
326 | - if( ! current_user_can( 'update_plugins' ) ) { |
|
327 | - wp_die( __( 'You do not have permission to install plugin updates', 'edd' ), __( 'Error', 'edd' ), array( 'response' => 403 ) ); |
|
326 | + if ( ! current_user_can('update_plugins')) { |
|
327 | + wp_die(__('You do not have permission to install plugin updates', 'edd'), __('Error', 'edd'), array('response' => 403)); |
|
328 | 328 | } |
329 | 329 | |
330 | - $response = $this->api_request( 'plugin_latest_version', array( 'slug' => $_REQUEST['slug'] ) ); |
|
330 | + $response = $this->api_request('plugin_latest_version', array('slug' => $_REQUEST['slug'])); |
|
331 | 331 | |
332 | - if( $response && isset( $response->sections['changelog'] ) ) { |
|
333 | - echo '<div style="background:#fff;padding:10px;">' . $response->sections['changelog'] . '</div>'; |
|
332 | + if ($response && isset($response->sections['changelog'])) { |
|
333 | + echo '<div style="background:#fff;padding:10px;">'.$response->sections['changelog'].'</div>'; |
|
334 | 334 | } |
335 | 335 | |
336 | 336 |
@@ -4,7 +4,9 @@ discard block |
||
4 | 4 | //set_site_transient( 'update_plugins', null ); |
5 | 5 | |
6 | 6 | // Exit if accessed directly |
7 | -if ( ! defined( 'ABSPATH' ) ) exit; |
|
7 | +if ( ! defined( 'ABSPATH' ) ) { |
|
8 | + exit; |
|
9 | +} |
|
8 | 10 | |
9 | 11 | /** |
10 | 12 | * Allows plugins to use their own update API. |
@@ -273,11 +275,13 @@ discard block |
||
273 | 275 | |
274 | 276 | $data = array_merge( $this->api_data, $_data ); |
275 | 277 | |
276 | - if ( $data['slug'] != $this->slug ) |
|
277 | - return; |
|
278 | + if ( $data['slug'] != $this->slug ) { |
|
279 | + return; |
|
280 | + } |
|
278 | 281 | |
279 | - if ( empty( $data['license'] ) ) |
|
280 | - return; |
|
282 | + if ( empty( $data['license'] ) ) { |
|
283 | + return; |
|
284 | + } |
|
281 | 285 | |
282 | 286 | if( $this->api_url == home_url() ) { |
283 | 287 | return false; // Don't allow a plugin to ping itself |
@@ -321,7 +321,7 @@ |
||
321 | 321 | * |
322 | 322 | * @param int $post_id Download (Post) ID |
323 | 323 | * |
324 | - * @return void |
|
324 | + * @return null|integer |
|
325 | 325 | */ |
326 | 326 | function give_price_save_quick_edit( $post_id ) { |
327 | 327 | if ( ! isset( $_POST['post_type'] ) || 'give_forms' !== $_POST['post_type'] ) { |
@@ -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 | |
@@ -27,34 +27,34 @@ discard block |
||
27 | 27 | * @return array $form_columns Updated array of forms columns |
28 | 28 | * Post Type List Table |
29 | 29 | */ |
30 | -function give_form_columns( $give_form_columns ) { |
|
30 | +function give_form_columns($give_form_columns) { |
|
31 | 31 | |
32 | 32 | //Standard columns |
33 | 33 | $give_form_columns = array( |
34 | 34 | 'cb' => '<input type="checkbox"/>', |
35 | - 'title' => __( 'Name', 'give' ), |
|
36 | - 'form_category' => __( 'Categories', 'give' ), |
|
37 | - 'form_tag' => __( 'Tags', 'give' ), |
|
38 | - 'price' => __( 'Price', 'give' ), |
|
39 | - 'goal' => __( 'Goal', 'give' ), |
|
40 | - 'donations' => __( 'Donations', 'give' ), |
|
41 | - 'earnings' => __( 'Income', 'give' ), |
|
42 | - 'shortcode' => __( 'Shortcode', 'give' ), |
|
43 | - 'date' => __( 'Date', 'give' ) |
|
35 | + 'title' => __('Name', 'give'), |
|
36 | + 'form_category' => __('Categories', 'give'), |
|
37 | + 'form_tag' => __('Tags', 'give'), |
|
38 | + 'price' => __('Price', 'give'), |
|
39 | + 'goal' => __('Goal', 'give'), |
|
40 | + 'donations' => __('Donations', 'give'), |
|
41 | + 'earnings' => __('Income', 'give'), |
|
42 | + 'shortcode' => __('Shortcode', 'give'), |
|
43 | + 'date' => __('Date', 'give') |
|
44 | 44 | ); |
45 | 45 | |
46 | 46 | //Does the user want categories / tags? |
47 | - if ( give_get_option( 'enable_categories' ) !== 'on' ) { |
|
48 | - unset( $give_form_columns['form_category'] ); |
|
47 | + if (give_get_option('enable_categories') !== 'on') { |
|
48 | + unset($give_form_columns['form_category']); |
|
49 | 49 | } |
50 | - if ( give_get_option( 'enable_tags' ) !== 'on' ) { |
|
51 | - unset( $give_form_columns['form_tag'] ); |
|
50 | + if (give_get_option('enable_tags') !== 'on') { |
|
51 | + unset($give_form_columns['form_tag']); |
|
52 | 52 | } |
53 | 53 | |
54 | - return apply_filters( 'give_forms_columns', $give_form_columns ); |
|
54 | + return apply_filters('give_forms_columns', $give_form_columns); |
|
55 | 55 | } |
56 | 56 | |
57 | -add_filter( 'manage_edit-give_forms_columns', 'give_form_columns' ); |
|
57 | +add_filter('manage_edit-give_forms_columns', 'give_form_columns'); |
|
58 | 58 | |
59 | 59 | /** |
60 | 60 | * Render Give Form Columns |
@@ -66,67 +66,67 @@ discard block |
||
66 | 66 | * |
67 | 67 | * @return void |
68 | 68 | */ |
69 | -function give_render_form_columns( $column_name, $post_id ) { |
|
70 | - if ( get_post_type( $post_id ) == 'give_forms' ) { |
|
69 | +function give_render_form_columns($column_name, $post_id) { |
|
70 | + if (get_post_type($post_id) == 'give_forms') { |
|
71 | 71 | global $give_options; |
72 | 72 | |
73 | - $style = isset( $give_options['button_style'] ) ? $give_options['button_style'] : 'button'; |
|
74 | - $color = isset( $give_options['checkout_color'] ) ? $give_options['checkout_color'] : 'blue'; |
|
75 | - $color = ( $color == 'inherit' ) ? '' : $color; |
|
73 | + $style = isset($give_options['button_style']) ? $give_options['button_style'] : 'button'; |
|
74 | + $color = isset($give_options['checkout_color']) ? $give_options['checkout_color'] : 'blue'; |
|
75 | + $color = ($color == 'inherit') ? '' : $color; |
|
76 | 76 | |
77 | - $purchase_text = ! empty( $give_options['add_to_cart_text'] ) ? $give_options['add_to_cart_text'] : __( 'Purchase', 'give' ); |
|
77 | + $purchase_text = ! empty($give_options['add_to_cart_text']) ? $give_options['add_to_cart_text'] : __('Purchase', 'give'); |
|
78 | 78 | |
79 | - switch ( $column_name ) { |
|
79 | + switch ($column_name) { |
|
80 | 80 | case 'form_category': |
81 | - echo get_the_term_list( $post_id, 'give_forms_category', '', ', ', '' ); |
|
81 | + echo get_the_term_list($post_id, 'give_forms_category', '', ', ', ''); |
|
82 | 82 | break; |
83 | 83 | case 'form_tag': |
84 | - echo get_the_term_list( $post_id, 'give_forms_tag', '', ', ', '' ); |
|
84 | + echo get_the_term_list($post_id, 'give_forms_tag', '', ', ', ''); |
|
85 | 85 | break; |
86 | 86 | case 'price': |
87 | - if ( give_has_variable_prices( $post_id ) ) { |
|
88 | - echo give_price_range( $post_id ); |
|
87 | + if (give_has_variable_prices($post_id)) { |
|
88 | + echo give_price_range($post_id); |
|
89 | 89 | } else { |
90 | - echo give_price( $post_id, false ); |
|
91 | - echo '<input type="hidden" class="formprice-' . $post_id . '" value="' . give_get_form_price( $post_id ) . '" />'; |
|
90 | + echo give_price($post_id, false); |
|
91 | + echo '<input type="hidden" class="formprice-'.$post_id.'" value="'.give_get_form_price($post_id).'" />'; |
|
92 | 92 | } |
93 | 93 | break; |
94 | 94 | case 'goal': |
95 | - $goal_option = get_post_meta( $post_id, '_give_goal_option', true ); |
|
96 | - if ( ! empty( $goal_option ) && $goal_option === 'yes' ) { |
|
97 | - echo give_goal( $post_id, false ); |
|
95 | + $goal_option = get_post_meta($post_id, '_give_goal_option', true); |
|
96 | + if ( ! empty($goal_option) && $goal_option === 'yes') { |
|
97 | + echo give_goal($post_id, false); |
|
98 | 98 | } else { |
99 | - echo __( 'No Goal Set', 'give' ); |
|
99 | + echo __('No Goal Set', 'give'); |
|
100 | 100 | } |
101 | 101 | |
102 | - echo '<input type="hidden" class="formgoal-' . $post_id . '" value="' . give_get_form_goal( $post_id ) . '" />'; |
|
102 | + echo '<input type="hidden" class="formgoal-'.$post_id.'" value="'.give_get_form_goal($post_id).'" />'; |
|
103 | 103 | break; |
104 | 104 | case 'donations': |
105 | - if ( current_user_can( 'view_give_forms_stats', $post_id ) ) { |
|
106 | - echo '<a href="' . esc_url( admin_url( 'edit.php?post_type=give_forms&page=give-reports&tab=logs&view=sales&form=' . $post_id ) ) . '">'; |
|
107 | - echo give_get_form_sales_stats( $post_id ); |
|
105 | + if (current_user_can('view_give_forms_stats', $post_id)) { |
|
106 | + echo '<a href="'.esc_url(admin_url('edit.php?post_type=give_forms&page=give-reports&tab=logs&view=sales&form='.$post_id)).'">'; |
|
107 | + echo give_get_form_sales_stats($post_id); |
|
108 | 108 | echo '</a>'; |
109 | 109 | } else { |
110 | 110 | echo '-'; |
111 | 111 | } |
112 | 112 | break; |
113 | 113 | case 'earnings': |
114 | - if ( current_user_can( 'view_give_forms_stats', $post_id ) ) { |
|
115 | - echo '<a href="' . esc_url( admin_url( 'edit.php?post_type=give_forms&page=give-reports&view=forms&form-id=' . $post_id ) ) . '">'; |
|
116 | - echo give_currency_filter( give_format_amount( give_get_form_earnings_stats( $post_id ) ) ); |
|
114 | + if (current_user_can('view_give_forms_stats', $post_id)) { |
|
115 | + echo '<a href="'.esc_url(admin_url('edit.php?post_type=give_forms&page=give-reports&view=forms&form-id='.$post_id)).'">'; |
|
116 | + echo give_currency_filter(give_format_amount(give_get_form_earnings_stats($post_id))); |
|
117 | 117 | echo '</a>'; |
118 | 118 | } else { |
119 | 119 | echo '-'; |
120 | 120 | } |
121 | 121 | break; |
122 | 122 | case 'shortcode': |
123 | - echo '<input onclick="this.setSelectionRange(0, this.value.length)" type="text" class="shortcode-input" readonly="" value="[give_form id="' . absint( $post_id ) . '"]">'; |
|
123 | + echo '<input onclick="this.setSelectionRange(0, this.value.length)" type="text" class="shortcode-input" readonly="" value="[give_form id="'.absint($post_id).'"]">'; |
|
124 | 124 | break; |
125 | 125 | } |
126 | 126 | } |
127 | 127 | } |
128 | 128 | |
129 | -add_action( 'manage_posts_custom_column', 'give_render_form_columns', 10, 2 ); |
|
129 | +add_action('manage_posts_custom_column', 'give_render_form_columns', 10, 2); |
|
130 | 130 | |
131 | 131 | /** |
132 | 132 | * Registers the sortable columns in the list table |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | * |
138 | 138 | * @return array $columns Array of sortable columns |
139 | 139 | */ |
140 | -function give_sortable_form_columns( $columns ) { |
|
140 | +function give_sortable_form_columns($columns) { |
|
141 | 141 | $columns['price'] = 'price'; |
142 | 142 | $columns['sales'] = 'sales'; |
143 | 143 | $columns['earnings'] = 'earnings'; |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | return $columns; |
147 | 147 | } |
148 | 148 | |
149 | -add_filter( 'manage_edit-give_forms_sortable_columns', 'give_sortable_form_columns' ); |
|
149 | +add_filter('manage_edit-give_forms_sortable_columns', 'give_sortable_form_columns'); |
|
150 | 150 | |
151 | 151 | /** |
152 | 152 | * Sorts Columns in the Forms List Table |
@@ -157,11 +157,11 @@ discard block |
||
157 | 157 | * |
158 | 158 | * @return array $vars Array of all the sort variables |
159 | 159 | */ |
160 | -function give_sort_forms( $vars ) { |
|
160 | +function give_sort_forms($vars) { |
|
161 | 161 | // Check if we're viewing the "give_forms" post type |
162 | - if ( isset( $vars['post_type'] ) && 'give_forms' == $vars['post_type'] ) { |
|
162 | + if (isset($vars['post_type']) && 'give_forms' == $vars['post_type']) { |
|
163 | 163 | // Check if 'orderby' is set to "sales" |
164 | - if ( isset( $vars['orderby'] ) && 'sales' == $vars['orderby'] ) { |
|
164 | + if (isset($vars['orderby']) && 'sales' == $vars['orderby']) { |
|
165 | 165 | $vars = array_merge( |
166 | 166 | $vars, |
167 | 167 | array( |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | } |
173 | 173 | |
174 | 174 | // Check if "orderby" is set to "earnings" |
175 | - if ( isset( $vars['orderby'] ) && 'earnings' == $vars['orderby'] ) { |
|
175 | + if (isset($vars['orderby']) && 'earnings' == $vars['orderby']) { |
|
176 | 176 | $vars = array_merge( |
177 | 177 | $vars, |
178 | 178 | array( |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | } |
184 | 184 | |
185 | 185 | // Check if "orderby" is set to "price" |
186 | - if ( isset( $vars['orderby'] ) && 'price' == $vars['orderby'] ) { |
|
186 | + if (isset($vars['orderby']) && 'price' == $vars['orderby']) { |
|
187 | 187 | $vars = array_merge( |
188 | 188 | $vars, |
189 | 189 | array( |
@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | } |
195 | 195 | |
196 | 196 | // Check if "orderby" is set to "goal" |
197 | - if ( isset( $vars['orderby'] ) && 'goal' == $vars['orderby'] ) { |
|
197 | + if (isset($vars['orderby']) && 'goal' == $vars['orderby']) { |
|
198 | 198 | $vars = array_merge( |
199 | 199 | $vars, |
200 | 200 | array( |
@@ -217,16 +217,16 @@ discard block |
||
217 | 217 | * |
218 | 218 | * @return array Array of all sort variables |
219 | 219 | */ |
220 | -function give_filter_forms( $vars ) { |
|
221 | - if ( isset( $vars['post_type'] ) && 'give_forms' == $vars['post_type'] ) { |
|
220 | +function give_filter_forms($vars) { |
|
221 | + if (isset($vars['post_type']) && 'give_forms' == $vars['post_type']) { |
|
222 | 222 | |
223 | 223 | // If an author ID was passed, use it |
224 | - if ( isset( $_REQUEST['author'] ) && ! current_user_can( 'view_give_reports' ) ) { |
|
224 | + if (isset($_REQUEST['author']) && ! current_user_can('view_give_reports')) { |
|
225 | 225 | |
226 | 226 | $author_id = $_REQUEST['author']; |
227 | - if ( (int) $author_id !== get_current_user_id() ) { |
|
227 | + if ((int) $author_id !== get_current_user_id()) { |
|
228 | 228 | // Tried to view the products of another person, sorry |
229 | - wp_die( __( 'You do not have permission to view this data.', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
229 | + wp_die(__('You do not have permission to view this data.', 'give'), __('Error', 'give'), array('response' => 403)); |
|
230 | 230 | } |
231 | 231 | $vars = array_merge( |
232 | 232 | $vars, |
@@ -251,11 +251,11 @@ discard block |
||
251 | 251 | * @return void |
252 | 252 | */ |
253 | 253 | function give_forms_load() { |
254 | - add_filter( 'request', 'give_sort_forms' ); |
|
255 | - add_filter( 'request', 'give_filter_forms' ); |
|
254 | + add_filter('request', 'give_sort_forms'); |
|
255 | + add_filter('request', 'give_filter_forms'); |
|
256 | 256 | } |
257 | 257 | |
258 | -add_action( 'load-edit.php', 'give_forms_load', 9999 ); |
|
258 | +add_action('load-edit.php', 'give_forms_load', 9999); |
|
259 | 259 | |
260 | 260 | /** |
261 | 261 | * Remove Forms Month Filter |
@@ -269,17 +269,17 @@ discard block |
||
269 | 269 | * @global $typenow The post type we are viewing |
270 | 270 | * @return array Empty array disables the dropdown |
271 | 271 | */ |
272 | -function give_remove_month_filter( $dates ) { |
|
272 | +function give_remove_month_filter($dates) { |
|
273 | 273 | global $typenow; |
274 | 274 | |
275 | - if ( $typenow == 'give_forms' ) { |
|
275 | + if ($typenow == 'give_forms') { |
|
276 | 276 | $dates = array(); |
277 | 277 | } |
278 | 278 | |
279 | 279 | return $dates; |
280 | 280 | } |
281 | 281 | |
282 | -add_filter( 'months_dropdown_results', 'give_remove_month_filter', 99 ); |
|
282 | +add_filter('months_dropdown_results', 'give_remove_month_filter', 99); |
|
283 | 283 | |
284 | 284 | /** |
285 | 285 | * Adds price field to Quick Edit options |
@@ -291,16 +291,16 @@ discard block |
||
291 | 291 | * |
292 | 292 | * @return void |
293 | 293 | */ |
294 | -function give_price_field_quick_edit( $column_name, $post_type ) { |
|
295 | - if ( $column_name != 'price' || $post_type != 'give_forms' ) { |
|
294 | +function give_price_field_quick_edit($column_name, $post_type) { |
|
295 | + if ($column_name != 'price' || $post_type != 'give_forms') { |
|
296 | 296 | return; |
297 | 297 | } |
298 | 298 | ?> |
299 | 299 | <fieldset class="inline-edit-col-left"> |
300 | 300 | <div id="give-give-data" class="inline-edit-col"> |
301 | - <h4><?php echo sprintf( __( '%s Configuration', 'give' ), give_get_forms_label_singular() ); ?></h4> |
|
301 | + <h4><?php echo sprintf(__('%s Configuration', 'give'), give_get_forms_label_singular()); ?></h4> |
|
302 | 302 | <label> |
303 | - <span class="title"><?php _e( 'Price', 'give' ); ?></span> |
|
303 | + <span class="title"><?php _e('Price', 'give'); ?></span> |
|
304 | 304 | <span class="input-text-wrap"> |
305 | 305 | <input type="text" name="_give_regprice" class="text regprice" /> |
306 | 306 | </span> |
@@ -311,8 +311,8 @@ discard block |
||
311 | 311 | <?php |
312 | 312 | } |
313 | 313 | |
314 | -add_action( 'quick_edit_custom_box', 'give_price_field_quick_edit', 10, 2 ); |
|
315 | -add_action( 'bulk_edit_custom_box', 'give_price_field_quick_edit', 10, 2 ); |
|
314 | +add_action('quick_edit_custom_box', 'give_price_field_quick_edit', 10, 2); |
|
315 | +add_action('bulk_edit_custom_box', 'give_price_field_quick_edit', 10, 2); |
|
316 | 316 | |
317 | 317 | /** |
318 | 318 | * Updates price when saving post |
@@ -323,23 +323,23 @@ discard block |
||
323 | 323 | * |
324 | 324 | * @return void |
325 | 325 | */ |
326 | -function give_price_save_quick_edit( $post_id ) { |
|
327 | - if ( ! isset( $_POST['post_type'] ) || 'give_forms' !== $_POST['post_type'] ) { |
|
326 | +function give_price_save_quick_edit($post_id) { |
|
327 | + if ( ! isset($_POST['post_type']) || 'give_forms' !== $_POST['post_type']) { |
|
328 | 328 | return; |
329 | 329 | } |
330 | - if ( ! current_user_can( 'edit_post', $post_id ) ) { |
|
330 | + if ( ! current_user_can('edit_post', $post_id)) { |
|
331 | 331 | return $post_id; |
332 | 332 | } |
333 | - if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) { |
|
333 | + if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) { |
|
334 | 334 | return $post_id; |
335 | 335 | } |
336 | 336 | |
337 | - if ( isset( $_REQUEST['_give_regprice'] ) ) { |
|
338 | - update_post_meta( $post_id, '_give_set_price', strip_tags( stripslashes( $_REQUEST['_give_regprice'] ) ) ); |
|
337 | + if (isset($_REQUEST['_give_regprice'])) { |
|
338 | + update_post_meta($post_id, '_give_set_price', strip_tags(stripslashes($_REQUEST['_give_regprice']))); |
|
339 | 339 | } |
340 | 340 | } |
341 | 341 | |
342 | -add_action( 'save_post', 'give_price_save_quick_edit' ); |
|
342 | +add_action('save_post', 'give_price_save_quick_edit'); |
|
343 | 343 | |
344 | 344 | /** |
345 | 345 | * Process bulk edit actions via AJAX |
@@ -349,18 +349,18 @@ discard block |
||
349 | 349 | */ |
350 | 350 | function give_save_bulk_edit() { |
351 | 351 | |
352 | - $post_ids = ( isset( $_POST['post_ids'] ) && ! empty( $_POST['post_ids'] ) ) ? $_POST['post_ids'] : array(); |
|
352 | + $post_ids = (isset($_POST['post_ids']) && ! empty($_POST['post_ids'])) ? $_POST['post_ids'] : array(); |
|
353 | 353 | |
354 | - if ( ! empty( $post_ids ) && is_array( $post_ids ) ) { |
|
355 | - $price = isset( $_POST['price'] ) ? strip_tags( stripslashes( $_POST['price'] ) ) : 0; |
|
356 | - foreach ( $post_ids as $post_id ) { |
|
354 | + if ( ! empty($post_ids) && is_array($post_ids)) { |
|
355 | + $price = isset($_POST['price']) ? strip_tags(stripslashes($_POST['price'])) : 0; |
|
356 | + foreach ($post_ids as $post_id) { |
|
357 | 357 | |
358 | - if ( ! current_user_can( 'edit_post', $post_id ) ) { |
|
358 | + if ( ! current_user_can('edit_post', $post_id)) { |
|
359 | 359 | continue; |
360 | 360 | } |
361 | 361 | |
362 | - if ( ! empty( $price ) ) { |
|
363 | - update_post_meta( $post_id, '_give_set_price', give_sanitize_amount( $price ) ); |
|
362 | + if ( ! empty($price)) { |
|
363 | + update_post_meta($post_id, '_give_set_price', give_sanitize_amount($price)); |
|
364 | 364 | } |
365 | 365 | } |
366 | 366 | } |
@@ -368,4 +368,4 @@ discard block |
||
368 | 368 | die(); |
369 | 369 | } |
370 | 370 | |
371 | -add_action( 'wp_ajax_give_save_bulk_edit', 'give_save_bulk_edit' ); |
|
371 | +add_action('wp_ajax_give_save_bulk_edit', 'give_save_bulk_edit'); |
@@ -297,7 +297,6 @@ |
||
297 | 297 | * |
298 | 298 | * @since 1.0 |
299 | 299 | * |
300 | - * @param array $data Arguments passed |
|
301 | 300 | * |
302 | 301 | * @return void |
303 | 302 | */ |
@@ -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 | |
@@ -26,108 +26,108 @@ discard block |
||
26 | 26 | * @return void |
27 | 27 | * |
28 | 28 | */ |
29 | -function give_update_payment_details( $data ) { |
|
29 | +function give_update_payment_details($data) { |
|
30 | 30 | |
31 | - if ( ! current_user_can( 'edit_give_payments', $data['give_payment_id'] ) ) { |
|
32 | - wp_die( __( 'You do not have permission to edit this payment record', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
31 | + if ( ! current_user_can('edit_give_payments', $data['give_payment_id'])) { |
|
32 | + wp_die(__('You do not have permission to edit this payment record', 'give'), __('Error', 'give'), array('response' => 403)); |
|
33 | 33 | } |
34 | 34 | |
35 | - check_admin_referer( 'give_update_payment_details_nonce' ); |
|
35 | + check_admin_referer('give_update_payment_details_nonce'); |
|
36 | 36 | |
37 | 37 | // Retrieve the payment ID |
38 | - $payment_id = absint( $data['give_payment_id'] ); |
|
38 | + $payment_id = absint($data['give_payment_id']); |
|
39 | 39 | |
40 | 40 | // Retrieve existing payment meta |
41 | - $meta = give_get_payment_meta( $payment_id ); |
|
42 | - $user_info = give_get_payment_meta_user_info( $payment_id ); |
|
41 | + $meta = give_get_payment_meta($payment_id); |
|
42 | + $user_info = give_get_payment_meta_user_info($payment_id); |
|
43 | 43 | |
44 | 44 | $status = $data['give-payment-status']; |
45 | - $user_id = isset( $data['give-payment-user-id'] ) ? intval( $data['give-payment-user-id'] ) : ''; |
|
46 | - $date = sanitize_text_field( $data['give-payment-date'] ); |
|
47 | - $hour = sanitize_text_field( $data['give-payment-time-hour'] ); |
|
45 | + $user_id = isset($data['give-payment-user-id']) ? intval($data['give-payment-user-id']) : ''; |
|
46 | + $date = sanitize_text_field($data['give-payment-date']); |
|
47 | + $hour = sanitize_text_field($data['give-payment-time-hour']); |
|
48 | 48 | $form_id = give_get_payment_form_id($payment_id); |
49 | 49 | |
50 | 50 | // Restrict to our high and low |
51 | - if ( $hour > 23 ) { |
|
51 | + if ($hour > 23) { |
|
52 | 52 | $hour = 23; |
53 | - } elseif ( $hour < 0 ) { |
|
53 | + } elseif ($hour < 0) { |
|
54 | 54 | $hour = 00; |
55 | 55 | } |
56 | 56 | |
57 | - $minute = sanitize_text_field( $data['give-payment-time-min'] ); |
|
57 | + $minute = sanitize_text_field($data['give-payment-time-min']); |
|
58 | 58 | |
59 | 59 | // Restrict to our high and low |
60 | - if ( $minute > 59 ) { |
|
60 | + if ($minute > 59) { |
|
61 | 61 | $minute = 59; |
62 | - } elseif ( $minute < 0 ) { |
|
62 | + } elseif ($minute < 0) { |
|
63 | 63 | $minute = 00; |
64 | 64 | } |
65 | 65 | |
66 | - $address = array_map( 'trim', $data['give-payment-address'][0] ); |
|
67 | - $date = date( 'Y-m-d', strtotime( $date ) ) . ' ' . $hour . ':' . $minute . ':00'; |
|
68 | - $curr_total = give_sanitize_amount( give_get_payment_amount( $payment_id ) ); |
|
69 | - $new_total = give_sanitize_amount( $_POST['give-payment-total'] ); |
|
70 | - $curr_customer_id = sanitize_text_field( $data['give-current-customer'] ); |
|
71 | - $new_customer_id = sanitize_text_field( $data['customer-id'] ); |
|
66 | + $address = array_map('trim', $data['give-payment-address'][0]); |
|
67 | + $date = date('Y-m-d', strtotime($date)).' '.$hour.':'.$minute.':00'; |
|
68 | + $curr_total = give_sanitize_amount(give_get_payment_amount($payment_id)); |
|
69 | + $new_total = give_sanitize_amount($_POST['give-payment-total']); |
|
70 | + $curr_customer_id = sanitize_text_field($data['give-current-customer']); |
|
71 | + $new_customer_id = sanitize_text_field($data['customer-id']); |
|
72 | 72 | |
73 | - do_action( 'give_update_edited_purchase', $payment_id ); |
|
73 | + do_action('give_update_edited_purchase', $payment_id); |
|
74 | 74 | |
75 | 75 | // Update main payment record |
76 | - $updated = wp_update_post( array( |
|
76 | + $updated = wp_update_post(array( |
|
77 | 77 | 'ID' => $payment_id, |
78 | 78 | 'post_date' => $date |
79 | - ) ); |
|
79 | + )); |
|
80 | 80 | |
81 | - if ( 0 === $updated ) { |
|
82 | - wp_die( __( 'Error Updating Payment', 'give' ), __( 'Error', 'give' ), array( 'response' => 400 ) ); |
|
81 | + if (0 === $updated) { |
|
82 | + wp_die(__('Error Updating Payment', 'give'), __('Error', 'give'), array('response' => 400)); |
|
83 | 83 | } |
84 | 84 | |
85 | 85 | $customer_changed = false; |
86 | 86 | |
87 | - if ( isset( $data['give-new-customer'] ) && $data['give-new-customer'] == '1' ) { |
|
87 | + if (isset($data['give-new-customer']) && $data['give-new-customer'] == '1') { |
|
88 | 88 | |
89 | - $email = isset( $data['give-new-customer-email'] ) ? sanitize_text_field( $data['give-new-customer-email'] ) : ''; |
|
90 | - $names = isset( $data['give-new-customer-name'] ) ? sanitize_text_field( $data['give-new-customer-name'] ) : ''; |
|
89 | + $email = isset($data['give-new-customer-email']) ? sanitize_text_field($data['give-new-customer-email']) : ''; |
|
90 | + $names = isset($data['give-new-customer-name']) ? sanitize_text_field($data['give-new-customer-name']) : ''; |
|
91 | 91 | |
92 | - if ( empty( $email ) || empty( $names ) ) { |
|
93 | - wp_die( __( 'New Customers require a name and email address', 'give' ) ); |
|
92 | + if (empty($email) || empty($names)) { |
|
93 | + wp_die(__('New Customers require a name and email address', 'give')); |
|
94 | 94 | } |
95 | 95 | |
96 | - $customer = new Give_Customer( $email ); |
|
97 | - if ( empty( $customer->id ) ) { |
|
98 | - $customer_data = array( 'name' => $names, 'email' => $email ); |
|
99 | - $user_id = email_exists( $email ); |
|
100 | - if ( false !== $user_id ) { |
|
96 | + $customer = new Give_Customer($email); |
|
97 | + if (empty($customer->id)) { |
|
98 | + $customer_data = array('name' => $names, 'email' => $email); |
|
99 | + $user_id = email_exists($email); |
|
100 | + if (false !== $user_id) { |
|
101 | 101 | $customer_data['user_id'] = $user_id; |
102 | 102 | } |
103 | 103 | |
104 | - if ( ! $customer->create( $customer_data ) ) { |
|
104 | + if ( ! $customer->create($customer_data)) { |
|
105 | 105 | // Failed to crete the new customer, assume the previous customer |
106 | 106 | $customer_changed = false; |
107 | - $customer = new Give_Customer( $curr_customer_id ); |
|
108 | - give_set_error( 'give-payment-new-customer-fail', __( 'Error creating new customer', 'give' ) ); |
|
107 | + $customer = new Give_Customer($curr_customer_id); |
|
108 | + give_set_error('give-payment-new-customer-fail', __('Error creating new customer', 'give')); |
|
109 | 109 | } |
110 | 110 | } |
111 | 111 | |
112 | 112 | $new_customer_id = $customer->id; |
113 | 113 | |
114 | - $previous_customer = new Give_Customer( $curr_customer_id ); |
|
114 | + $previous_customer = new Give_Customer($curr_customer_id); |
|
115 | 115 | |
116 | 116 | $customer_changed = true; |
117 | 117 | |
118 | - } elseif ( $curr_customer_id !== $new_customer_id ) { |
|
118 | + } elseif ($curr_customer_id !== $new_customer_id) { |
|
119 | 119 | |
120 | - $customer = new Give_Customer( $new_customer_id ); |
|
120 | + $customer = new Give_Customer($new_customer_id); |
|
121 | 121 | $email = $customer->email; |
122 | 122 | $names = $customer->name; |
123 | 123 | |
124 | - $previous_customer = new Give_Customer( $curr_customer_id ); |
|
124 | + $previous_customer = new Give_Customer($curr_customer_id); |
|
125 | 125 | |
126 | 126 | $customer_changed = true; |
127 | 127 | |
128 | 128 | } else { |
129 | 129 | |
130 | - $customer = new Give_Customer( $curr_customer_id ); |
|
130 | + $customer = new Give_Customer($curr_customer_id); |
|
131 | 131 | $email = $customer->email; |
132 | 132 | $names = $customer->name; |
133 | 133 | |
@@ -135,31 +135,31 @@ discard block |
||
135 | 135 | |
136 | 136 | |
137 | 137 | // Setup first and last name from input values |
138 | - $names = explode( ' ', $names ); |
|
139 | - $first_name = ! empty( $names[0] ) ? $names[0] : ''; |
|
138 | + $names = explode(' ', $names); |
|
139 | + $first_name = ! empty($names[0]) ? $names[0] : ''; |
|
140 | 140 | $last_name = ''; |
141 | - if ( ! empty( $names[1] ) ) { |
|
142 | - unset( $names[0] ); |
|
143 | - $last_name = implode( ' ', $names ); |
|
141 | + if ( ! empty($names[1])) { |
|
142 | + unset($names[0]); |
|
143 | + $last_name = implode(' ', $names); |
|
144 | 144 | } |
145 | 145 | |
146 | - if ( $customer_changed ) { |
|
146 | + if ($customer_changed) { |
|
147 | 147 | |
148 | 148 | // Remove the stats and payment from the previous customer and attach it to the new customer |
149 | - $previous_customer->remove_payment( $payment_id, false ); |
|
150 | - $customer->attach_payment( $payment_id, false ); |
|
149 | + $previous_customer->remove_payment($payment_id, false); |
|
150 | + $customer->attach_payment($payment_id, false); |
|
151 | 151 | |
152 | 152 | // If purchase was completed and not ever refunded, adjust stats of customers |
153 | - if ( 'revoked' == $status || 'publish' == $status ) { |
|
153 | + if ('revoked' == $status || 'publish' == $status) { |
|
154 | 154 | |
155 | 155 | $previous_customer->decrease_purchase_count(); |
156 | - $previous_customer->decrease_value( $new_total ); |
|
156 | + $previous_customer->decrease_value($new_total); |
|
157 | 157 | |
158 | 158 | $customer->increase_purchase_count(); |
159 | - $customer->increase_value( $new_total ); |
|
159 | + $customer->increase_value($new_total); |
|
160 | 160 | } |
161 | 161 | |
162 | - update_post_meta( $payment_id, '_give_payment_customer_id', $customer->id ); |
|
162 | + update_post_meta($payment_id, '_give_payment_customer_id', $customer->id); |
|
163 | 163 | } |
164 | 164 | |
165 | 165 | |
@@ -173,47 +173,47 @@ discard block |
||
173 | 173 | |
174 | 174 | |
175 | 175 | // Check for payment notes |
176 | - if ( ! empty( $data['give-payment-note'] ) ) { |
|
176 | + if ( ! empty($data['give-payment-note'])) { |
|
177 | 177 | |
178 | - $note = wp_kses( $data['give-payment-note'], array() ); |
|
179 | - give_insert_payment_note( $payment_id, $note ); |
|
178 | + $note = wp_kses($data['give-payment-note'], array()); |
|
179 | + give_insert_payment_note($payment_id, $note); |
|
180 | 180 | |
181 | 181 | } |
182 | 182 | |
183 | 183 | // Set new status |
184 | - give_update_payment_status( $payment_id, $status ); |
|
184 | + give_update_payment_status($payment_id, $status); |
|
185 | 185 | |
186 | - give_update_payment_meta( $payment_id, '_give_payment_user_id', $customer->user_id ); |
|
187 | - give_update_payment_meta( $payment_id, '_give_payment_user_email', $customer->email ); |
|
188 | - give_update_payment_meta( $payment_id, '_give_payment_meta', $meta ); |
|
189 | - give_update_payment_meta( $payment_id, '_give_payment_total', $new_total ); |
|
186 | + give_update_payment_meta($payment_id, '_give_payment_user_id', $customer->user_id); |
|
187 | + give_update_payment_meta($payment_id, '_give_payment_user_email', $customer->email); |
|
188 | + give_update_payment_meta($payment_id, '_give_payment_meta', $meta); |
|
189 | + give_update_payment_meta($payment_id, '_give_payment_total', $new_total); |
|
190 | 190 | |
191 | 191 | // Adjust total store earnings if the payment total has been changed |
192 | - if ( $new_total !== $curr_total && ( 'publish' == $status || 'revoked' == $status ) ) { |
|
192 | + if ($new_total !== $curr_total && ('publish' == $status || 'revoked' == $status)) { |
|
193 | 193 | |
194 | - if ( $new_total > $curr_total ) { |
|
194 | + if ($new_total > $curr_total) { |
|
195 | 195 | // Increase if our new total is higher |
196 | 196 | $difference = $new_total - $curr_total; |
197 | - give_increase_total_earnings( $difference ); |
|
198 | - $form = new Give_Donate_Form( $form_id ); |
|
199 | - $form->increase_earnings( $difference ); |
|
200 | - } elseif ( $curr_total > $new_total ) { |
|
197 | + give_increase_total_earnings($difference); |
|
198 | + $form = new Give_Donate_Form($form_id); |
|
199 | + $form->increase_earnings($difference); |
|
200 | + } elseif ($curr_total > $new_total) { |
|
201 | 201 | // Decrease if our new total is lower |
202 | 202 | $difference = $curr_total - $new_total; |
203 | - give_decrease_total_earnings( $difference ); |
|
204 | - $form = new Give_Donate_Form( $form_id ); |
|
205 | - $form->decrease_earnings( $difference ); |
|
203 | + give_decrease_total_earnings($difference); |
|
204 | + $form = new Give_Donate_Form($form_id); |
|
205 | + $form->decrease_earnings($difference); |
|
206 | 206 | } |
207 | 207 | |
208 | 208 | } |
209 | 209 | |
210 | - do_action( 'give_updated_edited_purchase', $payment_id ); |
|
210 | + do_action('give_updated_edited_purchase', $payment_id); |
|
211 | 211 | |
212 | - wp_safe_redirect( admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&give-message=payment-updated&id=' . $payment_id ) ); |
|
212 | + wp_safe_redirect(admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&give-message=payment-updated&id='.$payment_id)); |
|
213 | 213 | exit; |
214 | 214 | } |
215 | 215 | |
216 | -add_action( 'give_update_payment_details', 'give_update_payment_details' ); |
|
216 | +add_action('give_update_payment_details', 'give_update_payment_details'); |
|
217 | 217 | |
218 | 218 | /** |
219 | 219 | * Trigger a Purchase Deletion |
@@ -224,45 +224,45 @@ discard block |
||
224 | 224 | * |
225 | 225 | * @return void |
226 | 226 | */ |
227 | -function give_trigger_purchase_delete( $data ) { |
|
228 | - if ( wp_verify_nonce( $data['_wpnonce'], 'give_payment_nonce' ) ) { |
|
227 | +function give_trigger_purchase_delete($data) { |
|
228 | + if (wp_verify_nonce($data['_wpnonce'], 'give_payment_nonce')) { |
|
229 | 229 | |
230 | - $payment_id = absint( $data['purchase_id'] ); |
|
230 | + $payment_id = absint($data['purchase_id']); |
|
231 | 231 | |
232 | - if ( ! current_user_can( 'edit_give_payments', $payment_id ) ) { |
|
233 | - wp_die( __( 'You do not have permission to edit this payment record', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
232 | + if ( ! current_user_can('edit_give_payments', $payment_id)) { |
|
233 | + wp_die(__('You do not have permission to edit this payment record', 'give'), __('Error', 'give'), array('response' => 403)); |
|
234 | 234 | } |
235 | 235 | |
236 | - give_delete_purchase( $payment_id ); |
|
237 | - wp_redirect( admin_url( '/edit.php?post_type=give_forms&page=give-payment-history&give-message=payment_deleted' ) ); |
|
236 | + give_delete_purchase($payment_id); |
|
237 | + wp_redirect(admin_url('/edit.php?post_type=give_forms&page=give-payment-history&give-message=payment_deleted')); |
|
238 | 238 | give_die(); |
239 | 239 | } |
240 | 240 | } |
241 | 241 | |
242 | -add_action( 'give_delete_payment', 'give_trigger_purchase_delete' ); |
|
242 | +add_action('give_delete_payment', 'give_trigger_purchase_delete'); |
|
243 | 243 | |
244 | 244 | function give_ajax_store_payment_note() { |
245 | 245 | |
246 | - $payment_id = absint( $_POST['payment_id'] ); |
|
247 | - $note = wp_kses( $_POST['note'], array() ); |
|
246 | + $payment_id = absint($_POST['payment_id']); |
|
247 | + $note = wp_kses($_POST['note'], array()); |
|
248 | 248 | |
249 | - if ( ! current_user_can( 'edit_give_payments', $payment_id ) ) { |
|
250 | - wp_die( __( 'You do not have permission to edit this payment record', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
249 | + if ( ! current_user_can('edit_give_payments', $payment_id)) { |
|
250 | + wp_die(__('You do not have permission to edit this payment record', 'give'), __('Error', 'give'), array('response' => 403)); |
|
251 | 251 | } |
252 | 252 | |
253 | - if ( empty( $payment_id ) ) { |
|
254 | - die( '-1' ); |
|
253 | + if (empty($payment_id)) { |
|
254 | + die('-1'); |
|
255 | 255 | } |
256 | 256 | |
257 | - if ( empty( $note ) ) { |
|
258 | - die( '-1' ); |
|
257 | + if (empty($note)) { |
|
258 | + die('-1'); |
|
259 | 259 | } |
260 | 260 | |
261 | - $note_id = give_insert_payment_note( $payment_id, $note ); |
|
262 | - die( give_get_payment_note_html( $note_id ) ); |
|
261 | + $note_id = give_insert_payment_note($payment_id, $note); |
|
262 | + die(give_get_payment_note_html($note_id)); |
|
263 | 263 | } |
264 | 264 | |
265 | -add_action( 'wp_ajax_give_insert_payment_note', 'give_ajax_store_payment_note' ); |
|
265 | +add_action('wp_ajax_give_insert_payment_note', 'give_ajax_store_payment_note'); |
|
266 | 266 | |
267 | 267 | /** |
268 | 268 | * Triggers a payment note deletion without ajax |
@@ -273,24 +273,24 @@ discard block |
||
273 | 273 | * |
274 | 274 | * @return void |
275 | 275 | */ |
276 | -function give_trigger_payment_note_deletion( $data ) { |
|
276 | +function give_trigger_payment_note_deletion($data) { |
|
277 | 277 | |
278 | - if ( ! wp_verify_nonce( $data['_wpnonce'], 'give_delete_payment_note_' . $data['note_id'] ) ) { |
|
278 | + if ( ! wp_verify_nonce($data['_wpnonce'], 'give_delete_payment_note_'.$data['note_id'])) { |
|
279 | 279 | return; |
280 | 280 | } |
281 | 281 | |
282 | - if ( ! current_user_can( 'edit_give_payments', $data['payment_id'] ) ) { |
|
283 | - wp_die( __( 'You do not have permission to edit this payment record', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
282 | + if ( ! current_user_can('edit_give_payments', $data['payment_id'])) { |
|
283 | + wp_die(__('You do not have permission to edit this payment record', 'give'), __('Error', 'give'), array('response' => 403)); |
|
284 | 284 | } |
285 | 285 | |
286 | - $edit_order_url = admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&give-message=payment-note-deleted&id=' . absint( $data['payment_id'] ) ); |
|
286 | + $edit_order_url = admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&give-message=payment-note-deleted&id='.absint($data['payment_id'])); |
|
287 | 287 | |
288 | - give_delete_payment_note( $data['note_id'], $data['payment_id'] ); |
|
288 | + give_delete_payment_note($data['note_id'], $data['payment_id']); |
|
289 | 289 | |
290 | - wp_redirect( $edit_order_url ); |
|
290 | + wp_redirect($edit_order_url); |
|
291 | 291 | } |
292 | 292 | |
293 | -add_action( 'give_delete_payment_note', 'give_trigger_payment_note_deletion' ); |
|
293 | +add_action('give_delete_payment_note', 'give_trigger_payment_note_deletion'); |
|
294 | 294 | |
295 | 295 | /** |
296 | 296 | * Delete a payment note deletion with ajax |
@@ -303,16 +303,16 @@ discard block |
||
303 | 303 | */ |
304 | 304 | function give_ajax_delete_payment_note() { |
305 | 305 | |
306 | - if ( ! current_user_can( 'edit_give_payments', $_POST['payment_id'] ) ) { |
|
307 | - wp_die( __( 'You do not have permission to edit this payment record', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
306 | + if ( ! current_user_can('edit_give_payments', $_POST['payment_id'])) { |
|
307 | + wp_die(__('You do not have permission to edit this payment record', 'give'), __('Error', 'give'), array('response' => 403)); |
|
308 | 308 | } |
309 | 309 | |
310 | - if ( give_delete_payment_note( $_POST['note_id'], $_POST['payment_id'] ) ) { |
|
311 | - die( '1' ); |
|
310 | + if (give_delete_payment_note($_POST['note_id'], $_POST['payment_id'])) { |
|
311 | + die('1'); |
|
312 | 312 | } else { |
313 | - die( '-1' ); |
|
313 | + die('-1'); |
|
314 | 314 | } |
315 | 315 | |
316 | 316 | } |
317 | 317 | |
318 | -add_action( 'wp_ajax_give_delete_payment_note', 'give_ajax_delete_payment_note' ); |
|
319 | 318 | \ No newline at end of file |
319 | +add_action('wp_ajax_give_delete_payment_note', 'give_ajax_delete_payment_note'); |
|
320 | 320 | \ No newline at end of file |
@@ -279,7 +279,6 @@ |
||
279 | 279 | * @access public |
280 | 280 | * @since 1.0 |
281 | 281 | * |
282 | - * @param array $item Contains all the data of the discount code |
|
283 | 282 | * @param string $column_name The name of the column |
284 | 283 | * |
285 | 284 | * @return string Column Name |
@@ -10,13 +10,13 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
17 | 17 | // Load WP_List_Table if not loaded |
18 | -if ( ! class_exists( 'WP_List_Table' ) ) { |
|
19 | - require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php'; |
|
18 | +if ( ! class_exists('WP_List_Table')) { |
|
19 | + require_once ABSPATH.'wp-admin/includes/class-wp-list-table.php'; |
|
20 | 20 | } |
21 | 21 | |
22 | 22 | /** |
@@ -112,37 +112,37 @@ discard block |
||
112 | 112 | global $status, $page; |
113 | 113 | |
114 | 114 | // Set parent defaults |
115 | - parent::__construct( array( |
|
116 | - 'singular' => give_get_forms_label_singular(), // Singular name of the listed records |
|
117 | - 'plural' => give_get_forms_label_plural(), // Plural name of the listed records |
|
115 | + parent::__construct(array( |
|
116 | + 'singular' => give_get_forms_label_singular(), // Singular name of the listed records |
|
117 | + 'plural' => give_get_forms_label_plural(), // Plural name of the listed records |
|
118 | 118 | 'ajax' => false // Does this table support ajax? |
119 | - ) ); |
|
119 | + )); |
|
120 | 120 | |
121 | 121 | $this->get_payment_counts(); |
122 | 122 | $this->process_bulk_action(); |
123 | - $this->base_url = admin_url( 'edit.php?post_type=give_forms&page=give-payment-history' ); |
|
123 | + $this->base_url = admin_url('edit.php?post_type=give_forms&page=give-payment-history'); |
|
124 | 124 | } |
125 | 125 | |
126 | 126 | public function advanced_filters() { |
127 | - $start_date = isset( $_GET['start-date'] ) ? sanitize_text_field( $_GET['start-date'] ) : null; |
|
128 | - $end_date = isset( $_GET['end-date'] ) ? sanitize_text_field( $_GET['end-date'] ) : null; |
|
129 | - $status = isset( $_GET['status'] ) ? $_GET['status'] : ''; |
|
127 | + $start_date = isset($_GET['start-date']) ? sanitize_text_field($_GET['start-date']) : null; |
|
128 | + $end_date = isset($_GET['end-date']) ? sanitize_text_field($_GET['end-date']) : null; |
|
129 | + $status = isset($_GET['status']) ? $_GET['status'] : ''; |
|
130 | 130 | ?> |
131 | 131 | <div id="give-payment-filters"> |
132 | 132 | <span id="give-payment-date-filters"> |
133 | - <label for="start-date" class="give-start-date-label"><?php _e( 'Start Date:', 'give' ); ?></label> |
|
133 | + <label for="start-date" class="give-start-date-label"><?php _e('Start Date:', 'give'); ?></label> |
|
134 | 134 | <input type="text" id="start-date" name="start-date" class="give_datepicker" value="<?php echo $start_date; ?>" placeholder="mm/dd/yyyy" /> |
135 | - <label for="end-date" class="give-end-date-label"><?php _e( 'End Date:', 'give' ); ?></label> |
|
135 | + <label for="end-date" class="give-end-date-label"><?php _e('End Date:', 'give'); ?></label> |
|
136 | 136 | <input type="text" id="end-date" name="end-date" class="give_datepicker" value="<?php echo $end_date; ?>" placeholder="mm/dd/yyyy" /> |
137 | - <input type="submit" class="button-secondary" value="<?php _e( 'Apply', 'give' ); ?>" /> |
|
137 | + <input type="submit" class="button-secondary" value="<?php _e('Apply', 'give'); ?>" /> |
|
138 | 138 | </span> |
139 | - <?php if ( ! empty( $status ) ) : ?> |
|
140 | - <input type="hidden" name="status" value="<?php echo esc_attr( $status ); ?>" /> |
|
139 | + <?php if ( ! empty($status)) : ?> |
|
140 | + <input type="hidden" name="status" value="<?php echo esc_attr($status); ?>" /> |
|
141 | 141 | <?php endif; ?> |
142 | - <?php if ( ! empty( $start_date ) || ! empty( $end_date ) ) : ?> |
|
143 | - <a href="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-payment-history' ); ?>" class="button-secondary"><?php _e( 'Clear Filter', 'give' ); ?></a> |
|
142 | + <?php if ( ! empty($start_date) || ! empty($end_date)) : ?> |
|
143 | + <a href="<?php echo admin_url('edit.php?post_type=give_forms&page=give-payment-history'); ?>" class="button-secondary"><?php _e('Clear Filter', 'give'); ?></a> |
|
144 | 144 | <?php endif; ?> |
145 | - <?php $this->search_box( __( 'Search', 'give' ), 'give-payments' ); ?> |
|
145 | + <?php $this->search_box(__('Search', 'give'), 'give-payments'); ?> |
|
146 | 146 | </div> |
147 | 147 | |
148 | 148 | <?php |
@@ -159,25 +159,25 @@ discard block |
||
159 | 159 | * |
160 | 160 | * @return void |
161 | 161 | */ |
162 | - public function search_box( $text, $input_id ) { |
|
163 | - if ( empty( $_REQUEST['s'] ) && ! $this->has_items() ) { |
|
162 | + public function search_box($text, $input_id) { |
|
163 | + if (empty($_REQUEST['s']) && ! $this->has_items()) { |
|
164 | 164 | return; |
165 | 165 | } |
166 | 166 | |
167 | - $input_id = $input_id . '-search-input'; |
|
167 | + $input_id = $input_id.'-search-input'; |
|
168 | 168 | |
169 | - if ( ! empty( $_REQUEST['orderby'] ) ) { |
|
170 | - echo '<input type="hidden" name="orderby" value="' . esc_attr( $_REQUEST['orderby'] ) . '" />'; |
|
169 | + if ( ! empty($_REQUEST['orderby'])) { |
|
170 | + echo '<input type="hidden" name="orderby" value="'.esc_attr($_REQUEST['orderby']).'" />'; |
|
171 | 171 | } |
172 | - if ( ! empty( $_REQUEST['order'] ) ) { |
|
173 | - echo '<input type="hidden" name="order" value="' . esc_attr( $_REQUEST['order'] ) . '" />'; |
|
172 | + if ( ! empty($_REQUEST['order'])) { |
|
173 | + echo '<input type="hidden" name="order" value="'.esc_attr($_REQUEST['order']).'" />'; |
|
174 | 174 | } |
175 | 175 | ?> |
176 | 176 | <p class="search-box"> |
177 | - <?php do_action( 'give_payment_history_search' ); ?> |
|
177 | + <?php do_action('give_payment_history_search'); ?> |
|
178 | 178 | <label class="screen-reader-text" for="<?php echo $input_id ?>"><?php echo $text; ?>:</label> |
179 | 179 | <input type="search" id="<?php echo $input_id ?>" name="s" value="<?php _admin_search_query(); ?>" /> |
180 | - <?php submit_button( $text, 'button', false, false, array( 'ID' => 'search-submit' ) ); ?><br /> |
|
180 | + <?php submit_button($text, 'button', false, false, array('ID' => 'search-submit')); ?><br /> |
|
181 | 181 | </p> |
182 | 182 | <?php |
183 | 183 | } |
@@ -191,47 +191,47 @@ discard block |
||
191 | 191 | */ |
192 | 192 | public function get_views() { |
193 | 193 | |
194 | - $current = isset( $_GET['status'] ) ? $_GET['status'] : ''; |
|
195 | - $total_count = ' <span class="count">(' . $this->total_count . ')</span>'; |
|
196 | - $complete_count = ' <span class="count">(' . $this->complete_count . ')</span>'; |
|
197 | - $pending_count = ' <span class="count">(' . $this->pending_count . ')</span>'; |
|
198 | - $refunded_count = ' <span class="count">(' . $this->refunded_count . ')</span>'; |
|
199 | - $failed_count = ' <span class="count">(' . $this->failed_count . ')</span>'; |
|
200 | - $abandoned_count = ' <span class="count">(' . $this->abandoned_count . ')</span>'; |
|
201 | - $revoked_count = ' <span class="count">(' . $this->revoked_count . ')</span>'; |
|
194 | + $current = isset($_GET['status']) ? $_GET['status'] : ''; |
|
195 | + $total_count = ' <span class="count">('.$this->total_count.')</span>'; |
|
196 | + $complete_count = ' <span class="count">('.$this->complete_count.')</span>'; |
|
197 | + $pending_count = ' <span class="count">('.$this->pending_count.')</span>'; |
|
198 | + $refunded_count = ' <span class="count">('.$this->refunded_count.')</span>'; |
|
199 | + $failed_count = ' <span class="count">('.$this->failed_count.')</span>'; |
|
200 | + $abandoned_count = ' <span class="count">('.$this->abandoned_count.')</span>'; |
|
201 | + $revoked_count = ' <span class="count">('.$this->revoked_count.')</span>'; |
|
202 | 202 | |
203 | 203 | $views = array( |
204 | - 'all' => sprintf( '<a href="%s"%s>%s</a>', remove_query_arg( array( |
|
204 | + 'all' => sprintf('<a href="%s"%s>%s</a>', remove_query_arg(array( |
|
205 | 205 | 'status', |
206 | 206 | 'paged' |
207 | - ) ), $current === 'all' || $current == '' ? ' class="current"' : '', __( 'All', 'give' ) . $total_count ), |
|
208 | - 'publish' => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array( |
|
207 | + )), $current === 'all' || $current == '' ? ' class="current"' : '', __('All', 'give').$total_count), |
|
208 | + 'publish' => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array( |
|
209 | 209 | 'status' => 'publish', |
210 | 210 | 'paged' => false |
211 | - ) ) ), $current === 'publish' ? ' class="current"' : '', __( 'Completed', 'give' ) . $complete_count ), |
|
212 | - 'pending' => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array( |
|
211 | + ))), $current === 'publish' ? ' class="current"' : '', __('Completed', 'give').$complete_count), |
|
212 | + 'pending' => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array( |
|
213 | 213 | 'status' => 'pending', |
214 | 214 | 'paged' => false |
215 | - ) ) ), $current === 'pending' ? ' class="current"' : '', __( 'Pending', 'give' ) . $pending_count ), |
|
216 | - 'refunded' => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array( |
|
215 | + ))), $current === 'pending' ? ' class="current"' : '', __('Pending', 'give').$pending_count), |
|
216 | + 'refunded' => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array( |
|
217 | 217 | 'status' => 'refunded', |
218 | 218 | 'paged' => false |
219 | - ) ) ), $current === 'refunded' ? ' class="current"' : '', __( 'Refunded', 'give' ) . $refunded_count ), |
|
220 | - 'revoked' => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array( |
|
219 | + ))), $current === 'refunded' ? ' class="current"' : '', __('Refunded', 'give').$refunded_count), |
|
220 | + 'revoked' => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array( |
|
221 | 221 | 'status' => 'revoked', |
222 | 222 | 'paged' => false |
223 | - ) ) ), $current === 'revoked' ? ' class="current"' : '', __( 'Revoked', 'give' ) . $revoked_count ), |
|
224 | - 'failed' => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array( |
|
223 | + ))), $current === 'revoked' ? ' class="current"' : '', __('Revoked', 'give').$revoked_count), |
|
224 | + 'failed' => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array( |
|
225 | 225 | 'status' => 'failed', |
226 | 226 | 'paged' => false |
227 | - ) ) ), $current === 'failed' ? ' class="current"' : '', __( 'Failed', 'give' ) . $failed_count ), |
|
228 | - 'abandoned' => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array( |
|
227 | + ))), $current === 'failed' ? ' class="current"' : '', __('Failed', 'give').$failed_count), |
|
228 | + 'abandoned' => sprintf('<a href="%s"%s>%s</a>', esc_url(add_query_arg(array( |
|
229 | 229 | 'status' => 'abandoned', |
230 | 230 | 'paged' => false |
231 | - ) ) ), $current === 'abandoned' ? ' class="current"' : '', __( 'Abandoned', 'give' ) . $abandoned_count ) |
|
231 | + ))), $current === 'abandoned' ? ' class="current"' : '', __('Abandoned', 'give').$abandoned_count) |
|
232 | 232 | ); |
233 | 233 | |
234 | - return apply_filters( 'give_payments_table_views', $views ); |
|
234 | + return apply_filters('give_payments_table_views', $views); |
|
235 | 235 | } |
236 | 236 | |
237 | 237 | /** |
@@ -244,16 +244,16 @@ discard block |
||
244 | 244 | public function get_columns() { |
245 | 245 | $columns = array( |
246 | 246 | 'cb' => '<input type="checkbox" />', //Render a checkbox instead of text |
247 | - 'email' => __( 'Email', 'give' ), |
|
248 | - 'details' => __( 'Details', 'give' ), |
|
249 | - 'amount' => __( 'Amount', 'give' ), |
|
250 | - 'status' => __( 'Status', 'give' ), |
|
251 | - 'date' => __( 'Date', 'give' ), |
|
252 | - 'donor' => __( 'Donor', 'give' ), |
|
253 | - 'ID' => __( 'ID', 'give' ), |
|
247 | + 'email' => __('Email', 'give'), |
|
248 | + 'details' => __('Details', 'give'), |
|
249 | + 'amount' => __('Amount', 'give'), |
|
250 | + 'status' => __('Status', 'give'), |
|
251 | + 'date' => __('Date', 'give'), |
|
252 | + 'donor' => __('Donor', 'give'), |
|
253 | + 'ID' => __('ID', 'give'), |
|
254 | 254 | ); |
255 | 255 | |
256 | - return apply_filters( 'give_payments_table_columns', $columns ); |
|
256 | + return apply_filters('give_payments_table_columns', $columns); |
|
257 | 257 | } |
258 | 258 | |
259 | 259 | /** |
@@ -265,12 +265,12 @@ discard block |
||
265 | 265 | */ |
266 | 266 | public function get_sortable_columns() { |
267 | 267 | $columns = array( |
268 | - 'ID' => array( 'ID', true ), |
|
269 | - 'amount' => array( 'amount', false ), |
|
270 | - 'date' => array( 'date', false ) |
|
268 | + 'ID' => array('ID', true), |
|
269 | + 'amount' => array('amount', false), |
|
270 | + 'date' => array('date', false) |
|
271 | 271 | ); |
272 | 272 | |
273 | - return apply_filters( 'give_payments_table_sortable_columns', $columns ); |
|
273 | + return apply_filters('give_payments_table_sortable_columns', $columns); |
|
274 | 274 | } |
275 | 275 | |
276 | 276 | /** |
@@ -284,30 +284,30 @@ discard block |
||
284 | 284 | * |
285 | 285 | * @return string Column Name |
286 | 286 | */ |
287 | - public function column_default( $payment, $column_name ) { |
|
288 | - switch ( $column_name ) { |
|
287 | + public function column_default($payment, $column_name) { |
|
288 | + switch ($column_name) { |
|
289 | 289 | case 'amount' : |
290 | - $amount = ! empty( $payment->total ) ? $payment->total : 0; |
|
291 | - $value = give_currency_filter( give_format_amount( $amount ), give_get_payment_currency_code( $payment->ID ) ); |
|
290 | + $amount = ! empty($payment->total) ? $payment->total : 0; |
|
291 | + $value = give_currency_filter(give_format_amount($amount), give_get_payment_currency_code($payment->ID)); |
|
292 | 292 | break; |
293 | 293 | case 'date' : |
294 | - $date = strtotime( $payment->date ); |
|
295 | - $value = date_i18n( get_option( 'date_format' ), $date ); |
|
294 | + $date = strtotime($payment->date); |
|
295 | + $value = date_i18n(get_option('date_format'), $date); |
|
296 | 296 | break; |
297 | 297 | case 'status' : |
298 | - $payment = get_post( $payment->ID ); |
|
299 | - $value = '<div class="give-donation-status status-' . sanitize_title( give_get_payment_status( $payment, true ) ) . '"><span class="give-donation-status-icon"></span> ' . give_get_payment_status( $payment, true ) . '</div>'; |
|
298 | + $payment = get_post($payment->ID); |
|
299 | + $value = '<div class="give-donation-status status-'.sanitize_title(give_get_payment_status($payment, true)).'"><span class="give-donation-status-icon"></span> '.give_get_payment_status($payment, true).'</div>'; |
|
300 | 300 | break; |
301 | 301 | case 'details' : |
302 | - $value = '<div class="give-payment-details-link-wrap"><a href="' . esc_url( add_query_arg( 'id', $payment->ID, admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details' ) ) ) . '" class="give-payment-details-link button button-small">' . __( 'View Donation Details', 'give' ) . '</a></div>'; |
|
302 | + $value = '<div class="give-payment-details-link-wrap"><a href="'.esc_url(add_query_arg('id', $payment->ID, admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details'))).'" class="give-payment-details-link button button-small">'.__('View Donation Details', 'give').'</a></div>'; |
|
303 | 303 | break; |
304 | 304 | default: |
305 | - $value = isset( $payment->$column_name ) ? $payment->$column_name : ''; |
|
305 | + $value = isset($payment->$column_name) ? $payment->$column_name : ''; |
|
306 | 306 | break; |
307 | 307 | |
308 | 308 | } |
309 | 309 | |
310 | - return apply_filters( 'give_payments_table_column', $value, $payment->ID, $column_name ); |
|
310 | + return apply_filters('give_payments_table_column', $value, $payment->ID, $column_name); |
|
311 | 311 | } |
312 | 312 | |
313 | 313 | /** |
@@ -320,32 +320,32 @@ discard block |
||
320 | 320 | * |
321 | 321 | * @return string Data shown in the Email column |
322 | 322 | */ |
323 | - public function column_email( $payment ) { |
|
323 | + public function column_email($payment) { |
|
324 | 324 | |
325 | 325 | $row_actions = array(); |
326 | 326 | |
327 | - if ( give_is_payment_complete( $payment->ID ) ) { |
|
328 | - $row_actions['email_links'] = '<a href="' . add_query_arg( array( |
|
327 | + if (give_is_payment_complete($payment->ID)) { |
|
328 | + $row_actions['email_links'] = '<a href="'.add_query_arg(array( |
|
329 | 329 | 'give-action' => 'email_links', |
330 | 330 | 'purchase_id' => $payment->ID |
331 | - ), $this->base_url ) . '">' . __( 'Resend Donation Receipt', 'give' ) . '</a>'; |
|
331 | + ), $this->base_url).'">'.__('Resend Donation Receipt', 'give').'</a>'; |
|
332 | 332 | |
333 | 333 | } |
334 | 334 | |
335 | - $row_actions['delete'] = '<a href="' . wp_nonce_url( add_query_arg( array( |
|
335 | + $row_actions['delete'] = '<a href="'.wp_nonce_url(add_query_arg(array( |
|
336 | 336 | 'give-action' => 'delete_payment', |
337 | 337 | 'purchase_id' => $payment->ID |
338 | - ), $this->base_url ), 'give_payment_nonce' ) . '">' . __( 'Delete', 'give' ) . '</a>'; |
|
338 | + ), $this->base_url), 'give_payment_nonce').'">'.__('Delete', 'give').'</a>'; |
|
339 | 339 | |
340 | - $row_actions = apply_filters( 'give_payment_row_actions', $row_actions, $payment ); |
|
340 | + $row_actions = apply_filters('give_payment_row_actions', $row_actions, $payment); |
|
341 | 341 | |
342 | - if ( ! isset( $payment->user_info['email'] ) ) { |
|
343 | - $payment->user_info['email'] = __( '(unknown)', 'give' ); |
|
342 | + if ( ! isset($payment->user_info['email'])) { |
|
343 | + $payment->user_info['email'] = __('(unknown)', 'give'); |
|
344 | 344 | } |
345 | 345 | |
346 | - $value = '<span class="give-email-column-value">' . $payment->user_info['email'] . '</span>' . $this->row_actions( $row_actions ); |
|
346 | + $value = '<span class="give-email-column-value">'.$payment->user_info['email'].'</span>'.$this->row_actions($row_actions); |
|
347 | 347 | |
348 | - return apply_filters( 'give_payments_table_column', $value, $payment->ID, 'email' ); |
|
348 | + return apply_filters('give_payments_table_column', $value, $payment->ID, 'email'); |
|
349 | 349 | } |
350 | 350 | |
351 | 351 | /** |
@@ -358,7 +358,7 @@ discard block |
||
358 | 358 | * |
359 | 359 | * @return string Displays a checkbox |
360 | 360 | */ |
361 | - public function column_cb( $payment ) { |
|
361 | + public function column_cb($payment) { |
|
362 | 362 | return sprintf( |
363 | 363 | '<input type="checkbox" name="%1$s[]" value="%2$s" />', |
364 | 364 | 'payment', |
@@ -376,8 +376,8 @@ discard block |
||
376 | 376 | * |
377 | 377 | * @return string Displays a checkbox |
378 | 378 | */ |
379 | - public function column_ID( $payment ) { |
|
380 | - return '<span class="give-payment-id">' . give_get_payment_number( $payment->ID ) . '</span>'; |
|
379 | + public function column_ID($payment) { |
|
380 | + return '<span class="give-payment-id">'.give_get_payment_number($payment->ID).'</span>'; |
|
381 | 381 | } |
382 | 382 | |
383 | 383 | /** |
@@ -390,18 +390,18 @@ discard block |
||
390 | 390 | * |
391 | 391 | * @return string Data shown in the User column |
392 | 392 | */ |
393 | - public function column_donor( $payment ) { |
|
393 | + public function column_donor($payment) { |
|
394 | 394 | |
395 | 395 | // $user_id = give_get_payment_user_id( $payment->ID ); |
396 | 396 | |
397 | - $customer_id = give_get_payment_customer_id( $payment->ID ); |
|
398 | - $customer = new Give_Customer( $customer_id ); |
|
397 | + $customer_id = give_get_payment_customer_id($payment->ID); |
|
398 | + $customer = new Give_Customer($customer_id); |
|
399 | 399 | |
400 | - $view_url = admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $customer_id ); |
|
400 | + $view_url = admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$customer_id); |
|
401 | 401 | |
402 | - $value = '<a href="' . esc_url( $view_url ) . '" data-tooltip="' . __( 'Click here to view this Donor\'s profile', 'give' ) . '">' . $customer->name . '</a>'; |
|
402 | + $value = '<a href="'.esc_url($view_url).'" data-tooltip="'.__('Click here to view this Donor\'s profile', 'give').'">'.$customer->name.'</a>'; |
|
403 | 403 | |
404 | - return apply_filters( 'give_payments_table_column', $value, $payment->ID, 'donor' ); |
|
404 | + return apply_filters('give_payments_table_column', $value, $payment->ID, 'donor'); |
|
405 | 405 | } |
406 | 406 | |
407 | 407 | /** |
@@ -413,17 +413,17 @@ discard block |
||
413 | 413 | */ |
414 | 414 | public function get_bulk_actions() { |
415 | 415 | $actions = array( |
416 | - 'delete' => __( 'Delete', 'give' ), |
|
417 | - 'set-status-publish' => __( 'Set To Completed', 'give' ), |
|
418 | - 'set-status-pending' => __( 'Set To Pending', 'give' ), |
|
419 | - 'set-status-refunded' => __( 'Set To Refunded', 'give' ), |
|
420 | - 'set-status-revoked' => __( 'Set To Revoked', 'give' ), |
|
421 | - 'set-status-failed' => __( 'Set To Failed', 'give' ), |
|
422 | - 'set-status-abandoned' => __( 'Set To Abandoned', 'give' ), |
|
423 | - 'resend-receipt' => __( 'Resend Email Receipts', 'give' ) |
|
416 | + 'delete' => __('Delete', 'give'), |
|
417 | + 'set-status-publish' => __('Set To Completed', 'give'), |
|
418 | + 'set-status-pending' => __('Set To Pending', 'give'), |
|
419 | + 'set-status-refunded' => __('Set To Refunded', 'give'), |
|
420 | + 'set-status-revoked' => __('Set To Revoked', 'give'), |
|
421 | + 'set-status-failed' => __('Set To Failed', 'give'), |
|
422 | + 'set-status-abandoned' => __('Set To Abandoned', 'give'), |
|
423 | + 'resend-receipt' => __('Resend Email Receipts', 'give') |
|
424 | 424 | ); |
425 | 425 | |
426 | - return apply_filters( 'give_payments_table_bulk_actions', $actions ); |
|
426 | + return apply_filters('give_payments_table_bulk_actions', $actions); |
|
427 | 427 | } |
428 | 428 | |
429 | 429 | /** |
@@ -434,53 +434,53 @@ discard block |
||
434 | 434 | * @return void |
435 | 435 | */ |
436 | 436 | public function process_bulk_action() { |
437 | - $ids = isset( $_GET['payment'] ) ? $_GET['payment'] : false; |
|
437 | + $ids = isset($_GET['payment']) ? $_GET['payment'] : false; |
|
438 | 438 | $action = $this->current_action(); |
439 | 439 | |
440 | - if ( ! is_array( $ids ) ) { |
|
441 | - $ids = array( $ids ); |
|
440 | + if ( ! is_array($ids)) { |
|
441 | + $ids = array($ids); |
|
442 | 442 | } |
443 | 443 | |
444 | - if ( empty( $action ) ) { |
|
444 | + if (empty($action)) { |
|
445 | 445 | return; |
446 | 446 | } |
447 | 447 | |
448 | - foreach ( $ids as $id ) { |
|
448 | + foreach ($ids as $id) { |
|
449 | 449 | |
450 | 450 | // Detect when a bulk action is being triggered... |
451 | - if ( 'delete' === $this->current_action() ) { |
|
452 | - give_delete_purchase( $id ); |
|
451 | + if ('delete' === $this->current_action()) { |
|
452 | + give_delete_purchase($id); |
|
453 | 453 | } |
454 | 454 | |
455 | - if ( 'set-status-publish' === $this->current_action() ) { |
|
456 | - give_update_payment_status( $id, 'publish' ); |
|
455 | + if ('set-status-publish' === $this->current_action()) { |
|
456 | + give_update_payment_status($id, 'publish'); |
|
457 | 457 | } |
458 | 458 | |
459 | - if ( 'set-status-pending' === $this->current_action() ) { |
|
460 | - give_update_payment_status( $id, 'pending' ); |
|
459 | + if ('set-status-pending' === $this->current_action()) { |
|
460 | + give_update_payment_status($id, 'pending'); |
|
461 | 461 | } |
462 | 462 | |
463 | - if ( 'set-status-refunded' === $this->current_action() ) { |
|
464 | - give_update_payment_status( $id, 'refunded' ); |
|
463 | + if ('set-status-refunded' === $this->current_action()) { |
|
464 | + give_update_payment_status($id, 'refunded'); |
|
465 | 465 | } |
466 | 466 | |
467 | - if ( 'set-status-revoked' === $this->current_action() ) { |
|
468 | - give_update_payment_status( $id, 'revoked' ); |
|
467 | + if ('set-status-revoked' === $this->current_action()) { |
|
468 | + give_update_payment_status($id, 'revoked'); |
|
469 | 469 | } |
470 | 470 | |
471 | - if ( 'set-status-failed' === $this->current_action() ) { |
|
472 | - give_update_payment_status( $id, 'failed' ); |
|
471 | + if ('set-status-failed' === $this->current_action()) { |
|
472 | + give_update_payment_status($id, 'failed'); |
|
473 | 473 | } |
474 | 474 | |
475 | - if ( 'set-status-abandoned' === $this->current_action() ) { |
|
476 | - give_update_payment_status( $id, 'abandoned' ); |
|
475 | + if ('set-status-abandoned' === $this->current_action()) { |
|
476 | + give_update_payment_status($id, 'abandoned'); |
|
477 | 477 | } |
478 | 478 | |
479 | - if ( 'resend-receipt' === $this->current_action() ) { |
|
480 | - give_email_donation_receipt( $id, false ); |
|
479 | + if ('resend-receipt' === $this->current_action()) { |
|
480 | + give_email_donation_receipt($id, false); |
|
481 | 481 | } |
482 | 482 | |
483 | - do_action( 'give_payments_table_do_bulk_action', $id, $this->current_action() ); |
|
483 | + do_action('give_payments_table_do_bulk_action', $id, $this->current_action()); |
|
484 | 484 | } |
485 | 485 | |
486 | 486 | } |
@@ -498,21 +498,21 @@ discard block |
||
498 | 498 | |
499 | 499 | $args = array(); |
500 | 500 | |
501 | - if ( isset( $_GET['user'] ) ) { |
|
502 | - $args['user'] = urldecode( $_GET['user'] ); |
|
503 | - } elseif ( isset( $_GET['s'] ) ) { |
|
504 | - $args['s'] = urldecode( $_GET['s'] ); |
|
501 | + if (isset($_GET['user'])) { |
|
502 | + $args['user'] = urldecode($_GET['user']); |
|
503 | + } elseif (isset($_GET['s'])) { |
|
504 | + $args['s'] = urldecode($_GET['s']); |
|
505 | 505 | } |
506 | 506 | |
507 | - if ( ! empty( $_GET['start-date'] ) ) { |
|
508 | - $args['start-date'] = urldecode( $_GET['start-date'] ); |
|
507 | + if ( ! empty($_GET['start-date'])) { |
|
508 | + $args['start-date'] = urldecode($_GET['start-date']); |
|
509 | 509 | } |
510 | 510 | |
511 | - if ( ! empty( $_GET['end-date'] ) ) { |
|
512 | - $args['end-date'] = urldecode( $_GET['end-date'] ); |
|
511 | + if ( ! empty($_GET['end-date'])) { |
|
512 | + $args['end-date'] = urldecode($_GET['end-date']); |
|
513 | 513 | } |
514 | 514 | |
515 | - $payment_count = give_count_payments( $args ); |
|
515 | + $payment_count = give_count_payments($args); |
|
516 | 516 | $this->complete_count = $payment_count->publish; |
517 | 517 | $this->pending_count = $payment_count->pending; |
518 | 518 | $this->refunded_count = $payment_count->refunded; |
@@ -520,7 +520,7 @@ discard block |
||
520 | 520 | $this->revoked_count = $payment_count->revoked; |
521 | 521 | $this->abandoned_count = $payment_count->abandoned; |
522 | 522 | |
523 | - foreach ( $payment_count as $count ) { |
|
523 | + foreach ($payment_count as $count) { |
|
524 | 524 | $this->total_count += $count; |
525 | 525 | } |
526 | 526 | } |
@@ -535,26 +535,26 @@ discard block |
||
535 | 535 | public function payments_data() { |
536 | 536 | |
537 | 537 | $per_page = $this->per_page; |
538 | - $orderby = isset( $_GET['orderby'] ) ? urldecode( $_GET['orderby'] ) : 'ID'; |
|
539 | - $order = isset( $_GET['order'] ) ? $_GET['order'] : 'DESC'; |
|
540 | - $user = isset( $_GET['user'] ) ? $_GET['user'] : null; |
|
541 | - $status = isset( $_GET['status'] ) ? $_GET['status'] : give_get_payment_status_keys(); |
|
542 | - $meta_key = isset( $_GET['meta_key'] ) ? $_GET['meta_key'] : null; |
|
543 | - $year = isset( $_GET['year'] ) ? $_GET['year'] : null; |
|
544 | - $month = isset( $_GET['m'] ) ? $_GET['m'] : null; |
|
545 | - $day = isset( $_GET['day'] ) ? $_GET['day'] : null; |
|
546 | - $search = isset( $_GET['s'] ) ? sanitize_text_field( $_GET['s'] ) : null; |
|
547 | - $start_date = isset( $_GET['start-date'] ) ? sanitize_text_field( $_GET['start-date'] ) : null; |
|
548 | - $end_date = isset( $_GET['end-date'] ) ? sanitize_text_field( $_GET['end-date'] ) : $start_date; |
|
549 | - |
|
550 | - if ( ! empty( $search ) ) { |
|
538 | + $orderby = isset($_GET['orderby']) ? urldecode($_GET['orderby']) : 'ID'; |
|
539 | + $order = isset($_GET['order']) ? $_GET['order'] : 'DESC'; |
|
540 | + $user = isset($_GET['user']) ? $_GET['user'] : null; |
|
541 | + $status = isset($_GET['status']) ? $_GET['status'] : give_get_payment_status_keys(); |
|
542 | + $meta_key = isset($_GET['meta_key']) ? $_GET['meta_key'] : null; |
|
543 | + $year = isset($_GET['year']) ? $_GET['year'] : null; |
|
544 | + $month = isset($_GET['m']) ? $_GET['m'] : null; |
|
545 | + $day = isset($_GET['day']) ? $_GET['day'] : null; |
|
546 | + $search = isset($_GET['s']) ? sanitize_text_field($_GET['s']) : null; |
|
547 | + $start_date = isset($_GET['start-date']) ? sanitize_text_field($_GET['start-date']) : null; |
|
548 | + $end_date = isset($_GET['end-date']) ? sanitize_text_field($_GET['end-date']) : $start_date; |
|
549 | + |
|
550 | + if ( ! empty($search)) { |
|
551 | 551 | $status = 'any'; // Force all payment statuses when searching |
552 | 552 | } |
553 | 553 | |
554 | 554 | $args = array( |
555 | 555 | 'output' => 'payments', |
556 | 556 | 'number' => $per_page, |
557 | - 'page' => isset( $_GET['paged'] ) ? $_GET['paged'] : null, |
|
557 | + 'page' => isset($_GET['paged']) ? $_GET['paged'] : null, |
|
558 | 558 | 'orderby' => $orderby, |
559 | 559 | 'order' => $order, |
560 | 560 | 'user' => $user, |
@@ -568,14 +568,14 @@ discard block |
||
568 | 568 | 'end_date' => $end_date, |
569 | 569 | ); |
570 | 570 | |
571 | - if ( is_string( $search ) && false !== strpos( $search, 'txn:' ) ) { |
|
571 | + if (is_string($search) && false !== strpos($search, 'txn:')) { |
|
572 | 572 | |
573 | 573 | $args['search_in_notes'] = true; |
574 | - $args['s'] = trim( str_replace( 'txn:', '', $args['s'] ) ); |
|
574 | + $args['s'] = trim(str_replace('txn:', '', $args['s'])); |
|
575 | 575 | |
576 | 576 | } |
577 | 577 | |
578 | - $p_query = new Give_Payments_Query( $args ); |
|
578 | + $p_query = new Give_Payments_Query($args); |
|
579 | 579 | |
580 | 580 | return $p_query->get_payments(); |
581 | 581 | |
@@ -595,17 +595,17 @@ discard block |
||
595 | 595 | */ |
596 | 596 | public function prepare_items() { |
597 | 597 | |
598 | - wp_reset_vars( array( 'action', 'payment', 'orderby', 'order', 's' ) ); |
|
598 | + wp_reset_vars(array('action', 'payment', 'orderby', 'order', 's')); |
|
599 | 599 | |
600 | 600 | $columns = $this->get_columns(); |
601 | 601 | $hidden = array(); // No hidden columns |
602 | 602 | $sortable = $this->get_sortable_columns(); |
603 | 603 | $data = $this->payments_data(); |
604 | - $status = isset( $_GET['status'] ) ? $_GET['status'] : 'any'; |
|
604 | + $status = isset($_GET['status']) ? $_GET['status'] : 'any'; |
|
605 | 605 | |
606 | - $this->_column_headers = array( $columns, $hidden, $sortable ); |
|
606 | + $this->_column_headers = array($columns, $hidden, $sortable); |
|
607 | 607 | |
608 | - switch ( $status ) { |
|
608 | + switch ($status) { |
|
609 | 609 | case 'publish': |
610 | 610 | $total_items = $this->complete_count; |
611 | 611 | break; |
@@ -629,18 +629,18 @@ discard block |
||
629 | 629 | break; |
630 | 630 | default: |
631 | 631 | // Retrieve the count of the non-default-Give status |
632 | - $count = wp_count_posts( 'give_payment' ); |
|
632 | + $count = wp_count_posts('give_payment'); |
|
633 | 633 | $total_items = $count->{$status}; |
634 | 634 | } |
635 | 635 | |
636 | 636 | $this->items = $data; |
637 | 637 | |
638 | - $this->set_pagination_args( array( |
|
638 | + $this->set_pagination_args(array( |
|
639 | 639 | 'total_items' => $total_items, |
640 | 640 | // WE have to calculate the total number of items |
641 | 641 | 'per_page' => $this->per_page, |
642 | 642 | // WE have to determine how many items to show on a page |
643 | - 'total_pages' => ceil( $total_items / $this->per_page ) |
|
643 | + 'total_pages' => ceil($total_items / $this->per_page) |
|
644 | 644 | // WE have to calculate the total number of pages |
645 | 645 | ) |
646 | 646 | ); |
@@ -80,7 +80,7 @@ |
||
80 | 80 | * |
81 | 81 | * @param $url |
82 | 82 | * |
83 | - * @return mixed |
|
83 | + * @return string |
|
84 | 84 | */ |
85 | 85 | public function give_update_cmb_meta_box_url( $url ) { |
86 | 86 | //Path to Give's CMB |
@@ -43,23 +43,23 @@ discard block |
||
43 | 43 | */ |
44 | 44 | public function __construct() { |
45 | 45 | |
46 | - add_action( 'admin_init', array( $this, 'init' ) ); |
|
46 | + add_action('admin_init', array($this, 'init')); |
|
47 | 47 | |
48 | 48 | //Customize CMB2 URL |
49 | - add_filter( 'cmb2_meta_box_url', array( $this, 'give_update_cmb_meta_box_url' ) ); |
|
49 | + add_filter('cmb2_meta_box_url', array($this, 'give_update_cmb_meta_box_url')); |
|
50 | 50 | |
51 | 51 | //Custom CMB2 Settings Fields |
52 | - add_action( 'cmb2_render_give_title', 'give_title_callback', 10, 5 ); |
|
53 | - add_action( 'cmb2_render_enabled_gateways', 'give_enabled_gateways_callback', 10, 5 ); |
|
54 | - add_action( 'cmb2_render_default_gateway', 'give_default_gateway_callback', 10, 5 ); |
|
55 | - add_action( 'cmb2_render_email_preview_buttons', 'give_email_preview_buttons_callback', 10, 5 ); |
|
56 | - add_action( 'cmb2_render_system_info', 'give_system_info_callback', 10, 5 ); |
|
57 | - add_action( 'cmb2_render_api', 'give_api_callback', 10, 5 ); |
|
58 | - add_action( 'cmb2_render_license_key', 'give_license_key_callback', 10, 5 ); |
|
59 | - add_action( "cmb2_save_options-page_fields", array( $this, 'settings_notices' ), 10, 3 ); |
|
52 | + add_action('cmb2_render_give_title', 'give_title_callback', 10, 5); |
|
53 | + add_action('cmb2_render_enabled_gateways', 'give_enabled_gateways_callback', 10, 5); |
|
54 | + add_action('cmb2_render_default_gateway', 'give_default_gateway_callback', 10, 5); |
|
55 | + add_action('cmb2_render_email_preview_buttons', 'give_email_preview_buttons_callback', 10, 5); |
|
56 | + add_action('cmb2_render_system_info', 'give_system_info_callback', 10, 5); |
|
57 | + add_action('cmb2_render_api', 'give_api_callback', 10, 5); |
|
58 | + add_action('cmb2_render_license_key', 'give_license_key_callback', 10, 5); |
|
59 | + add_action("cmb2_save_options-page_fields", array($this, 'settings_notices'), 10, 3); |
|
60 | 60 | |
61 | 61 | // Include CMB CSS in the head to avoid FOUC |
62 | - add_action( "admin_print_styles-give_forms_page_give-settings", array( 'CMB2_hookup', 'enqueue_cmb_css' ) ); |
|
62 | + add_action("admin_print_styles-give_forms_page_give-settings", array('CMB2_hookup', 'enqueue_cmb_css')); |
|
63 | 63 | |
64 | 64 | } |
65 | 65 | |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | * @since 1.0 |
69 | 69 | */ |
70 | 70 | public function init() { |
71 | - register_setting( $this->key, $this->key ); |
|
71 | + register_setting($this->key, $this->key); |
|
72 | 72 | |
73 | 73 | } |
74 | 74 | |
@@ -82,9 +82,9 @@ discard block |
||
82 | 82 | * |
83 | 83 | * @return mixed |
84 | 84 | */ |
85 | - public function give_update_cmb_meta_box_url( $url ) { |
|
85 | + public function give_update_cmb_meta_box_url($url) { |
|
86 | 86 | //Path to Give's CMB |
87 | - return GIVE_PLUGIN_URL . '/includes/libraries/cmb2'; |
|
87 | + return GIVE_PLUGIN_URL.'/includes/libraries/cmb2'; |
|
88 | 88 | } |
89 | 89 | |
90 | 90 | |
@@ -96,27 +96,27 @@ discard block |
||
96 | 96 | */ |
97 | 97 | public function give_get_settings_tabs() { |
98 | 98 | |
99 | - $settings = $this->give_settings( null ); |
|
99 | + $settings = $this->give_settings(null); |
|
100 | 100 | |
101 | 101 | $tabs = array(); |
102 | - $tabs['general'] = __( 'General', 'give' ); |
|
103 | - $tabs['gateways'] = __( 'Payment Gateways', 'give' ); |
|
104 | - $tabs['display'] = __( 'Display Options', 'give' ); |
|
105 | - $tabs['emails'] = __( 'Emails', 'give' ); |
|
102 | + $tabs['general'] = __('General', 'give'); |
|
103 | + $tabs['gateways'] = __('Payment Gateways', 'give'); |
|
104 | + $tabs['display'] = __('Display Options', 'give'); |
|
105 | + $tabs['emails'] = __('Emails', 'give'); |
|
106 | 106 | |
107 | - if ( ! empty( $settings['addons']['fields'] ) ) { |
|
108 | - $tabs['addons'] = __( 'Add-ons', 'give' ); |
|
107 | + if ( ! empty($settings['addons']['fields'])) { |
|
108 | + $tabs['addons'] = __('Add-ons', 'give'); |
|
109 | 109 | } |
110 | 110 | |
111 | - if ( ! empty( $settings['licenses']['fields'] ) ) { |
|
112 | - $tabs['licenses'] = __( 'Licenses', 'give' ); |
|
111 | + if ( ! empty($settings['licenses']['fields'])) { |
|
112 | + $tabs['licenses'] = __('Licenses', 'give'); |
|
113 | 113 | } |
114 | 114 | |
115 | - $tabs['advanced'] = __( 'Advanced', 'give' ); |
|
116 | - $tabs['api'] = __( 'API', 'give' ); |
|
117 | - $tabs['system_info'] = __( 'System Info', 'give' ); |
|
115 | + $tabs['advanced'] = __('Advanced', 'give'); |
|
116 | + $tabs['api'] = __('API', 'give'); |
|
117 | + $tabs['system_info'] = __('System Info', 'give'); |
|
118 | 118 | |
119 | - return apply_filters( 'give_settings_tabs', $tabs ); |
|
119 | + return apply_filters('give_settings_tabs', $tabs); |
|
120 | 120 | } |
121 | 121 | |
122 | 122 | |
@@ -126,31 +126,31 @@ discard block |
||
126 | 126 | */ |
127 | 127 | public function admin_page_display() { |
128 | 128 | |
129 | - $active_tab = isset( $_GET['tab'] ) && array_key_exists( $_GET['tab'], $this->give_get_settings_tabs() ) ? $_GET['tab'] : 'general'; |
|
129 | + $active_tab = isset($_GET['tab']) && array_key_exists($_GET['tab'], $this->give_get_settings_tabs()) ? $_GET['tab'] : 'general'; |
|
130 | 130 | |
131 | 131 | ?> |
132 | 132 | |
133 | 133 | <div class="wrap give_settings_page cmb2_options_page <?php echo $this->key; ?>"> |
134 | 134 | <h1 class="nav-tab-wrapper"> |
135 | 135 | <?php |
136 | - foreach ( $this->give_get_settings_tabs() as $tab_id => $tab_name ) { |
|
136 | + foreach ($this->give_get_settings_tabs() as $tab_id => $tab_name) { |
|
137 | 137 | |
138 | - $tab_url = esc_url( add_query_arg( array( |
|
138 | + $tab_url = esc_url(add_query_arg(array( |
|
139 | 139 | 'settings-updated' => false, |
140 | 140 | 'tab' => $tab_id |
141 | - ) ) ); |
|
141 | + ))); |
|
142 | 142 | |
143 | 143 | $active = $active_tab == $tab_id ? ' nav-tab-active' : ''; |
144 | 144 | |
145 | - echo '<a href="' . esc_url( $tab_url ) . '" title="' . esc_attr( $tab_name ) . '" class="nav-tab' . $active . '">'; |
|
146 | - echo esc_html( $tab_name ); |
|
145 | + echo '<a href="'.esc_url($tab_url).'" title="'.esc_attr($tab_name).'" class="nav-tab'.$active.'">'; |
|
146 | + echo esc_html($tab_name); |
|
147 | 147 | |
148 | 148 | echo '</a>'; |
149 | 149 | } |
150 | 150 | ?> |
151 | 151 | </h1> |
152 | 152 | |
153 | - <?php cmb2_metabox_form( $this->give_settings( $active_tab ), $this->key ); ?> |
|
153 | + <?php cmb2_metabox_form($this->give_settings($active_tab), $this->key); ?> |
|
154 | 154 | |
155 | 155 | </div><!-- .wrap --> |
156 | 156 | |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | * |
167 | 167 | * @return array |
168 | 168 | */ |
169 | - public function give_settings( $active_tab ) { |
|
169 | + public function give_settings($active_tab) { |
|
170 | 170 | |
171 | 171 | $give_settings = array( |
172 | 172 | /** |
@@ -174,60 +174,60 @@ discard block |
||
174 | 174 | */ |
175 | 175 | 'general' => array( |
176 | 176 | 'id' => 'options_page', |
177 | - 'give_title' => __( 'General Settings', 'give' ), |
|
178 | - 'show_on' => array( 'key' => 'options-page', 'value' => array( $this->key, ), ), |
|
179 | - 'fields' => apply_filters( 'give_settings_general', array( |
|
177 | + 'give_title' => __('General Settings', 'give'), |
|
178 | + 'show_on' => array('key' => 'options-page', 'value' => array($this->key,),), |
|
179 | + 'fields' => apply_filters('give_settings_general', array( |
|
180 | 180 | array( |
181 | - 'name' => __( 'General Settings', 'give' ), |
|
181 | + 'name' => __('General Settings', 'give'), |
|
182 | 182 | 'desc' => '<hr>', |
183 | 183 | 'type' => 'give_title', |
184 | 184 | 'id' => 'give_title_general_settings_1' |
185 | 185 | ), |
186 | 186 | array( |
187 | - 'name' => __( 'Success Page', 'give' ), |
|
188 | - 'desc' => __( 'This is the page donators are sent to after completing their donations. The <code>[give_receipt]</code> shortcode should be on this page.', 'give' ), |
|
187 | + 'name' => __('Success Page', 'give'), |
|
188 | + 'desc' => __('This is the page donators are sent to after completing their donations. The <code>[give_receipt]</code> shortcode should be on this page.', 'give'), |
|
189 | 189 | 'id' => 'success_page', |
190 | 190 | 'type' => 'select', |
191 | - 'options' => give_cmb2_get_post_options( array( |
|
191 | + 'options' => give_cmb2_get_post_options(array( |
|
192 | 192 | 'post_type' => 'page', |
193 | - 'numberposts' => - 1 |
|
194 | - ) ), |
|
193 | + 'numberposts' => -1 |
|
194 | + )), |
|
195 | 195 | ), |
196 | 196 | array( |
197 | - 'name' => __( 'Failed Transaction Page', 'give' ), |
|
198 | - 'desc' => __( 'This is the page donors are sent to if their transaction is cancelled or fails.', 'give' ), |
|
197 | + 'name' => __('Failed Transaction Page', 'give'), |
|
198 | + 'desc' => __('This is the page donors are sent to if their transaction is cancelled or fails.', 'give'), |
|
199 | 199 | 'id' => 'failure_page', |
200 | 200 | 'type' => 'select', |
201 | - 'options' => give_cmb2_get_post_options( array( |
|
201 | + 'options' => give_cmb2_get_post_options(array( |
|
202 | 202 | 'post_type' => 'page', |
203 | - 'numberposts' => - 1 |
|
204 | - ) ), |
|
203 | + 'numberposts' => -1 |
|
204 | + )), |
|
205 | 205 | ), |
206 | 206 | array( |
207 | - 'name' => __( 'Donation History Page', 'give' ), |
|
208 | - 'desc' => __( 'This page shows a complete donation history for the current user. The <code>[donation_history]</code> shortcode should be on this page.', 'give' ), |
|
207 | + 'name' => __('Donation History Page', 'give'), |
|
208 | + 'desc' => __('This page shows a complete donation history for the current user. The <code>[donation_history]</code> shortcode should be on this page.', 'give'), |
|
209 | 209 | 'id' => 'history_page', |
210 | 210 | 'type' => 'select', |
211 | - 'options' => give_cmb2_get_post_options( array( |
|
211 | + 'options' => give_cmb2_get_post_options(array( |
|
212 | 212 | 'post_type' => 'page', |
213 | - 'numberposts' => - 1 |
|
214 | - ) ), |
|
213 | + 'numberposts' => -1 |
|
214 | + )), |
|
215 | 215 | ), |
216 | 216 | array( |
217 | - 'name' => __( 'Base Country', 'give' ), |
|
218 | - 'desc' => __( 'Where does your site operate from?', 'give' ), |
|
217 | + 'name' => __('Base Country', 'give'), |
|
218 | + 'desc' => __('Where does your site operate from?', 'give'), |
|
219 | 219 | 'id' => 'base_country', |
220 | 220 | 'type' => 'select', |
221 | 221 | 'options' => give_get_country_list(), |
222 | 222 | ), |
223 | 223 | array( |
224 | - 'name' => __( 'Currency Settings', 'give' ), |
|
224 | + 'name' => __('Currency Settings', 'give'), |
|
225 | 225 | 'desc' => '<hr>', |
226 | 226 | 'type' => 'give_title', |
227 | 227 | 'id' => 'give_title_general_settings_2' |
228 | 228 | ), |
229 | 229 | array( |
230 | - 'name' => __( 'Currency', 'give' ), |
|
230 | + 'name' => __('Currency', 'give'), |
|
231 | 231 | 'desc' => 'Choose your currency. Note that some payment gateways have currency restrictions.', |
232 | 232 | 'id' => 'currency', |
233 | 233 | 'type' => 'select', |
@@ -235,26 +235,26 @@ discard block |
||
235 | 235 | 'default' => 'USD', |
236 | 236 | ), |
237 | 237 | array( |
238 | - 'name' => __( 'Currency Position', 'give' ), |
|
238 | + 'name' => __('Currency Position', 'give'), |
|
239 | 239 | 'desc' => 'Choose the position of the currency sign.', |
240 | 240 | 'id' => 'currency_position', |
241 | 241 | 'type' => 'select', |
242 | 242 | 'options' => array( |
243 | - 'before' => __( 'Before - $10', 'give' ), |
|
244 | - 'after' => __( 'After - 10$', 'give' ) |
|
243 | + 'before' => __('Before - $10', 'give'), |
|
244 | + 'after' => __('After - 10$', 'give') |
|
245 | 245 | ), |
246 | 246 | 'default' => 'before', |
247 | 247 | ), |
248 | 248 | array( |
249 | - 'name' => __( 'Thousands Separator', 'give' ), |
|
250 | - 'desc' => __( 'The symbol (typically , or .) to separate thousands', 'give' ), |
|
249 | + 'name' => __('Thousands Separator', 'give'), |
|
250 | + 'desc' => __('The symbol (typically , or .) to separate thousands', 'give'), |
|
251 | 251 | 'id' => 'thousands_separator', |
252 | 252 | 'type' => 'text_small', |
253 | 253 | 'default' => ',', |
254 | 254 | ), |
255 | 255 | array( |
256 | - 'name' => __( 'Decimal Separator', 'give' ), |
|
257 | - 'desc' => __( 'The symbol (usually , or .) to separate decimal points', 'give' ), |
|
256 | + 'name' => __('Decimal Separator', 'give'), |
|
257 | + 'desc' => __('The symbol (usually , or .) to separate decimal points', 'give'), |
|
258 | 258 | 'id' => 'decimal_separator', |
259 | 259 | 'type' => 'text_small', |
260 | 260 | 'default' => '.', |
@@ -267,83 +267,83 @@ discard block |
||
267 | 267 | */ |
268 | 268 | 'gateways' => array( |
269 | 269 | 'id' => 'options_page', |
270 | - 'give_title' => __( 'Payment Gateways', 'give' ), |
|
271 | - 'show_on' => array( 'key' => 'options-page', 'value' => array( $this->key, ), ), |
|
272 | - 'fields' => apply_filters( 'give_settings_gateways', array( |
|
270 | + 'give_title' => __('Payment Gateways', 'give'), |
|
271 | + 'show_on' => array('key' => 'options-page', 'value' => array($this->key,),), |
|
272 | + 'fields' => apply_filters('give_settings_gateways', array( |
|
273 | 273 | array( |
274 | - 'name' => __( 'Gateways Settings', 'give' ), |
|
274 | + 'name' => __('Gateways Settings', 'give'), |
|
275 | 275 | 'desc' => '<hr>', |
276 | 276 | 'id' => 'give_title_gateway_settings_1', |
277 | 277 | 'type' => 'give_title' |
278 | 278 | ), |
279 | 279 | array( |
280 | - 'name' => __( 'Test Mode', 'give' ), |
|
281 | - 'desc' => __( 'While in test mode no live transactions are processed. To fully use test mode, you must have a sandbox (test) account for the payment gateway you are testing.', 'give' ), |
|
280 | + 'name' => __('Test Mode', 'give'), |
|
281 | + 'desc' => __('While in test mode no live transactions are processed. To fully use test mode, you must have a sandbox (test) account for the payment gateway you are testing.', 'give'), |
|
282 | 282 | 'id' => 'test_mode', |
283 | 283 | 'type' => 'checkbox' |
284 | 284 | ), |
285 | 285 | array( |
286 | - 'name' => __( 'Enabled Gateways', 'give' ), |
|
287 | - 'desc' => __( 'Choose the payment gateways you would like enabled.', 'give' ), |
|
286 | + 'name' => __('Enabled Gateways', 'give'), |
|
287 | + 'desc' => __('Choose the payment gateways you would like enabled.', 'give'), |
|
288 | 288 | 'id' => 'gateways', |
289 | 289 | 'type' => 'enabled_gateways' |
290 | 290 | ), |
291 | 291 | array( |
292 | - 'name' => __( 'Default Gateway', 'give' ), |
|
293 | - 'desc' => __( 'This is the gateway that will be selected by default.', 'give' ), |
|
292 | + 'name' => __('Default Gateway', 'give'), |
|
293 | + 'desc' => __('This is the gateway that will be selected by default.', 'give'), |
|
294 | 294 | 'id' => 'default_gateway', |
295 | 295 | 'type' => 'default_gateway' |
296 | 296 | ), |
297 | 297 | array( |
298 | - 'name' => __( 'PayPal Standard', 'give' ), |
|
298 | + 'name' => __('PayPal Standard', 'give'), |
|
299 | 299 | 'desc' => '<hr>', |
300 | 300 | 'type' => 'give_title', |
301 | 301 | 'id' => 'give_title_gateway_settings_2', |
302 | 302 | ), |
303 | 303 | array( |
304 | - 'name' => __( 'PayPal Email', 'give' ), |
|
305 | - 'desc' => __( 'Enter your PayPal account\'s email', 'give' ), |
|
304 | + 'name' => __('PayPal Email', 'give'), |
|
305 | + 'desc' => __('Enter your PayPal account\'s email', 'give'), |
|
306 | 306 | 'id' => 'paypal_email', |
307 | 307 | 'type' => 'text_email', |
308 | 308 | ), |
309 | 309 | array( |
310 | - 'name' => __( 'PayPal Page Style', 'give' ), |
|
311 | - 'desc' => __( 'Enter the name of the page style to use, or leave blank to use the default', 'give' ), |
|
310 | + 'name' => __('PayPal Page Style', 'give'), |
|
311 | + 'desc' => __('Enter the name of the page style to use, or leave blank to use the default', 'give'), |
|
312 | 312 | 'id' => 'paypal_page_style', |
313 | 313 | 'type' => 'text', |
314 | 314 | ), |
315 | 315 | array( |
316 | - 'name' => __( 'PayPal Transaction Type', 'give' ), |
|
317 | - 'desc' => __( 'Nonprofits must verify their status to withdraw donations they receive via PayPal. PayPal users that are not verified nonprofits must demonstrate how their donations will be used, once they raise more than $10,000. By default, Give transactions are sent to PayPal as donations. You may change the transaction type using this option if you feel you may not meet PayPal\'s donation requirements.', 'give' ), |
|
316 | + 'name' => __('PayPal Transaction Type', 'give'), |
|
317 | + 'desc' => __('Nonprofits must verify their status to withdraw donations they receive via PayPal. PayPal users that are not verified nonprofits must demonstrate how their donations will be used, once they raise more than $10,000. By default, Give transactions are sent to PayPal as donations. You may change the transaction type using this option if you feel you may not meet PayPal\'s donation requirements.', 'give'), |
|
318 | 318 | 'id' => 'paypal_button_type', |
319 | 319 | 'type' => 'radio_inline', |
320 | 320 | 'options' => array( |
321 | - 'donation' => __( 'Donation', 'give' ), |
|
322 | - 'standard' => __( 'Standard Transaction', 'give' ) |
|
321 | + 'donation' => __('Donation', 'give'), |
|
322 | + 'standard' => __('Standard Transaction', 'give') |
|
323 | 323 | ), |
324 | 324 | 'default' => 'donation', |
325 | 325 | ), |
326 | 326 | array( |
327 | - 'name' => __( 'Disable PayPal IPN Verification', 'give' ), |
|
328 | - 'desc' => __( 'If donations are not getting marked as complete, then check this box. This forces the site to use a slightly less secure method of verifying donations.', 'give' ), |
|
327 | + 'name' => __('Disable PayPal IPN Verification', 'give'), |
|
328 | + 'desc' => __('If donations are not getting marked as complete, then check this box. This forces the site to use a slightly less secure method of verifying donations.', 'give'), |
|
329 | 329 | 'id' => 'disable_paypal_verification', |
330 | 330 | 'type' => 'checkbox' |
331 | 331 | ), |
332 | 332 | array( |
333 | - 'name' => __( 'Offline Donations', 'give' ), |
|
333 | + 'name' => __('Offline Donations', 'give'), |
|
334 | 334 | 'desc' => '<hr>', |
335 | 335 | 'type' => 'give_title', |
336 | 336 | 'id' => 'give_title_gateway_settings_3', |
337 | 337 | ), |
338 | 338 | array( |
339 | - 'name' => __( 'Collect Billing Details', 'give' ), |
|
340 | - 'desc' => __( 'This option will enable the billing details section for offline donations. The fieldset will appear above the offline donation instructions. Note: You may customize this option per form as needed.', 'give' ), |
|
339 | + 'name' => __('Collect Billing Details', 'give'), |
|
340 | + 'desc' => __('This option will enable the billing details section for offline donations. The fieldset will appear above the offline donation instructions. Note: You may customize this option per form as needed.', 'give'), |
|
341 | 341 | 'id' => 'give_offline_donation_enable_billing_fields', |
342 | 342 | 'type' => 'checkbox' |
343 | 343 | ), |
344 | 344 | array( |
345 | - 'name' => __( 'Offline Donation Instructions', 'give' ), |
|
346 | - 'desc' => __( 'The following content will appear for all forms when the user selects the offline donation payment option. Note: You may customize the content per form as needed.', 'give' ), |
|
345 | + 'name' => __('Offline Donation Instructions', 'give'), |
|
346 | + 'desc' => __('The following content will appear for all forms when the user selects the offline donation payment option. Note: You may customize the content per form as needed.', 'give'), |
|
347 | 347 | 'id' => 'global_offline_donation_content', |
348 | 348 | 'default' => give_get_default_offline_donation_content(), |
349 | 349 | 'type' => 'wysiwyg', |
@@ -352,15 +352,15 @@ discard block |
||
352 | 352 | ) |
353 | 353 | ), |
354 | 354 | array( |
355 | - 'name' => __( 'Offline Donation Email Instructions Subject', 'give' ), |
|
356 | - 'desc' => __( 'Enter the subject line for the donation receipt email.', 'give' ), |
|
355 | + 'name' => __('Offline Donation Email Instructions Subject', 'give'), |
|
356 | + 'desc' => __('Enter the subject line for the donation receipt email.', 'give'), |
|
357 | 357 | 'id' => 'offline_donation_subject', |
358 | - 'default' => __( '{donation} - Offline Donation Instructions', 'give' ), |
|
358 | + 'default' => __('{donation} - Offline Donation Instructions', 'give'), |
|
359 | 359 | 'type' => 'text' |
360 | 360 | ), |
361 | 361 | array( |
362 | - 'name' => __( 'Offline Donation Email Instructions', 'give' ), |
|
363 | - 'desc' => __( 'Enter the instructions you want emailed to the donor after they have submitted the donation form. Most likely this would include important information like mailing address and who to make the check out to.', 'give' ), |
|
362 | + 'name' => __('Offline Donation Email Instructions', 'give'), |
|
363 | + 'desc' => __('Enter the instructions you want emailed to the donor after they have submitted the donation form. Most likely this would include important information like mailing address and who to make the check out to.', 'give'), |
|
364 | 364 | 'id' => 'global_offline_donation_email', |
365 | 365 | 'default' => give_get_default_offline_donation_email_content(), |
366 | 366 | 'type' => 'wysiwyg', |
@@ -374,84 +374,84 @@ discard block |
||
374 | 374 | /** Display Settings */ |
375 | 375 | 'display' => array( |
376 | 376 | 'id' => 'options_page', |
377 | - 'give_title' => __( 'Display Settings', 'give' ), |
|
378 | - 'show_on' => array( 'key' => 'options-page', 'value' => array( $this->key, ), ), |
|
379 | - 'fields' => apply_filters( 'give_settings_display', array( |
|
377 | + 'give_title' => __('Display Settings', 'give'), |
|
378 | + 'show_on' => array('key' => 'options-page', 'value' => array($this->key,),), |
|
379 | + 'fields' => apply_filters('give_settings_display', array( |
|
380 | 380 | array( |
381 | - 'name' => __( 'Display Settings', 'give' ), |
|
381 | + 'name' => __('Display Settings', 'give'), |
|
382 | 382 | 'desc' => '<hr>', |
383 | 383 | 'id' => 'give_title_display_settings_1', |
384 | 384 | 'type' => 'give_title' |
385 | 385 | ), |
386 | 386 | array( |
387 | - 'name' => __( 'Disable CSS', 'give' ), |
|
388 | - 'desc' => __( 'Enable this option if you would like to disable all of Give\'s included CSS stylesheets.', 'give' ), |
|
387 | + 'name' => __('Disable CSS', 'give'), |
|
388 | + 'desc' => __('Enable this option if you would like to disable all of Give\'s included CSS stylesheets.', 'give'), |
|
389 | 389 | 'id' => 'disable_css', |
390 | 390 | 'type' => 'checkbox' |
391 | 391 | ), |
392 | 392 | array( |
393 | - 'name' => __( 'Enable Floating Labels', 'give' ), |
|
394 | - 'desc' => sprintf( __( 'Enable this option if you would like to enable <a href="%s" target="_blank">floating labels</a> in Give\'s donation forms.<br>Be aware that if you have the "Disable CSS" option enabled, you will need to style the floating labels yourself.', 'give' ), esc_url( "http://bradfrost.com/blog/post/float-label-pattern/" ) ), |
|
393 | + 'name' => __('Enable Floating Labels', 'give'), |
|
394 | + 'desc' => sprintf(__('Enable this option if you would like to enable <a href="%s" target="_blank">floating labels</a> in Give\'s donation forms.<br>Be aware that if you have the "Disable CSS" option enabled, you will need to style the floating labels yourself.', 'give'), esc_url("http://bradfrost.com/blog/post/float-label-pattern/")), |
|
395 | 395 | 'id' => 'enable_floatlabels', |
396 | 396 | 'type' => 'checkbox' |
397 | 397 | ), |
398 | 398 | array( |
399 | - 'name' => __( 'Disable Welcome Screen', 'give' ), |
|
400 | - 'desc' => sprintf( __( 'Enable this option if you would like to disable the Give Welcome screen every time Give is activated and/or updated. You can always access the Welcome Screen <a href="%s">here</a> if you want in the future.', 'give' ), esc_url( admin_url( 'index.php?page=give-about' ) ) ), |
|
399 | + 'name' => __('Disable Welcome Screen', 'give'), |
|
400 | + 'desc' => sprintf(__('Enable this option if you would like to disable the Give Welcome screen every time Give is activated and/or updated. You can always access the Welcome Screen <a href="%s">here</a> if you want in the future.', 'give'), esc_url(admin_url('index.php?page=give-about'))), |
|
401 | 401 | 'id' => 'disable_welcome', |
402 | 402 | 'type' => 'checkbox' |
403 | 403 | ), |
404 | 404 | array( |
405 | - 'name' => __( 'Post Types', 'give' ), |
|
405 | + 'name' => __('Post Types', 'give'), |
|
406 | 406 | 'desc' => '<hr>', |
407 | 407 | 'id' => 'give_title_display_settings_2', |
408 | 408 | 'type' => 'give_title' |
409 | 409 | ), |
410 | 410 | array( |
411 | - 'name' => __( 'Disable Form Single Views', 'give' ), |
|
412 | - 'desc' => __( 'By default, all forms have single views enabled which create a specific URL on your website for that form. This option disables the singular and archive views from being publicly viewable. Note: you will need to embed forms using a shortcode or widget if enabled.', 'give' ), |
|
411 | + 'name' => __('Disable Form Single Views', 'give'), |
|
412 | + 'desc' => __('By default, all forms have single views enabled which create a specific URL on your website for that form. This option disables the singular and archive views from being publicly viewable. Note: you will need to embed forms using a shortcode or widget if enabled.', 'give'), |
|
413 | 413 | 'id' => 'disable_forms_singular', |
414 | 414 | 'type' => 'checkbox' |
415 | 415 | ), |
416 | 416 | array( |
417 | - 'name' => __( 'Disable Form Archives', 'give' ), |
|
418 | - 'desc' => __( 'Archives pages list all the forms you have created. This option will disable only the form\'s archive page(s). The single form\'s view will remain in place. Note: you will need to refresh your permalinks after this option has been enabled.', 'give' ), |
|
417 | + 'name' => __('Disable Form Archives', 'give'), |
|
418 | + 'desc' => __('Archives pages list all the forms you have created. This option will disable only the form\'s archive page(s). The single form\'s view will remain in place. Note: you will need to refresh your permalinks after this option has been enabled.', 'give'), |
|
419 | 419 | 'id' => 'disable_forms_archives', |
420 | 420 | 'type' => 'checkbox' |
421 | 421 | ), |
422 | 422 | array( |
423 | - 'name' => __( 'Disable Form Excerpts', 'give' ), |
|
424 | - 'desc' => __( 'The excerpt is an optional summary or description of a donation form; in short, a summary as to why the user should give.', 'give' ), |
|
423 | + 'name' => __('Disable Form Excerpts', 'give'), |
|
424 | + 'desc' => __('The excerpt is an optional summary or description of a donation form; in short, a summary as to why the user should give.', 'give'), |
|
425 | 425 | 'id' => 'disable_forms_excerpt', |
426 | 426 | 'type' => 'checkbox' |
427 | 427 | ), |
428 | 428 | array( |
429 | - 'name' => __( 'Disable Form Featured Image', 'give' ), |
|
430 | - 'desc' => __( 'The Featured Image is an image that is chosen as the representative image for donation form. The display of this image is largely up to the theme. If you do not wish to use the featured image you can disable it using this option.', 'give' ), |
|
429 | + 'name' => __('Disable Form Featured Image', 'give'), |
|
430 | + 'desc' => __('The Featured Image is an image that is chosen as the representative image for donation form. The display of this image is largely up to the theme. If you do not wish to use the featured image you can disable it using this option.', 'give'), |
|
431 | 431 | 'id' => 'disable_form_featured_img', |
432 | 432 | 'type' => 'checkbox' |
433 | 433 | ), |
434 | 434 | array( |
435 | - 'name' => __( 'Disable Single Form Sidebar', 'give' ), |
|
436 | - 'desc' => __( 'The sidebar allows you to add additional widget to the Give single form view. If you don\'t plan on using the sidebar you may disable it with this option.', 'give' ), |
|
435 | + 'name' => __('Disable Single Form Sidebar', 'give'), |
|
436 | + 'desc' => __('The sidebar allows you to add additional widget to the Give single form view. If you don\'t plan on using the sidebar you may disable it with this option.', 'give'), |
|
437 | 437 | 'id' => 'disable_form_sidebar', |
438 | 438 | 'type' => 'checkbox' |
439 | 439 | ), |
440 | 440 | array( |
441 | - 'name' => __( 'Taxonomies', 'give' ), |
|
441 | + 'name' => __('Taxonomies', 'give'), |
|
442 | 442 | 'desc' => '<hr>', |
443 | 443 | 'id' => 'give_title_display_settings_3', |
444 | 444 | 'type' => 'give_title' |
445 | 445 | ), |
446 | 446 | array( |
447 | - 'name' => __( 'Enable Form Categories', 'give' ), |
|
448 | - 'desc' => __( 'Check this option if you would like to categorize your donation forms. This option enables the form\'s category taxonomy.', 'give' ), |
|
447 | + 'name' => __('Enable Form Categories', 'give'), |
|
448 | + 'desc' => __('Check this option if you would like to categorize your donation forms. This option enables the form\'s category taxonomy.', 'give'), |
|
449 | 449 | 'id' => 'enable_categories', |
450 | 450 | 'type' => 'checkbox' |
451 | 451 | ), |
452 | 452 | array( |
453 | - 'name' => __( 'Enable Form Tags', 'give' ), |
|
454 | - 'desc' => __( 'Check this option if you would like to tag your donation forms. This option enables the form\'s tag taxonomy.', 'give' ), |
|
453 | + 'name' => __('Enable Form Tags', 'give'), |
|
454 | + 'desc' => __('Check this option if you would like to tag your donation forms. This option enables the form\'s tag taxonomy.', 'give'), |
|
455 | 455 | 'id' => 'enable_tags', |
456 | 456 | 'type' => 'checkbox' |
457 | 457 | ), |
@@ -464,93 +464,93 @@ discard block |
||
464 | 464 | */ |
465 | 465 | 'emails' => array( |
466 | 466 | 'id' => 'options_page', |
467 | - 'give_title' => __( 'Give Email Settings', 'give' ), |
|
468 | - 'show_on' => array( 'key' => 'options-page', 'value' => array( $this->key, ), ), |
|
469 | - 'fields' => apply_filters( 'give_settings_emails', array( |
|
467 | + 'give_title' => __('Give Email Settings', 'give'), |
|
468 | + 'show_on' => array('key' => 'options-page', 'value' => array($this->key,),), |
|
469 | + 'fields' => apply_filters('give_settings_emails', array( |
|
470 | 470 | array( |
471 | - 'name' => __( 'Email Settings', 'give' ), |
|
471 | + 'name' => __('Email Settings', 'give'), |
|
472 | 472 | 'desc' => '<hr>', |
473 | 473 | 'id' => 'give_title_email_settings_1', |
474 | 474 | 'type' => 'give_title' |
475 | 475 | ), |
476 | 476 | array( |
477 | 477 | 'id' => 'email_template', |
478 | - 'name' => __( 'Email Template', 'give' ), |
|
479 | - 'desc' => __( 'Choose a template. Click "Save Changes" then "Preview Donation Receipt" to see the new template.', 'give' ), |
|
478 | + 'name' => __('Email Template', 'give'), |
|
479 | + 'desc' => __('Choose a template. Click "Save Changes" then "Preview Donation Receipt" to see the new template.', 'give'), |
|
480 | 480 | 'type' => 'select', |
481 | 481 | 'options' => give_get_email_templates() |
482 | 482 | ), |
483 | 483 | array( |
484 | 484 | 'id' => 'email_logo', |
485 | - 'name' => __( 'Logo', 'give' ), |
|
486 | - 'desc' => __( 'Upload or choose a logo to be displayed at the top of the donation receipt emails. Displayed on HTML emails only.', 'give' ), |
|
485 | + 'name' => __('Logo', 'give'), |
|
486 | + 'desc' => __('Upload or choose a logo to be displayed at the top of the donation receipt emails. Displayed on HTML emails only.', 'give'), |
|
487 | 487 | 'type' => 'file' |
488 | 488 | ), |
489 | 489 | array( |
490 | 490 | 'id' => 'from_name', |
491 | - 'name' => __( 'From Name', 'give' ), |
|
492 | - 'desc' => __( 'The name donation receipts are said to come from. This should probably be your site or shop name.', 'give' ), |
|
493 | - 'default' => get_bloginfo( 'name' ), |
|
491 | + 'name' => __('From Name', 'give'), |
|
492 | + 'desc' => __('The name donation receipts are said to come from. This should probably be your site or shop name.', 'give'), |
|
493 | + 'default' => get_bloginfo('name'), |
|
494 | 494 | 'type' => 'text' |
495 | 495 | ), |
496 | 496 | array( |
497 | 497 | 'id' => 'from_email', |
498 | - 'name' => __( 'From Email', 'give' ), |
|
499 | - 'desc' => __( 'Email to send donation receipts from. This will act as the "from" and "reply-to" address.', 'give' ), |
|
500 | - 'default' => get_bloginfo( 'admin_email' ), |
|
498 | + 'name' => __('From Email', 'give'), |
|
499 | + 'desc' => __('Email to send donation receipts from. This will act as the "from" and "reply-to" address.', 'give'), |
|
500 | + 'default' => get_bloginfo('admin_email'), |
|
501 | 501 | 'type' => 'text' |
502 | 502 | ), |
503 | 503 | array( |
504 | - 'name' => __( 'Donation Receipt', 'give' ), |
|
504 | + 'name' => __('Donation Receipt', 'give'), |
|
505 | 505 | 'desc' => '<hr>', |
506 | 506 | 'id' => 'give_title_email_settings_2', |
507 | 507 | 'type' => 'give_title' |
508 | 508 | ), |
509 | 509 | array( |
510 | 510 | 'id' => 'donation_subject', |
511 | - 'name' => __( 'Donation Email Subject', 'give' ), |
|
512 | - 'desc' => __( 'Enter the subject line for the donation receipt email', 'give' ), |
|
513 | - 'default' => __( 'Donation Receipt', 'give' ), |
|
511 | + 'name' => __('Donation Email Subject', 'give'), |
|
512 | + 'desc' => __('Enter the subject line for the donation receipt email', 'give'), |
|
513 | + 'default' => __('Donation Receipt', 'give'), |
|
514 | 514 | 'type' => 'text' |
515 | 515 | ), |
516 | 516 | array( |
517 | 517 | 'id' => 'donation_receipt', |
518 | - 'name' => __( 'Donation Receipt', 'give' ), |
|
519 | - 'desc' => __( 'Enter the email that is sent to users after completing a successful donation. HTML is accepted. Available template tags:', 'give' ) . '<br/>' . give_get_emails_tags_list(), |
|
518 | + 'name' => __('Donation Receipt', 'give'), |
|
519 | + 'desc' => __('Enter the email that is sent to users after completing a successful donation. HTML is accepted. Available template tags:', 'give').'<br/>'.give_get_emails_tags_list(), |
|
520 | 520 | 'type' => 'wysiwyg', |
521 | - 'default' => __( "Dear", "give" ) . " {name},\n\n" . __( "Thank you for your donation. Your generosity is appreciated! Please click on the link below to view your receipt.", "give" ) . "\n\n{receipt_link}\n\nSincerely,\n{sitename}" |
|
521 | + 'default' => __("Dear", "give")." {name},\n\n".__("Thank you for your donation. Your generosity is appreciated! Please click on the link below to view your receipt.", "give")."\n\n{receipt_link}\n\nSincerely,\n{sitename}" |
|
522 | 522 | ), |
523 | 523 | array( |
524 | - 'name' => __( 'New Donation Notification', 'give' ), |
|
524 | + 'name' => __('New Donation Notification', 'give'), |
|
525 | 525 | 'desc' => '<hr>', |
526 | 526 | 'id' => 'give_title_email_settings_3', |
527 | 527 | 'type' => 'give_title' |
528 | 528 | ), |
529 | 529 | array( |
530 | 530 | 'id' => 'donation_notification_subject', |
531 | - 'name' => __( 'Donation Notification Subject', 'give' ), |
|
532 | - 'desc' => __( 'Enter the subject line for the donation notification email', 'give' ), |
|
531 | + 'name' => __('Donation Notification Subject', 'give'), |
|
532 | + 'desc' => __('Enter the subject line for the donation notification email', 'give'), |
|
533 | 533 | 'type' => 'text', |
534 | - 'default' => __( 'New Donation - #{payment_id}', 'give' ) |
|
534 | + 'default' => __('New Donation - #{payment_id}', 'give') |
|
535 | 535 | ), |
536 | 536 | array( |
537 | 537 | 'id' => 'donation_notification', |
538 | - 'name' => __( 'Donation Notification', 'give' ), |
|
539 | - 'desc' => __( 'Enter the email that is sent to donation notification emails after completion of a donation. HTML is accepted. Available template tags:', 'give' ) . '<br/>' . give_get_emails_tags_list(), |
|
538 | + 'name' => __('Donation Notification', 'give'), |
|
539 | + 'desc' => __('Enter the email that is sent to donation notification emails after completion of a donation. HTML is accepted. Available template tags:', 'give').'<br/>'.give_get_emails_tags_list(), |
|
540 | 540 | 'type' => 'wysiwyg', |
541 | 541 | 'default' => give_get_default_donation_notification_email() |
542 | 542 | ), |
543 | 543 | array( |
544 | 544 | 'id' => 'admin_notice_emails', |
545 | - 'name' => __( 'Donation Notification Emails', 'give' ), |
|
546 | - 'desc' => sprintf( __( 'Enter the email address(es) that should receive a notification anytime a donation is made, please only enter %1$sone email address per line%2$s and not separated by commas.', 'give' ), '<span class="give-underline">', '</span>' ), |
|
545 | + 'name' => __('Donation Notification Emails', 'give'), |
|
546 | + 'desc' => sprintf(__('Enter the email address(es) that should receive a notification anytime a donation is made, please only enter %1$sone email address per line%2$s and not separated by commas.', 'give'), '<span class="give-underline">', '</span>'), |
|
547 | 547 | 'type' => 'textarea', |
548 | - 'default' => get_bloginfo( 'admin_email' ) |
|
548 | + 'default' => get_bloginfo('admin_email') |
|
549 | 549 | ), |
550 | 550 | array( |
551 | 551 | 'id' => 'disable_admin_notices', |
552 | - 'name' => __( 'Disable Admin Notifications', 'give' ), |
|
553 | - 'desc' => __( 'Check this box if you do not want to receive emails when new donations are made.', 'give' ), |
|
552 | + 'name' => __('Disable Admin Notifications', 'give'), |
|
553 | + 'desc' => __('Check this box if you do not want to receive emails when new donations are made.', 'give'), |
|
554 | 554 | 'type' => 'checkbox' |
555 | 555 | ) |
556 | 556 | ) |
@@ -559,76 +559,76 @@ discard block |
||
559 | 559 | /** Extension Settings */ |
560 | 560 | 'addons' => array( |
561 | 561 | 'id' => 'options_page', |
562 | - 'give_title' => __( 'Give Add-ons Settings', 'give' ), |
|
563 | - 'show_on' => array( 'key' => 'options-page', 'value' => array( $this->key, ), ), |
|
564 | - 'fields' => apply_filters( 'give_settings_addons', array() |
|
562 | + 'give_title' => __('Give Add-ons Settings', 'give'), |
|
563 | + 'show_on' => array('key' => 'options-page', 'value' => array($this->key,),), |
|
564 | + 'fields' => apply_filters('give_settings_addons', array() |
|
565 | 565 | ) |
566 | 566 | ), |
567 | 567 | /** Licenses Settings */ |
568 | 568 | 'licenses' => array( |
569 | 569 | 'id' => 'options_page', |
570 | - 'give_title' => __( 'Give Licenses', 'give' ), |
|
571 | - 'show_on' => array( 'key' => 'options-page', 'value' => array( $this->key, ), ), |
|
572 | - 'fields' => apply_filters( 'give_settings_licenses', array() |
|
570 | + 'give_title' => __('Give Licenses', 'give'), |
|
571 | + 'show_on' => array('key' => 'options-page', 'value' => array($this->key,),), |
|
572 | + 'fields' => apply_filters('give_settings_licenses', array() |
|
573 | 573 | ) |
574 | 574 | ), |
575 | 575 | /** Advanced Options */ |
576 | 576 | 'advanced' => array( |
577 | 577 | 'id' => 'options_page', |
578 | - 'give_title' => __( 'Advanced Options', 'give' ), |
|
579 | - 'show_on' => array( 'key' => 'options-page', 'value' => array( $this->key, ), ), |
|
580 | - 'fields' => apply_filters( 'give_settings_advanced', array( |
|
578 | + 'give_title' => __('Advanced Options', 'give'), |
|
579 | + 'show_on' => array('key' => 'options-page', 'value' => array($this->key,),), |
|
580 | + 'fields' => apply_filters('give_settings_advanced', array( |
|
581 | 581 | array( |
582 | - 'name' => __( 'Session Control', 'give' ), |
|
582 | + 'name' => __('Session Control', 'give'), |
|
583 | 583 | 'desc' => '<hr>', |
584 | 584 | 'id' => 'give_title_session_control_1', |
585 | 585 | 'type' => 'give_title' |
586 | 586 | ), |
587 | 587 | array( |
588 | 588 | 'id' => 'session_lifetime', |
589 | - 'name' => __( 'Session Lifetime', 'give' ), |
|
590 | - 'desc' => __( 'Give will start a new session per user once they have donated. This option controls the lifetime a user\'s session is kept alive. An active session allows users to view donation receipts on your site without having to be logged in.', 'give' ), |
|
589 | + 'name' => __('Session Lifetime', 'give'), |
|
590 | + 'desc' => __('Give will start a new session per user once they have donated. This option controls the lifetime a user\'s session is kept alive. An active session allows users to view donation receipts on your site without having to be logged in.', 'give'), |
|
591 | 591 | 'type' => 'select', |
592 | 592 | 'options' => array( |
593 | - '86400' => __( '24 Hours', 'give' ), |
|
594 | - '172800' => __( '48 Hours', 'give' ), |
|
595 | - '259200' => __( '72 Hours', 'give' ), |
|
596 | - '604800' => __( '1 Week', 'give' ), |
|
593 | + '86400' => __('24 Hours', 'give'), |
|
594 | + '172800' => __('48 Hours', 'give'), |
|
595 | + '259200' => __('72 Hours', 'give'), |
|
596 | + '604800' => __('1 Week', 'give'), |
|
597 | 597 | ) |
598 | 598 | ), |
599 | 599 | array( |
600 | - 'name' => __( 'Data Control', 'give' ), |
|
600 | + 'name' => __('Data Control', 'give'), |
|
601 | 601 | 'desc' => '<hr>', |
602 | 602 | 'id' => 'give_title_data_control_2', |
603 | 603 | 'type' => 'give_title' |
604 | 604 | ), |
605 | 605 | array( |
606 | - 'name' => __( 'Remove All Data on Uninstall?', 'give' ), |
|
607 | - 'desc' => __( 'Check this box if you would like Give to completely remove all of its data when the plugin is deleted.', 'give' ), |
|
606 | + 'name' => __('Remove All Data on Uninstall?', 'give'), |
|
607 | + 'desc' => __('Check this box if you would like Give to completely remove all of its data when the plugin is deleted.', 'give'), |
|
608 | 608 | 'id' => 'uninstall_on_delete', |
609 | 609 | 'type' => 'checkbox' |
610 | 610 | ), |
611 | 611 | array( |
612 | - 'name' => __( 'Filter Control', 'give' ), |
|
612 | + 'name' => __('Filter Control', 'give'), |
|
613 | 613 | 'desc' => '<hr>', |
614 | 614 | 'id' => 'give_title_filter_control', |
615 | 615 | 'type' => 'give_title' |
616 | 616 | ), |
617 | 617 | array( |
618 | - 'name' => __( 'Disable <code>the_content</code> filter', 'give' ), |
|
619 | - 'desc' => sprintf( __( 'If you are seeing extra social buttons, related posts, or other unwanted elements appearing within your forms then you can disable WordPress\' content filter. <a href="%s" target="_blank">Learn more</a> about the_content filter.', 'give' ), esc_url( 'https://codex.wordpress.org/Plugin_API/Filter_Reference/the_content' ) ), |
|
618 | + 'name' => __('Disable <code>the_content</code> filter', 'give'), |
|
619 | + 'desc' => sprintf(__('If you are seeing extra social buttons, related posts, or other unwanted elements appearing within your forms then you can disable WordPress\' content filter. <a href="%s" target="_blank">Learn more</a> about the_content filter.', 'give'), esc_url('https://codex.wordpress.org/Plugin_API/Filter_Reference/the_content')), |
|
620 | 620 | 'id' => 'disable_the_content_filter', |
621 | 621 | 'type' => 'checkbox' |
622 | 622 | ), |
623 | 623 | array( |
624 | - 'name' => __( 'Script Loading', 'give' ), |
|
624 | + 'name' => __('Script Loading', 'give'), |
|
625 | 625 | 'desc' => '<hr>', |
626 | 626 | 'id' => 'give_title_script_control', |
627 | 627 | 'type' => 'give_title' |
628 | 628 | ), |
629 | 629 | array( |
630 | - 'name' => __( 'Load Scripts in Footer?', 'give' ), |
|
631 | - 'desc' => __( 'Check this box if you would like Give to load all frontend JavaScript files in the footer.', 'give' ), |
|
630 | + 'name' => __('Load Scripts in Footer?', 'give'), |
|
631 | + 'desc' => __('Check this box if you would like Give to load all frontend JavaScript files in the footer.', 'give'), |
|
632 | 632 | 'id' => 'scripts_footer', |
633 | 633 | 'type' => 'checkbox' |
634 | 634 | ) |
@@ -638,13 +638,13 @@ discard block |
||
638 | 638 | /** API Settings */ |
639 | 639 | 'api' => array( |
640 | 640 | 'id' => 'options_page', |
641 | - 'give_title' => __( 'API', 'give' ), |
|
642 | - 'show_on' => array( 'key' => 'options-page', 'value' => array( $this->key, ), ), |
|
641 | + 'give_title' => __('API', 'give'), |
|
642 | + 'show_on' => array('key' => 'options-page', 'value' => array($this->key,),), |
|
643 | 643 | 'show_names' => false, // Hide field names on the left |
644 | - 'fields' => apply_filters( 'give_settings_system', array( |
|
644 | + 'fields' => apply_filters('give_settings_system', array( |
|
645 | 645 | array( |
646 | 646 | 'id' => 'api', |
647 | - 'name' => __( 'API', 'give' ), |
|
647 | + 'name' => __('API', 'give'), |
|
648 | 648 | 'type' => 'api' |
649 | 649 | ) |
650 | 650 | ) |
@@ -653,13 +653,13 @@ discard block |
||
653 | 653 | /** Licenses Settings */ |
654 | 654 | 'system_info' => array( |
655 | 655 | 'id' => 'options_page', |
656 | - 'give_title' => __( 'System Info', 'give' ), |
|
657 | - 'show_on' => array( 'key' => 'options-page', 'value' => array( $this->key, ), ), |
|
658 | - 'fields' => apply_filters( 'give_settings_system', array( |
|
656 | + 'give_title' => __('System Info', 'give'), |
|
657 | + 'show_on' => array('key' => 'options-page', 'value' => array($this->key,),), |
|
658 | + 'fields' => apply_filters('give_settings_system', array( |
|
659 | 659 | array( |
660 | 660 | 'id' => 'system_info', |
661 | - 'name' => __( 'System Info', 'give' ), |
|
662 | - 'desc' => __( 'Please copy and paste this information in your ticket when contacting support.', 'give' ), |
|
661 | + 'name' => __('System Info', 'give'), |
|
662 | + 'desc' => __('Please copy and paste this information in your ticket when contacting support.', 'give'), |
|
663 | 663 | 'type' => 'system_info' |
664 | 664 | ) |
665 | 665 | ) |
@@ -668,12 +668,12 @@ discard block |
||
668 | 668 | ); |
669 | 669 | |
670 | 670 | //Return all settings array if necessary |
671 | - if ( $active_tab === null || ! isset( $give_settings[ $active_tab ] ) ) { |
|
672 | - return apply_filters( 'give_registered_settings', $give_settings ); |
|
671 | + if ($active_tab === null || ! isset($give_settings[$active_tab])) { |
|
672 | + return apply_filters('give_registered_settings', $give_settings); |
|
673 | 673 | } |
674 | 674 | |
675 | 675 | // Add other tabs and settings fields as needed |
676 | - return apply_filters( 'give_registered_settings', $give_settings[ $active_tab ] ); |
|
676 | + return apply_filters('give_registered_settings', $give_settings[$active_tab]); |
|
677 | 677 | |
678 | 678 | } |
679 | 679 | |
@@ -684,18 +684,18 @@ discard block |
||
684 | 684 | * @param $updated |
685 | 685 | * @param $cmb |
686 | 686 | */ |
687 | - public function settings_notices( $object_id, $updated, $cmb ) { |
|
687 | + public function settings_notices($object_id, $updated, $cmb) { |
|
688 | 688 | |
689 | 689 | //Sanity check |
690 | - if ( $object_id !== $this->key ) { |
|
690 | + if ($object_id !== $this->key) { |
|
691 | 691 | return; |
692 | 692 | } |
693 | 693 | |
694 | - if ( did_action( 'cmb2_save_options-page_fields' ) === 1 ) { |
|
695 | - settings_errors( 'give-notices' ); |
|
694 | + if (did_action('cmb2_save_options-page_fields') === 1) { |
|
695 | + settings_errors('give-notices'); |
|
696 | 696 | } |
697 | 697 | |
698 | - add_settings_error( 'give-notices', 'global-settings-updated', __( 'Settings updated.', 'give' ), 'updated' ); |
|
698 | + add_settings_error('give-notices', 'global-settings-updated', __('Settings updated.', 'give'), 'updated'); |
|
699 | 699 | |
700 | 700 | } |
701 | 701 | |
@@ -709,17 +709,17 @@ discard block |
||
709 | 709 | * |
710 | 710 | * @return mixed Field value or exception is thrown |
711 | 711 | */ |
712 | - public function __get( $field ) { |
|
712 | + public function __get($field) { |
|
713 | 713 | |
714 | 714 | // Allowed fields to retrieve |
715 | - if ( in_array( $field, array( 'key', 'fields', 'give_title', 'options_page' ), true ) ) { |
|
715 | + if (in_array($field, array('key', 'fields', 'give_title', 'options_page'), true)) { |
|
716 | 716 | return $this->{$field}; |
717 | 717 | } |
718 | - if ( 'option_metabox' === $field ) { |
|
718 | + if ('option_metabox' === $field) { |
|
719 | 719 | return $this->option_metabox(); |
720 | 720 | } |
721 | 721 | |
722 | - throw new Exception( 'Invalid property: ' . $field ); |
|
722 | + throw new Exception('Invalid property: '.$field); |
|
723 | 723 | } |
724 | 724 | |
725 | 725 | |
@@ -736,12 +736,12 @@ discard block |
||
736 | 736 | * |
737 | 737 | * @return mixed Option value |
738 | 738 | */ |
739 | -function give_get_option( $key = '', $default = false ) { |
|
739 | +function give_get_option($key = '', $default = false) { |
|
740 | 740 | global $give_options; |
741 | - $value = ! empty( $give_options[ $key ] ) ? $give_options[ $key ] : $default; |
|
742 | - $value = apply_filters( 'give_get_option', $value, $key, $default ); |
|
741 | + $value = ! empty($give_options[$key]) ? $give_options[$key] : $default; |
|
742 | + $value = apply_filters('give_get_option', $value, $key, $default); |
|
743 | 743 | |
744 | - return apply_filters( 'give_get_option_' . $key, $value, $key, $default ); |
|
744 | + return apply_filters('give_get_option_'.$key, $value, $key, $default); |
|
745 | 745 | } |
746 | 746 | |
747 | 747 | |
@@ -759,33 +759,33 @@ discard block |
||
759 | 759 | * |
760 | 760 | * @return boolean True if updated, false if not. |
761 | 761 | */ |
762 | -function give_update_option( $key = '', $value = false ) { |
|
762 | +function give_update_option($key = '', $value = false) { |
|
763 | 763 | |
764 | 764 | // If no key, exit |
765 | - if ( empty( $key ) ) { |
|
765 | + if (empty($key)) { |
|
766 | 766 | return false; |
767 | 767 | } |
768 | 768 | |
769 | - if ( empty( $value ) ) { |
|
770 | - $remove_option = give_delete_option( $key ); |
|
769 | + if (empty($value)) { |
|
770 | + $remove_option = give_delete_option($key); |
|
771 | 771 | |
772 | 772 | return $remove_option; |
773 | 773 | } |
774 | 774 | |
775 | 775 | // First let's grab the current settings |
776 | - $options = get_option( 'give_settings' ); |
|
776 | + $options = get_option('give_settings'); |
|
777 | 777 | |
778 | 778 | // Let's let devs alter that value coming in |
779 | - $value = apply_filters( 'give_update_option', $value, $key ); |
|
779 | + $value = apply_filters('give_update_option', $value, $key); |
|
780 | 780 | |
781 | 781 | // Next let's try to update the value |
782 | - $options[ $key ] = $value; |
|
783 | - $did_update = update_option( 'give_settings', $options ); |
|
782 | + $options[$key] = $value; |
|
783 | + $did_update = update_option('give_settings', $options); |
|
784 | 784 | |
785 | 785 | // If it updated, let's update the global variable |
786 | - if ( $did_update ) { |
|
786 | + if ($did_update) { |
|
787 | 787 | global $give_options; |
788 | - $give_options[ $key ] = $value; |
|
788 | + $give_options[$key] = $value; |
|
789 | 789 | } |
790 | 790 | |
791 | 791 | return $did_update; |
@@ -802,27 +802,27 @@ discard block |
||
802 | 802 | * |
803 | 803 | * @return boolean True if updated, false if not. |
804 | 804 | */ |
805 | -function give_delete_option( $key = '' ) { |
|
805 | +function give_delete_option($key = '') { |
|
806 | 806 | |
807 | 807 | // If no key, exit |
808 | - if ( empty( $key ) ) { |
|
808 | + if (empty($key)) { |
|
809 | 809 | return false; |
810 | 810 | } |
811 | 811 | |
812 | 812 | // First let's grab the current settings |
813 | - $options = get_option( 'give_settings' ); |
|
813 | + $options = get_option('give_settings'); |
|
814 | 814 | |
815 | 815 | // Next let's try to update the value |
816 | - if ( isset( $options[ $key ] ) ) { |
|
816 | + if (isset($options[$key])) { |
|
817 | 817 | |
818 | - unset( $options[ $key ] ); |
|
818 | + unset($options[$key]); |
|
819 | 819 | |
820 | 820 | } |
821 | 821 | |
822 | - $did_update = update_option( 'give_settings', $options ); |
|
822 | + $did_update = update_option('give_settings', $options); |
|
823 | 823 | |
824 | 824 | // If it updated, let's update the global variable |
825 | - if ( $did_update ) { |
|
825 | + if ($did_update) { |
|
826 | 826 | global $give_options; |
827 | 827 | $give_options = $options; |
828 | 828 | } |
@@ -841,9 +841,9 @@ discard block |
||
841 | 841 | */ |
842 | 842 | function give_get_settings() { |
843 | 843 | |
844 | - $settings = get_option( 'give_settings' ); |
|
844 | + $settings = get_option('give_settings'); |
|
845 | 845 | |
846 | - return (array) apply_filters( 'give_get_settings', $settings ); |
|
846 | + return (array) apply_filters('give_get_settings', $settings); |
|
847 | 847 | |
848 | 848 | } |
849 | 849 | |
@@ -857,7 +857,7 @@ discard block |
||
857 | 857 | * @global $give_options Array of all the Give Options |
858 | 858 | * @return void |
859 | 859 | */ |
860 | -function give_enabled_gateways_callback( $field_object, $escaped_value, $object_id, $object_type, $field_type_object ) { |
|
860 | +function give_enabled_gateways_callback($field_object, $escaped_value, $object_id, $object_type, $field_type_object) { |
|
861 | 861 | |
862 | 862 | $id = $field_type_object->field->args['id']; |
863 | 863 | $field_description = $field_type_object->field->args['desc']; |
@@ -865,21 +865,21 @@ discard block |
||
865 | 865 | |
866 | 866 | echo '<ul class="cmb2-checkbox-list cmb2-list">'; |
867 | 867 | |
868 | - foreach ( $gateways as $key => $option ) : |
|
868 | + foreach ($gateways as $key => $option) : |
|
869 | 869 | |
870 | - if ( is_array( $escaped_value ) && array_key_exists( $key, $escaped_value ) ) { |
|
870 | + if (is_array($escaped_value) && array_key_exists($key, $escaped_value)) { |
|
871 | 871 | $enabled = '1'; |
872 | 872 | } else { |
873 | 873 | $enabled = null; |
874 | 874 | } |
875 | 875 | |
876 | - echo '<li><input name="' . $id . '[' . $key . ']" id="' . $id . '[' . $key . ']" type="checkbox" value="1" ' . checked( '1', $enabled, false ) . '/> '; |
|
877 | - echo '<label for="' . $id . '[' . $key . ']">' . $option['admin_label'] . '</label></li>'; |
|
876 | + echo '<li><input name="'.$id.'['.$key.']" id="'.$id.'['.$key.']" type="checkbox" value="1" '.checked('1', $enabled, false).'/> '; |
|
877 | + echo '<label for="'.$id.'['.$key.']">'.$option['admin_label'].'</label></li>'; |
|
878 | 878 | |
879 | 879 | endforeach; |
880 | 880 | |
881 | - if ( $field_description ) { |
|
882 | - echo '<p class="cmb2-metabox-description">' . $field_description . '</p>'; |
|
881 | + if ($field_description) { |
|
882 | + echo '<p class="cmb2-metabox-description">'.$field_description.'</p>'; |
|
883 | 883 | } |
884 | 884 | |
885 | 885 | echo '</ul>'; |
@@ -898,31 +898,31 @@ discard block |
||
898 | 898 | * |
899 | 899 | * @return void |
900 | 900 | */ |
901 | -function give_default_gateway_callback( $field_object, $escaped_value, $object_id, $object_type, $field_type_object ) { |
|
901 | +function give_default_gateway_callback($field_object, $escaped_value, $object_id, $object_type, $field_type_object) { |
|
902 | 902 | |
903 | 903 | $id = $field_type_object->field->args['id']; |
904 | 904 | $field_description = $field_type_object->field->args['desc']; |
905 | 905 | $gateways = give_get_enabled_payment_gateways(); |
906 | 906 | |
907 | - echo '<select class="cmb2_select" name="' . $id . '" id="' . $id . '">'; |
|
907 | + echo '<select class="cmb2_select" name="'.$id.'" id="'.$id.'">'; |
|
908 | 908 | |
909 | 909 | //Add a field to the Give Form admin single post view of this field |
910 | - if ( $field_type_object->field->object_type === 'post' ) { |
|
911 | - echo '<option value="global">' . __( 'Global Default', 'give' ) . '</option>'; |
|
910 | + if ($field_type_object->field->object_type === 'post') { |
|
911 | + echo '<option value="global">'.__('Global Default', 'give').'</option>'; |
|
912 | 912 | } |
913 | 913 | |
914 | - foreach ( $gateways as $key => $option ) : |
|
914 | + foreach ($gateways as $key => $option) : |
|
915 | 915 | |
916 | - $selected = isset( $escaped_value ) ? selected( $key, $escaped_value, false ) : ''; |
|
916 | + $selected = isset($escaped_value) ? selected($key, $escaped_value, false) : ''; |
|
917 | 917 | |
918 | 918 | |
919 | - echo '<option value="' . esc_attr( $key ) . '"' . $selected . '>' . esc_html( $option['admin_label'] ) . '</option>'; |
|
919 | + echo '<option value="'.esc_attr($key).'"'.$selected.'>'.esc_html($option['admin_label']).'</option>'; |
|
920 | 920 | |
921 | 921 | endforeach; |
922 | 922 | |
923 | 923 | echo '</select>'; |
924 | 924 | |
925 | - echo '<p class="cmb2-metabox-description">' . $field_description . '</p>'; |
|
925 | + echo '<p class="cmb2-metabox-description">'.$field_description.'</p>'; |
|
926 | 926 | |
927 | 927 | } |
928 | 928 | |
@@ -937,7 +937,7 @@ discard block |
||
937 | 937 | * |
938 | 938 | * @return void |
939 | 939 | */ |
940 | -function give_title_callback( $field_object, $escaped_value, $object_id, $object_type, $field_type_object ) { |
|
940 | +function give_title_callback($field_object, $escaped_value, $object_id, $object_type, $field_type_object) { |
|
941 | 941 | |
942 | 942 | $id = $field_type_object->field->args['id']; |
943 | 943 | $title = $field_type_object->field->args['name']; |
@@ -956,25 +956,25 @@ discard block |
||
956 | 956 | * @see: https://github.com/WebDevStudios/CMB2/wiki/Adding-your-own-field-types |
957 | 957 | * @return array An array of options that matches the CMB2 options array |
958 | 958 | */ |
959 | -function give_cmb2_get_post_options( $query_args, $force = false ) { |
|
959 | +function give_cmb2_get_post_options($query_args, $force = false) { |
|
960 | 960 | |
961 | - $post_options = array( '' => '' ); // Blank option |
|
961 | + $post_options = array('' => ''); // Blank option |
|
962 | 962 | |
963 | - if ( ( ! isset( $_GET['page'] ) || 'give-settings' != $_GET['page'] ) && ! $force ) { |
|
963 | + if (( ! isset($_GET['page']) || 'give-settings' != $_GET['page']) && ! $force) { |
|
964 | 964 | return $post_options; |
965 | 965 | } |
966 | 966 | |
967 | - $args = wp_parse_args( $query_args, array( |
|
967 | + $args = wp_parse_args($query_args, array( |
|
968 | 968 | 'post_type' => 'page', |
969 | 969 | 'numberposts' => 10, |
970 | - ) ); |
|
970 | + )); |
|
971 | 971 | |
972 | - $posts = get_posts( $args ); |
|
972 | + $posts = get_posts($args); |
|
973 | 973 | |
974 | - if ( $posts ) { |
|
975 | - foreach ( $posts as $post ) { |
|
974 | + if ($posts) { |
|
975 | + foreach ($posts as $post) { |
|
976 | 976 | |
977 | - $post_options[ $post->ID ] = $post->post_title; |
|
977 | + $post_options[$post->ID] = $post->post_title; |
|
978 | 978 | |
979 | 979 | } |
980 | 980 | } |
@@ -991,14 +991,14 @@ discard block |
||
991 | 991 | * @since 1.0 |
992 | 992 | */ |
993 | 993 | |
994 | -add_filter( 'cmb2_get_metabox_form_format', 'give_modify_cmb2_form_output', 10, 3 ); |
|
994 | +add_filter('cmb2_get_metabox_form_format', 'give_modify_cmb2_form_output', 10, 3); |
|
995 | 995 | |
996 | -function give_modify_cmb2_form_output( $form_format, $object_id, $cmb ) { |
|
996 | +function give_modify_cmb2_form_output($form_format, $object_id, $cmb) { |
|
997 | 997 | |
998 | 998 | //only modify the give settings form |
999 | - if ( 'give_settings' == $object_id && 'options_page' == $cmb->cmb_id ) { |
|
999 | + if ('give_settings' == $object_id && 'options_page' == $cmb->cmb_id) { |
|
1000 | 1000 | |
1001 | - return '<form class="cmb-form" method="post" id="%1$s" enctype="multipart/form-data" encoding="multipart/form-data"><input type="hidden" name="object_id" value="%2$s">%3$s<div class="give-submit-wrap"><input type="submit" name="submit-cmb" value="' . __( 'Save Settings', 'give' ) . '" class="button-primary"></div></form>'; |
|
1001 | + return '<form class="cmb-form" method="post" id="%1$s" enctype="multipart/form-data" encoding="multipart/form-data"><input type="hidden" name="object_id" value="%2$s">%3$s<div class="give-submit-wrap"><input type="submit" name="submit-cmb" value="'.__('Save Settings', 'give').'" class="button-primary"></div></form>'; |
|
1002 | 1002 | } |
1003 | 1003 | |
1004 | 1004 | return $form_format; |
@@ -1016,35 +1016,35 @@ discard block |
||
1016 | 1016 | * |
1017 | 1017 | * @return void |
1018 | 1018 | */ |
1019 | -if ( ! function_exists( 'give_license_key_callback' ) ) { |
|
1020 | - function give_license_key_callback( $field_object, $escaped_value, $object_id, $object_type, $field_type_object ) { |
|
1019 | +if ( ! function_exists('give_license_key_callback')) { |
|
1020 | + function give_license_key_callback($field_object, $escaped_value, $object_id, $object_type, $field_type_object) { |
|
1021 | 1021 | |
1022 | 1022 | $id = $field_type_object->field->args['id']; |
1023 | 1023 | $field_description = $field_type_object->field->args['desc']; |
1024 | - $license_status = get_option( $field_type_object->field->args['options']['is_valid_license_option'] ); |
|
1024 | + $license_status = get_option($field_type_object->field->args['options']['is_valid_license_option']); |
|
1025 | 1025 | $field_classes = 'regular-text give-license-field'; |
1026 | - $type = empty( $escaped_value ) ? 'text' : 'password'; |
|
1026 | + $type = empty($escaped_value) ? 'text' : 'password'; |
|
1027 | 1027 | |
1028 | - if ( $license_status === 'valid' ) { |
|
1028 | + if ($license_status === 'valid') { |
|
1029 | 1029 | $field_classes .= ' give-license-active'; |
1030 | 1030 | } |
1031 | 1031 | |
1032 | - $html = $field_type_object->input( array( |
|
1032 | + $html = $field_type_object->input(array( |
|
1033 | 1033 | 'class' => $field_classes, |
1034 | 1034 | 'type' => $type |
1035 | - ) ); |
|
1035 | + )); |
|
1036 | 1036 | |
1037 | 1037 | //License is active so show deactivate button |
1038 | - if ( $license_status === 'valid' ) { |
|
1039 | - $html .= '<input type="submit" class="button-secondary give-license-deactivate" name="' . $id . '_deactivate" value="' . __( 'Deactivate License', 'give' ) . '"/>'; |
|
1038 | + if ($license_status === 'valid') { |
|
1039 | + $html .= '<input type="submit" class="button-secondary give-license-deactivate" name="'.$id.'_deactivate" value="'.__('Deactivate License', 'give').'"/>'; |
|
1040 | 1040 | } else { |
1041 | 1041 | //This license is not valid so delete it |
1042 | - give_delete_option( $id ); |
|
1042 | + give_delete_option($id); |
|
1043 | 1043 | } |
1044 | 1044 | |
1045 | - $html .= '<label for="give_settings[' . $id . ']"> ' . $field_description . '</label>'; |
|
1045 | + $html .= '<label for="give_settings['.$id.']"> '.$field_description.'</label>'; |
|
1046 | 1046 | |
1047 | - wp_nonce_field( $id . '-nonce', $id . '-nonce' ); |
|
1047 | + wp_nonce_field($id.'-nonce', $id.'-nonce'); |
|
1048 | 1048 | |
1049 | 1049 | echo $html; |
1050 | 1050 | } |
@@ -1059,13 +1059,13 @@ discard block |
||
1059 | 1059 | */ |
1060 | 1060 | function give_api_callback() { |
1061 | 1061 | |
1062 | - if ( ! current_user_can( 'manage_give_settings' ) ) { |
|
1062 | + if ( ! current_user_can('manage_give_settings')) { |
|
1063 | 1063 | return; |
1064 | 1064 | } |
1065 | 1065 | |
1066 | - do_action( 'give_tools_api_keys_before' ); |
|
1066 | + do_action('give_tools_api_keys_before'); |
|
1067 | 1067 | |
1068 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/class-api-keys-table.php'; |
|
1068 | + require_once GIVE_PLUGIN_DIR.'includes/admin/class-api-keys-table.php'; |
|
1069 | 1069 | |
1070 | 1070 | $api_keys_table = new Give_API_Keys_Table(); |
1071 | 1071 | $api_keys_table->prepare_items(); |
@@ -1073,7 +1073,7 @@ discard block |
||
1073 | 1073 | ?> |
1074 | 1074 | <p> |
1075 | 1075 | <?php printf( |
1076 | - __( 'API keys allow users to use the <a href="%s">Give REST API</a> to retrieve donation data in JSON or XML for external applications or devices, such as <a href="%s">Zapier</a>.', 'give' ), |
|
1076 | + __('API keys allow users to use the <a href="%s">Give REST API</a> to retrieve donation data in JSON or XML for external applications or devices, such as <a href="%s">Zapier</a>.', 'give'), |
|
1077 | 1077 | 'https://givewp.com/documentation/give-api-reference/', |
1078 | 1078 | 'https://givewp.com/addons/zapier/' |
1079 | 1079 | ); ?> |
@@ -1086,10 +1086,10 @@ discard block |
||
1086 | 1086 | </style> |
1087 | 1087 | <?php |
1088 | 1088 | |
1089 | - do_action( 'give_tools_api_keys_after' ); |
|
1089 | + do_action('give_tools_api_keys_after'); |
|
1090 | 1090 | } |
1091 | 1091 | |
1092 | -add_action( 'give_settings_tab_api_keys', 'give_api_callback' ); |
|
1092 | +add_action('give_settings_tab_api_keys', 'give_api_callback'); |
|
1093 | 1093 | |
1094 | 1094 | /** |
1095 | 1095 | * Hook Callback |
@@ -1102,8 +1102,8 @@ discard block |
||
1102 | 1102 | * |
1103 | 1103 | * @return void |
1104 | 1104 | */ |
1105 | -function give_hook_callback( $args ) { |
|
1106 | - do_action( 'give_' . $args['id'] ); |
|
1105 | +function give_hook_callback($args) { |
|
1106 | + do_action('give_'.$args['id']); |
|
1107 | 1107 | } |
1108 | 1108 | |
1109 | 1109 | /** |
@@ -1113,10 +1113,10 @@ discard block |
||
1113 | 1113 | * |
1114 | 1114 | */ |
1115 | 1115 | |
1116 | -if ( file_exists( WP_PLUGIN_DIR . '/cmb2/init.php' ) && ! defined( 'CMB2_LOADED' ) ) { |
|
1117 | - require_once WP_PLUGIN_DIR . '/cmb2/init.php'; |
|
1118 | -} elseif ( file_exists( GIVE_PLUGIN_DIR . '/includes/libraries/cmb2/init.php' ) && ! defined( 'CMB2_LOADED' ) ) { |
|
1119 | - require_once GIVE_PLUGIN_DIR . '/includes/libraries/cmb2/init.php'; |
|
1120 | -} elseif ( file_exists( GIVE_PLUGIN_DIR . '/includes/libraries/CMB2/init.php' ) && ! defined( 'CMB2_LOADED' ) ) { |
|
1121 | - require_once GIVE_PLUGIN_DIR . '/includes/libraries/CMB2/init.php'; |
|
1116 | +if (file_exists(WP_PLUGIN_DIR.'/cmb2/init.php') && ! defined('CMB2_LOADED')) { |
|
1117 | + require_once WP_PLUGIN_DIR.'/cmb2/init.php'; |
|
1118 | +} elseif (file_exists(GIVE_PLUGIN_DIR.'/includes/libraries/cmb2/init.php') && ! defined('CMB2_LOADED')) { |
|
1119 | + require_once GIVE_PLUGIN_DIR.'/includes/libraries/cmb2/init.php'; |
|
1120 | +} elseif (file_exists(GIVE_PLUGIN_DIR.'/includes/libraries/CMB2/init.php') && ! defined('CMB2_LOADED')) { |
|
1121 | + require_once GIVE_PLUGIN_DIR.'/includes/libraries/CMB2/init.php'; |
|
1122 | 1122 | } |
1123 | 1123 | \ No newline at end of file |
@@ -157,7 +157,7 @@ |
||
157 | 157 | * |
158 | 158 | * @access public |
159 | 159 | * @since 1.0 |
160 | - * @return mixed String if search is present, false otherwise |
|
160 | + * @return string|false String if search is present, false otherwise |
|
161 | 161 | */ |
162 | 162 | public function get_search() { |
163 | 163 | return ! empty( $_GET['s'] ) ? urldecode( trim( $_GET['s'] ) ) : false; |
@@ -1,13 +1,13 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * API Requests Log View Class |
|
4 | - * |
|
5 | - * @package Give |
|
6 | - * @subpackage Admin/Reports |
|
7 | - * @copyright Copyright (c) 2015, WordImpress |
|
8 | - * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License |
|
9 | - * @since 1.0 |
|
10 | - */ |
|
3 | + * API Requests Log View Class |
|
4 | + * |
|
5 | + * @package Give |
|
6 | + * @subpackage Admin/Reports |
|
7 | + * @copyright Copyright (c) 2015, WordImpress |
|
8 | + * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License |
|
9 | + * @since 1.0 |
|
10 | + */ |
|
11 | 11 | |
12 | 12 | // Exit if accessed directly |
13 | 13 | if ( ! defined( 'ABSPATH' ) ) { |
@@ -10,13 +10,13 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
17 | 17 | // Load WP_List_Table if not loaded |
18 | -if ( ! class_exists( 'WP_List_Table' ) ) { |
|
19 | - require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php'; |
|
18 | +if ( ! class_exists('WP_List_Table')) { |
|
19 | + require_once ABSPATH.'wp-admin/includes/class-wp-list-table.php'; |
|
20 | 20 | } |
21 | 21 | |
22 | 22 | /** |
@@ -45,11 +45,11 @@ discard block |
||
45 | 45 | global $status, $page; |
46 | 46 | |
47 | 47 | // Set parent defaults |
48 | - parent::__construct( array( |
|
49 | - 'singular' => give_get_forms_label_singular(), // Singular name of the listed records |
|
50 | - 'plural' => give_get_forms_label_plural(), // Plural name of the listed records |
|
48 | + parent::__construct(array( |
|
49 | + 'singular' => give_get_forms_label_singular(), // Singular name of the listed records |
|
50 | + 'plural' => give_get_forms_label_plural(), // Plural name of the listed records |
|
51 | 51 | 'ajax' => false // Does this table support ajax? |
52 | - ) ); |
|
52 | + )); |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | /** |
@@ -63,20 +63,20 @@ discard block |
||
63 | 63 | * |
64 | 64 | * @return void |
65 | 65 | */ |
66 | - public function search_box( $text, $input_id ) { |
|
67 | - $input_id = $input_id . '-search-input'; |
|
66 | + public function search_box($text, $input_id) { |
|
67 | + $input_id = $input_id.'-search-input'; |
|
68 | 68 | |
69 | - if ( ! empty( $_REQUEST['orderby'] ) ) { |
|
70 | - echo '<input type="hidden" name="orderby" value="' . esc_attr( $_REQUEST['orderby'] ) . '" />'; |
|
69 | + if ( ! empty($_REQUEST['orderby'])) { |
|
70 | + echo '<input type="hidden" name="orderby" value="'.esc_attr($_REQUEST['orderby']).'" />'; |
|
71 | 71 | } |
72 | - if ( ! empty( $_REQUEST['order'] ) ) { |
|
73 | - echo '<input type="hidden" name="order" value="' . esc_attr( $_REQUEST['order'] ) . '" />'; |
|
72 | + if ( ! empty($_REQUEST['order'])) { |
|
73 | + echo '<input type="hidden" name="order" value="'.esc_attr($_REQUEST['order']).'" />'; |
|
74 | 74 | } |
75 | 75 | ?> |
76 | 76 | <p class="search-box"> |
77 | 77 | <label class="screen-reader-text" for="<?php echo $input_id ?>"><?php echo $text; ?>:</label> |
78 | 78 | <input type="search" id="<?php echo $input_id ?>" name="s" value="<?php _admin_search_query(); ?>" /> |
79 | - <?php submit_button( $text, 'button', false, false, array( 'ID' => 'search-submit' ) ); ?> |
|
79 | + <?php submit_button($text, 'button', false, false, array('ID' => 'search-submit')); ?> |
|
80 | 80 | </p> |
81 | 81 | <?php |
82 | 82 | } |
@@ -90,10 +90,10 @@ discard block |
||
90 | 90 | */ |
91 | 91 | public function get_columns() { |
92 | 92 | $columns = array( |
93 | - 'ID' => __( 'Log ID', 'give' ), |
|
94 | - 'details' => __( 'Request Details', 'give' ), |
|
95 | - 'ip' => __( 'Request IP', 'give' ), |
|
96 | - 'date' => __( 'Date', 'give' ) |
|
93 | + 'ID' => __('Log ID', 'give'), |
|
94 | + 'details' => __('Request Details', 'give'), |
|
95 | + 'ip' => __('Request IP', 'give'), |
|
96 | + 'date' => __('Date', 'give') |
|
97 | 97 | ); |
98 | 98 | |
99 | 99 | return $columns; |
@@ -110,10 +110,10 @@ discard block |
||
110 | 110 | * |
111 | 111 | * @return string Column Name |
112 | 112 | */ |
113 | - public function column_default( $item, $column_name ) { |
|
114 | - switch ( $column_name ) { |
|
113 | + public function column_default($item, $column_name) { |
|
114 | + switch ($column_name) { |
|
115 | 115 | default: |
116 | - return $item[ $column_name ]; |
|
116 | + return $item[$column_name]; |
|
117 | 117 | } |
118 | 118 | } |
119 | 119 | |
@@ -127,26 +127,26 @@ discard block |
||
127 | 127 | * |
128 | 128 | * @return void |
129 | 129 | */ |
130 | - public function column_details( $item ) { |
|
130 | + public function column_details($item) { |
|
131 | 131 | ?> |
132 | - <a href="#TB_inline?width=640&inlineId=log-details-<?php echo $item['ID']; ?>" class="thickbox" title="<?php _e( 'View Request Details', 'give' ); ?> "><?php _e( 'View Request', 'give' ); ?></a> |
|
132 | + <a href="#TB_inline?width=640&inlineId=log-details-<?php echo $item['ID']; ?>" class="thickbox" title="<?php _e('View Request Details', 'give'); ?> "><?php _e('View Request', 'give'); ?></a> |
|
133 | 133 | <div id="log-details-<?php echo $item['ID']; ?>" style="display:none;"> |
134 | 134 | <?php |
135 | 135 | |
136 | - $request = get_post_field( 'post_excerpt', $item['ID'] ); |
|
137 | - $error = get_post_field( 'post_content', $item['ID'] ); |
|
138 | - echo '<p><strong>' . __( 'API Request:', 'give' ) . '</strong></p>'; |
|
139 | - echo '<div>' . $request . '</div>'; |
|
140 | - if ( ! empty( $error ) ) { |
|
141 | - echo '<p><strong>' . __( 'Error', 'give' ) . '</strong></p>'; |
|
142 | - echo '<div>' . esc_html( $error ) . '</div>'; |
|
136 | + $request = get_post_field('post_excerpt', $item['ID']); |
|
137 | + $error = get_post_field('post_content', $item['ID']); |
|
138 | + echo '<p><strong>'.__('API Request:', 'give').'</strong></p>'; |
|
139 | + echo '<div>'.$request.'</div>'; |
|
140 | + if ( ! empty($error)) { |
|
141 | + echo '<p><strong>'.__('Error', 'give').'</strong></p>'; |
|
142 | + echo '<div>'.esc_html($error).'</div>'; |
|
143 | 143 | } |
144 | - echo '<p><strong>' . __( 'API User:', 'give' ) . '</strong></p>'; |
|
145 | - echo '<div>' . get_post_meta( $item['ID'], '_give_log_user', true ) . '</div>'; |
|
146 | - echo '<p><strong>' . __( 'API Key:', 'give' ) . '</strong></p>'; |
|
147 | - echo '<div>' . get_post_meta( $item['ID'], '_give_log_key', true ) . '</div>'; |
|
148 | - echo '<p><strong>' . __( 'Request Date:', 'give' ) . '</strong></p>'; |
|
149 | - echo '<div>' . get_post_field( 'post_date', $item['ID'] ) . '</div>'; |
|
144 | + echo '<p><strong>'.__('API User:', 'give').'</strong></p>'; |
|
145 | + echo '<div>'.get_post_meta($item['ID'], '_give_log_user', true).'</div>'; |
|
146 | + echo '<p><strong>'.__('API Key:', 'give').'</strong></p>'; |
|
147 | + echo '<div>'.get_post_meta($item['ID'], '_give_log_key', true).'</div>'; |
|
148 | + echo '<p><strong>'.__('Request Date:', 'give').'</strong></p>'; |
|
149 | + echo '<div>'.get_post_field('post_date', $item['ID']).'</div>'; |
|
150 | 150 | ?> |
151 | 151 | </div> |
152 | 152 | <?php |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | * @return mixed String if search is present, false otherwise |
161 | 161 | */ |
162 | 162 | public function get_search() { |
163 | - return ! empty( $_GET['s'] ) ? urldecode( trim( $_GET['s'] ) ) : false; |
|
163 | + return ! empty($_GET['s']) ? urldecode(trim($_GET['s'])) : false; |
|
164 | 164 | } |
165 | 165 | |
166 | 166 | /** |
@@ -177,31 +177,31 @@ discard block |
||
177 | 177 | |
178 | 178 | $search = $this->get_search(); |
179 | 179 | |
180 | - if ( $search ) { |
|
181 | - if ( filter_var( $search, FILTER_VALIDATE_IP ) ) { |
|
180 | + if ($search) { |
|
181 | + if (filter_var($search, FILTER_VALIDATE_IP)) { |
|
182 | 182 | // This is an IP address search |
183 | 183 | $key = '_give_log_request_ip'; |
184 | - } else if ( is_email( $search ) ) { |
|
184 | + } else if (is_email($search)) { |
|
185 | 185 | // This is an email search |
186 | - $userdata = get_user_by( 'email', $search ); |
|
186 | + $userdata = get_user_by('email', $search); |
|
187 | 187 | |
188 | - if ( $userdata ) { |
|
188 | + if ($userdata) { |
|
189 | 189 | $search = $userdata->ID; |
190 | 190 | } |
191 | 191 | |
192 | 192 | $key = '_give_log_user'; |
193 | - } elseif ( strlen( $search ) == 32 ) { |
|
193 | + } elseif (strlen($search) == 32) { |
|
194 | 194 | // Look for an API key |
195 | 195 | $key = '_give_log_key'; |
196 | - } elseif ( stristr( $search, 'token:' ) ) { |
|
196 | + } elseif (stristr($search, 'token:')) { |
|
197 | 197 | // Look for an API token |
198 | - $search = str_ireplace( 'token:', '', $search ); |
|
198 | + $search = str_ireplace('token:', '', $search); |
|
199 | 199 | $key = '_give_log_token'; |
200 | 200 | } else { |
201 | 201 | // This is (probably) a user ID search |
202 | - $userdata = get_userdata( $search ); |
|
202 | + $userdata = get_userdata($search); |
|
203 | 203 | |
204 | - if ( $userdata ) { |
|
204 | + if ($userdata) { |
|
205 | 205 | $search = $userdata->ID; |
206 | 206 | } |
207 | 207 | |
@@ -227,7 +227,7 @@ discard block |
||
227 | 227 | * @return int Current page number |
228 | 228 | */ |
229 | 229 | public function get_paged() { |
230 | - return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1; |
|
230 | + return isset($_GET['paged']) ? absint($_GET['paged']) : 1; |
|
231 | 231 | } |
232 | 232 | |
233 | 233 | /** |
@@ -237,7 +237,7 @@ discard block |
||
237 | 237 | * @since 1.0 |
238 | 238 | * @return void |
239 | 239 | */ |
240 | - function bulk_actions( $which = '' ) { |
|
240 | + function bulk_actions($which = '') { |
|
241 | 241 | // These aren't really bulk actions but this outputs the markup in the right place |
242 | 242 | give_log_views(); |
243 | 243 | } |
@@ -261,14 +261,14 @@ discard block |
||
261 | 261 | 'meta_query' => $this->get_meta_query() |
262 | 262 | ); |
263 | 263 | |
264 | - $logs = $give_logs->get_connected_logs( $log_query ); |
|
264 | + $logs = $give_logs->get_connected_logs($log_query); |
|
265 | 265 | |
266 | - if ( $logs ) { |
|
267 | - foreach ( $logs as $log ) { |
|
266 | + if ($logs) { |
|
267 | + foreach ($logs as $log) { |
|
268 | 268 | |
269 | 269 | $logs_data[] = array( |
270 | 270 | 'ID' => $log->ID, |
271 | - 'ip' => get_post_meta( $log->ID, '_give_log_request_ip', true ), |
|
271 | + 'ip' => get_post_meta($log->ID, '_give_log_request_ip', true), |
|
272 | 272 | 'date' => $log->post_date |
273 | 273 | ); |
274 | 274 | } |
@@ -296,14 +296,14 @@ discard block |
||
296 | 296 | $columns = $this->get_columns(); |
297 | 297 | $hidden = array(); // No hidden columns |
298 | 298 | $sortable = $this->get_sortable_columns(); |
299 | - $this->_column_headers = array( $columns, $hidden, $sortable ); |
|
299 | + $this->_column_headers = array($columns, $hidden, $sortable); |
|
300 | 300 | $this->items = $this->get_logs(); |
301 | - $total_items = $give_logs->get_log_count( 0, 'api_requests' ); |
|
301 | + $total_items = $give_logs->get_log_count(0, 'api_requests'); |
|
302 | 302 | |
303 | - $this->set_pagination_args( array( |
|
303 | + $this->set_pagination_args(array( |
|
304 | 304 | 'total_items' => $total_items, |
305 | 305 | 'per_page' => $this->per_page, |
306 | - 'total_pages' => ceil( $total_items / $this->per_page ) |
|
306 | + 'total_pages' => ceil($total_items / $this->per_page) |
|
307 | 307 | ) |
308 | 308 | ); |
309 | 309 | } |