@@ -43,12 +43,12 @@ discard block |
||
43 | 43 | function parse_um_profile_post_content( $args = array() ) { |
44 | 44 | global $ultimatemember; |
45 | 45 | |
46 | - if( ! $ultimatemember || ! is_object( $ultimatemember ) || ! class_exists( 'GravityView_View_Data' ) ) { |
|
46 | + if ( ! $ultimatemember || ! is_object( $ultimatemember ) || ! class_exists( 'GravityView_View_Data' ) ) { |
|
47 | 47 | return; |
48 | 48 | } |
49 | 49 | |
50 | 50 | // @todo Support Ultimate Member 2.0 - for now, prevent fatal error |
51 | - if( ! isset( $ultimatemember->profile ) ) { |
|
51 | + if ( ! isset( $ultimatemember->profile ) ) { |
|
52 | 52 | return; |
53 | 53 | } |
54 | 54 | |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | return; |
65 | 65 | } |
66 | 66 | |
67 | - GravityView_View_Data::getInstance()->parse_post_content( $active_tab[0]->post_content ); |
|
67 | + GravityView_View_Data::getInstance()->parse_post_content( $active_tab[ 0 ]->post_content ); |
|
68 | 68 | |
69 | 69 | wp_reset_postdata(); |
70 | 70 | } |
@@ -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 |
@@ -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 ) { |
@@ -102,8 +102,7 @@ discard block |
||
102 | 102 | $entries = $view->get_entries( gravityview()->request ); |
103 | 103 | } |
104 | 104 | |
105 | - $page = \GV\Utils::get( $parameters['paging'], 'current_page' ) ? |
|
106 | - : ( ( ( $parameters['paging']['offset'] - $view->settings->get( 'offset' ) ) / $parameters['paging']['page_size'] ) + 1 ); |
|
105 | + $page = \GV\Utils::get( $parameters[ 'paging' ], 'current_page' ) ?: ( ( ( $parameters[ 'paging' ][ 'offset' ] - $view->settings->get( 'offset' ) ) / $parameters[ 'paging' ][ 'page_size' ] ) + 1 ); |
|
107 | 106 | |
108 | 107 | /** Set paging, count and unwrap the entries. */ |
109 | 108 | $paging = array( |
@@ -142,17 +141,17 @@ discard block |
||
142 | 141 | * @return null|string The value of a field in an entry. |
143 | 142 | */ |
144 | 143 | function GravityView_API_field_value( $entry, $field_settings, $format ) { |
145 | - if ( empty( $entry['form_id'] ) || empty( $field_settings['id'] ) ) { |
|
144 | + if ( empty( $entry[ 'form_id' ] ) || empty( $field_settings[ 'id' ] ) ) { |
|
146 | 145 | gravityview()->log->error( 'No entry or field_settings[id] supplied', array( 'data' => array( func_get_args() ) ) ); |
147 | 146 | return null; |
148 | 147 | } |
149 | 148 | |
150 | - if ( ! empty( $entry['_multi'] ) && ! empty( $field_settings['form_id'] ) && ! empty( $entry['_multi'][ $field_settings['form_id'] ] ) ) { |
|
151 | - $multientry = \GV\Multi_Entry::from_entries( array_map( '\GV\GF_Entry::from_entry', $entry['_multi'] ) ); |
|
152 | - $entry = $entry['_multi'][ $field_settings['form_id'] ]; |
|
149 | + if ( ! empty( $entry[ '_multi' ] ) && ! empty( $field_settings[ 'form_id' ] ) && ! empty( $entry[ '_multi' ][ $field_settings[ 'form_id' ] ] ) ) { |
|
150 | + $multientry = \GV\Multi_Entry::from_entries( array_map( '\GV\GF_Entry::from_entry', $entry[ '_multi' ] ) ); |
|
151 | + $entry = $entry[ '_multi' ][ $field_settings[ 'form_id' ] ]; |
|
153 | 152 | } |
154 | 153 | |
155 | - if ( empty( $entry['id'] ) || ! $entry = \GV\GF_Entry::by_id( $entry['id'] ) ) { |
|
154 | + if ( empty( $entry[ 'id' ] ) || ! $entry = \GV\GF_Entry::by_id( $entry[ 'id' ] ) ) { |
|
156 | 155 | gravityview()->log->error( 'Invalid \GV\GF_Entry supplied', array( 'data' => $entry ) ); |
157 | 156 | return null; |
158 | 157 | } |
@@ -162,18 +161,18 @@ discard block |
||
162 | 161 | * |
163 | 162 | * Fields with a numeric ID are Gravity Forms ones. |
164 | 163 | */ |
165 | - $source = is_numeric( $field_settings['id'] ) ? \GV\Source::BACKEND_GRAVITYFORMS : \GV\Source::BACKEND_INTERNAL;; |
|
164 | + $source = is_numeric( $field_settings[ 'id' ] ) ? \GV\Source::BACKEND_GRAVITYFORMS : \GV\Source::BACKEND_INTERNAL; ; |
|
166 | 165 | |
167 | 166 | /** Initialize the future field. */ |
168 | 167 | switch ( $source ): |
169 | 168 | /** The Gravity Forms backend. */ |
170 | 169 | case \GV\Source::BACKEND_GRAVITYFORMS: |
171 | - if ( ! $form = \GV\GF_Form::by_id( $entry['form_id'] ) ) { |
|
170 | + if ( ! $form = \GV\GF_Form::by_id( $entry[ 'form_id' ] ) ) { |
|
172 | 171 | gravityview()->log->error( 'No form Gravity Form found for entry', array( 'data' => $entry ) ); |
173 | 172 | return null; |
174 | 173 | } |
175 | 174 | |
176 | - if ( ! $field = $form::get_field( $form, $field_settings['id'] ) ) { |
|
175 | + if ( ! $field = $form::get_field( $form, $field_settings[ 'id' ] ) ) { |
|
177 | 176 | return null; |
178 | 177 | } |
179 | 178 | |
@@ -181,7 +180,7 @@ discard block |
||
181 | 180 | |
182 | 181 | /** Our internal backend. */ |
183 | 182 | case \GV\Source::BACKEND_INTERNAL: |
184 | - if ( ! $field = \GV\Internal_Source::get_field( $field_settings['id'] ) ) { |
|
183 | + if ( ! $field = \GV\Internal_Source::get_field( $field_settings[ 'id' ] ) ) { |
|
185 | 184 | return null; |
186 | 185 | } |
187 | 186 | |
@@ -215,13 +214,13 @@ discard block |
||
215 | 214 | |
216 | 215 | /** A bail condition. */ |
217 | 216 | $bail = function( $label, $field_settings, $entry, $force_show_label, $form ) { |
218 | - if ( ! empty( $field_settings['show_label'] ) || $force_show_label ) { |
|
217 | + if ( ! empty( $field_settings[ 'show_label' ] ) || $force_show_label ) { |
|
219 | 218 | |
220 | - $label = isset( $field_settings['label'] ) ? $field_settings['label'] : ''; |
|
219 | + $label = isset( $field_settings[ 'label' ] ) ? $field_settings[ 'label' ] : ''; |
|
221 | 220 | |
222 | 221 | // Use Gravity Forms label by default, but if a custom label is defined in GV, use it. |
223 | - if ( ! empty( $field_settings['custom_label'] ) ) { |
|
224 | - $label = \GravityView_API::replace_variables( $field_settings['custom_label'], $form, $entry ); |
|
222 | + if ( ! empty( $field_settings[ 'custom_label' ] ) ) { |
|
223 | + $label = \GravityView_API::replace_variables( $field_settings[ 'custom_label' ], $form, $entry ); |
|
225 | 224 | } |
226 | 225 | |
227 | 226 | /** |
@@ -247,19 +246,19 @@ discard block |
||
247 | 246 | |
248 | 247 | $label = ''; |
249 | 248 | |
250 | - if ( ! empty( $entry['_multi'] ) && ! empty( $field_settings['form_id'] ) && ! empty( $entry['_multi'][ $field_settings['form_id'] ] ) ) { |
|
251 | - $entry = $entry['_multi'][ $field_settings['form_id'] ]; |
|
252 | - if ( $_form = \GV\GF_Form::by_id( $field_settings['form_id'] ) ) { |
|
249 | + if ( ! empty( $entry[ '_multi' ] ) && ! empty( $field_settings[ 'form_id' ] ) && ! empty( $entry[ '_multi' ][ $field_settings[ 'form_id' ] ] ) ) { |
|
250 | + $entry = $entry[ '_multi' ][ $field_settings[ 'form_id' ] ]; |
|
251 | + if ( $_form = \GV\GF_Form::by_id( $field_settings[ 'form_id' ] ) ) { |
|
253 | 252 | $form = $_form->form; |
254 | 253 | } |
255 | 254 | } |
256 | 255 | |
257 | - if ( empty( $entry['form_id'] ) || empty( $field_settings['id'] ) ) { |
|
256 | + if ( empty( $entry[ 'form_id' ] ) || empty( $field_settings[ 'id' ] ) ) { |
|
258 | 257 | gravityview()->log->error( 'No entry or field_settings[id] supplied', array( 'data' => array( func_get_args() ) ) ); |
259 | 258 | return $bail( $label, $field_settings, $entry, $force_show_label, $form ); |
260 | 259 | } |
261 | 260 | |
262 | - if ( empty( $entry['id'] ) || ! $gv_entry = \GV\GF_Entry::by_id( $entry['id'] ) ) { |
|
261 | + if ( empty( $entry[ 'id' ] ) || ! $gv_entry = \GV\GF_Entry::by_id( $entry[ 'id' ] ) ) { |
|
263 | 262 | gravityview()->log->error( 'Invalid \GV\GF_Entry supplied', array( 'data' => $entry ) ); |
264 | 263 | return $bail( $label, $field_settings, $entry, $force_show_label, $form ); |
265 | 264 | } |
@@ -271,31 +270,31 @@ discard block |
||
271 | 270 | * |
272 | 271 | * Fields with a numeric ID are Gravity Forms ones. |
273 | 272 | */ |
274 | - $source = is_numeric( $field_settings['id'] ) ? \GV\Source::BACKEND_GRAVITYFORMS : \GV\Source::BACKEND_INTERNAL; |
|
273 | + $source = is_numeric( $field_settings[ 'id' ] ) ? \GV\Source::BACKEND_GRAVITYFORMS : \GV\Source::BACKEND_INTERNAL; |
|
275 | 274 | |
276 | 275 | /** Initialize the future field. */ |
277 | 276 | switch ( $source ): |
278 | 277 | /** The Gravity Forms backend. */ |
279 | 278 | case \GV\Source::BACKEND_GRAVITYFORMS: |
280 | - if ( ! $gf_form = \GV\GF_Form::by_id( $entry['form_id'] ) ) { |
|
279 | + if ( ! $gf_form = \GV\GF_Form::by_id( $entry[ 'form_id' ] ) ) { |
|
281 | 280 | gravityview()->log->error( 'No form Gravity Form found for entry', array( 'data' => $entry ) ); |
282 | 281 | return $bail( $label, $field_settings, $entry->as_entry(), $force_show_label, $form ); |
283 | 282 | } |
284 | 283 | |
285 | - if ( ! $field = $gf_form::get_field( $gf_form, $field_settings['id'] ) ) { |
|
286 | - gravityview()->log->error( 'No field found for specified form and field ID #{field_id}', array( 'field_id' => $field_settings['id'], 'data' => $form ) ); |
|
284 | + if ( ! $field = $gf_form::get_field( $gf_form, $field_settings[ 'id' ] ) ) { |
|
285 | + gravityview()->log->error( 'No field found for specified form and field ID #{field_id}', array( 'field_id' => $field_settings[ 'id' ], 'data' => $form ) ); |
|
287 | 286 | return $bail( $label, $field_settings, $entry->as_entry(), $force_show_label, $gf_form->form ); |
288 | 287 | } |
289 | - if ( empty( $field_settings['show_label'] ) ) { |
|
288 | + if ( empty( $field_settings[ 'show_label' ] ) ) { |
|
290 | 289 | /** The label never wins... */ |
291 | - $field_settings['label'] = ''; |
|
290 | + $field_settings[ 'label' ] = ''; |
|
292 | 291 | } |
293 | 292 | |
294 | 293 | break; |
295 | 294 | |
296 | 295 | /** Our internal backend. */ |
297 | 296 | case \GV\Source::BACKEND_INTERNAL: |
298 | - if ( ! $field = \GV\Internal_Source::get_field( $field_settings['id'] ) ) { |
|
297 | + if ( ! $field = \GV\Internal_Source::get_field( $field_settings[ 'id' ] ) ) { |
|
299 | 298 | return $bail( $label, $field_settings, $entry->as_entry(), $force_show_label, $form ); |
300 | 299 | } |
301 | 300 | break; |
@@ -307,8 +306,8 @@ discard block |
||
307 | 306 | break; |
308 | 307 | endswitch; |
309 | 308 | |
310 | - if( $force_show_label ) { |
|
311 | - $field_settings['show_label'] = '1'; |
|
309 | + if ( $force_show_label ) { |
|
310 | + $field_settings[ 'show_label' ] = '1'; |
|
312 | 311 | } |
313 | 312 | |
314 | 313 | /** Add the field settings. */ |
@@ -444,7 +443,7 @@ discard block |
||
444 | 443 | '\GravityView_View::_current_entry' => \GravityView_View::getInstance()->getCurrentEntry(), |
445 | 444 | '\GravityView_View::fields' => \GravityView_View::getInstance()->getFields(), |
446 | 445 | '\GravityView_View::_current_field' => \GravityView_View::getInstance()->getCurrentField(), |
447 | - 'wp_actions[loop_start]' => empty( $wp_actions['loop_start'] ) ? 0 : $wp_actions['loop_start'], |
|
446 | + 'wp_actions[loop_start]' => empty( $wp_actions[ 'loop_start' ] ) ? 0 : $wp_actions[ 'loop_start' ], |
|
448 | 447 | 'wp_query::in_the_loop' => $wp_query->in_the_loop, |
449 | 448 | ); |
450 | 449 | } |
@@ -532,7 +531,7 @@ discard block |
||
532 | 531 | break; |
533 | 532 | case 'wp_actions[loop_start]': |
534 | 533 | global $wp_actions; |
535 | - $wp_actions['loop_start'] = $value; |
|
534 | + $wp_actions[ 'loop_start' ] = $value; |
|
536 | 535 | break; |
537 | 536 | case 'wp_query::in_the_loop': |
538 | 537 | global $wp_query; |
@@ -629,9 +628,7 @@ discard block |
||
629 | 628 | case 'request': |
630 | 629 | self::thaw( array( |
631 | 630 | '\GravityView_View::context' => ( |
632 | - $value->is_entry() ? 'single' : |
|
633 | - ( $value->is_edit_entry() ? 'edit' : |
|
634 | - ( $value->is_view() ? 'directory': null ) |
|
631 | + $value->is_entry() ? 'single' : ( $value->is_edit_entry() ? 'edit' : ( $value->is_view() ? 'directory' : null ) |
|
635 | 632 | ) |
636 | 633 | ), |
637 | 634 | '\GravityView_frontend::is_search' => $value->is_search(), |
@@ -685,14 +682,14 @@ discard block |
||
685 | 682 | global $wp_query, $wp_actions; |
686 | 683 | |
687 | 684 | $wp_query->in_the_loop = false; |
688 | - $wp_actions['loop_start'] = 0; |
|
685 | + $wp_actions[ 'loop_start' ] = 0; |
|
689 | 686 | } |
690 | 687 | } |
691 | 688 | |
692 | 689 | |
693 | 690 | /** Add some global fix for field capability discrepancies. */ |
694 | 691 | add_filter( 'gravityview/configuration/fields', function( $fields ) { |
695 | - if ( empty( $fields ) ) { |
|
692 | + if ( empty( $fields ) ) { |
|
696 | 693 | return $fields; |
697 | 694 | } |
698 | 695 | |
@@ -719,11 +716,11 @@ discard block |
||
719 | 716 | } |
720 | 717 | |
721 | 718 | foreach ( $_fields as $uid => &$_field ) { |
722 | - if ( ! isset( $_field['only_loggedin'] ) ) { |
|
719 | + if ( ! isset( $_field[ 'only_loggedin' ] ) ) { |
|
723 | 720 | continue; |
724 | 721 | } |
725 | 722 | /** If we do not require login, we don't require a cap. */ |
726 | - $_field['only_loggedin'] != '1' && ( $_field['only_loggedin_cap'] = '' ); |
|
723 | + $_field[ 'only_loggedin' ] != '1' && ( $_field[ 'only_loggedin_cap' ] = '' ); |
|
727 | 724 | } |
728 | 725 | } |
729 | 726 | return $fields; |
@@ -754,8 +751,8 @@ discard block |
||
754 | 751 | } |
755 | 752 | |
756 | 753 | foreach ( $_fields as $uid => &$_field ) { |
757 | - if ( ! empty( $_field['id'] ) && is_numeric( $_field['id'] ) && empty( $_field['form_id'] ) ) { |
|
758 | - $_field['form_id'] = $view->form->ID; |
|
754 | + if ( ! empty( $_field[ 'id' ] ) && is_numeric( $_field[ 'id' ] ) && empty( $_field[ 'form_id' ] ) ) { |
|
755 | + $_field[ 'form_id' ] = $view->form->ID; |
|
759 | 756 | } |
760 | 757 | } |
761 | 758 | } |
@@ -769,25 +766,25 @@ discard block |
||
769 | 766 | if ( class_exists( '\GravityView_frontend' ) ) { |
770 | 767 | global $wp_filter; |
771 | 768 | |
772 | - if ( empty( $wp_filter['gravityview_after'] ) ) { |
|
769 | + if ( empty( $wp_filter[ 'gravityview_after' ] ) ) { |
|
773 | 770 | return; |
774 | 771 | } |
775 | 772 | |
776 | 773 | /** WordPress 4.6 and lower compatibility, when WP_Hook classes were still absent. */ |
777 | - if ( is_array( $wp_filter['gravityview_after'] ) ) { |
|
778 | - if ( ! empty( $wp_filter['gravityview_after'][10] ) ) { |
|
779 | - foreach ( $wp_filter['gravityview_after'][10] as $function_key => $callback ) { |
|
774 | + if ( is_array( $wp_filter[ 'gravityview_after' ] ) ) { |
|
775 | + if ( ! empty( $wp_filter[ 'gravityview_after' ][ 10 ] ) ) { |
|
776 | + foreach ( $wp_filter[ 'gravityview_after' ][ 10 ] as $function_key => $callback ) { |
|
780 | 777 | if ( strpos( $function_key, 'context_not_configured_warning' ) ) { |
781 | - unset( $wp_filter['gravityview_after'][10][ $function_key ] ); |
|
778 | + unset( $wp_filter[ 'gravityview_after' ][ 10 ][ $function_key ] ); |
|
782 | 779 | } |
783 | 780 | } |
784 | 781 | } |
785 | 782 | return; |
786 | 783 | } |
787 | 784 | |
788 | - foreach ( $wp_filter['gravityview_after']->callbacks[10] as $function_key => $callback ) { |
|
785 | + foreach ( $wp_filter[ 'gravityview_after' ]->callbacks[ 10 ] as $function_key => $callback ) { |
|
789 | 786 | if ( strpos( $function_key, 'context_not_configured_warning' ) ) { |
790 | - unset( $wp_filter['gravityview_after']->callbacks[10][ $function_key ] ); |
|
787 | + unset( $wp_filter[ 'gravityview_after' ]->callbacks[ 10 ][ $function_key ] ); |
|
791 | 788 | } |
792 | 789 | } |
793 | 790 | } |
@@ -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 | */ |
@@ -291,7 +291,7 @@ |
||
291 | 291 | public function settings() { |
292 | 292 | |
293 | 293 | // If doing ajax, get outta here |
294 | - if ( ! is_admin() || ( defined( 'DOING_AJAX' ) && DOING_AJAX && 'update-plugin' !== Utils::_POST('action') ) ) { |
|
294 | + if ( ! is_admin() || ( defined( 'DOING_AJAX' ) && DOING_AJAX && 'update-plugin' !== Utils::_POST('action') ) ) { |
|
295 | 295 | return; |
296 | 296 | } |
297 | 297 |
@@ -305,13 +305,13 @@ |
||
305 | 305 | $this->_remote_update_url, |
306 | 306 | $this->_path, |
307 | 307 | array( |
308 | - 'version' => $this->_version, // current version number |
|
309 | - 'license' => \GV\Utils::get( $license, 'license_key', \GV\Utils::get( $license, 'license', null ) ), |
|
310 | - 'item_id' => $this->_item_id, // The ID of the download on _remote_update_url |
|
311 | - 'item_name' => $this->_title, // name of this plugin |
|
312 | - 'author' => strip_tags( $this->_author ) // author of this plugin |
|
313 | - ) |
|
314 | - ); |
|
308 | + 'version' => $this->_version, // current version number |
|
309 | + 'license' => \GV\Utils::get( $license, 'license_key', \GV\Utils::get( $license, 'license', null ) ), |
|
310 | + 'item_id' => $this->_item_id, // The ID of the download on _remote_update_url |
|
311 | + 'item_name' => $this->_title, // name of this plugin |
|
312 | + 'author' => strip_tags( $this->_author ) // author of this plugin |
|
313 | + ) |
|
314 | + ); |
|
315 | 315 | } |
316 | 316 | |
317 | 317 | /** |
@@ -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 { |
@@ -258,12 +258,12 @@ discard block |
||
258 | 258 | |
259 | 259 | $locale = get_locale(); |
260 | 260 | |
261 | - if ( function_exists('get_user_locale') && is_admin() ) { |
|
261 | + if ( function_exists( 'get_user_locale' ) && is_admin() ) { |
|
262 | 262 | $locale = get_user_locale(); |
263 | 263 | } |
264 | 264 | |
265 | 265 | // Traditional WordPress plugin locale filter |
266 | - $locale = apply_filters( 'plugin_locale', $locale, $this->_text_domain ); |
|
266 | + $locale = apply_filters( 'plugin_locale', $locale, $this->_text_domain ); |
|
267 | 267 | |
268 | 268 | $mofile = sprintf( '%1$s-%2$s.mo', $this->_text_domain, $locale ); |
269 | 269 | |
@@ -291,7 +291,7 @@ discard block |
||
291 | 291 | public function settings() { |
292 | 292 | |
293 | 293 | // If doing ajax, get outta here |
294 | - if ( ! is_admin() || ( defined( 'DOING_AJAX' ) && DOING_AJAX && 'update-plugin' !== Utils::_POST('action') ) ) { |
|
294 | + if ( ! is_admin() || ( defined( 'DOING_AJAX' ) && DOING_AJAX && 'update-plugin' !== Utils::_POST( 'action' ) ) ) { |
|
295 | 295 | return; |
296 | 296 | } |
297 | 297 | |
@@ -308,7 +308,7 @@ discard block |
||
308 | 308 | 'version' => $this->_version, // current version number |
309 | 309 | 'license' => \GV\Utils::get( $license, 'license_key', \GV\Utils::get( $license, 'license', null ) ), |
310 | 310 | 'item_id' => $this->_item_id, // The ID of the download on _remote_update_url |
311 | - 'item_name' => $this->_title, // name of this plugin |
|
311 | + 'item_name' => $this->_title, // name of this plugin |
|
312 | 312 | 'author' => strip_tags( $this->_author ) // author of this plugin |
313 | 313 | ) |
314 | 314 | ); |
@@ -337,16 +337,16 @@ discard block |
||
337 | 337 | */ |
338 | 338 | public static function add_notice( $notice = array() ) { |
339 | 339 | |
340 | - if ( is_array( $notice ) && empty( $notice['message'] ) ) { |
|
340 | + if ( is_array( $notice ) && empty( $notice[ 'message' ] ) ) { |
|
341 | 341 | gravityview()->log->error( 'Notice not set', array( 'data' => $notice ) ); |
342 | 342 | return; |
343 | 343 | } else if ( is_string( $notice ) ) { |
344 | 344 | $notice = array( 'message' => $notice ); |
345 | 345 | } |
346 | 346 | |
347 | - $notice['class'] = empty( $notice['class'] ) ? 'error' : $notice['class']; |
|
347 | + $notice[ 'class' ] = empty( $notice[ 'class' ] ) ? 'error' : $notice[ 'class' ]; |
|
348 | 348 | |
349 | - self::$admin_notices []= $notice; |
|
349 | + self::$admin_notices [ ] = $notice; |
|
350 | 350 | } |
351 | 351 | |
352 | 352 | /** |
@@ -360,8 +360,8 @@ discard block |
||
360 | 360 | } |
361 | 361 | |
362 | 362 | foreach ( self::$admin_notices as $key => $notice ) { |
363 | - echo '<div id="message" class="'. esc_attr( $notice['class'] ).'">'; |
|
364 | - echo wpautop( $notice['message'] ); |
|
363 | + echo '<div id="message" class="' . esc_attr( $notice[ 'class' ] ) . '">'; |
|
364 | + echo wpautop( $notice[ 'message' ] ); |
|
365 | 365 | echo '<div class="clear"></div>'; |
366 | 366 | echo '</div>'; |
367 | 367 | } |
@@ -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 ); |
@@ -22,7 +22,7 @@ |
||
22 | 22 | * |
23 | 23 | * @param \GV\Field $field The field to be ouput. |
24 | 24 | * |
25 | - * @return string|false The field output or false if "hide_empty" is set. |
|
25 | + * @return null|string The field output or false if "hide_empty" is set. |
|
26 | 26 | */ |
27 | 27 | public function the_field( \GV\Field $field ) { |
28 | 28 | $renderer = new Field_Renderer(); |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | */ |
27 | 27 | public function the_field( \GV\Field $field ) { |
28 | 28 | $renderer = new Field_Renderer(); |
29 | - $source = is_numeric( $field->ID ) ? ( GF_Form::by_id( $field->form_id ) ? : $this->view->form ) : new Internal_Source(); |
|
29 | + $source = is_numeric( $field->ID ) ? ( GF_Form::by_id( $field->form_id ) ?: $this->view->form ) : new Internal_Source(); |
|
30 | 30 | |
31 | 31 | return $renderer->render( $field, $this->view, $source, $this->entry->from_field( $field ), $this->request ); |
32 | 32 | } |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | foreach ( $fields->all() as $field ) { |
64 | 64 | $context = Template_Context::from_template( $this, compact( 'field' ) ); |
65 | 65 | |
66 | - $form = \GV\GF_Form::by_id( $field->form_id ) ? : $this->view->form; |
|
66 | + $form = \GV\GF_Form::by_id( $field->form_id ) ?: $this->view->form; |
|
67 | 67 | $entry = $this->entry->from_field( $field ); |
68 | 68 | |
69 | 69 | if ( ! $entry ) { |
@@ -63,7 +63,6 @@ |
||
63 | 63 | * Initializer. |
64 | 64 | * |
65 | 65 | * @param \GV\View $view The View connected to this template. |
66 | - * @param \GV\Entry_Collection $entries A collection of entries for this view. |
|
67 | 66 | * @param \GV\Request $request The request context. |
68 | 67 | */ |
69 | 68 | public function __construct( Entry $entry, View $view, Request $request ) { |
@@ -113,18 +113,18 @@ |
||
113 | 113 | global $post; |
114 | 114 | |
115 | 115 | if ( ! $this->request->is_view() && $post ) { |
116 | - $specifics []= sprintf( '%spost-%d-view-%d-entry-%d-%s.php', $slug_dir, $post->ID, $this->view->ID, $this->entry->ID, $slug_name ); |
|
117 | - $specifics []= sprintf( '%spost-%d-entry-%d-%s.php', $slug_dir, $post->ID, $this->entry->ID, $slug_name ); |
|
118 | - $specifics []= sprintf( '%spost-%d-view-%d-%s.php', $slug_dir, $post->ID, $this->view->ID, $slug_name ); |
|
119 | - $specifics []= sprintf( '%spost-%d-%s.php', $slug_dir, $post->ID, $slug_name ); |
|
116 | + $specifics [ ] = sprintf( '%spost-%d-view-%d-entry-%d-%s.php', $slug_dir, $post->ID, $this->view->ID, $this->entry->ID, $slug_name ); |
|
117 | + $specifics [ ] = sprintf( '%spost-%d-entry-%d-%s.php', $slug_dir, $post->ID, $this->entry->ID, $slug_name ); |
|
118 | + $specifics [ ] = sprintf( '%spost-%d-view-%d-%s.php', $slug_dir, $post->ID, $this->view->ID, $slug_name ); |
|
119 | + $specifics [ ] = sprintf( '%spost-%d-%s.php', $slug_dir, $post->ID, $slug_name ); |
|
120 | 120 | } |
121 | 121 | |
122 | - $specifics []= sprintf( '%sview-%d-entry-%d-%s.php', $slug_dir, $this->view->ID, $this->entry->ID, $slug_name ); |
|
123 | - $specifics []= sprintf( '%sform-%d-entry-%d-%s.php', $slug_dir, $this->view->form->ID, $this->entry->ID, $slug_name ); |
|
124 | - $specifics []= sprintf( '%sview-%d-%s.php', $slug_dir, $this->view->ID, $slug_name ); |
|
125 | - $specifics []= sprintf( '%sform-%d-%s.php', $slug_dir, $this->view->form->ID, $slug_name ); |
|
122 | + $specifics [ ] = sprintf( '%sview-%d-entry-%d-%s.php', $slug_dir, $this->view->ID, $this->entry->ID, $slug_name ); |
|
123 | + $specifics [ ] = sprintf( '%sform-%d-entry-%d-%s.php', $slug_dir, $this->view->form->ID, $this->entry->ID, $slug_name ); |
|
124 | + $specifics [ ] = sprintf( '%sview-%d-%s.php', $slug_dir, $this->view->ID, $slug_name ); |
|
125 | + $specifics [ ] = sprintf( '%sform-%d-%s.php', $slug_dir, $this->view->form->ID, $slug_name ); |
|
126 | 126 | |
127 | - $specifics []= sprintf( '%sentry-%d-%s.php', $slug_dir, $this->entry->ID, $slug_name ); |
|
127 | + $specifics [ ] = sprintf( '%sentry-%d-%s.php', $slug_dir, $this->entry->ID, $slug_name ); |
|
128 | 128 | |
129 | 129 | return array_merge( $specifics, $templates ); |
130 | 130 | } |