@@ -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. |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | * @return static |
78 | 78 | */ |
79 | 79 | public static function get_instance() { |
80 | - if ( null === static::$instance ) { |
|
80 | + if (null === static::$instance) { |
|
81 | 81 | self::$instance = new static(); |
82 | 82 | } |
83 | 83 | |
@@ -104,26 +104,26 @@ discard block |
||
104 | 104 | * @return void |
105 | 105 | */ |
106 | 106 | private function setup_hooks() { |
107 | - if ( ! $this->is_donations_import_page() ) { |
|
107 | + if ( ! $this->is_donations_import_page()) { |
|
108 | 108 | return; |
109 | 109 | } |
110 | 110 | |
111 | 111 | // Do not render main import tools page. |
112 | - remove_action( 'give_admin_field_tools_import', array( 'Give_Settings_Import', 'render_import_field', ) ); |
|
112 | + remove_action('give_admin_field_tools_import', array('Give_Settings_Import', 'render_import_field',)); |
|
113 | 113 | |
114 | 114 | // Render donation import page |
115 | - add_action( 'give_admin_field_tools_import', array( $this, 'render_page' ) ); |
|
115 | + add_action('give_admin_field_tools_import', array($this, 'render_page')); |
|
116 | 116 | |
117 | 117 | // Print the HTML. |
118 | - add_action( 'give_tools_import_core_settings_form_start', array( $this, 'html' ), 10 ); |
|
118 | + add_action('give_tools_import_core_settings_form_start', array($this, 'html'), 10); |
|
119 | 119 | |
120 | 120 | // Run when form submit. |
121 | - add_action( 'give-tools_save_import', array( $this, 'save' ) ); |
|
121 | + add_action('give-tools_save_import', array($this, 'save')); |
|
122 | 122 | |
123 | - add_action( 'give-tools_update_notices', array( $this, 'update_notices' ), 11, 1 ); |
|
123 | + add_action('give-tools_update_notices', array($this, 'update_notices'), 11, 1); |
|
124 | 124 | |
125 | 125 | // Used to add submit button. |
126 | - add_action( 'give_tools_import_core_settings_form_end', array( $this, 'submit' ), 10 ); |
|
126 | + add_action('give_tools_import_core_settings_form_end', array($this, 'submit'), 10); |
|
127 | 127 | } |
128 | 128 | |
129 | 129 | /** |
@@ -135,9 +135,9 @@ discard block |
||
135 | 135 | * |
136 | 136 | * @return mixed |
137 | 137 | */ |
138 | - public function update_notices( $messages ) { |
|
139 | - if ( ! empty( $_GET['tab'] ) && 'import' === give_clean( $_GET['tab'] ) ) { |
|
140 | - unset( $messages['give-setting-updated'] ); |
|
138 | + public function update_notices($messages) { |
|
139 | + if ( ! empty($_GET['tab']) && 'import' === give_clean($_GET['tab'])) { |
|
140 | + unset($messages['give-setting-updated']); |
|
141 | 141 | } |
142 | 142 | |
143 | 143 | return $messages; |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | * @since 1.8.17 |
150 | 150 | */ |
151 | 151 | public function submit() { |
152 | - wp_nonce_field( 'give-save-settings', '_give-save-settings' ); |
|
152 | + wp_nonce_field('give-save-settings', '_give-save-settings'); |
|
153 | 153 | ?> |
154 | 154 | <input type="hidden" class="import-step" id="import-step" name="step" value="<?php echo $this->get_step(); ?>"/> |
155 | 155 | <input type="hidden" class="importer-type" value="<?php echo $this->importer_type; ?>"/> |
@@ -169,11 +169,11 @@ discard block |
||
169 | 169 | ?> |
170 | 170 | <section> |
171 | 171 | <table |
172 | - class="widefat export-options-table give-table <?php echo "step-{$step}"; ?> <?php echo( 1 === $step && ! empty( $this->is_json_valid ) ? 'give-hidden' : '' ); ?> " |
|
172 | + class="widefat export-options-table give-table <?php echo "step-{$step}"; ?> <?php echo(1 === $step && ! empty($this->is_json_valid) ? 'give-hidden' : ''); ?> " |
|
173 | 173 | id="<?php echo "step-{$step}"; ?>"> |
174 | 174 | <tbody> |
175 | 175 | <?php |
176 | - switch ( $step ) { |
|
176 | + switch ($step) { |
|
177 | 177 | case 1: |
178 | 178 | $this->render_upload_html(); |
179 | 179 | break; |
@@ -200,14 +200,14 @@ discard block |
||
200 | 200 | public function import_success() { |
201 | 201 | // Imported successfully |
202 | 202 | |
203 | - $success = (bool) ( isset( $_GET['success'] ) ? give_clean( $_GET['success'] ) : false ); |
|
204 | - $undo = (bool) ( isset( $_GET['undo'] ) ? give_clean( $_GET['undo'] ) : false ); |
|
203 | + $success = (bool) (isset($_GET['success']) ? give_clean($_GET['success']) : false); |
|
204 | + $undo = (bool) (isset($_GET['undo']) ? give_clean($_GET['undo']) : false); |
|
205 | 205 | $query_arg_setting = array( |
206 | 206 | 'post_type' => 'give_forms', |
207 | 207 | 'page' => 'give-settings', |
208 | 208 | ); |
209 | 209 | |
210 | - if ( $undo ) { |
|
210 | + if ($undo) { |
|
211 | 211 | $success = false; |
212 | 212 | } |
213 | 213 | |
@@ -220,30 +220,30 @@ discard block |
||
220 | 220 | 'undo' => 'true', |
221 | 221 | ); |
222 | 222 | |
223 | - $title = __( 'Settings Importing Completed!', 'give' ); |
|
224 | - if ( $success ) { |
|
223 | + $title = __('Settings Importing Completed!', 'give'); |
|
224 | + if ($success) { |
|
225 | 225 | $query_arg_success['undo'] = '1'; |
226 | 226 | $query_arg_success['step'] = '3'; |
227 | 227 | $query_arg_success['success'] = '1'; |
228 | - $text = __( 'Undo Importing', 'give' ); |
|
228 | + $text = __('Undo Importing', 'give'); |
|
229 | 229 | } else { |
230 | - if ( $undo ) { |
|
231 | - $host_give_options = get_option( 'give_settings_old', array() ); |
|
232 | - update_option( 'give_settings', $host_give_options ); |
|
233 | - $title = __( 'Undo of Setting Imported Completed!', 'give' ); |
|
230 | + if ($undo) { |
|
231 | + $host_give_options = get_option('give_settings_old', array()); |
|
232 | + update_option('give_settings', $host_give_options); |
|
233 | + $title = __('Undo of Setting Imported Completed!', 'give'); |
|
234 | 234 | } else { |
235 | - $title = __( 'Failed to import', 'give' ); |
|
235 | + $title = __('Failed to import', 'give'); |
|
236 | 236 | } |
237 | 237 | |
238 | - $text = __( 'Importing Again', 'give' ); |
|
238 | + $text = __('Importing Again', 'give'); |
|
239 | 239 | } |
240 | 240 | ?> |
241 | 241 | <tr valign="top" class="give-import-dropdown"> |
242 | 242 | <th colspan="2"> |
243 | 243 | <h2><?php echo $title; ?></h2> |
244 | 244 | <p> |
245 | - <a class="button button-large button-secondary" href="<?php echo add_query_arg( $query_arg_success, admin_url( 'edit.php' ) ); ?>"><?php echo $text; ?></a> |
|
246 | - <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> |
|
245 | + <a class="button button-large button-secondary" href="<?php echo add_query_arg($query_arg_success, admin_url('edit.php')); ?>"><?php echo $text; ?></a> |
|
246 | + <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> |
|
247 | 247 | </p> |
248 | 248 | </th> |
249 | 249 | </tr> |
@@ -256,14 +256,14 @@ discard block |
||
256 | 256 | * @since 1.8.17 |
257 | 257 | */ |
258 | 258 | public function start_import() { |
259 | - $type = ( ! empty( $_GET['type'] ) ? give_clean( $_GET['type'] ) : 'replace' ); |
|
260 | - $file_name = ( ! empty( $_GET['file_name'] ) ? give_clean( $_GET['file_name'] ) : '' ); |
|
259 | + $type = ( ! empty($_GET['type']) ? give_clean($_GET['type']) : 'replace'); |
|
260 | + $file_name = ( ! empty($_GET['file_name']) ? give_clean($_GET['file_name']) : ''); |
|
261 | 261 | |
262 | 262 | ?> |
263 | 263 | <tr valign="top" class="give-import-dropdown"> |
264 | 264 | <th colspan="2"> |
265 | - <h2 id="give-import-title"><?php esc_html_e( 'Importing', 'give' ) ?></h2> |
|
266 | - <p class="give-field-description"><?php esc_html_e( 'Your settings are now being imported...', 'give' ) ?></p> |
|
265 | + <h2 id="give-import-title"><?php esc_html_e('Importing', 'give') ?></h2> |
|
266 | + <p class="give-field-description"><?php esc_html_e('Your settings are now being imported...', 'give') ?></p> |
|
267 | 267 | </th> |
268 | 268 | </tr> |
269 | 269 | |
@@ -290,14 +290,14 @@ discard block |
||
290 | 290 | $step = $this->get_step(); |
291 | 291 | ?> |
292 | 292 | <ol class="give-progress-steps"> |
293 | - <li class="<?php echo( 1 === $step ? 'active' : '' ); ?>"> |
|
294 | - <?php esc_html_e( 'Upload JSON file', 'give' ); ?> |
|
293 | + <li class="<?php echo(1 === $step ? 'active' : ''); ?>"> |
|
294 | + <?php esc_html_e('Upload JSON file', 'give'); ?> |
|
295 | 295 | </li> |
296 | - <li class="<?php echo( 2 === $step ? 'active' : '' ); ?>"> |
|
297 | - <?php esc_html_e( 'Import', 'give' ); ?> |
|
296 | + <li class="<?php echo(2 === $step ? 'active' : ''); ?>"> |
|
297 | + <?php esc_html_e('Import', 'give'); ?> |
|
298 | 298 | </li> |
299 | - <li class="<?php echo( 3 === $step ? 'active' : '' ); ?>"> |
|
300 | - <?php esc_html_e( 'Done!', 'give' ); ?> |
|
299 | + <li class="<?php echo(3 === $step ? 'active' : ''); ?>"> |
|
300 | + <?php esc_html_e('Done!', 'give'); ?> |
|
301 | 301 | </li> |
302 | 302 | </ol> |
303 | 303 | <?php |
@@ -311,14 +311,14 @@ discard block |
||
311 | 311 | * @return int $step on which step doest the import is on. |
312 | 312 | */ |
313 | 313 | public function get_step() { |
314 | - $step = (int) ( isset( $_REQUEST['step'] ) ? give_clean( $_REQUEST['step'] ) : 0 ); |
|
314 | + $step = (int) (isset($_REQUEST['step']) ? give_clean($_REQUEST['step']) : 0); |
|
315 | 315 | $on_step = 1; |
316 | 316 | |
317 | - if ( empty( $step ) || 1 === $step ) { |
|
317 | + if (empty($step) || 1 === $step) { |
|
318 | 318 | $on_step = 1; |
319 | - } elseif ( 2 === $step ) { |
|
319 | + } elseif (2 === $step) { |
|
320 | 320 | $on_step = 2; |
321 | - } elseif ( 3 === $step ) { |
|
321 | + } elseif (3 === $step) { |
|
322 | 322 | $on_step = 3; |
323 | 323 | } |
324 | 324 | |
@@ -331,7 +331,7 @@ discard block |
||
331 | 331 | * @since 1.8.17 |
332 | 332 | */ |
333 | 333 | public function render_page() { |
334 | - include_once GIVE_PLUGIN_DIR . 'includes/admin/tools/views/html-admin-page-import-core-settings.php'; |
|
334 | + include_once GIVE_PLUGIN_DIR.'includes/admin/tools/views/html-admin-page-import-core-settings.php'; |
|
335 | 335 | } |
336 | 336 | |
337 | 337 | /** |
@@ -343,28 +343,28 @@ discard block |
||
343 | 343 | * @return void |
344 | 344 | */ |
345 | 345 | public function render_upload_html() { |
346 | - $json = ( isset( $_POST['json'] ) ? give_clean( $_POST['json'] ) : '' ); |
|
347 | - $type = ( isset( $_POST['type'] ) ? give_clean( $_POST['type'] ) : 'merge' ); |
|
346 | + $json = (isset($_POST['json']) ? give_clean($_POST['json']) : ''); |
|
347 | + $type = (isset($_POST['type']) ? give_clean($_POST['type']) : 'merge'); |
|
348 | 348 | $step = $this->get_step(); |
349 | 349 | |
350 | 350 | ?> |
351 | 351 | <tr valign="top"> |
352 | 352 | <th colspan="2"> |
353 | - <h2 id="give-import-title"><?php esc_html_e( 'Import Core Settings from a JSON file', 'give' ) ?></h2> |
|
354 | - <p class="give-field-description"><?php esc_html_e( 'This tool allows you to import Give settings from another Give installation. Settings imported contain data from Give core as well as any of our Premium Add-ons.', 'give' ) ?></p> |
|
353 | + <h2 id="give-import-title"><?php esc_html_e('Import Core Settings from a JSON file', 'give') ?></h2> |
|
354 | + <p class="give-field-description"><?php esc_html_e('This tool allows you to import Give settings from another Give installation. Settings imported contain data from Give core as well as any of our Premium Add-ons.', 'give') ?></p> |
|
355 | 355 | </th> |
356 | 356 | </tr> |
357 | 357 | |
358 | 358 | <tr valign="top"> |
359 | 359 | <th scope="row" class="titledesc"> |
360 | - <label for="json"><?php esc_html_e( 'Choose a JSON file:', 'give' ) ?></label> |
|
360 | + <label for="json"><?php esc_html_e('Choose a JSON file:', 'give') ?></label> |
|
361 | 361 | </th> |
362 | 362 | <td class="give-forminp"> |
363 | 363 | <div class="give-field-wrap"> |
364 | 364 | <label for="json"> |
365 | 365 | <input type="file" name="json" class="give-upload-json-file" value="<?php echo $json; ?>" |
366 | 366 | accept=".json"> |
367 | - <p class="give-field-description"><?php esc_html_e( 'The file type must be JSON.', 'give' )?></p> |
|
367 | + <p class="give-field-description"><?php esc_html_e('The file type must be JSON.', 'give')?></p> |
|
368 | 368 | </label> |
369 | 369 | </div> |
370 | 370 | </td> |
@@ -373,21 +373,21 @@ discard block |
||
373 | 373 | $settings = array( |
374 | 374 | array( |
375 | 375 | 'id' => 'type', |
376 | - 'name' => __( 'Merge Type:', 'give' ), |
|
377 | - 'description' => __( 'Select "Merge" to retain existing settings, or "Replace" to overwrite with the settings from the JSON file', 'give' ), |
|
376 | + 'name' => __('Merge Type:', 'give'), |
|
377 | + 'description' => __('Select "Merge" to retain existing settings, or "Replace" to overwrite with the settings from the JSON file', 'give'), |
|
378 | 378 | 'default' => $type, |
379 | 379 | 'type' => 'radio_inline', |
380 | 380 | 'options' => array( |
381 | - 'merge' => __( 'Merge', 'give' ), |
|
382 | - 'replace' => __( 'Replace', 'give' ), |
|
381 | + 'merge' => __('Merge', 'give'), |
|
382 | + 'replace' => __('Replace', 'give'), |
|
383 | 383 | ), |
384 | 384 | ), |
385 | 385 | ); |
386 | 386 | |
387 | - $settings = apply_filters( 'give_import_core_setting_html', $settings ); |
|
387 | + $settings = apply_filters('give_import_core_setting_html', $settings); |
|
388 | 388 | |
389 | - if ( empty( $this->is_json_valid ) ) { |
|
390 | - Give_Admin_Settings::output_fields( $settings, 'give_settings' ); |
|
389 | + if (empty($this->is_json_valid)) { |
|
390 | + Give_Admin_Settings::output_fields($settings, 'give_settings'); |
|
391 | 391 | ?> |
392 | 392 | <tr valign="top"> |
393 | 393 | <th></th> |
@@ -395,7 +395,7 @@ discard block |
||
395 | 395 | <input type="submit" |
396 | 396 | class="button button-primary button-large button-secondary <?php echo "step-{$step}"; ?>" |
397 | 397 | id="recount-stats-submit" |
398 | - value="<?php esc_attr_e( 'Submit', 'give' ); ?>"/> |
|
398 | + value="<?php esc_attr_e('Submit', 'give'); ?>"/> |
|
399 | 399 | </th> |
400 | 400 | </tr> |
401 | 401 | <?php |
@@ -417,20 +417,20 @@ discard block |
||
417 | 417 | $step = $this->get_step(); |
418 | 418 | |
419 | 419 | // Validation for first step. |
420 | - if ( 1 === $step ) { |
|
421 | - $type = ( ! empty( $_REQUEST['type'] ) ? give_clean( $_REQUEST['type'] ) : 'replace' ); |
|
420 | + if (1 === $step) { |
|
421 | + $type = ( ! empty($_REQUEST['type']) ? give_clean($_REQUEST['type']) : 'replace'); |
|
422 | 422 | $core_settings = self::upload_widget_settings_file(); |
423 | - if ( ! empty( $core_settings['error'] ) ) { |
|
424 | - Give_Admin_Settings::add_error( 'give-import-csv', __( 'Please upload a valid JSON settings file.', 'give' ) ); |
|
423 | + if ( ! empty($core_settings['error'])) { |
|
424 | + Give_Admin_Settings::add_error('give-import-csv', __('Please upload a valid JSON settings file.', 'give')); |
|
425 | 425 | } else { |
426 | - $file_path = explode( '/', $core_settings['file'] ); |
|
427 | - $count = ( count( $file_path ) - 1 ); |
|
428 | - $url = give_import_page_url( (array) apply_filters( 'give_import_core_settings_importing_url', array( |
|
426 | + $file_path = explode('/', $core_settings['file']); |
|
427 | + $count = (count($file_path) - 1); |
|
428 | + $url = give_import_page_url((array) apply_filters('give_import_core_settings_importing_url', array( |
|
429 | 429 | 'step' => '2', |
430 | 430 | 'importer-type' => $this->importer_type, |
431 | 431 | 'type' => $type, |
432 | - 'file_name' => $file_path[ $count ], |
|
433 | - ) ) ); |
|
432 | + 'file_name' => $file_path[$count], |
|
433 | + ))); |
|
434 | 434 | |
435 | 435 | |
436 | 436 | $this->is_json_valid = $url; |
@@ -445,7 +445,7 @@ discard block |
||
445 | 445 | * @return bool |
446 | 446 | */ |
447 | 447 | private function is_donations_import_page() { |
448 | - return 'import' === give_get_current_setting_tab() && isset( $_GET['importer-type'] ) && $this->importer_type === give_clean( $_GET['importer-type'] ); |
|
448 | + return 'import' === give_get_current_setting_tab() && isset($_GET['importer-type']) && $this->importer_type === give_clean($_GET['importer-type']); |
|
449 | 449 | } |
450 | 450 | |
451 | 451 | /** |
@@ -454,14 +454,14 @@ discard block |
||
454 | 454 | */ |
455 | 455 | public static function upload_widget_settings_file() { |
456 | 456 | $upload = false; |
457 | - if ( isset( $_FILES['json'] ) ) { |
|
458 | - add_filter( 'upload_mimes', array( __CLASS__, 'json_upload_mimes' ) ); |
|
457 | + if (isset($_FILES['json'])) { |
|
458 | + add_filter('upload_mimes', array(__CLASS__, 'json_upload_mimes')); |
|
459 | 459 | |
460 | - $upload = wp_handle_upload( $_FILES['json'], array( 'test_form' => false ) ); |
|
460 | + $upload = wp_handle_upload($_FILES['json'], array('test_form' => false)); |
|
461 | 461 | |
462 | - remove_filter( 'upload_mimes', array( __CLASS__, 'json_upload_mimes' ) ); |
|
462 | + remove_filter('upload_mimes', array(__CLASS__, 'json_upload_mimes')); |
|
463 | 463 | } else { |
464 | - Give_Admin_Settings::add_error( 'give-import-csv', __( 'Please upload or provide a valid JSON file.', 'give' ) ); |
|
464 | + Give_Admin_Settings::add_error('give-import-csv', __('Please upload or provide a valid JSON file.', 'give')); |
|
465 | 465 | } |
466 | 466 | |
467 | 467 | return $upload; |
@@ -472,7 +472,7 @@ discard block |
||
472 | 472 | * |
473 | 473 | * @param array $existing_mimes |
474 | 474 | */ |
475 | - public static function json_upload_mimes( $existing_mimes = array() ) { |
|
475 | + public static function json_upload_mimes($existing_mimes = array()) { |
|
476 | 476 | $existing_mimes['json'] = 'application/json'; |
477 | 477 | |
478 | 478 | return $existing_mimes; |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -21,12 +21,12 @@ discard block |
||
21 | 21 | * @return void |
22 | 22 | */ |
23 | 23 | function give_register_dashboard_widgets() { |
24 | - if ( current_user_can( apply_filters( 'give_dashboard_stats_cap', 'view_give_reports' ) ) ) { |
|
25 | - wp_add_dashboard_widget( 'give_dashboard_sales', __( 'Give: Donation Statistics', 'give' ), 'give_dashboard_sales_widget' ); |
|
24 | + if (current_user_can(apply_filters('give_dashboard_stats_cap', 'view_give_reports'))) { |
|
25 | + wp_add_dashboard_widget('give_dashboard_sales', __('Give: Donation Statistics', 'give'), 'give_dashboard_sales_widget'); |
|
26 | 26 | } |
27 | 27 | } |
28 | 28 | |
29 | -add_action( 'wp_dashboard_setup', 'give_register_dashboard_widgets', 10 ); |
|
29 | +add_action('wp_dashboard_setup', 'give_register_dashboard_widgets', 10); |
|
30 | 30 | |
31 | 31 | /** |
32 | 32 | * Sales Summary Dashboard Widget |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | */ |
39 | 39 | function give_dashboard_sales_widget() { |
40 | 40 | |
41 | - if ( ! current_user_can( apply_filters( 'give_dashboard_stats_cap', 'view_give_reports' ) ) ) { |
|
41 | + if ( ! current_user_can(apply_filters('give_dashboard_stats_cap', 'view_give_reports'))) { |
|
42 | 42 | return; |
43 | 43 | } |
44 | 44 | $stats = new Give_Payment_Stats(); ?> |
@@ -46,27 +46,27 @@ discard block |
||
46 | 46 | <div class="give-dashboard-widget"> |
47 | 47 | |
48 | 48 | <div class="give-dashboard-today give-clearfix"> |
49 | - <h3 class="give-dashboard-date-today"><?php echo date_i18n( _x( 'F j, Y', 'dashboard widget', 'give' ) ); ?></h3> |
|
49 | + <h3 class="give-dashboard-date-today"><?php echo date_i18n(_x('F j, Y', 'dashboard widget', 'give')); ?></h3> |
|
50 | 50 | |
51 | 51 | <p class="give-dashboard-happy-day"><?php |
52 | 52 | printf( |
53 | 53 | /* translators: %s: day of the week */ |
54 | - __( 'Happy %s!', 'give' ), |
|
55 | - date_i18n( 'l', current_time( 'timestamp' ) ) |
|
54 | + __('Happy %s!', 'give'), |
|
55 | + date_i18n('l', current_time('timestamp')) |
|
56 | 56 | ); |
57 | 57 | ?></p> |
58 | 58 | |
59 | 59 | <p class="give-dashboard-today-earnings"><?php |
60 | - $earnings_today = $stats->get_earnings( 0, 'today', false ); |
|
61 | - echo give_currency_filter( give_format_amount( $earnings_today, array( 'sanitize' => false ) ) ); |
|
60 | + $earnings_today = $stats->get_earnings(0, 'today', false); |
|
61 | + echo give_currency_filter(give_format_amount($earnings_today, array('sanitize' => false))); |
|
62 | 62 | ?></p> |
63 | 63 | |
64 | 64 | <p class="give-donations-today"><?php |
65 | - $donations_today = $stats->get_sales( 0, 'today', false ); |
|
65 | + $donations_today = $stats->get_sales(0, 'today', false); |
|
66 | 66 | printf( |
67 | 67 | /* translators: %s: daily donation count */ |
68 | - __( '%s donations today', 'give' ), |
|
69 | - give_format_amount( $donations_today, array( 'decimal' => false, 'sanitize' => false ) ) |
|
68 | + __('%s donations today', 'give'), |
|
69 | + give_format_amount($donations_today, array('decimal' => false, 'sanitize' => false)) |
|
70 | 70 | ); |
71 | 71 | ?></p> |
72 | 72 | |
@@ -76,34 +76,34 @@ discard block |
||
76 | 76 | <table class="give-table-stats"> |
77 | 77 | <thead style="display: none;"> |
78 | 78 | <tr> |
79 | - <th><?php _e( 'This Week', 'give' ); ?></th> |
|
80 | - <th><?php _e( 'This Month', 'give' ); ?></th> |
|
81 | - <th><?php _e( 'Past 30 Days', 'give' ); ?></th> |
|
79 | + <th><?php _e('This Week', 'give'); ?></th> |
|
80 | + <th><?php _e('This Month', 'give'); ?></th> |
|
81 | + <th><?php _e('Past 30 Days', 'give'); ?></th> |
|
82 | 82 | </tr> |
83 | 83 | </thead> |
84 | 84 | <tbody> |
85 | 85 | <tr id="give-table-stats-tr-1"> |
86 | 86 | <td> |
87 | - <p class="give-dashboard-stat-total"><?php echo give_currency_filter( give_format_amount( $stats->get_earnings( 0, 'this_week' ), array( 'sanitize' => false ) ) ); ?></p> |
|
87 | + <p class="give-dashboard-stat-total"><?php echo give_currency_filter(give_format_amount($stats->get_earnings(0, 'this_week'), array('sanitize' => false))); ?></p> |
|
88 | 88 | |
89 | - <p class="give-dashboard-stat-total-label"><?php _e( 'This Week', 'give' ); ?></p> |
|
89 | + <p class="give-dashboard-stat-total-label"><?php _e('This Week', 'give'); ?></p> |
|
90 | 90 | </td> |
91 | 91 | <td> |
92 | - <p class="give-dashboard-stat-total"><?php echo give_currency_filter( give_format_amount( $stats->get_earnings( 0, 'this_month' ), array( 'sanitize' => false ) ) ); ?></p> |
|
92 | + <p class="give-dashboard-stat-total"><?php echo give_currency_filter(give_format_amount($stats->get_earnings(0, 'this_month'), array('sanitize' => false))); ?></p> |
|
93 | 93 | |
94 | - <p class="give-dashboard-stat-total-label"><?php _e( 'This Month', 'give' ); ?></p> |
|
94 | + <p class="give-dashboard-stat-total-label"><?php _e('This Month', 'give'); ?></p> |
|
95 | 95 | </td> |
96 | 96 | </tr> |
97 | 97 | <tr id="give-table-stats-tr-2"> |
98 | 98 | <td> |
99 | - <p class="give-dashboard-stat-total"><?php echo give_currency_filter( give_format_amount( $stats->get_earnings( 0, 'last_month' ), array( 'sanitize' => false ) ) ) ?></p> |
|
99 | + <p class="give-dashboard-stat-total"><?php echo give_currency_filter(give_format_amount($stats->get_earnings(0, 'last_month'), array('sanitize' => false))) ?></p> |
|
100 | 100 | |
101 | - <p class="give-dashboard-stat-total-label"><?php _e( 'Last Month', 'give' ); ?></p> |
|
101 | + <p class="give-dashboard-stat-total-label"><?php _e('Last Month', 'give'); ?></p> |
|
102 | 102 | </td> |
103 | 103 | <td> |
104 | - <p class="give-dashboard-stat-total"><?php echo give_currency_filter( give_format_amount( $stats->get_earnings( 0, 'this_quarter' ), array( 'sanitize' => false ) ) ) ?></p> |
|
104 | + <p class="give-dashboard-stat-total"><?php echo give_currency_filter(give_format_amount($stats->get_earnings(0, 'this_quarter'), array('sanitize' => false))) ?></p> |
|
105 | 105 | |
106 | - <p class="give-dashboard-stat-total-label"><?php _e( 'This Quarter', 'give' ); ?></p> |
|
106 | + <p class="give-dashboard-stat-total-label"><?php _e('This Quarter', 'give'); ?></p> |
|
107 | 107 | </td> |
108 | 108 | </tr> |
109 | 109 | </tbody> |
@@ -123,24 +123,24 @@ discard block |
||
123 | 123 | * |
124 | 124 | * @return array |
125 | 125 | */ |
126 | -function give_dashboard_at_a_glance_widget( $items ) { |
|
126 | +function give_dashboard_at_a_glance_widget($items) { |
|
127 | 127 | |
128 | - $num_posts = wp_count_posts( 'give_forms' ); |
|
128 | + $num_posts = wp_count_posts('give_forms'); |
|
129 | 129 | |
130 | - if ( $num_posts && $num_posts->publish ) { |
|
130 | + if ($num_posts && $num_posts->publish) { |
|
131 | 131 | |
132 | 132 | $text = sprintf( |
133 | 133 | /* translators: %s: number of posts published */ |
134 | - _n( '%s Give Form', '%s Give Forms', $num_posts->publish, 'give' ), |
|
134 | + _n('%s Give Form', '%s Give Forms', $num_posts->publish, 'give'), |
|
135 | 135 | $num_posts->publish |
136 | 136 | ); |
137 | 137 | |
138 | - $text = sprintf( $text, number_format_i18n( $num_posts->publish ) ); |
|
138 | + $text = sprintf($text, number_format_i18n($num_posts->publish)); |
|
139 | 139 | |
140 | - if ( current_user_can( 'edit_give_forms', get_current_user_id() ) ) { |
|
140 | + if (current_user_can('edit_give_forms', get_current_user_id())) { |
|
141 | 141 | $text = sprintf( |
142 | 142 | '<a class="give-forms-count" href="%1$s">%2$s</a>', |
143 | - admin_url( 'edit.php?post_type=give_forms' ), |
|
143 | + admin_url('edit.php?post_type=give_forms'), |
|
144 | 144 | $text |
145 | 145 | ); |
146 | 146 | } else { |
@@ -156,4 +156,4 @@ discard block |
||
156 | 156 | return $items; |
157 | 157 | } |
158 | 158 | |
159 | -add_filter( 'dashboard_glance_items', 'give_dashboard_at_a_glance_widget', 1, 1 ); |
|
159 | +add_filter('dashboard_glance_items', 'give_dashboard_at_a_glance_widget', 1, 1); |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -24,10 +24,10 @@ discard block |
||
24 | 24 | * @return void |
25 | 25 | */ |
26 | 26 | function give_payment_history_page() { |
27 | - if ( isset( $_GET['view'] ) && 'view-payment-details' == $_GET['view'] ) { |
|
28 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/payments/view-payment-details.php'; |
|
27 | + if (isset($_GET['view']) && 'view-payment-details' == $_GET['view']) { |
|
28 | + require_once GIVE_PLUGIN_DIR.'includes/admin/payments/view-payment-details.php'; |
|
29 | 29 | } else { |
30 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/payments/class-payments-table.php'; |
|
30 | + require_once GIVE_PLUGIN_DIR.'includes/admin/payments/class-payments-table.php'; |
|
31 | 31 | $payments_table = new Give_Payment_History_Table(); |
32 | 32 | $payments_table->prepare_items(); |
33 | 33 | ?> |
@@ -41,23 +41,23 @@ discard block |
||
41 | 41 | * |
42 | 42 | * @since 1.7 |
43 | 43 | */ |
44 | - do_action( 'give_payments_page_top' ); |
|
44 | + do_action('give_payments_page_top'); |
|
45 | 45 | ?> |
46 | 46 | <hr class="wp-header-end"> |
47 | 47 | |
48 | - <form id="give-payments-advanced-filter" method="get" action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-payment-history' ); ?>"> |
|
48 | + <form id="give-payments-advanced-filter" method="get" action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-payment-history'); ?>"> |
|
49 | 49 | <input type="hidden" name="post_type" value="give_forms" /> |
50 | 50 | <input type="hidden" name="page" value="give-payment-history" /> |
51 | 51 | <?php $payments_table->views() ?> |
52 | 52 | <?php $payments_table->advanced_filters(); ?> |
53 | 53 | </form> |
54 | 54 | |
55 | - <form id="give-payments-filter" method="get" action="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-payment-history' ); ?>"> |
|
55 | + <form id="give-payments-filter" method="get" action="<?php echo admin_url('edit.php?post_type=give_forms&page=give-payment-history'); ?>"> |
|
56 | 56 | <input type="hidden" name="post_type" value="give_forms" /> |
57 | 57 | <input type="hidden" name="page" value="give-payment-history" /> |
58 | 58 | <?php |
59 | - if ( ! empty( $_GET['donor'] ) ) { |
|
60 | - echo sprintf( '<input type="hidden" name="donor" value="%s"/>', absint( $_GET['donor'] ) ); |
|
59 | + if ( ! empty($_GET['donor'])) { |
|
60 | + echo sprintf('<input type="hidden" name="donor" value="%s"/>', absint($_GET['donor'])); |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | $payments_table->display(); |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | * |
71 | 71 | * @since 1.7 |
72 | 72 | */ |
73 | - do_action( 'give_payments_page_bottom' ); |
|
73 | + do_action('give_payments_page_bottom'); |
|
74 | 74 | ?> |
75 | 75 | |
76 | 76 | </div> |
@@ -87,29 +87,29 @@ discard block |
||
87 | 87 | * @param $title |
88 | 88 | * @return string |
89 | 89 | */ |
90 | -function give_view_donation_details_title( $admin_title, $title ) { |
|
90 | +function give_view_donation_details_title($admin_title, $title) { |
|
91 | 91 | |
92 | - if ( 'give_forms_page_give-payment-history' != get_current_screen()->base ) { |
|
92 | + if ('give_forms_page_give-payment-history' != get_current_screen()->base) { |
|
93 | 93 | return $admin_title; |
94 | 94 | } |
95 | 95 | |
96 | - if( ! isset( $_GET['give-action'] ) ) { |
|
96 | + if ( ! isset($_GET['give-action'])) { |
|
97 | 97 | return $admin_title; |
98 | 98 | } |
99 | 99 | |
100 | - switch( $_GET['give-action'] ) : |
|
100 | + switch ($_GET['give-action']) : |
|
101 | 101 | |
102 | 102 | case 'view-payment-details' : |
103 | 103 | $title = sprintf( |
104 | 104 | /* translators: %s: admin title */ |
105 | - esc_html__( 'View Donation Details - %s', 'give' ), |
|
105 | + esc_html__('View Donation Details - %s', 'give'), |
|
106 | 106 | $admin_title |
107 | 107 | ); |
108 | 108 | break; |
109 | 109 | case 'edit-payment' : |
110 | 110 | $title = sprintf( |
111 | 111 | /* translators: %s: admin title */ |
112 | - esc_html__( 'Edit Donation - %s', 'give' ), |
|
112 | + esc_html__('Edit Donation - %s', 'give'), |
|
113 | 113 | $admin_title |
114 | 114 | ); |
115 | 115 | break; |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | |
121 | 121 | return $title; |
122 | 122 | } |
123 | -add_filter( 'admin_title', 'give_view_donation_details_title', 10, 2 ); |
|
123 | +add_filter('admin_title', 'give_view_donation_details_title', 10, 2); |
|
124 | 124 | |
125 | 125 | /** |
126 | 126 | * Intercept default Edit post links for Give payments and rewrite them to the View Order Details screen. |
@@ -132,20 +132,20 @@ discard block |
||
132 | 132 | * @param $context |
133 | 133 | * @return string |
134 | 134 | */ |
135 | -function give_override_edit_post_for_payment_link( $url, $post_id = 0, $context ) { |
|
135 | +function give_override_edit_post_for_payment_link($url, $post_id = 0, $context) { |
|
136 | 136 | |
137 | - $post = get_post( $post_id ); |
|
137 | + $post = get_post($post_id); |
|
138 | 138 | |
139 | - if( ! $post ) { |
|
139 | + if ( ! $post) { |
|
140 | 140 | return $url; |
141 | 141 | } |
142 | 142 | |
143 | - if( 'give_payment' != $post->post_type ) { |
|
143 | + if ('give_payment' != $post->post_type) { |
|
144 | 144 | return $url; |
145 | 145 | } |
146 | 146 | |
147 | - $url = admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&id=' . $post_id ); |
|
147 | + $url = admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&id='.$post_id); |
|
148 | 148 | |
149 | 149 | return $url; |
150 | 150 | } |
151 | -add_filter( 'get_edit_post_link', 'give_override_edit_post_for_payment_link', 10, 3 ); |
|
151 | +add_filter('get_edit_post_link', 'give_override_edit_post_for_payment_link', 10, 3); |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -25,48 +25,48 @@ discard block |
||
25 | 25 | * |
26 | 26 | * @return void |
27 | 27 | */ |
28 | -function give_update_payment_details( $data ) { |
|
28 | +function give_update_payment_details($data) { |
|
29 | 29 | |
30 | - if ( ! current_user_can( 'edit_give_payments', $data['give_payment_id'] ) ) { |
|
31 | - wp_die( __( 'You do not have permission to edit payments.', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
30 | + if ( ! current_user_can('edit_give_payments', $data['give_payment_id'])) { |
|
31 | + wp_die(__('You do not have permission to edit payments.', 'give'), __('Error', 'give'), array('response' => 403)); |
|
32 | 32 | } |
33 | 33 | |
34 | - check_admin_referer( 'give_update_payment_details_nonce' ); |
|
34 | + check_admin_referer('give_update_payment_details_nonce'); |
|
35 | 35 | |
36 | 36 | // Retrieve the payment ID. |
37 | - $payment_id = absint( $data['give_payment_id'] ); |
|
37 | + $payment_id = absint($data['give_payment_id']); |
|
38 | 38 | |
39 | 39 | /* @var Give_Payment $payment */ |
40 | - $payment = new Give_Payment( $payment_id ); |
|
40 | + $payment = new Give_Payment($payment_id); |
|
41 | 41 | |
42 | 42 | $status = $data['give-payment-status']; |
43 | - $date = sanitize_text_field( $data['give-payment-date'] ); |
|
44 | - $hour = sanitize_text_field( $data['give-payment-time-hour'] ); |
|
43 | + $date = sanitize_text_field($data['give-payment-date']); |
|
44 | + $hour = sanitize_text_field($data['give-payment-time-hour']); |
|
45 | 45 | |
46 | 46 | // Restrict to our high and low. |
47 | - if ( $hour > 23 ) { |
|
47 | + if ($hour > 23) { |
|
48 | 48 | $hour = 23; |
49 | - } elseif ( $hour < 0 ) { |
|
49 | + } elseif ($hour < 0) { |
|
50 | 50 | $hour = 00; |
51 | 51 | } |
52 | 52 | |
53 | - $minute = sanitize_text_field( $data['give-payment-time-min'] ); |
|
53 | + $minute = sanitize_text_field($data['give-payment-time-min']); |
|
54 | 54 | |
55 | 55 | // Restrict to our high and low. |
56 | - if ( $minute > 59 ) { |
|
56 | + if ($minute > 59) { |
|
57 | 57 | $minute = 59; |
58 | - } elseif ( $minute < 0 ) { |
|
58 | + } elseif ($minute < 0) { |
|
59 | 59 | $minute = 00; |
60 | 60 | } |
61 | 61 | |
62 | - $address = give_clean( $data['give-payment-address'][0] ); |
|
62 | + $address = give_clean($data['give-payment-address'][0]); |
|
63 | 63 | |
64 | 64 | $curr_total = $payment->total; |
65 | - $new_total = give_maybe_sanitize_amount( ( ! empty( $data['give-payment-total'] ) ? $data['give-payment-total'] : 0 ) ); |
|
66 | - $date = date( 'Y-m-d', strtotime( $date ) ) . ' ' . $hour . ':' . $minute . ':00'; |
|
65 | + $new_total = give_maybe_sanitize_amount(( ! empty($data['give-payment-total']) ? $data['give-payment-total'] : 0)); |
|
66 | + $date = date('Y-m-d', strtotime($date)).' '.$hour.':'.$minute.':00'; |
|
67 | 67 | |
68 | - $curr_donor_id = sanitize_text_field( $data['give-current-donor'] ); |
|
69 | - $new_donor_id = sanitize_text_field( $data['donor-id'] ); |
|
68 | + $curr_donor_id = sanitize_text_field($data['give-current-donor']); |
|
69 | + $new_donor_id = sanitize_text_field($data['donor-id']); |
|
70 | 70 | |
71 | 71 | /** |
72 | 72 | * Fires before updating edited donation. |
@@ -76,71 +76,71 @@ discard block |
||
76 | 76 | * |
77 | 77 | * @param int $payment_id The ID of the payment. |
78 | 78 | */ |
79 | - do_action( 'give_update_edited_donation', $payment_id ); |
|
79 | + do_action('give_update_edited_donation', $payment_id); |
|
80 | 80 | |
81 | 81 | $payment->date = $date; |
82 | 82 | $updated = $payment->save(); |
83 | 83 | |
84 | - if ( 0 === $updated ) { |
|
85 | - wp_die( __( 'Error Updating Donation.', 'give' ), __( 'Error', 'give' ), array( 'response' => 400 ) ); |
|
84 | + if (0 === $updated) { |
|
85 | + wp_die(__('Error Updating Donation.', 'give'), __('Error', 'give'), array('response' => 400)); |
|
86 | 86 | } |
87 | 87 | |
88 | 88 | $donor_changed = false; |
89 | 89 | |
90 | - if ( isset( $data['give-new-donor'] ) && $data['give-new-donor'] == '1' ) { |
|
90 | + if (isset($data['give-new-donor']) && $data['give-new-donor'] == '1') { |
|
91 | 91 | |
92 | - $email = ! empty( $data['give-new-donor-email'] ) ? sanitize_text_field( $data['give-new-donor-email'] ) : ''; |
|
93 | - $first_name = ! empty( $data['give-new-donor-first-name'] ) ? sanitize_text_field( $data['give-new-donor-first-name'] ) : ''; |
|
94 | - $last_name = ! empty( $data['give-new-donor-last-name'] ) ? sanitize_text_field( $data['give-new-donor-last-name'] ) : ''; |
|
95 | - $names = strip_tags( wp_unslash( trim( "{$first_name} {$last_name}" ) ) ); |
|
92 | + $email = ! empty($data['give-new-donor-email']) ? sanitize_text_field($data['give-new-donor-email']) : ''; |
|
93 | + $first_name = ! empty($data['give-new-donor-first-name']) ? sanitize_text_field($data['give-new-donor-first-name']) : ''; |
|
94 | + $last_name = ! empty($data['give-new-donor-last-name']) ? sanitize_text_field($data['give-new-donor-last-name']) : ''; |
|
95 | + $names = strip_tags(wp_unslash(trim("{$first_name} {$last_name}"))); |
|
96 | 96 | |
97 | - if ( empty( $email ) || empty( $first_name ) ) { |
|
98 | - wp_die( __( 'New Donor requires first name and email address.', 'give' ), __( 'Error', 'give' ), array( 'response' => 400 ) ); |
|
97 | + if (empty($email) || empty($first_name)) { |
|
98 | + wp_die(__('New Donor requires first name and email address.', 'give'), __('Error', 'give'), array('response' => 400)); |
|
99 | 99 | } |
100 | 100 | |
101 | - $donor = new Give_Donor( $email ); |
|
102 | - if ( empty( $donor->id ) ) { |
|
103 | - $donor_data = array( 'name' => $names, 'email' => $email ); |
|
104 | - $user_id = email_exists( $email ); |
|
105 | - if ( false !== $user_id ) { |
|
101 | + $donor = new Give_Donor($email); |
|
102 | + if (empty($donor->id)) { |
|
103 | + $donor_data = array('name' => $names, 'email' => $email); |
|
104 | + $user_id = email_exists($email); |
|
105 | + if (false !== $user_id) { |
|
106 | 106 | $donor_data['user_id'] = $user_id; |
107 | 107 | } |
108 | 108 | |
109 | - if ( ! $donor->create( $donor_data ) ) { |
|
109 | + if ( ! $donor->create($donor_data)) { |
|
110 | 110 | // Failed to create the new donor, assume the previous donor. |
111 | 111 | $donor_changed = false; |
112 | - $donor = new Give_Donor( $curr_donor_id ); |
|
113 | - give_set_error( 'give-payment-new-donor-fail', __( 'Error creating new donor.', 'give' ) ); |
|
112 | + $donor = new Give_Donor($curr_donor_id); |
|
113 | + give_set_error('give-payment-new-donor-fail', __('Error creating new donor.', 'give')); |
|
114 | 114 | } |
115 | 115 | } |
116 | 116 | |
117 | 117 | // Create and Update Donor First Name and Last Name in Meta Fields. |
118 | - $donor->update_meta( '_give_donor_first_name', $first_name ); |
|
119 | - $donor->update_meta( '_give_donor_last_name', $last_name ); |
|
118 | + $donor->update_meta('_give_donor_first_name', $first_name); |
|
119 | + $donor->update_meta('_give_donor_last_name', $last_name); |
|
120 | 120 | |
121 | 121 | $new_donor_id = $donor->id; |
122 | 122 | |
123 | - $previous_donor = new Give_Donor( $curr_donor_id ); |
|
123 | + $previous_donor = new Give_Donor($curr_donor_id); |
|
124 | 124 | |
125 | 125 | $donor_changed = true; |
126 | 126 | |
127 | - } elseif ( $curr_donor_id !== $new_donor_id ) { |
|
127 | + } elseif ($curr_donor_id !== $new_donor_id) { |
|
128 | 128 | |
129 | - $donor = new Give_Donor( $new_donor_id ); |
|
129 | + $donor = new Give_Donor($new_donor_id); |
|
130 | 130 | $email = $donor->email; |
131 | 131 | $names = $donor->name; |
132 | 132 | |
133 | - $previous_donor = new Give_Donor( $curr_donor_id ); |
|
133 | + $previous_donor = new Give_Donor($curr_donor_id); |
|
134 | 134 | |
135 | 135 | $donor_changed = true; |
136 | 136 | |
137 | 137 | } else { |
138 | - $donor = new Give_Donor( $curr_donor_id ); |
|
138 | + $donor = new Give_Donor($curr_donor_id); |
|
139 | 139 | $email = $donor->email; |
140 | 140 | $names = $donor->name; |
141 | 141 | } |
142 | 142 | |
143 | - if ( $donor_changed ) { |
|
143 | + if ($donor_changed) { |
|
144 | 144 | |
145 | 145 | // Setup first and last name from input values. |
146 | 146 | $first_name = $donor->get_first_name(); |
@@ -150,26 +150,26 @@ discard block |
||
150 | 150 | $payment->last_name = $last_name; |
151 | 151 | |
152 | 152 | // Remove the stats and payment from the previous donor and attach it to the new donor. |
153 | - $previous_donor->remove_payment( $payment_id, false ); |
|
154 | - $donor->attach_payment( $payment_id, false ); |
|
153 | + $previous_donor->remove_payment($payment_id, false); |
|
154 | + $donor->attach_payment($payment_id, false); |
|
155 | 155 | |
156 | - if ( 'publish' == $status ) { |
|
156 | + if ('publish' == $status) { |
|
157 | 157 | |
158 | 158 | // Reduce previous user donation count and amount. |
159 | 159 | $previous_donor->decrease_donation_count(); |
160 | - $previous_donor->decrease_value( $curr_total ); |
|
160 | + $previous_donor->decrease_value($curr_total); |
|
161 | 161 | |
162 | 162 | // If donation was completed adjust stats of new donors. |
163 | 163 | $donor->increase_purchase_count(); |
164 | - $donor->increase_value( $new_total ); |
|
164 | + $donor->increase_value($new_total); |
|
165 | 165 | } |
166 | 166 | |
167 | 167 | $payment->customer_id = $donor->id; |
168 | 168 | } else { |
169 | 169 | |
170 | - if ( 'publish' === $status ) { |
|
170 | + if ('publish' === $status) { |
|
171 | 171 | // Update user donation stat. |
172 | - $donor->update_donation_value( $curr_total, $new_total ); |
|
172 | + $donor->update_donation_value($curr_total, $new_total); |
|
173 | 173 | } |
174 | 174 | } |
175 | 175 | |
@@ -180,10 +180,10 @@ discard block |
||
180 | 180 | $payment->total = $new_total; |
181 | 181 | |
182 | 182 | // Check for payment notes. |
183 | - if ( ! empty( $data['give-payment-note'] ) ) { |
|
183 | + if ( ! empty($data['give-payment-note'])) { |
|
184 | 184 | |
185 | - $note = wp_kses( $data['give-payment-note'], array() ); |
|
186 | - give_insert_payment_note( $payment_id, $note ); |
|
185 | + $note = wp_kses($data['give-payment-note'], array()); |
|
186 | + give_insert_payment_note($payment_id, $note); |
|
187 | 187 | |
188 | 188 | } |
189 | 189 | |
@@ -191,17 +191,17 @@ discard block |
||
191 | 191 | $payment->status = $status; |
192 | 192 | |
193 | 193 | // Adjust total store earnings if the payment total has been changed. |
194 | - if ( $new_total !== $curr_total && 'publish' == $status ) { |
|
194 | + if ($new_total !== $curr_total && 'publish' == $status) { |
|
195 | 195 | |
196 | - if ( $new_total > $curr_total ) { |
|
196 | + if ($new_total > $curr_total) { |
|
197 | 197 | // Increase if our new total is higher. |
198 | 198 | $difference = $new_total - $curr_total; |
199 | - give_increase_total_earnings( $difference ); |
|
199 | + give_increase_total_earnings($difference); |
|
200 | 200 | |
201 | - } elseif ( $curr_total > $new_total ) { |
|
201 | + } elseif ($curr_total > $new_total) { |
|
202 | 202 | // Decrease if our new total is lower. |
203 | 203 | $difference = $curr_total - $new_total; |
204 | - give_decrease_total_earnings( $difference ); |
|
204 | + give_decrease_total_earnings($difference); |
|
205 | 205 | |
206 | 206 | } |
207 | 207 | } |
@@ -209,55 +209,55 @@ discard block |
||
209 | 209 | $payment->save(); |
210 | 210 | |
211 | 211 | // Get new give form ID. |
212 | - $new_form_id = absint( $data['give-payment-form-select'] ); |
|
213 | - $current_form_id = absint( $payment->get_meta( '_give_payment_form_id' ) ); |
|
212 | + $new_form_id = absint($data['give-payment-form-select']); |
|
213 | + $current_form_id = absint($payment->get_meta('_give_payment_form_id')); |
|
214 | 214 | |
215 | 215 | // We are adding payment transfer code in last to remove any conflict with above functionality. |
216 | 216 | // For example: above code will automatically handle form stat (increase/decrease) when payment status changes. |
217 | 217 | // Check if user want to transfer current payment to new give form id. |
218 | - if ( $new_form_id && $new_form_id != $current_form_id ) { |
|
218 | + if ($new_form_id && $new_form_id != $current_form_id) { |
|
219 | 219 | |
220 | 220 | // Get new give form title. |
221 | - $new_form_title = get_the_title( $new_form_id ); |
|
221 | + $new_form_title = get_the_title($new_form_id); |
|
222 | 222 | |
223 | 223 | // Update payment give form meta data. |
224 | - $payment->update_meta( '_give_payment_form_id', $new_form_id ); |
|
225 | - $payment->update_meta( '_give_payment_form_title', $new_form_title ); |
|
224 | + $payment->update_meta('_give_payment_form_id', $new_form_id); |
|
225 | + $payment->update_meta('_give_payment_form_title', $new_form_title); |
|
226 | 226 | |
227 | 227 | // Update price id payment metadata. |
228 | - if ( ! give_has_variable_prices( $new_form_id ) ) { |
|
229 | - $payment->update_meta( '_give_payment_price_id', '' ); |
|
228 | + if ( ! give_has_variable_prices($new_form_id)) { |
|
229 | + $payment->update_meta('_give_payment_price_id', ''); |
|
230 | 230 | } |
231 | 231 | |
232 | 232 | // If donation was completed, adjust stats of forms. |
233 | - if ( 'publish' == $status ) { |
|
233 | + if ('publish' == $status) { |
|
234 | 234 | |
235 | 235 | // Decrease sale of old give form. For other payment status. |
236 | - $current_form = new Give_Donate_Form( $current_form_id ); |
|
236 | + $current_form = new Give_Donate_Form($current_form_id); |
|
237 | 237 | $current_form->decrease_sales(); |
238 | - $current_form->decrease_earnings( $curr_total, $payment->ID ); |
|
238 | + $current_form->decrease_earnings($curr_total, $payment->ID); |
|
239 | 239 | |
240 | 240 | // Increase sale of new give form. |
241 | - $new_form = new Give_Donate_Form( $new_form_id ); |
|
241 | + $new_form = new Give_Donate_Form($new_form_id); |
|
242 | 242 | $new_form->increase_sales(); |
243 | - $new_form->increase_earnings( $new_total, $payment->ID ); |
|
243 | + $new_form->increase_earnings($new_total, $payment->ID); |
|
244 | 244 | } |
245 | 245 | |
246 | 246 | // Re setup payment to update new meta value in object. |
247 | - $payment->update_payment_setup( $payment->ID ); |
|
247 | + $payment->update_payment_setup($payment->ID); |
|
248 | 248 | |
249 | 249 | // Update form id in payment logs. |
250 | - Give()->async_process->data( array( |
|
251 | - 'data' => array( $new_form_id, $payment_id ), |
|
250 | + Give()->async_process->data(array( |
|
251 | + 'data' => array($new_form_id, $payment_id), |
|
252 | 252 | 'hook' => 'give_update_log_form_id', |
253 | - ) )->dispatch(); |
|
253 | + ))->dispatch(); |
|
254 | 254 | } |
255 | 255 | |
256 | 256 | // Update price id if current form is variable form. |
257 | 257 | /* @var Give_Donate_Form $form */ |
258 | - $form = new Give_Donate_Form( $payment->form_id ); |
|
258 | + $form = new Give_Donate_Form($payment->form_id); |
|
259 | 259 | |
260 | - if ( isset( $data['give-variable-price'] ) && $form->has_variable_prices() ) { |
|
260 | + if (isset($data['give-variable-price']) && $form->has_variable_prices()) { |
|
261 | 261 | |
262 | 262 | // Get payment meta data. |
263 | 263 | $payment_meta = $payment->get_meta(); |
@@ -266,9 +266,9 @@ discard block |
||
266 | 266 | $price_id = ''; |
267 | 267 | |
268 | 268 | // Get price info |
269 | - if( 0 <= $data['give-variable-price'] ) { |
|
270 | - foreach ( $form->prices as $variable_price ) { |
|
271 | - if( $new_total === give_maybe_sanitize_amount( $variable_price['_give_amount'] ) ) { |
|
269 | + if (0 <= $data['give-variable-price']) { |
|
270 | + foreach ($form->prices as $variable_price) { |
|
271 | + if ($new_total === give_maybe_sanitize_amount($variable_price['_give_amount'])) { |
|
272 | 272 | $price_info = $variable_price; |
273 | 273 | break; |
274 | 274 | } |
@@ -276,15 +276,15 @@ discard block |
||
276 | 276 | } |
277 | 277 | |
278 | 278 | // Set price id. |
279 | - if( ! empty( $price_info ) ) { |
|
279 | + if ( ! empty($price_info)) { |
|
280 | 280 | $price_id = $data['give-variable-price']; |
281 | 281 | |
282 | - if( $data['give-variable-price'] !== $price_info['_give_id']['level_id'] ) { |
|
282 | + if ($data['give-variable-price'] !== $price_info['_give_id']['level_id']) { |
|
283 | 283 | // Set price id to amount match. |
284 | 284 | $price_id = $price_info['_give_id']['level_id']; |
285 | 285 | } |
286 | 286 | |
287 | - } elseif( $form->is_custom_price_mode() ){ |
|
287 | + } elseif ($form->is_custom_price_mode()) { |
|
288 | 288 | $price_id = 'custom'; |
289 | 289 | } |
290 | 290 | |
@@ -292,11 +292,11 @@ discard block |
||
292 | 292 | $payment_meta['price_id'] = $price_id; |
293 | 293 | |
294 | 294 | // Update payment give form meta data. |
295 | - $payment->update_meta( '_give_payment_price_id', $price_id ); |
|
296 | - $payment->update_meta( '_give_payment_meta', $payment_meta ); |
|
295 | + $payment->update_meta('_give_payment_price_id', $price_id); |
|
296 | + $payment->update_meta('_give_payment_meta', $payment_meta); |
|
297 | 297 | |
298 | 298 | // Re setup payment to update new meta value in object. |
299 | - $payment->update_payment_setup( $payment->ID ); |
|
299 | + $payment->update_payment_setup($payment->ID); |
|
300 | 300 | } |
301 | 301 | |
302 | 302 | /** |
@@ -307,13 +307,13 @@ discard block |
||
307 | 307 | * |
308 | 308 | * @param int $payment_id The ID of the payment. |
309 | 309 | */ |
310 | - do_action( 'give_updated_edited_donation', $payment_id ); |
|
310 | + do_action('give_updated_edited_donation', $payment_id); |
|
311 | 311 | |
312 | - wp_safe_redirect( admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&give-message=payment-updated&id=' . $payment_id ) ); |
|
312 | + wp_safe_redirect(admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&give-message=payment-updated&id='.$payment_id)); |
|
313 | 313 | exit; |
314 | 314 | } |
315 | 315 | |
316 | -add_action( 'give_update_payment_details', 'give_update_payment_details' ); |
|
316 | +add_action('give_update_payment_details', 'give_update_payment_details'); |
|
317 | 317 | |
318 | 318 | /** |
319 | 319 | * Trigger a Donation Deletion. |
@@ -324,48 +324,48 @@ discard block |
||
324 | 324 | * |
325 | 325 | * @return void |
326 | 326 | */ |
327 | -function give_trigger_donation_delete( $data ) { |
|
328 | - if ( wp_verify_nonce( $data['_wpnonce'], 'give_donation_nonce' ) ) { |
|
327 | +function give_trigger_donation_delete($data) { |
|
328 | + if (wp_verify_nonce($data['_wpnonce'], 'give_donation_nonce')) { |
|
329 | 329 | |
330 | - $payment_id = absint( $data['purchase_id'] ); |
|
330 | + $payment_id = absint($data['purchase_id']); |
|
331 | 331 | |
332 | - if ( ! current_user_can( 'edit_give_payments', $payment_id ) ) { |
|
333 | - wp_die( __( 'You do not have permission to edit payments.', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
332 | + if ( ! current_user_can('edit_give_payments', $payment_id)) { |
|
333 | + wp_die(__('You do not have permission to edit payments.', 'give'), __('Error', 'give'), array('response' => 403)); |
|
334 | 334 | } |
335 | 335 | |
336 | - give_delete_donation( $payment_id ); |
|
337 | - wp_redirect( admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&give-message=donation_deleted' ) ); |
|
336 | + give_delete_donation($payment_id); |
|
337 | + wp_redirect(admin_url('edit.php?post_type=give_forms&page=give-payment-history&give-message=donation_deleted')); |
|
338 | 338 | give_die(); |
339 | 339 | } |
340 | 340 | } |
341 | 341 | |
342 | -add_action( 'give_delete_payment', 'give_trigger_donation_delete' ); |
|
342 | +add_action('give_delete_payment', 'give_trigger_donation_delete'); |
|
343 | 343 | |
344 | 344 | /** |
345 | 345 | * AJAX Store Donation Note |
346 | 346 | */ |
347 | 347 | function give_ajax_store_payment_note() { |
348 | 348 | |
349 | - $payment_id = absint( $_POST['payment_id'] ); |
|
350 | - $note = wp_kses( $_POST['note'], array() ); |
|
349 | + $payment_id = absint($_POST['payment_id']); |
|
350 | + $note = wp_kses($_POST['note'], array()); |
|
351 | 351 | |
352 | - if ( ! current_user_can( 'edit_give_payments', $payment_id ) ) { |
|
353 | - wp_die( __( 'You do not have permission to edit payments.', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
352 | + if ( ! current_user_can('edit_give_payments', $payment_id)) { |
|
353 | + wp_die(__('You do not have permission to edit payments.', 'give'), __('Error', 'give'), array('response' => 403)); |
|
354 | 354 | } |
355 | 355 | |
356 | - if ( empty( $payment_id ) ) { |
|
357 | - die( '-1' ); |
|
356 | + if (empty($payment_id)) { |
|
357 | + die('-1'); |
|
358 | 358 | } |
359 | 359 | |
360 | - if ( empty( $note ) ) { |
|
361 | - die( '-1' ); |
|
360 | + if (empty($note)) { |
|
361 | + die('-1'); |
|
362 | 362 | } |
363 | 363 | |
364 | - $note_id = give_insert_payment_note( $payment_id, $note ); |
|
365 | - die( give_get_payment_note_html( $note_id ) ); |
|
364 | + $note_id = give_insert_payment_note($payment_id, $note); |
|
365 | + die(give_get_payment_note_html($note_id)); |
|
366 | 366 | } |
367 | 367 | |
368 | -add_action( 'wp_ajax_give_insert_payment_note', 'give_ajax_store_payment_note' ); |
|
368 | +add_action('wp_ajax_give_insert_payment_note', 'give_ajax_store_payment_note'); |
|
369 | 369 | |
370 | 370 | /** |
371 | 371 | * Triggers a donation note deletion without ajax |
@@ -376,24 +376,24 @@ discard block |
||
376 | 376 | * |
377 | 377 | * @return void |
378 | 378 | */ |
379 | -function give_trigger_payment_note_deletion( $data ) { |
|
379 | +function give_trigger_payment_note_deletion($data) { |
|
380 | 380 | |
381 | - if ( ! wp_verify_nonce( $data['_wpnonce'], 'give_delete_payment_note_' . $data['note_id'] ) ) { |
|
381 | + if ( ! wp_verify_nonce($data['_wpnonce'], 'give_delete_payment_note_'.$data['note_id'])) { |
|
382 | 382 | return; |
383 | 383 | } |
384 | 384 | |
385 | - if ( ! current_user_can( 'edit_give_payments', $data['payment_id'] ) ) { |
|
386 | - wp_die( __( 'You do not have permission to edit payments.', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
385 | + if ( ! current_user_can('edit_give_payments', $data['payment_id'])) { |
|
386 | + wp_die(__('You do not have permission to edit payments.', 'give'), __('Error', 'give'), array('response' => 403)); |
|
387 | 387 | } |
388 | 388 | |
389 | - $edit_order_url = admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&give-message=donation-note-deleted&id=' . absint( $data['payment_id'] ) ); |
|
389 | + $edit_order_url = admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&give-message=donation-note-deleted&id='.absint($data['payment_id'])); |
|
390 | 390 | |
391 | - give_delete_payment_note( $data['note_id'], $data['payment_id'] ); |
|
391 | + give_delete_payment_note($data['note_id'], $data['payment_id']); |
|
392 | 392 | |
393 | - wp_redirect( $edit_order_url ); |
|
393 | + wp_redirect($edit_order_url); |
|
394 | 394 | } |
395 | 395 | |
396 | -add_action( 'give_delete_payment_note', 'give_trigger_payment_note_deletion' ); |
|
396 | +add_action('give_delete_payment_note', 'give_trigger_payment_note_deletion'); |
|
397 | 397 | |
398 | 398 | /** |
399 | 399 | * Delete a payment note deletion with ajax |
@@ -404,16 +404,16 @@ discard block |
||
404 | 404 | */ |
405 | 405 | function give_ajax_delete_payment_note() { |
406 | 406 | |
407 | - if ( ! current_user_can( 'edit_give_payments', $_POST['payment_id'] ) ) { |
|
408 | - wp_die( __( 'You do not have permission to edit payments.', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
407 | + if ( ! current_user_can('edit_give_payments', $_POST['payment_id'])) { |
|
408 | + wp_die(__('You do not have permission to edit payments.', 'give'), __('Error', 'give'), array('response' => 403)); |
|
409 | 409 | } |
410 | 410 | |
411 | - if ( give_delete_payment_note( $_POST['note_id'], $_POST['payment_id'] ) ) { |
|
412 | - die( '1' ); |
|
411 | + if (give_delete_payment_note($_POST['note_id'], $_POST['payment_id'])) { |
|
412 | + die('1'); |
|
413 | 413 | } else { |
414 | - die( '-1' ); |
|
414 | + die('-1'); |
|
415 | 415 | } |
416 | 416 | |
417 | 417 | } |
418 | 418 | |
419 | -add_action( 'wp_ajax_give_delete_payment_note', 'give_ajax_delete_payment_note' ); |
|
419 | +add_action('wp_ajax_give_delete_payment_note', 'give_ajax_delete_payment_note'); |
@@ -323,10 +323,10 @@ |
||
323 | 323 | </div> |
324 | 324 | |
325 | 325 | <?php |
326 | - // Display the transaction ID present. |
|
327 | - // The transaction ID is the charge ID from the gateway. |
|
328 | - // For instance, stripe "ch_BzvwYCchqOy5Nt". |
|
329 | - if ( $transaction_id != $payment_id ) : ?> |
|
326 | + // Display the transaction ID present. |
|
327 | + // The transaction ID is the charge ID from the gateway. |
|
328 | + // For instance, stripe "ch_BzvwYCchqOy5Nt". |
|
329 | + if ( $transaction_id != $payment_id ) : ?> |
|
330 | 330 | <div class="give-order-tx-id give-admin-box-inside"> |
331 | 331 | <p> |
332 | 332 | <strong><?php _e( 'Transaction ID:', 'give' ); ?> <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo sprintf( esc_attr__( 'The transaction ID within %s.', 'give' ), $gateway); ?>"></span></strong> |
@@ -10,13 +10,13 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
17 | -if ( ! current_user_can( 'view_give_payments' ) ) { |
|
17 | +if ( ! current_user_can('view_give_payments')) { |
|
18 | 18 | wp_die( |
19 | - __( 'Sorry, you are not allowed to access this page.', 'give' ), __( 'Error', 'give' ), array( |
|
19 | + __('Sorry, you are not allowed to access this page.', 'give'), __('Error', 'give'), array( |
|
20 | 20 | 'response' => 403, |
21 | 21 | ) |
22 | 22 | ); |
@@ -28,35 +28,35 @@ discard block |
||
28 | 28 | * @since 1.0 |
29 | 29 | * @return void |
30 | 30 | */ |
31 | -if ( ! isset( $_GET['id'] ) || ! is_numeric( $_GET['id'] ) ) { |
|
32 | - wp_die( __( 'Donation ID not supplied. Please try again.', 'give' ), __( 'Error', 'give' ), array( 'response' => 400 ) ); |
|
31 | +if ( ! isset($_GET['id']) || ! is_numeric($_GET['id'])) { |
|
32 | + wp_die(__('Donation ID not supplied. Please try again.', 'give'), __('Error', 'give'), array('response' => 400)); |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | // Setup the variables |
36 | -$payment_id = absint( $_GET['id'] ); |
|
37 | -$payment = new Give_Payment( $payment_id ); |
|
36 | +$payment_id = absint($_GET['id']); |
|
37 | +$payment = new Give_Payment($payment_id); |
|
38 | 38 | |
39 | 39 | // Sanity check... fail if donation ID is invalid |
40 | 40 | $payment_exists = $payment->ID; |
41 | -if ( empty( $payment_exists ) ) { |
|
42 | - wp_die( __( 'The specified ID does not belong to a donation. Please try again.', 'give' ), __( 'Error', 'give' ), array( 'response' => 400 ) ); |
|
41 | +if (empty($payment_exists)) { |
|
42 | + wp_die(__('The specified ID does not belong to a donation. Please try again.', 'give'), __('Error', 'give'), array('response' => 400)); |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | $number = $payment->number; |
46 | 46 | $payment_meta = $payment->get_meta(); |
47 | 47 | |
48 | -$company_name = ! empty( $payment_meta['_give_donation_company'] ) ? esc_attr( $payment_meta['_give_donation_company'] ) : ''; |
|
49 | -$transaction_id = esc_attr( $payment->transaction_id ); |
|
48 | +$company_name = ! empty($payment_meta['_give_donation_company']) ? esc_attr($payment_meta['_give_donation_company']) : ''; |
|
49 | +$transaction_id = esc_attr($payment->transaction_id); |
|
50 | 50 | $user_id = $payment->user_id; |
51 | 51 | $donor_id = $payment->customer_id; |
52 | -$payment_date = strtotime( $payment->date ); |
|
53 | -$user_info = give_get_payment_meta_user_info( $payment_id ); |
|
52 | +$payment_date = strtotime($payment->date); |
|
53 | +$user_info = give_get_payment_meta_user_info($payment_id); |
|
54 | 54 | $address = $payment->address; |
55 | 55 | $currency_code = $payment->currency; |
56 | 56 | $gateway = $payment->gateway; |
57 | 57 | $currency_code = $payment->currency; |
58 | 58 | $payment_mode = $payment->mode; |
59 | -$base_url = admin_url( 'edit.php?post_type=give_forms&page=give-payment-history' ); |
|
59 | +$base_url = admin_url('edit.php?post_type=give_forms&page=give-payment-history'); |
|
60 | 60 | |
61 | 61 | ?> |
62 | 62 | <div class="wrap give-wrap"> |
@@ -65,13 +65,13 @@ discard block |
||
65 | 65 | <?php |
66 | 66 | printf( |
67 | 67 | /* translators: %s: donation number */ |
68 | - esc_html__( 'Donation %s', 'give' ), |
|
68 | + esc_html__('Donation %s', 'give'), |
|
69 | 69 | $number |
70 | 70 | ); |
71 | - if ( $payment_mode == 'test' ) { |
|
71 | + if ($payment_mode == 'test') { |
|
72 | 72 | echo Give()->tooltips->render_span(array( |
73 | - 'label' => __( 'This donation was made in test mode.', 'give' ), |
|
74 | - 'tag_content' => __( 'Test Donation', 'give' ), |
|
73 | + 'label' => __('This donation was made in test mode.', 'give'), |
|
74 | + 'tag_content' => __('Test Donation', 'give'), |
|
75 | 75 | 'position'=> 'right', |
76 | 76 | 'attributes' => array( |
77 | 77 | 'id' => 'test-payment-label', |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | * |
91 | 91 | * @param int $payment_id Payment id. |
92 | 92 | */ |
93 | - do_action( 'give_view_donation_details_before', $payment_id ); |
|
93 | + do_action('give_view_donation_details_before', $payment_id); |
|
94 | 94 | ?> |
95 | 95 | |
96 | 96 | <hr class="wp-header-end"> |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | * |
105 | 105 | * @param int $payment_id Payment id. |
106 | 106 | */ |
107 | - do_action( 'give_view_donation_details_form_top', $payment_id ); |
|
107 | + do_action('give_view_donation_details_form_top', $payment_id); |
|
108 | 108 | ?> |
109 | 109 | <div id="poststuff"> |
110 | 110 | <div id="give-dashboard-widgets-wrap"> |
@@ -120,16 +120,16 @@ discard block |
||
120 | 120 | * |
121 | 121 | * @param int $payment_id Payment id. |
122 | 122 | */ |
123 | - do_action( 'give_view_donation_details_sidebar_before', $payment_id ); |
|
123 | + do_action('give_view_donation_details_sidebar_before', $payment_id); |
|
124 | 124 | ?> |
125 | 125 | |
126 | 126 | <div id="give-order-update" class="postbox give-order-data"> |
127 | 127 | |
128 | 128 | <div class="give-order-top"> |
129 | - <h3 class="hndle"><?php _e( 'Update Donation', 'give' ); ?></h3> |
|
129 | + <h3 class="hndle"><?php _e('Update Donation', 'give'); ?></h3> |
|
130 | 130 | |
131 | 131 | <?php |
132 | - if ( current_user_can( 'view_give_payments' ) ) { |
|
132 | + if (current_user_can('view_give_payments')) { |
|
133 | 133 | echo sprintf( |
134 | 134 | '<span class="delete-donation" id="delete-donation-%d"><a class="delete-single-donation delete-donation-button dashicons dashicons-trash" href="%s" aria-label="%s"></a></span>', |
135 | 135 | $payment_id, |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | ), $base_url |
142 | 142 | ), 'give_donation_nonce' |
143 | 143 | ), |
144 | - sprintf( __( 'Delete Donation %s', 'give' ), $payment_id ) |
|
144 | + sprintf(__('Delete Donation %s', 'give'), $payment_id) |
|
145 | 145 | ); |
146 | 146 | } |
147 | 147 | ?> |
@@ -158,33 +158,33 @@ discard block |
||
158 | 158 | * |
159 | 159 | * @param int $payment_id Payment id. |
160 | 160 | */ |
161 | - do_action( 'give_view_donation_details_totals_before', $payment_id ); |
|
161 | + do_action('give_view_donation_details_totals_before', $payment_id); |
|
162 | 162 | ?> |
163 | 163 | |
164 | 164 | <div class="give-admin-box-inside"> |
165 | 165 | <p> |
166 | - <label for="give-payment-status" class="strong"><?php _e( 'Status:', 'give' ); ?></label> |
|
166 | + <label for="give-payment-status" class="strong"><?php _e('Status:', 'give'); ?></label> |
|
167 | 167 | <select id="give-payment-status" name="give-payment-status" class="medium-text"> |
168 | - <?php foreach ( give_get_payment_statuses() as $key => $status ) : ?> |
|
169 | - <option value="<?php echo esc_attr( $key ); ?>"<?php selected( $payment->status, $key, true ); ?>><?php echo esc_html( $status ); ?></option> |
|
168 | + <?php foreach (give_get_payment_statuses() as $key => $status) : ?> |
|
169 | + <option value="<?php echo esc_attr($key); ?>"<?php selected($payment->status, $key, true); ?>><?php echo esc_html($status); ?></option> |
|
170 | 170 | <?php endforeach; ?> |
171 | 171 | </select> |
172 | - <span class="give-donation-status status-<?php echo sanitize_title( $payment->status ); ?>"><span class="give-donation-status-icon"></span></span> |
|
172 | + <span class="give-donation-status status-<?php echo sanitize_title($payment->status); ?>"><span class="give-donation-status-icon"></span></span> |
|
173 | 173 | </p> |
174 | 174 | </div> |
175 | 175 | |
176 | 176 | <div class="give-admin-box-inside"> |
177 | 177 | <p> |
178 | - <label for="give-payment-date" class="strong"><?php _e( 'Date:', 'give' ); ?></label> |
|
179 | - <input type="text" id="give-payment-date" name="give-payment-date" value="<?php echo esc_attr( date( 'm/d/Y', $payment_date ) ); ?>" class="medium-text give_datepicker"/> |
|
178 | + <label for="give-payment-date" class="strong"><?php _e('Date:', 'give'); ?></label> |
|
179 | + <input type="text" id="give-payment-date" name="give-payment-date" value="<?php echo esc_attr(date('m/d/Y', $payment_date)); ?>" class="medium-text give_datepicker"/> |
|
180 | 180 | </p> |
181 | 181 | </div> |
182 | 182 | |
183 | 183 | <div class="give-admin-box-inside"> |
184 | 184 | <p> |
185 | - <label for="give-payment-time-hour" class="strong"><?php _e( 'Time:', 'give' ); ?></label> |
|
186 | - <input type="number" step="1" max="24" id="give-payment-time-hour" name="give-payment-time-hour" value="<?php echo esc_attr( date_i18n( 'H', $payment_date ) ); ?>" class="small-text give-payment-time-hour"/> : |
|
187 | - <input type="number" step="1" max="59" id="give-payment-time-min" name="give-payment-time-min" value="<?php echo esc_attr( date( 'i', $payment_date ) ); ?>" class="small-text give-payment-time-min"/> |
|
185 | + <label for="give-payment-time-hour" class="strong"><?php _e('Time:', 'give'); ?></label> |
|
186 | + <input type="number" step="1" max="24" id="give-payment-time-hour" name="give-payment-time-hour" value="<?php echo esc_attr(date_i18n('H', $payment_date)); ?>" class="small-text give-payment-time-hour"/> : |
|
187 | + <input type="number" step="1" max="59" id="give-payment-time-min" name="give-payment-time-min" value="<?php echo esc_attr(date('i', $payment_date)); ?>" class="small-text give-payment-time-min"/> |
|
188 | 188 | </p> |
189 | 189 | </div> |
190 | 190 | |
@@ -198,14 +198,14 @@ discard block |
||
198 | 198 | * |
199 | 199 | * @param int $payment_id Payment id. |
200 | 200 | */ |
201 | - do_action( 'give_view_donation_details_update_inner', $payment_id ); |
|
201 | + do_action('give_view_donation_details_update_inner', $payment_id); |
|
202 | 202 | ?> |
203 | 203 | |
204 | 204 | <div class="give-order-payment give-admin-box-inside"> |
205 | 205 | <p> |
206 | - <label for="give-payment-total" class="strong"><?php _e( 'Total Donation:', 'give' ); ?></label> |
|
207 | - <?php echo give_currency_symbol( $payment->currency ); ?> |
|
208 | - <input id="give-payment-total" name="give-payment-total" type="text" class="small-text give-price-field" value="<?php echo esc_attr( give_format_decimal( give_donation_amount( $payment_id ), false, false ) ); ?>"/> |
|
206 | + <label for="give-payment-total" class="strong"><?php _e('Total Donation:', 'give'); ?></label> |
|
207 | + <?php echo give_currency_symbol($payment->currency); ?> |
|
208 | + <input id="give-payment-total" name="give-payment-total" type="text" class="small-text give-price-field" value="<?php echo esc_attr(give_format_decimal(give_donation_amount($payment_id), false, false)); ?>"/> |
|
209 | 209 | </p> |
210 | 210 | </div> |
211 | 211 | |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | * |
218 | 218 | * @param int $payment_id Payment id. |
219 | 219 | */ |
220 | - do_action( 'give_view_donation_details_totals_after', $payment_id ); |
|
220 | + do_action('give_view_donation_details_totals_after', $payment_id); |
|
221 | 221 | ?> |
222 | 222 | |
223 | 223 | </div> |
@@ -235,17 +235,17 @@ discard block |
||
235 | 235 | * |
236 | 236 | * @param int $payment_id Payment id. |
237 | 237 | */ |
238 | - do_action( 'give_view_donation_details_update_before', $payment_id ); |
|
238 | + do_action('give_view_donation_details_update_before', $payment_id); |
|
239 | 239 | ?> |
240 | 240 | |
241 | 241 | <div id="major-publishing-actions"> |
242 | 242 | <div id="publishing-action"> |
243 | 243 | |
244 | 244 | <input type="submit" class="button button-primary right" |
245 | - value="<?php _e( 'Save Donation', 'give' ); ?>"/> |
|
245 | + value="<?php _e('Save Donation', 'give'); ?>"/> |
|
246 | 246 | |
247 | 247 | <?php |
248 | - if ( give_is_payment_complete( $payment_id ) ) { |
|
248 | + if (give_is_payment_complete($payment_id)) { |
|
249 | 249 | echo sprintf( |
250 | 250 | '<a href="%1$s" id="give-resend-receipt" class="button-secondary right">%2$s</a>', |
251 | 251 | esc_url( |
@@ -256,7 +256,7 @@ discard block |
||
256 | 256 | ) |
257 | 257 | ) |
258 | 258 | ), |
259 | - __( 'Resend Receipt', 'give' ) |
|
259 | + __('Resend Receipt', 'give') |
|
260 | 260 | ); |
261 | 261 | } |
262 | 262 | ?> |
@@ -271,7 +271,7 @@ discard block |
||
271 | 271 | * |
272 | 272 | * @param int $payment_id Payment id. |
273 | 273 | */ |
274 | - do_action( 'give_view_donation_details_update_after', $payment_id ); |
|
274 | + do_action('give_view_donation_details_update_after', $payment_id); |
|
275 | 275 | ?> |
276 | 276 | |
277 | 277 | </div> |
@@ -282,7 +282,7 @@ discard block |
||
282 | 282 | |
283 | 283 | <div id="give-order-details" class="postbox give-order-data"> |
284 | 284 | |
285 | - <h3 class="hndle"><?php _e( 'Donation Meta', 'give' ); ?></h3> |
|
285 | + <h3 class="hndle"><?php _e('Donation Meta', 'give'); ?></h3> |
|
286 | 286 | |
287 | 287 | <div class="inside"> |
288 | 288 | <div class="give-admin-box"> |
@@ -295,30 +295,30 @@ discard block |
||
295 | 295 | * |
296 | 296 | * @param int $payment_id Payment id. |
297 | 297 | */ |
298 | - do_action( 'give_view_donation_details_payment_meta_before', $payment_id ); |
|
298 | + do_action('give_view_donation_details_payment_meta_before', $payment_id); |
|
299 | 299 | |
300 | - $gateway = give_get_payment_gateway( $payment_id ); |
|
301 | - if ( $gateway ) : |
|
300 | + $gateway = give_get_payment_gateway($payment_id); |
|
301 | + if ($gateway) : |
|
302 | 302 | ?> |
303 | 303 | <div class="give-order-gateway give-admin-box-inside"> |
304 | 304 | <p> |
305 | - <strong><?php _e( 'Gateway:', 'give' ); ?></strong> |
|
306 | - <?php echo give_get_gateway_admin_label( $gateway ); ?> |
|
305 | + <strong><?php _e('Gateway:', 'give'); ?></strong> |
|
306 | + <?php echo give_get_gateway_admin_label($gateway); ?> |
|
307 | 307 | </p> |
308 | 308 | </div> |
309 | 309 | <?php endif; ?> |
310 | 310 | |
311 | 311 | <div class="give-order-payment-key give-admin-box-inside"> |
312 | 312 | <p> |
313 | - <strong><?php _e( 'Key:', 'give' ); ?></strong> |
|
314 | - <?php echo give_get_payment_key( $payment_id ); ?> |
|
313 | + <strong><?php _e('Key:', 'give'); ?></strong> |
|
314 | + <?php echo give_get_payment_key($payment_id); ?> |
|
315 | 315 | </p> |
316 | 316 | </div> |
317 | 317 | |
318 | 318 | <div class="give-order-ip give-admin-box-inside"> |
319 | 319 | <p> |
320 | - <strong><?php _e( 'IP:', 'give' ); ?></strong> |
|
321 | - <?php echo esc_html( give_get_payment_user_ip( $payment_id ) ); ?> |
|
320 | + <strong><?php _e('IP:', 'give'); ?></strong> |
|
321 | + <?php echo esc_html(give_get_payment_user_ip($payment_id)); ?> |
|
322 | 322 | </p> |
323 | 323 | </div> |
324 | 324 | |
@@ -326,18 +326,18 @@ discard block |
||
326 | 326 | // Display the transaction ID present. |
327 | 327 | // The transaction ID is the charge ID from the gateway. |
328 | 328 | // For instance, stripe "ch_BzvwYCchqOy5Nt". |
329 | - if ( $transaction_id != $payment_id ) : ?> |
|
329 | + if ($transaction_id != $payment_id) : ?> |
|
330 | 330 | <div class="give-order-tx-id give-admin-box-inside"> |
331 | 331 | <p> |
332 | - <strong><?php _e( 'Transaction ID:', 'give' ); ?> <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo sprintf( esc_attr__( 'The transaction ID within %s.', 'give' ), $gateway); ?>"></span></strong> |
|
333 | - <?php echo apply_filters( "give_payment_details_transaction_id-{$gateway}", $transaction_id, $payment_id ); ?> |
|
332 | + <strong><?php _e('Transaction ID:', 'give'); ?> <span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo sprintf(esc_attr__('The transaction ID within %s.', 'give'), $gateway); ?>"></span></strong> |
|
333 | + <?php echo apply_filters("give_payment_details_transaction_id-{$gateway}", $transaction_id, $payment_id); ?> |
|
334 | 334 | </p> |
335 | 335 | </div> |
336 | 336 | <?php endif; ?> |
337 | 337 | |
338 | 338 | <div class="give-admin-box-inside"> |
339 | - <p><?php $purchase_url = admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&donor=' . absint( give_get_payment_donor_id( $payment_id ) ) ); ?> |
|
340 | - <a href="<?php echo $purchase_url; ?>"><?php _e( 'View all donations for this donor »', 'give' ); ?></a> |
|
339 | + <p><?php $purchase_url = admin_url('edit.php?post_type=give_forms&page=give-payment-history&donor='.absint(give_get_payment_donor_id($payment_id))); ?> |
|
340 | + <a href="<?php echo $purchase_url; ?>"><?php _e('View all donations for this donor »', 'give'); ?></a> |
|
341 | 341 | </p> |
342 | 342 | </div> |
343 | 343 | |
@@ -349,7 +349,7 @@ discard block |
||
349 | 349 | * |
350 | 350 | * @param int $payment_id Payment id. |
351 | 351 | */ |
352 | - do_action( 'give_view_donation_details_payment_meta_after', $payment_id ); |
|
352 | + do_action('give_view_donation_details_payment_meta_after', $payment_id); |
|
353 | 353 | ?> |
354 | 354 | |
355 | 355 | </div> |
@@ -369,7 +369,7 @@ discard block |
||
369 | 369 | * |
370 | 370 | * @param int $payment_id Payment id. |
371 | 371 | */ |
372 | - do_action( 'give_view_donation_details_sidebar_after', $payment_id ); |
|
372 | + do_action('give_view_donation_details_sidebar_after', $payment_id); |
|
373 | 373 | ?> |
374 | 374 | |
375 | 375 | </div> |
@@ -389,31 +389,31 @@ discard block |
||
389 | 389 | * |
390 | 390 | * @param int $payment_id Payment id. |
391 | 391 | */ |
392 | - do_action( 'give_view_donation_details_main_before', $payment_id ); |
|
392 | + do_action('give_view_donation_details_main_before', $payment_id); |
|
393 | 393 | ?> |
394 | 394 | |
395 | 395 | <?php $column_count = 'columns-3'; ?> |
396 | 396 | <div id="give-donation-overview" class="postbox <?php echo $column_count; ?>"> |
397 | - <h3 class="hndle"><?php _e( 'Donation Information', 'give' ); ?></h3> |
|
397 | + <h3 class="hndle"><?php _e('Donation Information', 'give'); ?></h3> |
|
398 | 398 | |
399 | 399 | <div class="inside"> |
400 | 400 | |
401 | 401 | <div class="column-container"> |
402 | 402 | <div class="column"> |
403 | 403 | <p> |
404 | - <strong><?php _e( 'Donation Form ID:', 'give' ); ?></strong><br> |
|
404 | + <strong><?php _e('Donation Form ID:', 'give'); ?></strong><br> |
|
405 | 405 | <?php |
406 | - if ( $payment_meta['form_id'] ) : |
|
406 | + if ($payment_meta['form_id']) : |
|
407 | 407 | printf( |
408 | 408 | '<a href="%1$s">%2$s</a>', |
409 | - admin_url( 'post.php?action=edit&post=' . $payment_meta['form_id'] ), |
|
409 | + admin_url('post.php?action=edit&post='.$payment_meta['form_id']), |
|
410 | 410 | $payment_meta['form_id'] |
411 | 411 | ); |
412 | 412 | endif; |
413 | 413 | ?> |
414 | 414 | </p> |
415 | 415 | <p> |
416 | - <strong><?php esc_html_e( 'Donation Form Title:', 'give' ); ?></strong><br> |
|
416 | + <strong><?php esc_html_e('Donation Form Title:', 'give'); ?></strong><br> |
|
417 | 417 | <?php |
418 | 418 | echo Give()->html->forms_dropdown( |
419 | 419 | array( |
@@ -429,21 +429,21 @@ discard block |
||
429 | 429 | </div> |
430 | 430 | <div class="column"> |
431 | 431 | <p> |
432 | - <strong><?php _e( 'Donation Date:', 'give' ); ?></strong><br> |
|
433 | - <?php echo date_i18n( give_date_format(), $payment_date ); ?> |
|
432 | + <strong><?php _e('Donation Date:', 'give'); ?></strong><br> |
|
433 | + <?php echo date_i18n(give_date_format(), $payment_date); ?> |
|
434 | 434 | </p> |
435 | 435 | <p> |
436 | - <strong><?php _e( 'Donation Level:', 'give' ); ?></strong><br> |
|
436 | + <strong><?php _e('Donation Level:', 'give'); ?></strong><br> |
|
437 | 437 | <span class="give-donation-level"> |
438 | 438 | <?php |
439 | - $var_prices = give_has_variable_prices( $payment_meta['form_id'] ); |
|
440 | - if ( empty( $var_prices ) ) { |
|
441 | - _e( 'n/a', 'give' ); |
|
439 | + $var_prices = give_has_variable_prices($payment_meta['form_id']); |
|
440 | + if (empty($var_prices)) { |
|
441 | + _e('n/a', 'give'); |
|
442 | 442 | } else { |
443 | 443 | $prices_atts = array(); |
444 | - if ( $variable_prices = give_get_variable_prices( $payment_meta['form_id'] ) ) { |
|
445 | - foreach ( $variable_prices as $variable_price ) { |
|
446 | - $prices_atts[ $variable_price['_give_id']['level_id'] ] = give_format_amount( $variable_price['_give_amount'], array( 'sanitize' => false ) ); |
|
444 | + if ($variable_prices = give_get_variable_prices($payment_meta['form_id'])) { |
|
445 | + foreach ($variable_prices as $variable_price) { |
|
446 | + $prices_atts[$variable_price['_give_id']['level_id']] = give_format_amount($variable_price['_give_amount'], array('sanitize' => false)); |
|
447 | 447 | } |
448 | 448 | } |
449 | 449 | // Variable price dropdown options. |
@@ -452,12 +452,12 @@ discard block |
||
452 | 452 | 'name' => 'give-variable-price', |
453 | 453 | 'chosen' => true, |
454 | 454 | 'show_option_all' => '', |
455 | - 'show_option_none' => ( '' === get_post_meta( $payment_id, '_give_payment_price_id', true ) ? __( 'None', 'give' ) : '' ), |
|
456 | - 'select_atts' => 'data-prices=' . esc_attr( wp_json_encode( $prices_atts ) ), |
|
455 | + 'show_option_none' => ('' === get_post_meta($payment_id, '_give_payment_price_id', true) ? __('None', 'give') : ''), |
|
456 | + 'select_atts' => 'data-prices='.esc_attr(wp_json_encode($prices_atts)), |
|
457 | 457 | 'selected' => $payment_meta['price_id'], |
458 | 458 | ); |
459 | 459 | // Render variable prices select tag html. |
460 | - give_get_form_variable_price_dropdown( $variable_price_dropdown_option, true ); |
|
460 | + give_get_form_variable_price_dropdown($variable_price_dropdown_option, true); |
|
461 | 461 | } |
462 | 462 | ?> |
463 | 463 | </span> |
@@ -465,8 +465,8 @@ discard block |
||
465 | 465 | </div> |
466 | 466 | <div class="column"> |
467 | 467 | <p> |
468 | - <strong><?php esc_html_e( 'Total Donation:', 'give' ); ?></strong><br> |
|
469 | - <?php echo give_donation_amount( $payment, true ); ?> |
|
468 | + <strong><?php esc_html_e('Total Donation:', 'give'); ?></strong><br> |
|
469 | + <?php echo give_donation_amount($payment, true); ?> |
|
470 | 470 | </p> |
471 | 471 | |
472 | 472 | <p> |
@@ -480,7 +480,7 @@ discard block |
||
480 | 480 | * |
481 | 481 | * @param int $payment_id Payment id. |
482 | 482 | */ |
483 | - do_action( 'give_donation_details_thead_before', $payment_id ); |
|
483 | + do_action('give_donation_details_thead_before', $payment_id); |
|
484 | 484 | |
485 | 485 | |
486 | 486 | /** |
@@ -492,7 +492,7 @@ discard block |
||
492 | 492 | * |
493 | 493 | * @param int $payment_id Payment id. |
494 | 494 | */ |
495 | - do_action( 'give_donation_details_thead_after', $payment_id ); |
|
495 | + do_action('give_donation_details_thead_after', $payment_id); |
|
496 | 496 | |
497 | 497 | /** |
498 | 498 | * Fires in donation details page, in the donation-information metabox, before the body elements. |
@@ -503,7 +503,7 @@ discard block |
||
503 | 503 | * |
504 | 504 | * @param int $payment_id Payment id. |
505 | 505 | */ |
506 | - do_action( 'give_donation_details_tbody_before', $payment_id ); |
|
506 | + do_action('give_donation_details_tbody_before', $payment_id); |
|
507 | 507 | |
508 | 508 | /** |
509 | 509 | * Fires in donation details page, in the donation-information metabox, after the body elements. |
@@ -514,7 +514,7 @@ discard block |
||
514 | 514 | * |
515 | 515 | * @param int $payment_id Payment id. |
516 | 516 | */ |
517 | - do_action( 'give_donation_details_tbody_after', $payment_id ); |
|
517 | + do_action('give_donation_details_tbody_after', $payment_id); |
|
518 | 518 | ?> |
519 | 519 | </p> |
520 | 520 | </div> |
@@ -534,59 +534,59 @@ discard block |
||
534 | 534 | * |
535 | 535 | * @param int $payment_id Payment id. |
536 | 536 | */ |
537 | - do_action( 'give_view_donation_details_donor_detail_before', $payment_id ); |
|
537 | + do_action('give_view_donation_details_donor_detail_before', $payment_id); |
|
538 | 538 | ?> |
539 | 539 | |
540 | 540 | <div id="give-donor-details" class="postbox"> |
541 | - <h3 class="hndle"><?php _e( 'Donor Details', 'give' ); ?></h3> |
|
541 | + <h3 class="hndle"><?php _e('Donor Details', 'give'); ?></h3> |
|
542 | 542 | |
543 | 543 | <div class="inside"> |
544 | 544 | |
545 | - <?php $donor = new Give_Donor( $donor_id ); ?> |
|
545 | + <?php $donor = new Give_Donor($donor_id); ?> |
|
546 | 546 | |
547 | 547 | <div class="column-container donor-info"> |
548 | 548 | <div class="column"> |
549 | 549 | <p> |
550 | - <strong><?php _e( 'Donor ID:', 'give' ); ?></strong><br> |
|
550 | + <strong><?php _e('Donor ID:', 'give'); ?></strong><br> |
|
551 | 551 | <?php |
552 | - if ( ! empty( $donor->id ) ) { |
|
552 | + if ( ! empty($donor->id)) { |
|
553 | 553 | printf( |
554 | 554 | '<a href="%1$s">%2$s</a>', |
555 | - admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $donor->id ), |
|
555 | + admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$donor->id), |
|
556 | 556 | $donor->id |
557 | 557 | ); |
558 | 558 | } |
559 | 559 | ?> |
560 | - <span>(<a href="#new" class="give-payment-new-donor"><?php _e( 'Create New Donor', 'give' ); ?></a>)</span> |
|
560 | + <span>(<a href="#new" class="give-payment-new-donor"><?php _e('Create New Donor', 'give'); ?></a>)</span> |
|
561 | 561 | </p> |
562 | 562 | <p> |
563 | - <strong><?php _e( 'Donor Since:', 'give' ); ?></strong><br> |
|
564 | - <?php echo date_i18n( give_date_format(), strtotime( $donor->date_created ) ) ?> |
|
563 | + <strong><?php _e('Donor Since:', 'give'); ?></strong><br> |
|
564 | + <?php echo date_i18n(give_date_format(), strtotime($donor->date_created)) ?> |
|
565 | 565 | </p> |
566 | 566 | </div> |
567 | 567 | <div class="column"> |
568 | 568 | <p> |
569 | - <strong><?php _e( 'Donor Name:', 'give' ); ?></strong><br> |
|
569 | + <strong><?php _e('Donor Name:', 'give'); ?></strong><br> |
|
570 | 570 | <?php |
571 | - $donor_billing_name = give_get_donor_name_by( $payment_id, 'donation' ); |
|
572 | - $donor_name = give_get_donor_name_by( $donor_id, 'donor' ); |
|
571 | + $donor_billing_name = give_get_donor_name_by($payment_id, 'donation'); |
|
572 | + $donor_name = give_get_donor_name_by($donor_id, 'donor'); |
|
573 | 573 | |
574 | 574 | // Check whether the donor name and WP_User name is same or not. |
575 | - if ( sanitize_title( $donor_billing_name ) != sanitize_title( $donor_name ) ) { |
|
576 | - echo $donor_billing_name . ' (<a href="' . esc_url( admin_url( "edit.php?post_type=give_forms&page=give-donors&view=overview&id=$donor_id" ) ) . '">' . $donor_name . '</a>)'; |
|
575 | + if (sanitize_title($donor_billing_name) != sanitize_title($donor_name)) { |
|
576 | + echo $donor_billing_name.' (<a href="'.esc_url(admin_url("edit.php?post_type=give_forms&page=give-donors&view=overview&id=$donor_id")).'">'.$donor_name.'</a>)'; |
|
577 | 577 | } else { |
578 | 578 | echo $donor_name; |
579 | 579 | } |
580 | 580 | ?> |
581 | 581 | </p> |
582 | 582 | <p> |
583 | - <strong><?php _e( 'Donor Email:', 'give' ); ?></strong><br> |
|
583 | + <strong><?php _e('Donor Email:', 'give'); ?></strong><br> |
|
584 | 584 | <?php echo $donor->email; ?> |
585 | 585 | </p> |
586 | 586 | </div> |
587 | 587 | <div class="column"> |
588 | 588 | <p> |
589 | - <strong><?php _e( 'Change Donor:', 'give' ); ?></strong><br> |
|
589 | + <strong><?php _e('Change Donor:', 'give'); ?></strong><br> |
|
590 | 590 | <?php |
591 | 591 | echo Give()->html->donor_dropdown( |
592 | 592 | array( |
@@ -597,9 +597,9 @@ discard block |
||
597 | 597 | ?> |
598 | 598 | </p> |
599 | 599 | <p> |
600 | - <?php if ( ! empty( $company_name ) ) { |
|
600 | + <?php if ( ! empty($company_name)) { |
|
601 | 601 | ?> |
602 | - <strong><?php esc_html_e( 'Company Name:', 'give' ); ?></strong><br> |
|
602 | + <strong><?php esc_html_e('Company Name:', 'give'); ?></strong><br> |
|
603 | 603 | <?php |
604 | 604 | echo $company_name; |
605 | 605 | } ?> |
@@ -610,19 +610,19 @@ discard block |
||
610 | 610 | <div class="column-container new-donor" style="display: none"> |
611 | 611 | <div class="column"> |
612 | 612 | <p> |
613 | - <label for="give-new-donor-first-name"><?php _e( 'New Donor First Name:', 'give' ); ?></label> |
|
613 | + <label for="give-new-donor-first-name"><?php _e('New Donor First Name:', 'give'); ?></label> |
|
614 | 614 | <input id="give-new-donor-first-name" type="text" name="give-new-donor-first-name" value="" class="medium-text"/> |
615 | 615 | </p> |
616 | 616 | </div> |
617 | 617 | <div class="column"> |
618 | 618 | <p> |
619 | - <label for="give-new-donor-last-name"><?php _e( 'New Donor Last Name:', 'give' ); ?></label> |
|
619 | + <label for="give-new-donor-last-name"><?php _e('New Donor Last Name:', 'give'); ?></label> |
|
620 | 620 | <input id="give-new-donor-last-name" type="text" name="give-new-donor-last-name" value="" class="medium-text"/> |
621 | 621 | </p> |
622 | 622 | </div> |
623 | 623 | <div class="column"> |
624 | 624 | <p> |
625 | - <label for="give-new-donor-email"><?php _e( 'New Donor Email:', 'give' ); ?></label> |
|
625 | + <label for="give-new-donor-email"><?php _e('New Donor Email:', 'give'); ?></label> |
|
626 | 626 | <input id="give-new-donor-email" type="email" name="give-new-donor-email" value="" class="medium-text"/> |
627 | 627 | </p> |
628 | 628 | </div> |
@@ -630,9 +630,9 @@ discard block |
||
630 | 630 | <p> |
631 | 631 | <input type="hidden" name="give-current-donor" value="<?php echo $donor->id; ?>"/> |
632 | 632 | <input type="hidden" id="give-new-donor" name="give-new-donor" value="0"/> |
633 | - <a href="#cancel" class="give-payment-new-donor-cancel give-delete"><?php _e( 'Cancel', 'give' ); ?></a> |
|
633 | + <a href="#cancel" class="give-payment-new-donor-cancel give-delete"><?php _e('Cancel', 'give'); ?></a> |
|
634 | 634 | <br> |
635 | - <em><?php _e( 'Click "Save Donation" to create new donor.', 'give' ); ?></em> |
|
635 | + <em><?php _e('Click "Save Donation" to create new donor.', 'give'); ?></em> |
|
636 | 636 | </p> |
637 | 637 | </div> |
638 | 638 | </div> |
@@ -647,7 +647,7 @@ discard block |
||
647 | 647 | * @param array $payment_meta Payment meta. |
648 | 648 | * @param array $user_info User information. |
649 | 649 | */ |
650 | - do_action( 'give_payment_personal_details_list', $payment_meta, $user_info ); |
|
650 | + do_action('give_payment_personal_details_list', $payment_meta, $user_info); |
|
651 | 651 | |
652 | 652 | /** |
653 | 653 | * Fires on the donation details page, in the donor-details metabox. |
@@ -656,7 +656,7 @@ discard block |
||
656 | 656 | * |
657 | 657 | * @param int $payment_id Payment id. |
658 | 658 | */ |
659 | - do_action( 'give_payment_view_details', $payment_id ); |
|
659 | + do_action('give_payment_view_details', $payment_id); |
|
660 | 660 | ?> |
661 | 661 | |
662 | 662 | </div> |
@@ -672,11 +672,11 @@ discard block |
||
672 | 672 | * |
673 | 673 | * @param int $payment_id Payment id. |
674 | 674 | */ |
675 | - do_action( 'give_view_donation_details_billing_before', $payment_id ); |
|
675 | + do_action('give_view_donation_details_billing_before', $payment_id); |
|
676 | 676 | ?> |
677 | 677 | |
678 | 678 | <div id="give-billing-details" class="postbox"> |
679 | - <h3 class="hndle"><?php _e( 'Billing Address', 'give' ); ?></h3> |
|
679 | + <h3 class="hndle"><?php _e('Billing Address', 'give'); ?></h3> |
|
680 | 680 | |
681 | 681 | <div class="inside"> |
682 | 682 | |
@@ -686,9 +686,9 @@ discard block |
||
686 | 686 | <div class="data column-container"> |
687 | 687 | |
688 | 688 | <?php |
689 | - $address['country'] = ( ! empty( $address['country'] ) ? $address['country'] : give_get_country() ); |
|
689 | + $address['country'] = ( ! empty($address['country']) ? $address['country'] : give_get_country()); |
|
690 | 690 | |
691 | - $address['state'] = ( ! empty( $address['state'] ) ? $address['state'] : '' ); |
|
691 | + $address['state'] = ( ! empty($address['state']) ? $address['state'] : ''); |
|
692 | 692 | |
693 | 693 | // Get the country list that does not have any states init. |
694 | 694 | $no_states_country = give_no_states_country_list(); |
@@ -696,7 +696,7 @@ discard block |
||
696 | 696 | |
697 | 697 | <div class="row"> |
698 | 698 | <div id="give-order-address-country-wrap"> |
699 | - <label class="order-data-address-line"><?php _e( 'Country:', 'give' ); ?></label> |
|
699 | + <label class="order-data-address-line"><?php _e('Country:', 'give'); ?></label> |
|
700 | 700 | <?php |
701 | 701 | echo Give()->html->select( |
702 | 702 | array( |
@@ -706,8 +706,8 @@ discard block |
||
706 | 706 | 'show_option_all' => false, |
707 | 707 | 'show_option_none' => false, |
708 | 708 | 'chosen' => true, |
709 | - 'placeholder' => esc_attr__( 'Select a country', 'give' ), |
|
710 | - 'data' => array( 'search-type' => 'no_ajax' ), |
|
709 | + 'placeholder' => esc_attr__('Select a country', 'give'), |
|
710 | + 'data' => array('search-type' => 'no_ajax'), |
|
711 | 711 | ) |
712 | 712 | ); |
713 | 713 | ?> |
@@ -716,35 +716,35 @@ discard block |
||
716 | 716 | |
717 | 717 | <div class="row"> |
718 | 718 | <div class="give-wrap-address-line1"> |
719 | - <label for="give-payment-address-line1" class="order-data-address"><?php _e( 'Address 1:', 'give' ); ?></label> |
|
720 | - <input id="give-payment-address-line1" type="text" name="give-payment-address[0][line1]" value="<?php echo esc_attr( $address['line1'] ); ?>" class="medium-text"/> |
|
719 | + <label for="give-payment-address-line1" class="order-data-address"><?php _e('Address 1:', 'give'); ?></label> |
|
720 | + <input id="give-payment-address-line1" type="text" name="give-payment-address[0][line1]" value="<?php echo esc_attr($address['line1']); ?>" class="medium-text"/> |
|
721 | 721 | </div> |
722 | 722 | </div> |
723 | 723 | |
724 | 724 | <div class="row"> |
725 | 725 | <div class="give-wrap-address-line2"> |
726 | - <label for="give-payment-address-line2" class="order-data-address-line"><?php _e( 'Address 2:', 'give' ); ?></label> |
|
727 | - <input id="give-payment-address-line2" type="text" name="give-payment-address[0][line2]" value="<?php echo esc_attr( $address['line2'] ); ?>" class="medium-text"/> |
|
726 | + <label for="give-payment-address-line2" class="order-data-address-line"><?php _e('Address 2:', 'give'); ?></label> |
|
727 | + <input id="give-payment-address-line2" type="text" name="give-payment-address[0][line2]" value="<?php echo esc_attr($address['line2']); ?>" class="medium-text"/> |
|
728 | 728 | </div> |
729 | 729 | </div> |
730 | 730 | |
731 | 731 | <div class="row"> |
732 | 732 | <div class="give-wrap-address-city"> |
733 | - <label for="give-payment-address-city" class="order-data-address-line"><?php esc_html_e( 'City:', 'give' ); ?></label> |
|
734 | - <input id="give-payment-address-city" type="text" name="give-payment-address[0][city]" value="<?php echo esc_attr( $address['city'] ); ?>" class="medium-text"/> |
|
733 | + <label for="give-payment-address-city" class="order-data-address-line"><?php esc_html_e('City:', 'give'); ?></label> |
|
734 | + <input id="give-payment-address-city" type="text" name="give-payment-address[0][city]" value="<?php echo esc_attr($address['city']); ?>" class="medium-text"/> |
|
735 | 735 | </div> |
736 | 736 | </div> |
737 | 737 | |
738 | 738 | <?php |
739 | - $state_exists = ( ! empty( $address['country'] ) && array_key_exists( $address['country'], $no_states_country ) ? true : false ); |
|
739 | + $state_exists = ( ! empty($address['country']) && array_key_exists($address['country'], $no_states_country) ? true : false); |
|
740 | 740 | ?> |
741 | 741 | <div class="row"> |
742 | - <div class="<?php echo( ! empty( $state_exists ) ? 'column-full' : 'column' ); ?> give-column give-column-state"> |
|
743 | - <div id="give-order-address-state-wrap" class="<?php echo( ! empty( $state_exists ) ? 'give-hidden' : '' ); ?>"> |
|
744 | - <label for="give-payment-address-state" class="order-data-address-line"><?php esc_html_e( 'State / Province / County:', 'give' ); ?></label> |
|
742 | + <div class="<?php echo( ! empty($state_exists) ? 'column-full' : 'column'); ?> give-column give-column-state"> |
|
743 | + <div id="give-order-address-state-wrap" class="<?php echo( ! empty($state_exists) ? 'give-hidden' : ''); ?>"> |
|
744 | + <label for="give-payment-address-state" class="order-data-address-line"><?php esc_html_e('State / Province / County:', 'give'); ?></label> |
|
745 | 745 | <?php |
746 | - $states = give_get_states( $address['country'] ); |
|
747 | - if ( ! empty( $states ) ) { |
|
746 | + $states = give_get_states($address['country']); |
|
747 | + if ( ! empty($states)) { |
|
748 | 748 | echo Give()->html->select( |
749 | 749 | array( |
750 | 750 | 'options' => $states, |
@@ -753,23 +753,23 @@ discard block |
||
753 | 753 | 'show_option_all' => false, |
754 | 754 | 'show_option_none' => false, |
755 | 755 | 'chosen' => true, |
756 | - 'placeholder' => esc_attr__( 'Select a state', 'give' ), |
|
757 | - 'data' => array( 'search-type' => 'no_ajax' ), |
|
756 | + 'placeholder' => esc_attr__('Select a state', 'give'), |
|
757 | + 'data' => array('search-type' => 'no_ajax'), |
|
758 | 758 | ) |
759 | 759 | ); |
760 | 760 | } else { |
761 | 761 | ?> |
762 | - <input id="give-payment-address-state" type="text" name="give-payment-address[0][state]" value="<?php echo esc_attr( $address['state'] ); ?>" class="medium-text"/> |
|
762 | + <input id="give-payment-address-state" type="text" name="give-payment-address[0][state]" value="<?php echo esc_attr($address['state']); ?>" class="medium-text"/> |
|
763 | 763 | <?php |
764 | 764 | } |
765 | 765 | ?> |
766 | 766 | </div> |
767 | 767 | </div> |
768 | 768 | |
769 | - <div class="<?php echo( ! empty( $state_exists ) ? 'column-full' : 'column' ); ?> give-column give-column-zip"> |
|
769 | + <div class="<?php echo( ! empty($state_exists) ? 'column-full' : 'column'); ?> give-column give-column-zip"> |
|
770 | 770 | <div class="give-wrap-address-zip"> |
771 | - <label for="give-payment-address-zip" class="order-data-address-line"><?php _e( 'Zip / Postal Code:', 'give' ); ?></label> |
|
772 | - <input id="give-payment-address-zip" type="text" name="give-payment-address[0][zip]" value="<?php echo esc_attr( $address['zip'] ); ?>" class="medium-text"/> |
|
771 | + <label for="give-payment-address-zip" class="order-data-address-line"><?php _e('Zip / Postal Code:', 'give'); ?></label> |
|
772 | + <input id="give-payment-address-zip" type="text" name="give-payment-address[0][zip]" value="<?php echo esc_attr($address['zip']); ?>" class="medium-text"/> |
|
773 | 773 | </div> |
774 | 774 | </div> |
775 | 775 | </div> |
@@ -788,7 +788,7 @@ discard block |
||
788 | 788 | * |
789 | 789 | * @param int $payment_id Payment id. |
790 | 790 | */ |
791 | - do_action( 'give_payment_billing_details', $payment_id ); |
|
791 | + do_action('give_payment_billing_details', $payment_id); |
|
792 | 792 | ?> |
793 | 793 | |
794 | 794 | </div> |
@@ -804,34 +804,34 @@ discard block |
||
804 | 804 | * |
805 | 805 | * @param int $payment_id Payment id. |
806 | 806 | */ |
807 | - do_action( 'give_view_donation_details_billing_after', $payment_id ); |
|
807 | + do_action('give_view_donation_details_billing_after', $payment_id); |
|
808 | 808 | ?> |
809 | 809 | |
810 | 810 | <div id="give-payment-notes" class="postbox"> |
811 | - <h3 class="hndle"><?php _e( 'Donation Notes', 'give' ); ?></h3> |
|
811 | + <h3 class="hndle"><?php _e('Donation Notes', 'give'); ?></h3> |
|
812 | 812 | |
813 | 813 | <div class="inside"> |
814 | 814 | <div id="give-payment-notes-inner"> |
815 | 815 | <?php |
816 | - $notes = give_get_payment_notes( $payment_id ); |
|
817 | - if ( ! empty( $notes ) ) { |
|
816 | + $notes = give_get_payment_notes($payment_id); |
|
817 | + if ( ! empty($notes)) { |
|
818 | 818 | $no_notes_display = ' style="display:none;"'; |
819 | - foreach ( $notes as $note ) : |
|
819 | + foreach ($notes as $note) : |
|
820 | 820 | |
821 | - echo give_get_payment_note_html( $note, $payment_id ); |
|
821 | + echo give_get_payment_note_html($note, $payment_id); |
|
822 | 822 | |
823 | 823 | endforeach; |
824 | 824 | } else { |
825 | 825 | $no_notes_display = ''; |
826 | 826 | } |
827 | 827 | |
828 | - echo '<p class="give-no-payment-notes"' . $no_notes_display . '>' . esc_html__( 'No donation notes.', 'give' ) . '</p>'; |
|
828 | + echo '<p class="give-no-payment-notes"'.$no_notes_display.'>'.esc_html__('No donation notes.', 'give').'</p>'; |
|
829 | 829 | ?> |
830 | 830 | </div> |
831 | 831 | <textarea name="give-payment-note" id="give-payment-note" class="large-text"></textarea> |
832 | 832 | |
833 | 833 | <div class="give-clearfix"> |
834 | - <button id="give-add-payment-note" class="button button-secondary button-small" data-payment-id="<?php echo absint( $payment_id ); ?>"><?php _e( 'Add Note', 'give' ); ?></button> |
|
834 | + <button id="give-add-payment-note" class="button button-secondary button-small" data-payment-id="<?php echo absint($payment_id); ?>"><?php _e('Add Note', 'give'); ?></button> |
|
835 | 835 | </div> |
836 | 836 | |
837 | 837 | </div> |
@@ -847,7 +847,7 @@ discard block |
||
847 | 847 | * |
848 | 848 | * @param int $payment_id Payment id. |
849 | 849 | */ |
850 | - do_action( 'give_view_donation_details_main_after', $payment_id ); |
|
850 | + do_action('give_view_donation_details_main_after', $payment_id); |
|
851 | 851 | ?> |
852 | 852 | |
853 | 853 | </div> |
@@ -869,11 +869,11 @@ discard block |
||
869 | 869 | * |
870 | 870 | * @param int $payment_id Payment id. |
871 | 871 | */ |
872 | - do_action( 'give_view_donation_details_form_bottom', $payment_id ); |
|
872 | + do_action('give_view_donation_details_form_bottom', $payment_id); |
|
873 | 873 | |
874 | - wp_nonce_field( 'give_update_payment_details_nonce' ); |
|
874 | + wp_nonce_field('give_update_payment_details_nonce'); |
|
875 | 875 | ?> |
876 | - <input type="hidden" name="give_payment_id" value="<?php echo esc_attr( $payment_id ); ?>"/> |
|
876 | + <input type="hidden" name="give_payment_id" value="<?php echo esc_attr($payment_id); ?>"/> |
|
877 | 877 | <input type="hidden" name="give_action" value="update_payment_details"/> |
878 | 878 | </form> |
879 | 879 | <?php |
@@ -884,6 +884,6 @@ discard block |
||
884 | 884 | * |
885 | 885 | * @param int $payment_id Payment id. |
886 | 886 | */ |
887 | - do_action( 'give_view_donation_details_after', $payment_id ); |
|
887 | + do_action('give_view_donation_details_after', $payment_id); |
|
888 | 888 | ?> |
889 | 889 | </div><!-- /.wrap --> |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -27,34 +27,34 @@ discard block |
||
27 | 27 | * @return array $form_columns Updated array of forms columns |
28 | 28 | * Post Type List Table |
29 | 29 | */ |
30 | -function give_form_columns( $give_form_columns ) { |
|
30 | +function give_form_columns($give_form_columns) { |
|
31 | 31 | |
32 | 32 | // Standard columns |
33 | 33 | $give_form_columns = array( |
34 | 34 | 'cb' => '<input type="checkbox"/>', |
35 | - 'title' => __( 'Name', 'give' ), |
|
36 | - 'form_category' => __( 'Categories', 'give' ), |
|
37 | - 'form_tag' => __( 'Tags', 'give' ), |
|
38 | - 'price' => __( 'Amount', 'give' ), |
|
39 | - 'goal' => __( 'Goal', 'give' ), |
|
40 | - 'donations' => __( 'Donations', 'give' ), |
|
41 | - 'earnings' => __( 'Income', 'give' ), |
|
42 | - 'shortcode' => __( 'Shortcode', 'give' ), |
|
43 | - 'date' => __( 'Date', 'give' ), |
|
35 | + 'title' => __('Name', 'give'), |
|
36 | + 'form_category' => __('Categories', 'give'), |
|
37 | + 'form_tag' => __('Tags', 'give'), |
|
38 | + 'price' => __('Amount', 'give'), |
|
39 | + 'goal' => __('Goal', 'give'), |
|
40 | + 'donations' => __('Donations', 'give'), |
|
41 | + 'earnings' => __('Income', 'give'), |
|
42 | + 'shortcode' => __('Shortcode', 'give'), |
|
43 | + 'date' => __('Date', 'give'), |
|
44 | 44 | ); |
45 | 45 | |
46 | 46 | // Does the user want categories / tags? |
47 | - if ( ! give_is_setting_enabled( give_get_option( 'categories', 'disabled' ) ) ) { |
|
48 | - unset( $give_form_columns['form_category'] ); |
|
47 | + if ( ! give_is_setting_enabled(give_get_option('categories', 'disabled'))) { |
|
48 | + unset($give_form_columns['form_category']); |
|
49 | 49 | } |
50 | - if ( ! give_is_setting_enabled( give_get_option( 'tags', 'disabled' ) ) ) { |
|
51 | - unset( $give_form_columns['form_tag'] ); |
|
50 | + if ( ! give_is_setting_enabled(give_get_option('tags', 'disabled'))) { |
|
51 | + unset($give_form_columns['form_tag']); |
|
52 | 52 | } |
53 | 53 | |
54 | - return apply_filters( 'give_forms_columns', $give_form_columns ); |
|
54 | + return apply_filters('give_forms_columns', $give_form_columns); |
|
55 | 55 | } |
56 | 56 | |
57 | -add_filter( 'manage_edit-give_forms_columns', 'give_form_columns' ); |
|
57 | +add_filter('manage_edit-give_forms_columns', 'give_form_columns'); |
|
58 | 58 | |
59 | 59 | /** |
60 | 60 | * Render Give Form Columns |
@@ -66,70 +66,70 @@ discard block |
||
66 | 66 | * |
67 | 67 | * @return void |
68 | 68 | */ |
69 | -function give_render_form_columns( $column_name, $post_id ) { |
|
70 | - if ( get_post_type( $post_id ) == 'give_forms' ) { |
|
69 | +function give_render_form_columns($column_name, $post_id) { |
|
70 | + if (get_post_type($post_id) == 'give_forms') { |
|
71 | 71 | |
72 | - switch ( $column_name ) { |
|
72 | + switch ($column_name) { |
|
73 | 73 | case 'form_category': |
74 | - echo get_the_term_list( $post_id, 'give_forms_category', '', ', ', '' ); |
|
74 | + echo get_the_term_list($post_id, 'give_forms_category', '', ', ', ''); |
|
75 | 75 | break; |
76 | 76 | case 'form_tag': |
77 | - echo get_the_term_list( $post_id, 'give_forms_tag', '', ', ', '' ); |
|
77 | + echo get_the_term_list($post_id, 'give_forms_tag', '', ', ', ''); |
|
78 | 78 | break; |
79 | 79 | case 'price': |
80 | - if ( give_has_variable_prices( $post_id ) ) { |
|
81 | - echo give_price_range( $post_id ); |
|
80 | + if (give_has_variable_prices($post_id)) { |
|
81 | + echo give_price_range($post_id); |
|
82 | 82 | } else { |
83 | - echo give_price( $post_id, false ); |
|
84 | - printf( '<input type="hidden" class="formprice-%1$s" value="%2$s" />', esc_attr( $post_id ), esc_attr( give_get_form_price( $post_id ) ) ); |
|
83 | + echo give_price($post_id, false); |
|
84 | + printf('<input type="hidden" class="formprice-%1$s" value="%2$s" />', esc_attr($post_id), esc_attr(give_get_form_price($post_id))); |
|
85 | 85 | } |
86 | 86 | break; |
87 | 87 | case 'goal': |
88 | - if ( give_is_setting_enabled( give_get_meta( $post_id, '_give_goal_option', true ) ) ) { |
|
88 | + if (give_is_setting_enabled(give_get_meta($post_id, '_give_goal_option', true))) { |
|
89 | 89 | |
90 | - echo give_admin_form_goal_stats( $post_id ); |
|
90 | + echo give_admin_form_goal_stats($post_id); |
|
91 | 91 | |
92 | 92 | } else { |
93 | - _e( 'No Goal Set', 'give' ); |
|
93 | + _e('No Goal Set', 'give'); |
|
94 | 94 | } |
95 | 95 | |
96 | 96 | printf( |
97 | 97 | '<input type="hidden" class="formgoal-%1$s" value="%2$s" />', |
98 | - esc_attr( $post_id ), |
|
99 | - give_get_form_goal( $post_id ) |
|
98 | + esc_attr($post_id), |
|
99 | + give_get_form_goal($post_id) |
|
100 | 100 | ); |
101 | 101 | |
102 | 102 | break; |
103 | 103 | case 'donations': |
104 | - if ( current_user_can( 'view_give_form_stats', $post_id ) ) { |
|
104 | + if (current_user_can('view_give_form_stats', $post_id)) { |
|
105 | 105 | printf( |
106 | 106 | '<a href="%1$s">%2$s</a>', |
107 | - esc_url( admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&form_id=' . $post_id ) ), |
|
108 | - give_get_form_sales_stats( $post_id ) |
|
107 | + esc_url(admin_url('edit.php?post_type=give_forms&page=give-payment-history&form_id='.$post_id)), |
|
108 | + give_get_form_sales_stats($post_id) |
|
109 | 109 | ); |
110 | 110 | } else { |
111 | 111 | echo '-'; |
112 | 112 | } |
113 | 113 | break; |
114 | 114 | case 'earnings': |
115 | - if ( current_user_can( 'view_give_form_stats', $post_id ) ) { |
|
115 | + if (current_user_can('view_give_form_stats', $post_id)) { |
|
116 | 116 | printf( |
117 | 117 | '<a href="%1$s">%2$s</a>', |
118 | - esc_url( admin_url( 'edit.php?post_type=give_forms&page=give-reports&tab=forms&form-id=' . $post_id ) ), |
|
119 | - give_currency_filter( give_format_amount( give_get_form_earnings_stats( $post_id ), array( 'sanitize' => false ) ) ) |
|
118 | + esc_url(admin_url('edit.php?post_type=give_forms&page=give-reports&tab=forms&form-id='.$post_id)), |
|
119 | + give_currency_filter(give_format_amount(give_get_form_earnings_stats($post_id), array('sanitize' => false))) |
|
120 | 120 | ); |
121 | 121 | } else { |
122 | 122 | echo '-'; |
123 | 123 | } |
124 | 124 | break; |
125 | 125 | case 'shortcode': |
126 | - printf( '<input onclick="this.setSelectionRange(0, this.value.length)" type="text" class="shortcode-input" readonly="" value="[give_form id="%s"]"', absint( $post_id ) ); |
|
126 | + printf('<input onclick="this.setSelectionRange(0, this.value.length)" type="text" class="shortcode-input" readonly="" value="[give_form id="%s"]"', absint($post_id)); |
|
127 | 127 | break; |
128 | 128 | }// End switch(). |
129 | 129 | }// End if(). |
130 | 130 | } |
131 | 131 | |
132 | -add_action( 'manage_posts_custom_column', 'give_render_form_columns', 10, 2 ); |
|
132 | +add_action('manage_posts_custom_column', 'give_render_form_columns', 10, 2); |
|
133 | 133 | |
134 | 134 | /** |
135 | 135 | * Registers the sortable columns in the list table |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | * |
141 | 141 | * @return array $columns Array of sortable columns |
142 | 142 | */ |
143 | -function give_sortable_form_columns( $columns ) { |
|
143 | +function give_sortable_form_columns($columns) { |
|
144 | 144 | $columns['price'] = 'amount'; |
145 | 145 | $columns['sales'] = 'sales'; |
146 | 146 | $columns['earnings'] = 'earnings'; |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | return $columns; |
151 | 151 | } |
152 | 152 | |
153 | -add_filter( 'manage_edit-give_forms_sortable_columns', 'give_sortable_form_columns' ); |
|
153 | +add_filter('manage_edit-give_forms_sortable_columns', 'give_sortable_form_columns'); |
|
154 | 154 | |
155 | 155 | /** |
156 | 156 | * Sorts Columns in the Forms List Table |
@@ -161,13 +161,13 @@ discard block |
||
161 | 161 | * |
162 | 162 | * @return array $vars Array of all the sort variables. |
163 | 163 | */ |
164 | -function give_sort_forms( $vars ) { |
|
164 | +function give_sort_forms($vars) { |
|
165 | 165 | // Check if we're viewing the "give_forms" post type. |
166 | - if ( ! isset( $vars['post_type'] ) || ! isset( $vars['orderby'] ) || 'give_forms' !== $vars['post_type'] ) { |
|
166 | + if ( ! isset($vars['post_type']) || ! isset($vars['orderby']) || 'give_forms' !== $vars['post_type']) { |
|
167 | 167 | return $vars; |
168 | 168 | } |
169 | 169 | |
170 | - switch ( $vars['orderby'] ) { |
|
170 | + switch ($vars['orderby']) { |
|
171 | 171 | // Check if 'orderby' is set to "sales". |
172 | 172 | case 'sales': |
173 | 173 | $vars = array_merge( |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | |
193 | 193 | // Check if "orderby" is set to "price/amount". |
194 | 194 | case 'amount': |
195 | - $multi_level_meta_key = ( 'asc' === $vars['order'] ) ? '_give_levels_minimum_amount' : '_give_levels_maximum_amount'; |
|
195 | + $multi_level_meta_key = ('asc' === $vars['order']) ? '_give_levels_minimum_amount' : '_give_levels_maximum_amount'; |
|
196 | 196 | |
197 | 197 | $vars['orderby'] = 'meta_value_num'; |
198 | 198 | $vars['meta_query'] = array( |
@@ -244,17 +244,17 @@ discard block |
||
244 | 244 | * |
245 | 245 | * @return array Array of all sort variables. |
246 | 246 | */ |
247 | -function give_filter_forms( $vars ) { |
|
248 | - if ( isset( $vars['post_type'] ) && 'give_forms' == $vars['post_type'] ) { |
|
247 | +function give_filter_forms($vars) { |
|
248 | + if (isset($vars['post_type']) && 'give_forms' == $vars['post_type']) { |
|
249 | 249 | |
250 | 250 | // If an author ID was passed, use it |
251 | - if ( isset( $_REQUEST['author'] ) && ! current_user_can( 'view_give_reports' ) ) { |
|
251 | + if (isset($_REQUEST['author']) && ! current_user_can('view_give_reports')) { |
|
252 | 252 | |
253 | 253 | $author_id = $_REQUEST['author']; |
254 | - if ( (int) $author_id !== get_current_user_id() ) { |
|
255 | - wp_die( esc_html__( 'You do not have permission to view this data.', 'give' ), esc_html__( 'Error', 'give' ), array( |
|
254 | + if ((int) $author_id !== get_current_user_id()) { |
|
255 | + wp_die(esc_html__('You do not have permission to view this data.', 'give'), esc_html__('Error', 'give'), array( |
|
256 | 256 | 'response' => 403, |
257 | - ) ); |
|
257 | + )); |
|
258 | 258 | } |
259 | 259 | $vars = array_merge( |
260 | 260 | $vars, |
@@ -278,11 +278,11 @@ discard block |
||
278 | 278 | * @return void |
279 | 279 | */ |
280 | 280 | function give_forms_load() { |
281 | - add_filter( 'request', 'give_sort_forms' ); |
|
282 | - add_filter( 'request', 'give_filter_forms' ); |
|
281 | + add_filter('request', 'give_sort_forms'); |
|
282 | + add_filter('request', 'give_filter_forms'); |
|
283 | 283 | } |
284 | 284 | |
285 | -add_action( 'load-edit.php', 'give_forms_load', 9999 ); |
|
285 | +add_action('load-edit.php', 'give_forms_load', 9999); |
|
286 | 286 | |
287 | 287 | /** |
288 | 288 | * Remove Forms Month Filter |
@@ -296,17 +296,17 @@ discard block |
||
296 | 296 | * @global $typenow The post type we are viewing. |
297 | 297 | * @return array Empty array disables the dropdown. |
298 | 298 | */ |
299 | -function give_remove_month_filter( $dates ) { |
|
299 | +function give_remove_month_filter($dates) { |
|
300 | 300 | global $typenow; |
301 | 301 | |
302 | - if ( $typenow == 'give_forms' ) { |
|
302 | + if ($typenow == 'give_forms') { |
|
303 | 303 | $dates = array(); |
304 | 304 | } |
305 | 305 | |
306 | 306 | return $dates; |
307 | 307 | } |
308 | 308 | |
309 | -add_filter( 'months_dropdown_results', 'give_remove_month_filter', 99 ); |
|
309 | +add_filter('months_dropdown_results', 'give_remove_month_filter', 99); |
|
310 | 310 | |
311 | 311 | /** |
312 | 312 | * Updates price when saving post |
@@ -317,23 +317,23 @@ discard block |
||
317 | 317 | * |
318 | 318 | * @return int|null |
319 | 319 | */ |
320 | -function give_price_save_quick_edit( $post_id ) { |
|
321 | - if ( ! isset( $_POST['post_type'] ) || 'give_forms' !== $_POST['post_type'] ) { |
|
320 | +function give_price_save_quick_edit($post_id) { |
|
321 | + if ( ! isset($_POST['post_type']) || 'give_forms' !== $_POST['post_type']) { |
|
322 | 322 | return; |
323 | 323 | } |
324 | - if ( ! current_user_can( 'edit_post', $post_id ) ) { |
|
324 | + if ( ! current_user_can('edit_post', $post_id)) { |
|
325 | 325 | return $post_id; |
326 | 326 | } |
327 | - if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) { |
|
327 | + if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) { |
|
328 | 328 | return $post_id; |
329 | 329 | } |
330 | 330 | |
331 | - if ( isset( $_REQUEST['_give_regprice'] ) ) { |
|
332 | - give_update_meta( $post_id, '_give_set_price', give_sanitize_amount_for_db( strip_tags( stripslashes( $_REQUEST['_give_regprice'] ) ) ) ); |
|
331 | + if (isset($_REQUEST['_give_regprice'])) { |
|
332 | + give_update_meta($post_id, '_give_set_price', give_sanitize_amount_for_db(strip_tags(stripslashes($_REQUEST['_give_regprice'])))); |
|
333 | 333 | } |
334 | 334 | } |
335 | 335 | |
336 | -add_action( 'save_post', 'give_price_save_quick_edit' ); |
|
336 | +add_action('save_post', 'give_price_save_quick_edit'); |
|
337 | 337 | |
338 | 338 | /** |
339 | 339 | * Process bulk edit actions via AJAX |
@@ -343,18 +343,18 @@ discard block |
||
343 | 343 | */ |
344 | 344 | function give_save_bulk_edit() { |
345 | 345 | |
346 | - $post_ids = ( isset( $_POST['post_ids'] ) && ! empty( $_POST['post_ids'] ) ) ? $_POST['post_ids'] : array(); |
|
346 | + $post_ids = (isset($_POST['post_ids']) && ! empty($_POST['post_ids'])) ? $_POST['post_ids'] : array(); |
|
347 | 347 | |
348 | - if ( ! empty( $post_ids ) && is_array( $post_ids ) ) { |
|
349 | - $price = isset( $_POST['price'] ) ? strip_tags( stripslashes( $_POST['price'] ) ) : 0; |
|
350 | - foreach ( $post_ids as $post_id ) { |
|
348 | + if ( ! empty($post_ids) && is_array($post_ids)) { |
|
349 | + $price = isset($_POST['price']) ? strip_tags(stripslashes($_POST['price'])) : 0; |
|
350 | + foreach ($post_ids as $post_id) { |
|
351 | 351 | |
352 | - if ( ! current_user_can( 'edit_post', $post_id ) ) { |
|
352 | + if ( ! current_user_can('edit_post', $post_id)) { |
|
353 | 353 | continue; |
354 | 354 | } |
355 | 355 | |
356 | - if ( ! empty( $price ) ) { |
|
357 | - give_update_meta( $post_id, '_give_set_price', give_sanitize_amount_for_db( $price ) ); |
|
356 | + if ( ! empty($price)) { |
|
357 | + give_update_meta($post_id, '_give_set_price', give_sanitize_amount_for_db($price)); |
|
358 | 358 | } |
359 | 359 | } |
360 | 360 | } |
@@ -362,4 +362,4 @@ discard block |
||
362 | 362 | die(); |
363 | 363 | } |
364 | 364 | |
365 | -add_action( 'wp_ajax_give_save_bulk_edit', 'give_save_bulk_edit' ); |
|
365 | +add_action('wp_ajax_give_save_bulk_edit', 'give_save_bulk_edit'); |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -27,30 +27,30 @@ discard block |
||
27 | 27 | * |
28 | 28 | * @return mixed |
29 | 29 | */ |
30 | -function __give_sanitize_number_decimals_setting_field( $value ) { |
|
30 | +function __give_sanitize_number_decimals_setting_field($value) { |
|
31 | 31 | $value_changed = false; |
32 | 32 | $old_value = $value; |
33 | 33 | |
34 | - if ( isset( $_POST['decimal_separator'] ) ) { |
|
35 | - $value = ! empty( $_POST['decimal_separator'] ) ? $value : 0; |
|
34 | + if (isset($_POST['decimal_separator'])) { |
|
35 | + $value = ! empty($_POST['decimal_separator']) ? $value : 0; |
|
36 | 36 | $value_changed = true; |
37 | 37 | } |
38 | 38 | |
39 | - if ( $value_changed && ( $old_value !== $value ) ) { |
|
40 | - Give_Admin_Settings::add_error( 'give-number-decimal', __( 'The \'Number of Decimals\' option has been automatically set to zero because the \'Decimal Separator\' is not set.', 'give' ) ); |
|
39 | + if ($value_changed && ($old_value !== $value)) { |
|
40 | + Give_Admin_Settings::add_error('give-number-decimal', __('The \'Number of Decimals\' option has been automatically set to zero because the \'Decimal Separator\' is not set.', 'give')); |
|
41 | 41 | } |
42 | 42 | |
43 | - $value = absint( $value ); |
|
43 | + $value = absint($value); |
|
44 | 44 | |
45 | - if ( 6 <= $value ) { |
|
45 | + if (6 <= $value) { |
|
46 | 46 | $value = 5; |
47 | - Give_Admin_Settings::add_error( 'give-number-decimal', __( 'The \'Number of Decimals\' option has been automatically set to 5 because you entered a number higher than the maximum allowed.', 'give' ) ); |
|
47 | + Give_Admin_Settings::add_error('give-number-decimal', __('The \'Number of Decimals\' option has been automatically set to 5 because you entered a number higher than the maximum allowed.', 'give')); |
|
48 | 48 | } |
49 | 49 | |
50 | - return absint( $value ); |
|
50 | + return absint($value); |
|
51 | 51 | } |
52 | 52 | |
53 | -add_filter( 'give_admin_settings_sanitize_option_number_decimals', '__give_sanitize_number_decimals_setting_field', 10 ); |
|
53 | +add_filter('give_admin_settings_sanitize_option_number_decimals', '__give_sanitize_number_decimals_setting_field', 10); |
|
54 | 54 | |
55 | 55 | |
56 | 56 | /** |
@@ -66,20 +66,20 @@ discard block |
||
66 | 66 | * |
67 | 67 | * @return mixed |
68 | 68 | */ |
69 | -function __give_validate_decimal_separator_setting_field( $value ) { |
|
70 | - $thousand_separator = isset( $_POST['thousands_separator'] ) ? give_clean( $_POST['thousands_separator'] ) : ''; |
|
71 | - $decimal_separator = isset( $_POST['decimal_separator'] ) ? give_clean( $_POST['decimal_separator'] ) : ''; |
|
69 | +function __give_validate_decimal_separator_setting_field($value) { |
|
70 | + $thousand_separator = isset($_POST['thousands_separator']) ? give_clean($_POST['thousands_separator']) : ''; |
|
71 | + $decimal_separator = isset($_POST['decimal_separator']) ? give_clean($_POST['decimal_separator']) : ''; |
|
72 | 72 | |
73 | - if ( $decimal_separator === $thousand_separator ) { |
|
73 | + if ($decimal_separator === $thousand_separator) { |
|
74 | 74 | $value = ''; |
75 | 75 | $_POST['number_decimals'] = 0; |
76 | - Give_Admin_Settings::add_error( 'give-decimal-separator', __( 'The \'Decimal Separator\' option has automatically been set to empty because it can not be equal to the \'Thousand Separator\'', 'give' ) ); |
|
76 | + Give_Admin_Settings::add_error('give-decimal-separator', __('The \'Decimal Separator\' option has automatically been set to empty because it can not be equal to the \'Thousand Separator\'', 'give')); |
|
77 | 77 | } |
78 | 78 | |
79 | 79 | return $value; |
80 | 80 | } |
81 | 81 | |
82 | -add_filter( 'give_admin_settings_sanitize_option_decimal_separator', '__give_validate_decimal_separator_setting_field', 10 ); |
|
82 | +add_filter('give_admin_settings_sanitize_option_decimal_separator', '__give_validate_decimal_separator_setting_field', 10); |
|
83 | 83 | |
84 | 84 | /** |
85 | 85 | * Change $delimiter text to symbol. |
@@ -90,16 +90,16 @@ discard block |
||
90 | 90 | * |
91 | 91 | * @return string $delimiter. |
92 | 92 | */ |
93 | -function __give_import_delimiter_set_callback( $delimiter ) { |
|
93 | +function __give_import_delimiter_set_callback($delimiter) { |
|
94 | 94 | $delimite_type = array( |
95 | 95 | 'csv' => ',', |
96 | 96 | 'tab-separated-values' => "\t", |
97 | 97 | ); |
98 | 98 | |
99 | - return ( array_key_exists( $delimiter, $delimite_type ) ? $delimite_type[ $delimiter ] : ',' ); |
|
99 | + return (array_key_exists($delimiter, $delimite_type) ? $delimite_type[$delimiter] : ','); |
|
100 | 100 | } |
101 | 101 | |
102 | -add_filter( 'give_import_delimiter_set', '__give_import_delimiter_set_callback', 10 ); |
|
102 | +add_filter('give_import_delimiter_set', '__give_import_delimiter_set_callback', 10); |
|
103 | 103 | |
104 | 104 | /** |
105 | 105 | * Give unset the page id from the core setting data from the json files. |
@@ -111,17 +111,17 @@ discard block |
||
111 | 111 | * |
112 | 112 | * @return array $json_to_array |
113 | 113 | */ |
114 | -function give_import_core_settings_merge_pages( $json_to_array, $type ) { |
|
115 | - if ( 'merge' === $type ) { |
|
116 | - unset( $json_to_array['success_page'] ); |
|
117 | - unset( $json_to_array['failure_page'] ); |
|
118 | - unset( $json_to_array['history_page'] ); |
|
114 | +function give_import_core_settings_merge_pages($json_to_array, $type) { |
|
115 | + if ('merge' === $type) { |
|
116 | + unset($json_to_array['success_page']); |
|
117 | + unset($json_to_array['failure_page']); |
|
118 | + unset($json_to_array['history_page']); |
|
119 | 119 | } |
120 | 120 | |
121 | 121 | return $json_to_array; |
122 | 122 | } |
123 | 123 | |
124 | -add_filter( 'give_import_core_settings_data', 'give_import_core_settings_merge_pages', 11, 2 ); |
|
124 | +add_filter('give_import_core_settings_data', 'give_import_core_settings_merge_pages', 11, 2); |
|
125 | 125 | |
126 | 126 | /** |
127 | 127 | * Give check the image size from the core setting data from the json files. |
@@ -133,18 +133,18 @@ discard block |
||
133 | 133 | * |
134 | 134 | * @return array $json_to_array |
135 | 135 | */ |
136 | -function give_import_core_settings_merge_image_size( $json_to_array, $type ) { |
|
137 | - if ( 'merge' === $type ) { |
|
136 | +function give_import_core_settings_merge_image_size($json_to_array, $type) { |
|
137 | + if ('merge' === $type) { |
|
138 | 138 | // Featured image sizes import under Display Options > Post Types > Featured Image Size. |
139 | 139 | if ( |
140 | - ! empty( $json_to_array['form_featured_img'] ) |
|
141 | - && ! empty( $json_to_array['featured_image_size'] ) |
|
142 | - && give_is_setting_enabled( $json_to_array['form_featured_img'] ) |
|
140 | + ! empty($json_to_array['form_featured_img']) |
|
141 | + && ! empty($json_to_array['featured_image_size']) |
|
142 | + && give_is_setting_enabled($json_to_array['form_featured_img']) |
|
143 | 143 | ) { |
144 | 144 | $images_sizes = get_intermediate_image_sizes(); |
145 | 145 | |
146 | - if ( ! in_array( $json_to_array['featured_image_size'], $images_sizes, true ) ) { |
|
147 | - unset( $json_to_array['featured_image_size'] ); |
|
146 | + if ( ! in_array($json_to_array['featured_image_size'], $images_sizes, true)) { |
|
147 | + unset($json_to_array['featured_image_size']); |
|
148 | 148 | } |
149 | 149 | } |
150 | 150 | } |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | return $json_to_array; |
153 | 153 | } |
154 | 154 | |
155 | -add_filter( 'give_import_core_settings_data', 'give_import_core_settings_merge_image_size', 12, 2 ); |
|
155 | +add_filter('give_import_core_settings_data', 'give_import_core_settings_merge_image_size', 12, 2); |
|
156 | 156 | |
157 | 157 | /** |
158 | 158 | * Give upload the image logo from the core setting data from the json files. |
@@ -164,24 +164,24 @@ discard block |
||
164 | 164 | * |
165 | 165 | * @return array $json_to_array |
166 | 166 | */ |
167 | -function give_import_core_settings_merge_upload_image( $json_to_array, $type ) { |
|
168 | - if ( 'merge' === $type ) { |
|
167 | +function give_import_core_settings_merge_upload_image($json_to_array, $type) { |
|
168 | + if ('merge' === $type) { |
|
169 | 169 | // Emails > Email Settings > Logo. |
170 | - if ( ! empty( $json_to_array['email_logo'] ) ) { |
|
170 | + if ( ! empty($json_to_array['email_logo'])) { |
|
171 | 171 | |
172 | 172 | // Need to require these files. |
173 | - if ( ! function_exists( 'media_handle_upload' ) ) { |
|
174 | - require_once( ABSPATH . 'wp-admin/includes/image.php' ); |
|
175 | - require_once( ABSPATH . 'wp-admin/includes/file.php' ); |
|
176 | - require_once( ABSPATH . 'wp-admin/includes/media.php' ); |
|
173 | + if ( ! function_exists('media_handle_upload')) { |
|
174 | + require_once(ABSPATH.'wp-admin/includes/image.php'); |
|
175 | + require_once(ABSPATH.'wp-admin/includes/file.php'); |
|
176 | + require_once(ABSPATH.'wp-admin/includes/media.php'); |
|
177 | 177 | } |
178 | 178 | |
179 | 179 | $url = $json_to_array['email_logo']; |
180 | - $new_url = media_sideload_image( $url, 0, null, 'src' ); |
|
181 | - if ( ! is_wp_error( $new_url ) ) { |
|
180 | + $new_url = media_sideload_image($url, 0, null, 'src'); |
|
181 | + if ( ! is_wp_error($new_url)) { |
|
182 | 182 | $json_to_array['email_logo'] = $new_url; |
183 | 183 | } else { |
184 | - unset( $json_to_array['email_logo'] ); |
|
184 | + unset($json_to_array['email_logo']); |
|
185 | 185 | } |
186 | 186 | } |
187 | 187 | } |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | return $json_to_array; |
190 | 190 | } |
191 | 191 | |
192 | -add_filter( 'give_import_core_settings_data', 'give_import_core_settings_merge_upload_image', 13, 2 ); |
|
192 | +add_filter('give_import_core_settings_data', 'give_import_core_settings_merge_upload_image', 13, 2); |
|
193 | 193 | |
194 | 194 | /** |
195 | 195 | * Give unset the license key from the core setting data from the json files. |
@@ -201,12 +201,12 @@ discard block |
||
201 | 201 | * |
202 | 202 | * @return array $json_to_array |
203 | 203 | */ |
204 | -function give_import_core_settings_merge_license_key( $json_to_array, $type ) { |
|
205 | - if ( 'merge' === $type ) { |
|
206 | - foreach ( $json_to_array as $key => $value ) { |
|
207 | - $is_license_key = strpos( '_license_key', $key ); |
|
208 | - if ( ! empty( $is_license_key ) ) { |
|
209 | - unset( $json_to_array[ $key ] ); |
|
204 | +function give_import_core_settings_merge_license_key($json_to_array, $type) { |
|
205 | + if ('merge' === $type) { |
|
206 | + foreach ($json_to_array as $key => $value) { |
|
207 | + $is_license_key = strpos('_license_key', $key); |
|
208 | + if ( ! empty($is_license_key)) { |
|
209 | + unset($json_to_array[$key]); |
|
210 | 210 | } |
211 | 211 | } |
212 | 212 | } |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | return $json_to_array; |
215 | 215 | } |
216 | 216 | |
217 | -add_filter( 'give_import_core_settings_data', 'give_import_core_settings_merge_license_key', 14, 2 ); |
|
217 | +add_filter('give_import_core_settings_data', 'give_import_core_settings_merge_license_key', 14, 2); |
|
218 | 218 | |
219 | 219 | /** |
220 | 220 | * Give merge the json data and setting data. |
@@ -227,16 +227,16 @@ discard block |
||
227 | 227 | * |
228 | 228 | * @return array $json_to_array |
229 | 229 | */ |
230 | -function give_import_core_settings_merge_data( $json_to_array, $type, $host_give_options ) { |
|
231 | - if ( 'merge' === $type ) { |
|
232 | - $json_to_array_merge = array_merge( $host_give_options, $json_to_array ); |
|
230 | +function give_import_core_settings_merge_data($json_to_array, $type, $host_give_options) { |
|
231 | + if ('merge' === $type) { |
|
232 | + $json_to_array_merge = array_merge($host_give_options, $json_to_array); |
|
233 | 233 | $json_to_array = $json_to_array_merge; |
234 | 234 | } |
235 | 235 | |
236 | 236 | return $json_to_array; |
237 | 237 | } |
238 | 238 | |
239 | -add_filter( 'give_import_core_settings_data', 'give_import_core_settings_merge_data', 1000, 3 ); |
|
239 | +add_filter('give_import_core_settings_data', 'give_import_core_settings_merge_data', 1000, 3); |
|
240 | 240 | |
241 | 241 | /** |
242 | 242 | * Backward Compatibility - Cleanup User Roles. |
@@ -247,11 +247,11 @@ discard block |
||
247 | 247 | * |
248 | 248 | * @return mixed |
249 | 249 | */ |
250 | -function give_bc_1817_cleanup_user_roles( $caps ) { |
|
250 | +function give_bc_1817_cleanup_user_roles($caps) { |
|
251 | 251 | |
252 | 252 | if ( |
253 | - ! give_has_upgrade_completed( 'v1817_cleanup_user_roles' ) && |
|
254 | - ! isset( $caps['view_give_payments'] ) |
|
253 | + ! give_has_upgrade_completed('v1817_cleanup_user_roles') && |
|
254 | + ! isset($caps['view_give_payments']) |
|
255 | 255 | ) { |
256 | 256 | give_v1817_process_cleanup_user_roles(); |
257 | 257 | } |
@@ -259,4 +259,4 @@ discard block |
||
259 | 259 | return $caps; |
260 | 260 | } |
261 | 261 | |
262 | -add_filter( 'user_has_cap', 'give_bc_1817_cleanup_user_roles' ); |
|
262 | +add_filter('user_has_cap', 'give_bc_1817_cleanup_user_roles'); |
@@ -7,12 +7,12 @@ discard block |
||
7 | 7 | */ |
8 | 8 | |
9 | 9 | // Exit if accessed directly. |
10 | -if ( ! defined( 'ABSPATH' ) ) { |
|
10 | +if ( ! defined('ABSPATH')) { |
|
11 | 11 | exit; |
12 | 12 | } |
13 | 13 | |
14 | 14 | // Add give command. |
15 | -WP_CLI::add_command( 'give', 'GIVE_CLI_COMMAND' ); |
|
15 | +WP_CLI::add_command('give', 'GIVE_CLI_COMMAND'); |
|
16 | 16 | |
17 | 17 | |
18 | 18 | /** |
@@ -76,8 +76,8 @@ discard block |
||
76 | 76 | * |
77 | 77 | * @subcommand logo |
78 | 78 | */ |
79 | - public function ascii( $args, $assoc_args ) { |
|
80 | - WP_CLI::log( file_get_contents( GIVE_PLUGIN_DIR . 'assets/dist/images/give-ascii-logo.txt' ) ); |
|
79 | + public function ascii($args, $assoc_args) { |
|
80 | + WP_CLI::log(file_get_contents(GIVE_PLUGIN_DIR.'assets/dist/images/give-ascii-logo.txt')); |
|
81 | 81 | } |
82 | 82 | |
83 | 83 | |
@@ -102,54 +102,54 @@ discard block |
||
102 | 102 | * |
103 | 103 | * @subcommand details |
104 | 104 | */ |
105 | - public function details( $args, $assoc_args ) { |
|
105 | + public function details($args, $assoc_args) { |
|
106 | 106 | |
107 | 107 | /** |
108 | 108 | * Plugin Information |
109 | 109 | */ |
110 | - WP_CLI::log( $this->color_message( __( 'Give Version: ', 'give' ) ) . GIVE_VERSION ); |
|
110 | + WP_CLI::log($this->color_message(__('Give Version: ', 'give')).GIVE_VERSION); |
|
111 | 111 | |
112 | 112 | /** |
113 | 113 | * General Information. |
114 | 114 | */ |
115 | - WP_CLI::log( "\n#### " . $this->color_message( __( 'General information', 'give' ) ) . ' ####' ); |
|
115 | + WP_CLI::log("\n#### ".$this->color_message(__('General information', 'give')).' ####'); |
|
116 | 116 | |
117 | - $success_page = give_get_option( 'success_page' ); |
|
118 | - $failure_page = give_get_option( 'failure_page' ); |
|
119 | - $history_page = give_get_option( 'history_page' ); |
|
117 | + $success_page = give_get_option('success_page'); |
|
118 | + $failure_page = give_get_option('failure_page'); |
|
119 | + $history_page = give_get_option('history_page'); |
|
120 | 120 | |
121 | - WP_CLI::log( $this->color_message( sprintf( __( 'Success Page: ', 'give' ) ) ) . ( $success_page ? "[{$success_page}] " . get_permalink( $success_page ) : __( 'Not Set', 'give' ) ) ); |
|
122 | - WP_CLI::log( $this->color_message( __( 'Failed Donation Page: ', 'give' ) ) . ( $failure_page ? "[{$failure_page}] " . get_permalink( $failure_page ) : __( 'Not Set', 'give' ) ) ); |
|
123 | - WP_CLI::log( $this->color_message( __( 'Donation History Page: ', 'give' ) ) . ( $history_page ? "[{$history_page}] " . get_permalink( $history_page ) : __( 'Not Set', 'give' ) ) ); |
|
124 | - WP_CLI::log( $this->color_message( __( 'Country: ', 'give' ) ) . give_get_country() ); |
|
121 | + WP_CLI::log($this->color_message(sprintf(__('Success Page: ', 'give'))).($success_page ? "[{$success_page}] ".get_permalink($success_page) : __('Not Set', 'give'))); |
|
122 | + WP_CLI::log($this->color_message(__('Failed Donation Page: ', 'give')).($failure_page ? "[{$failure_page}] ".get_permalink($failure_page) : __('Not Set', 'give'))); |
|
123 | + WP_CLI::log($this->color_message(__('Donation History Page: ', 'give')).($history_page ? "[{$history_page}] ".get_permalink($history_page) : __('Not Set', 'give'))); |
|
124 | + WP_CLI::log($this->color_message(__('Country: ', 'give')).give_get_country()); |
|
125 | 125 | |
126 | 126 | /** |
127 | 127 | * Currency Information. |
128 | 128 | */ |
129 | - $default_gateway = give_get_option( 'default_gateway' ); |
|
129 | + $default_gateway = give_get_option('default_gateway'); |
|
130 | 130 | |
131 | - WP_CLI::log( "\n#### " . $this->color_message( __( 'Currency Information', 'give' ) ) . ' ####' ); |
|
131 | + WP_CLI::log("\n#### ".$this->color_message(__('Currency Information', 'give')).' ####'); |
|
132 | 132 | |
133 | - WP_CLI::log( $this->color_message( __( 'Currency: ', 'give' ), give_get_currency() ) ); |
|
134 | - WP_CLI::log( $this->color_message( __( 'Currency Position: ', 'give' ), give_get_currency_position() ) ); |
|
135 | - WP_CLI::log( $this->color_message( __( 'Thousand Separator: ', 'give' ), give_get_price_thousand_separator() ) ); |
|
136 | - WP_CLI::log( $this->color_message( __( 'Decimal Separator: ', 'give' ), give_get_price_decimal_separator() ) ); |
|
137 | - WP_CLI::log( $this->color_message( __( 'Number of Decimals: ', 'give' ), give_get_price_decimals() ) ); |
|
138 | - WP_CLI::log( $this->color_message( __( 'Test Mode: ', 'give' ), ( give_get_option( 'test_mode' ) ? __( 'Yes', 'give' ) : __( 'No', 'give' ) ) ) ); |
|
139 | - WP_CLI::log( $this->color_message( __( 'Default Gateway: ', 'give' ), ( $default_gateway ? $default_gateway : __( 'Not Set', 'give' ) ) ) ); |
|
133 | + WP_CLI::log($this->color_message(__('Currency: ', 'give'), give_get_currency())); |
|
134 | + WP_CLI::log($this->color_message(__('Currency Position: ', 'give'), give_get_currency_position())); |
|
135 | + WP_CLI::log($this->color_message(__('Thousand Separator: ', 'give'), give_get_price_thousand_separator())); |
|
136 | + WP_CLI::log($this->color_message(__('Decimal Separator: ', 'give'), give_get_price_decimal_separator())); |
|
137 | + WP_CLI::log($this->color_message(__('Number of Decimals: ', 'give'), give_get_price_decimals())); |
|
138 | + WP_CLI::log($this->color_message(__('Test Mode: ', 'give'), (give_get_option('test_mode') ? __('Yes', 'give') : __('No', 'give')))); |
|
139 | + WP_CLI::log($this->color_message(__('Default Gateway: ', 'give'), ($default_gateway ? $default_gateway : __('Not Set', 'give')))); |
|
140 | 140 | |
141 | 141 | // Payment gateways Information. |
142 | - $gateways = give_get_ordered_payment_gateways( give_get_payment_gateways() ); |
|
143 | - WP_CLI::log( $this->color_message( __( 'Enabled Gateways: ', 'give' ) ) ); |
|
142 | + $gateways = give_get_ordered_payment_gateways(give_get_payment_gateways()); |
|
143 | + WP_CLI::log($this->color_message(__('Enabled Gateways: ', 'give'))); |
|
144 | 144 | |
145 | - if ( ! empty( $gateways ) ) { |
|
145 | + if ( ! empty($gateways)) { |
|
146 | 146 | self::$counter = 1; |
147 | - foreach ( $gateways as $gateway ) { |
|
148 | - WP_CLI::log( ' ' . $this->color_message( self::$counter, $gateway['admin_label'] ) ); |
|
149 | - self::$counter ++; |
|
147 | + foreach ($gateways as $gateway) { |
|
148 | + WP_CLI::log(' '.$this->color_message(self::$counter, $gateway['admin_label'])); |
|
149 | + self::$counter++; |
|
150 | 150 | } |
151 | 151 | } else { |
152 | - WP_CLI::log( __( 'Not any payment gateways found', 'give' ) ); |
|
152 | + WP_CLI::log(__('Not any payment gateways found', 'give')); |
|
153 | 153 | } |
154 | 154 | } |
155 | 155 | |
@@ -181,15 +181,15 @@ discard block |
||
181 | 181 | * |
182 | 182 | * @subcommand forms |
183 | 183 | */ |
184 | - public function forms( $args, $assoc_args ) { |
|
184 | + public function forms($args, $assoc_args) { |
|
185 | 185 | global $wp_query; |
186 | - $form_id = isset( $assoc_args ) && array_key_exists( 'id', $assoc_args ) ? absint( $assoc_args['id'] ) : false; |
|
187 | - $number = isset( $assoc_args ) && array_key_exists( 'number', $assoc_args ) ? absint( $assoc_args['number'] ) : 10; |
|
186 | + $form_id = isset($assoc_args) && array_key_exists('id', $assoc_args) ? absint($assoc_args['id']) : false; |
|
187 | + $number = isset($assoc_args) && array_key_exists('number', $assoc_args) ? absint($assoc_args['number']) : 10; |
|
188 | 188 | $start = time(); |
189 | 189 | |
190 | 190 | // Cache previous number query var. |
191 | 191 | $is_set_number = $cache_per_page = false; |
192 | - if ( isset( $wp_query->query_vars['number'] ) ) { |
|
192 | + if (isset($wp_query->query_vars['number'])) { |
|
193 | 193 | $cache_per_page = $wp_query->query_vars['number']; |
194 | 194 | $is_set_number = true; |
195 | 195 | } |
@@ -198,22 +198,22 @@ discard block |
||
198 | 198 | $wp_query->query_vars['number'] = $number; |
199 | 199 | |
200 | 200 | // Get forms. |
201 | - $forms = $form_id ? $this->api->get_forms( $form_id ) : $this->api->get_forms(); |
|
201 | + $forms = $form_id ? $this->api->get_forms($form_id) : $this->api->get_forms(); |
|
202 | 202 | |
203 | 203 | // Reset number query var. |
204 | - if ( $is_set_number ) { |
|
204 | + if ($is_set_number) { |
|
205 | 205 | $wp_query->query_vars['number'] = $cache_per_page; |
206 | 206 | } |
207 | 207 | |
208 | 208 | // Bailout. |
209 | - if ( array_key_exists( 'error', $forms ) ) { |
|
209 | + if (array_key_exists('error', $forms)) { |
|
210 | 210 | |
211 | - WP_CLI::warning( $forms['error'] ); |
|
211 | + WP_CLI::warning($forms['error']); |
|
212 | 212 | |
213 | 213 | return; |
214 | - } elseif ( empty( $forms['forms'] ) ) { |
|
214 | + } elseif (empty($forms['forms'])) { |
|
215 | 215 | |
216 | - WP_CLI::error( __( 'No forms found.', 'give' ) ); |
|
216 | + WP_CLI::error(__('No forms found.', 'give')); |
|
217 | 217 | |
218 | 218 | return; |
219 | 219 | } |
@@ -221,25 +221,25 @@ discard block |
||
221 | 221 | // Param to check if form typeis already showed or not. |
222 | 222 | $is_show_form_type = false; |
223 | 223 | |
224 | - if ( 1 === count( $forms ) && $form_id ) { |
|
224 | + if (1 === count($forms) && $form_id) { |
|
225 | 225 | // Show single form. |
226 | - foreach ( $forms['forms'][0] as $key => $info ) { |
|
227 | - switch ( $key ) { |
|
226 | + foreach ($forms['forms'][0] as $key => $info) { |
|
227 | + switch ($key) { |
|
228 | 228 | case 'stats': |
229 | - $this->color_main_heading( ucfirst( $key ) ); |
|
229 | + $this->color_main_heading(ucfirst($key)); |
|
230 | 230 | |
231 | - foreach ( $info as $heading => $data ) { |
|
232 | - $this->color_sub_heading( ucfirst( $heading ) ); |
|
233 | - switch ( $heading ) { |
|
231 | + foreach ($info as $heading => $data) { |
|
232 | + $this->color_sub_heading(ucfirst($heading)); |
|
233 | + switch ($heading) { |
|
234 | 234 | default: |
235 | - foreach ( $data as $subheading => $subdata ) { |
|
235 | + foreach ($data as $subheading => $subdata) { |
|
236 | 236 | |
237 | - switch ( $subheading ) { |
|
237 | + switch ($subheading) { |
|
238 | 238 | case 'earnings': |
239 | - WP_CLI::log( $this->color_message( $subheading . ': ', give_currency_filter( $subdata ) ) ); |
|
239 | + WP_CLI::log($this->color_message($subheading.': ', give_currency_filter($subdata))); |
|
240 | 240 | break; |
241 | 241 | default: |
242 | - WP_CLI::log( $this->color_message( $subheading . ': ', $subdata ) ); |
|
242 | + WP_CLI::log($this->color_message($subheading.': ', $subdata)); |
|
243 | 243 | } |
244 | 244 | } |
245 | 245 | } |
@@ -249,26 +249,26 @@ discard block |
||
249 | 249 | case 'pricing': |
250 | 250 | case 'info': |
251 | 251 | default: |
252 | - $this->color_main_heading( ucfirst( $key ) ); |
|
252 | + $this->color_main_heading(ucfirst($key)); |
|
253 | 253 | |
254 | 254 | // Show form type. |
255 | - if ( ! $is_show_form_type ) { |
|
256 | - $form = new Give_Donate_Form( $form_id ); |
|
255 | + if ( ! $is_show_form_type) { |
|
256 | + $form = new Give_Donate_Form($form_id); |
|
257 | 257 | $is_show_form_type = true; |
258 | 258 | |
259 | - WP_CLI::log( $this->color_message( __( 'form type', 'give' ), $form->get_type() ) ); |
|
259 | + WP_CLI::log($this->color_message(__('form type', 'give'), $form->get_type())); |
|
260 | 260 | } |
261 | 261 | |
262 | - foreach ( $info as $heading => $data ) { |
|
262 | + foreach ($info as $heading => $data) { |
|
263 | 263 | |
264 | - switch ( $heading ) { |
|
264 | + switch ($heading) { |
|
265 | 265 | case 'id': |
266 | - WP_CLI::log( $this->color_message( $heading, $data ) ); |
|
266 | + WP_CLI::log($this->color_message($heading, $data)); |
|
267 | 267 | break; |
268 | 268 | |
269 | 269 | default: |
270 | - $data = empty( $data ) ? __( 'Not set', 'give' ) : $data; |
|
271 | - WP_CLI::log( $this->color_message( $heading, $data ) ); |
|
270 | + $data = empty($data) ? __('Not set', 'give') : $data; |
|
271 | + WP_CLI::log($this->color_message($heading, $data)); |
|
272 | 272 | } |
273 | 273 | } |
274 | 274 | }// End switch(). |
@@ -279,37 +279,37 @@ discard block |
||
279 | 279 | $is_table_first_row_set = false; |
280 | 280 | $table_column_count = 0; |
281 | 281 | |
282 | - WP_CLI::line( $this->color_message( sprintf( __( '%d donation forms found', 'give' ), count( $forms['forms'] ) ), '', false ) ); |
|
282 | + WP_CLI::line($this->color_message(sprintf(__('%d donation forms found', 'give'), count($forms['forms'])), '', false)); |
|
283 | 283 | |
284 | - foreach ( $forms['forms'] as $index => $form_data ) { |
|
284 | + foreach ($forms['forms'] as $index => $form_data) { |
|
285 | 285 | |
286 | 286 | // Default table data. |
287 | 287 | $table_first_row = array(); |
288 | 288 | $table_row = array(); |
289 | 289 | |
290 | - foreach ( $form_data['info'] as $key => $form ) { |
|
290 | + foreach ($form_data['info'] as $key => $form) { |
|
291 | 291 | |
292 | 292 | // Do not show thumbnail, content and link in table. |
293 | - if ( in_array( $key, array( 'content', 'thumbnail', 'link' ), true ) ) { |
|
293 | + if (in_array($key, array('content', 'thumbnail', 'link'), true)) { |
|
294 | 294 | continue; |
295 | 295 | } |
296 | 296 | |
297 | - if ( ! $is_table_first_row_set ) { |
|
297 | + if ( ! $is_table_first_row_set) { |
|
298 | 298 | $table_first_row[] = $key; |
299 | 299 | } |
300 | 300 | |
301 | 301 | $table_row[] = $form; |
302 | 302 | |
303 | - if ( 'status' === $key ) { |
|
303 | + if ('status' === $key) { |
|
304 | 304 | // First array item will be an form id in our case. |
305 | - $form = new Give_Donate_Form( absint( $table_row[0] ) ); |
|
305 | + $form = new Give_Donate_Form(absint($table_row[0])); |
|
306 | 306 | |
307 | 307 | $table_row[] = $form->get_type(); |
308 | 308 | } |
309 | 309 | } |
310 | 310 | |
311 | 311 | // Set table first row. |
312 | - if ( ! $is_table_first_row_set ) { |
|
312 | + if ( ! $is_table_first_row_set) { |
|
313 | 313 | |
314 | 314 | // Add extra column to table. |
315 | 315 | $table_first_row[] = 'type'; |
@@ -322,7 +322,7 @@ discard block |
||
322 | 322 | $table_data[] = $table_row; |
323 | 323 | }// End foreach(). |
324 | 324 | |
325 | - $this->display_table( $table_data ); |
|
325 | + $this->display_table($table_data); |
|
326 | 326 | }// End if(). |
327 | 327 | } |
328 | 328 | |
@@ -375,59 +375,59 @@ discard block |
||
375 | 375 | * |
376 | 376 | * @subcommand donors |
377 | 377 | */ |
378 | - public function donors( $args, $assoc_args ) { |
|
378 | + public function donors($args, $assoc_args) { |
|
379 | 379 | global $wp_query; |
380 | - $donor_id = isset( $assoc_args ) && array_key_exists( 'id', $assoc_args ) ? absint( $assoc_args['id'] ) : false; |
|
381 | - $email = isset( $assoc_args ) && array_key_exists( 'email', $assoc_args ) ? $assoc_args['email'] : false; |
|
382 | - $name = isset( $assoc_args ) && array_key_exists( 'name', $assoc_args ) ? $assoc_args['name'] : ''; |
|
383 | - $create = isset( $assoc_args ) && array_key_exists( 'create', $assoc_args ) ? $assoc_args['create'] : false; |
|
384 | - $number = isset( $assoc_args ) && array_key_exists( 'number', $assoc_args ) ? $assoc_args['number'] : 10; |
|
385 | - $form_id = isset( $assoc_args ) && array_key_exists( 'form-id', $assoc_args ) ? $assoc_args['form-id'] : 0; |
|
386 | - $format = isset( $assoc_args ) && array_key_exists( 'format', $assoc_args ) ? $assoc_args['format'] : 'table'; |
|
380 | + $donor_id = isset($assoc_args) && array_key_exists('id', $assoc_args) ? absint($assoc_args['id']) : false; |
|
381 | + $email = isset($assoc_args) && array_key_exists('email', $assoc_args) ? $assoc_args['email'] : false; |
|
382 | + $name = isset($assoc_args) && array_key_exists('name', $assoc_args) ? $assoc_args['name'] : ''; |
|
383 | + $create = isset($assoc_args) && array_key_exists('create', $assoc_args) ? $assoc_args['create'] : false; |
|
384 | + $number = isset($assoc_args) && array_key_exists('number', $assoc_args) ? $assoc_args['number'] : 10; |
|
385 | + $form_id = isset($assoc_args) && array_key_exists('form-id', $assoc_args) ? $assoc_args['form-id'] : 0; |
|
386 | + $format = isset($assoc_args) && array_key_exists('format', $assoc_args) ? $assoc_args['format'] : 'table'; |
|
387 | 387 | $start = time(); |
388 | 388 | |
389 | - if ( $create ) { |
|
390 | - if ( 80 < $create ) { |
|
391 | - WP_CLI::warning( 'Currently we can only generate maximum 80 donors.', 'give' ); |
|
389 | + if ($create) { |
|
390 | + if (80 < $create) { |
|
391 | + WP_CLI::warning('Currently we can only generate maximum 80 donors.', 'give'); |
|
392 | 392 | $create = 80; |
393 | 393 | } |
394 | 394 | |
395 | 395 | $number = 1; |
396 | 396 | |
397 | - if ( isset( $assoc_args['email'] ) && ! is_email( $email ) ) { |
|
398 | - WP_CLI::warning( 'Wrong email address provided.', 'give' ); |
|
397 | + if (isset($assoc_args['email']) && ! is_email($email)) { |
|
398 | + WP_CLI::warning('Wrong email address provided.', 'give'); |
|
399 | 399 | |
400 | 400 | return; |
401 | 401 | } |
402 | 402 | |
403 | 403 | // Create one or more donors. |
404 | - if ( ! $email ) { |
|
404 | + if ( ! $email) { |
|
405 | 405 | // If no email is specified, look to see if we are generating arbitrary donor accounts. |
406 | - $number = is_numeric( $create ) ? absint( $create ) : 1; |
|
406 | + $number = is_numeric($create) ? absint($create) : 1; |
|
407 | 407 | } |
408 | 408 | |
409 | - for ( $i = 0; $i < $number; $i ++ ) { |
|
409 | + for ($i = 0; $i < $number; $i++) { |
|
410 | 410 | $name = $name ? $name : $this->get_random_name(); |
411 | - $email = $email ? $email : $this->get_random_email( $name ); |
|
411 | + $email = $email ? $email : $this->get_random_email($name); |
|
412 | 412 | |
413 | 413 | $args = array( |
414 | 414 | 'email' => $email, |
415 | 415 | 'name' => $name, |
416 | 416 | ); |
417 | 417 | |
418 | - $donor_id = Give()->donors->add( $args ); |
|
418 | + $donor_id = Give()->donors->add($args); |
|
419 | 419 | |
420 | - if ( $donor_id ) { |
|
421 | - WP_CLI::line( $this->color_message( sprintf( __( 'Donor #%d created successfully', 'give' ), $donor_id ) ) ); |
|
420 | + if ($donor_id) { |
|
421 | + WP_CLI::line($this->color_message(sprintf(__('Donor #%d created successfully', 'give'), $donor_id))); |
|
422 | 422 | } else { |
423 | - WP_CLI::error( __( 'Failed to create donor', 'give' ) ); |
|
423 | + WP_CLI::error(__('Failed to create donor', 'give')); |
|
424 | 424 | } |
425 | 425 | |
426 | 426 | // Reset email and name to false so it is generated on the next loop (if creating donors). |
427 | 427 | $email = $name = false; |
428 | 428 | } |
429 | 429 | |
430 | - WP_CLI::line( $this->color_message( sprintf( __( '%1$d donors created in %2$d seconds', 'give' ), $number, time() - $start ) ) ); |
|
430 | + WP_CLI::line($this->color_message(sprintf(__('%1$d donors created in %2$d seconds', 'give'), $number, time() - $start))); |
|
431 | 431 | |
432 | 432 | } else { |
433 | 433 | // Counter. |
@@ -441,7 +441,7 @@ discard block |
||
441 | 441 | */ |
442 | 442 | // Cache previous number query var. |
443 | 443 | $is_set_number = $cache_per_page = false; |
444 | - if ( isset( $wp_query->query_vars['number'] ) ) { |
|
444 | + if (isset($wp_query->query_vars['number'])) { |
|
445 | 445 | $cache_per_page = $wp_query->query_vars['number']; |
446 | 446 | $is_set_number = true; |
447 | 447 | } |
@@ -450,24 +450,24 @@ discard block |
||
450 | 450 | $wp_query->query_vars['number'] = $number; |
451 | 451 | |
452 | 452 | // Get donors. |
453 | - if ( $form_id ) { |
|
453 | + if ($form_id) { |
|
454 | 454 | // @TODO: Allow user to get a list of donors by donation status. |
455 | - $donors = $this->get_donors_by_form_id( $form_id ); |
|
455 | + $donors = $this->get_donors_by_form_id($form_id); |
|
456 | 456 | } else { |
457 | - $donors = $this->api->get_donors( $search ); |
|
457 | + $donors = $this->api->get_donors($search); |
|
458 | 458 | } |
459 | 459 | |
460 | 460 | // Reset number query var. |
461 | - if ( $is_set_number ) { |
|
461 | + if ($is_set_number) { |
|
462 | 462 | $wp_query->query_vars['number'] = $cache_per_page; |
463 | 463 | } |
464 | 464 | |
465 | - if ( isset( $donors['error'] ) ) { |
|
466 | - WP_CLI::error( $donors['error'] ); |
|
465 | + if (isset($donors['error'])) { |
|
466 | + WP_CLI::error($donors['error']); |
|
467 | 467 | } |
468 | 468 | |
469 | - if ( empty( $donors ) ) { |
|
470 | - WP_CLI::error( __( 'No donors found.', 'give' ) ); |
|
469 | + if (empty($donors)) { |
|
470 | + WP_CLI::error(__('No donors found.', 'give')); |
|
471 | 471 | |
472 | 472 | return; |
473 | 473 | } |
@@ -475,24 +475,24 @@ discard block |
||
475 | 475 | $table_data = array(); |
476 | 476 | $is_table_first_row_set = false; |
477 | 477 | |
478 | - foreach ( $donors['donors'] as $donor_data ) { |
|
478 | + foreach ($donors['donors'] as $donor_data) { |
|
479 | 479 | // Set default table row data. |
480 | - $table_first_row = array( __( 's_no', 'give' ) ); |
|
481 | - $table_row = array( self::$counter ); |
|
480 | + $table_first_row = array(__('s_no', 'give')); |
|
481 | + $table_row = array(self::$counter); |
|
482 | 482 | |
483 | - foreach ( $donor_data as $key => $donor ) { |
|
484 | - switch ( $key ) { |
|
483 | + foreach ($donor_data as $key => $donor) { |
|
484 | + switch ($key) { |
|
485 | 485 | case 'stats': |
486 | - foreach ( $donor as $heading => $data ) { |
|
486 | + foreach ($donor as $heading => $data) { |
|
487 | 487 | |
488 | 488 | // Get first row. |
489 | - if ( ! $is_table_first_row_set ) { |
|
489 | + if ( ! $is_table_first_row_set) { |
|
490 | 490 | $table_first_row[] = $heading; |
491 | 491 | } |
492 | 492 | |
493 | - switch ( $heading ) { |
|
493 | + switch ($heading) { |
|
494 | 494 | case 'total_spent': |
495 | - $table_row[] = give_currency_filter( $data ); |
|
495 | + $table_row[] = give_currency_filter($data); |
|
496 | 496 | break; |
497 | 497 | |
498 | 498 | default: |
@@ -503,10 +503,10 @@ discard block |
||
503 | 503 | |
504 | 504 | case 'info': |
505 | 505 | default: |
506 | - foreach ( $donor as $heading => $data ) { |
|
506 | + foreach ($donor as $heading => $data) { |
|
507 | 507 | |
508 | 508 | // Get first row. |
509 | - if ( ! $is_table_first_row_set ) { |
|
509 | + if ( ! $is_table_first_row_set) { |
|
510 | 510 | $table_first_row[] = $heading; |
511 | 511 | } |
512 | 512 | |
@@ -516,7 +516,7 @@ discard block |
||
516 | 516 | } |
517 | 517 | |
518 | 518 | // Add first row data to table data. |
519 | - if ( ! $is_table_first_row_set ) { |
|
519 | + if ( ! $is_table_first_row_set) { |
|
520 | 520 | $table_data[] = $table_first_row; |
521 | 521 | $is_table_first_row_set = true; |
522 | 522 | } |
@@ -525,44 +525,44 @@ discard block |
||
525 | 525 | $table_data[] = $table_row; |
526 | 526 | |
527 | 527 | // Increase counter. |
528 | - self::$counter ++; |
|
528 | + self::$counter++; |
|
529 | 529 | }// End foreach(). |
530 | 530 | |
531 | - switch ( $format ) { |
|
531 | + switch ($format) { |
|
532 | 532 | case 'json': |
533 | 533 | $table_column_name = $table_data[0]; |
534 | - unset( $table_data[0] ); |
|
534 | + unset($table_data[0]); |
|
535 | 535 | |
536 | 536 | $new_table_data = array(); |
537 | - foreach ( $table_data as $index => $data ) { |
|
538 | - foreach ( $data as $key => $value ) { |
|
539 | - $new_table_data[ $index ][ $table_column_name[ $key ] ] = $value; |
|
537 | + foreach ($table_data as $index => $data) { |
|
538 | + foreach ($data as $key => $value) { |
|
539 | + $new_table_data[$index][$table_column_name[$key]] = $value; |
|
540 | 540 | } |
541 | 541 | } |
542 | 542 | |
543 | - WP_CLI::log( json_encode( $new_table_data ) ); |
|
543 | + WP_CLI::log(json_encode($new_table_data)); |
|
544 | 544 | break; |
545 | 545 | |
546 | 546 | case 'csv': |
547 | - $file_path = trailingslashit( WP_CONTENT_DIR ) . 'uploads/give_donors_' . date( 'Y_m_d_s', current_time( 'timestamp' ) ) . '.csv'; |
|
548 | - $fp = fopen( $file_path, 'w' ); |
|
547 | + $file_path = trailingslashit(WP_CONTENT_DIR).'uploads/give_donors_'.date('Y_m_d_s', current_time('timestamp')).'.csv'; |
|
548 | + $fp = fopen($file_path, 'w'); |
|
549 | 549 | |
550 | - if ( is_writable( $file_path ) ) { |
|
551 | - foreach ( $table_data as $fields ) { |
|
552 | - fputcsv( $fp, $fields ); |
|
550 | + if (is_writable($file_path)) { |
|
551 | + foreach ($table_data as $fields) { |
|
552 | + fputcsv($fp, $fields); |
|
553 | 553 | } |
554 | 554 | |
555 | - fclose( $fp ); |
|
555 | + fclose($fp); |
|
556 | 556 | |
557 | - WP_CLI::success( "Donors list csv created successfully: {$file_path}" ); |
|
557 | + WP_CLI::success("Donors list csv created successfully: {$file_path}"); |
|
558 | 558 | } else { |
559 | - WP_CLI::warning( "Unable to create donors list csv file: {$file_path} (May folder do not have write permission)" ); |
|
559 | + WP_CLI::warning("Unable to create donors list csv file: {$file_path} (May folder do not have write permission)"); |
|
560 | 560 | } |
561 | 561 | |
562 | 562 | break; |
563 | 563 | |
564 | 564 | default: |
565 | - $this->display_table( $table_data ); |
|
565 | + $this->display_table($table_data); |
|
566 | 566 | }// End switch(). |
567 | 567 | }// End if(). |
568 | 568 | } |
@@ -592,13 +592,13 @@ discard block |
||
592 | 592 | * |
593 | 593 | * @subcommand donations |
594 | 594 | */ |
595 | - public function donations( $args, $assoc_args ) { |
|
595 | + public function donations($args, $assoc_args) { |
|
596 | 596 | global $wp_query; |
597 | - $number = isset( $assoc_args ) && array_key_exists( 'number', $assoc_args ) ? $assoc_args['number'] : 10; |
|
597 | + $number = isset($assoc_args) && array_key_exists('number', $assoc_args) ? $assoc_args['number'] : 10; |
|
598 | 598 | |
599 | 599 | // Cache previous number query var. |
600 | 600 | $is_set_number = $cache_per_page = false; |
601 | - if ( isset( $wp_query->query_vars['number'] ) ) { |
|
601 | + if (isset($wp_query->query_vars['number'])) { |
|
602 | 602 | $cache_per_page = $wp_query->query_vars['number']; |
603 | 603 | $is_set_number = true; |
604 | 604 | } |
@@ -610,46 +610,46 @@ discard block |
||
610 | 610 | $donations = $this->api->get_recent_donations(); |
611 | 611 | |
612 | 612 | // Reset number query var. |
613 | - if ( $is_set_number ) { |
|
613 | + if ($is_set_number) { |
|
614 | 614 | $wp_query->query_vars['number'] = $cache_per_page; |
615 | 615 | } |
616 | 616 | |
617 | - if ( empty( $donations ) ) { |
|
618 | - WP_CLI::error( __( 'No donations found.', 'give' ) ); |
|
617 | + if (empty($donations)) { |
|
618 | + WP_CLI::error(__('No donations found.', 'give')); |
|
619 | 619 | |
620 | 620 | return; |
621 | 621 | } |
622 | 622 | |
623 | 623 | self::$counter = 1; |
624 | 624 | |
625 | - foreach ( $donations['donations'] as $key => $donation ) { |
|
626 | - $this->color_main_heading( sprintf( __( '%1$s. Donation #%2$s', 'give' ), self::$counter, $donation['ID'] ), 'Y' ); |
|
627 | - self::$counter ++; |
|
625 | + foreach ($donations['donations'] as $key => $donation) { |
|
626 | + $this->color_main_heading(sprintf(__('%1$s. Donation #%2$s', 'give'), self::$counter, $donation['ID']), 'Y'); |
|
627 | + self::$counter++; |
|
628 | 628 | |
629 | - foreach ( $donation as $column => $data ) { |
|
629 | + foreach ($donation as $column => $data) { |
|
630 | 630 | |
631 | - if ( is_array( $data ) ) { |
|
632 | - $this->color_sub_heading( $column ); |
|
633 | - foreach ( $data as $subcolumn => $subdata ) { |
|
631 | + if (is_array($data)) { |
|
632 | + $this->color_sub_heading($column); |
|
633 | + foreach ($data as $subcolumn => $subdata) { |
|
634 | 634 | |
635 | 635 | // Decode html codes. |
636 | - switch ( $subcolumn ) { |
|
636 | + switch ($subcolumn) { |
|
637 | 637 | case 'name': |
638 | - $subdata = html_entity_decode( $subdata ); |
|
638 | + $subdata = html_entity_decode($subdata); |
|
639 | 639 | break; |
640 | 640 | } |
641 | 641 | |
642 | 642 | // @TODO Check if multi dimension array information is importent to show or not. For example inside donation array we have array for fees data inside payment meta. |
643 | - if ( is_array( $subdata ) ) { |
|
643 | + if (is_array($subdata)) { |
|
644 | 644 | continue; |
645 | 645 | } |
646 | 646 | |
647 | - WP_CLI::log( $this->color_message( $subcolumn, $subdata ) ); |
|
647 | + WP_CLI::log($this->color_message($subcolumn, $subdata)); |
|
648 | 648 | } |
649 | 649 | continue; |
650 | 650 | } |
651 | 651 | |
652 | - WP_CLI::log( $this->color_message( $column, $data ) ); |
|
652 | + WP_CLI::log($this->color_message($column, $data)); |
|
653 | 653 | } |
654 | 654 | } |
655 | 655 | } |
@@ -689,27 +689,27 @@ discard block |
||
689 | 689 | * |
690 | 690 | * @return void |
691 | 691 | */ |
692 | - public function report( $args, $assoc_args ) { |
|
692 | + public function report($args, $assoc_args) { |
|
693 | 693 | $stats = new Give_Payment_Stats(); |
694 | - $date = isset( $assoc_args ) && array_key_exists( 'date', $assoc_args ) ? $assoc_args['date'] : false; |
|
695 | - $start_date = isset( $assoc_args ) && array_key_exists( 'start-date', $assoc_args ) ? $assoc_args['start-date'] : false; |
|
696 | - $end_date = isset( $assoc_args ) && array_key_exists( 'end-date', $assoc_args ) ? $assoc_args['end-date'] : false; |
|
697 | - $form_id = isset( $assoc_args ) && array_key_exists( 'id', $assoc_args ) ? $assoc_args['id'] : 0; |
|
694 | + $date = isset($assoc_args) && array_key_exists('date', $assoc_args) ? $assoc_args['date'] : false; |
|
695 | + $start_date = isset($assoc_args) && array_key_exists('start-date', $assoc_args) ? $assoc_args['start-date'] : false; |
|
696 | + $end_date = isset($assoc_args) && array_key_exists('end-date', $assoc_args) ? $assoc_args['end-date'] : false; |
|
697 | + $form_id = isset($assoc_args) && array_key_exists('id', $assoc_args) ? $assoc_args['id'] : 0; |
|
698 | 698 | |
699 | - if ( ! empty( $date ) ) { |
|
699 | + if ( ! empty($date)) { |
|
700 | 700 | $start_date = $date; |
701 | 701 | $end_date = false; |
702 | - } elseif ( empty( $date ) && empty( $start_date ) ) { |
|
702 | + } elseif (empty($date) && empty($start_date)) { |
|
703 | 703 | $start_date = 'this_month'; |
704 | 704 | $end_date = false; |
705 | 705 | } |
706 | 706 | |
707 | 707 | // Get stats. |
708 | - $earnings = $stats->get_earnings( $form_id, $start_date, $end_date ); |
|
709 | - $sales = $stats->get_sales( $form_id, $start_date, $end_date ); |
|
708 | + $earnings = $stats->get_earnings($form_id, $start_date, $end_date); |
|
709 | + $sales = $stats->get_sales($form_id, $start_date, $end_date); |
|
710 | 710 | |
711 | - WP_CLI::line( $this->color_message( __( 'Earnings', 'give' ), give_currency_filter( $earnings, array( 'decode_currency' => true ) ) ) ); |
|
712 | - WP_CLI::line( $this->color_message( __( 'Sales', 'give' ), $sales ) ); |
|
711 | + WP_CLI::line($this->color_message(__('Earnings', 'give'), give_currency_filter($earnings, array('decode_currency' => true)))); |
|
712 | + WP_CLI::line($this->color_message(__('Sales', 'give'), $sales)); |
|
713 | 713 | } |
714 | 714 | |
715 | 715 | |
@@ -736,27 +736,27 @@ discard block |
||
736 | 736 | * |
737 | 737 | * @subcommand cache |
738 | 738 | */ |
739 | - public function cache( $args, $assoc_args ) { |
|
740 | - $action = isset( $assoc_args ) && array_key_exists( 'action', $assoc_args ) ? $assoc_args['action'] : false; |
|
739 | + public function cache($args, $assoc_args) { |
|
740 | + $action = isset($assoc_args) && array_key_exists('action', $assoc_args) ? $assoc_args['action'] : false; |
|
741 | 741 | |
742 | 742 | // Bailout. |
743 | - if ( ! $action || ! in_array( $action, array( 'delete' ), true ) ) { |
|
744 | - WP_CLI::warning( __( 'Type wp give cache --action=delete to delete all stat transients', 'give' ) ); |
|
743 | + if ( ! $action || ! in_array($action, array('delete'), true)) { |
|
744 | + WP_CLI::warning(__('Type wp give cache --action=delete to delete all stat transients', 'give')); |
|
745 | 745 | |
746 | 746 | return; |
747 | 747 | } |
748 | 748 | |
749 | - switch ( $action ) { |
|
749 | + switch ($action) { |
|
750 | 750 | case 'delete': |
751 | 751 | // Reset counter. |
752 | 752 | self::$counter = 1; |
753 | 753 | |
754 | - if ( $this->delete_stats_transients() ) { |
|
754 | + if ($this->delete_stats_transients()) { |
|
755 | 755 | // Report .eading. |
756 | - WP_CLI::success( 'Give cache deleted.' ); |
|
756 | + WP_CLI::success('Give cache deleted.'); |
|
757 | 757 | } else { |
758 | 758 | // Report .eading. |
759 | - WP_CLI::warning( 'We did not find any Give plugin cache to delete :)' ); |
|
759 | + WP_CLI::warning('We did not find any Give plugin cache to delete :)'); |
|
760 | 760 | } |
761 | 761 | break; |
762 | 762 | } |
@@ -785,27 +785,27 @@ discard block |
||
785 | 785 | ARRAY_A |
786 | 786 | ); |
787 | 787 | |
788 | - if ( ! empty( $stat_option_names ) ) { |
|
788 | + if ( ! empty($stat_option_names)) { |
|
789 | 789 | |
790 | - foreach ( $stat_option_names as $option_name ) { |
|
790 | + foreach ($stat_option_names as $option_name) { |
|
791 | 791 | $error = false; |
792 | 792 | $option_name = $option_name['option_name']; |
793 | 793 | |
794 | - switch ( true ) { |
|
795 | - case ( false !== strpos( $option_name, 'transient' ) ): |
|
796 | - $option_name = str_replace( '_transient_', '', $option_name ); |
|
797 | - $error = delete_transient( $option_name ); |
|
794 | + switch (true) { |
|
795 | + case (false !== strpos($option_name, 'transient')): |
|
796 | + $option_name = str_replace('_transient_', '', $option_name); |
|
797 | + $error = delete_transient($option_name); |
|
798 | 798 | break; |
799 | 799 | |
800 | 800 | default: |
801 | - $error = delete_option( $option_name ); |
|
801 | + $error = delete_option($option_name); |
|
802 | 802 | } |
803 | 803 | |
804 | - if ( $error ) { |
|
805 | - WP_CLI::log( $this->color_message( self::$counter, $option_name ) ); |
|
806 | - self::$counter ++; |
|
804 | + if ($error) { |
|
805 | + WP_CLI::log($this->color_message(self::$counter, $option_name)); |
|
806 | + self::$counter++; |
|
807 | 807 | } else { |
808 | - WP_CLI::log( $this->color_message( __( 'Error while deleting this transient', 'give' ), $option_name ) ); |
|
808 | + WP_CLI::log($this->color_message(__('Error while deleting this transient', 'give'), $option_name)); |
|
809 | 809 | } |
810 | 810 | } |
811 | 811 | |
@@ -826,13 +826,13 @@ discard block |
||
826 | 826 | * |
827 | 827 | * @return string |
828 | 828 | */ |
829 | - private function color_message( $heading, $message = '', $colon = true, $color = 'g' ) { |
|
829 | + private function color_message($heading, $message = '', $colon = true, $color = 'g') { |
|
830 | 830 | // Add colon. |
831 | - if ( $colon ) { |
|
832 | - $heading = $heading . ': '; |
|
831 | + if ($colon) { |
|
832 | + $heading = $heading.': '; |
|
833 | 833 | } |
834 | 834 | |
835 | - return WP_CLI::colorize( "%{$color}" . $heading . '%n' ) . $message; |
|
835 | + return WP_CLI::colorize("%{$color}".$heading.'%n').$message; |
|
836 | 836 | } |
837 | 837 | |
838 | 838 | |
@@ -847,8 +847,8 @@ discard block |
||
847 | 847 | * |
848 | 848 | * @return void |
849 | 849 | */ |
850 | - private function color_main_heading( $heading, $color = 'g' ) { |
|
851 | - WP_CLI::log( "\n###### " . $this->color_message( $heading, '', false, $color ) . ' ######' ); |
|
850 | + private function color_main_heading($heading, $color = 'g') { |
|
851 | + WP_CLI::log("\n###### ".$this->color_message($heading, '', false, $color).' ######'); |
|
852 | 852 | } |
853 | 853 | |
854 | 854 | /** |
@@ -861,8 +861,8 @@ discard block |
||
861 | 861 | * |
862 | 862 | * @return void |
863 | 863 | */ |
864 | - private function color_sub_heading( $subheading ) { |
|
865 | - WP_CLI::log( "\n--->" . $subheading . '', '', false ); |
|
864 | + private function color_sub_heading($subheading) { |
|
865 | + WP_CLI::log("\n--->".$subheading.'', '', false); |
|
866 | 866 | } |
867 | 867 | |
868 | 868 | |
@@ -876,17 +876,17 @@ discard block |
||
876 | 876 | * |
877 | 877 | * @return void |
878 | 878 | */ |
879 | - private function display_table( $data ) { |
|
879 | + private function display_table($data) { |
|
880 | 880 | $table = new \cli\Table(); |
881 | 881 | |
882 | 882 | // Set table header. |
883 | - $table->setHeaders( $data[0] ); |
|
883 | + $table->setHeaders($data[0]); |
|
884 | 884 | |
885 | 885 | // Remove table header. |
886 | - unset( $data[0] ); |
|
886 | + unset($data[0]); |
|
887 | 887 | |
888 | 888 | // Set table data. |
889 | - $table->setRows( $data ); |
|
889 | + $table->setRows($data); |
|
890 | 890 | |
891 | 891 | // Display table. |
892 | 892 | $table->display(); |
@@ -903,14 +903,14 @@ discard block |
||
903 | 903 | * @return array |
904 | 904 | */ |
905 | 905 | |
906 | - private function get_donors_by_form_id( $form_id ) { |
|
906 | + private function get_donors_by_form_id($form_id) { |
|
907 | 907 | $donors = array(); |
908 | 908 | |
909 | 909 | $donations = new Give_Payments_Query( |
910 | 910 | array( |
911 | - 'give_forms' => array( $form_id ), |
|
912 | - 'number' => - 1, |
|
913 | - 'status' => array( 'publish' ), |
|
911 | + 'give_forms' => array($form_id), |
|
912 | + 'number' => -1, |
|
913 | + 'status' => array('publish'), |
|
914 | 914 | ) |
915 | 915 | ); |
916 | 916 | |
@@ -918,16 +918,16 @@ discard block |
||
918 | 918 | $skip_donors = array(); |
919 | 919 | |
920 | 920 | /* @var Give_Payment|object $donation Payment object. */ |
921 | - foreach ( $donations as $donation ) { |
|
921 | + foreach ($donations as $donation) { |
|
922 | 922 | |
923 | - if ( in_array( $donation->customer_id, $skip_donors, true ) ) { |
|
923 | + if (in_array($donation->customer_id, $skip_donors, true)) { |
|
924 | 924 | continue; |
925 | 925 | } |
926 | 926 | |
927 | - if ( ! empty( $donors ) ) { |
|
928 | - $donors['donors'][] = current( current( $this->api->get_donors( (int) $donation->customer_id ) ) ); |
|
927 | + if ( ! empty($donors)) { |
|
928 | + $donors['donors'][] = current(current($this->api->get_donors((int) $donation->customer_id))); |
|
929 | 929 | } else { |
930 | - $donors = array_merge( $donors, $this->api->get_donors( (int) $donation->customer_id ) ); |
|
930 | + $donors = array_merge($donors, $this->api->get_donors((int) $donation->customer_id)); |
|
931 | 931 | } |
932 | 932 | |
933 | 933 | $skip_donors[] = $donation->customer_id; |
@@ -972,15 +972,15 @@ discard block |
||
972 | 972 | ); |
973 | 973 | |
974 | 974 | // Generate a random forename. |
975 | - $random_name = $names[ mt_rand( 0, sizeof( $names ) - 1 ) ]; |
|
975 | + $random_name = $names[mt_rand(0, sizeof($names) - 1)]; |
|
976 | 976 | |
977 | 977 | // Generate a random surname. |
978 | - $random_surname = $surnames[ mt_rand( 0, sizeof( $surnames ) - 1 ) ]; |
|
978 | + $random_surname = $surnames[mt_rand(0, sizeof($surnames) - 1)]; |
|
979 | 979 | |
980 | 980 | // Generate name. |
981 | 981 | $name = "{$random_name} {$random_surname}"; |
982 | 982 | |
983 | - if ( in_array( $name, $this->new_donor_names ) ) { |
|
983 | + if (in_array($name, $this->new_donor_names)) { |
|
984 | 984 | $name = $this->get_random_name(); |
985 | 985 | } |
986 | 986 | |
@@ -999,8 +999,8 @@ discard block |
||
999 | 999 | * |
1000 | 1000 | * @return string |
1001 | 1001 | */ |
1002 | - private function get_random_email( $name ) { |
|
1003 | - return implode( '.', explode( ' ', strtolower( $name ) ) ) . '@test.com'; |
|
1002 | + private function get_random_email($name) { |
|
1003 | + return implode('.', explode(' ', strtolower($name))).'@test.com'; |
|
1004 | 1004 | } |
1005 | 1005 | |
1006 | 1006 | /** |
@@ -1015,59 +1015,59 @@ discard block |
||
1015 | 1015 | * @when after_wp_load |
1016 | 1016 | * @subcommand test-mode |
1017 | 1017 | */ |
1018 | - public function test_mode( $args, $assoc ) { |
|
1018 | + public function test_mode($args, $assoc) { |
|
1019 | 1019 | |
1020 | 1020 | // Return if associative arguments are not specified. |
1021 | - if ( empty( $assoc ) ) { |
|
1022 | - WP_CLI::error( "--enable or --disable flag is missing." ); |
|
1021 | + if (empty($assoc)) { |
|
1022 | + WP_CLI::error("--enable or --disable flag is missing."); |
|
1023 | 1023 | return; |
1024 | 1024 | } |
1025 | 1025 | |
1026 | - $enabled_gateways = give_get_option( 'gateways' ); |
|
1027 | - $default_gateway = give_get_option( 'default_gateway' ); |
|
1026 | + $enabled_gateways = give_get_option('gateways'); |
|
1027 | + $default_gateway = give_get_option('default_gateway'); |
|
1028 | 1028 | |
1029 | 1029 | |
1030 | 1030 | // Enable Test Mode. |
1031 | - if ( true === WP_CLI\Utils\get_flag_value( $assoc, 'enable' ) ) { |
|
1031 | + if (true === WP_CLI\Utils\get_flag_value($assoc, 'enable')) { |
|
1032 | 1032 | |
1033 | 1033 | // Set `Test Mode` to `enabled`. |
1034 | - give_update_option( 'test_mode', 'enabled' ); |
|
1034 | + give_update_option('test_mode', 'enabled'); |
|
1035 | 1035 | |
1036 | 1036 | |
1037 | 1037 | // Enable `Test Donation` gateway. |
1038 | 1038 | $enabled_gateways['manual'] = "1"; |
1039 | - give_update_option( 'gateways', $enabled_gateways ); |
|
1039 | + give_update_option('gateways', $enabled_gateways); |
|
1040 | 1040 | |
1041 | 1041 | |
1042 | 1042 | // Set `Test Donation` as default gateway. |
1043 | - add_option( 'give_test_mode_default_gateway', $default_gateway ); |
|
1044 | - give_update_option( 'default_gateway', 'manual' ); |
|
1043 | + add_option('give_test_mode_default_gateway', $default_gateway); |
|
1044 | + give_update_option('default_gateway', 'manual'); |
|
1045 | 1045 | |
1046 | 1046 | |
1047 | 1047 | // Show success message on completion. |
1048 | - WP_CLI::success( 'Give Test mode enabled' ); |
|
1048 | + WP_CLI::success('Give Test mode enabled'); |
|
1049 | 1049 | } |
1050 | 1050 | |
1051 | 1051 | // Disable Test Mode. |
1052 | - if ( true === WP_CLI\Utils\get_flag_value( $assoc, 'disable' ) ) { |
|
1052 | + if (true === WP_CLI\Utils\get_flag_value($assoc, 'disable')) { |
|
1053 | 1053 | |
1054 | 1054 | // Set `Test Mode` to `disabled`. |
1055 | - give_update_option( 'test_mode', 'disabled' ); |
|
1055 | + give_update_option('test_mode', 'disabled'); |
|
1056 | 1056 | |
1057 | 1057 | |
1058 | 1058 | // Disable `Test Donation` gateway. |
1059 | - unset( $enabled_gateways['manual'] ); |
|
1060 | - give_update_option( 'gateways', $enabled_gateways ); |
|
1059 | + unset($enabled_gateways['manual']); |
|
1060 | + give_update_option('gateways', $enabled_gateways); |
|
1061 | 1061 | |
1062 | 1062 | |
1063 | 1063 | // Backup `Default Gateway` setting for restore on test mode disable. |
1064 | - $default_gateway_backup = get_option( 'give_test_mode_default_gateway' ); |
|
1065 | - give_update_option( 'default_gateway', $default_gateway_backup ); |
|
1066 | - delete_option( 'give_test_mode_default_gateway' ); |
|
1064 | + $default_gateway_backup = get_option('give_test_mode_default_gateway'); |
|
1065 | + give_update_option('default_gateway', $default_gateway_backup); |
|
1066 | + delete_option('give_test_mode_default_gateway'); |
|
1067 | 1067 | |
1068 | 1068 | |
1069 | 1069 | // Show success message on completion. |
1070 | - WP_CLI::success( 'Give Test mode disabled' ); |
|
1070 | + WP_CLI::success('Give Test mode disabled'); |
|
1071 | 1071 | } |
1072 | 1072 | } |
1073 | 1073 | } |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -25,14 +25,14 @@ discard block |
||
25 | 25 | */ |
26 | 26 | function give_get_actions() { |
27 | 27 | |
28 | - $_get_action = ! empty( $_GET['give_action'] ) ? $_GET['give_action'] : null; |
|
28 | + $_get_action = ! empty($_GET['give_action']) ? $_GET['give_action'] : null; |
|
29 | 29 | |
30 | 30 | // Add backward compatibility to give-action param ( $_GET ) |
31 | - if ( empty( $_get_action ) ) { |
|
32 | - $_get_action = ! empty( $_GET['give-action'] ) ? $_GET['give-action'] : null; |
|
31 | + if (empty($_get_action)) { |
|
32 | + $_get_action = ! empty($_GET['give-action']) ? $_GET['give-action'] : null; |
|
33 | 33 | } |
34 | 34 | |
35 | - if ( isset( $_get_action ) ) { |
|
35 | + if (isset($_get_action)) { |
|
36 | 36 | /** |
37 | 37 | * Fires in WordPress init or admin init, when give_action is present in $_GET. |
38 | 38 | * |
@@ -40,12 +40,12 @@ discard block |
||
40 | 40 | * |
41 | 41 | * @param array $_GET Array of HTTP GET variables. |
42 | 42 | */ |
43 | - do_action( "give_{$_get_action}", $_GET ); |
|
43 | + do_action("give_{$_get_action}", $_GET); |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | } |
47 | 47 | |
48 | -add_action( 'init', 'give_get_actions' ); |
|
48 | +add_action('init', 'give_get_actions'); |
|
49 | 49 | |
50 | 50 | /** |
51 | 51 | * Hooks Give actions, when present in the $_POST super global. Every give_action |
@@ -58,14 +58,14 @@ discard block |
||
58 | 58 | */ |
59 | 59 | function give_post_actions() { |
60 | 60 | |
61 | - $_post_action = ! empty( $_POST['give_action'] ) ? $_POST['give_action'] : null; |
|
61 | + $_post_action = ! empty($_POST['give_action']) ? $_POST['give_action'] : null; |
|
62 | 62 | |
63 | 63 | // Add backward compatibility to give-action param ( $_POST ). |
64 | - if ( empty( $_post_action ) ) { |
|
65 | - $_post_action = ! empty( $_POST['give-action'] ) ? $_POST['give-action'] : null; |
|
64 | + if (empty($_post_action)) { |
|
65 | + $_post_action = ! empty($_POST['give-action']) ? $_POST['give-action'] : null; |
|
66 | 66 | } |
67 | 67 | |
68 | - if ( isset( $_post_action ) ) { |
|
68 | + if (isset($_post_action)) { |
|
69 | 69 | /** |
70 | 70 | * Fires in WordPress init or admin init, when give_action is present in $_POST. |
71 | 71 | * |
@@ -73,12 +73,12 @@ discard block |
||
73 | 73 | * |
74 | 74 | * @param array $_POST Array of HTTP POST variables. |
75 | 75 | */ |
76 | - do_action( "give_{$_post_action}", $_POST ); |
|
76 | + do_action("give_{$_post_action}", $_POST); |
|
77 | 77 | } |
78 | 78 | |
79 | 79 | } |
80 | 80 | |
81 | -add_action( 'init', 'give_post_actions' ); |
|
81 | +add_action('init', 'give_post_actions'); |
|
82 | 82 | |
83 | 83 | /** |
84 | 84 | * Connect WordPress user with Donor. |
@@ -90,17 +90,17 @@ discard block |
||
90 | 90 | * |
91 | 91 | * @return void |
92 | 92 | */ |
93 | -function give_connect_donor_to_wpuser( $user_id, $user_data ) { |
|
93 | +function give_connect_donor_to_wpuser($user_id, $user_data) { |
|
94 | 94 | /* @var Give_Donor $donor */ |
95 | - $donor = new Give_Donor( $user_data['user_email'] ); |
|
95 | + $donor = new Give_Donor($user_data['user_email']); |
|
96 | 96 | |
97 | 97 | // Validate donor id and check if do nor is already connect to wp user or not. |
98 | - if ( $donor->id && ! $donor->user_id ) { |
|
98 | + if ($donor->id && ! $donor->user_id) { |
|
99 | 99 | |
100 | 100 | // Update donor user_id. |
101 | - if ( $donor->update( array( 'user_id' => $user_id ) ) ) { |
|
102 | - $donor_note = sprintf( esc_html__( 'WordPress user #%d is connected to #%d', 'give' ), $user_id, $donor->id ); |
|
103 | - $donor->add_note( $donor_note ); |
|
101 | + if ($donor->update(array('user_id' => $user_id))) { |
|
102 | + $donor_note = sprintf(esc_html__('WordPress user #%d is connected to #%d', 'give'), $user_id, $donor->id); |
|
103 | + $donor->add_note($donor_note); |
|
104 | 104 | |
105 | 105 | // Update user_id meta in payments. |
106 | 106 | // if( ! empty( $donor->payment_ids ) && ( $donations = explode( ',', $donor->payment_ids ) ) ) { |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | } |
114 | 114 | } |
115 | 115 | |
116 | -add_action( 'give_insert_user', 'give_connect_donor_to_wpuser', 10, 2 ); |
|
116 | +add_action('give_insert_user', 'give_connect_donor_to_wpuser', 10, 2); |
|
117 | 117 | |
118 | 118 | |
119 | 119 | /** |
@@ -127,45 +127,45 @@ discard block |
||
127 | 127 | */ |
128 | 128 | function give_validate_license_when_site_migrated() { |
129 | 129 | // Store current site address if not already stored. |
130 | - $home_url_parts = parse_url( home_url() ); |
|
131 | - $home_url = isset( $home_url_parts['host'] ) ? $home_url_parts['host'] : false; |
|
132 | - $home_url .= isset( $home_url_parts['path'] ) ? $home_url_parts['path'] : ''; |
|
133 | - $site_address_before_migrate = get_option( 'give_site_address_before_migrate' ); |
|
130 | + $home_url_parts = parse_url(home_url()); |
|
131 | + $home_url = isset($home_url_parts['host']) ? $home_url_parts['host'] : false; |
|
132 | + $home_url .= isset($home_url_parts['path']) ? $home_url_parts['path'] : ''; |
|
133 | + $site_address_before_migrate = get_option('give_site_address_before_migrate'); |
|
134 | 134 | |
135 | 135 | // Need $home_url to proceed. |
136 | - if ( ! $home_url ) { |
|
136 | + if ( ! $home_url) { |
|
137 | 137 | return; |
138 | 138 | } |
139 | 139 | |
140 | 140 | // Save site address. |
141 | - if ( ! $site_address_before_migrate ) { |
|
141 | + if ( ! $site_address_before_migrate) { |
|
142 | 142 | // Update site address. |
143 | - update_option( 'give_site_address_before_migrate', $home_url ); |
|
143 | + update_option('give_site_address_before_migrate', $home_url); |
|
144 | 144 | |
145 | 145 | return; |
146 | 146 | } |
147 | 147 | |
148 | 148 | // Backwards compat. for before when we were storing URL scheme. |
149 | - if ( strpos( $site_address_before_migrate, 'http' ) ) { |
|
150 | - $site_address_before_migrate = parse_url( $site_address_before_migrate ); |
|
151 | - $site_address_before_migrate = isset( $site_address_before_migrate['host'] ) ? $site_address_before_migrate['host'] : false; |
|
149 | + if (strpos($site_address_before_migrate, 'http')) { |
|
150 | + $site_address_before_migrate = parse_url($site_address_before_migrate); |
|
151 | + $site_address_before_migrate = isset($site_address_before_migrate['host']) ? $site_address_before_migrate['host'] : false; |
|
152 | 152 | |
153 | 153 | // Add path for multisite installs. |
154 | - $site_address_before_migrate .= isset( $site_address_before_migrate['path'] ) ? $site_address_before_migrate['path'] : ''; |
|
154 | + $site_address_before_migrate .= isset($site_address_before_migrate['path']) ? $site_address_before_migrate['path'] : ''; |
|
155 | 155 | } |
156 | 156 | |
157 | 157 | // If the two URLs don't match run CRON. |
158 | - if ( $home_url !== $site_address_before_migrate ) { |
|
158 | + if ($home_url !== $site_address_before_migrate) { |
|
159 | 159 | // Immediately run cron. |
160 | - wp_schedule_single_event( time(), 'give_validate_license_when_site_migrated' ); |
|
160 | + wp_schedule_single_event(time(), 'give_validate_license_when_site_migrated'); |
|
161 | 161 | |
162 | 162 | // Update site address. |
163 | - update_option( 'give_site_address_before_migrate', $home_url ); |
|
163 | + update_option('give_site_address_before_migrate', $home_url); |
|
164 | 164 | } |
165 | 165 | |
166 | 166 | } |
167 | 167 | |
168 | -add_action( 'admin_init', 'give_validate_license_when_site_migrated' ); |
|
168 | +add_action('admin_init', 'give_validate_license_when_site_migrated'); |
|
169 | 169 | |
170 | 170 | |
171 | 171 | /** |
@@ -175,19 +175,19 @@ discard block |
||
175 | 175 | * |
176 | 176 | * @param $data |
177 | 177 | */ |
178 | -function give_donor_batch_export_complete( $data ) { |
|
178 | +function give_donor_batch_export_complete($data) { |
|
179 | 179 | // Remove donor ids cache. |
180 | 180 | if ( |
181 | - isset( $data['class'] ) |
|
181 | + isset($data['class']) |
|
182 | 182 | && 'Give_Batch_Donors_Export' === $data['class'] |
183 | - && ! empty( $data['forms'] ) |
|
184 | - && isset( $data['give_export_option']['query_id'] ) |
|
183 | + && ! empty($data['forms']) |
|
184 | + && isset($data['give_export_option']['query_id']) |
|
185 | 185 | ) { |
186 | - Give_Cache::delete( Give_Cache::get_key( $data['give_export_option']['query_id'] ) ); |
|
186 | + Give_Cache::delete(Give_Cache::get_key($data['give_export_option']['query_id'])); |
|
187 | 187 | } |
188 | 188 | } |
189 | 189 | |
190 | -add_action( 'give_file_export_complete', 'give_donor_batch_export_complete' ); |
|
190 | +add_action('give_file_export_complete', 'give_donor_batch_export_complete'); |
|
191 | 191 | |
192 | 192 | /** |
193 | 193 | * Print css for wordpress setting pages. |
@@ -198,12 +198,12 @@ discard block |
||
198 | 198 | /* @var WP_Screen $screen */ |
199 | 199 | $screen = get_current_screen(); |
200 | 200 | |
201 | - if ( ! ( $screen instanceof WP_Screen ) ) { |
|
201 | + if ( ! ($screen instanceof WP_Screen)) { |
|
202 | 202 | return false; |
203 | 203 | } |
204 | 204 | |
205 | - switch ( true ) { |
|
206 | - case ( 'plugins' === $screen->base || 'plugins-network' === $screen->base ): |
|
205 | + switch (true) { |
|
206 | + case ('plugins' === $screen->base || 'plugins-network' === $screen->base): |
|
207 | 207 | ?> |
208 | 208 | <style> |
209 | 209 | tr.active.update + tr.give-addon-notice-tr td { |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | } |
241 | 241 | } |
242 | 242 | |
243 | -add_action( 'admin_head', 'give_admin_quick_css' ); |
|
243 | +add_action('admin_head', 'give_admin_quick_css'); |
|
244 | 244 | |
245 | 245 | |
246 | 246 | /** |
@@ -252,31 +252,31 @@ discard block |
||
252 | 252 | * |
253 | 253 | * @return void |
254 | 254 | */ |
255 | -function give_set_donation_levels_max_min_amount( $form_id ) { |
|
255 | +function give_set_donation_levels_max_min_amount($form_id) { |
|
256 | 256 | if ( |
257 | - ( 'set' === $_POST['_give_price_option'] ) || |
|
258 | - ( in_array( '_give_donation_levels', $_POST ) && count( $_POST['_give_donation_levels'] ) <= 0 ) || |
|
259 | - ! ( $donation_levels_amounts = wp_list_pluck( $_POST['_give_donation_levels'], '_give_amount' ) ) |
|
257 | + ('set' === $_POST['_give_price_option']) || |
|
258 | + (in_array('_give_donation_levels', $_POST) && count($_POST['_give_donation_levels']) <= 0) || |
|
259 | + ! ($donation_levels_amounts = wp_list_pluck($_POST['_give_donation_levels'], '_give_amount')) |
|
260 | 260 | ) { |
261 | 261 | // Delete old meta. |
262 | - give_delete_meta( $form_id, '_give_levels_minimum_amount' ); |
|
263 | - give_delete_meta( $form_id, '_give_levels_maximum_amount' ); |
|
262 | + give_delete_meta($form_id, '_give_levels_minimum_amount'); |
|
263 | + give_delete_meta($form_id, '_give_levels_maximum_amount'); |
|
264 | 264 | |
265 | 265 | return; |
266 | 266 | } |
267 | 267 | |
268 | 268 | // Sanitize donation level amounts. |
269 | - $donation_levels_amounts = array_map( 'give_maybe_sanitize_amount', $donation_levels_amounts ); |
|
269 | + $donation_levels_amounts = array_map('give_maybe_sanitize_amount', $donation_levels_amounts); |
|
270 | 270 | |
271 | - $min_amount = min( $donation_levels_amounts ); |
|
272 | - $max_amount = max( $donation_levels_amounts ); |
|
271 | + $min_amount = min($donation_levels_amounts); |
|
272 | + $max_amount = max($donation_levels_amounts); |
|
273 | 273 | |
274 | 274 | // Set Minimum and Maximum amount for Multi Level Donation Forms. |
275 | - give_update_meta( $form_id, '_give_levels_minimum_amount', $min_amount ? give_sanitize_amount_for_db( $min_amount ) : 0 ); |
|
276 | - give_update_meta( $form_id, '_give_levels_maximum_amount', $max_amount ? give_sanitize_amount_for_db( $max_amount ) : 0 ); |
|
275 | + give_update_meta($form_id, '_give_levels_minimum_amount', $min_amount ? give_sanitize_amount_for_db($min_amount) : 0); |
|
276 | + give_update_meta($form_id, '_give_levels_maximum_amount', $max_amount ? give_sanitize_amount_for_db($max_amount) : 0); |
|
277 | 277 | } |
278 | 278 | |
279 | -add_action( 'give_pre_process_give_forms_meta', 'give_set_donation_levels_max_min_amount', 30 ); |
|
279 | +add_action('give_pre_process_give_forms_meta', 'give_set_donation_levels_max_min_amount', 30); |
|
280 | 280 | |
281 | 281 | |
282 | 282 | /** |
@@ -286,23 +286,23 @@ discard block |
||
286 | 286 | * |
287 | 287 | * @param int $payment_id |
288 | 288 | */ |
289 | -function _give_save_donor_billing_address( $payment_id ) { |
|
290 | - $donor_id = absint( give_get_payment_donor_id( $payment_id )); |
|
289 | +function _give_save_donor_billing_address($payment_id) { |
|
290 | + $donor_id = absint(give_get_payment_donor_id($payment_id)); |
|
291 | 291 | |
292 | 292 | // Bailout |
293 | - if ( ! $donor_id ) { |
|
293 | + if ( ! $donor_id) { |
|
294 | 294 | return; |
295 | 295 | } |
296 | 296 | |
297 | 297 | |
298 | 298 | /* @var Give_Donor $donor */ |
299 | - $donor = new Give_Donor( $donor_id ); |
|
299 | + $donor = new Give_Donor($donor_id); |
|
300 | 300 | |
301 | 301 | // Save address. |
302 | - $donor->add_address( 'billing[]', give_get_donation_address( $payment_id ) ); |
|
302 | + $donor->add_address('billing[]', give_get_donation_address($payment_id)); |
|
303 | 303 | } |
304 | 304 | |
305 | -add_action( 'give_complete_donation', '_give_save_donor_billing_address', 9999 ); |
|
305 | +add_action('give_complete_donation', '_give_save_donor_billing_address', 9999); |
|
306 | 306 | |
307 | 307 | |
308 | 308 | /** |
@@ -312,23 +312,23 @@ discard block |
||
312 | 312 | * |
313 | 313 | * @param array $args |
314 | 314 | */ |
315 | -function give_update_log_form_id( $args ) { |
|
316 | - $new_form_id = absint( $args[0] ); |
|
317 | - $payment_id = absint( $args[1] ); |
|
318 | - $logs = Give()->logs->get_logs( $payment_id ); |
|
315 | +function give_update_log_form_id($args) { |
|
316 | + $new_form_id = absint($args[0]); |
|
317 | + $payment_id = absint($args[1]); |
|
318 | + $logs = Give()->logs->get_logs($payment_id); |
|
319 | 319 | |
320 | 320 | // Bailout. |
321 | - if ( empty( $logs ) ) { |
|
321 | + if (empty($logs)) { |
|
322 | 322 | return; |
323 | 323 | } |
324 | 324 | |
325 | 325 | /* @var object $log */ |
326 | - foreach ( $logs as $log ) { |
|
327 | - Give()->logs->logmeta_db->update_meta( $log->ID, '_give_log_form_id', $new_form_id ); |
|
326 | + foreach ($logs as $log) { |
|
327 | + Give()->logs->logmeta_db->update_meta($log->ID, '_give_log_form_id', $new_form_id); |
|
328 | 328 | } |
329 | 329 | |
330 | 330 | // Delete cache. |
331 | 331 | Give()->logs->delete_cache(); |
332 | 332 | } |
333 | 333 | |
334 | -add_action( 'give_update_log_form_id', 'give_update_log_form_id' ); |
|
335 | 334 | \ No newline at end of file |
335 | +add_action('give_update_log_form_id', 'give_update_log_form_id'); |
|
336 | 336 | \ No newline at end of file |