@@ -45,7 +45,7 @@ |
||
45 | 45 | */ |
46 | 46 | function filter_file_path( $file_path = '', $file_path_info = array(), $field_settings = array() ) { |
47 | 47 | |
48 | - $file_path = str_replace('www.dropbox.com', 'dl.dropboxusercontent.com', $file_path ); |
|
48 | + $file_path = str_replace( 'www.dropbox.com', 'dl.dropboxusercontent.com', $file_path ); |
|
49 | 49 | $file_path = str_replace( '?dl=0', '', $file_path ); |
50 | 50 | |
51 | 51 | return $file_path; |
@@ -141,7 +141,7 @@ |
||
141 | 141 | global $wpdb; |
142 | 142 | |
143 | 143 | if ( version_compare( GravityView_GFFormsModel::get_database_version(), '2.3-dev-1', '>=' ) |
144 | - && method_exists( 'GFFormsModel', 'get_entry_notes_table_name' ) ) { |
|
144 | + && method_exists( 'GFFormsModel', 'get_entry_notes_table_name' ) ) { |
|
145 | 145 | $notes_table = GFFormsModel::get_entry_notes_table_name(); |
146 | 146 | } else { |
147 | 147 | $notes_table = GFFormsModel::get_lead_notes_table_name(); |
@@ -67,10 +67,10 @@ discard block |
||
67 | 67 | // Make sure the keys are all set |
68 | 68 | $note = wp_parse_args( $note, $default_note ); |
69 | 69 | |
70 | - GFFormsModel::add_note( intval( $note['lead_id'] ), intval( $note['user_id'] ), esc_attr( $note['user_name'] ), $note['note'], esc_attr( $note['note_type'] ) ); |
|
70 | + GFFormsModel::add_note( intval( $note[ 'lead_id' ] ), intval( $note[ 'user_id' ] ), esc_attr( $note[ 'user_name' ] ), $note[ 'note' ], esc_attr( $note[ 'note_type' ] ) ); |
|
71 | 71 | |
72 | 72 | // If last_error is empty string, there was no error. |
73 | - if( empty( $wpdb->last_error ) ) { |
|
73 | + if ( empty( $wpdb->last_error ) ) { |
|
74 | 74 | $return = $wpdb->insert_id; |
75 | 75 | } else { |
76 | 76 | $return = new WP_Error( 'gravityview-add-note', $wpdb->last_error ); |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | */ |
97 | 97 | public static function delete_notes( $note_ids = array() ) { |
98 | 98 | |
99 | - if( !is_array( $note_ids ) ) { |
|
99 | + if ( ! is_array( $note_ids ) ) { |
|
100 | 100 | |
101 | 101 | gravityview()->log->error( 'Note IDs not an array. Not processing delete request.', array( 'data' => $note_ids ) ); |
102 | 102 | |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | ) |
157 | 157 | ); |
158 | 158 | |
159 | - return $results ? $results[0] : false; |
|
159 | + return $results ? $results[ 0 ] : false; |
|
160 | 160 | } |
161 | 161 | |
162 | 162 | /** |
@@ -169,8 +169,8 @@ discard block |
||
169 | 169 | */ |
170 | 170 | public static function filter_avatar( $avatar = '', $note ) { |
171 | 171 | |
172 | - if( 'gravityview' === $note->note_type && -1 === (int)$note->user_id ) { |
|
173 | - $avatar = sprintf( '<img src="%s" width="48" height="48" alt="GravityView" class="avatar avatar-48 gravityview-avatar" />', esc_url_raw( plugins_url( 'assets/images/floaty-avatar.png', GRAVITYVIEW_FILE ) ) ); |
|
172 | + if ( 'gravityview' === $note->note_type && -1 === (int)$note->user_id ) { |
|
173 | + $avatar = sprintf( '<img src="%s" width="48" height="48" alt="GravityView" class="avatar avatar-48 gravityview-avatar" />', esc_url_raw( plugins_url( 'assets/images/floaty-avatar.png', GRAVITYVIEW_FILE ) ) ); |
|
174 | 174 | } |
175 | 175 | |
176 | 176 | return $avatar; |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | |
65 | 65 | add_filter( 'icl_ls_languages', array( $this, 'wpml_ls_filter' ) ); |
66 | 66 | |
67 | - add_filter( 'gravityview_directory_link', array( $this, 'filter_gravityview_back_link') ); |
|
67 | + add_filter( 'gravityview_directory_link', array( $this, 'filter_gravityview_back_link' ) ); |
|
68 | 68 | } |
69 | 69 | |
70 | 70 | /** |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | function filter_gravityview_back_link( $link ) { |
85 | 85 | global $wpml_url_filters; |
86 | 86 | |
87 | - if( $wpml_url_filters ) { |
|
87 | + if ( $wpml_url_filters ) { |
|
88 | 88 | $link = $wpml_url_filters->permalink_filter( $link, GravityView_frontend::getInstance()->getPostId() ); |
89 | 89 | } |
90 | 90 | |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | private function remove_url_hooks() { |
102 | 102 | global $wpml_url_filters; |
103 | 103 | |
104 | - if( ! $wpml_url_filters ) { |
|
104 | + if ( ! $wpml_url_filters ) { |
|
105 | 105 | return; |
106 | 106 | } |
107 | 107 | |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | private function add_url_hooks() { |
130 | 130 | global $wpml_url_filters; |
131 | 131 | |
132 | - if( ! $wpml_url_filters ) { |
|
132 | + if ( ! $wpml_url_filters ) { |
|
133 | 133 | return; |
134 | 134 | } |
135 | 135 | |
@@ -178,10 +178,10 @@ discard block |
||
178 | 178 | |
179 | 179 | $this->remove_url_hooks(); |
180 | 180 | |
181 | - if( $translations ) { |
|
181 | + if ( $translations ) { |
|
182 | 182 | foreach ( $languages as $lang_code => $language ) { |
183 | 183 | |
184 | - if( ! isset( $translations[ $lang_code ] ) || ! is_object( $translations[ $lang_code ] ) ) { |
|
184 | + if ( ! isset( $translations[ $lang_code ] ) || ! is_object( $translations[ $lang_code ] ) ) { |
|
185 | 185 | continue; |
186 | 186 | } |
187 | 187 | |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | break; |
216 | 216 | } |
217 | 217 | |
218 | - $languages[ $lang_code ]['url'] = $entry_link; |
|
218 | + $languages[ $lang_code ][ 'url' ] = $entry_link; |
|
219 | 219 | } |
220 | 220 | } |
221 | 221 |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | function edit_entry_fix_hidden_fields( $fields ) { |
50 | 50 | |
51 | 51 | /** @var GF_Field $field */ |
52 | - foreach( $fields as &$field ) { |
|
52 | + foreach ( $fields as &$field ) { |
|
53 | 53 | if ( 'hidden' === $field->type ) { |
54 | 54 | |
55 | 55 | /** |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | */ |
61 | 61 | $reveal_hidden_field = apply_filters( 'gravityview/edit_entry/reveal_hidden_field', true, $field ); |
62 | 62 | |
63 | - if( ! $reveal_hidden_field ) { |
|
63 | + if ( ! $reveal_hidden_field ) { |
|
64 | 64 | continue; |
65 | 65 | } |
66 | 66 |
@@ -10,6 +10,7 @@ discard block |
||
10 | 10 | * @internal |
11 | 11 | * @since 2.0 |
12 | 12 | * |
13 | + * @param \GravityView_View_Data $_this |
|
13 | 14 | * @return array|false The old array data, or false on error. |
14 | 15 | */ |
15 | 16 | function GravityView_View_Data_add_view( $view_id, $atts, $_this ) { |
@@ -62,6 +63,8 @@ discard block |
||
62 | 63 | * @internal |
63 | 64 | * @since 2.0 |
64 | 65 | * |
66 | + * @param integer $form_id |
|
67 | + * @param integer $count |
|
65 | 68 | * @return array The old associative array data as returned by |
66 | 69 | * \GravityView_frontend::get_view_entries(), the paging parameters |
67 | 70 | * and a total count of all entries. |
@@ -155,6 +158,7 @@ discard block |
||
155 | 158 | * @internal |
156 | 159 | * @since 2.0 |
157 | 160 | * |
161 | + * @param string $format |
|
158 | 162 | * @return null|string The value of a field in an entry. |
159 | 163 | */ |
160 | 164 | function GravityView_API_field_value( $entry, $field_settings, $format ) { |
@@ -96,18 +96,18 @@ discard block |
||
96 | 96 | $paging = \GV\Utils::get( $parameters, 'paging' ); |
97 | 97 | } else { |
98 | 98 | $entries = $form->entries |
99 | - ->filter( \GV\GF_Entry_Filter::from_search_criteria( $criteria['search_criteria'] ) ) |
|
100 | - ->offset( $args['offset'] ) |
|
101 | - ->limit( $criteria['paging']['page_size'] ); |
|
99 | + ->filter( \GV\GF_Entry_Filter::from_search_criteria( $criteria[ 'search_criteria' ] ) ) |
|
100 | + ->offset( $args[ 'offset' ] ) |
|
101 | + ->limit( $criteria[ 'paging' ][ 'page_size' ] ); |
|
102 | 102 | |
103 | - if ( $criteria['paging']['page_size'] ) { |
|
104 | - $entries = $entries->page( ( ( $criteria['paging']['offset'] - $args['offset'] ) / $criteria['paging']['page_size'] ) + 1 ); |
|
103 | + if ( $criteria[ 'paging' ][ 'page_size' ] ) { |
|
104 | + $entries = $entries->page( ( ( $criteria[ 'paging' ][ 'offset' ] - $args[ 'offset' ] ) / $criteria[ 'paging' ][ 'page_size' ] ) + 1 ); |
|
105 | 105 | } |
106 | 106 | |
107 | - if ( ! empty( $criteria['sorting'] ) ) { |
|
107 | + if ( ! empty( $criteria[ 'sorting' ] ) ) { |
|
108 | 108 | $field = new \GV\Field(); |
109 | - $field->ID = $criteria['sorting']['key']; |
|
110 | - switch( strtolower( $criteria['sorting']['direction'] ) ) { |
|
109 | + $field->ID = $criteria[ 'sorting' ][ 'key' ]; |
|
110 | + switch ( strtolower( $criteria[ 'sorting' ][ 'direction' ] ) ) { |
|
111 | 111 | case 'asc': |
112 | 112 | $direction = \GV\Entry_Sort::ASC; |
113 | 113 | break; |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | break; |
121 | 121 | } |
122 | 122 | |
123 | - $mode = $criteria['sorting']['is_numeric'] ? \GV\Entry_Sort::NUMERIC : \GV\Entry_Sort::ALPHA; |
|
123 | + $mode = $criteria[ 'sorting' ][ 'is_numeric' ] ? \GV\Entry_Sort::NUMERIC : \GV\Entry_Sort::ALPHA; |
|
124 | 124 | $entries = $entries->sort( new \GV\Entry_Sort( $field, $direction, $mode ) ); |
125 | 125 | } |
126 | 126 | |
@@ -158,16 +158,16 @@ discard block |
||
158 | 158 | * @return null|string The value of a field in an entry. |
159 | 159 | */ |
160 | 160 | function GravityView_API_field_value( $entry, $field_settings, $format ) { |
161 | - if ( empty( $entry['form_id'] ) || empty( $field_settings['id'] ) ) { |
|
161 | + if ( empty( $entry[ 'form_id' ] ) || empty( $field_settings[ 'id' ] ) ) { |
|
162 | 162 | gravityview()->log->error( 'No entry or field_settings[id] supplied', array( 'data' => array( func_get_args() ) ) ); |
163 | 163 | return null; |
164 | 164 | } |
165 | 165 | |
166 | - if ( ! empty( $entry['_multi'] ) && ! empty( $field_settings['form_id'] ) && ! empty( $entry['_multi'][ $field_settings['form_id'] ] ) ) { |
|
167 | - $entry = $entry['_multi'][ $field_settings['form_id'] ]; |
|
166 | + if ( ! empty( $entry[ '_multi' ] ) && ! empty( $field_settings[ 'form_id' ] ) && ! empty( $entry[ '_multi' ][ $field_settings[ 'form_id' ] ] ) ) { |
|
167 | + $entry = $entry[ '_multi' ][ $field_settings[ 'form_id' ] ]; |
|
168 | 168 | } |
169 | 169 | |
170 | - if ( empty( $entry['id'] ) || ! $entry = \GV\GF_Entry::by_id( $entry['id'] ) ) { |
|
170 | + if ( empty( $entry[ 'id' ] ) || ! $entry = \GV\GF_Entry::by_id( $entry[ 'id' ] ) ) { |
|
171 | 171 | gravityview()->log->error( 'Invalid \GV\GF_Entry supplied', array( 'data' => $entry ) ); |
172 | 172 | return null; |
173 | 173 | } |
@@ -177,18 +177,18 @@ discard block |
||
177 | 177 | * |
178 | 178 | * Fields with a numeric ID are Gravity Forms ones. |
179 | 179 | */ |
180 | - $source = is_numeric( $field_settings['id'] ) ? \GV\Source::BACKEND_GRAVITYFORMS : \GV\Source::BACKEND_INTERNAL;; |
|
180 | + $source = is_numeric( $field_settings[ 'id' ] ) ? \GV\Source::BACKEND_GRAVITYFORMS : \GV\Source::BACKEND_INTERNAL; ; |
|
181 | 181 | |
182 | 182 | /** Initialize the future field. */ |
183 | 183 | switch ( $source ): |
184 | 184 | /** The Gravity Forms backend. */ |
185 | 185 | case \GV\Source::BACKEND_GRAVITYFORMS: |
186 | - if ( ! $form = \GV\GF_Form::by_id( $entry['form_id'] ) ) { |
|
186 | + if ( ! $form = \GV\GF_Form::by_id( $entry[ 'form_id' ] ) ) { |
|
187 | 187 | gravityview()->log->error( 'No form Gravity Form found for entry', array( 'data' => $entry ) ); |
188 | 188 | return null; |
189 | 189 | } |
190 | 190 | |
191 | - if ( ! $field = $form::get_field( $form, $field_settings['id'] ) ) { |
|
191 | + if ( ! $field = $form::get_field( $form, $field_settings[ 'id' ] ) ) { |
|
192 | 192 | return null; |
193 | 193 | } |
194 | 194 | |
@@ -196,7 +196,7 @@ discard block |
||
196 | 196 | |
197 | 197 | /** Our internal backend. */ |
198 | 198 | case \GV\Source::BACKEND_INTERNAL: |
199 | - if ( ! $field = \GV\Internal_Source::get_field( $field_settings['id'] ) ) { |
|
199 | + if ( ! $field = \GV\Internal_Source::get_field( $field_settings[ 'id' ] ) ) { |
|
200 | 200 | return null; |
201 | 201 | } |
202 | 202 | |
@@ -230,13 +230,13 @@ discard block |
||
230 | 230 | |
231 | 231 | /** A bail condition. */ |
232 | 232 | $bail = function( $label, $field_settings, $entry, $force_show_label, $form ) { |
233 | - if ( ! empty( $field_settings['show_label'] ) || $force_show_label ) { |
|
233 | + if ( ! empty( $field_settings[ 'show_label' ] ) || $force_show_label ) { |
|
234 | 234 | |
235 | - $label = isset( $field_settings['label'] ) ? $field_settings['label'] : ''; |
|
235 | + $label = isset( $field_settings[ 'label' ] ) ? $field_settings[ 'label' ] : ''; |
|
236 | 236 | |
237 | 237 | // Use Gravity Forms label by default, but if a custom label is defined in GV, use it. |
238 | - if ( ! empty( $field_settings['custom_label'] ) ) { |
|
239 | - $label = \GravityView_API::replace_variables( $field_settings['custom_label'], $form, $entry ); |
|
238 | + if ( ! empty( $field_settings[ 'custom_label' ] ) ) { |
|
239 | + $label = \GravityView_API::replace_variables( $field_settings[ 'custom_label' ], $form, $entry ); |
|
240 | 240 | } |
241 | 241 | |
242 | 242 | /** |
@@ -262,19 +262,19 @@ discard block |
||
262 | 262 | |
263 | 263 | $label = ''; |
264 | 264 | |
265 | - if ( ! empty( $entry['_multi'] ) && ! empty( $field_settings['form_id'] ) && ! empty( $entry['_multi'][ $field_settings['form_id'] ] ) ) { |
|
266 | - $entry = $entry['_multi'][ $field_settings['form_id'] ]; |
|
267 | - if ( $_form = \GV\GF_Form::by_id( $field_settings['form_id'] ) ) { |
|
265 | + if ( ! empty( $entry[ '_multi' ] ) && ! empty( $field_settings[ 'form_id' ] ) && ! empty( $entry[ '_multi' ][ $field_settings[ 'form_id' ] ] ) ) { |
|
266 | + $entry = $entry[ '_multi' ][ $field_settings[ 'form_id' ] ]; |
|
267 | + if ( $_form = \GV\GF_Form::by_id( $field_settings[ 'form_id' ] ) ) { |
|
268 | 268 | $form = $_form->form; |
269 | 269 | } |
270 | 270 | } |
271 | 271 | |
272 | - if ( empty( $entry['form_id'] ) || empty( $field_settings['id'] ) ) { |
|
272 | + if ( empty( $entry[ 'form_id' ] ) || empty( $field_settings[ 'id' ] ) ) { |
|
273 | 273 | gravityview()->log->error( 'No entry or field_settings[id] supplied', array( 'data' => array( func_get_args() ) ) ); |
274 | 274 | return $bail( $label, $field_settings, $entry, $force_show_label, $form ); |
275 | 275 | } |
276 | 276 | |
277 | - if ( empty( $entry['id'] ) || ! $gv_entry = \GV\GF_Entry::by_id( $entry['id'] ) ) { |
|
277 | + if ( empty( $entry[ 'id' ] ) || ! $gv_entry = \GV\GF_Entry::by_id( $entry[ 'id' ] ) ) { |
|
278 | 278 | gravityview()->log->error( 'Invalid \GV\GF_Entry supplied', array( 'data' => $entry ) ); |
279 | 279 | return $bail( $label, $field_settings, $entry, $force_show_label, $form ); |
280 | 280 | } |
@@ -286,31 +286,31 @@ discard block |
||
286 | 286 | * |
287 | 287 | * Fields with a numeric ID are Gravity Forms ones. |
288 | 288 | */ |
289 | - $source = is_numeric( $field_settings['id'] ) ? \GV\Source::BACKEND_GRAVITYFORMS : \GV\Source::BACKEND_INTERNAL; |
|
289 | + $source = is_numeric( $field_settings[ 'id' ] ) ? \GV\Source::BACKEND_GRAVITYFORMS : \GV\Source::BACKEND_INTERNAL; |
|
290 | 290 | |
291 | 291 | /** Initialize the future field. */ |
292 | 292 | switch ( $source ): |
293 | 293 | /** The Gravity Forms backend. */ |
294 | 294 | case \GV\Source::BACKEND_GRAVITYFORMS: |
295 | - if ( ! $gf_form = \GV\GF_Form::by_id( $entry['form_id'] ) ) { |
|
295 | + if ( ! $gf_form = \GV\GF_Form::by_id( $entry[ 'form_id' ] ) ) { |
|
296 | 296 | gravityview()->log->error( 'No form Gravity Form found for entry', array( 'data' => $entry ) ); |
297 | 297 | return $bail( $label, $field_settings, $entry->as_entry(), $force_show_label, $form ); |
298 | 298 | } |
299 | 299 | |
300 | - if ( ! $field = $gf_form::get_field( $gf_form, $field_settings['id'] ) ) { |
|
301 | - gravityview()->log->error( 'No field found for specified form and field ID #{field_id}', array( 'field_id' => $field_settings['id'], 'data' => $form ) ); |
|
300 | + if ( ! $field = $gf_form::get_field( $gf_form, $field_settings[ 'id' ] ) ) { |
|
301 | + gravityview()->log->error( 'No field found for specified form and field ID #{field_id}', array( 'field_id' => $field_settings[ 'id' ], 'data' => $form ) ); |
|
302 | 302 | return $bail( $label, $field_settings, $entry->as_entry(), $force_show_label, $gf_form->form ); |
303 | 303 | } |
304 | - if ( empty( $field_settings['show_label'] ) ) { |
|
304 | + if ( empty( $field_settings[ 'show_label' ] ) ) { |
|
305 | 305 | /** The label never wins... */ |
306 | - $field_settings['label'] = ''; |
|
306 | + $field_settings[ 'label' ] = ''; |
|
307 | 307 | } |
308 | 308 | |
309 | 309 | break; |
310 | 310 | |
311 | 311 | /** Our internal backend. */ |
312 | 312 | case \GV\Source::BACKEND_INTERNAL: |
313 | - if ( ! $field = \GV\Internal_Source::get_field( $field_settings['id'] ) ) { |
|
313 | + if ( ! $field = \GV\Internal_Source::get_field( $field_settings[ 'id' ] ) ) { |
|
314 | 314 | return $bail( $label, $field_settings, $entry->as_entry(), $force_show_label, $form ); |
315 | 315 | } |
316 | 316 | break; |
@@ -453,7 +453,7 @@ discard block |
||
453 | 453 | '\GravityView_frontend::entry' => \GravityView_frontend::getInstance()->getEntry(), |
454 | 454 | '\GravityView_View::_current_entry' => \GravityView_View::getInstance()->getCurrentEntry(), |
455 | 455 | '\GravityView_View::fields' => \GravityView_View::getInstance()->getFields(), |
456 | - 'wp_actions[loop_start]' => empty( $wp_actions['loop_start'] ) ? 0 : $wp_actions['loop_start'], |
|
456 | + 'wp_actions[loop_start]' => empty( $wp_actions[ 'loop_start' ] ) ? 0 : $wp_actions[ 'loop_start' ], |
|
457 | 457 | 'wp_query::in_the_loop' => $wp_query->in_the_loop, |
458 | 458 | ); |
459 | 459 | } |
@@ -535,7 +535,7 @@ discard block |
||
535 | 535 | break; |
536 | 536 | case 'wp_actions[loop_start]': |
537 | 537 | global $wp_actions; |
538 | - $wp_actions['loop_start'] = $value; |
|
538 | + $wp_actions[ 'loop_start' ] = $value; |
|
539 | 539 | break; |
540 | 540 | case 'wp_query::in_the_loop': |
541 | 541 | global $wp_query; |
@@ -613,9 +613,7 @@ discard block |
||
613 | 613 | case 'request': |
614 | 614 | self::thaw( array( |
615 | 615 | '\GravityView_View::context' => ( |
616 | - $value->is_entry() ? 'single' : |
|
617 | - ( $value->is_edit_entry() ? 'edit' : |
|
618 | - ( $value->is_view() ? 'directory': null ) |
|
616 | + $value->is_entry() ? 'single' : ( $value->is_edit_entry() ? 'edit' : ( $value->is_view() ? 'directory' : null ) |
|
619 | 617 | ) |
620 | 618 | ), |
621 | 619 | '\GravityView_frontend::is_search' => $value->is_search(), |
@@ -669,14 +667,14 @@ discard block |
||
669 | 667 | global $wp_query, $wp_actions; |
670 | 668 | |
671 | 669 | $wp_query->in_the_loop = false; |
672 | - $wp_actions['loop_start'] = 0; |
|
670 | + $wp_actions[ 'loop_start' ] = 0; |
|
673 | 671 | } |
674 | 672 | } |
675 | 673 | |
676 | 674 | |
677 | 675 | /** Add some global fix for field capability discrepancies. */ |
678 | 676 | add_filter( 'gravityview/configuration/fields', function( $fields ) { |
679 | - if ( empty( $fields ) ) { |
|
677 | + if ( empty( $fields ) ) { |
|
680 | 678 | return $fields; |
681 | 679 | } |
682 | 680 | |
@@ -703,11 +701,11 @@ discard block |
||
703 | 701 | } |
704 | 702 | |
705 | 703 | foreach ( $_fields as $uid => &$_field ) { |
706 | - if ( ! isset( $_field['only_loggedin'] ) ) { |
|
704 | + if ( ! isset( $_field[ 'only_loggedin' ] ) ) { |
|
707 | 705 | continue; |
708 | 706 | } |
709 | 707 | /** If we do not require login, we don't require a cap. */ |
710 | - $_field['only_loggedin'] != '1' && ( $_field['only_loggedin_cap'] = '' ); |
|
708 | + $_field[ 'only_loggedin' ] != '1' && ( $_field[ 'only_loggedin_cap' ] = '' ); |
|
711 | 709 | } |
712 | 710 | } |
713 | 711 | return $fields; |
@@ -738,8 +736,8 @@ discard block |
||
738 | 736 | } |
739 | 737 | |
740 | 738 | foreach ( $_fields as $uid => &$_field ) { |
741 | - if ( ! empty( $_field['id'] ) && is_numeric( $_field['id'] ) && empty( $_field['form_id'] ) ) { |
|
742 | - $_field['form_id'] = $view->form->ID; |
|
739 | + if ( ! empty( $_field[ 'id' ] ) && is_numeric( $_field[ 'id' ] ) && empty( $_field[ 'form_id' ] ) ) { |
|
740 | + $_field[ 'form_id' ] = $view->form->ID; |
|
743 | 741 | } |
744 | 742 | } |
745 | 743 | } |
@@ -753,25 +751,25 @@ discard block |
||
753 | 751 | if ( class_exists( '\GravityView_frontend' ) ) { |
754 | 752 | global $wp_filter; |
755 | 753 | |
756 | - if ( empty( $wp_filter['gravityview_after'] ) ) { |
|
754 | + if ( empty( $wp_filter[ 'gravityview_after' ] ) ) { |
|
757 | 755 | return; |
758 | 756 | } |
759 | 757 | |
760 | 758 | /** WordPress 4.6 and lower compatibility, when WP_Hook classes were still absent. */ |
761 | - if ( is_array( $wp_filter['gravityview_after'] ) ) { |
|
762 | - if ( ! empty( $wp_filter['gravityview_after'][10] ) ) { |
|
763 | - foreach ( $wp_filter['gravityview_after'][10] as $function_key => $callback ) { |
|
759 | + if ( is_array( $wp_filter[ 'gravityview_after' ] ) ) { |
|
760 | + if ( ! empty( $wp_filter[ 'gravityview_after' ][ 10 ] ) ) { |
|
761 | + foreach ( $wp_filter[ 'gravityview_after' ][ 10 ] as $function_key => $callback ) { |
|
764 | 762 | if ( strpos( $function_key, 'context_not_configured_warning' ) ) { |
765 | - unset( $wp_filter['gravityview_after'][10][ $function_key ] ); |
|
763 | + unset( $wp_filter[ 'gravityview_after' ][ 10 ][ $function_key ] ); |
|
766 | 764 | } |
767 | 765 | } |
768 | 766 | } |
769 | 767 | return; |
770 | 768 | } |
771 | 769 | |
772 | - foreach ( $wp_filter['gravityview_after']->callbacks[10] as $function_key => $callback ) { |
|
770 | + foreach ( $wp_filter[ 'gravityview_after' ]->callbacks[ 10 ] as $function_key => $callback ) { |
|
773 | 771 | if ( strpos( $function_key, 'context_not_configured_warning' ) ) { |
774 | - unset( $wp_filter['gravityview_after']->callbacks[10][ $function_key ] ); |
|
772 | + unset( $wp_filter[ 'gravityview_after' ]->callbacks[ 10 ][ $function_key ] ); |
|
775 | 773 | } |
776 | 774 | } |
777 | 775 | } |
@@ -102,7 +102,7 @@ |
||
102 | 102 | * |
103 | 103 | * @param array $entry The array ID. |
104 | 104 | * |
105 | - * @return \GV\Entry|null An instance of this entry or null if not found. |
|
105 | + * @return null|GF_Entry An instance of this entry or null if not found. |
|
106 | 106 | */ |
107 | 107 | public static function from_entry( $entry ) { |
108 | 108 | if ( empty( $entry['id'] ) ) { |
@@ -105,14 +105,14 @@ discard block |
||
105 | 105 | * @return \GV\Entry|null An instance of this entry or null if not found. |
106 | 106 | */ |
107 | 107 | public static function from_entry( $entry ) { |
108 | - if ( empty( $entry['id'] ) ) { |
|
108 | + if ( empty( $entry[ 'id' ] ) ) { |
|
109 | 109 | return null; |
110 | 110 | } |
111 | 111 | |
112 | 112 | $self = new self(); |
113 | 113 | $self->entry = $entry; |
114 | 114 | |
115 | - $self->ID = $self->entry['id']; |
|
115 | + $self->ID = $self->entry[ 'id' ]; |
|
116 | 116 | $self->slug = \GravityView_API::get_entry_slug( $self->ID, $self->as_entry() ); |
117 | 117 | |
118 | 118 | return $self; |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | * @return bool Whether the offset exists or not. |
128 | 128 | */ |
129 | 129 | public function offsetExists( $offset ) { |
130 | - return isset( $this->entry[$offset] ); |
|
130 | + return isset( $this->entry[ $offset ] ); |
|
131 | 131 | } |
132 | 132 | |
133 | 133 | /** |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | * @return mixed The value of the requested entry data. |
143 | 143 | */ |
144 | 144 | public function offsetGet( $offset ) { |
145 | - return $this->entry[$offset]; |
|
145 | + return $this->entry[ $offset ]; |
|
146 | 146 | } |
147 | 147 | |
148 | 148 | /** |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | * - Checks PHP version numbers |
208 | 208 | * - Sets self::$is_compatible[__CLASS__] to boolean value |
209 | 209 | * |
210 | - * @return boolean Is the extension supported? |
|
210 | + * @return boolean|null Is the extension supported? |
|
211 | 211 | */ |
212 | 212 | protected function is_extension_supported() { |
213 | 213 | |
@@ -329,7 +329,7 @@ discard block |
||
329 | 329 | /** |
330 | 330 | * Add a notice to be displayed in the admin. |
331 | 331 | * |
332 | - * @param array $notice Array with `class` and `message` keys. The message is not escaped. |
|
332 | + * @param string $notice Array with `class` and `message` keys. The message is not escaped. |
|
333 | 333 | * |
334 | 334 | * @return void |
335 | 335 | */ |
@@ -244,13 +244,13 @@ |
||
244 | 244 | $this->_remote_update_url, |
245 | 245 | $this->_path, |
246 | 246 | array( |
247 | - 'version' => $this->_version, // current version number |
|
248 | - 'license' => $license['license'], |
|
249 | - 'item_id' => $this->_item_id, // The ID of the download on _remote_update_url |
|
250 | - 'item_name' => $this->_title, // name of this plugin |
|
251 | - 'author' => strip_tags( $this->_author ) // author of this plugin |
|
252 | - ) |
|
253 | - ); |
|
247 | + 'version' => $this->_version, // current version number |
|
248 | + 'license' => $license['license'], |
|
249 | + 'item_id' => $this->_item_id, // The ID of the download on _remote_update_url |
|
250 | + 'item_name' => $this->_title, // name of this plugin |
|
251 | + 'author' => strip_tags( $this->_author ) // author of this plugin |
|
252 | + ) |
|
253 | + ); |
|
254 | 254 | } |
255 | 255 | |
256 | 256 | /** |
@@ -180,13 +180,13 @@ discard block |
||
180 | 180 | $tab = wp_parse_args( $tab_settings, $tab_defaults ); |
181 | 181 | |
182 | 182 | // Force the screen to be GravityView |
183 | - $tab['screen'] = 'gravityview'; |
|
183 | + $tab[ 'screen' ] = 'gravityview'; |
|
184 | 184 | |
185 | 185 | if ( class_exists( 'GravityView_Metabox_Tab' ) ) { |
186 | - $metabox = new \GravityView_Metabox_Tab( $tab['id'], $tab['title'], $tab['file'], $tab['icon-class'], $tab['callback'], $tab['callback_args'] ); |
|
186 | + $metabox = new \GravityView_Metabox_Tab( $tab[ 'id' ], $tab[ 'title' ], $tab[ 'file' ], $tab[ 'icon-class' ], $tab[ 'callback' ], $tab[ 'callback_args' ] ); |
|
187 | 187 | \GravityView_Metabox_Tabs::add( $metabox ); |
188 | 188 | } else { |
189 | - add_meta_box( 'gravityview_' . $tab['id'], $tab['title'], $tab['callback'], $tab['screen'], $tab['context'], $tab['priority'] ); |
|
189 | + add_meta_box( 'gravityview_' . $tab[ 'id' ], $tab[ 'title' ], $tab[ 'callback' ], $tab[ 'screen' ], $tab[ 'context' ], $tab[ 'priority' ] ); |
|
190 | 190 | } |
191 | 191 | } |
192 | 192 | |
@@ -211,14 +211,14 @@ discard block |
||
211 | 211 | */ |
212 | 212 | protected function is_extension_supported() { |
213 | 213 | |
214 | - self::$is_compatible = is_array( self::$is_compatible ) ? self::$is_compatible : array( get_called_class() => (bool) self::$is_compatible ); |
|
214 | + self::$is_compatible = is_array( self::$is_compatible ) ? self::$is_compatible : array( get_called_class() => (bool)self::$is_compatible ); |
|
215 | 215 | |
216 | 216 | if ( ! function_exists( 'gravityview' ) ) { |
217 | 217 | $message = sprintf( __( 'Could not activate the %s Extension; GravityView is not active.', 'gravityview' ), esc_html( $this->_title ) ); |
218 | - } else if ( false === version_compare( Plugin::$version, $this->_min_gravityview_version , ">=" ) ) { |
|
219 | - $message = sprintf( __( 'The %s Extension requires GravityView Version %s or newer.', 'gravityview' ), esc_html( $this->_title ), '<tt>'.$this->_min_gravityview_version.'</tt>' ); |
|
220 | - } else if ( isset( $this->_min_php_version ) && false === version_compare( phpversion(), $this->_min_php_version , ">=" ) ) { |
|
221 | - $message = sprintf( __( 'The %s Extension requires PHP Version %s or newer. Please ask your host to upgrade your server\'s PHP.', 'gravityview' ), esc_html( $this->_title ), '<tt>'.$this->_min_php_version.'</tt>' ); |
|
218 | + } else if ( false === version_compare( Plugin::$version, $this->_min_gravityview_version, ">=" ) ) { |
|
219 | + $message = sprintf( __( 'The %s Extension requires GravityView Version %s or newer.', 'gravityview' ), esc_html( $this->_title ), '<tt>' . $this->_min_gravityview_version . '</tt>' ); |
|
220 | + } else if ( isset( $this->_min_php_version ) && false === version_compare( phpversion(), $this->_min_php_version, ">=" ) ) { |
|
221 | + $message = sprintf( __( 'The %s Extension requires PHP Version %s or newer. Please ask your host to upgrade your server\'s PHP.', 'gravityview' ), esc_html( $this->_title ), '<tt>' . $this->_min_php_version . '</tt>' ); |
|
222 | 222 | } else if ( ! empty( $this->_max_gravityview_version ) && false === version_compare( $this->_max_gravityview_version, Plugin::$version, ">" ) ) { |
223 | 223 | $message = sprintf( __( 'The %s Extension is not compatible with this version of GravityView. Please update the Extension to the latest version.', 'gravityview' ), esc_html( $this->_title ) ); |
224 | 224 | } else { |
@@ -257,7 +257,7 @@ discard block |
||
257 | 257 | $lang_dir = dirname( plugin_basename( $path ) ) . '/languages/'; |
258 | 258 | |
259 | 259 | // Traditional WordPress plugin locale filter |
260 | - $locale = apply_filters( 'plugin_locale', get_locale(), $this->_text_domain ); |
|
260 | + $locale = apply_filters( 'plugin_locale', get_locale(), $this->_text_domain ); |
|
261 | 261 | |
262 | 262 | $mofile = sprintf( '%1$s-%2$s.mo', $this->_text_domain, $locale ); |
263 | 263 | |
@@ -284,7 +284,7 @@ discard block |
||
284 | 284 | */ |
285 | 285 | public function settings() { |
286 | 286 | // If doing ajax, get outta here |
287 | - if ( ! is_admin() || ( defined( 'DOING_AJAX' ) && DOING_AJAX ) ) { |
|
287 | + if ( ! is_admin() || ( defined( 'DOING_AJAX' ) && DOING_AJAX ) ) { |
|
288 | 288 | return; |
289 | 289 | } |
290 | 290 | |
@@ -295,7 +295,7 @@ discard block |
||
295 | 295 | } |
296 | 296 | |
297 | 297 | // Don't update if invalid license. |
298 | - if ( false === $license || empty( $license['status'] ) || strtolower( $license['status'] ) !== 'valid' ) { |
|
298 | + if ( false === $license || empty( $license[ 'status' ] ) || strtolower( $license[ 'status' ] ) !== 'valid' ) { |
|
299 | 299 | return; |
300 | 300 | } |
301 | 301 | |
@@ -304,9 +304,9 @@ discard block |
||
304 | 304 | $this->_path, |
305 | 305 | array( |
306 | 306 | 'version' => $this->_version, // current version number |
307 | - 'license' => $license['license'], |
|
307 | + 'license' => $license[ 'license' ], |
|
308 | 308 | 'item_id' => $this->_item_id, // The ID of the download on _remote_update_url |
309 | - 'item_name' => $this->_title, // name of this plugin |
|
309 | + 'item_name' => $this->_title, // name of this plugin |
|
310 | 310 | 'author' => strip_tags( $this->_author ) // author of this plugin |
311 | 311 | ) |
312 | 312 | ); |
@@ -335,16 +335,16 @@ discard block |
||
335 | 335 | */ |
336 | 336 | public static function add_notice( $notice = array() ) { |
337 | 337 | |
338 | - if ( is_array( $notice ) && empty( $notice['message'] ) ) { |
|
338 | + if ( is_array( $notice ) && empty( $notice[ 'message' ] ) ) { |
|
339 | 339 | gravityview()->log->error( 'Notice not set', array( 'data' => $notice ) ); |
340 | 340 | return; |
341 | 341 | } else if ( is_string( $notice ) ) { |
342 | 342 | $notice = array( 'message' => $notice ); |
343 | 343 | } |
344 | 344 | |
345 | - $notice['class'] = empty( $notice['class'] ) ? 'error' : $notice['class']; |
|
345 | + $notice[ 'class' ] = empty( $notice[ 'class' ] ) ? 'error' : $notice[ 'class' ]; |
|
346 | 346 | |
347 | - self::$admin_notices []= $notice; |
|
347 | + self::$admin_notices [ ] = $notice; |
|
348 | 348 | } |
349 | 349 | |
350 | 350 | /** |
@@ -358,8 +358,8 @@ discard block |
||
358 | 358 | } |
359 | 359 | |
360 | 360 | foreach ( self::$admin_notices as $key => $notice ) { |
361 | - echo '<div id="message" class="'. esc_attr( $notice['class'] ).'">'; |
|
362 | - echo wpautop( $notice['message'] ); |
|
361 | + echo '<div id="message" class="' . esc_attr( $notice[ 'class' ] ) . '">'; |
|
362 | + echo wpautop( $notice[ 'message' ] ); |
|
363 | 363 | echo '<div class="clear"></div>'; |
364 | 364 | echo '</div>'; |
365 | 365 | } |
@@ -284,7 +284,7 @@ |
||
284 | 284 | */ |
285 | 285 | public function settings() { |
286 | 286 | // If doing ajax, get outta here |
287 | - if ( ! is_admin() || ( defined( 'DOING_AJAX' ) && DOING_AJAX ) ) { |
|
287 | + if ( ! is_admin() || ( defined( 'DOING_AJAX' ) && DOING_AJAX ) ) { |
|
288 | 288 | return; |
289 | 289 | } |
290 | 290 |
@@ -54,7 +54,7 @@ |
||
54 | 54 | * @param \GV\GF_Form $form The Gravity Form form. |
55 | 55 | * @param int $field_id The Gravity Form field ID for the $form. |
56 | 56 | * |
57 | - * @return \GV\Field|null The requested field or null if not found. |
|
57 | + * @return null|GF_Field The requested field or null if not found. |
|
58 | 58 | */ |
59 | 59 | public static function by_id( $form, $field_id ) { |
60 | 60 |
@@ -27,17 +27,17 @@ discard block |
||
27 | 27 | * @return \GV\GF_Field|null The field implementation or null on error. |
28 | 28 | */ |
29 | 29 | public static function from_configuration( $configuration ) { |
30 | - if ( empty( $configuration['id'] ) || ! is_numeric( $configuration['id'] ) ) { |
|
30 | + if ( empty( $configuration[ 'id' ] ) || ! is_numeric( $configuration[ 'id' ] ) ) { |
|
31 | 31 | gravityview()->log->error( 'Invalid configuration[id] supplied.' ); |
32 | 32 | return null; |
33 | 33 | } |
34 | 34 | |
35 | - if ( empty( $configuration['form_id'] ) || ! $form = \GV\GF_Form::by_id( $configuration['form_id'] ) ) { |
|
35 | + if ( empty( $configuration[ 'form_id' ] ) || ! $form = \GV\GF_Form::by_id( $configuration[ 'form_id' ] ) ) { |
|
36 | 36 | gravityview()->log->error( 'Invalid configuration[form_id] supplied.' ); |
37 | 37 | return null; |
38 | 38 | } |
39 | 39 | |
40 | - $field = self::by_id( $form, $configuration['id'] ); |
|
40 | + $field = self::by_id( $form, $configuration[ 'id' ] ); |
|
41 | 41 | |
42 | 42 | if ( ! $field ) { |
43 | 43 | gravityview()->log->error( 'Invalid configuration[id] supplied.' ); |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | |
112 | 112 | /** This is a complex Gravity Forms input. */ |
113 | 113 | if ( $input = \GFFormsModel::get_input( $this->field, $this->ID ) ) { |
114 | - $label = ! empty( $input['customLabel'] ) ? $input['customLabel'] : $input['label']; |
|
114 | + $label = ! empty( $input[ 'customLabel' ] ) ? $input[ 'customLabel' ] : $input[ 'label' ]; |
|
115 | 115 | } else { |
116 | 116 | /** This is a field with one label. */ |
117 | 117 | $label = $this->field->get_field_label( true, $this->label ); |
@@ -132,10 +132,8 @@ |
||
132 | 132 | /** |
133 | 133 | * Get a \GV\Field by Form and Field ID for this data source. |
134 | 134 | * |
135 | - * @param \GV\GF_Form $form The Gravity Form form ID. |
|
136 | - * @param int $field_id The Gravity Form field ID for the $form_id. |
|
137 | 135 | * |
138 | - * @return \GV\Field|null The requested field or null if not found. |
|
136 | + * @return null|GF_Field The requested field or null if not found. |
|
139 | 137 | */ |
140 | 138 | public static function get_field( /** varargs */ ) { |
141 | 139 | $args = func_get_args(); |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | $self = new self(); |
56 | 56 | $self->form = $form; |
57 | 57 | |
58 | - $self->ID = $self->form['id']; |
|
58 | + $self->ID = $self->form[ 'id' ]; |
|
59 | 59 | |
60 | 60 | return $self; |
61 | 61 | } |
@@ -98,11 +98,11 @@ discard block |
||
98 | 98 | |
99 | 99 | /** The offset and limit */ |
100 | 100 | if ( ! empty( $offset->limit ) ) { |
101 | - $paging['page_size'] = $offset->limit; |
|
101 | + $paging[ 'page_size' ] = $offset->limit; |
|
102 | 102 | } |
103 | 103 | |
104 | 104 | if ( ! empty( $offset->offset ) ) { |
105 | - $paging['offset'] = $offset->offset; |
|
105 | + $paging[ 'offset' ] = $offset->offset; |
|
106 | 106 | } |
107 | 107 | |
108 | 108 | foreach ( \GFAPI::get_entries( $form->ID, $search_criteria, $sorting, $paging ) as $entry ) { |
@@ -159,8 +159,8 @@ discard block |
||
159 | 159 | */ |
160 | 160 | public function get_fields() { |
161 | 161 | $fields = array(); |
162 | - foreach ( $this['fields'] as $field ) { |
|
163 | - foreach ( empty( $field['inputs'] ) ? array( $field['id'] ) : wp_list_pluck( $field['inputs'], 'id' ) as $id ) { |
|
162 | + foreach ( $this[ 'fields' ] as $field ) { |
|
163 | + foreach ( empty( $field[ 'inputs' ] ) ? array( $field[ 'id' ] ) : wp_list_pluck( $field[ 'inputs' ], 'id' ) as $id ) { |
|
164 | 164 | if ( is_numeric( $id ) ) { |
165 | 165 | $fields[ $id ] = self::get_field( $this, $id ); |
166 | 166 | } else { |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | * @return bool Whether the offset exists or not. |
198 | 198 | */ |
199 | 199 | public function offsetExists( $offset ) { |
200 | - return isset( $this->form[$offset] ); |
|
200 | + return isset( $this->form[ $offset ] ); |
|
201 | 201 | } |
202 | 202 | |
203 | 203 | /** |
@@ -212,7 +212,7 @@ discard block |
||
212 | 212 | * @return mixed The value of the requested form data. |
213 | 213 | */ |
214 | 214 | public function offsetGet( $offset ) { |
215 | - return $this->form[$offset]; |
|
215 | + return $this->form[ $offset ]; |
|
216 | 216 | } |
217 | 217 | |
218 | 218 | /** |