@@ -31,7 +31,7 @@ |
||
31 | 31 | |
32 | 32 | public function field_options( $field_options, $template_id, $field_id, $context, $input_type, $form_id ) { |
33 | 33 | |
34 | - $this->add_field_support('link_to_post', $field_options ); |
|
34 | + $this->add_field_support( 'link_to_post', $field_options ); |
|
35 | 35 | |
36 | 36 | return $field_options; |
37 | 37 | } |
@@ -60,8 +60,8 @@ discard block |
||
60 | 60 | |
61 | 61 | if ( 'address' === \GV\Utils::get( $search_field, 'type' ) ) { |
62 | 62 | |
63 | - $field_id = intval( floor( $search_field['key'] ) ); |
|
64 | - $input_id = gravityview_get_input_id_from_id( $search_field['key'] ); |
|
63 | + $field_id = intval( floor( $search_field[ 'key' ] ) ); |
|
64 | + $input_id = gravityview_get_input_id_from_id( $search_field[ 'key' ] ); |
|
65 | 65 | $form = GravityView_View::getInstance()->getForm(); |
66 | 66 | |
67 | 67 | /** @var GF_Field_Address $address_field */ |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | $choices = array(); |
71 | 71 | |
72 | 72 | $method_name = 'get_choices_' . self::get_input_type_from_input_id( $input_id ); |
73 | - if( method_exists( $this, $method_name ) ) { |
|
73 | + if ( method_exists( $this, $method_name ) ) { |
|
74 | 74 | /** |
75 | 75 | * @uses GravityView_Field_Address::get_choices_country() |
76 | 76 | * @uses GravityView_Field_Address::get_choices_state() |
@@ -78,12 +78,12 @@ discard block |
||
78 | 78 | $choices = $this->{$method_name}( $address_field, $form ); |
79 | 79 | } |
80 | 80 | |
81 | - if( ! empty( $choices ) ) { |
|
82 | - $search_field['choices'] = $choices; |
|
83 | - $search_field['type'] = \GV\Utils::get( $search_field, 'input'); |
|
81 | + if ( ! empty( $choices ) ) { |
|
82 | + $search_field[ 'choices' ] = $choices; |
|
83 | + $search_field[ 'type' ] = \GV\Utils::get( $search_field, 'input' ); |
|
84 | 84 | } else { |
85 | - $search_field['type'] = 'text'; |
|
86 | - $search_field['input'] = 'input_text'; |
|
85 | + $search_field[ 'type' ] = 'text'; |
|
86 | + $search_field[ 'input' ] = 'input_text'; |
|
87 | 87 | } |
88 | 88 | } |
89 | 89 | } |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | $country_choices = array(); |
110 | 110 | |
111 | 111 | foreach ( $countries as $key => $country ) { |
112 | - $country_choices[] = array( |
|
112 | + $country_choices[ ] = array( |
|
113 | 113 | 'value' => $country, |
114 | 114 | 'text' => $country, |
115 | 115 | ); |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | */ |
135 | 135 | private function get_choices_state( $address_field, $form ) { |
136 | 136 | |
137 | - $address_type = empty( $address_field->addressType ) ? $address_field->get_default_address_type( $form['id'] ) : $address_field->addressType; |
|
137 | + $address_type = empty( $address_field->addressType ) ? $address_field->get_default_address_type( $form[ 'id' ] ) : $address_field->addressType; |
|
138 | 138 | |
139 | 139 | $state_choices = array(); |
140 | 140 | |
@@ -146,8 +146,8 @@ discard block |
||
146 | 146 | $states = GFCommon::get_canadian_provinces(); |
147 | 147 | break; |
148 | 148 | default: |
149 | - $address_types = $address_field->get_address_types( $form['id'] ); |
|
150 | - $states = empty( $address_types[ $address_type ]['states'] ) ? array() : $address_types[ $address_type ]['states']; |
|
149 | + $address_types = $address_field->get_address_types( $form[ 'id' ] ); |
|
150 | + $states = empty( $address_types[ $address_type ][ 'states' ] ) ? array() : $address_types[ $address_type ][ 'states' ]; |
|
151 | 151 | break; |
152 | 152 | } |
153 | 153 | |
@@ -156,19 +156,19 @@ discard block |
||
156 | 156 | $state_subchoices = array(); |
157 | 157 | |
158 | 158 | foreach ( $state as $key => $substate ) { |
159 | - $state_subchoices[] = array( |
|
159 | + $state_subchoices[ ] = array( |
|
160 | 160 | 'value' => is_numeric( $key ) ? $substate : $key, |
161 | 161 | 'text' => $substate, |
162 | 162 | ); |
163 | 163 | } |
164 | 164 | |
165 | - $state_choices[] = array( |
|
165 | + $state_choices[ ] = array( |
|
166 | 166 | 'text' => $key, |
167 | 167 | 'value' => $state_subchoices, |
168 | 168 | ); |
169 | 169 | |
170 | 170 | } else { |
171 | - $state_choices[] = array( |
|
171 | + $state_choices[ ] = array( |
|
172 | 172 | 'value' => is_numeric( $key ) ? $state : $key, |
173 | 173 | 'text' => $state, |
174 | 174 | ); |
@@ -192,13 +192,13 @@ discard block |
||
192 | 192 | // Use the same inputs as the "text" input type allows |
193 | 193 | $text_inputs = \GV\Utils::get( $input_types, 'text' ); |
194 | 194 | |
195 | - $input_types['street'] = $text_inputs; |
|
196 | - $input_types['street2'] = $text_inputs; |
|
197 | - $input_types['city'] = $text_inputs; |
|
195 | + $input_types[ 'street' ] = $text_inputs; |
|
196 | + $input_types[ 'street2' ] = $text_inputs; |
|
197 | + $input_types[ 'city' ] = $text_inputs; |
|
198 | 198 | |
199 | - $input_types['state'] = array( 'select', 'radio', 'link' ) + $text_inputs; |
|
200 | - $input_types['zip'] = array( 'input_text' ); |
|
201 | - $input_types['country'] = array( 'select', 'radio', 'link' ) + $text_inputs; |
|
199 | + $input_types[ 'state' ] = array( 'select', 'radio', 'link' ) + $text_inputs; |
|
200 | + $input_types[ 'zip' ] = array( 'input_text' ); |
|
201 | + $input_types[ 'country' ] = array( 'select', 'radio', 'link' ) + $text_inputs; |
|
202 | 202 | |
203 | 203 | return $input_types; |
204 | 204 | } |
@@ -219,10 +219,10 @@ discard block |
||
219 | 219 | // Is this search field for an input (eg: 4.2) or the whole address field (eg: 4)? |
220 | 220 | $input_id = gravityview_get_input_id_from_id( $field_id ); |
221 | 221 | |
222 | - if( 'address' === $field_type && $input_id ) { |
|
222 | + if ( 'address' === $field_type && $input_id ) { |
|
223 | 223 | |
224 | 224 | // If the input ID matches an expected address input, set to that. Otherwise, keep existing input type. |
225 | - if( $address_field_name = self::get_input_type_from_input_id( $input_id ) ) { |
|
225 | + if ( $address_field_name = self::get_input_type_from_input_id( $input_id ) ) { |
|
226 | 226 | $input_type = $address_field_name; |
227 | 227 | } |
228 | 228 | } |
@@ -271,20 +271,20 @@ discard block |
||
271 | 271 | public function field_options( $field_options, $template_id, $field_id, $context, $input_type, $form_id ) { |
272 | 272 | |
273 | 273 | // If this is NOT the full address field, return default options. |
274 | - if( floor( $field_id ) !== floatval( $field_id ) ) { |
|
274 | + if ( floor( $field_id ) !== floatval( $field_id ) ) { |
|
275 | 275 | return $field_options; |
276 | 276 | } |
277 | 277 | |
278 | - if( 'edit' === $context ) { |
|
278 | + if ( 'edit' === $context ) { |
|
279 | 279 | return $field_options; |
280 | 280 | } |
281 | 281 | |
282 | 282 | $add_options = array(); |
283 | 283 | |
284 | - $add_options['show_map_link'] = array( |
|
284 | + $add_options[ 'show_map_link' ] = array( |
|
285 | 285 | 'type' => 'checkbox', |
286 | 286 | 'label' => __( 'Show Map Link:', 'gravityview' ), |
287 | - 'desc' => __('Display a "Map It" link below the address', 'gravityview'), |
|
287 | + 'desc' => __( 'Display a "Map It" link below the address', 'gravityview' ), |
|
288 | 288 | 'value' => true, |
289 | 289 | 'merge_tags' => false, |
290 | 290 | ); |
@@ -28,9 +28,9 @@ |
||
28 | 28 | public function field_options( $field_options, $template_id, $field_id, $context, $input_type, $form_id ) { |
29 | 29 | |
30 | 30 | // It makes no sense to use this as the link. |
31 | - unset( $field_options['show_as_link'] ); |
|
31 | + unset( $field_options[ 'show_as_link' ] ); |
|
32 | 32 | |
33 | - if( 'edit' === $context ) { |
|
33 | + if ( 'edit' === $context ) { |
|
34 | 34 | return $field_options; |
35 | 35 | } |
36 | 36 |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | |
25 | 25 | function load() { |
26 | 26 | |
27 | - if( !is_admin() ) { |
|
27 | + if ( ! is_admin() ) { |
|
28 | 28 | return; |
29 | 29 | } |
30 | 30 | |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | add_filter( 'gravityview_template_edit_link_options', array( $this, 'edit_link_field_options' ), 10, 5 ); |
39 | 39 | |
40 | 40 | // add tooltips |
41 | - add_filter( 'gravityview/metaboxes/tooltips', array( $this, 'tooltips') ); |
|
41 | + add_filter( 'gravityview/metaboxes/tooltips', array( $this, 'tooltips' ) ); |
|
42 | 42 | |
43 | 43 | // custom fields' options for zone EDIT |
44 | 44 | add_filter( 'gravityview_template_field_options', array( $this, 'field_options' ), 10, 6 ); |
@@ -52,12 +52,12 @@ discard block |
||
52 | 52 | */ |
53 | 53 | function add_default_field( $entry_default_fields, $form = array(), $zone = '' ) { |
54 | 54 | |
55 | - if( $zone !== 'edit' ) { |
|
55 | + if ( $zone !== 'edit' ) { |
|
56 | 56 | |
57 | - $entry_default_fields['edit_link'] = array( |
|
58 | - 'label' => __('Edit Entry', 'gravityview'), |
|
57 | + $entry_default_fields[ 'edit_link' ] = array( |
|
58 | + 'label' => __( 'Edit Entry', 'gravityview' ), |
|
59 | 59 | 'type' => 'edit_link', |
60 | - 'desc' => __('A link to edit the entry. Visible based on View settings.', 'gravityview'), |
|
60 | + 'desc' => __( 'A link to edit the entry. Visible based on View settings.', 'gravityview' ), |
|
61 | 61 | ); |
62 | 62 | |
63 | 63 | } |
@@ -81,12 +81,12 @@ discard block |
||
81 | 81 | $caps = $visibility_caps; |
82 | 82 | |
83 | 83 | // If we're configuring fields in the edit context, we want a limited selection |
84 | - if( $context === 'edit' ) { |
|
84 | + if ( $context === 'edit' ) { |
|
85 | 85 | |
86 | 86 | // Remove other built-in caps. |
87 | - unset( $caps['publish_posts'], $caps['gravityforms_view_entries'], $caps['delete_others_posts'] ); |
|
87 | + unset( $caps[ 'publish_posts' ], $caps[ 'gravityforms_view_entries' ], $caps[ 'delete_others_posts' ] ); |
|
88 | 88 | |
89 | - $caps['read'] = _x('Entry Creator','User capability', 'gravityview'); |
|
89 | + $caps[ 'read' ] = _x( 'Entry Creator', 'User capability', 'gravityview' ); |
|
90 | 90 | } |
91 | 91 | |
92 | 92 | return $caps; |
@@ -104,16 +104,16 @@ discard block |
||
104 | 104 | function edit_link_field_options( $field_options, $template_id, $field_id, $context, $input_type ) { |
105 | 105 | |
106 | 106 | // Always a link, never a filter |
107 | - unset( $field_options['show_as_link'], $field_options['search_filter'] ); |
|
107 | + unset( $field_options[ 'show_as_link' ], $field_options[ 'search_filter' ] ); |
|
108 | 108 | |
109 | 109 | // Edit Entry link should only appear to visitors capable of editing entries |
110 | - unset( $field_options['only_loggedin'], $field_options['only_loggedin_cap'] ); |
|
110 | + unset( $field_options[ 'only_loggedin' ], $field_options[ 'only_loggedin_cap' ] ); |
|
111 | 111 | |
112 | - $add_option['edit_link'] = array( |
|
112 | + $add_option[ 'edit_link' ] = array( |
|
113 | 113 | 'type' => 'text', |
114 | 114 | 'label' => __( 'Edit Link Text', 'gravityview' ), |
115 | 115 | 'desc' => NULL, |
116 | - 'value' => __('Edit Entry', 'gravityview'), |
|
116 | + 'value' => __( 'Edit Entry', 'gravityview' ), |
|
117 | 117 | 'merge_tags' => true, |
118 | 118 | ); |
119 | 119 | |
@@ -129,9 +129,9 @@ discard block |
||
129 | 129 | |
130 | 130 | $return = $tooltips; |
131 | 131 | |
132 | - $return['allow_edit_cap'] = array( |
|
133 | - 'title' => __('Limiting Edit Access', 'gravityview'), |
|
134 | - 'value' => __('Change this setting if you don\'t want the user who created the entry to be able to edit this field.', 'gravityview'), |
|
132 | + $return[ 'allow_edit_cap' ] = array( |
|
133 | + 'title' => __( 'Limiting Edit Access', 'gravityview' ), |
|
134 | + 'value' => __( 'Change this setting if you don\'t want the user who created the entry to be able to edit this field.', 'gravityview' ), |
|
135 | 135 | ); |
136 | 136 | |
137 | 137 | return $return; |
@@ -149,12 +149,12 @@ discard block |
||
149 | 149 | public function field_options( $field_options, $template_id, $field_id, $context, $input_type, $form_id ) { |
150 | 150 | |
151 | 151 | // We only want to modify the settings for the edit context |
152 | - if( 'edit' !== $context ) { |
|
152 | + if ( 'edit' !== $context ) { |
|
153 | 153 | |
154 | 154 | /** |
155 | 155 | * @since 1.8.4 |
156 | 156 | */ |
157 | - $field_options['new_window'] = array( |
|
157 | + $field_options[ 'new_window' ] = array( |
|
158 | 158 | 'type' => 'checkbox', |
159 | 159 | 'label' => __( 'Open link in a new tab or window?', 'gravityview' ), |
160 | 160 | 'value' => false, |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | } |
165 | 165 | |
166 | 166 | // Entry field is only for logged in users |
167 | - unset( $field_options['only_loggedin'], $field_options['only_loggedin_cap'] ); |
|
167 | + unset( $field_options[ 'only_loggedin' ], $field_options[ 'only_loggedin_cap' ] ); |
|
168 | 168 | |
169 | 169 | $add_options = array( |
170 | 170 | 'allow_edit_cap' => array( |
@@ -63,19 +63,19 @@ discard block |
||
63 | 63 | |
64 | 64 | add_shortcode( 'gv_note_add', array( 'GravityView_Field_Notes', 'get_add_note_part' ) ); |
65 | 65 | |
66 | - add_action( 'wp', array( $this, 'maybe_delete_notes'), 1000 ); |
|
67 | - add_action( 'wp_ajax_nopriv_gv_delete_notes', array( $this, 'maybe_delete_notes') ); |
|
68 | - add_action( 'wp_ajax_gv_delete_notes', array( $this, 'maybe_delete_notes') ); |
|
66 | + add_action( 'wp', array( $this, 'maybe_delete_notes' ), 1000 ); |
|
67 | + add_action( 'wp_ajax_nopriv_gv_delete_notes', array( $this, 'maybe_delete_notes' ) ); |
|
68 | + add_action( 'wp_ajax_gv_delete_notes', array( $this, 'maybe_delete_notes' ) ); |
|
69 | 69 | |
70 | - add_action( 'wp', array( $this, 'maybe_add_note'), 1000 ); |
|
71 | - add_action( 'wp_ajax_nopriv_gv_note_add', array( $this, 'maybe_add_note') ); |
|
72 | - add_action( 'wp_ajax_gv_note_add', array( $this, 'maybe_add_note') ); |
|
70 | + add_action( 'wp', array( $this, 'maybe_add_note' ), 1000 ); |
|
71 | + add_action( 'wp_ajax_nopriv_gv_note_add', array( $this, 'maybe_add_note' ) ); |
|
72 | + add_action( 'wp_ajax_gv_note_add', array( $this, 'maybe_add_note' ) ); |
|
73 | 73 | |
74 | 74 | // add template path to check for field |
75 | 75 | add_filter( 'gravityview_template_paths', array( $this, 'add_template_path' ) ); |
76 | 76 | add_filter( 'gravityview/template/fields_template_paths', array( $this, 'add_template_path' ) ); |
77 | 77 | |
78 | - add_action( 'wp_enqueue_scripts', array( $this, 'register_scripts') ); |
|
78 | + add_action( 'wp_enqueue_scripts', array( $this, 'register_scripts' ) ); |
|
79 | 79 | add_action( 'gravityview/field/notes/scripts', array( $this, 'enqueue_scripts' ) ); |
80 | 80 | |
81 | 81 | add_filter( 'gravityview_entry_default_fields', array( $this, 'add_entry_default_field' ), 10, 3 ); |
@@ -97,8 +97,8 @@ discard block |
||
97 | 97 | */ |
98 | 98 | public function add_entry_default_field( $entry_default_fields, $form, $zone ) { |
99 | 99 | |
100 | - if( in_array( $zone, array( 'directory', 'single' ) ) ) { |
|
101 | - $entry_default_fields['notes'] = array( |
|
100 | + if ( in_array( $zone, array( 'directory', 'single' ) ) ) { |
|
101 | + $entry_default_fields[ 'notes' ] = array( |
|
102 | 102 | 'label' => __( 'Entry Notes', 'gravityview' ), |
103 | 103 | 'type' => 'notes', |
104 | 104 | 'desc' => __( 'Display, add, and delete notes for an entry.', 'gravityview' ), |
@@ -131,23 +131,23 @@ discard block |
||
131 | 131 | public function enqueue_scripts() { |
132 | 132 | global $wp_actions; |
133 | 133 | |
134 | - if( ! wp_script_is( 'gravityview-notes', 'enqueued' ) ) { |
|
134 | + if ( ! wp_script_is( 'gravityview-notes', 'enqueued' ) ) { |
|
135 | 135 | wp_enqueue_style( 'gravityview-notes' ); |
136 | 136 | wp_enqueue_script( 'gravityview-notes' ); |
137 | 137 | } |
138 | 138 | |
139 | - if( ! wp_script_is( 'gravityview-notes', 'done' ) ) { |
|
139 | + if ( ! wp_script_is( 'gravityview-notes', 'done' ) ) { |
|
140 | 140 | |
141 | 141 | $strings = self::strings(); |
142 | 142 | |
143 | 143 | wp_localize_script( 'gravityview-notes', 'GVNotes', array( |
144 | 144 | 'ajaxurl' => admin_url( 'admin-ajax.php' ), |
145 | 145 | 'text' => array( |
146 | - 'processing' => $strings['processing'], |
|
147 | - 'delete_confirm' => $strings['delete-confirm'], |
|
148 | - 'note_added' => $strings['added-note'], |
|
149 | - 'error_invalid' => $strings['error-invalid'], |
|
150 | - 'error_empty_note' => $strings['error-empty-note'], |
|
146 | + 'processing' => $strings[ 'processing' ], |
|
147 | + 'delete_confirm' => $strings[ 'delete-confirm' ], |
|
148 | + 'note_added' => $strings[ 'added-note' ], |
|
149 | + 'error_invalid' => $strings[ 'error-invalid' ], |
|
150 | + 'error_empty_note' => $strings[ 'error-empty-note' ], |
|
151 | 151 | ), |
152 | 152 | ) ); |
153 | 153 | } |
@@ -164,31 +164,31 @@ discard block |
||
164 | 164 | */ |
165 | 165 | function maybe_add_note() { |
166 | 166 | |
167 | - if( ! GVCommon::has_cap( 'gravityview_add_entry_notes' ) ) { |
|
167 | + if ( ! GVCommon::has_cap( 'gravityview_add_entry_notes' ) ) { |
|
168 | 168 | gravityview()->log->error( 'The user isnt allowed to add entry notes.' ); |
169 | 169 | return; |
170 | 170 | } |
171 | 171 | |
172 | - if( ! isset( $_POST['action'] ) ) { |
|
172 | + if ( ! isset( $_POST[ 'action' ] ) ) { |
|
173 | 173 | return; |
174 | 174 | } |
175 | 175 | |
176 | - if( 'gv_note_add' === $_POST['action'] ) { |
|
176 | + if ( 'gv_note_add' === $_POST[ 'action' ] ) { |
|
177 | 177 | |
178 | - if( ! GVCommon::has_cap( 'gravityview_add_entry_notes' ) ) { |
|
178 | + if ( ! GVCommon::has_cap( 'gravityview_add_entry_notes' ) ) { |
|
179 | 179 | do_action( 'gravityview_log_error', __METHOD__ . ': The user isnt allowed to add entry notes.' ); |
180 | 180 | return; |
181 | 181 | } |
182 | 182 | |
183 | 183 | $post = wp_unslash( $_POST ); |
184 | 184 | |
185 | - if( $this->doing_ajax ) { |
|
186 | - parse_str( $post['data'], $data ); |
|
185 | + if ( $this->doing_ajax ) { |
|
186 | + parse_str( $post[ 'data' ], $data ); |
|
187 | 187 | } else { |
188 | 188 | $data = $post; |
189 | 189 | } |
190 | 190 | |
191 | - $this->process_add_note( (array) $data ); |
|
191 | + $this->process_add_note( (array)$data ); |
|
192 | 192 | } |
193 | 193 | } |
194 | 194 | |
@@ -215,23 +215,23 @@ discard block |
||
215 | 215 | $error = false; |
216 | 216 | $success = false; |
217 | 217 | |
218 | - if( empty( $data['entry-slug'] ) ) { |
|
218 | + if ( empty( $data[ 'entry-slug' ] ) ) { |
|
219 | 219 | |
220 | - $error = self::strings('error-invalid'); |
|
220 | + $error = self::strings( 'error-invalid' ); |
|
221 | 221 | gravityview()->log->error( 'The note is missing an Entry ID.' ); |
222 | 222 | |
223 | 223 | } else { |
224 | 224 | |
225 | - $valid = wp_verify_nonce( $data['gv_note_add'], 'gv_note_add_' . $data['entry-slug'] ); |
|
225 | + $valid = wp_verify_nonce( $data[ 'gv_note_add' ], 'gv_note_add_' . $data[ 'entry-slug' ] ); |
|
226 | 226 | |
227 | 227 | $has_cap = GVCommon::has_cap( 'gravityview_add_entry_notes' ); |
228 | 228 | |
229 | - if( ! $has_cap ) { |
|
229 | + if ( ! $has_cap ) { |
|
230 | 230 | $error = self::strings( 'error-cap-add' ); |
231 | 231 | gravityview()->log->error( 'Adding a note failed: the user does not have the "gravityview_add_entry_notes" capability.' ); |
232 | 232 | } elseif ( $valid ) { |
233 | 233 | |
234 | - $entry = gravityview_get_entry( $data['entry-slug'], true, false ); |
|
234 | + $entry = gravityview_get_entry( $data[ 'entry-slug' ], true, false ); |
|
235 | 235 | |
236 | 236 | $added = $this->add_note( $entry, $data ); |
237 | 237 | |
@@ -249,22 +249,22 @@ discard block |
||
249 | 249 | $this->maybe_send_entry_notes( $note, $entry, $data ); |
250 | 250 | |
251 | 251 | if ( $note ) { |
252 | - $success = self::display_note( $note, ! empty( $data['show-delete'] ) ); |
|
252 | + $success = self::display_note( $note, ! empty( $data[ 'show-delete' ] ) ); |
|
253 | 253 | gravityview()->log->debug( 'The note was successfully created', array( 'data' => compact( 'note', 'data' ) ) ); |
254 | 254 | } else { |
255 | - $error = self::strings('error-add-note'); |
|
255 | + $error = self::strings( 'error-add-note' ); |
|
256 | 256 | gravityview()->log->error( 'The note was not successfully created', array( 'data' => compact( 'note', 'data' ) ) ); |
257 | 257 | } |
258 | 258 | } |
259 | 259 | } else { |
260 | - $error = self::strings('error-invalid'); |
|
260 | + $error = self::strings( 'error-invalid' ); |
|
261 | 261 | gravityview()->log->error( 'Nonce validation failed; the note was not created' ); |
262 | 262 | } |
263 | 263 | } |
264 | 264 | |
265 | 265 | |
266 | - if( $this->doing_ajax ) { |
|
267 | - if( $success ) { |
|
266 | + if ( $this->doing_ajax ) { |
|
267 | + if ( $success ) { |
|
268 | 268 | wp_send_json_success( array( 'html' => $success ) ); |
269 | 269 | } else { |
270 | 270 | $error = $error ? $error : self::strings( 'error-invalid' ); |
@@ -290,11 +290,11 @@ discard block |
||
290 | 290 | return; |
291 | 291 | } |
292 | 292 | |
293 | - if ( isset( $_POST['action'] ) && 'gv_delete_notes' === $_POST['action'] ) { |
|
293 | + if ( isset( $_POST[ 'action' ] ) && 'gv_delete_notes' === $_POST[ 'action' ] ) { |
|
294 | 294 | |
295 | 295 | $post = wp_unslash( $_POST ); |
296 | 296 | if ( $this->doing_ajax ) { |
297 | - parse_str( $post['data'], $data ); |
|
297 | + parse_str( $post[ 'data' ], $data ); |
|
298 | 298 | } else { |
299 | 299 | $data = $post; |
300 | 300 | } |
@@ -325,18 +325,18 @@ discard block |
||
325 | 325 | */ |
326 | 326 | function process_delete_notes( $data ) { |
327 | 327 | |
328 | - $valid = wp_verify_nonce( $data['gv_delete_notes'], 'gv_delete_notes_' . $data['entry-slug'] ); |
|
328 | + $valid = wp_verify_nonce( $data[ 'gv_delete_notes' ], 'gv_delete_notes_' . $data[ 'entry-slug' ] ); |
|
329 | 329 | $has_cap = GVCommon::has_cap( 'gravityview_delete_entry_notes' ); |
330 | 330 | $success = false; |
331 | 331 | |
332 | 332 | if ( $valid && $has_cap ) { |
333 | - GravityView_Entry_Notes::delete_notes( $data['note'] ); |
|
333 | + GravityView_Entry_Notes::delete_notes( $data[ 'note' ] ); |
|
334 | 334 | $success = true; |
335 | 335 | } |
336 | 336 | |
337 | - if( $this->doing_ajax ) { |
|
337 | + if ( $this->doing_ajax ) { |
|
338 | 338 | |
339 | - if( $success ) { |
|
339 | + if ( $success ) { |
|
340 | 340 | wp_send_json_success(); |
341 | 341 | } else { |
342 | 342 | if ( ! $valid ) { |
@@ -369,13 +369,13 @@ discard block |
||
369 | 369 | |
370 | 370 | public function field_options( $field_options, $template_id, $field_id, $context, $input_type, $form_id ) { |
371 | 371 | |
372 | - unset( $field_options['show_as_link'] ); |
|
372 | + unset( $field_options[ 'show_as_link' ] ); |
|
373 | 373 | |
374 | 374 | $notes_options = array( |
375 | 375 | 'notes' => array( |
376 | 376 | 'type' => 'checkboxes', |
377 | - 'label' => __('Note Settings', 'gravityview'), |
|
378 | - 'desc' => sprintf( _x('Only users with specific capabilities will be able to view, add and delete notes. %sRead more%s.', '%s is opening and closing HTML link', 'gravityview' ), '<a href="https://docs.gravityview.co/article/311-gravityview-capabilities">', '</a>' ), |
|
377 | + 'label' => __( 'Note Settings', 'gravityview' ), |
|
378 | + 'desc' => sprintf( _x( 'Only users with specific capabilities will be able to view, add and delete notes. %sRead more%s.', '%s is opening and closing HTML link', 'gravityview' ), '<a href="https://docs.gravityview.co/article/311-gravityview-capabilities">', '</a>' ), |
|
379 | 379 | 'options' => array( |
380 | 380 | 'view' => array( |
381 | 381 | 'label' => __( 'Display notes?', 'gravityview' ), |
@@ -427,7 +427,7 @@ discard block |
||
427 | 427 | 'processing' => __( 'Processing…', 'gravityview' ), |
428 | 428 | 'other-email' => __( 'Other email address', 'gravityview' ), |
429 | 429 | 'email-label' => __( 'Email address', 'gravityview' ), |
430 | - 'email-placeholder' => _x('[email protected]', 'Example email address used as a placeholder', 'gravityview'), |
|
430 | + 'email-placeholder' => _x( '[email protected]', 'Example email address used as a placeholder', 'gravityview' ), |
|
431 | 431 | 'subject-label' => __( 'Subject', 'gravityview' ), |
432 | 432 | 'subject' => __( 'Email subject', 'gravityview' ), |
433 | 433 | 'default-email-subject' => __( 'New entry note', 'gravityview' ), |
@@ -447,7 +447,7 @@ discard block |
||
447 | 447 | */ |
448 | 448 | $strings = gv_map_deep( apply_filters( 'gravityview/field/notes/strings', $strings ), 'esc_html' ); |
449 | 449 | |
450 | - if( $key ) { |
|
450 | + if ( $key ) { |
|
451 | 451 | return isset( $strings[ $key ] ) ? $strings[ $key ] : ''; |
452 | 452 | } |
453 | 453 | |
@@ -469,7 +469,7 @@ discard block |
||
469 | 469 | */ |
470 | 470 | static public function display_note( $note, $show_delete = false, $context = null ) { |
471 | 471 | |
472 | - if( ! is_object( $note ) ) { |
|
472 | + if ( ! is_object( $note ) ) { |
|
473 | 473 | return ''; |
474 | 474 | } |
475 | 475 | |
@@ -524,7 +524,7 @@ discard block |
||
524 | 524 | } |
525 | 525 | |
526 | 526 | $replacements = array( |
527 | - '{note_id}' => $note_content['note_id'], |
|
527 | + '{note_id}' => $note_content[ 'note_id' ], |
|
528 | 528 | '{row_class}' => 'gv-note', |
529 | 529 | '{note_detail}' => $note_detail_html |
530 | 530 | ); |
@@ -556,13 +556,13 @@ discard block |
||
556 | 556 | |
557 | 557 | $user_data = get_userdata( $current_user->ID ); |
558 | 558 | |
559 | - $note_content = trim( $data['gv-note-content'] ); |
|
559 | + $note_content = trim( $data[ 'gv-note-content' ] ); |
|
560 | 560 | |
561 | - if( empty( $note_content ) ) { |
|
561 | + if ( empty( $note_content ) ) { |
|
562 | 562 | return new WP_Error( 'gv-add-note-empty', __( 'The note is empty.', 'gravityview' ) ); |
563 | 563 | } |
564 | 564 | |
565 | - $return = GravityView_Entry_Notes::add_note( $entry['id'], $user_data->ID, $user_data->display_name, $note_content, 'gravityview/field/notes' ); |
|
565 | + $return = GravityView_Entry_Notes::add_note( $entry[ 'id' ], $user_data->ID, $user_data->display_name, $note_content, 'gravityview/field/notes' ); |
|
566 | 566 | |
567 | 567 | return $return; |
568 | 568 | } |
@@ -582,7 +582,7 @@ discard block |
||
582 | 582 | |
583 | 583 | $atts = shortcode_atts( array( 'entry' => null ), $atts ); |
584 | 584 | |
585 | - if( ! GVCommon::has_cap( 'gravityview_add_entry_notes' ) ) { |
|
585 | + if ( ! GVCommon::has_cap( 'gravityview_add_entry_notes' ) ) { |
|
586 | 586 | gravityview()->log->error( 'User does not have permission to add entry notes ("gravityview_add_entry_notes").' ); |
587 | 587 | return ''; |
588 | 588 | } |
@@ -604,8 +604,8 @@ discard block |
||
604 | 604 | |
605 | 605 | $visibility_settings = $gravityview_view->getCurrentFieldSetting( 'notes' ); |
606 | 606 | |
607 | - if ( $atts['entry'] ) { |
|
608 | - $entry = GFAPI::get_entry( $atts['entry'] ); |
|
607 | + if ( $atts[ 'entry' ] ) { |
|
608 | + $entry = GFAPI::get_entry( $atts[ 'entry' ] ); |
|
609 | 609 | } |
610 | 610 | |
611 | 611 | if ( ! isset( $entry ) || ! $entry ) { |
@@ -615,19 +615,19 @@ discard block |
||
615 | 615 | |
616 | 616 | // Strip extra whitespace in template |
617 | 617 | $add_note_html = gravityview_strip_whitespace( $add_note_html ); |
618 | - $entry_slug = GravityView_API::get_entry_slug( $entry['id'], $entry ); |
|
618 | + $entry_slug = GravityView_API::get_entry_slug( $entry[ 'id' ], $entry ); |
|
619 | 619 | $nonce_field = wp_nonce_field( 'gv_note_add_' . $entry_slug, 'gv_note_add', false, false ); |
620 | 620 | |
621 | 621 | // Only generate the dropdown if the field settings allow it |
622 | 622 | $email_fields = ''; |
623 | - if( ! empty( $visibility_settings['email'] ) ) { |
|
623 | + if ( ! empty( $visibility_settings[ 'email' ] ) ) { |
|
624 | 624 | $email_fields = self::get_note_email_fields( $entry_slug ); |
625 | 625 | } |
626 | 626 | |
627 | 627 | $add_note_html = str_replace( '{entry_slug}', $entry_slug, $add_note_html ); |
628 | 628 | $add_note_html = str_replace( '{nonce_field}', $nonce_field, $add_note_html ); |
629 | - $add_note_html = str_replace( '{show_delete}', intval( empty( $visibility_settings['delete'] ) ? 0 : $visibility_settings['delete'] ), $add_note_html ); |
|
630 | - $add_note_html = str_replace( '{email_fields}', $email_fields, $add_note_html ); |
|
629 | + $add_note_html = str_replace( '{show_delete}', intval( empty( $visibility_settings[ 'delete' ] ) ? 0 : $visibility_settings[ 'delete' ] ), $add_note_html ); |
|
630 | + $add_note_html = str_replace( '{email_fields}', $email_fields, $add_note_html ); |
|
631 | 631 | $add_note_html = str_replace( '{url}', esc_url_raw( add_query_arg( array() ) ), $add_note_html ); |
632 | 632 | |
633 | 633 | return $add_note_html; |
@@ -652,8 +652,8 @@ discard block |
||
652 | 652 | $note_emails = array(); |
653 | 653 | |
654 | 654 | foreach ( $email_fields as $email_field ) { |
655 | - if ( ! empty( $entry["{$email_field->id}"] ) && is_email( $entry["{$email_field->id}"] ) ) { |
|
656 | - $note_emails[] = $entry["{$email_field->id}"]; |
|
655 | + if ( ! empty( $entry[ "{$email_field->id}" ] ) && is_email( $entry[ "{$email_field->id}" ] ) ) { |
|
656 | + $note_emails[ ] = $entry[ "{$email_field->id}" ]; |
|
657 | 657 | } |
658 | 658 | } |
659 | 659 | |
@@ -665,7 +665,7 @@ discard block |
||
665 | 665 | */ |
666 | 666 | $note_emails = apply_filters( 'gravityview/field/notes/emails', $note_emails, $entry ); |
667 | 667 | |
668 | - return (array) $note_emails; |
|
668 | + return (array)$note_emails; |
|
669 | 669 | } |
670 | 670 | |
671 | 671 | /** |
@@ -681,7 +681,7 @@ discard block |
||
681 | 681 | */ |
682 | 682 | private static function get_note_email_fields( $entry_slug = '' ) { |
683 | 683 | |
684 | - if( ! GVCommon::has_cap( 'gravityview_email_entry_notes' ) ) { |
|
684 | + if ( ! GVCommon::has_cap( 'gravityview_email_entry_notes' ) ) { |
|
685 | 685 | gravityview()->log->error( 'User does not have permission to email entry notes ("gravityview_email_entry_notes").' ); |
686 | 686 | return ''; |
687 | 687 | } |
@@ -703,27 +703,27 @@ discard block |
||
703 | 703 | |
704 | 704 | if ( ! empty( $note_emails ) || $include_custom ) { ?> |
705 | 705 | <div class="gv-note-email-container"> |
706 | - <label for="gv-note-email-to-<?php echo $entry_slug_esc; ?>" class="screen-reader-text"><?php echo $strings['also-email']; ?></label> |
|
706 | + <label for="gv-note-email-to-<?php echo $entry_slug_esc; ?>" class="screen-reader-text"><?php echo $strings[ 'also-email' ]; ?></label> |
|
707 | 707 | <select class="gv-note-email-to" name="gv-note-to" id="gv-note-email-to-<?php echo $entry_slug_esc; ?>"> |
708 | - <option value=""><?php echo $strings['also-email']; ?></option> |
|
708 | + <option value=""><?php echo $strings[ 'also-email' ]; ?></option> |
|
709 | 709 | <?php foreach ( $note_emails as $email ) { |
710 | 710 | ?> |
711 | 711 | <option value="<?php echo esc_attr( $email ); ?>"><?php echo esc_html( $email ); ?></option> |
712 | 712 | <?php } |
713 | - if( $include_custom ) { ?> |
|
714 | - <option value="custom"><?php echo self::strings('other-email'); ?></option> |
|
713 | + if ( $include_custom ) { ?> |
|
714 | + <option value="custom"><?php echo self::strings( 'other-email' ); ?></option> |
|
715 | 715 | <?php } ?> |
716 | 716 | </select> |
717 | 717 | <fieldset class="gv-note-to-container"> |
718 | - <?php if( $include_custom ) { ?> |
|
718 | + <?php if ( $include_custom ) { ?> |
|
719 | 719 | <div class='gv-note-to-custom-container'> |
720 | - <label for="gv-note-email-to-custom-<?php echo $entry_slug_esc; ?>"><?php echo $strings['email-label']; ?></label> |
|
721 | - <input type="text" name="gv-note-to-custom" placeholder="<?php echo $strings['email-placeholder']; ?>" id="gv-note-to-custom-<?php echo $entry_slug_esc; ?>" value="" /> |
|
720 | + <label for="gv-note-email-to-custom-<?php echo $entry_slug_esc; ?>"><?php echo $strings[ 'email-label' ]; ?></label> |
|
721 | + <input type="text" name="gv-note-to-custom" placeholder="<?php echo $strings[ 'email-placeholder' ]; ?>" id="gv-note-to-custom-<?php echo $entry_slug_esc; ?>" value="" /> |
|
722 | 722 | </div> |
723 | 723 | <?php } ?> |
724 | 724 | <div class='gv-note-subject-container'> |
725 | - <label for="gv-note-subject-<?php echo $entry_slug_esc; ?>"><?php echo $strings['subject-label']; ?></label> |
|
726 | - <input type="text" name="gv-note-subject" placeholder="<?php echo $strings['subject']; ?>" id="gv-note-subject-<?php echo $entry_slug_esc; ?>" value="" /> |
|
725 | + <label for="gv-note-subject-<?php echo $entry_slug_esc; ?>"><?php echo $strings[ 'subject-label' ]; ?></label> |
|
726 | + <input type="text" name="gv-note-subject" placeholder="<?php echo $strings[ 'subject' ]; ?>" id="gv-note-subject-<?php echo $entry_slug_esc; ?>" value="" /> |
|
727 | 727 | </div> |
728 | 728 | </fieldset> |
729 | 729 | </div> |
@@ -746,7 +746,7 @@ discard block |
||
746 | 746 | */ |
747 | 747 | private function maybe_send_entry_notes( $note = false, $entry, $data ) { |
748 | 748 | |
749 | - if( ! $note || ! GVCommon::has_cap('gravityview_email_entry_notes') ) { |
|
749 | + if ( ! $note || ! GVCommon::has_cap( 'gravityview_email_entry_notes' ) ) { |
|
750 | 750 | gravityview()->log->debug( 'User doesn\'t have "gravityview_email_entry_notes" cap, or $note is empty', array( 'data' => $note ) ); |
751 | 751 | return; |
752 | 752 | } |
@@ -754,7 +754,7 @@ discard block |
||
754 | 754 | gravityview()->log->debug( '$data', array( 'data' => $data ) ); |
755 | 755 | |
756 | 756 | //emailing notes if configured |
757 | - if ( ! empty( $data['gv-note-to'] ) ) { |
|
757 | + if ( ! empty( $data[ 'gv-note-to' ] ) ) { |
|
758 | 758 | |
759 | 759 | $default_data = array( |
760 | 760 | 'gv-note-to' => '', |
@@ -764,11 +764,11 @@ discard block |
||
764 | 764 | 'current-url' => '', |
765 | 765 | ); |
766 | 766 | |
767 | - $current_user = wp_get_current_user(); |
|
767 | + $current_user = wp_get_current_user(); |
|
768 | 768 | $email_data = wp_parse_args( $data, $default_data ); |
769 | 769 | |
770 | - $from = $current_user->user_email; |
|
771 | - $to = $email_data['gv-note-to']; |
|
770 | + $from = $current_user->user_email; |
|
771 | + $to = $email_data[ 'gv-note-to' ]; |
|
772 | 772 | |
773 | 773 | /** |
774 | 774 | * Documented in get_note_email_fields |
@@ -776,8 +776,8 @@ discard block |
||
776 | 776 | */ |
777 | 777 | $include_custom = apply_filters( 'gravityview/field/notes/custom-email', true ); |
778 | 778 | |
779 | - if( 'custom' === $to && $include_custom ) { |
|
780 | - $to = $email_data['gv-note-to-custom']; |
|
779 | + if ( 'custom' === $to && $include_custom ) { |
|
780 | + $to = $email_data[ 'gv-note-to-custom' ]; |
|
781 | 781 | gravityview()->log->debug( 'Sending note to a custom email address: {to}' . array( 'to' => $to ) ); |
782 | 782 | } |
783 | 783 | |
@@ -788,13 +788,13 @@ discard block |
||
788 | 788 | |
789 | 789 | $bcc = false; |
790 | 790 | $reply_to = $from; |
791 | - $subject = trim( $email_data['gv-note-subject'] ); |
|
791 | + $subject = trim( $email_data[ 'gv-note-subject' ] ); |
|
792 | 792 | |
793 | 793 | // We use empty() here because GF uses empty to check against, too. `0` isn't a valid subject to GF |
794 | 794 | $subject = empty( $subject ) ? self::strings( 'default-email-subject' ) : $subject; |
795 | - $message = $email_data['gv-note-content']; |
|
795 | + $message = $email_data[ 'gv-note-content' ]; |
|
796 | 796 | $email_footer = self::strings( 'email-footer' ); |
797 | - $from_name = $current_user->display_name; |
|
797 | + $from_name = $current_user->display_name; |
|
798 | 798 | $message_format = 'html'; |
799 | 799 | |
800 | 800 | /** |
@@ -825,7 +825,7 @@ discard block |
||
825 | 825 | |
826 | 826 | GVCommon::send_email( $from, $to, $bcc, $reply_to, $subject, $message, $from_name, $message_format, '', $entry, false ); |
827 | 827 | |
828 | - $form = isset( $entry['form_id'] ) ? GFAPI::get_form( $entry['form_id'] ) : array(); |
|
828 | + $form = isset( $entry[ 'form_id' ] ) ? GFAPI::get_form( $entry[ 'form_id' ] ) : array(); |
|
829 | 829 | |
830 | 830 | /** |
831 | 831 | * @see https://www.gravityhelp.com/documentation/article/10146-2/ It's here for compatibility with Gravity Forms |
@@ -851,7 +851,7 @@ discard block |
||
851 | 851 | |
852 | 852 | $output = ''; |
853 | 853 | |
854 | - if( ! empty( $email_footer ) ) { |
|
854 | + if ( ! empty( $email_footer ) ) { |
|
855 | 855 | $url = \GV\Utils::get( $email_data, 'current-url' ); |
856 | 856 | $url = html_entity_decode( $url ); |
857 | 857 | $url = site_url( $url ); |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | |
23 | 23 | public function field_options( $field_options, $template_id, $field_id, $context, $input_type, $form_id ) { |
24 | 24 | |
25 | - unset( $field_options['search_filter'] ); |
|
25 | + unset( $field_options[ 'search_filter' ] ); |
|
26 | 26 | |
27 | 27 | if ( 'edit' === $context ) { |
28 | 28 | return $field_options; |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | $add_options = array(); |
34 | 34 | |
35 | 35 | if ( $field->field->inputType === 'likert' && $field->field->gsurveyLikertEnableScoring ) { |
36 | - $add_options['score'] = array( |
|
36 | + $add_options[ 'score' ] = array( |
|
37 | 37 | 'type' => 'checkbox', |
38 | 38 | 'label' => __( 'Show score', 'gravityview' ), |
39 | 39 | 'desc' => __( 'Display likert score as a simple number.', 'gravityview' ), |
@@ -41,7 +41,7 @@ |
||
41 | 41 | * @return string If Gravity Flow not found, or entry not processed yet, returns initial value. Otherwise, returns name of workflow step. |
42 | 42 | */ |
43 | 43 | function modify_entry_value_workflow_current_status_timestamp( $output, $entry, $field_settings, $field ) { |
44 | - $timestamp = gform_get_meta( $entry['id'], 'workflow_current_status_timestamp' ); |
|
44 | + $timestamp = gform_get_meta( $entry[ 'id' ], 'workflow_current_status_timestamp' ); |
|
45 | 45 | |
46 | 46 | if ( ! $timestamp ) { |
47 | 47 | return $timestamp; |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | |
34 | 34 | parent::add_hooks(); |
35 | 35 | |
36 | - add_filter( 'gravityview/search/searchable_fields', array( $this, 'modify_search_bar_fields_dropdown'), 10, 2 ); |
|
36 | + add_filter( 'gravityview/search/searchable_fields', array( $this, 'modify_search_bar_fields_dropdown' ), 10, 2 ); |
|
37 | 37 | |
38 | 38 | add_filter( 'gravityview/admin/available_fields', array( $this, 'maybe_add_non_default_fields' ), 10, 3 ); |
39 | 39 | |
@@ -55,13 +55,13 @@ discard block |
||
55 | 55 | */ |
56 | 56 | public static function get_status_options( $form_id = 0, $status_key = 'workflow_final_status' ) { |
57 | 57 | |
58 | - if( empty( $form_id ) ) { |
|
58 | + if ( empty( $form_id ) ) { |
|
59 | 59 | $form_id = GravityView_View::getInstance()->getFormId(); |
60 | 60 | } |
61 | 61 | |
62 | 62 | $entry_meta = gravity_flow()->get_entry_meta( array(), $form_id ); |
63 | 63 | |
64 | - return (array) \GV\Utils::get( $entry_meta, $status_key . '/filter/choices' ); |
|
64 | + return (array)\GV\Utils::get( $entry_meta, $status_key . '/filter/choices' ); |
|
65 | 65 | } |
66 | 66 | |
67 | 67 | |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | |
84 | 84 | $workflow_steps = $GFlow->get_steps(); |
85 | 85 | |
86 | - if( $workflow_steps ) { |
|
86 | + if ( $workflow_steps ) { |
|
87 | 87 | |
88 | 88 | foreach ( $workflow_steps as $step ) { |
89 | 89 | |
@@ -95,12 +95,12 @@ discard block |
||
95 | 95 | ); |
96 | 96 | } |
97 | 97 | |
98 | - $fields['workflow_step'] = array( |
|
98 | + $fields[ 'workflow_step' ] = array( |
|
99 | 99 | 'label' => esc_html__( 'Workflow Step', 'gravityview' ), |
100 | 100 | 'type' => 'select', |
101 | 101 | ); |
102 | 102 | |
103 | - $fields['workflow_final_status'] = array( |
|
103 | + $fields[ 'workflow_final_status' ] = array( |
|
104 | 104 | 'label' => esc_html__( 'Workflow Status', 'gravityview' ), |
105 | 105 | 'type' => 'select', |
106 | 106 | ); |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | if ( ( $insert_at = array_search( 'workflow_final_status', wp_list_pluck( $fields, 'key' ) ) ) !== false ) { |
117 | 117 | $fields_end = array_splice( $fields, $insert_at + 1 ); |
118 | 118 | |
119 | - $fields[] = array( |
|
119 | + $fields[ ] = array( |
|
120 | 120 | 'text' => __( 'Workflow Current Status Timestamp', 'gravityview' ), |
121 | 121 | 'operators' => array( '>', '<' ), |
122 | 122 | 'placeholder' => 'yyyy-mm-dd', |
@@ -142,8 +142,8 @@ discard block |
||
142 | 142 | $keys_end = array_splice( $keys, $insert_at + 1 ); |
143 | 143 | $values_end = array_splice( $values, $insert_at + 1 ); |
144 | 144 | |
145 | - $keys[] = 'workflow_current_status_timestamp'; |
|
146 | - $values[] = array( |
|
145 | + $keys[ ] = 'workflow_current_status_timestamp'; |
|
146 | + $values[ ] = array( |
|
147 | 147 | 'label' => __( 'Workflow Current Status Timestamp', 'gravityview' ), |
148 | 148 | 'type' => 'workflow_current_status_timestamp', |
149 | 149 | ); |
@@ -125,8 +125,8 @@ discard block |
||
125 | 125 | |
126 | 126 | $form = false; |
127 | 127 | |
128 | - if( $entry ) { |
|
129 | - $form = GFAPI::get_form( $entry['form_id'] ); |
|
128 | + if ( $entry ) { |
|
129 | + $form = GFAPI::get_form( $entry[ 'form_id' ] ); |
|
130 | 130 | } |
131 | 131 | |
132 | 132 | return $form; |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | } |
203 | 203 | } |
204 | 204 | |
205 | - return (bool) $has_transaction_data; |
|
205 | + return (bool)$has_transaction_data; |
|
206 | 206 | } |
207 | 207 | |
208 | 208 | /** |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | |
241 | 241 | $results = GFAPI::get_entries( intval( $form_id ), $search_criteria, null, $paging ); |
242 | 242 | |
243 | - $result = ( ! empty( $results ) && ! empty( $results[0]['id'] ) ) ? $results[0]['id'] : null; |
|
243 | + $result = ( ! empty( $results ) && ! empty( $results[ 0 ][ 'id' ] ) ) ? $results[ 0 ][ 'id' ] : null; |
|
244 | 244 | |
245 | 245 | return $result; |
246 | 246 | } |
@@ -257,10 +257,10 @@ discard block |
||
257 | 257 | * |
258 | 258 | * @return array Empty array if GFAPI class isn't available or no forms. Otherwise, the array of Forms |
259 | 259 | */ |
260 | - public static function get_forms( $active = true, $trash = false ) { |
|
260 | + public static function get_forms( $active = true, $trash = false ) { |
|
261 | 261 | $forms = array(); |
262 | 262 | if ( class_exists( 'GFAPI' ) ) { |
263 | - if( 'any' === $active ) { |
|
263 | + if ( 'any' === $active ) { |
|
264 | 264 | $active_forms = GFAPI::get_forms( true, $trash ); |
265 | 265 | $inactive_forms = GFAPI::get_forms( false, $trash ); |
266 | 266 | $forms = array_merge( array_filter( $active_forms ), array_filter( $inactive_forms ) ); |
@@ -291,9 +291,9 @@ discard block |
||
291 | 291 | $has_post_fields = false; |
292 | 292 | |
293 | 293 | if ( $form ) { |
294 | - foreach ( $form['fields'] as $field ) { |
|
295 | - if ( $include_parent_field || empty( $field['inputs'] ) ) { |
|
296 | - $fields["{$field['id']}"] = array( |
|
294 | + foreach ( $form[ 'fields' ] as $field ) { |
|
295 | + if ( $include_parent_field || empty( $field[ 'inputs' ] ) ) { |
|
296 | + $fields[ "{$field[ 'id' ]}" ] = array( |
|
297 | 297 | 'label' => \GV\Utils::get( $field, 'label' ), |
298 | 298 | 'parent' => null, |
299 | 299 | 'type' => \GV\Utils::get( $field, 'type' ), |
@@ -302,10 +302,10 @@ discard block |
||
302 | 302 | ); |
303 | 303 | } |
304 | 304 | |
305 | - if ( $add_default_properties && ! empty( $field['inputs'] ) ) { |
|
306 | - foreach ( $field['inputs'] as $input ) { |
|
305 | + if ( $add_default_properties && ! empty( $field[ 'inputs' ] ) ) { |
|
306 | + foreach ( $field[ 'inputs' ] as $input ) { |
|
307 | 307 | |
308 | - if( ! empty( $input['isHidden'] ) ) { |
|
308 | + if ( ! empty( $input[ 'isHidden' ] ) ) { |
|
309 | 309 | continue; |
310 | 310 | } |
311 | 311 | |
@@ -313,10 +313,10 @@ discard block |
||
313 | 313 | * @hack |
314 | 314 | * In case of email/email confirmation, the input for email has the same id as the parent field |
315 | 315 | */ |
316 | - if( 'email' === $field['type'] && false === strpos( $input['id'], '.' ) ) { |
|
316 | + if ( 'email' === $field[ 'type' ] && false === strpos( $input[ 'id' ], '.' ) ) { |
|
317 | 317 | continue; |
318 | 318 | } |
319 | - $fields["{$input['id']}"] = array( |
|
319 | + $fields[ "{$input[ 'id' ]}" ] = array( |
|
320 | 320 | 'label' => \GV\Utils::get( $input, 'label' ), |
321 | 321 | 'customLabel' => \GV\Utils::get( $input, 'customLabel' ), |
322 | 322 | 'parent' => $field, |
@@ -328,7 +328,7 @@ discard block |
||
328 | 328 | } |
329 | 329 | |
330 | 330 | |
331 | - if( GFCommon::is_product_field( $field['type'] ) ){ |
|
331 | + if ( GFCommon::is_product_field( $field[ 'type' ] ) ) { |
|
332 | 332 | $has_product_fields = true; |
333 | 333 | } |
334 | 334 | |
@@ -342,7 +342,7 @@ discard block |
||
342 | 342 | * @since 1.7 |
343 | 343 | */ |
344 | 344 | if ( $has_post_fields ) { |
345 | - $fields['post_id'] = array( |
|
345 | + $fields[ 'post_id' ] = array( |
|
346 | 346 | 'label' => __( 'Post ID', 'gravityview' ), |
347 | 347 | 'type' => 'post_id', |
348 | 348 | ); |
@@ -355,11 +355,11 @@ discard block |
||
355 | 355 | foreach ( $payment_fields as $payment_field ) { |
356 | 356 | |
357 | 357 | // Either the field exists ($fields['shipping']) or the form explicitly contains a `shipping` field with numeric key |
358 | - if( isset( $fields["{$payment_field->name}"] ) || GFCommon::get_fields_by_type( $form, $payment_field->name ) ) { |
|
358 | + if ( isset( $fields[ "{$payment_field->name}" ] ) || GFCommon::get_fields_by_type( $form, $payment_field->name ) ) { |
|
359 | 359 | continue; |
360 | 360 | } |
361 | 361 | |
362 | - $fields["{$payment_field->name}"] = array( |
|
362 | + $fields[ "{$payment_field->name}" ] = array( |
|
363 | 363 | 'label' => $payment_field->label, |
364 | 364 | 'desc' => $payment_field->description, |
365 | 365 | 'type' => $payment_field->name, |
@@ -391,9 +391,9 @@ discard block |
||
391 | 391 | |
392 | 392 | $fields = array(); |
393 | 393 | |
394 | - foreach ( $extra_fields as $key => $field ){ |
|
395 | - if ( ! empty( $only_default_column ) && ! empty( $field['is_default_column'] ) ) { |
|
396 | - $fields[ $key ] = array( 'label' => $field['label'], 'type' => 'entry_meta' ); |
|
394 | + foreach ( $extra_fields as $key => $field ) { |
|
395 | + if ( ! empty( $only_default_column ) && ! empty( $field[ 'is_default_column' ] ) ) { |
|
396 | + $fields[ $key ] = array( 'label' => $field[ 'label' ], 'type' => 'entry_meta' ); |
|
397 | 397 | } |
398 | 398 | } |
399 | 399 | |
@@ -433,33 +433,33 @@ discard block |
||
433 | 433 | 'search_criteria' => null, |
434 | 434 | 'sorting' => null, |
435 | 435 | 'paging' => null, |
436 | - 'cache' => (isset( $passed_criteria['cache'] ) ? (bool) $passed_criteria['cache'] : true), |
|
436 | + 'cache' => ( isset( $passed_criteria[ 'cache' ] ) ? (bool)$passed_criteria[ 'cache' ] : true ), |
|
437 | 437 | 'context_view_id' => null, |
438 | 438 | ); |
439 | 439 | |
440 | 440 | $criteria = wp_parse_args( $passed_criteria, $search_criteria_defaults ); |
441 | 441 | |
442 | - if ( ! empty( $criteria['search_criteria']['field_filters'] ) ) { |
|
443 | - foreach ( $criteria['search_criteria']['field_filters'] as &$filter ) { |
|
442 | + if ( ! empty( $criteria[ 'search_criteria' ][ 'field_filters' ] ) ) { |
|
443 | + foreach ( $criteria[ 'search_criteria' ][ 'field_filters' ] as &$filter ) { |
|
444 | 444 | |
445 | 445 | if ( ! is_array( $filter ) ) { |
446 | 446 | continue; |
447 | 447 | } |
448 | 448 | |
449 | 449 | // By default, we want searches to be wildcard for each field. |
450 | - $filter['operator'] = empty( $filter['operator'] ) ? 'contains' : $filter['operator']; |
|
450 | + $filter[ 'operator' ] = empty( $filter[ 'operator' ] ) ? 'contains' : $filter[ 'operator' ]; |
|
451 | 451 | |
452 | 452 | /** |
453 | 453 | * @filter `gravityview_search_operator` Modify the search operator for the field (contains, is, isnot, etc) |
454 | 454 | * @param string $operator Existing search operator |
455 | 455 | * @param array $filter array with `key`, `value`, `operator`, `type` keys |
456 | 456 | */ |
457 | - $filter['operator'] = apply_filters( 'gravityview_search_operator', $filter['operator'], $filter ); |
|
457 | + $filter[ 'operator' ] = apply_filters( 'gravityview_search_operator', $filter[ 'operator' ], $filter ); |
|
458 | 458 | } |
459 | 459 | |
460 | 460 | // don't send just the [mode] without any field filter. |
461 | - if( count( $criteria['search_criteria']['field_filters'] ) === 1 && array_key_exists( 'mode' , $criteria['search_criteria']['field_filters'] ) ) { |
|
462 | - unset( $criteria['search_criteria']['field_filters']['mode'] ); |
|
461 | + if ( count( $criteria[ 'search_criteria' ][ 'field_filters' ] ) === 1 && array_key_exists( 'mode', $criteria[ 'search_criteria' ][ 'field_filters' ] ) ) { |
|
462 | + unset( $criteria[ 'search_criteria' ][ 'field_filters' ][ 'mode' ] ); |
|
463 | 463 | } |
464 | 464 | |
465 | 465 | } |
@@ -470,33 +470,33 @@ discard block |
||
470 | 470 | * Prepare date formats to be in Gravity Forms DB format; |
471 | 471 | * $passed_criteria may include date formats incompatible with Gravity Forms. |
472 | 472 | */ |
473 | - foreach ( array('start_date', 'end_date' ) as $key ) { |
|
473 | + foreach ( array( 'start_date', 'end_date' ) as $key ) { |
|
474 | 474 | |
475 | - if ( ! empty( $criteria['search_criteria'][ $key ] ) ) { |
|
475 | + if ( ! empty( $criteria[ 'search_criteria' ][ $key ] ) ) { |
|
476 | 476 | |
477 | 477 | // Use date_create instead of new DateTime so it returns false if invalid date format. |
478 | - $date = date_create( $criteria['search_criteria'][ $key ] ); |
|
478 | + $date = date_create( $criteria[ 'search_criteria' ][ $key ] ); |
|
479 | 479 | |
480 | 480 | if ( $date ) { |
481 | 481 | // Gravity Forms wants dates in the `Y-m-d H:i:s` format. |
482 | - $criteria['search_criteria'][ $key ] = $date->format( 'Y-m-d H:i:s' ); |
|
482 | + $criteria[ 'search_criteria' ][ $key ] = $date->format( 'Y-m-d H:i:s' ); |
|
483 | 483 | } else { |
484 | - gravityview()->log->error( '{key} Date format not valid:', array( 'key' => $key, $criteria['search_criteria'][ $key ] ) ); |
|
484 | + gravityview()->log->error( '{key} Date format not valid:', array( 'key' => $key, $criteria[ 'search_criteria' ][ $key ] ) ); |
|
485 | 485 | |
486 | 486 | // If it's an invalid date, unset it. Gravity Forms freaks out otherwise. |
487 | - unset( $criteria['search_criteria'][ $key ] ); |
|
487 | + unset( $criteria[ 'search_criteria' ][ $key ] ); |
|
488 | 488 | } |
489 | 489 | } |
490 | 490 | } |
491 | 491 | |
492 | - if ( empty( $criteria['context_view_id'] ) ) { |
|
492 | + if ( empty( $criteria[ 'context_view_id' ] ) ) { |
|
493 | 493 | // Calculate the context view id and send it to the advanced filter |
494 | 494 | if ( GravityView_frontend::getInstance()->getSingleEntry() ) { |
495 | - $criteria['context_view_id'] = GravityView_frontend::getInstance()->get_context_view_id(); |
|
495 | + $criteria[ 'context_view_id' ] = GravityView_frontend::getInstance()->get_context_view_id(); |
|
496 | 496 | } else if ( class_exists( 'GravityView_View_Data' ) && GravityView_View_Data::getInstance() && GravityView_View_Data::getInstance()->has_multiple_views() ) { |
497 | - $criteria['context_view_id'] = GravityView_frontend::getInstance()->get_context_view_id(); |
|
497 | + $criteria[ 'context_view_id' ] = GravityView_frontend::getInstance()->get_context_view_id(); |
|
498 | 498 | } else if ( 'delete' === GFForms::get( 'action' ) ) { |
499 | - $criteria['context_view_id'] = isset( $_GET['view_id'] ) ? intval( $_GET['view_id'] ) : null; |
|
499 | + $criteria[ 'context_view_id' ] = isset( $_GET[ 'view_id' ] ) ? intval( $_GET[ 'view_id' ] ) : null; |
|
500 | 500 | } |
501 | 501 | } |
502 | 502 | |
@@ -506,7 +506,7 @@ discard block |
||
506 | 506 | * @param array $form_ids Forms to search |
507 | 507 | * @param int $view_id ID of the view being used to search |
508 | 508 | */ |
509 | - $criteria = apply_filters( 'gravityview_search_criteria', $criteria, $form_ids, $criteria['context_view_id'] ); |
|
509 | + $criteria = apply_filters( 'gravityview_search_criteria', $criteria, $form_ids, $criteria[ 'context_view_id' ] ); |
|
510 | 510 | |
511 | 511 | return (array)$criteria; |
512 | 512 | } |
@@ -541,7 +541,7 @@ discard block |
||
541 | 541 | /** Reduce # of database calls */ |
542 | 542 | add_filter( 'gform_is_encrypted_field', '__return_false' ); |
543 | 543 | |
544 | - if ( ! empty( $criteria['cache'] ) ) { |
|
544 | + if ( ! empty( $criteria[ 'cache' ] ) ) { |
|
545 | 545 | |
546 | 546 | $Cache = new GravityView_Cache( $form_ids, $criteria ); |
547 | 547 | |
@@ -549,7 +549,7 @@ discard block |
||
549 | 549 | |
550 | 550 | // Still update the total count when using cached results |
551 | 551 | if ( ! is_null( $total ) ) { |
552 | - $total = GFAPI::count_entries( $form_ids, $criteria['search_criteria'] ); |
|
552 | + $total = GFAPI::count_entries( $form_ids, $criteria[ 'search_criteria' ] ); |
|
553 | 553 | } |
554 | 554 | |
555 | 555 | $return = $entries; |
@@ -571,9 +571,9 @@ discard block |
||
571 | 571 | $entries = apply_filters_ref_array( 'gravityview_before_get_entries', array( null, $criteria, $passed_criteria, &$total ) ); |
572 | 572 | |
573 | 573 | // No entries returned from gravityview_before_get_entries |
574 | - if( is_null( $entries ) ) { |
|
574 | + if ( is_null( $entries ) ) { |
|
575 | 575 | |
576 | - $entries = GFAPI::get_entries( $form_ids, $criteria['search_criteria'], $criteria['sorting'], $criteria['paging'], $total ); |
|
576 | + $entries = GFAPI::get_entries( $form_ids, $criteria[ 'search_criteria' ], $criteria[ 'sorting' ], $criteria[ 'paging' ], $total ); |
|
577 | 577 | |
578 | 578 | if ( is_wp_error( $entries ) ) { |
579 | 579 | gravityview()->log->error( '{error}', array( 'error' => $entries->get_error_message(), 'data' => $entries ) ); |
@@ -584,7 +584,7 @@ discard block |
||
584 | 584 | } |
585 | 585 | } |
586 | 586 | |
587 | - if ( ! empty( $criteria['cache'] ) && isset( $Cache ) ) { |
|
587 | + if ( ! empty( $criteria[ 'cache' ] ) && isset( $Cache ) ) { |
|
588 | 588 | |
589 | 589 | // Cache results |
590 | 590 | $Cache->set( $entries, 'entries' ); |
@@ -693,12 +693,12 @@ discard block |
||
693 | 693 | */ |
694 | 694 | $check_entry_display = apply_filters( 'gravityview/common/get_entry/check_entry_display', $check_entry_display, $entry ); |
695 | 695 | |
696 | - if( $check_entry_display ) { |
|
696 | + if ( $check_entry_display ) { |
|
697 | 697 | // Is the entry allowed |
698 | 698 | $entry = self::check_entry_display( $entry ); |
699 | 699 | } |
700 | 700 | |
701 | - if( is_wp_error( $entry ) ) { |
|
701 | + if ( is_wp_error( $entry ) ) { |
|
702 | 702 | gravityview()->log->error( '{error}', array( 'error' => $entry->get_error_message() ) ); |
703 | 703 | return false; |
704 | 704 | } |
@@ -732,12 +732,12 @@ discard block |
||
732 | 732 | |
733 | 733 | $value = false; |
734 | 734 | |
735 | - if( 'context' === $val1 ) { |
|
735 | + if ( 'context' === $val1 ) { |
|
736 | 736 | |
737 | 737 | $matching_contexts = array( $val2 ); |
738 | 738 | |
739 | 739 | // We allow for non-standard contexts. |
740 | - switch( $val2 ) { |
|
740 | + switch ( $val2 ) { |
|
741 | 741 | // Check for either single or edit |
742 | 742 | case 'singular': |
743 | 743 | $matching_contexts = array( 'single', 'edit' ); |
@@ -780,18 +780,18 @@ discard block |
||
780 | 780 | $json_val_1 = json_decode( $val1, true ); |
781 | 781 | $json_val_2 = json_decode( $val2, true ); |
782 | 782 | |
783 | - if( ! empty( $json_val_1 ) || ! empty( $json_val_2 ) ) { |
|
783 | + if ( ! empty( $json_val_1 ) || ! empty( $json_val_2 ) ) { |
|
784 | 784 | |
785 | 785 | $json_in = false; |
786 | - $json_val_1 = $json_val_1 ? (array) $json_val_1 : array( $val1 ); |
|
787 | - $json_val_2 = $json_val_2 ? (array) $json_val_2 : array( $val2 ); |
|
786 | + $json_val_1 = $json_val_1 ? (array)$json_val_1 : array( $val1 ); |
|
787 | + $json_val_2 = $json_val_2 ? (array)$json_val_2 : array( $val2 ); |
|
788 | 788 | |
789 | 789 | // For JSON, we want to compare as "in" or "not in" rather than "contains" |
790 | 790 | foreach ( $json_val_1 as $item_1 ) { |
791 | 791 | foreach ( $json_val_2 as $item_2 ) { |
792 | 792 | $json_in = self::matches_operation( $item_1, $item_2, 'is' ); |
793 | 793 | |
794 | - if( $json_in ) { |
|
794 | + if ( $json_in ) { |
|
795 | 795 | break 2; |
796 | 796 | } |
797 | 797 | } |
@@ -843,10 +843,10 @@ discard block |
||
843 | 843 | public static function check_entry_display( $entry, $view = null ) { |
844 | 844 | |
845 | 845 | if ( ! $entry || is_wp_error( $entry ) ) { |
846 | - return new WP_Error('entry_not_found', 'Entry was not found.', $entry ); |
|
846 | + return new WP_Error( 'entry_not_found', 'Entry was not found.', $entry ); |
|
847 | 847 | } |
848 | 848 | |
849 | - if ( empty( $entry['form_id'] ) ) { |
|
849 | + if ( empty( $entry[ 'form_id' ] ) ) { |
|
850 | 850 | return new WP_Error( 'form_id_not_set', '[apply_filters_to_entry] Entry is empty!', $entry ); |
851 | 851 | } |
852 | 852 | |
@@ -854,8 +854,8 @@ discard block |
||
854 | 854 | $view_form_id = $view->form->ID; |
855 | 855 | |
856 | 856 | if ( $view->joins ) { |
857 | - if ( in_array( (int)$entry['form_id'], array_keys( $view::get_joined_forms( $view->ID ) ), true ) ) { |
|
858 | - $view_form_id = $entry['form_id']; |
|
857 | + if ( in_array( (int)$entry[ 'form_id' ], array_keys( $view::get_joined_forms( $view->ID ) ), true ) ) { |
|
858 | + $view_form_id = $entry[ 'form_id' ]; |
|
859 | 859 | } |
860 | 860 | } |
861 | 861 | |
@@ -863,13 +863,13 @@ discard block |
||
863 | 863 | * Check whether the entry is in the entries subset by running a modified query. |
864 | 864 | */ |
865 | 865 | add_action( 'gravityview/view/query', $entry_subset_callback = function( &$query, $view, $request ) use ( $entry, $view_form_id ) { |
866 | - $_tmp_query = new \GF_Query( $view_form_id, array( |
|
866 | + $_tmp_query = new \GF_Query( $view_form_id, array( |
|
867 | 867 | 'field_filters' => array( |
868 | 868 | 'mode' => 'all', |
869 | 869 | array( |
870 | 870 | 'key' => 'id', |
871 | 871 | 'operation' => 'is', |
872 | - 'value' => $entry['id'] |
|
872 | + 'value' => $entry[ 'id' ] |
|
873 | 873 | ) |
874 | 874 | ) |
875 | 875 | ) ); |
@@ -879,14 +879,14 @@ discard block |
||
879 | 879 | /** @var \GF_Query $query */ |
880 | 880 | $query_parts = $query->_introspect(); |
881 | 881 | |
882 | - $query->where( \GF_Query_Condition::_and( $_tmp_query_parts['where'], $query_parts['where'] ) ); |
|
882 | + $query->where( \GF_Query_Condition::_and( $_tmp_query_parts[ 'where' ], $query_parts[ 'where' ] ) ); |
|
883 | 883 | |
884 | 884 | }, 10, 3 ); |
885 | 885 | |
886 | 886 | // Prevent page offset from being applied to the single entry query; it's used to return to the referring page number |
887 | 887 | add_filter( 'gravityview_search_criteria', $remove_pagenum = function( $criteria ) { |
888 | 888 | |
889 | - $criteria['paging'] = array( |
|
889 | + $criteria[ 'paging' ] = array( |
|
890 | 890 | 'offset' => 0, |
891 | 891 | 'page_size' => 25 |
892 | 892 | ); |
@@ -905,20 +905,20 @@ discard block |
||
905 | 905 | } |
906 | 906 | |
907 | 907 | // This entry is on a View with joins |
908 | - if ( $entries[0]->is_multi() ) { |
|
908 | + if ( $entries[ 0 ]->is_multi() ) { |
|
909 | 909 | |
910 | 910 | $multi_entry_ids = array(); |
911 | 911 | |
912 | - foreach ( $entries[0]->entries as $multi_entry ) { |
|
913 | - $multi_entry_ids[] = (int) $multi_entry->ID; |
|
912 | + foreach ( $entries[ 0 ]->entries as $multi_entry ) { |
|
913 | + $multi_entry_ids[ ] = (int)$multi_entry->ID; |
|
914 | 914 | } |
915 | 915 | |
916 | - if ( ! in_array( (int) $entry['id'], $multi_entry_ids, true ) ) { |
|
916 | + if ( ! in_array( (int)$entry[ 'id' ], $multi_entry_ids, true ) ) { |
|
917 | 917 | remove_action( 'gravityview/view/query', $entry_subset_callback ); |
918 | 918 | return new \WP_Error( 'failed_criteria', 'Entry failed search_criteria and field_filters' ); |
919 | 919 | } |
920 | 920 | |
921 | - } elseif ( (int) $entries[0]->ID !== (int) $entry['id'] ) { |
|
921 | + } elseif ( (int)$entries[ 0 ]->ID !== (int)$entry[ 'id' ] ) { |
|
922 | 922 | remove_action( 'gravityview/view/query', $entry_subset_callback ); |
923 | 923 | return new \WP_Error( 'failed_criteria', 'Entry failed search_criteria and field_filters' ); |
924 | 924 | } |
@@ -931,59 +931,59 @@ discard block |
||
931 | 931 | 'context_view_id' => $view ? $view->ID : null, |
932 | 932 | ) ); |
933 | 933 | |
934 | - if ( empty( $criteria['search_criteria'] ) || ! is_array( $criteria['search_criteria'] ) ) { |
|
934 | + if ( empty( $criteria[ 'search_criteria' ] ) || ! is_array( $criteria[ 'search_criteria' ] ) ) { |
|
935 | 935 | gravityview()->log->debug( '[apply_filters_to_entry] Entry approved! No search criteria found:', array( 'data' => $criteria ) ); |
936 | 936 | return $entry; |
937 | 937 | } |
938 | 938 | |
939 | 939 | // Make sure the current View is connected to the same form as the Entry |
940 | - if( ! empty( $criteria['context_view_id'] ) ) { |
|
941 | - $context_view_id = intval( $criteria['context_view_id'] ); |
|
940 | + if ( ! empty( $criteria[ 'context_view_id' ] ) ) { |
|
941 | + $context_view_id = intval( $criteria[ 'context_view_id' ] ); |
|
942 | 942 | $context_form_id = gravityview_get_form_id( $context_view_id ); |
943 | - if( intval( $context_form_id ) !== intval( $entry['form_id'] ) ) { |
|
944 | - return new WP_Error( 'view_id_not_match', sprintf( '[apply_filters_to_entry] Entry form ID does not match current View connected form ID:', $entry['form_id'] ), $criteria['context_view_id'] ); |
|
943 | + if ( intval( $context_form_id ) !== intval( $entry[ 'form_id' ] ) ) { |
|
944 | + return new WP_Error( 'view_id_not_match', sprintf( '[apply_filters_to_entry] Entry form ID does not match current View connected form ID:', $entry[ 'form_id' ] ), $criteria[ 'context_view_id' ] ); |
|
945 | 945 | } |
946 | 946 | } |
947 | 947 | |
948 | - $search_criteria = $criteria['search_criteria']; |
|
948 | + $search_criteria = $criteria[ 'search_criteria' ]; |
|
949 | 949 | |
950 | 950 | // check entry status |
951 | - if ( array_key_exists( 'status', $search_criteria ) && $search_criteria['status'] != $entry['status'] ) { |
|
952 | - return new WP_Error( 'status_not_valid', sprintf( '[apply_filters_to_entry] Entry status - %s - is not valid according to filter:', $entry['status'] ), $search_criteria ); |
|
951 | + if ( array_key_exists( 'status', $search_criteria ) && $search_criteria[ 'status' ] != $entry[ 'status' ] ) { |
|
952 | + return new WP_Error( 'status_not_valid', sprintf( '[apply_filters_to_entry] Entry status - %s - is not valid according to filter:', $entry[ 'status' ] ), $search_criteria ); |
|
953 | 953 | } |
954 | 954 | |
955 | 955 | // check entry date |
956 | 956 | // @todo: Does it make sense to apply the Date create filters to the single entry? |
957 | 957 | |
958 | 958 | // field_filters |
959 | - if ( empty( $search_criteria['field_filters'] ) || ! is_array( $search_criteria['field_filters'] ) ) { |
|
959 | + if ( empty( $search_criteria[ 'field_filters' ] ) || ! is_array( $search_criteria[ 'field_filters' ] ) ) { |
|
960 | 960 | gravityview()->log->debug( '[apply_filters_to_entry] Entry approved! No field filters criteria found:', array( 'data' => $search_criteria ) ); |
961 | 961 | return $entry; |
962 | 962 | } |
963 | 963 | |
964 | - $filters = $search_criteria['field_filters']; |
|
964 | + $filters = $search_criteria[ 'field_filters' ]; |
|
965 | 965 | |
966 | - $mode = array_key_exists( 'mode', $filters ) ? strtolower( $filters['mode'] ) : 'all'; |
|
966 | + $mode = array_key_exists( 'mode', $filters ) ? strtolower( $filters[ 'mode' ] ) : 'all'; |
|
967 | 967 | |
968 | - $mode = $mode ? : 'all'; // If mode is an empty string, assume it's 'all' |
|
968 | + $mode = $mode ?: 'all'; // If mode is an empty string, assume it's 'all' |
|
969 | 969 | |
970 | 970 | // Prevent the mode from being processed below |
971 | - unset( $filters['mode'] ); |
|
971 | + unset( $filters[ 'mode' ] ); |
|
972 | 972 | |
973 | - $form = self::get_form( $entry['form_id'] ); |
|
973 | + $form = self::get_form( $entry[ 'form_id' ] ); |
|
974 | 974 | |
975 | 975 | foreach ( $filters as $filter ) { |
976 | - $operator = isset( $filter['operator'] ) ? strtolower( $filter['operator'] ) : 'is'; |
|
976 | + $operator = isset( $filter[ 'operator' ] ) ? strtolower( $filter[ 'operator' ] ) : 'is'; |
|
977 | 977 | |
978 | - if ( ! isset( $filter['key'] ) ) { |
|
978 | + if ( ! isset( $filter[ 'key' ] ) ) { |
|
979 | 979 | gravityview()->log->debug( '[apply_filters_to_entry] Filter key not set, any field mode', array( 'filter' => $filter ) ); |
980 | 980 | /** |
981 | 981 | * This is a cross-field search. Let's start digging'. |
982 | 982 | */ |
983 | 983 | foreach ( \GV\Utils::get( $form, 'fields', array() ) as $field ) { |
984 | 984 | $field_value = GFFormsModel::get_lead_field_value( $entry, $field ); |
985 | - if ( $is_value_match = GravityView_GFFormsModel::is_value_match( $field_value, $filter['value'], $operator, $field ) ) { |
|
986 | - if ( 'any' === $mode) { |
|
985 | + if ( $is_value_match = GravityView_GFFormsModel::is_value_match( $field_value, $filter[ 'value' ], $operator, $field ) ) { |
|
986 | + if ( 'any' === $mode ) { |
|
987 | 987 | return $entry; // All good here |
988 | 988 | } // mode === 'all' |
989 | 989 | continue 2; // Next filter |
@@ -992,13 +992,13 @@ discard block |
||
992 | 992 | } |
993 | 993 | |
994 | 994 | if ( 'all' === $mode ) { |
995 | - return new WP_Error('failed_criteria', '[apply_filters_to_entry] Entry cannot be displayed. Failed a subcriterium for any field in ALL mode', $filter ); |
|
995 | + return new WP_Error( 'failed_criteria', '[apply_filters_to_entry] Entry cannot be displayed. Failed a subcriterium for any field in ALL mode', $filter ); |
|
996 | 996 | } |
997 | 997 | |
998 | 998 | continue; |
999 | 999 | } |
1000 | 1000 | |
1001 | - $k = $filter['key']; |
|
1001 | + $k = $filter[ 'key' ]; |
|
1002 | 1002 | |
1003 | 1003 | $field = self::get_field( $form, $k ); |
1004 | 1004 | |
@@ -1006,12 +1006,12 @@ discard block |
||
1006 | 1006 | $field_value = isset( $entry[ $k ] ) ? $entry[ $k ] : null; |
1007 | 1007 | $field = $k; |
1008 | 1008 | } else { |
1009 | - $field_value = GFFormsModel::get_lead_field_value( $entry, $field ); |
|
1009 | + $field_value = GFFormsModel::get_lead_field_value( $entry, $field ); |
|
1010 | 1010 | // If it's a complex field, then fetch the input's value, if exists at the current key. Otherwise, let GF handle it |
1011 | 1011 | $field_value = ( is_array( $field_value ) && isset( $field_value[ $k ] ) ) ? \GV\Utils::get( $field_value, $k ) : $field_value; |
1012 | 1012 | } |
1013 | 1013 | |
1014 | - $is_value_match = GravityView_GFFormsModel::is_value_match( $field_value, $filter['value'], $operator, $field ); |
|
1014 | + $is_value_match = GravityView_GFFormsModel::is_value_match( $field_value, $filter[ 'value' ], $operator, $field ); |
|
1015 | 1015 | |
1016 | 1016 | // Any match is all we need to know |
1017 | 1017 | if ( $is_value_match && 'any' === $mode ) { |
@@ -1020,7 +1020,7 @@ discard block |
||
1020 | 1020 | |
1021 | 1021 | // Any failed match is a total fail |
1022 | 1022 | if ( ! $is_value_match && 'all' === $mode ) { |
1023 | - return new WP_Error('failed_criteria', '[apply_filters_to_entry] Entry cannot be displayed. Failed a criterium for ALL mode', $filter ); |
|
1023 | + return new WP_Error( 'failed_criteria', '[apply_filters_to_entry] Entry cannot be displayed. Failed a criterium for ALL mode', $filter ); |
|
1024 | 1024 | } |
1025 | 1025 | } |
1026 | 1026 | |
@@ -1030,7 +1030,7 @@ discard block |
||
1030 | 1030 | gravityview()->log->debug( '[apply_filters_to_entry] Entry approved: all conditions were met' ); |
1031 | 1031 | return $entry; |
1032 | 1032 | } else { |
1033 | - return new WP_Error('failed_any_criteria', '[apply_filters_to_entry] Entry cannot be displayed. Failed all the criteria for ANY mode', $filters ); |
|
1033 | + return new WP_Error( 'failed_any_criteria', '[apply_filters_to_entry] Entry cannot be displayed. Failed all the criteria for ANY mode', $filters ); |
|
1034 | 1034 | } |
1035 | 1035 | |
1036 | 1036 | } |
@@ -1071,18 +1071,18 @@ discard block |
||
1071 | 1071 | * Gravity Forms code to adjust date to locally-configured Time Zone |
1072 | 1072 | * @see GFCommon::format_date() for original code |
1073 | 1073 | */ |
1074 | - $date_gmt_time = mysql2date( 'G', $date_string ); |
|
1074 | + $date_gmt_time = mysql2date( 'G', $date_string ); |
|
1075 | 1075 | $date_local_timestamp = GFCommon::get_local_timestamp( $date_gmt_time ); |
1076 | 1076 | |
1077 | - $format = \GV\Utils::get( $atts, 'format' ); |
|
1078 | - $is_human = ! empty( $atts['human'] ); |
|
1079 | - $is_diff = ! empty( $atts['diff'] ); |
|
1080 | - $is_raw = ! empty( $atts['raw'] ); |
|
1081 | - $is_timestamp = ! empty( $atts['timestamp'] ); |
|
1082 | - $include_time = ! empty( $atts['time'] ); |
|
1077 | + $format = \GV\Utils::get( $atts, 'format' ); |
|
1078 | + $is_human = ! empty( $atts[ 'human' ] ); |
|
1079 | + $is_diff = ! empty( $atts[ 'diff' ] ); |
|
1080 | + $is_raw = ! empty( $atts[ 'raw' ] ); |
|
1081 | + $is_timestamp = ! empty( $atts[ 'timestamp' ] ); |
|
1082 | + $include_time = ! empty( $atts[ 'time' ] ); |
|
1083 | 1083 | |
1084 | 1084 | // If we're using time diff, we want to have a different default format |
1085 | - if( empty( $format ) ) { |
|
1085 | + if ( empty( $format ) ) { |
|
1086 | 1086 | /* translators: %s: relative time from now, used for generic date comparisons. "1 day ago", or "20 seconds ago" */ |
1087 | 1087 | $format = $is_diff ? esc_html__( '%s ago', 'gravityview' ) : get_option( 'date_format' ); |
1088 | 1088 | } |
@@ -1090,7 +1090,7 @@ discard block |
||
1090 | 1090 | // If raw was specified, don't modify the stored value |
1091 | 1091 | if ( $is_raw ) { |
1092 | 1092 | $formatted_date = $date_string; |
1093 | - } elseif( $is_timestamp ) { |
|
1093 | + } elseif ( $is_timestamp ) { |
|
1094 | 1094 | $formatted_date = $date_local_timestamp; |
1095 | 1095 | } elseif ( $is_diff ) { |
1096 | 1096 | $formatted_date = sprintf( $format, human_time_diff( $date_gmt_time ) ); |
@@ -1124,7 +1124,7 @@ discard block |
||
1124 | 1124 | |
1125 | 1125 | $label = \GV\Utils::get( $field, 'label' ); |
1126 | 1126 | |
1127 | - if( floor( $field_id ) !== floatval( $field_id ) ) { |
|
1127 | + if ( floor( $field_id ) !== floatval( $field_id ) ) { |
|
1128 | 1128 | $label = GFFormsModel::get_choice_text( $field, $field_value, $field_id ); |
1129 | 1129 | } |
1130 | 1130 | |
@@ -1152,7 +1152,7 @@ discard block |
||
1152 | 1152 | $form = GFAPI::get_form( $form ); |
1153 | 1153 | } |
1154 | 1154 | |
1155 | - if ( class_exists( 'GFFormsModel' ) ){ |
|
1155 | + if ( class_exists( 'GFFormsModel' ) ) { |
|
1156 | 1156 | return GFFormsModel::get_field( $form, $field_id ); |
1157 | 1157 | } else { |
1158 | 1158 | return null; |
@@ -1199,19 +1199,19 @@ discard block |
||
1199 | 1199 | $shortcodes = array(); |
1200 | 1200 | |
1201 | 1201 | preg_match_all( '/' . get_shortcode_regex() . '/s', $content, $matches, PREG_SET_ORDER ); |
1202 | - if ( empty( $matches ) ){ |
|
1202 | + if ( empty( $matches ) ) { |
|
1203 | 1203 | return false; |
1204 | 1204 | } |
1205 | 1205 | |
1206 | 1206 | foreach ( $matches as $shortcode ) { |
1207 | - if ( $tag === $shortcode[2] ) { |
|
1207 | + if ( $tag === $shortcode[ 2 ] ) { |
|
1208 | 1208 | |
1209 | 1209 | // Changed this to $shortcode instead of true so we get the parsed atts. |
1210 | - $shortcodes[] = $shortcode; |
|
1210 | + $shortcodes[ ] = $shortcode; |
|
1211 | 1211 | |
1212 | - } else if ( isset( $shortcode[5] ) && $results = self::has_shortcode_r( $shortcode[5], $tag ) ) { |
|
1213 | - foreach( $results as $result ) { |
|
1214 | - $shortcodes[] = $result; |
|
1212 | + } else if ( isset( $shortcode[ 5 ] ) && $results = self::has_shortcode_r( $shortcode[ 5 ], $tag ) ) { |
|
1213 | + foreach ( $results as $result ) { |
|
1214 | + $shortcodes[ ] = $result; |
|
1215 | 1215 | } |
1216 | 1216 | } |
1217 | 1217 | } |
@@ -1243,7 +1243,7 @@ discard block |
||
1243 | 1243 | 'post_type' => 'gravityview', |
1244 | 1244 | 'posts_per_page' => 100, |
1245 | 1245 | 'meta_key' => '_gravityview_form_id', |
1246 | - 'meta_value' => (int) $form_id, |
|
1246 | + 'meta_value' => (int)$form_id, |
|
1247 | 1247 | ); |
1248 | 1248 | $args = wp_parse_args( $args, $defaults ); |
1249 | 1249 | $views = get_posts( $args ); |
@@ -1255,21 +1255,21 @@ discard block |
||
1255 | 1255 | |
1256 | 1256 | $data = unserialize( $view->meta_value ); |
1257 | 1257 | |
1258 | - if( ! $data || ! is_array( $data ) ) { |
|
1258 | + if ( ! $data || ! is_array( $data ) ) { |
|
1259 | 1259 | continue; |
1260 | 1260 | } |
1261 | 1261 | |
1262 | 1262 | foreach ( $data as $datum ) { |
1263 | - if ( ! empty( $datum[2] ) && (int) $datum[2] === (int) $form_id ) { |
|
1264 | - $joined_forms[] = $view->post_id; |
|
1263 | + if ( ! empty( $datum[ 2 ] ) && (int)$datum[ 2 ] === (int)$form_id ) { |
|
1264 | + $joined_forms[ ] = $view->post_id; |
|
1265 | 1265 | } |
1266 | 1266 | } |
1267 | 1267 | } |
1268 | 1268 | |
1269 | 1269 | if ( $joined_forms ) { |
1270 | - $joined_args = array( |
|
1270 | + $joined_args = array( |
|
1271 | 1271 | 'post_type' => 'gravityview', |
1272 | - 'posts_per_page' => $args['posts_per_page'], |
|
1272 | + 'posts_per_page' => $args[ 'posts_per_page' ], |
|
1273 | 1273 | 'post__in' => $joined_forms, |
1274 | 1274 | ); |
1275 | 1275 | $views = array_merge( $views, get_posts( $joined_args ) ); |
@@ -1425,7 +1425,7 @@ discard block |
||
1425 | 1425 | |
1426 | 1426 | $directory_widgets = wp_parse_args( $view_widgets, $defaults ); |
1427 | 1427 | |
1428 | - if( $json_decode ) { |
|
1428 | + if ( $json_decode ) { |
|
1429 | 1429 | $directory_widgets = gv_map_deep( $directory_widgets, 'gv_maybe_json_decode' ); |
1430 | 1430 | } |
1431 | 1431 | |
@@ -1441,7 +1441,7 @@ discard block |
||
1441 | 1441 | * @return string html |
1442 | 1442 | */ |
1443 | 1443 | public static function get_sortable_fields( $formid, $current = '' ) { |
1444 | - $output = '<option value="" ' . selected( '', $current, false ).'>' . esc_html__( 'Default', 'gravityview' ) .'</option>'; |
|
1444 | + $output = '<option value="" ' . selected( '', $current, false ) . '>' . esc_html__( 'Default', 'gravityview' ) . '</option>'; |
|
1445 | 1445 | |
1446 | 1446 | if ( empty( $formid ) ) { |
1447 | 1447 | return $output; |
@@ -1454,11 +1454,11 @@ discard block |
||
1454 | 1454 | $blacklist_field_types = apply_filters( 'gravityview_blacklist_field_types', array( 'list', 'textarea' ), null ); |
1455 | 1455 | |
1456 | 1456 | foreach ( $fields as $id => $field ) { |
1457 | - if ( in_array( $field['type'], $blacklist_field_types ) ) { |
|
1457 | + if ( in_array( $field[ 'type' ], $blacklist_field_types ) ) { |
|
1458 | 1458 | continue; |
1459 | 1459 | } |
1460 | 1460 | |
1461 | - $output .= '<option value="'. $id .'" '. selected( $id, $current, false ).'>'. esc_attr( $field['label'] ) .'</option>'; |
|
1461 | + $output .= '<option value="' . $id . '" ' . selected( $id, $current, false ) . '>' . esc_attr( $field[ 'label' ] ) . '</option>'; |
|
1462 | 1462 | } |
1463 | 1463 | } |
1464 | 1464 | |
@@ -1493,16 +1493,16 @@ discard block |
||
1493 | 1493 | $blacklist_field_types = apply_filters( 'gravityview_blacklist_field_types', $blacklist, NULL ); |
1494 | 1494 | |
1495 | 1495 | // TODO: Convert to using array_filter |
1496 | - foreach( $fields as $id => $field ) { |
|
1496 | + foreach ( $fields as $id => $field ) { |
|
1497 | 1497 | |
1498 | - if( in_array( $field['type'], $blacklist_field_types ) ) { |
|
1498 | + if ( in_array( $field[ 'type' ], $blacklist_field_types ) ) { |
|
1499 | 1499 | unset( $fields[ $id ] ); |
1500 | 1500 | } |
1501 | 1501 | |
1502 | 1502 | /** |
1503 | 1503 | * Merge date and time subfields. |
1504 | 1504 | */ |
1505 | - if ( in_array( $field['type'], array( 'date', 'time' ) ) && ! empty( $field['parent'] ) ) { |
|
1505 | + if ( in_array( $field[ 'type' ], array( 'date', 'time' ) ) && ! empty( $field[ 'parent' ] ) ) { |
|
1506 | 1506 | $fields[ intval( $id ) ] = array( |
1507 | 1507 | 'label' => \GV\Utils::get( $field, 'parent/label' ), |
1508 | 1508 | 'parent' => null, |
@@ -1552,14 +1552,14 @@ discard block |
||
1552 | 1552 | * @param int|array $field field key or field array |
1553 | 1553 | * @return boolean |
1554 | 1554 | */ |
1555 | - public static function is_field_numeric( $form = null, $field = '' ) { |
|
1555 | + public static function is_field_numeric( $form = null, $field = '' ) { |
|
1556 | 1556 | |
1557 | 1557 | if ( ! is_array( $form ) && ! is_array( $field ) ) { |
1558 | 1558 | $form = self::get_form( $form ); |
1559 | 1559 | } |
1560 | 1560 | |
1561 | 1561 | // If entry meta, it's a string. Otherwise, numeric |
1562 | - if( ! is_numeric( $field ) && is_string( $field ) ) { |
|
1562 | + if ( ! is_numeric( $field ) && is_string( $field ) ) { |
|
1563 | 1563 | $type = $field; |
1564 | 1564 | } else { |
1565 | 1565 | $type = self::get_field_type( $form, $field ); |
@@ -1573,9 +1573,9 @@ discard block |
||
1573 | 1573 | $numeric_types = apply_filters( 'gravityview/common/numeric_types', array( 'number', 'time' ) ); |
1574 | 1574 | |
1575 | 1575 | // Defer to GravityView_Field setting, if the field type is registered and `is_numeric` is true |
1576 | - if( $gv_field = GravityView_Fields::get( $type ) ) { |
|
1577 | - if( true === $gv_field->is_numeric ) { |
|
1578 | - $numeric_types[] = $gv_field->is_numeric; |
|
1576 | + if ( $gv_field = GravityView_Fields::get( $type ) ) { |
|
1577 | + if ( true === $gv_field->is_numeric ) { |
|
1578 | + $numeric_types[ ] = $gv_field->is_numeric; |
|
1579 | 1579 | } |
1580 | 1580 | } |
1581 | 1581 | |
@@ -1725,18 +1725,18 @@ discard block |
||
1725 | 1725 | $final_atts = array_filter( $final_atts ); |
1726 | 1726 | |
1727 | 1727 | // If the href wasn't passed as an attribute, use the value passed to the function |
1728 | - if ( empty( $final_atts['href'] ) && ! empty( $href ) ) { |
|
1729 | - $final_atts['href'] = $href; |
|
1728 | + if ( empty( $final_atts[ 'href' ] ) && ! empty( $href ) ) { |
|
1729 | + $final_atts[ 'href' ] = $href; |
|
1730 | 1730 | } |
1731 | 1731 | |
1732 | - $final_atts['href'] = esc_url_raw( $href ); |
|
1732 | + $final_atts[ 'href' ] = esc_url_raw( $href ); |
|
1733 | 1733 | |
1734 | 1734 | /** |
1735 | 1735 | * Fix potential security issue with target=_blank |
1736 | 1736 | * @see https://dev.to/ben/the-targetblank-vulnerability-by-example |
1737 | 1737 | */ |
1738 | - if( '_blank' === \GV\Utils::get( $final_atts, 'target' ) ) { |
|
1739 | - $final_atts['rel'] = trim( \GV\Utils::get( $final_atts, 'rel', '' ) . ' noopener noreferrer' ); |
|
1738 | + if ( '_blank' === \GV\Utils::get( $final_atts, 'target' ) ) { |
|
1739 | + $final_atts[ 'rel' ] = trim( \GV\Utils::get( $final_atts, 'rel', '' ) . ' noopener noreferrer' ); |
|
1740 | 1740 | } |
1741 | 1741 | |
1742 | 1742 | // Sort the attributes alphabetically, to help testing |
@@ -1748,7 +1748,7 @@ discard block |
||
1748 | 1748 | $output .= sprintf( ' %s="%s"', $attr, esc_attr( $value ) ); |
1749 | 1749 | } |
1750 | 1750 | |
1751 | - if( '' !== $output ) { |
|
1751 | + if ( '' !== $output ) { |
|
1752 | 1752 | $output = '<a' . $output . '>' . $anchor_text . '</a>'; |
1753 | 1753 | } |
1754 | 1754 | |
@@ -1775,7 +1775,7 @@ discard block |
||
1775 | 1775 | if ( is_array( $value ) && isset( $merged[ $key ] ) && is_array( $merged[ $key ] ) ) { |
1776 | 1776 | $merged[ $key ] = self::array_merge_recursive_distinct( $merged[ $key ], $value ); |
1777 | 1777 | } else if ( is_numeric( $key ) && isset( $merged[ $key ] ) ) { |
1778 | - $merged[] = $value; |
|
1778 | + $merged[ ] = $value; |
|
1779 | 1779 | } else { |
1780 | 1780 | $merged[ $key ] = $value; |
1781 | 1781 | } |
@@ -1808,7 +1808,7 @@ discard block |
||
1808 | 1808 | * `$context` is where are we using this information (e.g. change_entry_creator, search_widget ..) |
1809 | 1809 | * @param array $settings Settings array, with `number` key defining the # of users to display |
1810 | 1810 | */ |
1811 | - $get_users_settings = apply_filters( 'gravityview/get_users/'. $context, apply_filters( 'gravityview_change_entry_creator_user_parameters', $get_users_settings ) ); |
|
1811 | + $get_users_settings = apply_filters( 'gravityview/get_users/' . $context, apply_filters( 'gravityview_change_entry_creator_user_parameters', $get_users_settings ) ); |
|
1812 | 1812 | |
1813 | 1813 | return get_users( $get_users_settings ); |
1814 | 1814 | } |
@@ -1828,11 +1828,11 @@ discard block |
||
1828 | 1828 | public static function generate_notice( $notice, $class = '', $cap = '', $object_id = null ) { |
1829 | 1829 | |
1830 | 1830 | // If $cap is defined, only show notice if user has capability |
1831 | - if( $cap && ! GVCommon::has_cap( $cap, $object_id ) ) { |
|
1831 | + if ( $cap && ! GVCommon::has_cap( $cap, $object_id ) ) { |
|
1832 | 1832 | return ''; |
1833 | 1833 | } |
1834 | 1834 | |
1835 | - return '<div class="gv-notice '.gravityview_sanitize_html_class( $class ) .'">'. $notice .'</div>'; |
|
1835 | + return '<div class="gv-notice ' . gravityview_sanitize_html_class( $class ) . '">' . $notice . '</div>'; |
|
1836 | 1836 | } |
1837 | 1837 | |
1838 | 1838 | /** |