@@ -11,11 +11,11 @@ discard block |
||
11 | 11 | * @since 1.8.17 |
12 | 12 | */ |
13 | 13 | |
14 | -if ( ! defined( 'ABSPATH' ) ) { |
|
14 | +if ( ! defined('ABSPATH')) { |
|
15 | 15 | exit; // Exit if accessed directly |
16 | 16 | } |
17 | 17 | |
18 | -if ( ! class_exists( 'Give_Import_Core_Settings' ) ) { |
|
18 | +if ( ! class_exists('Give_Import_Core_Settings')) { |
|
19 | 19 | |
20 | 20 | /** |
21 | 21 | * Give_Import_Core_Settings. |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | * @return static |
69 | 69 | */ |
70 | 70 | public static function get_instance() { |
71 | - if ( null === static::$instance ) { |
|
71 | + if (null === static::$instance) { |
|
72 | 72 | self::$instance = new static(); |
73 | 73 | } |
74 | 74 | |
@@ -95,26 +95,26 @@ discard block |
||
95 | 95 | * @return void |
96 | 96 | */ |
97 | 97 | private function setup_hooks() { |
98 | - if ( ! $this->is_donations_import_page() ) { |
|
98 | + if ( ! $this->is_donations_import_page()) { |
|
99 | 99 | return; |
100 | 100 | } |
101 | 101 | |
102 | 102 | // Do not render main import tools page. |
103 | - remove_action( 'give_admin_field_tools_import', array( 'Give_Settings_Import', 'render_import_field', ) ); |
|
103 | + remove_action('give_admin_field_tools_import', array('Give_Settings_Import', 'render_import_field',)); |
|
104 | 104 | |
105 | 105 | // Render donation import page |
106 | - add_action( 'give_admin_field_tools_import', array( $this, 'render_page' ) ); |
|
106 | + add_action('give_admin_field_tools_import', array($this, 'render_page')); |
|
107 | 107 | |
108 | 108 | // Print the HTML. |
109 | - add_action( 'give_tools_import_core_settings_form_start', array( $this, 'html' ), 10 ); |
|
109 | + add_action('give_tools_import_core_settings_form_start', array($this, 'html'), 10); |
|
110 | 110 | |
111 | 111 | // Run when form submit. |
112 | - add_action( 'give-tools_save_import', array( $this, 'save' ) ); |
|
112 | + add_action('give-tools_save_import', array($this, 'save')); |
|
113 | 113 | |
114 | - add_action( 'give-tools_update_notices', array( $this, 'update_notices' ), 11, 1 ); |
|
114 | + add_action('give-tools_update_notices', array($this, 'update_notices'), 11, 1); |
|
115 | 115 | |
116 | 116 | // Used to add submit button. |
117 | - add_action( 'give_tools_import_core_settings_form_end', array( $this, 'submit' ), 10 ); |
|
117 | + add_action('give_tools_import_core_settings_form_end', array($this, 'submit'), 10); |
|
118 | 118 | } |
119 | 119 | |
120 | 120 | /** |
@@ -126,9 +126,9 @@ discard block |
||
126 | 126 | * |
127 | 127 | * @return mixed |
128 | 128 | */ |
129 | - public function update_notices( $messages ) { |
|
130 | - if ( ! empty( $_GET['tab'] ) && 'import' === give_clean( $_GET['tab'] ) ) { |
|
131 | - unset( $messages['give-setting-updated'] ); |
|
129 | + public function update_notices($messages) { |
|
130 | + if ( ! empty($_GET['tab']) && 'import' === give_clean($_GET['tab'])) { |
|
131 | + unset($messages['give-setting-updated']); |
|
132 | 132 | } |
133 | 133 | |
134 | 134 | return $messages; |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | * @since 1.8.17 |
141 | 141 | */ |
142 | 142 | public function submit() { |
143 | - wp_nonce_field( 'give-save-settings', '_give-save-settings' ); |
|
143 | + wp_nonce_field('give-save-settings', '_give-save-settings'); |
|
144 | 144 | ?> |
145 | 145 | <input type="hidden" class="import-step" id="import-step" name="step" value="<?php echo $this->get_step(); ?>"/> |
146 | 146 | <input type="hidden" class="importer-type" value="<?php echo $this->importer_type; ?>"/> |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | id="<?php echo "step-{$step}"; ?>"> |
164 | 164 | <tbody> |
165 | 165 | <?php |
166 | - switch ( $this->get_step() ) { |
|
166 | + switch ($this->get_step()) { |
|
167 | 167 | case 1: |
168 | 168 | $this->render_upload_html(); |
169 | 169 | break; |
@@ -190,14 +190,14 @@ discard block |
||
190 | 190 | public function import_success() { |
191 | 191 | // Imported successfully |
192 | 192 | |
193 | - $success = (bool) ( isset( $_GET['success'] ) ? give_clean( $_GET['success'] ) : false ); |
|
194 | - $undo = (bool) ( isset( $_GET['undo'] ) ? give_clean( $_GET['undo'] ) : false ); |
|
193 | + $success = (bool) (isset($_GET['success']) ? give_clean($_GET['success']) : false); |
|
194 | + $undo = (bool) (isset($_GET['undo']) ? give_clean($_GET['undo']) : false); |
|
195 | 195 | $query_arg_setting = array( |
196 | 196 | 'post_type' => 'give_forms', |
197 | 197 | 'page' => 'give-settings', |
198 | 198 | ); |
199 | 199 | |
200 | - if ( $undo ) { |
|
200 | + if ($undo) { |
|
201 | 201 | $success = false; |
202 | 202 | } |
203 | 203 | |
@@ -210,30 +210,30 @@ discard block |
||
210 | 210 | 'undo' => 'true', |
211 | 211 | ); |
212 | 212 | |
213 | - $title = __( 'Settings Importing Completed!', 'give' ); |
|
214 | - if ( $success ) { |
|
213 | + $title = __('Settings Importing Completed!', 'give'); |
|
214 | + if ($success) { |
|
215 | 215 | $query_arg_success['undo'] = '1'; |
216 | 216 | $query_arg_success['step'] = '3'; |
217 | 217 | $query_arg_success['success'] = '1'; |
218 | - $text = __( 'Undo Importing', 'give' ); |
|
218 | + $text = __('Undo Importing', 'give'); |
|
219 | 219 | } else { |
220 | - if ( $undo ) { |
|
221 | - $host_give_options = get_option( 'give_settings_old', array() ); |
|
222 | - update_option( 'give_settings', $host_give_options ); |
|
223 | - $title = __( 'Undo of Setting Imported Completed!', 'give' ); |
|
220 | + if ($undo) { |
|
221 | + $host_give_options = get_option('give_settings_old', array()); |
|
222 | + update_option('give_settings', $host_give_options); |
|
223 | + $title = __('Undo of Setting Imported Completed!', 'give'); |
|
224 | 224 | } else { |
225 | - $title = __( 'Failed to import', 'give' ); |
|
225 | + $title = __('Failed to import', 'give'); |
|
226 | 226 | } |
227 | 227 | |
228 | - $text = __( 'Importing Again', 'give' ); |
|
228 | + $text = __('Importing Again', 'give'); |
|
229 | 229 | } |
230 | 230 | ?> |
231 | 231 | <tr valign="top" class="give-import-dropdown"> |
232 | 232 | <th colspan="2"> |
233 | 233 | <h2><?php echo $title; ?></h2> |
234 | 234 | <p> |
235 | - <a class="button button-large button-secondary" href="<?php echo add_query_arg( $query_arg_success, admin_url( 'edit.php' ) ); ?>"><?php echo $text; ?></a> |
|
236 | - <a class="button button-large button-secondary" href="<?php echo add_query_arg( $query_arg_setting, admin_url( 'edit.php' ) ); ?>"><?php echo __( 'View Settings', 'give' ); ?></a> |
|
235 | + <a class="button button-large button-secondary" href="<?php echo add_query_arg($query_arg_success, admin_url('edit.php')); ?>"><?php echo $text; ?></a> |
|
236 | + <a class="button button-large button-secondary" href="<?php echo add_query_arg($query_arg_setting, admin_url('edit.php')); ?>"><?php echo __('View Settings', 'give'); ?></a> |
|
237 | 237 | </p> |
238 | 238 | </th> |
239 | 239 | </tr> |
@@ -246,14 +246,14 @@ discard block |
||
246 | 246 | * @since 1.8.17 |
247 | 247 | */ |
248 | 248 | public function start_import() { |
249 | - $type = ( ! empty( $_GET['type'] ) ? give_clean( $_GET['type'] ) : 'replace' ); |
|
250 | - $file_name = ( ! empty( $_GET['file_name'] ) ? give_clean( $_GET['file_name'] ) : '' ); |
|
249 | + $type = ( ! empty($_GET['type']) ? give_clean($_GET['type']) : 'replace'); |
|
250 | + $file_name = ( ! empty($_GET['file_name']) ? give_clean($_GET['file_name']) : ''); |
|
251 | 251 | |
252 | 252 | ?> |
253 | 253 | <tr valign="top" class="give-import-dropdown"> |
254 | 254 | <th colspan="2"> |
255 | - <h2 id="give-import-title"><?php esc_html_e( 'Importing', 'give' ) ?></h2> |
|
256 | - <p class="give-field-description"><?php esc_html_e( 'Your settings are now being imported...', 'give' ) ?></p> |
|
255 | + <h2 id="give-import-title"><?php esc_html_e('Importing', 'give') ?></h2> |
|
256 | + <p class="give-field-description"><?php esc_html_e('Your settings are now being imported...', 'give') ?></p> |
|
257 | 257 | </th> |
258 | 258 | </tr> |
259 | 259 | |
@@ -286,14 +286,14 @@ discard block |
||
286 | 286 | $step = $this->get_step(); |
287 | 287 | ?> |
288 | 288 | <ol class="give-progress-steps"> |
289 | - <li class="<?php echo( 1 === $step ? 'active' : '' ); ?>"> |
|
290 | - <?php esc_html_e( 'Upload JSON file', 'give' ); ?> |
|
289 | + <li class="<?php echo(1 === $step ? 'active' : ''); ?>"> |
|
290 | + <?php esc_html_e('Upload JSON file', 'give'); ?> |
|
291 | 291 | </li> |
292 | - <li class="<?php echo( 2 === $step ? 'active' : '' ); ?>"> |
|
293 | - <?php esc_html_e( 'Import', 'give' ); ?> |
|
292 | + <li class="<?php echo(2 === $step ? 'active' : ''); ?>"> |
|
293 | + <?php esc_html_e('Import', 'give'); ?> |
|
294 | 294 | </li> |
295 | - <li class="<?php echo( 3 === $step ? 'active' : '' ); ?>"> |
|
296 | - <?php esc_html_e( 'Done!', 'give' ); ?> |
|
295 | + <li class="<?php echo(3 === $step ? 'active' : ''); ?>"> |
|
296 | + <?php esc_html_e('Done!', 'give'); ?> |
|
297 | 297 | </li> |
298 | 298 | </ol> |
299 | 299 | <?php |
@@ -307,14 +307,14 @@ discard block |
||
307 | 307 | * @return int $step on which step doest the import is on. |
308 | 308 | */ |
309 | 309 | public function get_step() { |
310 | - $step = (int) ( isset( $_REQUEST['step'] ) ? give_clean( $_REQUEST['step'] ) : 0 ); |
|
310 | + $step = (int) (isset($_REQUEST['step']) ? give_clean($_REQUEST['step']) : 0); |
|
311 | 311 | $on_step = 1; |
312 | 312 | |
313 | - if ( empty( $step ) || 1 === $step ) { |
|
313 | + if (empty($step) || 1 === $step) { |
|
314 | 314 | $on_step = 1; |
315 | - } elseif ( 2 === $step ) { |
|
315 | + } elseif (2 === $step) { |
|
316 | 316 | $on_step = 2; |
317 | - } elseif ( 3 === $step ) { |
|
317 | + } elseif (3 === $step) { |
|
318 | 318 | $on_step = 3; |
319 | 319 | } |
320 | 320 | |
@@ -327,7 +327,7 @@ discard block |
||
327 | 327 | * @since 1.8.17 |
328 | 328 | */ |
329 | 329 | public function render_page() { |
330 | - include_once GIVE_PLUGIN_DIR . 'includes/admin/tools/views/html-admin-page-import-core-settings.php'; |
|
330 | + include_once GIVE_PLUGIN_DIR.'includes/admin/tools/views/html-admin-page-import-core-settings.php'; |
|
331 | 331 | } |
332 | 332 | |
333 | 333 | /** |
@@ -339,15 +339,15 @@ discard block |
||
339 | 339 | * @return void |
340 | 340 | */ |
341 | 341 | public function render_upload_html() { |
342 | - $json = ( isset( $_POST['json'] ) ? give_clean( $_POST['json'] ) : '' ); |
|
343 | - $type = ( isset( $_POST['type'] ) ? give_clean( $_POST['type'] ) : 'merge' ); |
|
342 | + $json = (isset($_POST['json']) ? give_clean($_POST['json']) : ''); |
|
343 | + $type = (isset($_POST['type']) ? give_clean($_POST['type']) : 'merge'); |
|
344 | 344 | $step = $this->get_step(); |
345 | 345 | |
346 | 346 | ?> |
347 | 347 | <tr valign="top"> |
348 | 348 | <th colspan="2"> |
349 | - <h2 id="give-import-title"><?php esc_html_e( 'Import Core Settings from a JSON file', 'give' ) ?></h2> |
|
350 | - <p class="give-field-description"><?php esc_html_e( 'This tool allows you to merge or replace settings data to your give settings via a JSON file.', 'give' ) ?></p> |
|
349 | + <h2 id="give-import-title"><?php esc_html_e('Import Core Settings from a JSON file', 'give') ?></h2> |
|
350 | + <p class="give-field-description"><?php esc_html_e('This tool allows you to merge or replace settings data to your give settings via a JSON file.', 'give') ?></p> |
|
351 | 351 | </th> |
352 | 352 | </tr> |
353 | 353 | |
@@ -369,20 +369,20 @@ discard block |
||
369 | 369 | $settings = array( |
370 | 370 | array( |
371 | 371 | 'id' => 'type', |
372 | - 'name' => __( 'Merge Type:', 'give' ), |
|
373 | - 'description' => __( 'Import the Setting from the JSON and then merge or replace with the current settings', 'give' ), |
|
372 | + 'name' => __('Merge Type:', 'give'), |
|
373 | + 'description' => __('Import the Setting from the JSON and then merge or replace with the current settings', 'give'), |
|
374 | 374 | 'default' => $type, |
375 | 375 | 'type' => 'radio_inline', |
376 | 376 | 'options' => array( |
377 | - 'merge' => __( 'Merge', 'give' ), |
|
378 | - 'replace' => __( 'Replace', 'give' ), |
|
377 | + 'merge' => __('Merge', 'give'), |
|
378 | + 'replace' => __('Replace', 'give'), |
|
379 | 379 | ), |
380 | 380 | ), |
381 | 381 | ); |
382 | 382 | |
383 | - $settings = apply_filters( 'give_import_core_setting_html', $settings ); |
|
383 | + $settings = apply_filters('give_import_core_setting_html', $settings); |
|
384 | 384 | |
385 | - Give_Admin_Settings::output_fields( $settings, 'give_settings' ); |
|
385 | + Give_Admin_Settings::output_fields($settings, 'give_settings'); |
|
386 | 386 | ?> |
387 | 387 | <tr valign="top"> |
388 | 388 | <th></th> |
@@ -390,7 +390,7 @@ discard block |
||
390 | 390 | <input type="submit" |
391 | 391 | class="button button-primary button-large button-secondary <?php echo "step-{$step}"; ?>" |
392 | 392 | id="recount-stats-submit" |
393 | - value="<?php esc_attr_e( 'Submit', 'give' ); ?>"/> |
|
393 | + value="<?php esc_attr_e('Submit', 'give'); ?>"/> |
|
394 | 394 | </th> |
395 | 395 | </tr> |
396 | 396 | <?php |
@@ -407,20 +407,20 @@ discard block |
||
407 | 407 | $step = $this->get_step(); |
408 | 408 | |
409 | 409 | // Validation for first step. |
410 | - if ( 1 === $step ) { |
|
411 | - $type = ( ! empty( $_REQUEST['type'] ) ? give_clean( $_REQUEST['type'] ) : 'replace' ); |
|
410 | + if (1 === $step) { |
|
411 | + $type = ( ! empty($_REQUEST['type']) ? give_clean($_REQUEST['type']) : 'replace'); |
|
412 | 412 | $core_settings = self::upload_widget_settings_file(); |
413 | - if ( ! empty( $core_settings['error'] ) ) { |
|
414 | - Give_Admin_Settings::add_error( 'give-import-csv', __( 'Please upload a valid JSON settings file.', 'give' ) ); |
|
413 | + if ( ! empty($core_settings['error'])) { |
|
414 | + Give_Admin_Settings::add_error('give-import-csv', __('Please upload a valid JSON settings file.', 'give')); |
|
415 | 415 | } else { |
416 | - $file_path = explode( '/', $core_settings['file'] ); |
|
417 | - $count = ( count( $file_path ) - 1 ); |
|
418 | - $url = give_import_page_url( (array) apply_filters( 'give_import_core_settings_importing_url', array( |
|
416 | + $file_path = explode('/', $core_settings['file']); |
|
417 | + $count = (count($file_path) - 1); |
|
418 | + $url = give_import_page_url((array) apply_filters('give_import_core_settings_importing_url', array( |
|
419 | 419 | 'step' => '2', |
420 | 420 | 'importer-type' => $this->importer_type, |
421 | 421 | 'type' => $type, |
422 | - 'file_name' => $file_path[ $count ], |
|
423 | - ) ) ); |
|
422 | + 'file_name' => $file_path[$count], |
|
423 | + ))); |
|
424 | 424 | |
425 | 425 | ?> |
426 | 426 | <script type="text/javascript"> |
@@ -438,7 +438,7 @@ discard block |
||
438 | 438 | * @return bool |
439 | 439 | */ |
440 | 440 | private function is_donations_import_page() { |
441 | - return 'import' === give_get_current_setting_tab() && isset( $_GET['importer-type'] ) && $this->importer_type === give_clean( $_GET['importer-type'] ); |
|
441 | + return 'import' === give_get_current_setting_tab() && isset($_GET['importer-type']) && $this->importer_type === give_clean($_GET['importer-type']); |
|
442 | 442 | } |
443 | 443 | |
444 | 444 | /** |
@@ -447,14 +447,14 @@ discard block |
||
447 | 447 | */ |
448 | 448 | public static function upload_widget_settings_file() { |
449 | 449 | $upload = false; |
450 | - if ( isset( $_FILES['json'] ) ) { |
|
451 | - add_filter( 'upload_mimes', array( __CLASS__, 'json_upload_mimes' ) ); |
|
450 | + if (isset($_FILES['json'])) { |
|
451 | + add_filter('upload_mimes', array(__CLASS__, 'json_upload_mimes')); |
|
452 | 452 | |
453 | - $upload = wp_handle_upload( $_FILES['json'], array( 'test_form' => false ) ); |
|
453 | + $upload = wp_handle_upload($_FILES['json'], array('test_form' => false)); |
|
454 | 454 | |
455 | - remove_filter( 'upload_mimes', array( __CLASS__, 'json_upload_mimes' ) ); |
|
455 | + remove_filter('upload_mimes', array(__CLASS__, 'json_upload_mimes')); |
|
456 | 456 | } else { |
457 | - Give_Admin_Settings::add_error( 'give-import-csv', __( 'Please upload or provide a valid JSON file.', 'give' ) ); |
|
457 | + Give_Admin_Settings::add_error('give-import-csv', __('Please upload or provide a valid JSON file.', 'give')); |
|
458 | 458 | } |
459 | 459 | |
460 | 460 | return $upload; |
@@ -465,7 +465,7 @@ discard block |
||
465 | 465 | * |
466 | 466 | * @param array $existing_mimes |
467 | 467 | */ |
468 | - public static function json_upload_mimes( $existing_mimes = array() ) { |
|
468 | + public static function json_upload_mimes($existing_mimes = array()) { |
|
469 | 469 | $existing_mimes['json'] = 'application/json'; |
470 | 470 | |
471 | 471 | return $existing_mimes; |
@@ -9,11 +9,11 @@ discard block |
||
9 | 9 | * @since 1.8 |
10 | 10 | */ |
11 | 11 | |
12 | -if ( ! defined( 'ABSPATH' ) ) { |
|
12 | +if ( ! defined('ABSPATH')) { |
|
13 | 13 | exit; // Exit if accessed directly |
14 | 14 | } |
15 | 15 | |
16 | -if ( ! class_exists( 'Give_Settings_Import' ) ) { |
|
16 | +if ( ! class_exists('Give_Settings_Import')) { |
|
17 | 17 | |
18 | 18 | /** |
19 | 19 | * Give_Settings_Import. |
@@ -45,23 +45,23 @@ discard block |
||
45 | 45 | */ |
46 | 46 | public function __construct() { |
47 | 47 | $this->id = 'import'; |
48 | - $this->label = __( 'Import', 'give' ); |
|
48 | + $this->label = __('Import', 'give'); |
|
49 | 49 | |
50 | 50 | parent::__construct(); |
51 | 51 | |
52 | 52 | // Will display html of the import donation. |
53 | - add_action( 'give_admin_field_tools_import', array( |
|
53 | + add_action('give_admin_field_tools_import', array( |
|
54 | 54 | 'Give_Settings_Import', |
55 | 55 | 'render_import_field', |
56 | - ), 10, 2 ); |
|
56 | + ), 10, 2); |
|
57 | 57 | |
58 | 58 | // Do not use main form for this tab. |
59 | - if ( give_get_current_setting_tab() === $this->id ) { |
|
60 | - add_action( "give-tools_open_form", '__return_empty_string' ); |
|
61 | - add_action( "give-tools_close_form", '__return_empty_string' ); |
|
59 | + if (give_get_current_setting_tab() === $this->id) { |
|
60 | + add_action("give-tools_open_form", '__return_empty_string'); |
|
61 | + add_action("give-tools_close_form", '__return_empty_string'); |
|
62 | 62 | |
63 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/import/class-give-import-donations.php'; |
|
64 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/import/class-give-import-core-settings.php'; |
|
63 | + require_once GIVE_PLUGIN_DIR.'includes/admin/tools/import/class-give-import-donations.php'; |
|
64 | + require_once GIVE_PLUGIN_DIR.'includes/admin/tools/import/class-give-import-core-settings.php'; |
|
65 | 65 | } |
66 | 66 | } |
67 | 67 | |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | * @param array $settings |
81 | 81 | */ |
82 | 82 | $settings = apply_filters( |
83 | - 'give_get_settings_' . $this->id, |
|
83 | + 'give_get_settings_'.$this->id, |
|
84 | 84 | array( |
85 | 85 | array( |
86 | 86 | 'id' => 'give_tools_import', |
@@ -89,14 +89,14 @@ discard block |
||
89 | 89 | ), |
90 | 90 | array( |
91 | 91 | 'id' => 'import', |
92 | - 'name' => __( 'Import', 'give' ), |
|
92 | + 'name' => __('Import', 'give'), |
|
93 | 93 | 'type' => 'tools_import', |
94 | 94 | ), |
95 | 95 | array( |
96 | - 'name' => esc_html__( 'Import Docs Link', 'give' ), |
|
96 | + 'name' => esc_html__('Import Docs Link', 'give'), |
|
97 | 97 | 'id' => 'import_docs_link', |
98 | - 'url' => esc_url( 'http://docs.givewp.com/tools-importer' ), |
|
99 | - 'title' => __( 'Import Tab', 'give' ), |
|
98 | + 'url' => esc_url('http://docs.givewp.com/tools-importer'), |
|
99 | + 'title' => __('Import Tab', 'give'), |
|
100 | 100 | 'type' => 'give_docs_link', |
101 | 101 | ), |
102 | 102 | array( |
@@ -120,8 +120,8 @@ discard block |
||
120 | 120 | * @param $field |
121 | 121 | * @param $option_value |
122 | 122 | */ |
123 | - public static function render_import_field( $field, $option_value ) { |
|
124 | - include_once GIVE_PLUGIN_DIR . 'includes/admin/tools/views/html-admin-page-imports.php'; |
|
123 | + public static function render_import_field($field, $option_value) { |
|
124 | + include_once GIVE_PLUGIN_DIR.'includes/admin/tools/views/html-admin-page-imports.php'; |
|
125 | 125 | } |
126 | 126 | } |
127 | 127 | } |
@@ -3,11 +3,11 @@ discard block |
||
3 | 3 | * Admin View: Import Donations |
4 | 4 | */ |
5 | 5 | |
6 | -if ( ! defined( 'ABSPATH' ) ) { |
|
6 | +if ( ! defined('ABSPATH')) { |
|
7 | 7 | exit; |
8 | 8 | } |
9 | 9 | |
10 | -if ( ! current_user_can( 'manage_give_settings' ) ) { |
|
10 | +if ( ! current_user_can('manage_give_settings')) { |
|
11 | 11 | return; |
12 | 12 | } |
13 | 13 | |
@@ -16,11 +16,11 @@ discard block |
||
16 | 16 | * |
17 | 17 | * @since 1.8.13 |
18 | 18 | */ |
19 | -do_action( 'give_tools_import_donations_main_before' ); |
|
19 | +do_action('give_tools_import_donations_main_before'); |
|
20 | 20 | ?> |
21 | 21 | <div id="poststuff"> |
22 | 22 | <div class="postbox"> |
23 | - <h1 class="give-importer-h1" align="center"><?php esc_html_e( 'Import Donations', 'give' ); ?></h1> |
|
23 | + <h1 class="give-importer-h1" align="center"><?php esc_html_e('Import Donations', 'give'); ?></h1> |
|
24 | 24 | <div class="inside give-tools-setting-page-import give-import-donations"> |
25 | 25 | <?php |
26 | 26 | /** |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | * |
29 | 29 | * @since 1.8.14 |
30 | 30 | */ |
31 | - do_action( 'give_tools_import_donations_form_before_start' ); |
|
31 | + do_action('give_tools_import_donations_form_before_start'); |
|
32 | 32 | ?> |
33 | 33 | <form method="post" id="give-import-donations-form" class="give-import-form tools-setting-page-import tools-setting-page-import"> |
34 | 34 | |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | * |
39 | 39 | * @since 1.8.14 |
40 | 40 | */ |
41 | - do_action( 'give_tools_import_donations_form_start' ); |
|
41 | + do_action('give_tools_import_donations_form_start'); |
|
42 | 42 | ?> |
43 | 43 | |
44 | 44 | <?php |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | * |
48 | 48 | * @since 1.8.14 |
49 | 49 | */ |
50 | - do_action( 'give_tools_import_donations_form_end' ); |
|
50 | + do_action('give_tools_import_donations_form_end'); |
|
51 | 51 | ?> |
52 | 52 | </form> |
53 | 53 | <?php |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | * |
57 | 57 | * @since 1.8.14 |
58 | 58 | */ |
59 | - do_action( 'give_tools_import_donations_form_after_end' ); |
|
59 | + do_action('give_tools_import_donations_form_after_end'); |
|
60 | 60 | ?> |
61 | 61 | </div><!-- .inside --> |
62 | 62 | </div><!-- .postbox --> |
@@ -67,4 +67,4 @@ discard block |
||
67 | 67 | * |
68 | 68 | * @since 1.8.13 |
69 | 69 | */ |
70 | -do_action( 'give_tools_import_donations_main_after' ); |
|
70 | +do_action('give_tools_import_donations_main_after'); |
@@ -3,7 +3,7 @@ discard block |
||
3 | 3 | * Admin View: Exports |
4 | 4 | */ |
5 | 5 | |
6 | -if ( ! defined( 'ABSPATH' ) ) { |
|
6 | +if ( ! defined('ABSPATH')) { |
|
7 | 7 | exit; |
8 | 8 | } ?> |
9 | 9 | |
@@ -18,14 +18,14 @@ discard block |
||
18 | 18 | * |
19 | 19 | * @since 1.0 |
20 | 20 | */ |
21 | - do_action( 'give_tools_tab_export_content_top' ); |
|
21 | + do_action('give_tools_tab_export_content_top'); |
|
22 | 22 | ?> |
23 | 23 | |
24 | 24 | <table class="widefat export-options-table give-table striped"> |
25 | 25 | <thead> |
26 | 26 | <tr> |
27 | - <th scope="col"><?php esc_html_e( 'Export Type', 'give' ); ?></th> |
|
28 | - <th scope="col"><?php esc_html_e( 'Export Options', 'give' ); ?></th> |
|
27 | + <th scope="col"><?php esc_html_e('Export Type', 'give'); ?></th> |
|
28 | + <th scope="col"><?php esc_html_e('Export Options', 'give'); ?></th> |
|
29 | 29 | </tr> |
30 | 30 | </thead> |
31 | 31 | <tbody> |
@@ -38,42 +38,42 @@ discard block |
||
38 | 38 | * |
39 | 39 | * @since 1.0 |
40 | 40 | */ |
41 | - do_action( 'give_tools_tab_export_table_top' ); |
|
41 | + do_action('give_tools_tab_export_table_top'); |
|
42 | 42 | ?> |
43 | 43 | <tr class="give-export-pdf-sales-earnings"> |
44 | 44 | <td scope="row" class="row-title"> |
45 | 45 | <h3> |
46 | - <span><?php esc_html_e( 'Export PDF of Donations and Income', 'give' ); ?></span> |
|
46 | + <span><?php esc_html_e('Export PDF of Donations and Income', 'give'); ?></span> |
|
47 | 47 | </h3> |
48 | - <p><?php esc_html_e( 'Download a PDF of Donations and Income reports for all forms for the current year.', 'give' ); ?></p> |
|
48 | + <p><?php esc_html_e('Download a PDF of Donations and Income reports for all forms for the current year.', 'give'); ?></p> |
|
49 | 49 | </td> |
50 | 50 | <td> |
51 | - <a class="button" href="<?php echo wp_nonce_url( add_query_arg( array( 'give-action' => 'generate_pdf' ) ), 'give_generate_pdf' ); ?>"> |
|
52 | - <?php esc_html_e( 'Generate PDF', 'give' ); ?> |
|
51 | + <a class="button" href="<?php echo wp_nonce_url(add_query_arg(array('give-action' => 'generate_pdf')), 'give_generate_pdf'); ?>"> |
|
52 | + <?php esc_html_e('Generate PDF', 'give'); ?> |
|
53 | 53 | </a> |
54 | 54 | </td> |
55 | 55 | </tr> |
56 | 56 | <tr class="give-export-sales-earnings"> |
57 | 57 | <td scope="row" class="row-title"> |
58 | 58 | <h3> |
59 | - <span><?php esc_html_e( 'Export Income and Donation Stats', 'give' ); ?></span> |
|
59 | + <span><?php esc_html_e('Export Income and Donation Stats', 'give'); ?></span> |
|
60 | 60 | </h3> |
61 | - <p><?php esc_html_e( 'Download a CSV of income and donations over time.', 'give' ); ?></p> |
|
61 | + <p><?php esc_html_e('Download a CSV of income and donations over time.', 'give'); ?></p> |
|
62 | 62 | </td> |
63 | 63 | <td> |
64 | 64 | <form method="post"> |
65 | 65 | <?php |
66 | 66 | printf( |
67 | 67 | /* translators: 1: start date dropdown 2: end date dropdown */ |
68 | - esc_html__( '%1$s to %2$s', 'give' ), |
|
69 | - Give()->html->year_dropdown( 'start_year' ) . ' ' . Give()->html->month_dropdown( 'start_month' ), |
|
70 | - Give()->html->year_dropdown( 'end_year' ) . ' ' . Give()->html->month_dropdown( 'end_month' ) |
|
68 | + esc_html__('%1$s to %2$s', 'give'), |
|
69 | + Give()->html->year_dropdown('start_year').' '.Give()->html->month_dropdown('start_month'), |
|
70 | + Give()->html->year_dropdown('end_year').' '.Give()->html->month_dropdown('end_month') |
|
71 | 71 | ); |
72 | 72 | ?> |
73 | 73 | <input type="hidden" name="give-action" |
74 | 74 | value="earnings_export"/> |
75 | 75 | <input type="submit" |
76 | - value="<?php esc_attr_e( 'Generate CSV', 'give' ); ?>" |
|
76 | + value="<?php esc_attr_e('Generate CSV', 'give'); ?>" |
|
77 | 77 | class="button-secondary"/> |
78 | 78 | </form> |
79 | 79 | </td> |
@@ -81,37 +81,37 @@ discard block |
||
81 | 81 | <tr class="give-export-payment-history"> |
82 | 82 | <td scope="row" class="row-title"> |
83 | 83 | <h3> |
84 | - <span><?php esc_html_e( 'Export Donation History', 'give' ); ?></span> |
|
84 | + <span><?php esc_html_e('Export Donation History', 'give'); ?></span> |
|
85 | 85 | </h3> |
86 | - <p><?php esc_html_e( 'Download a CSV of all donations recorded.', 'give' ); ?></p> |
|
86 | + <p><?php esc_html_e('Download a CSV of all donations recorded.', 'give'); ?></p> |
|
87 | 87 | </td> |
88 | 88 | <td> |
89 | 89 | <form id="give-export-payments" |
90 | 90 | class="give-export-form" method="post"> |
91 | 91 | <?php |
92 | - echo Give()->html->date_field( array( |
|
92 | + echo Give()->html->date_field(array( |
|
93 | 93 | 'id' => 'give-payment-export-start', |
94 | 94 | 'name' => 'start', |
95 | - 'placeholder' => esc_attr__( 'Start date', 'give' ), |
|
96 | - ) ); |
|
95 | + 'placeholder' => esc_attr__('Start date', 'give'), |
|
96 | + )); |
|
97 | 97 | |
98 | - echo Give()->html->date_field( array( |
|
98 | + echo Give()->html->date_field(array( |
|
99 | 99 | 'id' => 'give-payment-export-end', |
100 | 100 | 'name' => 'end', |
101 | - 'placeholder' => esc_attr__( 'End date', 'give' ), |
|
102 | - ) ); |
|
101 | + 'placeholder' => esc_attr__('End date', 'give'), |
|
102 | + )); |
|
103 | 103 | ?> |
104 | 104 | <select name="status"> |
105 | - <option value="any"><?php esc_html_e( 'All Statuses', 'give' ); ?></option> |
|
105 | + <option value="any"><?php esc_html_e('All Statuses', 'give'); ?></option> |
|
106 | 106 | <?php |
107 | 107 | $statuses = give_get_payment_statuses(); |
108 | - foreach ( $statuses as $status => $label ) { |
|
109 | - echo '<option value="' . $status . '">' . $label . '</option>'; |
|
108 | + foreach ($statuses as $status => $label) { |
|
109 | + echo '<option value="'.$status.'">'.$label.'</option>'; |
|
110 | 110 | } |
111 | 111 | ?> |
112 | 112 | </select> |
113 | 113 | <?php |
114 | - if ( give_is_setting_enabled( give_get_option( 'categories' ) ) ) { |
|
114 | + if (give_is_setting_enabled(give_get_option('categories'))) { |
|
115 | 115 | echo Give()->html->category_dropdown( |
116 | 116 | 'give_forms_categories[]', |
117 | 117 | 0, |
@@ -121,12 +121,12 @@ discard block |
||
121 | 121 | 'multiple' => true, |
122 | 122 | 'selected' => array(), |
123 | 123 | 'show_option_all' => false, |
124 | - 'placeholder' => __( 'Choose one or more from categories', 'give' ), |
|
124 | + 'placeholder' => __('Choose one or more from categories', 'give'), |
|
125 | 125 | ) |
126 | 126 | ); |
127 | 127 | } |
128 | 128 | |
129 | - if ( give_is_setting_enabled( give_get_option( 'tags' ) ) ) { |
|
129 | + if (give_is_setting_enabled(give_get_option('tags'))) { |
|
130 | 130 | echo Give()->html->tags_dropdown( |
131 | 131 | 'give_forms_tags[]', |
132 | 132 | 0, |
@@ -136,18 +136,18 @@ discard block |
||
136 | 136 | 'multiple' => true, |
137 | 137 | 'selected' => array(), |
138 | 138 | 'show_option_all' => false, |
139 | - 'placeholder' => __( 'Choose one or more from tags', 'give' ), |
|
139 | + 'placeholder' => __('Choose one or more from tags', 'give'), |
|
140 | 140 | ) |
141 | 141 | ); |
142 | 142 | } |
143 | 143 | |
144 | - wp_nonce_field( 'give_ajax_export', 'give_ajax_export' ); |
|
144 | + wp_nonce_field('give_ajax_export', 'give_ajax_export'); |
|
145 | 145 | ?> |
146 | 146 | <input type="hidden" name="give-export-class" |
147 | 147 | value="Give_Batch_Payments_Export"/> |
148 | 148 | <span> |
149 | 149 | <input type="submit" |
150 | - value="<?php esc_attr_e( 'Generate CSV', 'give' ); ?>" |
|
150 | + value="<?php esc_attr_e('Generate CSV', 'give'); ?>" |
|
151 | 151 | class="button-secondary"/> |
152 | 152 | <span class="spinner"></span> |
153 | 153 | </span> |
@@ -157,9 +157,9 @@ discard block |
||
157 | 157 | <tr class="give-export-donors"> |
158 | 158 | <td scope="row" class="row-title"> |
159 | 159 | <h3> |
160 | - <span><?php esc_html_e( 'Export Donors in CSV', 'give' ); ?></span> |
|
160 | + <span><?php esc_html_e('Export Donors in CSV', 'give'); ?></span> |
|
161 | 161 | </h3> |
162 | - <p><?php esc_html_e( 'Download an export of donors for all donation forms or only those who have given to a particular form.', 'give' ); ?></p> |
|
162 | + <p><?php esc_html_e('Download an export of donors for all donation forms or only those who have given to a particular form.', 'give'); ?></p> |
|
163 | 163 | </td> |
164 | 164 | <td> |
165 | 165 | <form method="post" id="give_donor_export" |
@@ -167,93 +167,93 @@ discard block |
||
167 | 167 | |
168 | 168 | <?php |
169 | 169 | // Start Date form field for donors |
170 | - echo Give()->html->date_field( array( |
|
170 | + echo Give()->html->date_field(array( |
|
171 | 171 | 'id' => 'give_donor_export_start_date', |
172 | 172 | 'name' => 'donor_export_start_date', |
173 | - 'placeholder' => esc_attr__( 'Start date', 'give' ), |
|
174 | - ) ); |
|
173 | + 'placeholder' => esc_attr__('Start date', 'give'), |
|
174 | + )); |
|
175 | 175 | |
176 | 176 | // End Date form field for donors |
177 | - echo Give()->html->date_field( array( |
|
177 | + echo Give()->html->date_field(array( |
|
178 | 178 | 'id' => 'give_donor_export_end_date', |
179 | 179 | 'name' => 'donor_export_end_date', |
180 | - 'placeholder' => esc_attr__( 'End date', 'give' ), |
|
181 | - ) ); |
|
180 | + 'placeholder' => esc_attr__('End date', 'give'), |
|
181 | + )); |
|
182 | 182 | |
183 | 183 | // Donation forms dropdown for donors export |
184 | - echo Give()->html->forms_dropdown( array( |
|
184 | + echo Give()->html->forms_dropdown(array( |
|
185 | 185 | 'name' => 'forms', |
186 | 186 | 'id' => 'give_donor_export_form', |
187 | 187 | 'chosen' => true, |
188 | - ) ); |
|
188 | + )); |
|
189 | 189 | ?> |
190 | - <input type="submit" value="<?php esc_attr_e( 'Generate CSV', 'give' ); ?>" class="button-secondary"/> |
|
190 | + <input type="submit" value="<?php esc_attr_e('Generate CSV', 'give'); ?>" class="button-secondary"/> |
|
191 | 191 | |
192 | 192 | <div id="export-donor-options-wrap" |
193 | 193 | class="give-clearfix"> |
194 | - <p><?php esc_html_e( 'Export Columns:', 'give' ); ?></p> |
|
194 | + <p><?php esc_html_e('Export Columns:', 'give'); ?></p> |
|
195 | 195 | <ul id="give-export-option-ul"> |
196 | 196 | <li> |
197 | 197 | <label for="give-export-fullname"> |
198 | 198 | <input type="checkbox" checked |
199 | 199 | name="give_export_option[full_name]" |
200 | - id="give-export-fullname"><?php esc_html_e( 'Name', 'give' ); ?> |
|
200 | + id="give-export-fullname"><?php esc_html_e('Name', 'give'); ?> |
|
201 | 201 | </label> |
202 | 202 | </li> |
203 | 203 | <li> |
204 | 204 | <label for="give-export-email"> |
205 | 205 | <input type="checkbox" checked |
206 | 206 | name="give_export_option[email]" |
207 | - id="give-export-email"><?php esc_html_e( 'Email', 'give' ); ?> |
|
207 | + id="give-export-email"><?php esc_html_e('Email', 'give'); ?> |
|
208 | 208 | </label> |
209 | 209 | </li> |
210 | 210 | <li> |
211 | 211 | <label for="give-export-address"> |
212 | 212 | <input type="checkbox" checked |
213 | 213 | name="give_export_option[address]" |
214 | - id="give-export-address"><?php esc_html_e( 'Address', 'give' ); ?> |
|
214 | + id="give-export-address"><?php esc_html_e('Address', 'give'); ?> |
|
215 | 215 | </label> |
216 | 216 | </li> |
217 | 217 | <li> |
218 | 218 | <label for="give-export-userid"> |
219 | 219 | <input type="checkbox" checked |
220 | 220 | name="give_export_option[userid]" |
221 | - id="give-export-userid"><?php esc_html_e( 'User ID', 'give' ); ?> |
|
221 | + id="give-export-userid"><?php esc_html_e('User ID', 'give'); ?> |
|
222 | 222 | </label> |
223 | 223 | </li> |
224 | 224 | <li> |
225 | 225 | <label for="give-export-donation-form"> |
226 | 226 | <input type="checkbox" checked |
227 | 227 | name="give_export_option[donation_form]" |
228 | - id="give-export-donation-form"><?php esc_html_e( 'Donation Form', 'give' ); ?> |
|
228 | + id="give-export-donation-form"><?php esc_html_e('Donation Form', 'give'); ?> |
|
229 | 229 | </label> |
230 | 230 | </li> |
231 | 231 | <li> |
232 | 232 | <label for="give-export-first-donation-date"> |
233 | 233 | <input type="checkbox" checked |
234 | 234 | name="give_export_option[date_first_donated]" |
235 | - id="give-export-first-donation-date"><?php esc_html_e( 'First Donation Date', 'give' ); ?> |
|
235 | + id="give-export-first-donation-date"><?php esc_html_e('First Donation Date', 'give'); ?> |
|
236 | 236 | </label> |
237 | 237 | </li> |
238 | 238 | <li> |
239 | 239 | <label for="give-export-donation-number"> |
240 | 240 | <input type="checkbox" checked |
241 | 241 | name="give_export_option[donations]" |
242 | - id="give-export-donation-number"><?php esc_html_e( 'Number of Donations', 'give' ); ?> |
|
242 | + id="give-export-donation-number"><?php esc_html_e('Number of Donations', 'give'); ?> |
|
243 | 243 | </label> |
244 | 244 | </li> |
245 | 245 | <li> |
246 | 246 | <label for="give-export-donation-sum"> |
247 | 247 | <input type="checkbox" checked |
248 | 248 | name="give_export_option[donation_sum]" |
249 | - id="give-export-donation-sum"><?php esc_html_e( 'Total Donated', 'give' ); ?> |
|
249 | + id="give-export-donation-sum"><?php esc_html_e('Total Donated', 'give'); ?> |
|
250 | 250 | </label> |
251 | 251 | </li> |
252 | 252 | </ul> |
253 | 253 | </div> |
254 | - <?php wp_nonce_field( 'give_ajax_export', 'give_ajax_export' ); ?> |
|
254 | + <?php wp_nonce_field('give_ajax_export', 'give_ajax_export'); ?> |
|
255 | 255 | <input type="hidden" name="give-export-class" value="Give_Batch_Donors_Export"/> |
256 | - <input type="hidden" name="give_export_option[query_id]" value="<?php echo uniqid( 'give_' ); ?>"/> |
|
256 | + <input type="hidden" name="give_export_option[query_id]" value="<?php echo uniqid('give_'); ?>"/> |
|
257 | 257 | </form> |
258 | 258 | </td> |
259 | 259 | </tr> |
@@ -261,14 +261,14 @@ discard block |
||
261 | 261 | <tr class="give-export-core-settings"> |
262 | 262 | <td scope="row" class="row-title"> |
263 | 263 | <h3> |
264 | - <span><?php esc_html_e( 'Export Give Settings', 'give' ); ?></span> |
|
264 | + <span><?php esc_html_e('Export Give Settings', 'give'); ?></span> |
|
265 | 265 | </h3> |
266 | - <p><?php esc_html_e( 'Download an export of Give\'s settings and import it in a new WordPress installation.', 'give' ); ?></p> |
|
266 | + <p><?php esc_html_e('Download an export of Give\'s settings and import it in a new WordPress installation.', 'give'); ?></p> |
|
267 | 267 | </td> |
268 | 268 | <td> |
269 | 269 | <form method="post"> |
270 | 270 | <input type="hidden" name="give-action" value="core_settings_export"/> |
271 | - <input type="submit" value="<?php esc_attr_e( 'Export JSON', 'give' ); ?>" class="button-secondary"/> |
|
271 | + <input type="submit" value="<?php esc_attr_e('Export JSON', 'give'); ?>" class="button-secondary"/> |
|
272 | 272 | </form> |
273 | 273 | </td> |
274 | 274 | </tr> |
@@ -281,7 +281,7 @@ discard block |
||
281 | 281 | * |
282 | 282 | * @since 1.0 |
283 | 283 | */ |
284 | - do_action( 'give_tools_tab_export_table_bottom' ); |
|
284 | + do_action('give_tools_tab_export_table_bottom'); |
|
285 | 285 | ?> |
286 | 286 | </tbody> |
287 | 287 | </table> |
@@ -292,7 +292,7 @@ discard block |
||
292 | 292 | * |
293 | 293 | * @since 1.0 |
294 | 294 | */ |
295 | - do_action( 'give_tools_tab_export_content_bottom' ); |
|
295 | + do_action('give_tools_tab_export_content_bottom'); |
|
296 | 296 | ?> |
297 | 297 | |
298 | 298 | </div> |
@@ -3,11 +3,11 @@ discard block |
||
3 | 3 | * Admin View: Exports |
4 | 4 | */ |
5 | 5 | |
6 | -if ( ! defined( 'ABSPATH' ) ) { |
|
6 | +if ( ! defined('ABSPATH')) { |
|
7 | 7 | exit; |
8 | 8 | } |
9 | 9 | |
10 | -if ( ! current_user_can( 'manage_give_settings' ) ) { |
|
10 | +if ( ! current_user_can('manage_give_settings')) { |
|
11 | 11 | return; |
12 | 12 | } |
13 | 13 | |
@@ -16,29 +16,29 @@ discard block |
||
16 | 16 | * |
17 | 17 | * @since 1.5 |
18 | 18 | */ |
19 | -do_action( 'give_tools_recount_stats_before' ); |
|
19 | +do_action('give_tools_recount_stats_before'); |
|
20 | 20 | ?> |
21 | 21 | <div id="poststuff"> |
22 | 22 | <div class="postbox"> |
23 | 23 | |
24 | - <h2 class="hndle ui-sortable-handle"><span><?php esc_html_e( 'Recount Stats', 'give' ); ?></span></h2> |
|
24 | + <h2 class="hndle ui-sortable-handle"><span><?php esc_html_e('Recount Stats', 'give'); ?></span></h2> |
|
25 | 25 | |
26 | 26 | <div class="inside recount-stats-controls"> |
27 | - <p><?php esc_html_e( 'Use these tools to recount stats, delete test transactions, or reset stats.', 'give' ); ?></p> |
|
27 | + <p><?php esc_html_e('Use these tools to recount stats, delete test transactions, or reset stats.', 'give'); ?></p> |
|
28 | 28 | <form method="post" id="give-tools-recount-form" class="give-export-form"> |
29 | 29 | |
30 | - <?php wp_nonce_field( 'give_ajax_export', 'give_ajax_export' ); ?> |
|
30 | + <?php wp_nonce_field('give_ajax_export', 'give_ajax_export'); ?> |
|
31 | 31 | |
32 | 32 | <select name="give-export-class" id="recount-stats-type"> |
33 | - <option value="0" selected="selected" disabled="disabled"><?php esc_html_e( 'Please select an option', 'give' ); ?></option> |
|
34 | - <option data-type="recount-stats" value="Give_Tools_Recount_Income"><?php esc_html_e( 'Recalculate Total Donation Income Amount', 'give' ); ?></option> |
|
35 | - <option data-type="recount-form" value="Give_Tools_Recount_Form_Stats"><?php esc_html_e( 'Recalculate Income Amount and Donation Counts for a Form', 'give' ); ?></option> |
|
36 | - <option data-type="recount-all" value="Give_Tools_Recount_All_Stats"><?php esc_html_e( 'Recalculate Income Amount and Donation Counts for All Forms', 'give' ); ?></option> |
|
37 | - <option data-type="recount-donor-stats" value="Give_Tools_Recount_Donor_Stats"><?php esc_html_e( 'Recalculate Donor Statistics', 'give' ); ?></option> |
|
38 | - <option data-type="delete-test-transactions" value="Give_Tools_Delete_Test_Transactions"><?php esc_html_e( 'Delete Test Payments', 'give' ); ?></option> |
|
39 | - <option data-type="delete-test-donors" value="Give_Tools_Delete_Donors"><?php esc_html_e( 'Delete Test Donors and Payments', 'give' ); ?></option> |
|
40 | - <option data-type="delete-import-donors" value="Give_Tools_Import_Donors"><?php esc_html_e( 'Delete Imported Donors and Payments', 'give' ); ?></option> |
|
41 | - <option data-type="reset-stats" value="Give_Tools_Reset_Stats"><?php esc_html_e( 'Delete All Data', 'give' ); ?></option> |
|
33 | + <option value="0" selected="selected" disabled="disabled"><?php esc_html_e('Please select an option', 'give'); ?></option> |
|
34 | + <option data-type="recount-stats" value="Give_Tools_Recount_Income"><?php esc_html_e('Recalculate Total Donation Income Amount', 'give'); ?></option> |
|
35 | + <option data-type="recount-form" value="Give_Tools_Recount_Form_Stats"><?php esc_html_e('Recalculate Income Amount and Donation Counts for a Form', 'give'); ?></option> |
|
36 | + <option data-type="recount-all" value="Give_Tools_Recount_All_Stats"><?php esc_html_e('Recalculate Income Amount and Donation Counts for All Forms', 'give'); ?></option> |
|
37 | + <option data-type="recount-donor-stats" value="Give_Tools_Recount_Donor_Stats"><?php esc_html_e('Recalculate Donor Statistics', 'give'); ?></option> |
|
38 | + <option data-type="delete-test-transactions" value="Give_Tools_Delete_Test_Transactions"><?php esc_html_e('Delete Test Payments', 'give'); ?></option> |
|
39 | + <option data-type="delete-test-donors" value="Give_Tools_Delete_Donors"><?php esc_html_e('Delete Test Donors and Payments', 'give'); ?></option> |
|
40 | + <option data-type="delete-import-donors" value="Give_Tools_Import_Donors"><?php esc_html_e('Delete Imported Donors and Payments', 'give'); ?></option> |
|
41 | + <option data-type="reset-stats" value="Give_Tools_Reset_Stats"><?php esc_html_e('Delete All Data', 'give'); ?></option> |
|
42 | 42 | <?php |
43 | 43 | /** |
44 | 44 | * Fires in the recount stats selectbox. |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | * |
48 | 48 | * @since 1.5 |
49 | 49 | */ |
50 | - do_action( 'give_recount_tool_options' ); |
|
50 | + do_action('give_recount_tool_options'); |
|
51 | 51 | ?> |
52 | 52 | </select> |
53 | 53 | |
@@ -56,34 +56,34 @@ discard block |
||
56 | 56 | $args = array( |
57 | 57 | 'class' => 'tools-form-dropdown-recount-form-select', |
58 | 58 | 'name' => 'form_id', |
59 | - 'number' => - 1, |
|
59 | + 'number' => -1, |
|
60 | 60 | 'chosen' => true, |
61 | - 'placeholder' => __( 'Select Form', 'give' ), |
|
61 | + 'placeholder' => __('Select Form', 'give'), |
|
62 | 62 | ); |
63 | - echo Give()->html->forms_dropdown( $args ); |
|
63 | + echo Give()->html->forms_dropdown($args); |
|
64 | 64 | ?> |
65 | 65 | </span> |
66 | 66 | |
67 | 67 | <span class="tools-form-dropdown tools-form-dropdown-delete-import-donors" style="display: none"> |
68 | 68 | <label for="delete-import-donors"> |
69 | 69 | <?php |
70 | - echo Give()->html->checkbox( array( |
|
70 | + echo Give()->html->checkbox(array( |
|
71 | 71 | 'name' => 'delete-import-donors' |
72 | - ) ); |
|
73 | - _e( 'Delete imported WordPress users', 'give' ); |
|
72 | + )); |
|
73 | + _e('Delete imported WordPress users', 'give'); |
|
74 | 74 | ?> |
75 | 75 | </label> |
76 | 76 | </span> |
77 | 77 | |
78 | - <input type="submit" id="recount-stats-submit" value="<?php esc_attr_e( 'Submit', 'give' ); ?>" class="button-secondary"/> |
|
78 | + <input type="submit" id="recount-stats-submit" value="<?php esc_attr_e('Submit', 'give'); ?>" class="button-secondary"/> |
|
79 | 79 | |
80 | 80 | <br/> |
81 | 81 | |
82 | 82 | <span class="give-recount-stats-descriptions"> |
83 | - <span id="recount-stats"><?php esc_html_e( 'Recalculates the overall donation income amount.', 'give' ); ?></span> |
|
84 | - <span id="recount-form"><?php esc_html_e( 'Recalculates the donation and income stats for a specific form.', 'give' ); ?></span> |
|
85 | - <span id="recount-all"><?php esc_html_e( 'Recalculates the earnings and sales stats for all forms.', 'give' ); ?></span> |
|
86 | - <span id="recount-customer-stats"><?php esc_html_e( 'Recalculates the lifetime value and donation counts for all donors.', 'give' ); ?></span> |
|
83 | + <span id="recount-stats"><?php esc_html_e('Recalculates the overall donation income amount.', 'give'); ?></span> |
|
84 | + <span id="recount-form"><?php esc_html_e('Recalculates the donation and income stats for a specific form.', 'give'); ?></span> |
|
85 | + <span id="recount-all"><?php esc_html_e('Recalculates the earnings and sales stats for all forms.', 'give'); ?></span> |
|
86 | + <span id="recount-customer-stats"><?php esc_html_e('Recalculates the lifetime value and donation counts for all donors.', 'give'); ?></span> |
|
87 | 87 | <?php |
88 | 88 | /** |
89 | 89 | * Fires in the recount stats description area. |
@@ -92,10 +92,10 @@ discard block |
||
92 | 92 | * |
93 | 93 | * @since 1.5 |
94 | 94 | */ |
95 | - do_action( 'give_recount_tool_descriptions' ); |
|
95 | + do_action('give_recount_tool_descriptions'); |
|
96 | 96 | ?> |
97 | - <span id="delete-test-transactions"><?php _e( '<strong>Deletes</strong> all TEST donations, donors, and related log entries.', 'give' ); ?></span> |
|
98 | - <span id="reset-stats"><?php _e( '<strong>Deletes</strong> ALL donations, donors, and related log entries regardless of test or live mode.', 'give' ); ?></span> |
|
97 | + <span id="delete-test-transactions"><?php _e('<strong>Deletes</strong> all TEST donations, donors, and related log entries.', 'give'); ?></span> |
|
98 | + <span id="reset-stats"><?php _e('<strong>Deletes</strong> ALL donations, donors, and related log entries regardless of test or live mode.', 'give'); ?></span> |
|
99 | 99 | </span> |
100 | 100 | |
101 | 101 | <span class="spinner"></span> |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | * |
110 | 110 | * @since 1.5 |
111 | 111 | */ |
112 | - do_action( 'give_tools_recount_forms' ); |
|
112 | + do_action('give_tools_recount_forms'); |
|
113 | 113 | ?> |
114 | 114 | </div><!-- .inside --> |
115 | 115 | </div><!-- .postbox --> |
@@ -120,4 +120,4 @@ discard block |
||
120 | 120 | * |
121 | 121 | * @since 1.5 |
122 | 122 | */ |
123 | -do_action( 'give_tools_recount_stats_after' ); |
|
123 | +do_action('give_tools_recount_stats_after'); |
@@ -3,7 +3,7 @@ discard block |
||
3 | 3 | * Admin View: Imports |
4 | 4 | */ |
5 | 5 | |
6 | -if ( ! defined( 'ABSPATH' ) ) { |
|
6 | +if ( ! defined('ABSPATH')) { |
|
7 | 7 | exit; |
8 | 8 | } ?> |
9 | 9 | |
@@ -18,14 +18,14 @@ discard block |
||
18 | 18 | * |
19 | 19 | * @since 1.8.14 |
20 | 20 | */ |
21 | - do_action( 'give_tools_tab_import_content_top' ); |
|
21 | + do_action('give_tools_tab_import_content_top'); |
|
22 | 22 | ?> |
23 | 23 | |
24 | 24 | <table class="widefat Import-options-table give-table"> |
25 | 25 | <thead> |
26 | 26 | <tr> |
27 | - <th scope="col"><?php esc_html_e( 'Import Type', 'give' ); ?></th> |
|
28 | - <th scope="col"><?php esc_html_e( 'Import Options', 'give' ); ?></th> |
|
27 | + <th scope="col"><?php esc_html_e('Import Type', 'give'); ?></th> |
|
28 | + <th scope="col"><?php esc_html_e('Import Options', 'give'); ?></th> |
|
29 | 29 | </tr> |
30 | 30 | </thead> |
31 | 31 | <tbody> |
@@ -38,19 +38,19 @@ discard block |
||
38 | 38 | * |
39 | 39 | * @since 1.8.14 |
40 | 40 | */ |
41 | - do_action( 'give_tools_tab_import_table_top' ); |
|
41 | + do_action('give_tools_tab_import_table_top'); |
|
42 | 42 | ?> |
43 | 43 | |
44 | 44 | <tr class="give-Import-pdf-sales-earnings"> |
45 | 45 | <td scope="row" class="row-title"> |
46 | 46 | <h3> |
47 | - <span><?php esc_html_e( 'Import Donations', 'give' ); ?></span> |
|
47 | + <span><?php esc_html_e('Import Donations', 'give'); ?></span> |
|
48 | 48 | </h3> |
49 | - <p><?php esc_html_e( 'Import a CSV of Donations.', 'give' ); ?></p> |
|
49 | + <p><?php esc_html_e('Import a CSV of Donations.', 'give'); ?></p> |
|
50 | 50 | </td> |
51 | 51 | <td> |
52 | - <a class="button" href="<?php echo add_query_arg( array( 'importer-type' => 'import_donations' ) ); ?>"> |
|
53 | - <?php esc_html_e( 'Import CSV', 'give' ); ?> |
|
52 | + <a class="button" href="<?php echo add_query_arg(array('importer-type' => 'import_donations')); ?>"> |
|
53 | + <?php esc_html_e('Import CSV', 'give'); ?> |
|
54 | 54 | </a> |
55 | 55 | </td> |
56 | 56 | </tr> |
@@ -58,13 +58,13 @@ discard block |
||
58 | 58 | <tr class="give-import-core-settings"> |
59 | 59 | <td scope="row" class="row-title"> |
60 | 60 | <h3> |
61 | - <span><?php esc_html_e( 'Import Give Settings', 'give' ); ?></span> |
|
61 | + <span><?php esc_html_e('Import Give Settings', 'give'); ?></span> |
|
62 | 62 | </h3> |
63 | - <p><?php esc_html_e( 'Import Give\'s settings in JSON format.', 'give' ); ?></p> |
|
63 | + <p><?php esc_html_e('Import Give\'s settings in JSON format.', 'give'); ?></p> |
|
64 | 64 | </td> |
65 | 65 | <td> |
66 | - <a class="button" href="<?php echo add_query_arg( array( 'importer-type' => 'import_core_setting' ) ); ?>"> |
|
67 | - <?php esc_html_e( 'Import JSON', 'give' ); ?> |
|
66 | + <a class="button" href="<?php echo add_query_arg(array('importer-type' => 'import_core_setting')); ?>"> |
|
67 | + <?php esc_html_e('Import JSON', 'give'); ?> |
|
68 | 68 | </a> |
69 | 69 | </td> |
70 | 70 | </tr> |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | * |
79 | 79 | * @since 1.8.14 |
80 | 80 | */ |
81 | - do_action( 'give_tools_tab_import_table_bottom' ); |
|
81 | + do_action('give_tools_tab_import_table_bottom'); |
|
82 | 82 | ?> |
83 | 83 | </tbody> |
84 | 84 | </table> |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | * |
90 | 90 | * @since 1.8.14 |
91 | 91 | */ |
92 | - do_action( 'give_tools_tab_import_content_bottom' ); |
|
92 | + do_action('give_tools_tab_import_content_bottom'); |
|
93 | 93 | ?> |
94 | 94 | |
95 | 95 | </div> |
@@ -3,11 +3,11 @@ discard block |
||
3 | 3 | * Admin View: Import Core Settings |
4 | 4 | */ |
5 | 5 | |
6 | -if ( ! defined( 'ABSPATH' ) ) { |
|
6 | +if ( ! defined('ABSPATH')) { |
|
7 | 7 | exit; |
8 | 8 | } |
9 | 9 | |
10 | -if ( ! current_user_can( 'manage_give_settings' ) ) { |
|
10 | +if ( ! current_user_can('manage_give_settings')) { |
|
11 | 11 | return; |
12 | 12 | } |
13 | 13 | |
@@ -16,11 +16,11 @@ discard block |
||
16 | 16 | * |
17 | 17 | * @since 1.8.17 |
18 | 18 | */ |
19 | -do_action( 'give_tools_import_core_settings_main_before' ); |
|
19 | +do_action('give_tools_import_core_settings_main_before'); |
|
20 | 20 | ?> |
21 | 21 | <div id="poststuff"> |
22 | 22 | <div class="postbox"> |
23 | - <h1 class="give-importer-h1" align="center"><?php esc_html_e( 'Import Settings', 'give' ); ?></h1> |
|
23 | + <h1 class="give-importer-h1" align="center"><?php esc_html_e('Import Settings', 'give'); ?></h1> |
|
24 | 24 | <div class="inside give-tools-setting-page-import give-import-core-settings"> |
25 | 25 | <?php |
26 | 26 | /** |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | * |
29 | 29 | * @since 1.8.17 |
30 | 30 | */ |
31 | - do_action( 'give_tools_import_core_settings_form_before_start' ); |
|
31 | + do_action('give_tools_import_core_settings_form_before_start'); |
|
32 | 32 | ?> |
33 | 33 | <form method="post" id="give-import-core-settings-form" |
34 | 34 | class="give-import-form tools-setting-page-import tools-setting-page-import" |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | * |
41 | 41 | * @since 1.8.17 |
42 | 42 | */ |
43 | - do_action( 'give_tools_import_core_settings_form_start' ); |
|
43 | + do_action('give_tools_import_core_settings_form_start'); |
|
44 | 44 | ?> |
45 | 45 | |
46 | 46 | <?php |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | * |
50 | 50 | * @since 1.8.17 |
51 | 51 | */ |
52 | - do_action( 'give_tools_import_core_settings_form_end' ); |
|
52 | + do_action('give_tools_import_core_settings_form_end'); |
|
53 | 53 | ?> |
54 | 54 | </form> |
55 | 55 | <?php |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | * |
59 | 59 | * @since 1.8.17 |
60 | 60 | */ |
61 | - do_action( 'give_tools_import_core_settings_form_after_end' ); |
|
61 | + do_action('give_tools_import_core_settings_form_after_end'); |
|
62 | 62 | ?> |
63 | 63 | </div><!-- .inside --> |
64 | 64 | </div><!-- .postbox --> |
@@ -69,4 +69,4 @@ discard block |
||
69 | 69 | * |
70 | 70 | * @since 1.8.17 |
71 | 71 | */ |
72 | -do_action( 'give_tools_import_core_settings_main_after' ); |
|
72 | +do_action('give_tools_import_core_settings_main_after'); |
@@ -9,11 +9,11 @@ discard block |
||
9 | 9 | * @since 1.8 |
10 | 10 | */ |
11 | 11 | |
12 | -if ( ! defined( 'ABSPATH' ) ) { |
|
12 | +if ( ! defined('ABSPATH')) { |
|
13 | 13 | exit; // Exit if accessed directly |
14 | 14 | } |
15 | 15 | |
16 | -if ( ! class_exists( 'Give_Settings_System_Info' ) ) : |
|
16 | +if ( ! class_exists('Give_Settings_System_Info')) : |
|
17 | 17 | |
18 | 18 | /** |
19 | 19 | * Give_Settings_System_Info. |
@@ -34,14 +34,14 @@ discard block |
||
34 | 34 | */ |
35 | 35 | public function __construct() { |
36 | 36 | $this->id = 'system-info'; |
37 | - $this->label = esc_html__( 'System Info', 'give' ); |
|
37 | + $this->label = esc_html__('System Info', 'give'); |
|
38 | 38 | |
39 | 39 | parent::__construct(); |
40 | 40 | |
41 | 41 | // Do not use main form for this tab. |
42 | - if ( give_get_current_setting_tab() === $this->id ) { |
|
43 | - add_action( "give-tools_open_form", '__return_empty_string' ); |
|
44 | - add_action( "give-tools_close_form", '__return_empty_string' ); |
|
42 | + if (give_get_current_setting_tab() === $this->id) { |
|
43 | + add_action("give-tools_open_form", '__return_empty_string'); |
|
44 | + add_action("give-tools_close_form", '__return_empty_string'); |
|
45 | 45 | } |
46 | 46 | } |
47 | 47 | |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | */ |
54 | 54 | public function output() { |
55 | 55 | $GLOBALS['give_hide_save_button'] = true; |
56 | - include_once( 'views/html-admin-page-system-info.php' ); |
|
56 | + include_once('views/html-admin-page-system-info.php'); |
|
57 | 57 | } |
58 | 58 | } |
59 | 59 |
@@ -1204,7 +1204,7 @@ |
||
1204 | 1204 | |
1205 | 1205 | } |
1206 | 1206 | |
1207 | - }else{ |
|
1207 | + } else{ |
|
1208 | 1208 | // The Update Ran. |
1209 | 1209 | give_set_upgrade_complete( 'v1817_update_donation_iranian_currency_code' ); |
1210 | 1210 | } |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | */ |
13 | 13 | |
14 | 14 | // Exit if accessed directly. |
15 | -if ( ! defined( 'ABSPATH' ) ) { |
|
15 | +if ( ! defined('ABSPATH')) { |
|
16 | 16 | exit; |
17 | 17 | } |
18 | 18 | |
@@ -25,63 +25,63 @@ discard block |
||
25 | 25 | */ |
26 | 26 | function give_do_automatic_upgrades() { |
27 | 27 | $did_upgrade = false; |
28 | - $give_version = preg_replace( '/[^0-9.].*/', '', get_option( 'give_version' ) ); |
|
28 | + $give_version = preg_replace('/[^0-9.].*/', '', get_option('give_version')); |
|
29 | 29 | |
30 | - if ( ! $give_version ) { |
|
30 | + if ( ! $give_version) { |
|
31 | 31 | // 1.0 is the first version to use this option so we must add it. |
32 | 32 | $give_version = '1.0'; |
33 | 33 | } |
34 | 34 | |
35 | - switch ( true ) { |
|
35 | + switch (true) { |
|
36 | 36 | |
37 | - case version_compare( $give_version, '1.6', '<' ) : |
|
37 | + case version_compare($give_version, '1.6', '<') : |
|
38 | 38 | give_v16_upgrades(); |
39 | 39 | $did_upgrade = true; |
40 | 40 | |
41 | - case version_compare( $give_version, '1.7', '<' ) : |
|
41 | + case version_compare($give_version, '1.7', '<') : |
|
42 | 42 | give_v17_upgrades(); |
43 | 43 | $did_upgrade = true; |
44 | 44 | |
45 | - case version_compare( $give_version, '1.8', '<' ) : |
|
45 | + case version_compare($give_version, '1.8', '<') : |
|
46 | 46 | give_v18_upgrades(); |
47 | 47 | $did_upgrade = true; |
48 | 48 | |
49 | - case version_compare( $give_version, '1.8.7', '<' ) : |
|
49 | + case version_compare($give_version, '1.8.7', '<') : |
|
50 | 50 | give_v187_upgrades(); |
51 | 51 | $did_upgrade = true; |
52 | 52 | |
53 | - case version_compare( $give_version, '1.8.8', '<' ) : |
|
53 | + case version_compare($give_version, '1.8.8', '<') : |
|
54 | 54 | give_v188_upgrades(); |
55 | 55 | $did_upgrade = true; |
56 | 56 | |
57 | - case version_compare( $give_version, '1.8.9', '<' ) : |
|
57 | + case version_compare($give_version, '1.8.9', '<') : |
|
58 | 58 | give_v189_upgrades(); |
59 | 59 | $did_upgrade = true; |
60 | 60 | |
61 | - case version_compare( $give_version, '1.8.12', '<' ) : |
|
61 | + case version_compare($give_version, '1.8.12', '<') : |
|
62 | 62 | give_v1812_upgrades(); |
63 | 63 | $did_upgrade = true; |
64 | 64 | |
65 | - case version_compare( $give_version, '1.8.13', '<' ) : |
|
65 | + case version_compare($give_version, '1.8.13', '<') : |
|
66 | 66 | give_v1813_upgrades(); |
67 | 67 | $did_upgrade = true; |
68 | 68 | |
69 | - case version_compare( $give_version, '1.8.17', '<' ) : |
|
69 | + case version_compare($give_version, '1.8.17', '<') : |
|
70 | 70 | give_v1817_upgrades(); |
71 | 71 | $did_upgrade = true; |
72 | 72 | |
73 | - case version_compare( $give_version, '1.8.18', '<' ) : |
|
73 | + case version_compare($give_version, '1.8.18', '<') : |
|
74 | 74 | give_v1818_upgrades(); |
75 | 75 | $did_upgrade = true; |
76 | 76 | } |
77 | 77 | |
78 | - if ( $did_upgrade ) { |
|
79 | - update_option( 'give_version', preg_replace( '/[^0-9.].*/', '', GIVE_VERSION ) ); |
|
78 | + if ($did_upgrade) { |
|
79 | + update_option('give_version', preg_replace('/[^0-9.].*/', '', GIVE_VERSION)); |
|
80 | 80 | } |
81 | 81 | } |
82 | 82 | |
83 | -add_action( 'admin_init', 'give_do_automatic_upgrades' ); |
|
84 | -add_action( 'give_upgrades', 'give_do_automatic_upgrades' ); |
|
83 | +add_action('admin_init', 'give_do_automatic_upgrades'); |
|
84 | +add_action('give_upgrades', 'give_do_automatic_upgrades'); |
|
85 | 85 | |
86 | 86 | /** |
87 | 87 | * Display Upgrade Notices. |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | * |
96 | 96 | * @return void |
97 | 97 | */ |
98 | -function give_show_upgrade_notices( $give_updates ) { |
|
98 | +function give_show_upgrade_notices($give_updates) { |
|
99 | 99 | // v1.3.2 Upgrades |
100 | 100 | $give_updates->register( |
101 | 101 | array( |
@@ -161,34 +161,34 @@ discard block |
||
161 | 161 | ); |
162 | 162 | |
163 | 163 | // v1.8.17 Upgrades for donations. |
164 | - $give_updates->register( array( |
|
164 | + $give_updates->register(array( |
|
165 | 165 | 'id' => 'v1817_update_donation_iranian_currency_code', |
166 | 166 | 'version' => '1.8.17', |
167 | 167 | 'callback' => 'give_v1817_update_donation_iranian_currency_code', |
168 | - ) ); |
|
168 | + )); |
|
169 | 169 | |
170 | 170 | // v1.8.17 Upgrades for cleanup of user roles. |
171 | - $give_updates->register( array( |
|
171 | + $give_updates->register(array( |
|
172 | 172 | 'id' => 'v1817_cleanup_user_roles', |
173 | 173 | 'version' => '1.8.17', |
174 | 174 | 'callback' => 'give_v1817_cleanup_user_roles', |
175 | - ) ); |
|
175 | + )); |
|
176 | 176 | |
177 | 177 | // v1.8.18 Upgrades for assigning custom amount to existing set donations. |
178 | - $give_updates->register( array( |
|
178 | + $give_updates->register(array( |
|
179 | 179 | 'id' => 'v1818_assign_custom_amount_set_donation', |
180 | 180 | 'version' => '1.8.18', |
181 | 181 | 'callback' => 'give_v1818_assign_custom_amount_set_donation', |
182 | - ) ); |
|
182 | + )); |
|
183 | 183 | // v1.8.18 Cleanup the Give Worker Role Caps. |
184 | - $give_updates->register( array( |
|
184 | + $give_updates->register(array( |
|
185 | 185 | 'id' => 'v1818_give_worker_role_cleanup', |
186 | 186 | 'version' => '1.8.18', |
187 | 187 | 'callback' => 'give_v1818_give_worker_role_cleanup', |
188 | - ) ); |
|
188 | + )); |
|
189 | 189 | } |
190 | 190 | |
191 | -add_action( 'give_register_updates', 'give_show_upgrade_notices' ); |
|
191 | +add_action('give_register_updates', 'give_show_upgrade_notices'); |
|
192 | 192 | |
193 | 193 | /** |
194 | 194 | * Triggers all upgrade functions |
@@ -200,29 +200,29 @@ discard block |
||
200 | 200 | */ |
201 | 201 | function give_trigger_upgrades() { |
202 | 202 | |
203 | - if ( ! current_user_can( 'manage_give_settings' ) ) { |
|
204 | - wp_die( esc_html__( 'You do not have permission to do Give upgrades.', 'give' ), esc_html__( 'Error', 'give' ), array( |
|
203 | + if ( ! current_user_can('manage_give_settings')) { |
|
204 | + wp_die(esc_html__('You do not have permission to do Give upgrades.', 'give'), esc_html__('Error', 'give'), array( |
|
205 | 205 | 'response' => 403, |
206 | - ) ); |
|
206 | + )); |
|
207 | 207 | } |
208 | 208 | |
209 | - $give_version = get_option( 'give_version' ); |
|
209 | + $give_version = get_option('give_version'); |
|
210 | 210 | |
211 | - if ( ! $give_version ) { |
|
211 | + if ( ! $give_version) { |
|
212 | 212 | // 1.0 is the first version to use this option so we must add it. |
213 | 213 | $give_version = '1.0'; |
214 | - add_option( 'give_version', $give_version ); |
|
214 | + add_option('give_version', $give_version); |
|
215 | 215 | } |
216 | 216 | |
217 | - update_option( 'give_version', GIVE_VERSION ); |
|
218 | - delete_option( 'give_doing_upgrade' ); |
|
217 | + update_option('give_version', GIVE_VERSION); |
|
218 | + delete_option('give_doing_upgrade'); |
|
219 | 219 | |
220 | - if ( DOING_AJAX ) { |
|
221 | - die( 'complete' ); |
|
220 | + if (DOING_AJAX) { |
|
221 | + die('complete'); |
|
222 | 222 | } // End if(). |
223 | 223 | } |
224 | 224 | |
225 | -add_action( 'wp_ajax_give_trigger_upgrades', 'give_trigger_upgrades' ); |
|
225 | +add_action('wp_ajax_give_trigger_upgrades', 'give_trigger_upgrades'); |
|
226 | 226 | |
227 | 227 | |
228 | 228 | /** |
@@ -238,20 +238,20 @@ discard block |
||
238 | 238 | /* @var Give_Updates $give_updates */ |
239 | 239 | $give_updates = Give_Updates::get_instance(); |
240 | 240 | |
241 | - if ( ! current_user_can( 'manage_give_settings' ) ) { |
|
242 | - wp_die( esc_html__( 'You do not have permission to do Give upgrades.', 'give' ), esc_html__( 'Error', 'give' ), array( |
|
241 | + if ( ! current_user_can('manage_give_settings')) { |
|
242 | + wp_die(esc_html__('You do not have permission to do Give upgrades.', 'give'), esc_html__('Error', 'give'), array( |
|
243 | 243 | 'response' => 403, |
244 | - ) ); |
|
244 | + )); |
|
245 | 245 | } |
246 | 246 | |
247 | 247 | give_ignore_user_abort(); |
248 | 248 | |
249 | 249 | // UPDATE DB METAKEYS. |
250 | 250 | $sql = "UPDATE $wpdb->postmeta SET meta_key = '_give_payment_customer_id' WHERE meta_key = '_give_payment_donor_id'"; |
251 | - $query = $wpdb->query( $sql ); |
|
251 | + $query = $wpdb->query($sql); |
|
252 | 252 | |
253 | 253 | $give_updates->percentage = 100; |
254 | - give_set_upgrade_complete( 'upgrade_give_payment_customer_id' ); |
|
254 | + give_set_upgrade_complete('upgrade_give_payment_customer_id'); |
|
255 | 255 | } |
256 | 256 | |
257 | 257 | |
@@ -275,24 +275,24 @@ discard block |
||
275 | 275 | $where .= "AND ( p.post_status = 'abandoned' )"; |
276 | 276 | $where .= "AND ( m.meta_key = '_give_payment_gateway' AND m.meta_value = 'offline' )"; |
277 | 277 | |
278 | - $sql = $select . $join . $where; |
|
279 | - $found_payments = $wpdb->get_col( $sql ); |
|
278 | + $sql = $select.$join.$where; |
|
279 | + $found_payments = $wpdb->get_col($sql); |
|
280 | 280 | |
281 | - foreach ( $found_payments as $payment ) { |
|
281 | + foreach ($found_payments as $payment) { |
|
282 | 282 | |
283 | 283 | // Only change ones marked abandoned since our release last week because the admin may have marked some abandoned themselves. |
284 | - $modified_time = get_post_modified_time( 'U', false, $payment ); |
|
284 | + $modified_time = get_post_modified_time('U', false, $payment); |
|
285 | 285 | |
286 | 286 | // 1450124863 = 12/10/2015 20:42:25. |
287 | - if ( $modified_time >= 1450124863 ) { |
|
287 | + if ($modified_time >= 1450124863) { |
|
288 | 288 | |
289 | - give_update_payment_status( $payment, 'pending' ); |
|
289 | + give_update_payment_status($payment, 'pending'); |
|
290 | 290 | |
291 | 291 | } |
292 | 292 | } |
293 | 293 | |
294 | 294 | $give_updates->percentage = 100; |
295 | - give_set_upgrade_complete( 'upgrade_give_offline_status' ); |
|
295 | + give_set_upgrade_complete('upgrade_give_offline_status'); |
|
296 | 296 | } |
297 | 297 | |
298 | 298 | |
@@ -305,17 +305,17 @@ discard block |
||
305 | 305 | */ |
306 | 306 | function give_v152_cleanup_users() { |
307 | 307 | |
308 | - $give_version = get_option( 'give_version' ); |
|
308 | + $give_version = get_option('give_version'); |
|
309 | 309 | |
310 | - if ( ! $give_version ) { |
|
310 | + if ( ! $give_version) { |
|
311 | 311 | // 1.0 is the first version to use this option so we must add it. |
312 | 312 | $give_version = '1.0'; |
313 | 313 | } |
314 | 314 | |
315 | - $give_version = preg_replace( '/[^0-9.].*/', '', $give_version ); |
|
315 | + $give_version = preg_replace('/[^0-9.].*/', '', $give_version); |
|
316 | 316 | |
317 | 317 | // v1.5.2 Upgrades |
318 | - if ( version_compare( $give_version, '1.5.2', '<' ) || ! give_has_upgrade_completed( 'upgrade_give_user_caps_cleanup' ) ) { |
|
318 | + if (version_compare($give_version, '1.5.2', '<') || ! give_has_upgrade_completed('upgrade_give_user_caps_cleanup')) { |
|
319 | 319 | |
320 | 320 | // Delete all caps with "ss". |
321 | 321 | // Also delete all unused "campaign" roles. |
@@ -362,9 +362,9 @@ discard block |
||
362 | 362 | ); |
363 | 363 | |
364 | 364 | global $wp_roles; |
365 | - foreach ( $delete_caps as $cap ) { |
|
366 | - foreach ( array_keys( $wp_roles->roles ) as $role ) { |
|
367 | - $wp_roles->remove_cap( $role, $cap ); |
|
365 | + foreach ($delete_caps as $cap) { |
|
366 | + foreach (array_keys($wp_roles->roles) as $role) { |
|
367 | + $wp_roles->remove_cap($role, $cap); |
|
368 | 368 | } |
369 | 369 | } |
370 | 370 | |
@@ -374,15 +374,15 @@ discard block |
||
374 | 374 | $roles->add_caps(); |
375 | 375 | |
376 | 376 | // The Update Ran. |
377 | - update_option( 'give_version', preg_replace( '/[^0-9.].*/', '', GIVE_VERSION ) ); |
|
378 | - give_set_upgrade_complete( 'upgrade_give_user_caps_cleanup' ); |
|
379 | - delete_option( 'give_doing_upgrade' ); |
|
377 | + update_option('give_version', preg_replace('/[^0-9.].*/', '', GIVE_VERSION)); |
|
378 | + give_set_upgrade_complete('upgrade_give_user_caps_cleanup'); |
|
379 | + delete_option('give_doing_upgrade'); |
|
380 | 380 | |
381 | 381 | }// End if(). |
382 | 382 | |
383 | 383 | } |
384 | 384 | |
385 | -add_action( 'admin_init', 'give_v152_cleanup_users' ); |
|
385 | +add_action('admin_init', 'give_v152_cleanup_users'); |
|
386 | 386 | |
387 | 387 | /** |
388 | 388 | * 1.6 Upgrade routine to create the customer meta table. |
@@ -425,53 +425,53 @@ discard block |
||
425 | 425 | |
426 | 426 | // Get addons license key. |
427 | 427 | $addons = array(); |
428 | - foreach ( $give_options as $key => $value ) { |
|
429 | - if ( false !== strpos( $key, '_license_key' ) ) { |
|
430 | - $addons[ $key ] = $value; |
|
428 | + foreach ($give_options as $key => $value) { |
|
429 | + if (false !== strpos($key, '_license_key')) { |
|
430 | + $addons[$key] = $value; |
|
431 | 431 | } |
432 | 432 | } |
433 | 433 | |
434 | 434 | // Bailout: We do not have any addon license data to upgrade. |
435 | - if ( empty( $addons ) ) { |
|
435 | + if (empty($addons)) { |
|
436 | 436 | return false; |
437 | 437 | } |
438 | 438 | |
439 | - foreach ( $addons as $key => $addon_license ) { |
|
439 | + foreach ($addons as $key => $addon_license) { |
|
440 | 440 | |
441 | 441 | // Get addon shortname. |
442 | - $shortname = str_replace( '_license_key', '', $key ); |
|
442 | + $shortname = str_replace('_license_key', '', $key); |
|
443 | 443 | |
444 | 444 | // Addon license option name. |
445 | - $addon_license_option_name = $shortname . '_license_active'; |
|
445 | + $addon_license_option_name = $shortname.'_license_active'; |
|
446 | 446 | |
447 | 447 | // bailout if license is empty. |
448 | - if ( empty( $addon_license ) ) { |
|
449 | - delete_option( $addon_license_option_name ); |
|
448 | + if (empty($addon_license)) { |
|
449 | + delete_option($addon_license_option_name); |
|
450 | 450 | continue; |
451 | 451 | } |
452 | 452 | |
453 | 453 | // Get addon name. |
454 | 454 | $addon_name = array(); |
455 | - $addon_name_parts = explode( '_', str_replace( 'give_', '', $shortname ) ); |
|
456 | - foreach ( $addon_name_parts as $name_part ) { |
|
455 | + $addon_name_parts = explode('_', str_replace('give_', '', $shortname)); |
|
456 | + foreach ($addon_name_parts as $name_part) { |
|
457 | 457 | |
458 | 458 | // Fix addon name |
459 | - switch ( $name_part ) { |
|
459 | + switch ($name_part) { |
|
460 | 460 | case 'authorizenet' : |
461 | 461 | $name_part = 'authorize.net'; |
462 | 462 | break; |
463 | 463 | } |
464 | 464 | |
465 | - $addon_name[] = ucfirst( $name_part ); |
|
465 | + $addon_name[] = ucfirst($name_part); |
|
466 | 466 | } |
467 | 467 | |
468 | - $addon_name = implode( ' ', $addon_name ); |
|
468 | + $addon_name = implode(' ', $addon_name); |
|
469 | 469 | |
470 | 470 | // Data to send to the API. |
471 | 471 | $api_params = array( |
472 | 472 | 'edd_action' => 'activate_license', // never change from "edd_" to "give_"! |
473 | 473 | 'license' => $addon_license, |
474 | - 'item_name' => urlencode( $addon_name ), |
|
474 | + 'item_name' => urlencode($addon_name), |
|
475 | 475 | 'url' => home_url(), |
476 | 476 | ); |
477 | 477 | |
@@ -486,17 +486,17 @@ discard block |
||
486 | 486 | ); |
487 | 487 | |
488 | 488 | // Make sure there are no errors. |
489 | - if ( is_wp_error( $response ) ) { |
|
490 | - delete_option( $addon_license_option_name ); |
|
489 | + if (is_wp_error($response)) { |
|
490 | + delete_option($addon_license_option_name); |
|
491 | 491 | continue; |
492 | 492 | } |
493 | 493 | |
494 | 494 | // Tell WordPress to look for updates. |
495 | - set_site_transient( 'update_plugins', null ); |
|
495 | + set_site_transient('update_plugins', null); |
|
496 | 496 | |
497 | 497 | // Decode license data. |
498 | - $license_data = json_decode( wp_remote_retrieve_body( $response ) ); |
|
499 | - update_option( $addon_license_option_name, $license_data ); |
|
498 | + $license_data = json_decode(wp_remote_retrieve_body($response)); |
|
499 | + update_option($addon_license_option_name, $license_data); |
|
500 | 500 | }// End foreach(). |
501 | 501 | } |
502 | 502 | |
@@ -526,9 +526,9 @@ discard block |
||
526 | 526 | ); |
527 | 527 | |
528 | 528 | global $wp_roles; |
529 | - foreach ( $delete_caps as $cap ) { |
|
530 | - foreach ( array_keys( $wp_roles->roles ) as $role ) { |
|
531 | - $wp_roles->remove_cap( $role, $cap ); |
|
529 | + foreach ($delete_caps as $cap) { |
|
530 | + foreach (array_keys($wp_roles->roles) as $role) { |
|
531 | + $wp_roles->remove_cap($role, $cap); |
|
532 | 532 | } |
533 | 533 | } |
534 | 534 | |
@@ -562,7 +562,7 @@ discard block |
||
562 | 562 | function give_v18_upgrades_core_setting() { |
563 | 563 | // Core settings which changes from checkbox to radio. |
564 | 564 | $core_setting_names = array_merge( |
565 | - array_keys( give_v18_renamed_core_settings() ), |
|
565 | + array_keys(give_v18_renamed_core_settings()), |
|
566 | 566 | array( |
567 | 567 | 'uninstall_on_delete', |
568 | 568 | 'scripts_footer', |
@@ -574,48 +574,48 @@ discard block |
||
574 | 574 | ); |
575 | 575 | |
576 | 576 | // Bailout: If not any setting define. |
577 | - if ( $give_settings = get_option( 'give_settings' ) ) { |
|
577 | + if ($give_settings = get_option('give_settings')) { |
|
578 | 578 | |
579 | 579 | $setting_changed = false; |
580 | 580 | |
581 | 581 | // Loop: check each setting field. |
582 | - foreach ( $core_setting_names as $setting_name ) { |
|
582 | + foreach ($core_setting_names as $setting_name) { |
|
583 | 583 | // New setting name. |
584 | - $new_setting_name = preg_replace( '/^(enable_|disable_)/', '', $setting_name ); |
|
584 | + $new_setting_name = preg_replace('/^(enable_|disable_)/', '', $setting_name); |
|
585 | 585 | |
586 | 586 | // Continue: If setting already set. |
587 | 587 | if ( |
588 | - array_key_exists( $new_setting_name, $give_settings ) |
|
589 | - && in_array( $give_settings[ $new_setting_name ], array( 'enabled', 'disabled' ) ) |
|
588 | + array_key_exists($new_setting_name, $give_settings) |
|
589 | + && in_array($give_settings[$new_setting_name], array('enabled', 'disabled')) |
|
590 | 590 | ) { |
591 | 591 | continue; |
592 | 592 | } |
593 | 593 | |
594 | 594 | // Set checkbox value to radio value. |
595 | - $give_settings[ $setting_name ] = ( ! empty( $give_settings[ $setting_name ] ) && 'on' === $give_settings[ $setting_name ] ? 'enabled' : 'disabled' ); |
|
595 | + $give_settings[$setting_name] = ( ! empty($give_settings[$setting_name]) && 'on' === $give_settings[$setting_name] ? 'enabled' : 'disabled'); |
|
596 | 596 | |
597 | 597 | // @see https://github.com/WordImpress/Give/issues/1063. |
598 | - if ( false !== strpos( $setting_name, 'disable_' ) ) { |
|
598 | + if (false !== strpos($setting_name, 'disable_')) { |
|
599 | 599 | |
600 | - $give_settings[ $new_setting_name ] = ( give_is_setting_enabled( $give_settings[ $setting_name ] ) ? 'disabled' : 'enabled' ); |
|
601 | - } elseif ( false !== strpos( $setting_name, 'enable_' ) ) { |
|
600 | + $give_settings[$new_setting_name] = (give_is_setting_enabled($give_settings[$setting_name]) ? 'disabled' : 'enabled'); |
|
601 | + } elseif (false !== strpos($setting_name, 'enable_')) { |
|
602 | 602 | |
603 | - $give_settings[ $new_setting_name ] = ( give_is_setting_enabled( $give_settings[ $setting_name ] ) ? 'enabled' : 'disabled' ); |
|
603 | + $give_settings[$new_setting_name] = (give_is_setting_enabled($give_settings[$setting_name]) ? 'enabled' : 'disabled'); |
|
604 | 604 | } |
605 | 605 | |
606 | 606 | // Tell bot to update core setting to db. |
607 | - if ( ! $setting_changed ) { |
|
607 | + if ( ! $setting_changed) { |
|
608 | 608 | $setting_changed = true; |
609 | 609 | } |
610 | 610 | } |
611 | 611 | |
612 | 612 | // Update setting only if they changed. |
613 | - if ( $setting_changed ) { |
|
614 | - update_option( 'give_settings', $give_settings ); |
|
613 | + if ($setting_changed) { |
|
614 | + update_option('give_settings', $give_settings); |
|
615 | 615 | } |
616 | 616 | }// End if(). |
617 | 617 | |
618 | - give_set_upgrade_complete( 'v18_upgrades_core_setting' ); |
|
618 | + give_set_upgrade_complete('v18_upgrades_core_setting'); |
|
619 | 619 | } |
620 | 620 | |
621 | 621 | /** |
@@ -629,7 +629,7 @@ discard block |
||
629 | 629 | $give_updates = Give_Updates::get_instance(); |
630 | 630 | |
631 | 631 | // form query |
632 | - $forms = new WP_Query( array( |
|
632 | + $forms = new WP_Query(array( |
|
633 | 633 | 'paged' => $give_updates->step, |
634 | 634 | 'status' => 'any', |
635 | 635 | 'order' => 'ASC', |
@@ -638,41 +638,41 @@ discard block |
||
638 | 638 | ) |
639 | 639 | ); |
640 | 640 | |
641 | - if ( $forms->have_posts() ) { |
|
642 | - $give_updates->set_percentage( $forms->found_posts, ( $give_updates->step * 20 ) ); |
|
641 | + if ($forms->have_posts()) { |
|
642 | + $give_updates->set_percentage($forms->found_posts, ($give_updates->step * 20)); |
|
643 | 643 | |
644 | - while ( $forms->have_posts() ) { |
|
644 | + while ($forms->have_posts()) { |
|
645 | 645 | $forms->the_post(); |
646 | 646 | |
647 | 647 | // Form content. |
648 | 648 | // Note in version 1.8 display content setting split into display content and content placement setting. |
649 | 649 | // You can delete _give_content_option in future. |
650 | - $show_content = give_get_meta( get_the_ID(), '_give_content_option', true ); |
|
651 | - if ( $show_content && ! give_get_meta( get_the_ID(), '_give_display_content', true ) ) { |
|
652 | - $field_value = ( 'none' !== $show_content ? 'enabled' : 'disabled' ); |
|
653 | - give_update_meta( get_the_ID(), '_give_display_content', $field_value ); |
|
650 | + $show_content = give_get_meta(get_the_ID(), '_give_content_option', true); |
|
651 | + if ($show_content && ! give_get_meta(get_the_ID(), '_give_display_content', true)) { |
|
652 | + $field_value = ('none' !== $show_content ? 'enabled' : 'disabled'); |
|
653 | + give_update_meta(get_the_ID(), '_give_display_content', $field_value); |
|
654 | 654 | |
655 | - $field_value = ( 'none' !== $show_content ? $show_content : 'give_pre_form' ); |
|
656 | - give_update_meta( get_the_ID(), '_give_content_placement', $field_value ); |
|
655 | + $field_value = ('none' !== $show_content ? $show_content : 'give_pre_form'); |
|
656 | + give_update_meta(get_the_ID(), '_give_content_placement', $field_value); |
|
657 | 657 | } |
658 | 658 | |
659 | 659 | // "Disable" Guest Donation. Checkbox. |
660 | 660 | // See: https://github.com/WordImpress/Give/issues/1470. |
661 | - $guest_donation = give_get_meta( get_the_ID(), '_give_logged_in_only', true ); |
|
662 | - $guest_donation_newval = ( in_array( $guest_donation, array( 'yes', 'on' ) ) ? 'disabled' : 'enabled' ); |
|
663 | - give_update_meta( get_the_ID(), '_give_logged_in_only', $guest_donation_newval ); |
|
661 | + $guest_donation = give_get_meta(get_the_ID(), '_give_logged_in_only', true); |
|
662 | + $guest_donation_newval = (in_array($guest_donation, array('yes', 'on')) ? 'disabled' : 'enabled'); |
|
663 | + give_update_meta(get_the_ID(), '_give_logged_in_only', $guest_donation_newval); |
|
664 | 664 | |
665 | 665 | // Offline Donations. |
666 | 666 | // See: https://github.com/WordImpress/Give/issues/1579. |
667 | - $offline_donation = give_get_meta( get_the_ID(), '_give_customize_offline_donations', true ); |
|
668 | - if ( 'no' === $offline_donation ) { |
|
667 | + $offline_donation = give_get_meta(get_the_ID(), '_give_customize_offline_donations', true); |
|
668 | + if ('no' === $offline_donation) { |
|
669 | 669 | $offline_donation_newval = 'global'; |
670 | - } elseif ( 'yes' === $offline_donation ) { |
|
670 | + } elseif ('yes' === $offline_donation) { |
|
671 | 671 | $offline_donation_newval = 'enabled'; |
672 | 672 | } else { |
673 | 673 | $offline_donation_newval = 'disabled'; |
674 | 674 | } |
675 | - give_update_meta( get_the_ID(), '_give_customize_offline_donations', $offline_donation_newval ); |
|
675 | + give_update_meta(get_the_ID(), '_give_customize_offline_donations', $offline_donation_newval); |
|
676 | 676 | |
677 | 677 | // Convert yes/no setting field to enabled/disabled. |
678 | 678 | $form_radio_settings = array( |
@@ -692,15 +692,15 @@ discard block |
||
692 | 692 | '_give_offline_donation_enable_billing_fields_single', |
693 | 693 | ); |
694 | 694 | |
695 | - foreach ( $form_radio_settings as $meta_key ) { |
|
695 | + foreach ($form_radio_settings as $meta_key) { |
|
696 | 696 | // Get value. |
697 | - $field_value = give_get_meta( get_the_ID(), $meta_key, true ); |
|
697 | + $field_value = give_get_meta(get_the_ID(), $meta_key, true); |
|
698 | 698 | |
699 | 699 | // Convert meta value only if it is in yes/no/none. |
700 | - if ( in_array( $field_value, array( 'yes', 'on', 'no', 'none' ) ) ) { |
|
700 | + if (in_array($field_value, array('yes', 'on', 'no', 'none'))) { |
|
701 | 701 | |
702 | - $field_value = ( in_array( $field_value, array( 'yes', 'on' ) ) ? 'enabled' : 'disabled' ); |
|
703 | - give_update_meta( get_the_ID(), $meta_key, $field_value ); |
|
702 | + $field_value = (in_array($field_value, array('yes', 'on')) ? 'enabled' : 'disabled'); |
|
703 | + give_update_meta(get_the_ID(), $meta_key, $field_value); |
|
704 | 704 | } |
705 | 705 | } |
706 | 706 | }// End while(). |
@@ -709,7 +709,7 @@ discard block |
||
709 | 709 | |
710 | 710 | } else { |
711 | 711 | // No more forms found, finish up. |
712 | - give_set_upgrade_complete( 'v18_upgrades_form_metadata' ); |
|
712 | + give_set_upgrade_complete('v18_upgrades_form_metadata'); |
|
713 | 713 | } |
714 | 714 | } |
715 | 715 | |
@@ -776,7 +776,7 @@ discard block |
||
776 | 776 | '%_transient_give_stats_%', |
777 | 777 | 'give_cache%', |
778 | 778 | '%_transient_give_add_ons_feed%', |
779 | - '%_transient__give_ajax_works' . |
|
779 | + '%_transient__give_ajax_works'. |
|
780 | 780 | '%_transient_give_total_api_keys%', |
781 | 781 | '%_transient_give_i18n_give_promo_hide%', |
782 | 782 | '%_transient_give_contributors%', |
@@ -803,24 +803,24 @@ discard block |
||
803 | 803 | ARRAY_A |
804 | 804 | ); |
805 | 805 | |
806 | - if ( ! empty( $user_apikey_options ) ) { |
|
807 | - foreach ( $user_apikey_options as $user ) { |
|
808 | - $cached_options[] = '_transient_' . md5( 'give_api_user_' . $user['meta_key'] ); |
|
809 | - $cached_options[] = '_transient_' . md5( 'give_api_user_public_key' . $user['user_id'] ); |
|
810 | - $cached_options[] = '_transient_' . md5( 'give_api_user_secret_key' . $user['user_id'] ); |
|
806 | + if ( ! empty($user_apikey_options)) { |
|
807 | + foreach ($user_apikey_options as $user) { |
|
808 | + $cached_options[] = '_transient_'.md5('give_api_user_'.$user['meta_key']); |
|
809 | + $cached_options[] = '_transient_'.md5('give_api_user_public_key'.$user['user_id']); |
|
810 | + $cached_options[] = '_transient_'.md5('give_api_user_secret_key'.$user['user_id']); |
|
811 | 811 | } |
812 | 812 | } |
813 | 813 | |
814 | - if ( ! empty( $cached_options ) ) { |
|
815 | - foreach ( $cached_options as $option ) { |
|
816 | - switch ( true ) { |
|
817 | - case ( false !== strpos( $option, 'transient' ) ): |
|
818 | - $option = str_replace( '_transient_', '', $option ); |
|
819 | - delete_transient( $option ); |
|
814 | + if ( ! empty($cached_options)) { |
|
815 | + foreach ($cached_options as $option) { |
|
816 | + switch (true) { |
|
817 | + case (false !== strpos($option, 'transient')): |
|
818 | + $option = str_replace('_transient_', '', $option); |
|
819 | + delete_transient($option); |
|
820 | 820 | break; |
821 | 821 | |
822 | 822 | default: |
823 | - delete_option( $option ); |
|
823 | + delete_option($option); |
|
824 | 824 | } |
825 | 825 | } |
826 | 826 | } |
@@ -838,7 +838,7 @@ discard block |
||
838 | 838 | global $wp_roles; |
839 | 839 | |
840 | 840 | // Get the role object. |
841 | - $give_worker = get_role( 'give_worker' ); |
|
841 | + $give_worker = get_role('give_worker'); |
|
842 | 842 | |
843 | 843 | // A list of capabilities to add for give workers. |
844 | 844 | $caps_to_add = array( |
@@ -846,9 +846,9 @@ discard block |
||
846 | 846 | 'edit_pages', |
847 | 847 | ); |
848 | 848 | |
849 | - foreach ( $caps_to_add as $cap ) { |
|
849 | + foreach ($caps_to_add as $cap) { |
|
850 | 850 | // Add the capability. |
851 | - $give_worker->add_cap( $cap ); |
|
851 | + $give_worker->add_cap($cap); |
|
852 | 852 | } |
853 | 853 | |
854 | 854 | } |
@@ -865,7 +865,7 @@ discard block |
||
865 | 865 | $give_updates = Give_Updates::get_instance(); |
866 | 866 | |
867 | 867 | // form query. |
868 | - $donation_forms = new WP_Query( array( |
|
868 | + $donation_forms = new WP_Query(array( |
|
869 | 869 | 'paged' => $give_updates->step, |
870 | 870 | 'status' => 'any', |
871 | 871 | 'order' => 'ASC', |
@@ -874,10 +874,10 @@ discard block |
||
874 | 874 | ) |
875 | 875 | ); |
876 | 876 | |
877 | - if ( $donation_forms->have_posts() ) { |
|
878 | - $give_updates->set_percentage( $donation_forms->found_posts, ( $give_updates->step * 20 ) ); |
|
877 | + if ($donation_forms->have_posts()) { |
|
878 | + $give_updates->set_percentage($donation_forms->found_posts, ($give_updates->step * 20)); |
|
879 | 879 | |
880 | - while ( $donation_forms->have_posts() ) { |
|
880 | + while ($donation_forms->have_posts()) { |
|
881 | 881 | $donation_forms->the_post(); |
882 | 882 | $form_id = get_the_ID(); |
883 | 883 | |
@@ -885,41 +885,41 @@ discard block |
||
885 | 885 | update_post_meta( |
886 | 886 | $form_id, |
887 | 887 | '_give_set_price', |
888 | - give_sanitize_amount( get_post_meta( $form_id, '_give_set_price', true ) ) |
|
888 | + give_sanitize_amount(get_post_meta($form_id, '_give_set_price', true)) |
|
889 | 889 | ); |
890 | 890 | |
891 | 891 | // Remove formatting from _give_custom_amount_minimum. |
892 | 892 | update_post_meta( |
893 | 893 | $form_id, |
894 | 894 | '_give_custom_amount_minimum', |
895 | - give_sanitize_amount( get_post_meta( $form_id, '_give_custom_amount_minimum', true ) ) |
|
895 | + give_sanitize_amount(get_post_meta($form_id, '_give_custom_amount_minimum', true)) |
|
896 | 896 | ); |
897 | 897 | |
898 | 898 | // Bailout. |
899 | - if ( 'set' === get_post_meta( $form_id, '_give_price_option', true ) ) { |
|
899 | + if ('set' === get_post_meta($form_id, '_give_price_option', true)) { |
|
900 | 900 | continue; |
901 | 901 | } |
902 | 902 | |
903 | - $donation_levels = get_post_meta( $form_id, '_give_donation_levels', true ); |
|
903 | + $donation_levels = get_post_meta($form_id, '_give_donation_levels', true); |
|
904 | 904 | |
905 | - if ( ! empty( $donation_levels ) ) { |
|
905 | + if ( ! empty($donation_levels)) { |
|
906 | 906 | |
907 | - foreach ( $donation_levels as $index => $donation_level ) { |
|
908 | - if ( isset( $donation_level['_give_amount'] ) ) { |
|
909 | - $donation_levels[ $index ]['_give_amount'] = give_sanitize_amount( $donation_level['_give_amount'] ); |
|
907 | + foreach ($donation_levels as $index => $donation_level) { |
|
908 | + if (isset($donation_level['_give_amount'])) { |
|
909 | + $donation_levels[$index]['_give_amount'] = give_sanitize_amount($donation_level['_give_amount']); |
|
910 | 910 | } |
911 | 911 | } |
912 | 912 | |
913 | - update_post_meta( $form_id, '_give_donation_levels', $donation_levels ); |
|
913 | + update_post_meta($form_id, '_give_donation_levels', $donation_levels); |
|
914 | 914 | |
915 | - $donation_levels_amounts = wp_list_pluck( $donation_levels, '_give_amount' ); |
|
915 | + $donation_levels_amounts = wp_list_pluck($donation_levels, '_give_amount'); |
|
916 | 916 | |
917 | - $min_amount = min( $donation_levels_amounts ); |
|
918 | - $max_amount = max( $donation_levels_amounts ); |
|
917 | + $min_amount = min($donation_levels_amounts); |
|
918 | + $max_amount = max($donation_levels_amounts); |
|
919 | 919 | |
920 | 920 | // Set Minimum and Maximum amount for Multi Level Donation Forms |
921 | - give_update_meta( $form_id, '_give_levels_minimum_amount', $min_amount ? give_sanitize_amount( $min_amount ) : 0 ); |
|
922 | - give_update_meta( $form_id, '_give_levels_maximum_amount', $max_amount ? give_sanitize_amount( $max_amount ) : 0 ); |
|
921 | + give_update_meta($form_id, '_give_levels_minimum_amount', $min_amount ? give_sanitize_amount($min_amount) : 0); |
|
922 | + give_update_meta($form_id, '_give_levels_maximum_amount', $max_amount ? give_sanitize_amount($max_amount) : 0); |
|
923 | 923 | } |
924 | 924 | |
925 | 925 | } |
@@ -928,7 +928,7 @@ discard block |
||
928 | 928 | wp_reset_postdata(); |
929 | 929 | } else { |
930 | 930 | // The Update Ran. |
931 | - give_set_upgrade_complete( 'v189_upgrades_levels_post_meta' ); |
|
931 | + give_set_upgrade_complete('v189_upgrades_levels_post_meta'); |
|
932 | 932 | } |
933 | 933 | |
934 | 934 | } |
@@ -984,22 +984,22 @@ discard block |
||
984 | 984 | $give_settings = give_get_settings(); |
985 | 985 | $give_setting_updated = false; |
986 | 986 | |
987 | - if ( $give_settings['thousands_separator'] === $give_settings['decimal_separator'] ) { |
|
987 | + if ($give_settings['thousands_separator'] === $give_settings['decimal_separator']) { |
|
988 | 988 | $give_settings['number_decimals'] = 0; |
989 | 989 | $give_settings['decimal_separator'] = ''; |
990 | 990 | $give_setting_updated = true; |
991 | 991 | |
992 | - } elseif ( empty( $give_settings['decimal_separator'] ) ) { |
|
992 | + } elseif (empty($give_settings['decimal_separator'])) { |
|
993 | 993 | $give_settings['number_decimals'] = 0; |
994 | 994 | $give_setting_updated = true; |
995 | 995 | |
996 | - } elseif ( 6 < absint( $give_settings['number_decimals'] ) ) { |
|
996 | + } elseif (6 < absint($give_settings['number_decimals'])) { |
|
997 | 997 | $give_settings['number_decimals'] = 5; |
998 | 998 | $give_setting_updated = true; |
999 | 999 | } |
1000 | 1000 | |
1001 | - if ( $give_setting_updated ) { |
|
1002 | - update_option( 'give_settings', $give_settings ); |
|
1001 | + if ($give_setting_updated) { |
|
1002 | + update_option('give_settings', $give_settings); |
|
1003 | 1003 | } |
1004 | 1004 | } |
1005 | 1005 | |
@@ -1018,70 +1018,70 @@ discard block |
||
1018 | 1018 | $give_updates = Give_Updates::get_instance(); |
1019 | 1019 | |
1020 | 1020 | // form query. |
1021 | - $donation_forms = new WP_Query( array( |
|
1021 | + $donation_forms = new WP_Query(array( |
|
1022 | 1022 | 'paged' => $give_updates->step, |
1023 | 1023 | 'status' => 'any', |
1024 | 1024 | 'order' => 'ASC', |
1025 | - 'post_type' => array( 'give_forms', 'give_payment' ), |
|
1025 | + 'post_type' => array('give_forms', 'give_payment'), |
|
1026 | 1026 | 'posts_per_page' => 20, |
1027 | 1027 | ) |
1028 | 1028 | ); |
1029 | 1029 | |
1030 | - if ( $donation_forms->have_posts() ) { |
|
1031 | - $give_updates->set_percentage( $donation_forms->found_posts, ( $give_updates->step * 20 ) ); |
|
1030 | + if ($donation_forms->have_posts()) { |
|
1031 | + $give_updates->set_percentage($donation_forms->found_posts, ($give_updates->step * 20)); |
|
1032 | 1032 | |
1033 | - while ( $donation_forms->have_posts() ) { |
|
1033 | + while ($donation_forms->have_posts()) { |
|
1034 | 1034 | $donation_forms->the_post(); |
1035 | 1035 | global $post; |
1036 | 1036 | |
1037 | - $meta = get_post_meta( $post->ID ); |
|
1037 | + $meta = get_post_meta($post->ID); |
|
1038 | 1038 | |
1039 | - switch ( $post->post_type ) { |
|
1039 | + switch ($post->post_type) { |
|
1040 | 1040 | case 'give_forms': |
1041 | 1041 | // _give_set_price. |
1042 | - if ( ! empty( $meta['_give_set_price'][0] ) ) { |
|
1043 | - update_post_meta( $post->ID, '_give_set_price', give_sanitize_amount_for_db( $meta['_give_set_price'][0] ) ); |
|
1042 | + if ( ! empty($meta['_give_set_price'][0])) { |
|
1043 | + update_post_meta($post->ID, '_give_set_price', give_sanitize_amount_for_db($meta['_give_set_price'][0])); |
|
1044 | 1044 | } |
1045 | 1045 | |
1046 | 1046 | // _give_custom_amount_minimum. |
1047 | - if ( ! empty( $meta['_give_custom_amount_minimum'][0] ) ) { |
|
1048 | - update_post_meta( $post->ID, '_give_custom_amount_minimum', give_sanitize_amount_for_db( $meta['_give_custom_amount_minimum'][0] ) ); |
|
1047 | + if ( ! empty($meta['_give_custom_amount_minimum'][0])) { |
|
1048 | + update_post_meta($post->ID, '_give_custom_amount_minimum', give_sanitize_amount_for_db($meta['_give_custom_amount_minimum'][0])); |
|
1049 | 1049 | } |
1050 | 1050 | |
1051 | 1051 | // _give_levels_minimum_amount. |
1052 | - if ( ! empty( $meta['_give_levels_minimum_amount'][0] ) ) { |
|
1053 | - update_post_meta( $post->ID, '_give_levels_minimum_amount', give_sanitize_amount_for_db( $meta['_give_levels_minimum_amount'][0] ) ); |
|
1052 | + if ( ! empty($meta['_give_levels_minimum_amount'][0])) { |
|
1053 | + update_post_meta($post->ID, '_give_levels_minimum_amount', give_sanitize_amount_for_db($meta['_give_levels_minimum_amount'][0])); |
|
1054 | 1054 | } |
1055 | 1055 | |
1056 | 1056 | // _give_levels_maximum_amount. |
1057 | - if ( ! empty( $meta['_give_levels_maximum_amount'][0] ) ) { |
|
1058 | - update_post_meta( $post->ID, '_give_levels_maximum_amount', give_sanitize_amount_for_db( $meta['_give_levels_maximum_amount'][0] ) ); |
|
1057 | + if ( ! empty($meta['_give_levels_maximum_amount'][0])) { |
|
1058 | + update_post_meta($post->ID, '_give_levels_maximum_amount', give_sanitize_amount_for_db($meta['_give_levels_maximum_amount'][0])); |
|
1059 | 1059 | } |
1060 | 1060 | |
1061 | 1061 | // _give_set_goal. |
1062 | - if ( ! empty( $meta['_give_set_goal'][0] ) ) { |
|
1063 | - update_post_meta( $post->ID, '_give_set_goal', give_sanitize_amount_for_db( $meta['_give_set_goal'][0] ) ); |
|
1062 | + if ( ! empty($meta['_give_set_goal'][0])) { |
|
1063 | + update_post_meta($post->ID, '_give_set_goal', give_sanitize_amount_for_db($meta['_give_set_goal'][0])); |
|
1064 | 1064 | } |
1065 | 1065 | |
1066 | 1066 | // _give_form_earnings. |
1067 | - if ( ! empty( $meta['_give_form_earnings'][0] ) ) { |
|
1068 | - update_post_meta( $post->ID, '_give_form_earnings', give_sanitize_amount_for_db( $meta['_give_form_earnings'][0] ) ); |
|
1067 | + if ( ! empty($meta['_give_form_earnings'][0])) { |
|
1068 | + update_post_meta($post->ID, '_give_form_earnings', give_sanitize_amount_for_db($meta['_give_form_earnings'][0])); |
|
1069 | 1069 | } |
1070 | 1070 | |
1071 | 1071 | // _give_custom_amount_minimum. |
1072 | - if ( ! empty( $meta['_give_donation_levels'][0] ) ) { |
|
1073 | - $donation_levels = unserialize( $meta['_give_donation_levels'][0] ); |
|
1072 | + if ( ! empty($meta['_give_donation_levels'][0])) { |
|
1073 | + $donation_levels = unserialize($meta['_give_donation_levels'][0]); |
|
1074 | 1074 | |
1075 | - foreach ( $donation_levels as $index => $level ) { |
|
1076 | - if ( empty( $level['_give_amount'] ) ) { |
|
1075 | + foreach ($donation_levels as $index => $level) { |
|
1076 | + if (empty($level['_give_amount'])) { |
|
1077 | 1077 | continue; |
1078 | 1078 | } |
1079 | 1079 | |
1080 | - $donation_levels[ $index ]['_give_amount'] = give_sanitize_amount_for_db( $level['_give_amount'] ); |
|
1080 | + $donation_levels[$index]['_give_amount'] = give_sanitize_amount_for_db($level['_give_amount']); |
|
1081 | 1081 | } |
1082 | 1082 | |
1083 | 1083 | $meta['_give_donation_levels'] = $donation_levels; |
1084 | - update_post_meta( $post->ID, '_give_donation_levels', $meta['_give_donation_levels'] ); |
|
1084 | + update_post_meta($post->ID, '_give_donation_levels', $meta['_give_donation_levels']); |
|
1085 | 1085 | } |
1086 | 1086 | |
1087 | 1087 | |
@@ -1089,8 +1089,8 @@ discard block |
||
1089 | 1089 | |
1090 | 1090 | case 'give_payment': |
1091 | 1091 | // _give_payment_total. |
1092 | - if ( ! empty( $meta['_give_payment_total'][0] ) ) { |
|
1093 | - update_post_meta( $post->ID, '_give_payment_total', give_sanitize_amount_for_db( $meta['_give_payment_total'][0] ) ); |
|
1092 | + if ( ! empty($meta['_give_payment_total'][0])) { |
|
1093 | + update_post_meta($post->ID, '_give_payment_total', give_sanitize_amount_for_db($meta['_give_payment_total'][0])); |
|
1094 | 1094 | } |
1095 | 1095 | |
1096 | 1096 | break; |
@@ -1101,7 +1101,7 @@ discard block |
||
1101 | 1101 | wp_reset_postdata(); |
1102 | 1102 | } else { |
1103 | 1103 | // The Update Ran. |
1104 | - give_set_upgrade_complete( 'v1812_update_amount_values' ); |
|
1104 | + give_set_upgrade_complete('v1812_update_amount_values'); |
|
1105 | 1105 | } |
1106 | 1106 | } |
1107 | 1107 | |
@@ -1121,22 +1121,22 @@ discard block |
||
1121 | 1121 | $offset = 1 === $give_updates->step ? 0 : $give_updates->step * 20; |
1122 | 1122 | |
1123 | 1123 | // form query. |
1124 | - $donors = Give()->donors->get_donors( array( |
|
1124 | + $donors = Give()->donors->get_donors(array( |
|
1125 | 1125 | 'number' => 20, |
1126 | 1126 | 'offset' => $offset, |
1127 | 1127 | ) |
1128 | 1128 | ); |
1129 | 1129 | |
1130 | - if ( ! empty( $donors ) ) { |
|
1131 | - $give_updates->set_percentage( Give()->donors->count(), ( $give_updates->step * 20 ) ); |
|
1130 | + if ( ! empty($donors)) { |
|
1131 | + $give_updates->set_percentage(Give()->donors->count(), ($give_updates->step * 20)); |
|
1132 | 1132 | |
1133 | 1133 | /* @var Object $donor */ |
1134 | - foreach ( $donors as $donor ) { |
|
1135 | - Give()->donors->update( $donor->id, array( 'purchase_value' => give_sanitize_amount_for_db( $donor->purchase_value ) ) ); |
|
1134 | + foreach ($donors as $donor) { |
|
1135 | + Give()->donors->update($donor->id, array('purchase_value' => give_sanitize_amount_for_db($donor->purchase_value))); |
|
1136 | 1136 | } |
1137 | 1137 | } else { |
1138 | 1138 | // The Update Ran. |
1139 | - give_set_upgrade_complete( 'v1812_update_donor_purchase_values' ); |
|
1139 | + give_set_upgrade_complete('v1812_update_donor_purchase_values'); |
|
1140 | 1140 | } |
1141 | 1141 | } |
1142 | 1142 | |
@@ -1151,25 +1151,25 @@ discard block |
||
1151 | 1151 | $offset = 1 === $give_updates->step ? 0 : $give_updates->step * 20; |
1152 | 1152 | |
1153 | 1153 | // Fetch all the existing donors. |
1154 | - $donors = Give()->donors->get_donors( array( |
|
1154 | + $donors = Give()->donors->get_donors(array( |
|
1155 | 1155 | 'number' => 20, |
1156 | 1156 | 'offset' => $offset, |
1157 | 1157 | ) |
1158 | 1158 | ); |
1159 | 1159 | |
1160 | - if ( ! empty( $donors ) ) { |
|
1161 | - $give_updates->set_percentage( Give()->donors->count(), ( $give_updates->step * 20 ) ); |
|
1160 | + if ( ! empty($donors)) { |
|
1161 | + $give_updates->set_percentage(Give()->donors->count(), ($give_updates->step * 20)); |
|
1162 | 1162 | |
1163 | 1163 | /* @var Object $donor */ |
1164 | - foreach ( $donors as $donor ) { |
|
1164 | + foreach ($donors as $donor) { |
|
1165 | 1165 | $user_id = $donor->user_id; |
1166 | 1166 | |
1167 | 1167 | // Proceed, if donor is attached with user. |
1168 | - if ( $user_id ) { |
|
1169 | - $user = get_userdata( $user_id ); |
|
1168 | + if ($user_id) { |
|
1169 | + $user = get_userdata($user_id); |
|
1170 | 1170 | |
1171 | 1171 | // Update user role, if user has subscriber role. |
1172 | - if ( is_array( $user->roles ) && in_array( 'subscriber', $user->roles ) ) { |
|
1172 | + if (is_array($user->roles) && in_array('subscriber', $user->roles)) { |
|
1173 | 1173 | wp_update_user( |
1174 | 1174 | array( |
1175 | 1175 | 'ID' => $user_id, |
@@ -1181,7 +1181,7 @@ discard block |
||
1181 | 1181 | } |
1182 | 1182 | } else { |
1183 | 1183 | // The Update Ran. |
1184 | - give_set_upgrade_complete( 'v1813_update_donor_user_roles' ); |
|
1184 | + give_set_upgrade_complete('v1813_update_donor_user_roles'); |
|
1185 | 1185 | } |
1186 | 1186 | } |
1187 | 1187 | |
@@ -1195,33 +1195,33 @@ discard block |
||
1195 | 1195 | $give_updates = Give_Updates::get_instance(); |
1196 | 1196 | |
1197 | 1197 | // form query. |
1198 | - $payments = new WP_Query( array( |
|
1198 | + $payments = new WP_Query(array( |
|
1199 | 1199 | 'paged' => $give_updates->step, |
1200 | 1200 | 'status' => 'any', |
1201 | 1201 | 'order' => 'ASC', |
1202 | - 'post_type' => array( 'give_payment' ), |
|
1202 | + 'post_type' => array('give_payment'), |
|
1203 | 1203 | 'posts_per_page' => 20, |
1204 | 1204 | ) |
1205 | 1205 | ); |
1206 | 1206 | |
1207 | - if ( $payments->have_posts() ) { |
|
1208 | - $give_updates->set_percentage( $payments->found_posts, ( $give_updates->step * 20 ) ); |
|
1207 | + if ($payments->have_posts()) { |
|
1208 | + $give_updates->set_percentage($payments->found_posts, ($give_updates->step * 20)); |
|
1209 | 1209 | |
1210 | - while( $payments->have_posts() ) { |
|
1210 | + while ($payments->have_posts()) { |
|
1211 | 1211 | $payments->the_post(); |
1212 | 1212 | |
1213 | - $payment_meta = give_get_payment_meta( get_the_ID() ); |
|
1213 | + $payment_meta = give_get_payment_meta(get_the_ID()); |
|
1214 | 1214 | |
1215 | - if ( 'RIAL' === $payment_meta['currency'] ) { |
|
1215 | + if ('RIAL' === $payment_meta['currency']) { |
|
1216 | 1216 | $payment_meta['currency'] = 'IRR'; |
1217 | - give_update_meta( get_the_ID(), '_give_payment_meta', $payment_meta ); |
|
1217 | + give_update_meta(get_the_ID(), '_give_payment_meta', $payment_meta); |
|
1218 | 1218 | } |
1219 | 1219 | |
1220 | 1220 | } |
1221 | 1221 | |
1222 | - }else{ |
|
1222 | + } else { |
|
1223 | 1223 | // The Update Ran. |
1224 | - give_set_upgrade_complete( 'v1817_update_donation_iranian_currency_code' ); |
|
1224 | + give_set_upgrade_complete('v1817_update_donation_iranian_currency_code'); |
|
1225 | 1225 | } |
1226 | 1226 | } |
1227 | 1227 | |
@@ -1232,7 +1232,7 @@ discard block |
||
1232 | 1232 | */ |
1233 | 1233 | function give_v1813_upgrades() { |
1234 | 1234 | // Update admin setting. |
1235 | - give_update_option( 'donor_default_user_role', 'give_donor' ); |
|
1235 | + give_update_option('donor_default_user_role', 'give_donor'); |
|
1236 | 1236 | |
1237 | 1237 | // Update Give roles. |
1238 | 1238 | $roles = new Give_Roles(); |
@@ -1249,9 +1249,9 @@ discard block |
||
1249 | 1249 | function give_v1817_upgrades() { |
1250 | 1250 | $give_settings = give_get_settings(); |
1251 | 1251 | |
1252 | - if ( 'RIAL' === $give_settings['currency'] ) { |
|
1252 | + if ('RIAL' === $give_settings['currency']) { |
|
1253 | 1253 | $give_settings['currency'] = 'IRR'; |
1254 | - update_option( 'give_settings', $give_settings ); |
|
1254 | + update_option('give_settings', $give_settings); |
|
1255 | 1255 | } |
1256 | 1256 | } |
1257 | 1257 | |
@@ -1264,7 +1264,7 @@ discard block |
||
1264 | 1264 | |
1265 | 1265 | global $wp_roles; |
1266 | 1266 | |
1267 | - if( ! ( $wp_roles instanceof WP_Roles ) ) { |
|
1267 | + if ( ! ($wp_roles instanceof WP_Roles)) { |
|
1268 | 1268 | return; |
1269 | 1269 | } |
1270 | 1270 | |
@@ -1288,15 +1288,15 @@ discard block |
||
1288 | 1288 | ), |
1289 | 1289 | ); |
1290 | 1290 | |
1291 | - foreach ( $add_caps as $role => $caps ) { |
|
1292 | - foreach( $caps as $cap ) { |
|
1293 | - $wp_roles->add_cap( $role, $cap ); |
|
1291 | + foreach ($add_caps as $role => $caps) { |
|
1292 | + foreach ($caps as $cap) { |
|
1293 | + $wp_roles->add_cap($role, $cap); |
|
1294 | 1294 | } |
1295 | 1295 | } |
1296 | 1296 | |
1297 | - foreach ( $remove_caps as $role => $caps ) { |
|
1298 | - foreach( $caps as $cap ) { |
|
1299 | - $wp_roles->remove_cap( $role, $cap ); |
|
1297 | + foreach ($remove_caps as $role => $caps) { |
|
1298 | + foreach ($caps as $cap) { |
|
1299 | + $wp_roles->remove_cap($role, $cap); |
|
1300 | 1300 | } |
1301 | 1301 | } |
1302 | 1302 | |
@@ -1322,7 +1322,7 @@ discard block |
||
1322 | 1322 | $roles->add_roles(); |
1323 | 1323 | $roles->add_caps(); |
1324 | 1324 | |
1325 | - give_set_upgrade_complete( 'v1817_cleanup_user_roles' ); |
|
1325 | + give_set_upgrade_complete('v1817_cleanup_user_roles'); |
|
1326 | 1326 | |
1327 | 1327 | } |
1328 | 1328 | |
@@ -1334,7 +1334,7 @@ discard block |
||
1334 | 1334 | function give_v1818_upgrades() { |
1335 | 1335 | |
1336 | 1336 | // Remove email_access_installed from give_settings. |
1337 | - give_delete_option( 'email_access_installed' ); |
|
1337 | + give_delete_option('email_access_installed'); |
|
1338 | 1338 | } |
1339 | 1339 | |
1340 | 1340 | /** |
@@ -1345,25 +1345,25 @@ discard block |
||
1345 | 1345 | function give_v1818_assign_custom_amount_set_donation() { |
1346 | 1346 | |
1347 | 1347 | /* @var Give_Updates $give_updates */ |
1348 | - $give_updates = Give_Updates::get_instance(); |
|
1348 | + $give_updates = Give_Updates::get_instance(); |
|
1349 | 1349 | |
1350 | - $donations = new WP_Query( array( |
|
1350 | + $donations = new WP_Query(array( |
|
1351 | 1351 | 'paged' => $give_updates->step, |
1352 | 1352 | 'status' => 'any', |
1353 | 1353 | 'order' => 'ASC', |
1354 | - 'post_type' => array( 'give_payment' ), |
|
1354 | + 'post_type' => array('give_payment'), |
|
1355 | 1355 | 'posts_per_page' => 100, |
1356 | 1356 | ) |
1357 | 1357 | ); |
1358 | 1358 | |
1359 | - if ( $donations->have_posts() ) { |
|
1360 | - $give_updates->set_percentage( $donations->found_posts, $give_updates->step * 20 ); |
|
1359 | + if ($donations->have_posts()) { |
|
1360 | + $give_updates->set_percentage($donations->found_posts, $give_updates->step * 20); |
|
1361 | 1361 | |
1362 | - while ( $donations->have_posts() ) { |
|
1362 | + while ($donations->have_posts()) { |
|
1363 | 1363 | $donations->the_post(); |
1364 | 1364 | |
1365 | - $form = new Give_Donate_Form( give_get_meta( get_the_ID(), '_give_payment_form_id', true ) ); |
|
1366 | - $donation_meta = give_get_payment_meta( get_the_ID() ); |
|
1365 | + $form = new Give_Donate_Form(give_get_meta(get_the_ID(), '_give_payment_form_id', true)); |
|
1366 | + $donation_meta = give_get_payment_meta(get_the_ID()); |
|
1367 | 1367 | |
1368 | 1368 | // Update Donation meta with price_id set as custom, only if it is: |
1369 | 1369 | // 1. Donation Type = Set Donation. |
@@ -1372,19 +1372,19 @@ discard block |
||
1372 | 1372 | if ( |
1373 | 1373 | $form->ID && |
1374 | 1374 | $form->is_set_type_donation_form() && |
1375 | - ( 'custom' !== $donation_meta['price_id'] ) && |
|
1376 | - $form->is_custom_price( give_get_meta( get_the_ID(), '_give_payment_total', true ) ) |
|
1375 | + ('custom' !== $donation_meta['price_id']) && |
|
1376 | + $form->is_custom_price(give_get_meta(get_the_ID(), '_give_payment_total', true)) |
|
1377 | 1377 | ) { |
1378 | 1378 | $donation_meta['price_id'] = 'custom'; |
1379 | - give_update_meta( get_the_ID(), '_give_payment_meta', $donation_meta ); |
|
1380 | - give_update_meta( get_the_ID(), '_give_payment_price_id', 'custom' ); |
|
1379 | + give_update_meta(get_the_ID(), '_give_payment_meta', $donation_meta); |
|
1380 | + give_update_meta(get_the_ID(), '_give_payment_price_id', 'custom'); |
|
1381 | 1381 | } |
1382 | 1382 | } |
1383 | 1383 | |
1384 | 1384 | wp_reset_postdata(); |
1385 | 1385 | } else { |
1386 | 1386 | // Update Ran Successfully. |
1387 | - give_set_upgrade_complete( 'v1818_assign_custom_amount_set_donation' ); |
|
1387 | + give_set_upgrade_complete('v1818_assign_custom_amount_set_donation'); |
|
1388 | 1388 | } |
1389 | 1389 | |
1390 | 1390 | } |
@@ -1397,14 +1397,14 @@ discard block |
||
1397 | 1397 | * |
1398 | 1398 | * @since 1.8.18 |
1399 | 1399 | */ |
1400 | -function give_v1818_give_worker_role_cleanup(){ |
|
1400 | +function give_v1818_give_worker_role_cleanup() { |
|
1401 | 1401 | |
1402 | 1402 | /* @var Give_Updates $give_updates */ |
1403 | 1403 | $give_updates = Give_Updates::get_instance(); |
1404 | 1404 | |
1405 | 1405 | global $wp_roles; |
1406 | 1406 | |
1407 | - if( ! ( $wp_roles instanceof WP_Roles ) ) { |
|
1407 | + if ( ! ($wp_roles instanceof WP_Roles)) { |
|
1408 | 1408 | return; |
1409 | 1409 | } |
1410 | 1410 | |
@@ -1422,9 +1422,9 @@ discard block |
||
1422 | 1422 | ), |
1423 | 1423 | ); |
1424 | 1424 | |
1425 | - foreach ( $remove_caps as $role => $caps ) { |
|
1426 | - foreach( $caps as $cap ) { |
|
1427 | - $wp_roles->remove_cap( $role, $cap ); |
|
1425 | + foreach ($remove_caps as $role => $caps) { |
|
1426 | + foreach ($caps as $cap) { |
|
1427 | + $wp_roles->remove_cap($role, $cap); |
|
1428 | 1428 | } |
1429 | 1429 | } |
1430 | 1430 | |
@@ -1435,6 +1435,6 @@ discard block |
||
1435 | 1435 | $roles->add_roles(); |
1436 | 1436 | $roles->add_caps(); |
1437 | 1437 | |
1438 | - give_set_upgrade_complete( 'v1818_give_worker_role_cleanup' ); |
|
1438 | + give_set_upgrade_complete('v1818_give_worker_role_cleanup'); |
|
1439 | 1439 | |
1440 | 1440 | } |
1441 | 1441 | \ No newline at end of file |