@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | |
10 | 10 | var $name = 'checkbox'; |
11 | 11 | |
12 | - var $search_operators = array( 'is', 'in', 'not in', 'isnot', 'contains'); |
|
12 | + var $search_operators = array( 'is', 'in', 'not in', 'isnot', 'contains' ); |
|
13 | 13 | |
14 | 14 | var $_gf_field_class_name = 'GF_Field_Checkbox'; |
15 | 15 | |
@@ -39,9 +39,9 @@ discard block |
||
39 | 39 | $field_options = parent::field_options( $field_options, $template_id, $field_id, $context, $input_type ); |
40 | 40 | |
41 | 41 | // It's not the parent field; it's an input |
42 | - if( floor( $field_id ) !== floatval( $field_id ) ) { |
|
42 | + if ( floor( $field_id ) !== floatval( $field_id ) ) { |
|
43 | 43 | |
44 | - if( $this->is_choice_value_enabled() ) { |
|
44 | + if ( $this->is_choice_value_enabled() ) { |
|
45 | 45 | |
46 | 46 | $desc = esc_html__( 'This input has a label and a value. What should be displayed?', 'gravityview' ); |
47 | 47 | $default = 'value'; |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | ); |
60 | 60 | } |
61 | 61 | |
62 | - $field_options['choice_display'] = array( |
|
62 | + $field_options[ 'choice_display' ] = array( |
|
63 | 63 | 'type' => 'radio', |
64 | 64 | 'class' => 'vertical', |
65 | 65 | 'label' => __( 'What should be displayed:', 'gravityview' ), |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | function parse_um_profile_post_content( $args = array() ) { |
44 | 44 | global $ultimatemember; |
45 | 45 | |
46 | - if( ! $ultimatemember || ! is_object( $ultimatemember ) || ! class_exists( 'GravityView_View_Data' ) ) { |
|
46 | + if ( ! $ultimatemember || ! is_object( $ultimatemember ) || ! class_exists( 'GravityView_View_Data' ) ) { |
|
47 | 47 | return; |
48 | 48 | } |
49 | 49 | |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | return; |
60 | 60 | } |
61 | 61 | |
62 | - GravityView_View_Data::getInstance()->parse_post_content( $active_tab[0]->post_content ); |
|
62 | + GravityView_View_Data::getInstance()->parse_post_content( $active_tab[ 0 ]->post_content ); |
|
63 | 63 | |
64 | 64 | wp_reset_postdata(); |
65 | 65 | } |
@@ -34,7 +34,7 @@ |
||
34 | 34 | * Prevent Divi from adding their stuff to GV pages |
35 | 35 | */ |
36 | 36 | public function add_hooks_admin_init() { |
37 | - if( GravityView_Admin::is_admin_page() ) { |
|
37 | + if ( GravityView_Admin::is_admin_page() ) { |
|
38 | 38 | // Prevent Divi from adding import/export modal dialog |
39 | 39 | remove_action( 'admin_init', 'et_pb_register_builder_portabilities' ); |
40 | 40 |
@@ -10,8 +10,8 @@ discard block |
||
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'] ) ) { |
|
14 | - do_action('gravityview_log_debug', 'search-field-select.php - No choices for field' ); |
|
13 | +if ( empty( $search_field[ 'choices' ] ) ) { |
|
14 | + do_action( 'gravityview_log_debug', 'search-field-select.php - No choices for field' ); |
|
15 | 15 | return; |
16 | 16 | } |
17 | 17 | |
@@ -21,19 +21,19 @@ discard block |
||
21 | 21 | * @param string $default_option Default: `—` (—) |
22 | 22 | * @param string $field_type Field type: "select" or "multiselect" |
23 | 23 | */ |
24 | -$default_option = apply_filters('gravityview/extension/search/select_default', '—', 'select' ); |
|
24 | +$default_option = apply_filters( 'gravityview/extension/search/select_default', '—', 'select' ); |
|
25 | 25 | |
26 | 26 | ?> |
27 | 27 | <div class="gv-search-box gv-search-field-select"> |
28 | - <?php if( ! gv_empty( $search_field['label'], false ) ) { ?> |
|
29 | - <label for="search-box-<?php echo esc_attr( $search_field['name'] ); ?>"><?php echo esc_html( $search_field['label'] ); ?></label> |
|
28 | + <?php if ( ! gv_empty( $search_field[ 'label' ], false ) ) { ?> |
|
29 | + <label for="search-box-<?php echo esc_attr( $search_field[ 'name' ] ); ?>"><?php echo esc_html( $search_field[ 'label' ] ); ?></label> |
|
30 | 30 | <?php } ?> |
31 | 31 | <p> |
32 | - <select name="<?php echo esc_attr( $search_field['name'] ); ?>" id="search-box-<?php echo esc_attr( $search_field['name'] ); ?>"> |
|
33 | - <option value="" <?php gv_selected( '', $search_field['value'], true ); ?>><?php echo esc_html( $default_option ); ?></option> |
|
32 | + <select name="<?php echo esc_attr( $search_field[ 'name' ] ); ?>" id="search-box-<?php echo esc_attr( $search_field[ 'name' ] ); ?>"> |
|
33 | + <option value="" <?php gv_selected( '', $search_field[ 'value' ], true ); ?>><?php echo esc_html( $default_option ); ?></option> |
|
34 | 34 | <?php |
35 | - foreach( $search_field['choices'] as $choice ) : ?> |
|
36 | - <option value="<?php echo esc_attr( $choice['value'] ); ?>" <?php gv_selected( esc_attr( $choice['value'] ), esc_attr( $search_field['value'] ), true ); ?>><?php echo esc_html( $choice['text'] ); ?></option> |
|
35 | + foreach ( $search_field[ 'choices' ] as $choice ) : ?> |
|
36 | + <option value="<?php echo esc_attr( $choice[ 'value' ] ); ?>" <?php gv_selected( esc_attr( $choice[ 'value' ] ), esc_attr( $search_field[ 'value' ] ), true ); ?>><?php echo esc_html( $choice[ 'text' ] ); ?></option> |
|
37 | 37 | <?php endforeach; ?> |
38 | 38 | </select> |
39 | 39 | </p> |
@@ -38,13 +38,13 @@ discard block |
||
38 | 38 | /** @var WP_Admin_Bar $wp_admin_bar */ |
39 | 39 | global $wp_admin_bar; |
40 | 40 | |
41 | - if( is_admin() || ! GVCommon::has_cap( array( 'edit_gravityviews', 'gravityview_edit_entry', 'gravityforms_edit_forms' ) ) ) { |
|
41 | + if ( is_admin() || ! GVCommon::has_cap( array( 'edit_gravityviews', 'gravityview_edit_entry', 'gravityforms_edit_forms' ) ) ) { |
|
42 | 42 | return; |
43 | 43 | } |
44 | 44 | |
45 | 45 | $view_data = GravityView_View_Data::getInstance()->get_views(); |
46 | 46 | |
47 | - if( empty( $view_data ) ) { |
|
47 | + if ( empty( $view_data ) ) { |
|
48 | 48 | return; |
49 | 49 | } |
50 | 50 | |
@@ -104,9 +104,9 @@ discard block |
||
104 | 104 | 'parent' => 'gravityview', |
105 | 105 | 'title' => __( 'Edit Entry', 'gravityview' ), |
106 | 106 | 'meta' => array( |
107 | - 'title' => sprintf( __( 'Edit Entry %s', 'gravityview' ), GravityView_API::get_entry_slug( $entry['id'], $entry ) ), |
|
107 | + 'title' => sprintf( __( 'Edit Entry %s', 'gravityview' ), GravityView_API::get_entry_slug( $entry[ 'id' ], $entry ) ), |
|
108 | 108 | ), |
109 | - 'href' => esc_url_raw( admin_url( sprintf( 'admin.php?page=gf_entries&screen_mode=edit&view=entry&id=%d&lid=%d', $entry['form_id'], $entry['id'] ) ) ), |
|
109 | + 'href' => esc_url_raw( admin_url( sprintf( 'admin.php?page=gf_entries&screen_mode=edit&view=entry&id=%d&lid=%d', $entry[ 'form_id' ], $entry[ 'id' ] ) ) ), |
|
110 | 110 | ) ); |
111 | 111 | |
112 | 112 | } |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | /** @var WP_Admin_Bar $wp_admin_bar */ |
123 | 123 | global $wp_admin_bar; |
124 | 124 | |
125 | - if( GVCommon::has_cap( array( 'edit_gravityviews', 'edit_gravityview', 'gravityforms_edit_forms' ) ) ) { |
|
125 | + if ( GVCommon::has_cap( array( 'edit_gravityviews', 'edit_gravityview', 'gravityforms_edit_forms' ) ) ) { |
|
126 | 126 | |
127 | 127 | $view_data = GravityView_View_Data::getInstance(); |
128 | 128 | |
@@ -139,32 +139,32 @@ discard block |
||
139 | 139 | $edit_view_title = __( 'Edit View', 'gravityview' ); |
140 | 140 | $edit_form_title = __( 'Edit Form', 'gravityview' ); |
141 | 141 | |
142 | - if( sizeof( $views ) > 1 ) { |
|
143 | - $edit_view_title = sprintf( _x( 'Edit View #%d', 'Edit View with the ID of %d', 'gravityview' ), $view['id'] ); |
|
144 | - $edit_form_title = sprintf( __( 'Edit Form #%d', 'Edit Form with the ID of %d', 'gravityview' ), $view['form_id'] ); |
|
142 | + if ( sizeof( $views ) > 1 ) { |
|
143 | + $edit_view_title = sprintf( _x( 'Edit View #%d', 'Edit View with the ID of %d', 'gravityview' ), $view[ 'id' ] ); |
|
144 | + $edit_form_title = sprintf( __( 'Edit Form #%d', 'Edit Form with the ID of %d', 'gravityview' ), $view[ 'form_id' ] ); |
|
145 | 145 | } |
146 | 146 | |
147 | - if( GVCommon::has_cap( 'edit_gravityview', $view['id'] ) && ! in_array( $view['id'], $added_views ) ) { |
|
147 | + if ( GVCommon::has_cap( 'edit_gravityview', $view[ 'id' ] ) && ! in_array( $view[ 'id' ], $added_views ) ) { |
|
148 | 148 | |
149 | - $added_views[] = $view['id']; |
|
149 | + $added_views[ ] = $view[ 'id' ]; |
|
150 | 150 | |
151 | 151 | $wp_admin_bar->add_menu( array( |
152 | - 'id' => 'edit-view-' . $view['id'], |
|
152 | + 'id' => 'edit-view-' . $view[ 'id' ], |
|
153 | 153 | 'parent' => 'gravityview', |
154 | 154 | 'title' => $edit_view_title, |
155 | - 'href' => esc_url_raw( admin_url( sprintf( 'post.php?post=%d&action=edit', $view['id'] ) ) ), |
|
155 | + 'href' => esc_url_raw( admin_url( sprintf( 'post.php?post=%d&action=edit', $view[ 'id' ] ) ) ), |
|
156 | 156 | ) ); |
157 | 157 | } |
158 | 158 | |
159 | - if ( ! empty( $view['form_id'] ) && GVCommon::has_cap( array( 'gravityforms_edit_forms' ), $view['form_id'] ) && ! in_array( $view['form_id'], $added_forms ) ) { |
|
159 | + if ( ! empty( $view[ 'form_id' ] ) && GVCommon::has_cap( array( 'gravityforms_edit_forms' ), $view[ 'form_id' ] ) && ! in_array( $view[ 'form_id' ], $added_forms ) ) { |
|
160 | 160 | |
161 | - $added_forms[] = $view['form_id']; |
|
161 | + $added_forms[ ] = $view[ 'form_id' ]; |
|
162 | 162 | |
163 | 163 | $wp_admin_bar->add_menu( array( |
164 | - 'id' => 'edit-form-' . $view['form_id'], |
|
164 | + 'id' => 'edit-form-' . $view[ 'form_id' ], |
|
165 | 165 | 'parent' => 'gravityview', |
166 | 166 | 'title' => $edit_form_title, |
167 | - 'href' => esc_url_raw( admin_url( sprintf( 'admin.php?page=gf_edit_forms&id=%d', $view['form_id'] ) ) ), |
|
167 | + 'href' => esc_url_raw( admin_url( sprintf( 'admin.php?page=gf_edit_forms&id=%d', $view[ 'form_id' ] ) ) ), |
|
168 | 168 | ) ); |
169 | 169 | } |
170 | 170 | } |
@@ -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 | |
13 | 13 | echo $this->get_tooltip() . $this->get_field_desc(); |
14 | 14 | |
@@ -20,13 +20,13 @@ discard block |
||
20 | 20 | } |
21 | 21 | |
22 | 22 | function render_input( $override_input = null ) { |
23 | - if( isset( $override_input ) ) { |
|
23 | + if ( isset( $override_input ) ) { |
|
24 | 24 | echo $override_input; |
25 | 25 | return; |
26 | 26 | } |
27 | 27 | ?> |
28 | 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 ) : ?> |
|
29 | + <?php foreach ( $this->field[ 'options' ] as $value => $label ) : ?> |
|
30 | 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> |
@@ -12,10 +12,10 @@ |
||
12 | 12 | |
13 | 13 | $field_info_items = array(); |
14 | 14 | |
15 | - if( !empty( $this->item['description'] ) ) { |
|
15 | + if ( ! empty( $this->item[ 'description' ] ) ) { |
|
16 | 16 | |
17 | - $field_info_items[] = array( |
|
18 | - 'value' => $this->item['description'] |
|
17 | + $field_info_items[ ] = array( |
|
18 | + 'value' => $this->item[ 'description' ] |
|
19 | 19 | ); |
20 | 20 | |
21 | 21 | } |
@@ -15,29 +15,29 @@ |
||
15 | 15 | $field_info_items = array(); |
16 | 16 | |
17 | 17 | // Fields with IDs, not like Source URL or Entry ID |
18 | - if( is_numeric( $this->id ) ) { |
|
18 | + if ( is_numeric( $this->id ) ) { |
|
19 | 19 | |
20 | - $field_type_title = GFCommon::get_field_type_title( $this->item['input_type'] ); |
|
20 | + $field_type_title = GFCommon::get_field_type_title( $this->item[ 'input_type' ] ); |
|
21 | 21 | |
22 | - $field_info_items[] = array( |
|
23 | - 'value' => sprintf( __('Type: %s', 'gravityview'), $field_type_title ) |
|
22 | + $field_info_items[ ] = array( |
|
23 | + 'value' => sprintf( __( 'Type: %s', 'gravityview' ), $field_type_title ) |
|
24 | 24 | ); |
25 | 25 | |
26 | - $field_info_items[] = array( |
|
27 | - 'value' => sprintf( __('Field ID: %s', 'gravityview'), $this->id ), |
|
26 | + $field_info_items[ ] = array( |
|
27 | + 'value' => sprintf( __( 'Field ID: %s', 'gravityview' ), $this->id ), |
|
28 | 28 | ); |
29 | 29 | |
30 | 30 | } |
31 | 31 | |
32 | - if( !empty( $this->item['desc'] ) ) { |
|
33 | - $field_info_items[] = array( |
|
34 | - 'value' => $this->item['desc'] |
|
32 | + if ( ! empty( $this->item[ 'desc' ] ) ) { |
|
33 | + $field_info_items[ ] = array( |
|
34 | + 'value' => $this->item[ 'desc' ] |
|
35 | 35 | ); |
36 | 36 | } |
37 | 37 | |
38 | - if( !empty( $this->item['adminLabel'] ) ) { |
|
39 | - $field_info_items[] = array( |
|
40 | - 'value' => sprintf( __('Admin Label: %s', 'gravityview' ), $this->item['adminLabel'] ), |
|
38 | + if ( ! empty( $this->item[ 'adminLabel' ] ) ) { |
|
39 | + $field_info_items[ ] = array( |
|
40 | + 'value' => sprintf( __( 'Admin Label: %s', 'gravityview' ), $this->item[ 'adminLabel' ] ), |
|
41 | 41 | 'class' => 'gv-sublabel' |
42 | 42 | ); |
43 | 43 | } |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | * Return array of fields' id and label, for a given Form ID |
210 | 210 | * |
211 | 211 | * @access public |
212 | - * @param string|array $form_id (default: '') or $form object |
|
212 | + * @param string|array $form (default: '') or $form object |
|
213 | 213 | * @param bool $add_default_properties |
214 | 214 | * @param bool $include_parent_field |
215 | 215 | * @return array |
@@ -850,7 +850,7 @@ discard block |
||
850 | 850 | * |
851 | 851 | * @param array $form Gravity Forms form array |
852 | 852 | * @param string $field_id ID of the field. If an input, full input ID (like `1.3`) |
853 | - * @param string|array $field_value Raw value of the field. |
|
853 | + * @param string $field_value Raw value of the field. |
|
854 | 854 | * @return string |
855 | 855 | */ |
856 | 856 | public static function get_field_label( $form = array(), $field_id = '', $field_value = '' ) { |
@@ -1503,9 +1503,9 @@ discard block |
||
1503 | 1503 | * @param string $message Message body (required) |
1504 | 1504 | * @param string $from_name Displayed name of the sender |
1505 | 1505 | * @param string $message_format If "html", sent text as `text/html`. Otherwise, `text/plain`. Default: "html". |
1506 | - * @param string|array $attachments Optional. Files to attach. {@see wp_mail()} for usage. Default: "". |
|
1506 | + * @param string $attachments Optional. Files to attach. {@see wp_mail()} for usage. Default: "". |
|
1507 | 1507 | * @param array|false $entry Gravity Forms entry array, related to the email. Default: false. |
1508 | - * @param array|false $notification Gravity Forms notification that triggered the email. {@see GFCommon::send_notification}. Default:false. |
|
1508 | + * @param boolean $notification Gravity Forms notification that triggered the email. {@see GFCommon::send_notification}. Default:false. |
|
1509 | 1509 | */ |
1510 | 1510 | public static function send_email( $from, $to, $bcc, $reply_to, $subject, $message, $from_name = '', $message_format = 'html', $attachments = '', $entry = false, $notification = false ) { |
1511 | 1511 |
@@ -245,12 +245,12 @@ discard block |
||
245 | 245 | } |
246 | 246 | |
247 | 247 | /** |
248 | - * @hack |
|
249 | - * In case of email/email confirmation, the input for email has the same id as the parent field |
|
250 | - */ |
|
248 | + * @hack |
|
249 | + * In case of email/email confirmation, the input for email has the same id as the parent field |
|
250 | + */ |
|
251 | 251 | if( 'email' === $field->type && false === strpos( $input['id'], '.' ) ) { |
252 | - continue; |
|
253 | - } |
|
252 | + continue; |
|
253 | + } |
|
254 | 254 | $fields["{$input['id']}"] = array( |
255 | 255 | 'label' => rgar( $input, 'label' ), |
256 | 256 | 'customLabel' => rgar( $input, 'customLabel' ), |
@@ -427,7 +427,7 @@ discard block |
||
427 | 427 | } elseif ( 'delete' === RGForms::get( 'action' ) ) { |
428 | 428 | $criteria['context_view_id'] = isset( $_GET['view_id'] ) ? intval( $_GET['view_id'] ) : null; |
429 | 429 | } elseif( !isset( $criteria['context_view_id'] ) ) { |
430 | - // Prevent overriding the Context View ID: Some widgets could set the context_view_id (e.g. Recent Entries widget) |
|
430 | + // Prevent overriding the Context View ID: Some widgets could set the context_view_id (e.g. Recent Entries widget) |
|
431 | 431 | $criteria['context_view_id'] = null; |
432 | 432 | } |
433 | 433 | |
@@ -1162,7 +1162,7 @@ discard block |
||
1162 | 1162 | ), |
1163 | 1163 | ); |
1164 | 1164 | |
1165 | - $fields = $date_created + $fields; |
|
1165 | + $fields = $date_created + $fields; |
|
1166 | 1166 | |
1167 | 1167 | $blacklist_field_types = apply_filters( 'gravityview_blacklist_field_types', $blacklist, NULL ); |
1168 | 1168 | |
@@ -1174,13 +1174,13 @@ discard block |
||
1174 | 1174 | } |
1175 | 1175 | } |
1176 | 1176 | |
1177 | - /** |
|
1178 | - * @filter `gravityview/common/sortable_fields` Filter the sortable fields |
|
1179 | - * @since 1.12 |
|
1180 | - * @param array $fields Sub-set of GF form fields that are sortable |
|
1181 | - * @param int $formid The Gravity Forms form ID that the fields are from |
|
1182 | - */ |
|
1183 | - $fields = apply_filters( 'gravityview/common/sortable_fields', $fields, $formid ); |
|
1177 | + /** |
|
1178 | + * @filter `gravityview/common/sortable_fields` Filter the sortable fields |
|
1179 | + * @since 1.12 |
|
1180 | + * @param array $fields Sub-set of GF form fields that are sortable |
|
1181 | + * @param int $formid The Gravity Forms form ID that the fields are from |
|
1182 | + */ |
|
1183 | + $fields = apply_filters( 'gravityview/common/sortable_fields', $fields, $formid ); |
|
1184 | 1184 | |
1185 | 1185 | return $fields; |
1186 | 1186 | } |
@@ -1472,17 +1472,17 @@ discard block |
||
1472 | 1472 | } |
1473 | 1473 | |
1474 | 1474 | |
1475 | - /** |
|
1476 | - * Display updated/error notice |
|
1477 | - * |
|
1478 | - * @param string $notice text/HTML of notice |
|
1479 | - * @param string $class CSS class for notice (`updated` or `error`) |
|
1480 | - * |
|
1481 | - * @return string |
|
1482 | - */ |
|
1483 | - public static function generate_notice( $notice, $class = '' ) { |
|
1484 | - return '<div class="gv-notice '.gravityview_sanitize_html_class( $class ) .'">'. $notice .'</div>'; |
|
1485 | - } |
|
1475 | + /** |
|
1476 | + * Display updated/error notice |
|
1477 | + * |
|
1478 | + * @param string $notice text/HTML of notice |
|
1479 | + * @param string $class CSS class for notice (`updated` or `error`) |
|
1480 | + * |
|
1481 | + * @return string |
|
1482 | + */ |
|
1483 | + public static function generate_notice( $notice, $class = '' ) { |
|
1484 | + return '<div class="gv-notice '.gravityview_sanitize_html_class( $class ) .'">'. $notice .'</div>'; |
|
1485 | + } |
|
1486 | 1486 | |
1487 | 1487 | /** |
1488 | 1488 | * Inspired on \GFCommon::encode_shortcodes, reverse the encoding by replacing the ascii characters by the shortcode brackets |
@@ -262,7 +262,7 @@ discard block |
||
262 | 262 | } |
263 | 263 | |
264 | 264 | |
265 | - if( GFCommon::is_product_field( $field['type'] ) ){ |
|
265 | + if( GFCommon::is_product_field( $field['type'] ) ) { |
|
266 | 266 | $has_product_fields = true; |
267 | 267 | } |
268 | 268 | |
@@ -322,7 +322,7 @@ discard block |
||
322 | 322 | |
323 | 323 | $fields = array(); |
324 | 324 | |
325 | - foreach ( $extra_fields as $key => $field ){ |
|
325 | + foreach ( $extra_fields as $key => $field ) { |
|
326 | 326 | if ( ! empty( $only_default_column ) && ! empty( $field['is_default_column'] ) ) { |
327 | 327 | $fields[ $key ] = array( 'label' => $field['label'], 'type' => 'entry_meta' ); |
328 | 328 | } |
@@ -888,7 +888,7 @@ discard block |
||
888 | 888 | * @return GF_Field|null Gravity Forms field object, or NULL: Gravity Forms GFFormsModel does not exist or field at $field_id doesn't exist. |
889 | 889 | */ |
890 | 890 | public static function get_field( $form, $field_id ) { |
891 | - if ( class_exists( 'GFFormsModel' ) ){ |
|
891 | + if ( class_exists( 'GFFormsModel' ) ) { |
|
892 | 892 | return GFFormsModel::get_field( $form, $field_id ); |
893 | 893 | } else { |
894 | 894 | return null; |
@@ -935,7 +935,7 @@ discard block |
||
935 | 935 | $shortcodes = array(); |
936 | 936 | |
937 | 937 | preg_match_all( '/' . get_shortcode_regex() . '/s', $content, $matches, PREG_SET_ORDER ); |
938 | - if ( empty( $matches ) ){ |
|
938 | + if ( empty( $matches ) ) { |
|
939 | 939 | return false; |
940 | 940 | } |
941 | 941 |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | |
125 | 125 | $entry = self::get_entry( $entry_slug, true ); |
126 | 126 | |
127 | - $form = self::get_form( $entry['form_id'] ); |
|
127 | + $form = self::get_form( $entry[ 'form_id' ] ); |
|
128 | 128 | |
129 | 129 | return $form; |
130 | 130 | } |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | |
183 | 183 | $results = GFAPI::get_entries( intval( $form_id ), $search_criteria, null, $paging ); |
184 | 184 | |
185 | - $result = ( ! empty( $results ) && ! empty( $results[0]['id'] ) ) ? $results[0]['id'] : null; |
|
185 | + $result = ( ! empty( $results ) && ! empty( $results[ 0 ][ 'id' ] ) ) ? $results[ 0 ][ 'id' ] : null; |
|
186 | 186 | |
187 | 187 | return $result; |
188 | 188 | } |
@@ -199,10 +199,10 @@ discard block |
||
199 | 199 | * |
200 | 200 | * @return array Empty array if GFAPI class isn't available or no forms. Otherwise, the array of Forms |
201 | 201 | */ |
202 | - public static function get_forms( $active = true, $trash = false ) { |
|
202 | + public static function get_forms( $active = true, $trash = false ) { |
|
203 | 203 | $forms = array(); |
204 | 204 | if ( class_exists( 'GFAPI' ) ) { |
205 | - if( 'any' === $active ) { |
|
205 | + if ( 'any' === $active ) { |
|
206 | 206 | $active_forms = GFAPI::get_forms( true, $trash ); |
207 | 207 | $inactive_forms = GFAPI::get_forms( false, $trash ); |
208 | 208 | $forms = array_merge( array_filter( $active_forms ), array_filter( $inactive_forms ) ); |
@@ -233,9 +233,9 @@ discard block |
||
233 | 233 | $has_post_fields = false; |
234 | 234 | |
235 | 235 | if ( $form ) { |
236 | - foreach ( $form['fields'] as $field ) { |
|
237 | - if ( $include_parent_field || empty( $field['inputs'] ) ) { |
|
238 | - $fields["{$field['id']}"] = array( |
|
236 | + foreach ( $form[ 'fields' ] as $field ) { |
|
237 | + if ( $include_parent_field || empty( $field[ 'inputs' ] ) ) { |
|
238 | + $fields[ "{$field[ 'id' ]}" ] = array( |
|
239 | 239 | 'label' => rgar( $field, 'label' ), |
240 | 240 | 'parent' => null, |
241 | 241 | 'type' => rgar( $field, 'type' ), |
@@ -244,10 +244,10 @@ discard block |
||
244 | 244 | ); |
245 | 245 | } |
246 | 246 | |
247 | - if ( $add_default_properties && ! empty( $field['inputs'] ) ) { |
|
248 | - foreach ( $field['inputs'] as $input ) { |
|
247 | + if ( $add_default_properties && ! empty( $field[ 'inputs' ] ) ) { |
|
248 | + foreach ( $field[ 'inputs' ] as $input ) { |
|
249 | 249 | |
250 | - if( ! empty( $input['isHidden'] ) ) { |
|
250 | + if ( ! empty( $input[ 'isHidden' ] ) ) { |
|
251 | 251 | continue; |
252 | 252 | } |
253 | 253 | |
@@ -255,10 +255,10 @@ discard block |
||
255 | 255 | * @hack |
256 | 256 | * In case of email/email confirmation, the input for email has the same id as the parent field |
257 | 257 | */ |
258 | - if( 'email' === $field['type'] && false === strpos( $input['id'], '.' ) ) { |
|
258 | + if ( 'email' === $field[ 'type' ] && false === strpos( $input[ 'id' ], '.' ) ) { |
|
259 | 259 | continue; |
260 | 260 | } |
261 | - $fields["{$input['id']}"] = array( |
|
261 | + $fields[ "{$input[ 'id' ]}" ] = array( |
|
262 | 262 | 'label' => rgar( $input, 'label' ), |
263 | 263 | 'customLabel' => rgar( $input, 'customLabel' ), |
264 | 264 | 'parent' => $field, |
@@ -270,7 +270,7 @@ discard block |
||
270 | 270 | } |
271 | 271 | |
272 | 272 | |
273 | - if( GFCommon::is_product_field( $field['type'] ) ){ |
|
273 | + if ( GFCommon::is_product_field( $field[ 'type' ] ) ) { |
|
274 | 274 | $has_product_fields = true; |
275 | 275 | } |
276 | 276 | |
@@ -284,7 +284,7 @@ discard block |
||
284 | 284 | * @since 1.7 |
285 | 285 | */ |
286 | 286 | if ( $has_post_fields ) { |
287 | - $fields['post_id'] = array( |
|
287 | + $fields[ 'post_id' ] = array( |
|
288 | 288 | 'label' => __( 'Post ID', 'gravityview' ), |
289 | 289 | 'type' => 'post_id', |
290 | 290 | ); |
@@ -295,10 +295,10 @@ discard block |
||
295 | 295 | $payment_fields = GravityView_Fields::get_all( 'pricing' ); |
296 | 296 | |
297 | 297 | foreach ( $payment_fields as $payment_field ) { |
298 | - if( isset( $fields["{$payment_field->name}"] ) ) { |
|
298 | + if ( isset( $fields[ "{$payment_field->name}" ] ) ) { |
|
299 | 299 | continue; |
300 | 300 | } |
301 | - $fields["{$payment_field->name}"] = array( |
|
301 | + $fields[ "{$payment_field->name}" ] = array( |
|
302 | 302 | 'label' => $payment_field->label, |
303 | 303 | 'desc' => $payment_field->description, |
304 | 304 | 'type' => $payment_field->name, |
@@ -330,9 +330,9 @@ discard block |
||
330 | 330 | |
331 | 331 | $fields = array(); |
332 | 332 | |
333 | - foreach ( $extra_fields as $key => $field ){ |
|
334 | - if ( ! empty( $only_default_column ) && ! empty( $field['is_default_column'] ) ) { |
|
335 | - $fields[ $key ] = array( 'label' => $field['label'], 'type' => 'entry_meta' ); |
|
333 | + foreach ( $extra_fields as $key => $field ) { |
|
334 | + if ( ! empty( $only_default_column ) && ! empty( $field[ 'is_default_column' ] ) ) { |
|
335 | + $fields[ $key ] = array( 'label' => $field[ 'label' ], 'type' => 'entry_meta' ); |
|
336 | 336 | } |
337 | 337 | } |
338 | 338 | |
@@ -372,32 +372,32 @@ discard block |
||
372 | 372 | 'search_criteria' => null, |
373 | 373 | 'sorting' => null, |
374 | 374 | 'paging' => null, |
375 | - 'cache' => (isset( $passed_criteria['cache'] ) ? $passed_criteria['cache'] : true), |
|
375 | + 'cache' => ( isset( $passed_criteria[ 'cache' ] ) ? $passed_criteria[ 'cache' ] : true ), |
|
376 | 376 | ); |
377 | 377 | |
378 | 378 | $criteria = wp_parse_args( $passed_criteria, $search_criteria_defaults ); |
379 | 379 | |
380 | - if ( ! empty( $criteria['search_criteria']['field_filters'] ) ) { |
|
381 | - foreach ( $criteria['search_criteria']['field_filters'] as &$filter ) { |
|
380 | + if ( ! empty( $criteria[ 'search_criteria' ][ 'field_filters' ] ) ) { |
|
381 | + foreach ( $criteria[ 'search_criteria' ][ 'field_filters' ] as &$filter ) { |
|
382 | 382 | |
383 | 383 | if ( ! is_array( $filter ) ) { |
384 | 384 | continue; |
385 | 385 | } |
386 | 386 | |
387 | 387 | // By default, we want searches to be wildcard for each field. |
388 | - $filter['operator'] = empty( $filter['operator'] ) ? 'contains' : $filter['operator']; |
|
388 | + $filter[ 'operator' ] = empty( $filter[ 'operator' ] ) ? 'contains' : $filter[ 'operator' ]; |
|
389 | 389 | |
390 | 390 | /** |
391 | 391 | * @filter `gravityview_search_operator` Modify the search operator for the field (contains, is, isnot, etc) |
392 | 392 | * @param string $operator Existing search operator |
393 | 393 | * @param array $filter array with `key`, `value`, `operator`, `type` keys |
394 | 394 | */ |
395 | - $filter['operator'] = apply_filters( 'gravityview_search_operator', $filter['operator'], $filter ); |
|
395 | + $filter[ 'operator' ] = apply_filters( 'gravityview_search_operator', $filter[ 'operator' ], $filter ); |
|
396 | 396 | } |
397 | 397 | |
398 | 398 | // don't send just the [mode] without any field filter. |
399 | - if( count( $criteria['search_criteria']['field_filters'] ) === 1 && array_key_exists( 'mode' , $criteria['search_criteria']['field_filters'] ) ) { |
|
400 | - unset( $criteria['search_criteria']['field_filters']['mode'] ); |
|
399 | + if ( count( $criteria[ 'search_criteria' ][ 'field_filters' ] ) === 1 && array_key_exists( 'mode', $criteria[ 'search_criteria' ][ 'field_filters' ] ) ) { |
|
400 | + unset( $criteria[ 'search_criteria' ][ 'field_filters' ][ 'mode' ] ); |
|
401 | 401 | } |
402 | 402 | |
403 | 403 | } |
@@ -408,21 +408,21 @@ discard block |
||
408 | 408 | * Prepare date formats to be in Gravity Forms DB format; |
409 | 409 | * $passed_criteria may include date formats incompatible with Gravity Forms. |
410 | 410 | */ |
411 | - foreach ( array('start_date', 'end_date' ) as $key ) { |
|
411 | + foreach ( array( 'start_date', 'end_date' ) as $key ) { |
|
412 | 412 | |
413 | - if ( ! empty( $criteria['search_criteria'][ $key ] ) ) { |
|
413 | + if ( ! empty( $criteria[ 'search_criteria' ][ $key ] ) ) { |
|
414 | 414 | |
415 | 415 | // Use date_create instead of new DateTime so it returns false if invalid date format. |
416 | - $date = date_create( $criteria['search_criteria'][ $key ] ); |
|
416 | + $date = date_create( $criteria[ 'search_criteria' ][ $key ] ); |
|
417 | 417 | |
418 | 418 | if ( $date ) { |
419 | 419 | // Gravity Forms wants dates in the `Y-m-d H:i:s` format. |
420 | - $criteria['search_criteria'][ $key ] = $date->format( 'Y-m-d H:i:s' ); |
|
420 | + $criteria[ 'search_criteria' ][ $key ] = $date->format( 'Y-m-d H:i:s' ); |
|
421 | 421 | } else { |
422 | 422 | // If it's an invalid date, unset it. Gravity Forms freaks out otherwise. |
423 | - unset( $criteria['search_criteria'][ $key ] ); |
|
423 | + unset( $criteria[ 'search_criteria' ][ $key ] ); |
|
424 | 424 | |
425 | - do_action( 'gravityview_log_error', '[filter_get_entries_criteria] '.$key.' Date format not valid:', $criteria['search_criteria'][ $key ] ); |
|
425 | + do_action( 'gravityview_log_error', '[filter_get_entries_criteria] ' . $key . ' Date format not valid:', $criteria[ 'search_criteria' ][ $key ] ); |
|
426 | 426 | } |
427 | 427 | } |
428 | 428 | } |
@@ -430,12 +430,12 @@ discard block |
||
430 | 430 | |
431 | 431 | // When multiple views are embedded, OR single entry, calculate the context view id and send it to the advanced filter |
432 | 432 | if ( class_exists( 'GravityView_View_Data' ) && GravityView_View_Data::getInstance()->has_multiple_views() || GravityView_frontend::getInstance()->getSingleEntry() ) { |
433 | - $criteria['context_view_id'] = GravityView_frontend::getInstance()->get_context_view_id(); |
|
433 | + $criteria[ 'context_view_id' ] = GravityView_frontend::getInstance()->get_context_view_id(); |
|
434 | 434 | } elseif ( 'delete' === RGForms::get( 'action' ) ) { |
435 | - $criteria['context_view_id'] = isset( $_GET['view_id'] ) ? intval( $_GET['view_id'] ) : null; |
|
436 | - } elseif( !isset( $criteria['context_view_id'] ) ) { |
|
435 | + $criteria[ 'context_view_id' ] = isset( $_GET[ 'view_id' ] ) ? intval( $_GET[ 'view_id' ] ) : null; |
|
436 | + } elseif ( ! isset( $criteria[ 'context_view_id' ] ) ) { |
|
437 | 437 | // Prevent overriding the Context View ID: Some widgets could set the context_view_id (e.g. Recent Entries widget) |
438 | - $criteria['context_view_id'] = null; |
|
438 | + $criteria[ 'context_view_id' ] = null; |
|
439 | 439 | } |
440 | 440 | |
441 | 441 | /** |
@@ -444,7 +444,7 @@ discard block |
||
444 | 444 | * @param array $form_ids Forms to search |
445 | 445 | * @param int $view_id ID of the view being used to search |
446 | 446 | */ |
447 | - $criteria = apply_filters( 'gravityview_search_criteria', $criteria, $form_ids, $criteria['context_view_id'] ); |
|
447 | + $criteria = apply_filters( 'gravityview_search_criteria', $criteria, $form_ids, $criteria[ 'context_view_id' ] ); |
|
448 | 448 | |
449 | 449 | return (array)$criteria; |
450 | 450 | |
@@ -475,7 +475,7 @@ discard block |
||
475 | 475 | /** Reduce # of database calls */ |
476 | 476 | add_filter( 'gform_is_encrypted_field', '__return_false' ); |
477 | 477 | |
478 | - if ( ! empty( $criteria['cache'] ) ) { |
|
478 | + if ( ! empty( $criteria[ 'cache' ] ) ) { |
|
479 | 479 | |
480 | 480 | $Cache = new GravityView_Cache( $form_ids, $criteria ); |
481 | 481 | |
@@ -483,7 +483,7 @@ discard block |
||
483 | 483 | |
484 | 484 | // Still update the total count when using cached results |
485 | 485 | if ( ! is_null( $total ) ) { |
486 | - $total = GFAPI::count_entries( $form_ids, $criteria['search_criteria'] ); |
|
486 | + $total = GFAPI::count_entries( $form_ids, $criteria[ 'search_criteria' ] ); |
|
487 | 487 | } |
488 | 488 | |
489 | 489 | $return = $entries; |
@@ -503,9 +503,9 @@ discard block |
||
503 | 503 | $entries = apply_filters( 'gravityview_before_get_entries', null, $criteria, $passed_criteria, $total ); |
504 | 504 | |
505 | 505 | // No entries returned from gravityview_before_get_entries |
506 | - if( is_null( $entries ) ) { |
|
506 | + if ( is_null( $entries ) ) { |
|
507 | 507 | |
508 | - $entries = GFAPI::get_entries( $form_ids, $criteria['search_criteria'], $criteria['sorting'], $criteria['paging'], $total ); |
|
508 | + $entries = GFAPI::get_entries( $form_ids, $criteria[ 'search_criteria' ], $criteria[ 'sorting' ], $criteria[ 'paging' ], $total ); |
|
509 | 509 | |
510 | 510 | if ( is_wp_error( $entries ) ) { |
511 | 511 | do_action( 'gravityview_log_error', $entries->get_error_message(), $entries ); |
@@ -514,7 +514,7 @@ discard block |
||
514 | 514 | } |
515 | 515 | } |
516 | 516 | |
517 | - if ( ! empty( $criteria['cache'] ) && isset( $Cache ) ) { |
|
517 | + if ( ! empty( $criteria[ 'cache' ] ) && isset( $Cache ) ) { |
|
518 | 518 | |
519 | 519 | // Cache results |
520 | 520 | $Cache->set( $entries, 'entries' ); |
@@ -619,7 +619,7 @@ discard block |
||
619 | 619 | */ |
620 | 620 | $check_entry_display = apply_filters( 'gravityview/common/get_entry/check_entry_display', $check_entry_display, $entry ); |
621 | 621 | |
622 | - if( $check_entry_display ) { |
|
622 | + if ( $check_entry_display ) { |
|
623 | 623 | // Is the entry allowed |
624 | 624 | $entry = self::check_entry_display( $entry ); |
625 | 625 | } |
@@ -652,12 +652,12 @@ discard block |
||
652 | 652 | |
653 | 653 | $value = false; |
654 | 654 | |
655 | - if( 'context' === $val1 ) { |
|
655 | + if ( 'context' === $val1 ) { |
|
656 | 656 | |
657 | 657 | $matching_contexts = array( $val2 ); |
658 | 658 | |
659 | 659 | // We allow for non-standard contexts. |
660 | - switch( $val2 ) { |
|
660 | + switch ( $val2 ) { |
|
661 | 661 | // Check for either single or edit |
662 | 662 | case 'singular': |
663 | 663 | $matching_contexts = array( 'single', 'edit' ); |
@@ -717,7 +717,7 @@ discard block |
||
717 | 717 | return false; |
718 | 718 | } |
719 | 719 | |
720 | - if ( empty( $entry['form_id'] ) ) { |
|
720 | + if ( empty( $entry[ 'form_id' ] ) ) { |
|
721 | 721 | do_action( 'gravityview_log_debug', '[apply_filters_to_entry] Entry is empty! Entry:', $entry ); |
722 | 722 | return false; |
723 | 723 | } |
@@ -725,26 +725,26 @@ discard block |
||
725 | 725 | $criteria = self::calculate_get_entries_criteria(); |
726 | 726 | |
727 | 727 | // Make sure the current View is connected to the same form as the Entry |
728 | - if( ! empty( $criteria['context_view_id'] ) ) { |
|
729 | - $context_view_id = intval( $criteria['context_view_id'] ); |
|
728 | + if ( ! empty( $criteria[ 'context_view_id' ] ) ) { |
|
729 | + $context_view_id = intval( $criteria[ 'context_view_id' ] ); |
|
730 | 730 | $context_form_id = gravityview_get_form_id( $context_view_id ); |
731 | - if( intval( $context_form_id ) !== intval( $entry['form_id'] ) ) { |
|
732 | - do_action( 'gravityview_log_debug', sprintf( '[apply_filters_to_entry] Entry form ID does not match current View connected form ID:', $entry['form_id'] ), $criteria['context_view_id'] ); |
|
731 | + if ( intval( $context_form_id ) !== intval( $entry[ 'form_id' ] ) ) { |
|
732 | + do_action( 'gravityview_log_debug', sprintf( '[apply_filters_to_entry] Entry form ID does not match current View connected form ID:', $entry[ 'form_id' ] ), $criteria[ 'context_view_id' ] ); |
|
733 | 733 | return false; |
734 | 734 | } |
735 | 735 | } |
736 | 736 | |
737 | - if ( empty( $criteria['search_criteria'] ) || ! is_array( $criteria['search_criteria'] ) ) { |
|
737 | + if ( empty( $criteria[ 'search_criteria' ] ) || ! is_array( $criteria[ 'search_criteria' ] ) ) { |
|
738 | 738 | do_action( 'gravityview_log_debug', '[apply_filters_to_entry] Entry approved! No search criteria found:', $criteria ); |
739 | 739 | return $entry; |
740 | 740 | } |
741 | 741 | |
742 | - $search_criteria = $criteria['search_criteria']; |
|
742 | + $search_criteria = $criteria[ 'search_criteria' ]; |
|
743 | 743 | unset( $criteria ); |
744 | 744 | |
745 | 745 | // check entry status |
746 | - if ( array_key_exists( 'status', $search_criteria ) && $search_criteria['status'] != $entry['status'] ) { |
|
747 | - do_action( 'gravityview_log_debug', sprintf( '[apply_filters_to_entry] Entry status - %s - is not valid according to filter:', $entry['status'] ), $search_criteria ); |
|
746 | + if ( array_key_exists( 'status', $search_criteria ) && $search_criteria[ 'status' ] != $entry[ 'status' ] ) { |
|
747 | + do_action( 'gravityview_log_debug', sprintf( '[apply_filters_to_entry] Entry status - %s - is not valid according to filter:', $entry[ 'status' ] ), $search_criteria ); |
|
748 | 748 | return false; |
749 | 749 | } |
750 | 750 | |
@@ -752,37 +752,37 @@ discard block |
||
752 | 752 | // @todo: Does it make sense to apply the Date create filters to the single entry? |
753 | 753 | |
754 | 754 | // field_filters |
755 | - if ( empty( $search_criteria['field_filters'] ) || ! is_array( $search_criteria['field_filters'] ) ) { |
|
755 | + if ( empty( $search_criteria[ 'field_filters' ] ) || ! is_array( $search_criteria[ 'field_filters' ] ) ) { |
|
756 | 756 | do_action( 'gravityview_log_debug', '[apply_filters_to_entry] Entry approved! No field filters criteria found:', $search_criteria ); |
757 | 757 | return $entry; |
758 | 758 | } |
759 | 759 | |
760 | - $filters = $search_criteria['field_filters']; |
|
760 | + $filters = $search_criteria[ 'field_filters' ]; |
|
761 | 761 | unset( $search_criteria ); |
762 | 762 | |
763 | - $mode = array_key_exists( 'mode', $filters ) ? strtolower( $filters['mode'] ) : 'all'; |
|
764 | - unset( $filters['mode'] ); |
|
763 | + $mode = array_key_exists( 'mode', $filters ) ? strtolower( $filters[ 'mode' ] ) : 'all'; |
|
764 | + unset( $filters[ 'mode' ] ); |
|
765 | 765 | |
766 | - $form = self::get_form( $entry['form_id'] ); |
|
766 | + $form = self::get_form( $entry[ 'form_id' ] ); |
|
767 | 767 | |
768 | 768 | foreach ( $filters as $filter ) { |
769 | 769 | |
770 | - if ( ! isset( $filter['key'] ) ) { |
|
770 | + if ( ! isset( $filter[ 'key' ] ) ) { |
|
771 | 771 | continue; |
772 | 772 | } |
773 | 773 | |
774 | - $k = $filter['key']; |
|
774 | + $k = $filter[ 'key' ]; |
|
775 | 775 | |
776 | 776 | if ( in_array( $k, array( 'created_by', 'payment_status' ) ) ) { |
777 | 777 | $field_value = $entry[ $k ]; |
778 | 778 | $field = null; |
779 | 779 | } else { |
780 | 780 | $field = self::get_field( $form, $k ); |
781 | - $field_value = GFFormsModel::get_lead_field_value( $entry, $field ); |
|
781 | + $field_value = GFFormsModel::get_lead_field_value( $entry, $field ); |
|
782 | 782 | } |
783 | 783 | |
784 | - $operator = isset( $filter['operator'] ) ? strtolower( $filter['operator'] ) : 'is'; |
|
785 | - $is_value_match = GFFormsModel::is_value_match( $field_value, $filter['value'], $operator, $field ); |
|
784 | + $operator = isset( $filter[ 'operator' ] ) ? strtolower( $filter[ 'operator' ] ) : 'is'; |
|
785 | + $is_value_match = GFFormsModel::is_value_match( $field_value, $filter[ 'value' ], $operator, $field ); |
|
786 | 786 | |
787 | 787 | // verify if we are already free to go! |
788 | 788 | if ( ! $is_value_match && 'all' === $mode ) { |
@@ -840,18 +840,18 @@ discard block |
||
840 | 840 | * Gravity Forms code to adjust date to locally-configured Time Zone |
841 | 841 | * @see GFCommon::format_date() for original code |
842 | 842 | */ |
843 | - $date_gmt_time = mysql2date( 'G', $date_string ); |
|
843 | + $date_gmt_time = mysql2date( 'G', $date_string ); |
|
844 | 844 | $date_local_timestamp = GFCommon::get_local_timestamp( $date_gmt_time ); |
845 | 845 | |
846 | - $format = rgar( $atts, 'format' ); |
|
847 | - $is_human = ! empty( $atts['human'] ); |
|
848 | - $is_diff = ! empty( $atts['diff'] ); |
|
849 | - $is_raw = ! empty( $atts['raw'] ); |
|
850 | - $is_timestamp = ! empty( $atts['timestamp'] ); |
|
851 | - $include_time = ! empty( $atts['time'] ); |
|
846 | + $format = rgar( $atts, 'format' ); |
|
847 | + $is_human = ! empty( $atts[ 'human' ] ); |
|
848 | + $is_diff = ! empty( $atts[ 'diff' ] ); |
|
849 | + $is_raw = ! empty( $atts[ 'raw' ] ); |
|
850 | + $is_timestamp = ! empty( $atts[ 'timestamp' ] ); |
|
851 | + $include_time = ! empty( $atts[ 'time' ] ); |
|
852 | 852 | |
853 | 853 | // If we're using time diff, we want to have a different default format |
854 | - if( empty( $format ) ) { |
|
854 | + if ( empty( $format ) ) { |
|
855 | 855 | /* translators: %s: relative time from now, used for generic date comparisons. "1 day ago", or "20 seconds ago" */ |
856 | 856 | $format = $is_diff ? esc_html__( '%s ago', 'gravityview' ) : get_option( 'date_format' ); |
857 | 857 | } |
@@ -859,7 +859,7 @@ discard block |
||
859 | 859 | // If raw was specified, don't modify the stored value |
860 | 860 | if ( $is_raw ) { |
861 | 861 | $formatted_date = $date_string; |
862 | - } elseif( $is_timestamp ) { |
|
862 | + } elseif ( $is_timestamp ) { |
|
863 | 863 | $formatted_date = $date_local_timestamp; |
864 | 864 | } elseif ( $is_diff ) { |
865 | 865 | $formatted_date = sprintf( $format, human_time_diff( $date_gmt_time ) ); |
@@ -893,7 +893,7 @@ discard block |
||
893 | 893 | |
894 | 894 | $label = rgar( $field, 'label' ); |
895 | 895 | |
896 | - if( floor( $field_id ) !== floatval( $field_id ) ) { |
|
896 | + if ( floor( $field_id ) !== floatval( $field_id ) ) { |
|
897 | 897 | $label = GFFormsModel::get_choice_text( $field, $field_value, $field_id ); |
898 | 898 | } |
899 | 899 | |
@@ -914,7 +914,7 @@ discard block |
||
914 | 914 | * @return GF_Field|null Gravity Forms field object, or NULL: Gravity Forms GFFormsModel does not exist or field at $field_id doesn't exist. |
915 | 915 | */ |
916 | 916 | public static function get_field( $form, $field_id ) { |
917 | - if ( class_exists( 'GFFormsModel' ) ){ |
|
917 | + if ( class_exists( 'GFFormsModel' ) ) { |
|
918 | 918 | return GFFormsModel::get_field( $form, $field_id ); |
919 | 919 | } else { |
920 | 920 | return null; |
@@ -961,19 +961,19 @@ discard block |
||
961 | 961 | $shortcodes = array(); |
962 | 962 | |
963 | 963 | preg_match_all( '/' . get_shortcode_regex() . '/s', $content, $matches, PREG_SET_ORDER ); |
964 | - if ( empty( $matches ) ){ |
|
964 | + if ( empty( $matches ) ) { |
|
965 | 965 | return false; |
966 | 966 | } |
967 | 967 | |
968 | 968 | foreach ( $matches as $shortcode ) { |
969 | - if ( $tag === $shortcode[2] ) { |
|
969 | + if ( $tag === $shortcode[ 2 ] ) { |
|
970 | 970 | |
971 | 971 | // Changed this to $shortcode instead of true so we get the parsed atts. |
972 | - $shortcodes[] = $shortcode; |
|
972 | + $shortcodes[ ] = $shortcode; |
|
973 | 973 | |
974 | - } else if ( isset( $shortcode[5] ) && $results = self::has_shortcode_r( $shortcode[5], $tag ) ) { |
|
975 | - foreach( $results as $result ) { |
|
976 | - $shortcodes[] = $result; |
|
974 | + } else if ( isset( $shortcode[ 5 ] ) && $results = self::has_shortcode_r( $shortcode[ 5 ], $tag ) ) { |
|
975 | + foreach ( $results as $result ) { |
|
976 | + $shortcodes[ ] = $result; |
|
977 | 977 | } |
978 | 978 | } |
979 | 979 | } |
@@ -1117,7 +1117,7 @@ discard block |
||
1117 | 1117 | public static function get_directory_fields( $post_id, $apply_filter = true ) { |
1118 | 1118 | $fields = get_post_meta( $post_id, '_gravityview_directory_fields', true ); |
1119 | 1119 | |
1120 | - if( $apply_filter ) { |
|
1120 | + if ( $apply_filter ) { |
|
1121 | 1121 | /** |
1122 | 1122 | * @filter `gravityview/configuration/fields` Filter the View fields' configuration array |
1123 | 1123 | * @since 1.6.5 |
@@ -1140,7 +1140,7 @@ discard block |
||
1140 | 1140 | * @return string html |
1141 | 1141 | */ |
1142 | 1142 | public static function get_sortable_fields( $formid, $current = '' ) { |
1143 | - $output = '<option value="" ' . selected( '', $current, false ).'>' . esc_html__( 'Default', 'gravityview' ) .'</option>'; |
|
1143 | + $output = '<option value="" ' . selected( '', $current, false ) . '>' . esc_html__( 'Default', 'gravityview' ) . '</option>'; |
|
1144 | 1144 | |
1145 | 1145 | if ( empty( $formid ) ) { |
1146 | 1146 | return $output; |
@@ -1153,11 +1153,11 @@ discard block |
||
1153 | 1153 | $blacklist_field_types = apply_filters( 'gravityview_blacklist_field_types', array( 'list', 'textarea' ), null ); |
1154 | 1154 | |
1155 | 1155 | foreach ( $fields as $id => $field ) { |
1156 | - if ( in_array( $field['type'], $blacklist_field_types ) ) { |
|
1156 | + if ( in_array( $field[ 'type' ], $blacklist_field_types ) ) { |
|
1157 | 1157 | continue; |
1158 | 1158 | } |
1159 | 1159 | |
1160 | - $output .= '<option value="'. $id .'" '. selected( $id, $current, false ).'>'. esc_attr( $field['label'] ) .'</option>'; |
|
1160 | + $output .= '<option value="' . $id . '" ' . selected( $id, $current, false ) . '>' . esc_attr( $field[ 'label' ] ) . '</option>'; |
|
1161 | 1161 | } |
1162 | 1162 | } |
1163 | 1163 | |
@@ -1192,9 +1192,9 @@ discard block |
||
1192 | 1192 | $blacklist_field_types = apply_filters( 'gravityview_blacklist_field_types', $blacklist, NULL ); |
1193 | 1193 | |
1194 | 1194 | // TODO: Convert to using array_filter |
1195 | - foreach( $fields as $id => $field ) { |
|
1195 | + foreach ( $fields as $id => $field ) { |
|
1196 | 1196 | |
1197 | - if( in_array( $field['type'], $blacklist_field_types ) ) { |
|
1197 | + if ( in_array( $field[ 'type' ], $blacklist_field_types ) ) { |
|
1198 | 1198 | unset( $fields[ $id ] ); |
1199 | 1199 | } |
1200 | 1200 | } |
@@ -1235,14 +1235,14 @@ discard block |
||
1235 | 1235 | * @param int|array $field field key or field array |
1236 | 1236 | * @return boolean |
1237 | 1237 | */ |
1238 | - public static function is_field_numeric( $form = null, $field = '' ) { |
|
1238 | + public static function is_field_numeric( $form = null, $field = '' ) { |
|
1239 | 1239 | |
1240 | 1240 | if ( ! is_array( $form ) && ! is_array( $field ) ) { |
1241 | 1241 | $form = self::get_form( $form ); |
1242 | 1242 | } |
1243 | 1243 | |
1244 | 1244 | // If entry meta, it's a string. Otherwise, numeric |
1245 | - if( ! is_numeric( $field ) && is_string( $field ) ) { |
|
1245 | + if ( ! is_numeric( $field ) && is_string( $field ) ) { |
|
1246 | 1246 | $type = $field; |
1247 | 1247 | } else { |
1248 | 1248 | $type = self::get_field_type( $form, $field ); |
@@ -1256,9 +1256,9 @@ discard block |
||
1256 | 1256 | $numeric_types = apply_filters( 'gravityview/common/numeric_types', array( 'number', 'time' ) ); |
1257 | 1257 | |
1258 | 1258 | // Defer to GravityView_Field setting, if the field type is registered and `is_numeric` is true |
1259 | - if( $gv_field = GravityView_Fields::get( $type ) ) { |
|
1260 | - if( true === $gv_field->is_numeric ) { |
|
1261 | - $numeric_types[] = $gv_field->is_numeric; |
|
1259 | + if ( $gv_field = GravityView_Fields::get( $type ) ) { |
|
1260 | + if ( true === $gv_field->is_numeric ) { |
|
1261 | + $numeric_types[ ] = $gv_field->is_numeric; |
|
1262 | 1262 | } |
1263 | 1263 | } |
1264 | 1264 | |
@@ -1408,18 +1408,18 @@ discard block |
||
1408 | 1408 | $final_atts = array_filter( $final_atts ); |
1409 | 1409 | |
1410 | 1410 | // If the href wasn't passed as an attribute, use the value passed to the function |
1411 | - if ( empty( $final_atts['href'] ) && ! empty( $href ) ) { |
|
1412 | - $final_atts['href'] = $href; |
|
1411 | + if ( empty( $final_atts[ 'href' ] ) && ! empty( $href ) ) { |
|
1412 | + $final_atts[ 'href' ] = $href; |
|
1413 | 1413 | } |
1414 | 1414 | |
1415 | - $final_atts['href'] = esc_url_raw( $href ); |
|
1415 | + $final_atts[ 'href' ] = esc_url_raw( $href ); |
|
1416 | 1416 | |
1417 | 1417 | /** |
1418 | 1418 | * Fix potential security issue with target=_blank |
1419 | 1419 | * @see https://dev.to/ben/the-targetblank-vulnerability-by-example |
1420 | 1420 | */ |
1421 | - if( '_blank' === rgar( $final_atts, 'target' ) ) { |
|
1422 | - $final_atts['rel'] = trim( rgar( $final_atts, 'rel', '' ) . ' noopener noreferrer' ); |
|
1421 | + if ( '_blank' === rgar( $final_atts, 'target' ) ) { |
|
1422 | + $final_atts[ 'rel' ] = trim( rgar( $final_atts, 'rel', '' ) . ' noopener noreferrer' ); |
|
1423 | 1423 | } |
1424 | 1424 | |
1425 | 1425 | // Sort the attributes alphabetically, to help testing |
@@ -1431,7 +1431,7 @@ discard block |
||
1431 | 1431 | $output .= sprintf( ' %s="%s"', $attr, esc_attr( $value ) ); |
1432 | 1432 | } |
1433 | 1433 | |
1434 | - if( '' !== $output ) { |
|
1434 | + if ( '' !== $output ) { |
|
1435 | 1435 | $output = '<a' . $output . '>' . $anchor_text . '</a>'; |
1436 | 1436 | } |
1437 | 1437 | |
@@ -1458,7 +1458,7 @@ discard block |
||
1458 | 1458 | if ( is_array( $value ) && isset( $merged[ $key ] ) && is_array( $merged[ $key ] ) ) { |
1459 | 1459 | $merged[ $key ] = self::array_merge_recursive_distinct( $merged[ $key ], $value ); |
1460 | 1460 | } else if ( is_numeric( $key ) && isset( $merged[ $key ] ) ) { |
1461 | - $merged[] = $value; |
|
1461 | + $merged[ ] = $value; |
|
1462 | 1462 | } else { |
1463 | 1463 | $merged[ $key ] = $value; |
1464 | 1464 | } |
@@ -1491,7 +1491,7 @@ discard block |
||
1491 | 1491 | * `$context` is where are we using this information (e.g. change_entry_creator, search_widget ..) |
1492 | 1492 | * @param array $settings Settings array, with `number` key defining the # of users to display |
1493 | 1493 | */ |
1494 | - $get_users_settings = apply_filters( 'gravityview/get_users/'. $context, apply_filters( 'gravityview_change_entry_creator_user_parameters', $get_users_settings ) ); |
|
1494 | + $get_users_settings = apply_filters( 'gravityview/get_users/' . $context, apply_filters( 'gravityview_change_entry_creator_user_parameters', $get_users_settings ) ); |
|
1495 | 1495 | |
1496 | 1496 | return get_users( $get_users_settings ); |
1497 | 1497 | } |
@@ -1506,7 +1506,7 @@ discard block |
||
1506 | 1506 | * @return string |
1507 | 1507 | */ |
1508 | 1508 | public static function generate_notice( $notice, $class = '' ) { |
1509 | - return '<div class="gv-notice '.gravityview_sanitize_html_class( $class ) .'">'. $notice .'</div>'; |
|
1509 | + return '<div class="gv-notice ' . gravityview_sanitize_html_class( $class ) . '">' . $notice . '</div>'; |
|
1510 | 1510 | } |
1511 | 1511 | |
1512 | 1512 | /** |