@@ -10,22 +10,22 @@ |
||
10 | 10 | $search_field = $gravityview_view->search_field; |
11 | 11 | |
12 | 12 | // Make sure that there are choices to display |
13 | -if( empty( $search_field['choices'] ) ) { |
|
13 | +if ( empty( $search_field[ 'choices' ] ) ) { |
|
14 | 14 | gravityview()->log->debug( 'search-field-radio.php - No choices for field' ); |
15 | 15 | return; |
16 | 16 | } |
17 | 17 | |
18 | 18 | ?> |
19 | 19 | <div class="gv-search-box gv-search-field-radio"> |
20 | - <?php if( ! gv_empty( $search_field['label'], false, false ) ) { ?> |
|
21 | - <label for=search-box-<?php echo esc_attr( $search_field['name'] ); ?>><?php echo esc_html( $search_field['label'] ); ?></label> |
|
20 | + <?php if ( ! gv_empty( $search_field[ 'label' ], false, false ) ) { ?> |
|
21 | + <label for=search-box-<?php echo esc_attr( $search_field[ 'name' ] ); ?>><?php echo esc_html( $search_field[ 'label' ] ); ?></label> |
|
22 | 22 | <?php } ?> |
23 | 23 | <p> |
24 | - <?php foreach( $search_field['choices'] as $choice ) { ?> |
|
24 | + <?php foreach ( $search_field[ 'choices' ] as $choice ) { ?> |
|
25 | 25 | |
26 | - <label for="search-box-<?php echo sanitize_html_class( $search_field['name'].$choice['value'].$choice['text'] ); ?>" class="gv-check-radio"> |
|
27 | - <input type="radio" name="<?php echo esc_attr( $search_field['name'] ); ?>" value="<?php echo esc_attr( $choice['value'] ); ?>" id="search-box-<?php echo sanitize_html_class( $search_field['name'].$choice['value'].$choice['text'] ); ?>" <?php checked( $choice['value'], $search_field['value'], true ); ?>> |
|
28 | - <?php echo esc_html( $choice['text'] ); ?> |
|
26 | + <label for="search-box-<?php echo sanitize_html_class( $search_field[ 'name' ] . $choice[ 'value' ] . $choice[ 'text' ] ); ?>" class="gv-check-radio"> |
|
27 | + <input type="radio" name="<?php echo esc_attr( $search_field[ 'name' ] ); ?>" value="<?php echo esc_attr( $choice[ 'value' ] ); ?>" id="search-box-<?php echo sanitize_html_class( $search_field[ 'name' ] . $choice[ 'value' ] . $choice[ 'text' ] ); ?>" <?php checked( $choice[ 'value' ], $search_field[ 'value' ], true ); ?>> |
|
28 | + <?php echo esc_html( $choice[ 'text' ] ); ?> |
|
29 | 29 | </label> |
30 | 30 | |
31 | 31 | <?php } ?> |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | ?> |
9 | 9 | <label for="<?php echo $this->get_field_id(); ?>" class="<?php echo $this->get_label_class(); ?>"><?php |
10 | 10 | |
11 | - echo '<span class="gv-label">'.$this->get_field_label().'</span>'; |
|
11 | + echo '<span class="gv-label">' . $this->get_field_label() . '</span>'; |
|
12 | 12 | echo $this->get_tooltip() . $this->get_field_desc(); |
13 | 13 | ?><div> |
14 | 14 | <?php $this->render_input(); ?> |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | |
20 | 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,7 +28,7 @@ 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 | 34 | $class .= \GV\Utils::get( $this->field, 'class', 'widefat' ); |
@@ -97,9 +97,9 @@ discard block |
||
97 | 97 | * @param array $callback_args Arguments passed to the callback |
98 | 98 | * @return void |
99 | 99 | */ |
100 | - function __construct( $id, $title = '', $file = '', $icon_class_name = '', $callback = '', $callback_args = array() ) { |
|
100 | + function __construct( $id, $title = '', $file = '', $icon_class_name = '', $callback = '', $callback_args = array() ) { |
|
101 | 101 | |
102 | - $this->id = $this->prefix.$id; |
|
102 | + $this->id = $this->prefix . $id; |
|
103 | 103 | $this->title = $title; |
104 | 104 | $this->render_template_file = $file; |
105 | 105 | $this->callback = $callback; |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | */ |
119 | 119 | function parse_icon_class_name( $icon_class_name = '' ) { |
120 | 120 | |
121 | - if( preg_match( '/dashicon/i', $icon_class_name ) ) { |
|
121 | + if ( preg_match( '/dashicon/i', $icon_class_name ) ) { |
|
122 | 122 | $icon_class_name = 'dashicons ' . $icon_class_name; |
123 | 123 | } |
124 | 124 | |
@@ -142,29 +142,29 @@ discard block |
||
142 | 142 | */ |
143 | 143 | function render( $post ) { |
144 | 144 | |
145 | - if( !empty( $this->render_template_file ) ) { |
|
145 | + if ( ! empty( $this->render_template_file ) ) { |
|
146 | 146 | |
147 | 147 | $file = $this->render_template_file; |
148 | 148 | |
149 | 149 | // If the full path exists, use it |
150 | - if( file_exists( $file ) ) { |
|
150 | + if ( file_exists( $file ) ) { |
|
151 | 151 | $path = $file; |
152 | 152 | } else { |
153 | - $path = GRAVITYVIEW_DIR .'includes/admin/metaboxes/views/'.$file; |
|
153 | + $path = GRAVITYVIEW_DIR . 'includes/admin/metaboxes/views/' . $file; |
|
154 | 154 | } |
155 | 155 | |
156 | - if( file_exists( $path ) ) { |
|
156 | + if ( file_exists( $path ) ) { |
|
157 | 157 | include $path; |
158 | 158 | } else { |
159 | 159 | gravityview()->log->error( 'Metabox template file not found', array( 'data' => $this ) ); |
160 | 160 | } |
161 | 161 | |
162 | - } else if( !empty( $this->callback ) ) { |
|
162 | + } else if ( ! empty( $this->callback ) ) { |
|
163 | 163 | |
164 | - if( is_callable( $this->callback ) ) { |
|
164 | + if ( is_callable( $this->callback ) ) { |
|
165 | 165 | |
166 | 166 | /** @see do_accordion_sections() */ |
167 | - call_user_func( $this->callback, $post, (array) $this ); |
|
167 | + call_user_func( $this->callback, $post, (array)$this ); |
|
168 | 168 | |
169 | 169 | } else { |
170 | 170 | gravityview()->log->error( 'Metabox callback was not callable', array( 'data' => $this ) ); |
@@ -52,9 +52,9 @@ discard block |
||
52 | 52 | * @since 1.11 |
53 | 53 | * @param boolean $boolean Whether to trigger update on user registration (default: true) |
54 | 54 | */ |
55 | - if( apply_filters( 'gravityview/edit_entry/user_registration/trigger_update', true ) ) { |
|
55 | + if ( apply_filters( 'gravityview/edit_entry/user_registration/trigger_update', true ) ) { |
|
56 | 56 | |
57 | - add_action( 'gravityview/edit_entry/after_update' , array( $this, 'update_user' ), 10, 2 ); |
|
57 | + add_action( 'gravityview/edit_entry/after_update', array( $this, 'update_user' ), 10, 2 ); |
|
58 | 58 | |
59 | 59 | // last resort in case the current user display name don't match any of the defaults |
60 | 60 | add_action( 'gform_user_updated', array( $this, 'restore_display_name' ), 10, 4 ); |
@@ -72,10 +72,10 @@ discard block |
||
72 | 72 | */ |
73 | 73 | public function update_user( $form = array(), $entry_id = 0 ) { |
74 | 74 | |
75 | - if( ! class_exists( 'GFAPI' ) || ! class_exists( 'GF_User_Registration' ) ) { |
|
75 | + if ( ! class_exists( 'GFAPI' ) || ! class_exists( 'GF_User_Registration' ) ) { |
|
76 | 76 | gravityview()->log->error( 'GFAPI or User Registration class not found; not updating the user' ); |
77 | 77 | return; |
78 | - } elseif( empty( $entry_id ) ) { |
|
78 | + } elseif ( empty( $entry_id ) ) { |
|
79 | 79 | gravityview()->log->error( 'Entry ID is empty [{entry_id}]; not updating the user', array( 'entry_id' => $entry_id ) ); |
80 | 80 | return; |
81 | 81 | } |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | |
103 | 103 | // If an Update feed, make sure the conditions are met. |
104 | 104 | if ( \GV\Utils::get( $config, 'meta/feedType' ) === 'update' ) { |
105 | - if( ! $gf_user_registration->is_feed_condition_met( $config, $form, $entry ) ) { |
|
105 | + if ( ! $gf_user_registration->is_feed_condition_met( $config, $form, $entry ) ) { |
|
106 | 106 | return; |
107 | 107 | } |
108 | 108 | } |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | remove_filter( 'send_email_change_email', '__return_false', 3 ); |
119 | 119 | |
120 | 120 | // Prevent double-triggering by removing the hook |
121 | - remove_action( 'gravityview/edit_entry/after_update' , array( $this, 'update_user' ), 10 ); |
|
121 | + remove_action( 'gravityview/edit_entry/after_update', array( $this, 'update_user' ), 10 ); |
|
122 | 122 | } |
123 | 123 | |
124 | 124 | /** |
@@ -151,17 +151,17 @@ discard block |
||
151 | 151 | */ |
152 | 152 | $preserve_role = apply_filters( 'gravityview/edit_entry/user_registration/preserve_role', true, $config, $form, $entry ); |
153 | 153 | |
154 | - if( $preserve_role ) { |
|
155 | - $config['meta']['role'] = 'gfur_preserve_role'; |
|
154 | + if ( $preserve_role ) { |
|
155 | + $config[ 'meta' ][ 'role' ] = 'gfur_preserve_role'; |
|
156 | 156 | } |
157 | 157 | |
158 | - $displayname = $this->match_current_display_name( $entry['created_by'] ); |
|
158 | + $displayname = $this->match_current_display_name( $entry[ 'created_by' ] ); |
|
159 | 159 | |
160 | 160 | /** |
161 | 161 | * Make sure the current display name is not changed with the update user method. |
162 | 162 | * @since 1.15 |
163 | 163 | */ |
164 | - $config['meta']['displayname'] = $displayname ? $displayname : $config['meta']['displayname']; |
|
164 | + $config[ 'meta' ][ 'displayname' ] = $displayname ? $displayname : $config[ 'meta' ][ 'displayname' ]; |
|
165 | 165 | |
166 | 166 | /** |
167 | 167 | * @filter `gravityview/edit_entry/user_registration/config` Modify the User Registration Addon feed configuration |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | |
189 | 189 | $user = get_userdata( $user_id ); |
190 | 190 | |
191 | - if( ! $user ) { |
|
191 | + if ( ! $user ) { |
|
192 | 192 | return false; |
193 | 193 | } |
194 | 194 | |
@@ -200,7 +200,7 @@ discard block |
||
200 | 200 | * In case we can't find the current display name format, trigger last resort method at the 'gform_user_updated' hook |
201 | 201 | * @see restore_display_name |
202 | 202 | */ |
203 | - if( false === $format ) { |
|
203 | + if ( false === $format ) { |
|
204 | 204 | $this->_user_before_update = $user; |
205 | 205 | } |
206 | 206 | |
@@ -218,20 +218,20 @@ discard block |
||
218 | 218 | public function generate_display_names( $profileuser ) { |
219 | 219 | |
220 | 220 | $public_display = array(); |
221 | - $public_display['nickname'] = $profileuser->nickname; |
|
222 | - $public_display['username'] = $profileuser->user_login; |
|
221 | + $public_display[ 'nickname' ] = $profileuser->nickname; |
|
222 | + $public_display[ 'username' ] = $profileuser->user_login; |
|
223 | 223 | |
224 | - if ( !empty($profileuser->first_name) ) { |
|
225 | - $public_display['firstname'] = $profileuser->first_name; |
|
224 | + if ( ! empty( $profileuser->first_name ) ) { |
|
225 | + $public_display[ 'firstname' ] = $profileuser->first_name; |
|
226 | 226 | } |
227 | 227 | |
228 | - if ( !empty($profileuser->last_name) ) { |
|
229 | - $public_display['lastname'] = $profileuser->last_name; |
|
228 | + if ( ! empty( $profileuser->last_name ) ) { |
|
229 | + $public_display[ 'lastname' ] = $profileuser->last_name; |
|
230 | 230 | } |
231 | 231 | |
232 | - if ( !empty($profileuser->first_name) && !empty($profileuser->last_name) ) { |
|
233 | - $public_display['firstlast'] = $profileuser->first_name . ' ' . $profileuser->last_name; |
|
234 | - $public_display['lastfirst'] = $profileuser->last_name . ' ' . $profileuser->first_name; |
|
232 | + if ( ! empty( $profileuser->first_name ) && ! empty( $profileuser->last_name ) ) { |
|
233 | + $public_display[ 'firstlast' ] = $profileuser->first_name . ' ' . $profileuser->last_name; |
|
234 | + $public_display[ 'lastfirst' ] = $profileuser->last_name . ' ' . $profileuser->first_name; |
|
235 | 235 | } |
236 | 236 | |
237 | 237 | $public_display = array_map( 'trim', $public_display ); |
@@ -270,7 +270,7 @@ discard block |
||
270 | 270 | * - or we don't need as we found the correct format before updating user. |
271 | 271 | * @since 1.14.4 |
272 | 272 | */ |
273 | - if( ! $restore_display_name || $is_update_feed || is_null( $this->_user_before_update ) ) { |
|
273 | + if ( ! $restore_display_name || $is_update_feed || is_null( $this->_user_before_update ) ) { |
|
274 | 274 | return null; |
275 | 275 | } |
276 | 276 | |
@@ -302,7 +302,7 @@ discard block |
||
302 | 302 | |
303 | 303 | $updated = wp_update_user( $restored_user ); |
304 | 304 | |
305 | - if( is_wp_error( $updated ) ) { |
|
305 | + if ( is_wp_error( $updated ) ) { |
|
306 | 306 | gravityview()->log->error( 'There was an error updating user #{user_id} details', array( 'user_id' => $user_id, 'data' => $updated ) ); |
307 | 307 | } else { |
308 | 308 | gravityview()->log->debug( 'User #{user_id} details restored', array( 'user_id' => $user_id ) ); |
@@ -42,7 +42,7 @@ |
||
42 | 42 | static function getInstance() { |
43 | 43 | gravityview()->log->notice( '\GravityView_oEmbed is deprecated. Use \GV\oEmbed instead.' ); |
44 | 44 | |
45 | - if( empty( self::$instance ) ) { |
|
45 | + if ( empty( self::$instance ) ) { |
|
46 | 46 | self::$instance = new self; |
47 | 47 | self::$instance->initialize(); |
48 | 48 | } |
@@ -333,8 +333,8 @@ discard block |
||
333 | 333 | * @param mixed $field_id Field ID or Field array |
334 | 334 | * @return string field type |
335 | 335 | */ |
336 | -function gravityview_get_field_type( $form = null , $field_id = '' ) { |
|
337 | - return GVCommon::get_field_type( $form, $field_id ); |
|
336 | +function gravityview_get_field_type( $form = null, $field_id = '' ) { |
|
337 | + return GVCommon::get_field_type( $form, $field_id ); |
|
338 | 338 | } |
339 | 339 | |
340 | 340 | |
@@ -347,8 +347,8 @@ discard block |
||
347 | 347 | * @return string HTML of the output. Empty string if $view_id is empty. |
348 | 348 | */ |
349 | 349 | function get_gravityview( $view_id = '', $atts = array() ) { |
350 | - if( !empty( $view_id ) ) { |
|
351 | - $atts['id'] = $view_id; |
|
350 | + if ( ! empty( $view_id ) ) { |
|
351 | + $atts[ 'id' ] = $view_id; |
|
352 | 352 | $args = wp_parse_args( $atts, \GV\View_Settings::defaults() ); |
353 | 353 | $GravityView_frontend = GravityView_frontend::getInstance(); |
354 | 354 | $GravityView_frontend->setGvOutputData( GravityView_View_Data::getInstance( $view_id ) ); |
@@ -391,19 +391,19 @@ discard block |
||
391 | 391 | */ |
392 | 392 | function gravityview_view_has_single_checkbox_or_radio( $form, $view_fields ) { |
393 | 393 | |
394 | - if( class_exists('GFFormsModel') && $form_fields = GFFormsModel::get_fields_by_type( $form, array( 'checkbox', 'radio' ) ) ) { |
|
394 | + if ( class_exists( 'GFFormsModel' ) && $form_fields = GFFormsModel::get_fields_by_type( $form, array( 'checkbox', 'radio' ) ) ) { |
|
395 | 395 | |
396 | 396 | /** @var GF_Field_Radio|GF_Field_Checkbox $form_field */ |
397 | - foreach( $form_fields as $form_field ) { |
|
397 | + foreach ( $form_fields as $form_field ) { |
|
398 | 398 | $field_id = $form_field->id; |
399 | - foreach( $view_fields as $zone ) { |
|
399 | + foreach ( $view_fields as $zone ) { |
|
400 | 400 | |
401 | 401 | // ACF compatibility; ACF-added fields aren't arrays |
402 | 402 | if ( ! is_array( $zone ) ) { continue; } |
403 | 403 | |
404 | - foreach( $zone as $field ) { |
|
404 | + foreach ( $zone as $field ) { |
|
405 | 405 | // If it's an input, not the parent and the parent ID matches a checkbox or radio |
406 | - if( ( strpos( $field['id'], '.' ) > 0 ) && floor( $field['id'] ) === floor( $field_id ) ) { |
|
406 | + if ( ( strpos( $field[ 'id' ], '.' ) > 0 ) && floor( $field[ 'id' ] ) === floor( $field_id ) ) { |
|
407 | 407 | return true; |
408 | 408 | } |
409 | 409 | } |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | private function add_hooks() { |
38 | 38 | /** @see \GV\Field::get_value_filters */ |
39 | 39 | add_filter( "gravityview/field/{$this->name}/output", array( $this, 'get_content' ), 4, 2 ); |
40 | - add_action( 'gravityview/template/after', array( $this, 'print_script'), 10, 1 ); |
|
40 | + add_action( 'gravityview/template/after', array( $this, 'print_script' ), 10, 1 ); |
|
41 | 41 | add_filter( 'gravityview_entry_default_fields', array( $this, 'add_default_field' ), 10, 3 ); |
42 | 42 | } |
43 | 43 | |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | */ |
53 | 53 | function add_default_field( $entry_default_fields = array(), $form = array(), $zone = '' ) { |
54 | 54 | |
55 | - if( 'edit' !== $zone ) { |
|
55 | + if ( 'edit' !== $zone ) { |
|
56 | 56 | $entry_default_fields[ $this->name ] = array( |
57 | 57 | 'label' => $this->label, |
58 | 58 | 'desc' => $this->description, |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | public function get_content( $output, $template ) { |
77 | 77 | $entry = $template->entry; |
78 | 78 | |
79 | - $star_url = GFCommon::get_base_url() .'/images/star' . intval( $entry['is_starred'] ) .'.png'; |
|
79 | + $star_url = GFCommon::get_base_url() . '/images/star' . intval( $entry[ 'is_starred' ] ) . '.png'; |
|
80 | 80 | |
81 | 81 | $entry_id = ''; |
82 | 82 | |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | } |
86 | 86 | |
87 | 87 | // if( $show_as_star ) |
88 | - $output = '<img class="gv-star-image" '.$entry_id.' data-is_starred="'. intval( $entry['is_starred'] ) .'" src="'. esc_attr( $star_url ) .'" />'; |
|
88 | + $output = '<img class="gv-star-image" ' . $entry_id . ' data-is_starred="' . intval( $entry[ 'is_starred' ] ) . '" src="' . esc_attr( $star_url ) . '" />'; |
|
89 | 89 | |
90 | 90 | self::$has_star_field = true; |
91 | 91 | |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | */ |
103 | 103 | public function print_script( $context ) { |
104 | 104 | |
105 | - if( ! self::$has_star_field ) { |
|
105 | + if ( ! self::$has_star_field ) { |
|
106 | 106 | return; |
107 | 107 | } |
108 | 108 |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | public function get_content( $output = '', $entry = array(), $field_settings = array(), $field = array() ) { |
50 | 50 | |
51 | 51 | /** Overridden by a template. */ |
52 | - if( ! empty( $field['field_path'] ) ) { return $output; } |
|
52 | + if ( ! empty( $field[ 'field_path' ] ) ) { return $output; } |
|
53 | 53 | |
54 | 54 | $amount = \GV\Utils::get( $entry, 'payment_amount' ); |
55 | 55 | $return = GFCommon::to_money( $amount, \GV\Utils::get( $entry, 'currency' ) ); |
@@ -88,14 +88,14 @@ discard block |
||
88 | 88 | * |
89 | 89 | * @return string Original text if {date_created} isn't found. Otherwise, replaced text. |
90 | 90 | */ |
91 | - public function replace_merge_tag( $matches = array(), $text = '', $form = array(), $entry = array(), $url_encode = false, $esc_html = false ) { |
|
91 | + public function replace_merge_tag( $matches = array(), $text = '', $form = array(), $entry = array(), $url_encode = false, $esc_html = false ) { |
|
92 | 92 | |
93 | 93 | $return = $text; |
94 | 94 | |
95 | 95 | foreach ( $matches as $match ) { |
96 | 96 | |
97 | - $full_tag = $match[0]; |
|
98 | - $modifier = isset( $match[1] ) ? $match[1] : false; |
|
97 | + $full_tag = $match[ 0 ]; |
|
98 | + $modifier = isset( $match[ 1 ] ) ? $match[ 1 ] : false; |
|
99 | 99 | |
100 | 100 | $amount = \GV\Utils::get( $entry, 'payment_amount' ); |
101 | 101 |
@@ -34,7 +34,7 @@ |
||
34 | 34 | global $post; |
35 | 35 | |
36 | 36 | if ( $post ) { |
37 | - $context['post'] = $post; |
|
37 | + $context[ 'post' ] = $post; |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | \GV\Mocks\Legacy_Context::push( $context ); |