@@ -25,12 +25,12 @@ discard block |
||
25 | 25 | * @since 1.15 |
26 | 26 | */ |
27 | 27 | function add_hooks() { |
28 | - add_action( 'personal_options', array( $this, 'user_field' ) ); |
|
29 | - add_action( 'personal_options_update', array( $this, 'update_user_meta_value' ) ); |
|
30 | - add_action( 'edit_user_profile_update', array( $this, 'update_user_meta_value' ) ); |
|
31 | - add_action( 'admin_enqueue_scripts', array( $this, 'maybe_enqueue_script' ), 1000 ); |
|
32 | - add_action( 'update_option_active_plugins', array( $this, 'flush_related_plugins_transient' ) ); |
|
33 | - add_action( 'update_option_active_sitewide_plugins', array( $this, 'flush_related_plugins_transient' ) ); |
|
28 | + add_action('personal_options', array($this, 'user_field')); |
|
29 | + add_action('personal_options_update', array($this, 'update_user_meta_value')); |
|
30 | + add_action('edit_user_profile_update', array($this, 'update_user_meta_value')); |
|
31 | + add_action('admin_enqueue_scripts', array($this, 'maybe_enqueue_script'), 1000); |
|
32 | + add_action('update_option_active_plugins', array($this, 'flush_related_plugins_transient')); |
|
33 | + add_action('update_option_active_sitewide_plugins', array($this, 'flush_related_plugins_transient')); |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | /** |
@@ -42,11 +42,11 @@ discard block |
||
42 | 42 | * |
43 | 43 | * @return void |
44 | 44 | */ |
45 | - static function maybe_enqueue_script( $hook ) { |
|
45 | + static function maybe_enqueue_script($hook) { |
|
46 | 46 | global $pagenow; |
47 | 47 | |
48 | 48 | // Don't show if not GravityView page, or if we're on the Widgets page |
49 | - if ( ! gravityview_is_admin_page( $hook ) || $pagenow === 'widgets.php' ) { |
|
49 | + if (!gravityview_is_admin_page($hook) || $pagenow === 'widgets.php') { |
|
50 | 50 | return; |
51 | 51 | } |
52 | 52 | |
@@ -55,17 +55,17 @@ discard block |
||
55 | 55 | * @since 1.15 |
56 | 56 | * @param boolean $display_beacon Default: `true` |
57 | 57 | */ |
58 | - $display_support_port = apply_filters( 'gravityview/support_port/display', self::show_for_user() ); |
|
58 | + $display_support_port = apply_filters('gravityview/support_port/display', self::show_for_user()); |
|
59 | 59 | |
60 | - if ( empty( $display_support_port ) ) { |
|
61 | - do_action( 'gravityview_log_debug', __METHOD__ . ' - Not showing Support Port' ); |
|
60 | + if (empty($display_support_port)) { |
|
61 | + do_action('gravityview_log_debug', __METHOD__.' - Not showing Support Port'); |
|
62 | 62 | |
63 | 63 | return; |
64 | 64 | } |
65 | 65 | |
66 | - $script_debug = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
|
66 | + $script_debug = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min'; |
|
67 | 67 | |
68 | - wp_enqueue_script( 'gravityview-support', plugins_url( 'assets/js/support' . $script_debug . '.js', GRAVITYVIEW_FILE ), array(), GravityView_Plugin::version, true ); |
|
68 | + wp_enqueue_script('gravityview-support', plugins_url('assets/js/support'.$script_debug.'.js', GRAVITYVIEW_FILE), array(), GravityView_Plugin::version, true); |
|
69 | 69 | |
70 | 70 | self::_localize_script(); |
71 | 71 | } |
@@ -80,30 +80,30 @@ discard block |
||
80 | 80 | private static function _localize_script() { |
81 | 81 | |
82 | 82 | $translation = array( |
83 | - 'agentLabel' => __( 'GravityView Support', 'gravityview' ), |
|
84 | - 'searchLabel' => __( 'Search GravityView Docs', 'gravityview' ), |
|
85 | - 'searchErrorLabel' => __( 'Your search timed out. Please double-check your internet connection and try again.', 'gravityview' ), |
|
86 | - 'noResultsLabel' => _x( 'No results found for', 'a support form search has returned empty for the following word', 'gravityview' ), |
|
87 | - 'contactLabel' => __( 'Contact Support', 'gravityview' ), |
|
88 | - 'attachFileLabel' => __( 'Attach a screenshot or file', 'gravityview' ), |
|
89 | - 'attachFileError' => __( 'The maximum file size is 10 MB', 'gravityview' ), |
|
90 | - 'nameLabel' => __( 'Your Name', 'gravityview' ), |
|
91 | - 'nameError' => __( 'Please enter your name', 'gravityview' ), |
|
92 | - 'emailLabel' => __( 'Email address', 'gravityview' ), |
|
93 | - 'emailError' => __( 'Please enter a valid email address', 'gravityview' ), |
|
94 | - 'subjectLabel' => __( 'Subject', 'gravityview' ), |
|
95 | - 'subjectError' => _x( 'Please enter a subject', 'Error shown when submitting support request and there is no subject provided', 'gravityview' ), |
|
96 | - 'messageLabel' => __( 'How can we help you?', 'gravityview' ), |
|
97 | - 'messageError' => _x( 'Please enter a message', 'Error shown when submitting support request and there is no message provided', 'gravityview' ), |
|
98 | - 'contactSuccessLabel' => __( 'Message sent!', 'gravityview' ), |
|
99 | - 'contactSuccessDescription' => __( 'Thanks for reaching out! Someone from the GravityView team will get back to you soon.', 'gravityview' ), |
|
83 | + 'agentLabel' => __('GravityView Support', 'gravityview'), |
|
84 | + 'searchLabel' => __('Search GravityView Docs', 'gravityview'), |
|
85 | + 'searchErrorLabel' => __('Your search timed out. Please double-check your internet connection and try again.', 'gravityview'), |
|
86 | + 'noResultsLabel' => _x('No results found for', 'a support form search has returned empty for the following word', 'gravityview'), |
|
87 | + 'contactLabel' => __('Contact Support', 'gravityview'), |
|
88 | + 'attachFileLabel' => __('Attach a screenshot or file', 'gravityview'), |
|
89 | + 'attachFileError' => __('The maximum file size is 10 MB', 'gravityview'), |
|
90 | + 'nameLabel' => __('Your Name', 'gravityview'), |
|
91 | + 'nameError' => __('Please enter your name', 'gravityview'), |
|
92 | + 'emailLabel' => __('Email address', 'gravityview'), |
|
93 | + 'emailError' => __('Please enter a valid email address', 'gravityview'), |
|
94 | + 'subjectLabel' => __('Subject', 'gravityview'), |
|
95 | + 'subjectError' => _x('Please enter a subject', 'Error shown when submitting support request and there is no subject provided', 'gravityview'), |
|
96 | + 'messageLabel' => __('How can we help you?', 'gravityview'), |
|
97 | + 'messageError' => _x('Please enter a message', 'Error shown when submitting support request and there is no message provided', 'gravityview'), |
|
98 | + 'contactSuccessLabel' => __('Message sent!', 'gravityview'), |
|
99 | + 'contactSuccessDescription' => __('Thanks for reaching out! Someone from the GravityView team will get back to you soon.', 'gravityview'), |
|
100 | 100 | #'topicLabel' => __('Select a topic', 'gravityview' ), // Not yet implemented |
101 | 101 | #'topicError' => __('Please select a topic from the list', 'gravityview' ), // Not yet implemented |
102 | 102 | ); |
103 | 103 | |
104 | - $response = GravityView_Settings::getSetting( 'license_key_response' ); |
|
104 | + $response = GravityView_Settings::getSetting('license_key_response'); |
|
105 | 105 | |
106 | - $response = wp_parse_args( $response, array( |
|
106 | + $response = wp_parse_args($response, array( |
|
107 | 107 | 'license' => '', |
108 | 108 | 'message' => '', |
109 | 109 | 'license_key' => '', |
@@ -114,12 +114,12 @@ discard block |
||
114 | 114 | 'payment_id' => '', |
115 | 115 | 'customer_name' => '', |
116 | 116 | 'customer_email' => '', |
117 | - ) ); |
|
117 | + )); |
|
118 | 118 | |
119 | 119 | // This is just HTML we don't need. |
120 | - unset( $response['message'] ); |
|
120 | + unset($response['message']); |
|
121 | 121 | |
122 | - switch ( intval( $response['license_limit'] ) ) { |
|
122 | + switch (intval($response['license_limit'])) { |
|
123 | 123 | case 1: |
124 | 124 | $package = 'Sol'; |
125 | 125 | break; |
@@ -130,17 +130,17 @@ discard block |
||
130 | 130 | $package = 'Interstellar'; |
131 | 131 | break; |
132 | 132 | default: |
133 | - $package = sprintf( '%d-Site License', $response['license_limit'] ); |
|
133 | + $package = sprintf('%d-Site License', $response['license_limit']); |
|
134 | 134 | } |
135 | 135 | |
136 | 136 | $data = array( |
137 | - 'email' => GravityView_Settings::getSetting( 'support-email' ), |
|
137 | + 'email' => GravityView_Settings::getSetting('support-email'), |
|
138 | 138 | 'name' => $response['customer_name'], |
139 | - 'Valid License?' => ucwords( $response['license'] ), |
|
139 | + 'Valid License?' => ucwords($response['license']), |
|
140 | 140 | 'License Key' => $response['license_key'], |
141 | 141 | 'License Level' => $package, |
142 | - 'Site Admin Email' => get_bloginfo( 'admin_email' ), |
|
143 | - 'Support Email' => GravityView_Settings::getSetting( 'support-email' ), |
|
142 | + 'Site Admin Email' => get_bloginfo('admin_email'), |
|
143 | + 'Support Email' => GravityView_Settings::getSetting('support-email'), |
|
144 | 144 | 'License Limit' => $response['license_limit'], |
145 | 145 | 'Site Count' => $response['site_count'], |
146 | 146 | 'License Expires' => $response['expires'], |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | 'Payment ID' => $response['payment_id'], |
149 | 149 | 'Payment Name' => $response['customer_name'], |
150 | 150 | 'Payment Email' => $response['customer_email'], |
151 | - 'WordPress Version' => get_bloginfo( 'version', 'display' ), |
|
151 | + 'WordPress Version' => get_bloginfo('version', 'display'), |
|
152 | 152 | 'PHP Version' => phpversion(), |
153 | 153 | 'GravityView Version' => GravityView_Plugin::version, |
154 | 154 | 'Gravity Forms Version' => GFForms::$version, |
@@ -156,15 +156,15 @@ discard block |
||
156 | 156 | ); |
157 | 157 | |
158 | 158 | $localization_data = array( |
159 | - 'contactEnabled' => (int)current_user_can( 'gravityview_contact_support' ), // @todo use GVCommon::has_cap() after merge |
|
160 | - 'protocol' => ( is_ssl() ? 'https' : 'http' ), |
|
159 | + 'contactEnabled' => (int)current_user_can('gravityview_contact_support'), // @todo use GVCommon::has_cap() after merge |
|
160 | + 'protocol' => (is_ssl() ? 'https' : 'http'), |
|
161 | 161 | 'data' => $data, |
162 | 162 | 'translation' => $translation, |
163 | 163 | ); |
164 | 164 | |
165 | - wp_localize_script( 'gravityview-support', 'gvSupport', $localization_data ); |
|
165 | + wp_localize_script('gravityview-support', 'gvSupport', $localization_data); |
|
166 | 166 | |
167 | - unset( $localization_data, $data, $translation, $response, $package ); |
|
167 | + unset($localization_data, $data, $translation, $response, $package); |
|
168 | 168 | } |
169 | 169 | |
170 | 170 | /** |
@@ -175,36 +175,36 @@ discard block |
||
175 | 175 | */ |
176 | 176 | static private function get_related_plugins_and_extensions() { |
177 | 177 | |
178 | - if ( ! function_exists( 'wp_get_active_and_valid_plugins' ) ) { |
|
178 | + if (!function_exists('wp_get_active_and_valid_plugins')) { |
|
179 | 179 | return 'Running < WP 3.0'; |
180 | 180 | } |
181 | 181 | |
182 | - $extensions = get_site_transient( self::related_plugins_key ); |
|
182 | + $extensions = get_site_transient(self::related_plugins_key); |
|
183 | 183 | |
184 | - if ( empty( $extensions ) ) { |
|
184 | + if (empty($extensions)) { |
|
185 | 185 | |
186 | 186 | $active_plugins = wp_get_active_and_valid_plugins(); |
187 | 187 | $extensions = array(); |
188 | - foreach ( $active_plugins as $active_plugin ) { |
|
188 | + foreach ($active_plugins as $active_plugin) { |
|
189 | 189 | |
190 | 190 | // Match gravityview, gravity-forms, gravityforms, gravitate |
191 | - if ( ! preg_match( '/(gravityview|gravity-?forms|gravitate)/ism', $active_plugin ) ) { |
|
191 | + if (!preg_match('/(gravityview|gravity-?forms|gravitate)/ism', $active_plugin)) { |
|
192 | 192 | continue; |
193 | 193 | } |
194 | 194 | |
195 | - $plugin_data = get_plugin_data( $active_plugin ); |
|
195 | + $plugin_data = get_plugin_data($active_plugin); |
|
196 | 196 | |
197 | - $extensions[] = sprintf( '%s %s', $plugin_data['Name'], $plugin_data['Version'] ); |
|
197 | + $extensions[] = sprintf('%s %s', $plugin_data['Name'], $plugin_data['Version']); |
|
198 | 198 | } |
199 | 199 | |
200 | - if( $extensions ) { |
|
201 | - set_site_transient( self::related_plugins_key, $extensions, HOUR_IN_SECONDS ); |
|
200 | + if ($extensions) { |
|
201 | + set_site_transient(self::related_plugins_key, $extensions, HOUR_IN_SECONDS); |
|
202 | 202 | } else { |
203 | 203 | return 'There was an error fetching related plugins.'; |
204 | 204 | } |
205 | 205 | } |
206 | 206 | |
207 | - return implode( '<br />', $extensions ); |
|
207 | + return implode('<br />', $extensions); |
|
208 | 208 | } |
209 | 209 | |
210 | 210 | /** |
@@ -214,8 +214,8 @@ discard block |
||
214 | 214 | * @since 1.15 |
215 | 215 | */ |
216 | 216 | public function flush_related_plugins_transient() { |
217 | - if ( function_exists( 'delete_site_transient' ) ) { |
|
218 | - delete_site_transient( self::related_plugins_key ); |
|
217 | + if (function_exists('delete_site_transient')) { |
|
218 | + delete_site_transient(self::related_plugins_key); |
|
219 | 219 | } |
220 | 220 | } |
221 | 221 | |
@@ -231,20 +231,20 @@ discard block |
||
231 | 231 | * |
232 | 232 | * @return bool Whether to show GravityView support |
233 | 233 | */ |
234 | - static public function show_for_user( $user = 0 ) { |
|
234 | + static public function show_for_user($user = 0) { |
|
235 | 235 | |
236 | - if ( ! GVCommon::has_cap( 'gravityview_support_port' ) ) { |
|
236 | + if (!GVCommon::has_cap('gravityview_support_port')) { |
|
237 | 237 | return false; |
238 | 238 | } |
239 | 239 | |
240 | - $pref = get_user_option( self::user_pref_name, $user ); |
|
240 | + $pref = get_user_option(self::user_pref_name, $user); |
|
241 | 241 | |
242 | 242 | // Not set; default to plugin setting |
243 | - if ( false === $pref ) { |
|
244 | - return GravityView_Settings::getSetting( 'support_port' ); |
|
243 | + if (false === $pref) { |
|
244 | + return GravityView_Settings::getSetting('support_port'); |
|
245 | 245 | } |
246 | 246 | |
247 | - return ! empty( $pref ); |
|
247 | + return !empty($pref); |
|
248 | 248 | } |
249 | 249 | |
250 | 250 | |
@@ -257,9 +257,9 @@ discard block |
||
257 | 257 | * |
258 | 258 | * @return void |
259 | 259 | */ |
260 | - public function update_user_meta_value( $user_id ) { |
|
261 | - if ( current_user_can( 'edit_user', $user_id ) && isset( $_POST[ self::user_pref_name ] ) ) { |
|
262 | - update_user_meta( $user_id, self::user_pref_name, intval( $_POST[ self::user_pref_name ] ) ); |
|
260 | + public function update_user_meta_value($user_id) { |
|
261 | + if (current_user_can('edit_user', $user_id) && isset($_POST[self::user_pref_name])) { |
|
262 | + update_user_meta($user_id, self::user_pref_name, intval($_POST[self::user_pref_name])); |
|
263 | 263 | } |
264 | 264 | } |
265 | 265 | |
@@ -274,7 +274,7 @@ discard block |
||
274 | 274 | * |
275 | 275 | * @return void |
276 | 276 | */ |
277 | - function user_field( $user ) { |
|
277 | + function user_field($user) { |
|
278 | 278 | |
279 | 279 | /** |
280 | 280 | * @filter `gravityview/support_port/show_profile_setting` Should the "GravityView Support Port" setting be shown on user profiles? |
@@ -284,21 +284,21 @@ discard block |
||
284 | 284 | * @param boolean $allow_profile_setting Default: `true`, if the user has the `gravityview_support_port` capability, which defaults to true for Contributors and higher |
285 | 285 | * @param WP_User $user Current user object |
286 | 286 | */ |
287 | - $allow_profile_setting = apply_filters( 'gravityview/support_port/show_profile_setting', current_user_can( 'gravityview_support_port' ), $user ); |
|
287 | + $allow_profile_setting = apply_filters('gravityview/support_port/show_profile_setting', current_user_can('gravityview_support_port'), $user); |
|
288 | 288 | |
289 | - if ( $allow_profile_setting && current_user_can( 'edit_user', $user->ID ) ) { |
|
289 | + if ($allow_profile_setting && current_user_can('edit_user', $user->ID)) { |
|
290 | 290 | ?> |
291 | 291 | <table class="form-table"> |
292 | 292 | <tbody> |
293 | 293 | <tr class="user-gravityview-support-button-wrap"> |
294 | - <th scope="row"><?php _e( 'GravityView Support Port', 'gravityview' ); ?></th> |
|
294 | + <th scope="row"><?php _e('GravityView Support Port', 'gravityview'); ?></th> |
|
295 | 295 | <td> |
296 | 296 | <fieldset> |
297 | - <legend class="screen-reader-text"><span><?php _e( 'GravityView Support Port', 'gravityview' ) ?></span></legend> |
|
297 | + <legend class="screen-reader-text"><span><?php _e('GravityView Support Port', 'gravityview') ?></span></legend> |
|
298 | 298 | <label> |
299 | - <input name="<?php echo esc_attr( self::user_pref_name ); ?>" type="hidden" value="0"/> |
|
300 | - <input name="<?php echo esc_attr( self::user_pref_name ); ?>" type="checkbox" value="1" <?php checked( self::show_for_user( $user->ID ) ); ?> /> |
|
301 | - <?php esc_html_e( 'Show GravityView Support Port when on a GravityView-related page', 'gravityview' ); ?> |
|
299 | + <input name="<?php echo esc_attr(self::user_pref_name); ?>" type="hidden" value="0"/> |
|
300 | + <input name="<?php echo esc_attr(self::user_pref_name); ?>" type="checkbox" value="1" <?php checked(self::show_for_user($user->ID)); ?> /> |
|
301 | + <?php esc_html_e('Show GravityView Support Port when on a GravityView-related page', 'gravityview'); ?> |
|
302 | 302 | </label> |
303 | 303 | </fieldset> |
304 | 304 | </td> |
@@ -10,158 +10,158 @@ discard block |
||
10 | 10 | * |
11 | 11 | * @var string |
12 | 12 | */ |
13 | - protected $name; |
|
13 | + protected $name; |
|
14 | 14 | |
15 | 15 | /** |
16 | 16 | * Field settings |
17 | 17 | * |
18 | 18 | * @var array |
19 | 19 | */ |
20 | - protected $field; |
|
20 | + protected $field; |
|
21 | 21 | |
22 | 22 | /** |
23 | 23 | * Field current value |
24 | 24 | * |
25 | 25 | * @var mixed |
26 | 26 | */ |
27 | - protected $value; |
|
28 | - |
|
29 | - function __construct( $name = '', $field = array(), $curr_value = NULL ) { |
|
30 | - |
|
31 | - $this->name = $name; |
|
32 | - |
|
33 | - $defaults = self::get_field_defaults(); |
|
34 | - |
|
35 | - // Backward compatibility |
|
36 | - if( !empty( $field['choices'] ) ) { |
|
37 | - $field['options'] = $field['choices']; |
|
38 | - unset( $field['choices'] ); |
|
39 | - } |
|
40 | - |
|
41 | - $this->field = wp_parse_args( $field, $defaults ); |
|
42 | - |
|
43 | - $this->value = is_null( $curr_value ) ? $this->field['value'] : $curr_value; |
|
44 | - |
|
45 | - } |
|
46 | - |
|
47 | - /** |
|
48 | - * Returns the default details for a field option |
|
49 | - * |
|
50 | - * - default // default option value, in case nothing is defined (@deprecated) |
|
51 | - * - desc // option description |
|
52 | - * - value // the option default value |
|
53 | - * - label // the option label |
|
54 | - * - left_label // In case of checkboxes, left label will appear on the left of the checkbox |
|
55 | - * - id // the field id |
|
56 | - * - type // the option type ( text, checkbox, select, ... ) |
|
57 | - * - options // when type is select, define the select options ('choices' is @deprecated) |
|
58 | - * - merge_tags // if the option supports merge tags feature |
|
59 | - * - class // (new) define extra classes for the field |
|
60 | - * - tooltip // |
|
61 | - * |
|
62 | - * @return array |
|
63 | - */ |
|
64 | - public static function get_field_defaults() { |
|
65 | - return array( |
|
66 | - 'desc' => '', |
|
67 | - 'value' => NULL, |
|
68 | - 'label' => '', |
|
69 | - 'id' => NULL, |
|
70 | - 'type' => 'text', |
|
71 | - 'options' => NULL, |
|
72 | - 'merge_tags' => true, |
|
73 | - 'class' => '', |
|
74 | - 'tooltip' => NULL |
|
75 | - ); |
|
76 | - } |
|
77 | - |
|
78 | - |
|
79 | - function get_tooltip() { |
|
80 | - if( !function_exists('gform_tooltip') ) { |
|
81 | - return NULL; |
|
82 | - } |
|
83 | - |
|
84 | - return !empty( $this->field['tooltip'] ) ? ' '.gform_tooltip( $this->field['tooltip'] , false, true ) : NULL; |
|
85 | - } |
|
86 | - |
|
87 | - /** |
|
88 | - * Build input id based on the name |
|
89 | - * @return string |
|
90 | - */ |
|
91 | - function get_field_id() { |
|
92 | - if( isset( $this->field['id'] ) ) { |
|
93 | - return esc_attr( $this->field['id'] ); |
|
94 | - } |
|
95 | - return esc_attr( sanitize_html_class( $this->name ) ); |
|
96 | - } |
|
97 | - |
|
98 | - /** |
|
99 | - * Retrieve field label |
|
100 | - * @return string |
|
101 | - */ |
|
102 | - function get_field_label() { |
|
103 | - return esc_html( trim( $this->field['label'] ) ); |
|
104 | - } |
|
27 | + protected $value; |
|
28 | + |
|
29 | + function __construct( $name = '', $field = array(), $curr_value = NULL ) { |
|
30 | + |
|
31 | + $this->name = $name; |
|
32 | + |
|
33 | + $defaults = self::get_field_defaults(); |
|
34 | + |
|
35 | + // Backward compatibility |
|
36 | + if( !empty( $field['choices'] ) ) { |
|
37 | + $field['options'] = $field['choices']; |
|
38 | + unset( $field['choices'] ); |
|
39 | + } |
|
40 | + |
|
41 | + $this->field = wp_parse_args( $field, $defaults ); |
|
42 | + |
|
43 | + $this->value = is_null( $curr_value ) ? $this->field['value'] : $curr_value; |
|
44 | + |
|
45 | + } |
|
46 | + |
|
47 | + /** |
|
48 | + * Returns the default details for a field option |
|
49 | + * |
|
50 | + * - default // default option value, in case nothing is defined (@deprecated) |
|
51 | + * - desc // option description |
|
52 | + * - value // the option default value |
|
53 | + * - label // the option label |
|
54 | + * - left_label // In case of checkboxes, left label will appear on the left of the checkbox |
|
55 | + * - id // the field id |
|
56 | + * - type // the option type ( text, checkbox, select, ... ) |
|
57 | + * - options // when type is select, define the select options ('choices' is @deprecated) |
|
58 | + * - merge_tags // if the option supports merge tags feature |
|
59 | + * - class // (new) define extra classes for the field |
|
60 | + * - tooltip // |
|
61 | + * |
|
62 | + * @return array |
|
63 | + */ |
|
64 | + public static function get_field_defaults() { |
|
65 | + return array( |
|
66 | + 'desc' => '', |
|
67 | + 'value' => NULL, |
|
68 | + 'label' => '', |
|
69 | + 'id' => NULL, |
|
70 | + 'type' => 'text', |
|
71 | + 'options' => NULL, |
|
72 | + 'merge_tags' => true, |
|
73 | + 'class' => '', |
|
74 | + 'tooltip' => NULL |
|
75 | + ); |
|
76 | + } |
|
77 | + |
|
78 | + |
|
79 | + function get_tooltip() { |
|
80 | + if( !function_exists('gform_tooltip') ) { |
|
81 | + return NULL; |
|
82 | + } |
|
83 | + |
|
84 | + return !empty( $this->field['tooltip'] ) ? ' '.gform_tooltip( $this->field['tooltip'] , false, true ) : NULL; |
|
85 | + } |
|
86 | + |
|
87 | + /** |
|
88 | + * Build input id based on the name |
|
89 | + * @return string |
|
90 | + */ |
|
91 | + function get_field_id() { |
|
92 | + if( isset( $this->field['id'] ) ) { |
|
93 | + return esc_attr( $this->field['id'] ); |
|
94 | + } |
|
95 | + return esc_attr( sanitize_html_class( $this->name ) ); |
|
96 | + } |
|
97 | + |
|
98 | + /** |
|
99 | + * Retrieve field label |
|
100 | + * @return string |
|
101 | + */ |
|
102 | + function get_field_label() { |
|
103 | + return esc_html( trim( $this->field['label'] ) ); |
|
104 | + } |
|
105 | 105 | |
106 | 106 | /** |
107 | 107 | * Retrieve field left label |
108 | - * |
|
109 | - * @since 1.7 |
|
110 | - * |
|
108 | + * |
|
109 | + * @since 1.7 |
|
110 | + * |
|
111 | 111 | * @return string |
112 | 112 | */ |
113 | 113 | function get_field_left_label() { |
114 | 114 | return isset( $this->field['left_label'] ) ? esc_html( trim( $this->field['left_label'] ) ) : NULL; |
115 | 115 | } |
116 | 116 | |
117 | - /** |
|
118 | - * Retrieve field label class |
|
119 | - * @return string |
|
120 | - */ |
|
121 | - function get_label_class() { |
|
122 | - return 'gv-label-'. sanitize_html_class( $this->field['type'] ); |
|
123 | - } |
|
124 | - |
|
125 | - |
|
126 | - /** |
|
127 | - * Retrieve field description |
|
128 | - * @return string |
|
129 | - */ |
|
130 | - function get_field_desc() { |
|
131 | - return !empty( $this->field['desc'] ) ? '<span class="howto">'. $this->field['desc'] .'</span>' : ''; |
|
132 | - } |
|
133 | - |
|
134 | - |
|
135 | - /** |
|
136 | - * Verify if field should have merge tags |
|
137 | - * @return boolean |
|
138 | - */ |
|
139 | - function show_merge_tags() { |
|
140 | - // Show the merge tags if the field is a list view |
|
141 | - $is_list = preg_match( '/_list-/ism', $this->name ); |
|
142 | - // Or is a single entry view |
|
143 | - $is_single = preg_match( '/single_/ism', $this->name ); |
|
144 | - |
|
145 | - return ( $is_single || $is_list ); |
|
146 | - } |
|
147 | - |
|
148 | - |
|
149 | - |
|
150 | - /** |
|
151 | - * important! Override this class |
|
152 | - * outputs the field option html |
|
153 | - */ |
|
154 | - function render_option() { |
|
155 | - // to replace on each field |
|
156 | - } |
|
157 | - |
|
158 | - /** |
|
159 | - * important! Override this class if needed |
|
160 | - * outputs the field setting html |
|
161 | - */ |
|
162 | - function render_setting( $override_input = NULL ) { |
|
163 | - |
|
164 | - if( !empty( $this->field['full_width'] ) ) { ?> |
|
117 | + /** |
|
118 | + * Retrieve field label class |
|
119 | + * @return string |
|
120 | + */ |
|
121 | + function get_label_class() { |
|
122 | + return 'gv-label-'. sanitize_html_class( $this->field['type'] ); |
|
123 | + } |
|
124 | + |
|
125 | + |
|
126 | + /** |
|
127 | + * Retrieve field description |
|
128 | + * @return string |
|
129 | + */ |
|
130 | + function get_field_desc() { |
|
131 | + return !empty( $this->field['desc'] ) ? '<span class="howto">'. $this->field['desc'] .'</span>' : ''; |
|
132 | + } |
|
133 | + |
|
134 | + |
|
135 | + /** |
|
136 | + * Verify if field should have merge tags |
|
137 | + * @return boolean |
|
138 | + */ |
|
139 | + function show_merge_tags() { |
|
140 | + // Show the merge tags if the field is a list view |
|
141 | + $is_list = preg_match( '/_list-/ism', $this->name ); |
|
142 | + // Or is a single entry view |
|
143 | + $is_single = preg_match( '/single_/ism', $this->name ); |
|
144 | + |
|
145 | + return ( $is_single || $is_list ); |
|
146 | + } |
|
147 | + |
|
148 | + |
|
149 | + |
|
150 | + /** |
|
151 | + * important! Override this class |
|
152 | + * outputs the field option html |
|
153 | + */ |
|
154 | + function render_option() { |
|
155 | + // to replace on each field |
|
156 | + } |
|
157 | + |
|
158 | + /** |
|
159 | + * important! Override this class if needed |
|
160 | + * outputs the field setting html |
|
161 | + */ |
|
162 | + function render_setting( $override_input = NULL ) { |
|
163 | + |
|
164 | + if( !empty( $this->field['full_width'] ) ) { ?> |
|
165 | 165 | <th scope="row" colspan="2"> |
166 | 166 | <div> |
167 | 167 | <label for="<?php echo $this->get_field_id(); ?>"> |
@@ -181,14 +181,14 @@ discard block |
||
181 | 181 | </td> |
182 | 182 | <?php } |
183 | 183 | |
184 | - } |
|
184 | + } |
|
185 | 185 | |
186 | - /** |
|
187 | - * important! Override this class |
|
188 | - * outputs the input html part |
|
189 | - */ |
|
190 | - function render_input( $override_input ) { |
|
191 | - echo ''; |
|
192 | - } |
|
186 | + /** |
|
187 | + * important! Override this class |
|
188 | + * outputs the input html part |
|
189 | + */ |
|
190 | + function render_input( $override_input ) { |
|
191 | + echo ''; |
|
192 | + } |
|
193 | 193 | |
194 | 194 | } |
@@ -26,21 +26,21 @@ discard block |
||
26 | 26 | */ |
27 | 27 | protected $value; |
28 | 28 | |
29 | - function __construct( $name = '', $field = array(), $curr_value = NULL ) { |
|
29 | + function __construct($name = '', $field = array(), $curr_value = NULL) { |
|
30 | 30 | |
31 | 31 | $this->name = $name; |
32 | 32 | |
33 | 33 | $defaults = self::get_field_defaults(); |
34 | 34 | |
35 | 35 | // Backward compatibility |
36 | - if( !empty( $field['choices'] ) ) { |
|
36 | + if (!empty($field['choices'])) { |
|
37 | 37 | $field['options'] = $field['choices']; |
38 | - unset( $field['choices'] ); |
|
38 | + unset($field['choices']); |
|
39 | 39 | } |
40 | 40 | |
41 | - $this->field = wp_parse_args( $field, $defaults ); |
|
41 | + $this->field = wp_parse_args($field, $defaults); |
|
42 | 42 | |
43 | - $this->value = is_null( $curr_value ) ? $this->field['value'] : $curr_value; |
|
43 | + $this->value = is_null($curr_value) ? $this->field['value'] : $curr_value; |
|
44 | 44 | |
45 | 45 | } |
46 | 46 | |
@@ -77,11 +77,11 @@ discard block |
||
77 | 77 | |
78 | 78 | |
79 | 79 | function get_tooltip() { |
80 | - if( !function_exists('gform_tooltip') ) { |
|
80 | + if (!function_exists('gform_tooltip')) { |
|
81 | 81 | return NULL; |
82 | 82 | } |
83 | 83 | |
84 | - return !empty( $this->field['tooltip'] ) ? ' '.gform_tooltip( $this->field['tooltip'] , false, true ) : NULL; |
|
84 | + return !empty($this->field['tooltip']) ? ' '.gform_tooltip($this->field['tooltip'], false, true) : NULL; |
|
85 | 85 | } |
86 | 86 | |
87 | 87 | /** |
@@ -89,10 +89,10 @@ discard block |
||
89 | 89 | * @return string |
90 | 90 | */ |
91 | 91 | function get_field_id() { |
92 | - if( isset( $this->field['id'] ) ) { |
|
93 | - return esc_attr( $this->field['id'] ); |
|
92 | + if (isset($this->field['id'])) { |
|
93 | + return esc_attr($this->field['id']); |
|
94 | 94 | } |
95 | - return esc_attr( sanitize_html_class( $this->name ) ); |
|
95 | + return esc_attr(sanitize_html_class($this->name)); |
|
96 | 96 | } |
97 | 97 | |
98 | 98 | /** |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | * @return string |
101 | 101 | */ |
102 | 102 | function get_field_label() { |
103 | - return esc_html( trim( $this->field['label'] ) ); |
|
103 | + return esc_html(trim($this->field['label'])); |
|
104 | 104 | } |
105 | 105 | |
106 | 106 | /** |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | * @return string |
112 | 112 | */ |
113 | 113 | function get_field_left_label() { |
114 | - return isset( $this->field['left_label'] ) ? esc_html( trim( $this->field['left_label'] ) ) : NULL; |
|
114 | + return isset($this->field['left_label']) ? esc_html(trim($this->field['left_label'])) : NULL; |
|
115 | 115 | } |
116 | 116 | |
117 | 117 | /** |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | * @return string |
120 | 120 | */ |
121 | 121 | function get_label_class() { |
122 | - return 'gv-label-'. sanitize_html_class( $this->field['type'] ); |
|
122 | + return 'gv-label-'.sanitize_html_class($this->field['type']); |
|
123 | 123 | } |
124 | 124 | |
125 | 125 | |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | * @return string |
129 | 129 | */ |
130 | 130 | function get_field_desc() { |
131 | - return !empty( $this->field['desc'] ) ? '<span class="howto">'. $this->field['desc'] .'</span>' : ''; |
|
131 | + return !empty($this->field['desc']) ? '<span class="howto">'.$this->field['desc'].'</span>' : ''; |
|
132 | 132 | } |
133 | 133 | |
134 | 134 | |
@@ -138,11 +138,11 @@ discard block |
||
138 | 138 | */ |
139 | 139 | function show_merge_tags() { |
140 | 140 | // Show the merge tags if the field is a list view |
141 | - $is_list = preg_match( '/_list-/ism', $this->name ); |
|
141 | + $is_list = preg_match('/_list-/ism', $this->name); |
|
142 | 142 | // Or is a single entry view |
143 | - $is_single = preg_match( '/single_/ism', $this->name ); |
|
143 | + $is_single = preg_match('/single_/ism', $this->name); |
|
144 | 144 | |
145 | - return ( $is_single || $is_list ); |
|
145 | + return ($is_single || $is_list); |
|
146 | 146 | } |
147 | 147 | |
148 | 148 | |
@@ -159,25 +159,25 @@ discard block |
||
159 | 159 | * important! Override this class if needed |
160 | 160 | * outputs the field setting html |
161 | 161 | */ |
162 | - function render_setting( $override_input = NULL ) { |
|
162 | + function render_setting($override_input = NULL) { |
|
163 | 163 | |
164 | - if( !empty( $this->field['full_width'] ) ) { ?> |
|
164 | + if (!empty($this->field['full_width'])) { ?> |
|
165 | 165 | <th scope="row" colspan="2"> |
166 | 166 | <div> |
167 | 167 | <label for="<?php echo $this->get_field_id(); ?>"> |
168 | - <?php echo $this->get_field_label() . $this->get_tooltip(); ?> |
|
168 | + <?php echo $this->get_field_label().$this->get_tooltip(); ?> |
|
169 | 169 | </label> |
170 | 170 | </div> |
171 | - <?php $this->render_input( $override_input ); ?> |
|
171 | + <?php $this->render_input($override_input); ?> |
|
172 | 172 | </th> |
173 | 173 | <?php } else { ?> |
174 | 174 | <th scope="row"> |
175 | 175 | <label for="<?php echo $this->get_field_id(); ?>"> |
176 | - <?php echo $this->get_field_label() . $this->get_tooltip(); ?> |
|
176 | + <?php echo $this->get_field_label().$this->get_tooltip(); ?> |
|
177 | 177 | </label> |
178 | 178 | </th> |
179 | 179 | <td> |
180 | - <?php $this->render_input( $override_input ); ?> |
|
180 | + <?php $this->render_input($override_input); ?> |
|
181 | 181 | </td> |
182 | 182 | <?php } |
183 | 183 | |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | * important! Override this class |
188 | 188 | * outputs the input html part |
189 | 189 | */ |
190 | - function render_input( $override_input ) { |
|
190 | + function render_input($override_input) { |
|
191 | 191 | echo ''; |
192 | 192 | } |
193 | 193 |
@@ -8,10 +8,10 @@ discard block |
||
8 | 8 | function __construct() { |
9 | 9 | |
10 | 10 | // Add Edit link to the entry actions |
11 | - add_action( 'gform_entries_first_column_actions', array( $this, 'add_edit_link' ), 10, 5 ); |
|
11 | + add_action('gform_entries_first_column_actions', array($this, 'add_edit_link'), 10, 5); |
|
12 | 12 | |
13 | 13 | // Add script to enable edit link |
14 | - add_action( 'admin_head-forms_page_gf_entries', array( $this, 'add_edit_script') ); |
|
14 | + add_action('admin_head-forms_page_gf_entries', array($this, 'add_edit_script')); |
|
15 | 15 | |
16 | 16 | } |
17 | 17 | |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | public function add_edit_script() { |
27 | 27 | |
28 | 28 | // We're on a single entry page, or at least not the Entries page. |
29 | - if( !empty( $_GET['view'] ) && $_GET['view'] !== 'entries' ) { return; } |
|
29 | + if (!empty($_GET['view']) && $_GET['view'] !== 'entries') { return; } |
|
30 | 30 | ?> |
31 | 31 | <script> |
32 | 32 | jQuery( document ).ready( function( $ ) { |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | * @param array $lead The current entry data |
51 | 51 | * @param string $query_string URL query string for a link to the current entry. Missing the `?page=` part, which is strange. Example: `gf_entries&view=entry&id=35&lid=5212&filter=&paged=1` |
52 | 52 | */ |
53 | - function add_edit_link( $form_id = NULL, $field_id = NULL, $value = NULL, $lead = array(), $query_string = NULL ) { |
|
53 | + function add_edit_link($form_id = NULL, $field_id = NULL, $value = NULL, $lead = array(), $query_string = NULL) { |
|
54 | 54 | |
55 | 55 | $params = array( |
56 | 56 | 'page' => 'gf_entries', |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | |
64 | 64 | <span class="edit edit_entry"> |
65 | 65 | | |
66 | - <a title="<?php esc_attr_e( 'Edit this entry', 'gravityview'); ?>" href="<?php echo esc_url( add_query_arg( $params, admin_url( 'admin.php?page='.$query_string ) ) ); ?>"><?php esc_html_e( 'Edit', 'gravityview' ); ?></a> |
|
66 | + <a title="<?php esc_attr_e('Edit this entry', 'gravityview'); ?>" href="<?php echo esc_url(add_query_arg($params, admin_url('admin.php?page='.$query_string))); ?>"><?php esc_html_e('Edit', 'gravityview'); ?></a> |
|
67 | 67 | </span> |
68 | 68 | <?php |
69 | 69 | } |
@@ -8,24 +8,24 @@ discard block |
||
8 | 8 | ?> |
9 | 9 | <label for="<?php echo $this->get_field_id(); ?>" class="<?php echo $this->get_label_class(); ?>"> |
10 | 10 | <?php $this->render_input(); ?> |
11 | - <?php echo $this->get_field_label() . $this->get_tooltip() . $this->get_field_desc(); ?> |
|
11 | + <?php echo $this->get_field_label().$this->get_tooltip().$this->get_field_desc(); ?> |
|
12 | 12 | </label> |
13 | 13 | <?php |
14 | 14 | } |
15 | 15 | |
16 | - function render_setting( $override_input = NULL ) { |
|
16 | + function render_setting($override_input = NULL) { |
|
17 | 17 | |
18 | - if( $this->get_field_left_label() ) { ?> |
|
18 | + if ($this->get_field_left_label()) { ?> |
|
19 | 19 | |
20 | 20 | <td scope="row"> |
21 | 21 | <label for="<?php echo $this->get_field_id(); ?>"> |
22 | - <?php echo $this->get_field_left_label() . $this->get_tooltip(); ?> |
|
22 | + <?php echo $this->get_field_left_label().$this->get_tooltip(); ?> |
|
23 | 23 | </label> |
24 | 24 | </td> |
25 | 25 | <td> |
26 | 26 | <label> |
27 | - <?php $this->render_input( $override_input ); ?> |
|
28 | - <?php echo $this->get_field_label() . $this->get_tooltip() . $this->get_field_desc(); ?> |
|
27 | + <?php $this->render_input($override_input); ?> |
|
28 | + <?php echo $this->get_field_label().$this->get_tooltip().$this->get_field_desc(); ?> |
|
29 | 29 | </label> |
30 | 30 | </td> |
31 | 31 | |
@@ -33,23 +33,23 @@ discard block |
||
33 | 33 | |
34 | 34 | <td scope="row" colspan="2"> |
35 | 35 | <label for="<?php echo $this->get_field_id(); ?>"> |
36 | - <?php $this->render_input( $override_input ); ?> |
|
37 | - <?php echo $this->get_field_label() . $this->get_tooltip() . $this->get_field_desc(); ?> |
|
36 | + <?php $this->render_input($override_input); ?> |
|
37 | + <?php echo $this->get_field_label().$this->get_tooltip().$this->get_field_desc(); ?> |
|
38 | 38 | </label> |
39 | 39 | </td> |
40 | 40 | |
41 | 41 | <?php } |
42 | 42 | } |
43 | 43 | |
44 | - function render_input( $override_input = NULL ) { |
|
45 | - if( isset( $override_input ) ) { |
|
44 | + function render_input($override_input = NULL) { |
|
45 | + if (isset($override_input)) { |
|
46 | 46 | echo $override_input; |
47 | 47 | return; |
48 | 48 | } |
49 | 49 | |
50 | 50 | ?> |
51 | - <input name="<?php echo esc_attr( $this->name ); ?>" type="hidden" value="0" /> |
|
52 | - <input name="<?php echo esc_attr( $this->name ); ?>" id="<?php echo $this->get_field_id(); ?>" type="checkbox" value="1" <?php checked( $this->value, '1', true ); ?> /> |
|
51 | + <input name="<?php echo esc_attr($this->name); ?>" type="hidden" value="0" /> |
|
52 | + <input name="<?php echo esc_attr($this->name); ?>" id="<?php echo $this->get_field_id(); ?>" type="checkbox" value="1" <?php checked($this->value, '1', true); ?> /> |
|
53 | 53 | <?php |
54 | 54 | } |
55 | 55 |
@@ -15,7 +15,7 @@ |
||
15 | 15 | return; |
16 | 16 | } |
17 | 17 | |
18 | - $class = !empty( $this->field['class'] ) ? $this->field['class'] : 'widefat'; |
|
18 | + $class = !empty( $this->field['class'] ) ? $this->field['class'] : 'widefat'; |
|
19 | 19 | |
20 | 20 | ?> |
21 | 21 | <input name="<?php echo esc_attr( $this->name ); ?>" id="<?php echo $this->get_field_id(); ?>" type="hidden" value="<?php echo esc_attr( $this->value ); ?>" class="<?php echo esc_attr( $class ); ?>" /> |
@@ -8,17 +8,17 @@ |
||
8 | 8 | $this->render_input(); |
9 | 9 | } |
10 | 10 | |
11 | - function render_input( $override_input = null ) { |
|
11 | + function render_input($override_input = null) { |
|
12 | 12 | |
13 | - if( isset( $override_input ) ) { |
|
13 | + if (isset($override_input)) { |
|
14 | 14 | echo $override_input; |
15 | 15 | return; |
16 | 16 | } |
17 | 17 | |
18 | - $class = !empty( $this->field['class'] ) ? $this->field['class'] : 'widefat'; |
|
18 | + $class = !empty($this->field['class']) ? $this->field['class'] : 'widefat'; |
|
19 | 19 | |
20 | 20 | ?> |
21 | - <input name="<?php echo esc_attr( $this->name ); ?>" id="<?php echo $this->get_field_id(); ?>" type="hidden" value="<?php echo esc_attr( $this->value ); ?>" class="<?php echo esc_attr( $class ); ?>" /> |
|
21 | + <input name="<?php echo esc_attr($this->name); ?>" id="<?php echo $this->get_field_id(); ?>" type="hidden" value="<?php echo esc_attr($this->value); ?>" class="<?php echo esc_attr($class); ?>" /> |
|
22 | 22 | <?php |
23 | 23 | } |
24 | 24 |
@@ -18,10 +18,10 @@ |
||
18 | 18 | |
19 | 19 | $show_mt = $this->show_merge_tags(); |
20 | 20 | |
21 | - if( $show_mt && $this->field['merge_tags'] !== false || $this->field['merge_tags'] === 'force' ) { |
|
22 | - $class = 'merge-tag-support mt-position-right mt-hide_all_fields '; |
|
23 | - } |
|
24 | - $class .= !empty( $this->field['class'] ) ? $this->field['class'] : 'widefat'; |
|
21 | + if( $show_mt && $this->field['merge_tags'] !== false || $this->field['merge_tags'] === 'force' ) { |
|
22 | + $class = 'merge-tag-support mt-position-right mt-hide_all_fields '; |
|
23 | + } |
|
24 | + $class .= !empty( $this->field['class'] ) ? $this->field['class'] : 'widefat'; |
|
25 | 25 | |
26 | 26 | ?> |
27 | 27 | <input name="<?php echo esc_attr( $this->name ); ?>" id="<?php echo $this->get_field_id(); ?>" type="number" value="<?php echo esc_attr( $this->value ); ?>" class="<?php echo esc_attr( $class ); ?>"> |
@@ -3,13 +3,13 @@ discard block |
||
3 | 3 | * number input type |
4 | 4 | */ |
5 | 5 | |
6 | -if( !class_exists('GravityView_FieldType_text') ) { |
|
7 | - include_once( GRAVITYVIEW_DIR . 'includes/admin/field-types/type_text.php' ); |
|
6 | +if (!class_exists('GravityView_FieldType_text')) { |
|
7 | + include_once(GRAVITYVIEW_DIR.'includes/admin/field-types/type_text.php'); |
|
8 | 8 | } |
9 | 9 | class GravityView_FieldType_number extends GravityView_FieldType_text { |
10 | 10 | |
11 | - function render_input( $override_input = null ) { |
|
12 | - if( isset( $override_input ) ) { |
|
11 | + function render_input($override_input = null) { |
|
12 | + if (isset($override_input)) { |
|
13 | 13 | echo $override_input; |
14 | 14 | return; |
15 | 15 | } |
@@ -18,13 +18,13 @@ discard block |
||
18 | 18 | |
19 | 19 | $show_mt = $this->show_merge_tags(); |
20 | 20 | |
21 | - if( $show_mt && $this->field['merge_tags'] !== false || $this->field['merge_tags'] === 'force' ) { |
|
21 | + if ($show_mt && $this->field['merge_tags'] !== false || $this->field['merge_tags'] === 'force') { |
|
22 | 22 | $class = 'merge-tag-support mt-position-right mt-hide_all_fields '; |
23 | 23 | } |
24 | - $class .= !empty( $this->field['class'] ) ? $this->field['class'] : 'widefat'; |
|
24 | + $class .= !empty($this->field['class']) ? $this->field['class'] : 'widefat'; |
|
25 | 25 | |
26 | 26 | ?> |
27 | - <input name="<?php echo esc_attr( $this->name ); ?>" id="<?php echo $this->get_field_id(); ?>" type="number" value="<?php echo esc_attr( $this->value ); ?>" class="<?php echo esc_attr( $class ); ?>"> |
|
27 | + <input name="<?php echo esc_attr($this->name); ?>" id="<?php echo $this->get_field_id(); ?>" type="number" value="<?php echo esc_attr($this->value); ?>" class="<?php echo esc_attr($class); ?>"> |
|
28 | 28 | <?php |
29 | 29 | } |
30 | 30 |
@@ -18,15 +18,15 @@ |
||
18 | 18 | |
19 | 19 | } |
20 | 20 | |
21 | - function render_input( $override_input = null ) { |
|
22 | - if( isset( $override_input ) ) { |
|
21 | + function render_input($override_input = null) { |
|
22 | + if (isset($override_input)) { |
|
23 | 23 | echo $override_input; |
24 | 24 | return; |
25 | 25 | } |
26 | 26 | |
27 | - foreach( $this->field['options'] as $value => $label ) : ?> |
|
27 | + foreach ($this->field['options'] as $value => $label) : ?> |
|
28 | 28 | <label class="<?php echo $this->get_label_class(); ?>"> |
29 | - <input name="<?php echo esc_attr( $this->name ); ?>" id="<?php echo $this->get_field_id(); ?>-<?php echo esc_attr( $value ); ?>" type="radio" value="<?php echo esc_attr( $value ); ?>" <?php checked( $value, $this->value, true ); ?> /> <?php echo esc_html( $label ); ?> |
|
29 | + <input name="<?php echo esc_attr($this->name); ?>" id="<?php echo $this->get_field_id(); ?>-<?php echo esc_attr($value); ?>" type="radio" value="<?php echo esc_attr($value); ?>" <?php checked($value, $this->value, true); ?> /> <?php echo esc_html($label); ?> |
|
30 | 30 | </label> |
31 | 31 | <?php |
32 | 32 | endforeach; |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | |
11 | 11 | echo '<span class="gv-label">'.$this->get_field_label().'</span>'; |
12 | 12 | |
13 | - echo $this->get_tooltip() . $this->get_field_desc(); |
|
13 | + echo $this->get_tooltip().$this->get_field_desc(); |
|
14 | 14 | |
15 | 15 | $this->render_input(); |
16 | 16 | |
@@ -19,15 +19,15 @@ discard block |
||
19 | 19 | <?php |
20 | 20 | } |
21 | 21 | |
22 | - function render_input( $override_input = null ) { |
|
23 | - if( isset( $override_input ) ) { |
|
22 | + function render_input($override_input = null) { |
|
23 | + if (isset($override_input)) { |
|
24 | 24 | echo $override_input; |
25 | 25 | return; |
26 | 26 | } |
27 | 27 | ?> |
28 | - <select name="<?php echo esc_attr( $this->name ); ?>" id="<?php echo $this->get_field_id(); ?>"> |
|
29 | - <?php foreach( $this->field['options'] as $value => $label ) : ?> |
|
30 | - <option value="<?php echo esc_attr( $value ); ?>" <?php selected( $value, $this->value, true ); ?>><?php echo esc_html( $label ); ?></option> |
|
28 | + <select name="<?php echo esc_attr($this->name); ?>" id="<?php echo $this->get_field_id(); ?>"> |
|
29 | + <?php foreach ($this->field['options'] as $value => $label) : ?> |
|
30 | + <option value="<?php echo esc_attr($value); ?>" <?php selected($value, $this->value, true); ?>><?php echo esc_html($label); ?></option> |
|
31 | 31 | <?php endforeach; ?> |
32 | 32 | </select> |
33 | 33 | <?php |
@@ -28,10 +28,10 @@ |
||
28 | 28 | |
29 | 29 | $show_mt = $this->show_merge_tags(); |
30 | 30 | |
31 | - if( $show_mt && $this->field['merge_tags'] !== false || $this->field['merge_tags'] === 'force' ) { |
|
32 | - $class = 'merge-tag-support mt-position-right mt-hide_all_fields '; |
|
33 | - } |
|
34 | - $class .= !empty( $this->field['class'] ) ? $this->field['class'] : 'widefat'; |
|
31 | + if( $show_mt && $this->field['merge_tags'] !== false || $this->field['merge_tags'] === 'force' ) { |
|
32 | + $class = 'merge-tag-support mt-position-right mt-hide_all_fields '; |
|
33 | + } |
|
34 | + $class .= !empty( $this->field['class'] ) ? $this->field['class'] : 'widefat'; |
|
35 | 35 | |
36 | 36 | ?> |
37 | 37 | <input name="<?php echo esc_attr( $this->name ); ?>" id="<?php echo $this->get_field_id(); ?>" type="text" value="<?php echo esc_attr( $this->value ); ?>" class="<?php echo esc_attr( $class ); ?>"> |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | <label for="<?php echo $this->get_field_id(); ?>" class="<?php echo $this->get_label_class(); ?>"><?php |
10 | 10 | |
11 | 11 | echo '<span class="gv-label">'.$this->get_field_label().'</span>'; |
12 | - echo $this->get_tooltip() . $this->get_field_desc(); |
|
12 | + echo $this->get_tooltip().$this->get_field_desc(); |
|
13 | 13 | ?><div> |
14 | 14 | <?php $this->render_input(); ?> |
15 | 15 | </div> |
@@ -17,9 +17,9 @@ discard block |
||
17 | 17 | <?php |
18 | 18 | } |
19 | 19 | |
20 | - function render_input( $override_input = null ) { |
|
20 | + function render_input($override_input = null) { |
|
21 | 21 | |
22 | - if( isset( $override_input ) ) { |
|
22 | + if (isset($override_input)) { |
|
23 | 23 | echo $override_input; |
24 | 24 | return; |
25 | 25 | } |
@@ -28,13 +28,13 @@ discard block |
||
28 | 28 | |
29 | 29 | $show_mt = $this->show_merge_tags(); |
30 | 30 | |
31 | - if( $show_mt && $this->field['merge_tags'] !== false || $this->field['merge_tags'] === 'force' ) { |
|
31 | + if ($show_mt && $this->field['merge_tags'] !== false || $this->field['merge_tags'] === 'force') { |
|
32 | 32 | $class = 'merge-tag-support mt-position-right mt-hide_all_fields '; |
33 | 33 | } |
34 | - $class .= !empty( $this->field['class'] ) ? $this->field['class'] : 'widefat'; |
|
34 | + $class .= !empty($this->field['class']) ? $this->field['class'] : 'widefat'; |
|
35 | 35 | |
36 | 36 | ?> |
37 | - <input name="<?php echo esc_attr( $this->name ); ?>" id="<?php echo $this->get_field_id(); ?>" type="text" value="<?php echo esc_attr( $this->value ); ?>" class="<?php echo esc_attr( $class ); ?>"> |
|
37 | + <input name="<?php echo esc_attr($this->name); ?>" id="<?php echo $this->get_field_id(); ?>" type="text" value="<?php echo esc_attr($this->value); ?>" class="<?php echo esc_attr($class); ?>"> |
|
38 | 38 | <?php |
39 | 39 | } |
40 | 40 |