@@ -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 |
@@ -461,9 +461,12 @@ |
||
461 | 461 | </p> |
462 | 462 | <?php endforeach; ?> |
463 | 463 | <a href="#" data-id="<?php echo $value['id']; ?>" class="give-repeat-setting-field button-secondary"><?php echo $value['repeat_btn_title']; ?></a> |
464 | - <?php else : ?> |
|
464 | + <?php else { |
|
465 | + : ?> |
|
465 | 466 | <input |
466 | - name="<?php echo esc_attr( $value['id'] ); ?>" |
|
467 | + name="<?php echo esc_attr( $value['id'] ); |
|
468 | +} |
|
469 | +?>" |
|
467 | 470 | id="<?php echo esc_attr( $value['id'] ); ?>" |
468 | 471 | type="<?php echo esc_attr( $type ); ?>" |
469 | 472 | style="<?php echo esc_attr( $value['css'] ); ?>" |
@@ -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,61 +325,61 @@ 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><hr> |
|
367 | + <?php if ( ! empty($value['title'])) : ?> |
|
368 | + <h2><?php echo self::get_field_title($value); ?></h2><hr> |
|
369 | 369 | <?php endif; ?> |
370 | 370 | |
371 | - <?php if ( ! empty( $value['desc'] ) ) : ?> |
|
372 | - <?php echo wpautop( wptexturize( wp_kses_post( $value['desc'] ) ) ); ?> |
|
371 | + <?php if ( ! empty($value['desc'])) : ?> |
|
372 | + <?php echo wpautop(wptexturize(wp_kses_post($value['desc']))); ?> |
|
373 | 373 | <?php endif; ?> |
374 | 374 | </div> |
375 | 375 | <?php |
376 | 376 | } |
377 | 377 | |
378 | - if ( $value['table_html'] ) { |
|
379 | - echo '<table class="form-table give-setting-tab-body give-setting-tab-body-' . $current_tab . '">' . "\n\n"; |
|
378 | + if ($value['table_html']) { |
|
379 | + echo '<table class="form-table give-setting-tab-body give-setting-tab-body-'.$current_tab.'">'."\n\n"; |
|
380 | 380 | } |
381 | 381 | |
382 | - if ( ! empty( $value['id'] ) ) { |
|
382 | + if ( ! empty($value['id'])) { |
|
383 | 383 | |
384 | 384 | /** |
385 | 385 | * Trigger Action. |
@@ -388,14 +388,14 @@ discard block |
||
388 | 388 | * |
389 | 389 | * @since 1.8 |
390 | 390 | */ |
391 | - do_action( 'give_settings_' . sanitize_title( $value['id'] ) ); |
|
391 | + do_action('give_settings_'.sanitize_title($value['id'])); |
|
392 | 392 | } |
393 | 393 | |
394 | 394 | break; |
395 | 395 | |
396 | 396 | // Section Ends. |
397 | 397 | case 'sectionend': |
398 | - if ( ! empty( $value['id'] ) ) { |
|
398 | + if ( ! empty($value['id'])) { |
|
399 | 399 | |
400 | 400 | /** |
401 | 401 | * Trigger Action. |
@@ -404,14 +404,14 @@ discard block |
||
404 | 404 | * |
405 | 405 | * @since 1.8 |
406 | 406 | */ |
407 | - do_action( 'give_settings_' . sanitize_title( $value['id'] ) . '_end' ); |
|
407 | + do_action('give_settings_'.sanitize_title($value['id']).'_end'); |
|
408 | 408 | } |
409 | 409 | |
410 | - if ( $value['table_html'] ) { |
|
410 | + if ($value['table_html']) { |
|
411 | 411 | echo '</table>'; |
412 | 412 | } |
413 | 413 | |
414 | - if ( ! empty( $value['id'] ) ) { |
|
414 | + if ( ! empty($value['id'])) { |
|
415 | 415 | |
416 | 416 | /** |
417 | 417 | * Trigger Action. |
@@ -420,7 +420,7 @@ discard block |
||
420 | 420 | * |
421 | 421 | * @since 1.8 |
422 | 422 | */ |
423 | - do_action( 'give_settings_' . sanitize_title( $value['id'] ) . '_after' ); |
|
423 | + do_action('give_settings_'.sanitize_title($value['id']).'_after'); |
|
424 | 424 | } |
425 | 425 | |
426 | 426 | break; |
@@ -428,48 +428,48 @@ discard block |
||
428 | 428 | // Standard text inputs and subtypes like 'number'. |
429 | 429 | case 'colorpicker': |
430 | 430 | case 'hidden' : |
431 | - $value['wrapper_class'] = empty( $value['wrapper_class'] ) ? 'give-hidden' : trim( $value['wrapper_class'] ) . ' give-hidden'; |
|
431 | + $value['wrapper_class'] = empty($value['wrapper_class']) ? 'give-hidden' : trim($value['wrapper_class']).' give-hidden'; |
|
432 | 432 | case 'text': |
433 | 433 | case 'email': |
434 | 434 | case 'number': |
435 | 435 | case 'password' : |
436 | 436 | $type = $value['type']; |
437 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
437 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
438 | 438 | |
439 | 439 | // Set default value for repeater field if not any value set yet. |
440 | - if( $value['repeat'] && is_string( $option_value ) ) { |
|
441 | - $option_value = array( $value['default'] ); |
|
440 | + if ($value['repeat'] && is_string($option_value)) { |
|
441 | + $option_value = array($value['default']); |
|
442 | 442 | } |
443 | 443 | ?> |
444 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
444 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
445 | 445 | <th scope="row" class="titledesc"> |
446 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
446 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
447 | 447 | </th> |
448 | - <td class="give-forminp give-forminp-<?php echo sanitize_title( $value['type'] ) ?>"> |
|
449 | - <?php if ( $value['repeat'] ) : ?> |
|
450 | - <?php foreach ( $option_value as $index => $field_value ) : ?> |
|
448 | + <td class="give-forminp give-forminp-<?php echo sanitize_title($value['type']) ?>"> |
|
449 | + <?php if ($value['repeat']) : ?> |
|
450 | + <?php foreach ($option_value as $index => $field_value) : ?> |
|
451 | 451 | <p> |
452 | 452 | <input |
453 | - name="<?php echo esc_attr( $value['id'] ); ?>[]" |
|
454 | - type="<?php echo esc_attr( $type ); ?>" |
|
455 | - style="<?php echo esc_attr( $value['css'] ); ?>" |
|
456 | - value="<?php echo esc_attr( $field_value ); ?>" |
|
457 | - class="give-input-field<?php echo( empty( $value['class'] ) ? '' : ' ' . esc_attr( $value['class'] ) ); ?> <?php echo esc_attr( $value['id'] ); ?>" |
|
458 | - <?php echo implode( ' ', $custom_attributes ); ?> |
|
453 | + name="<?php echo esc_attr($value['id']); ?>[]" |
|
454 | + type="<?php echo esc_attr($type); ?>" |
|
455 | + style="<?php echo esc_attr($value['css']); ?>" |
|
456 | + value="<?php echo esc_attr($field_value); ?>" |
|
457 | + class="give-input-field<?php echo(empty($value['class']) ? '' : ' '.esc_attr($value['class'])); ?> <?php echo esc_attr($value['id']); ?>" |
|
458 | + <?php echo implode(' ', $custom_attributes); ?> |
|
459 | 459 | /> |
460 | - <span class="give-remove-setting-field" title="<?php esc_html_e( 'Remove setting field', 'give' ); ?>">-</span> |
|
460 | + <span class="give-remove-setting-field" title="<?php esc_html_e('Remove setting field', 'give'); ?>">-</span> |
|
461 | 461 | </p> |
462 | 462 | <?php endforeach; ?> |
463 | 463 | <a href="#" data-id="<?php echo $value['id']; ?>" class="give-repeat-setting-field button-secondary"><?php echo $value['repeat_btn_title']; ?></a> |
464 | 464 | <?php else : ?> |
465 | 465 | <input |
466 | - name="<?php echo esc_attr( $value['id'] ); ?>" |
|
467 | - id="<?php echo esc_attr( $value['id'] ); ?>" |
|
468 | - type="<?php echo esc_attr( $type ); ?>" |
|
469 | - style="<?php echo esc_attr( $value['css'] ); ?>" |
|
470 | - value="<?php echo esc_attr( $option_value ); ?>" |
|
471 | - class="give-input-field<?php echo( empty( $value['class'] ) ? '' : ' ' . esc_attr( $value['class'] ) ); ?>" |
|
472 | - <?php echo implode( ' ', $custom_attributes ); ?> |
|
466 | + name="<?php echo esc_attr($value['id']); ?>" |
|
467 | + id="<?php echo esc_attr($value['id']); ?>" |
|
468 | + type="<?php echo esc_attr($type); ?>" |
|
469 | + style="<?php echo esc_attr($value['css']); ?>" |
|
470 | + value="<?php echo esc_attr($option_value); ?>" |
|
471 | + class="give-input-field<?php echo(empty($value['class']) ? '' : ' '.esc_attr($value['class'])); ?>" |
|
472 | + <?php echo implode(' ', $custom_attributes); ?> |
|
473 | 473 | /> |
474 | 474 | <?php endif; ?> |
475 | 475 | <?php echo $description; ?> |
@@ -480,23 +480,23 @@ discard block |
||
480 | 480 | // Textarea. |
481 | 481 | case 'textarea': |
482 | 482 | |
483 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
483 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
484 | 484 | |
485 | 485 | ?> |
486 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
486 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
487 | 487 | <th scope="row" class="titledesc"> |
488 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
488 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
489 | 489 | </th> |
490 | - <td class="give-forminp give-forminp-<?php echo sanitize_title( $value['type'] ) ?>"> |
|
490 | + <td class="give-forminp give-forminp-<?php echo sanitize_title($value['type']) ?>"> |
|
491 | 491 | <textarea |
492 | - name="<?php echo esc_attr( $value['id'] ); ?>" |
|
493 | - id="<?php echo esc_attr( $value['id'] ); ?>" |
|
494 | - style="<?php echo esc_attr( $value['css'] ); ?>" |
|
495 | - class="<?php echo esc_attr( $value['class'] ); ?>" |
|
492 | + name="<?php echo esc_attr($value['id']); ?>" |
|
493 | + id="<?php echo esc_attr($value['id']); ?>" |
|
494 | + style="<?php echo esc_attr($value['css']); ?>" |
|
495 | + class="<?php echo esc_attr($value['class']); ?>" |
|
496 | 496 | rows="10" |
497 | 497 | cols="60" |
498 | - <?php echo implode( ' ', $custom_attributes ); ?> |
|
499 | - ><?php echo esc_textarea( $option_value ); ?></textarea> |
|
498 | + <?php echo implode(' ', $custom_attributes); ?> |
|
499 | + ><?php echo esc_textarea($option_value); ?></textarea> |
|
500 | 500 | <?php echo $description; ?> |
501 | 501 | </td> |
502 | 502 | </tr><?php |
@@ -506,35 +506,35 @@ discard block |
||
506 | 506 | case 'select' : |
507 | 507 | case 'multiselect' : |
508 | 508 | |
509 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
509 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
510 | 510 | |
511 | 511 | ?> |
512 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
512 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
513 | 513 | <th scope="row" class="titledesc"> |
514 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
514 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
515 | 515 | </th> |
516 | - <td class="give-forminp give-forminp-<?php echo sanitize_title( $value['type'] ) ?>"> |
|
516 | + <td class="give-forminp give-forminp-<?php echo sanitize_title($value['type']) ?>"> |
|
517 | 517 | <select |
518 | - name="<?php echo esc_attr( $value['id'] ); ?><?php if ( $value['type'] == 'multiselect' ) { |
|
518 | + name="<?php echo esc_attr($value['id']); ?><?php if ($value['type'] == 'multiselect') { |
|
519 | 519 | echo '[]'; |
520 | 520 | } ?>" |
521 | - id="<?php echo esc_attr( $value['id'] ); ?>" |
|
522 | - style="<?php echo esc_attr( $value['css'] ); ?>" |
|
523 | - class="<?php echo esc_attr( $value['class'] ); ?>" |
|
524 | - <?php echo implode( ' ', $custom_attributes ); ?> |
|
525 | - <?php echo ( 'multiselect' == $value['type'] ) ? 'multiple="multiple"' : ''; ?> |
|
521 | + id="<?php echo esc_attr($value['id']); ?>" |
|
522 | + style="<?php echo esc_attr($value['css']); ?>" |
|
523 | + class="<?php echo esc_attr($value['class']); ?>" |
|
524 | + <?php echo implode(' ', $custom_attributes); ?> |
|
525 | + <?php echo ('multiselect' == $value['type']) ? 'multiple="multiple"' : ''; ?> |
|
526 | 526 | > |
527 | 527 | |
528 | 528 | <?php |
529 | - if ( ! empty( $value['options'] ) ) { |
|
530 | - foreach ( $value['options'] as $key => $val ) { |
|
529 | + if ( ! empty($value['options'])) { |
|
530 | + foreach ($value['options'] as $key => $val) { |
|
531 | 531 | ?> |
532 | - <option value="<?php echo esc_attr( $key ); ?>" <?php |
|
532 | + <option value="<?php echo esc_attr($key); ?>" <?php |
|
533 | 533 | |
534 | - if ( is_array( $option_value ) ) { |
|
535 | - selected( in_array( $key, $option_value ), true ); |
|
534 | + if (is_array($option_value)) { |
|
535 | + selected(in_array($key, $option_value), true); |
|
536 | 536 | } else { |
537 | - selected( $option_value, $key ); |
|
537 | + selected($option_value, $key); |
|
538 | 538 | } |
539 | 539 | |
540 | 540 | ?>><?php echo $val ?></option> |
@@ -550,28 +550,28 @@ discard block |
||
550 | 550 | |
551 | 551 | // Radio inputs. |
552 | 552 | case 'radio_inline' : |
553 | - $value['class'] = empty( $value['class'] ) ? 'give-radio-inline' : $value['class'] . ' give-radio-inline'; |
|
553 | + $value['class'] = empty($value['class']) ? 'give-radio-inline' : $value['class'].' give-radio-inline'; |
|
554 | 554 | case 'radio' : |
555 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
555 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
556 | 556 | ?> |
557 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
557 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
558 | 558 | <th scope="row" class="titledesc"> |
559 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
559 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
560 | 560 | </th> |
561 | - <td class="give-forminp give-forminp-<?php echo sanitize_title( $value['type'] ) ?> <?php echo( ! empty( $value['class'] ) ? $value['class'] : '' ); ?>"> |
|
561 | + <td class="give-forminp give-forminp-<?php echo sanitize_title($value['type']) ?> <?php echo( ! empty($value['class']) ? $value['class'] : ''); ?>"> |
|
562 | 562 | <fieldset> |
563 | 563 | <ul> |
564 | 564 | <?php |
565 | - foreach ( $value['options'] as $key => $val ) { |
|
565 | + foreach ($value['options'] as $key => $val) { |
|
566 | 566 | ?> |
567 | 567 | <li> |
568 | 568 | <label><input |
569 | - name="<?php echo esc_attr( $value['id'] ); ?>" |
|
569 | + name="<?php echo esc_attr($value['id']); ?>" |
|
570 | 570 | value="<?php echo $key; ?>" |
571 | 571 | type="radio" |
572 | - style="<?php echo esc_attr( $value['css'] ); ?>" |
|
573 | - <?php echo implode( ' ', $custom_attributes ); ?> |
|
574 | - <?php checked( $key, $option_value ); ?> |
|
572 | + style="<?php echo esc_attr($value['css']); ?>" |
|
573 | + <?php echo implode(' ', $custom_attributes); ?> |
|
574 | + <?php checked($key, $option_value); ?> |
|
575 | 575 | /> <?php echo $val ?></label> |
576 | 576 | </li> |
577 | 577 | <?php |
@@ -585,21 +585,21 @@ discard block |
||
585 | 585 | |
586 | 586 | // Checkbox input. |
587 | 587 | case 'checkbox' : |
588 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
588 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
589 | 589 | ?> |
590 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
590 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
591 | 591 | <th scope="row" class="titledesc"> |
592 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
592 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
593 | 593 | </th> |
594 | 594 | <td class="give-forminp"> |
595 | 595 | <input |
596 | - name="<?php echo esc_attr( $value['id'] ); ?>" |
|
597 | - id="<?php echo esc_attr( $value['id'] ); ?>" |
|
596 | + name="<?php echo esc_attr($value['id']); ?>" |
|
597 | + id="<?php echo esc_attr($value['id']); ?>" |
|
598 | 598 | type="checkbox" |
599 | - class="<?php echo esc_attr( isset( $value['class'] ) ? $value['class'] : '' ); ?>" |
|
599 | + class="<?php echo esc_attr(isset($value['class']) ? $value['class'] : ''); ?>" |
|
600 | 600 | value="1" |
601 | - <?php checked( $option_value, 'on' ); ?> |
|
602 | - <?php echo implode( ' ', $custom_attributes ); ?> |
|
601 | + <?php checked($option_value, 'on'); ?> |
|
602 | + <?php echo implode(' ', $custom_attributes); ?> |
|
603 | 603 | /> |
604 | 604 | <?php echo $description; ?> |
605 | 605 | </td> |
@@ -609,28 +609,28 @@ discard block |
||
609 | 609 | |
610 | 610 | // Multi Checkbox input. |
611 | 611 | case 'multicheck' : |
612 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
613 | - $option_value = is_array( $option_value ) ? $option_value : array(); |
|
612 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
613 | + $option_value = is_array($option_value) ? $option_value : array(); |
|
614 | 614 | ?> |
615 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
615 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
616 | 616 | <th scope="row" class="titledesc"> |
617 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
617 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
618 | 618 | </th> |
619 | - <td class="give-forminp give-forminp-<?php echo sanitize_title( $value['type'] ) ?> <?php echo( ! empty( $value['class'] ) ? $value['class'] : '' ); ?>"> |
|
619 | + <td class="give-forminp give-forminp-<?php echo sanitize_title($value['type']) ?> <?php echo( ! empty($value['class']) ? $value['class'] : ''); ?>"> |
|
620 | 620 | <fieldset> |
621 | 621 | <ul> |
622 | 622 | <?php |
623 | - foreach ( $value['options'] as $key => $val ) { |
|
623 | + foreach ($value['options'] as $key => $val) { |
|
624 | 624 | ?> |
625 | 625 | <li> |
626 | 626 | <label> |
627 | 627 | <input |
628 | - name="<?php echo esc_attr( $value['id'] ); ?>[]" |
|
628 | + name="<?php echo esc_attr($value['id']); ?>[]" |
|
629 | 629 | value="<?php echo $key; ?>" |
630 | 630 | type="checkbox" |
631 | - style="<?php echo esc_attr( $value['css'] ); ?>" |
|
632 | - <?php echo implode( ' ', $custom_attributes ); ?> |
|
633 | - <?php if ( in_array( $key, $option_value ) ) { |
|
631 | + style="<?php echo esc_attr($value['css']); ?>" |
|
632 | + <?php echo implode(' ', $custom_attributes); ?> |
|
633 | + <?php if (in_array($key, $option_value)) { |
|
634 | 634 | echo 'checked="checked"'; |
635 | 635 | } ?> |
636 | 636 | /> <?php echo $val ?> |
@@ -649,30 +649,30 @@ discard block |
||
649 | 649 | // File input field. |
650 | 650 | case 'file' : |
651 | 651 | case 'media' : |
652 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
653 | - $button_label = esc_html__( sprintf( 'Add or Upload %s', ( 'file' === $value['type'] ? 'File' : 'Image' ) ), 'give' ); |
|
654 | - $fvalue = empty( $value['fvalue'] ) ? 'url' : $value['fvalue']; |
|
655 | - |
|
656 | - $allow_media_preview_tags = array( 'jpg', 'jpeg', 'png', 'gif', 'ico' ); |
|
657 | - $preview_image_src = $option_value ? ( 'id' === $fvalue ? wp_get_attachment_url( $option_value ) : $option_value ) : ''; |
|
658 | - $preview_image_extension = $preview_image_src ? pathinfo( $preview_image_src, PATHINFO_EXTENSION ) : ''; |
|
659 | - $is_show_preview = in_array( $preview_image_extension, $allow_media_preview_tags ); |
|
652 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
653 | + $button_label = esc_html__(sprintf('Add or Upload %s', ('file' === $value['type'] ? 'File' : 'Image')), 'give'); |
|
654 | + $fvalue = empty($value['fvalue']) ? 'url' : $value['fvalue']; |
|
655 | + |
|
656 | + $allow_media_preview_tags = array('jpg', 'jpeg', 'png', 'gif', 'ico'); |
|
657 | + $preview_image_src = $option_value ? ('id' === $fvalue ? wp_get_attachment_url($option_value) : $option_value) : ''; |
|
658 | + $preview_image_extension = $preview_image_src ? pathinfo($preview_image_src, PATHINFO_EXTENSION) : ''; |
|
659 | + $is_show_preview = in_array($preview_image_extension, $allow_media_preview_tags); |
|
660 | 660 | ?> |
661 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
661 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
662 | 662 | <th scope="row" class="titledesc"> |
663 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
663 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
664 | 664 | </th> |
665 | 665 | <td class="give-forminp"> |
666 | 666 | <div class="give-field-wrap"> |
667 | 667 | <label for="<?php echo $value['id'] ?>"> |
668 | 668 | <input |
669 | - name="<?php echo esc_attr( $value['id'] ); ?>" |
|
670 | - id="<?php echo esc_attr( $value['id'] ); ?>" |
|
669 | + name="<?php echo esc_attr($value['id']); ?>" |
|
670 | + id="<?php echo esc_attr($value['id']); ?>" |
|
671 | 671 | type="text" |
672 | - class="give-input-field<?php echo esc_attr( isset( $value['class'] ) ? ' ' . $value['class'] : '' ); ?>" |
|
672 | + class="give-input-field<?php echo esc_attr(isset($value['class']) ? ' '.$value['class'] : ''); ?>" |
|
673 | 673 | value="<?php echo $option_value; ?>" |
674 | - style="<?php echo esc_attr( $value['css'] ); ?>" |
|
675 | - <?php echo implode( ' ', $custom_attributes ); ?> |
|
674 | + style="<?php echo esc_attr($value['css']); ?>" |
|
675 | + <?php echo implode(' ', $custom_attributes); ?> |
|
676 | 676 | /> <input class="give-upload-button button" type="button" data-fvalue="<?php echo $fvalue; ?>" data-field-type="<?php echo $value['type']; ?>" value="<?php echo $button_label; ?>"> |
677 | 677 | <?php echo $description ?> |
678 | 678 | <div class="give-image-thumb<?php echo ! $option_value || ! $is_show_preview ? ' give-hidden' : ''; ?>"> |
@@ -689,17 +689,17 @@ discard block |
||
689 | 689 | // WordPress Editor. |
690 | 690 | case 'wysiwyg' : |
691 | 691 | // Get option value. |
692 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
692 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
693 | 693 | |
694 | 694 | // Get editor settings. |
695 | - $editor_settings = ! empty( $value['options'] ) ? $value['options'] : array(); |
|
695 | + $editor_settings = ! empty($value['options']) ? $value['options'] : array(); |
|
696 | 696 | ?> |
697 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
697 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
698 | 698 | <th scope="row" class="titledesc"> |
699 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
699 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
700 | 700 | </th> |
701 | 701 | <td class="give-forminp"> |
702 | - <?php wp_editor( $option_value, $value['id'], $editor_settings ); ?> |
|
702 | + <?php wp_editor($option_value, $value['id'], $editor_settings); ?> |
|
703 | 703 | <?php echo $description; ?> |
704 | 704 | </td> |
705 | 705 | </tr><?php |
@@ -708,9 +708,9 @@ discard block |
||
708 | 708 | // Custom: System setting field. |
709 | 709 | case 'system_info' : |
710 | 710 | ?> |
711 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
711 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
712 | 712 | <th scope="row" class="titledesc"> |
713 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
713 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
714 | 714 | </th> |
715 | 715 | <td class="give-forminp"> |
716 | 716 | <?php give_system_info_callback(); ?> |
@@ -721,14 +721,14 @@ discard block |
||
721 | 721 | |
722 | 722 | // Custom: Default gateways setting field. |
723 | 723 | case 'default_gateway' : |
724 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
724 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
725 | 725 | ?> |
726 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
726 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
727 | 727 | <th scope="row" class="titledesc"> |
728 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
728 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
729 | 729 | </th> |
730 | 730 | <td class="give-forminp"> |
731 | - <?php give_default_gateway_callback( $value, $option_value ); ?> |
|
731 | + <?php give_default_gateway_callback($value, $option_value); ?> |
|
732 | 732 | <?php echo $description; ?> |
733 | 733 | </td> |
734 | 734 | </tr><?php |
@@ -736,14 +736,14 @@ discard block |
||
736 | 736 | |
737 | 737 | // Custom: Enable gateways setting field. |
738 | 738 | case 'enabled_gateways' : |
739 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
739 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
740 | 740 | ?> |
741 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
741 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
742 | 742 | <th scope="row" class="titledesc"> |
743 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
743 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
744 | 744 | </th> |
745 | 745 | <td class="give-forminp"> |
746 | - <?php give_enabled_gateways_callback( $value, $option_value ); ?> |
|
746 | + <?php give_enabled_gateways_callback($value, $option_value); ?> |
|
747 | 747 | <?php echo $description; ?> |
748 | 748 | </td> |
749 | 749 | </tr><?php |
@@ -752,12 +752,12 @@ discard block |
||
752 | 752 | // Custom: Email preview buttons field. |
753 | 753 | case 'email_preview_buttons' : |
754 | 754 | ?> |
755 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
755 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
756 | 756 | <th scope="row" class="titledesc"> |
757 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
757 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
758 | 758 | </th> |
759 | 759 | <td class="give-forminp"> |
760 | - <?php give_email_preview_buttons_callback( $value ); ?> |
|
760 | + <?php give_email_preview_buttons_callback($value); ?> |
|
761 | 761 | <?php echo $description; ?> |
762 | 762 | </td> |
763 | 763 | </tr><?php |
@@ -771,22 +771,22 @@ discard block |
||
771 | 771 | |
772 | 772 | // Custom: Gateway API key. |
773 | 773 | case 'api_key' : |
774 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
775 | - $type = ! empty( $option_value ) ? 'password' : 'text'; |
|
774 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
775 | + $type = ! empty($option_value) ? 'password' : 'text'; |
|
776 | 776 | ?> |
777 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
777 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
778 | 778 | <th scope="row" class="titledesc"> |
779 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
779 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
780 | 780 | </th> |
781 | - <td class="give-forminp give-forminp-<?php echo sanitize_title( $value['type'] ) ?>"> |
|
781 | + <td class="give-forminp give-forminp-<?php echo sanitize_title($value['type']) ?>"> |
|
782 | 782 | <input |
783 | - name="<?php echo esc_attr( $value['id'] ); ?>" |
|
784 | - id="<?php echo esc_attr( $value['id'] ); ?>" |
|
785 | - type="<?php echo esc_attr( $type ); ?>" |
|
786 | - style="<?php echo esc_attr( $value['css'] ); ?>" |
|
787 | - value="<?php echo esc_attr( trim( $option_value ) ); ?>" |
|
788 | - class="give-input-field<?php echo( empty( $value['class'] ) ? '' : ' ' . esc_attr( $value['class'] ) ); ?>" |
|
789 | - <?php echo implode( ' ', $custom_attributes ); ?> |
|
783 | + name="<?php echo esc_attr($value['id']); ?>" |
|
784 | + id="<?php echo esc_attr($value['id']); ?>" |
|
785 | + type="<?php echo esc_attr($type); ?>" |
|
786 | + style="<?php echo esc_attr($value['css']); ?>" |
|
787 | + value="<?php echo esc_attr(trim($option_value)); ?>" |
|
788 | + class="give-input-field<?php echo(empty($value['class']) ? '' : ' '.esc_attr($value['class'])); ?>" |
|
789 | + <?php echo implode(' ', $custom_attributes); ?> |
|
790 | 790 | /> <?php echo $description; ?> |
791 | 791 | </td> |
792 | 792 | </tr><?php |
@@ -803,7 +803,7 @@ discard block |
||
803 | 803 | * |
804 | 804 | * @since 1.0 |
805 | 805 | */ |
806 | - do_action( "give_logs_view_{$current_section}" ); |
|
806 | + do_action("give_logs_view_{$current_section}"); |
|
807 | 807 | |
808 | 808 | echo $description; |
809 | 809 | break; |
@@ -811,7 +811,7 @@ discard block |
||
811 | 811 | // Custom: Data field. |
812 | 812 | case 'data' : |
813 | 813 | |
814 | - include GIVE_PLUGIN_DIR . 'includes/admin/tools/views/html-admin-page-data.php'; |
|
814 | + include GIVE_PLUGIN_DIR.'includes/admin/tools/views/html-admin-page-data.php'; |
|
815 | 815 | |
816 | 816 | echo $description; |
817 | 817 | break; |
@@ -819,12 +819,12 @@ discard block |
||
819 | 819 | // Custom: Give Docs Link field type. |
820 | 820 | case 'give_docs_link' : |
821 | 821 | ?> |
822 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
822 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
823 | 823 | <td class="give-docs-link" colspan="2"> |
824 | 824 | <?php |
825 | - echo '<p class="give-docs-link"><a href="' . esc_url( $value['url'] ) |
|
825 | + echo '<p class="give-docs-link"><a href="'.esc_url($value['url']) |
|
826 | 826 | . '" target="_blank">' |
827 | - . sprintf( esc_html__( 'Need Help? See docs on "%s"', 'give' ), $value['title'] ) |
|
827 | + . sprintf(esc_html__('Need Help? See docs on "%s"', 'give'), $value['title']) |
|
828 | 828 | . '<span class="dashicons dashicons-editor-help"></span></a></p>'; |
829 | 829 | ?> |
830 | 830 | </td> |
@@ -835,8 +835,8 @@ discard block |
||
835 | 835 | // You can add or handle your custom field action. |
836 | 836 | default: |
837 | 837 | // Get option value. |
838 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
839 | - do_action( 'give_admin_field_' . $value['type'], $value, $option_value ); |
|
838 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
839 | + do_action('give_admin_field_'.$value['type'], $value, $option_value); |
|
840 | 840 | break; |
841 | 841 | } |
842 | 842 | } |
@@ -852,15 +852,15 @@ discard block |
||
852 | 852 | * |
853 | 853 | * @return string The HTML description of the field. |
854 | 854 | */ |
855 | - public static function get_field_description( $value ) { |
|
855 | + public static function get_field_description($value) { |
|
856 | 856 | $description = ''; |
857 | 857 | |
858 | 858 | // Support for both 'description' and 'desc' args. |
859 | - $description_key = isset( $value['description'] ) ? 'description' : 'desc'; |
|
860 | - $value = ( isset( $value[ $description_key ] ) && ! empty( $value[ $description_key ] ) ) ? $value[ $description_key ] : ''; |
|
859 | + $description_key = isset($value['description']) ? 'description' : 'desc'; |
|
860 | + $value = (isset($value[$description_key]) && ! empty($value[$description_key])) ? $value[$description_key] : ''; |
|
861 | 861 | |
862 | - if ( ! empty( $value ) ) { |
|
863 | - $description = '<div class="give-field-description">' . wp_kses_post( $value ) . '</div>'; |
|
862 | + if ( ! empty($value)) { |
|
863 | + $description = '<div class="give-field-description">'.wp_kses_post($value).'</div>'; |
|
864 | 864 | } |
865 | 865 | |
866 | 866 | return $description; |
@@ -877,11 +877,11 @@ discard block |
||
877 | 877 | * |
878 | 878 | * @return array The description and tip as a 2 element array |
879 | 879 | */ |
880 | - public static function get_field_title( $value ) { |
|
881 | - $title = esc_html( $value['title'] ); |
|
880 | + public static function get_field_title($value) { |
|
881 | + $title = esc_html($value['title']); |
|
882 | 882 | |
883 | 883 | // If html tag detected then allow them to print. |
884 | - if ( strip_tags( $title ) ) { |
|
884 | + if (strip_tags($title)) { |
|
885 | 885 | $title = $value['title']; |
886 | 886 | } |
887 | 887 | |
@@ -900,8 +900,8 @@ discard block |
||
900 | 900 | * |
901 | 901 | * @return bool |
902 | 902 | */ |
903 | - public static function save_fields( $options, $option_name = '' ) { |
|
904 | - if ( empty( $_POST ) ) { |
|
903 | + public static function save_fields($options, $option_name = '') { |
|
904 | + if (empty($_POST)) { |
|
905 | 905 | return false; |
906 | 906 | } |
907 | 907 | |
@@ -909,37 +909,37 @@ discard block |
||
909 | 909 | $update_options = array(); |
910 | 910 | |
911 | 911 | // Loop options and get values to save. |
912 | - foreach ( $options as $option ) { |
|
913 | - if ( ! isset( $option['id'] ) || ! isset( $option['type'] ) ) { |
|
912 | + foreach ($options as $option) { |
|
913 | + if ( ! isset($option['id']) || ! isset($option['type'])) { |
|
914 | 914 | continue; |
915 | 915 | } |
916 | 916 | |
917 | 917 | // Get posted value. |
918 | - if ( strstr( $option['id'], '[' ) ) { |
|
919 | - parse_str( $option['id'], $option_name_array ); |
|
920 | - $field_option_name = current( array_keys( $option_name_array ) ); |
|
921 | - $setting_name = key( $option_name_array[ $field_option_name ] ); |
|
922 | - $raw_value = isset( $_POST[ $field_option_name ][ $setting_name ] ) ? wp_unslash( $_POST[ $field_option_name ][ $setting_name ] ) : null; |
|
918 | + if (strstr($option['id'], '[')) { |
|
919 | + parse_str($option['id'], $option_name_array); |
|
920 | + $field_option_name = current(array_keys($option_name_array)); |
|
921 | + $setting_name = key($option_name_array[$field_option_name]); |
|
922 | + $raw_value = isset($_POST[$field_option_name][$setting_name]) ? wp_unslash($_POST[$field_option_name][$setting_name]) : null; |
|
923 | 923 | } else { |
924 | 924 | $field_option_name = $option['id']; |
925 | 925 | $setting_name = ''; |
926 | - $raw_value = isset( $_POST[ $option['id'] ] ) ? wp_unslash( $_POST[ $option['id'] ] ) : null; |
|
926 | + $raw_value = isset($_POST[$option['id']]) ? wp_unslash($_POST[$option['id']]) : null; |
|
927 | 927 | } |
928 | 928 | |
929 | 929 | // Format the value based on option type. |
930 | - switch ( $option['type'] ) { |
|
930 | + switch ($option['type']) { |
|
931 | 931 | case 'checkbox' : |
932 | - $value = is_null( $raw_value ) ? '' : 'on'; |
|
932 | + $value = is_null($raw_value) ? '' : 'on'; |
|
933 | 933 | break; |
934 | 934 | case 'wysiwyg' : |
935 | 935 | case 'textarea' : |
936 | - $value = wp_kses_post( trim( $raw_value ) ); |
|
936 | + $value = wp_kses_post(trim($raw_value)); |
|
937 | 937 | break; |
938 | 938 | case 'multiselect' : |
939 | - $value = array_filter( array_map( 'give_clean', (array) $raw_value ) ); |
|
939 | + $value = array_filter(array_map('give_clean', (array) $raw_value)); |
|
940 | 940 | break; |
941 | 941 | default : |
942 | - $value = give_clean( $raw_value ); |
|
942 | + $value = give_clean($raw_value); |
|
943 | 943 | break; |
944 | 944 | } |
945 | 945 | |
@@ -948,37 +948,37 @@ discard block |
||
948 | 948 | * |
949 | 949 | * @since 1.8 |
950 | 950 | */ |
951 | - $value = apply_filters( 'give_admin_settings_sanitize_option', $value, $option, $raw_value ); |
|
951 | + $value = apply_filters('give_admin_settings_sanitize_option', $value, $option, $raw_value); |
|
952 | 952 | |
953 | 953 | /** |
954 | 954 | * Sanitize the value of an option by option name. |
955 | 955 | * |
956 | 956 | * @since 1.8 |
957 | 957 | */ |
958 | - $value = apply_filters( "give_admin_settings_sanitize_option_{$field_option_name}", $value, $option, $raw_value ); |
|
958 | + $value = apply_filters("give_admin_settings_sanitize_option_{$field_option_name}", $value, $option, $raw_value); |
|
959 | 959 | |
960 | - if ( is_null( $value ) ) { |
|
960 | + if (is_null($value)) { |
|
961 | 961 | continue; |
962 | 962 | } |
963 | 963 | |
964 | 964 | // Check if option is an array and handle that differently to single values. |
965 | - if ( $field_option_name && $setting_name ) { |
|
966 | - if ( ! isset( $update_options[ $field_option_name ] ) ) { |
|
967 | - $update_options[ $field_option_name ] = get_option( $field_option_name, array() ); |
|
965 | + if ($field_option_name && $setting_name) { |
|
966 | + if ( ! isset($update_options[$field_option_name])) { |
|
967 | + $update_options[$field_option_name] = get_option($field_option_name, array()); |
|
968 | 968 | } |
969 | - if ( ! is_array( $update_options[ $field_option_name ] ) ) { |
|
970 | - $update_options[ $field_option_name ] = array(); |
|
969 | + if ( ! is_array($update_options[$field_option_name])) { |
|
970 | + $update_options[$field_option_name] = array(); |
|
971 | 971 | } |
972 | - $update_options[ $field_option_name ][ $setting_name ] = $value; |
|
972 | + $update_options[$field_option_name][$setting_name] = $value; |
|
973 | 973 | } else { |
974 | - $update_options[ $field_option_name ] = $value; |
|
974 | + $update_options[$field_option_name] = $value; |
|
975 | 975 | } |
976 | 976 | } |
977 | 977 | |
978 | 978 | // Save all options in our array or there own option name i.e. option id. |
979 | - if ( empty( $option_name ) ) { |
|
980 | - foreach ( $update_options as $name => $value ) { |
|
981 | - update_option( $name, $value ); |
|
979 | + if (empty($option_name)) { |
|
980 | + foreach ($update_options as $name => $value) { |
|
981 | + update_option($name, $value); |
|
982 | 982 | |
983 | 983 | /** |
984 | 984 | * Trigger action. |
@@ -987,13 +987,13 @@ discard block |
||
987 | 987 | * |
988 | 988 | * @since 1.8 |
989 | 989 | */ |
990 | - do_action( "give_save_option_{$name}", $value, $name ); |
|
990 | + do_action("give_save_option_{$name}", $value, $name); |
|
991 | 991 | } |
992 | 992 | } else { |
993 | - $old_options = ( $old_options = get_option( $option_name ) ) ? $old_options : array(); |
|
994 | - $update_options = array_merge( $old_options, $update_options ); |
|
993 | + $old_options = ($old_options = get_option($option_name)) ? $old_options : array(); |
|
994 | + $update_options = array_merge($old_options, $update_options); |
|
995 | 995 | |
996 | - update_option( $option_name, $update_options ); |
|
996 | + update_option($option_name, $update_options); |
|
997 | 997 | |
998 | 998 | /** |
999 | 999 | * Trigger action. |
@@ -1002,7 +1002,7 @@ discard block |
||
1002 | 1002 | * |
1003 | 1003 | * @since 1.8 |
1004 | 1004 | */ |
1005 | - do_action( "give_save_settings_{$option_name}", $update_options, $option_name ); |
|
1005 | + do_action("give_save_settings_{$option_name}", $update_options, $option_name); |
|
1006 | 1006 | } |
1007 | 1007 | |
1008 | 1008 | return true; |
@@ -1031,17 +1031,17 @@ discard block |
||
1031 | 1031 | * |
1032 | 1032 | * @return bool |
1033 | 1033 | */ |
1034 | - public static function is_setting_page( $tab = '', $section = '' ) { |
|
1034 | + public static function is_setting_page($tab = '', $section = '') { |
|
1035 | 1035 | $is_setting_page = false; |
1036 | 1036 | |
1037 | 1037 | // Check fo setting tab. |
1038 | - if ( ! empty( $tab ) ) { |
|
1039 | - $is_setting_page = ( $tab === give_get_current_setting_tab() ); |
|
1038 | + if ( ! empty($tab)) { |
|
1039 | + $is_setting_page = ($tab === give_get_current_setting_tab()); |
|
1040 | 1040 | } |
1041 | 1041 | |
1042 | 1042 | // Check fo setting section. |
1043 | - if ( ! empty( $section ) ) { |
|
1044 | - $is_setting_page = ( $section === give_get_current_setting_section() ); |
|
1043 | + if ( ! empty($section)) { |
|
1044 | + $is_setting_page = ($section === give_get_current_setting_section()); |
|
1045 | 1045 | } |
1046 | 1046 | |
1047 | 1047 | return $is_setting_page; |
@@ -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 | |
@@ -23,19 +23,19 @@ discard block |
||
23 | 23 | * |
24 | 24 | * @return array An array of updated action links. |
25 | 25 | */ |
26 | -function give_plugin_action_links( $actions ) { |
|
26 | +function give_plugin_action_links($actions) { |
|
27 | 27 | $new_actions = array( |
28 | 28 | 'settings' => sprintf( |
29 | 29 | '<a href="%1$s">%2$s</a>', |
30 | - admin_url( 'edit.php?post_type=give_forms&page=give-settings' ), |
|
31 | - __( 'Settings', 'give' ) |
|
30 | + admin_url('edit.php?post_type=give_forms&page=give-settings'), |
|
31 | + __('Settings', 'give') |
|
32 | 32 | ), |
33 | 33 | ); |
34 | 34 | |
35 | - return array_merge( $new_actions, $actions ); |
|
35 | + return array_merge($new_actions, $actions); |
|
36 | 36 | } |
37 | 37 | |
38 | -add_filter( 'plugin_action_links_' . GIVE_PLUGIN_BASENAME, 'give_plugin_action_links' ); |
|
38 | +add_filter('plugin_action_links_'.GIVE_PLUGIN_BASENAME, 'give_plugin_action_links'); |
|
39 | 39 | |
40 | 40 | |
41 | 41 | /** |
@@ -48,38 +48,38 @@ discard block |
||
48 | 48 | * |
49 | 49 | * @return array |
50 | 50 | */ |
51 | -function give_plugin_row_meta( $plugin_meta, $plugin_file ) { |
|
52 | - if ( $plugin_file != GIVE_PLUGIN_BASENAME ) { |
|
51 | +function give_plugin_row_meta($plugin_meta, $plugin_file) { |
|
52 | + if ($plugin_file != GIVE_PLUGIN_BASENAME) { |
|
53 | 53 | return $plugin_meta; |
54 | 54 | } |
55 | 55 | |
56 | 56 | $new_meta_links = array( |
57 | 57 | sprintf( |
58 | 58 | '<a href="%1$s" target="_blank">%2$s</a>', |
59 | - esc_url( add_query_arg( array( |
|
59 | + esc_url(add_query_arg(array( |
|
60 | 60 | 'utm_source' => 'plugins-page', |
61 | 61 | 'utm_medium' => 'plugin-row', |
62 | 62 | 'utm_campaign' => 'admin', |
63 | - ), 'https://givewp.com/documentation/' ) |
|
63 | + ), 'https://givewp.com/documentation/') |
|
64 | 64 | ), |
65 | - __( 'Documentation', 'give' ) |
|
65 | + __('Documentation', 'give') |
|
66 | 66 | ), |
67 | 67 | sprintf( |
68 | 68 | '<a href="%1$s" target="_blank">%2$s</a>', |
69 | - esc_url( add_query_arg( array( |
|
69 | + esc_url(add_query_arg(array( |
|
70 | 70 | 'utm_source' => 'plugins-page', |
71 | 71 | 'utm_medium' => 'plugin-row', |
72 | 72 | 'utm_campaign' => 'admin', |
73 | - ), 'https://givewp.com/addons/' ) |
|
73 | + ), 'https://givewp.com/addons/') |
|
74 | 74 | ), |
75 | - __( 'Add-ons', 'give' ) |
|
75 | + __('Add-ons', 'give') |
|
76 | 76 | ), |
77 | 77 | ); |
78 | 78 | |
79 | - return array_merge( $plugin_meta, $new_meta_links ); |
|
79 | + return array_merge($plugin_meta, $new_meta_links); |
|
80 | 80 | } |
81 | 81 | |
82 | -add_filter( 'plugin_row_meta', 'give_plugin_row_meta', 10, 2 ); |
|
82 | +add_filter('plugin_row_meta', 'give_plugin_row_meta', 10, 2); |
|
83 | 83 | |
84 | 84 | |
85 | 85 | /** |
@@ -97,19 +97,18 @@ discard block |
||
97 | 97 | $title = ''; |
98 | 98 | global $submenu, $plugin_page; |
99 | 99 | |
100 | - foreach ( array_keys( $submenu ) as $parent ) { |
|
101 | - if( 'edit.php?post_type=give_forms' !== $parent ) { |
|
100 | + foreach (array_keys($submenu) as $parent) { |
|
101 | + if ('edit.php?post_type=give_forms' !== $parent) { |
|
102 | 102 | continue; |
103 | 103 | } |
104 | 104 | |
105 | - foreach ( $submenu[ $parent ] as $submenu_array ) { |
|
106 | - if( $plugin_page !== $submenu_array[2] ){ |
|
105 | + foreach ($submenu[$parent] as $submenu_array) { |
|
106 | + if ($plugin_page !== $submenu_array[2]) { |
|
107 | 107 | continue; |
108 | 108 | } |
109 | 109 | |
110 | - $title = isset( $submenu_array[0] ) ? |
|
111 | - $submenu_array[0] : |
|
112 | - $submenu_array[3]; |
|
110 | + $title = isset($submenu_array[0]) ? |
|
111 | + $submenu_array[0] : $submenu_array[3]; |
|
113 | 112 | } |
114 | 113 | } |
115 | 114 |
@@ -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; |
@@ -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_Display' ) ) : |
|
16 | +if ( ! class_exists('Give_Settings_Display')) : |
|
17 | 17 | |
18 | 18 | /** |
19 | 19 | * Give_Settings_Display. |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | */ |
28 | 28 | public function __construct() { |
29 | 29 | $this->id = 'display'; |
30 | - $this->label = __( 'Display Options', 'give' ); |
|
30 | + $this->label = __('Display Options', 'give'); |
|
31 | 31 | |
32 | 32 | $this->default_tab = 'display-settings'; |
33 | 33 | |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | $settings = array(); |
45 | 45 | $current_section = give_get_current_setting_section(); |
46 | 46 | |
47 | - switch ( $current_section ) { |
|
47 | + switch ($current_section) { |
|
48 | 48 | case 'display-settings' : |
49 | 49 | $settings = array( |
50 | 50 | // Section 1: Display |
@@ -53,55 +53,55 @@ discard block |
||
53 | 53 | 'type' => 'title', |
54 | 54 | ), |
55 | 55 | array( |
56 | - 'name' => __( 'Default Give Styles', 'give' ), |
|
57 | - 'desc' => __( 'You can disable Give\'s default styles for donation forms and other frontend elements.', 'give' ), |
|
56 | + 'name' => __('Default Give Styles', 'give'), |
|
57 | + 'desc' => __('You can disable Give\'s default styles for donation forms and other frontend elements.', 'give'), |
|
58 | 58 | 'id' => 'css', |
59 | 59 | 'type' => 'radio_inline', |
60 | 60 | 'default' => 'enabled', |
61 | 61 | 'options' => array( |
62 | - 'enabled' => __( 'Enabled', 'give' ), |
|
63 | - 'disabled' => __( 'Disabled', 'give' ), |
|
62 | + 'enabled' => __('Enabled', 'give'), |
|
63 | + 'disabled' => __('Disabled', 'give'), |
|
64 | 64 | ), |
65 | 65 | ), |
66 | 66 | array( |
67 | - 'name' => __( 'Floating Labels', 'give' ), |
|
67 | + 'name' => __('Floating Labels', 'give'), |
|
68 | 68 | /* translators: %s: http://docs.givewp.com/form-floating-labels */ |
69 | - 'desc' => sprintf( wp_kses( __( '<a href="%s" target="_blank">Floating labels</a> allows your labels to be inset within the form fields to provide a cleaner form appearance. Note that if the "Disable CSS" option is enabled, you will need to style the floating labels yourself.', 'give' ), array( |
|
69 | + 'desc' => sprintf(wp_kses(__('<a href="%s" target="_blank">Floating labels</a> allows your labels to be inset within the form fields to provide a cleaner form appearance. Note that if the "Disable CSS" option is enabled, you will need to style the floating labels yourself.', 'give'), array( |
|
70 | 70 | 'a' => array( |
71 | 71 | 'href' => array(), |
72 | 72 | 'target' => array(), |
73 | 73 | ), |
74 | - ) ), esc_url( 'http://docs.givewp.com/form-floating-labels' ) ), |
|
74 | + )), esc_url('http://docs.givewp.com/form-floating-labels')), |
|
75 | 75 | 'id' => 'floatlabels', |
76 | 76 | 'type' => 'radio_inline', |
77 | 77 | 'default' => 'disabled', |
78 | 78 | 'options' => array( |
79 | - 'enabled' => __( 'Enabled', 'give' ), |
|
80 | - 'disabled' => __( 'Disabled', 'give' ), |
|
79 | + 'enabled' => __('Enabled', 'give'), |
|
80 | + 'disabled' => __('Disabled', 'give'), |
|
81 | 81 | ), |
82 | 82 | ), |
83 | 83 | array( |
84 | - 'name' => __( 'Welcome Screen', 'give' ), |
|
84 | + 'name' => __('Welcome Screen', 'give'), |
|
85 | 85 | /* translators: %s: about page URL */ |
86 | - 'desc' => sprintf( wp_kses( __( 'Enable this option if you would like to disable the <a href="%s" target="_blank">Give Welcome screen</a> that displays each time Give is activated or updated.', 'give' ), array( |
|
86 | + 'desc' => sprintf(wp_kses(__('Enable this option if you would like to disable the <a href="%s" target="_blank">Give Welcome screen</a> that displays each time Give is activated or updated.', 'give'), array( |
|
87 | 87 | 'a' => array( |
88 | 88 | 'href' => array(), |
89 | 89 | 'target' => array(), |
90 | 90 | ), |
91 | - ) ), esc_url( admin_url( 'index.php?page=give-about' ) ) ), |
|
91 | + )), esc_url(admin_url('index.php?page=give-about'))), |
|
92 | 92 | 'id' => 'welcome', |
93 | 93 | 'type' => 'radio_inline', |
94 | 94 | 'default' => 'enabled', |
95 | 95 | 'options' => array( |
96 | - 'enabled' => __( 'Enabled', 'give' ), |
|
97 | - 'disabled' => __( 'Disabled', 'give' ), |
|
96 | + 'enabled' => __('Enabled', 'give'), |
|
97 | + 'disabled' => __('Disabled', 'give'), |
|
98 | 98 | ), |
99 | 99 | ), |
100 | 100 | array( |
101 | - 'name' => __( 'Display Settings Docs Link', 'give' ), |
|
101 | + 'name' => __('Display Settings Docs Link', 'give'), |
|
102 | 102 | 'id' => 'display_settings_docs_link', |
103 | - 'url' => esc_url( 'http://docs.givewp.com/form-display-options' ), |
|
104 | - 'title' => __( 'Display Options Settings', 'give' ), |
|
103 | + 'url' => esc_url('http://docs.givewp.com/form-display-options'), |
|
104 | + 'title' => __('Display Options Settings', 'give'), |
|
105 | 105 | 'type' => 'give_docs_link', |
106 | 106 | ), |
107 | 107 | array( |
@@ -118,78 +118,78 @@ discard block |
||
118 | 118 | 'type' => 'title', |
119 | 119 | ), |
120 | 120 | array( |
121 | - 'name' => __( 'Form Single Views', 'give' ), |
|
122 | - 'desc' => __( 'By default, all donation form have single views enabled which creates a specific URL on your website for that form. This option disables the singular posts from being publicly viewable. Note: you will need to embed forms using a shortcode or widget if enabled.', 'give' ), |
|
121 | + 'name' => __('Form Single Views', 'give'), |
|
122 | + 'desc' => __('By default, all donation form have single views enabled which creates a specific URL on your website for that form. This option disables the singular posts from being publicly viewable. Note: you will need to embed forms using a shortcode or widget if enabled.', 'give'), |
|
123 | 123 | 'id' => 'forms_singular', |
124 | 124 | 'type' => 'radio_inline', |
125 | 125 | 'default' => 'enabled', |
126 | 126 | 'options' => array( |
127 | - 'enabled' => __( 'Enabled', 'give' ), |
|
128 | - 'disabled' => __( 'Disabled', 'give' ), |
|
127 | + 'enabled' => __('Enabled', 'give'), |
|
128 | + 'disabled' => __('Disabled', 'give'), |
|
129 | 129 | ), |
130 | 130 | ), |
131 | 131 | array( |
132 | - 'name' => __( 'Form Archives', 'give' ), |
|
133 | - 'desc' => sprintf( wp_kses( __( 'Archives pages list all the donation forms you have created. This option will disable only the form\'s archive page(s). The single form\'s view will remain in place. Note: you will need to <a href="%s">refresh your permalinks</a> after this option has been enabled.', 'give' ), array( |
|
132 | + 'name' => __('Form Archives', 'give'), |
|
133 | + 'desc' => sprintf(wp_kses(__('Archives pages list all the donation forms you have created. This option will disable only the form\'s archive page(s). The single form\'s view will remain in place. Note: you will need to <a href="%s">refresh your permalinks</a> after this option has been enabled.', 'give'), array( |
|
134 | 134 | 'a' => array( |
135 | 135 | 'href' => array(), |
136 | 136 | 'target' => array(), |
137 | 137 | ), |
138 | - ) ), esc_url( admin_url( 'options-permalink.php' ) ) ), |
|
138 | + )), esc_url(admin_url('options-permalink.php'))), |
|
139 | 139 | 'id' => 'forms_archives', |
140 | 140 | 'type' => 'radio_inline', |
141 | 141 | 'default' => 'enabled', |
142 | 142 | 'options' => array( |
143 | - 'enabled' => __( 'Enabled', 'give' ), |
|
144 | - 'disabled' => __( 'Disabled', 'give' ), |
|
143 | + 'enabled' => __('Enabled', 'give'), |
|
144 | + 'disabled' => __('Disabled', 'give'), |
|
145 | 145 | ), |
146 | 146 | ), |
147 | 147 | array( |
148 | - 'name' => __( 'Form Excerpts', 'give' ), |
|
149 | - 'desc' => __( 'The excerpt is an optional summary or description of a donation form; in short, a summary as to why the user should give.', 'give' ), |
|
148 | + 'name' => __('Form Excerpts', 'give'), |
|
149 | + 'desc' => __('The excerpt is an optional summary or description of a donation form; in short, a summary as to why the user should give.', 'give'), |
|
150 | 150 | 'id' => 'forms_excerpt', |
151 | 151 | 'type' => 'radio_inline', |
152 | 152 | 'default' => 'enabled', |
153 | 153 | 'options' => array( |
154 | - 'enabled' => __( 'Enabled', 'give' ), |
|
155 | - 'disabled' => __( 'Disabled', 'give' ), |
|
154 | + 'enabled' => __('Enabled', 'give'), |
|
155 | + 'disabled' => __('Disabled', 'give'), |
|
156 | 156 | ), |
157 | 157 | ), |
158 | 158 | array( |
159 | - 'name' => __( 'Form Featured Image', 'give' ), |
|
160 | - 'desc' => __( 'If you do not wish to use the featured image functionality you can disable it using this option and it will not be displayed for single donation forms.', 'give' ), |
|
159 | + 'name' => __('Form Featured Image', 'give'), |
|
160 | + 'desc' => __('If you do not wish to use the featured image functionality you can disable it using this option and it will not be displayed for single donation forms.', 'give'), |
|
161 | 161 | 'id' => 'form_featured_img', |
162 | 162 | 'type' => 'radio_inline', |
163 | 163 | 'default' => 'enabled', |
164 | 164 | 'options' => array( |
165 | - 'enabled' => __( 'Enabled', 'give' ), |
|
166 | - 'disabled' => __( 'Disabled', 'give' ), |
|
165 | + 'enabled' => __('Enabled', 'give'), |
|
166 | + 'disabled' => __('Disabled', 'give'), |
|
167 | 167 | ), |
168 | 168 | ), |
169 | 169 | array( |
170 | - 'name' => __( 'Featured Image Size', 'give' ), |
|
171 | - 'desc' => __( 'The Featured Image is an image that is chosen as the representative image for a donation form. Some themes may have custom featured image sizes. Please select the size you would like to display for your single donation form\'s featured image.', 'give' ), |
|
170 | + 'name' => __('Featured Image Size', 'give'), |
|
171 | + 'desc' => __('The Featured Image is an image that is chosen as the representative image for a donation form. Some themes may have custom featured image sizes. Please select the size you would like to display for your single donation form\'s featured image.', 'give'), |
|
172 | 172 | 'id' => 'featured_image_size', |
173 | 173 | 'type' => 'select', |
174 | 174 | 'default' => 'large', |
175 | 175 | 'options' => give_get_featured_image_sizes(), |
176 | 176 | ), |
177 | 177 | array( |
178 | - 'name' => __( 'Single Form Sidebar', 'give' ), |
|
179 | - 'desc' => __( 'The sidebar allows you to add additional widgets to the Give single form view. If you don\'t plan on using the sidebar you may disable it with this option.', 'give' ), |
|
178 | + 'name' => __('Single Form Sidebar', 'give'), |
|
179 | + 'desc' => __('The sidebar allows you to add additional widgets to the Give single form view. If you don\'t plan on using the sidebar you may disable it with this option.', 'give'), |
|
180 | 180 | 'id' => 'form_sidebar', |
181 | 181 | 'type' => 'radio_inline', |
182 | 182 | 'default' => 'enabled', |
183 | 183 | 'options' => array( |
184 | - 'enabled' => __( 'Enabled', 'give' ), |
|
185 | - 'disabled' => __( 'Disabled', 'give' ), |
|
184 | + 'enabled' => __('Enabled', 'give'), |
|
185 | + 'disabled' => __('Disabled', 'give'), |
|
186 | 186 | ), |
187 | 187 | ), |
188 | 188 | array( |
189 | - 'name' => __( 'Post Types Docs Link', 'give' ), |
|
189 | + 'name' => __('Post Types Docs Link', 'give'), |
|
190 | 190 | 'id' => 'post_types_settings_docs_link', |
191 | - 'url' => esc_url( 'http://docs.givewp.com/settings-post-types' ), |
|
192 | - 'title' => __( 'Post Types Settings', 'give' ), |
|
191 | + 'url' => esc_url('http://docs.givewp.com/settings-post-types'), |
|
192 | + 'title' => __('Post Types Settings', 'give'), |
|
193 | 193 | 'type' => 'give_docs_link', |
194 | 194 | ), |
195 | 195 | array( |
@@ -206,32 +206,32 @@ discard block |
||
206 | 206 | 'type' => 'title', |
207 | 207 | ), |
208 | 208 | array( |
209 | - 'name' => __( 'Form Categories', 'give' ), |
|
210 | - 'desc' => __( 'Enable Categories for all Give forms.', 'give' ), |
|
209 | + 'name' => __('Form Categories', 'give'), |
|
210 | + 'desc' => __('Enable Categories for all Give forms.', 'give'), |
|
211 | 211 | 'id' => 'categories', |
212 | 212 | 'type' => 'radio_inline', |
213 | 213 | 'default' => 'disabled', |
214 | 214 | 'options' => array( |
215 | - 'enabled' => __( 'Enabled', 'give' ), |
|
216 | - 'disabled' => __( 'Disabled', 'give' ), |
|
215 | + 'enabled' => __('Enabled', 'give'), |
|
216 | + 'disabled' => __('Disabled', 'give'), |
|
217 | 217 | ), |
218 | 218 | ), |
219 | 219 | array( |
220 | - 'name' => __( 'Form Tags', 'give' ), |
|
221 | - 'desc' => __( 'Enable Tags for all Give forms.', 'give' ), |
|
220 | + 'name' => __('Form Tags', 'give'), |
|
221 | + 'desc' => __('Enable Tags for all Give forms.', 'give'), |
|
222 | 222 | 'id' => 'tags', |
223 | 223 | 'type' => 'radio_inline', |
224 | 224 | 'default' => 'disabled', |
225 | 225 | 'options' => array( |
226 | - 'enabled' => __( 'Enabled', 'give' ), |
|
227 | - 'disabled' => __( 'Disabled', 'give' ), |
|
226 | + 'enabled' => __('Enabled', 'give'), |
|
227 | + 'disabled' => __('Disabled', 'give'), |
|
228 | 228 | ), |
229 | 229 | ), |
230 | 230 | array( |
231 | - 'name' => __( 'Taxonomies Docs Link', 'give' ), |
|
231 | + 'name' => __('Taxonomies Docs Link', 'give'), |
|
232 | 232 | 'id' => 'taxonomies_settings_docs_link', |
233 | - 'url' => esc_url( 'http://docs.givewp.com/settings-taxonomies' ), |
|
234 | - 'title' => __( 'Taxonomies Settings', 'give' ), |
|
233 | + 'url' => esc_url('http://docs.givewp.com/settings-taxonomies'), |
|
234 | + 'title' => __('Taxonomies Settings', 'give'), |
|
235 | 235 | 'type' => 'give_docs_link', |
236 | 236 | ), |
237 | 237 | array( |
@@ -248,36 +248,36 @@ discard block |
||
248 | 248 | 'type' => 'title', |
249 | 249 | ), |
250 | 250 | array( |
251 | - 'name' => __( 'Terms and Conditions', 'give' ), |
|
252 | - 'desc' => __( 'Would you like donors to require that donors agree to your terms when donating? Note: You can enable/disable this option and customize the terms per form as well.', 'give' ), |
|
251 | + 'name' => __('Terms and Conditions', 'give'), |
|
252 | + 'desc' => __('Would you like donors to require that donors agree to your terms when donating? Note: You can enable/disable this option and customize the terms per form as well.', 'give'), |
|
253 | 253 | 'id' => 'terms', |
254 | 254 | 'type' => 'radio_inline', |
255 | 255 | 'default' => 'disabled', |
256 | 256 | 'options' => array( |
257 | - 'enabled' => __( 'Enabled', 'give' ), |
|
258 | - 'disabled' => __( 'Disabled', 'give' ), |
|
257 | + 'enabled' => __('Enabled', 'give'), |
|
258 | + 'disabled' => __('Disabled', 'give'), |
|
259 | 259 | ), |
260 | 260 | ), |
261 | 261 | array( |
262 | - 'name' => __( 'Agree to Terms Label', 'give' ), |
|
263 | - 'desc' => __( 'The label shown next to the agree to terms check box. Customize it here or leave blank to use the default placeholder text. Note: You can customize the label per form.', 'give' ), |
|
262 | + 'name' => __('Agree to Terms Label', 'give'), |
|
263 | + 'desc' => __('The label shown next to the agree to terms check box. Customize it here or leave blank to use the default placeholder text. Note: You can customize the label per form.', 'give'), |
|
264 | 264 | 'id' => 'agree_to_terms_label', |
265 | 265 | 'attributes' => array( |
266 | - 'placeholder' => esc_attr__( 'Agree to Terms?', 'give' ), |
|
266 | + 'placeholder' => esc_attr__('Agree to Terms?', 'give'), |
|
267 | 267 | ), |
268 | 268 | 'type' => 'text', |
269 | 269 | ), |
270 | 270 | array( |
271 | - 'name' => __( 'Agreement Text', 'give' ), |
|
272 | - 'desc' => __( 'This is the actual text which the user will be asked to agree to in order to donate. Note: You can customize the content per form as needed.', 'give' ), |
|
271 | + 'name' => __('Agreement Text', 'give'), |
|
272 | + 'desc' => __('This is the actual text which the user will be asked to agree to in order to donate. Note: You can customize the content per form as needed.', 'give'), |
|
273 | 273 | 'id' => 'agreement_text', |
274 | 274 | 'type' => 'wysiwyg', |
275 | 275 | ), |
276 | 276 | array( |
277 | - 'name' => __( 'Terms and Conditions Docs Link', 'give' ), |
|
277 | + 'name' => __('Terms and Conditions Docs Link', 'give'), |
|
278 | 278 | 'id' => 'terms_settings_docs_link', |
279 | - 'url' => esc_url( 'http://docs.givewp.com/settings-terms' ), |
|
280 | - 'title' => __( 'Terms and Conditions Settings', 'give' ), |
|
279 | + 'url' => esc_url('http://docs.givewp.com/settings-terms'), |
|
280 | + 'title' => __('Terms and Conditions Settings', 'give'), |
|
281 | 281 | 'type' => 'give_docs_link', |
282 | 282 | ), |
283 | 283 | array( |
@@ -292,7 +292,7 @@ discard block |
||
292 | 292 | * Filter the display options settings. |
293 | 293 | * Backward compatibility: Please do not use this filter. This filter is deprecated in 1.8 |
294 | 294 | */ |
295 | - $settings = apply_filters( 'give_settings_display', $settings ); |
|
295 | + $settings = apply_filters('give_settings_display', $settings); |
|
296 | 296 | |
297 | 297 | /** |
298 | 298 | * Filter the settings. |
@@ -301,7 +301,7 @@ discard block |
||
301 | 301 | * |
302 | 302 | * @param array $settings |
303 | 303 | */ |
304 | - $settings = apply_filters( 'give_get_settings_' . $this->id, $settings ); |
|
304 | + $settings = apply_filters('give_get_settings_'.$this->id, $settings); |
|
305 | 305 | |
306 | 306 | // Output. |
307 | 307 | return $settings; |
@@ -315,13 +315,13 @@ discard block |
||
315 | 315 | */ |
316 | 316 | public function get_sections() { |
317 | 317 | $sections = array( |
318 | - 'display-settings' => __( 'Display', 'give' ), |
|
319 | - 'post-types' => __( 'Post Types', 'give' ), |
|
320 | - 'taxonomies' => __( 'Taxonomies', 'give' ), |
|
321 | - 'term-and-conditions' => __( 'Terms and Conditions', 'give' ), |
|
318 | + 'display-settings' => __('Display', 'give'), |
|
319 | + 'post-types' => __('Post Types', 'give'), |
|
320 | + 'taxonomies' => __('Taxonomies', 'give'), |
|
321 | + 'term-and-conditions' => __('Terms and Conditions', 'give'), |
|
322 | 322 | ); |
323 | 323 | |
324 | - return apply_filters( 'give_get_sections_' . $this->id, $sections ); |
|
324 | + return apply_filters('give_get_sections_'.$this->id, $sections); |
|
325 | 325 | } |
326 | 326 | } |
327 | 327 |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -26,34 +26,34 @@ discard block |
||
26 | 26 | * |
27 | 27 | * @return void |
28 | 28 | */ |
29 | -function give_set_settings_with_disable_prefix( $old_settings, $settings ) { |
|
29 | +function give_set_settings_with_disable_prefix($old_settings, $settings) { |
|
30 | 30 | // Bailout. |
31 | - if ( ! function_exists( 'give_v18_renamed_core_settings' ) ) { |
|
31 | + if ( ! function_exists('give_v18_renamed_core_settings')) { |
|
32 | 32 | return; |
33 | 33 | } |
34 | 34 | |
35 | 35 | // Get old setting names. |
36 | - $old_settings = array_flip( give_v18_renamed_core_settings() ); |
|
36 | + $old_settings = array_flip(give_v18_renamed_core_settings()); |
|
37 | 37 | $update_setting = false; |
38 | 38 | |
39 | - foreach ( $settings as $key => $value ) { |
|
39 | + foreach ($settings as $key => $value) { |
|
40 | 40 | |
41 | 41 | // Check 1. Check if new option is really updated or not. |
42 | 42 | // Check 2. Continue if key is not renamed. |
43 | - if ( ! isset( $old_settings[ $key ] ) ) { |
|
43 | + if ( ! isset($old_settings[$key])) { |
|
44 | 44 | continue; |
45 | 45 | } |
46 | 46 | |
47 | 47 | // Set old setting. |
48 | - $settings[ $old_settings[ $key ] ] = 'on'; |
|
48 | + $settings[$old_settings[$key]] = 'on'; |
|
49 | 49 | |
50 | 50 | // Do not need to set old setting if new setting is not set. |
51 | 51 | if ( |
52 | - ( give_is_setting_enabled( $value ) && ( false !== strpos( $old_settings[ $key ], 'disable_' ) ) ) |
|
53 | - || ( ! give_is_setting_enabled( $value ) && ( false !== strpos( $old_settings[ $key ], 'enable_' ) ) ) |
|
52 | + (give_is_setting_enabled($value) && (false !== strpos($old_settings[$key], 'disable_'))) |
|
53 | + || ( ! give_is_setting_enabled($value) && (false !== strpos($old_settings[$key], 'enable_'))) |
|
54 | 54 | |
55 | 55 | ) { |
56 | - unset( $settings[ $old_settings[ $key ] ] ); |
|
56 | + unset($settings[$old_settings[$key]]); |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | // Tell bot to update setting. |
@@ -61,12 +61,12 @@ discard block |
||
61 | 61 | } |
62 | 62 | |
63 | 63 | // Update setting if any old setting set. |
64 | - if ( $update_setting ) { |
|
65 | - update_option( 'give_settings', $settings ); |
|
64 | + if ($update_setting) { |
|
65 | + update_option('give_settings', $settings); |
|
66 | 66 | } |
67 | 67 | } |
68 | 68 | |
69 | -add_action( 'update_option_give_settings', 'give_set_settings_with_disable_prefix', 10, 2 ); |
|
69 | +add_action('update_option_give_settings', 'give_set_settings_with_disable_prefix', 10, 2); |
|
70 | 70 | |
71 | 71 | /** |
72 | 72 | * Check spam through Akismet. |
@@ -80,45 +80,45 @@ discard block |
||
80 | 80 | * |
81 | 81 | * @return bool|mixed |
82 | 82 | */ |
83 | -function give_akismet( $spam ) { |
|
83 | +function give_akismet($spam) { |
|
84 | 84 | |
85 | 85 | // Bail out, If spam. |
86 | - if ( $spam ) { |
|
86 | + if ($spam) { |
|
87 | 87 | return $spam; |
88 | 88 | } |
89 | 89 | |
90 | 90 | // Bail out, if Akismet key not exist. |
91 | - if ( ! give_check_akismet_key() ) { |
|
91 | + if ( ! give_check_akismet_key()) { |
|
92 | 92 | return false; |
93 | 93 | } |
94 | 94 | |
95 | 95 | // Build args array. |
96 | 96 | $args = array(); |
97 | 97 | |
98 | - $args['comment_author'] = isset( $_POST['give_first'] ) ? strip_tags( trim( $_POST['give_first'] ) ) : ''; |
|
99 | - $args['comment_author_email'] = isset( $_POST['give_email'] ) ? $_POST['give_email'] : false; |
|
100 | - $args['blog'] = get_option( 'home' ); |
|
98 | + $args['comment_author'] = isset($_POST['give_first']) ? strip_tags(trim($_POST['give_first'])) : ''; |
|
99 | + $args['comment_author_email'] = isset($_POST['give_email']) ? $_POST['give_email'] : false; |
|
100 | + $args['blog'] = get_option('home'); |
|
101 | 101 | $args['blog_lang'] = get_locale(); |
102 | - $args['blog_charset'] = get_option( 'blog_charset' ); |
|
102 | + $args['blog_charset'] = get_option('blog_charset'); |
|
103 | 103 | $args['user_ip'] = $_SERVER['REMOTE_ADDR']; |
104 | 104 | $args['user_agent'] = $_SERVER['HTTP_USER_AGENT']; |
105 | 105 | $args['referrer'] = $_SERVER['HTTP_REFERER']; |
106 | 106 | $args['comment_type'] = 'contact-form'; |
107 | 107 | |
108 | - $ignore = array( 'HTTP_COOKIE', 'HTTP_COOKIE2', 'PHP_AUTH_PW' ); |
|
108 | + $ignore = array('HTTP_COOKIE', 'HTTP_COOKIE2', 'PHP_AUTH_PW'); |
|
109 | 109 | |
110 | - foreach ( $_SERVER as $key => $value ) { |
|
111 | - if ( ! in_array( $key, (array) $ignore ) ) { |
|
110 | + foreach ($_SERVER as $key => $value) { |
|
111 | + if ( ! in_array($key, (array) $ignore)) { |
|
112 | 112 | $args["$key"] = $value; |
113 | 113 | } |
114 | 114 | } |
115 | 115 | |
116 | 116 | // It will return Akismet spam detect API response. |
117 | - return give_akismet_spam_check( $args ); |
|
117 | + return give_akismet_spam_check($args); |
|
118 | 118 | |
119 | 119 | } |
120 | 120 | |
121 | -add_filter( 'give_spam', 'give_akismet' ); |
|
121 | +add_filter('give_spam', 'give_akismet'); |
|
122 | 122 | |
123 | 123 | /** |
124 | 124 | * Check Akismet API Key. |
@@ -128,11 +128,11 @@ discard block |
||
128 | 128 | * @return bool |
129 | 129 | */ |
130 | 130 | function give_check_akismet_key() { |
131 | - if ( is_callable( array( 'Akismet', 'get_api_key' ) ) ) { // Akismet v3.0+ |
|
131 | + if (is_callable(array('Akismet', 'get_api_key'))) { // Akismet v3.0+ |
|
132 | 132 | return (bool) Akismet::get_api_key(); |
133 | 133 | } |
134 | 134 | |
135 | - if ( function_exists( 'akismet_get_key' ) ) { |
|
135 | + if (function_exists('akismet_get_key')) { |
|
136 | 136 | return (bool) akismet_get_key(); |
137 | 137 | } |
138 | 138 | |
@@ -148,26 +148,26 @@ discard block |
||
148 | 148 | * |
149 | 149 | * @return bool|mixed |
150 | 150 | */ |
151 | -function give_akismet_spam_check( $args ) { |
|
151 | +function give_akismet_spam_check($args) { |
|
152 | 152 | global $akismet_api_host, $akismet_api_port; |
153 | 153 | |
154 | 154 | $spam = false; |
155 | - $query_string = http_build_query( $args ); |
|
155 | + $query_string = http_build_query($args); |
|
156 | 156 | |
157 | - if ( is_callable( array( 'Akismet', 'http_post' ) ) ) { // Akismet v3.0+ |
|
158 | - $response = Akismet::http_post( $query_string, 'comment-check' ); |
|
157 | + if (is_callable(array('Akismet', 'http_post'))) { // Akismet v3.0+ |
|
158 | + $response = Akismet::http_post($query_string, 'comment-check'); |
|
159 | 159 | } else { |
160 | - $response = akismet_http_post( $query_string, $akismet_api_host, |
|
161 | - '/1.1/comment-check', $akismet_api_port ); |
|
160 | + $response = akismet_http_post($query_string, $akismet_api_host, |
|
161 | + '/1.1/comment-check', $akismet_api_port); |
|
162 | 162 | } |
163 | 163 | |
164 | 164 | // It's spam if response status is true. |
165 | - if ( 'true' === $response[1] ) { |
|
165 | + if ('true' === $response[1]) { |
|
166 | 166 | $spam = true; |
167 | 167 | } |
168 | 168 | |
169 | 169 | // Allow developer to modified Akismet spam detection response. |
170 | - return apply_filters( 'give_akismet_spam_check', $spam, $args ); |
|
170 | + return apply_filters('give_akismet_spam_check', $spam, $args); |
|
171 | 171 | } |
172 | 172 | |
173 | 173 | /** |
@@ -180,15 +180,15 @@ discard block |
||
180 | 180 | * |
181 | 181 | * @return array |
182 | 182 | */ |
183 | -function give_bc_v1817_iranian_currency_code( $currencies ) { |
|
184 | - if ( ! give_has_upgrade_completed( 'v1817_update_donation_iranian_currency_code' ) ) { |
|
183 | +function give_bc_v1817_iranian_currency_code($currencies) { |
|
184 | + if ( ! give_has_upgrade_completed('v1817_update_donation_iranian_currency_code')) { |
|
185 | 185 | $currencies['RIAL'] = $currencies['IRR']; |
186 | 186 | } |
187 | 187 | |
188 | 188 | return $currencies; |
189 | 189 | } |
190 | 190 | |
191 | -add_filter( 'give_currencies', 'give_bc_v1817_iranian_currency_code', 0 ); |
|
191 | +add_filter('give_currencies', 'give_bc_v1817_iranian_currency_code', 0); |
|
192 | 192 | |
193 | 193 | |
194 | 194 | /** |
@@ -202,22 +202,20 @@ discard block |
||
202 | 202 | * |
203 | 203 | * @return string |
204 | 204 | */ |
205 | -function give_format_price_for_right_to_left_supported_currency( $formatted_amount, $currency_args, $price ) { |
|
206 | - if ( ! give_is_right_to_left_supported_currency( $currency_args['currency_code'] ) ) { |
|
205 | +function give_format_price_for_right_to_left_supported_currency($formatted_amount, $currency_args, $price) { |
|
206 | + if ( ! give_is_right_to_left_supported_currency($currency_args['currency_code'])) { |
|
207 | 207 | return $formatted_amount; |
208 | 208 | } |
209 | 209 | |
210 | 210 | $formatted_amount = ( |
211 | 211 | 'before' === (string) $currency_args['position'] ? |
212 | - '‫' . $price . $currency_args['symbol'] . '‬' : |
|
213 | - '‪' . $price . $currency_args['symbol'] . '‬' |
|
212 | + '‫'.$price.$currency_args['symbol'].'‬' : '‪'.$price.$currency_args['symbol'].'‬' |
|
214 | 213 | ); |
215 | 214 | |
216 | 215 | $formatted_amount = $currency_args['decode_currency'] ? |
217 | - html_entity_decode( $formatted_amount, ENT_COMPAT, 'UTF-8' ) : |
|
218 | - $formatted_amount; |
|
216 | + html_entity_decode($formatted_amount, ENT_COMPAT, 'UTF-8') : $formatted_amount; |
|
219 | 217 | |
220 | 218 | return $formatted_amount; |
221 | 219 | } |
222 | 220 | |
223 | -add_filter( 'give_currency_filter', 'give_format_price_for_right_to_left_supported_currency', 10, 3 ); |
|
224 | 221 | \ No newline at end of file |
222 | +add_filter('give_currency_filter', 'give_format_price_for_right_to_left_supported_currency', 10, 3); |
|
225 | 223 | \ No newline at end of file |
@@ -186,7 +186,8 @@ discard block |
||
186 | 186 | __( 'View', 'give' ) . ' ' . give_get_payment_status( $post, true ) . ' »' |
187 | 187 | ); |
188 | 188 | |
189 | - else : |
|
189 | + else { |
|
190 | + : |
|
190 | 191 | echo sprintf( |
191 | 192 | '<a href="%1$s">%2$s</a>', |
192 | 193 | esc_url( |
@@ -198,6 +199,7 @@ discard block |
||
198 | 199 | ), |
199 | 200 | __( 'View Receipt »', 'give' ) |
200 | 201 | ); |
202 | + } |
|
201 | 203 | |
202 | 204 | endif; |
203 | 205 | ?> |
@@ -242,6 +244,9 @@ discard block |
||
242 | 244 | </div> |
243 | 245 | </div> |
244 | 246 | <?php wp_reset_postdata(); ?> |
245 | -<?php else : ?> |
|
246 | - <?php Give()->notices->print_frontend_notice( __( 'It looks like you haven\'t made any donations.', 'give' ), true, 'success' ); ?> |
|
247 | +<?php else { |
|
248 | + : ?> |
|
249 | + <?php Give()->notices->print_frontend_notice( __( 'It looks like you haven\'t made any donations.', 'give' ), true, 'success' ); |
|
250 | +} |
|
251 | +?> |
|
247 | 252 | <?php endif; |
248 | 253 | \ No newline at end of file |
@@ -4,56 +4,56 @@ discard block |
||
4 | 4 | */ |
5 | 5 | |
6 | 6 | $donations = array(); |
7 | -$donation_history_args = Give()->session->get( 'give_donation_history_args' ); |
|
7 | +$donation_history_args = Give()->session->get('give_donation_history_args'); |
|
8 | 8 | |
9 | 9 | // User's Donations. |
10 | -if ( is_user_logged_in() ) { |
|
11 | - $donations = give_get_users_donations( get_current_user_id(), 20, true, 'any' ); |
|
12 | -} elseif ( Give()->email_access->token_exists ) { |
|
10 | +if (is_user_logged_in()) { |
|
11 | + $donations = give_get_users_donations(get_current_user_id(), 20, true, 'any'); |
|
12 | +} elseif (Give()->email_access->token_exists) { |
|
13 | 13 | // Email Access Token? |
14 | - $donations = give_get_users_donations( 0, 20, true, 'any' ); |
|
14 | + $donations = give_get_users_donations(0, 20, true, 'any'); |
|
15 | 15 | } elseif ( |
16 | 16 | false !== Give()->session->get_session_expiration() || |
17 | 17 | true === give_get_history_session() |
18 | 18 | ) { |
19 | 19 | // Session active? |
20 | - $email = Give()->session->get( 'give_email' ); |
|
21 | - $donor = Give()->donors->get_donor_by( 'email', $email ); |
|
22 | - $donations_count = count( explode( ',', $donor->payment_ids ) ); |
|
20 | + $email = Give()->session->get('give_email'); |
|
21 | + $donor = Give()->donors->get_donor_by('email', $email); |
|
22 | + $donations_count = count(explode(',', $donor->payment_ids)); |
|
23 | 23 | |
24 | - if( $donations_count > give_get_limit_display_donations() ) { |
|
24 | + if ($donations_count > give_get_limit_display_donations()) { |
|
25 | 25 | |
26 | 26 | // Restrict Security Email Access option, if donation count of a donor is less than or equal to limit. |
27 | - if( true !== Give_Cache::get( "give_cache_email_throttle_limit_exhausted_{$donor->id}" ) ) { |
|
28 | - add_action( 'give_donation_history_table_end', 'give_donation_history_table_end' ); |
|
27 | + if (true !== Give_Cache::get("give_cache_email_throttle_limit_exhausted_{$donor->id}")) { |
|
28 | + add_action('give_donation_history_table_end', 'give_donation_history_table_end'); |
|
29 | 29 | } else { |
30 | 30 | $value = Give()->email_access->verify_throttle / 60; |
31 | 31 | |
32 | - give_set_error( 'give-limited-throttle', sprintf( |
|
33 | - __( 'Too many access email requests detected. Please wait %s before requesting a new donation history access link.', 'give' ), |
|
34 | - sprintf( _n( '%s minute', '%s minutes', $value, 'give' ), $value ) |
|
35 | - ) ); |
|
32 | + give_set_error('give-limited-throttle', sprintf( |
|
33 | + __('Too many access email requests detected. Please wait %s before requesting a new donation history access link.', 'give'), |
|
34 | + sprintf(_n('%s minute', '%s minutes', $value, 'give'), $value) |
|
35 | + )); |
|
36 | 36 | |
37 | 37 | } |
38 | 38 | |
39 | - $donations = give_get_users_donations( $email, give_get_limit_display_donations(), true, 'any' ); |
|
39 | + $donations = give_get_users_donations($email, give_get_limit_display_donations(), true, 'any'); |
|
40 | 40 | } else { |
41 | - $donations = give_get_users_donations( $email, 20, true, 'any' ); |
|
41 | + $donations = give_get_users_donations($email, 20, true, 'any'); |
|
42 | 42 | } |
43 | 43 | } |
44 | 44 | |
45 | -Give()->notices->render_frontend_notices( 0 ); |
|
45 | +Give()->notices->render_frontend_notices(0); |
|
46 | 46 | |
47 | -if ( $donations ) : ?> |
|
47 | +if ($donations) : ?> |
|
48 | 48 | <?php |
49 | 49 | $table_headings = array( |
50 | - 'id' => __( 'ID', 'give' ), |
|
51 | - 'date' => __( 'Date', 'give' ), |
|
52 | - 'donor' => __( 'Donor', 'give' ), |
|
53 | - 'amount' => __( 'Amount', 'give' ), |
|
54 | - 'status' => __( 'Status', 'give' ), |
|
55 | - 'payment_method' => __( 'Payment Method', 'give' ), |
|
56 | - 'details' => __( 'Details', 'give' ), |
|
50 | + 'id' => __('ID', 'give'), |
|
51 | + 'date' => __('Date', 'give'), |
|
52 | + 'donor' => __('Donor', 'give'), |
|
53 | + 'amount' => __('Amount', 'give'), |
|
54 | + 'status' => __('Status', 'give'), |
|
55 | + 'payment_method' => __('Payment Method', 'give'), |
|
56 | + 'details' => __('Details', 'give'), |
|
57 | 57 | ); |
58 | 58 | ?> |
59 | 59 | <div class="give_user_history_main" > |
@@ -69,14 +69,14 @@ discard block |
||
69 | 69 | * |
70 | 70 | * @since 1.7 |
71 | 71 | */ |
72 | - do_action( 'give_donation_history_header_before' ); |
|
72 | + do_action('give_donation_history_header_before'); |
|
73 | 73 | |
74 | - foreach ( $donation_history_args as $index => $value ) { |
|
75 | - if ( filter_var( $donation_history_args[ $index ], FILTER_VALIDATE_BOOLEAN ) ) : |
|
74 | + foreach ($donation_history_args as $index => $value) { |
|
75 | + if (filter_var($donation_history_args[$index], FILTER_VALIDATE_BOOLEAN)) : |
|
76 | 76 | echo sprintf( |
77 | 77 | '<th scope="col" class="give-donation-%1$s>">%2$s</th>', |
78 | 78 | $index, |
79 | - $table_headings[ $index ] |
|
79 | + $table_headings[$index] |
|
80 | 80 | ); |
81 | 81 | endif; |
82 | 82 | } |
@@ -88,13 +88,13 @@ discard block |
||
88 | 88 | * |
89 | 89 | * @since 1.7 |
90 | 90 | */ |
91 | - do_action( 'give_donation_history_header_after' ); |
|
91 | + do_action('give_donation_history_header_after'); |
|
92 | 92 | ?> |
93 | 93 | </tr> |
94 | 94 | </thead> |
95 | - <?php foreach ( $donations as $post ) : |
|
96 | - setup_postdata( $post ); |
|
97 | - $donation_data = give_get_payment_meta( $post->ID ); ?> |
|
95 | + <?php foreach ($donations as $post) : |
|
96 | + setup_postdata($post); |
|
97 | + $donation_data = give_get_payment_meta($post->ID); ?> |
|
98 | 98 | <tr class="give-donation-row"> |
99 | 99 | <?php |
100 | 100 | /** |
@@ -107,36 +107,36 @@ discard block |
||
107 | 107 | * @param int $post_id The ID of the post. |
108 | 108 | * @param mixed $donation_data Payment meta data. |
109 | 109 | */ |
110 | - do_action( 'give_donation_history_row_start', $post->ID, $donation_data ); |
|
110 | + do_action('give_donation_history_row_start', $post->ID, $donation_data); |
|
111 | 111 | |
112 | - if ( filter_var( $donation_history_args['id'], FILTER_VALIDATE_BOOLEAN ) ) : |
|
112 | + if (filter_var($donation_history_args['id'], FILTER_VALIDATE_BOOLEAN)) : |
|
113 | 113 | echo sprintf( |
114 | 114 | '<td class="give-donation-id">#%1$s</td>', |
115 | - give_get_payment_number( $post->ID ) |
|
115 | + give_get_payment_number($post->ID) |
|
116 | 116 | ); |
117 | 117 | endif; |
118 | 118 | |
119 | - if ( filter_var( $donation_history_args['date'], FILTER_VALIDATE_BOOLEAN ) ) : |
|
119 | + if (filter_var($donation_history_args['date'], FILTER_VALIDATE_BOOLEAN)) : |
|
120 | 120 | echo sprintf( |
121 | 121 | '<td class="give-donation-date">%1$s</td>', |
122 | - date_i18n( give_date_format(), strtotime( get_post_field( 'post_date', $post->ID ) ) ) |
|
122 | + date_i18n(give_date_format(), strtotime(get_post_field('post_date', $post->ID))) |
|
123 | 123 | ); |
124 | 124 | endif; |
125 | 125 | |
126 | - if ( filter_var( $donation_history_args['donor'], FILTER_VALIDATE_BOOLEAN ) ) : |
|
126 | + if (filter_var($donation_history_args['donor'], FILTER_VALIDATE_BOOLEAN)) : |
|
127 | 127 | echo sprintf( |
128 | 128 | '<td class="give-donation-donor">%1$s</td>', |
129 | - give_get_donor_name_by( $post->ID ) |
|
129 | + give_get_donor_name_by($post->ID) |
|
130 | 130 | ); |
131 | 131 | endif; |
132 | 132 | ?> |
133 | 133 | |
134 | - <?php if ( filter_var( $donation_history_args['amount'], FILTER_VALIDATE_BOOLEAN ) ) : ?> |
|
134 | + <?php if (filter_var($donation_history_args['amount'], FILTER_VALIDATE_BOOLEAN)) : ?> |
|
135 | 135 | <td class="give-donation-amount"> |
136 | 136 | <span class="give-donation-amount"> |
137 | 137 | <?php |
138 | - $currency_code = give_get_payment_currency_code( $post->ID ); |
|
139 | - $donation_amount = give_donation_amount( $post->ID, true ); |
|
138 | + $currency_code = give_get_payment_currency_code($post->ID); |
|
139 | + $donation_amount = give_donation_amount($post->ID, true); |
|
140 | 140 | |
141 | 141 | /** |
142 | 142 | * Filters the donation amount on Donation History Page. |
@@ -148,42 +148,42 @@ discard block |
||
148 | 148 | * |
149 | 149 | * @return int |
150 | 150 | */ |
151 | - echo apply_filters( 'give_donation_history_row_amount', $donation_amount, $post->ID ); |
|
151 | + echo apply_filters('give_donation_history_row_amount', $donation_amount, $post->ID); |
|
152 | 152 | ?> |
153 | 153 | </span> |
154 | 154 | </td> |
155 | 155 | <?php endif; ?> |
156 | 156 | |
157 | 157 | <?php |
158 | - if ( filter_var( $donation_history_args['status'], FILTER_VALIDATE_BOOLEAN ) ) : |
|
158 | + if (filter_var($donation_history_args['status'], FILTER_VALIDATE_BOOLEAN)) : |
|
159 | 159 | echo sprintf( |
160 | 160 | '<td class="give-donation-status">%1$s</td>', |
161 | - give_get_payment_status( $post, true ) |
|
161 | + give_get_payment_status($post, true) |
|
162 | 162 | ); |
163 | 163 | endif; |
164 | 164 | |
165 | - if ( filter_var( $donation_history_args['payment_method'], FILTER_VALIDATE_BOOLEAN ) ) : |
|
165 | + if (filter_var($donation_history_args['payment_method'], FILTER_VALIDATE_BOOLEAN)) : |
|
166 | 166 | echo sprintf( |
167 | 167 | '<td class="give-donation-payment-method">%1$s</td>', |
168 | - give_get_gateway_checkout_label( give_get_payment_gateway( $post->ID ) ) |
|
168 | + give_get_gateway_checkout_label(give_get_payment_gateway($post->ID)) |
|
169 | 169 | ); |
170 | 170 | endif; |
171 | 171 | ?> |
172 | 172 | <td class="give-donation-details"> |
173 | 173 | <?php |
174 | 174 | // Display View Receipt or. |
175 | - if ( 'publish' !== $post->post_status && 'subscription' !== $post->post_status ) : |
|
175 | + if ('publish' !== $post->post_status && 'subscription' !== $post->post_status) : |
|
176 | 176 | echo sprintf( |
177 | 177 | '<a href="%1$s"><span class="give-donation-status %2$s">%3$s</span></a>', |
178 | 178 | esc_url( |
179 | 179 | add_query_arg( |
180 | 180 | 'payment_key', |
181 | - give_get_payment_key( $post->ID ), |
|
181 | + give_get_payment_key($post->ID), |
|
182 | 182 | give_get_history_page_uri() |
183 | 183 | ) |
184 | 184 | ), |
185 | 185 | $post->post_status, |
186 | - __( 'View', 'give' ) . ' ' . give_get_payment_status( $post, true ) . ' »' |
|
186 | + __('View', 'give').' '.give_get_payment_status($post, true).' »' |
|
187 | 187 | ); |
188 | 188 | |
189 | 189 | else : |
@@ -192,11 +192,11 @@ discard block |
||
192 | 192 | esc_url( |
193 | 193 | add_query_arg( |
194 | 194 | 'payment_key', |
195 | - give_get_payment_key( $post->ID ), |
|
195 | + give_get_payment_key($post->ID), |
|
196 | 196 | give_get_history_page_uri() |
197 | 197 | ) |
198 | 198 | ), |
199 | - __( 'View Receipt »', 'give' ) |
|
199 | + __('View Receipt »', 'give') |
|
200 | 200 | ); |
201 | 201 | |
202 | 202 | endif; |
@@ -213,7 +213,7 @@ discard block |
||
213 | 213 | * @param int $post_id The ID of the post. |
214 | 214 | * @param mixed $donation_data Payment meta data. |
215 | 215 | */ |
216 | - do_action( 'give_donation_history_row_end', $post->ID, $donation_data ); |
|
216 | + do_action('give_donation_history_row_end', $post->ID, $donation_data); |
|
217 | 217 | ?> |
218 | 218 | </tr> |
219 | 219 | <?php endforeach; ?> |
@@ -226,22 +226,22 @@ discard block |
||
226 | 226 | * |
227 | 227 | * @since 1.8.17 |
228 | 228 | */ |
229 | - do_action( 'give_donation_history_table_end' ); |
|
229 | + do_action('give_donation_history_table_end'); |
|
230 | 230 | ?> |
231 | 231 | </table> |
232 | 232 | <div id="give-donation-history-pagination" class="give_pagination navigation"> |
233 | 233 | <?php |
234 | 234 | $big = 999999; |
235 | - echo paginate_links( array( |
|
236 | - 'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ), |
|
235 | + echo paginate_links(array( |
|
236 | + 'base' => str_replace($big, '%#%', esc_url(get_pagenum_link($big))), |
|
237 | 237 | 'format' => '?paged=%#%', |
238 | - 'current' => max( 1, get_query_var( 'paged' ) ), |
|
239 | - 'total' => ceil( give_count_donations_of_donor() / 20 ) // 20 items per page |
|
240 | - ) ); |
|
238 | + 'current' => max(1, get_query_var('paged')), |
|
239 | + 'total' => ceil(give_count_donations_of_donor() / 20) // 20 items per page |
|
240 | + )); |
|
241 | 241 | ?> |
242 | 242 | </div> |
243 | 243 | </div> |
244 | 244 | <?php wp_reset_postdata(); ?> |
245 | 245 | <?php else : ?> |
246 | - <?php Give()->notices->print_frontend_notice( __( 'It looks like you haven\'t made any donations.', 'give' ), true, 'success' ); ?> |
|
246 | + <?php Give()->notices->print_frontend_notice(__('It looks like you haven\'t made any donations.', 'give'), true, 'success'); ?> |
|
247 | 247 | <?php endif; |
248 | 248 | \ No newline at end of file |