@@ -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 | |
@@ -109,8 +109,8 @@ discard block |
||
| 109 | 109 | |
| 110 | 110 | // Show error message if Akismet not configured and Admin try to save 'enabled' option. |
| 111 | 111 | if ( isset( $_POST['akismet_spam_protection'] ) |
| 112 | - && give_is_setting_enabled( $_POST['akismet_spam_protection'] ) |
|
| 113 | - && ! give_check_akismet_key() |
|
| 112 | + && give_is_setting_enabled( $_POST['akismet_spam_protection'] ) |
|
| 113 | + && ! give_check_akismet_key() |
|
| 114 | 114 | ) { |
| 115 | 115 | self::add_error( 'give-akismet-protection', __( 'Please properly configure Akismet to enable SPAM protection.', 'give' ) ); |
| 116 | 116 | |
@@ -792,9 +792,9 @@ discard block |
||
| 792 | 792 | <td class="give-docs-link" colspan="2"> |
| 793 | 793 | <?php |
| 794 | 794 | echo '<p class="give-docs-link"><a href="' . esc_url( $value['url'] ) |
| 795 | - . '" target="_blank">' |
|
| 796 | - . sprintf( esc_html__( 'Need Help? See docs on "%s"', 'give' ), $value['title'] ) |
|
| 797 | - . '<span class="dashicons dashicons-editor-help"></span></a></p>'; |
|
| 795 | + . '" target="_blank">' |
|
| 796 | + . sprintf( esc_html__( 'Need Help? See docs on "%s"', 'give' ), $value['title'] ) |
|
| 797 | + . '<span class="dashicons dashicons-editor-help"></span></a></p>'; |
|
| 798 | 798 | ?> |
| 799 | 799 | </td> |
| 800 | 800 | </tr><?php |
@@ -465,9 +465,12 @@ discard block |
||
| 465 | 465 | <?php endforeach; ?> |
| 466 | 466 | <a href="#" data-id="<?php echo $value['id']; ?>" |
| 467 | 467 | class="give-repeat-setting-field button-secondary"><?php echo $value['repeat_btn_title']; ?></a> |
| 468 | - <?php else : ?> |
|
| 468 | + <?php else { |
|
| 469 | + : ?> |
|
| 469 | 470 | <input |
| 470 | - name="<?php echo esc_attr( $value['id'] ); ?>" |
|
| 471 | + name="<?php echo esc_attr( $value['id'] ); |
|
| 472 | +} |
|
| 473 | +?>" |
|
| 471 | 474 | id="<?php echo esc_attr( $value['id'] ); ?>" |
| 472 | 475 | type="<?php echo esc_attr( $type ); ?>" |
| 473 | 476 | style="<?php echo esc_attr( $value['css'] ); ?>" |
@@ -533,7 +536,10 @@ discard block |
||
| 533 | 536 | </th> |
| 534 | 537 | <td class="give-forminp give-forminp-<?php echo sanitize_title( $value['type'] ) ?>"> |
| 535 | 538 | <select |
| 536 | - name="<?php echo esc_attr( $value['id'] ); ?><?php if ( $value['type'] == 'multiselect' ) echo '[]'; ?>" |
|
| 539 | + name="<?php echo esc_attr( $value['id'] ); ?><?php if ( $value['type'] == 'multiselect' ) { |
|
| 540 | + echo '[]'; |
|
| 541 | +} |
|
| 542 | +?>" |
|
| 537 | 543 | id="<?php echo esc_attr( $value['id'] ); ?>" |
| 538 | 544 | style="<?php echo esc_attr( $value['css'] ); ?>" |
| 539 | 545 | class="<?php echo esc_attr( $value['class'] ); ?>" |
@@ -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; |
| 14 | 14 | } |
| 15 | 15 | |
| 16 | -if ( ! class_exists( 'Give_Admin_Settings' ) ) : |
|
| 16 | +if ( ! class_exists('Give_Admin_Settings')) : |
|
| 17 | 17 | |
| 18 | 18 | /** |
| 19 | 19 | * Give_Admin_Settings Class. |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | * |
| 73 | 73 | * @param array $settings Array of settings class object. |
| 74 | 74 | */ |
| 75 | - self::$settings = apply_filters( self::$setting_filter_prefix . '_get_settings_pages', array() ); |
|
| 75 | + self::$settings = apply_filters(self::$setting_filter_prefix.'_get_settings_pages', array()); |
|
| 76 | 76 | |
| 77 | 77 | return self::$settings; |
| 78 | 78 | } |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | * @return bool |
| 87 | 87 | */ |
| 88 | 88 | public static function verify_nonce() { |
| 89 | - if ( empty( $_REQUEST['_give-save-settings'] ) || ! wp_verify_nonce( $_REQUEST['_give-save-settings'], 'give-save-settings' ) ) { |
|
| 89 | + if (empty($_REQUEST['_give-save-settings']) || ! wp_verify_nonce($_REQUEST['_give-save-settings'], 'give-save-settings')) { |
|
| 90 | 90 | return false; |
| 91 | 91 | } |
| 92 | 92 | |
@@ -102,17 +102,17 @@ discard block |
||
| 102 | 102 | public static function save() { |
| 103 | 103 | $current_tab = give_get_current_setting_tab(); |
| 104 | 104 | |
| 105 | - if ( ! self::verify_nonce() ) { |
|
| 106 | - echo '<div class="notice error"><p>' . __( 'Action failed. Please refresh the page and retry.', 'give' ) . '</p></div>'; |
|
| 105 | + if ( ! self::verify_nonce()) { |
|
| 106 | + echo '<div class="notice error"><p>'.__('Action failed. Please refresh the page and retry.', 'give').'</p></div>'; |
|
| 107 | 107 | die(); |
| 108 | 108 | } |
| 109 | 109 | |
| 110 | 110 | // Show error message if Akismet not configured and Admin try to save 'enabled' option. |
| 111 | - if ( isset( $_POST['akismet_spam_protection'] ) |
|
| 112 | - && give_is_setting_enabled( $_POST['akismet_spam_protection'] ) |
|
| 111 | + if (isset($_POST['akismet_spam_protection']) |
|
| 112 | + && give_is_setting_enabled($_POST['akismet_spam_protection']) |
|
| 113 | 113 | && ! give_check_akismet_key() |
| 114 | 114 | ) { |
| 115 | - self::add_error( 'give-akismet-protection', __( 'Please properly configure Akismet to enable SPAM protection.', 'give' ) ); |
|
| 115 | + self::add_error('give-akismet-protection', __('Please properly configure Akismet to enable SPAM protection.', 'give')); |
|
| 116 | 116 | |
| 117 | 117 | return; |
| 118 | 118 | } |
@@ -126,9 +126,9 @@ discard block |
||
| 126 | 126 | * |
| 127 | 127 | * @since 1.8 |
| 128 | 128 | */ |
| 129 | - do_action( self::$setting_filter_prefix . '_save_' . $current_tab ); |
|
| 129 | + do_action(self::$setting_filter_prefix.'_save_'.$current_tab); |
|
| 130 | 130 | |
| 131 | - self::add_message( 'give-setting-updated', __( 'Your settings have been saved.', 'give' ) ); |
|
| 131 | + self::add_message('give-setting-updated', __('Your settings have been saved.', 'give')); |
|
| 132 | 132 | |
| 133 | 133 | /** |
| 134 | 134 | * Trigger Action. |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | * |
| 140 | 140 | * @since 1.8 |
| 141 | 141 | */ |
| 142 | - do_action( self::$setting_filter_prefix . '_saved' ); |
|
| 142 | + do_action(self::$setting_filter_prefix.'_saved'); |
|
| 143 | 143 | } |
| 144 | 144 | |
| 145 | 145 | /** |
@@ -152,8 +152,8 @@ discard block |
||
| 152 | 152 | * |
| 153 | 153 | * @return void |
| 154 | 154 | */ |
| 155 | - public static function add_message( $code, $message ) { |
|
| 156 | - self::$messages[ $code ] = $message; |
|
| 155 | + public static function add_message($code, $message) { |
|
| 156 | + self::$messages[$code] = $message; |
|
| 157 | 157 | } |
| 158 | 158 | |
| 159 | 159 | /** |
@@ -166,8 +166,8 @@ discard block |
||
| 166 | 166 | * |
| 167 | 167 | * @return void |
| 168 | 168 | */ |
| 169 | - public static function add_error( $code, $message ) { |
|
| 170 | - self::$errors[ $code ] = $message; |
|
| 169 | + public static function add_error($code, $message) { |
|
| 170 | + self::$errors[$code] = $message; |
|
| 171 | 171 | } |
| 172 | 172 | |
| 173 | 173 | /** |
@@ -180,18 +180,18 @@ discard block |
||
| 180 | 180 | $notice_html = ''; |
| 181 | 181 | $classes = 'give-notice settings-error notice is-dismissible'; |
| 182 | 182 | |
| 183 | - self::$errors = apply_filters( self::$setting_filter_prefix . '_error_notices', self::$errors ); |
|
| 184 | - self::$messages = apply_filters( self::$setting_filter_prefix . '_update_notices', self::$messages ); |
|
| 183 | + self::$errors = apply_filters(self::$setting_filter_prefix.'_error_notices', self::$errors); |
|
| 184 | + self::$messages = apply_filters(self::$setting_filter_prefix.'_update_notices', self::$messages); |
|
| 185 | 185 | |
| 186 | - if ( 0 < count( self::$errors ) ) { |
|
| 187 | - foreach ( self::$errors as $code => $message ) { |
|
| 188 | - $notice_html .= '<div id="setting-error-' . $code . '" class="' . $classes . ' error"><p><strong>' . $message . '</strong></p></div>'; |
|
| 186 | + if (0 < count(self::$errors)) { |
|
| 187 | + foreach (self::$errors as $code => $message) { |
|
| 188 | + $notice_html .= '<div id="setting-error-'.$code.'" class="'.$classes.' error"><p><strong>'.$message.'</strong></p></div>'; |
|
| 189 | 189 | } |
| 190 | 190 | } |
| 191 | 191 | |
| 192 | - if ( 0 < count( self::$messages ) ) { |
|
| 193 | - foreach ( self::$messages as $code => $message ) { |
|
| 194 | - $notice_html .= '<div id="setting-error-' . $code . '" class="' . $classes . ' updated"><p><strong>' . $message . '</strong></p></div>'; |
|
| 192 | + if (0 < count(self::$messages)) { |
|
| 193 | + foreach (self::$messages as $code => $message) { |
|
| 194 | + $notice_html .= '<div id="setting-error-'.$code.'" class="'.$classes.' updated"><p><strong>'.$message.'</strong></p></div>'; |
|
| 195 | 195 | } |
| 196 | 196 | } |
| 197 | 197 | |
@@ -211,7 +211,7 @@ discard block |
||
| 211 | 211 | self::$setting_filter_prefix = give_get_current_setting_page(); |
| 212 | 212 | |
| 213 | 213 | // Bailout: Exit if setting page is not defined. |
| 214 | - if ( empty( self::$setting_filter_prefix ) ) { |
|
| 214 | + if (empty(self::$setting_filter_prefix)) { |
|
| 215 | 215 | return false; |
| 216 | 216 | } |
| 217 | 217 | |
@@ -224,7 +224,7 @@ discard block |
||
| 224 | 224 | * |
| 225 | 225 | * @since 1.8 |
| 226 | 226 | */ |
| 227 | - do_action( self::$setting_filter_prefix . '_start' ); |
|
| 227 | + do_action(self::$setting_filter_prefix.'_start'); |
|
| 228 | 228 | |
| 229 | 229 | $current_tab = give_get_current_setting_tab(); |
| 230 | 230 | |
@@ -234,9 +234,9 @@ discard block |
||
| 234 | 234 | /* @var object $current_setting_obj */ |
| 235 | 235 | $current_setting_obj = new StdClass; |
| 236 | 236 | |
| 237 | - foreach ( $all_setting as $setting ) { |
|
| 237 | + foreach ($all_setting as $setting) { |
|
| 238 | 238 | if ( |
| 239 | - method_exists( $setting, 'get_id' ) && |
|
| 239 | + method_exists($setting, 'get_id') && |
|
| 240 | 240 | $current_tab === $setting->get_id() |
| 241 | 241 | ) { |
| 242 | 242 | $current_setting_obj = $setting; |
@@ -245,7 +245,7 @@ discard block |
||
| 245 | 245 | } |
| 246 | 246 | |
| 247 | 247 | // Save settings if data has been posted. |
| 248 | - if ( ! empty( $_POST ) ) { |
|
| 248 | + if ( ! empty($_POST)) { |
|
| 249 | 249 | self::save(); |
| 250 | 250 | } |
| 251 | 251 | |
@@ -258,7 +258,7 @@ discard block |
||
| 258 | 258 | * |
| 259 | 259 | * @since 1.8 |
| 260 | 260 | */ |
| 261 | - $tabs = apply_filters( self::$setting_filter_prefix . '_tabs_array', array() ); |
|
| 261 | + $tabs = apply_filters(self::$setting_filter_prefix.'_tabs_array', array()); |
|
| 262 | 262 | |
| 263 | 263 | include 'views/html-admin-settings.php'; |
| 264 | 264 | |
@@ -276,25 +276,25 @@ discard block |
||
| 276 | 276 | * |
| 277 | 277 | * @return string|bool |
| 278 | 278 | */ |
| 279 | - public static function get_option( $option_name = '', $field_id = '', $default = false ) { |
|
| 279 | + public static function get_option($option_name = '', $field_id = '', $default = false) { |
|
| 280 | 280 | // Bailout. |
| 281 | - if ( empty( $option_name ) && empty( $field_id ) ) { |
|
| 281 | + if (empty($option_name) && empty($field_id)) { |
|
| 282 | 282 | return false; |
| 283 | 283 | } |
| 284 | 284 | |
| 285 | - if ( ! empty( $field_id ) && ! empty( $option_name ) ) { |
|
| 285 | + if ( ! empty($field_id) && ! empty($option_name)) { |
|
| 286 | 286 | // Get field value if any. |
| 287 | - $option_value = get_option( $option_name ); |
|
| 287 | + $option_value = get_option($option_name); |
|
| 288 | 288 | |
| 289 | - $option_value = ( is_array( $option_value ) && array_key_exists( $field_id, $option_value ) ) |
|
| 290 | - ? $option_value[ $field_id ] |
|
| 289 | + $option_value = (is_array($option_value) && array_key_exists($field_id, $option_value)) |
|
| 290 | + ? $option_value[$field_id] |
|
| 291 | 291 | : $default; |
| 292 | 292 | } else { |
| 293 | 293 | // If option name is empty but not field name then this means, setting is direct store to option table under there field name. |
| 294 | 294 | $option_name = ! $option_name ? $field_id : $option_name; |
| 295 | 295 | |
| 296 | 296 | // Get option value if any. |
| 297 | - $option_value = get_option( $option_name, $default ); |
|
| 297 | + $option_value = get_option($option_name, $default); |
|
| 298 | 298 | } |
| 299 | 299 | |
| 300 | 300 | return $option_value; |
@@ -313,7 +313,7 @@ discard block |
||
| 313 | 313 | * |
| 314 | 314 | * @return void |
| 315 | 315 | */ |
| 316 | - public static function output_fields( $options, $option_name = '' ) { |
|
| 316 | + public static function output_fields($options, $option_name = '') { |
|
| 317 | 317 | $current_tab = give_get_current_setting_tab(); |
| 318 | 318 | |
| 319 | 319 | // Field Default values. |
@@ -325,62 +325,62 @@ discard block |
||
| 325 | 325 | 'desc' => '', |
| 326 | 326 | 'table_html' => true, |
| 327 | 327 | 'repeat' => false, |
| 328 | - 'repeat_btn_title' => __( 'Add Field', 'give' ), |
|
| 328 | + 'repeat_btn_title' => __('Add Field', 'give'), |
|
| 329 | 329 | ); |
| 330 | 330 | |
| 331 | - foreach ( $options as $value ) { |
|
| 332 | - if ( ! isset( $value['type'] ) ) { |
|
| 331 | + foreach ($options as $value) { |
|
| 332 | + if ( ! isset($value['type'])) { |
|
| 333 | 333 | continue; |
| 334 | 334 | } |
| 335 | 335 | |
| 336 | 336 | // Set title. |
| 337 | - $defaults['title'] = isset( $value['name'] ) ? $value['name'] : ''; |
|
| 337 | + $defaults['title'] = isset($value['name']) ? $value['name'] : ''; |
|
| 338 | 338 | |
| 339 | 339 | // Set default setting. |
| 340 | - $value = wp_parse_args( $value, $defaults ); |
|
| 340 | + $value = wp_parse_args($value, $defaults); |
|
| 341 | 341 | |
| 342 | 342 | // Colorpicker field. |
| 343 | - $value['class'] = ( 'colorpicker' === $value['type'] ? trim( $value['class'] ) . ' give-colorpicker' : $value['class'] ); |
|
| 344 | - $value['type'] = ( 'colorpicker' === $value['type'] ? 'text' : $value['type'] ); |
|
| 343 | + $value['class'] = ('colorpicker' === $value['type'] ? trim($value['class']).' give-colorpicker' : $value['class']); |
|
| 344 | + $value['type'] = ('colorpicker' === $value['type'] ? 'text' : $value['type']); |
|
| 345 | 345 | |
| 346 | 346 | |
| 347 | 347 | // Custom attribute handling. |
| 348 | 348 | $custom_attributes = array(); |
| 349 | 349 | |
| 350 | - if ( ! empty( $value['attributes'] ) && is_array( $value['attributes'] ) ) { |
|
| 351 | - foreach ( $value['attributes'] as $attribute => $attribute_value ) { |
|
| 352 | - $custom_attributes[] = esc_attr( $attribute ) . '="' . esc_attr( $attribute_value ) . '"'; |
|
| 350 | + if ( ! empty($value['attributes']) && is_array($value['attributes'])) { |
|
| 351 | + foreach ($value['attributes'] as $attribute => $attribute_value) { |
|
| 352 | + $custom_attributes[] = esc_attr($attribute).'="'.esc_attr($attribute_value).'"'; |
|
| 353 | 353 | } |
| 354 | 354 | } |
| 355 | 355 | |
| 356 | 356 | // Description handling. |
| 357 | - $description = self::get_field_description( $value ); |
|
| 357 | + $description = self::get_field_description($value); |
|
| 358 | 358 | |
| 359 | 359 | // Switch based on type. |
| 360 | - switch ( $value['type'] ) { |
|
| 360 | + switch ($value['type']) { |
|
| 361 | 361 | |
| 362 | 362 | // Section Titles |
| 363 | 363 | case 'title': |
| 364 | - if ( ! empty( $value['title'] ) || ! empty( $value['desc'] ) ) { |
|
| 364 | + if ( ! empty($value['title']) || ! empty($value['desc'])) { |
|
| 365 | 365 | ?> |
| 366 | 366 | <div class="give-setting-tab-header give-setting-tab-header-<?php echo $current_tab; ?>"> |
| 367 | - <?php if ( ! empty( $value['title'] ) ) : ?> |
|
| 368 | - <h2><?php echo self::get_field_title( $value ); ?></h2> |
|
| 367 | + <?php if ( ! empty($value['title'])) : ?> |
|
| 368 | + <h2><?php echo self::get_field_title($value); ?></h2> |
|
| 369 | 369 | <hr> |
| 370 | 370 | <?php endif; ?> |
| 371 | 371 | |
| 372 | - <?php if ( ! empty( $value['desc'] ) ) : ?> |
|
| 373 | - <?php echo wpautop( wptexturize( wp_kses_post( $value['desc'] ) ) ); ?> |
|
| 372 | + <?php if ( ! empty($value['desc'])) : ?> |
|
| 373 | + <?php echo wpautop(wptexturize(wp_kses_post($value['desc']))); ?> |
|
| 374 | 374 | <?php endif; ?> |
| 375 | 375 | </div> |
| 376 | 376 | <?php |
| 377 | 377 | } |
| 378 | 378 | |
| 379 | - if ( $value['table_html'] ) { |
|
| 380 | - echo '<table class="form-table give-setting-tab-body give-setting-tab-body-' . $current_tab . '">' . "\n\n"; |
|
| 379 | + if ($value['table_html']) { |
|
| 380 | + echo '<table class="form-table give-setting-tab-body give-setting-tab-body-'.$current_tab.'">'."\n\n"; |
|
| 381 | 381 | } |
| 382 | 382 | |
| 383 | - if ( ! empty( $value['id'] ) ) { |
|
| 383 | + if ( ! empty($value['id'])) { |
|
| 384 | 384 | |
| 385 | 385 | /** |
| 386 | 386 | * Trigger Action. |
@@ -389,14 +389,14 @@ discard block |
||
| 389 | 389 | * |
| 390 | 390 | * @since 1.8 |
| 391 | 391 | */ |
| 392 | - do_action( 'give_settings_' . sanitize_title( $value['id'] ) ); |
|
| 392 | + do_action('give_settings_'.sanitize_title($value['id'])); |
|
| 393 | 393 | } |
| 394 | 394 | |
| 395 | 395 | break; |
| 396 | 396 | |
| 397 | 397 | // Section Ends. |
| 398 | 398 | case 'sectionend': |
| 399 | - if ( ! empty( $value['id'] ) ) { |
|
| 399 | + if ( ! empty($value['id'])) { |
|
| 400 | 400 | |
| 401 | 401 | /** |
| 402 | 402 | * Trigger Action. |
@@ -405,14 +405,14 @@ discard block |
||
| 405 | 405 | * |
| 406 | 406 | * @since 1.8 |
| 407 | 407 | */ |
| 408 | - do_action( 'give_settings_' . sanitize_title( $value['id'] ) . '_end' ); |
|
| 408 | + do_action('give_settings_'.sanitize_title($value['id']).'_end'); |
|
| 409 | 409 | } |
| 410 | 410 | |
| 411 | - if ( $value['table_html'] ) { |
|
| 411 | + if ($value['table_html']) { |
|
| 412 | 412 | echo '</table>'; |
| 413 | 413 | } |
| 414 | 414 | |
| 415 | - if ( ! empty( $value['id'] ) ) { |
|
| 415 | + if ( ! empty($value['id'])) { |
|
| 416 | 416 | |
| 417 | 417 | /** |
| 418 | 418 | * Trigger Action. |
@@ -421,7 +421,7 @@ discard block |
||
| 421 | 421 | * |
| 422 | 422 | * @since 1.8 |
| 423 | 423 | */ |
| 424 | - do_action( 'give_settings_' . sanitize_title( $value['id'] ) . '_after' ); |
|
| 424 | + do_action('give_settings_'.sanitize_title($value['id']).'_after'); |
|
| 425 | 425 | } |
| 426 | 426 | |
| 427 | 427 | break; |
@@ -429,51 +429,51 @@ discard block |
||
| 429 | 429 | // Standard text inputs and subtypes like 'number'. |
| 430 | 430 | case 'colorpicker': |
| 431 | 431 | case 'hidden' : |
| 432 | - $value['wrapper_class'] = empty( $value['wrapper_class'] ) ? 'give-hidden' : trim( $value['wrapper_class'] ) . ' give-hidden'; |
|
| 432 | + $value['wrapper_class'] = empty($value['wrapper_class']) ? 'give-hidden' : trim($value['wrapper_class']).' give-hidden'; |
|
| 433 | 433 | case 'text': |
| 434 | 434 | case 'email': |
| 435 | 435 | case 'number': |
| 436 | 436 | case 'password' : |
| 437 | 437 | $type = $value['type']; |
| 438 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
| 438 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
| 439 | 439 | |
| 440 | 440 | // Set default value for repeater field if not any value set yet. |
| 441 | - if ( $value['repeat'] && is_string( $option_value ) ) { |
|
| 442 | - $option_value = array( $value['default'] ); |
|
| 441 | + if ($value['repeat'] && is_string($option_value)) { |
|
| 442 | + $option_value = array($value['default']); |
|
| 443 | 443 | } |
| 444 | 444 | ?> |
| 445 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
| 445 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
| 446 | 446 | <th scope="row" class="titledesc"> |
| 447 | 447 | <label |
| 448 | - for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
| 448 | + for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
| 449 | 449 | </th> |
| 450 | - <td class="give-forminp give-forminp-<?php echo sanitize_title( $value['type'] ) ?>"> |
|
| 451 | - <?php if ( $value['repeat'] ) : ?> |
|
| 452 | - <?php foreach ( $option_value as $index => $field_value ) : ?> |
|
| 450 | + <td class="give-forminp give-forminp-<?php echo sanitize_title($value['type']) ?>"> |
|
| 451 | + <?php if ($value['repeat']) : ?> |
|
| 452 | + <?php foreach ($option_value as $index => $field_value) : ?> |
|
| 453 | 453 | <p> |
| 454 | 454 | <input |
| 455 | - name="<?php echo esc_attr( $value['id'] ); ?>[]" |
|
| 456 | - type="<?php echo esc_attr( $type ); ?>" |
|
| 457 | - style="<?php echo esc_attr( $value['css'] ); ?>" |
|
| 458 | - value="<?php echo esc_attr( $field_value ); ?>" |
|
| 459 | - class="give-input-field<?php echo( empty( $value['class'] ) ? '' : ' ' . esc_attr( $value['class'] ) ); ?> <?php echo esc_attr( $value['id'] ); ?>" |
|
| 460 | - <?php echo implode( ' ', $custom_attributes ); ?> |
|
| 455 | + name="<?php echo esc_attr($value['id']); ?>[]" |
|
| 456 | + type="<?php echo esc_attr($type); ?>" |
|
| 457 | + style="<?php echo esc_attr($value['css']); ?>" |
|
| 458 | + value="<?php echo esc_attr($field_value); ?>" |
|
| 459 | + class="give-input-field<?php echo(empty($value['class']) ? '' : ' '.esc_attr($value['class'])); ?> <?php echo esc_attr($value['id']); ?>" |
|
| 460 | + <?php echo implode(' ', $custom_attributes); ?> |
|
| 461 | 461 | /> |
| 462 | 462 | <span class="give-remove-setting-field" |
| 463 | - title="<?php esc_html_e( 'Remove setting field', 'give' ); ?>">-</span> |
|
| 463 | + title="<?php esc_html_e('Remove setting field', 'give'); ?>">-</span> |
|
| 464 | 464 | </p> |
| 465 | 465 | <?php endforeach; ?> |
| 466 | 466 | <a href="#" data-id="<?php echo $value['id']; ?>" |
| 467 | 467 | class="give-repeat-setting-field button-secondary"><?php echo $value['repeat_btn_title']; ?></a> |
| 468 | 468 | <?php else : ?> |
| 469 | 469 | <input |
| 470 | - name="<?php echo esc_attr( $value['id'] ); ?>" |
|
| 471 | - id="<?php echo esc_attr( $value['id'] ); ?>" |
|
| 472 | - type="<?php echo esc_attr( $type ); ?>" |
|
| 473 | - style="<?php echo esc_attr( $value['css'] ); ?>" |
|
| 474 | - value="<?php echo esc_attr( $option_value ); ?>" |
|
| 475 | - class="give-input-field<?php echo( empty( $value['class'] ) ? '' : ' ' . esc_attr( $value['class'] ) ); ?>" |
|
| 476 | - <?php echo implode( ' ', $custom_attributes ); ?> |
|
| 470 | + name="<?php echo esc_attr($value['id']); ?>" |
|
| 471 | + id="<?php echo esc_attr($value['id']); ?>" |
|
| 472 | + type="<?php echo esc_attr($type); ?>" |
|
| 473 | + style="<?php echo esc_attr($value['css']); ?>" |
|
| 474 | + value="<?php echo esc_attr($option_value); ?>" |
|
| 475 | + class="give-input-field<?php echo(empty($value['class']) ? '' : ' '.esc_attr($value['class'])); ?>" |
|
| 476 | + <?php echo implode(' ', $custom_attributes); ?> |
|
| 477 | 477 | /> |
| 478 | 478 | <?php endif; ?> |
| 479 | 479 | <?php echo $description; ?> |
@@ -484,24 +484,24 @@ discard block |
||
| 484 | 484 | // Textarea. |
| 485 | 485 | case 'textarea': |
| 486 | 486 | |
| 487 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
| 487 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
| 488 | 488 | |
| 489 | 489 | ?> |
| 490 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
| 490 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
| 491 | 491 | <th scope="row" class="titledesc"> |
| 492 | 492 | <label |
| 493 | - for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
| 493 | + for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
| 494 | 494 | </th> |
| 495 | - <td class="give-forminp give-forminp-<?php echo sanitize_title( $value['type'] ) ?>"> |
|
| 495 | + <td class="give-forminp give-forminp-<?php echo sanitize_title($value['type']) ?>"> |
|
| 496 | 496 | <textarea |
| 497 | - name="<?php echo esc_attr( $value['id'] ); ?>" |
|
| 498 | - id="<?php echo esc_attr( $value['id'] ); ?>" |
|
| 499 | - style="<?php echo esc_attr( $value['css'] ); ?>" |
|
| 500 | - class="<?php echo esc_attr( $value['class'] ); ?>" |
|
| 497 | + name="<?php echo esc_attr($value['id']); ?>" |
|
| 498 | + id="<?php echo esc_attr($value['id']); ?>" |
|
| 499 | + style="<?php echo esc_attr($value['css']); ?>" |
|
| 500 | + class="<?php echo esc_attr($value['class']); ?>" |
|
| 501 | 501 | rows="10" |
| 502 | 502 | cols="60" |
| 503 | - <?php echo implode( ' ', $custom_attributes ); ?> |
|
| 504 | - ><?php echo esc_textarea( $option_value ); ?></textarea> |
|
| 503 | + <?php echo implode(' ', $custom_attributes); ?> |
|
| 504 | + ><?php echo esc_textarea($option_value); ?></textarea> |
|
| 505 | 505 | <?php echo $description; ?> |
| 506 | 506 | </td> |
| 507 | 507 | </tr><?php |
@@ -510,47 +510,47 @@ discard block |
||
| 510 | 510 | // Select boxes. |
| 511 | 511 | case 'select' : |
| 512 | 512 | case 'multiselect' : |
| 513 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
| 513 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
| 514 | 514 | |
| 515 | 515 | /** |
| 516 | 516 | * insert page in option if missing. |
| 517 | 517 | * |
| 518 | 518 | * check success_page setting in general settings. |
| 519 | 519 | */ |
| 520 | - if( |
|
| 521 | - isset( $value['attributes' ] ) && |
|
| 522 | - false !== strpos( $value['class'], 'give-select-chosen' ) && |
|
| 523 | - in_array( 'data-search-type', array_keys( $value['attributes' ] ) ) && |
|
| 524 | - 'pages' == $value['attributes' ]['data-search-type'] && |
|
| 525 | - ! in_array( $option_value, array_keys( $value['options'] ) ) |
|
| 520 | + if ( |
|
| 521 | + isset($value['attributes']) && |
|
| 522 | + false !== strpos($value['class'], 'give-select-chosen') && |
|
| 523 | + in_array('data-search-type', array_keys($value['attributes'])) && |
|
| 524 | + 'pages' == $value['attributes']['data-search-type'] && |
|
| 525 | + ! in_array($option_value, array_keys($value['options'])) |
|
| 526 | 526 | ) { |
| 527 | - $value['options'][$option_value] = get_the_title( $option_value ); |
|
| 527 | + $value['options'][$option_value] = get_the_title($option_value); |
|
| 528 | 528 | } |
| 529 | 529 | ?> |
| 530 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
| 530 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
| 531 | 531 | <th scope="row" class="titledesc"> |
| 532 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
| 532 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
| 533 | 533 | </th> |
| 534 | - <td class="give-forminp give-forminp-<?php echo sanitize_title( $value['type'] ) ?>"> |
|
| 534 | + <td class="give-forminp give-forminp-<?php echo sanitize_title($value['type']) ?>"> |
|
| 535 | 535 | <select |
| 536 | - name="<?php echo esc_attr( $value['id'] ); ?><?php if ( $value['type'] == 'multiselect' ) echo '[]'; ?>" |
|
| 537 | - id="<?php echo esc_attr( $value['id'] ); ?>" |
|
| 538 | - style="<?php echo esc_attr( $value['css'] ); ?>" |
|
| 539 | - class="<?php echo esc_attr( $value['class'] ); ?>" |
|
| 540 | - <?php echo implode( ' ', $custom_attributes ); ?> |
|
| 541 | - <?php echo ( 'multiselect' == $value['type'] ) ? 'multiple="multiple"' : ''; ?> |
|
| 536 | + name="<?php echo esc_attr($value['id']); ?><?php if ($value['type'] == 'multiselect') echo '[]'; ?>" |
|
| 537 | + id="<?php echo esc_attr($value['id']); ?>" |
|
| 538 | + style="<?php echo esc_attr($value['css']); ?>" |
|
| 539 | + class="<?php echo esc_attr($value['class']); ?>" |
|
| 540 | + <?php echo implode(' ', $custom_attributes); ?> |
|
| 541 | + <?php echo ('multiselect' == $value['type']) ? 'multiple="multiple"' : ''; ?> |
|
| 542 | 542 | > |
| 543 | 543 | |
| 544 | 544 | <?php |
| 545 | - if ( ! empty( $value['options'] ) ) { |
|
| 546 | - foreach ( $value['options'] as $key => $val ) { |
|
| 545 | + if ( ! empty($value['options'])) { |
|
| 546 | + foreach ($value['options'] as $key => $val) { |
|
| 547 | 547 | ?> |
| 548 | - <option value="<?php echo esc_attr( $key ); ?>" <?php |
|
| 548 | + <option value="<?php echo esc_attr($key); ?>" <?php |
|
| 549 | 549 | |
| 550 | - if ( is_array( $option_value ) ) { |
|
| 551 | - selected( in_array( $key, $option_value ), true ); |
|
| 550 | + if (is_array($option_value)) { |
|
| 551 | + selected(in_array($key, $option_value), true); |
|
| 552 | 552 | } else { |
| 553 | - selected( $option_value, $key ); |
|
| 553 | + selected($option_value, $key); |
|
| 554 | 554 | } |
| 555 | 555 | |
| 556 | 556 | ?>><?php echo $val ?></option> |
@@ -566,29 +566,29 @@ discard block |
||
| 566 | 566 | |
| 567 | 567 | // Radio inputs. |
| 568 | 568 | case 'radio_inline' : |
| 569 | - $value['class'] = empty( $value['class'] ) ? 'give-radio-inline' : $value['class'] . ' give-radio-inline'; |
|
| 569 | + $value['class'] = empty($value['class']) ? 'give-radio-inline' : $value['class'].' give-radio-inline'; |
|
| 570 | 570 | case 'radio' : |
| 571 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
| 571 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
| 572 | 572 | ?> |
| 573 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
| 573 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
| 574 | 574 | <th scope="row" class="titledesc"> |
| 575 | 575 | <label |
| 576 | - for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
| 576 | + for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
| 577 | 577 | </th> |
| 578 | - <td class="give-forminp give-forminp-<?php echo sanitize_title( $value['type'] ) ?> <?php echo( ! empty( $value['class'] ) ? $value['class'] : '' ); ?>"> |
|
| 578 | + <td class="give-forminp give-forminp-<?php echo sanitize_title($value['type']) ?> <?php echo( ! empty($value['class']) ? $value['class'] : ''); ?>"> |
|
| 579 | 579 | <fieldset> |
| 580 | 580 | <ul> |
| 581 | 581 | <?php |
| 582 | - foreach ( $value['options'] as $key => $val ) { |
|
| 582 | + foreach ($value['options'] as $key => $val) { |
|
| 583 | 583 | ?> |
| 584 | 584 | <li> |
| 585 | 585 | <label><input |
| 586 | - name="<?php echo esc_attr( $value['id'] ); ?>" |
|
| 586 | + name="<?php echo esc_attr($value['id']); ?>" |
|
| 587 | 587 | value="<?php echo $key; ?>" |
| 588 | 588 | type="radio" |
| 589 | - style="<?php echo esc_attr( $value['css'] ); ?>" |
|
| 590 | - <?php echo implode( ' ', $custom_attributes ); ?> |
|
| 591 | - <?php checked( $key, $option_value ); ?> |
|
| 589 | + style="<?php echo esc_attr($value['css']); ?>" |
|
| 590 | + <?php echo implode(' ', $custom_attributes); ?> |
|
| 591 | + <?php checked($key, $option_value); ?> |
|
| 592 | 592 | /> <?php echo $val ?></label> |
| 593 | 593 | </li> |
| 594 | 594 | <?php |
@@ -602,22 +602,22 @@ discard block |
||
| 602 | 602 | |
| 603 | 603 | // Checkbox input. |
| 604 | 604 | case 'checkbox' : |
| 605 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
| 605 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
| 606 | 606 | ?> |
| 607 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
| 607 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
| 608 | 608 | <th scope="row" class="titledesc"> |
| 609 | 609 | <label |
| 610 | - for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
| 610 | + for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
| 611 | 611 | </th> |
| 612 | 612 | <td class="give-forminp"> |
| 613 | 613 | <input |
| 614 | - name="<?php echo esc_attr( $value['id'] ); ?>" |
|
| 615 | - id="<?php echo esc_attr( $value['id'] ); ?>" |
|
| 614 | + name="<?php echo esc_attr($value['id']); ?>" |
|
| 615 | + id="<?php echo esc_attr($value['id']); ?>" |
|
| 616 | 616 | type="checkbox" |
| 617 | - class="<?php echo esc_attr( isset( $value['class'] ) ? $value['class'] : '' ); ?>" |
|
| 617 | + class="<?php echo esc_attr(isset($value['class']) ? $value['class'] : ''); ?>" |
|
| 618 | 618 | value="1" |
| 619 | - <?php checked( $option_value, 'on' ); ?> |
|
| 620 | - <?php echo implode( ' ', $custom_attributes ); ?> |
|
| 619 | + <?php checked($option_value, 'on'); ?> |
|
| 620 | + <?php echo implode(' ', $custom_attributes); ?> |
|
| 621 | 621 | /> |
| 622 | 622 | <?php echo $description; ?> |
| 623 | 623 | </td> |
@@ -627,29 +627,29 @@ discard block |
||
| 627 | 627 | |
| 628 | 628 | // Multi Checkbox input. |
| 629 | 629 | case 'multicheck' : |
| 630 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
| 631 | - $option_value = is_array( $option_value ) ? $option_value : array(); |
|
| 630 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
| 631 | + $option_value = is_array($option_value) ? $option_value : array(); |
|
| 632 | 632 | ?> |
| 633 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
| 633 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
| 634 | 634 | <th scope="row" class="titledesc"> |
| 635 | 635 | <label |
| 636 | - for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
| 636 | + for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
| 637 | 637 | </th> |
| 638 | - <td class="give-forminp give-forminp-<?php echo sanitize_title( $value['type'] ) ?> <?php echo( ! empty( $value['class'] ) ? $value['class'] : '' ); ?>"> |
|
| 638 | + <td class="give-forminp give-forminp-<?php echo sanitize_title($value['type']) ?> <?php echo( ! empty($value['class']) ? $value['class'] : ''); ?>"> |
|
| 639 | 639 | <fieldset> |
| 640 | 640 | <ul> |
| 641 | 641 | <?php |
| 642 | - foreach ( $value['options'] as $key => $val ) { |
|
| 642 | + foreach ($value['options'] as $key => $val) { |
|
| 643 | 643 | ?> |
| 644 | 644 | <li> |
| 645 | 645 | <label> |
| 646 | 646 | <input |
| 647 | - name="<?php echo esc_attr( $value['id'] ); ?>[]" |
|
| 647 | + name="<?php echo esc_attr($value['id']); ?>[]" |
|
| 648 | 648 | value="<?php echo $key; ?>" |
| 649 | 649 | type="checkbox" |
| 650 | - style="<?php echo esc_attr( $value['css'] ); ?>" |
|
| 651 | - <?php echo implode( ' ', $custom_attributes ); ?> |
|
| 652 | - <?php if ( in_array( $key, $option_value ) ) { |
|
| 650 | + style="<?php echo esc_attr($value['css']); ?>" |
|
| 651 | + <?php echo implode(' ', $custom_attributes); ?> |
|
| 652 | + <?php if (in_array($key, $option_value)) { |
|
| 653 | 653 | echo 'checked="checked"'; |
| 654 | 654 | } ?> |
| 655 | 655 | /> <?php echo $val ?> |
@@ -668,31 +668,31 @@ discard block |
||
| 668 | 668 | // File input field. |
| 669 | 669 | case 'file' : |
| 670 | 670 | case 'media' : |
| 671 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
| 672 | - $button_label = sprintf( __( 'Add or Upload %s', 'give' ), ( 'file' === $value['type'] ? __( 'File', 'give' ) : __( 'Image', 'give' ) ) ); |
|
| 673 | - $fvalue = empty( $value['fvalue'] ) ? 'url' : $value['fvalue']; |
|
| 674 | - |
|
| 675 | - $allow_media_preview_tags = array( 'jpg', 'jpeg', 'png', 'gif', 'ico' ); |
|
| 676 | - $preview_image_src = $option_value ? ( 'id' === $fvalue ? wp_get_attachment_url( $option_value ) : $option_value ) : ''; |
|
| 677 | - $preview_image_extension = $preview_image_src ? pathinfo( $preview_image_src, PATHINFO_EXTENSION ) : ''; |
|
| 678 | - $is_show_preview = in_array( $preview_image_extension, $allow_media_preview_tags ); |
|
| 671 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
| 672 | + $button_label = sprintf(__('Add or Upload %s', 'give'), ('file' === $value['type'] ? __('File', 'give') : __('Image', 'give'))); |
|
| 673 | + $fvalue = empty($value['fvalue']) ? 'url' : $value['fvalue']; |
|
| 674 | + |
|
| 675 | + $allow_media_preview_tags = array('jpg', 'jpeg', 'png', 'gif', 'ico'); |
|
| 676 | + $preview_image_src = $option_value ? ('id' === $fvalue ? wp_get_attachment_url($option_value) : $option_value) : ''; |
|
| 677 | + $preview_image_extension = $preview_image_src ? pathinfo($preview_image_src, PATHINFO_EXTENSION) : ''; |
|
| 678 | + $is_show_preview = in_array($preview_image_extension, $allow_media_preview_tags); |
|
| 679 | 679 | ?> |
| 680 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
| 680 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
| 681 | 681 | <th scope="row" class="titledesc"> |
| 682 | 682 | <label |
| 683 | - for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
| 683 | + for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
| 684 | 684 | </th> |
| 685 | 685 | <td class="give-forminp"> |
| 686 | 686 | <div class="give-field-wrap"> |
| 687 | 687 | <label for="<?php echo $value['id'] ?>"> |
| 688 | 688 | <input |
| 689 | - name="<?php echo esc_attr( $value['id'] ); ?>" |
|
| 690 | - id="<?php echo esc_attr( $value['id'] ); ?>" |
|
| 689 | + name="<?php echo esc_attr($value['id']); ?>" |
|
| 690 | + id="<?php echo esc_attr($value['id']); ?>" |
|
| 691 | 691 | type="text" |
| 692 | - class="give-input-field<?php echo esc_attr( isset( $value['class'] ) ? ' ' . $value['class'] : '' ); ?>" |
|
| 692 | + class="give-input-field<?php echo esc_attr(isset($value['class']) ? ' '.$value['class'] : ''); ?>" |
|
| 693 | 693 | value="<?php echo $option_value; ?>" |
| 694 | - style="<?php echo esc_attr( $value['css'] ); ?>" |
|
| 695 | - <?php echo implode( ' ', $custom_attributes ); ?> |
|
| 694 | + style="<?php echo esc_attr($value['css']); ?>" |
|
| 695 | + <?php echo implode(' ', $custom_attributes); ?> |
|
| 696 | 696 | /> <input class="give-upload-button button" type="button" |
| 697 | 697 | data-fvalue="<?php echo $fvalue; ?>" |
| 698 | 698 | data-field-type="<?php echo $value['type']; ?>" |
@@ -713,18 +713,18 @@ discard block |
||
| 713 | 713 | // WordPress Editor. |
| 714 | 714 | case 'wysiwyg' : |
| 715 | 715 | // Get option value. |
| 716 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
| 716 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
| 717 | 717 | |
| 718 | 718 | // Get editor settings. |
| 719 | - $editor_settings = ! empty( $value['options'] ) ? $value['options'] : array(); |
|
| 719 | + $editor_settings = ! empty($value['options']) ? $value['options'] : array(); |
|
| 720 | 720 | ?> |
| 721 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
| 721 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
| 722 | 722 | <th scope="row" class="titledesc"> |
| 723 | 723 | <label |
| 724 | - for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
| 724 | + for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
| 725 | 725 | </th> |
| 726 | 726 | <td class="give-forminp"> |
| 727 | - <?php wp_editor( $option_value, $value['id'], $editor_settings ); ?> |
|
| 727 | + <?php wp_editor($option_value, $value['id'], $editor_settings); ?> |
|
| 728 | 728 | <?php echo $description; ?> |
| 729 | 729 | </td> |
| 730 | 730 | </tr><?php |
@@ -732,15 +732,15 @@ discard block |
||
| 732 | 732 | |
| 733 | 733 | // Custom: Default gateways setting field. |
| 734 | 734 | case 'default_gateway' : |
| 735 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
| 735 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
| 736 | 736 | ?> |
| 737 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
| 737 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
| 738 | 738 | <th scope="row" class="titledesc"> |
| 739 | 739 | <label |
| 740 | - for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
| 740 | + for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
| 741 | 741 | </th> |
| 742 | 742 | <td class="give-forminp"> |
| 743 | - <?php give_default_gateway_callback( $value, $option_value ); ?> |
|
| 743 | + <?php give_default_gateway_callback($value, $option_value); ?> |
|
| 744 | 744 | <?php echo $description; ?> |
| 745 | 745 | </td> |
| 746 | 746 | </tr><?php |
@@ -749,13 +749,13 @@ discard block |
||
| 749 | 749 | // Custom: Email preview buttons field. |
| 750 | 750 | case 'email_preview_buttons' : |
| 751 | 751 | ?> |
| 752 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
| 752 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
| 753 | 753 | <th scope="row" class="titledesc"> |
| 754 | 754 | <label |
| 755 | - for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
| 755 | + for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
| 756 | 756 | </th> |
| 757 | 757 | <td class="give-forminp"> |
| 758 | - <?php give_email_preview_buttons_callback( $value ); ?> |
|
| 758 | + <?php give_email_preview_buttons_callback($value); ?> |
|
| 759 | 759 | <?php echo $description; ?> |
| 760 | 760 | </td> |
| 761 | 761 | </tr><?php |
@@ -769,23 +769,23 @@ discard block |
||
| 769 | 769 | |
| 770 | 770 | // Custom: Gateway API key. |
| 771 | 771 | case 'api_key' : |
| 772 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
| 773 | - $type = ! empty( $option_value ) ? 'password' : 'text'; |
|
| 772 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
| 773 | + $type = ! empty($option_value) ? 'password' : 'text'; |
|
| 774 | 774 | ?> |
| 775 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
| 775 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
| 776 | 776 | <th scope="row" class="titledesc"> |
| 777 | 777 | <label |
| 778 | - for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
| 778 | + for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
| 779 | 779 | </th> |
| 780 | - <td class="give-forminp give-forminp-<?php echo sanitize_title( $value['type'] ) ?>"> |
|
| 780 | + <td class="give-forminp give-forminp-<?php echo sanitize_title($value['type']) ?>"> |
|
| 781 | 781 | <input |
| 782 | - name="<?php echo esc_attr( $value['id'] ); ?>" |
|
| 783 | - id="<?php echo esc_attr( $value['id'] ); ?>" |
|
| 784 | - type="<?php echo esc_attr( $type ); ?>" |
|
| 785 | - style="<?php echo esc_attr( $value['css'] ); ?>" |
|
| 786 | - value="<?php echo esc_attr( trim( $option_value ) ); ?>" |
|
| 787 | - class="give-input-field<?php echo( empty( $value['class'] ) ? '' : ' ' . esc_attr( $value['class'] ) ); ?>" |
|
| 788 | - <?php echo implode( ' ', $custom_attributes ); ?> |
|
| 782 | + name="<?php echo esc_attr($value['id']); ?>" |
|
| 783 | + id="<?php echo esc_attr($value['id']); ?>" |
|
| 784 | + type="<?php echo esc_attr($type); ?>" |
|
| 785 | + style="<?php echo esc_attr($value['css']); ?>" |
|
| 786 | + value="<?php echo esc_attr(trim($option_value)); ?>" |
|
| 787 | + class="give-input-field<?php echo(empty($value['class']) ? '' : ' '.esc_attr($value['class'])); ?>" |
|
| 788 | + <?php echo implode(' ', $custom_attributes); ?> |
|
| 789 | 789 | /> <?php echo $description; ?> |
| 790 | 790 | </td> |
| 791 | 791 | </tr><?php |
@@ -802,7 +802,7 @@ discard block |
||
| 802 | 802 | * |
| 803 | 803 | * @since 1.0 |
| 804 | 804 | */ |
| 805 | - do_action( "give_logs_view_{$current_section}" ); |
|
| 805 | + do_action("give_logs_view_{$current_section}"); |
|
| 806 | 806 | |
| 807 | 807 | echo $description; |
| 808 | 808 | break; |
@@ -810,7 +810,7 @@ discard block |
||
| 810 | 810 | // Custom: Data field. |
| 811 | 811 | case 'data' : |
| 812 | 812 | |
| 813 | - include GIVE_PLUGIN_DIR . 'includes/admin/tools/views/html-admin-page-data.php'; |
|
| 813 | + include GIVE_PLUGIN_DIR.'includes/admin/tools/views/html-admin-page-data.php'; |
|
| 814 | 814 | |
| 815 | 815 | echo $description; |
| 816 | 816 | break; |
@@ -818,12 +818,12 @@ discard block |
||
| 818 | 818 | // Custom: Give Docs Link field type. |
| 819 | 819 | case 'give_docs_link' : |
| 820 | 820 | ?> |
| 821 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
| 821 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
| 822 | 822 | <td class="give-docs-link" colspan="2"> |
| 823 | 823 | <?php |
| 824 | - echo '<p class="give-docs-link"><a href="' . esc_url( $value['url'] ) |
|
| 824 | + echo '<p class="give-docs-link"><a href="'.esc_url($value['url']) |
|
| 825 | 825 | . '" target="_blank">' |
| 826 | - . sprintf( esc_html__( 'Need Help? See docs on "%s"', 'give' ), $value['title'] ) |
|
| 826 | + . sprintf(esc_html__('Need Help? See docs on "%s"', 'give'), $value['title']) |
|
| 827 | 827 | . '<span class="dashicons dashicons-editor-help"></span></a></p>'; |
| 828 | 828 | ?> |
| 829 | 829 | </td> |
@@ -834,8 +834,8 @@ discard block |
||
| 834 | 834 | // You can add or handle your custom field action. |
| 835 | 835 | default: |
| 836 | 836 | // Get option value. |
| 837 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
| 838 | - do_action( 'give_admin_field_' . $value['type'], $value, $option_value ); |
|
| 837 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
| 838 | + do_action('give_admin_field_'.$value['type'], $value, $option_value); |
|
| 839 | 839 | break; |
| 840 | 840 | } |
| 841 | 841 | } |
@@ -851,15 +851,15 @@ discard block |
||
| 851 | 851 | * |
| 852 | 852 | * @return string The HTML description of the field. |
| 853 | 853 | */ |
| 854 | - public static function get_field_description( $value ) { |
|
| 854 | + public static function get_field_description($value) { |
|
| 855 | 855 | $description = ''; |
| 856 | 856 | |
| 857 | 857 | // Support for both 'description' and 'desc' args. |
| 858 | - $description_key = isset( $value['description'] ) ? 'description' : 'desc'; |
|
| 859 | - $value = ( isset( $value[ $description_key ] ) && ! empty( $value[ $description_key ] ) ) ? $value[ $description_key ] : ''; |
|
| 858 | + $description_key = isset($value['description']) ? 'description' : 'desc'; |
|
| 859 | + $value = (isset($value[$description_key]) && ! empty($value[$description_key])) ? $value[$description_key] : ''; |
|
| 860 | 860 | |
| 861 | - if ( ! empty( $value ) ) { |
|
| 862 | - $description = '<div class="give-field-description">' . wp_kses_post( $value ) . '</div>'; |
|
| 861 | + if ( ! empty($value)) { |
|
| 862 | + $description = '<div class="give-field-description">'.wp_kses_post($value).'</div>'; |
|
| 863 | 863 | } |
| 864 | 864 | |
| 865 | 865 | return $description; |
@@ -876,11 +876,11 @@ discard block |
||
| 876 | 876 | * |
| 877 | 877 | * @return array The description and tip as a 2 element array |
| 878 | 878 | */ |
| 879 | - public static function get_field_title( $value ) { |
|
| 880 | - $title = esc_html( $value['title'] ); |
|
| 879 | + public static function get_field_title($value) { |
|
| 880 | + $title = esc_html($value['title']); |
|
| 881 | 881 | |
| 882 | 882 | // If html tag detected then allow them to print. |
| 883 | - if ( strip_tags( $title ) ) { |
|
| 883 | + if (strip_tags($title)) { |
|
| 884 | 884 | $title = $value['title']; |
| 885 | 885 | } |
| 886 | 886 | |
@@ -899,8 +899,8 @@ discard block |
||
| 899 | 899 | * |
| 900 | 900 | * @return bool |
| 901 | 901 | */ |
| 902 | - public static function save_fields( $options, $option_name = '' ) { |
|
| 903 | - if ( empty( $_POST ) ) { |
|
| 902 | + public static function save_fields($options, $option_name = '') { |
|
| 903 | + if (empty($_POST)) { |
|
| 904 | 904 | return false; |
| 905 | 905 | } |
| 906 | 906 | |
@@ -908,37 +908,37 @@ discard block |
||
| 908 | 908 | $update_options = array(); |
| 909 | 909 | |
| 910 | 910 | // Loop options and get values to save. |
| 911 | - foreach ( $options as $option ) { |
|
| 912 | - if ( ! isset( $option['id'] ) || ! isset( $option['type'] ) ) { |
|
| 911 | + foreach ($options as $option) { |
|
| 912 | + if ( ! isset($option['id']) || ! isset($option['type'])) { |
|
| 913 | 913 | continue; |
| 914 | 914 | } |
| 915 | 915 | |
| 916 | 916 | // Get posted value. |
| 917 | - if ( strstr( $option['id'], '[' ) ) { |
|
| 918 | - parse_str( $option['id'], $option_name_array ); |
|
| 919 | - $field_option_name = current( array_keys( $option_name_array ) ); |
|
| 920 | - $setting_name = key( $option_name_array[ $field_option_name ] ); |
|
| 921 | - $raw_value = isset( $_POST[ $field_option_name ][ $setting_name ] ) ? wp_unslash( $_POST[ $field_option_name ][ $setting_name ] ) : null; |
|
| 917 | + if (strstr($option['id'], '[')) { |
|
| 918 | + parse_str($option['id'], $option_name_array); |
|
| 919 | + $field_option_name = current(array_keys($option_name_array)); |
|
| 920 | + $setting_name = key($option_name_array[$field_option_name]); |
|
| 921 | + $raw_value = isset($_POST[$field_option_name][$setting_name]) ? wp_unslash($_POST[$field_option_name][$setting_name]) : null; |
|
| 922 | 922 | } else { |
| 923 | 923 | $field_option_name = $option['id']; |
| 924 | 924 | $setting_name = ''; |
| 925 | - $raw_value = isset( $_POST[ $option['id'] ] ) ? wp_unslash( $_POST[ $option['id'] ] ) : null; |
|
| 925 | + $raw_value = isset($_POST[$option['id']]) ? wp_unslash($_POST[$option['id']]) : null; |
|
| 926 | 926 | } |
| 927 | 927 | |
| 928 | 928 | // Format the value based on option type. |
| 929 | - switch ( $option['type'] ) { |
|
| 929 | + switch ($option['type']) { |
|
| 930 | 930 | case 'checkbox' : |
| 931 | - $value = is_null( $raw_value ) ? '' : 'on'; |
|
| 931 | + $value = is_null($raw_value) ? '' : 'on'; |
|
| 932 | 932 | break; |
| 933 | 933 | case 'wysiwyg' : |
| 934 | 934 | case 'textarea' : |
| 935 | - $value = wp_kses_post( trim( $raw_value ) ); |
|
| 935 | + $value = wp_kses_post(trim($raw_value)); |
|
| 936 | 936 | break; |
| 937 | 937 | case 'multiselect' : |
| 938 | - $value = array_filter( array_map( 'give_clean', (array) $raw_value ) ); |
|
| 938 | + $value = array_filter(array_map('give_clean', (array) $raw_value)); |
|
| 939 | 939 | break; |
| 940 | 940 | default : |
| 941 | - $value = give_clean( $raw_value ); |
|
| 941 | + $value = give_clean($raw_value); |
|
| 942 | 942 | break; |
| 943 | 943 | } |
| 944 | 944 | |
@@ -947,37 +947,37 @@ discard block |
||
| 947 | 947 | * |
| 948 | 948 | * @since 1.8 |
| 949 | 949 | */ |
| 950 | - $value = apply_filters( 'give_admin_settings_sanitize_option', $value, $option, $raw_value ); |
|
| 950 | + $value = apply_filters('give_admin_settings_sanitize_option', $value, $option, $raw_value); |
|
| 951 | 951 | |
| 952 | 952 | /** |
| 953 | 953 | * Sanitize the value of an option by option name. |
| 954 | 954 | * |
| 955 | 955 | * @since 1.8 |
| 956 | 956 | */ |
| 957 | - $value = apply_filters( "give_admin_settings_sanitize_option_{$field_option_name}", $value, $option, $raw_value ); |
|
| 957 | + $value = apply_filters("give_admin_settings_sanitize_option_{$field_option_name}", $value, $option, $raw_value); |
|
| 958 | 958 | |
| 959 | - if ( is_null( $value ) ) { |
|
| 959 | + if (is_null($value)) { |
|
| 960 | 960 | continue; |
| 961 | 961 | } |
| 962 | 962 | |
| 963 | 963 | // Check if option is an array and handle that differently to single values. |
| 964 | - if ( $field_option_name && $setting_name ) { |
|
| 965 | - if ( ! isset( $update_options[ $field_option_name ] ) ) { |
|
| 966 | - $update_options[ $field_option_name ] = get_option( $field_option_name, array() ); |
|
| 964 | + if ($field_option_name && $setting_name) { |
|
| 965 | + if ( ! isset($update_options[$field_option_name])) { |
|
| 966 | + $update_options[$field_option_name] = get_option($field_option_name, array()); |
|
| 967 | 967 | } |
| 968 | - if ( ! is_array( $update_options[ $field_option_name ] ) ) { |
|
| 969 | - $update_options[ $field_option_name ] = array(); |
|
| 968 | + if ( ! is_array($update_options[$field_option_name])) { |
|
| 969 | + $update_options[$field_option_name] = array(); |
|
| 970 | 970 | } |
| 971 | - $update_options[ $field_option_name ][ $setting_name ] = $value; |
|
| 971 | + $update_options[$field_option_name][$setting_name] = $value; |
|
| 972 | 972 | } else { |
| 973 | - $update_options[ $field_option_name ] = $value; |
|
| 973 | + $update_options[$field_option_name] = $value; |
|
| 974 | 974 | } |
| 975 | 975 | } |
| 976 | 976 | |
| 977 | 977 | // Save all options in our array or there own option name i.e. option id. |
| 978 | - if ( empty( $option_name ) ) { |
|
| 979 | - foreach ( $update_options as $name => $value ) { |
|
| 980 | - update_option( $name, $value ); |
|
| 978 | + if (empty($option_name)) { |
|
| 979 | + foreach ($update_options as $name => $value) { |
|
| 980 | + update_option($name, $value); |
|
| 981 | 981 | |
| 982 | 982 | /** |
| 983 | 983 | * Trigger action. |
@@ -986,13 +986,13 @@ discard block |
||
| 986 | 986 | * |
| 987 | 987 | * @since 1.8 |
| 988 | 988 | */ |
| 989 | - do_action( "give_save_option_{$name}", $value, $name ); |
|
| 989 | + do_action("give_save_option_{$name}", $value, $name); |
|
| 990 | 990 | } |
| 991 | 991 | } else { |
| 992 | - $old_options = ( $old_options = get_option( $option_name ) ) ? $old_options : array(); |
|
| 993 | - $update_options = array_merge( $old_options, $update_options ); |
|
| 992 | + $old_options = ($old_options = get_option($option_name)) ? $old_options : array(); |
|
| 993 | + $update_options = array_merge($old_options, $update_options); |
|
| 994 | 994 | |
| 995 | - update_option( $option_name, $update_options ); |
|
| 995 | + update_option($option_name, $update_options); |
|
| 996 | 996 | |
| 997 | 997 | /** |
| 998 | 998 | * Trigger action. |
@@ -1001,7 +1001,7 @@ discard block |
||
| 1001 | 1001 | * |
| 1002 | 1002 | * @since 1.8 |
| 1003 | 1003 | */ |
| 1004 | - do_action( "give_save_settings_{$option_name}", $update_options, $option_name, $old_options ); |
|
| 1004 | + do_action("give_save_settings_{$option_name}", $update_options, $option_name, $old_options); |
|
| 1005 | 1005 | } |
| 1006 | 1006 | |
| 1007 | 1007 | return true; |
@@ -1030,21 +1030,21 @@ discard block |
||
| 1030 | 1030 | * |
| 1031 | 1031 | * @return bool |
| 1032 | 1032 | */ |
| 1033 | - public static function is_setting_page( $tab = '', $section = '' ) { |
|
| 1033 | + public static function is_setting_page($tab = '', $section = '') { |
|
| 1034 | 1034 | $is_setting_page = false; |
| 1035 | 1035 | |
| 1036 | - if( ! is_admin() ) { |
|
| 1036 | + if ( ! is_admin()) { |
|
| 1037 | 1037 | return $is_setting_page; |
| 1038 | 1038 | } |
| 1039 | 1039 | |
| 1040 | 1040 | // Check fo setting tab. |
| 1041 | - if ( ! empty( $tab ) ) { |
|
| 1042 | - $is_setting_page = ( $tab === give_get_current_setting_tab() ); |
|
| 1041 | + if ( ! empty($tab)) { |
|
| 1042 | + $is_setting_page = ($tab === give_get_current_setting_tab()); |
|
| 1043 | 1043 | } |
| 1044 | 1044 | |
| 1045 | 1045 | // Check fo setting section. |
| 1046 | - if ( ! empty( $section ) ) { |
|
| 1047 | - $is_setting_page = ( $section === give_get_current_setting_section() ); |
|
| 1046 | + if ( ! empty($section)) { |
|
| 1047 | + $is_setting_page = ($section === give_get_current_setting_section()); |
|
| 1048 | 1048 | } |
| 1049 | 1049 | |
| 1050 | 1050 | return $is_setting_page; |
@@ -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_License' ) ) : |
|
| 16 | +if ( ! class_exists('Give_Settings_License')) : |
|
| 17 | 17 | |
| 18 | 18 | /** |
| 19 | 19 | * Give_Settings_License. |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | */ |
| 28 | 28 | public function __construct() { |
| 29 | 29 | $this->id = 'licenses'; |
| 30 | - $this->label = esc_html__( 'Licenses', 'give' ); |
|
| 30 | + $this->label = esc_html__('Licenses', 'give'); |
|
| 31 | 31 | |
| 32 | 32 | parent::__construct(); |
| 33 | 33 | } |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | * Filter the licenses settings. |
| 46 | 46 | * Backward compatibility: Please do not use this filter. This filter is deprecated in 1.8 |
| 47 | 47 | */ |
| 48 | - $settings = apply_filters( 'give_settings_licenses', $settings ); |
|
| 48 | + $settings = apply_filters('give_settings_licenses', $settings); |
|
| 49 | 49 | |
| 50 | 50 | /** |
| 51 | 51 | * Filter the settings. |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | * |
| 55 | 55 | * @param array $settings |
| 56 | 56 | */ |
| 57 | - $settings = apply_filters( 'give_get_settings_' . $this->id, $settings ); |
|
| 57 | + $settings = apply_filters('give_get_settings_'.$this->id, $settings); |
|
| 58 | 58 | |
| 59 | 59 | // Output. |
| 60 | 60 | return $settings; |
@@ -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 | } |