@@ -9,11 +9,11 @@ discard block |
||
| 9 | 9 | * @since 1.8 |
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 12 | +if ( ! defined('ABSPATH')) { |
|
| 13 | 13 | exit; // Exit if accessed directly |
| 14 | 14 | } |
| 15 | 15 | |
| 16 | -if ( ! class_exists( 'Give_Settings_Data' ) ) : |
|
| 16 | +if ( ! class_exists('Give_Settings_Data')) : |
|
| 17 | 17 | |
| 18 | 18 | /** |
| 19 | 19 | * Give_Settings_Data. |
@@ -35,14 +35,14 @@ discard block |
||
| 35 | 35 | */ |
| 36 | 36 | public function __construct() { |
| 37 | 37 | $this->id = 'data'; |
| 38 | - $this->label = esc_html__( 'Data', 'give' ); |
|
| 38 | + $this->label = esc_html__('Data', 'give'); |
|
| 39 | 39 | |
| 40 | 40 | parent::__construct(); |
| 41 | 41 | |
| 42 | 42 | // Do not use main form for this tab. |
| 43 | - if( give_get_current_setting_tab() === $this->id ) { |
|
| 44 | - add_action( "give-tools_open_form", '__return_empty_string' ); |
|
| 45 | - add_action( "give-tools_close_form", '__return_empty_string' ); |
|
| 43 | + if (give_get_current_setting_tab() === $this->id) { |
|
| 44 | + add_action("give-tools_open_form", '__return_empty_string'); |
|
| 45 | + add_action("give-tools_close_form", '__return_empty_string'); |
|
| 46 | 46 | } |
| 47 | 47 | } |
| 48 | 48 | |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | */ |
| 55 | 55 | public function get_settings() { |
| 56 | 56 | // Get settings. |
| 57 | - $settings = apply_filters( 'give_settings_data', array( |
|
| 57 | + $settings = apply_filters('give_settings_data', array( |
|
| 58 | 58 | array( |
| 59 | 59 | 'id' => 'give_tools_tools', |
| 60 | 60 | 'type' => 'title', |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | ), |
| 63 | 63 | array( |
| 64 | 64 | 'id' => 'api', |
| 65 | - 'name' => esc_html__( 'Tools', 'give' ), |
|
| 65 | + 'name' => esc_html__('Tools', 'give'), |
|
| 66 | 66 | 'type' => 'data', |
| 67 | 67 | ), |
| 68 | 68 | array( |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | * @since 1.8 |
| 79 | 79 | * @param array $settings |
| 80 | 80 | */ |
| 81 | - $settings = apply_filters( 'give_get_settings_' . $this->id, $settings ); |
|
| 81 | + $settings = apply_filters('give_get_settings_'.$this->id, $settings); |
|
| 82 | 82 | |
| 83 | 83 | // Output. |
| 84 | 84 | return $settings; |
@@ -9,11 +9,11 @@ discard block |
||
| 9 | 9 | * @since 1.8 |
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 12 | +if ( ! defined('ABSPATH')) { |
|
| 13 | 13 | exit; // Exit if accessed directly |
| 14 | 14 | } |
| 15 | 15 | |
| 16 | -if ( ! class_exists( 'Give_Settings_Import' ) ) { |
|
| 16 | +if ( ! class_exists('Give_Settings_Import')) { |
|
| 17 | 17 | |
| 18 | 18 | /** |
| 19 | 19 | * Give_Settings_Import. |
@@ -45,23 +45,23 @@ discard block |
||
| 45 | 45 | */ |
| 46 | 46 | public function __construct() { |
| 47 | 47 | $this->id = 'import'; |
| 48 | - $this->label = __( 'Import', 'give' ); |
|
| 48 | + $this->label = __('Import', 'give'); |
|
| 49 | 49 | |
| 50 | 50 | parent::__construct(); |
| 51 | 51 | |
| 52 | 52 | // Will display html of the import donation. |
| 53 | - add_action( 'give_admin_field_tools_import', array( |
|
| 53 | + add_action('give_admin_field_tools_import', array( |
|
| 54 | 54 | 'Give_Settings_Import', |
| 55 | 55 | 'render_import_field', |
| 56 | - ), 10, 2 ); |
|
| 56 | + ), 10, 2); |
|
| 57 | 57 | |
| 58 | 58 | // Do not use main form for this tab. |
| 59 | - if ( give_get_current_setting_tab() === $this->id ) { |
|
| 60 | - add_action( "give-tools_open_form", '__return_empty_string' ); |
|
| 61 | - add_action( "give-tools_close_form", '__return_empty_string' ); |
|
| 59 | + if (give_get_current_setting_tab() === $this->id) { |
|
| 60 | + add_action("give-tools_open_form", '__return_empty_string'); |
|
| 61 | + add_action("give-tools_close_form", '__return_empty_string'); |
|
| 62 | 62 | |
| 63 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/import/class-give-import-donations.php'; |
|
| 64 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/tools/import/class-give-import-core-settings.php'; |
|
| 63 | + require_once GIVE_PLUGIN_DIR.'includes/admin/tools/import/class-give-import-donations.php'; |
|
| 64 | + require_once GIVE_PLUGIN_DIR.'includes/admin/tools/import/class-give-import-core-settings.php'; |
|
| 65 | 65 | } |
| 66 | 66 | } |
| 67 | 67 | |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | * @param array $settings |
| 81 | 81 | */ |
| 82 | 82 | $settings = apply_filters( |
| 83 | - 'give_get_settings_' . $this->id, |
|
| 83 | + 'give_get_settings_'.$this->id, |
|
| 84 | 84 | array( |
| 85 | 85 | array( |
| 86 | 86 | 'id' => 'give_tools_import', |
@@ -89,14 +89,14 @@ discard block |
||
| 89 | 89 | ), |
| 90 | 90 | array( |
| 91 | 91 | 'id' => 'import', |
| 92 | - 'name' => __( 'Import', 'give' ), |
|
| 92 | + 'name' => __('Import', 'give'), |
|
| 93 | 93 | 'type' => 'tools_import', |
| 94 | 94 | ), |
| 95 | 95 | array( |
| 96 | - 'name' => esc_html__( 'Import Docs Link', 'give' ), |
|
| 96 | + 'name' => esc_html__('Import Docs Link', 'give'), |
|
| 97 | 97 | 'id' => 'import_docs_link', |
| 98 | - 'url' => esc_url( 'http://docs.givewp.com/tools-importer' ), |
|
| 99 | - 'title' => __( 'Import Tab', 'give' ), |
|
| 98 | + 'url' => esc_url('http://docs.givewp.com/tools-importer'), |
|
| 99 | + 'title' => __('Import Tab', 'give'), |
|
| 100 | 100 | 'type' => 'give_docs_link', |
| 101 | 101 | ), |
| 102 | 102 | array( |
@@ -120,8 +120,8 @@ discard block |
||
| 120 | 120 | * @param $field |
| 121 | 121 | * @param $option_value |
| 122 | 122 | */ |
| 123 | - public static function render_import_field( $field, $option_value ) { |
|
| 124 | - include_once GIVE_PLUGIN_DIR . 'includes/admin/tools/views/html-admin-page-imports.php'; |
|
| 123 | + public static function render_import_field($field, $option_value) { |
|
| 124 | + include_once GIVE_PLUGIN_DIR.'includes/admin/tools/views/html-admin-page-imports.php'; |
|
| 125 | 125 | } |
| 126 | 126 | } |
| 127 | 127 | } |
@@ -3,7 +3,7 @@ discard block |
||
| 3 | 3 | * Admin View: Imports |
| 4 | 4 | */ |
| 5 | 5 | |
| 6 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 6 | +if ( ! defined('ABSPATH')) { |
|
| 7 | 7 | exit; |
| 8 | 8 | } ?> |
| 9 | 9 | |
@@ -18,14 +18,14 @@ discard block |
||
| 18 | 18 | * |
| 19 | 19 | * @since 1.8.14 |
| 20 | 20 | */ |
| 21 | - do_action( 'give_tools_tab_import_content_top' ); |
|
| 21 | + do_action('give_tools_tab_import_content_top'); |
|
| 22 | 22 | ?> |
| 23 | 23 | |
| 24 | 24 | <table class="widefat Import-options-table give-table"> |
| 25 | 25 | <thead> |
| 26 | 26 | <tr> |
| 27 | - <th scope="col"><?php esc_html_e( 'Import Type', 'give' ); ?></th> |
|
| 28 | - <th scope="col"><?php esc_html_e( 'Import Options', 'give' ); ?></th> |
|
| 27 | + <th scope="col"><?php esc_html_e('Import Type', 'give'); ?></th> |
|
| 28 | + <th scope="col"><?php esc_html_e('Import Options', 'give'); ?></th> |
|
| 29 | 29 | </tr> |
| 30 | 30 | </thead> |
| 31 | 31 | <tbody> |
@@ -38,19 +38,19 @@ discard block |
||
| 38 | 38 | * |
| 39 | 39 | * @since 1.8.14 |
| 40 | 40 | */ |
| 41 | - do_action( 'give_tools_tab_import_table_top' ); |
|
| 41 | + do_action('give_tools_tab_import_table_top'); |
|
| 42 | 42 | ?> |
| 43 | 43 | |
| 44 | 44 | <tr class="give-Import-pdf-sales-earnings"> |
| 45 | 45 | <td scope="row" class="row-title"> |
| 46 | 46 | <h3> |
| 47 | - <span><?php esc_html_e( 'Import Donations', 'give' ); ?></span> |
|
| 47 | + <span><?php esc_html_e('Import Donations', 'give'); ?></span> |
|
| 48 | 48 | </h3> |
| 49 | - <p><?php esc_html_e( 'Import a CSV of Donations.', 'give' ); ?></p> |
|
| 49 | + <p><?php esc_html_e('Import a CSV of Donations.', 'give'); ?></p> |
|
| 50 | 50 | </td> |
| 51 | 51 | <td> |
| 52 | - <a class="button" href="<?php echo add_query_arg( array( 'importer-type' => 'import_donations' ) ); ?>"> |
|
| 53 | - <?php esc_html_e( 'Import CSV', 'give' ); ?> |
|
| 52 | + <a class="button" href="<?php echo add_query_arg(array('importer-type' => 'import_donations')); ?>"> |
|
| 53 | + <?php esc_html_e('Import CSV', 'give'); ?> |
|
| 54 | 54 | </a> |
| 55 | 55 | </td> |
| 56 | 56 | </tr> |
@@ -58,13 +58,13 @@ discard block |
||
| 58 | 58 | <tr class="give-import-core-settings"> |
| 59 | 59 | <td scope="row" class="row-title"> |
| 60 | 60 | <h3> |
| 61 | - <span><?php esc_html_e( 'Import Give Settings', 'give' ); ?></span> |
|
| 61 | + <span><?php esc_html_e('Import Give Settings', 'give'); ?></span> |
|
| 62 | 62 | </h3> |
| 63 | - <p><?php esc_html_e( 'Import Give\'s settings in JSON format.', 'give' ); ?></p> |
|
| 63 | + <p><?php esc_html_e('Import Give\'s settings in JSON format.', 'give'); ?></p> |
|
| 64 | 64 | </td> |
| 65 | 65 | <td> |
| 66 | - <a class="button" href="<?php echo add_query_arg( array( 'importer-type' => 'import_core_setting' ) ); ?>"> |
|
| 67 | - <?php esc_html_e( 'Import JSON', 'give' ); ?> |
|
| 66 | + <a class="button" href="<?php echo add_query_arg(array('importer-type' => 'import_core_setting')); ?>"> |
|
| 67 | + <?php esc_html_e('Import JSON', 'give'); ?> |
|
| 68 | 68 | </a> |
| 69 | 69 | </td> |
| 70 | 70 | </tr> |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | * |
| 79 | 79 | * @since 1.8.14 |
| 80 | 80 | */ |
| 81 | - do_action( 'give_tools_tab_import_table_bottom' ); |
|
| 81 | + do_action('give_tools_tab_import_table_bottom'); |
|
| 82 | 82 | ?> |
| 83 | 83 | </tbody> |
| 84 | 84 | </table> |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | * |
| 90 | 90 | * @since 1.8.14 |
| 91 | 91 | */ |
| 92 | - do_action( 'give_tools_tab_import_content_bottom' ); |
|
| 92 | + do_action('give_tools_tab_import_content_bottom'); |
|
| 93 | 93 | ?> |
| 94 | 94 | |
| 95 | 95 | </div> |
@@ -3,11 +3,11 @@ discard block |
||
| 3 | 3 | * Admin View: Import Core Settings |
| 4 | 4 | */ |
| 5 | 5 | |
| 6 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 6 | +if ( ! defined('ABSPATH')) { |
|
| 7 | 7 | exit; |
| 8 | 8 | } |
| 9 | 9 | |
| 10 | -if ( ! current_user_can( 'manage_give_settings' ) ) { |
|
| 10 | +if ( ! current_user_can('manage_give_settings')) { |
|
| 11 | 11 | return; |
| 12 | 12 | } |
| 13 | 13 | |
@@ -16,11 +16,11 @@ discard block |
||
| 16 | 16 | * |
| 17 | 17 | * @since 1.8.17 |
| 18 | 18 | */ |
| 19 | -do_action( 'give_tools_import_core_settings_main_before' ); |
|
| 19 | +do_action('give_tools_import_core_settings_main_before'); |
|
| 20 | 20 | ?> |
| 21 | 21 | <div id="poststuff"> |
| 22 | 22 | <div class="postbox"> |
| 23 | - <h1 class="give-importer-h1" align="center"><?php esc_html_e( 'Import Settings', 'give' ); ?></h1> |
|
| 23 | + <h1 class="give-importer-h1" align="center"><?php esc_html_e('Import Settings', 'give'); ?></h1> |
|
| 24 | 24 | <div class="inside give-tools-setting-page-import give-import-core-settings"> |
| 25 | 25 | <?php |
| 26 | 26 | /** |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | * |
| 29 | 29 | * @since 1.8.17 |
| 30 | 30 | */ |
| 31 | - do_action( 'give_tools_import_core_settings_form_before_start' ); |
|
| 31 | + do_action('give_tools_import_core_settings_form_before_start'); |
|
| 32 | 32 | ?> |
| 33 | 33 | <form method="post" id="give-import-core-settings-form" |
| 34 | 34 | class="give-import-form tools-setting-page-import tools-setting-page-import" |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | * |
| 41 | 41 | * @since 1.8.17 |
| 42 | 42 | */ |
| 43 | - do_action( 'give_tools_import_core_settings_form_start' ); |
|
| 43 | + do_action('give_tools_import_core_settings_form_start'); |
|
| 44 | 44 | ?> |
| 45 | 45 | |
| 46 | 46 | <?php |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | * |
| 50 | 50 | * @since 1.8.17 |
| 51 | 51 | */ |
| 52 | - do_action( 'give_tools_import_core_settings_form_end' ); |
|
| 52 | + do_action('give_tools_import_core_settings_form_end'); |
|
| 53 | 53 | ?> |
| 54 | 54 | </form> |
| 55 | 55 | <?php |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | * |
| 59 | 59 | * @since 1.8.17 |
| 60 | 60 | */ |
| 61 | - do_action( 'give_tools_import_core_settings_form_after_end' ); |
|
| 61 | + do_action('give_tools_import_core_settings_form_after_end'); |
|
| 62 | 62 | ?> |
| 63 | 63 | </div><!-- .inside --> |
| 64 | 64 | </div><!-- .postbox --> |
@@ -69,4 +69,4 @@ discard block |
||
| 69 | 69 | * |
| 70 | 70 | * @since 1.8.17 |
| 71 | 71 | */ |
| 72 | -do_action( 'give_tools_import_core_settings_main_after' ); |
|
| 72 | +do_action('give_tools_import_core_settings_main_after'); |
|
@@ -9,11 +9,11 @@ discard block |
||
| 9 | 9 | * @since 1.8 |
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 12 | +if ( ! defined('ABSPATH')) { |
|
| 13 | 13 | exit; // Exit if accessed directly |
| 14 | 14 | } |
| 15 | 15 | |
| 16 | -if ( ! class_exists( 'Give_Settings_System_Info' ) ) : |
|
| 16 | +if ( ! class_exists('Give_Settings_System_Info')) : |
|
| 17 | 17 | |
| 18 | 18 | /** |
| 19 | 19 | * Give_Settings_System_Info. |
@@ -34,14 +34,14 @@ discard block |
||
| 34 | 34 | */ |
| 35 | 35 | public function __construct() { |
| 36 | 36 | $this->id = 'system-info'; |
| 37 | - $this->label = esc_html__( 'System Info', 'give' ); |
|
| 37 | + $this->label = esc_html__('System Info', 'give'); |
|
| 38 | 38 | |
| 39 | 39 | parent::__construct(); |
| 40 | 40 | |
| 41 | 41 | // Do not use main form for this tab. |
| 42 | - if ( give_get_current_setting_tab() === $this->id ) { |
|
| 43 | - add_action( "give-tools_open_form", '__return_empty_string' ); |
|
| 44 | - add_action( "give-tools_close_form", '__return_empty_string' ); |
|
| 42 | + if (give_get_current_setting_tab() === $this->id) { |
|
| 43 | + add_action("give-tools_open_form", '__return_empty_string'); |
|
| 44 | + add_action("give-tools_close_form", '__return_empty_string'); |
|
| 45 | 45 | } |
| 46 | 46 | } |
| 47 | 47 | |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | */ |
| 54 | 54 | public function output() { |
| 55 | 55 | $GLOBALS['give_hide_save_button'] = true; |
| 56 | - include_once( 'views/html-admin-page-system-info.php' ); |
|
| 56 | + include_once('views/html-admin-page-system-info.php'); |
|
| 57 | 57 | } |
| 58 | 58 | } |
| 59 | 59 | |
@@ -10,13 +10,13 @@ discard block |
||
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | 12 | // Exit if accessed directly. |
| 13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 13 | +if ( ! defined('ABSPATH')) { |
|
| 14 | 14 | exit; |
| 15 | 15 | } |
| 16 | 16 | |
| 17 | 17 | // Load WP_List_Table if not loaded |
| 18 | -if ( ! class_exists( 'WP_List_Table' ) ) { |
|
| 19 | - require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php'; |
|
| 18 | +if ( ! class_exists('WP_List_Table')) { |
|
| 19 | + require_once ABSPATH.'wp-admin/includes/class-wp-list-table.php'; |
|
| 20 | 20 | } |
| 21 | 21 | |
| 22 | 22 | /** |
@@ -45,11 +45,11 @@ discard block |
||
| 45 | 45 | global $status, $page; |
| 46 | 46 | |
| 47 | 47 | // Set parent defaults |
| 48 | - parent::__construct( array( |
|
| 49 | - 'singular' => give_get_forms_label_singular(), // Singular name of the listed records |
|
| 50 | - 'plural' => give_get_forms_label_plural(), // Plural name of the listed records |
|
| 48 | + parent::__construct(array( |
|
| 49 | + 'singular' => give_get_forms_label_singular(), // Singular name of the listed records |
|
| 50 | + 'plural' => give_get_forms_label_plural(), // Plural name of the listed records |
|
| 51 | 51 | 'ajax' => false // Does this table support ajax? |
| 52 | - ) ); |
|
| 52 | + )); |
|
| 53 | 53 | |
| 54 | 54 | } |
| 55 | 55 | |
@@ -64,12 +64,12 @@ discard block |
||
| 64 | 64 | * |
| 65 | 65 | * @return string Column Name |
| 66 | 66 | */ |
| 67 | - public function column_default( $item, $column_name ) { |
|
| 68 | - $donation_list_page_url = admin_url( 'edit.php?post_type=give_forms&page=give-payment-history' ); |
|
| 67 | + public function column_default($item, $column_name) { |
|
| 68 | + $donation_list_page_url = admin_url('edit.php?post_type=give_forms&page=give-payment-history'); |
|
| 69 | 69 | |
| 70 | - switch ( $column_name ) { |
|
| 70 | + switch ($column_name) { |
|
| 71 | 71 | case 'complete_sales': |
| 72 | - $value = $item[ $column_name ] ? |
|
| 72 | + $value = $item[$column_name] ? |
|
| 73 | 73 | sprintf( |
| 74 | 74 | '<a href="%s">%s</a>', |
| 75 | 75 | add_query_arg( |
@@ -79,13 +79,12 @@ discard block |
||
| 79 | 79 | ), |
| 80 | 80 | $donation_list_page_url |
| 81 | 81 | ), |
| 82 | - $item[ $column_name ] |
|
| 83 | - ) : |
|
| 84 | - $item[ $column_name ]; |
|
| 82 | + $item[$column_name] |
|
| 83 | + ) : $item[$column_name]; |
|
| 85 | 84 | break; |
| 86 | 85 | |
| 87 | 86 | case 'pending_sales': |
| 88 | - $value = $item[ $column_name ] ? |
|
| 87 | + $value = $item[$column_name] ? |
|
| 89 | 88 | sprintf( |
| 90 | 89 | '<a href="%s">%s</a>', |
| 91 | 90 | add_query_arg( |
@@ -95,13 +94,12 @@ discard block |
||
| 95 | 94 | ), |
| 96 | 95 | $donation_list_page_url |
| 97 | 96 | ), |
| 98 | - $item[ $column_name ] |
|
| 99 | - ) : |
|
| 100 | - $item[ $column_name ]; |
|
| 97 | + $item[$column_name] |
|
| 98 | + ) : $item[$column_name]; |
|
| 101 | 99 | break; |
| 102 | 100 | |
| 103 | 101 | case 'total_sales': |
| 104 | - $value = $item[ $column_name ] ? |
|
| 102 | + $value = $item[$column_name] ? |
|
| 105 | 103 | sprintf( |
| 106 | 104 | '<a href="%s">%s</a>', |
| 107 | 105 | add_query_arg( |
@@ -110,14 +108,13 @@ discard block |
||
| 110 | 108 | ), |
| 111 | 109 | $donation_list_page_url |
| 112 | 110 | ), |
| 113 | - $item[ $column_name ] |
|
| 114 | - ) : |
|
| 115 | - $item[ $column_name ]; |
|
| 111 | + $item[$column_name] |
|
| 112 | + ) : $item[$column_name]; |
|
| 116 | 113 | |
| 117 | 114 | break; |
| 118 | 115 | |
| 119 | 116 | default: |
| 120 | - $value = $item[ $column_name ]; |
|
| 117 | + $value = $item[$column_name]; |
|
| 121 | 118 | } |
| 122 | 119 | |
| 123 | 120 | return $value; |
@@ -132,11 +129,11 @@ discard block |
||
| 132 | 129 | */ |
| 133 | 130 | public function get_columns() { |
| 134 | 131 | $columns = array( |
| 135 | - 'label' => esc_attr__( 'Gateway', 'give' ), |
|
| 136 | - 'complete_sales' => esc_attr__( 'Complete Payments', 'give' ), |
|
| 137 | - 'pending_sales' => esc_attr__( 'Pending / Failed Payments', 'give' ), |
|
| 138 | - 'total_sales' => esc_attr__( 'Total Payments', 'give' ), |
|
| 139 | - 'total_donations' => esc_attr__( 'Total Donated', 'give' ) |
|
| 132 | + 'label' => esc_attr__('Gateway', 'give'), |
|
| 133 | + 'complete_sales' => esc_attr__('Complete Payments', 'give'), |
|
| 134 | + 'pending_sales' => esc_attr__('Pending / Failed Payments', 'give'), |
|
| 135 | + 'total_sales' => esc_attr__('Total Payments', 'give'), |
|
| 136 | + 'total_donations' => esc_attr__('Total Donated', 'give') |
|
| 140 | 137 | ); |
| 141 | 138 | |
| 142 | 139 | return $columns; |
@@ -151,7 +148,7 @@ discard block |
||
| 151 | 148 | */ |
| 152 | 149 | public function get_sortable_columns() { |
| 153 | 150 | return array( |
| 154 | - 'total_donations' => array( 'total_donations', false ) |
|
| 151 | + 'total_donations' => array('total_donations', false) |
|
| 155 | 152 | ); |
| 156 | 153 | } |
| 157 | 154 | |
@@ -164,7 +161,7 @@ discard block |
||
| 164 | 161 | * @return int Current page number |
| 165 | 162 | */ |
| 166 | 163 | public function get_paged() { |
| 167 | - return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1; |
|
| 164 | + return isset($_GET['paged']) ? absint($_GET['paged']) : 1; |
|
| 168 | 165 | } |
| 169 | 166 | |
| 170 | 167 | |
@@ -175,7 +172,7 @@ discard block |
||
| 175 | 172 | * @since 1.0 |
| 176 | 173 | * @return void |
| 177 | 174 | */ |
| 178 | - public function bulk_actions( $which = '' ) { |
|
| 175 | + public function bulk_actions($which = '') { |
|
| 179 | 176 | |
| 180 | 177 | } |
| 181 | 178 | |
@@ -187,27 +184,27 @@ discard block |
||
| 187 | 184 | * |
| 188 | 185 | * @param string $which |
| 189 | 186 | */ |
| 190 | - protected function display_tablenav( $which ) { |
|
| 187 | + protected function display_tablenav($which) { |
|
| 191 | 188 | |
| 192 | - if ( 'top' === $which ) { |
|
| 193 | - wp_nonce_field( 'bulk-' . $this->_args['plural'] ); |
|
| 189 | + if ('top' === $which) { |
|
| 190 | + wp_nonce_field('bulk-'.$this->_args['plural']); |
|
| 194 | 191 | } |
| 195 | 192 | ?> |
| 196 | - <div class="tablenav gateways-report-tablenav give-clearfix <?php echo esc_attr( $which ); ?>"> |
|
| 193 | + <div class="tablenav gateways-report-tablenav give-clearfix <?php echo esc_attr($which); ?>"> |
|
| 197 | 194 | |
| 198 | - <?php if ( 'top' === $which ) { ?> |
|
| 195 | + <?php if ('top' === $which) { ?> |
|
| 199 | 196 | <h2 class="alignleft reports-earnings-title screen-reader-text"> |
| 200 | - <?php _e( 'Donation Methods Report', 'give' ); ?> |
|
| 197 | + <?php _e('Donation Methods Report', 'give'); ?> |
|
| 201 | 198 | </h2> |
| 202 | 199 | <?php } ?> |
| 203 | 200 | |
| 204 | 201 | <div class="alignright tablenav-right"> |
| 205 | 202 | <div class="actions bulkactions"> |
| 206 | - <?php $this->bulk_actions( $which ); ?> |
|
| 203 | + <?php $this->bulk_actions($which); ?> |
|
| 207 | 204 | </div> |
| 208 | 205 | <?php |
| 209 | - $this->extra_tablenav( $which ); |
|
| 210 | - $this->pagination( $which ); |
|
| 206 | + $this->extra_tablenav($which); |
|
| 207 | + $this->pagination($which); |
|
| 211 | 208 | ?> |
| 212 | 209 | </div> |
| 213 | 210 | |
@@ -229,17 +226,17 @@ discard block |
||
| 229 | 226 | * |
| 230 | 227 | * @return int |
| 231 | 228 | */ |
| 232 | - public function give_sort_total_donations( $old_value, $new_value ) { |
|
| 229 | + public function give_sort_total_donations($old_value, $new_value) { |
|
| 233 | 230 | // If no sort, default to label. |
| 234 | - $orderby = ( ! empty( $_REQUEST['orderby'] ) ) ? $_REQUEST['orderby'] : 'label'; |
|
| 231 | + $orderby = ( ! empty($_REQUEST['orderby'])) ? $_REQUEST['orderby'] : 'label'; |
|
| 235 | 232 | |
| 236 | 233 | //If no order, default to asc. |
| 237 | - $order = ( ! empty( $_REQUEST['order'] ) ) ? $_REQUEST['order'] : 'asc'; |
|
| 234 | + $order = ( ! empty($_REQUEST['order'])) ? $_REQUEST['order'] : 'asc'; |
|
| 238 | 235 | |
| 239 | 236 | //Determine sort order. |
| 240 | - $result = strcmp( $old_value[ $orderby ], $new_value[ $orderby ] ); |
|
| 237 | + $result = strcmp($old_value[$orderby], $new_value[$orderby]); |
|
| 241 | 238 | |
| 242 | - return ( $order === 'asc' ) ? $result : -$result; |
|
| 239 | + return ($order === 'asc') ? $result : -$result; |
|
| 243 | 240 | } |
| 244 | 241 | |
| 245 | 242 | |
@@ -256,10 +253,10 @@ discard block |
||
| 256 | 253 | $gateways = give_get_payment_gateways(); |
| 257 | 254 | $stats = new Give_Payment_Stats(); |
| 258 | 255 | |
| 259 | - foreach ( $gateways as $gateway_id => $gateway ) { |
|
| 256 | + foreach ($gateways as $gateway_id => $gateway) { |
|
| 260 | 257 | |
| 261 | - $complete_count = give_count_sales_by_gateway( $gateway_id, 'publish' ); |
|
| 262 | - $pending_count = give_count_sales_by_gateway( $gateway_id, array( 'pending', 'failed' ) ); |
|
| 258 | + $complete_count = give_count_sales_by_gateway($gateway_id, 'publish'); |
|
| 259 | + $pending_count = give_count_sales_by_gateway($gateway_id, array('pending', 'failed')); |
|
| 263 | 260 | |
| 264 | 261 | $reports_data[] = array( |
| 265 | 262 | 'ID' => $gateway_id, |
@@ -267,7 +264,7 @@ discard block |
||
| 267 | 264 | 'complete_sales' => $complete_count, |
| 268 | 265 | 'pending_sales' => $pending_count, |
| 269 | 266 | 'total_sales' => $complete_count + $pending_count, |
| 270 | - 'total_donations' => give_currency_filter( give_format_amount( $stats->get_earnings( 0, strtotime('04/13/2015' ), current_time('timestamp' ), $gateway_id ), array( 'sanitize' => false ) ) ), |
|
| 267 | + 'total_donations' => give_currency_filter(give_format_amount($stats->get_earnings(0, strtotime('04/13/2015'), current_time('timestamp'), $gateway_id), array('sanitize' => false))), |
|
| 271 | 268 | ); |
| 272 | 269 | } |
| 273 | 270 | |
@@ -288,11 +285,11 @@ discard block |
||
| 288 | 285 | $columns = $this->get_columns(); |
| 289 | 286 | $hidden = array(); // No hidden columns |
| 290 | 287 | $sortable = $this->get_sortable_columns(); |
| 291 | - $this->_column_headers = array( $columns, $hidden, $sortable ); |
|
| 288 | + $this->_column_headers = array($columns, $hidden, $sortable); |
|
| 292 | 289 | $this->items = $this->reports_data(); |
| 293 | 290 | |
| 294 | 291 | // Sort Array when we are sorting data in array. |
| 295 | - usort( $this->items, array( $this, 'give_sort_total_donations' ) ); |
|
| 292 | + usort($this->items, array($this, 'give_sort_total_donations')); |
|
| 296 | 293 | |
| 297 | 294 | } |
| 298 | 295 | } |
@@ -10,17 +10,17 @@ |
||
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | 12 | // Exit if accessed directly. |
| 13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 13 | +if ( ! defined('ABSPATH')) { |
|
| 14 | 14 | exit; |
| 15 | 15 | } |
| 16 | 16 | ?> |
| 17 | 17 | <div class="wrap" id="poststuff"> |
| 18 | 18 | <div id="give-updates"> |
| 19 | - <h1 id="give-updates-h1"><?php esc_html_e( 'Give - Updates Complete', 'give' ); ?></h1> |
|
| 19 | + <h1 id="give-updates-h1"><?php esc_html_e('Give - Updates Complete', 'give'); ?></h1> |
|
| 20 | 20 | <hr class="wp-header-end"> |
| 21 | 21 | |
| 22 | 22 | <div class="give-update-panel-content"> |
| 23 | - <p><?php esc_html_e( 'Congratulations! You are running the latest versions of Give and its add-ons.', 'give' ); ?></p> |
|
| 23 | + <p><?php esc_html_e('Congratulations! You are running the latest versions of Give and its add-ons.', 'give'); ?></p> |
|
| 24 | 24 | </div> |
| 25 | 25 | |
| 26 | 26 | </div> |
@@ -12,7 +12,7 @@ discard block |
||
| 12 | 12 | */ |
| 13 | 13 | |
| 14 | 14 | // Exit if accessed directly. |
| 15 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 15 | +if ( ! defined('ABSPATH')) { |
|
| 16 | 16 | exit; |
| 17 | 17 | } |
| 18 | 18 | |
@@ -41,9 +41,9 @@ discard block |
||
| 41 | 41 | give_ignore_user_abort(); |
| 42 | 42 | |
| 43 | 43 | nocache_headers(); |
| 44 | - header( 'Content-Type: text/csv; charset=utf-8' ); |
|
| 45 | - header( 'Content-Disposition: attachment; filename=' . apply_filters( 'give_earnings_export_filename', 'give-export-' . $this->export_type . '-' . date( 'n' ) . '-' . date( 'Y' ) ) . '.csv' ); |
|
| 46 | - header( "Expires: 0" ); |
|
| 44 | + header('Content-Type: text/csv; charset=utf-8'); |
|
| 45 | + header('Content-Disposition: attachment; filename='.apply_filters('give_earnings_export_filename', 'give-export-'.$this->export_type.'-'.date('n').'-'.date('Y')).'.csv'); |
|
| 46 | + header("Expires: 0"); |
|
| 47 | 47 | |
| 48 | 48 | } |
| 49 | 49 | |
@@ -57,10 +57,10 @@ discard block |
||
| 57 | 57 | public function csv_cols() { |
| 58 | 58 | |
| 59 | 59 | $cols = array( |
| 60 | - 'date' => __( 'Date', 'give' ), |
|
| 61 | - 'donations' => __( 'Donations', 'give' ), |
|
| 60 | + 'date' => __('Date', 'give'), |
|
| 61 | + 'donations' => __('Donations', 'give'), |
|
| 62 | 62 | /* translators: %s: currency */ |
| 63 | - 'earnings' => sprintf( __( 'Income (%s)', 'give' ), give_currency_symbol('', true) ) |
|
| 63 | + 'earnings' => sprintf(__('Income (%s)', 'give'), give_currency_symbol('', true)) |
|
| 64 | 64 | ); |
| 65 | 65 | |
| 66 | 66 | return $cols; |
@@ -75,28 +75,28 @@ discard block |
||
| 75 | 75 | */ |
| 76 | 76 | public function get_data() { |
| 77 | 77 | |
| 78 | - $start_year = isset( $_POST['start_year'] ) ? absint( $_POST['start_year'] ) : date( 'Y' ); |
|
| 79 | - $end_year = isset( $_POST['end_year'] ) ? absint( $_POST['end_year'] ) : date( 'Y' ); |
|
| 80 | - $start_month = isset( $_POST['start_month'] ) ? absint( $_POST['start_month'] ) : date( 'n' ); |
|
| 81 | - $end_month = isset( $_POST['end_month'] ) ? absint( $_POST['end_month'] ) : date( 'n' ); |
|
| 78 | + $start_year = isset($_POST['start_year']) ? absint($_POST['start_year']) : date('Y'); |
|
| 79 | + $end_year = isset($_POST['end_year']) ? absint($_POST['end_year']) : date('Y'); |
|
| 80 | + $start_month = isset($_POST['start_month']) ? absint($_POST['start_month']) : date('n'); |
|
| 81 | + $end_month = isset($_POST['end_month']) ? absint($_POST['end_month']) : date('n'); |
|
| 82 | 82 | |
| 83 | 83 | $data = array(); |
| 84 | 84 | $year = $start_year; |
| 85 | 85 | $stats = new Give_Payment_Stats; |
| 86 | 86 | |
| 87 | - while ( $year <= $end_year ) { |
|
| 87 | + while ($year <= $end_year) { |
|
| 88 | 88 | |
| 89 | - if ( $year == $start_year && $year == $end_year ) { |
|
| 89 | + if ($year == $start_year && $year == $end_year) { |
|
| 90 | 90 | |
| 91 | 91 | $m1 = $start_month; |
| 92 | 92 | $m2 = $end_month; |
| 93 | 93 | |
| 94 | - } elseif ( $year == $start_year ) { |
|
| 94 | + } elseif ($year == $start_year) { |
|
| 95 | 95 | |
| 96 | 96 | $m1 = $start_month; |
| 97 | 97 | $m2 = 12; |
| 98 | 98 | |
| 99 | - } elseif ( $year == $end_year ) { |
|
| 99 | + } elseif ($year == $end_year) { |
|
| 100 | 100 | |
| 101 | 101 | $m1 = 1; |
| 102 | 102 | $m2 = $end_month; |
@@ -108,28 +108,28 @@ discard block |
||
| 108 | 108 | |
| 109 | 109 | } |
| 110 | 110 | |
| 111 | - while ( $m1 <= $m2 ) { |
|
| 111 | + while ($m1 <= $m2) { |
|
| 112 | 112 | |
| 113 | - $date1 = mktime( 0, 0, 0, $m1, 1, $year ); |
|
| 114 | - $date2 = mktime( 0, 0, 0, $m1, cal_days_in_month( CAL_GREGORIAN, $m1, $year ), $year ); |
|
| 113 | + $date1 = mktime(0, 0, 0, $m1, 1, $year); |
|
| 114 | + $date2 = mktime(0, 0, 0, $m1, cal_days_in_month(CAL_GREGORIAN, $m1, $year), $year); |
|
| 115 | 115 | |
| 116 | 116 | $data[] = array( |
| 117 | - 'date' => date_i18n( 'F Y', $date1 ), |
|
| 118 | - 'donations' => $stats->get_sales( 0, $date1, $date2 ), |
|
| 119 | - 'earnings' => give_format_amount( $stats->get_earnings( 0, $date1, $date2 ), array( 'sanitize' => false ) ), |
|
| 117 | + 'date' => date_i18n('F Y', $date1), |
|
| 118 | + 'donations' => $stats->get_sales(0, $date1, $date2), |
|
| 119 | + 'earnings' => give_format_amount($stats->get_earnings(0, $date1, $date2), array('sanitize' => false)), |
|
| 120 | 120 | ); |
| 121 | 121 | |
| 122 | - $m1 ++; |
|
| 122 | + $m1++; |
|
| 123 | 123 | |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | |
| 127 | - $year ++; |
|
| 127 | + $year++; |
|
| 128 | 128 | |
| 129 | 129 | } |
| 130 | 130 | |
| 131 | - $data = apply_filters( 'give_export_get_data', $data ); |
|
| 132 | - $data = apply_filters( "give_export_get_data_{$this->export_type}", $data ); |
|
| 131 | + $data = apply_filters('give_export_get_data', $data); |
|
| 132 | + $data = apply_filters("give_export_get_data_{$this->export_type}", $data); |
|
| 133 | 133 | |
| 134 | 134 | return $data; |
| 135 | 135 | } |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | * |
| 41 | 41 | * @since 1.8 |
| 42 | 42 | * |
| 43 | - * @return bool |
|
| 43 | + * @return false|null |
|
| 44 | 44 | */ |
| 45 | 45 | function give_redirect_to_clean_url_admin_pages() { |
| 46 | 46 | // Give admin pages. |
@@ -992,7 +992,7 @@ discard block |
||
| 992 | 992 | * @access public |
| 993 | 993 | * @since 2.0 |
| 994 | 994 | * |
| 995 | - * @return bool |
|
| 995 | + * @return false|null |
|
| 996 | 996 | */ |
| 997 | 997 | function give_update_donor_name_on_user_update( $user_id = 0 ) { |
| 998 | 998 | |
@@ -1032,7 +1032,7 @@ discard block |
||
| 1032 | 1032 | * @param int $user_id User ID. |
| 1033 | 1033 | * @param WP_User|bool $old_user_data User data. |
| 1034 | 1034 | * |
| 1035 | - * @return bool |
|
| 1035 | + * @return false|null |
|
| 1036 | 1036 | */ |
| 1037 | 1037 | function give_update_donor_email_on_user_update( $user_id = 0, $old_user_data = false ) { |
| 1038 | 1038 | |
@@ -10,7 +10,7 @@ discard block |
||
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | 12 | // Exit if accessed directly. |
| 13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 13 | +if ( ! defined('ABSPATH')) { |
|
| 14 | 14 | exit; |
| 15 | 15 | } |
| 16 | 16 | |
@@ -20,19 +20,19 @@ discard block |
||
| 20 | 20 | * @since 1.8 |
| 21 | 21 | */ |
| 22 | 22 | function give_load_wp_editor() { |
| 23 | - if ( ! isset( $_POST['wp_editor'] ) ) { |
|
| 23 | + if ( ! isset($_POST['wp_editor'])) { |
|
| 24 | 24 | die(); |
| 25 | 25 | } |
| 26 | 26 | |
| 27 | - $wp_editor = json_decode( base64_decode( $_POST['wp_editor'] ), true ); |
|
| 27 | + $wp_editor = json_decode(base64_decode($_POST['wp_editor']), true); |
|
| 28 | 28 | $wp_editor[2]['textarea_name'] = $_POST['textarea_name']; |
| 29 | 29 | |
| 30 | - wp_editor( $wp_editor[0], $_POST['wp_editor_id'], $wp_editor[2] ); |
|
| 30 | + wp_editor($wp_editor[0], $_POST['wp_editor_id'], $wp_editor[2]); |
|
| 31 | 31 | |
| 32 | 32 | die(); |
| 33 | 33 | } |
| 34 | 34 | |
| 35 | -add_action( 'wp_ajax_give_load_wp_editor', 'give_load_wp_editor' ); |
|
| 35 | +add_action('wp_ajax_give_load_wp_editor', 'give_load_wp_editor'); |
|
| 36 | 36 | |
| 37 | 37 | |
| 38 | 38 | /** |
@@ -52,13 +52,13 @@ discard block |
||
| 52 | 52 | ); |
| 53 | 53 | |
| 54 | 54 | // Get current page. |
| 55 | - $current_page = isset( $_GET['page'] ) ? esc_attr( $_GET['page'] ) : ''; |
|
| 55 | + $current_page = isset($_GET['page']) ? esc_attr($_GET['page']) : ''; |
|
| 56 | 56 | |
| 57 | 57 | // Bailout. |
| 58 | 58 | if ( |
| 59 | - empty( $current_page ) |
|
| 60 | - || empty( $_GET['_wp_http_referer'] ) |
|
| 61 | - || ! in_array( $current_page, $give_pages ) |
|
| 59 | + empty($current_page) |
|
| 60 | + || empty($_GET['_wp_http_referer']) |
|
| 61 | + || ! in_array($current_page, $give_pages) |
|
| 62 | 62 | ) { |
| 63 | 63 | return false; |
| 64 | 64 | } |
@@ -68,21 +68,21 @@ discard block |
||
| 68 | 68 | * |
| 69 | 69 | * @since 1.8 |
| 70 | 70 | */ |
| 71 | - $redirect = apply_filters( "give_validate_{$current_page}", true ); |
|
| 71 | + $redirect = apply_filters("give_validate_{$current_page}", true); |
|
| 72 | 72 | |
| 73 | - if ( $redirect ) { |
|
| 73 | + if ($redirect) { |
|
| 74 | 74 | // Redirect. |
| 75 | 75 | wp_redirect( |
| 76 | 76 | remove_query_arg( |
| 77 | - array( '_wp_http_referer', '_wpnonce' ), |
|
| 78 | - wp_unslash( $_SERVER['REQUEST_URI'] ) |
|
| 77 | + array('_wp_http_referer', '_wpnonce'), |
|
| 78 | + wp_unslash($_SERVER['REQUEST_URI']) |
|
| 79 | 79 | ) |
| 80 | 80 | ); |
| 81 | 81 | exit; |
| 82 | 82 | } |
| 83 | 83 | } |
| 84 | 84 | |
| 85 | -add_action( 'admin_init', 'give_redirect_to_clean_url_admin_pages' ); |
|
| 85 | +add_action('admin_init', 'give_redirect_to_clean_url_admin_pages'); |
|
| 86 | 86 | |
| 87 | 87 | |
| 88 | 88 | /** |
@@ -96,25 +96,25 @@ discard block |
||
| 96 | 96 | */ |
| 97 | 97 | function give_hide_outdated_php_notice() { |
| 98 | 98 | |
| 99 | - if ( ! isset( $_POST['_give_hide_outdated_php_notices_shortly'] ) ) { |
|
| 99 | + if ( ! isset($_POST['_give_hide_outdated_php_notices_shortly'])) { |
|
| 100 | 100 | give_die(); |
| 101 | 101 | } |
| 102 | 102 | |
| 103 | 103 | // Transient key name. |
| 104 | 104 | $transient_key = '_give_hide_outdated_php_notices_shortly'; |
| 105 | 105 | |
| 106 | - if ( Give_Cache::get( $transient_key, true ) ) { |
|
| 106 | + if (Give_Cache::get($transient_key, true)) { |
|
| 107 | 107 | return; |
| 108 | 108 | } |
| 109 | 109 | |
| 110 | 110 | // Hide notice for 24 hours. |
| 111 | - Give_Cache::set( $transient_key, true, DAY_IN_SECONDS, true ); |
|
| 111 | + Give_Cache::set($transient_key, true, DAY_IN_SECONDS, true); |
|
| 112 | 112 | |
| 113 | 113 | give_die(); |
| 114 | 114 | |
| 115 | 115 | } |
| 116 | 116 | |
| 117 | -add_action( 'wp_ajax_give_hide_outdated_php_notice', 'give_hide_outdated_php_notice' ); |
|
| 117 | +add_action('wp_ajax_give_hide_outdated_php_notice', 'give_hide_outdated_php_notice'); |
|
| 118 | 118 | |
| 119 | 119 | /** |
| 120 | 120 | * Register admin notices. |
@@ -123,27 +123,27 @@ discard block |
||
| 123 | 123 | */ |
| 124 | 124 | function _give_register_admin_notices() { |
| 125 | 125 | // Bailout. |
| 126 | - if ( ! is_admin() ) { |
|
| 126 | + if ( ! is_admin()) { |
|
| 127 | 127 | return; |
| 128 | 128 | } |
| 129 | 129 | |
| 130 | 130 | // Bulk action notices. |
| 131 | 131 | if ( |
| 132 | - isset( $_GET['action'] ) && |
|
| 133 | - ! empty( $_GET['action'] ) |
|
| 132 | + isset($_GET['action']) && |
|
| 133 | + ! empty($_GET['action']) |
|
| 134 | 134 | ) { |
| 135 | 135 | |
| 136 | 136 | // Add payment bulk notice. |
| 137 | 137 | if ( |
| 138 | - current_user_can( 'edit_give_payments' ) && |
|
| 139 | - isset( $_GET['payment'] ) && |
|
| 140 | - ! empty( $_GET['payment'] ) |
|
| 138 | + current_user_can('edit_give_payments') && |
|
| 139 | + isset($_GET['payment']) && |
|
| 140 | + ! empty($_GET['payment']) |
|
| 141 | 141 | ) { |
| 142 | - $payment_count = isset( $_GET['payment'] ) ? count( $_GET['payment'] ) : 0; |
|
| 142 | + $payment_count = isset($_GET['payment']) ? count($_GET['payment']) : 0; |
|
| 143 | 143 | |
| 144 | - switch ( $_GET['action'] ) { |
|
| 144 | + switch ($_GET['action']) { |
|
| 145 | 145 | case 'delete': |
| 146 | - Give()->notices->register_notice( array( |
|
| 146 | + Give()->notices->register_notice(array( |
|
| 147 | 147 | 'id' => 'bulk_action_delete', |
| 148 | 148 | 'type' => 'updated', |
| 149 | 149 | 'description' => sprintf( |
@@ -155,12 +155,12 @@ discard block |
||
| 155 | 155 | ), |
| 156 | 156 | $payment_count ), |
| 157 | 157 | 'show' => true, |
| 158 | - ) ); |
|
| 158 | + )); |
|
| 159 | 159 | |
| 160 | 160 | break; |
| 161 | 161 | |
| 162 | 162 | case 'resend-receipt': |
| 163 | - Give()->notices->register_notice( array( |
|
| 163 | + Give()->notices->register_notice(array( |
|
| 164 | 164 | 'id' => 'bulk_action_resend_receipt', |
| 165 | 165 | 'type' => 'updated', |
| 166 | 166 | 'description' => sprintf( |
@@ -173,7 +173,7 @@ discard block |
||
| 173 | 173 | $payment_count |
| 174 | 174 | ), |
| 175 | 175 | 'show' => true, |
| 176 | - ) ); |
|
| 176 | + )); |
|
| 177 | 177 | break; |
| 178 | 178 | |
| 179 | 179 | case 'set-status-publish' : |
@@ -185,7 +185,7 @@ discard block |
||
| 185 | 185 | case 'set-status-cancelled' : |
| 186 | 186 | case 'set-status-abandoned' : |
| 187 | 187 | case 'set-status-preapproval' : |
| 188 | - Give()->notices->register_notice( array( |
|
| 188 | + Give()->notices->register_notice(array( |
|
| 189 | 189 | 'id' => 'bulk_action_status_change', |
| 190 | 190 | 'type' => 'updated', |
| 191 | 191 | 'description' => _n( |
@@ -195,7 +195,7 @@ discard block |
||
| 195 | 195 | 'give' |
| 196 | 196 | ), |
| 197 | 197 | 'show' => true, |
| 198 | - ) ); |
|
| 198 | + )); |
|
| 199 | 199 | break; |
| 200 | 200 | }// End switch(). |
| 201 | 201 | }// End if(). |
@@ -203,239 +203,239 @@ discard block |
||
| 203 | 203 | |
| 204 | 204 | // Add give message notices. |
| 205 | 205 | $message_notices = give_get_admin_messages_key(); |
| 206 | - if ( ! empty( $message_notices ) ) { |
|
| 207 | - foreach ( $message_notices as $message_notice ) { |
|
| 206 | + if ( ! empty($message_notices)) { |
|
| 207 | + foreach ($message_notices as $message_notice) { |
|
| 208 | 208 | // Donation reports errors. |
| 209 | - if ( current_user_can( 'view_give_reports' ) ) { |
|
| 210 | - switch ( $message_notice ) { |
|
| 209 | + if (current_user_can('view_give_reports')) { |
|
| 210 | + switch ($message_notice) { |
|
| 211 | 211 | case 'donation-deleted' : |
| 212 | - Give()->notices->register_notice( array( |
|
| 212 | + Give()->notices->register_notice(array( |
|
| 213 | 213 | 'id' => 'give-donation-deleted', |
| 214 | 214 | 'type' => 'updated', |
| 215 | - 'description' => __( 'The donation has been deleted.', 'give' ), |
|
| 215 | + 'description' => __('The donation has been deleted.', 'give'), |
|
| 216 | 216 | 'show' => true, |
| 217 | - ) ); |
|
| 217 | + )); |
|
| 218 | 218 | break; |
| 219 | 219 | case 'email-sent' : |
| 220 | - Give()->notices->register_notice( array( |
|
| 220 | + Give()->notices->register_notice(array( |
|
| 221 | 221 | 'id' => 'give-email-sent', |
| 222 | 222 | 'type' => 'updated', |
| 223 | - 'description' => __( 'The donation receipt has been resent.', 'give' ), |
|
| 223 | + 'description' => __('The donation receipt has been resent.', 'give'), |
|
| 224 | 224 | 'show' => true, |
| 225 | - ) ); |
|
| 225 | + )); |
|
| 226 | 226 | break; |
| 227 | 227 | case 'refreshed-reports' : |
| 228 | - Give()->notices->register_notice( array( |
|
| 228 | + Give()->notices->register_notice(array( |
|
| 229 | 229 | 'id' => 'give-refreshed-reports', |
| 230 | 230 | 'type' => 'updated', |
| 231 | - 'description' => __( 'The reports cache has been cleared.', 'give' ), |
|
| 231 | + 'description' => __('The reports cache has been cleared.', 'give'), |
|
| 232 | 232 | 'show' => true, |
| 233 | - ) ); |
|
| 233 | + )); |
|
| 234 | 234 | break; |
| 235 | 235 | case 'donation-note-deleted' : |
| 236 | - Give()->notices->register_notice( array( |
|
| 236 | + Give()->notices->register_notice(array( |
|
| 237 | 237 | 'id' => 'give-donation-note-deleted', |
| 238 | 238 | 'type' => 'updated', |
| 239 | - 'description' => __( 'The donation note has been deleted.', 'give' ), |
|
| 239 | + 'description' => __('The donation note has been deleted.', 'give'), |
|
| 240 | 240 | 'show' => true, |
| 241 | - ) ); |
|
| 241 | + )); |
|
| 242 | 242 | break; |
| 243 | 243 | }// End switch(). |
| 244 | 244 | }// End if(). |
| 245 | 245 | |
| 246 | 246 | // Give settings notices and errors. |
| 247 | - if ( current_user_can( 'manage_give_settings' ) ) { |
|
| 248 | - switch ( $message_notice ) { |
|
| 247 | + if (current_user_can('manage_give_settings')) { |
|
| 248 | + switch ($message_notice) { |
|
| 249 | 249 | case 'settings-imported' : |
| 250 | - Give()->notices->register_notice( array( |
|
| 250 | + Give()->notices->register_notice(array( |
|
| 251 | 251 | 'id' => 'give-settings-imported', |
| 252 | 252 | 'type' => 'updated', |
| 253 | - 'description' => __( 'The settings have been imported.', 'give' ), |
|
| 253 | + 'description' => __('The settings have been imported.', 'give'), |
|
| 254 | 254 | 'show' => true, |
| 255 | - ) ); |
|
| 255 | + )); |
|
| 256 | 256 | break; |
| 257 | 257 | case 'api-key-generated' : |
| 258 | - Give()->notices->register_notice( array( |
|
| 258 | + Give()->notices->register_notice(array( |
|
| 259 | 259 | 'id' => 'give-api-key-generated', |
| 260 | 260 | 'type' => 'updated', |
| 261 | - 'description' => __( 'API keys have been generated.', 'give' ), |
|
| 261 | + 'description' => __('API keys have been generated.', 'give'), |
|
| 262 | 262 | 'show' => true, |
| 263 | - ) ); |
|
| 263 | + )); |
|
| 264 | 264 | break; |
| 265 | 265 | case 'api-key-exists' : |
| 266 | - Give()->notices->register_notice( array( |
|
| 266 | + Give()->notices->register_notice(array( |
|
| 267 | 267 | 'id' => 'give-api-key-exists', |
| 268 | 268 | 'type' => 'updated', |
| 269 | - 'description' => __( 'The specified user already has API keys.', 'give' ), |
|
| 269 | + 'description' => __('The specified user already has API keys.', 'give'), |
|
| 270 | 270 | 'show' => true, |
| 271 | - ) ); |
|
| 271 | + )); |
|
| 272 | 272 | break; |
| 273 | 273 | case 'api-key-regenerated' : |
| 274 | - Give()->notices->register_notice( array( |
|
| 274 | + Give()->notices->register_notice(array( |
|
| 275 | 275 | 'id' => 'give-api-key-regenerated', |
| 276 | 276 | 'type' => 'updated', |
| 277 | - 'description' => __( 'API keys have been regenerated.', 'give' ), |
|
| 277 | + 'description' => __('API keys have been regenerated.', 'give'), |
|
| 278 | 278 | 'show' => true, |
| 279 | - ) ); |
|
| 279 | + )); |
|
| 280 | 280 | break; |
| 281 | 281 | case 'api-key-revoked' : |
| 282 | - Give()->notices->register_notice( array( |
|
| 282 | + Give()->notices->register_notice(array( |
|
| 283 | 283 | 'id' => 'give-api-key-revoked', |
| 284 | 284 | 'type' => 'updated', |
| 285 | - 'description' => __( 'API keys have been revoked.', 'give' ), |
|
| 285 | + 'description' => __('API keys have been revoked.', 'give'), |
|
| 286 | 286 | 'show' => true, |
| 287 | - ) ); |
|
| 287 | + )); |
|
| 288 | 288 | break; |
| 289 | 289 | case 'sent-test-email' : |
| 290 | - Give()->notices->register_notice( array( |
|
| 290 | + Give()->notices->register_notice(array( |
|
| 291 | 291 | 'id' => 'give-sent-test-email', |
| 292 | 292 | 'type' => 'updated', |
| 293 | - 'description' => __( 'The test email has been sent.', 'give' ), |
|
| 293 | + 'description' => __('The test email has been sent.', 'give'), |
|
| 294 | 294 | 'show' => true, |
| 295 | - ) ); |
|
| 295 | + )); |
|
| 296 | 296 | break; |
| 297 | 297 | case 'matched-success-failure-page': |
| 298 | - Give()->notices->register_notice( array( |
|
| 298 | + Give()->notices->register_notice(array( |
|
| 299 | 299 | 'id' => 'give-matched-success-failure-page', |
| 300 | 300 | 'type' => 'updated', |
| 301 | - 'description' => __( 'You cannot set the success and failed pages to the same page', 'give' ), |
|
| 301 | + 'description' => __('You cannot set the success and failed pages to the same page', 'give'), |
|
| 302 | 302 | 'show' => true, |
| 303 | - ) ); |
|
| 303 | + )); |
|
| 304 | 304 | break; |
| 305 | 305 | }// End switch(). |
| 306 | 306 | }// End if(). |
| 307 | 307 | |
| 308 | 308 | // Payments errors. |
| 309 | - if ( current_user_can( 'edit_give_payments' ) ) { |
|
| 310 | - switch ( $message_notice ) { |
|
| 309 | + if (current_user_can('edit_give_payments')) { |
|
| 310 | + switch ($message_notice) { |
|
| 311 | 311 | case 'note-added' : |
| 312 | - Give()->notices->register_notice( array( |
|
| 312 | + Give()->notices->register_notice(array( |
|
| 313 | 313 | 'id' => 'give-note-added', |
| 314 | 314 | 'type' => 'updated', |
| 315 | - 'description' => __( 'The donation note has been added.', 'give' ), |
|
| 315 | + 'description' => __('The donation note has been added.', 'give'), |
|
| 316 | 316 | 'show' => true, |
| 317 | - ) ); |
|
| 317 | + )); |
|
| 318 | 318 | break; |
| 319 | 319 | case 'payment-updated' : |
| 320 | - Give()->notices->register_notice( array( |
|
| 320 | + Give()->notices->register_notice(array( |
|
| 321 | 321 | 'id' => 'give-payment-updated', |
| 322 | 322 | 'type' => 'updated', |
| 323 | - 'description' => __( 'The donation has been updated.', 'give' ), |
|
| 323 | + 'description' => __('The donation has been updated.', 'give'), |
|
| 324 | 324 | 'show' => true, |
| 325 | - ) ); |
|
| 325 | + )); |
|
| 326 | 326 | break; |
| 327 | 327 | }// End switch(). |
| 328 | 328 | }// End if(). |
| 329 | 329 | |
| 330 | 330 | // Donor Notices. |
| 331 | - if ( current_user_can( 'edit_give_payments' ) ) { |
|
| 332 | - switch ( $message_notice ) { |
|
| 331 | + if (current_user_can('edit_give_payments')) { |
|
| 332 | + switch ($message_notice) { |
|
| 333 | 333 | case 'donor-deleted' : |
| 334 | - Give()->notices->register_notice( array( |
|
| 334 | + Give()->notices->register_notice(array( |
|
| 335 | 335 | 'id' => 'give-donor-deleted', |
| 336 | 336 | 'type' => 'updated', |
| 337 | - 'description' => __( 'The selected donor(s) has been deleted.', 'give' ), |
|
| 337 | + 'description' => __('The selected donor(s) has been deleted.', 'give'), |
|
| 338 | 338 | 'show' => true, |
| 339 | - ) ); |
|
| 339 | + )); |
|
| 340 | 340 | break; |
| 341 | 341 | |
| 342 | 342 | case 'donor-donations-deleted' : |
| 343 | - Give()->notices->register_notice( array( |
|
| 343 | + Give()->notices->register_notice(array( |
|
| 344 | 344 | 'id' => 'give-donor-donations-deleted', |
| 345 | 345 | 'type' => 'updated', |
| 346 | - 'description' => __( 'The selected donor(s) and the associated donation(s) has been deleted.', 'give' ), |
|
| 346 | + 'description' => __('The selected donor(s) and the associated donation(s) has been deleted.', 'give'), |
|
| 347 | 347 | 'show' => true, |
| 348 | - ) ); |
|
| 348 | + )); |
|
| 349 | 349 | break; |
| 350 | 350 | |
| 351 | 351 | case 'confirm-delete-donor' : |
| 352 | - Give()->notices->register_notice( array( |
|
| 352 | + Give()->notices->register_notice(array( |
|
| 353 | 353 | 'id' => 'give-confirm-delete-donor', |
| 354 | 354 | 'type' => 'updated', |
| 355 | - 'description' => __( 'You must confirm to delete the selected donor(s).', 'give' ), |
|
| 355 | + 'description' => __('You must confirm to delete the selected donor(s).', 'give'), |
|
| 356 | 356 | 'show' => true, |
| 357 | - ) ); |
|
| 357 | + )); |
|
| 358 | 358 | break; |
| 359 | 359 | |
| 360 | 360 | case 'invalid-donor-id' : |
| 361 | - Give()->notices->register_notice( array( |
|
| 361 | + Give()->notices->register_notice(array( |
|
| 362 | 362 | 'id' => 'give-invalid-donor-id', |
| 363 | 363 | 'type' => 'updated', |
| 364 | - 'description' => __( 'Invalid Donor ID.', 'give' ), |
|
| 364 | + 'description' => __('Invalid Donor ID.', 'give'), |
|
| 365 | 365 | 'show' => true, |
| 366 | - ) ); |
|
| 366 | + )); |
|
| 367 | 367 | break; |
| 368 | 368 | |
| 369 | 369 | case 'donor-delete-failed' : |
| 370 | - Give()->notices->register_notice( array( |
|
| 370 | + Give()->notices->register_notice(array( |
|
| 371 | 371 | 'id' => 'give-donor-delete-failed', |
| 372 | 372 | 'type' => 'error', |
| 373 | - 'description' => __( 'Unable to delete selected donor(s).', 'give' ), |
|
| 373 | + 'description' => __('Unable to delete selected donor(s).', 'give'), |
|
| 374 | 374 | 'show' => true, |
| 375 | - ) ); |
|
| 375 | + )); |
|
| 376 | 376 | break; |
| 377 | 377 | |
| 378 | 378 | case 'email-added' : |
| 379 | - Give()->notices->register_notice( array( |
|
| 379 | + Give()->notices->register_notice(array( |
|
| 380 | 380 | 'id' => 'give-email-added', |
| 381 | 381 | 'type' => 'updated', |
| 382 | - 'description' => __( 'Donor email added.', 'give' ), |
|
| 382 | + 'description' => __('Donor email added.', 'give'), |
|
| 383 | 383 | 'show' => true, |
| 384 | - ) ); |
|
| 384 | + )); |
|
| 385 | 385 | break; |
| 386 | 386 | |
| 387 | 387 | case 'email-removed' : |
| 388 | - Give()->notices->register_notice( array( |
|
| 388 | + Give()->notices->register_notice(array( |
|
| 389 | 389 | 'id' => 'give-email-removed', |
| 390 | 390 | 'type' => 'updated', |
| 391 | - 'description' => __( 'Donor email removed.', 'give' ), |
|
| 391 | + 'description' => __('Donor email removed.', 'give'), |
|
| 392 | 392 | 'show' => true, |
| 393 | - ) ); |
|
| 393 | + )); |
|
| 394 | 394 | break; |
| 395 | 395 | |
| 396 | 396 | case 'email-remove-failed' : |
| 397 | - Give()->notices->register_notice( array( |
|
| 397 | + Give()->notices->register_notice(array( |
|
| 398 | 398 | 'id' => 'give-email-remove-failed', |
| 399 | 399 | 'type' => 'updated', |
| 400 | - 'description' => __( 'Failed to remove donor email.', 'give' ), |
|
| 400 | + 'description' => __('Failed to remove donor email.', 'give'), |
|
| 401 | 401 | 'show' => true, |
| 402 | - ) ); |
|
| 402 | + )); |
|
| 403 | 403 | break; |
| 404 | 404 | |
| 405 | 405 | case 'primary-email-updated' : |
| 406 | - Give()->notices->register_notice( array( |
|
| 406 | + Give()->notices->register_notice(array( |
|
| 407 | 407 | 'id' => 'give-primary-email-updated', |
| 408 | 408 | 'type' => 'updated', |
| 409 | - 'description' => __( 'Primary email updated for donor.', 'give' ), |
|
| 409 | + 'description' => __('Primary email updated for donor.', 'give'), |
|
| 410 | 410 | 'show' => true, |
| 411 | - ) ); |
|
| 411 | + )); |
|
| 412 | 412 | break; |
| 413 | 413 | |
| 414 | 414 | case 'primary-email-failed' : |
| 415 | - Give()->notices->register_notice( array( |
|
| 415 | + Give()->notices->register_notice(array( |
|
| 416 | 416 | 'id' => 'give-primary-email-failed', |
| 417 | 417 | 'type' => 'updated', |
| 418 | - 'description' => __( 'Failed to set primary email.', 'give' ), |
|
| 418 | + 'description' => __('Failed to set primary email.', 'give'), |
|
| 419 | 419 | 'show' => true, |
| 420 | - ) ); |
|
| 420 | + )); |
|
| 421 | 421 | break; |
| 422 | 422 | |
| 423 | 423 | case 'reconnect-user' : |
| 424 | - Give()->notices->register_notice( array( |
|
| 424 | + Give()->notices->register_notice(array( |
|
| 425 | 425 | 'id' => 'give-reconnect-user', |
| 426 | 426 | 'type' => 'updated', |
| 427 | - 'description' => __( 'User has been successfully connected with Donor.', 'give' ), |
|
| 427 | + 'description' => __('User has been successfully connected with Donor.', 'give'), |
|
| 428 | 428 | 'show' => true, |
| 429 | - ) ); |
|
| 429 | + )); |
|
| 430 | 430 | break; |
| 431 | 431 | |
| 432 | 432 | case 'profile-updated' : |
| 433 | - Give()->notices->register_notice( array( |
|
| 433 | + Give()->notices->register_notice(array( |
|
| 434 | 434 | 'id' => 'give-profile-updated', |
| 435 | 435 | 'type' => 'updated', |
| 436 | - 'description' => __( 'Donor information updated successfully.', 'give' ), |
|
| 436 | + 'description' => __('Donor information updated successfully.', 'give'), |
|
| 437 | 437 | 'show' => true, |
| 438 | - ) ); |
|
| 438 | + )); |
|
| 439 | 439 | break; |
| 440 | 440 | }// End switch(). |
| 441 | 441 | }// End if(). |
@@ -443,7 +443,7 @@ discard block |
||
| 443 | 443 | } |
| 444 | 444 | } |
| 445 | 445 | |
| 446 | -add_action( 'admin_notices', '_give_register_admin_notices', - 1 ); |
|
| 446 | +add_action('admin_notices', '_give_register_admin_notices', - 1); |
|
| 447 | 447 | |
| 448 | 448 | |
| 449 | 449 | /** |
@@ -453,39 +453,38 @@ discard block |
||
| 453 | 453 | * |
| 454 | 454 | * @return bool |
| 455 | 455 | */ |
| 456 | -function _give_show_test_mode_notice_in_admin_bar( $wp_admin_bar ) { |
|
| 457 | - $is_test_mode = ! empty( $_POST['test_mode'] ) ? |
|
| 458 | - give_is_setting_enabled( $_POST['test_mode'] ) : |
|
| 459 | - give_is_test_mode(); |
|
| 456 | +function _give_show_test_mode_notice_in_admin_bar($wp_admin_bar) { |
|
| 457 | + $is_test_mode = ! empty($_POST['test_mode']) ? |
|
| 458 | + give_is_setting_enabled($_POST['test_mode']) : give_is_test_mode(); |
|
| 460 | 459 | |
| 461 | 460 | if ( |
| 462 | - ! current_user_can( 'view_give_reports' ) || |
|
| 461 | + ! current_user_can('view_give_reports') || |
|
| 463 | 462 | ! $is_test_mode |
| 464 | 463 | ) { |
| 465 | 464 | return false; |
| 466 | 465 | } |
| 467 | 466 | |
| 468 | 467 | // Add the main site admin menu item. |
| 469 | - $wp_admin_bar->add_menu( array( |
|
| 468 | + $wp_admin_bar->add_menu(array( |
|
| 470 | 469 | 'id' => 'give-test-notice', |
| 471 | - 'href' => admin_url( 'edit.php?post_type=give_forms&page=give-settings&tab=gateways' ), |
|
| 470 | + 'href' => admin_url('edit.php?post_type=give_forms&page=give-settings&tab=gateways'), |
|
| 472 | 471 | 'parent' => 'top-secondary', |
| 473 | - 'title' => __( 'Give Test Mode Active', 'give' ), |
|
| 472 | + 'title' => __('Give Test Mode Active', 'give'), |
|
| 474 | 473 | 'meta' => array( |
| 475 | 474 | 'class' => 'give-test-mode-active', |
| 476 | 475 | ), |
| 477 | - ) ); |
|
| 476 | + )); |
|
| 478 | 477 | |
| 479 | 478 | return true; |
| 480 | 479 | } |
| 481 | 480 | |
| 482 | -add_action( 'admin_bar_menu', '_give_show_test_mode_notice_in_admin_bar', 1000, 1 ); |
|
| 481 | +add_action('admin_bar_menu', '_give_show_test_mode_notice_in_admin_bar', 1000, 1); |
|
| 483 | 482 | |
| 484 | 483 | /** |
| 485 | 484 | * Outputs the Give admin bar CSS. |
| 486 | 485 | */ |
| 487 | 486 | function _give_test_mode_notice_admin_bar_css() { |
| 488 | - if ( ! give_is_test_mode() ) { |
|
| 487 | + if ( ! give_is_test_mode()) { |
|
| 489 | 488 | return; |
| 490 | 489 | } |
| 491 | 490 | ?> |
@@ -503,7 +502,7 @@ discard block |
||
| 503 | 502 | <?php |
| 504 | 503 | } |
| 505 | 504 | |
| 506 | -add_action( 'admin_head', '_give_test_mode_notice_admin_bar_css' ); |
|
| 505 | +add_action('admin_head', '_give_test_mode_notice_admin_bar_css'); |
|
| 507 | 506 | |
| 508 | 507 | |
| 509 | 508 | /** |
@@ -513,12 +512,12 @@ discard block |
||
| 513 | 512 | */ |
| 514 | 513 | function give_import_page_link_callback() { |
| 515 | 514 | ?> |
| 516 | - <a href="<?php echo esc_url( give_import_page_url() ); ?>" |
|
| 517 | - class="page-import-action page-title-action"><?php _e( 'Import Donations', 'give' ); ?></a> |
|
| 515 | + <a href="<?php echo esc_url(give_import_page_url()); ?>" |
|
| 516 | + class="page-import-action page-title-action"><?php _e('Import Donations', 'give'); ?></a> |
|
| 518 | 517 | |
| 519 | 518 | <?php |
| 520 | 519 | // Check if view donation single page only. |
| 521 | - if ( ! empty( $_REQUEST['view'] ) && 'view-payment-details' === (string) give_clean( $_REQUEST['view'] ) && 'give-payment-history' === give_clean( $_REQUEST['page'] ) ) { |
|
| 520 | + if ( ! empty($_REQUEST['view']) && 'view-payment-details' === (string) give_clean($_REQUEST['view']) && 'give-payment-history' === give_clean($_REQUEST['page'])) { |
|
| 522 | 521 | ?> |
| 523 | 522 | <style type="text/css"> |
| 524 | 523 | .wrap #transaction-details-heading { |
@@ -529,7 +528,7 @@ discard block |
||
| 529 | 528 | } |
| 530 | 529 | } |
| 531 | 530 | |
| 532 | -add_action( 'give_payments_page_top', 'give_import_page_link_callback', 11 ); |
|
| 531 | +add_action('give_payments_page_top', 'give_import_page_link_callback', 11); |
|
| 533 | 532 | |
| 534 | 533 | /** |
| 535 | 534 | * Load donation import ajax callback |
@@ -545,9 +544,9 @@ discard block |
||
| 545 | 544 | Give_Cache::get_instance()->disable(); |
| 546 | 545 | |
| 547 | 546 | $import_setting = array(); |
| 548 | - $fields = isset( $_POST['fields'] ) ? $_POST['fields'] : null; |
|
| 547 | + $fields = isset($_POST['fields']) ? $_POST['fields'] : null; |
|
| 549 | 548 | |
| 550 | - parse_str( $fields, $output ); |
|
| 549 | + parse_str($fields, $output); |
|
| 551 | 550 | |
| 552 | 551 | $import_setting['create_user'] = $output['create_user']; |
| 553 | 552 | $import_setting['mode'] = $output['mode']; |
@@ -557,69 +556,69 @@ discard block |
||
| 557 | 556 | $import_setting['dry_run'] = $output['dry_run']; |
| 558 | 557 | |
| 559 | 558 | // Parent key id. |
| 560 | - $main_key = maybe_unserialize( $output['main_key'] ); |
|
| 561 | - |
|
| 562 | - $current = absint( $_REQUEST['current'] ); |
|
| 563 | - $total_ajax = absint( $_REQUEST['total_ajax'] ); |
|
| 564 | - $start = absint( $_REQUEST['start'] ); |
|
| 565 | - $end = absint( $_REQUEST['end'] ); |
|
| 566 | - $next = absint( $_REQUEST['next'] ); |
|
| 567 | - $total = absint( $_REQUEST['total'] ); |
|
| 568 | - $per_page = absint( $_REQUEST['per_page'] ); |
|
| 569 | - if ( empty( $output['delimiter'] ) ) { |
|
| 559 | + $main_key = maybe_unserialize($output['main_key']); |
|
| 560 | + |
|
| 561 | + $current = absint($_REQUEST['current']); |
|
| 562 | + $total_ajax = absint($_REQUEST['total_ajax']); |
|
| 563 | + $start = absint($_REQUEST['start']); |
|
| 564 | + $end = absint($_REQUEST['end']); |
|
| 565 | + $next = absint($_REQUEST['next']); |
|
| 566 | + $total = absint($_REQUEST['total']); |
|
| 567 | + $per_page = absint($_REQUEST['per_page']); |
|
| 568 | + if (empty($output['delimiter'])) { |
|
| 570 | 569 | $delimiter = ','; |
| 571 | 570 | } else { |
| 572 | 571 | $delimiter = $output['delimiter']; |
| 573 | 572 | } |
| 574 | 573 | |
| 575 | 574 | // Processing done here. |
| 576 | - $raw_data = give_get_donation_data_from_csv( $output['csv'], $start, $end, $delimiter ); |
|
| 577 | - $raw_key = maybe_unserialize( $output['mapto'] ); |
|
| 575 | + $raw_data = give_get_donation_data_from_csv($output['csv'], $start, $end, $delimiter); |
|
| 576 | + $raw_key = maybe_unserialize($output['mapto']); |
|
| 578 | 577 | $import_setting['raw_key'] = $raw_key; |
| 579 | 578 | |
| 580 | - if ( ! empty( $output['dry_run'] ) ) { |
|
| 581 | - $import_setting['csv_raw_data'] = give_get_donation_data_from_csv( $output['csv'], 1, $end, $delimiter ); |
|
| 579 | + if ( ! empty($output['dry_run'])) { |
|
| 580 | + $import_setting['csv_raw_data'] = give_get_donation_data_from_csv($output['csv'], 1, $end, $delimiter); |
|
| 582 | 581 | |
| 583 | - $import_setting['donors_list'] = Give()->donors->get_donors( array( |
|
| 584 | - 'number' => - 1, |
|
| 585 | - 'fields' => array( 'id', 'user_id', 'email' ), |
|
| 586 | - ) ); |
|
| 582 | + $import_setting['donors_list'] = Give()->donors->get_donors(array( |
|
| 583 | + 'number' => -1, |
|
| 584 | + 'fields' => array('id', 'user_id', 'email'), |
|
| 585 | + )); |
|
| 587 | 586 | } |
| 588 | 587 | |
| 589 | 588 | // Prevent normal emails. |
| 590 | - remove_action( 'give_complete_donation', 'give_trigger_donation_receipt', 999 ); |
|
| 591 | - remove_action( 'give_insert_user', 'give_new_user_notification', 10 ); |
|
| 592 | - remove_action( 'give_insert_payment', 'give_payment_save_page_data' ); |
|
| 589 | + remove_action('give_complete_donation', 'give_trigger_donation_receipt', 999); |
|
| 590 | + remove_action('give_insert_user', 'give_new_user_notification', 10); |
|
| 591 | + remove_action('give_insert_payment', 'give_payment_save_page_data'); |
|
| 593 | 592 | |
| 594 | 593 | $current_key = $start; |
| 595 | - foreach ( $raw_data as $row_data ) { |
|
| 594 | + foreach ($raw_data as $row_data) { |
|
| 596 | 595 | $import_setting['donation_key'] = $current_key; |
| 597 | - give_save_import_donation_to_db( $raw_key, $row_data, $main_key, $import_setting ); |
|
| 598 | - $current_key ++; |
|
| 596 | + give_save_import_donation_to_db($raw_key, $row_data, $main_key, $import_setting); |
|
| 597 | + $current_key++; |
|
| 599 | 598 | } |
| 600 | 599 | |
| 601 | 600 | // Check if function exists or not. |
| 602 | - if ( function_exists( 'give_payment_save_page_data' ) ) { |
|
| 603 | - add_action( 'give_insert_payment', 'give_payment_save_page_data' ); |
|
| 601 | + if (function_exists('give_payment_save_page_data')) { |
|
| 602 | + add_action('give_insert_payment', 'give_payment_save_page_data'); |
|
| 604 | 603 | } |
| 605 | - add_action( 'give_insert_user', 'give_new_user_notification', 10, 2 ); |
|
| 606 | - add_action( 'give_complete_donation', 'give_trigger_donation_receipt', 999 ); |
|
| 604 | + add_action('give_insert_user', 'give_new_user_notification', 10, 2); |
|
| 605 | + add_action('give_complete_donation', 'give_trigger_donation_receipt', 999); |
|
| 607 | 606 | |
| 608 | - if ( $next == false ) { |
|
| 607 | + if ($next == false) { |
|
| 609 | 608 | $json_data = array( |
| 610 | 609 | 'success' => true, |
| 611 | - 'message' => __( 'All donation uploaded successfully!', 'give' ), |
|
| 610 | + 'message' => __('All donation uploaded successfully!', 'give'), |
|
| 612 | 611 | ); |
| 613 | 612 | } else { |
| 614 | 613 | $index_start = $start; |
| 615 | 614 | $index_end = $end; |
| 616 | 615 | $last = false; |
| 617 | 616 | $next = true; |
| 618 | - if ( $next ) { |
|
| 617 | + if ($next) { |
|
| 619 | 618 | $index_start = $index_start + $per_page; |
| 620 | - $index_end = $per_page + ( $index_start - 1 ); |
|
| 619 | + $index_end = $per_page + ($index_start - 1); |
|
| 621 | 620 | } |
| 622 | - if ( $index_end >= $total ) { |
|
| 621 | + if ($index_end >= $total) { |
|
| 623 | 622 | $index_end = $total; |
| 624 | 623 | $last = true; |
| 625 | 624 | } |
@@ -633,31 +632,31 @@ discard block |
||
| 633 | 632 | ); |
| 634 | 633 | } |
| 635 | 634 | |
| 636 | - $url = give_import_page_url( array( |
|
| 635 | + $url = give_import_page_url(array( |
|
| 637 | 636 | 'step' => '4', |
| 638 | 637 | 'importer-type' => 'import_donations', |
| 639 | 638 | 'csv' => $output['csv'], |
| 640 | 639 | 'total' => $total, |
| 641 | 640 | 'delete_csv' => $import_setting['delete_csv'], |
| 642 | - 'success' => ( isset( $json_data['success'] ) ? $json_data['success'] : '' ), |
|
| 641 | + 'success' => (isset($json_data['success']) ? $json_data['success'] : ''), |
|
| 643 | 642 | 'dry_run' => $output['dry_run'], |
| 644 | - ) ); |
|
| 643 | + )); |
|
| 645 | 644 | $json_data['url'] = $url; |
| 646 | 645 | |
| 647 | - $current ++; |
|
| 646 | + $current++; |
|
| 648 | 647 | $json_data['current'] = $current; |
| 649 | 648 | |
| 650 | - $percentage = ( 100 / ( $total_ajax + 1 ) ) * $current; |
|
| 649 | + $percentage = (100 / ($total_ajax + 1)) * $current; |
|
| 651 | 650 | $json_data['percentage'] = $percentage; |
| 652 | 651 | |
| 653 | 652 | // Enable Give cache |
| 654 | 653 | Give_Cache::get_instance()->enable(); |
| 655 | 654 | |
| 656 | - $json_data = apply_filters( 'give_import_ajax_responces', $json_data, $fields ); |
|
| 657 | - wp_die( json_encode( $json_data ) ); |
|
| 655 | + $json_data = apply_filters('give_import_ajax_responces', $json_data, $fields); |
|
| 656 | + wp_die(json_encode($json_data)); |
|
| 658 | 657 | } |
| 659 | 658 | |
| 660 | -add_action( 'wp_ajax_give_donation_import', 'give_donation_import_callback' ); |
|
| 659 | +add_action('wp_ajax_give_donation_import', 'give_donation_import_callback'); |
|
| 661 | 660 | |
| 662 | 661 | /** |
| 663 | 662 | * Load core settings import ajax callback |
@@ -669,8 +668,8 @@ discard block |
||
| 669 | 668 | */ |
| 670 | 669 | |
| 671 | 670 | function give_core_settings_import_callback() { |
| 672 | - $fields = isset( $_POST['fields'] ) ? $_POST['fields'] : null; |
|
| 673 | - parse_str( $fields, $fields ); |
|
| 671 | + $fields = isset($_POST['fields']) ? $_POST['fields'] : null; |
|
| 672 | + parse_str($fields, $fields); |
|
| 674 | 673 | |
| 675 | 674 | $json_data['success'] = false; |
| 676 | 675 | |
@@ -685,22 +684,22 @@ discard block |
||
| 685 | 684 | * |
| 686 | 685 | * @return array $fields |
| 687 | 686 | */ |
| 688 | - $fields = (array) apply_filters( 'give_import_core_settings_fields', $fields ); |
|
| 687 | + $fields = (array) apply_filters('give_import_core_settings_fields', $fields); |
|
| 689 | 688 | |
| 690 | - $file_name = ( ! empty( $fields['file_name'] ) ? give_clean( $fields['file_name'] ) : false ); |
|
| 689 | + $file_name = ( ! empty($fields['file_name']) ? give_clean($fields['file_name']) : false); |
|
| 691 | 690 | |
| 692 | - if ( ! empty( $file_name ) ) { |
|
| 693 | - $type = ( ! empty( $fields['type'] ) ? give_clean( $fields['type'] ) : 'merge' ); |
|
| 691 | + if ( ! empty($file_name)) { |
|
| 692 | + $type = ( ! empty($fields['type']) ? give_clean($fields['type']) : 'merge'); |
|
| 694 | 693 | |
| 695 | 694 | // Get the json data from the file and then alter it in array format |
| 696 | - $json_string = give_get_core_settings_json( $file_name ); |
|
| 697 | - $json_to_array = json_decode( $json_string, true ); |
|
| 695 | + $json_string = give_get_core_settings_json($file_name); |
|
| 696 | + $json_to_array = json_decode($json_string, true); |
|
| 698 | 697 | |
| 699 | 698 | // get the current settign from the options table. |
| 700 | - $host_give_options = get_option( 'give_settings', array() ); |
|
| 699 | + $host_give_options = get_option('give_settings', array()); |
|
| 701 | 700 | |
| 702 | 701 | // Save old settins for backup. |
| 703 | - update_option( 'give_settings_old', $host_give_options, false ); |
|
| 702 | + update_option('give_settings_old', $host_give_options, false); |
|
| 704 | 703 | |
| 705 | 704 | /** |
| 706 | 705 | * Filter to Modify Core Settings that are being going to get import in options table as give settings. |
@@ -716,9 +715,9 @@ discard block |
||
| 716 | 715 | * |
| 717 | 716 | * @return array $json_to_array Setting that are being going to get imported |
| 718 | 717 | */ |
| 719 | - $json_to_array = (array) apply_filters( 'give_import_core_settings_data', $json_to_array, $type, $host_give_options, $fields ); |
|
| 718 | + $json_to_array = (array) apply_filters('give_import_core_settings_data', $json_to_array, $type, $host_give_options, $fields); |
|
| 720 | 719 | |
| 721 | - update_option( 'give_settings', $json_to_array, false ); |
|
| 720 | + update_option('give_settings', $json_to_array, false); |
|
| 722 | 721 | |
| 723 | 722 | $json_data['success'] = true; |
| 724 | 723 | } |
@@ -734,16 +733,16 @@ discard block |
||
| 734 | 733 | * |
| 735 | 734 | * @return array $url |
| 736 | 735 | */ |
| 737 | - $json_data['url'] = give_import_page_url( (array) apply_filters( 'give_import_core_settings_success_url', array( |
|
| 738 | - 'step' => ( empty( $json_data['success'] ) ? '1' : '3' ), |
|
| 736 | + $json_data['url'] = give_import_page_url((array) apply_filters('give_import_core_settings_success_url', array( |
|
| 737 | + 'step' => (empty($json_data['success']) ? '1' : '3'), |
|
| 739 | 738 | 'importer-type' => 'import_core_setting', |
| 740 | - 'success' => ( empty( $json_data['success'] ) ? '0' : '1' ), |
|
| 741 | - ) ) ); |
|
| 739 | + 'success' => (empty($json_data['success']) ? '0' : '1'), |
|
| 740 | + ))); |
|
| 742 | 741 | |
| 743 | - wp_send_json( $json_data ); |
|
| 742 | + wp_send_json($json_data); |
|
| 744 | 743 | } |
| 745 | 744 | |
| 746 | -add_action( 'wp_ajax_give_core_settings_import', 'give_core_settings_import_callback' ); |
|
| 745 | +add_action('wp_ajax_give_core_settings_import', 'give_core_settings_import_callback'); |
|
| 747 | 746 | |
| 748 | 747 | /** |
| 749 | 748 | * Initializes blank slate content if a list table is empty. |
@@ -755,7 +754,7 @@ discard block |
||
| 755 | 754 | $blank_slate->init(); |
| 756 | 755 | } |
| 757 | 756 | |
| 758 | -add_action( 'current_screen', 'give_blank_slate' ); |
|
| 757 | +add_action('current_screen', 'give_blank_slate'); |
|
| 759 | 758 | |
| 760 | 759 | /** |
| 761 | 760 | * Validate Fields of User Profile |
@@ -768,24 +767,24 @@ discard block |
||
| 768 | 767 | * |
| 769 | 768 | * @return mixed |
| 770 | 769 | */ |
| 771 | -function give_validate_user_profile( $errors, $update, $user ) { |
|
| 770 | +function give_validate_user_profile($errors, $update, $user) { |
|
| 772 | 771 | |
| 773 | - if ( ! empty( $_POST['action'] ) && ( 'adduser' === $_POST['action'] || 'createuser' === $_POST['action'] ) ) { |
|
| 772 | + if ( ! empty($_POST['action']) && ('adduser' === $_POST['action'] || 'createuser' === $_POST['action'])) { |
|
| 774 | 773 | return; |
| 775 | 774 | } |
| 776 | 775 | |
| 777 | - if ( ! empty( $user->ID ) ) { |
|
| 778 | - $donor = Give()->donors->get_donor_by( 'user_id', $user->ID ); |
|
| 776 | + if ( ! empty($user->ID)) { |
|
| 777 | + $donor = Give()->donors->get_donor_by('user_id', $user->ID); |
|
| 779 | 778 | |
| 780 | - if ( $donor ) { |
|
| 779 | + if ($donor) { |
|
| 781 | 780 | // If Donor is attached with User, then validate first name. |
| 782 | - if ( empty( $_POST['first_name'] ) ) { |
|
| 781 | + if (empty($_POST['first_name'])) { |
|
| 783 | 782 | $errors->add( |
| 784 | 783 | 'empty_first_name', |
| 785 | 784 | sprintf( |
| 786 | 785 | '<strong>%1$s:</strong> %2$s', |
| 787 | - __( 'ERROR', 'give' ), |
|
| 788 | - __( 'Please enter your first name.', 'give' ) |
|
| 786 | + __('ERROR', 'give'), |
|
| 787 | + __('Please enter your first name.', 'give') |
|
| 789 | 788 | ) |
| 790 | 789 | ); |
| 791 | 790 | } |
@@ -794,7 +793,7 @@ discard block |
||
| 794 | 793 | |
| 795 | 794 | } |
| 796 | 795 | |
| 797 | -add_action( 'user_profile_update_errors', 'give_validate_user_profile', 10, 3 ); |
|
| 796 | +add_action('user_profile_update_errors', 'give_validate_user_profile', 10, 3); |
|
| 798 | 797 | |
| 799 | 798 | /** |
| 800 | 799 | * Show Donor Information on User Profile Page. |
@@ -803,19 +802,19 @@ discard block |
||
| 803 | 802 | * |
| 804 | 803 | * @since 2.0 |
| 805 | 804 | */ |
| 806 | -function give_donor_information_profile_fields( $user ) { |
|
| 807 | - $donor = Give()->donors->get_donor_by( 'user_id', $user->ID ); |
|
| 805 | +function give_donor_information_profile_fields($user) { |
|
| 806 | + $donor = Give()->donors->get_donor_by('user_id', $user->ID); |
|
| 808 | 807 | |
| 809 | 808 | // Display Donor Information, only if donor is attached with User. |
| 810 | - if ( ! empty( $donor->user_id ) ) { |
|
| 809 | + if ( ! empty($donor->user_id)) { |
|
| 811 | 810 | ?> |
| 812 | 811 | <table class="form-table"> |
| 813 | 812 | <tbody> |
| 814 | 813 | <tr> |
| 815 | - <th scope="row"><?php _e( 'Donor', 'give' ); ?></th> |
|
| 814 | + <th scope="row"><?php _e('Donor', 'give'); ?></th> |
|
| 816 | 815 | <td> |
| 817 | - <a href="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-donors&view=overview&id=' . $donor->id ); ?>"> |
|
| 818 | - <?php _e( 'View Donor Information', 'give' ); ?> |
|
| 816 | + <a href="<?php echo admin_url('edit.php?post_type=give_forms&page=give-donors&view=overview&id='.$donor->id); ?>"> |
|
| 817 | + <?php _e('View Donor Information', 'give'); ?> |
|
| 819 | 818 | </a> |
| 820 | 819 | </td> |
| 821 | 820 | </tr> |
@@ -825,7 +824,7 @@ discard block |
||
| 825 | 824 | } |
| 826 | 825 | } |
| 827 | 826 | |
| 828 | -add_action( 'personal_options', 'give_donor_information_profile_fields' ); |
|
| 827 | +add_action('personal_options', 'give_donor_information_profile_fields'); |
|
| 829 | 828 | /** |
| 830 | 829 | * Get Array of WP User Roles. |
| 831 | 830 | * |
@@ -837,8 +836,8 @@ discard block |
||
| 837 | 836 | $user_roles = array(); |
| 838 | 837 | |
| 839 | 838 | // Loop through User Roles. |
| 840 | - foreach ( get_editable_roles() as $role_name => $role_info ) : |
|
| 841 | - $user_roles[ $role_name ] = $role_info['name']; |
|
| 839 | + foreach (get_editable_roles() as $role_name => $role_info) : |
|
| 840 | + $user_roles[$role_name] = $role_info['name']; |
|
| 842 | 841 | endforeach; |
| 843 | 842 | |
| 844 | 843 | return $user_roles; |
@@ -855,48 +854,46 @@ discard block |
||
| 855 | 854 | function __give_ajax_donor_manage_addresses() { |
| 856 | 855 | // Bailout. |
| 857 | 856 | if ( |
| 858 | - empty( $_POST['form'] ) || |
|
| 859 | - empty( $_POST['donorID'] ) |
|
| 857 | + empty($_POST['form']) || |
|
| 858 | + empty($_POST['donorID']) |
|
| 860 | 859 | ) { |
| 861 | - wp_send_json_error( array( |
|
| 860 | + wp_send_json_error(array( |
|
| 862 | 861 | 'error' => 1, |
| 863 | - ) ); |
|
| 862 | + )); |
|
| 864 | 863 | } |
| 865 | 864 | |
| 866 | - $post = give_clean( wp_parse_args( $_POST ) ); |
|
| 867 | - $donorID = absint( $post['donorID'] ); |
|
| 868 | - $form_data = give_clean( wp_parse_args( $post['form'] ) ); |
|
| 869 | - $is_multi_address_type = ( 'billing' === $form_data['address-id'] || false !== strpos( $form_data['address-id'], '_' ) ); |
|
| 870 | - $address_type = false !== strpos( $form_data['address-id'], '_' ) ? |
|
| 871 | - array_shift( explode( '_', $form_data['address-id'] ) ) : |
|
| 872 | - $form_data['address-id']; |
|
| 873 | - $address_id = false !== strpos( $form_data['address-id'], '_' ) ? |
|
| 874 | - array_pop( explode( '_', $form_data['address-id'] ) ) : |
|
| 875 | - null; |
|
| 865 | + $post = give_clean(wp_parse_args($_POST)); |
|
| 866 | + $donorID = absint($post['donorID']); |
|
| 867 | + $form_data = give_clean(wp_parse_args($post['form'])); |
|
| 868 | + $is_multi_address_type = ('billing' === $form_data['address-id'] || false !== strpos($form_data['address-id'], '_')); |
|
| 869 | + $address_type = false !== strpos($form_data['address-id'], '_') ? |
|
| 870 | + array_shift(explode('_', $form_data['address-id'])) : $form_data['address-id']; |
|
| 871 | + $address_id = false !== strpos($form_data['address-id'], '_') ? |
|
| 872 | + array_pop(explode('_', $form_data['address-id'])) : null; |
|
| 876 | 873 | $response_data = array( |
| 877 | 874 | 'action' => $form_data['address-action'], |
| 878 | 875 | 'id' => $form_data['address-id'], |
| 879 | 876 | ); |
| 880 | 877 | |
| 881 | 878 | // Security check. |
| 882 | - if ( ! wp_verify_nonce( $form_data['_wpnonce'], 'give-manage-donor-addresses' ) ) { |
|
| 883 | - wp_send_json_error( array( |
|
| 879 | + if ( ! wp_verify_nonce($form_data['_wpnonce'], 'give-manage-donor-addresses')) { |
|
| 880 | + wp_send_json_error(array( |
|
| 884 | 881 | 'error' => 1, |
| 885 | 882 | 'error_msg' => wp_sprintf( |
| 886 | 883 | '<div class="notice notice-error"><p>%s</p></div>', |
| 887 | - __( 'Error: Security issue.', 'give' ) |
|
| 884 | + __('Error: Security issue.', 'give') |
|
| 888 | 885 | ), |
| 889 | 886 | ) |
| 890 | 887 | ); |
| 891 | 888 | } |
| 892 | 889 | |
| 893 | - $donor = new Give_Donor( $donorID ); |
|
| 890 | + $donor = new Give_Donor($donorID); |
|
| 894 | 891 | |
| 895 | 892 | // Verify donor. |
| 896 | - if ( ! $donor->id ) { |
|
| 897 | - wp_send_json_error( array( |
|
| 893 | + if ( ! $donor->id) { |
|
| 894 | + wp_send_json_error(array( |
|
| 898 | 895 | 'error' => 3, |
| 899 | - ) ); |
|
| 896 | + )); |
|
| 900 | 897 | } |
| 901 | 898 | |
| 902 | 899 | // Unset all data except address. |
@@ -907,59 +904,57 @@ discard block |
||
| 907 | 904 | ); |
| 908 | 905 | |
| 909 | 906 | // Process action. |
| 910 | - switch ( $response_data['action'] ) { |
|
| 907 | + switch ($response_data['action']) { |
|
| 911 | 908 | |
| 912 | 909 | case 'add': |
| 913 | - if ( ! $donor->add_address( "{$address_type}[]", $form_data ) ) { |
|
| 914 | - wp_send_json_error( array( |
|
| 910 | + if ( ! $donor->add_address("{$address_type}[]", $form_data)) { |
|
| 911 | + wp_send_json_error(array( |
|
| 915 | 912 | 'error' => 1, |
| 916 | 913 | 'error_msg' => wp_sprintf( |
| 917 | 914 | '<div class="notice notice-error"><p>%s</p></div>', |
| 918 | - __( 'Error: Unable to save the address. Please check if address already exist.', 'give' ) |
|
| 915 | + __('Error: Unable to save the address. Please check if address already exist.', 'give') |
|
| 919 | 916 | ), |
| 920 | 917 | ) |
| 921 | 918 | ); |
| 922 | 919 | } |
| 923 | 920 | |
| 924 | - $total_addresses = count( $donor->address[ $address_type ] ); |
|
| 921 | + $total_addresses = count($donor->address[$address_type]); |
|
| 925 | 922 | |
| 926 | 923 | $address_index = $is_multi_address_type ? |
| 927 | - $total_addresses - 1 : |
|
| 928 | - $address_type; |
|
| 924 | + $total_addresses - 1 : $address_type; |
|
| 929 | 925 | |
| 930 | - $array_keys = array_keys( $donor->address[ $address_type ] ); |
|
| 926 | + $array_keys = array_keys($donor->address[$address_type]); |
|
| 931 | 927 | |
| 932 | 928 | $address_id = $is_multi_address_type ? |
| 933 | - end( $array_keys ) : |
|
| 934 | - $address_type; |
|
| 929 | + end($array_keys) : $address_type; |
|
| 935 | 930 | |
| 936 | 931 | $response_data['address_html'] = __give_get_format_address( |
| 937 | - end( $donor->address['billing'] ), |
|
| 932 | + end($donor->address['billing']), |
|
| 938 | 933 | array( |
| 939 | 934 | // We can add only billing address from donor screen. |
| 940 | 935 | 'type' => 'billing', |
| 941 | 936 | 'id' => $address_id, |
| 942 | - 'index' => ++ $address_index, |
|
| 937 | + 'index' => ++$address_index, |
|
| 943 | 938 | ) |
| 944 | 939 | ); |
| 945 | - $response_data['success_msg'] = wp_sprintf( |
|
| 940 | + $response_data['success_msg'] = wp_sprintf( |
|
| 946 | 941 | '<div class="notice updated"><p>%s</p></div>', |
| 947 | - __( 'Successfully added a new address to the donor.', 'give' ) |
|
| 942 | + __('Successfully added a new address to the donor.', 'give') |
|
| 948 | 943 | ); |
| 949 | 944 | |
| 950 | - if ( $is_multi_address_type ) { |
|
| 945 | + if ($is_multi_address_type) { |
|
| 951 | 946 | $response_data['id'] = "{$response_data['id']}_{$address_index}"; |
| 952 | 947 | } |
| 953 | 948 | |
| 954 | 949 | break; |
| 955 | 950 | |
| 956 | 951 | case 'remove': |
| 957 | - if ( ! $donor->remove_address( $response_data['id'] ) ) { |
|
| 958 | - wp_send_json_error( array( |
|
| 952 | + if ( ! $donor->remove_address($response_data['id'])) { |
|
| 953 | + wp_send_json_error(array( |
|
| 959 | 954 | 'error' => 2, |
| 960 | 955 | 'error_msg' => wp_sprintf( |
| 961 | 956 | '<div class="notice notice-error"><p>%s</p></div>', |
| 962 | - __( 'Error: Unable to delete address.', 'give' ) |
|
| 957 | + __('Error: Unable to delete address.', 'give') |
|
| 963 | 958 | ), |
| 964 | 959 | ) |
| 965 | 960 | ); |
@@ -967,18 +962,18 @@ discard block |
||
| 967 | 962 | |
| 968 | 963 | $response_data['success_msg'] = wp_sprintf( |
| 969 | 964 | '<div class="notice updated"><p>%s</p></div>', |
| 970 | - __( 'Successfully removed a address of donor.', 'give' ) |
|
| 965 | + __('Successfully removed a address of donor.', 'give') |
|
| 971 | 966 | ); |
| 972 | 967 | |
| 973 | 968 | break; |
| 974 | 969 | |
| 975 | 970 | case 'update': |
| 976 | - if ( ! $donor->update_address( $response_data['id'], $form_data ) ) { |
|
| 977 | - wp_send_json_error( array( |
|
| 971 | + if ( ! $donor->update_address($response_data['id'], $form_data)) { |
|
| 972 | + wp_send_json_error(array( |
|
| 978 | 973 | 'error' => 3, |
| 979 | 974 | 'error_msg' => wp_sprintf( |
| 980 | 975 | '<div class="notice notice-error"><p>%s</p></div>', |
| 981 | - __( 'Error: Unable to update address. Please check if address already exist.', 'give' ) |
|
| 976 | + __('Error: Unable to update address. Please check if address already exist.', 'give') |
|
| 982 | 977 | ), |
| 983 | 978 | ) |
| 984 | 979 | ); |
@@ -986,26 +981,25 @@ discard block |
||
| 986 | 981 | |
| 987 | 982 | $response_data['address_html'] = __give_get_format_address( |
| 988 | 983 | $is_multi_address_type ? |
| 989 | - $donor->address[ $address_type ][ $address_id ] : |
|
| 990 | - $donor->address[ $address_type ], |
|
| 984 | + $donor->address[$address_type][$address_id] : $donor->address[$address_type], |
|
| 991 | 985 | array( |
| 992 | 986 | 'type' => $address_type, |
| 993 | 987 | 'id' => $address_id, |
| 994 | 988 | 'index' => $address_id, |
| 995 | 989 | ) |
| 996 | 990 | ); |
| 997 | - $response_data['success_msg'] = wp_sprintf( |
|
| 991 | + $response_data['success_msg'] = wp_sprintf( |
|
| 998 | 992 | '<div class="notice updated"><p>%s</p></div>', |
| 999 | - __( 'Successfully updated a address of donor', 'give' ) |
|
| 993 | + __('Successfully updated a address of donor', 'give') |
|
| 1000 | 994 | ); |
| 1001 | 995 | |
| 1002 | 996 | break; |
| 1003 | 997 | }// End switch(). |
| 1004 | 998 | |
| 1005 | - wp_send_json_success( $response_data ); |
|
| 999 | + wp_send_json_success($response_data); |
|
| 1006 | 1000 | } |
| 1007 | 1001 | |
| 1008 | -add_action( 'wp_ajax_donor_manage_addresses', '__give_ajax_donor_manage_addresses' ); |
|
| 1002 | +add_action('wp_ajax_donor_manage_addresses', '__give_ajax_donor_manage_addresses'); |
|
| 1009 | 1003 | |
| 1010 | 1004 | /** |
| 1011 | 1005 | * Admin donor billing address label |
@@ -1016,13 +1010,13 @@ discard block |
||
| 1016 | 1010 | * |
| 1017 | 1011 | * @return string |
| 1018 | 1012 | */ |
| 1019 | -function __give_donor_billing_address_label( $address_label ) { |
|
| 1020 | - $address_label = __( 'Billing Address', 'give' ); |
|
| 1013 | +function __give_donor_billing_address_label($address_label) { |
|
| 1014 | + $address_label = __('Billing Address', 'give'); |
|
| 1021 | 1015 | |
| 1022 | 1016 | return $address_label; |
| 1023 | 1017 | } |
| 1024 | 1018 | |
| 1025 | -add_action( 'give_donor_billing_address_label', '__give_donor_billing_address_label' ); |
|
| 1019 | +add_action('give_donor_billing_address_label', '__give_donor_billing_address_label'); |
|
| 1026 | 1020 | |
| 1027 | 1021 | /** |
| 1028 | 1022 | * Admin donor personal address label |
@@ -1033,13 +1027,13 @@ discard block |
||
| 1033 | 1027 | * |
| 1034 | 1028 | * @return string |
| 1035 | 1029 | */ |
| 1036 | -function __give_donor_personal_address_label( $address_label ) { |
|
| 1037 | - $address_label = __( 'Personal Address', 'give' ); |
|
| 1030 | +function __give_donor_personal_address_label($address_label) { |
|
| 1031 | + $address_label = __('Personal Address', 'give'); |
|
| 1038 | 1032 | |
| 1039 | 1033 | return $address_label; |
| 1040 | 1034 | } |
| 1041 | 1035 | |
| 1042 | -add_action( 'give_donor_personal_address_label', '__give_donor_personal_address_label' ); |
|
| 1036 | +add_action('give_donor_personal_address_label', '__give_donor_personal_address_label'); |
|
| 1043 | 1037 | |
| 1044 | 1038 | /** |
| 1045 | 1039 | * Update Donor Information when User Profile is updated from admin. |
@@ -1052,34 +1046,34 @@ discard block |
||
| 1052 | 1046 | * |
| 1053 | 1047 | * @return bool |
| 1054 | 1048 | */ |
| 1055 | -function give_update_donor_name_on_user_update( $user_id = 0 ) { |
|
| 1049 | +function give_update_donor_name_on_user_update($user_id = 0) { |
|
| 1056 | 1050 | |
| 1057 | - if ( current_user_can( 'edit_user', $user_id ) ) { |
|
| 1051 | + if (current_user_can('edit_user', $user_id)) { |
|
| 1058 | 1052 | |
| 1059 | - $donor = new Give_Donor( $user_id, true ); |
|
| 1053 | + $donor = new Give_Donor($user_id, true); |
|
| 1060 | 1054 | |
| 1061 | 1055 | // Bailout, if donor doesn't exists. |
| 1062 | - if ( ! $donor ) { |
|
| 1056 | + if ( ! $donor) { |
|
| 1063 | 1057 | return false; |
| 1064 | 1058 | } |
| 1065 | 1059 | |
| 1066 | 1060 | // Get User First name and Last name. |
| 1067 | - $first_name = ( $_POST['first_name'] ) ? give_clean( $_POST['first_name'] ) : get_user_meta( $user_id, 'first_name', true ); |
|
| 1068 | - $last_name = ( $_POST['last_name'] ) ? give_clean( $_POST['last_name'] ) : get_user_meta( $user_id, 'last_name', true ); |
|
| 1069 | - $full_name = strip_tags( wp_unslash( trim( "{$first_name} {$last_name}" ) ) ); |
|
| 1061 | + $first_name = ($_POST['first_name']) ? give_clean($_POST['first_name']) : get_user_meta($user_id, 'first_name', true); |
|
| 1062 | + $last_name = ($_POST['last_name']) ? give_clean($_POST['last_name']) : get_user_meta($user_id, 'last_name', true); |
|
| 1063 | + $full_name = strip_tags(wp_unslash(trim("{$first_name} {$last_name}"))); |
|
| 1070 | 1064 | |
| 1071 | 1065 | // Assign User First name and Last name to Donor. |
| 1072 | - Give()->donors->update( $donor->id, array( |
|
| 1066 | + Give()->donors->update($donor->id, array( |
|
| 1073 | 1067 | 'name' => $full_name, |
| 1074 | - ) ); |
|
| 1075 | - Give()->donor_meta->update_meta( $donor->id, '_give_donor_first_name', $first_name ); |
|
| 1076 | - Give()->donor_meta->update_meta( $donor->id, '_give_donor_last_name', $last_name ); |
|
| 1068 | + )); |
|
| 1069 | + Give()->donor_meta->update_meta($donor->id, '_give_donor_first_name', $first_name); |
|
| 1070 | + Give()->donor_meta->update_meta($donor->id, '_give_donor_last_name', $last_name); |
|
| 1077 | 1071 | |
| 1078 | 1072 | } |
| 1079 | 1073 | } |
| 1080 | 1074 | |
| 1081 | -add_action( 'edit_user_profile_update', 'give_update_donor_name_on_user_update', 10 ); |
|
| 1082 | -add_action( 'personal_options_update', 'give_update_donor_name_on_user_update', 10 ); |
|
| 1075 | +add_action('edit_user_profile_update', 'give_update_donor_name_on_user_update', 10); |
|
| 1076 | +add_action('personal_options_update', 'give_update_donor_name_on_user_update', 10); |
|
| 1083 | 1077 | |
| 1084 | 1078 | |
| 1085 | 1079 | /** |
@@ -1094,31 +1088,31 @@ discard block |
||
| 1094 | 1088 | * |
| 1095 | 1089 | * @return bool |
| 1096 | 1090 | */ |
| 1097 | -function give_update_donor_email_on_user_update( $user_id = 0, $old_user_data = false ) { |
|
| 1091 | +function give_update_donor_email_on_user_update($user_id = 0, $old_user_data = false) { |
|
| 1098 | 1092 | |
| 1099 | - $donor = new Give_Donor( $user_id, true ); |
|
| 1093 | + $donor = new Give_Donor($user_id, true); |
|
| 1100 | 1094 | |
| 1101 | - if ( ! $donor ) { |
|
| 1095 | + if ( ! $donor) { |
|
| 1102 | 1096 | return false; |
| 1103 | 1097 | } |
| 1104 | 1098 | |
| 1105 | - $user = get_userdata( $user_id ); |
|
| 1099 | + $user = get_userdata($user_id); |
|
| 1106 | 1100 | |
| 1107 | - if ( ! empty( $user ) && $user->user_email !== $donor->email ) { |
|
| 1101 | + if ( ! empty($user) && $user->user_email !== $donor->email) { |
|
| 1108 | 1102 | |
| 1109 | - $success = Give()->donors->update( $donor->id, array( |
|
| 1103 | + $success = Give()->donors->update($donor->id, array( |
|
| 1110 | 1104 | 'email' => $user->user_email, |
| 1111 | - ) ); |
|
| 1105 | + )); |
|
| 1112 | 1106 | |
| 1113 | - if ( $success ) { |
|
| 1107 | + if ($success) { |
|
| 1114 | 1108 | // Update some payment meta if we need to |
| 1115 | - $payments_array = explode( ',', $donor->payment_ids ); |
|
| 1109 | + $payments_array = explode(',', $donor->payment_ids); |
|
| 1116 | 1110 | |
| 1117 | - if ( ! empty( $payments_array ) ) { |
|
| 1111 | + if ( ! empty($payments_array)) { |
|
| 1118 | 1112 | |
| 1119 | - foreach ( $payments_array as $payment_id ) { |
|
| 1113 | + foreach ($payments_array as $payment_id) { |
|
| 1120 | 1114 | |
| 1121 | - give_update_payment_meta( $payment_id, 'email', $user->user_email ); |
|
| 1115 | + give_update_payment_meta($payment_id, 'email', $user->user_email); |
|
| 1122 | 1116 | |
| 1123 | 1117 | } |
| 1124 | 1118 | } |
@@ -1131,14 +1125,14 @@ discard block |
||
| 1131 | 1125 | * @param WP_User $user WordPress User object. |
| 1132 | 1126 | * @param Give_Donor $donor Give donor object. |
| 1133 | 1127 | */ |
| 1134 | - do_action( 'give_update_donor_email_on_user_update', $user, $donor ); |
|
| 1128 | + do_action('give_update_donor_email_on_user_update', $user, $donor); |
|
| 1135 | 1129 | |
| 1136 | 1130 | } |
| 1137 | 1131 | } |
| 1138 | 1132 | |
| 1139 | 1133 | } |
| 1140 | 1134 | |
| 1141 | -add_action( 'profile_update', 'give_update_donor_email_on_user_update', 10, 2 ); |
|
| 1135 | +add_action('profile_update', 'give_update_donor_email_on_user_update', 10, 2); |
|
| 1142 | 1136 | |
| 1143 | 1137 | |
| 1144 | 1138 | /** |
@@ -1147,15 +1141,15 @@ discard block |
||
| 1147 | 1141 | function give_cache_flush() { |
| 1148 | 1142 | $result = Give_Cache::flush_cache(); |
| 1149 | 1143 | |
| 1150 | - if ( $result ) { |
|
| 1151 | - wp_send_json_success( array( |
|
| 1152 | - 'message' => __( 'Cache flushed successfully.', 'give' ), |
|
| 1144 | + if ($result) { |
|
| 1145 | + wp_send_json_success(array( |
|
| 1146 | + 'message' => __('Cache flushed successfully.', 'give'), |
|
| 1153 | 1147 | )); |
| 1154 | 1148 | } else { |
| 1155 | - wp_send_json_error( array( |
|
| 1156 | - 'message' => __( 'An error occured while flushing the cache.', 'give' ), |
|
| 1149 | + wp_send_json_error(array( |
|
| 1150 | + 'message' => __('An error occured while flushing the cache.', 'give'), |
|
| 1157 | 1151 | )); |
| 1158 | 1152 | } |
| 1159 | 1153 | } |
| 1160 | 1154 | |
| 1161 | -add_action( 'wp_ajax_give_cache_flush', 'give_cache_flush', 10, 0 ); |
|
| 1155 | +add_action('wp_ajax_give_cache_flush', 'give_cache_flush', 10, 0); |
|