@@ -9,11 +9,11 @@ discard block |
||
9 | 9 | * @since 1.8 |
10 | 10 | */ |
11 | 11 | |
12 | -if ( ! defined( 'ABSPATH' ) ) { |
|
12 | +if ( ! defined('ABSPATH')) { |
|
13 | 13 | exit; // Exit if accessed directly |
14 | 14 | } |
15 | 15 | |
16 | -if ( ! class_exists( 'Give_Settings_Data' ) ) : |
|
16 | +if ( ! class_exists('Give_Settings_Data')) : |
|
17 | 17 | |
18 | 18 | /** |
19 | 19 | * Give_Settings_Data. |
@@ -43,15 +43,15 @@ discard block |
||
43 | 43 | */ |
44 | 44 | public function __construct() { |
45 | 45 | $this->id = 'data'; |
46 | - $this->label = esc_html__( 'Data', 'give' ); |
|
46 | + $this->label = esc_html__('Data', 'give'); |
|
47 | 47 | |
48 | - add_filter( 'give-tools_tabs_array', array( $this, 'add_settings_page' ), 20 ); |
|
49 | - add_action( "give-tools_settings_{$this->id}_page", array( $this, 'output' ) ); |
|
48 | + add_filter('give-tools_tabs_array', array($this, 'add_settings_page'), 20); |
|
49 | + add_action("give-tools_settings_{$this->id}_page", array($this, 'output')); |
|
50 | 50 | |
51 | 51 | // Do not use main form for this tab. |
52 | - if( give_get_current_setting_tab() === $this->id ) { |
|
53 | - add_action( "give-tools_open_form", '__return_empty_string' ); |
|
54 | - add_action( "give-tools_close_form", '__return_empty_string' ); |
|
52 | + if (give_get_current_setting_tab() === $this->id) { |
|
53 | + add_action("give-tools_open_form", '__return_empty_string'); |
|
54 | + add_action("give-tools_close_form", '__return_empty_string'); |
|
55 | 55 | } |
56 | 56 | } |
57 | 57 | |
@@ -62,8 +62,8 @@ discard block |
||
62 | 62 | * @param array $pages Lst of pages. |
63 | 63 | * @return array |
64 | 64 | */ |
65 | - public function add_settings_page( $pages ) { |
|
66 | - $pages[ $this->id ] = $this->label; |
|
65 | + public function add_settings_page($pages) { |
|
66 | + $pages[$this->id] = $this->label; |
|
67 | 67 | |
68 | 68 | return $pages; |
69 | 69 | } |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | $GLOBALS['give_hide_save_button'] = true; |
80 | 80 | |
81 | 81 | // Get settings. |
82 | - $settings = apply_filters( 'give_settings_data', array( |
|
82 | + $settings = apply_filters('give_settings_data', array( |
|
83 | 83 | array( |
84 | 84 | 'id' => 'give_tools_tools', |
85 | 85 | 'type' => 'title', |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | ), |
88 | 88 | array( |
89 | 89 | 'id' => 'api', |
90 | - 'name' => esc_html__( 'Tools', 'give' ), |
|
90 | + 'name' => esc_html__('Tools', 'give'), |
|
91 | 91 | 'type' => 'data', |
92 | 92 | ), |
93 | 93 | array( |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | * @since 1.8 |
104 | 104 | * @param array $settings |
105 | 105 | */ |
106 | - $settings = apply_filters( 'give_get_settings_' . $this->id, $settings ); |
|
106 | + $settings = apply_filters('give_get_settings_'.$this->id, $settings); |
|
107 | 107 | |
108 | 108 | // Output. |
109 | 109 | return $settings; |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | public function output() { |
119 | 119 | $settings = $this->get_settings(); |
120 | 120 | |
121 | - Give_Admin_Settings::output_fields( $settings, 'give_settings' ); |
|
121 | + Give_Admin_Settings::output_fields($settings, 'give_settings'); |
|
122 | 122 | } |
123 | 123 | } |
124 | 124 |
@@ -205,7 +205,7 @@ |
||
205 | 205 | * |
206 | 206 | * @param bool $force If set to true then all cached values will be delete instead of only expired |
207 | 207 | * |
208 | - * @return bool |
|
208 | + * @return false|null |
|
209 | 209 | */ |
210 | 210 | public static function delete_all_expired( $force = false ) { |
211 | 211 | global $wpdb; |
@@ -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 | |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | * @return static |
44 | 44 | */ |
45 | 45 | public static function get_instance() { |
46 | - if ( ! isset( self::$instance ) && ! ( self::$instance instanceof Give_Cache ) ) { |
|
46 | + if ( ! isset(self::$instance) && ! (self::$instance instanceof Give_Cache)) { |
|
47 | 47 | self::$instance = new Give_Cache(); |
48 | 48 | } |
49 | 49 | |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | */ |
59 | 59 | public function setup_hooks() { |
60 | 60 | // weekly delete all expired cache. |
61 | - add_action( 'give_weekly_scheduled_events', array( $this, 'delete_all_expired' ) ); |
|
61 | + add_action('give_weekly_scheduled_events', array($this, 'delete_all_expired')); |
|
62 | 62 | } |
63 | 63 | |
64 | 64 | /** |
@@ -72,12 +72,12 @@ discard block |
||
72 | 72 | * @return string |
73 | 73 | */ |
74 | 74 | |
75 | - public static function get_key( $action, $query_args = null ) { |
|
75 | + public static function get_key($action, $query_args = null) { |
|
76 | 76 | $cache_key = "give_cache_{$action}"; |
77 | 77 | |
78 | 78 | // Bailout. |
79 | - if ( ! empty( $query_args ) ) { |
|
80 | - $cache_key = "{$cache_key}_" . substr( md5( serialize( $query_args ) ), 0, 15 ); |
|
79 | + if ( ! empty($query_args)) { |
|
80 | + $cache_key = "{$cache_key}_".substr(md5(serialize($query_args)), 0, 15); |
|
81 | 81 | } |
82 | 82 | |
83 | 83 | return $cache_key; |
@@ -95,26 +95,26 @@ discard block |
||
95 | 95 | * @return mixed |
96 | 96 | */ |
97 | 97 | |
98 | - public static function get( $cache_key, $custom_key = false, $query_args = array() ) { |
|
99 | - if ( ! self::is_valid_cache_key( $cache_key ) ) { |
|
100 | - if ( ! $custom_key ) { |
|
101 | - return new WP_Error( 'give_invalid_cache_key', __( 'Cache key format should be give_cache_*', 'give' ) ); |
|
98 | + public static function get($cache_key, $custom_key = false, $query_args = array()) { |
|
99 | + if ( ! self::is_valid_cache_key($cache_key)) { |
|
100 | + if ( ! $custom_key) { |
|
101 | + return new WP_Error('give_invalid_cache_key', __('Cache key format should be give_cache_*', 'give')); |
|
102 | 102 | } |
103 | 103 | |
104 | - $cache_key = self::get_key( $cache_key, $query_args ); |
|
104 | + $cache_key = self::get_key($cache_key, $query_args); |
|
105 | 105 | } |
106 | 106 | |
107 | - $option = get_option( $cache_key ); |
|
107 | + $option = get_option($cache_key); |
|
108 | 108 | |
109 | 109 | // Backward compatibility (<1.8.7). |
110 | - if ( ! is_array( $option ) || empty( $option ) || ! array_key_exists( 'expiration', $option ) ) { |
|
110 | + if ( ! is_array($option) || empty($option) || ! array_key_exists('expiration', $option)) { |
|
111 | 111 | return $option; |
112 | 112 | } |
113 | 113 | |
114 | 114 | // Get current time. |
115 | - $current_time = current_time( 'timestamp', 1 ); |
|
115 | + $current_time = current_time('timestamp', 1); |
|
116 | 116 | |
117 | - if ( empty( $option['expiration'] ) || ( $current_time < $option['expiration'] ) ) { |
|
117 | + if (empty($option['expiration']) || ($current_time < $option['expiration'])) { |
|
118 | 118 | $option = $option['data']; |
119 | 119 | } else { |
120 | 120 | $option = false; |
@@ -137,23 +137,23 @@ discard block |
||
137 | 137 | * @return mixed |
138 | 138 | */ |
139 | 139 | |
140 | - public static function set( $cache_key, $data, $expiration = null, $custom_key = false, $query_args = array() ) { |
|
141 | - if ( ! self::is_valid_cache_key( $cache_key ) ) { |
|
142 | - if ( ! $custom_key ) { |
|
143 | - return new WP_Error( 'give_invalid_cache_key', __( 'Cache key format should be give_cache_*', 'give' ) ); |
|
140 | + public static function set($cache_key, $data, $expiration = null, $custom_key = false, $query_args = array()) { |
|
141 | + if ( ! self::is_valid_cache_key($cache_key)) { |
|
142 | + if ( ! $custom_key) { |
|
143 | + return new WP_Error('give_invalid_cache_key', __('Cache key format should be give_cache_*', 'give')); |
|
144 | 144 | } |
145 | 145 | |
146 | - $cache_key = self::get_key( $cache_key, $query_args ); |
|
146 | + $cache_key = self::get_key($cache_key, $query_args); |
|
147 | 147 | } |
148 | 148 | |
149 | 149 | $option_value = array( |
150 | 150 | 'data' => $data, |
151 | - 'expiration' => ! is_null( $expiration ) |
|
152 | - ? ( $expiration + current_time( 'timestamp', 1 ) ) |
|
151 | + 'expiration' => ! is_null($expiration) |
|
152 | + ? ($expiration + current_time('timestamp', 1)) |
|
153 | 153 | : null, |
154 | 154 | ); |
155 | 155 | |
156 | - $result = update_option( $cache_key, $option_value, 'no' ); |
|
156 | + $result = update_option($cache_key, $option_value, 'no'); |
|
157 | 157 | |
158 | 158 | return $result; |
159 | 159 | } |
@@ -168,27 +168,27 @@ discard block |
||
168 | 168 | * @return bool|WP_Error |
169 | 169 | */ |
170 | 170 | |
171 | - public static function delete( $cache_keys ) { |
|
171 | + public static function delete($cache_keys) { |
|
172 | 172 | $result = true; |
173 | 173 | $invalid_keys = array(); |
174 | 174 | |
175 | - if ( ! empty( $cache_keys ) ) { |
|
176 | - $cache_keys = is_array( $cache_keys ) ? $cache_keys : array( $cache_keys ); |
|
175 | + if ( ! empty($cache_keys)) { |
|
176 | + $cache_keys = is_array($cache_keys) ? $cache_keys : array($cache_keys); |
|
177 | 177 | |
178 | - foreach ( $cache_keys as $cache_key ) { |
|
179 | - if ( ! self::is_valid_cache_key( $cache_key ) ) { |
|
178 | + foreach ($cache_keys as $cache_key) { |
|
179 | + if ( ! self::is_valid_cache_key($cache_key)) { |
|
180 | 180 | $invalid_keys[] = $cache_key; |
181 | 181 | $result = false; |
182 | 182 | } |
183 | 183 | |
184 | - delete_option( $cache_key ); |
|
184 | + delete_option($cache_key); |
|
185 | 185 | } |
186 | 186 | } |
187 | 187 | |
188 | - if( ! $result ) { |
|
188 | + if ( ! $result) { |
|
189 | 189 | $result = new WP_Error( |
190 | 190 | 'give_invalid_cache_key', |
191 | - __( 'Cache key format should be give_cache_*', 'give' ), |
|
191 | + __('Cache key format should be give_cache_*', 'give'), |
|
192 | 192 | $invalid_keys |
193 | 193 | ); |
194 | 194 | } |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | * |
208 | 208 | * @return bool |
209 | 209 | */ |
210 | - public static function delete_all_expired( $force = false ) { |
|
210 | + public static function delete_all_expired($force = false) { |
|
211 | 211 | global $wpdb; |
212 | 212 | $options = $wpdb->get_results( |
213 | 213 | $wpdb->prepare( |
@@ -221,30 +221,30 @@ discard block |
||
221 | 221 | ); |
222 | 222 | |
223 | 223 | // Bailout. |
224 | - if ( empty( $options ) ) { |
|
224 | + if (empty($options)) { |
|
225 | 225 | return false; |
226 | 226 | } |
227 | 227 | |
228 | - $current_time = current_time( 'timestamp', 1 ); |
|
228 | + $current_time = current_time('timestamp', 1); |
|
229 | 229 | |
230 | 230 | // Delete log cache. |
231 | - foreach ( $options as $option ) { |
|
232 | - $option['option_value'] = maybe_unserialize( $option['option_value'] ); |
|
231 | + foreach ($options as $option) { |
|
232 | + $option['option_value'] = maybe_unserialize($option['option_value']); |
|
233 | 233 | |
234 | 234 | if ( |
235 | 235 | ( |
236 | - ! self::is_valid_cache_key( $option['option_name'] ) |
|
237 | - || ! is_array( $option['option_value'] ) // Backward compatibility (<1.8.7). |
|
238 | - || ! array_key_exists( 'expiration', $option['option_value'] ) // Backward compatibility (<1.8.7). |
|
239 | - || empty( $option['option_value']['expiration'] ) |
|
240 | - || ( $current_time < $option['option_value']['expiration'] ) |
|
236 | + ! self::is_valid_cache_key($option['option_name']) |
|
237 | + || ! is_array($option['option_value']) // Backward compatibility (<1.8.7). |
|
238 | + || ! array_key_exists('expiration', $option['option_value']) // Backward compatibility (<1.8.7). |
|
239 | + || empty($option['option_value']['expiration']) |
|
240 | + || ($current_time < $option['option_value']['expiration']) |
|
241 | 241 | ) |
242 | 242 | && ! $force |
243 | 243 | ) { |
244 | 244 | continue; |
245 | 245 | } |
246 | 246 | |
247 | - self::delete( $option['option_name'] ); |
|
247 | + self::delete($option['option_name']); |
|
248 | 248 | } |
249 | 249 | } |
250 | 250 | |
@@ -260,16 +260,16 @@ discard block |
||
260 | 260 | * |
261 | 261 | * @return array |
262 | 262 | */ |
263 | - public static function get_options_like( $option_name, $fields = false ) { |
|
263 | + public static function get_options_like($option_name, $fields = false) { |
|
264 | 264 | global $wpdb; |
265 | 265 | |
266 | - if ( empty( $option_name ) ) { |
|
266 | + if (empty($option_name)) { |
|
267 | 267 | return array(); |
268 | 268 | } |
269 | 269 | |
270 | 270 | $field_names = $fields ? 'option_name, option_value' : 'option_name'; |
271 | 271 | |
272 | - if ( $fields ) { |
|
272 | + if ($fields) { |
|
273 | 273 | $options = $wpdb->get_results( |
274 | 274 | $wpdb->prepare( |
275 | 275 | "SELECT {$field_names } |
@@ -293,10 +293,10 @@ discard block |
||
293 | 293 | ); |
294 | 294 | } |
295 | 295 | |
296 | - if ( ! empty( $options ) && $fields ) { |
|
297 | - foreach ( $options as $index => $option ) { |
|
298 | - $option['option_value'] = maybe_unserialize( $option['option_value'] ); |
|
299 | - $options[ $index ] = $option; |
|
296 | + if ( ! empty($options) && $fields) { |
|
297 | + foreach ($options as $index => $option) { |
|
298 | + $option['option_value'] = maybe_unserialize($option['option_value']); |
|
299 | + $options[$index] = $option; |
|
300 | 300 | } |
301 | 301 | } |
302 | 302 | |
@@ -313,8 +313,8 @@ discard block |
||
313 | 313 | * |
314 | 314 | * @return bool|int |
315 | 315 | */ |
316 | - public static function is_valid_cache_key( $cache_key ) { |
|
317 | - return ( false !== strpos( $cache_key, 'give_cache_' ) ); |
|
316 | + public static function is_valid_cache_key($cache_key) { |
|
317 | + return (false !== strpos($cache_key, 'give_cache_')); |
|
318 | 318 | } |
319 | 319 | } |
320 | 320 |
@@ -10,61 +10,61 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) { |
|
13 | +if ( ! defined('WP_UNINSTALL_PLUGIN')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
17 | 17 | // Load Give file. |
18 | -include_once( 'give.php' ); |
|
18 | +include_once('give.php'); |
|
19 | 19 | |
20 | 20 | global $wpdb, $wp_roles; |
21 | 21 | |
22 | 22 | |
23 | -if ( give_is_setting_enabled( give_get_option( 'uninstall_on_delete' ) ) ) { |
|
23 | +if (give_is_setting_enabled(give_get_option('uninstall_on_delete'))) { |
|
24 | 24 | |
25 | 25 | // Delete All the Custom Post Types. |
26 | - $give_taxonomies = array( 'form_category', 'form_tag', 'give_log_type' ); |
|
27 | - $give_post_types = array( 'give_forms', 'give_payment', 'give_log' ); |
|
28 | - foreach ( $give_post_types as $post_type ) { |
|
26 | + $give_taxonomies = array('form_category', 'form_tag', 'give_log_type'); |
|
27 | + $give_post_types = array('give_forms', 'give_payment', 'give_log'); |
|
28 | + foreach ($give_post_types as $post_type) { |
|
29 | 29 | |
30 | - $give_taxonomies = array_merge( $give_taxonomies, get_object_taxonomies( $post_type ) ); |
|
31 | - $items = get_posts( array( |
|
30 | + $give_taxonomies = array_merge($give_taxonomies, get_object_taxonomies($post_type)); |
|
31 | + $items = get_posts(array( |
|
32 | 32 | 'post_type' => $post_type, |
33 | 33 | 'post_status' => 'any', |
34 | - 'numberposts' => - 1, |
|
34 | + 'numberposts' => -1, |
|
35 | 35 | 'fields' => 'ids', |
36 | - ) ); |
|
36 | + )); |
|
37 | 37 | |
38 | - if ( $items ) { |
|
39 | - foreach ( $items as $item ) { |
|
40 | - wp_delete_post( $item, true ); |
|
38 | + if ($items) { |
|
39 | + foreach ($items as $item) { |
|
40 | + wp_delete_post($item, true); |
|
41 | 41 | } |
42 | 42 | } |
43 | 43 | } |
44 | 44 | |
45 | 45 | // Delete All the Terms & Taxonomies. |
46 | - foreach ( array_unique( array_filter( $give_taxonomies ) ) as $taxonomy ) { |
|
46 | + foreach (array_unique(array_filter($give_taxonomies)) as $taxonomy) { |
|
47 | 47 | |
48 | - $terms = $wpdb->get_results( $wpdb->prepare( "SELECT t.*, tt.* FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy AS tt ON t.term_id = tt.term_id WHERE tt.taxonomy IN ('%s') ORDER BY t.name ASC", $taxonomy ) ); |
|
48 | + $terms = $wpdb->get_results($wpdb->prepare("SELECT t.*, tt.* FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy AS tt ON t.term_id = tt.term_id WHERE tt.taxonomy IN ('%s') ORDER BY t.name ASC", $taxonomy)); |
|
49 | 49 | |
50 | 50 | // Delete Terms. |
51 | - if ( $terms ) { |
|
52 | - foreach ( $terms as $term ) { |
|
53 | - $wpdb->delete( $wpdb->term_taxonomy, array( 'term_taxonomy_id' => $term->term_taxonomy_id ) ); |
|
54 | - $wpdb->delete( $wpdb->terms, array( 'term_id' => $term->term_id ) ); |
|
51 | + if ($terms) { |
|
52 | + foreach ($terms as $term) { |
|
53 | + $wpdb->delete($wpdb->term_taxonomy, array('term_taxonomy_id' => $term->term_taxonomy_id)); |
|
54 | + $wpdb->delete($wpdb->terms, array('term_id' => $term->term_id)); |
|
55 | 55 | } |
56 | 56 | } |
57 | 57 | |
58 | 58 | // Delete Taxonomies. |
59 | - $wpdb->delete( $wpdb->term_taxonomy, array( 'taxonomy' => $taxonomy ), array( '%s' ) ); |
|
59 | + $wpdb->delete($wpdb->term_taxonomy, array('taxonomy' => $taxonomy), array('%s')); |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | // Delete the Plugin Pages. |
63 | - $give_created_pages = array( 'success_page', 'failure_page', 'history_page' ); |
|
64 | - foreach ( $give_created_pages as $p ) { |
|
65 | - $page = give_get_option( $p, false ); |
|
66 | - if ( $page ) { |
|
67 | - wp_delete_post( $page, true ); |
|
63 | + $give_created_pages = array('success_page', 'failure_page', 'history_page'); |
|
64 | + foreach ($give_created_pages as $p) { |
|
65 | + $page = give_get_option($p, false); |
|
66 | + if ($page) { |
|
67 | + wp_delete_post($page, true); |
|
68 | 68 | } |
69 | 69 | } |
70 | 70 | |
@@ -72,20 +72,20 @@ discard block |
||
72 | 72 | Give()->roles->remove_caps(); |
73 | 73 | |
74 | 74 | // Delete the Roles. |
75 | - $give_roles = array( 'give_manager', 'give_accountant', 'give_worker' ); |
|
76 | - foreach ( $give_roles as $role ) { |
|
77 | - remove_role( $role ); |
|
75 | + $give_roles = array('give_manager', 'give_accountant', 'give_worker'); |
|
76 | + foreach ($give_roles as $role) { |
|
77 | + remove_role($role); |
|
78 | 78 | } |
79 | 79 | |
80 | 80 | // Remove all database tables. |
81 | - $wpdb->query( 'DROP TABLE IF EXISTS ' . $wpdb->prefix . 'give_donors' ); |
|
82 | - $wpdb->query( 'DROP TABLE IF EXISTS ' . $wpdb->prefix . 'give_customers' ); |
|
83 | - $wpdb->query( 'DROP TABLE IF EXISTS ' . $wpdb->prefix . 'give_customermeta' ); |
|
81 | + $wpdb->query('DROP TABLE IF EXISTS '.$wpdb->prefix.'give_donors'); |
|
82 | + $wpdb->query('DROP TABLE IF EXISTS '.$wpdb->prefix.'give_customers'); |
|
83 | + $wpdb->query('DROP TABLE IF EXISTS '.$wpdb->prefix.'give_customermeta'); |
|
84 | 84 | |
85 | 85 | // Cleanup Cron Events. |
86 | - wp_clear_scheduled_hook( 'give_daily_scheduled_events' ); |
|
87 | - wp_clear_scheduled_hook( 'give_daily_cron' ); |
|
88 | - wp_clear_scheduled_hook( 'give_weekly_cron' ); |
|
86 | + wp_clear_scheduled_hook('give_daily_scheduled_events'); |
|
87 | + wp_clear_scheduled_hook('give_daily_cron'); |
|
88 | + wp_clear_scheduled_hook('give_weekly_cron'); |
|
89 | 89 | |
90 | 90 | // Get all options. |
91 | 91 | $give_option_names = $wpdb->get_col( |
@@ -95,16 +95,16 @@ discard block |
||
95 | 95 | ) |
96 | 96 | ); |
97 | 97 | |
98 | - if ( ! empty( $give_option_names ) ) { |
|
98 | + if ( ! empty($give_option_names)) { |
|
99 | 99 | // Convert option name to transient or option name. |
100 | 100 | $new_give_option_names = array(); |
101 | 101 | |
102 | 102 | // Delete all the Plugin Options. |
103 | - foreach ( $give_option_names as $option ) { |
|
104 | - if ( false !== strpos( $option, 'give_cache' ) ) { |
|
105 | - Give_Cache::delete( $option ); |
|
103 | + foreach ($give_option_names as $option) { |
|
104 | + if (false !== strpos($option, 'give_cache')) { |
|
105 | + Give_Cache::delete($option); |
|
106 | 106 | } else { |
107 | - delete_option( $option ); |
|
107 | + delete_option($option); |
|
108 | 108 | } |
109 | 109 | } |
110 | 110 | } |
@@ -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,11 +26,11 @@ discard block |
||
26 | 26 | ob_start(); ?> |
27 | 27 | <div class="wrap" id="give-add-ons"> |
28 | 28 | <h1><?php echo get_admin_page_title(); ?> |
29 | - — <a href="https://givewp.com/addons/" class="button-primary give-view-addons-all" target="_blank"><?php esc_html_e( 'View All Add-ons', 'give' ); ?> |
|
29 | + — <a href="https://givewp.com/addons/" class="button-primary give-view-addons-all" target="_blank"><?php esc_html_e('View All Add-ons', 'give'); ?> |
|
30 | 30 | <span class="dashicons dashicons-external"></span></a> |
31 | 31 | </h1> |
32 | 32 | |
33 | - <p><?php esc_html_e( 'The following Add-ons extend the functionality of Give.', 'give' ); ?></p> |
|
33 | + <p><?php esc_html_e('The following Add-ons extend the functionality of Give.', 'give'); ?></p> |
|
34 | 34 | <?php echo give_add_ons_get_feed(); ?> |
35 | 35 | </div> |
36 | 36 | <?php |
@@ -48,20 +48,20 @@ discard block |
||
48 | 48 | function give_add_ons_get_feed() { |
49 | 49 | |
50 | 50 | $addons_debug = false; //set to true to debug |
51 | - $cache = Give_Cache::get( 'give_add_ons_feed', true ); |
|
51 | + $cache = Give_Cache::get('give_add_ons_feed', true); |
|
52 | 52 | |
53 | - if ( $cache === false || $addons_debug === true && WP_DEBUG === true ) { |
|
54 | - $feed = wp_remote_get( 'https://givewp.com/downloads/feed/', array( 'sslverify' => false ) ); |
|
53 | + if ($cache === false || $addons_debug === true && WP_DEBUG === true) { |
|
54 | + $feed = wp_remote_get('https://givewp.com/downloads/feed/', array('sslverify' => false)); |
|
55 | 55 | |
56 | - if ( ! is_wp_error( $feed ) ) { |
|
57 | - if ( isset( $feed['body'] ) && strlen( $feed['body'] ) > 0 ) { |
|
58 | - $cache = wp_remote_retrieve_body( $feed ); |
|
59 | - Give_Cache::set( 'give_add_ons_feed', $cache, HOUR_IN_SECONDS, true ); |
|
56 | + if ( ! is_wp_error($feed)) { |
|
57 | + if (isset($feed['body']) && strlen($feed['body']) > 0) { |
|
58 | + $cache = wp_remote_retrieve_body($feed); |
|
59 | + Give_Cache::set('give_add_ons_feed', $cache, HOUR_IN_SECONDS, true); |
|
60 | 60 | } |
61 | 61 | } else { |
62 | 62 | $cache = sprintf( |
63 | 63 | '<div class="error"><p>%s</p></div>', |
64 | - esc_html__( 'There was an error retrieving the Give Add-ons list from the server. Please try again later.', 'give' ) |
|
64 | + esc_html__('There was an error retrieving the Give Add-ons list from the server. Please try again later.', 'give') |
|
65 | 65 | ); |
66 | 66 | } |
67 | 67 | } |
@@ -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 | |
@@ -74,57 +74,57 @@ discard block |
||
74 | 74 | public function __construct() { |
75 | 75 | |
76 | 76 | $this->use_php_sessions = $this->use_php_sessions(); |
77 | - $this->exp_option = give_get_option( 'session_lifetime' ); |
|
77 | + $this->exp_option = give_get_option('session_lifetime'); |
|
78 | 78 | |
79 | 79 | // PHP Sessions. |
80 | - if ( $this->use_php_sessions ) { |
|
80 | + if ($this->use_php_sessions) { |
|
81 | 81 | |
82 | - if ( is_multisite() ) { |
|
82 | + if (is_multisite()) { |
|
83 | 83 | |
84 | - $this->prefix = '_' . get_current_blog_id(); |
|
84 | + $this->prefix = '_'.get_current_blog_id(); |
|
85 | 85 | |
86 | 86 | } |
87 | 87 | |
88 | - add_action( 'init', array( $this, 'maybe_start_session' ), - 2 ); |
|
88 | + add_action('init', array($this, 'maybe_start_session'), - 2); |
|
89 | 89 | |
90 | 90 | } else { |
91 | 91 | |
92 | - if ( ! $this->should_start_session() ) { |
|
92 | + if ( ! $this->should_start_session()) { |
|
93 | 93 | return; |
94 | 94 | } |
95 | 95 | |
96 | 96 | // Use WP_Session. |
97 | - if ( ! defined( 'WP_SESSION_COOKIE' ) ) { |
|
98 | - define( 'WP_SESSION_COOKIE', 'give_wp_session' ); |
|
97 | + if ( ! defined('WP_SESSION_COOKIE')) { |
|
98 | + define('WP_SESSION_COOKIE', 'give_wp_session'); |
|
99 | 99 | } |
100 | 100 | |
101 | - if ( ! class_exists( 'Recursive_ArrayAccess' ) ) { |
|
102 | - require_once GIVE_PLUGIN_DIR . 'includes/libraries/sessions/class-recursive-arrayaccess.php'; |
|
101 | + if ( ! class_exists('Recursive_ArrayAccess')) { |
|
102 | + require_once GIVE_PLUGIN_DIR.'includes/libraries/sessions/class-recursive-arrayaccess.php'; |
|
103 | 103 | } |
104 | 104 | |
105 | 105 | // Include utilities class |
106 | - if ( ! class_exists( 'WP_Session_Utils' ) ) { |
|
107 | - require_once GIVE_PLUGIN_DIR . 'includes/libraries/sessions/class-wp-session-utils.php'; |
|
106 | + if ( ! class_exists('WP_Session_Utils')) { |
|
107 | + require_once GIVE_PLUGIN_DIR.'includes/libraries/sessions/class-wp-session-utils.php'; |
|
108 | 108 | } |
109 | - if ( ! class_exists( 'WP_Session' ) ) { |
|
110 | - require_once GIVE_PLUGIN_DIR . 'includes/libraries/sessions/class-wp-session.php'; |
|
111 | - require_once GIVE_PLUGIN_DIR . 'includes/libraries/sessions/wp-session.php'; |
|
109 | + if ( ! class_exists('WP_Session')) { |
|
110 | + require_once GIVE_PLUGIN_DIR.'includes/libraries/sessions/class-wp-session.php'; |
|
111 | + require_once GIVE_PLUGIN_DIR.'includes/libraries/sessions/wp-session.php'; |
|
112 | 112 | } |
113 | 113 | |
114 | - add_filter( 'wp_session_expiration_variant', array( $this, 'set_expiration_variant_time' ), 99999 ); |
|
115 | - add_filter( 'wp_session_expiration', array( $this, 'set_expiration_time' ), 99999 ); |
|
114 | + add_filter('wp_session_expiration_variant', array($this, 'set_expiration_variant_time'), 99999); |
|
115 | + add_filter('wp_session_expiration', array($this, 'set_expiration_time'), 99999); |
|
116 | 116 | |
117 | 117 | } |
118 | 118 | |
119 | 119 | // Init Session. |
120 | - if ( empty( $this->session ) && ! $this->use_php_sessions ) { |
|
121 | - add_action( 'plugins_loaded', array( $this, 'init' ), - 1 ); |
|
120 | + if (empty($this->session) && ! $this->use_php_sessions) { |
|
121 | + add_action('plugins_loaded', array($this, 'init'), - 1); |
|
122 | 122 | } else { |
123 | - add_action( 'init', array( $this, 'init' ), - 1 ); |
|
123 | + add_action('init', array($this, 'init'), - 1); |
|
124 | 124 | } |
125 | 125 | |
126 | 126 | // Set cookie on Donation Completion page. |
127 | - add_action( 'give_pre_process_donation', array( $this, 'set_session_cookies' ) ); |
|
127 | + add_action('give_pre_process_donation', array($this, 'set_session_cookies')); |
|
128 | 128 | |
129 | 129 | } |
130 | 130 | |
@@ -140,8 +140,8 @@ discard block |
||
140 | 140 | */ |
141 | 141 | public function init() { |
142 | 142 | |
143 | - if ( $this->use_php_sessions ) { |
|
144 | - $this->session = isset( $_SESSION[ 'give' . $this->prefix ] ) && is_array( $_SESSION[ 'give' . $this->prefix ] ) ? $_SESSION[ 'give' . $this->prefix ] : array(); |
|
143 | + if ($this->use_php_sessions) { |
|
144 | + $this->session = isset($_SESSION['give'.$this->prefix]) && is_array($_SESSION['give'.$this->prefix]) ? $_SESSION['give'.$this->prefix] : array(); |
|
145 | 145 | } else { |
146 | 146 | $this->session = WP_Session::get_instance(); |
147 | 147 | } |
@@ -176,10 +176,10 @@ discard block |
||
176 | 176 | * |
177 | 177 | * @return string Session variable. |
178 | 178 | */ |
179 | - public function get( $key ) { |
|
180 | - $key = sanitize_key( $key ); |
|
179 | + public function get($key) { |
|
180 | + $key = sanitize_key($key); |
|
181 | 181 | |
182 | - return isset( $this->session[ $key ] ) ? maybe_unserialize( $this->session[ $key ] ) : false; |
|
182 | + return isset($this->session[$key]) ? maybe_unserialize($this->session[$key]) : false; |
|
183 | 183 | |
184 | 184 | } |
185 | 185 | |
@@ -196,21 +196,21 @@ discard block |
||
196 | 196 | * |
197 | 197 | * @return string Session variable. |
198 | 198 | */ |
199 | - public function set( $key, $value ) { |
|
199 | + public function set($key, $value) { |
|
200 | 200 | |
201 | - $key = sanitize_key( $key ); |
|
201 | + $key = sanitize_key($key); |
|
202 | 202 | |
203 | - if ( is_array( $value ) ) { |
|
204 | - $this->session[ $key ] = serialize( $value ); |
|
203 | + if (is_array($value)) { |
|
204 | + $this->session[$key] = serialize($value); |
|
205 | 205 | } else { |
206 | - $this->session[ $key ] = $value; |
|
206 | + $this->session[$key] = $value; |
|
207 | 207 | } |
208 | 208 | |
209 | - if ( $this->use_php_sessions ) { |
|
210 | - $_SESSION[ 'give' . $this->prefix ] = $this->session; |
|
209 | + if ($this->use_php_sessions) { |
|
210 | + $_SESSION['give'.$this->prefix] = $this->session; |
|
211 | 211 | } |
212 | 212 | |
213 | - return $this->session[ $key ]; |
|
213 | + return $this->session[$key]; |
|
214 | 214 | } |
215 | 215 | |
216 | 216 | /** |
@@ -224,10 +224,10 @@ discard block |
||
224 | 224 | * @hook |
225 | 225 | */ |
226 | 226 | public function set_session_cookies() { |
227 | - if ( ! headers_sent() ) { |
|
228 | - $lifetime = current_time( 'timestamp' ) + $this->set_expiration_time(); |
|
229 | - @setcookie( session_name(), session_id(), $lifetime, COOKIEPATH, COOKIE_DOMAIN, false ); |
|
230 | - @setcookie( session_name() . '_expiration', $lifetime, $lifetime, COOKIEPATH, COOKIE_DOMAIN, false ); |
|
227 | + if ( ! headers_sent()) { |
|
228 | + $lifetime = current_time('timestamp') + $this->set_expiration_time(); |
|
229 | + @setcookie(session_name(), session_id(), $lifetime, COOKIEPATH, COOKIE_DOMAIN, false); |
|
230 | + @setcookie(session_name().'_expiration', $lifetime, $lifetime, COOKIEPATH, COOKIE_DOMAIN, false); |
|
231 | 231 | } |
232 | 232 | } |
233 | 233 | |
@@ -243,7 +243,7 @@ discard block |
||
243 | 243 | */ |
244 | 244 | public function set_expiration_variant_time() { |
245 | 245 | |
246 | - return ( ! empty( $this->exp_option ) ? ( intval( $this->exp_option ) - 3600 ) : 30 * 60 * 23 ); |
|
246 | + return ( ! empty($this->exp_option) ? (intval($this->exp_option) - 3600) : 30 * 60 * 23); |
|
247 | 247 | } |
248 | 248 | |
249 | 249 | /** |
@@ -258,7 +258,7 @@ discard block |
||
258 | 258 | */ |
259 | 259 | public function set_expiration_time() { |
260 | 260 | |
261 | - return ( ! empty( $this->exp_option ) ? intval( $this->exp_option ) : 30 * 60 * 24 ); |
|
261 | + return ( ! empty($this->exp_option) ? intval($this->exp_option) : 30 * 60 * 24); |
|
262 | 262 | } |
263 | 263 | |
264 | 264 | /** |
@@ -276,21 +276,21 @@ discard block |
||
276 | 276 | $ret = false; |
277 | 277 | |
278 | 278 | // If the database variable is already set, no need to run auto detection. |
279 | - $give_use_php_sessions = (bool) get_option( 'give_use_php_sessions' ); |
|
279 | + $give_use_php_sessions = (bool) get_option('give_use_php_sessions'); |
|
280 | 280 | |
281 | - if ( ! $give_use_php_sessions ) { |
|
281 | + if ( ! $give_use_php_sessions) { |
|
282 | 282 | |
283 | 283 | // Attempt to detect if the server supports PHP sessions. |
284 | - if ( function_exists( 'session_start' ) && ! ini_get( 'safe_mode' ) ) { |
|
284 | + if (function_exists('session_start') && ! ini_get('safe_mode')) { |
|
285 | 285 | |
286 | - $this->set( 'give_use_php_sessions', 1 ); |
|
286 | + $this->set('give_use_php_sessions', 1); |
|
287 | 287 | |
288 | - if ( $this->get( 'give_use_php_sessions' ) ) { |
|
288 | + if ($this->get('give_use_php_sessions')) { |
|
289 | 289 | |
290 | 290 | $ret = true; |
291 | 291 | |
292 | 292 | // Set the database option. |
293 | - update_option( 'give_use_php_sessions', true ); |
|
293 | + update_option('give_use_php_sessions', true); |
|
294 | 294 | |
295 | 295 | } |
296 | 296 | } |
@@ -300,13 +300,13 @@ discard block |
||
300 | 300 | } |
301 | 301 | |
302 | 302 | // Enable or disable PHP Sessions based on the GIVE_USE_PHP_SESSIONS constant. |
303 | - if ( defined( 'GIVE_USE_PHP_SESSIONS' ) && GIVE_USE_PHP_SESSIONS ) { |
|
303 | + if (defined('GIVE_USE_PHP_SESSIONS') && GIVE_USE_PHP_SESSIONS) { |
|
304 | 304 | $ret = true; |
305 | - } elseif ( defined( 'GIVE_USE_PHP_SESSIONS' ) && ! GIVE_USE_PHP_SESSIONS ) { |
|
305 | + } elseif (defined('GIVE_USE_PHP_SESSIONS') && ! GIVE_USE_PHP_SESSIONS) { |
|
306 | 306 | $ret = false; |
307 | 307 | } |
308 | 308 | |
309 | - return (bool) apply_filters( 'give_use_php_sessions', $ret ); |
|
309 | + return (bool) apply_filters('give_use_php_sessions', $ret); |
|
310 | 310 | } |
311 | 311 | |
312 | 312 | /** |
@@ -323,9 +323,9 @@ discard block |
||
323 | 323 | |
324 | 324 | $start_session = true; |
325 | 325 | |
326 | - if ( ! empty( $_SERVER['REQUEST_URI'] ) ) { |
|
326 | + if ( ! empty($_SERVER['REQUEST_URI'])) { |
|
327 | 327 | |
328 | - $blacklist = apply_filters( 'give_session_start_uri_blacklist', array( |
|
328 | + $blacklist = apply_filters('give_session_start_uri_blacklist', array( |
|
329 | 329 | 'feed', |
330 | 330 | 'feed', |
331 | 331 | 'feed/rss', |
@@ -333,21 +333,21 @@ discard block |
||
333 | 333 | 'feed/rdf', |
334 | 334 | 'feed/atom', |
335 | 335 | 'comments/feed/', |
336 | - ) ); |
|
337 | - $uri = ltrim( $_SERVER['REQUEST_URI'], '/' ); |
|
338 | - $uri = untrailingslashit( $uri ); |
|
339 | - if ( in_array( $uri, $blacklist ) ) { |
|
336 | + )); |
|
337 | + $uri = ltrim($_SERVER['REQUEST_URI'], '/'); |
|
338 | + $uri = untrailingslashit($uri); |
|
339 | + if (in_array($uri, $blacklist)) { |
|
340 | 340 | $start_session = false; |
341 | 341 | } |
342 | - if ( false !== strpos( $uri, 'feed=' ) ) { |
|
342 | + if (false !== strpos($uri, 'feed=')) { |
|
343 | 343 | $start_session = false; |
344 | 344 | } |
345 | - if ( is_admin() ) { |
|
345 | + if (is_admin()) { |
|
346 | 346 | $start_session = false; |
347 | 347 | } |
348 | 348 | } |
349 | 349 | |
350 | - return apply_filters( 'give_start_session', $start_session ); |
|
350 | + return apply_filters('give_start_session', $start_session); |
|
351 | 351 | } |
352 | 352 | |
353 | 353 | /** |
@@ -363,11 +363,11 @@ discard block |
||
363 | 363 | */ |
364 | 364 | public function maybe_start_session() { |
365 | 365 | |
366 | - if ( ! $this->should_start_session() ) { |
|
366 | + if ( ! $this->should_start_session()) { |
|
367 | 367 | return; |
368 | 368 | } |
369 | 369 | |
370 | - if ( ! session_id() && ! headers_sent() ) { |
|
370 | + if ( ! session_id() && ! headers_sent()) { |
|
371 | 371 | session_start(); |
372 | 372 | } |
373 | 373 | |
@@ -386,9 +386,9 @@ discard block |
||
386 | 386 | |
387 | 387 | $expiration = false; |
388 | 388 | |
389 | - if ( session_id() && isset( $_COOKIE[ session_name() . '_expiration' ] ) ) { |
|
389 | + if (session_id() && isset($_COOKIE[session_name().'_expiration'])) { |
|
390 | 390 | |
391 | - $expiration = date( 'D, d M Y h:i:s', intval( $_COOKIE[ session_name() . '_expiration' ] ) ); |
|
391 | + $expiration = date('D, d M Y h:i:s', intval($_COOKIE[session_name().'_expiration'])); |
|
392 | 392 | |
393 | 393 | } |
394 | 394 |
@@ -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,35 +48,35 @@ 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); |
@@ -733,9 +733,9 @@ |
||
733 | 733 | <td class="give-docs-link" colspan="2"> |
734 | 734 | <?php |
735 | 735 | echo '<p class="give-docs-link"><a href="' . esc_url( $value['url'] ) |
736 | - . '" target="_blank">' |
|
737 | - . sprintf( esc_html__( 'Need Help? See docs on "%s"', 'give' ), $value['title'] ) |
|
738 | - . '<span class="dashicons dashicons-editor-help"></span></a></p>'; |
|
736 | + . '" target="_blank">' |
|
737 | + . sprintf( esc_html__( 'Need Help? See docs on "%s"', 'give' ), $value['title'] ) |
|
738 | + . '<span class="dashicons dashicons-editor-help"></span></a></p>'; |
|
739 | 739 | ?> |
740 | 740 | </td> |
741 | 741 | </tr><?php |
@@ -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,8 +86,8 @@ discard block |
||
86 | 86 | public static function save() { |
87 | 87 | $current_tab = give_get_current_setting_tab(); |
88 | 88 | |
89 | - if ( empty( $_REQUEST['_give-save-settings'] ) || ! wp_verify_nonce( $_REQUEST['_give-save-settings'], 'give-save-settings' ) ) { |
|
90 | - echo '<div class="notice error"><p>' . __( 'Action failed. Please refresh the page and retry.', 'give' ) . '</p></div>'; |
|
89 | + if (empty($_REQUEST['_give-save-settings']) || ! wp_verify_nonce($_REQUEST['_give-save-settings'], 'give-save-settings')) { |
|
90 | + echo '<div class="notice error"><p>'.__('Action failed. Please refresh the page and retry.', 'give').'</p></div>'; |
|
91 | 91 | die(); |
92 | 92 | } |
93 | 93 | |
@@ -100,9 +100,9 @@ discard block |
||
100 | 100 | * |
101 | 101 | * @since 1.8 |
102 | 102 | */ |
103 | - do_action( self::$setting_filter_prefix . '_save_' . $current_tab ); |
|
103 | + do_action(self::$setting_filter_prefix.'_save_'.$current_tab); |
|
104 | 104 | |
105 | - self::add_message( 'give-setting-updated', __( 'Your settings have been saved.', 'give' ) ); |
|
105 | + self::add_message('give-setting-updated', __('Your settings have been saved.', 'give')); |
|
106 | 106 | |
107 | 107 | /** |
108 | 108 | * Trigger Action. |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | * |
114 | 114 | * @since 1.8 |
115 | 115 | */ |
116 | - do_action( self::$setting_filter_prefix . '_saved' ); |
|
116 | + do_action(self::$setting_filter_prefix.'_saved'); |
|
117 | 117 | } |
118 | 118 | |
119 | 119 | /** |
@@ -126,8 +126,8 @@ discard block |
||
126 | 126 | * |
127 | 127 | * @return void |
128 | 128 | */ |
129 | - public static function add_message( $code, $message ) { |
|
130 | - self::$messages[ $code ] = $message; |
|
129 | + public static function add_message($code, $message) { |
|
130 | + self::$messages[$code] = $message; |
|
131 | 131 | } |
132 | 132 | |
133 | 133 | /** |
@@ -140,8 +140,8 @@ discard block |
||
140 | 140 | * |
141 | 141 | * @return void |
142 | 142 | */ |
143 | - public static function add_error( $code, $message ) { |
|
144 | - self::$errors[ $code ] = $message; |
|
143 | + public static function add_error($code, $message) { |
|
144 | + self::$errors[$code] = $message; |
|
145 | 145 | } |
146 | 146 | |
147 | 147 | /** |
@@ -154,18 +154,18 @@ discard block |
||
154 | 154 | $notice_html = ''; |
155 | 155 | $classes = 'give-notice settings-error notice is-dismissible'; |
156 | 156 | |
157 | - self::$errors = apply_filters( self::$setting_filter_prefix . '_error_notices', self::$errors ); |
|
158 | - self::$messages = apply_filters( self::$setting_filter_prefix . '_update_notices', self::$messages ); |
|
157 | + self::$errors = apply_filters(self::$setting_filter_prefix.'_error_notices', self::$errors); |
|
158 | + self::$messages = apply_filters(self::$setting_filter_prefix.'_update_notices', self::$messages); |
|
159 | 159 | |
160 | - if ( 0 < count( self::$errors ) ) { |
|
161 | - foreach ( self::$errors as $code => $message ) { |
|
162 | - $notice_html .= '<div id="setting-error-' . $code . '" class="' . $classes . ' error"><p><strong>' . $message . '</strong></p></div>'; |
|
160 | + if (0 < count(self::$errors)) { |
|
161 | + foreach (self::$errors as $code => $message) { |
|
162 | + $notice_html .= '<div id="setting-error-'.$code.'" class="'.$classes.' error"><p><strong>'.$message.'</strong></p></div>'; |
|
163 | 163 | } |
164 | 164 | } |
165 | 165 | |
166 | - if ( 0 < count( self::$messages ) ) { |
|
167 | - foreach ( self::$messages as $code => $message ) { |
|
168 | - $notice_html .= '<div id="setting-error-' . $code . '" class="' . $classes . ' updated"><p><strong>' . $message . '</strong></p></div>'; |
|
166 | + if (0 < count(self::$messages)) { |
|
167 | + foreach (self::$messages as $code => $message) { |
|
168 | + $notice_html .= '<div id="setting-error-'.$code.'" class="'.$classes.' updated"><p><strong>'.$message.'</strong></p></div>'; |
|
169 | 169 | } |
170 | 170 | } |
171 | 171 | |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | self::$setting_filter_prefix = give_get_current_setting_page(); |
186 | 186 | |
187 | 187 | // Bailout: Exit if setting page is not defined. |
188 | - if ( empty( self::$setting_filter_prefix ) ) { |
|
188 | + if (empty(self::$setting_filter_prefix)) { |
|
189 | 189 | return false; |
190 | 190 | } |
191 | 191 | |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | * |
199 | 199 | * @since 1.8 |
200 | 200 | */ |
201 | - do_action( self::$setting_filter_prefix . '_start' ); |
|
201 | + do_action(self::$setting_filter_prefix.'_start'); |
|
202 | 202 | |
203 | 203 | $current_tab = give_get_current_setting_tab(); |
204 | 204 | |
@@ -206,7 +206,7 @@ discard block |
||
206 | 206 | self::get_settings_pages(); |
207 | 207 | |
208 | 208 | // Save settings if data has been posted. |
209 | - if ( ! empty( $_POST ) ) { |
|
209 | + if ( ! empty($_POST)) { |
|
210 | 210 | self::save(); |
211 | 211 | } |
212 | 212 | |
@@ -219,7 +219,7 @@ discard block |
||
219 | 219 | * |
220 | 220 | * @since 1.8 |
221 | 221 | */ |
222 | - $tabs = apply_filters( self::$setting_filter_prefix . '_tabs_array', array() ); |
|
222 | + $tabs = apply_filters(self::$setting_filter_prefix.'_tabs_array', array()); |
|
223 | 223 | |
224 | 224 | include 'views/html-admin-settings.php'; |
225 | 225 | |
@@ -237,25 +237,25 @@ discard block |
||
237 | 237 | * |
238 | 238 | * @return string|bool |
239 | 239 | */ |
240 | - public static function get_option( $option_name = '', $field_id = '', $default = false ) { |
|
240 | + public static function get_option($option_name = '', $field_id = '', $default = false) { |
|
241 | 241 | // Bailout. |
242 | - if ( empty( $option_name ) && empty( $field_id ) ) { |
|
242 | + if (empty($option_name) && empty($field_id)) { |
|
243 | 243 | return false; |
244 | 244 | } |
245 | 245 | |
246 | - if ( ! empty( $field_id ) && ! empty( $option_name ) ) { |
|
246 | + if ( ! empty($field_id) && ! empty($option_name)) { |
|
247 | 247 | // Get field value if any. |
248 | - $option_value = get_option( $option_name ); |
|
248 | + $option_value = get_option($option_name); |
|
249 | 249 | |
250 | - $option_value = ( is_array( $option_value ) && array_key_exists( $field_id, $option_value ) ) |
|
251 | - ? $option_value[ $field_id ] |
|
250 | + $option_value = (is_array($option_value) && array_key_exists($field_id, $option_value)) |
|
251 | + ? $option_value[$field_id] |
|
252 | 252 | : $default; |
253 | 253 | } else { |
254 | 254 | // If option name is empty but not field name then this means, setting is direct store to option table under there field name. |
255 | 255 | $option_name = ! $option_name ? $field_id : $option_name; |
256 | 256 | |
257 | 257 | // Get option value if any. |
258 | - $option_value = get_option( $option_name, $default ); |
|
258 | + $option_value = get_option($option_name, $default); |
|
259 | 259 | } |
260 | 260 | |
261 | 261 | return $option_value; |
@@ -273,7 +273,7 @@ discard block |
||
273 | 273 | * |
274 | 274 | * @return void |
275 | 275 | */ |
276 | - public static function output_fields( $options, $option_name = '' ) { |
|
276 | + public static function output_fields($options, $option_name = '') { |
|
277 | 277 | $current_tab = give_get_current_setting_tab(); |
278 | 278 | |
279 | 279 | // Field Default values. |
@@ -286,52 +286,52 @@ discard block |
||
286 | 286 | 'table_html' => true, |
287 | 287 | ); |
288 | 288 | |
289 | - foreach ( $options as $value ) { |
|
290 | - if ( ! isset( $value['type'] ) ) { |
|
289 | + foreach ($options as $value) { |
|
290 | + if ( ! isset($value['type'])) { |
|
291 | 291 | continue; |
292 | 292 | } |
293 | 293 | |
294 | 294 | // Set title. |
295 | - $defaults['title'] = isset( $value['name'] ) ? $value['name'] : ''; |
|
295 | + $defaults['title'] = isset($value['name']) ? $value['name'] : ''; |
|
296 | 296 | |
297 | 297 | // Set default setting. |
298 | - $value = wp_parse_args( $value, $defaults ); |
|
298 | + $value = wp_parse_args($value, $defaults); |
|
299 | 299 | |
300 | 300 | // Colorpicker field. |
301 | - $value['class'] = ( 'colorpicker' === $value['type'] ? trim( $value['class'] ) . ' give-colorpicker' : $value['class'] ); |
|
302 | - $value['type'] = ( 'colorpicker' === $value['type'] ? 'text' : $value['type'] ); |
|
301 | + $value['class'] = ('colorpicker' === $value['type'] ? trim($value['class']).' give-colorpicker' : $value['class']); |
|
302 | + $value['type'] = ('colorpicker' === $value['type'] ? 'text' : $value['type']); |
|
303 | 303 | |
304 | 304 | |
305 | 305 | // Custom attribute handling. |
306 | 306 | $custom_attributes = array(); |
307 | 307 | |
308 | - if ( ! empty( $value['attributes'] ) && is_array( $value['attributes'] ) ) { |
|
309 | - foreach ( $value['attributes'] as $attribute => $attribute_value ) { |
|
310 | - $custom_attributes[] = esc_attr( $attribute ) . '="' . esc_attr( $attribute_value ) . '"'; |
|
308 | + if ( ! empty($value['attributes']) && is_array($value['attributes'])) { |
|
309 | + foreach ($value['attributes'] as $attribute => $attribute_value) { |
|
310 | + $custom_attributes[] = esc_attr($attribute).'="'.esc_attr($attribute_value).'"'; |
|
311 | 311 | } |
312 | 312 | } |
313 | 313 | |
314 | 314 | // Description handling. |
315 | - $description = self::get_field_description( $value ); |
|
315 | + $description = self::get_field_description($value); |
|
316 | 316 | |
317 | 317 | // Switch based on type. |
318 | - switch ( $value['type'] ) { |
|
318 | + switch ($value['type']) { |
|
319 | 319 | |
320 | 320 | // Section Titles |
321 | 321 | case 'title': |
322 | - if ( ! empty( $value['title'] ) ) { |
|
323 | - echo '<div class="give-setting-tab-header give-setting-tab-header-' . $current_tab . '"><h2>' . self::get_field_title( $value ) . '</h2><hr></div>'; |
|
322 | + if ( ! empty($value['title'])) { |
|
323 | + echo '<div class="give-setting-tab-header give-setting-tab-header-'.$current_tab.'"><h2>'.self::get_field_title($value).'</h2><hr></div>'; |
|
324 | 324 | } |
325 | 325 | |
326 | - if ( ! empty( $value['desc'] ) ) { |
|
327 | - echo wpautop( wptexturize( wp_kses_post( $value['desc'] ) ) ); |
|
326 | + if ( ! empty($value['desc'])) { |
|
327 | + echo wpautop(wptexturize(wp_kses_post($value['desc']))); |
|
328 | 328 | } |
329 | 329 | |
330 | - if ( $value['table_html'] ) { |
|
331 | - echo '<table class="form-table give-setting-tab-body give-setting-tab-body-' . $current_tab . '">' . "\n\n"; |
|
330 | + if ($value['table_html']) { |
|
331 | + echo '<table class="form-table give-setting-tab-body give-setting-tab-body-'.$current_tab.'">'."\n\n"; |
|
332 | 332 | } |
333 | 333 | |
334 | - if ( ! empty( $value['id'] ) ) { |
|
334 | + if ( ! empty($value['id'])) { |
|
335 | 335 | |
336 | 336 | /** |
337 | 337 | * Trigger Action. |
@@ -340,14 +340,14 @@ discard block |
||
340 | 340 | * |
341 | 341 | * @since 1.8 |
342 | 342 | */ |
343 | - do_action( 'give_settings_' . sanitize_title( $value['id'] ) ); |
|
343 | + do_action('give_settings_'.sanitize_title($value['id'])); |
|
344 | 344 | } |
345 | 345 | |
346 | 346 | break; |
347 | 347 | |
348 | 348 | // Section Ends. |
349 | 349 | case 'sectionend': |
350 | - if ( ! empty( $value['id'] ) ) { |
|
350 | + if ( ! empty($value['id'])) { |
|
351 | 351 | |
352 | 352 | /** |
353 | 353 | * Trigger Action. |
@@ -356,14 +356,14 @@ discard block |
||
356 | 356 | * |
357 | 357 | * @since 1.8 |
358 | 358 | */ |
359 | - do_action( 'give_settings_' . sanitize_title( $value['id'] ) . '_end' ); |
|
359 | + do_action('give_settings_'.sanitize_title($value['id']).'_end'); |
|
360 | 360 | } |
361 | 361 | |
362 | - if ( $value['table_html'] ) { |
|
362 | + if ($value['table_html']) { |
|
363 | 363 | echo '</table>'; |
364 | 364 | } |
365 | 365 | |
366 | - if ( ! empty( $value['id'] ) ) { |
|
366 | + if ( ! empty($value['id'])) { |
|
367 | 367 | |
368 | 368 | /** |
369 | 369 | * Trigger Action. |
@@ -372,7 +372,7 @@ discard block |
||
372 | 372 | * |
373 | 373 | * @since 1.8 |
374 | 374 | */ |
375 | - do_action( 'give_settings_' . sanitize_title( $value['id'] ) . '_after' ); |
|
375 | + do_action('give_settings_'.sanitize_title($value['id']).'_after'); |
|
376 | 376 | } |
377 | 377 | |
378 | 378 | break; |
@@ -385,22 +385,22 @@ discard block |
||
385 | 385 | case 'password' : |
386 | 386 | |
387 | 387 | $type = $value['type']; |
388 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
388 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
389 | 389 | |
390 | 390 | ?> |
391 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
391 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
392 | 392 | <th scope="row" class="titledesc"> |
393 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
393 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
394 | 394 | </th> |
395 | - <td class="give-forminp give-forminp-<?php echo sanitize_title( $value['type'] ) ?>"> |
|
395 | + <td class="give-forminp give-forminp-<?php echo sanitize_title($value['type']) ?>"> |
|
396 | 396 | <input |
397 | - name="<?php echo esc_attr( $value['id'] ); ?>" |
|
398 | - id="<?php echo esc_attr( $value['id'] ); ?>" |
|
399 | - type="<?php echo esc_attr( $type ); ?>" |
|
400 | - style="<?php echo esc_attr( $value['css'] ); ?>" |
|
401 | - value="<?php echo esc_attr( $option_value ); ?>" |
|
402 | - class="give-input-field<?php echo( empty( $value['class'] ) ? '' : ' ' . esc_attr( $value['class'] ) ); ?>" |
|
403 | - <?php echo implode( ' ', $custom_attributes ); ?> |
|
397 | + name="<?php echo esc_attr($value['id']); ?>" |
|
398 | + id="<?php echo esc_attr($value['id']); ?>" |
|
399 | + type="<?php echo esc_attr($type); ?>" |
|
400 | + style="<?php echo esc_attr($value['css']); ?>" |
|
401 | + value="<?php echo esc_attr($option_value); ?>" |
|
402 | + class="give-input-field<?php echo(empty($value['class']) ? '' : ' '.esc_attr($value['class'])); ?>" |
|
403 | + <?php echo implode(' ', $custom_attributes); ?> |
|
404 | 404 | /> <?php echo $description; ?> |
405 | 405 | </td> |
406 | 406 | </tr><?php |
@@ -409,23 +409,23 @@ discard block |
||
409 | 409 | // Textarea. |
410 | 410 | case 'textarea': |
411 | 411 | |
412 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
412 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
413 | 413 | |
414 | 414 | ?> |
415 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
415 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
416 | 416 | <th scope="row" class="titledesc"> |
417 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
417 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
418 | 418 | </th> |
419 | - <td class="give-forminp give-forminp-<?php echo sanitize_title( $value['type'] ) ?>"> |
|
419 | + <td class="give-forminp give-forminp-<?php echo sanitize_title($value['type']) ?>"> |
|
420 | 420 | <textarea |
421 | - name="<?php echo esc_attr( $value['id'] ); ?>" |
|
422 | - id="<?php echo esc_attr( $value['id'] ); ?>" |
|
423 | - style="<?php echo esc_attr( $value['css'] ); ?>" |
|
424 | - class="<?php echo esc_attr( $value['class'] ); ?>" |
|
421 | + name="<?php echo esc_attr($value['id']); ?>" |
|
422 | + id="<?php echo esc_attr($value['id']); ?>" |
|
423 | + style="<?php echo esc_attr($value['css']); ?>" |
|
424 | + class="<?php echo esc_attr($value['class']); ?>" |
|
425 | 425 | rows="10" |
426 | 426 | cols="60" |
427 | - <?php echo implode( ' ', $custom_attributes ); ?> |
|
428 | - ><?php echo esc_textarea( $option_value ); ?></textarea> |
|
427 | + <?php echo implode(' ', $custom_attributes); ?> |
|
428 | + ><?php echo esc_textarea($option_value); ?></textarea> |
|
429 | 429 | <?php echo $description; ?> |
430 | 430 | </td> |
431 | 431 | </tr><?php |
@@ -435,35 +435,35 @@ discard block |
||
435 | 435 | case 'select' : |
436 | 436 | case 'multiselect' : |
437 | 437 | |
438 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
438 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
439 | 439 | |
440 | 440 | ?> |
441 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
441 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
442 | 442 | <th scope="row" class="titledesc"> |
443 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
443 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
444 | 444 | </th> |
445 | - <td class="give-forminp give-forminp-<?php echo sanitize_title( $value['type'] ) ?>"> |
|
445 | + <td class="give-forminp give-forminp-<?php echo sanitize_title($value['type']) ?>"> |
|
446 | 446 | <select |
447 | - name="<?php echo esc_attr( $value['id'] ); ?><?php if ( $value['type'] == 'multiselect' ) { |
|
447 | + name="<?php echo esc_attr($value['id']); ?><?php if ($value['type'] == 'multiselect') { |
|
448 | 448 | echo '[]'; |
449 | 449 | } ?>" |
450 | - id="<?php echo esc_attr( $value['id'] ); ?>" |
|
451 | - style="<?php echo esc_attr( $value['css'] ); ?>" |
|
452 | - class="<?php echo esc_attr( $value['class'] ); ?>" |
|
453 | - <?php echo implode( ' ', $custom_attributes ); ?> |
|
454 | - <?php echo ( 'multiselect' == $value['type'] ) ? 'multiple="multiple"' : ''; ?> |
|
450 | + id="<?php echo esc_attr($value['id']); ?>" |
|
451 | + style="<?php echo esc_attr($value['css']); ?>" |
|
452 | + class="<?php echo esc_attr($value['class']); ?>" |
|
453 | + <?php echo implode(' ', $custom_attributes); ?> |
|
454 | + <?php echo ('multiselect' == $value['type']) ? 'multiple="multiple"' : ''; ?> |
|
455 | 455 | > |
456 | 456 | |
457 | 457 | <?php |
458 | - if ( ! empty( $value['options'] ) ) { |
|
459 | - foreach ( $value['options'] as $key => $val ) { |
|
458 | + if ( ! empty($value['options'])) { |
|
459 | + foreach ($value['options'] as $key => $val) { |
|
460 | 460 | ?> |
461 | - <option value="<?php echo esc_attr( $key ); ?>" <?php |
|
461 | + <option value="<?php echo esc_attr($key); ?>" <?php |
|
462 | 462 | |
463 | - if ( is_array( $option_value ) ) { |
|
464 | - selected( in_array( $key, $option_value ), true ); |
|
463 | + if (is_array($option_value)) { |
|
464 | + selected(in_array($key, $option_value), true); |
|
465 | 465 | } else { |
466 | - selected( $option_value, $key ); |
|
466 | + selected($option_value, $key); |
|
467 | 467 | } |
468 | 468 | |
469 | 469 | ?>><?php echo $val ?></option> |
@@ -479,28 +479,28 @@ discard block |
||
479 | 479 | |
480 | 480 | // Radio inputs. |
481 | 481 | case 'radio_inline' : |
482 | - $value['class'] = empty( $value['class'] ) ? 'give-radio-inline' : $value['class'] . ' give-radio-inline'; |
|
482 | + $value['class'] = empty($value['class']) ? 'give-radio-inline' : $value['class'].' give-radio-inline'; |
|
483 | 483 | case 'radio' : |
484 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
484 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
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'] ) ?> <?php echo( ! empty( $value['class'] ) ? $value['class'] : '' ); ?>"> |
|
490 | + <td class="give-forminp give-forminp-<?php echo sanitize_title($value['type']) ?> <?php echo( ! empty($value['class']) ? $value['class'] : ''); ?>"> |
|
491 | 491 | <fieldset> |
492 | 492 | <ul> |
493 | 493 | <?php |
494 | - foreach ( $value['options'] as $key => $val ) { |
|
494 | + foreach ($value['options'] as $key => $val) { |
|
495 | 495 | ?> |
496 | 496 | <li> |
497 | 497 | <label><input |
498 | - name="<?php echo esc_attr( $value['id'] ); ?>" |
|
498 | + name="<?php echo esc_attr($value['id']); ?>" |
|
499 | 499 | value="<?php echo $key; ?>" |
500 | 500 | type="radio" |
501 | - style="<?php echo esc_attr( $value['css'] ); ?>" |
|
502 | - <?php echo implode( ' ', $custom_attributes ); ?> |
|
503 | - <?php checked( $key, $option_value ); ?> |
|
501 | + style="<?php echo esc_attr($value['css']); ?>" |
|
502 | + <?php echo implode(' ', $custom_attributes); ?> |
|
503 | + <?php checked($key, $option_value); ?> |
|
504 | 504 | /> <?php echo $val ?></label> |
505 | 505 | </li> |
506 | 506 | <?php |
@@ -514,21 +514,21 @@ discard block |
||
514 | 514 | |
515 | 515 | // Checkbox input. |
516 | 516 | case 'checkbox' : |
517 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
517 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
518 | 518 | ?> |
519 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
519 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
520 | 520 | <th scope="row" class="titledesc"> |
521 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
521 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
522 | 522 | </th> |
523 | 523 | <td class="give-forminp"> |
524 | 524 | <input |
525 | - name="<?php echo esc_attr( $value['id'] ); ?>" |
|
526 | - id="<?php echo esc_attr( $value['id'] ); ?>" |
|
525 | + name="<?php echo esc_attr($value['id']); ?>" |
|
526 | + id="<?php echo esc_attr($value['id']); ?>" |
|
527 | 527 | type="checkbox" |
528 | - class="<?php echo esc_attr( isset( $value['class'] ) ? $value['class'] : '' ); ?>" |
|
528 | + class="<?php echo esc_attr(isset($value['class']) ? $value['class'] : ''); ?>" |
|
529 | 529 | value="1" |
530 | - <?php checked( $option_value, 'on' ); ?> |
|
531 | - <?php echo implode( ' ', $custom_attributes ); ?> |
|
530 | + <?php checked($option_value, 'on'); ?> |
|
531 | + <?php echo implode(' ', $custom_attributes); ?> |
|
532 | 532 | /> |
533 | 533 | <?php echo $description; ?> |
534 | 534 | </td> |
@@ -538,28 +538,28 @@ discard block |
||
538 | 538 | |
539 | 539 | // Multi Checkbox input. |
540 | 540 | case 'multicheck' : |
541 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
542 | - $option_value = is_array( $option_value ) ? $option_value : array(); |
|
541 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
542 | + $option_value = is_array($option_value) ? $option_value : array(); |
|
543 | 543 | ?> |
544 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
544 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
545 | 545 | <th scope="row" class="titledesc"> |
546 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
546 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
547 | 547 | </th> |
548 | - <td class="give-forminp give-forminp-<?php echo sanitize_title( $value['type'] ) ?> <?php echo( ! empty( $value['class'] ) ? $value['class'] : '' ); ?>"> |
|
548 | + <td class="give-forminp give-forminp-<?php echo sanitize_title($value['type']) ?> <?php echo( ! empty($value['class']) ? $value['class'] : ''); ?>"> |
|
549 | 549 | <fieldset> |
550 | 550 | <ul> |
551 | 551 | <?php |
552 | - foreach ( $value['options'] as $key => $val ) { |
|
552 | + foreach ($value['options'] as $key => $val) { |
|
553 | 553 | ?> |
554 | 554 | <li> |
555 | 555 | <label> |
556 | 556 | <input |
557 | - name="<?php echo esc_attr( $value['id'] ); ?>[]" |
|
557 | + name="<?php echo esc_attr($value['id']); ?>[]" |
|
558 | 558 | value="<?php echo $key; ?>" |
559 | 559 | type="checkbox" |
560 | - style="<?php echo esc_attr( $value['css'] ); ?>" |
|
561 | - <?php echo implode( ' ', $custom_attributes ); ?> |
|
562 | - <?php if ( in_array( $key, $option_value ) ) { |
|
560 | + style="<?php echo esc_attr($value['css']); ?>" |
|
561 | + <?php echo implode(' ', $custom_attributes); ?> |
|
562 | + <?php if (in_array($key, $option_value)) { |
|
563 | 563 | echo 'checked="checked"'; |
564 | 564 | } ?> |
565 | 565 | /> <?php echo $val ?> |
@@ -578,35 +578,35 @@ discard block |
||
578 | 578 | // File input field. |
579 | 579 | case 'file' : |
580 | 580 | case 'media' : |
581 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
582 | - $button_label = esc_html__( sprintf( 'Add or Upload %s', ( 'file' === $value['type'] ? 'File' : 'Image' ) ), 'give' ); |
|
583 | - $fvalue = empty( $value['fvalue'] ) ? 'url' : $value['fvalue']; |
|
584 | - |
|
585 | - $allow_media_preview_tags = array( 'jpg', 'jpeg', 'png', 'gif', 'ico' ); |
|
586 | - $preview_image_src = $option_value ? ( 'id' === $fvalue ? wp_get_attachment_url( $option_value ) : $option_value ) : '#'; |
|
587 | - $preview_image_extension = $preview_image_src ? pathinfo( $preview_image_src, PATHINFO_EXTENSION ) : ''; |
|
588 | - $is_show_preview = in_array( $preview_image_extension, $allow_media_preview_tags ); |
|
581 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
582 | + $button_label = esc_html__(sprintf('Add or Upload %s', ('file' === $value['type'] ? 'File' : 'Image')), 'give'); |
|
583 | + $fvalue = empty($value['fvalue']) ? 'url' : $value['fvalue']; |
|
584 | + |
|
585 | + $allow_media_preview_tags = array('jpg', 'jpeg', 'png', 'gif', 'ico'); |
|
586 | + $preview_image_src = $option_value ? ('id' === $fvalue ? wp_get_attachment_url($option_value) : $option_value) : '#'; |
|
587 | + $preview_image_extension = $preview_image_src ? pathinfo($preview_image_src, PATHINFO_EXTENSION) : ''; |
|
588 | + $is_show_preview = in_array($preview_image_extension, $allow_media_preview_tags); |
|
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 | <div class="give-field-wrap"> |
596 | 596 | <label for="<?php echo $value['id'] ?>"> |
597 | 597 | <input |
598 | - name="<?php echo esc_attr( $value['id'] ); ?>" |
|
599 | - id="<?php echo esc_attr( $value['id'] ); ?>" |
|
598 | + name="<?php echo esc_attr($value['id']); ?>" |
|
599 | + id="<?php echo esc_attr($value['id']); ?>" |
|
600 | 600 | type="text" |
601 | - class="give-input-field<?php echo esc_attr( isset( $value['class'] ) ? ' ' . $value['class'] : '' ); ?>" |
|
601 | + class="give-input-field<?php echo esc_attr(isset($value['class']) ? ' '.$value['class'] : ''); ?>" |
|
602 | 602 | value="<?php echo $option_value; ?>" |
603 | - style="<?php echo esc_attr( $value['css'] ); ?>" |
|
604 | - <?php echo implode( ' ', $custom_attributes ); ?> |
|
603 | + style="<?php echo esc_attr($value['css']); ?>" |
|
604 | + <?php echo implode(' ', $custom_attributes); ?> |
|
605 | 605 | /> <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; ?>"> |
606 | 606 | <?php echo $description ?> |
607 | 607 | <div class="give-image-thumb<?php echo ! $option_value || ! $is_show_preview ? ' give-hidden' : ''; ?>"> |
608 | 608 | <span class="give-delete-image-thumb dashicons dashicons-no-alt"></span> |
609 | - <img src="<?php echo $preview_image_src ; ?>" alt=""> |
|
609 | + <img src="<?php echo $preview_image_src; ?>" alt=""> |
|
610 | 610 | </div> |
611 | 611 | </label> |
612 | 612 | </div> |
@@ -618,17 +618,17 @@ discard block |
||
618 | 618 | // WordPress Editor. |
619 | 619 | case 'wysiwyg' : |
620 | 620 | // Get option value. |
621 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
621 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
622 | 622 | |
623 | 623 | // Get editor settings. |
624 | - $editor_settings = ! empty( $value['options'] ) ? $value['options'] : array(); |
|
624 | + $editor_settings = ! empty($value['options']) ? $value['options'] : array(); |
|
625 | 625 | ?> |
626 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
626 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
627 | 627 | <th scope="row" class="titledesc"> |
628 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
628 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
629 | 629 | </th> |
630 | 630 | <td class="give-forminp"> |
631 | - <?php wp_editor( $option_value, $value['id'], $editor_settings ); ?> |
|
631 | + <?php wp_editor($option_value, $value['id'], $editor_settings); ?> |
|
632 | 632 | <?php echo $description; ?> |
633 | 633 | </td> |
634 | 634 | </tr><?php |
@@ -637,9 +637,9 @@ discard block |
||
637 | 637 | // Custom: System setting field. |
638 | 638 | case 'system_info' : |
639 | 639 | ?> |
640 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
640 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
641 | 641 | <th scope="row" class="titledesc"> |
642 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
642 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
643 | 643 | </th> |
644 | 644 | <td class="give-forminp"> |
645 | 645 | <?php give_system_info_callback(); ?> |
@@ -650,14 +650,14 @@ discard block |
||
650 | 650 | |
651 | 651 | // Custom: Default gateways setting field. |
652 | 652 | case 'default_gateway' : |
653 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
653 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
654 | 654 | ?> |
655 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
655 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
656 | 656 | <th scope="row" class="titledesc"> |
657 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
657 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
658 | 658 | </th> |
659 | 659 | <td class="give-forminp"> |
660 | - <?php give_default_gateway_callback( $value, $option_value ); ?> |
|
660 | + <?php give_default_gateway_callback($value, $option_value); ?> |
|
661 | 661 | <?php echo $description; ?> |
662 | 662 | </td> |
663 | 663 | </tr><?php |
@@ -665,14 +665,14 @@ discard block |
||
665 | 665 | |
666 | 666 | // Custom: Enable gateways setting field. |
667 | 667 | case 'enabled_gateways' : |
668 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
668 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
669 | 669 | ?> |
670 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
670 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
671 | 671 | <th scope="row" class="titledesc"> |
672 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
672 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
673 | 673 | </th> |
674 | 674 | <td class="give-forminp"> |
675 | - <?php give_enabled_gateways_callback( $value, $option_value ); ?> |
|
675 | + <?php give_enabled_gateways_callback($value, $option_value); ?> |
|
676 | 676 | <?php echo $description; ?> |
677 | 677 | </td> |
678 | 678 | </tr><?php |
@@ -681,9 +681,9 @@ discard block |
||
681 | 681 | // Custom: Email preview buttons field. |
682 | 682 | case 'email_preview_buttons' : |
683 | 683 | ?> |
684 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
684 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
685 | 685 | <th scope="row" class="titledesc"> |
686 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
686 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
687 | 687 | </th> |
688 | 688 | <td class="give-forminp"> |
689 | 689 | <?php give_email_preview_buttons_callback(); ?> |
@@ -700,22 +700,22 @@ discard block |
||
700 | 700 | |
701 | 701 | // Custom: Gateway API key. |
702 | 702 | case 'api_key' : |
703 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
704 | - $type = ! empty( $option_value ) ? 'password' : 'text'; |
|
703 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
704 | + $type = ! empty($option_value) ? 'password' : 'text'; |
|
705 | 705 | ?> |
706 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
706 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
707 | 707 | <th scope="row" class="titledesc"> |
708 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
708 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
709 | 709 | </th> |
710 | - <td class="give-forminp give-forminp-<?php echo sanitize_title( $value['type'] ) ?>"> |
|
710 | + <td class="give-forminp give-forminp-<?php echo sanitize_title($value['type']) ?>"> |
|
711 | 711 | <input |
712 | - name="<?php echo esc_attr( $value['id'] ); ?>" |
|
713 | - id="<?php echo esc_attr( $value['id'] ); ?>" |
|
714 | - type="<?php echo esc_attr( $type ); ?>" |
|
715 | - style="<?php echo esc_attr( $value['css'] ); ?>" |
|
716 | - value="<?php echo esc_attr( trim( $option_value ) ); ?>" |
|
717 | - class="give-input-field<?php echo( empty( $value['class'] ) ? '' : ' ' . esc_attr( $value['class'] ) ); ?>" |
|
718 | - <?php echo implode( ' ', $custom_attributes ); ?> |
|
712 | + name="<?php echo esc_attr($value['id']); ?>" |
|
713 | + id="<?php echo esc_attr($value['id']); ?>" |
|
714 | + type="<?php echo esc_attr($type); ?>" |
|
715 | + style="<?php echo esc_attr($value['css']); ?>" |
|
716 | + value="<?php echo esc_attr(trim($option_value)); ?>" |
|
717 | + class="give-input-field<?php echo(empty($value['class']) ? '' : ' '.esc_attr($value['class'])); ?>" |
|
718 | + <?php echo implode(' ', $custom_attributes); ?> |
|
719 | 719 | /> <?php echo $description; ?> |
720 | 720 | </td> |
721 | 721 | </tr><?php |
@@ -724,7 +724,7 @@ discard block |
||
724 | 724 | // Custom: Log field. |
725 | 725 | case 'logs' : |
726 | 726 | |
727 | - include GIVE_PLUGIN_DIR . 'includes/admin/tools/logs/logs.php'; |
|
727 | + include GIVE_PLUGIN_DIR.'includes/admin/tools/logs/logs.php'; |
|
728 | 728 | |
729 | 729 | // Get current section. |
730 | 730 | $current_section = $_GET['section'] = give_get_current_setting_section(); |
@@ -734,7 +734,7 @@ discard block |
||
734 | 734 | * |
735 | 735 | * @since 1.0 |
736 | 736 | */ |
737 | - do_action( "give_logs_view_{$current_section}" ); |
|
737 | + do_action("give_logs_view_{$current_section}"); |
|
738 | 738 | |
739 | 739 | echo $description; |
740 | 740 | break; |
@@ -742,7 +742,7 @@ discard block |
||
742 | 742 | // Custom: Data field. |
743 | 743 | case 'data' : |
744 | 744 | |
745 | - include GIVE_PLUGIN_DIR . 'includes/admin/tools/views/html-admin-page-data.php'; |
|
745 | + include GIVE_PLUGIN_DIR.'includes/admin/tools/views/html-admin-page-data.php'; |
|
746 | 746 | |
747 | 747 | echo $description; |
748 | 748 | break; |
@@ -750,12 +750,12 @@ discard block |
||
750 | 750 | // Custom: Give Docs Link field type. |
751 | 751 | case 'give_docs_link' : |
752 | 752 | ?> |
753 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
753 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
754 | 754 | <td class="give-docs-link" colspan="2"> |
755 | 755 | <?php |
756 | - echo '<p class="give-docs-link"><a href="' . esc_url( $value['url'] ) |
|
756 | + echo '<p class="give-docs-link"><a href="'.esc_url($value['url']) |
|
757 | 757 | . '" target="_blank">' |
758 | - . sprintf( esc_html__( 'Need Help? See docs on "%s"', 'give' ), $value['title'] ) |
|
758 | + . sprintf(esc_html__('Need Help? See docs on "%s"', 'give'), $value['title']) |
|
759 | 759 | . '<span class="dashicons dashicons-editor-help"></span></a></p>'; |
760 | 760 | ?> |
761 | 761 | </td> |
@@ -766,8 +766,8 @@ discard block |
||
766 | 766 | // You can add or handle your custom field action. |
767 | 767 | default: |
768 | 768 | // Get option value. |
769 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
770 | - do_action( 'give_admin_field_' . $value['type'], $value, $option_value ); |
|
769 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
770 | + do_action('give_admin_field_'.$value['type'], $value, $option_value); |
|
771 | 771 | break; |
772 | 772 | } |
773 | 773 | } |
@@ -783,15 +783,15 @@ discard block |
||
783 | 783 | * |
784 | 784 | * @return string The HTML description of the field. |
785 | 785 | */ |
786 | - public static function get_field_description( $value ) { |
|
786 | + public static function get_field_description($value) { |
|
787 | 787 | $description = ''; |
788 | 788 | |
789 | 789 | // Support for both 'description' and 'desc' args. |
790 | - $description_key = isset( $value['description'] ) ? 'description' : 'desc'; |
|
791 | - $value = ( isset( $value[ $description_key ] ) && ! empty( $value[ $description_key ] ) ) ? $value[ $description_key ] : ''; |
|
790 | + $description_key = isset($value['description']) ? 'description' : 'desc'; |
|
791 | + $value = (isset($value[$description_key]) && ! empty($value[$description_key])) ? $value[$description_key] : ''; |
|
792 | 792 | |
793 | - if ( ! empty( $value ) ) { |
|
794 | - $description = '<p class="give-field-description">' . wp_kses_post( $value ) . '</p>'; |
|
793 | + if ( ! empty($value)) { |
|
794 | + $description = '<p class="give-field-description">'.wp_kses_post($value).'</p>'; |
|
795 | 795 | } |
796 | 796 | |
797 | 797 | return $description; |
@@ -808,11 +808,11 @@ discard block |
||
808 | 808 | * |
809 | 809 | * @return array The description and tip as a 2 element array |
810 | 810 | */ |
811 | - public static function get_field_title( $value ) { |
|
812 | - $title = esc_html( $value['title'] ); |
|
811 | + public static function get_field_title($value) { |
|
812 | + $title = esc_html($value['title']); |
|
813 | 813 | |
814 | 814 | // If html tag detected then allow them to print. |
815 | - if ( strip_tags( $title ) ) { |
|
815 | + if (strip_tags($title)) { |
|
816 | 816 | $title = $value['title']; |
817 | 817 | } |
818 | 818 | |
@@ -831,8 +831,8 @@ discard block |
||
831 | 831 | * |
832 | 832 | * @return bool |
833 | 833 | */ |
834 | - public static function save_fields( $options, $option_name = '' ) { |
|
835 | - if ( empty( $_POST ) ) { |
|
834 | + public static function save_fields($options, $option_name = '') { |
|
835 | + if (empty($_POST)) { |
|
836 | 836 | return false; |
837 | 837 | } |
838 | 838 | |
@@ -840,37 +840,37 @@ discard block |
||
840 | 840 | $update_options = array(); |
841 | 841 | |
842 | 842 | // Loop options and get values to save. |
843 | - foreach ( $options as $option ) { |
|
844 | - if ( ! isset( $option['id'] ) || ! isset( $option['type'] ) ) { |
|
843 | + foreach ($options as $option) { |
|
844 | + if ( ! isset($option['id']) || ! isset($option['type'])) { |
|
845 | 845 | continue; |
846 | 846 | } |
847 | 847 | |
848 | 848 | // Get posted value. |
849 | - if ( strstr( $option['id'], '[' ) ) { |
|
850 | - parse_str( $option['id'], $option_name_array ); |
|
851 | - $field_option_name = current( array_keys( $option_name_array ) ); |
|
852 | - $setting_name = key( $option_name_array[ $field_option_name ] ); |
|
853 | - $raw_value = isset( $_POST[ $field_option_name ][ $setting_name ] ) ? wp_unslash( $_POST[ $field_option_name ][ $setting_name ] ) : null; |
|
849 | + if (strstr($option['id'], '[')) { |
|
850 | + parse_str($option['id'], $option_name_array); |
|
851 | + $field_option_name = current(array_keys($option_name_array)); |
|
852 | + $setting_name = key($option_name_array[$field_option_name]); |
|
853 | + $raw_value = isset($_POST[$field_option_name][$setting_name]) ? wp_unslash($_POST[$field_option_name][$setting_name]) : null; |
|
854 | 854 | } else { |
855 | 855 | $field_option_name = $option['id']; |
856 | 856 | $setting_name = ''; |
857 | - $raw_value = isset( $_POST[ $option['id'] ] ) ? wp_unslash( $_POST[ $option['id'] ] ) : null; |
|
857 | + $raw_value = isset($_POST[$option['id']]) ? wp_unslash($_POST[$option['id']]) : null; |
|
858 | 858 | } |
859 | 859 | |
860 | 860 | // Format the value based on option type. |
861 | - switch ( $option['type'] ) { |
|
861 | + switch ($option['type']) { |
|
862 | 862 | case 'checkbox' : |
863 | - $value = is_null( $raw_value ) ? '' : 'on'; |
|
863 | + $value = is_null($raw_value) ? '' : 'on'; |
|
864 | 864 | break; |
865 | 865 | case 'wysiwyg' : |
866 | 866 | case 'textarea' : |
867 | - $value = wp_kses_post( trim( $raw_value ) ); |
|
867 | + $value = wp_kses_post(trim($raw_value)); |
|
868 | 868 | break; |
869 | 869 | case 'multiselect' : |
870 | - $value = array_filter( array_map( 'give_clean', (array) $raw_value ) ); |
|
870 | + $value = array_filter(array_map('give_clean', (array) $raw_value)); |
|
871 | 871 | break; |
872 | 872 | default : |
873 | - $value = give_clean( $raw_value ); |
|
873 | + $value = give_clean($raw_value); |
|
874 | 874 | break; |
875 | 875 | } |
876 | 876 | |
@@ -879,37 +879,37 @@ discard block |
||
879 | 879 | * |
880 | 880 | * @since 1.8 |
881 | 881 | */ |
882 | - $value = apply_filters( 'give_admin_settings_sanitize_option', $value, $option, $raw_value ); |
|
882 | + $value = apply_filters('give_admin_settings_sanitize_option', $value, $option, $raw_value); |
|
883 | 883 | |
884 | 884 | /** |
885 | 885 | * Sanitize the value of an option by option name. |
886 | 886 | * |
887 | 887 | * @since 1.8 |
888 | 888 | */ |
889 | - $value = apply_filters( "give_admin_settings_sanitize_option_{$field_option_name}", $value, $option, $raw_value ); |
|
889 | + $value = apply_filters("give_admin_settings_sanitize_option_{$field_option_name}", $value, $option, $raw_value); |
|
890 | 890 | |
891 | - if ( is_null( $value ) ) { |
|
891 | + if (is_null($value)) { |
|
892 | 892 | continue; |
893 | 893 | } |
894 | 894 | |
895 | 895 | // Check if option is an array and handle that differently to single values. |
896 | - if ( $field_option_name && $setting_name ) { |
|
897 | - if ( ! isset( $update_options[ $field_option_name ] ) ) { |
|
898 | - $update_options[ $field_option_name ] = get_option( $field_option_name, array() ); |
|
896 | + if ($field_option_name && $setting_name) { |
|
897 | + if ( ! isset($update_options[$field_option_name])) { |
|
898 | + $update_options[$field_option_name] = get_option($field_option_name, array()); |
|
899 | 899 | } |
900 | - if ( ! is_array( $update_options[ $field_option_name ] ) ) { |
|
901 | - $update_options[ $field_option_name ] = array(); |
|
900 | + if ( ! is_array($update_options[$field_option_name])) { |
|
901 | + $update_options[$field_option_name] = array(); |
|
902 | 902 | } |
903 | - $update_options[ $field_option_name ][ $setting_name ] = $value; |
|
903 | + $update_options[$field_option_name][$setting_name] = $value; |
|
904 | 904 | } else { |
905 | - $update_options[ $field_option_name ] = $value; |
|
905 | + $update_options[$field_option_name] = $value; |
|
906 | 906 | } |
907 | 907 | } |
908 | 908 | |
909 | 909 | // Save all options in our array or there own option name i.e. option id. |
910 | - if ( empty( $option_name ) ) { |
|
911 | - foreach ( $update_options as $name => $value ) { |
|
912 | - update_option( $name, $value ); |
|
910 | + if (empty($option_name)) { |
|
911 | + foreach ($update_options as $name => $value) { |
|
912 | + update_option($name, $value); |
|
913 | 913 | |
914 | 914 | /** |
915 | 915 | * Trigger action. |
@@ -918,13 +918,13 @@ discard block |
||
918 | 918 | * |
919 | 919 | * @since 1.8 |
920 | 920 | */ |
921 | - do_action( "give_save_option_{$name}", $value, $name ); |
|
921 | + do_action("give_save_option_{$name}", $value, $name); |
|
922 | 922 | } |
923 | 923 | } else { |
924 | - $old_options = ( $old_options = get_option( $option_name ) ) ? $old_options : array(); |
|
925 | - $update_options = array_merge( $old_options, $update_options ); |
|
924 | + $old_options = ($old_options = get_option($option_name)) ? $old_options : array(); |
|
925 | + $update_options = array_merge($old_options, $update_options); |
|
926 | 926 | |
927 | - update_option( $option_name, $update_options ); |
|
927 | + update_option($option_name, $update_options); |
|
928 | 928 | |
929 | 929 | /** |
930 | 930 | * Trigger action. |
@@ -933,7 +933,7 @@ discard block |
||
933 | 933 | * |
934 | 934 | * @since 1.8 |
935 | 935 | */ |
936 | - do_action( "give_save_settings_{$option_name}", $update_options, $option_name ); |
|
936 | + do_action("give_save_settings_{$option_name}", $update_options, $option_name); |
|
937 | 937 | } |
938 | 938 | |
939 | 939 | return true; |
@@ -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,36 +23,36 @@ discard block |
||
23 | 23 | function give_setup_post_types() { |
24 | 24 | |
25 | 25 | // Give Forms single post and archive options. |
26 | - $give_forms_singular = give_is_setting_enabled( give_get_option( 'forms_singular' ) ); |
|
27 | - $give_forms_archives = give_is_setting_enabled( give_get_option( 'forms_archives' ) ); |
|
26 | + $give_forms_singular = give_is_setting_enabled(give_get_option('forms_singular')); |
|
27 | + $give_forms_archives = give_is_setting_enabled(give_get_option('forms_archives')); |
|
28 | 28 | |
29 | - $give_forms_slug = defined( 'GIVE_SLUG' ) ? GIVE_SLUG : 'donations'; |
|
29 | + $give_forms_slug = defined('GIVE_SLUG') ? GIVE_SLUG : 'donations'; |
|
30 | 30 | // Support for old 'GIVE_FORMS_SLUG' constant |
31 | - if ( defined( 'GIVE_FORMS_SLUG' ) ) { |
|
31 | + if (defined('GIVE_FORMS_SLUG')) { |
|
32 | 32 | $give_forms_slug = GIVE_FORMS_SLUG; |
33 | 33 | } |
34 | 34 | |
35 | - $give_forms_rewrite = defined( 'GIVE_DISABLE_FORMS_REWRITE' ) && GIVE_DISABLE_FORMS_REWRITE ? false : array( |
|
35 | + $give_forms_rewrite = defined('GIVE_DISABLE_FORMS_REWRITE') && GIVE_DISABLE_FORMS_REWRITE ? false : array( |
|
36 | 36 | 'slug' => $give_forms_slug, |
37 | 37 | 'with_front' => false, |
38 | 38 | ); |
39 | 39 | |
40 | - $give_forms_labels = apply_filters( 'give_forms_labels', array( |
|
41 | - 'name' => __( 'Donation Forms', 'give' ), |
|
42 | - 'singular_name' => __( 'Form', 'give' ), |
|
43 | - 'add_new' => __( 'Add Form', 'give' ), |
|
44 | - 'add_new_item' => __( 'Add New Donation Form', 'give' ), |
|
45 | - 'edit_item' => __( 'Edit Donation Form', 'give' ), |
|
46 | - 'new_item' => __( 'New Form', 'give' ), |
|
47 | - 'all_items' => __( 'All Forms', 'give' ), |
|
48 | - 'view_item' => __( 'View Form', 'give' ), |
|
49 | - 'search_items' => __( 'Search Forms', 'give' ), |
|
50 | - 'not_found' => __( 'No forms found.', 'give' ), |
|
51 | - 'not_found_in_trash' => __( 'No forms found in Trash.', 'give' ), |
|
40 | + $give_forms_labels = apply_filters('give_forms_labels', array( |
|
41 | + 'name' => __('Donation Forms', 'give'), |
|
42 | + 'singular_name' => __('Form', 'give'), |
|
43 | + 'add_new' => __('Add Form', 'give'), |
|
44 | + 'add_new_item' => __('Add New Donation Form', 'give'), |
|
45 | + 'edit_item' => __('Edit Donation Form', 'give'), |
|
46 | + 'new_item' => __('New Form', 'give'), |
|
47 | + 'all_items' => __('All Forms', 'give'), |
|
48 | + 'view_item' => __('View Form', 'give'), |
|
49 | + 'search_items' => __('Search Forms', 'give'), |
|
50 | + 'not_found' => __('No forms found.', 'give'), |
|
51 | + 'not_found_in_trash' => __('No forms found in Trash.', 'give'), |
|
52 | 52 | 'parent_item_colon' => '', |
53 | - 'menu_name' => apply_filters( 'give_menu_name', __( 'Donations', 'give' ) ), |
|
54 | - 'name_admin_bar' => apply_filters( 'give_name_admin_bar_name', __( 'Donation Form', 'give' ) ), |
|
55 | - ) ); |
|
53 | + 'menu_name' => apply_filters('give_menu_name', __('Donations', 'give')), |
|
54 | + 'name_admin_bar' => apply_filters('give_name_admin_bar_name', __('Donation Form', 'give')), |
|
55 | + )); |
|
56 | 56 | |
57 | 57 | // Default give_forms supports. |
58 | 58 | $give_form_supports = array( |
@@ -64,14 +64,14 @@ discard block |
||
64 | 64 | ); |
65 | 65 | |
66 | 66 | // Has the user disabled the excerpt? |
67 | - if ( ! give_is_setting_enabled( give_get_option( 'forms_excerpt' ) ) ) { |
|
68 | - unset( $give_form_supports[2] ); |
|
67 | + if ( ! give_is_setting_enabled(give_get_option('forms_excerpt'))) { |
|
68 | + unset($give_form_supports[2]); |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | // Has user disabled the featured image? |
72 | - if ( ! give_is_setting_enabled( give_get_option( 'form_featured_img' ) ) ) { |
|
73 | - unset( $give_form_supports[1] ); |
|
74 | - remove_action( 'give_before_single_form_summary', 'give_show_form_images' ); |
|
72 | + if ( ! give_is_setting_enabled(give_get_option('form_featured_img'))) { |
|
73 | + unset($give_form_supports[1]); |
|
74 | + remove_action('give_before_single_form_summary', 'give_show_form_images'); |
|
75 | 75 | } |
76 | 76 | |
77 | 77 | $give_forms_args = array( |
@@ -87,42 +87,42 @@ discard block |
||
87 | 87 | 'has_archive' => $give_forms_archives, |
88 | 88 | 'menu_icon' => 'dashicons-give', |
89 | 89 | 'hierarchical' => false, |
90 | - 'supports' => apply_filters( 'give_forms_supports', $give_form_supports ), |
|
90 | + 'supports' => apply_filters('give_forms_supports', $give_form_supports), |
|
91 | 91 | ); |
92 | - register_post_type( 'give_forms', apply_filters( 'give_forms_post_type_args', $give_forms_args ) ); |
|
92 | + register_post_type('give_forms', apply_filters('give_forms_post_type_args', $give_forms_args)); |
|
93 | 93 | |
94 | 94 | /** Donation Post Type */ |
95 | 95 | $payment_labels = array( |
96 | - 'name' => _x( 'Donations', 'post type general name', 'give' ), |
|
97 | - 'singular_name' => _x( 'Donation', 'post type singular name', 'give' ), |
|
98 | - 'add_new' => __( 'Add New', 'give' ), |
|
99 | - 'add_new_item' => __( 'Add New Donation', 'give' ), |
|
100 | - 'edit_item' => __( 'Edit Donation', 'give' ), |
|
101 | - 'new_item' => __( 'New Donation', 'give' ), |
|
102 | - 'all_items' => __( 'All Donations', 'give' ), |
|
103 | - 'view_item' => __( 'View Donation', 'give' ), |
|
104 | - 'search_items' => __( 'Search Donations', 'give' ), |
|
105 | - 'not_found' => __( 'No donations found.', 'give' ), |
|
106 | - 'not_found_in_trash' => __( 'No donations found in Trash.', 'give' ), |
|
96 | + 'name' => _x('Donations', 'post type general name', 'give'), |
|
97 | + 'singular_name' => _x('Donation', 'post type singular name', 'give'), |
|
98 | + 'add_new' => __('Add New', 'give'), |
|
99 | + 'add_new_item' => __('Add New Donation', 'give'), |
|
100 | + 'edit_item' => __('Edit Donation', 'give'), |
|
101 | + 'new_item' => __('New Donation', 'give'), |
|
102 | + 'all_items' => __('All Donations', 'give'), |
|
103 | + 'view_item' => __('View Donation', 'give'), |
|
104 | + 'search_items' => __('Search Donations', 'give'), |
|
105 | + 'not_found' => __('No donations found.', 'give'), |
|
106 | + 'not_found_in_trash' => __('No donations found in Trash.', 'give'), |
|
107 | 107 | 'parent_item_colon' => '', |
108 | - 'menu_name' => __( 'Donations', 'give' ), |
|
108 | + 'menu_name' => __('Donations', 'give'), |
|
109 | 109 | ); |
110 | 110 | |
111 | 111 | $payment_args = array( |
112 | - 'labels' => apply_filters( 'give_payment_labels', $payment_labels ), |
|
112 | + 'labels' => apply_filters('give_payment_labels', $payment_labels), |
|
113 | 113 | 'public' => false, |
114 | 114 | 'query_var' => false, |
115 | 115 | 'rewrite' => false, |
116 | 116 | 'map_meta_cap' => true, |
117 | 117 | 'capability_type' => 'give_payment', |
118 | - 'supports' => array( 'title' ), |
|
118 | + 'supports' => array('title'), |
|
119 | 119 | 'can_export' => true, |
120 | 120 | ); |
121 | - register_post_type( 'give_payment', $payment_args ); |
|
121 | + register_post_type('give_payment', $payment_args); |
|
122 | 122 | |
123 | 123 | } |
124 | 124 | |
125 | -add_action( 'init', 'give_setup_post_types', 1 ); |
|
125 | +add_action('init', 'give_setup_post_types', 1); |
|
126 | 126 | |
127 | 127 | |
128 | 128 | /** |
@@ -135,30 +135,30 @@ discard block |
||
135 | 135 | */ |
136 | 136 | function give_setup_taxonomies() { |
137 | 137 | |
138 | - $slug = defined( 'GIVE_FORMS_SLUG' ) ? GIVE_FORMS_SLUG : 'donations'; |
|
138 | + $slug = defined('GIVE_FORMS_SLUG') ? GIVE_FORMS_SLUG : 'donations'; |
|
139 | 139 | |
140 | 140 | /** Categories */ |
141 | 141 | $category_labels = array( |
142 | - 'name' => _x( 'Form Categories', 'taxonomy general name', 'give' ), |
|
143 | - 'singular_name' => _x( 'Category', 'taxonomy singular name', 'give' ), |
|
144 | - 'search_items' => __( 'Search Categories', 'give' ), |
|
145 | - 'all_items' => __( 'All Categories', 'give' ), |
|
146 | - 'parent_item' => __( 'Parent Category', 'give' ), |
|
147 | - 'parent_item_colon' => __( 'Parent Category:', 'give' ), |
|
148 | - 'edit_item' => __( 'Edit Category', 'give' ), |
|
149 | - 'update_item' => __( 'Update Category', 'give' ), |
|
150 | - 'add_new_item' => __( 'Add New Category', 'give' ), |
|
151 | - 'new_item_name' => __( 'New Category Name', 'give' ), |
|
152 | - 'menu_name' => __( 'Categories', 'give' ), |
|
142 | + 'name' => _x('Form Categories', 'taxonomy general name', 'give'), |
|
143 | + 'singular_name' => _x('Category', 'taxonomy singular name', 'give'), |
|
144 | + 'search_items' => __('Search Categories', 'give'), |
|
145 | + 'all_items' => __('All Categories', 'give'), |
|
146 | + 'parent_item' => __('Parent Category', 'give'), |
|
147 | + 'parent_item_colon' => __('Parent Category:', 'give'), |
|
148 | + 'edit_item' => __('Edit Category', 'give'), |
|
149 | + 'update_item' => __('Update Category', 'give'), |
|
150 | + 'add_new_item' => __('Add New Category', 'give'), |
|
151 | + 'new_item_name' => __('New Category Name', 'give'), |
|
152 | + 'menu_name' => __('Categories', 'give'), |
|
153 | 153 | ); |
154 | 154 | |
155 | - $category_args = apply_filters( 'give_forms_category_args', array( |
|
155 | + $category_args = apply_filters('give_forms_category_args', array( |
|
156 | 156 | 'hierarchical' => true, |
157 | - 'labels' => apply_filters( 'give_forms_category_labels', $category_labels ), |
|
157 | + 'labels' => apply_filters('give_forms_category_labels', $category_labels), |
|
158 | 158 | 'show_ui' => true, |
159 | 159 | 'query_var' => 'give_forms_category', |
160 | 160 | 'rewrite' => array( |
161 | - 'slug' => $slug . '/category', |
|
161 | + 'slug' => $slug.'/category', |
|
162 | 162 | 'with_front' => false, |
163 | 163 | 'hierarchical' => true, |
164 | 164 | ), |
@@ -172,33 +172,33 @@ discard block |
||
172 | 172 | ); |
173 | 173 | |
174 | 174 | // Does the user want categories? |
175 | - if ( give_is_setting_enabled( give_get_option( 'categories', 'disabled' ) ) ) { |
|
176 | - register_taxonomy( 'give_forms_category', array( 'give_forms' ), $category_args ); |
|
177 | - register_taxonomy_for_object_type( 'give_forms_category', 'give_forms' ); |
|
175 | + if (give_is_setting_enabled(give_get_option('categories', 'disabled'))) { |
|
176 | + register_taxonomy('give_forms_category', array('give_forms'), $category_args); |
|
177 | + register_taxonomy_for_object_type('give_forms_category', 'give_forms'); |
|
178 | 178 | } |
179 | 179 | |
180 | 180 | /** Tags */ |
181 | 181 | $tag_labels = array( |
182 | - 'name' => _x( 'Form Tags', 'taxonomy general name', 'give' ), |
|
183 | - 'singular_name' => _x( 'Tag', 'taxonomy singular name', 'give' ), |
|
184 | - 'search_items' => __( 'Search Tags', 'give' ), |
|
185 | - 'all_items' => __( 'All Tags', 'give' ), |
|
186 | - 'parent_item' => __( 'Parent Tag', 'give' ), |
|
187 | - 'parent_item_colon' => __( 'Parent Tag:', 'give' ), |
|
188 | - 'edit_item' => __( 'Edit Tag', 'give' ), |
|
189 | - 'update_item' => __( 'Update Tag', 'give' ), |
|
190 | - 'add_new_item' => __( 'Add New Tag', 'give' ), |
|
191 | - 'new_item_name' => __( 'New Tag Name', 'give' ), |
|
192 | - 'menu_name' => __( 'Tags', 'give' ), |
|
193 | - 'choose_from_most_used' => __( 'Choose from most used tags.', 'give' ), |
|
182 | + 'name' => _x('Form Tags', 'taxonomy general name', 'give'), |
|
183 | + 'singular_name' => _x('Tag', 'taxonomy singular name', 'give'), |
|
184 | + 'search_items' => __('Search Tags', 'give'), |
|
185 | + 'all_items' => __('All Tags', 'give'), |
|
186 | + 'parent_item' => __('Parent Tag', 'give'), |
|
187 | + 'parent_item_colon' => __('Parent Tag:', 'give'), |
|
188 | + 'edit_item' => __('Edit Tag', 'give'), |
|
189 | + 'update_item' => __('Update Tag', 'give'), |
|
190 | + 'add_new_item' => __('Add New Tag', 'give'), |
|
191 | + 'new_item_name' => __('New Tag Name', 'give'), |
|
192 | + 'menu_name' => __('Tags', 'give'), |
|
193 | + 'choose_from_most_used' => __('Choose from most used tags.', 'give'), |
|
194 | 194 | ); |
195 | 195 | |
196 | - $tag_args = apply_filters( 'give_forms_tag_args', array( |
|
196 | + $tag_args = apply_filters('give_forms_tag_args', array( |
|
197 | 197 | 'hierarchical' => false, |
198 | - 'labels' => apply_filters( 'give_forms_tag_labels', $tag_labels ), |
|
198 | + 'labels' => apply_filters('give_forms_tag_labels', $tag_labels), |
|
199 | 199 | 'show_ui' => true, |
200 | 200 | 'query_var' => 'give_forms_tag', |
201 | - 'rewrite' => array( 'slug' => $slug . '/tag', 'with_front' => false, 'hierarchical' => true ), |
|
201 | + 'rewrite' => array('slug' => $slug.'/tag', 'with_front' => false, 'hierarchical' => true), |
|
202 | 202 | 'capabilities' => array( |
203 | 203 | 'manage_terms' => 'manage_give_form_terms', |
204 | 204 | 'edit_terms' => 'edit_give_form_terms', |
@@ -208,14 +208,14 @@ discard block |
||
208 | 208 | ) |
209 | 209 | ); |
210 | 210 | |
211 | - if ( give_is_setting_enabled( give_get_option( 'tags', 'disabled' ) ) ) { |
|
212 | - register_taxonomy( 'give_forms_tag', array( 'give_forms' ), $tag_args ); |
|
213 | - register_taxonomy_for_object_type( 'give_forms_tag', 'give_forms' ); |
|
211 | + if (give_is_setting_enabled(give_get_option('tags', 'disabled'))) { |
|
212 | + register_taxonomy('give_forms_tag', array('give_forms'), $tag_args); |
|
213 | + register_taxonomy_for_object_type('give_forms_tag', 'give_forms'); |
|
214 | 214 | } |
215 | 215 | |
216 | 216 | } |
217 | 217 | |
218 | -add_action( 'init', 'give_setup_taxonomies', 0 ); |
|
218 | +add_action('init', 'give_setup_taxonomies', 0); |
|
219 | 219 | |
220 | 220 | |
221 | 221 | /** |
@@ -226,11 +226,11 @@ discard block |
||
226 | 226 | */ |
227 | 227 | function give_get_default_form_labels() { |
228 | 228 | $defaults = array( |
229 | - 'singular' => __( 'Form', 'give' ), |
|
230 | - 'plural' => __( 'Forms', 'give' ), |
|
229 | + 'singular' => __('Form', 'give'), |
|
230 | + 'plural' => __('Forms', 'give'), |
|
231 | 231 | ); |
232 | 232 | |
233 | - return apply_filters( 'give_default_form_name', $defaults ); |
|
233 | + return apply_filters('give_default_form_name', $defaults); |
|
234 | 234 | } |
235 | 235 | |
236 | 236 | /** |
@@ -242,10 +242,10 @@ discard block |
||
242 | 242 | * |
243 | 243 | * @return string $defaults['singular'] Singular label |
244 | 244 | */ |
245 | -function give_get_forms_label_singular( $lowercase = false ) { |
|
245 | +function give_get_forms_label_singular($lowercase = false) { |
|
246 | 246 | $defaults = give_get_default_form_labels(); |
247 | 247 | |
248 | - return ( $lowercase ) ? strtolower( $defaults['singular'] ) : $defaults['singular']; |
|
248 | + return ($lowercase) ? strtolower($defaults['singular']) : $defaults['singular']; |
|
249 | 249 | } |
250 | 250 | |
251 | 251 | /** |
@@ -254,10 +254,10 @@ discard block |
||
254 | 254 | * @since 1.0 |
255 | 255 | * @return string $defaults['plural'] Plural label |
256 | 256 | */ |
257 | -function give_get_forms_label_plural( $lowercase = false ) { |
|
257 | +function give_get_forms_label_plural($lowercase = false) { |
|
258 | 258 | $defaults = give_get_default_form_labels(); |
259 | 259 | |
260 | - return ( $lowercase ) ? strtolower( $defaults['plural'] ) : $defaults['plural']; |
|
260 | + return ($lowercase) ? strtolower($defaults['plural']) : $defaults['plural']; |
|
261 | 261 | } |
262 | 262 | |
263 | 263 | /** |
@@ -269,24 +269,24 @@ discard block |
||
269 | 269 | * |
270 | 270 | * @return string $title New placeholder text |
271 | 271 | */ |
272 | -function give_change_default_title( $title ) { |
|
272 | +function give_change_default_title($title) { |
|
273 | 273 | // If a frontend plugin uses this filter (check extensions before changing this function) |
274 | - if ( ! is_admin() ) { |
|
275 | - $title = __( 'Enter form title here', 'give' ); |
|
274 | + if ( ! is_admin()) { |
|
275 | + $title = __('Enter form title here', 'give'); |
|
276 | 276 | |
277 | 277 | return $title; |
278 | 278 | } |
279 | 279 | |
280 | 280 | $screen = get_current_screen(); |
281 | 281 | |
282 | - if ( 'give_forms' == $screen->post_type ) { |
|
283 | - $title = __( 'Enter form title here', 'give' ); |
|
282 | + if ('give_forms' == $screen->post_type) { |
|
283 | + $title = __('Enter form title here', 'give'); |
|
284 | 284 | } |
285 | 285 | |
286 | 286 | return $title; |
287 | 287 | } |
288 | 288 | |
289 | -add_filter( 'enter_title_here', 'give_change_default_title' ); |
|
289 | +add_filter('enter_title_here', 'give_change_default_title'); |
|
290 | 290 | |
291 | 291 | /** |
292 | 292 | * Registers Custom Post Statuses which are used by the Payments |
@@ -296,58 +296,58 @@ discard block |
||
296 | 296 | */ |
297 | 297 | function give_register_post_type_statuses() { |
298 | 298 | // Payment Statuses |
299 | - register_post_status( 'refunded', array( |
|
300 | - 'label' => __( 'Refunded', 'give' ), |
|
299 | + register_post_status('refunded', array( |
|
300 | + 'label' => __('Refunded', 'give'), |
|
301 | 301 | 'public' => true, |
302 | 302 | 'exclude_from_search' => false, |
303 | 303 | 'show_in_admin_all_list' => true, |
304 | 304 | 'show_in_admin_status_list' => true, |
305 | - 'label_count' => _n_noop( 'Refunded <span class="count">(%s)</span>', 'Refunded <span class="count">(%s)</span>', 'give' ), |
|
306 | - ) ); |
|
307 | - register_post_status( 'failed', array( |
|
308 | - 'label' => __( 'Failed', 'give' ), |
|
305 | + 'label_count' => _n_noop('Refunded <span class="count">(%s)</span>', 'Refunded <span class="count">(%s)</span>', 'give'), |
|
306 | + )); |
|
307 | + register_post_status('failed', array( |
|
308 | + 'label' => __('Failed', 'give'), |
|
309 | 309 | 'public' => true, |
310 | 310 | 'exclude_from_search' => false, |
311 | 311 | 'show_in_admin_all_list' => true, |
312 | 312 | 'show_in_admin_status_list' => true, |
313 | - 'label_count' => _n_noop( 'Failed <span class="count">(%s)</span>', 'Failed <span class="count">(%s)</span>', 'give' ), |
|
314 | - ) ); |
|
315 | - register_post_status( 'revoked', array( |
|
316 | - 'label' => __( 'Revoked', 'give' ), |
|
313 | + 'label_count' => _n_noop('Failed <span class="count">(%s)</span>', 'Failed <span class="count">(%s)</span>', 'give'), |
|
314 | + )); |
|
315 | + register_post_status('revoked', array( |
|
316 | + 'label' => __('Revoked', 'give'), |
|
317 | 317 | 'public' => true, |
318 | 318 | 'exclude_from_search' => false, |
319 | 319 | 'show_in_admin_all_list' => true, |
320 | 320 | 'show_in_admin_status_list' => true, |
321 | - 'label_count' => _n_noop( 'Revoked <span class="count">(%s)</span>', 'Revoked <span class="count">(%s)</span>', 'give' ), |
|
322 | - ) ); |
|
323 | - register_post_status( 'cancelled', array( |
|
324 | - 'label' => __( 'Cancelled', 'give' ), |
|
321 | + 'label_count' => _n_noop('Revoked <span class="count">(%s)</span>', 'Revoked <span class="count">(%s)</span>', 'give'), |
|
322 | + )); |
|
323 | + register_post_status('cancelled', array( |
|
324 | + 'label' => __('Cancelled', 'give'), |
|
325 | 325 | 'public' => true, |
326 | 326 | 'exclude_from_search' => false, |
327 | 327 | 'show_in_admin_all_list' => true, |
328 | 328 | 'show_in_admin_status_list' => true, |
329 | - 'label_count' => _n_noop( 'Cancelled <span class="count">(%s)</span>', 'Cancelled <span class="count">(%s)</span>', 'give' ), |
|
330 | - ) ); |
|
331 | - register_post_status( 'abandoned', array( |
|
332 | - 'label' => __( 'Abandoned', 'give' ), |
|
329 | + 'label_count' => _n_noop('Cancelled <span class="count">(%s)</span>', 'Cancelled <span class="count">(%s)</span>', 'give'), |
|
330 | + )); |
|
331 | + register_post_status('abandoned', array( |
|
332 | + 'label' => __('Abandoned', 'give'), |
|
333 | 333 | 'public' => true, |
334 | 334 | 'exclude_from_search' => false, |
335 | 335 | 'show_in_admin_all_list' => true, |
336 | 336 | 'show_in_admin_status_list' => true, |
337 | - 'label_count' => _n_noop( 'Abandoned <span class="count">(%s)</span>', 'Abandoned <span class="count">(%s)</span>', 'give' ), |
|
338 | - ) ); |
|
339 | - register_post_status( 'processing', array( |
|
340 | - 'label' => _x( 'Processing', 'Processing payment status', 'give' ), |
|
337 | + 'label_count' => _n_noop('Abandoned <span class="count">(%s)</span>', 'Abandoned <span class="count">(%s)</span>', 'give'), |
|
338 | + )); |
|
339 | + register_post_status('processing', array( |
|
340 | + 'label' => _x('Processing', 'Processing payment status', 'give'), |
|
341 | 341 | 'public' => true, |
342 | 342 | 'exclude_from_search' => false, |
343 | 343 | 'show_in_admin_all_list' => true, |
344 | 344 | 'show_in_admin_status_list' => true, |
345 | - 'label_count' => _n_noop( 'Processing <span class="count">(%s)</span>', 'Processing <span class="count">(%s)</span>', 'give' ) |
|
346 | - ) ); |
|
345 | + 'label_count' => _n_noop('Processing <span class="count">(%s)</span>', 'Processing <span class="count">(%s)</span>', 'give') |
|
346 | + )); |
|
347 | 347 | |
348 | 348 | } |
349 | 349 | |
350 | -add_action( 'init', 'give_register_post_type_statuses' ); |
|
350 | +add_action('init', 'give_register_post_type_statuses'); |
|
351 | 351 | |
352 | 352 | /** |
353 | 353 | * Updated Messages |
@@ -360,27 +360,27 @@ discard block |
||
360 | 360 | * |
361 | 361 | * @return array $messages New post updated messages |
362 | 362 | */ |
363 | -function give_updated_messages( $messages ) { |
|
363 | +function give_updated_messages($messages) { |
|
364 | 364 | global $post, $post_ID; |
365 | 365 | |
366 | - if ( ! give_is_setting_enabled( give_get_option( 'forms_singular' ) ) ) { |
|
366 | + if ( ! give_is_setting_enabled(give_get_option('forms_singular'))) { |
|
367 | 367 | |
368 | 368 | $messages['give_forms'] = array( |
369 | - 1 => __( 'Form updated.', 'give' ), |
|
370 | - 4 => __( 'Form updated.', 'give' ), |
|
371 | - 6 => __( 'Form published.', 'give' ), |
|
372 | - 7 => __( 'Form saved.', 'give' ), |
|
373 | - 8 => __( 'Form submitted.', 'give' ), |
|
369 | + 1 => __('Form updated.', 'give'), |
|
370 | + 4 => __('Form updated.', 'give'), |
|
371 | + 6 => __('Form published.', 'give'), |
|
372 | + 7 => __('Form saved.', 'give'), |
|
373 | + 8 => __('Form submitted.', 'give'), |
|
374 | 374 | ); |
375 | 375 | |
376 | 376 | } else { |
377 | 377 | |
378 | 378 | $messages['give_forms'] = array( |
379 | - 1 => sprintf( '%1$s <a href="%2$s">%3$s</a>', __( 'Form updated.', 'give' ), get_permalink( $post_ID ), __( 'View Form', 'give' ) ), |
|
380 | - 4 => sprintf( '%1$s <a href="%2$s">%3$s</a>', __( 'Form updated.', 'give' ), get_permalink( $post_ID ), __( 'View Form', 'give' ) ), |
|
381 | - 6 => sprintf( '%1$s <a href="%2$s">%3$s</a>', __( 'Form published.', 'give' ), get_permalink( $post_ID ), __( 'View Form', 'give' ) ), |
|
382 | - 7 => sprintf( '%1$s <a href="%2$s">%3$s</a>', __( 'Form saved.', 'give' ), get_permalink( $post_ID ), __( 'View Form', 'give' ) ), |
|
383 | - 8 => sprintf( '%1$s <a href="%2$s">%3$s</a>', __( 'Form submitted.', 'give' ), get_permalink( $post_ID ), __( 'View Form', 'give' ) ), |
|
379 | + 1 => sprintf('%1$s <a href="%2$s">%3$s</a>', __('Form updated.', 'give'), get_permalink($post_ID), __('View Form', 'give')), |
|
380 | + 4 => sprintf('%1$s <a href="%2$s">%3$s</a>', __('Form updated.', 'give'), get_permalink($post_ID), __('View Form', 'give')), |
|
381 | + 6 => sprintf('%1$s <a href="%2$s">%3$s</a>', __('Form published.', 'give'), get_permalink($post_ID), __('View Form', 'give')), |
|
382 | + 7 => sprintf('%1$s <a href="%2$s">%3$s</a>', __('Form saved.', 'give'), get_permalink($post_ID), __('View Form', 'give')), |
|
383 | + 8 => sprintf('%1$s <a href="%2$s">%3$s</a>', __('Form submitted.', 'give'), get_permalink($post_ID), __('View Form', 'give')), |
|
384 | 384 | ); |
385 | 385 | |
386 | 386 | } |
@@ -388,27 +388,27 @@ discard block |
||
388 | 388 | return $messages; |
389 | 389 | } |
390 | 390 | |
391 | -add_filter( 'post_updated_messages', 'give_updated_messages' ); |
|
391 | +add_filter('post_updated_messages', 'give_updated_messages'); |
|
392 | 392 | |
393 | 393 | |
394 | 394 | /** |
395 | 395 | * Setup Post Type Images |
396 | 396 | */ |
397 | -add_action( 'after_setup_theme', 'give_add_thumbnail_support', 10 ); |
|
397 | +add_action('after_setup_theme', 'give_add_thumbnail_support', 10); |
|
398 | 398 | |
399 | 399 | /** |
400 | 400 | * Ensure post thumbnail support is turned on |
401 | 401 | */ |
402 | 402 | function give_add_thumbnail_support() { |
403 | - if ( ! give_is_setting_enabled( give_get_option( 'form_featured_img' ) ) ) { |
|
403 | + if ( ! give_is_setting_enabled(give_get_option('form_featured_img'))) { |
|
404 | 404 | return; |
405 | 405 | } |
406 | 406 | |
407 | - if ( ! current_theme_supports( 'post-thumbnails' ) ) { |
|
408 | - add_theme_support( 'post-thumbnails' ); |
|
407 | + if ( ! current_theme_supports('post-thumbnails')) { |
|
408 | + add_theme_support('post-thumbnails'); |
|
409 | 409 | } |
410 | 410 | |
411 | - add_post_type_support( 'give_forms', 'thumbnail' ); |
|
411 | + add_post_type_support('give_forms', 'thumbnail'); |
|
412 | 412 | } |
413 | 413 | |
414 | 414 | /** |
@@ -420,21 +420,21 @@ discard block |
||
420 | 420 | |
421 | 421 | // Single Give Forms (disabled if single turned off in settings) |
422 | 422 | if ( |
423 | - give_is_setting_enabled( give_get_option( 'forms_singular' ) ) |
|
424 | - && give_is_setting_enabled( give_get_option( 'form_sidebar' ) ) |
|
423 | + give_is_setting_enabled(give_get_option('forms_singular')) |
|
424 | + && give_is_setting_enabled(give_get_option('form_sidebar')) |
|
425 | 425 | ) { |
426 | 426 | |
427 | - register_sidebar( apply_filters( 'give_forms_single_sidebar', array( |
|
428 | - 'name' => __( 'Give Single Form Sidebar', 'give' ), |
|
427 | + register_sidebar(apply_filters('give_forms_single_sidebar', array( |
|
428 | + 'name' => __('Give Single Form Sidebar', 'give'), |
|
429 | 429 | 'id' => 'give-forms-sidebar', |
430 | - 'description' => __( 'Widgets in this area will be shown on the single Give forms aside area. This sidebar will not display for embedded forms.', 'give' ), |
|
430 | + 'description' => __('Widgets in this area will be shown on the single Give forms aside area. This sidebar will not display for embedded forms.', 'give'), |
|
431 | 431 | 'before_widget' => '<div id="%1$s" class="widget %2$s">', |
432 | 432 | 'after_widget' => '</div>', |
433 | 433 | 'before_title' => '<h3 class="widgettitle widget-title">', |
434 | 434 | 'after_title' => '</h3>', |
435 | - ) ) ); |
|
435 | + ))); |
|
436 | 436 | |
437 | 437 | } |
438 | 438 | } |
439 | 439 | |
440 | -add_action( 'widgets_init', 'give_widgets_init', 999 ); |
|
440 | +add_action('widgets_init', 'give_widgets_init', 999); |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | * |
73 | 73 | * @param $url |
74 | 74 | * |
75 | - * @return mixed |
|
75 | + * @return string |
|
76 | 76 | */ |
77 | 77 | public function give_update_cmb_meta_box_url( $url ) { |
78 | 78 | // Path to Give's CMB |
@@ -935,7 +935,7 @@ discard block |
||
935 | 935 | * @since 1.3.5 |
936 | 936 | * |
937 | 937 | * @param $array |
938 | - * @param $position |int|string Expects an array key or 'id' of the settings field to appear after |
|
938 | + * @param string $position |int|string Expects an array key or 'id' of the settings field to appear after |
|
939 | 939 | * @param $insert |array a valid array of options to insert |
940 | 940 | * |
941 | 941 | * @return array |
@@ -974,7 +974,7 @@ discard block |
||
974 | 974 | * @since 1.0 |
975 | 975 | * |
976 | 976 | * @param array $field_arr |
977 | - * @param array $saved_values |
|
977 | + * @param string|boolean $saved_values |
|
978 | 978 | * |
979 | 979 | * @return void |
980 | 980 | */ |
@@ -1009,7 +1009,7 @@ discard block |
||
1009 | 1009 | * @since 1.0 |
1010 | 1010 | * |
1011 | 1011 | * @param array $field_arr |
1012 | - * @param array $saved_value |
|
1012 | + * @param string|boolean $saved_value |
|
1013 | 1013 | * |
1014 | 1014 | * @return void |
1015 | 1015 | */ |
@@ -1163,7 +1163,7 @@ discard block |
||
1163 | 1163 | * @params $string text |
1164 | 1164 | * @params $filter array |
1165 | 1165 | * |
1166 | - * @return text $string |
|
1166 | + * @return string $string |
|
1167 | 1167 | */ |
1168 | 1168 | function give_slug_to_title( $string, $filters = array() ){ |
1169 | 1169 |
@@ -1167,12 +1167,12 @@ |
||
1167 | 1167 | */ |
1168 | 1168 | function give_slug_to_title( $string, $filters = array() ){ |
1169 | 1169 | |
1170 | - foreach( $filters as $filter_item ){ |
|
1171 | - $string = str_replace( $filter_item, ' ', $string ); |
|
1172 | - } |
|
1170 | + foreach( $filters as $filter_item ){ |
|
1171 | + $string = str_replace( $filter_item, ' ', $string ); |
|
1172 | + } |
|
1173 | 1173 | |
1174 | - // Return updated string after converting it to title case |
|
1175 | - return ucwords( $string ); |
|
1174 | + // Return updated string after converting it to title case |
|
1175 | + return ucwords( $string ); |
|
1176 | 1176 | |
1177 | 1177 | } |
1178 | 1178 |
@@ -43,14 +43,14 @@ discard block |
||
43 | 43 | public function __construct() { |
44 | 44 | |
45 | 45 | // Custom CMB2 Settings Fields |
46 | - add_action( 'cmb2_render_give_title', 'give_title_callback', 10, 5 ); |
|
47 | - add_action( 'cmb2_render_give_description', 'give_description_callback', 10, 5 ); |
|
48 | - add_action( 'cmb2_render_enabled_gateways', 'give_enabled_gateways_callback', 10, 5 ); |
|
49 | - add_action( 'cmb2_render_default_gateway', 'give_default_gateway_callback', 10, 5 ); |
|
50 | - add_action( 'cmb2_render_email_preview_buttons', 'give_email_preview_buttons_callback', 10, 5 ); |
|
51 | - add_action( 'cmb2_render_system_info', 'give_system_info_callback', 10, 5 ); |
|
52 | - add_action( 'cmb2_render_api', 'give_api_callback', 10, 5 ); |
|
53 | - add_action( 'cmb2_render_license_key', 'give_license_key_callback', 10, 5 ); |
|
46 | + add_action('cmb2_render_give_title', 'give_title_callback', 10, 5); |
|
47 | + add_action('cmb2_render_give_description', 'give_description_callback', 10, 5); |
|
48 | + add_action('cmb2_render_enabled_gateways', 'give_enabled_gateways_callback', 10, 5); |
|
49 | + add_action('cmb2_render_default_gateway', 'give_default_gateway_callback', 10, 5); |
|
50 | + add_action('cmb2_render_email_preview_buttons', 'give_email_preview_buttons_callback', 10, 5); |
|
51 | + add_action('cmb2_render_system_info', 'give_system_info_callback', 10, 5); |
|
52 | + add_action('cmb2_render_api', 'give_api_callback', 10, 5); |
|
53 | + add_action('cmb2_render_license_key', 'give_license_key_callback', 10, 5); |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | * @since 1.0 |
61 | 61 | */ |
62 | 62 | public function init() { |
63 | - register_setting( $this->key, $this->key ); |
|
63 | + register_setting($this->key, $this->key); |
|
64 | 64 | |
65 | 65 | } |
66 | 66 | |
@@ -74,9 +74,9 @@ discard block |
||
74 | 74 | * |
75 | 75 | * @return mixed |
76 | 76 | */ |
77 | - public function give_update_cmb_meta_box_url( $url ) { |
|
77 | + public function give_update_cmb_meta_box_url($url) { |
|
78 | 78 | // Path to Give's CMB |
79 | - return GIVE_PLUGIN_URL . '/includes/libraries/cmb2'; |
|
79 | + return GIVE_PLUGIN_URL.'/includes/libraries/cmb2'; |
|
80 | 80 | } |
81 | 81 | |
82 | 82 | |
@@ -88,27 +88,27 @@ discard block |
||
88 | 88 | */ |
89 | 89 | public function give_get_settings_tabs() { |
90 | 90 | |
91 | - $settings = $this->give_settings( null ); |
|
91 | + $settings = $this->give_settings(null); |
|
92 | 92 | |
93 | 93 | $tabs = array(); |
94 | - $tabs['general'] = __( 'General', 'give' ); |
|
95 | - $tabs['gateways'] = __( 'Payment Gateways', 'give' ); |
|
96 | - $tabs['display'] = __( 'Display Options', 'give' ); |
|
97 | - $tabs['emails'] = __( 'Emails', 'give' ); |
|
94 | + $tabs['general'] = __('General', 'give'); |
|
95 | + $tabs['gateways'] = __('Payment Gateways', 'give'); |
|
96 | + $tabs['display'] = __('Display Options', 'give'); |
|
97 | + $tabs['emails'] = __('Emails', 'give'); |
|
98 | 98 | |
99 | - if ( ! empty( $settings['addons']['fields'] ) ) { |
|
100 | - $tabs['addons'] = __( 'Add-ons', 'give' ); |
|
99 | + if ( ! empty($settings['addons']['fields'])) { |
|
100 | + $tabs['addons'] = __('Add-ons', 'give'); |
|
101 | 101 | } |
102 | 102 | |
103 | - if ( ! empty( $settings['licenses']['fields'] ) ) { |
|
104 | - $tabs['licenses'] = __( 'Licenses', 'give' ); |
|
103 | + if ( ! empty($settings['licenses']['fields'])) { |
|
104 | + $tabs['licenses'] = __('Licenses', 'give'); |
|
105 | 105 | } |
106 | 106 | |
107 | - $tabs['advanced'] = __( 'Advanced', 'give' ); |
|
108 | - $tabs['api'] = __( 'API', 'give' ); |
|
109 | - $tabs['system_info'] = __( 'System Info', 'give' ); |
|
107 | + $tabs['advanced'] = __('Advanced', 'give'); |
|
108 | + $tabs['api'] = __('API', 'give'); |
|
109 | + $tabs['system_info'] = __('System Info', 'give'); |
|
110 | 110 | |
111 | - return apply_filters( 'give_settings_tabs', $tabs ); |
|
111 | + return apply_filters('give_settings_tabs', $tabs); |
|
112 | 112 | } |
113 | 113 | |
114 | 114 | |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | */ |
120 | 120 | public function admin_page_display() { |
121 | 121 | |
122 | - $active_tab = isset( $_GET['tab'] ) && array_key_exists( $_GET['tab'], $this->give_get_settings_tabs() ) ? $_GET['tab'] : 'general'; |
|
122 | + $active_tab = isset($_GET['tab']) && array_key_exists($_GET['tab'], $this->give_get_settings_tabs()) ? $_GET['tab'] : 'general'; |
|
123 | 123 | |
124 | 124 | ?> |
125 | 125 | |
@@ -129,22 +129,22 @@ discard block |
||
129 | 129 | |
130 | 130 | <h2 class="nav-tab-wrapper"> |
131 | 131 | <?php |
132 | - foreach ( $this->give_get_settings_tabs() as $tab_id => $tab_name ) { |
|
132 | + foreach ($this->give_get_settings_tabs() as $tab_id => $tab_name) { |
|
133 | 133 | |
134 | - $tab_url = esc_url( add_query_arg( array( |
|
134 | + $tab_url = esc_url(add_query_arg(array( |
|
135 | 135 | 'settings-updated' => false, |
136 | 136 | 'tab' => $tab_id, |
137 | - ) ) ); |
|
137 | + ))); |
|
138 | 138 | |
139 | 139 | $active = $active_tab == $tab_id ? ' nav-tab-active' : ''; |
140 | 140 | |
141 | - echo '<a href="' . esc_url( $tab_url ) . '" class="nav-tab' . $active . '" id="tab-' . $tab_id . '">' . esc_html( $tab_name ) . '</a>'; |
|
141 | + echo '<a href="'.esc_url($tab_url).'" class="nav-tab'.$active.'" id="tab-'.$tab_id.'">'.esc_html($tab_name).'</a>'; |
|
142 | 142 | |
143 | 143 | } |
144 | 144 | ?> |
145 | 145 | </h2> |
146 | 146 | |
147 | - <?php cmb2_metabox_form( $this->give_settings( $active_tab ), $this->key ); ?> |
|
147 | + <?php cmb2_metabox_form($this->give_settings($active_tab), $this->key); ?> |
|
148 | 148 | |
149 | 149 | </div><!-- .wrap --> |
150 | 150 | |
@@ -166,12 +166,12 @@ discard block |
||
166 | 166 | * |
167 | 167 | * @return string |
168 | 168 | */ |
169 | - function give_modify_cmb2_form_output( $form_format, $object_id, $cmb ) { |
|
169 | + function give_modify_cmb2_form_output($form_format, $object_id, $cmb) { |
|
170 | 170 | |
171 | 171 | // only modify the give settings form |
172 | - if ( 'give_settings' == $object_id ) { |
|
172 | + if ('give_settings' == $object_id) { |
|
173 | 173 | |
174 | - return '<form class="cmb-form" method="post" id="%1$s" enctype="multipart/form-data" encoding="multipart/form-data"><input type="hidden" name="give_settings_saved" value="true"><input type="hidden" name="object_id" value="%2$s">%3$s<div class="give-submit-wrap"><input type="submit" name="submit-cmb" value="' . esc_attr__( 'Save Settings', 'give' ) . '" class="button-primary"></div></form>'; |
|
174 | + return '<form class="cmb-form" method="post" id="%1$s" enctype="multipart/form-data" encoding="multipart/form-data"><input type="hidden" name="give_settings_saved" value="true"><input type="hidden" name="object_id" value="%2$s">%3$s<div class="give-submit-wrap"><input type="submit" name="submit-cmb" value="'.esc_attr__('Save Settings', 'give').'" class="button-primary"></div></form>'; |
|
175 | 175 | |
176 | 176 | } |
177 | 177 | |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | * |
189 | 189 | * @return array |
190 | 190 | */ |
191 | - public function give_settings( $active_tab ) { |
|
191 | + public function give_settings($active_tab) { |
|
192 | 192 | |
193 | 193 | $give_settings = array( |
194 | 194 | /** |
@@ -196,99 +196,99 @@ discard block |
||
196 | 196 | */ |
197 | 197 | 'general' => array( |
198 | 198 | 'id' => 'general_settings', |
199 | - 'give_title' => __( 'General Settings', 'give' ), |
|
200 | - 'show_on' => array( 'key' => 'options-page', 'value' => array( $this->key ) ), |
|
201 | - 'fields' => apply_filters( 'give_settings_general', array( |
|
199 | + 'give_title' => __('General Settings', 'give'), |
|
200 | + 'show_on' => array('key' => 'options-page', 'value' => array($this->key)), |
|
201 | + 'fields' => apply_filters('give_settings_general', array( |
|
202 | 202 | array( |
203 | - 'name' => __( 'General Settings', 'give' ), |
|
203 | + 'name' => __('General Settings', 'give'), |
|
204 | 204 | 'desc' => '', |
205 | 205 | 'type' => 'give_title', |
206 | 206 | 'id' => 'give_title_general_settings_1', |
207 | 207 | ), |
208 | 208 | array( |
209 | - 'name' => __( 'Success Page', 'give' ), |
|
209 | + 'name' => __('Success Page', 'give'), |
|
210 | 210 | /* translators: %s: [give_receipt] */ |
211 | - 'desc' => sprintf( __( 'The page donors are sent to after completing their donations. The %s shortcode should be on this page.', 'give' ), '<code>[give_receipt]</code>' ), |
|
211 | + 'desc' => sprintf(__('The page donors are sent to after completing their donations. The %s shortcode should be on this page.', 'give'), '<code>[give_receipt]</code>'), |
|
212 | 212 | 'id' => 'success_page', |
213 | 213 | 'type' => 'select', |
214 | - 'options' => give_cmb2_get_post_options( array( |
|
214 | + 'options' => give_cmb2_get_post_options(array( |
|
215 | 215 | 'post_type' => 'page', |
216 | - 'numberposts' => - 1, |
|
217 | - ) ), |
|
216 | + 'numberposts' => -1, |
|
217 | + )), |
|
218 | 218 | ), |
219 | 219 | array( |
220 | - 'name' => __( 'Failed Donation Page', 'give' ), |
|
221 | - 'desc' => __( 'The page donors are sent to if their donation is cancelled or fails.', 'give' ), |
|
220 | + 'name' => __('Failed Donation Page', 'give'), |
|
221 | + 'desc' => __('The page donors are sent to if their donation is cancelled or fails.', 'give'), |
|
222 | 222 | 'id' => 'failure_page', |
223 | 223 | 'type' => 'select', |
224 | - 'options' => give_cmb2_get_post_options( array( |
|
224 | + 'options' => give_cmb2_get_post_options(array( |
|
225 | 225 | 'post_type' => 'page', |
226 | - 'numberposts' => - 1, |
|
227 | - ) ), |
|
226 | + 'numberposts' => -1, |
|
227 | + )), |
|
228 | 228 | ), |
229 | 229 | array( |
230 | - 'name' => __( 'Donation History Page', 'give' ), |
|
230 | + 'name' => __('Donation History Page', 'give'), |
|
231 | 231 | /* translators: %s: [donation_history] */ |
232 | - 'desc' => sprintf( __( 'The page showing a complete donation history for the current user. The %s shortcode should be on this page.', 'give' ), '<code>[donation_history]</code>' ), |
|
232 | + 'desc' => sprintf(__('The page showing a complete donation history for the current user. The %s shortcode should be on this page.', 'give'), '<code>[donation_history]</code>'), |
|
233 | 233 | 'id' => 'history_page', |
234 | 234 | 'type' => 'select', |
235 | - 'options' => give_cmb2_get_post_options( array( |
|
235 | + 'options' => give_cmb2_get_post_options(array( |
|
236 | 236 | 'post_type' => 'page', |
237 | - 'numberposts' => - 1, |
|
238 | - ) ), |
|
237 | + 'numberposts' => -1, |
|
238 | + )), |
|
239 | 239 | ), |
240 | 240 | array( |
241 | - 'name' => __( 'Base Country', 'give' ), |
|
242 | - 'desc' => __( 'The country your site operates from.', 'give' ), |
|
241 | + 'name' => __('Base Country', 'give'), |
|
242 | + 'desc' => __('The country your site operates from.', 'give'), |
|
243 | 243 | 'id' => 'base_country', |
244 | 244 | 'type' => 'select', |
245 | 245 | 'options' => give_get_country_list(), |
246 | 246 | ), |
247 | 247 | array( |
248 | - 'name' => __( 'Currency Settings', 'give' ), |
|
248 | + 'name' => __('Currency Settings', 'give'), |
|
249 | 249 | 'desc' => '', |
250 | 250 | 'type' => 'give_title', |
251 | 251 | 'id' => 'give_title_general_settings_2', |
252 | 252 | ), |
253 | 253 | array( |
254 | - 'name' => __( 'Currency', 'give' ), |
|
255 | - 'desc' => __( 'The donation currency. Note that some payment gateways have currency restrictions.', 'give' ), |
|
254 | + 'name' => __('Currency', 'give'), |
|
255 | + 'desc' => __('The donation currency. Note that some payment gateways have currency restrictions.', 'give'), |
|
256 | 256 | 'id' => 'currency', |
257 | 257 | 'type' => 'select', |
258 | 258 | 'options' => give_get_currencies(), |
259 | 259 | 'default' => 'USD', |
260 | 260 | ), |
261 | 261 | array( |
262 | - 'name' => __( 'Currency Position', 'give' ), |
|
263 | - 'desc' => __( 'The position of the currency symbol.', 'give' ), |
|
262 | + 'name' => __('Currency Position', 'give'), |
|
263 | + 'desc' => __('The position of the currency symbol.', 'give'), |
|
264 | 264 | 'id' => 'currency_position', |
265 | 265 | 'type' => 'select', |
266 | 266 | 'options' => array( |
267 | 267 | /* translators: %s: currency symbol */ |
268 | - 'before' => sprintf( __( 'Before - %s10', 'give' ), give_currency_symbol( give_get_currency() ) ), |
|
268 | + 'before' => sprintf(__('Before - %s10', 'give'), give_currency_symbol(give_get_currency())), |
|
269 | 269 | /* translators: %s: currency symbol */ |
270 | - 'after' => sprintf( __( 'After - 10%s', 'give' ), give_currency_symbol( give_get_currency() ) ), |
|
270 | + 'after' => sprintf(__('After - 10%s', 'give'), give_currency_symbol(give_get_currency())), |
|
271 | 271 | ), |
272 | 272 | 'default' => 'before', |
273 | 273 | ), |
274 | 274 | array( |
275 | - 'name' => __( 'Thousands Separator', 'give' ), |
|
276 | - 'desc' => __( 'The symbol (usually , or .) to separate thousands.', 'give' ), |
|
275 | + 'name' => __('Thousands Separator', 'give'), |
|
276 | + 'desc' => __('The symbol (usually , or .) to separate thousands.', 'give'), |
|
277 | 277 | 'id' => 'thousands_separator', |
278 | 278 | 'type' => 'text_small', |
279 | 279 | 'sanitization_cb' => 'give_sanitize_thousand_separator', |
280 | 280 | 'default' => ',', |
281 | 281 | ), |
282 | 282 | array( |
283 | - 'name' => __( 'Decimal Separator', 'give' ), |
|
284 | - 'desc' => __( 'The symbol (usually , or .) to separate decimal points.', 'give' ), |
|
283 | + 'name' => __('Decimal Separator', 'give'), |
|
284 | + 'desc' => __('The symbol (usually , or .) to separate decimal points.', 'give'), |
|
285 | 285 | 'id' => 'decimal_separator', |
286 | 286 | 'type' => 'text_small', |
287 | 287 | 'default' => '.', |
288 | 288 | ), |
289 | 289 | array( |
290 | - 'name' => __( 'Number of Decimals', 'give' ), |
|
291 | - 'desc' => __( 'The number of decimal points displayed in amounts.', 'give' ), |
|
290 | + 'name' => __('Number of Decimals', 'give'), |
|
291 | + 'desc' => __('The number of decimal points displayed in amounts.', 'give'), |
|
292 | 292 | 'id' => 'number_decimals', |
293 | 293 | 'type' => 'text_small', |
294 | 294 | 'default' => 2, |
@@ -302,83 +302,83 @@ discard block |
||
302 | 302 | */ |
303 | 303 | 'gateways' => array( |
304 | 304 | 'id' => 'payment_gateways', |
305 | - 'give_title' => __( 'Payment Gateways', 'give' ), |
|
306 | - 'show_on' => array( 'key' => 'options-page', 'value' => array( $this->key ) ), |
|
307 | - 'fields' => apply_filters( 'give_settings_gateways', array( |
|
305 | + 'give_title' => __('Payment Gateways', 'give'), |
|
306 | + 'show_on' => array('key' => 'options-page', 'value' => array($this->key)), |
|
307 | + 'fields' => apply_filters('give_settings_gateways', array( |
|
308 | 308 | array( |
309 | - 'name' => __( 'Gateways Settings', 'give' ), |
|
309 | + 'name' => __('Gateways Settings', 'give'), |
|
310 | 310 | 'desc' => '', |
311 | 311 | 'id' => 'give_title_gateway_settings_1', |
312 | 312 | 'type' => 'give_title', |
313 | 313 | ), |
314 | 314 | array( |
315 | - 'name' => __( 'Test Mode', 'give' ), |
|
316 | - 'desc' => __( 'While in test mode no live donations are processed. To fully use test mode, you must have a sandbox (test) account for the payment gateway you are testing.', 'give' ), |
|
315 | + 'name' => __('Test Mode', 'give'), |
|
316 | + 'desc' => __('While in test mode no live donations are processed. To fully use test mode, you must have a sandbox (test) account for the payment gateway you are testing.', 'give'), |
|
317 | 317 | 'id' => 'test_mode', |
318 | 318 | 'type' => 'checkbox', |
319 | 319 | ), |
320 | 320 | array( |
321 | - 'name' => __( 'Enabled Gateways', 'give' ), |
|
322 | - 'desc' => __( 'Enable your payment gateway. Can be ordered by dragging.', 'give' ), |
|
321 | + 'name' => __('Enabled Gateways', 'give'), |
|
322 | + 'desc' => __('Enable your payment gateway. Can be ordered by dragging.', 'give'), |
|
323 | 323 | 'id' => 'gateways', |
324 | 324 | 'type' => 'enabled_gateways', |
325 | 325 | ), |
326 | 326 | array( |
327 | - 'name' => __( 'Default Gateway', 'give' ), |
|
328 | - 'desc' => __( 'The gateway that will be selected by default.', 'give' ), |
|
327 | + 'name' => __('Default Gateway', 'give'), |
|
328 | + 'desc' => __('The gateway that will be selected by default.', 'give'), |
|
329 | 329 | 'id' => 'default_gateway', |
330 | 330 | 'type' => 'default_gateway', |
331 | 331 | ), |
332 | 332 | array( |
333 | - 'name' => __( 'PayPal Standard', 'give' ), |
|
333 | + 'name' => __('PayPal Standard', 'give'), |
|
334 | 334 | 'desc' => '', |
335 | 335 | 'type' => 'give_title', |
336 | 336 | 'id' => 'give_title_gateway_settings_2', |
337 | 337 | ), |
338 | 338 | array( |
339 | - 'name' => __( 'PayPal Email', 'give' ), |
|
340 | - 'desc' => __( 'Enter your PayPal account\'s email.', 'give' ), |
|
339 | + 'name' => __('PayPal Email', 'give'), |
|
340 | + 'desc' => __('Enter your PayPal account\'s email.', 'give'), |
|
341 | 341 | 'id' => 'paypal_email', |
342 | 342 | 'type' => 'text_email', |
343 | 343 | ), |
344 | 344 | array( |
345 | - 'name' => __( 'PayPal Page Style', 'give' ), |
|
346 | - 'desc' => __( 'Enter the name of the page style to use, or leave blank to use the default.', 'give' ), |
|
345 | + 'name' => __('PayPal Page Style', 'give'), |
|
346 | + 'desc' => __('Enter the name of the page style to use, or leave blank to use the default.', 'give'), |
|
347 | 347 | 'id' => 'paypal_page_style', |
348 | 348 | 'type' => 'text', |
349 | 349 | ), |
350 | 350 | array( |
351 | - 'name' => __( 'PayPal Transaction Type', 'give' ), |
|
352 | - 'desc' => __( 'Nonprofits must verify their status to withdraw donations they receive via PayPal. PayPal users that are not verified nonprofits must demonstrate how their donations will be used, once they raise more than $10,000. By default, Give transactions are sent to PayPal as donations. You may change the transaction type using this option if you feel you may not meet PayPal\'s donation requirements.', 'give' ), |
|
351 | + 'name' => __('PayPal Transaction Type', 'give'), |
|
352 | + 'desc' => __('Nonprofits must verify their status to withdraw donations they receive via PayPal. PayPal users that are not verified nonprofits must demonstrate how their donations will be used, once they raise more than $10,000. By default, Give transactions are sent to PayPal as donations. You may change the transaction type using this option if you feel you may not meet PayPal\'s donation requirements.', 'give'), |
|
353 | 353 | 'id' => 'paypal_button_type', |
354 | 354 | 'type' => 'radio_inline', |
355 | 355 | 'options' => array( |
356 | - 'donation' => __( 'Donation', 'give' ), |
|
357 | - 'standard' => __( 'Standard Transaction', 'give' ), |
|
356 | + 'donation' => __('Donation', 'give'), |
|
357 | + 'standard' => __('Standard Transaction', 'give'), |
|
358 | 358 | ), |
359 | 359 | 'default' => 'donation', |
360 | 360 | ), |
361 | 361 | array( |
362 | - 'name' => __( 'Disable PayPal IPN Verification', 'give' ), |
|
363 | - 'desc' => __( 'If donations are not getting marked as complete, use a slightly less secure method of verifying donations.', 'give' ), |
|
362 | + 'name' => __('Disable PayPal IPN Verification', 'give'), |
|
363 | + 'desc' => __('If donations are not getting marked as complete, use a slightly less secure method of verifying donations.', 'give'), |
|
364 | 364 | 'id' => 'disable_paypal_verification', |
365 | 365 | 'type' => 'checkbox', |
366 | 366 | ), |
367 | 367 | array( |
368 | - 'name' => __( 'Offline Donations', 'give' ), |
|
368 | + 'name' => __('Offline Donations', 'give'), |
|
369 | 369 | 'desc' => '', |
370 | 370 | 'type' => 'give_title', |
371 | 371 | 'id' => 'give_title_gateway_settings_3', |
372 | 372 | ), |
373 | 373 | array( |
374 | - 'name' => __( 'Collect Billing Details', 'give' ), |
|
375 | - 'desc' => __( 'Enable to request billing details for offline donations. Will appear above offline donation instructions. Can be enabled/disabled per form.', 'give' ), |
|
374 | + 'name' => __('Collect Billing Details', 'give'), |
|
375 | + 'desc' => __('Enable to request billing details for offline donations. Will appear above offline donation instructions. Can be enabled/disabled per form.', 'give'), |
|
376 | 376 | 'id' => 'give_offline_donation_enable_billing_fields', |
377 | 377 | 'type' => 'checkbox', |
378 | 378 | ), |
379 | 379 | array( |
380 | - 'name' => __( 'Offline Donation Instructions', 'give' ), |
|
381 | - 'desc' => __( 'The following content will appear for all forms when the user selects the offline donation payment option. Note: You may customize the content per form as needed.', 'give' ), |
|
380 | + 'name' => __('Offline Donation Instructions', 'give'), |
|
381 | + 'desc' => __('The following content will appear for all forms when the user selects the offline donation payment option. Note: You may customize the content per form as needed.', 'give'), |
|
382 | 382 | 'id' => 'global_offline_donation_content', |
383 | 383 | 'default' => give_get_default_offline_donation_content(), |
384 | 384 | 'type' => 'wysiwyg', |
@@ -387,15 +387,15 @@ discard block |
||
387 | 387 | ), |
388 | 388 | ), |
389 | 389 | array( |
390 | - 'name' => __( 'Offline Donation Email Instructions Subject', 'give' ), |
|
391 | - 'desc' => __( 'Enter the subject line for the donation receipt email.', 'give' ), |
|
390 | + 'name' => __('Offline Donation Email Instructions Subject', 'give'), |
|
391 | + 'desc' => __('Enter the subject line for the donation receipt email.', 'give'), |
|
392 | 392 | 'id' => 'offline_donation_subject', |
393 | - 'default' => esc_attr__( '{donation} - Offline Donation Instructions', 'give' ), |
|
393 | + 'default' => esc_attr__('{donation} - Offline Donation Instructions', 'give'), |
|
394 | 394 | 'type' => 'text', |
395 | 395 | ), |
396 | 396 | array( |
397 | - 'name' => __( 'Offline Donation Email Instructions', 'give' ), |
|
398 | - 'desc' => __( 'Enter the instructions you want emailed to the donor after they have submitted the donation form. Most likely this would include important information like mailing address and who to make the check out to.', 'give' ), |
|
397 | + 'name' => __('Offline Donation Email Instructions', 'give'), |
|
398 | + 'desc' => __('Enter the instructions you want emailed to the donor after they have submitted the donation form. Most likely this would include important information like mailing address and who to make the check out to.', 'give'), |
|
399 | 399 | 'id' => 'global_offline_donation_email', |
400 | 400 | 'default' => give_get_default_offline_donation_email_content(), |
401 | 401 | 'type' => 'wysiwyg', |
@@ -409,104 +409,104 @@ discard block |
||
409 | 409 | /** Display Settings */ |
410 | 410 | 'display' => array( |
411 | 411 | 'id' => 'display_settings', |
412 | - 'give_title' => __( 'Display Settings', 'give' ), |
|
413 | - 'show_on' => array( 'key' => 'options-page', 'value' => array( $this->key ) ), |
|
414 | - 'fields' => apply_filters( 'give_settings_display', array( |
|
412 | + 'give_title' => __('Display Settings', 'give'), |
|
413 | + 'show_on' => array('key' => 'options-page', 'value' => array($this->key)), |
|
414 | + 'fields' => apply_filters('give_settings_display', array( |
|
415 | 415 | array( |
416 | - 'name' => __( 'Display Settings', 'give' ), |
|
416 | + 'name' => __('Display Settings', 'give'), |
|
417 | 417 | 'desc' => '', |
418 | 418 | 'id' => 'give_title_display_settings_1', |
419 | 419 | 'type' => 'give_title', |
420 | 420 | ), |
421 | 421 | array( |
422 | - 'name' => __( 'Disable CSS', 'give' ), |
|
423 | - 'desc' => __( 'Enable this option if you would like to disable all of Give\'s included CSS stylesheets.', 'give' ), |
|
422 | + 'name' => __('Disable CSS', 'give'), |
|
423 | + 'desc' => __('Enable this option if you would like to disable all of Give\'s included CSS stylesheets.', 'give'), |
|
424 | 424 | 'id' => 'disable_css', |
425 | 425 | 'type' => 'checkbox', |
426 | 426 | ), |
427 | 427 | array( |
428 | - 'name' => __( 'Enable Floating Labels', 'give' ), |
|
428 | + 'name' => __('Enable Floating Labels', 'give'), |
|
429 | 429 | /* translators: %s: http://docs.givewp.com/form-floating-labels */ |
430 | - 'desc' => sprintf( wp_kses( __( 'Enable <a href="%s" target="_blank">floating labels</a> in Give\'s donation forms. Note that if the "Disable CSS" option is enabled, you will need to style the floating labels yourself.', 'give' ), array( |
|
430 | + 'desc' => sprintf(wp_kses(__('Enable <a href="%s" target="_blank">floating labels</a> in Give\'s donation forms. Note that if the "Disable CSS" option is enabled, you will need to style the floating labels yourself.', 'give'), array( |
|
431 | 431 | 'a' => array( |
432 | 432 | 'href' => array(), |
433 | 433 | 'target' => array(), |
434 | 434 | ), |
435 | - ) ), esc_url( 'http://docs.givewp.com/form-floating-labels' ) ), |
|
435 | + )), esc_url('http://docs.givewp.com/form-floating-labels')), |
|
436 | 436 | 'id' => 'floatlabels', |
437 | 437 | 'type' => 'checkbox', |
438 | 438 | ), |
439 | 439 | array( |
440 | - 'name' => __( 'Disable Welcome Screen', 'give' ), |
|
440 | + 'name' => __('Disable Welcome Screen', 'give'), |
|
441 | 441 | /* translators: %s: about page URL */ |
442 | - 'desc' => sprintf( wp_kses( __( 'Enable this option if you would like to disable the <a href="%s" target="_blank">Give Welcome screen</a> every time Give is activated and/or updated.', 'give' ), array( |
|
442 | + 'desc' => sprintf(wp_kses(__('Enable this option if you would like to disable the <a href="%s" target="_blank">Give Welcome screen</a> every time Give is activated and/or updated.', 'give'), array( |
|
443 | 443 | 'a' => array( |
444 | 444 | 'href' => array(), |
445 | 445 | 'target' => array(), |
446 | 446 | ), |
447 | - ) ), esc_url( admin_url( 'index.php?page=give-about' ) ) ), |
|
447 | + )), esc_url(admin_url('index.php?page=give-about'))), |
|
448 | 448 | 'id' => 'disable_welcome', |
449 | 449 | 'type' => 'checkbox', |
450 | 450 | ), |
451 | 451 | array( |
452 | - 'name' => __( 'Post Types', 'give' ), |
|
452 | + 'name' => __('Post Types', 'give'), |
|
453 | 453 | 'desc' => '', |
454 | 454 | 'id' => 'give_title_display_settings_2', |
455 | 455 | 'type' => 'give_title', |
456 | 456 | ), |
457 | 457 | array( |
458 | - 'name' => __( 'Disable Form Single Views', 'give' ), |
|
459 | - 'desc' => __( 'By default, all forms have single views enabled which create a specific URL on your website for that form. This option disables the singular and archive views from being publicly viewable. Note: you will need to embed forms using a shortcode or widget if enabled.', 'give' ), |
|
458 | + 'name' => __('Disable Form Single Views', 'give'), |
|
459 | + 'desc' => __('By default, all forms have single views enabled which create a specific URL on your website for that form. This option disables the singular and archive views from being publicly viewable. Note: you will need to embed forms using a shortcode or widget if enabled.', 'give'), |
|
460 | 460 | 'id' => 'disable_forms_singular', |
461 | 461 | 'type' => 'checkbox', |
462 | 462 | ), |
463 | 463 | array( |
464 | - 'name' => __( 'Disable Form Archives', 'give' ), |
|
465 | - 'desc' => __( 'Archives pages list all the 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 refresh your permalinks after this option has been enabled.', 'give' ), |
|
464 | + 'name' => __('Disable Form Archives', 'give'), |
|
465 | + 'desc' => __('Archives pages list all the 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 refresh your permalinks after this option has been enabled.', 'give'), |
|
466 | 466 | 'id' => 'disable_forms_archives', |
467 | 467 | 'type' => 'checkbox', |
468 | 468 | ), |
469 | 469 | array( |
470 | - 'name' => __( 'Disable Form Excerpts', 'give' ), |
|
471 | - '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' ), |
|
470 | + 'name' => __('Disable Form Excerpts', 'give'), |
|
471 | + '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'), |
|
472 | 472 | 'id' => 'disable_forms_excerpt', |
473 | 473 | 'type' => 'checkbox', |
474 | 474 | ), |
475 | 475 | array( |
476 | - 'name' => __( 'Featured Image Size', 'give' ), |
|
477 | - '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' ), |
|
476 | + 'name' => __('Featured Image Size', 'give'), |
|
477 | + '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'), |
|
478 | 478 | 'id' => 'featured_image_size', |
479 | 479 | 'type' => 'select', |
480 | 480 | 'default' => 'large', |
481 | 481 | 'options' => give_get_featured_image_sizes(), |
482 | 482 | ), |
483 | 483 | array( |
484 | - 'name' => __( 'Disable Form Featured Image', 'give' ), |
|
485 | - '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' ), |
|
484 | + 'name' => __('Disable Form Featured Image', 'give'), |
|
485 | + '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'), |
|
486 | 486 | 'id' => 'disable_form_featured_img', |
487 | 487 | 'type' => 'checkbox', |
488 | 488 | ), |
489 | 489 | array( |
490 | - 'name' => __( 'Disable Single Form Sidebar', 'give' ), |
|
491 | - 'desc' => __( 'The sidebar allows you to add additional widget to the Give single form view. If you don\'t plan on using the sidebar you may disable it with this option.', 'give' ), |
|
490 | + 'name' => __('Disable Single Form Sidebar', 'give'), |
|
491 | + 'desc' => __('The sidebar allows you to add additional widget to the Give single form view. If you don\'t plan on using the sidebar you may disable it with this option.', 'give'), |
|
492 | 492 | 'id' => 'disable_form_sidebar', |
493 | 493 | 'type' => 'checkbox', |
494 | 494 | ), |
495 | 495 | array( |
496 | - 'name' => __( 'Taxonomies', 'give' ), |
|
496 | + 'name' => __('Taxonomies', 'give'), |
|
497 | 497 | 'desc' => '', |
498 | 498 | 'id' => 'give_title_display_settings_3', |
499 | 499 | 'type' => 'give_title', |
500 | 500 | ), |
501 | 501 | array( |
502 | - 'name' => __( 'Enable Form Categories', 'give' ), |
|
503 | - 'desc' => __( 'Enables the "Category" taxonomy for all Give forms.', 'give' ), |
|
502 | + 'name' => __('Enable Form Categories', 'give'), |
|
503 | + 'desc' => __('Enables the "Category" taxonomy for all Give forms.', 'give'), |
|
504 | 504 | 'id' => 'categories', |
505 | 505 | 'type' => 'checkbox', |
506 | 506 | ), |
507 | 507 | array( |
508 | - 'name' => __( 'Enable Form Tags', 'give' ), |
|
509 | - 'desc' => __( 'Enables the "Tag" taxonomy for all Give forms.', 'give' ), |
|
508 | + 'name' => __('Enable Form Tags', 'give'), |
|
509 | + 'desc' => __('Enables the "Tag" taxonomy for all Give forms.', 'give'), |
|
510 | 510 | 'id' => 'tags', |
511 | 511 | 'type' => 'checkbox', |
512 | 512 | ), |
@@ -519,101 +519,101 @@ discard block |
||
519 | 519 | */ |
520 | 520 | 'emails' => array( |
521 | 521 | 'id' => 'email_settings', |
522 | - 'give_title' => __( 'Email Settings', 'give' ), |
|
523 | - 'show_on' => array( 'key' => 'options-page', 'value' => array( $this->key ) ), |
|
524 | - 'fields' => apply_filters( 'give_settings_emails', array( |
|
522 | + 'give_title' => __('Email Settings', 'give'), |
|
523 | + 'show_on' => array('key' => 'options-page', 'value' => array($this->key)), |
|
524 | + 'fields' => apply_filters('give_settings_emails', array( |
|
525 | 525 | array( |
526 | - 'name' => __( 'Email Settings', 'give' ), |
|
526 | + 'name' => __('Email Settings', 'give'), |
|
527 | 527 | 'desc' => '', |
528 | 528 | 'id' => 'give_title_email_settings_1', |
529 | 529 | 'type' => 'give_title', |
530 | 530 | ), |
531 | 531 | array( |
532 | 532 | 'id' => 'email_template', |
533 | - 'name' => __( 'Email Template', 'give' ), |
|
534 | - 'desc' => __( 'Choose a template. Click "Save Changes" then "Preview Donation Receipt" to see the new template.', 'give' ), |
|
533 | + 'name' => __('Email Template', 'give'), |
|
534 | + 'desc' => __('Choose a template. Click "Save Changes" then "Preview Donation Receipt" to see the new template.', 'give'), |
|
535 | 535 | 'type' => 'select', |
536 | 536 | 'options' => give_get_email_templates(), |
537 | 537 | ), |
538 | 538 | array( |
539 | 539 | 'id' => 'email_logo', |
540 | - 'name' => __( 'Logo', 'give' ), |
|
541 | - 'desc' => __( 'Upload or choose a logo to be displayed at the top of the donation receipt emails. Displayed on HTML emails only.', 'give' ), |
|
540 | + 'name' => __('Logo', 'give'), |
|
541 | + 'desc' => __('Upload or choose a logo to be displayed at the top of the donation receipt emails. Displayed on HTML emails only.', 'give'), |
|
542 | 542 | 'type' => 'file', |
543 | 543 | ), |
544 | 544 | array( |
545 | 545 | 'id' => 'from_name', |
546 | - 'name' => __( 'From Name', 'give' ), |
|
547 | - 'desc' => __( 'The name that appears in the "From" field in donation receipt emails.', 'give' ), |
|
548 | - 'default' => get_bloginfo( 'name' ), |
|
546 | + 'name' => __('From Name', 'give'), |
|
547 | + 'desc' => __('The name that appears in the "From" field in donation receipt emails.', 'give'), |
|
548 | + 'default' => get_bloginfo('name'), |
|
549 | 549 | 'type' => 'text', |
550 | 550 | ), |
551 | 551 | array( |
552 | 552 | 'id' => 'from_email', |
553 | - 'name' => __( 'From Email', 'give' ), |
|
554 | - 'desc' => __( 'Email to send donation receipts from. This will act as the "from" and "reply-to" address.', 'give' ), |
|
555 | - 'default' => get_bloginfo( 'admin_email' ), |
|
553 | + 'name' => __('From Email', 'give'), |
|
554 | + 'desc' => __('Email to send donation receipts from. This will act as the "from" and "reply-to" address.', 'give'), |
|
555 | + 'default' => get_bloginfo('admin_email'), |
|
556 | 556 | 'type' => 'text', |
557 | 557 | ), |
558 | 558 | array( |
559 | - 'name' => __( 'Donation Receipt', 'give' ), |
|
559 | + 'name' => __('Donation Receipt', 'give'), |
|
560 | 560 | 'desc' => '', |
561 | 561 | 'id' => 'give_title_email_settings_2', |
562 | 562 | 'type' => 'give_title', |
563 | 563 | ), |
564 | 564 | array( |
565 | 565 | 'id' => 'donation_subject', |
566 | - 'name' => __( 'Donation Email Subject', 'give' ), |
|
567 | - 'desc' => __( 'Enter the subject line for the donation receipt email.', 'give' ), |
|
568 | - 'default' => esc_attr__( 'Donation Receipt', 'give' ), |
|
566 | + 'name' => __('Donation Email Subject', 'give'), |
|
567 | + 'desc' => __('Enter the subject line for the donation receipt email.', 'give'), |
|
568 | + 'default' => esc_attr__('Donation Receipt', 'give'), |
|
569 | 569 | 'type' => 'text', |
570 | 570 | ), |
571 | 571 | array( |
572 | 572 | 'id' => 'donation_receipt', |
573 | - 'name' => __( 'Donation Receipt', 'give' ), |
|
573 | + 'name' => __('Donation Receipt', 'give'), |
|
574 | 574 | 'desc' => sprintf( |
575 | 575 | /* translators: %s: emails tags list */ |
576 | - __( 'Enter the email that is sent to users after completing a successful donation. HTML is accepted. Available template tags: %s', 'give' ), |
|
577 | - '<br/>' . give_get_emails_tags_list() |
|
576 | + __('Enter the email that is sent to users after completing a successful donation. HTML is accepted. Available template tags: %s', 'give'), |
|
577 | + '<br/>'.give_get_emails_tags_list() |
|
578 | 578 | ), |
579 | 579 | 'type' => 'wysiwyg', |
580 | 580 | 'default' => give_get_default_donation_receipt_email(), |
581 | 581 | ), |
582 | 582 | array( |
583 | - 'name' => __( 'New Donation Notification', 'give' ), |
|
583 | + 'name' => __('New Donation Notification', 'give'), |
|
584 | 584 | 'desc' => '', |
585 | 585 | 'id' => 'give_title_email_settings_3', |
586 | 586 | 'type' => 'give_title', |
587 | 587 | ), |
588 | 588 | array( |
589 | 589 | 'id' => 'donation_notification_subject', |
590 | - 'name' => __( 'Donation Notification Subject', 'give' ), |
|
591 | - 'desc' => __( 'Enter the subject line for the donation notification email.', 'give' ), |
|
590 | + 'name' => __('Donation Notification Subject', 'give'), |
|
591 | + 'desc' => __('Enter the subject line for the donation notification email.', 'give'), |
|
592 | 592 | 'type' => 'text', |
593 | - 'default' => esc_attr__( 'New Donation - #{payment_id}', 'give' ), |
|
593 | + 'default' => esc_attr__('New Donation - #{payment_id}', 'give'), |
|
594 | 594 | ), |
595 | 595 | array( |
596 | 596 | 'id' => 'donation_notification', |
597 | - 'name' => __( 'Donation Notification', 'give' ), |
|
597 | + 'name' => __('Donation Notification', 'give'), |
|
598 | 598 | 'desc' => sprintf( |
599 | 599 | /* translators: %s: emails tags list */ |
600 | - __( 'Enter the email that is sent to donation notification emails after completion of a donation. HTML is accepted. Available template tags: %s', 'give' ), |
|
601 | - '<br/>' . give_get_emails_tags_list() |
|
600 | + __('Enter the email that is sent to donation notification emails after completion of a donation. HTML is accepted. Available template tags: %s', 'give'), |
|
601 | + '<br/>'.give_get_emails_tags_list() |
|
602 | 602 | ), |
603 | 603 | 'type' => 'wysiwyg', |
604 | 604 | 'default' => give_get_default_donation_notification_email(), |
605 | 605 | ), |
606 | 606 | array( |
607 | 607 | 'id' => 'admin_notice_emails', |
608 | - 'name' => __( 'Donation Notification Emails', 'give' ), |
|
609 | - 'desc' => __( 'Enter the email address(es) that should receive a notification anytime a donation is made, please only enter <span class="give-underline">one email address per line</span> and <strong>not separated by commas</strong>.', 'give' ), |
|
608 | + 'name' => __('Donation Notification Emails', 'give'), |
|
609 | + 'desc' => __('Enter the email address(es) that should receive a notification anytime a donation is made, please only enter <span class="give-underline">one email address per line</span> and <strong>not separated by commas</strong>.', 'give'), |
|
610 | 610 | 'type' => 'textarea', |
611 | - 'default' => get_bloginfo( 'admin_email' ), |
|
611 | + 'default' => get_bloginfo('admin_email'), |
|
612 | 612 | ), |
613 | 613 | array( |
614 | 614 | 'id' => 'disable_admin_notices', |
615 | - 'name' => __( 'Disable Admin Notifications', 'give' ), |
|
616 | - 'desc' => __( 'Check this box if you do not want to receive emails when new donations are made.', 'give' ), |
|
615 | + 'name' => __('Disable Admin Notifications', 'give'), |
|
616 | + 'desc' => __('Check this box if you do not want to receive emails when new donations are made.', 'give'), |
|
617 | 617 | 'type' => 'checkbox', |
618 | 618 | ), |
619 | 619 | ) |
@@ -622,99 +622,99 @@ discard block |
||
622 | 622 | /** Extension Settings */ |
623 | 623 | 'addons' => array( |
624 | 624 | 'id' => 'addons', |
625 | - 'give_title' => __( 'Give Add-ons Settings', 'give' ), |
|
626 | - 'show_on' => array( 'key' => 'options-page', 'value' => array( $this->key ) ), |
|
627 | - 'fields' => apply_filters( 'give_settings_addons', array() |
|
625 | + 'give_title' => __('Give Add-ons Settings', 'give'), |
|
626 | + 'show_on' => array('key' => 'options-page', 'value' => array($this->key)), |
|
627 | + 'fields' => apply_filters('give_settings_addons', array() |
|
628 | 628 | ), |
629 | 629 | ), |
630 | 630 | /** Licenses Settings */ |
631 | 631 | 'licenses' => array( |
632 | 632 | 'id' => 'licenses', |
633 | - 'give_title' => __( 'Give Licenses', 'give' ), |
|
634 | - 'show_on' => array( 'key' => 'options-page', 'value' => array( $this->key ) ), |
|
635 | - 'fields' => apply_filters( 'give_settings_licenses', array() |
|
633 | + 'give_title' => __('Give Licenses', 'give'), |
|
634 | + 'show_on' => array('key' => 'options-page', 'value' => array($this->key)), |
|
635 | + 'fields' => apply_filters('give_settings_licenses', array() |
|
636 | 636 | ), |
637 | 637 | ), |
638 | 638 | /** Advanced Options */ |
639 | 639 | 'advanced' => array( |
640 | 640 | 'id' => 'advanced_options', |
641 | - 'give_title' => __( 'Advanced Options', 'give' ), |
|
642 | - 'show_on' => array( 'key' => 'options-page', 'value' => array( $this->key ) ), |
|
643 | - 'fields' => apply_filters( 'give_settings_advanced', array( |
|
641 | + 'give_title' => __('Advanced Options', 'give'), |
|
642 | + 'show_on' => array('key' => 'options-page', 'value' => array($this->key)), |
|
643 | + 'fields' => apply_filters('give_settings_advanced', array( |
|
644 | 644 | array( |
645 | - 'name' => __( 'Access Control', 'give' ), |
|
645 | + 'name' => __('Access Control', 'give'), |
|
646 | 646 | 'desc' => '', |
647 | 647 | 'id' => 'give_title_session_control_1', |
648 | 648 | 'type' => 'give_title', |
649 | 649 | ), |
650 | 650 | array( |
651 | 651 | 'id' => 'session_lifetime', |
652 | - 'name' => __( 'Session Lifetime', 'give' ), |
|
653 | - 'desc' => __( 'The length of time a user\'s session is kept alive. Give starts a new session per user upon donation. Sessions allow donors to view their donation receipts without being logged in.', 'give' ), |
|
652 | + 'name' => __('Session Lifetime', 'give'), |
|
653 | + 'desc' => __('The length of time a user\'s session is kept alive. Give starts a new session per user upon donation. Sessions allow donors to view their donation receipts without being logged in.', 'give'), |
|
654 | 654 | 'type' => 'select', |
655 | 655 | 'options' => array( |
656 | - '86400' => __( '24 Hours', 'give' ), |
|
657 | - '172800' => __( '48 Hours', 'give' ), |
|
658 | - '259200' => __( '72 Hours', 'give' ), |
|
659 | - '604800' => __( '1 Week', 'give' ), |
|
656 | + '86400' => __('24 Hours', 'give'), |
|
657 | + '172800' => __('48 Hours', 'give'), |
|
658 | + '259200' => __('72 Hours', 'give'), |
|
659 | + '604800' => __('1 Week', 'give'), |
|
660 | 660 | ), |
661 | 661 | ), |
662 | 662 | array( |
663 | - 'name' => __( 'Email Access', 'give' ), |
|
664 | - 'desc' => __( 'Would you like your donors to be able to access their donation history using only email? Donors whose sessions have expired and do not have an account may still access their donation history via a temporary email access link.', 'give' ), |
|
663 | + 'name' => __('Email Access', 'give'), |
|
664 | + 'desc' => __('Would you like your donors to be able to access their donation history using only email? Donors whose sessions have expired and do not have an account may still access their donation history via a temporary email access link.', 'give'), |
|
665 | 665 | 'id' => 'email_access', |
666 | 666 | 'type' => 'checkbox', |
667 | 667 | ), |
668 | 668 | array( |
669 | 669 | 'id' => 'recaptcha_key', |
670 | - 'name' => __( 'reCAPTCHA Site Key', 'give' ), |
|
670 | + 'name' => __('reCAPTCHA Site Key', 'give'), |
|
671 | 671 | /* translators: %s: https://www.google.com/recaptcha/ */ |
672 | - 'desc' => sprintf( __( 'If you would like to prevent spam on the email access form navigate to <a href="%s" target="_blank">the reCAPTCHA website</a> and sign up for an API key. The reCAPTCHA uses Google\'s user-friendly single click verification method.', 'give' ), esc_url( 'https://www.google.com/recaptcha/' ) ), |
|
672 | + 'desc' => sprintf(__('If you would like to prevent spam on the email access form navigate to <a href="%s" target="_blank">the reCAPTCHA website</a> and sign up for an API key. The reCAPTCHA uses Google\'s user-friendly single click verification method.', 'give'), esc_url('https://www.google.com/recaptcha/')), |
|
673 | 673 | 'default' => '', |
674 | 674 | 'type' => 'text', |
675 | 675 | ), |
676 | 676 | array( |
677 | 677 | 'id' => 'recaptcha_secret', |
678 | - 'name' => __( 'reCAPTCHA Secret Key', 'give' ), |
|
679 | - 'desc' => __( 'Please paste the reCAPTCHA secret key here from your manage reCAPTCHA API Keys panel.', 'give' ), |
|
678 | + 'name' => __('reCAPTCHA Secret Key', 'give'), |
|
679 | + 'desc' => __('Please paste the reCAPTCHA secret key here from your manage reCAPTCHA API Keys panel.', 'give'), |
|
680 | 680 | 'default' => '', |
681 | 681 | 'type' => 'text', |
682 | 682 | ), |
683 | 683 | array( |
684 | - 'name' => __( 'Data Control', 'give' ), |
|
684 | + 'name' => __('Data Control', 'give'), |
|
685 | 685 | 'desc' => '', |
686 | 686 | 'id' => 'give_title_data_control_2', |
687 | 687 | 'type' => 'give_title', |
688 | 688 | ), |
689 | 689 | array( |
690 | - 'name' => __( 'Remove All Data on Uninstall?', 'give' ), |
|
691 | - 'desc' => __( 'When the plugin is deleted, completely remove all Give data.', 'give' ), |
|
690 | + 'name' => __('Remove All Data on Uninstall?', 'give'), |
|
691 | + 'desc' => __('When the plugin is deleted, completely remove all Give data.', 'give'), |
|
692 | 692 | 'id' => 'uninstall_on_delete', |
693 | 693 | 'type' => 'checkbox', |
694 | 694 | ), |
695 | 695 | array( |
696 | - 'name' => __( 'Filter Control', 'give' ), |
|
696 | + 'name' => __('Filter Control', 'give'), |
|
697 | 697 | 'desc' => '', |
698 | 698 | 'id' => 'give_title_filter_control', |
699 | 699 | 'type' => 'give_title', |
700 | 700 | ), |
701 | 701 | array( |
702 | 702 | /* translators: %s: the_content */ |
703 | - 'name' => sprintf( __( 'Disable %s filter', 'give' ), '<code>the_content</code>' ), |
|
703 | + 'name' => sprintf(__('Disable %s filter', 'give'), '<code>the_content</code>'), |
|
704 | 704 | /* translators: 1: https://codex.wordpress.org/Plugin_API/Filter_Reference/the_content 2: the_content */ |
705 | - 'desc' => sprintf( __( 'If you are seeing extra social buttons, related posts, or other unwanted elements appearing within your forms then you can disable WordPress\' content filter. <a href="%1$s" target="_blank">Learn more</a> about %2$s filter.', 'give' ), esc_url( 'https://codex.wordpress.org/Plugin_API/Filter_Reference/the_content' ), '<code>the_content</code>' ), |
|
705 | + 'desc' => sprintf(__('If you are seeing extra social buttons, related posts, or other unwanted elements appearing within your forms then you can disable WordPress\' content filter. <a href="%1$s" target="_blank">Learn more</a> about %2$s filter.', 'give'), esc_url('https://codex.wordpress.org/Plugin_API/Filter_Reference/the_content'), '<code>the_content</code>'), |
|
706 | 706 | 'id' => 'disable_the_content_filter', |
707 | 707 | 'type' => 'checkbox', |
708 | 708 | ), |
709 | 709 | array( |
710 | - 'name' => __( 'Script Loading', 'give' ), |
|
710 | + 'name' => __('Script Loading', 'give'), |
|
711 | 711 | 'desc' => '', |
712 | 712 | 'id' => 'give_title_script_control', |
713 | 713 | 'type' => 'give_title', |
714 | 714 | ), |
715 | 715 | array( |
716 | - 'name' => __( 'Load Scripts in Footer?', 'give' ), |
|
717 | - 'desc' => __( 'Check this box if you would like Give to load all frontend JavaScript files in the footer.', 'give' ), |
|
716 | + 'name' => __('Load Scripts in Footer?', 'give'), |
|
717 | + 'desc' => __('Check this box if you would like Give to load all frontend JavaScript files in the footer.', 'give'), |
|
718 | 718 | 'id' => 'scripts_footer', |
719 | 719 | 'type' => 'checkbox', |
720 | 720 | ), |
@@ -724,13 +724,13 @@ discard block |
||
724 | 724 | /** API Settings */ |
725 | 725 | 'api' => array( |
726 | 726 | 'id' => 'api', |
727 | - 'give_title' => __( 'API', 'give' ), |
|
728 | - 'show_on' => array( 'key' => 'options-page', 'value' => array( $this->key ) ), |
|
727 | + 'give_title' => __('API', 'give'), |
|
728 | + 'show_on' => array('key' => 'options-page', 'value' => array($this->key)), |
|
729 | 729 | 'show_names' => false, // Hide field names on the left |
730 | - 'fields' => apply_filters( 'give_settings_system', array( |
|
730 | + 'fields' => apply_filters('give_settings_system', array( |
|
731 | 731 | array( |
732 | 732 | 'id' => 'api', |
733 | - 'name' => __( 'API', 'give' ), |
|
733 | + 'name' => __('API', 'give'), |
|
734 | 734 | 'type' => 'api', |
735 | 735 | ), |
736 | 736 | ) |
@@ -739,13 +739,13 @@ discard block |
||
739 | 739 | /** Licenses Settings */ |
740 | 740 | 'system_info' => array( |
741 | 741 | 'id' => 'system_info', |
742 | - 'give_title' => __( 'System Info', 'give' ), |
|
743 | - 'show_on' => array( 'key' => 'options-page', 'value' => array( $this->key ) ), |
|
744 | - 'fields' => apply_filters( 'give_settings_system', array( |
|
742 | + 'give_title' => __('System Info', 'give'), |
|
743 | + 'show_on' => array('key' => 'options-page', 'value' => array($this->key)), |
|
744 | + 'fields' => apply_filters('give_settings_system', array( |
|
745 | 745 | array( |
746 | 746 | 'id' => 'system-info-textarea', |
747 | - 'name' => __( 'System Info', 'give' ), |
|
748 | - 'desc' => __( 'Please copy and paste this information in your ticket when contacting support.', 'give' ), |
|
747 | + 'name' => __('System Info', 'give'), |
|
748 | + 'desc' => __('Please copy and paste this information in your ticket when contacting support.', 'give'), |
|
749 | 749 | 'type' => 'system_info', |
750 | 750 | ), |
751 | 751 | ) |
@@ -753,15 +753,15 @@ discard block |
||
753 | 753 | ), |
754 | 754 | ); |
755 | 755 | |
756 | - $give_settings = apply_filters( 'give_registered_settings', $give_settings ); |
|
756 | + $give_settings = apply_filters('give_registered_settings', $give_settings); |
|
757 | 757 | |
758 | 758 | // Return all settings array if no active tab |
759 | - if ( empty( $active_tab ) || ! isset( $give_settings[ $active_tab ] ) ) { |
|
759 | + if (empty($active_tab) || ! isset($give_settings[$active_tab])) { |
|
760 | 760 | return $give_settings; |
761 | 761 | } |
762 | 762 | |
763 | 763 | // Add other tabs and settings fields as needed |
764 | - return $give_settings[ $active_tab ]; |
|
764 | + return $give_settings[$active_tab]; |
|
765 | 765 | |
766 | 766 | } |
767 | 767 | |
@@ -770,11 +770,11 @@ discard block |
||
770 | 770 | */ |
771 | 771 | public function settings_notices() { |
772 | 772 | |
773 | - if ( ! isset( $_POST['give_settings_saved'] ) ) { |
|
773 | + if ( ! isset($_POST['give_settings_saved'])) { |
|
774 | 774 | return; |
775 | 775 | } |
776 | 776 | |
777 | - add_settings_error( 'give-notices', 'global-settings-updated', __( 'Settings updated.', 'give' ), 'updated' ); |
|
777 | + add_settings_error('give-notices', 'global-settings-updated', __('Settings updated.', 'give'), 'updated'); |
|
778 | 778 | |
779 | 779 | } |
780 | 780 | |
@@ -789,14 +789,14 @@ discard block |
||
789 | 789 | * @return mixed Field value or exception is thrown. |
790 | 790 | * @throws Exception Throws an exception if the field is invalid. |
791 | 791 | */ |
792 | - public function __get( $field ) { |
|
792 | + public function __get($field) { |
|
793 | 793 | |
794 | 794 | // Allowed fields to retrieve |
795 | - if ( in_array( $field, array( 'key', 'fields', 'give_title', 'options_page' ), true ) ) { |
|
795 | + if (in_array($field, array('key', 'fields', 'give_title', 'options_page'), true)) { |
|
796 | 796 | return $this->{$field}; |
797 | 797 | } |
798 | 798 | |
799 | - throw new Exception( sprintf( __( 'Invalid property: %s', 'give' ), $field ) ); |
|
799 | + throw new Exception(sprintf(__('Invalid property: %s', 'give'), $field)); |
|
800 | 800 | } |
801 | 801 | |
802 | 802 | |
@@ -815,12 +815,12 @@ discard block |
||
815 | 815 | * |
816 | 816 | * @return mixed Option value |
817 | 817 | */ |
818 | -function give_get_option( $key = '', $default = false ) { |
|
818 | +function give_get_option($key = '', $default = false) { |
|
819 | 819 | $give_options = give_get_settings(); |
820 | - $value = ! empty( $give_options[ $key ] ) ? $give_options[ $key ] : $default; |
|
821 | - $value = apply_filters( 'give_get_option', $value, $key, $default ); |
|
820 | + $value = ! empty($give_options[$key]) ? $give_options[$key] : $default; |
|
821 | + $value = apply_filters('give_get_option', $value, $key, $default); |
|
822 | 822 | |
823 | - return apply_filters( "give_get_option_{$key}", $value, $key, $default ); |
|
823 | + return apply_filters("give_get_option_{$key}", $value, $key, $default); |
|
824 | 824 | } |
825 | 825 | |
826 | 826 | |
@@ -838,33 +838,33 @@ discard block |
||
838 | 838 | * |
839 | 839 | * @return boolean True if updated, false if not. |
840 | 840 | */ |
841 | -function give_update_option( $key = '', $value = false ) { |
|
841 | +function give_update_option($key = '', $value = false) { |
|
842 | 842 | |
843 | 843 | // If no key, exit |
844 | - if ( empty( $key ) ) { |
|
844 | + if (empty($key)) { |
|
845 | 845 | return false; |
846 | 846 | } |
847 | 847 | |
848 | - if ( empty( $value ) ) { |
|
849 | - $remove_option = give_delete_option( $key ); |
|
848 | + if (empty($value)) { |
|
849 | + $remove_option = give_delete_option($key); |
|
850 | 850 | |
851 | 851 | return $remove_option; |
852 | 852 | } |
853 | 853 | |
854 | 854 | // First let's grab the current settings |
855 | - $options = get_option( 'give_settings' ); |
|
855 | + $options = get_option('give_settings'); |
|
856 | 856 | |
857 | 857 | // Let's let devs alter that value coming in |
858 | - $value = apply_filters( 'give_update_option', $value, $key ); |
|
858 | + $value = apply_filters('give_update_option', $value, $key); |
|
859 | 859 | |
860 | 860 | // Next let's try to update the value |
861 | - $options[ $key ] = $value; |
|
862 | - $did_update = update_option( 'give_settings', $options ); |
|
861 | + $options[$key] = $value; |
|
862 | + $did_update = update_option('give_settings', $options); |
|
863 | 863 | |
864 | 864 | // If it updated, let's update the global variable |
865 | - if ( $did_update ) { |
|
865 | + if ($did_update) { |
|
866 | 866 | global $give_options; |
867 | - $give_options[ $key ] = $value; |
|
867 | + $give_options[$key] = $value; |
|
868 | 868 | } |
869 | 869 | |
870 | 870 | return $did_update; |
@@ -883,25 +883,25 @@ discard block |
||
883 | 883 | * |
884 | 884 | * @return boolean True if updated, false if not. |
885 | 885 | */ |
886 | -function give_delete_option( $key = '' ) { |
|
886 | +function give_delete_option($key = '') { |
|
887 | 887 | |
888 | 888 | // If no key, exit |
889 | - if ( empty( $key ) ) { |
|
889 | + if (empty($key)) { |
|
890 | 890 | return false; |
891 | 891 | } |
892 | 892 | |
893 | 893 | // First let's grab the current settings |
894 | - $options = get_option( 'give_settings' ); |
|
894 | + $options = get_option('give_settings'); |
|
895 | 895 | |
896 | 896 | // Next let's try to update the value |
897 | - if ( isset( $options[ $key ] ) ) { |
|
898 | - unset( $options[ $key ] ); |
|
897 | + if (isset($options[$key])) { |
|
898 | + unset($options[$key]); |
|
899 | 899 | } |
900 | 900 | |
901 | - $did_update = update_option( 'give_settings', $options ); |
|
901 | + $did_update = update_option('give_settings', $options); |
|
902 | 902 | |
903 | 903 | // If it updated, let's update the global variable |
904 | - if ( $did_update ) { |
|
904 | + if ($did_update) { |
|
905 | 905 | global $give_options; |
906 | 906 | $give_options = $options; |
907 | 907 | } |
@@ -920,9 +920,9 @@ discard block |
||
920 | 920 | */ |
921 | 921 | function give_get_settings() { |
922 | 922 | |
923 | - $settings = get_option( 'give_settings' ); |
|
923 | + $settings = get_option('give_settings'); |
|
924 | 924 | |
925 | - return (array) apply_filters( 'give_get_settings', $settings ); |
|
925 | + return (array) apply_filters('give_get_settings', $settings); |
|
926 | 926 | |
927 | 927 | } |
928 | 928 | |
@@ -940,25 +940,25 @@ discard block |
||
940 | 940 | * |
941 | 941 | * @return array |
942 | 942 | */ |
943 | -function give_settings_array_insert( $array, $position, $insert ) { |
|
944 | - if ( is_int( $position ) ) { |
|
945 | - array_splice( $array, $position, 0, $insert ); |
|
943 | +function give_settings_array_insert($array, $position, $insert) { |
|
944 | + if (is_int($position)) { |
|
945 | + array_splice($array, $position, 0, $insert); |
|
946 | 946 | } else { |
947 | 947 | |
948 | - foreach ( $array as $index => $subarray ) { |
|
949 | - if ( isset( $subarray['id'] ) && $subarray['id'] == $position ) { |
|
948 | + foreach ($array as $index => $subarray) { |
|
949 | + if (isset($subarray['id']) && $subarray['id'] == $position) { |
|
950 | 950 | $pos = $index; |
951 | 951 | } |
952 | 952 | } |
953 | 953 | |
954 | - if ( ! isset( $pos ) ) { |
|
954 | + if ( ! isset($pos)) { |
|
955 | 955 | return $array; |
956 | 956 | } |
957 | 957 | |
958 | 958 | $array = array_merge( |
959 | - array_slice( $array, 0, $pos ), |
|
959 | + array_slice($array, 0, $pos), |
|
960 | 960 | $insert, |
961 | - array_slice( $array, $pos ) |
|
961 | + array_slice($array, $pos) |
|
962 | 962 | ); |
963 | 963 | } |
964 | 964 | |
@@ -978,23 +978,23 @@ discard block |
||
978 | 978 | * |
979 | 979 | * @return void |
980 | 980 | */ |
981 | -function give_enabled_gateways_callback( $field_arr, $saved_values = array() ) { |
|
981 | +function give_enabled_gateways_callback($field_arr, $saved_values = array()) { |
|
982 | 982 | |
983 | 983 | $id = $field_arr['id']; |
984 | - $gateways = give_get_ordered_payment_gateways( give_get_payment_gateways() ); |
|
984 | + $gateways = give_get_ordered_payment_gateways(give_get_payment_gateways()); |
|
985 | 985 | |
986 | 986 | echo '<ul class="give-checklist-fields give-payment-gatways-list">'; |
987 | 987 | |
988 | - foreach ( $gateways as $key => $option ) : |
|
988 | + foreach ($gateways as $key => $option) : |
|
989 | 989 | |
990 | - if ( is_array( $saved_values ) && array_key_exists( $key, $saved_values ) ) { |
|
990 | + if (is_array($saved_values) && array_key_exists($key, $saved_values)) { |
|
991 | 991 | $enabled = '1'; |
992 | 992 | } else { |
993 | 993 | $enabled = null; |
994 | 994 | } |
995 | 995 | |
996 | - echo '<li><span class="give-drag-handle"><span class="dashicons dashicons-menu"></span></span><input name="' . $id . '[' . $key . ']" id="' . $id . '[' . $key . ']" type="checkbox" value="1" ' . checked( '1', $enabled, false ) . '/> '; |
|
997 | - echo '<label for="' . $id . '[' . $key . ']">' . $option['admin_label'] . '</label></li>'; |
|
996 | + echo '<li><span class="give-drag-handle"><span class="dashicons dashicons-menu"></span></span><input name="'.$id.'['.$key.']" id="'.$id.'['.$key.']" type="checkbox" value="1" '.checked('1', $enabled, false).'/> '; |
|
997 | + echo '<label for="'.$id.'['.$key.']">'.$option['admin_label'].'</label></li>'; |
|
998 | 998 | |
999 | 999 | endforeach; |
1000 | 1000 | |
@@ -1013,16 +1013,16 @@ discard block |
||
1013 | 1013 | * |
1014 | 1014 | * @return void |
1015 | 1015 | */ |
1016 | -function give_default_gateway_callback( $field_arr, $saved_value ) { |
|
1016 | +function give_default_gateway_callback($field_arr, $saved_value) { |
|
1017 | 1017 | $id = $field_arr['id']; |
1018 | 1018 | $gateways = give_get_enabled_payment_gateways(); |
1019 | - $saved_value = give_get_default_gateway( null ); |
|
1019 | + $saved_value = give_get_default_gateway(null); |
|
1020 | 1020 | |
1021 | - echo '<select class="give-select" name="' . $id . '" id="' . $id . '">'; |
|
1021 | + echo '<select class="give-select" name="'.$id.'" id="'.$id.'">'; |
|
1022 | 1022 | |
1023 | - foreach ( $gateways as $key => $option ) : |
|
1024 | - $selected = isset( $saved_value ) ? selected( $key, $saved_value, false ) : ''; |
|
1025 | - echo '<option value="' . esc_attr( $key ) . '"' . $selected . '>' . esc_html( $option['admin_label'] ) . '</option>'; |
|
1023 | + foreach ($gateways as $key => $option) : |
|
1024 | + $selected = isset($saved_value) ? selected($key, $saved_value, false) : ''; |
|
1025 | + echo '<option value="'.esc_attr($key).'"'.$selected.'>'.esc_html($option['admin_label']).'</option>'; |
|
1026 | 1026 | endforeach; |
1027 | 1027 | |
1028 | 1028 | echo '</select>'; |
@@ -1040,13 +1040,13 @@ discard block |
||
1040 | 1040 | * |
1041 | 1041 | * @return void |
1042 | 1042 | */ |
1043 | -function give_title_callback( $field_object, $escaped_value, $object_id, $object_type, $field_type_object ) { |
|
1043 | +function give_title_callback($field_object, $escaped_value, $object_id, $object_type, $field_type_object) { |
|
1044 | 1044 | |
1045 | 1045 | $id = $field_type_object->field->args['id']; |
1046 | 1046 | $title = $field_type_object->field->args['name']; |
1047 | 1047 | $field_description = $field_type_object->field->args['desc']; |
1048 | 1048 | |
1049 | - echo '<hr>' . $field_description; |
|
1049 | + echo '<hr>'.$field_description; |
|
1050 | 1050 | |
1051 | 1051 | } |
1052 | 1052 | |
@@ -1061,7 +1061,7 @@ discard block |
||
1061 | 1061 | * |
1062 | 1062 | * @return void |
1063 | 1063 | */ |
1064 | -function give_description_callback( $field_object, $escaped_value, $object_id, $object_type, $field_type_object ) { |
|
1064 | +function give_description_callback($field_object, $escaped_value, $object_id, $object_type, $field_type_object) { |
|
1065 | 1065 | |
1066 | 1066 | $id = $field_type_object->field->args['id']; |
1067 | 1067 | $title = $field_type_object->field->args['name']; |
@@ -1080,25 +1080,25 @@ discard block |
||
1080 | 1080 | * @see: https://github.com/WebDevStudios/CMB2/wiki/Adding-your-own-field-types |
1081 | 1081 | * @return array An array of options that matches the CMB2 options array |
1082 | 1082 | */ |
1083 | -function give_cmb2_get_post_options( $query_args, $force = false ) { |
|
1083 | +function give_cmb2_get_post_options($query_args, $force = false) { |
|
1084 | 1084 | |
1085 | - $post_options = array( '' => '' ); // Blank option |
|
1085 | + $post_options = array('' => ''); // Blank option |
|
1086 | 1086 | |
1087 | - if ( ( ! isset( $_GET['page'] ) || 'give-settings' != $_GET['page'] ) && ! $force ) { |
|
1087 | + if (( ! isset($_GET['page']) || 'give-settings' != $_GET['page']) && ! $force) { |
|
1088 | 1088 | return $post_options; |
1089 | 1089 | } |
1090 | 1090 | |
1091 | - $args = wp_parse_args( $query_args, array( |
|
1091 | + $args = wp_parse_args($query_args, array( |
|
1092 | 1092 | 'post_type' => 'page', |
1093 | 1093 | 'numberposts' => 10, |
1094 | - ) ); |
|
1094 | + )); |
|
1095 | 1095 | |
1096 | - $posts = get_posts( $args ); |
|
1096 | + $posts = get_posts($args); |
|
1097 | 1097 | |
1098 | - if ( $posts ) { |
|
1099 | - foreach ( $posts as $post ) { |
|
1098 | + if ($posts) { |
|
1099 | + foreach ($posts as $post) { |
|
1100 | 1100 | |
1101 | - $post_options[ $post->ID ] = $post->post_title; |
|
1101 | + $post_options[$post->ID] = $post->post_title; |
|
1102 | 1102 | |
1103 | 1103 | } |
1104 | 1104 | } |
@@ -1123,33 +1123,33 @@ discard block |
||
1123 | 1123 | |
1124 | 1124 | $sizes = array(); |
1125 | 1125 | $get_sizes = get_intermediate_image_sizes(); |
1126 | - $core_image_sizes = array( 'thumbnail', 'medium', 'medium_large', 'large' ); |
|
1126 | + $core_image_sizes = array('thumbnail', 'medium', 'medium_large', 'large'); |
|
1127 | 1127 | |
1128 | 1128 | |
1129 | 1129 | // This will help us to filter special characters from a string |
1130 | - $filter_slug_items = array( '_', '-' ); |
|
1130 | + $filter_slug_items = array('_', '-'); |
|
1131 | 1131 | |
1132 | - foreach ( $get_sizes as $_size ) { |
|
1132 | + foreach ($get_sizes as $_size) { |
|
1133 | 1133 | |
1134 | 1134 | // Converting image size slug to title case |
1135 | - $sizes[ $_size ] = give_slug_to_title( $_size, $filter_slug_items ); |
|
1135 | + $sizes[$_size] = give_slug_to_title($_size, $filter_slug_items); |
|
1136 | 1136 | |
1137 | - if ( in_array( $_size, $core_image_sizes ) ) { |
|
1138 | - $sizes[ $_size ] .= ' (' . get_option( "{$_size}_size_w" ) . 'x' . get_option( "{$_size}_size_h" ); |
|
1139 | - } elseif ( isset( $_wp_additional_image_sizes[ $_size ] ) ) { |
|
1140 | - $sizes[ $_size ] .= " ({$_wp_additional_image_sizes[ $_size ]['width']} x {$_wp_additional_image_sizes[ $_size ]['height']}"; |
|
1137 | + if (in_array($_size, $core_image_sizes)) { |
|
1138 | + $sizes[$_size] .= ' ('.get_option("{$_size}_size_w").'x'.get_option("{$_size}_size_h"); |
|
1139 | + } elseif (isset($_wp_additional_image_sizes[$_size])) { |
|
1140 | + $sizes[$_size] .= " ({$_wp_additional_image_sizes[$_size]['width']} x {$_wp_additional_image_sizes[$_size]['height']}"; |
|
1141 | 1141 | } |
1142 | 1142 | |
1143 | 1143 | // Based on the above image height check, label the respective resolution as responsive |
1144 | - if ( ( array_key_exists( $_size, $_wp_additional_image_sizes ) && ! $_wp_additional_image_sizes[ $_size ]['crop'] ) || ( in_array( $_size, $core_image_sizes ) && ! get_option( "{$_size}_crop" ) ) ) { |
|
1145 | - $sizes[ $_size ] .= ' - responsive'; |
|
1144 | + if ((array_key_exists($_size, $_wp_additional_image_sizes) && ! $_wp_additional_image_sizes[$_size]['crop']) || (in_array($_size, $core_image_sizes) && ! get_option("{$_size}_crop"))) { |
|
1145 | + $sizes[$_size] .= ' - responsive'; |
|
1146 | 1146 | } |
1147 | 1147 | |
1148 | - $sizes[ $_size ] .= ')'; |
|
1148 | + $sizes[$_size] .= ')'; |
|
1149 | 1149 | |
1150 | 1150 | } |
1151 | 1151 | |
1152 | - return apply_filters( 'give_get_featured_image_sizes', $sizes ); |
|
1152 | + return apply_filters('give_get_featured_image_sizes', $sizes); |
|
1153 | 1153 | } |
1154 | 1154 | |
1155 | 1155 | |
@@ -1165,14 +1165,14 @@ discard block |
||
1165 | 1165 | * |
1166 | 1166 | * @return text $string |
1167 | 1167 | */ |
1168 | -function give_slug_to_title( $string, $filters = array() ){ |
|
1168 | +function give_slug_to_title($string, $filters = array()) { |
|
1169 | 1169 | |
1170 | - foreach( $filters as $filter_item ){ |
|
1171 | - $string = str_replace( $filter_item, ' ', $string ); |
|
1170 | + foreach ($filters as $filter_item) { |
|
1171 | + $string = str_replace($filter_item, ' ', $string); |
|
1172 | 1172 | } |
1173 | 1173 | |
1174 | 1174 | // Return updated string after converting it to title case |
1175 | - return ucwords( $string ); |
|
1175 | + return ucwords($string); |
|
1176 | 1176 | |
1177 | 1177 | } |
1178 | 1178 | |
@@ -1188,18 +1188,18 @@ discard block |
||
1188 | 1188 | * |
1189 | 1189 | * @return void |
1190 | 1190 | */ |
1191 | -function give_license_key_callback( $field_object, $escaped_value, $object_id, $object_type, $field_type_object ) { |
|
1191 | +function give_license_key_callback($field_object, $escaped_value, $object_id, $object_type, $field_type_object) { |
|
1192 | 1192 | /* @var CMB2_Types $field_type_object */ |
1193 | 1193 | |
1194 | 1194 | $id = $field_type_object->field->args['id']; |
1195 | 1195 | $field_description = $field_type_object->field->args['desc']; |
1196 | 1196 | $license = $field_type_object->field->args['options']['license']; |
1197 | 1197 | $license_key = $escaped_value; |
1198 | - $is_license_key = apply_filters( 'give_is_license_key', ( is_object( $license ) && ! empty( $license ) ) ); |
|
1199 | - $is_valid_license = apply_filters( 'give_is_valid_license', ( $is_license_key && property_exists( $license, 'license' ) && 'valid' === $license->license ) ); |
|
1198 | + $is_license_key = apply_filters('give_is_license_key', (is_object($license) && ! empty($license))); |
|
1199 | + $is_valid_license = apply_filters('give_is_valid_license', ($is_license_key && property_exists($license, 'license') && 'valid' === $license->license)); |
|
1200 | 1200 | $shortname = $field_type_object->field->args['options']['shortname']; |
1201 | 1201 | $field_classes = 'regular-text give-license-field'; |
1202 | - $type = empty( $escaped_value ) || ! $is_valid_license ? 'text' : 'password'; |
|
1202 | + $type = empty($escaped_value) || ! $is_valid_license ? 'text' : 'password'; |
|
1203 | 1203 | $custom_html = ''; |
1204 | 1204 | $messages = array(); |
1205 | 1205 | $class = ''; |
@@ -1211,145 +1211,145 @@ discard block |
||
1211 | 1211 | |
1212 | 1212 | // By default query on edd api url will return license object which contain status and message property, this can break below functionality. |
1213 | 1213 | // To combat that check if status is set to error or not, if yes then set $is_license_key to false. |
1214 | - if ( $is_license_key && property_exists( $license, 'status' ) && 'error' === $license->status ) { |
|
1214 | + if ($is_license_key && property_exists($license, 'status') && 'error' === $license->status) { |
|
1215 | 1215 | $is_license_key = false; |
1216 | 1216 | } |
1217 | 1217 | |
1218 | 1218 | // Check if current license is part of subscription or not. |
1219 | - $subscriptions = get_option( 'give_subscriptions' ); |
|
1219 | + $subscriptions = get_option('give_subscriptions'); |
|
1220 | 1220 | |
1221 | - if ( $is_license_key && $subscriptions ) { |
|
1222 | - foreach ( $subscriptions as $subscription ) { |
|
1223 | - if ( in_array( $license_key, $subscription['licenses'] ) ) { |
|
1221 | + if ($is_license_key && $subscriptions) { |
|
1222 | + foreach ($subscriptions as $subscription) { |
|
1223 | + if (in_array($license_key, $subscription['licenses'])) { |
|
1224 | 1224 | $is_in_subscription = $subscription['id']; |
1225 | 1225 | break; |
1226 | 1226 | } |
1227 | 1227 | } |
1228 | 1228 | } |
1229 | 1229 | |
1230 | - if ( $is_license_key ) { |
|
1231 | - if ( $is_in_subscription ) { |
|
1232 | - $subscription_expires = strtotime( $subscriptions[ $is_in_subscription ]['expires'] ); |
|
1233 | - $subscription_status = __( 'renew', 'give' ); |
|
1230 | + if ($is_license_key) { |
|
1231 | + if ($is_in_subscription) { |
|
1232 | + $subscription_expires = strtotime($subscriptions[$is_in_subscription]['expires']); |
|
1233 | + $subscription_status = __('renew', 'give'); |
|
1234 | 1234 | |
1235 | - if ( ( 'active' !== $subscriptions[ $is_in_subscription ]['status'] ) ) { |
|
1236 | - $subscription_status = __( 'expire', 'give' ); |
|
1235 | + if (('active' !== $subscriptions[$is_in_subscription]['status'])) { |
|
1236 | + $subscription_status = __('expire', 'give'); |
|
1237 | 1237 | } |
1238 | 1238 | |
1239 | - if ( $subscription_expires < current_time( 'timestamp', 1 ) ) { |
|
1240 | - $messages[] = sprintf( |
|
1241 | - __( 'Your subscription (<a href="%1$s" target="_blank">#%2$d</a>) expired. Please <a href="%3$s" target="_blank" title="Renew your license key">renew your license key</a>', 'give' ), |
|
1242 | - urldecode( $subscriptions[ $is_in_subscription ]['invoice_url'] ), |
|
1243 | - $subscriptions[ $is_in_subscription ]['payment_id'], |
|
1244 | - $checkout_page_link . '?edd_license_key=' . $subscriptions[ $is_in_subscription ]['license_key'] . '&utm_campaign=admin&utm_source=licenses&utm_medium=expired' |
|
1239 | + if ($subscription_expires < current_time('timestamp', 1)) { |
|
1240 | + $messages[] = sprintf( |
|
1241 | + __('Your subscription (<a href="%1$s" target="_blank">#%2$d</a>) expired. Please <a href="%3$s" target="_blank" title="Renew your license key">renew your license key</a>', 'give'), |
|
1242 | + urldecode($subscriptions[$is_in_subscription]['invoice_url']), |
|
1243 | + $subscriptions[$is_in_subscription]['payment_id'], |
|
1244 | + $checkout_page_link.'?edd_license_key='.$subscriptions[$is_in_subscription]['license_key'].'&utm_campaign=admin&utm_source=licenses&utm_medium=expired' |
|
1245 | 1245 | ); |
1246 | 1246 | $license_status = 'license-expired'; |
1247 | - } elseif ( strtotime( '- 7 days', $subscription_expires ) < current_time( 'timestamp', 1 ) ) { |
|
1247 | + } elseif (strtotime('- 7 days', $subscription_expires) < current_time('timestamp', 1)) { |
|
1248 | 1248 | $messages[] = sprintf( |
1249 | - __( 'Your subscription (<a href="%1$s" target="_blank">#%2$d</a>) will %3$s in %4$s.', 'give' ), |
|
1250 | - urldecode( $subscriptions[ $is_in_subscription ]['invoice_url'] ), |
|
1251 | - $subscriptions[ $is_in_subscription ]['payment_id'], |
|
1249 | + __('Your subscription (<a href="%1$s" target="_blank">#%2$d</a>) will %3$s in %4$s.', 'give'), |
|
1250 | + urldecode($subscriptions[$is_in_subscription]['invoice_url']), |
|
1251 | + $subscriptions[$is_in_subscription]['payment_id'], |
|
1252 | 1252 | $subscription_status, |
1253 | - human_time_diff( current_time( 'timestamp', 1 ), strtotime( $subscriptions[ $is_in_subscription ]['expires'] ) ) |
|
1253 | + human_time_diff(current_time('timestamp', 1), strtotime($subscriptions[$is_in_subscription]['expires'])) |
|
1254 | 1254 | ); |
1255 | 1255 | $license_status = 'license-expires-soon'; |
1256 | 1256 | } else { |
1257 | 1257 | $messages[] = sprintf( |
1258 | - __( 'Your subscription (<a href="%1$s" target="_blank">#%2$d</a>) will %3$s on %4$s.', 'give' ), |
|
1259 | - urldecode( $subscriptions[ $is_in_subscription ]['invoice_url'] ), |
|
1260 | - $subscriptions[ $is_in_subscription ]['payment_id'], |
|
1258 | + __('Your subscription (<a href="%1$s" target="_blank">#%2$d</a>) will %3$s on %4$s.', 'give'), |
|
1259 | + urldecode($subscriptions[$is_in_subscription]['invoice_url']), |
|
1260 | + $subscriptions[$is_in_subscription]['payment_id'], |
|
1261 | 1261 | $subscription_status, |
1262 | - date_i18n( get_option( 'date_format' ), strtotime( $subscriptions[ $is_in_subscription ]['expires'], current_time( 'timestamp' ) ) ) |
|
1262 | + date_i18n(get_option('date_format'), strtotime($subscriptions[$is_in_subscription]['expires'], current_time('timestamp'))) |
|
1263 | 1263 | ); |
1264 | 1264 | $license_status = 'license-expiration-date'; |
1265 | 1265 | } |
1266 | - } elseif ( empty( $license->success ) && property_exists( $license, 'error' ) ) { |
|
1266 | + } elseif (empty($license->success) && property_exists($license, 'error')) { |
|
1267 | 1267 | |
1268 | 1268 | // activate_license 'invalid' on anything other than valid, so if there was an error capture it |
1269 | - switch ( $license->error ) { |
|
1269 | + switch ($license->error) { |
|
1270 | 1270 | case 'expired' : |
1271 | 1271 | $class = $license->error; |
1272 | 1272 | $messages[] = sprintf( |
1273 | - __( 'Your license key expired on %1$s. Please <a href="%2$s" target="_blank" title="Renew your license key">renew your license key</a>.', 'give' ), |
|
1274 | - date_i18n( get_option( 'date_format' ), strtotime( $license->expires, current_time( 'timestamp' ) ) ), |
|
1275 | - $checkout_page_link . '?edd_license_key=' . $license_key . '&utm_campaign=admin&utm_source=licenses&utm_medium=expired' |
|
1273 | + __('Your license key expired on %1$s. Please <a href="%2$s" target="_blank" title="Renew your license key">renew your license key</a>.', 'give'), |
|
1274 | + date_i18n(get_option('date_format'), strtotime($license->expires, current_time('timestamp'))), |
|
1275 | + $checkout_page_link.'?edd_license_key='.$license_key.'&utm_campaign=admin&utm_source=licenses&utm_medium=expired' |
|
1276 | 1276 | ); |
1277 | - $license_status = 'license-' . $class; |
|
1277 | + $license_status = 'license-'.$class; |
|
1278 | 1278 | break; |
1279 | 1279 | |
1280 | 1280 | case 'missing' : |
1281 | 1281 | $class = $license->error; |
1282 | 1282 | $messages[] = sprintf( |
1283 | - __( 'Invalid license. Please <a href="%s" target="_blank" title="Visit account page">visit your account page</a> and verify it.', 'give' ), |
|
1284 | - $account_page_link . '?utm_campaign=admin&utm_source=licenses&utm_medium=missing' |
|
1283 | + __('Invalid license. Please <a href="%s" target="_blank" title="Visit account page">visit your account page</a> and verify it.', 'give'), |
|
1284 | + $account_page_link.'?utm_campaign=admin&utm_source=licenses&utm_medium=missing' |
|
1285 | 1285 | ); |
1286 | - $license_status = 'license-' . $class; |
|
1286 | + $license_status = 'license-'.$class; |
|
1287 | 1287 | break; |
1288 | 1288 | |
1289 | 1289 | case 'invalid' : |
1290 | 1290 | $class = $license->error; |
1291 | 1291 | $messages[] = sprintf( |
1292 | - __( 'Your %1$s is not active for this URL. Please <a href="%2$s" target="_blank" title="Visit account page">visit your account page</a> to manage your license key URLs.', 'give' ), |
|
1292 | + __('Your %1$s is not active for this URL. Please <a href="%2$s" target="_blank" title="Visit account page">visit your account page</a> to manage your license key URLs.', 'give'), |
|
1293 | 1293 | $addon_name, |
1294 | - $account_page_link . '?utm_campaign=admin&utm_source=licenses&utm_medium=invalid' |
|
1294 | + $account_page_link.'?utm_campaign=admin&utm_source=licenses&utm_medium=invalid' |
|
1295 | 1295 | ); |
1296 | - $license_status = 'license-' . $class; |
|
1296 | + $license_status = 'license-'.$class; |
|
1297 | 1297 | break; |
1298 | 1298 | |
1299 | 1299 | case 'site_inactive' : |
1300 | 1300 | $class = $license->error; |
1301 | 1301 | $messages[] = sprintf( |
1302 | - __( 'Your %1$s is not active for this URL. Please <a href="%2$s" target="_blank" title="Visit account page">visit your account page</a> to manage your license key URLs.', 'give' ), |
|
1302 | + __('Your %1$s is not active for this URL. Please <a href="%2$s" target="_blank" title="Visit account page">visit your account page</a> to manage your license key URLs.', 'give'), |
|
1303 | 1303 | $addon_name, |
1304 | - $account_page_link . '?utm_campaign=admin&utm_source=licenses&utm_medium=invalid' |
|
1304 | + $account_page_link.'?utm_campaign=admin&utm_source=licenses&utm_medium=invalid' |
|
1305 | 1305 | ); |
1306 | - $license_status = 'license-' . $class; |
|
1306 | + $license_status = 'license-'.$class; |
|
1307 | 1307 | break; |
1308 | 1308 | |
1309 | 1309 | case 'item_name_mismatch' : |
1310 | 1310 | $class = $license->error; |
1311 | - $messages[] = sprintf( __( 'This license %1$s does not belong to %2$s.', 'give' ), $license_key, $addon_name ); |
|
1312 | - $license_status = 'license-' . $class; |
|
1311 | + $messages[] = sprintf(__('This license %1$s does not belong to %2$s.', 'give'), $license_key, $addon_name); |
|
1312 | + $license_status = 'license-'.$class; |
|
1313 | 1313 | break; |
1314 | 1314 | |
1315 | 1315 | case 'no_activations_left': |
1316 | 1316 | $class = $license->error; |
1317 | - $messages[] = sprintf( __( 'Your license key has reached it\'s activation limit. <a href="%s">View possible upgrades</a> now.', 'give' ), $account_page_link ); |
|
1318 | - $license_status = 'license-' . $class; |
|
1317 | + $messages[] = sprintf(__('Your license key has reached it\'s activation limit. <a href="%s">View possible upgrades</a> now.', 'give'), $account_page_link); |
|
1318 | + $license_status = 'license-'.$class; |
|
1319 | 1319 | break; |
1320 | 1320 | } |
1321 | 1321 | |
1322 | - } elseif ( empty( $license->success ) ){ |
|
1322 | + } elseif (empty($license->success)) { |
|
1323 | 1323 | $class = 'invalid'; |
1324 | 1324 | $messages[] = sprintf( |
1325 | - __( 'Your %1$s is not active for this URL. Please <a href="%2$s" target="_blank" title="Visit account page">visit your account page</a> to manage your license key URLs.', 'give' ), |
|
1325 | + __('Your %1$s is not active for this URL. Please <a href="%2$s" target="_blank" title="Visit account page">visit your account page</a> to manage your license key URLs.', 'give'), |
|
1326 | 1326 | $addon_name, |
1327 | - $account_page_link . '?utm_campaign=admin&utm_source=licenses&utm_medium=invalid' |
|
1327 | + $account_page_link.'?utm_campaign=admin&utm_source=licenses&utm_medium=invalid' |
|
1328 | 1328 | ); |
1329 | - $license_status = 'license-' . $class; |
|
1329 | + $license_status = 'license-'.$class; |
|
1330 | 1330 | |
1331 | - }else { |
|
1332 | - switch ( $license->license ) { |
|
1331 | + } else { |
|
1332 | + switch ($license->license) { |
|
1333 | 1333 | case 'valid' : |
1334 | 1334 | default: |
1335 | 1335 | $class = 'valid'; |
1336 | - $now = current_time( 'timestamp' ); |
|
1337 | - $expiration = strtotime( $license->expires, current_time( 'timestamp' ) ); |
|
1336 | + $now = current_time('timestamp'); |
|
1337 | + $expiration = strtotime($license->expires, current_time('timestamp')); |
|
1338 | 1338 | |
1339 | - if ( 'lifetime' === $license->expires ) { |
|
1340 | - $messages[] = __( 'License key never expires.', 'give' ); |
|
1339 | + if ('lifetime' === $license->expires) { |
|
1340 | + $messages[] = __('License key never expires.', 'give'); |
|
1341 | 1341 | $license_status = 'license-lifetime-notice'; |
1342 | - } elseif ( $expiration > $now && $expiration - $now < ( DAY_IN_SECONDS * 30 ) ) { |
|
1342 | + } elseif ($expiration > $now && $expiration - $now < (DAY_IN_SECONDS * 30)) { |
|
1343 | 1343 | $messages[] = sprintf( |
1344 | - __( 'Your license key expires soon! It expires on %1$s. <a href="%2$s" target="_blank" title="Renew license">Renew your license key</a>.', 'give' ), |
|
1345 | - date_i18n( get_option( 'date_format' ), strtotime( $license->expires, current_time( 'timestamp' ) ) ), |
|
1346 | - $checkout_page_link . '?edd_license_key=' . $license_key . '&utm_campaign=admin&utm_source=licenses&utm_medium=renew' |
|
1344 | + __('Your license key expires soon! It expires on %1$s. <a href="%2$s" target="_blank" title="Renew license">Renew your license key</a>.', 'give'), |
|
1345 | + date_i18n(get_option('date_format'), strtotime($license->expires, current_time('timestamp'))), |
|
1346 | + $checkout_page_link.'?edd_license_key='.$license_key.'&utm_campaign=admin&utm_source=licenses&utm_medium=renew' |
|
1347 | 1347 | ); |
1348 | 1348 | $license_status = 'license-expires-soon'; |
1349 | 1349 | } else { |
1350 | 1350 | $messages[] = sprintf( |
1351 | - __( 'Your license key expires on %s.', 'give' ), |
|
1352 | - date_i18n( get_option( 'date_format' ), strtotime( $license->expires, current_time( 'timestamp' ) ) ) |
|
1351 | + __('Your license key expires on %s.', 'give'), |
|
1352 | + date_i18n(get_option('date_format'), strtotime($license->expires, current_time('timestamp'))) |
|
1353 | 1353 | ); |
1354 | 1354 | $license_status = 'license-expiration-date'; |
1355 | 1355 | } |
@@ -1357,15 +1357,15 @@ discard block |
||
1357 | 1357 | } |
1358 | 1358 | } |
1359 | 1359 | } else { |
1360 | - $messages[] = sprintf( |
|
1361 | - __( 'To receive updates, please enter your valid %s license key.', 'give' ), |
|
1360 | + $messages[] = sprintf( |
|
1361 | + __('To receive updates, please enter your valid %s license key.', 'give'), |
|
1362 | 1362 | $addon_name |
1363 | 1363 | ); |
1364 | 1364 | $license_status = 'inactive'; |
1365 | 1365 | } |
1366 | 1366 | |
1367 | 1367 | // Add class for input field if license is active. |
1368 | - if ( $is_valid_license ) { |
|
1368 | + if ($is_valid_license) { |
|
1369 | 1369 | $field_classes .= ' give-license-active'; |
1370 | 1370 | } |
1371 | 1371 | |
@@ -1373,33 +1373,33 @@ discard block |
||
1373 | 1373 | $input_field_html = "<input type=\"{$type}\" name=\"{$id}\" class=\"{$field_classes}\" value=\"{$license_key}\">"; |
1374 | 1374 | |
1375 | 1375 | // If license is active so show deactivate button. |
1376 | - if ( $is_valid_license ) { |
|
1376 | + if ($is_valid_license) { |
|
1377 | 1377 | // Get input field html. |
1378 | 1378 | $input_field_html = "<input type=\"{$type}\" name=\"{$id}\" class=\"{$field_classes}\" value=\"{$license_key}\" readonly=\"readonly\">"; |
1379 | 1379 | |
1380 | - $custom_html = '<input type="submit" class="button button-small give-license-deactivate" name="' . $id . '_deactivate" value="' . esc_attr__( 'Deactivate License', 'give' ) . '"/>'; |
|
1380 | + $custom_html = '<input type="submit" class="button button-small give-license-deactivate" name="'.$id.'_deactivate" value="'.esc_attr__('Deactivate License', 'give').'"/>'; |
|
1381 | 1381 | |
1382 | 1382 | } |
1383 | 1383 | |
1384 | 1384 | // Field description. |
1385 | - $custom_html .= '<label for="give_settings[' . $id . ']"> ' . $field_description . '</label>'; |
|
1385 | + $custom_html .= '<label for="give_settings['.$id.']"> '.$field_description.'</label>'; |
|
1386 | 1386 | |
1387 | 1387 | // If no messages found then inform user that to get updated in future register yourself. |
1388 | - if ( empty( $messages ) ) { |
|
1389 | - $messages[] = apply_filters( "{$shortname}_default_addon_notice", __( 'To receive updates, please enter your valid license key.', 'give' ) ); |
|
1388 | + if (empty($messages)) { |
|
1389 | + $messages[] = apply_filters("{$shortname}_default_addon_notice", __('To receive updates, please enter your valid license key.', 'give')); |
|
1390 | 1390 | } |
1391 | 1391 | |
1392 | - foreach ( $messages as $message ) { |
|
1393 | - $custom_html .= '<div class="give-license-status-notice give-' . $license_status . '">'; |
|
1394 | - $custom_html .= '<p>' . $message . '</p>'; |
|
1392 | + foreach ($messages as $message) { |
|
1393 | + $custom_html .= '<div class="give-license-status-notice give-'.$license_status.'">'; |
|
1394 | + $custom_html .= '<p>'.$message.'</p>'; |
|
1395 | 1395 | $custom_html .= '</div>'; |
1396 | 1396 | } |
1397 | 1397 | |
1398 | 1398 | // Field html. |
1399 | - $custom_html = apply_filters( 'give_license_key_field_html', $input_field_html . $custom_html, $field_type_object ); |
|
1399 | + $custom_html = apply_filters('give_license_key_field_html', $input_field_html.$custom_html, $field_type_object); |
|
1400 | 1400 | |
1401 | 1401 | // Nonce. |
1402 | - wp_nonce_field( $id . '-nonce', $id . '-nonce' ); |
|
1402 | + wp_nonce_field($id.'-nonce', $id.'-nonce'); |
|
1403 | 1403 | |
1404 | 1404 | // Print field html. |
1405 | 1405 | echo "<div class=\"give-license-key\"><label for=\"{$id}\">{$addon_name }</label></div><div class=\"give-license-block\">{$custom_html}</div>"; |
@@ -1414,7 +1414,7 @@ discard block |
||
1414 | 1414 | */ |
1415 | 1415 | function give_api_callback() { |
1416 | 1416 | |
1417 | - if ( ! current_user_can( 'manage_give_settings' ) ) { |
|
1417 | + if ( ! current_user_can('manage_give_settings')) { |
|
1418 | 1418 | return; |
1419 | 1419 | } |
1420 | 1420 | |
@@ -1423,9 +1423,9 @@ discard block |
||
1423 | 1423 | * |
1424 | 1424 | * @since 1.0 |
1425 | 1425 | */ |
1426 | - do_action( 'give_tools_api_keys_before' ); |
|
1426 | + do_action('give_tools_api_keys_before'); |
|
1427 | 1427 | |
1428 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/class-api-keys-table.php'; |
|
1428 | + require_once GIVE_PLUGIN_DIR.'includes/admin/class-api-keys-table.php'; |
|
1429 | 1429 | |
1430 | 1430 | $api_keys_table = new Give_API_Keys_Table(); |
1431 | 1431 | $api_keys_table->prepare_items(); |
@@ -1434,9 +1434,9 @@ discard block |
||
1434 | 1434 | <span class="cmb2-metabox-description api-description"> |
1435 | 1435 | <?php echo sprintf( |
1436 | 1436 | /* translators: 1: http://docs.givewp.com/api 2: http://docs.givewp.com/addon-zapier */ |
1437 | - __( 'You can create API keys for individual users within their profile edit screen. API keys allow users to use the <a href="%1$s" target="_blank">Give REST API</a> to retrieve donation data in JSON or XML for external applications or devices, such as <a href="%2$s" target="_blank">Zapier</a>.', 'give' ), |
|
1438 | - esc_url( 'http://docs.givewp.com/api' ), |
|
1439 | - esc_url( 'http://docs.givewp.com/addon-zapier' ) |
|
1437 | + __('You can create API keys for individual users within their profile edit screen. API keys allow users to use the <a href="%1$s" target="_blank">Give REST API</a> to retrieve donation data in JSON or XML for external applications or devices, such as <a href="%2$s" target="_blank">Zapier</a>.', 'give'), |
|
1438 | + esc_url('http://docs.givewp.com/api'), |
|
1439 | + esc_url('http://docs.givewp.com/addon-zapier') |
|
1440 | 1440 | ); ?> |
1441 | 1441 | </span> |
1442 | 1442 | <?php |
@@ -1446,10 +1446,10 @@ discard block |
||
1446 | 1446 | * |
1447 | 1447 | * @since 1.0 |
1448 | 1448 | */ |
1449 | - do_action( 'give_tools_api_keys_after' ); |
|
1449 | + do_action('give_tools_api_keys_after'); |
|
1450 | 1450 | } |
1451 | 1451 | |
1452 | -add_action( 'give_settings_tab_api_keys', 'give_api_callback' ); |
|
1452 | +add_action('give_settings_tab_api_keys', 'give_api_callback'); |
|
1453 | 1453 | |
1454 | 1454 | /** |
1455 | 1455 | * Hook Callback |
@@ -1462,7 +1462,7 @@ discard block |
||
1462 | 1462 | * |
1463 | 1463 | * @return void |
1464 | 1464 | */ |
1465 | -function give_hook_callback( $args ) { |
|
1465 | +function give_hook_callback($args) { |
|
1466 | 1466 | |
1467 | 1467 | $id = $args['id']; |
1468 | 1468 | |
@@ -1471,7 +1471,7 @@ discard block |
||
1471 | 1471 | * |
1472 | 1472 | * @since 1.0 |
1473 | 1473 | */ |
1474 | - do_action( "give_{$id}" ); |
|
1474 | + do_action("give_{$id}"); |
|
1475 | 1475 | |
1476 | 1476 | } |
1477 | 1477 | |
@@ -1486,19 +1486,19 @@ discard block |
||
1486 | 1486 | * |
1487 | 1487 | * @return bool |
1488 | 1488 | */ |
1489 | -function give_is_setting_enabled( $value, $compare_with = null ) { |
|
1490 | - if ( ! is_null( $compare_with ) ) { |
|
1489 | +function give_is_setting_enabled($value, $compare_with = null) { |
|
1490 | + if ( ! is_null($compare_with)) { |
|
1491 | 1491 | |
1492 | - if ( is_array( $compare_with ) ) { |
|
1492 | + if (is_array($compare_with)) { |
|
1493 | 1493 | // Output. |
1494 | - return in_array( $value, $compare_with ); |
|
1494 | + return in_array($value, $compare_with); |
|
1495 | 1495 | } |
1496 | 1496 | |
1497 | 1497 | // Output. |
1498 | - return ( $value === $compare_with ); |
|
1498 | + return ($value === $compare_with); |
|
1499 | 1499 | } |
1500 | 1500 | |
1501 | 1501 | // Backward compatibility: From version 1.8 most of setting is modified to enabled/disabled |
1502 | 1502 | // Output. |
1503 | - return ( in_array( $value, array( 'enabled', 'on', 'yes' ) ) ? true : false ); |
|
1503 | + return (in_array($value, array('enabled', 'on', 'yes')) ? true : false); |
|
1504 | 1504 | } |
@@ -1328,7 +1328,7 @@ |
||
1328 | 1328 | ); |
1329 | 1329 | $license_status = 'license-' . $class; |
1330 | 1330 | |
1331 | - }else { |
|
1331 | + } else { |
|
1332 | 1332 | switch ( $license->license ) { |
1333 | 1333 | case 'valid' : |
1334 | 1334 | default: |