@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | array( |
82 | 82 | 'ajaxurl' => admin_url( 'admin-ajax.php' ), |
83 | 83 | 'action' => 'entry_creator_get_users', |
84 | - 'gf25' => (bool) gravityview()->plugin->is_GF_25(), |
|
84 | + 'gf25' => (bool)gravityview()->plugin->is_GF_25(), |
|
85 | 85 | 'language' => array( |
86 | 86 | 'search_placeholder' => esc_html__( 'Search by ID, login, email, or name.', 'gravityview' ), |
87 | 87 | ), |
@@ -105,11 +105,11 @@ discard block |
||
105 | 105 | ) |
106 | 106 | ); |
107 | 107 | |
108 | - if ( ! wp_verify_nonce( $post_var['gv_nonce'], 'gv_entry_creator' ) ) { |
|
108 | + if ( ! wp_verify_nonce( $post_var[ 'gv_nonce' ], 'gv_entry_creator' ) ) { |
|
109 | 109 | die(); |
110 | 110 | } |
111 | 111 | |
112 | - $search_string = $post_var['q']; |
|
112 | + $search_string = $post_var[ 'q' ]; |
|
113 | 113 | |
114 | 114 | if ( is_numeric( $search_string ) ) { |
115 | 115 | $user_args = array( |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | } |
157 | 157 | |
158 | 158 | // Update the entry. The `false` prevents checking Akismet; `true` disables the user updated hook from firing |
159 | - $result = RGFormsModel::update_entry_property( (int) $entry['id'], 'created_by', (int) $user_id, false, true ); |
|
159 | + $result = RGFormsModel::update_entry_property( (int)$entry[ 'id' ], 'created_by', (int)$user_id, false, true ); |
|
160 | 160 | |
161 | 161 | if ( false === $result ) { |
162 | 162 | $status = __( 'Error', 'gravityview' ); |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | return; |
179 | 179 | } |
180 | 180 | |
181 | - GravityView_Entry_Notes::add_note( $entry['id'], - 1, 'GravityView', $note, 'gravityview' ); |
|
181 | + GravityView_Entry_Notes::add_note( $entry[ 'id' ], - 1, 'GravityView', $note, 'gravityview' ); |
|
182 | 182 | |
183 | 183 | } |
184 | 184 | |
@@ -213,7 +213,7 @@ discard block |
||
213 | 213 | } |
214 | 214 | |
215 | 215 | // If screen mode isn't set, then we're in the wrong place. |
216 | - if ( empty( $_REQUEST['screen_mode'] ) ) { |
|
216 | + if ( empty( $_REQUEST[ 'screen_mode' ] ) ) { |
|
217 | 217 | return; |
218 | 218 | } |
219 | 219 | |
@@ -239,7 +239,7 @@ discard block |
||
239 | 239 | |
240 | 240 | // If $_GET['screen_mode'] is set to edit, set $_POST value |
241 | 241 | if ( \GV\Utils::_GET( 'screen_mode' ) === 'edit' ) { |
242 | - $_POST["screen_mode"] = 'edit'; |
|
242 | + $_POST[ "screen_mode" ] = 'edit'; |
|
243 | 243 | } |
244 | 244 | |
245 | 245 | } |
@@ -314,7 +314,7 @@ discard block |
||
314 | 314 | $entry_creator_user_id = \GV\Utils::get( $entry, 'created_by' ); |
315 | 315 | |
316 | 316 | $entry_creator_user = GVCommon::get_users( 'change_entry_creator', array( 'include' => $entry_creator_user_id ) ); |
317 | - $entry_creator_user = isset( $entry_creator_user[0] ) ? $entry_creator_user[0] : array(); |
|
317 | + $entry_creator_user = isset( $entry_creator_user[ 0 ] ) ? $entry_creator_user[ 0 ] : array(); |
|
318 | 318 | |
319 | 319 | if ( empty( $entry_creator_user ) ) { |
320 | 320 | $output .= '<option value="0"> — ' . esc_attr_x( 'No User', 'No user assigned to the entry', 'gravityview' ) . ' — </option>'; |
@@ -332,18 +332,18 @@ discard block |
||
332 | 332 | } |
333 | 333 | |
334 | 334 | $user_count = count_users(); |
335 | - $user_count = $user_count['total_users']; |
|
335 | + $user_count = $user_count[ 'total_users' ]; |
|
336 | 336 | $users_displayed = self::DEFAULT_NUMBER_OF_USERS + ( ! empty( $entry_creator_user ) ? 1 : 0 ); |
337 | 337 | if ( $user_count > $users_displayed ) { |
338 | 338 | $remaining_users = $user_count - $users_displayed; |
339 | - $user_users = _n( esc_html__('user', 'gravityview' ), esc_html__('users', 'gravityview' ), $remaining_users ); |
|
339 | + $user_users = _n( esc_html__( 'user', 'gravityview' ), esc_html__( 'users', 'gravityview' ), $remaining_users ); |
|
340 | 340 | $message = esc_html_x( 'Use the input above to search the remaining %d %s.', '%d is replaced with user count %s is replaced with "user" or "users"', 'gravityview' ); |
341 | 341 | $message = sprintf( $message, $remaining_users, $user_users ); |
342 | - $output .= '<option value="_user_count" disabled="disabled">' . esc_html( $message ) . '</option>'; |
|
342 | + $output .= '<option value="_user_count" disabled="disabled">' . esc_html( $message ) . '</option>'; |
|
343 | 343 | } |
344 | 344 | |
345 | 345 | $output .= '</select>'; |
346 | - $output .= '<input name="originally_created_by" value="' . esc_attr( $entry['created_by'] ) . '" type="hidden" />'; |
|
346 | + $output .= '<input name="originally_created_by" value="' . esc_attr( $entry[ 'created_by' ] ) . '" type="hidden" />'; |
|
347 | 347 | $output .= wp_nonce_field( 'gv_entry_creator', 'gv_entry_creator_nonce', false, false ); |
348 | 348 | |
349 | 349 | echo $output; |
@@ -357,8 +357,8 @@ discard block |
||
357 | 357 | * @return array |
358 | 358 | */ |
359 | 359 | function register_gform_noconflict( $assets ) { |
360 | - $assets[] = 'gravityview_selectwoo'; |
|
361 | - $assets[] = 'gravityview_entry_creator'; |
|
360 | + $assets[ ] = 'gravityview_selectwoo'; |
|
361 | + $assets[ ] = 'gravityview_entry_creator'; |
|
362 | 362 | |
363 | 363 | return $assets; |
364 | 364 | } |
@@ -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,13 +766,13 @@ 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 | - foreach ( $wp_filter['gravityview_after']->callbacks[10] as $function_key => $callback ) { |
|
773 | + foreach ( $wp_filter[ 'gravityview_after' ]->callbacks[ 10 ] as $function_key => $callback ) { |
|
777 | 774 | if ( strpos( $function_key, 'context_not_configured_warning' ) ) { |
778 | - unset( $wp_filter['gravityview_after']->callbacks[10][ $function_key ] ); |
|
775 | + unset( $wp_filter[ 'gravityview_after' ]->callbacks[ 10 ][ $function_key ] ); |
|
779 | 776 | } |
780 | 777 | } |
781 | 778 | } |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | * @deprecated |
115 | 115 | * @see The `gravityview/view_collection/from_post/meta_keys` filter. |
116 | 116 | */ |
117 | - $meta_keys = (array) apply_filters_deprecated( 'gravityview/data/parse/meta_keys', array( $meta_keys, $post->ID ), '2.0.7', 'gravityview/view_collection/from_post/meta_keys' ); |
|
117 | + $meta_keys = (array)apply_filters_deprecated( 'gravityview/data/parse/meta_keys', array( $meta_keys, $post->ID ), '2.0.7', 'gravityview/view_collection/from_post/meta_keys' ); |
|
118 | 118 | |
119 | 119 | /** What about inside post meta values? */ |
120 | 120 | foreach ( $meta_keys as $meta_key ) { |
@@ -168,12 +168,12 @@ discard block |
||
168 | 168 | |
169 | 169 | /** Let's find us some [gravityview] shortcodes perhaps. */ |
170 | 170 | foreach ( Shortcode::parse( $content ) as $shortcode ) { |
171 | - if ( $shortcode->name != 'gravityview' || empty( $shortcode->atts['id'] ) ) { |
|
171 | + if ( $shortcode->name != 'gravityview' || empty( $shortcode->atts[ 'id' ] ) ) { |
|
172 | 172 | continue; |
173 | 173 | } |
174 | 174 | |
175 | - if ( is_numeric( $shortcode->atts['id'] ) ) { |
|
176 | - $view = View::by_id( $shortcode->atts['id'] ); |
|
175 | + if ( is_numeric( $shortcode->atts[ 'id' ] ) ) { |
|
176 | + $view = View::by_id( $shortcode->atts[ 'id' ] ); |
|
177 | 177 | if ( ! $view ) { |
178 | 178 | continue; |
179 | 179 | } |
@@ -98,15 +98,15 @@ discard block |
||
98 | 98 | $additional = array(); |
99 | 99 | |
100 | 100 | // form-19-table-body.php |
101 | - $additional[] = sprintf( 'form-%d-%s-%s.php', $this->view->form ? $this->view->form->ID : 0, $slug, $name ); |
|
101 | + $additional[ ] = sprintf( 'form-%d-%s-%s.php', $this->view->form ? $this->view->form->ID : 0, $slug, $name ); |
|
102 | 102 | |
103 | 103 | // view-3-table-body.php |
104 | - $additional[] = sprintf( 'view-%d-%s-%s.php', $this->view->ID, $slug, $name ); |
|
104 | + $additional[ ] = sprintf( 'view-%d-%s-%s.php', $this->view->ID, $slug, $name ); |
|
105 | 105 | |
106 | 106 | global $post; |
107 | 107 | if ( $post ) { |
108 | 108 | // page-19-table-body.php |
109 | - $additional[] = sprintf( 'page-%d-%s-%s.php', $post->ID, $slug, $name ); |
|
109 | + $additional[ ] = sprintf( 'page-%d-%s-%s.php', $post->ID, $slug, $name ); |
|
110 | 110 | } |
111 | 111 | |
112 | 112 | // Combine with existing table-body.php and table.php |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | ob_start(); |
131 | 131 | |
132 | 132 | $request = new Mock_Request(); |
133 | - $request->returns['is_view'] = $this->view; |
|
133 | + $request->returns[ 'is_view' ] = $this->view; |
|
134 | 134 | |
135 | 135 | /** |
136 | 136 | * You got one shot. One opportunity. To render all the widgets you have ever wanted. |
@@ -142,9 +142,9 @@ discard block |
||
142 | 142 | */ |
143 | 143 | global $wp_filter; |
144 | 144 | foreach ( array( 'gravityview_before', 'gravityview_after' ) as $hook ) { |
145 | - foreach ( $wp_filter[ $hook ]->callbacks[10] as $function_key => $callback ) { |
|
145 | + foreach ( $wp_filter[ $hook ]->callbacks[ 10 ] as $function_key => $callback ) { |
|
146 | 146 | if ( strpos( $function_key, 'render_widget_hooks' ) ) { |
147 | - unset( $wp_filter[ $hook ]->callbacks[10][ $function_key ] ); |
|
147 | + unset( $wp_filter[ $hook ]->callbacks[ 10 ][ $function_key ] ); |
|
148 | 148 | } |
149 | 149 | } |
150 | 150 | } |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | */ |
155 | 155 | if ( $this->entry ) { |
156 | 156 | |
157 | - $request->returns['is_entry'] = $this->entry; |
|
157 | + $request->returns[ 'is_entry' ] = $this->entry; |
|
158 | 158 | |
159 | 159 | global $post; |
160 | 160 | |
@@ -188,11 +188,11 @@ discard block |
||
188 | 188 | * This allows us to fake it till we make it. |
189 | 189 | */ |
190 | 190 | $parameters = $this->view->settings->as_atts(); |
191 | - if ( ! empty( $parameters['sort_field'] ) && is_array( $parameters['sort_field'] ) ) { |
|
191 | + if ( ! empty( $parameters[ 'sort_field' ] ) && is_array( $parameters[ 'sort_field' ] ) ) { |
|
192 | 192 | $has_multisort = true; |
193 | - $parameters['sort_field'] = reset( $parameters['sort_field'] ); |
|
194 | - if ( ! empty( $parameters['sort_direction'] ) && is_array( $parameters['sort_direction'] ) ) { |
|
195 | - $parameters['sort_direction'] = reset( $parameters['sort_direction'] ); |
|
193 | + $parameters[ 'sort_field' ] = reset( $parameters[ 'sort_field' ] ); |
|
194 | + if ( ! empty( $parameters[ 'sort_direction' ] ) && is_array( $parameters[ 'sort_direction' ] ) ) { |
|
195 | + $parameters[ 'sort_direction' ] = reset( $parameters[ 'sort_direction' ] ); |
|
196 | 196 | } |
197 | 197 | } |
198 | 198 | |
@@ -211,8 +211,8 @@ discard block |
||
211 | 211 | 'fields' => $this->view->fields->by_visible( $this->view ), |
212 | 212 | 'in_the_loop' => true, |
213 | 213 | ), empty( $parameters ) ? array() : array( |
214 | - 'paging' => $parameters['paging'], |
|
215 | - 'sorting' => $parameters['sorting'], |
|
214 | + 'paging' => $parameters[ 'paging' ], |
|
215 | + 'sorting' => $parameters[ 'sorting' ], |
|
216 | 216 | ), $post ? array( |
217 | 217 | 'post' => $post, |
218 | 218 | ) : array() ) ); |
@@ -32,19 +32,19 @@ discard block |
||
32 | 32 | // If there's an overriding CSS file in the current template folder, use it. |
33 | 33 | $template_css_path = trailingslashit( get_stylesheet_directory() ) . 'gravityview/css/' . $css_file; |
34 | 34 | |
35 | - if( file_exists( $template_css_path ) ) { |
|
35 | + if ( file_exists( $template_css_path ) ) { |
|
36 | 36 | $path = trailingslashit( get_stylesheet_directory_uri() ) . 'gravityview/css/' . $css_file; |
37 | 37 | gravityview()->log->debug( 'Stylesheet override ({css_file})', array( 'css_file' => esc_attr( $css_file ) ) ); |
38 | 38 | } else { |
39 | 39 | // Default: use GravityView CSS file |
40 | 40 | |
41 | 41 | // If no path is provided, assume default plugin templates CSS folder |
42 | - if( '' === $dir_path ) { |
|
42 | + if ( '' === $dir_path ) { |
|
43 | 43 | $dir_path = GRAVITYVIEW_DIR . 'templates/css/'; |
44 | 44 | } |
45 | 45 | |
46 | 46 | // plugins_url() expects a path to a file, not directory. We append a file to be stripped. |
47 | - $path = plugins_url( $css_file, trailingslashit( $dir_path ) . 'stripped-by-plugin_basename.php' ); |
|
47 | + $path = plugins_url( $css_file, trailingslashit( $dir_path ) . 'stripped-by-plugin_basename.php' ); |
|
48 | 48 | } |
49 | 49 | |
50 | 50 | return $path; |
@@ -82,9 +82,9 @@ discard block |
||
82 | 82 | |
83 | 83 | $parsed_permalink = parse_url( get_permalink( $id ) ); |
84 | 84 | |
85 | - $permalink_args = isset( $parsed_permalink['query'] ) ? $parsed_permalink['query'] : false; |
|
85 | + $permalink_args = isset( $parsed_permalink[ 'query' ] ) ? $parsed_permalink[ 'query' ] : false; |
|
86 | 86 | |
87 | - if( empty( $permalink_args ) ) { |
|
87 | + if ( empty( $permalink_args ) ) { |
|
88 | 88 | return array(); |
89 | 89 | } |
90 | 90 | |
@@ -109,15 +109,15 @@ discard block |
||
109 | 109 | function gv_selected( $value, $current, $echo = true, $type = 'selected' ) { |
110 | 110 | |
111 | 111 | $output = ''; |
112 | - if( is_array( $current ) ) { |
|
113 | - if( in_array( $value, $current ) ) { |
|
112 | + if ( is_array( $current ) ) { |
|
113 | + if ( in_array( $value, $current ) ) { |
|
114 | 114 | $output = __checked_selected_helper( true, true, false, $type ); |
115 | 115 | } |
116 | 116 | } else { |
117 | 117 | $output = __checked_selected_helper( $value, $current, false, $type ); |
118 | 118 | } |
119 | 119 | |
120 | - if( $echo ) { |
|
120 | + if ( $echo ) { |
|
121 | 121 | echo $output; |
122 | 122 | } |
123 | 123 | |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | } |
126 | 126 | |
127 | 127 | |
128 | -if( ! function_exists( 'gravityview_sanitize_html_class' ) ) { |
|
128 | +if ( ! function_exists( 'gravityview_sanitize_html_class' ) ) { |
|
129 | 129 | |
130 | 130 | /** |
131 | 131 | * sanitize_html_class doesn't handle spaces (multiple classes). We remedy that. |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | */ |
172 | 172 | function gravityview_strip_whitespace( $string ) { |
173 | 173 | $string = normalize_whitespace( $string ); |
174 | - return preg_replace('/[\r\n\t ]+/', ' ', $string ); |
|
174 | + return preg_replace( '/[\r\n\t ]+/', ' ', $string ); |
|
175 | 175 | } |
176 | 176 | |
177 | 177 | /** |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | * @return string Included file contents |
186 | 186 | */ |
187 | 187 | function gravityview_ob_include( $file_path, $object = NULL ) { |
188 | - if( ! file_exists( $file_path ) ) { |
|
188 | + if ( ! file_exists( $file_path ) ) { |
|
189 | 189 | gravityview()->log->error( 'File path does not exist. {path}', array( 'path' => $file_path ) ); |
190 | 190 | return ''; |
191 | 191 | } |
@@ -209,15 +209,15 @@ discard block |
||
209 | 209 | |
210 | 210 | $width = $height * 0.7586206897; |
211 | 211 | |
212 | - if( function_exists('is_rtl') && is_rtl() ) { |
|
213 | - $style = 'margin:10px 10px 10px 0; height='. $height .'px; width: '. $width .'px;'; |
|
212 | + if ( function_exists( 'is_rtl' ) && is_rtl() ) { |
|
213 | + $style = 'margin:10px 10px 10px 0; height=' . $height . 'px; width: ' . $width . 'px;'; |
|
214 | 214 | $css_class = is_string( $css_class ) ? $css_class : 'alignright'; |
215 | 215 | } else { |
216 | - $style = 'margin:10px 10px 10px 0; height='. $height .'px; width: '. $width .'px;'; |
|
216 | + $style = 'margin:10px 10px 10px 0; height=' . $height . 'px; width: ' . $width . 'px;'; |
|
217 | 217 | $css_class = is_string( $css_class ) ? $css_class : 'alignleft'; |
218 | 218 | } |
219 | 219 | |
220 | - return '<img src="'. esc_url( plugins_url( 'assets/images/astronaut-200x263.png', GRAVITYVIEW_FILE ) ) .'" class="'. gravityview_sanitize_html_class( $css_class ).'" height="'.intval( $height ).'" width="'.round( $width, 2 ).'" alt="The GravityView Astronaut Says:" style="'.$style.'" />'; |
|
220 | + return '<img src="' . esc_url( plugins_url( 'assets/images/astronaut-200x263.png', GRAVITYVIEW_FILE ) ) . '" class="' . gravityview_sanitize_html_class( $css_class ) . '" height="' . intval( $height ) . '" width="' . round( $width, 2 ) . '" alt="The GravityView Astronaut Says:" style="' . $style . '" />'; |
|
221 | 221 | } |
222 | 222 | |
223 | 223 | /** |
@@ -241,9 +241,9 @@ discard block |
||
241 | 241 | function gravityview_number_format( $number, $decimals = '', $separator = true ) { |
242 | 242 | global $wp_locale; |
243 | 243 | |
244 | - if( '' === $decimals ) { |
|
244 | + if ( '' === $decimals ) { |
|
245 | 245 | |
246 | - $decimal_point = isset( $wp_locale ) ? $wp_locale->number_format['decimal_point'] : '.'; |
|
246 | + $decimal_point = isset( $wp_locale ) ? $wp_locale->number_format[ 'decimal_point' ] : '.'; |
|
247 | 247 | |
248 | 248 | /** |
249 | 249 | * Calculate the position of the decimal point in the number |
@@ -276,7 +276,7 @@ discard block |
||
276 | 276 | $parts = parse_url( $value ); |
277 | 277 | |
278 | 278 | // No domain? Strange...show the original text. |
279 | - if( empty( $parts['host'] ) ) { |
|
279 | + if ( empty( $parts[ 'host' ] ) ) { |
|
280 | 280 | return $value; |
281 | 281 | } |
282 | 282 | |
@@ -289,16 +289,16 @@ discard block |
||
289 | 289 | * @param boolean $enable Whether to strip the scheme. Return false to show scheme. (default: true)\n |
290 | 290 | * If true: `http://example.com => example.com` |
291 | 291 | */ |
292 | - if( false === apply_filters('gravityview_anchor_text_striphttp', true) ) { |
|
292 | + if ( false === apply_filters( 'gravityview_anchor_text_striphttp', true ) ) { |
|
293 | 293 | |
294 | - if( isset( $parts['scheme'] ) ) { |
|
295 | - $return .= $parts['scheme']; |
|
294 | + if ( isset( $parts[ 'scheme' ] ) ) { |
|
295 | + $return .= $parts[ 'scheme' ]; |
|
296 | 296 | } |
297 | 297 | |
298 | 298 | } |
299 | 299 | |
300 | 300 | // The domain, which may contain a subdomain |
301 | - $domain = $parts['host']; |
|
301 | + $domain = $parts[ 'host' ]; |
|
302 | 302 | |
303 | 303 | /** |
304 | 304 | * @filter `gravityview_anchor_text_stripwww` Strip www from the domain? |
@@ -306,10 +306,10 @@ discard block |
||
306 | 306 | * @param boolean $enable Whether to strip www. Return false to show www. (default: true)\n |
307 | 307 | * If true: `www.example.com => example.com` |
308 | 308 | */ |
309 | - $strip_www = apply_filters('gravityview_anchor_text_stripwww', true ); |
|
309 | + $strip_www = apply_filters( 'gravityview_anchor_text_stripwww', true ); |
|
310 | 310 | |
311 | - if( $strip_www ) { |
|
312 | - $domain = str_replace('www.', '', $domain ); |
|
311 | + if ( $strip_www ) { |
|
312 | + $domain = str_replace( 'www.', '', $domain ); |
|
313 | 313 | } |
314 | 314 | |
315 | 315 | /** |
@@ -319,11 +319,11 @@ discard block |
||
319 | 319 | * If true: `http://demo.example.com => example.com` \n |
320 | 320 | * If false: `http://demo.example.com => demo.example.com` |
321 | 321 | */ |
322 | - $strip_subdomains = apply_filters('gravityview_anchor_text_nosubdomain', true); |
|
322 | + $strip_subdomains = apply_filters( 'gravityview_anchor_text_nosubdomain', true ); |
|
323 | 323 | |
324 | - if( $strip_subdomains ) { |
|
324 | + if ( $strip_subdomains ) { |
|
325 | 325 | |
326 | - $domain = _gravityview_strip_subdomain( $parts['host'] ); |
|
326 | + $domain = _gravityview_strip_subdomain( $parts[ 'host' ] ); |
|
327 | 327 | |
328 | 328 | } |
329 | 329 | |
@@ -337,12 +337,12 @@ discard block |
||
337 | 337 | * If true: `http://example.com/sub/directory/page.html => example.com` \n |
338 | 338 | * If false: `http://example.com/sub/directory/page.html => example.com/sub/directory/page.html` |
339 | 339 | */ |
340 | - $root_only = apply_filters('gravityview_anchor_text_rootonly', true); |
|
340 | + $root_only = apply_filters( 'gravityview_anchor_text_rootonly', true ); |
|
341 | 341 | |
342 | - if( empty( $root_only ) ) { |
|
342 | + if ( empty( $root_only ) ) { |
|
343 | 343 | |
344 | - if( isset( $parts['path'] ) ) { |
|
345 | - $return .= $parts['path']; |
|
344 | + if ( isset( $parts[ 'path' ] ) ) { |
|
345 | + $return .= $parts[ 'path' ]; |
|
346 | 346 | } |
347 | 347 | } |
348 | 348 | |
@@ -352,12 +352,12 @@ discard block |
||
352 | 352 | * @param boolean $enable Whether to enable "root only". Return false to show full path. (default: true)\n |
353 | 353 | * If true: `http://example.com/?query=example => example.com` |
354 | 354 | */ |
355 | - $strip_query_string = apply_filters('gravityview_anchor_text_noquerystring', true ); |
|
355 | + $strip_query_string = apply_filters( 'gravityview_anchor_text_noquerystring', true ); |
|
356 | 356 | |
357 | - if( empty( $strip_query_string ) ) { |
|
357 | + if ( empty( $strip_query_string ) ) { |
|
358 | 358 | |
359 | - if( isset( $parts['query'] ) ) { |
|
360 | - $return .= '?'.$parts['query']; |
|
359 | + if ( isset( $parts[ 'query' ] ) ) { |
|
360 | + $return .= '?' . $parts[ 'query' ]; |
|
361 | 361 | } |
362 | 362 | |
363 | 363 | } |
@@ -374,8 +374,8 @@ discard block |
||
374 | 374 | */ |
375 | 375 | function _gravityview_strip_subdomain( $string_maybe_has_subdomain ) { |
376 | 376 | |
377 | - if( preg_match("/(?P<domain>[a-z0-9][a-z0-9\-]{1,63}\.(?:com\.|co\.|net\.|org\.|firm\.|me\.|school\.|law\.|gov\.|mod\.|msk\.|irkutsks\.|sa\.|act\.|police\.|plc\.|ac\.|tm\.|asso\.|biz\.|pro\.|cg\.|telememo\.)?[a-z\.]{2,6})$/i", $string_maybe_has_subdomain, $matches ) ) { |
|
378 | - return $matches['domain']; |
|
377 | + if ( preg_match( "/(?P<domain>[a-z0-9][a-z0-9\-]{1,63}\.(?:com\.|co\.|net\.|org\.|firm\.|me\.|school\.|law\.|gov\.|mod\.|msk\.|irkutsks\.|sa\.|act\.|police\.|plc\.|ac\.|tm\.|asso\.|biz\.|pro\.|cg\.|telememo\.)?[a-z\.]{2,6})$/i", $string_maybe_has_subdomain, $matches ) ) { |
|
378 | + return $matches[ 'domain' ]; |
|
379 | 379 | } else { |
380 | 380 | return $string_maybe_has_subdomain; |
381 | 381 | } |
@@ -444,7 +444,7 @@ discard block |
||
444 | 444 | |
445 | 445 | if ( in_array( $value, array( 'yes', 'true' ), true ) ) { |
446 | 446 | $value = true; |
447 | - } else if( in_array( $value, array( 'no', 'false' ), true ) ) { |
|
447 | + } else if ( in_array( $value, array( 'no', 'false' ), true ) ) { |
|
448 | 448 | $value = false; |
449 | 449 | } |
450 | 450 | } |
@@ -473,7 +473,7 @@ discard block |
||
473 | 473 | */ |
474 | 474 | function gv_maybe_json_decode( $value, $assoc = false, $depth = 512, $options = 0 ) { |
475 | 475 | |
476 | - if( ! is_string( $value ) ) { |
|
476 | + if ( ! is_string( $value ) ) { |
|
477 | 477 | return $value; |
478 | 478 | } |
479 | 479 | |
@@ -484,12 +484,12 @@ discard block |
||
484 | 484 | } |
485 | 485 | |
486 | 486 | // There was a JSON error (PHP 5.3+) |
487 | - if( function_exists('json_last_error') && JSON_ERROR_NONE !== json_last_error() ) { |
|
487 | + if ( function_exists( 'json_last_error' ) && JSON_ERROR_NONE !== json_last_error() ) { |
|
488 | 488 | return $value; |
489 | 489 | } |
490 | 490 | |
491 | 491 | // It wasn't JSON (PHP < 5.3 fallback) |
492 | - if( is_null( $decoded ) ) { |
|
492 | + if ( is_null( $decoded ) ) { |
|
493 | 493 | return $value; |
494 | 494 | } |
495 | 495 | |
@@ -556,7 +556,7 @@ discard block |
||
556 | 556 | |
557 | 557 | $exploded = explode( '.', "{$field_id}" ); |
558 | 558 | |
559 | - return isset( $exploded[1] ) ? intval( $exploded[1] ) : false; |
|
559 | + return isset( $exploded[ 1 ] ) ? intval( $exploded[ 1 ] ) : false; |
|
560 | 560 | } |
561 | 561 | |
562 | 562 | /** |
@@ -597,13 +597,13 @@ discard block |
||
597 | 597 | */ |
598 | 598 | $args = apply_filters( 'gravityview_get_terms_choices_args', $args ); |
599 | 599 | |
600 | - $terms = get_terms( $args['taxonomy'], $args ); |
|
600 | + $terms = get_terms( $args[ 'taxonomy' ], $args ); |
|
601 | 601 | |
602 | 602 | $choices = array(); |
603 | 603 | |
604 | 604 | if ( is_array( $terms ) ) { |
605 | 605 | foreach ( $terms as $term_id => $term_name ) { |
606 | - $choices[] = array( |
|
606 | + $choices[ ] = array( |
|
607 | 607 | 'text' => $term_name, |
608 | 608 | 'value' => $term_id |
609 | 609 | ); |
@@ -627,21 +627,21 @@ discard block |
||
627 | 627 | function _gravityview_process_posted_fields() { |
628 | 628 | $fields = array(); |
629 | 629 | |
630 | - if( !empty( $_POST['gv_fields'] ) ) { |
|
631 | - if ( ! is_array( $_POST['gv_fields'] ) ) { |
|
630 | + if ( ! empty( $_POST[ 'gv_fields' ] ) ) { |
|
631 | + if ( ! is_array( $_POST[ 'gv_fields' ] ) ) { |
|
632 | 632 | |
633 | 633 | // We are not using parse_str() due to max_input_vars limitation with large View configurations |
634 | 634 | $fields_holder = array(); |
635 | - GVCommon::gv_parse_str( stripslashes( $_POST['gv_fields'] ), $fields_holder ); |
|
635 | + GVCommon::gv_parse_str( stripslashes( $_POST[ 'gv_fields' ] ), $fields_holder ); |
|
636 | 636 | |
637 | - if ( isset( $fields_holder['fields'] ) ) { |
|
638 | - $fields = $fields_holder['fields']; |
|
637 | + if ( isset( $fields_holder[ 'fields' ] ) ) { |
|
638 | + $fields = $fields_holder[ 'fields' ]; |
|
639 | 639 | } else { |
640 | 640 | gravityview()->log->error( 'No `fields` key was found after parsing $fields string', array( 'data' => $fields_holder ) ); |
641 | 641 | } |
642 | 642 | |
643 | 643 | } else { |
644 | - $fields = $_POST['gv_fields']; |
|
644 | + $fields = $_POST[ 'gv_fields' ]; |
|
645 | 645 | } |
646 | 646 | } |
647 | 647 |
@@ -60,21 +60,21 @@ discard block |
||
60 | 60 | public function dismiss_notice() { |
61 | 61 | |
62 | 62 | // No dismiss sent |
63 | - if( empty( $_GET['gv-dismiss'] ) || empty( $_GET['notice'] ) ) { |
|
63 | + if ( empty( $_GET[ 'gv-dismiss' ] ) || empty( $_GET[ 'notice' ] ) ) { |
|
64 | 64 | return; |
65 | 65 | } |
66 | 66 | |
67 | 67 | // Invalid nonce |
68 | - if( !wp_verify_nonce( $_GET['gv-dismiss'], 'dismiss' ) ) { |
|
68 | + if ( ! wp_verify_nonce( $_GET[ 'gv-dismiss' ], 'dismiss' ) ) { |
|
69 | 69 | return; |
70 | 70 | } |
71 | 71 | |
72 | - $notice_id = esc_attr( $_GET['notice'] ); |
|
72 | + $notice_id = esc_attr( $_GET[ 'notice' ] ); |
|
73 | 73 | |
74 | 74 | //don't display a message if use has dismissed the message for this version |
75 | 75 | $dismissed_notices = (array)get_transient( 'gravityview_dismissed_notices' ); |
76 | 76 | |
77 | - $dismissed_notices[] = $notice_id; |
|
77 | + $dismissed_notices[ ] = $notice_id; |
|
78 | 78 | |
79 | 79 | $dismissed_notices = array_unique( $dismissed_notices ); |
80 | 80 | |
@@ -97,12 +97,12 @@ discard block |
||
97 | 97 | private function is_notice_dismissed( $notice ) { |
98 | 98 | |
99 | 99 | // There are no dismissed notices. |
100 | - if( empty( self::$dismissed_notices ) ) { |
|
100 | + if ( empty( self::$dismissed_notices ) ) { |
|
101 | 101 | return false; |
102 | 102 | } |
103 | 103 | |
104 | 104 | // Has the |
105 | - $is_dismissed = !empty( $notice['dismiss'] ) && in_array( $notice['dismiss'], self::$dismissed_notices ); |
|
105 | + $is_dismissed = ! empty( $notice[ 'dismiss' ] ) && in_array( $notice[ 'dismiss' ], self::$dismissed_notices ); |
|
106 | 106 | |
107 | 107 | return $is_dismissed ? true : false; |
108 | 108 | } |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | */ |
128 | 128 | private function check_show_multisite_notices() { |
129 | 129 | |
130 | - if( ! is_multisite() ) { |
|
130 | + if ( ! is_multisite() ) { |
|
131 | 131 | return true; |
132 | 132 | } |
133 | 133 | |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | } |
138 | 138 | |
139 | 139 | // or they don't have admin capabilities |
140 | - if( ! is_super_admin() ) { |
|
140 | + if ( ! is_super_admin() ) { |
|
141 | 141 | return false; |
142 | 142 | } |
143 | 143 | |
@@ -160,48 +160,48 @@ discard block |
||
160 | 160 | */ |
161 | 161 | $notices = apply_filters( 'gravityview/admin/notices', self::$admin_notices ); |
162 | 162 | |
163 | - if( empty( $notices ) || ! $this->check_show_multisite_notices() ) { |
|
163 | + if ( empty( $notices ) || ! $this->check_show_multisite_notices() ) { |
|
164 | 164 | return; |
165 | 165 | } |
166 | 166 | |
167 | 167 | //don't display a message if use has dismissed the message for this version |
168 | 168 | // TODO: Use get_user_meta instead of get_transient |
169 | - self::$dismissed_notices = isset( $_GET['show-dismissed-notices'] ) ? array() : (array)get_transient( 'gravityview_dismissed_notices' ); |
|
169 | + self::$dismissed_notices = isset( $_GET[ 'show-dismissed-notices' ] ) ? array() : (array)get_transient( 'gravityview_dismissed_notices' ); |
|
170 | 170 | |
171 | 171 | $output = ''; |
172 | 172 | |
173 | - foreach( $notices as $notice ) { |
|
173 | + foreach ( $notices as $notice ) { |
|
174 | 174 | |
175 | 175 | // If the user doesn't have the capability to see the warning |
176 | - if( isset( $notice['cap'] ) && false === GVCommon::has_cap( $notice['cap'] ) ) { |
|
176 | + if ( isset( $notice[ 'cap' ] ) && false === GVCommon::has_cap( $notice[ 'cap' ] ) ) { |
|
177 | 177 | gravityview()->log->debug( 'Notice not shown because user does not have the capability to view it.', array( 'data' => $notice ) ); |
178 | 178 | continue; |
179 | 179 | } |
180 | 180 | |
181 | - if( true === $this->is_notice_dismissed( $notice ) ) { |
|
181 | + if ( true === $this->is_notice_dismissed( $notice ) ) { |
|
182 | 182 | gravityview()->log->debug( 'Notice not shown because the notice has already been dismissed.', array( 'data' => $notice ) ); |
183 | 183 | continue; |
184 | 184 | } |
185 | 185 | |
186 | - $output .= '<div id="message" style="position:relative" class="notice '. gravityview_sanitize_html_class( $notice['class'] ).'">'; |
|
186 | + $output .= '<div id="message" style="position:relative" class="notice ' . gravityview_sanitize_html_class( $notice[ 'class' ] ) . '">'; |
|
187 | 187 | |
188 | 188 | // Too cute to leave out. |
189 | 189 | $output .= gravityview_get_floaty(); |
190 | 190 | |
191 | - if( !empty( $notice['title'] ) ) { |
|
192 | - $output .= '<h3>'.esc_html( $notice['title'] ) .'</h3>'; |
|
191 | + if ( ! empty( $notice[ 'title' ] ) ) { |
|
192 | + $output .= '<h3>' . esc_html( $notice[ 'title' ] ) . '</h3>'; |
|
193 | 193 | } |
194 | 194 | |
195 | - $message = isset( $notice['message'] ) ? $notice['message'] : ''; |
|
195 | + $message = isset( $notice[ 'message' ] ) ? $notice[ 'message' ] : ''; |
|
196 | 196 | |
197 | - if( !empty( $notice['dismiss'] ) ) { |
|
197 | + if ( ! empty( $notice[ 'dismiss' ] ) ) { |
|
198 | 198 | |
199 | - $dismiss = esc_attr($notice['dismiss']); |
|
199 | + $dismiss = esc_attr( $notice[ 'dismiss' ] ); |
|
200 | 200 | |
201 | 201 | $url = esc_url( add_query_arg( array( 'gv-dismiss' => wp_create_nonce( 'dismiss' ), 'notice' => $dismiss ) ) ); |
202 | 202 | |
203 | 203 | $align = is_rtl() ? 'alignleft' : 'alignright'; |
204 | - $message .= '<a href="'.$url.'" data-notice="'.$dismiss.'" class="' . $align . ' button button-link">'.esc_html__('Dismiss', 'gravityview' ).'</a></p>'; |
|
204 | + $message .= '<a href="' . $url . '" data-notice="' . $dismiss . '" class="' . $align . ' button button-link">' . esc_html__( 'Dismiss', 'gravityview' ) . '</a></p>'; |
|
205 | 205 | } |
206 | 206 | |
207 | 207 | $output .= wpautop( $message ); |
@@ -233,14 +233,14 @@ discard block |
||
233 | 233 | */ |
234 | 234 | public static function add_notice( $notice = array() ) { |
235 | 235 | |
236 | - if( !isset( $notice['message'] ) ) { |
|
236 | + if ( ! isset( $notice[ 'message' ] ) ) { |
|
237 | 237 | gravityview()->log->error( 'Notice not set', array( 'data' => $notice ) ); |
238 | 238 | return; |
239 | 239 | } |
240 | 240 | |
241 | - $notice['class'] = empty( $notice['class'] ) ? 'error' : $notice['class']; |
|
241 | + $notice[ 'class' ] = empty( $notice[ 'class' ] ) ? 'error' : $notice[ 'class' ]; |
|
242 | 242 | |
243 | - self::$admin_notices[] = $notice; |
|
243 | + self::$admin_notices[ ] = $notice; |
|
244 | 244 | } |
245 | 245 | } |
246 | 246 |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | $current_user = wp_get_current_user(); |
82 | 82 | $user_meta_key = '_gv_dismissed_entry_approval_notice' . $gravityview->view->ID; |
83 | 83 | |
84 | - if ( isset( $_GET['gv-dismiss'] ) && wp_verify_nonce( $_GET['gv-dismiss'], 'dismiss' ) ) { |
|
84 | + if ( isset( $_GET[ 'gv-dismiss' ] ) && wp_verify_nonce( $_GET[ 'gv-dismiss' ], 'dismiss' ) ) { |
|
85 | 85 | add_user_meta( $current_user->ID, $user_meta_key, 1 ); // Prevent user from seeing this again for this View |
86 | 86 | return; |
87 | 87 | } |
@@ -150,8 +150,7 @@ discard block |
||
150 | 150 | $tab = __( 'Edit Entry', 'gravityview' ); |
151 | 151 | $context = 'edit'; |
152 | 152 | break; |
153 | - case ( $gravityview->request->is_entry( $gravityview->view->form ? $gravityview->view->form->ID : 0 ) ): |
|
154 | - $tab = __( 'Single Entry', 'gravityview' ); |
|
153 | + case ( $gravityview->request->is_entry( $gravityview->view->form ? $gravityview->view->form->ID : 0 ) ) : $tab = __( 'Single Entry', 'gravityview' ); |
|
155 | 154 | $context = 'single'; |
156 | 155 | break; |
157 | 156 | default: |
@@ -173,7 +172,7 @@ discard block |
||
173 | 172 | $action_text = sprintf( esc_html__( 'Add fields to %s', 'gravityview' ), $tab ); |
174 | 173 | $message = esc_html__( 'You can only see this message because you are able to edit this View.', 'gravityview' ); |
175 | 174 | |
176 | - $image = sprintf( '<img alt="%s" src="%s" style="margin-top: 10px;" />', $tab, esc_url( plugins_url( sprintf( 'assets/images/tab-%s.png', $context ), GRAVITYVIEW_FILE ) ) ); |
|
175 | + $image = sprintf( '<img alt="%s" src="%s" style="margin-top: 10px;" />', $tab, esc_url( plugins_url( sprintf( 'assets/images/tab-%s.png', $context ), GRAVITYVIEW_FILE ) ) ); |
|
177 | 176 | $output = sprintf( '<h3>%s <strong><a href="%s">%s</a></strong></h3><p>%s</p>', $title, esc_url( $edit_link ), $action_text, $message ); |
178 | 177 | |
179 | 178 | echo \GVCommon::generate_notice( $output . $image, 'gv-warning warning', 'edit_gravityview', $gravityview->view->ID ); |
@@ -199,11 +198,11 @@ discard block |
||
199 | 198 | |
200 | 199 | $post_types = get_post_types(); |
201 | 200 | |
202 | - foreach( $post_types as $post_type ) { |
|
201 | + foreach ( $post_types as $post_type ) { |
|
203 | 202 | $post_type_rewrite = get_post_type_object( $post_type )->rewrite; |
204 | 203 | |
205 | 204 | if ( $slug = \GV\Utils::get( $post_type_rewrite, 'slug' ) ) { |
206 | - $reserved_slugs[] = $slug; |
|
205 | + $reserved_slugs[ ] = $slug; |
|
207 | 206 | } |
208 | 207 | } |
209 | 208 |
@@ -27,32 +27,32 @@ discard block |
||
27 | 27 | add_filter( 'gravityview_blacklist_field_types', array( $this, 'default_field_blacklist' ), 10, 2 ); |
28 | 28 | |
29 | 29 | // Tooltips |
30 | - add_filter( 'gform_tooltips', array( $this, 'tooltips') ); |
|
30 | + add_filter( 'gform_tooltips', array( $this, 'tooltips' ) ); |
|
31 | 31 | |
32 | 32 | // adding styles and scripts |
33 | - add_action( 'admin_enqueue_scripts', array( 'GravityView_Admin_Views', 'add_scripts_and_styles'), 999 ); |
|
34 | - add_filter( 'gform_noconflict_styles', array( $this, 'register_no_conflict') ); |
|
35 | - add_filter( 'gform_noconflict_scripts', array( $this, 'register_no_conflict') ); |
|
36 | - add_filter( 'gravityview_noconflict_styles', array( $this, 'register_no_conflict') ); |
|
37 | - add_filter( 'gravityview_noconflict_scripts', array( $this, 'register_no_conflict') ); |
|
38 | - |
|
39 | - add_action( 'gravityview_render_directory_active_areas', array( $this, 'render_directory_active_areas'), 10, 4 ); |
|
40 | - add_action( 'gravityview_render_widgets_active_areas', array( $this, 'render_widgets_active_areas'), 10, 3 ); |
|
41 | - add_action( 'gravityview_render_field_pickers', array( $this, 'render_field_pickers'), 10, 2 ); |
|
42 | - add_action( 'gravityview_render_available_fields', array( $this, 'render_available_fields'), 10, 2 ); |
|
43 | - add_action( 'gravityview_render_available_widgets', array( $this, 'render_available_widgets') ); |
|
44 | - add_action( 'gravityview_render_active_areas', array( $this, 'render_active_areas'), 10, 5 ); |
|
33 | + add_action( 'admin_enqueue_scripts', array( 'GravityView_Admin_Views', 'add_scripts_and_styles' ), 999 ); |
|
34 | + add_filter( 'gform_noconflict_styles', array( $this, 'register_no_conflict' ) ); |
|
35 | + add_filter( 'gform_noconflict_scripts', array( $this, 'register_no_conflict' ) ); |
|
36 | + add_filter( 'gravityview_noconflict_styles', array( $this, 'register_no_conflict' ) ); |
|
37 | + add_filter( 'gravityview_noconflict_scripts', array( $this, 'register_no_conflict' ) ); |
|
38 | + |
|
39 | + add_action( 'gravityview_render_directory_active_areas', array( $this, 'render_directory_active_areas' ), 10, 4 ); |
|
40 | + add_action( 'gravityview_render_widgets_active_areas', array( $this, 'render_widgets_active_areas' ), 10, 3 ); |
|
41 | + add_action( 'gravityview_render_field_pickers', array( $this, 'render_field_pickers' ), 10, 2 ); |
|
42 | + add_action( 'gravityview_render_available_fields', array( $this, 'render_available_fields' ), 10, 2 ); |
|
43 | + add_action( 'gravityview_render_available_widgets', array( $this, 'render_available_widgets' ) ); |
|
44 | + add_action( 'gravityview_render_active_areas', array( $this, 'render_active_areas' ), 10, 5 ); |
|
45 | 45 | |
46 | 46 | // @todo check if this hook is needed.. |
47 | 47 | //add_action( 'gravityview_render_field_options', array( $this, 'render_field_options'), 10, 9 ); |
48 | 48 | |
49 | 49 | // Add Connected Form column |
50 | - add_filter('manage_gravityview_posts_columns' , array( $this, 'add_post_type_columns' ) ); |
|
50 | + add_filter( 'manage_gravityview_posts_columns', array( $this, 'add_post_type_columns' ) ); |
|
51 | 51 | |
52 | 52 | add_filter( 'gform_toolbar_menu', array( 'GravityView_Admin_Views', 'gform_toolbar_menu' ), 10, 2 ); |
53 | 53 | add_action( 'gform_form_actions', array( 'GravityView_Admin_Views', 'gform_toolbar_menu' ), 10, 2 ); |
54 | 54 | |
55 | - add_action( 'manage_gravityview_posts_custom_column', array( $this, 'add_custom_column_content'), 10, 2 ); |
|
55 | + add_action( 'manage_gravityview_posts_custom_column', array( $this, 'add_custom_column_content' ), 10, 2 ); |
|
56 | 56 | |
57 | 57 | add_action( 'restrict_manage_posts', array( $this, 'add_view_dropdown' ) ); |
58 | 58 | |
@@ -70,11 +70,11 @@ discard block |
||
70 | 70 | */ |
71 | 71 | function suggest_support_articles( $localization_data = array() ) { |
72 | 72 | |
73 | - if( ! gravityview()->request->is_view() ) { |
|
73 | + if ( ! gravityview()->request->is_view() ) { |
|
74 | 74 | return $localization_data; |
75 | 75 | } |
76 | 76 | |
77 | - $localization_data['suggest'] = array( |
|
77 | + $localization_data[ 'suggest' ] = array( |
|
78 | 78 | '57ef23539033602e61d4a560', |
79 | 79 | '54c67bb9e4b0512429885513', |
80 | 80 | '54c67bb9e4b0512429885512', |
@@ -103,20 +103,20 @@ discard block |
||
103 | 103 | return; |
104 | 104 | } |
105 | 105 | |
106 | - if ( ! isset( $query->query_vars['post_type'] ) ) { |
|
106 | + if ( ! isset( $query->query_vars[ 'post_type' ] ) ) { |
|
107 | 107 | return; |
108 | 108 | } |
109 | 109 | |
110 | - if ( 'gravityview' !== $query->query_vars['post_type'] ) { |
|
110 | + if ( 'gravityview' !== $query->query_vars[ 'post_type' ] ) { |
|
111 | 111 | return; |
112 | 112 | } |
113 | 113 | |
114 | - $form_id = (int) \GV\Utils::_GET( 'gravityview_form_id' ); |
|
114 | + $form_id = (int)\GV\Utils::_GET( 'gravityview_form_id' ); |
|
115 | 115 | |
116 | 116 | $meta_query = array(); |
117 | 117 | |
118 | 118 | if ( $form_id ) { |
119 | - $meta_query[] = array( |
|
119 | + $meta_query[ ] = array( |
|
120 | 120 | 'key' => '_gravityview_form_id', |
121 | 121 | 'value' => $form_id, |
122 | 122 | ); |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | $layout_id = \GV\Utils::_GET( 'gravityview_layout' ); |
126 | 126 | |
127 | 127 | if ( $layout_id ) { |
128 | - $meta_query[] = array( |
|
128 | + $meta_query[ ] = array( |
|
129 | 129 | 'key' => '_gravityview_directory_template', |
130 | 130 | 'value' => esc_attr( $layout_id ), |
131 | 131 | ); |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | public function add_view_dropdown() { |
143 | 143 | $current_screen = get_current_screen(); |
144 | 144 | |
145 | - if( 'gravityview' !== $current_screen->post_type ) { |
|
145 | + if ( 'gravityview' !== $current_screen->post_type ) { |
|
146 | 146 | return; |
147 | 147 | } |
148 | 148 | |
@@ -150,12 +150,12 @@ discard block |
||
150 | 150 | $current_form = \GV\Utils::_GET( 'gravityview_form_id' ); |
151 | 151 | |
152 | 152 | // If there are no forms to select, show no forms. |
153 | - if( ! empty( $forms ) ) { ?> |
|
153 | + if ( ! empty( $forms ) ) { ?> |
|
154 | 154 | <label for="gravityview_form_id" class="screen-reader-text"><?php esc_html_e( 'Filter Views by form', 'gravityview' ); ?></label> |
155 | 155 | <select name="gravityview_form_id" id="gravityview_form_id"> |
156 | 156 | <option value="" <?php selected( '', $current_form, true ); ?>><?php esc_html_e( 'All forms', 'gravityview' ); ?></option> |
157 | - <?php foreach( $forms as $form ) { ?> |
|
158 | - <option value="<?php echo esc_attr( $form['id'] ); ?>" <?php selected( $form['id'], $current_form, true ); ?>><?php echo esc_html( $form['title'] ); ?></option> |
|
157 | + <?php foreach ( $forms as $form ) { ?> |
|
158 | + <option value="<?php echo esc_attr( $form[ 'id' ] ); ?>" <?php selected( $form[ 'id' ], $current_form, true ); ?>><?php echo esc_html( $form[ 'title' ] ); ?></option> |
|
159 | 159 | <?php } ?> |
160 | 160 | </select> |
161 | 161 | <?php } |
@@ -164,26 +164,26 @@ discard block |
||
164 | 164 | $current_layout = \GV\Utils::_GET( 'gravityview_layout' ); |
165 | 165 | |
166 | 166 | // If there are no forms to select, show no forms. |
167 | - if( ! empty( $layouts ) ) { ?> |
|
167 | + if ( ! empty( $layouts ) ) { ?> |
|
168 | 168 | <label for="gravityview_layout_name" class="screen-reader-text"><?php esc_html_e( 'Filter Views by layout', 'gravityview' ); ?></label> |
169 | 169 | <select name="gravityview_layout" id="gravityview_layout_name"> |
170 | 170 | <option value="" <?php selected( '', $current_layout, true ); ?>><?php esc_html_e( 'All layouts', 'gravityview' ); ?></option> |
171 | 171 | <optgroup label="<?php esc_html_e( 'Layouts', 'gravityview' ); ?>"> |
172 | - <?php foreach( $layouts as $layout_id => $layout ) { |
|
173 | - if ( in_array( $layout['type'], array( 'preset', 'internal' ), true ) ) { |
|
172 | + <?php foreach ( $layouts as $layout_id => $layout ) { |
|
173 | + if ( in_array( $layout[ 'type' ], array( 'preset', 'internal' ), true ) ) { |
|
174 | 174 | continue; |
175 | 175 | } |
176 | 176 | ?> |
177 | - <option value="<?php echo esc_attr( $layout_id ); ?>" <?php selected( $layout_id, $current_layout, true ); ?>><?php echo esc_html( $layout['label'] ); ?></option> |
|
177 | + <option value="<?php echo esc_attr( $layout_id ); ?>" <?php selected( $layout_id, $current_layout, true ); ?>><?php echo esc_html( $layout[ 'label' ] ); ?></option> |
|
178 | 178 | <?php } ?> |
179 | 179 | </optgroup> |
180 | 180 | <optgroup label="<?php esc_html_e( 'Form Presets', 'gravityview' ); ?>"> |
181 | - <?php foreach( $layouts as $layout_id => $layout ) { |
|
182 | - if ( ! in_array( $layout['type'], array( 'preset' ), true ) ) { |
|
181 | + <?php foreach ( $layouts as $layout_id => $layout ) { |
|
182 | + if ( ! in_array( $layout[ 'type' ], array( 'preset' ), true ) ) { |
|
183 | 183 | continue; |
184 | 184 | } |
185 | 185 | ?> |
186 | - <option value="<?php echo esc_attr( $layout_id ); ?>" <?php selected( $layout_id, $current_layout, true ); ?>><?php echo esc_html( $layout['label'] ); ?></option> |
|
186 | + <option value="<?php echo esc_attr( $layout_id ); ?>" <?php selected( $layout_id, $current_layout, true ); ?>><?php echo esc_html( $layout[ 'label' ] ); ?></option> |
|
187 | 187 | <?php } ?> |
188 | 188 | </optgroup> |
189 | 189 | </select> |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | */ |
198 | 198 | public static function render_setting_row( $key = '', $current_settings = array(), $override_input = null, $name = 'template_settings[%s]', $id = 'gravityview_se_%s' ) { |
199 | 199 | _deprecated_function( 'GravityView_Admin_Views::render_setting_row', '1.1.7', 'GravityView_Render_Settings::render_setting_row' ); |
200 | - GravityView_Render_Settings::render_setting_row( $key, $current_settings, $override_input, $name , $id ); |
|
200 | + GravityView_Render_Settings::render_setting_row( $key, $current_settings, $override_input, $name, $id ); |
|
201 | 201 | } |
202 | 202 | |
203 | 203 | /** |
@@ -219,7 +219,7 @@ discard block |
||
219 | 219 | public static function gform_toolbar_menu( $menu_items = array(), $id = NULL ) { |
220 | 220 | |
221 | 221 | // Don't show on Trashed forms |
222 | - if( 'trash' === rgget( 'filter') ) { |
|
222 | + if ( 'trash' === rgget( 'filter' ) ) { |
|
223 | 223 | return $menu_items; |
224 | 224 | } |
225 | 225 | |
@@ -227,13 +227,13 @@ discard block |
||
227 | 227 | |
228 | 228 | $priority = 0; |
229 | 229 | |
230 | - if( 'form_list' === GFForms::get_page() ) { |
|
230 | + if ( 'form_list' === GFForms::get_page() ) { |
|
231 | 231 | $priority = 790; |
232 | 232 | } |
233 | 233 | |
234 | - if( empty( $connected_views ) ) { |
|
234 | + if ( empty( $connected_views ) ) { |
|
235 | 235 | |
236 | - $menu_items['gravityview'] = array( |
|
236 | + $menu_items[ 'gravityview' ] = array( |
|
237 | 237 | 'label' => esc_attr__( 'Create a View', 'gravityview' ), |
238 | 238 | 'icon' => '<i class="fa fa-lg gv-icon-astronaut-head gv-icon"></i>', |
239 | 239 | 'title' => esc_attr__( 'Create a View using this form as a data source', 'gravityview' ), |
@@ -249,22 +249,22 @@ discard block |
||
249 | 249 | $sub_menu_items = array(); |
250 | 250 | foreach ( (array)$connected_views as $view ) { |
251 | 251 | |
252 | - if( ! GVCommon::has_cap( 'edit_gravityview', $view->ID ) ) { |
|
252 | + if ( ! GVCommon::has_cap( 'edit_gravityview', $view->ID ) ) { |
|
253 | 253 | continue; |
254 | 254 | } |
255 | 255 | |
256 | - $label = empty( $view->post_title ) ? sprintf( __('No Title (View #%d)', 'gravityview' ), $view->ID ) : $view->post_title; |
|
256 | + $label = empty( $view->post_title ) ? sprintf( __( 'No Title (View #%d)', 'gravityview' ), $view->ID ) : $view->post_title; |
|
257 | 257 | |
258 | - $sub_menu_items[] = array( |
|
258 | + $sub_menu_items[ ] = array( |
|
259 | 259 | 'label' => esc_attr( $label ), |
260 | - 'url' => admin_url( 'post.php?action=edit&post='.$view->ID ), |
|
260 | + 'url' => admin_url( 'post.php?action=edit&post=' . $view->ID ), |
|
261 | 261 | ); |
262 | 262 | } |
263 | 263 | |
264 | 264 | // If there were no items added, then let's create the parent menu |
265 | - if( $sub_menu_items ) { |
|
265 | + if ( $sub_menu_items ) { |
|
266 | 266 | |
267 | - $sub_menu_items[] = array( |
|
267 | + $sub_menu_items[ ] = array( |
|
268 | 268 | 'label' => esc_attr__( 'Create a View', 'gravityview' ), |
269 | 269 | 'link_class' => 'gv-create-view', |
270 | 270 | 'icon' => '<i> + </i>', |
@@ -280,14 +280,14 @@ discard block |
||
280 | 280 | if ( ! ( 'gf_edit_forms' === rgget( 'page' ) && '' === rgget( 'view' ) ) || version_compare( '2.5-beta', GFForms::$version, '>' ) ) { |
281 | 281 | |
282 | 282 | // Make sure Gravity Forms uses the submenu; if there's only one item, it uses a link instead of a dropdown |
283 | - $sub_menu_items[] = array( |
|
283 | + $sub_menu_items[ ] = array( |
|
284 | 284 | 'url' => '#', |
285 | 285 | 'label' => '', |
286 | 286 | 'menu_class' => 'hidden', |
287 | 287 | 'capabilities' => '', |
288 | 288 | ); |
289 | 289 | |
290 | - $menu_items['gravityview'] = array( |
|
290 | + $menu_items[ 'gravityview' ] = array( |
|
291 | 291 | 'label' => __( 'Connected Views', 'gravityview' ), |
292 | 292 | 'icon' => '<i class="fa fa-lg gv-icon-astronaut-head gv-icon"></i>', |
293 | 293 | 'title' => __( 'GravityView Views using this form as a data source', 'gravityview' ), |
@@ -301,7 +301,7 @@ discard block |
||
301 | 301 | |
302 | 302 | } else { |
303 | 303 | |
304 | - $menu_items[ 'gravityview'] = array( |
|
304 | + $menu_items[ 'gravityview' ] = array( |
|
305 | 305 | 'label' => __( 'Connected Views', 'gravityview' ), |
306 | 306 | 'url' => '#gravityview-group-heading', |
307 | 307 | 'icon' => '<i class="fa fa-lg gv-icon-astronaut-head gv-icon"></i>', |
@@ -337,8 +337,8 @@ discard block |
||
337 | 337 | $add = array( 'captcha', 'page' ); |
338 | 338 | |
339 | 339 | // Don't allowing editing the following values: |
340 | - if( $context === 'edit' ) { |
|
341 | - $add[] = 'post_id'; |
|
340 | + if ( $context === 'edit' ) { |
|
341 | + $add[ ] = 'post_id'; |
|
342 | 342 | } |
343 | 343 | |
344 | 344 | $return = array_merge( $array, $add ); |
@@ -361,27 +361,27 @@ discard block |
||
361 | 361 | foreach ( $default_args as $key => $arg ) { |
362 | 362 | |
363 | 363 | // If an arg has `tooltip` defined, but it's false, don't display a tooltip |
364 | - if( isset( $arg['tooltip'] ) && empty( $arg['tooltip'] ) ) { continue; } |
|
364 | + if ( isset( $arg[ 'tooltip' ] ) && empty( $arg[ 'tooltip' ] ) ) { continue; } |
|
365 | 365 | |
366 | 366 | // By default, use `tooltip` if defined. |
367 | - $tooltip = empty( $arg['tooltip'] ) ? NULL : $arg['tooltip']; |
|
367 | + $tooltip = empty( $arg[ 'tooltip' ] ) ? NULL : $arg[ 'tooltip' ]; |
|
368 | 368 | |
369 | 369 | // If there's no tooltip set, continue |
370 | - if( empty( $tooltip ) ) { |
|
370 | + if ( empty( $tooltip ) ) { |
|
371 | 371 | continue; |
372 | 372 | } |
373 | 373 | |
374 | 374 | // Add the tooltip |
375 | - $gv_tooltips[ 'gv_'.$key ] = array( |
|
376 | - 'title' => $arg['label'], |
|
375 | + $gv_tooltips[ 'gv_' . $key ] = array( |
|
376 | + 'title' => $arg[ 'label' ], |
|
377 | 377 | 'value' => $tooltip, |
378 | 378 | ); |
379 | 379 | |
380 | 380 | } |
381 | 381 | |
382 | - $gv_tooltips['gv_css_merge_tags'] = array( |
|
383 | - 'title' => __('CSS Merge Tags', 'gravityview'), |
|
384 | - 'value' => sprintf( __( 'Developers: The CSS classes will be sanitized using the %ssanitize_title_with_dashes()%s function.', 'gravityview'), '<code>', '</code>' ) |
|
382 | + $gv_tooltips[ 'gv_css_merge_tags' ] = array( |
|
383 | + 'title' => __( 'CSS Merge Tags', 'gravityview' ), |
|
384 | + 'value' => sprintf( __( 'Developers: The CSS classes will be sanitized using the %ssanitize_title_with_dashes()%s function.', 'gravityview' ), '<code>', '</code>' ) |
|
385 | 385 | ); |
386 | 386 | |
387 | 387 | /** |
@@ -399,9 +399,9 @@ discard block |
||
399 | 399 | |
400 | 400 | foreach ( $gv_tooltips as $key => $tooltip ) { |
401 | 401 | |
402 | - $title = empty( $tooltip['title'] ) ? '' : '<h6>'.esc_html( $tooltip['title'] ) .'</h6>'; |
|
402 | + $title = empty( $tooltip[ 'title' ] ) ? '' : '<h6>' . esc_html( $tooltip[ 'title' ] ) . '</h6>'; |
|
403 | 403 | |
404 | - $tooltips[ $key ] = $title . wpautop( esc_html( $tooltip['value'] ) ); |
|
404 | + $tooltips[ $key ] = $title . wpautop( esc_html( $tooltip[ 'value' ] ) ); |
|
405 | 405 | } |
406 | 406 | |
407 | 407 | return $tooltips; |
@@ -415,7 +415,7 @@ discard block |
||
415 | 415 | * |
416 | 416 | * @return void |
417 | 417 | */ |
418 | - public function add_custom_column_content( $column_name = NULL, $post_id ) { |
|
418 | + public function add_custom_column_content( $column_name = NULL, $post_id ) { |
|
419 | 419 | |
420 | 420 | $output = ''; |
421 | 421 | |
@@ -437,7 +437,7 @@ discard block |
||
437 | 437 | // Generate backup if label doesn't exist: `example_name` => `Example Name` |
438 | 438 | $template_id_pretty = ucwords( implode( ' ', explode( '_', $template_id ) ) ); |
439 | 439 | |
440 | - $output = $template ? $template['label'] : $template_id_pretty; |
|
440 | + $output = $template ? $template[ 'label' ] : $template_id_pretty; |
|
441 | 441 | |
442 | 442 | break; |
443 | 443 | |
@@ -478,44 +478,44 @@ discard block |
||
478 | 478 | static public function get_connected_form_links( $form, $include_form_link = true ) { |
479 | 479 | |
480 | 480 | // Either the form is empty or the form ID is 0, not yet set. |
481 | - if( empty( $form ) ) { |
|
481 | + if ( empty( $form ) ) { |
|
482 | 482 | return ''; |
483 | 483 | } |
484 | 484 | |
485 | 485 | // The $form is passed as the form ID |
486 | - if( !is_array( $form ) ) { |
|
486 | + if ( ! is_array( $form ) ) { |
|
487 | 487 | $form = gravityview_get_form( $form ); |
488 | 488 | } |
489 | 489 | |
490 | - $form_id = $form['id']; |
|
490 | + $form_id = $form[ 'id' ]; |
|
491 | 491 | $links = array(); |
492 | 492 | |
493 | - if( GVCommon::has_cap( 'gravityforms_edit_forms' ) ) { |
|
493 | + if ( GVCommon::has_cap( 'gravityforms_edit_forms' ) ) { |
|
494 | 494 | $form_url = admin_url( sprintf( 'admin.php?page=gf_edit_forms&id=%d', $form_id ) ); |
495 | - $form_link = '<strong class="gv-form-title">'.gravityview_get_link( $form_url, $form['title'], 'class=row-title' ).'</strong>'; |
|
496 | - $links[] = '<span>'.gravityview_get_link( $form_url, __('Edit Form', 'gravityview') ).'</span>'; |
|
495 | + $form_link = '<strong class="gv-form-title">' . gravityview_get_link( $form_url, $form[ 'title' ], 'class=row-title' ) . '</strong>'; |
|
496 | + $links[ ] = '<span>' . gravityview_get_link( $form_url, __( 'Edit Form', 'gravityview' ) ) . '</span>'; |
|
497 | 497 | } else { |
498 | - $form_link = '<strong class="gv-form-title">'. esc_html( $form['title'] ). '</strong>'; |
|
498 | + $form_link = '<strong class="gv-form-title">' . esc_html( $form[ 'title' ] ) . '</strong>'; |
|
499 | 499 | } |
500 | 500 | |
501 | - if( GVCommon::has_cap( 'gravityforms_view_entries' ) ) { |
|
501 | + if ( GVCommon::has_cap( 'gravityforms_view_entries' ) ) { |
|
502 | 502 | $entries_url = admin_url( sprintf( 'admin.php?page=gf_entries&id=%d', $form_id ) ); |
503 | - $links[] = '<span>'.gravityview_get_link( $entries_url, __('Entries', 'gravityview') ).'</span>'; |
|
503 | + $links[ ] = '<span>' . gravityview_get_link( $entries_url, __( 'Entries', 'gravityview' ) ) . '</span>'; |
|
504 | 504 | } |
505 | 505 | |
506 | - if( GVCommon::has_cap( array( 'gravityforms_edit_settings', 'gravityview_view_settings' ) ) ) { |
|
506 | + if ( GVCommon::has_cap( array( 'gravityforms_edit_settings', 'gravityview_view_settings' ) ) ) { |
|
507 | 507 | $settings_url = admin_url( sprintf( 'admin.php?page=gf_edit_forms&view=settings&id=%d', $form_id ) ); |
508 | - $links[] = '<span>'.gravityview_get_link( $settings_url, __('Settings', 'gravityview'), 'title='.__('Edit settings for this form', 'gravityview') ).'</span>'; |
|
508 | + $links[ ] = '<span>' . gravityview_get_link( $settings_url, __( 'Settings', 'gravityview' ), 'title=' . __( 'Edit settings for this form', 'gravityview' ) ) . '</span>'; |
|
509 | 509 | } |
510 | 510 | |
511 | - if( GVCommon::has_cap( array("gravityforms_edit_forms", "gravityforms_create_form", "gravityforms_preview_forms") ) ) { |
|
511 | + if ( GVCommon::has_cap( array( "gravityforms_edit_forms", "gravityforms_create_form", "gravityforms_preview_forms" ) ) ) { |
|
512 | 512 | $preview_url = site_url( sprintf( '?gf_page=preview&id=%d', $form_id ) ); |
513 | - $links[] = '<span>'.gravityview_get_link( $preview_url, __('Preview Form', 'gravityview'), 'title='.__('Preview this form', 'gravityview') ).'</span>'; |
|
513 | + $links[ ] = '<span>' . gravityview_get_link( $preview_url, __( 'Preview Form', 'gravityview' ), 'title=' . __( 'Preview this form', 'gravityview' ) ) . '</span>'; |
|
514 | 514 | } |
515 | 515 | |
516 | 516 | $output = ''; |
517 | 517 | |
518 | - if( !empty( $include_form_link ) ) { |
|
518 | + if ( ! empty( $include_form_link ) ) { |
|
519 | 519 | $output .= $form_link; |
520 | 520 | } |
521 | 521 | |
@@ -530,11 +530,11 @@ discard block |
||
530 | 530 | $css_class = 'row-actions'; |
531 | 531 | |
532 | 532 | // Is Screen Options > View mode set to "Extended view"? If so, keep actions visible. |
533 | - if( 'excerpt' === get_user_setting( 'posts_list_mode', 'list' ) ) { |
|
533 | + if ( 'excerpt' === get_user_setting( 'posts_list_mode', 'list' ) ) { |
|
534 | 534 | $css_class = 'row-actions visible'; |
535 | 535 | } |
536 | 536 | |
537 | - $output .= '<div class="' . $css_class . '">'. implode( ' | ', $links ) .'</div>'; |
|
537 | + $output .= '<div class="' . $css_class . '">' . implode( ' | ', $links ) . '</div>'; |
|
538 | 538 | |
539 | 539 | return $output; |
540 | 540 | } |
@@ -548,8 +548,8 @@ discard block |
||
548 | 548 | // Get the date column and save it for later to add back in. |
549 | 549 | // This adds it after the Data Source column. |
550 | 550 | // This way, we don't need to do array_slice, array_merge, etc. |
551 | - $date = $columns['date']; |
|
552 | - unset( $columns['date'] ); |
|
551 | + $date = $columns[ 'date' ]; |
|
552 | + unset( $columns[ 'date' ] ); |
|
553 | 553 | |
554 | 554 | $data_source_required_caps = array( |
555 | 555 | 'gravityforms_edit_forms', |
@@ -560,14 +560,14 @@ discard block |
||
560 | 560 | 'gravityforms_preview_forms', |
561 | 561 | ); |
562 | 562 | |
563 | - if( GVCommon::has_cap( $data_source_required_caps ) ) { |
|
564 | - $columns['gv_connected_form'] = __( 'Data Source', 'gravityview' ); |
|
563 | + if ( GVCommon::has_cap( $data_source_required_caps ) ) { |
|
564 | + $columns[ 'gv_connected_form' ] = __( 'Data Source', 'gravityview' ); |
|
565 | 565 | } |
566 | 566 | |
567 | - $columns['gv_template'] = _x( 'Template', 'Column title that shows what template is being used for Views', 'gravityview' ); |
|
567 | + $columns[ 'gv_template' ] = _x( 'Template', 'Column title that shows what template is being used for Views', 'gravityview' ); |
|
568 | 568 | |
569 | 569 | // Add the date back in. |
570 | - $columns['date'] = $date; |
|
570 | + $columns[ 'date' ] = $date; |
|
571 | 571 | |
572 | 572 | return $columns; |
573 | 573 | } |
@@ -580,12 +580,12 @@ discard block |
||
580 | 580 | */ |
581 | 581 | function save_postdata( $post_id ) { |
582 | 582 | |
583 | - if( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ){ |
|
583 | + if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) { |
|
584 | 584 | return; |
585 | 585 | } |
586 | 586 | |
587 | 587 | // validate post_type |
588 | - if ( ! isset( $_POST['post_type'] ) || 'gravityview' != $_POST['post_type'] ) { |
|
588 | + if ( ! isset( $_POST[ 'post_type' ] ) || 'gravityview' != $_POST[ 'post_type' ] ) { |
|
589 | 589 | return; |
590 | 590 | } |
591 | 591 | |
@@ -600,63 +600,63 @@ discard block |
||
600 | 600 | $statii = array(); |
601 | 601 | |
602 | 602 | // check if this is a start fresh View |
603 | - if ( isset( $_POST['gravityview_select_form_nonce'] ) && wp_verify_nonce( $_POST['gravityview_select_form_nonce'], 'gravityview_select_form' ) ) { |
|
603 | + if ( isset( $_POST[ 'gravityview_select_form_nonce' ] ) && wp_verify_nonce( $_POST[ 'gravityview_select_form_nonce' ], 'gravityview_select_form' ) ) { |
|
604 | 604 | |
605 | - $form_id = !empty( $_POST['gravityview_form_id'] ) ? $_POST['gravityview_form_id'] : ''; |
|
605 | + $form_id = ! empty( $_POST[ 'gravityview_form_id' ] ) ? $_POST[ 'gravityview_form_id' ] : ''; |
|
606 | 606 | // save form id |
607 | - $statii['form_id'] = update_post_meta( $post_id, '_gravityview_form_id', $form_id ); |
|
607 | + $statii[ 'form_id' ] = update_post_meta( $post_id, '_gravityview_form_id', $form_id ); |
|
608 | 608 | |
609 | 609 | } |
610 | 610 | |
611 | - if( false === GVCommon::has_cap( 'gravityforms_create_form' ) && empty( $statii['form_id'] ) ) { |
|
611 | + if ( false === GVCommon::has_cap( 'gravityforms_create_form' ) && empty( $statii[ 'form_id' ] ) ) { |
|
612 | 612 | gravityview()->log->error( 'Current user does not have the capability to create a new Form.', array( 'data' => wp_get_current_user() ) ); |
613 | 613 | return; |
614 | 614 | } |
615 | 615 | |
616 | 616 | // Was this a start fresh? |
617 | - if ( ! empty( $_POST['gravityview_form_id_start_fresh'] ) ) { |
|
618 | - $statii['start_fresh'] = add_post_meta( $post_id, '_gravityview_start_fresh', 1 ); |
|
617 | + if ( ! empty( $_POST[ 'gravityview_form_id_start_fresh' ] ) ) { |
|
618 | + $statii[ 'start_fresh' ] = add_post_meta( $post_id, '_gravityview_start_fresh', 1 ); |
|
619 | 619 | } else { |
620 | - $statii['start_fresh'] = delete_post_meta( $post_id, '_gravityview_start_fresh' ); |
|
620 | + $statii[ 'start_fresh' ] = delete_post_meta( $post_id, '_gravityview_start_fresh' ); |
|
621 | 621 | } |
622 | 622 | |
623 | 623 | // Check if we have a template id |
624 | - if ( isset( $_POST['gravityview_select_template_nonce'] ) && wp_verify_nonce( $_POST['gravityview_select_template_nonce'], 'gravityview_select_template' ) ) { |
|
624 | + if ( isset( $_POST[ 'gravityview_select_template_nonce' ] ) && wp_verify_nonce( $_POST[ 'gravityview_select_template_nonce' ], 'gravityview_select_template' ) ) { |
|
625 | 625 | |
626 | - $template_id = !empty( $_POST['gravityview_directory_template'] ) ? $_POST['gravityview_directory_template'] : ''; |
|
626 | + $template_id = ! empty( $_POST[ 'gravityview_directory_template' ] ) ? $_POST[ 'gravityview_directory_template' ] : ''; |
|
627 | 627 | |
628 | 628 | // now save template id |
629 | - $statii['directory_template'] = update_post_meta( $post_id, '_gravityview_directory_template', $template_id ); |
|
629 | + $statii[ 'directory_template' ] = update_post_meta( $post_id, '_gravityview_directory_template', $template_id ); |
|
630 | 630 | } |
631 | 631 | |
632 | 632 | |
633 | 633 | // save View Configuration metabox |
634 | - if ( isset( $_POST['gravityview_view_configuration_nonce'] ) && wp_verify_nonce( $_POST['gravityview_view_configuration_nonce'], 'gravityview_view_configuration' ) ) { |
|
634 | + if ( isset( $_POST[ 'gravityview_view_configuration_nonce' ] ) && wp_verify_nonce( $_POST[ 'gravityview_view_configuration_nonce' ], 'gravityview_view_configuration' ) ) { |
|
635 | 635 | |
636 | 636 | // template settings |
637 | - if( empty( $_POST['template_settings'] ) ) { |
|
638 | - $_POST['template_settings'] = array(); |
|
637 | + if ( empty( $_POST[ 'template_settings' ] ) ) { |
|
638 | + $_POST[ 'template_settings' ] = array(); |
|
639 | 639 | } |
640 | - $statii['template_settings'] = update_post_meta( $post_id, '_gravityview_template_settings', $_POST['template_settings'] ); |
|
640 | + $statii[ 'template_settings' ] = update_post_meta( $post_id, '_gravityview_template_settings', $_POST[ 'template_settings' ] ); |
|
641 | 641 | |
642 | 642 | // guard against unloaded View configuration page |
643 | - if ( isset( $_POST['gv_fields'] ) && isset( $_POST['gv_fields_done'] ) ) { |
|
643 | + if ( isset( $_POST[ 'gv_fields' ] ) && isset( $_POST[ 'gv_fields_done' ] ) ) { |
|
644 | 644 | $fields = array(); |
645 | 645 | |
646 | - if ( ! empty( $_POST['gv_fields'] ) ) { |
|
646 | + if ( ! empty( $_POST[ 'gv_fields' ] ) ) { |
|
647 | 647 | $fields = _gravityview_process_posted_fields(); |
648 | 648 | } |
649 | 649 | |
650 | 650 | $fields = wp_slash( $fields ); |
651 | 651 | |
652 | - $statii['directory_fields'] = update_post_meta( $post_id, '_gravityview_directory_fields', $fields ); |
|
652 | + $statii[ 'directory_fields' ] = update_post_meta( $post_id, '_gravityview_directory_fields', $fields ); |
|
653 | 653 | } |
654 | 654 | |
655 | 655 | // Directory Visible Widgets |
656 | - if( empty( $_POST['widgets'] ) ) { |
|
657 | - $_POST['widgets'] = array(); |
|
656 | + if ( empty( $_POST[ 'widgets' ] ) ) { |
|
657 | + $_POST[ 'widgets' ] = array(); |
|
658 | 658 | } |
659 | - $statii['directory_widgets'] = gravityview_set_directory_widgets( $post_id, $_POST['widgets'] ); |
|
659 | + $statii[ 'directory_widgets' ] = gravityview_set_directory_widgets( $post_id, $_POST[ 'widgets' ] ); |
|
660 | 660 | |
661 | 661 | } // end save view configuration |
662 | 662 | |
@@ -666,7 +666,7 @@ discard block |
||
666 | 666 | * @param array $statii Array of statuses of the post meta saving processes. If saving worked, each key should be mapped to a value of the post ID (`directory_widgets` => `124`). If failed (or didn't change), the value will be false. |
667 | 667 | * @since 1.17.2 |
668 | 668 | */ |
669 | - do_action('gravityview_view_saved', $post_id, $statii ); |
|
669 | + do_action( 'gravityview_view_saved', $post_id, $statii ); |
|
670 | 670 | |
671 | 671 | gravityview()->log->debug( '[save_postdata] Update Post Meta Statuses (also returns false if nothing changed)', array( 'data' => array_map( 'intval', $statii ) ) ); |
672 | 672 | } |
@@ -711,20 +711,20 @@ discard block |
||
711 | 711 | |
712 | 712 | $output = ''; |
713 | 713 | |
714 | - if( !empty( $fields ) ) { |
|
714 | + if ( ! empty( $fields ) ) { |
|
715 | 715 | |
716 | - foreach( $fields as $id => $details ) { |
|
716 | + foreach ( $fields as $id => $details ) { |
|
717 | 717 | |
718 | - if( in_array( $details['type'], (array) $blacklist_field_types ) ) { |
|
718 | + if ( in_array( $details[ 'type' ], (array)$blacklist_field_types ) ) { |
|
719 | 719 | continue; |
720 | 720 | } |
721 | 721 | |
722 | 722 | // Edit mode only allows editing the parent fields, not single inputs. |
723 | - if( $context === 'edit' && ! empty( $details['parent'] ) ) { |
|
723 | + if ( $context === 'edit' && ! empty( $details[ 'parent' ] ) ) { |
|
724 | 724 | continue; |
725 | 725 | } |
726 | 726 | |
727 | - $output .= new GravityView_Admin_View_Field( $details['label'], $id, $details, array(), $form ); |
|
727 | + $output .= new GravityView_Admin_View_Field( $details[ 'label' ], $id, $details, array(), $form ); |
|
728 | 728 | |
729 | 729 | } // End foreach |
730 | 730 | } |
@@ -732,7 +732,7 @@ discard block |
||
732 | 732 | echo $output; |
733 | 733 | |
734 | 734 | // For the EDIT view we only want to allow the form fields. |
735 | - if( $context === 'edit' ) { |
|
735 | + if ( $context === 'edit' ) { |
|
736 | 736 | return; |
737 | 737 | } |
738 | 738 | |
@@ -751,7 +751,7 @@ discard block |
||
751 | 751 | $additional_fields = array( |
752 | 752 | array( |
753 | 753 | 'label_text' => '+ ' . __( 'Add All Form Fields', 'gravityview' ), |
754 | - 'desc' => __('Insert all the form fields at once.', 'gravityview'), |
|
754 | + 'desc' => __( 'Insert all the form fields at once.', 'gravityview' ), |
|
755 | 755 | 'field_id' => 'all-fields', |
756 | 756 | 'label_type' => 'field', |
757 | 757 | 'input_type' => null, |
@@ -767,7 +767,7 @@ discard block |
||
767 | 767 | */ |
768 | 768 | $additional_fields = apply_filters( 'gravityview_additional_fields', $additional_fields ); |
769 | 769 | |
770 | - foreach ( (array) $additional_fields as $item ) { |
|
770 | + foreach ( (array)$additional_fields as $item ) { |
|
771 | 771 | |
772 | 772 | // Prevent items from not having index set |
773 | 773 | $item = wp_parse_args( $item, array( |
@@ -778,16 +778,16 @@ discard block |
||
778 | 778 | 'field_options' => null, |
779 | 779 | 'settings_html' => null, |
780 | 780 | 'icon' => null, |
781 | - )); |
|
781 | + ) ); |
|
782 | 782 | |
783 | 783 | // Backward compat. |
784 | - if( !empty( $item['field_options'] ) ) { |
|
784 | + if ( ! empty( $item[ 'field_options' ] ) ) { |
|
785 | 785 | // Use settings_html from now on. |
786 | - $item['settings_html'] = $item['field_options']; |
|
786 | + $item[ 'settings_html' ] = $item[ 'field_options' ]; |
|
787 | 787 | } |
788 | 788 | |
789 | 789 | // Render a label for each of them |
790 | - echo new GravityView_Admin_View_Field( $item['label_text'], $item['field_id'], $item, $settings = array(), $form ); |
|
790 | + echo new GravityView_Admin_View_Field( $item[ 'label_text' ], $item[ 'field_id' ], $item, $settings = array(), $form ); |
|
791 | 791 | |
792 | 792 | } |
793 | 793 | |
@@ -799,59 +799,59 @@ discard block |
||
799 | 799 | * @param string $zone Either 'single', 'directory', 'header', 'footer' |
800 | 800 | * @return array |
801 | 801 | */ |
802 | - function get_entry_default_fields($form, $zone) { |
|
802 | + function get_entry_default_fields( $form, $zone ) { |
|
803 | 803 | |
804 | 804 | $entry_default_fields = array(); |
805 | 805 | |
806 | - if( in_array( $zone, array( 'directory', 'single' ) ) ) { |
|
806 | + if ( in_array( $zone, array( 'directory', 'single' ) ) ) { |
|
807 | 807 | |
808 | 808 | $entry_default_fields = array( |
809 | 809 | 'id' => array( |
810 | - 'label' => __('Entry ID', 'gravityview'), |
|
810 | + 'label' => __( 'Entry ID', 'gravityview' ), |
|
811 | 811 | 'type' => 'id', |
812 | - 'desc' => __('The unique ID of the entry.', 'gravityview'), |
|
812 | + 'desc' => __( 'The unique ID of the entry.', 'gravityview' ), |
|
813 | 813 | ), |
814 | 814 | 'date_created' => array( |
815 | - 'label' => __('Entry Date', 'gravityview'), |
|
816 | - 'desc' => __('The date the entry was created.', 'gravityview'), |
|
815 | + 'label' => __( 'Entry Date', 'gravityview' ), |
|
816 | + 'desc' => __( 'The date the entry was created.', 'gravityview' ), |
|
817 | 817 | 'type' => 'date_created', |
818 | 818 | ), |
819 | 819 | 'date_updated' => array( |
820 | - 'label' => __( 'Date Updated', 'gravityview'), |
|
821 | - 'desc' => __('The date the entry was last updated.', 'gravityview'), |
|
820 | + 'label' => __( 'Date Updated', 'gravityview' ), |
|
821 | + 'desc' => __( 'The date the entry was last updated.', 'gravityview' ), |
|
822 | 822 | 'type' => 'date_updated', |
823 | 823 | ), |
824 | 824 | 'source_url' => array( |
825 | - 'label' => __('Source URL', 'gravityview'), |
|
825 | + 'label' => __( 'Source URL', 'gravityview' ), |
|
826 | 826 | 'type' => 'source_url', |
827 | - 'desc' => __('The URL of the page where the form was submitted.', 'gravityview'), |
|
827 | + 'desc' => __( 'The URL of the page where the form was submitted.', 'gravityview' ), |
|
828 | 828 | ), |
829 | 829 | 'ip' => array( |
830 | - 'label' => __('User IP', 'gravityview'), |
|
830 | + 'label' => __( 'User IP', 'gravityview' ), |
|
831 | 831 | 'type' => 'ip', |
832 | - 'desc' => __('The IP Address of the user who created the entry.', 'gravityview'), |
|
832 | + 'desc' => __( 'The IP Address of the user who created the entry.', 'gravityview' ), |
|
833 | 833 | ), |
834 | 834 | 'created_by' => array( |
835 | - 'label' => __('User', 'gravityview'), |
|
835 | + 'label' => __( 'User', 'gravityview' ), |
|
836 | 836 | 'type' => 'created_by', |
837 | - 'desc' => __('Details of the logged-in user who created the entry (if any).', 'gravityview'), |
|
837 | + 'desc' => __( 'Details of the logged-in user who created the entry (if any).', 'gravityview' ), |
|
838 | 838 | ), |
839 | 839 | |
840 | 840 | /** |
841 | 841 | * @since 1.7.2 |
842 | 842 | */ |
843 | 843 | 'other_entries' => array( |
844 | - 'label' => __('Other Entries', 'gravityview'), |
|
844 | + 'label' => __( 'Other Entries', 'gravityview' ), |
|
845 | 845 | 'type' => 'other_entries', |
846 | - 'desc' => __('Display other entries created by the entry creator.', 'gravityview'), |
|
846 | + 'desc' => __( 'Display other entries created by the entry creator.', 'gravityview' ), |
|
847 | 847 | ), |
848 | 848 | ); |
849 | 849 | |
850 | - if( 'single' !== $zone) { |
|
850 | + if ( 'single' !== $zone ) { |
|
851 | 851 | |
852 | - $entry_default_fields['entry_link'] = array( |
|
853 | - 'label' => __('Link to Entry', 'gravityview'), |
|
854 | - 'desc' => __('A dedicated link to the single entry with customizable text.', 'gravityview'), |
|
852 | + $entry_default_fields[ 'entry_link' ] = array( |
|
853 | + 'label' => __( 'Link to Entry', 'gravityview' ), |
|
854 | + 'desc' => __( 'A dedicated link to the single entry with customizable text.', 'gravityview' ), |
|
855 | 855 | 'type' => 'entry_link', |
856 | 856 | ); |
857 | 857 | } |
@@ -861,19 +861,19 @@ discard block |
||
861 | 861 | /** |
862 | 862 | * @since 1.2 |
863 | 863 | */ |
864 | - $entry_default_fields['custom'] = array( |
|
865 | - 'label' => __('Custom Content', 'gravityview'), |
|
864 | + $entry_default_fields[ 'custom' ] = array( |
|
865 | + 'label' => __( 'Custom Content', 'gravityview' ), |
|
866 | 866 | 'type' => 'custom', |
867 | - 'desc' => __('Insert custom text or HTML.', 'gravityview'), |
|
867 | + 'desc' => __( 'Insert custom text or HTML.', 'gravityview' ), |
|
868 | 868 | ); |
869 | 869 | |
870 | 870 | /** |
871 | 871 | * @since develop |
872 | 872 | */ |
873 | - $entry_default_fields['sequence'] = array( |
|
874 | - 'label' => __('Result Number', 'gravityview'), |
|
873 | + $entry_default_fields[ 'sequence' ] = array( |
|
874 | + 'label' => __( 'Result Number', 'gravityview' ), |
|
875 | 875 | 'type' => 'sequence', |
876 | - 'desc' => __('Display a sequential result number for each entry.', 'gravityview'), |
|
876 | + 'desc' => __( 'Display a sequential result number for each entry.', 'gravityview' ), |
|
877 | 877 | ); |
878 | 878 | |
879 | 879 | /** |
@@ -882,7 +882,7 @@ discard block |
||
882 | 882 | * @param string|array $form form_ID or form object |
883 | 883 | * @param string $zone Either 'single', 'directory', 'header', 'footer' |
884 | 884 | */ |
885 | - return apply_filters( 'gravityview_entry_default_fields', $entry_default_fields, $form, $zone); |
|
885 | + return apply_filters( 'gravityview_entry_default_fields', $entry_default_fields, $form, $zone ); |
|
886 | 886 | } |
887 | 887 | |
888 | 888 | /** |
@@ -893,7 +893,7 @@ discard block |
||
893 | 893 | */ |
894 | 894 | function get_available_fields( $form = '', $zone = NULL ) { |
895 | 895 | |
896 | - if( empty( $form ) ) { |
|
896 | + if ( empty( $form ) ) { |
|
897 | 897 | gravityview()->log->error( '$form is empty' ); |
898 | 898 | return array(); |
899 | 899 | } |
@@ -902,7 +902,7 @@ discard block |
||
902 | 902 | $fields = gravityview_get_form_fields( $form, true ); |
903 | 903 | |
904 | 904 | // get meta fields ( only if form was already created ) |
905 | - if( !is_array( $form ) ) { |
|
905 | + if ( ! is_array( $form ) ) { |
|
906 | 906 | $meta_fields = gravityview_get_entry_meta( $form ); |
907 | 907 | } else { |
908 | 908 | $meta_fields = array(); |
@@ -915,14 +915,14 @@ discard block |
||
915 | 915 | $fields = $fields + $meta_fields + $default_fields; |
916 | 916 | |
917 | 917 | // Move Custom Content to top |
918 | - $fields = array( 'custom' => $fields['custom'] ) + $fields; |
|
918 | + $fields = array( 'custom' => $fields[ 'custom' ] ) + $fields; |
|
919 | 919 | |
920 | 920 | $gv_fields = GravityView_Fields::get_all(); |
921 | 921 | |
922 | 922 | foreach ( $fields as &$field ) { |
923 | 923 | foreach ( $gv_fields as $gv_field ) { |
924 | - if ( $field['type'] === $gv_field->name ) { |
|
925 | - $field['icon'] = $gv_field->icon; |
|
924 | + if ( $field[ 'type' ] === $gv_field->name ) { |
|
925 | + $field[ 'icon' ] = $gv_field->icon; |
|
926 | 926 | } |
927 | 927 | } |
928 | 928 | } |
@@ -945,11 +945,11 @@ discard block |
||
945 | 945 | |
946 | 946 | $widgets = $this->get_registered_widgets(); |
947 | 947 | |
948 | - if( !empty( $widgets ) ) { |
|
948 | + if ( ! empty( $widgets ) ) { |
|
949 | 949 | |
950 | - foreach( $widgets as $id => $details ) { |
|
950 | + foreach ( $widgets as $id => $details ) { |
|
951 | 951 | |
952 | - echo new GravityView_Admin_View_Widget( $details['label'], $id, $details ); |
|
952 | + echo new GravityView_Admin_View_Widget( $details[ 'label' ], $id, $details ); |
|
953 | 953 | |
954 | 954 | } |
955 | 955 | } |
@@ -978,7 +978,7 @@ discard block |
||
978 | 978 | function render_active_areas( $template_id, $type, $zone, $rows, $values ) { |
979 | 979 | global $post; |
980 | 980 | |
981 | - if( $type === 'widget' ) { |
|
981 | + if ( $type === 'widget' ) { |
|
982 | 982 | $button_label = __( 'Add Widget', 'gravityview' ); |
983 | 983 | } else { |
984 | 984 | $button_label = __( 'Add Field', 'gravityview' ); |
@@ -1004,10 +1004,10 @@ discard block |
||
1004 | 1004 | $form_id = null; |
1005 | 1005 | |
1006 | 1006 | // if saved values, get available fields to label everyone |
1007 | - if( !empty( $values ) && ( !empty( $post->ID ) || !empty( $_POST['template_id'] ) ) ) { |
|
1007 | + if ( ! empty( $values ) && ( ! empty( $post->ID ) || ! empty( $_POST[ 'template_id' ] ) ) ) { |
|
1008 | 1008 | |
1009 | - if( !empty( $_POST['template_id'] ) ) { |
|
1010 | - $form = GravityView_Ajax::pre_get_form_fields( $_POST['template_id'] ); |
|
1009 | + if ( ! empty( $_POST[ 'template_id' ] ) ) { |
|
1010 | + $form = GravityView_Ajax::pre_get_form_fields( $_POST[ 'template_id' ] ); |
|
1011 | 1011 | } else { |
1012 | 1012 | $form_id = $form = gravityview_get_form_id( $post->ID ); |
1013 | 1013 | } |
@@ -1025,42 +1025,42 @@ discard block |
||
1025 | 1025 | } |
1026 | 1026 | } |
1027 | 1027 | |
1028 | - foreach( $rows as $row ) : |
|
1029 | - foreach( $row as $col => $areas ) : |
|
1030 | - $column = ($col == '2-2') ? '1-2' : $col; ?> |
|
1028 | + foreach ( $rows as $row ) : |
|
1029 | + foreach ( $row as $col => $areas ) : |
|
1030 | + $column = ( $col == '2-2' ) ? '1-2' : $col; ?> |
|
1031 | 1031 | |
1032 | 1032 | <div class="gv-grid-col-<?php echo esc_attr( $column ); ?>"> |
1033 | 1033 | |
1034 | - <?php foreach( $areas as $area ) : ?> |
|
1034 | + <?php foreach ( $areas as $area ) : ?> |
|
1035 | 1035 | |
1036 | - <div class="gv-droppable-area" data-areaid="<?php echo esc_attr( $zone .'_'. $area['areaid'] ); ?>" data-context="<?php echo esc_attr( $zone ); ?>"> |
|
1037 | - <div class="active-drop active-drop-<?php echo esc_attr( $type ); ?>" data-areaid="<?php echo esc_attr( $zone .'_'. $area['areaid'] ); ?>"> |
|
1036 | + <div class="gv-droppable-area" data-areaid="<?php echo esc_attr( $zone . '_' . $area[ 'areaid' ] ); ?>" data-context="<?php echo esc_attr( $zone ); ?>"> |
|
1037 | + <div class="active-drop active-drop-<?php echo esc_attr( $type ); ?>" data-areaid="<?php echo esc_attr( $zone . '_' . $area[ 'areaid' ] ); ?>"> |
|
1038 | 1038 | <?php // render saved fields |
1039 | - if( ! empty( $values[ $zone .'_'. $area['areaid'] ] ) ) { |
|
1039 | + if ( ! empty( $values[ $zone . '_' . $area[ 'areaid' ] ] ) ) { |
|
1040 | 1040 | |
1041 | - foreach( $values[ $zone .'_'. $area['areaid'] ] as $uniqid => $field ) { |
|
1041 | + foreach ( $values[ $zone . '_' . $area[ 'areaid' ] ] as $uniqid => $field ) { |
|
1042 | 1042 | |
1043 | 1043 | // Maybe has a form ID |
1044 | - $form_id = empty( $field['form_id'] ) ? $form_id : $field['form_id']; |
|
1044 | + $form_id = empty( $field[ 'form_id' ] ) ? $form_id : $field[ 'form_id' ]; |
|
1045 | 1045 | |
1046 | 1046 | $input_type = NULL; |
1047 | 1047 | |
1048 | 1048 | if ( $form_id ) { |
1049 | - $original_item = isset( $available_items[ $form_id ] [ $field['id'] ] ) ? $available_items[ $form_id ] [ $field['id'] ] : false ; |
|
1049 | + $original_item = isset( $available_items[ $form_id ] [ $field[ 'id' ] ] ) ? $available_items[ $form_id ] [ $field[ 'id' ] ] : false; |
|
1050 | 1050 | } else { |
1051 | - $original_item = isset( $available_items[ $field['id'] ] ) ? $available_items[ $field['id'] ] : false ; |
|
1051 | + $original_item = isset( $available_items[ $field[ 'id' ] ] ) ? $available_items[ $field[ 'id' ] ] : false; |
|
1052 | 1052 | } |
1053 | 1053 | |
1054 | - if ( !$original_item ) { |
|
1055 | - gravityview()->log->error( 'An item was not available when rendering the output; maybe it was added by a plugin that is now de-activated.', array(' data' => array('available_items' => $available_items, 'field' => $field ) ) ); |
|
1054 | + if ( ! $original_item ) { |
|
1055 | + gravityview()->log->error( 'An item was not available when rendering the output; maybe it was added by a plugin that is now de-activated.', array( ' data' => array( 'available_items' => $available_items, 'field' => $field ) ) ); |
|
1056 | 1056 | |
1057 | 1057 | $original_item = $field; |
1058 | 1058 | } else { |
1059 | - $input_type = isset( $original_item['type'] ) ? $original_item['type'] : NULL; |
|
1059 | + $input_type = isset( $original_item[ 'type' ] ) ? $original_item[ 'type' ] : NULL; |
|
1060 | 1060 | } |
1061 | 1061 | |
1062 | 1062 | // Field options dialog box |
1063 | - $field_options = GravityView_Render_Settings::render_field_options( $form_id, $type, $template_id, $field['id'], $original_item['label'], $zone .'_'. $area['areaid'], $input_type, $uniqid, $field, $zone, $original_item ); |
|
1063 | + $field_options = GravityView_Render_Settings::render_field_options( $form_id, $type, $template_id, $field[ 'id' ], $original_item[ 'label' ], $zone . '_' . $area[ 'areaid' ], $input_type, $uniqid, $field, $zone, $original_item ); |
|
1064 | 1064 | |
1065 | 1065 | $item = array( |
1066 | 1066 | 'input_type' => $input_type, |
@@ -1073,22 +1073,22 @@ discard block |
||
1073 | 1073 | $item = wp_parse_args( $item, $original_item ); |
1074 | 1074 | } |
1075 | 1075 | |
1076 | - switch( $type ) { |
|
1076 | + switch ( $type ) { |
|
1077 | 1077 | case 'widget': |
1078 | - echo new GravityView_Admin_View_Widget( $item['label'], $field['id'], $item, $field ); |
|
1078 | + echo new GravityView_Admin_View_Widget( $item[ 'label' ], $field[ 'id' ], $item, $field ); |
|
1079 | 1079 | break; |
1080 | 1080 | default: |
1081 | - echo new GravityView_Admin_View_Field( $field['label'], $field['id'], $item, $field, $form_id ); |
|
1081 | + echo new GravityView_Admin_View_Field( $field[ 'label' ], $field[ 'id' ], $item, $field, $form_id ); |
|
1082 | 1082 | } |
1083 | 1083 | } |
1084 | 1084 | |
1085 | 1085 | } // End if zone is not empty ?> |
1086 | 1086 | |
1087 | - <span class="drop-message"><?php echo sprintf( esc_html__('"+ %s" or drag existing %ss here.', 'gravityview'), esc_html( $button_label ), esc_html( $type ) ); ?></span> |
|
1087 | + <span class="drop-message"><?php echo sprintf( esc_html__( '"+ %s" or drag existing %ss here.', 'gravityview' ), esc_html( $button_label ), esc_html( $type ) ); ?></span> |
|
1088 | 1088 | </div> |
1089 | 1089 | <div class="gv-droppable-area-action"> |
1090 | - <button class="gv-add-field button-secondary" title="" data-objecttype="<?php echo esc_attr( $type ); ?>" data-areaid="<?php echo esc_attr( $zone .'_'. $area['areaid'] ); ?>" data-context="<?php echo esc_attr( $zone ); ?>" data-formid="<?php echo $view ? esc_attr( $view->form ? $view->form->ID : '' ) : ''; ?>"><?php echo '+ '.esc_html( $button_label ); ?></button> |
|
1091 | - <p class="gv-droppable-area-title"><strong><?php echo esc_html( $area['title'] ); ?></strong><?php if( !empty( $area['subtitle'] ) ) { ?><span class="gv-droppable-area-subtitle"> – <?php echo esc_html( $area['subtitle'] ); ?></span><?php } ?></p> |
|
1090 | + <button class="gv-add-field button-secondary" title="" data-objecttype="<?php echo esc_attr( $type ); ?>" data-areaid="<?php echo esc_attr( $zone . '_' . $area[ 'areaid' ] ); ?>" data-context="<?php echo esc_attr( $zone ); ?>" data-formid="<?php echo $view ? esc_attr( $view->form ? $view->form->ID : '' ) : ''; ?>"><?php echo '+ ' . esc_html( $button_label ); ?></button> |
|
1091 | + <p class="gv-droppable-area-title"><strong><?php echo esc_html( $area[ 'title' ] ); ?></strong><?php if ( ! empty( $area[ 'subtitle' ] ) ) { ?><span class="gv-droppable-area-subtitle"> – <?php echo esc_html( $area[ 'subtitle' ] ); ?></span><?php } ?></p> |
|
1092 | 1092 | </div> |
1093 | 1093 | </div> |
1094 | 1094 | |
@@ -1116,7 +1116,7 @@ discard block |
||
1116 | 1116 | // This is a new View, prefill the widgets |
1117 | 1117 | $widgets = array( |
1118 | 1118 | 'header_top' => array( |
1119 | - substr( md5( microtime( true ) ), 0, 13 ) => array ( |
|
1119 | + substr( md5( microtime( true ) ), 0, 13 ) => array( |
|
1120 | 1120 | 'id' => 'search_bar', |
1121 | 1121 | 'label' => __( 'Search Bar', 'gravityview' ), |
1122 | 1122 | 'search_layout' => 'horizontal', |
@@ -1191,12 +1191,12 @@ discard block |
||
1191 | 1191 | if ( $post ) { |
1192 | 1192 | $source_form_id = gravityview_get_form_id( $post->ID ); |
1193 | 1193 | if ( $source_form_id ) { |
1194 | - $form_ids[] = $source_form_id; |
|
1194 | + $form_ids[ ] = $source_form_id; |
|
1195 | 1195 | } |
1196 | 1196 | |
1197 | 1197 | $joined_forms = \GV\View::get_joined_forms( $post->ID ); |
1198 | 1198 | foreach ( $joined_forms as $joined_form ) { |
1199 | - $form_ids[] = $joined_form->ID; |
|
1199 | + $form_ids[ ] = $joined_form->ID; |
|
1200 | 1200 | } |
1201 | 1201 | } |
1202 | 1202 | foreach ( array_unique( $form_ids ) as $form_id ) { |
@@ -1230,7 +1230,7 @@ discard block |
||
1230 | 1230 | * @return string HTML of the active areas |
1231 | 1231 | */ |
1232 | 1232 | function render_directory_active_areas( $template_id = '', $context = 'single', $post_id = '', $echo = false ) { |
1233 | - if( empty( $template_id ) ) { |
|
1233 | + if ( empty( $template_id ) ) { |
|
1234 | 1234 | gravityview()->log->debug( '[render_directory_active_areas] {template_id} is empty', array( 'template_id' => $template_id ) ); |
1235 | 1235 | return ''; |
1236 | 1236 | } |
@@ -1244,12 +1244,12 @@ discard block |
||
1244 | 1244 | */ |
1245 | 1245 | $template_areas = apply_filters( 'gravityview_template_active_areas', array(), $template_id, $context ); |
1246 | 1246 | |
1247 | - if( empty( $template_areas ) ) { |
|
1247 | + if ( empty( $template_areas ) ) { |
|
1248 | 1248 | |
1249 | 1249 | gravityview()->log->debug( '[render_directory_active_areas] No areas defined. Maybe template {template_id} is disabled.', array( 'data' => $template_id ) ); |
1250 | 1250 | $output = '<div>'; |
1251 | - $output .= '<h2 class="description" style="font-size: 16px; margin:0">'. sprintf( esc_html__( 'This View is configured using the %s View type, which is disabled.', 'gravityview' ), '<em>'.$template_id.'</em>' ) .'</h2>'; |
|
1252 | - $output .= '<p class="description" style="font-size: 14px; margin:0 0 1em 0;padding:0">'.esc_html__('The data is not lost; re-activate the associated plugin and the configuration will re-appear.', 'gravityview').'</p>'; |
|
1251 | + $output .= '<h2 class="description" style="font-size: 16px; margin:0">' . sprintf( esc_html__( 'This View is configured using the %s View type, which is disabled.', 'gravityview' ), '<em>' . $template_id . '</em>' ) . '</h2>'; |
|
1252 | + $output .= '<p class="description" style="font-size: 14px; margin:0 0 1em 0;padding:0">' . esc_html__( 'The data is not lost; re-activate the associated plugin and the configuration will re-appear.', 'gravityview' ) . '</p>'; |
|
1253 | 1253 | $output .= '</div>'; |
1254 | 1254 | } else { |
1255 | 1255 | |
@@ -1264,7 +1264,7 @@ discard block |
||
1264 | 1264 | |
1265 | 1265 | } |
1266 | 1266 | |
1267 | - if( $echo ) { |
|
1267 | + if ( $echo ) { |
|
1268 | 1268 | echo $output; |
1269 | 1269 | } |
1270 | 1270 | |
@@ -1292,30 +1292,30 @@ discard block |
||
1292 | 1292 | } |
1293 | 1293 | |
1294 | 1294 | // Add the GV font (with the Astronaut) |
1295 | - wp_enqueue_style( 'gravityview_global', plugins_url('assets/css/admin-global.css', GRAVITYVIEW_FILE), array(), \GV\Plugin::$version ); |
|
1295 | + wp_enqueue_style( 'gravityview_global', plugins_url( 'assets/css/admin-global.css', GRAVITYVIEW_FILE ), array(), \GV\Plugin::$version ); |
|
1296 | 1296 | wp_register_style( 'gravityview_views_styles', plugins_url( 'assets/css/admin-views.css', GRAVITYVIEW_FILE ), array( 'dashicons', 'wp-jquery-ui-dialog' ), \GV\Plugin::$version ); |
1297 | 1297 | |
1298 | - wp_register_script( 'gravityview-jquery-cookie', plugins_url('assets/lib/jquery.cookie/jquery.cookie.min.js', GRAVITYVIEW_FILE), array( 'jquery' ), \GV\Plugin::$version, true ); |
|
1298 | + wp_register_script( 'gravityview-jquery-cookie', plugins_url( 'assets/lib/jquery.cookie/jquery.cookie.min.js', GRAVITYVIEW_FILE ), array( 'jquery' ), \GV\Plugin::$version, true ); |
|
1299 | 1299 | |
1300 | - if( GFForms::get_page() === 'form_list' ) { |
|
1300 | + if ( GFForms::get_page() === 'form_list' ) { |
|
1301 | 1301 | wp_enqueue_style( 'gravityview_views_styles' ); |
1302 | 1302 | return; |
1303 | 1303 | } |
1304 | 1304 | |
1305 | 1305 | // Don't process any scripts below here if it's not a GravityView page. |
1306 | - if( ! gravityview()->request->is_admin( $hook, 'single' ) && ! $is_widgets_page ) { |
|
1306 | + if ( ! gravityview()->request->is_admin( $hook, 'single' ) && ! $is_widgets_page ) { |
|
1307 | 1307 | return; |
1308 | 1308 | } |
1309 | 1309 | |
1310 | 1310 | wp_enqueue_script( 'jquery-ui-datepicker' ); |
1311 | - wp_enqueue_style( 'gravityview_views_datepicker', plugins_url('assets/css/admin-datepicker.css', GRAVITYVIEW_FILE), \GV\Plugin::$version ); |
|
1311 | + wp_enqueue_style( 'gravityview_views_datepicker', plugins_url( 'assets/css/admin-datepicker.css', GRAVITYVIEW_FILE ), \GV\Plugin::$version ); |
|
1312 | 1312 | |
1313 | 1313 | // Enqueue scripts |
1314 | 1314 | wp_enqueue_script( 'gravityview_views_scripts', plugins_url( 'assets/js/admin-views' . $script_debug . '.js', GRAVITYVIEW_FILE ), array( 'jquery-ui-tabs', 'jquery-ui-draggable', 'jquery-ui-droppable', 'jquery-ui-sortable', 'jquery-ui-tooltip', 'jquery-ui-dialog', 'gravityview-jquery-cookie', 'jquery-ui-datepicker', 'underscore' ), \GV\Plugin::$version ); |
1315 | 1315 | |
1316 | - wp_localize_script('gravityview_views_scripts', 'gvGlobals', array( |
|
1316 | + wp_localize_script( 'gravityview_views_scripts', 'gvGlobals', array( |
|
1317 | 1317 | 'cookiepath' => COOKIEPATH, |
1318 | - 'passed_form_id' => (bool) \GV\Utils::_GET( 'form_id' ), |
|
1318 | + 'passed_form_id' => (bool)\GV\Utils::_GET( 'form_id' ), |
|
1319 | 1319 | 'nonce' => wp_create_nonce( 'gravityview_ajaxviews' ), |
1320 | 1320 | 'label_viewname' => __( 'Enter View name here', 'gravityview' ), |
1321 | 1321 | 'label_reorder_search_fields' => __( 'Reorder Search Fields', 'gravityview' ), |
@@ -1330,7 +1330,7 @@ discard block |
||
1330 | 1330 | 'loading_error' => esc_html__( 'There was an error loading dynamic content.', 'gravityview' ), |
1331 | 1331 | 'field_loaderror' => __( 'Error while adding the field. Please try again or contact GravityView support.', 'gravityview' ), |
1332 | 1332 | 'remove_all_fields' => __( 'Would you like to remove all fields in this zone? (You are seeing this message because you were holding down the ALT key)', 'gravityview' ), |
1333 | - )); |
|
1333 | + ) ); |
|
1334 | 1334 | |
1335 | 1335 | wp_enqueue_style( 'gravityview_views_styles' ); |
1336 | 1336 | |
@@ -1338,7 +1338,7 @@ discard block |
||
1338 | 1338 | self::enqueue_gravity_forms_scripts(); |
1339 | 1339 | |
1340 | 1340 | // 2.5 changed how Merge Tags are enqueued |
1341 | - if ( is_callable( array( 'GFCommon', 'output_hooks_javascript') ) ) { |
|
1341 | + if ( is_callable( array( 'GFCommon', 'output_hooks_javascript' ) ) ) { |
|
1342 | 1342 | GFCommon::output_hooks_javascript(); |
1343 | 1343 | } |
1344 | 1344 | } |
@@ -1362,7 +1362,7 @@ discard block |
||
1362 | 1362 | ); |
1363 | 1363 | |
1364 | 1364 | if ( wp_is_mobile() ) { |
1365 | - $scripts[] = 'jquery-touch-punch'; |
|
1365 | + $scripts[ ] = 'jquery-touch-punch'; |
|
1366 | 1366 | } |
1367 | 1367 | |
1368 | 1368 | wp_enqueue_script( $scripts ); |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | $supports = array( 'title', 'revisions' ); |
126 | 126 | |
127 | 127 | if ( $is_hierarchical ) { |
128 | - $supports[] = 'page-attributes'; |
|
128 | + $supports[ ] = 'page-attributes'; |
|
129 | 129 | } |
130 | 130 | |
131 | 131 | /** |
@@ -229,12 +229,12 @@ discard block |
||
229 | 229 | $tsv_rule = array( sprintf( '%s/([^/]+)/tsv/?', $slug ), 'index.php?gravityview=$matches[1]&tsv=1', 'top' ); |
230 | 230 | |
231 | 231 | add_filter( 'query_vars', function( $query_vars ) { |
232 | - $query_vars[] = 'csv'; |
|
233 | - $query_vars[] = 'tsv'; |
|
232 | + $query_vars[ ] = 'csv'; |
|
233 | + $query_vars[ ] = 'tsv'; |
|
234 | 234 | return $query_vars; |
235 | 235 | } ); |
236 | 236 | |
237 | - if ( ! isset( $wp_rewrite->extra_rules_top[ $csv_rule[0] ] ) ) { |
|
237 | + if ( ! isset( $wp_rewrite->extra_rules_top[ $csv_rule[ 0 ] ] ) ) { |
|
238 | 238 | call_user_func_array( 'add_rewrite_rule', $csv_rule ); |
239 | 239 | call_user_func_array( 'add_rewrite_rule', $tsv_rule ); |
240 | 240 | } |
@@ -295,7 +295,7 @@ discard block |
||
295 | 295 | |
296 | 296 | $message = esc_html__( 'You can only see this message because you are able to edit this View.', 'gravityview' ); |
297 | 297 | |
298 | - $image = sprintf( '<img alt="%s" src="%s" style="margin-top: 10px;" />', esc_attr__( 'Data Source', 'gravityview' ), esc_url( plugins_url( 'assets/images/screenshots/data-source.png', GRAVITYVIEW_FILE ) ) ); |
|
298 | + $image = sprintf( '<img alt="%s" src="%s" style="margin-top: 10px;" />', esc_attr__( 'Data Source', 'gravityview' ), esc_url( plugins_url( 'assets/images/screenshots/data-source.png', GRAVITYVIEW_FILE ) ) ); |
|
299 | 299 | |
300 | 300 | return \GVCommon::generate_notice( '<h3>' . $title . '</h3>' . wpautop( $message . $image ), 'notice' ); |
301 | 301 | } |
@@ -321,13 +321,13 @@ discard block |
||
321 | 321 | return $content; |
322 | 322 | } |
323 | 323 | |
324 | - $is_admin_and_can_view = $view->settings->get( 'admin_show_all_statuses' ) && \GVCommon::has_cap('gravityview_moderate_entries', $view->ID ); |
|
324 | + $is_admin_and_can_view = $view->settings->get( 'admin_show_all_statuses' ) && \GVCommon::has_cap( 'gravityview_moderate_entries', $view->ID ); |
|
325 | 325 | |
326 | 326 | /** |
327 | 327 | * Editing a single entry. |
328 | 328 | */ |
329 | 329 | if ( $entry = $request->is_edit_entry( $view->form ? $view->form->ID : 0 ) ) { |
330 | - if ( $entry['status'] != 'active' ) { |
|
330 | + if ( $entry[ 'status' ] != 'active' ) { |
|
331 | 331 | gravityview()->log->notice( 'Entry ID #{entry_id} is not active', array( 'entry_id' => $entry->ID ) ); |
332 | 332 | return __( 'You are not allowed to view this content.', 'gravityview' ); |
333 | 333 | } |
@@ -338,7 +338,7 @@ discard block |
||
338 | 338 | } |
339 | 339 | |
340 | 340 | if ( $view->settings->get( 'show_only_approved' ) && ! $is_admin_and_can_view ) { |
341 | - if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $entry->ID, \GravityView_Entry_Approval::meta_key ) ) ) { |
|
341 | + if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $entry->ID, \GravityView_Entry_Approval::meta_key ) ) ) { |
|
342 | 342 | gravityview()->log->error( 'Entry ID #{entry_id} is not approved for viewing', array( 'entry_id' => $entry->ID ) ); |
343 | 343 | return __( 'You are not allowed to view this content.', 'gravityview' ); |
344 | 344 | } |
@@ -361,7 +361,7 @@ discard block |
||
361 | 361 | |
362 | 362 | foreach ( $entryset as $e ) { |
363 | 363 | |
364 | - if ( 'active' !== $e['status'] ) { |
|
364 | + if ( 'active' !== $e[ 'status' ] ) { |
|
365 | 365 | gravityview()->log->notice( 'Entry ID #{entry_id} is not active', array( 'entry_id' => $e->ID ) ); |
366 | 366 | return __( 'You are not allowed to view this content.', 'gravityview' ); |
367 | 367 | } |
@@ -372,7 +372,7 @@ discard block |
||
372 | 372 | } |
373 | 373 | |
374 | 374 | if ( $show_only_approved && ! $is_admin_and_can_view ) { |
375 | - if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $e->ID, \GravityView_Entry_Approval::meta_key ) ) ) { |
|
375 | + if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $e->ID, \GravityView_Entry_Approval::meta_key ) ) ) { |
|
376 | 376 | gravityview()->log->error( 'Entry ID #{entry_id} is not approved for viewing', array( 'entry_id' => $e->ID ) ); |
377 | 377 | return __( 'You are not allowed to view this content.', 'gravityview' ); |
378 | 378 | } |
@@ -547,7 +547,7 @@ discard block |
||
547 | 547 | $join_column = is_numeric( $join_column ) ? GF_Field::by_id( $join, $join_column ) : Internal_Field::by_id( $join_column ); |
548 | 548 | $join_on_column = is_numeric( $join_on_column ) ? GF_Field::by_id( $join_on, $join_on_column ) : Internal_Field::by_id( $join_on_column ); |
549 | 549 | |
550 | - $joins [] = new Join( $join, $join_column, $join_on, $join_on_column ); |
|
550 | + $joins [ ] = new Join( $join, $join_column, $join_on, $join_on_column ); |
|
551 | 551 | } |
552 | 552 | |
553 | 553 | return $joins; |
@@ -637,13 +637,13 @@ discard block |
||
637 | 637 | } |
638 | 638 | |
639 | 639 | foreach ( $_fields as $field ) { |
640 | - if ( ! empty( $field['unions'] ) ) { |
|
641 | - foreach ( $field['unions'] as $form_id => $field_id ) { |
|
640 | + if ( ! empty( $field[ 'unions' ] ) ) { |
|
641 | + foreach ( $field[ 'unions' ] as $form_id => $field_id ) { |
|
642 | 642 | if ( ! isset( $unions[ $form_id ] ) ) { |
643 | 643 | $unions[ $form_id ] = array(); |
644 | 644 | } |
645 | 645 | |
646 | - $unions[ $form_id ][ $field['id'] ] = |
|
646 | + $unions[ $form_id ][ $field[ 'id' ] ] = |
|
647 | 647 | is_numeric( $field_id ) ? \GV\GF_Field::by_id( \GV\GF_Form::by_id( $form_id ), $field_id ) : \GV\Internal_Field::by_id( $field_id ); |
648 | 648 | } |
649 | 649 | } |
@@ -698,7 +698,7 @@ discard block |
||
698 | 698 | if ( ! $view->form ) { |
699 | 699 | gravityview()->log->error( 'View #{view_id} tried attaching non-existent Form #{form_id} to it.', array( |
700 | 700 | 'view_id' => $view->ID, |
701 | - 'form_id' => $view->_gravityview_form_id ? : 0, |
|
701 | + 'form_id' => $view->_gravityview_form_id ?: 0, |
|
702 | 702 | ) ); |
703 | 703 | } |
704 | 704 | |
@@ -937,11 +937,11 @@ discard block |
||
937 | 937 | * Remove multiple sorting before calling legacy filters. |
938 | 938 | * This allows us to fake it till we make it. |
939 | 939 | */ |
940 | - if ( ! empty( $parameters['sort_field'] ) && is_array( $parameters['sort_field'] ) ) { |
|
940 | + if ( ! empty( $parameters[ 'sort_field' ] ) && is_array( $parameters[ 'sort_field' ] ) ) { |
|
941 | 941 | $has_multisort = true; |
942 | - $parameters['sort_field'] = reset( $parameters['sort_field'] ); |
|
943 | - if ( ! empty( $parameters['sort_direction'] ) && is_array( $parameters['sort_direction'] ) ) { |
|
944 | - $parameters['sort_direction'] = reset( $parameters['sort_direction'] ); |
|
942 | + $parameters[ 'sort_field' ] = reset( $parameters[ 'sort_field' ] ); |
|
943 | + if ( ! empty( $parameters[ 'sort_direction' ] ) && is_array( $parameters[ 'sort_direction' ] ) ) { |
|
944 | + $parameters[ 'sort_direction' ] = reset( $parameters[ 'sort_direction' ] ); |
|
945 | 945 | } |
946 | 946 | } |
947 | 947 | |
@@ -950,31 +950,30 @@ discard block |
||
950 | 950 | */ |
951 | 951 | $parameters = \GravityView_frontend::get_view_entries_parameters( $parameters, $this->form->ID ); |
952 | 952 | |
953 | - $parameters['context_view_id'] = $this->ID; |
|
953 | + $parameters[ 'context_view_id' ] = $this->ID; |
|
954 | 954 | $parameters = \GVCommon::calculate_get_entries_criteria( $parameters, $this->form->ID ); |
955 | 955 | |
956 | 956 | if ( ! is_array( $parameters ) ) { |
957 | 957 | $parameters = array(); |
958 | 958 | } |
959 | 959 | |
960 | - if ( ! is_array( $parameters['search_criteria'] ) ) { |
|
961 | - $parameters['search_criteria'] = array(); |
|
960 | + if ( ! is_array( $parameters[ 'search_criteria' ] ) ) { |
|
961 | + $parameters[ 'search_criteria' ] = array(); |
|
962 | 962 | } |
963 | 963 | |
964 | - if ( ( ! isset( $parameters['search_criteria']['field_filters'] ) ) || ( ! is_array( $parameters['search_criteria']['field_filters'] ) ) ) { |
|
965 | - $parameters['search_criteria']['field_filters'] = array(); |
|
964 | + if ( ( ! isset( $parameters[ 'search_criteria' ][ 'field_filters' ] ) ) || ( ! is_array( $parameters[ 'search_criteria' ][ 'field_filters' ] ) ) ) { |
|
965 | + $parameters[ 'search_criteria' ][ 'field_filters' ] = array(); |
|
966 | 966 | } |
967 | 967 | |
968 | 968 | if ( $request instanceof REST\Request ) { |
969 | 969 | $atts = $this->settings->as_atts(); |
970 | 970 | $paging_parameters = wp_parse_args( $request->get_paging(), array( |
971 | - 'paging' => array( 'page_size' => $atts['page_size'] ), |
|
971 | + 'paging' => array( 'page_size' => $atts[ 'page_size' ] ), |
|
972 | 972 | ) ); |
973 | - $parameters['paging'] = $paging_parameters['paging']; |
|
973 | + $parameters[ 'paging' ] = $paging_parameters[ 'paging' ]; |
|
974 | 974 | } |
975 | 975 | |
976 | - $page = Utils::get( $parameters['paging'], 'current_page' ) ? |
|
977 | - : ( ( ( $parameters['paging']['offset'] - $this->settings->get( 'offset' ) ) / \GV\Utils::get( $parameters, 'paging/page_size', 25 ) ) + 1 ); |
|
976 | + $page = Utils::get( $parameters[ 'paging' ], 'current_page' ) ?: ( ( ( $parameters[ 'paging' ][ 'offset' ] - $this->settings->get( 'offset' ) ) / \GV\Utils::get( $parameters, 'paging/page_size', 25 ) ) + 1 ); |
|
978 | 977 | |
979 | 978 | /** |
980 | 979 | * Cleanup duplicate field_filter parameters to simplify the query. |
@@ -982,14 +981,14 @@ discard block |
||
982 | 981 | $unique_field_filters = array(); |
983 | 982 | foreach ( Utils::get( $parameters, 'search_criteria/field_filters', array() ) as $key => $filter ) { |
984 | 983 | if ( 'mode' === $key ) { |
985 | - $unique_field_filters['mode'] = $filter; |
|
984 | + $unique_field_filters[ 'mode' ] = $filter; |
|
986 | 985 | } else if ( ! in_array( $filter, $unique_field_filters ) ) { |
987 | - $unique_field_filters[] = $filter; |
|
986 | + $unique_field_filters[ ] = $filter; |
|
988 | 987 | } |
989 | 988 | } |
990 | - $parameters['search_criteria']['field_filters'] = $unique_field_filters; |
|
989 | + $parameters[ 'search_criteria' ][ 'field_filters' ] = $unique_field_filters; |
|
991 | 990 | |
992 | - if ( ! empty( $parameters['search_criteria']['field_filters'] ) ) { |
|
991 | + if ( ! empty( $parameters[ 'search_criteria' ][ 'field_filters' ] ) ) { |
|
993 | 992 | gravityview()->log->notice( 'search_criteria/field_filters is not empty, third-party code may be using legacy search_criteria filters.' ); |
994 | 993 | } |
995 | 994 | |
@@ -998,7 +997,7 @@ discard block |
||
998 | 997 | $query_class = $this->get_query_class(); |
999 | 998 | |
1000 | 999 | /** @type \GF_Query $query */ |
1001 | - $query = new $query_class( $this->form->ID, $parameters['search_criteria'], Utils::get( $parameters, 'sorting' ) ); |
|
1000 | + $query = new $query_class( $this->form->ID, $parameters[ 'search_criteria' ], Utils::get( $parameters, 'sorting' ) ); |
|
1002 | 1001 | |
1003 | 1002 | /** |
1004 | 1003 | * Apply multisort. |
@@ -1009,15 +1008,15 @@ discard block |
||
1009 | 1008 | $view_setting_sort_field_ids = \GV\Utils::get( $atts, 'sort_field', array() ); |
1010 | 1009 | $view_setting_sort_directions = \GV\Utils::get( $atts, 'sort_direction', array() ); |
1011 | 1010 | |
1012 | - $has_sort_query_param = ! empty( $_GET['sort'] ) && is_array( $_GET['sort'] ); |
|
1011 | + $has_sort_query_param = ! empty( $_GET[ 'sort' ] ) && is_array( $_GET[ 'sort' ] ); |
|
1013 | 1012 | |
1014 | - if( $has_sort_query_param ) { |
|
1015 | - $has_sort_query_param = array_filter( array_values( $_GET['sort'] ) ); |
|
1013 | + if ( $has_sort_query_param ) { |
|
1014 | + $has_sort_query_param = array_filter( array_values( $_GET[ 'sort' ] ) ); |
|
1016 | 1015 | } |
1017 | 1016 | |
1018 | 1017 | if ( $this->settings->get( 'sort_columns' ) && $has_sort_query_param ) { |
1019 | - $sort_field_ids = array_keys( $_GET['sort'] ); |
|
1020 | - $sort_directions = array_values( $_GET['sort'] ); |
|
1018 | + $sort_field_ids = array_keys( $_GET[ 'sort' ] ); |
|
1019 | + $sort_directions = array_values( $_GET[ 'sort' ] ); |
|
1021 | 1020 | } else { |
1022 | 1021 | $sort_field_ids = $view_setting_sort_field_ids; |
1023 | 1022 | $sort_directions = $view_setting_sort_directions; |
@@ -1025,7 +1024,7 @@ discard block |
||
1025 | 1024 | |
1026 | 1025 | $skip_first = false; |
1027 | 1026 | |
1028 | - foreach ( (array) $sort_field_ids as $key => $sort_field_id ) { |
|
1027 | + foreach ( (array)$sort_field_ids as $key => $sort_field_id ) { |
|
1029 | 1028 | |
1030 | 1029 | if ( ! $skip_first && ! $has_sort_query_param ) { |
1031 | 1030 | $skip_first = true; // Skip the first one, it's already in the query |
@@ -1055,15 +1054,15 @@ discard block |
||
1055 | 1054 | |
1056 | 1055 | $merged_time = false; |
1057 | 1056 | |
1058 | - foreach ( $q['order'] as $oid => $order ) { |
|
1059 | - if ( $order[0] instanceof \GF_Query_Column ) { |
|
1060 | - $column = $order[0]; |
|
1061 | - } else if ( $order[0] instanceof \GF_Query_Call ) { |
|
1062 | - if ( count( $order[0]->columns ) != 1 || ! $order[0]->columns[0] instanceof \GF_Query_Column ) { |
|
1057 | + foreach ( $q[ 'order' ] as $oid => $order ) { |
|
1058 | + if ( $order[ 0 ] instanceof \GF_Query_Column ) { |
|
1059 | + $column = $order[ 0 ]; |
|
1060 | + } else if ( $order[ 0 ] instanceof \GF_Query_Call ) { |
|
1061 | + if ( count( $order[ 0 ]->columns ) != 1 || ! $order[ 0 ]->columns[ 0 ] instanceof \GF_Query_Column ) { |
|
1063 | 1062 | $orders[ $oid ] = $order; |
1064 | 1063 | continue; // Need something that resembles a single sort |
1065 | 1064 | } |
1066 | - $column = $order[0]->columns[0]; |
|
1065 | + $column = $order[ 0 ]->columns[ 0 ]; |
|
1067 | 1066 | } |
1068 | 1067 | |
1069 | 1068 | if ( ( ! $field = \GFAPI::get_field( $column->source, $column->field_id ) ) || $field->type !== 'time' ) { |
@@ -1077,7 +1076,7 @@ discard block |
||
1077 | 1076 | |
1078 | 1077 | $orders[ $oid ] = array( |
1079 | 1078 | new \GV\Mocks\GF_Query_Call_TIMESORT( 'timesort', array( $column, $sql ) ), |
1080 | - $order[1] // Mock it! |
|
1079 | + $order[ 1 ] // Mock it! |
|
1081 | 1080 | ); |
1082 | 1081 | |
1083 | 1082 | $merged_time = true; |
@@ -1088,15 +1087,15 @@ discard block |
||
1088 | 1087 | * ORDER again. |
1089 | 1088 | */ |
1090 | 1089 | if ( ! empty( $orders ) && $_orders = $query->_order_generate( $orders ) ) { |
1091 | - $sql['order'] = 'ORDER BY ' . implode( ', ', $_orders ); |
|
1090 | + $sql[ 'order' ] = 'ORDER BY ' . implode( ', ', $_orders ); |
|
1092 | 1091 | } |
1093 | 1092 | } |
1094 | 1093 | |
1095 | 1094 | return $sql; |
1096 | 1095 | } ); |
1097 | 1096 | |
1098 | - $query->limit( $parameters['paging']['page_size'] ) |
|
1099 | - ->offset( ( ( $page - 1 ) * $parameters['paging']['page_size'] ) + $this->settings->get( 'offset' ) ); |
|
1097 | + $query->limit( $parameters[ 'paging' ][ 'page_size' ] ) |
|
1098 | + ->offset( ( ( $page - 1 ) * $parameters[ 'paging' ][ 'page_size' ] ) + $this->settings->get( 'offset' ) ); |
|
1100 | 1099 | |
1101 | 1100 | /** |
1102 | 1101 | * Any joins? |
@@ -1119,7 +1118,7 @@ discard block |
||
1119 | 1118 | |
1120 | 1119 | $query_parameters = $query->_introspect(); |
1121 | 1120 | |
1122 | - $query->where( \GF_Query_Condition::_and( $query_parameters['where'], $condition ) ); |
|
1121 | + $query->where( \GF_Query_Condition::_and( $query_parameters[ 'where' ], $condition ) ); |
|
1123 | 1122 | } |
1124 | 1123 | |
1125 | 1124 | /** |
@@ -1153,7 +1152,7 @@ discard block |
||
1153 | 1152 | } |
1154 | 1153 | |
1155 | 1154 | $q = $query->_introspect(); |
1156 | - $query->where( \GF_Query_Condition::_and( $q['where'], $condition ) ); |
|
1155 | + $query->where( \GF_Query_Condition::_and( $q[ 'where' ], $condition ) ); |
|
1157 | 1156 | |
1158 | 1157 | if ( $this->settings->get( 'show_only_approved' ) && ! $is_admin_and_can_view ) { |
1159 | 1158 | |
@@ -1178,7 +1177,7 @@ discard block |
||
1178 | 1177 | |
1179 | 1178 | $query_parameters = $query->_introspect(); |
1180 | 1179 | |
1181 | - $query->where( \GF_Query_Condition::_and( $query_parameters['where'], $condition ) ); |
|
1180 | + $query->where( \GF_Query_Condition::_and( $query_parameters[ 'where' ], $condition ) ); |
|
1182 | 1181 | } |
1183 | 1182 | } |
1184 | 1183 | |
@@ -1202,7 +1201,7 @@ discard block |
||
1202 | 1201 | $conditions = array(); |
1203 | 1202 | |
1204 | 1203 | foreach ( $condition->expressions as $_condition ) { |
1205 | - $conditions[] = $recurse( $_condition, $fields, $recurse ); |
|
1204 | + $conditions[ ] = $recurse( $_condition, $fields, $recurse ); |
|
1206 | 1205 | } |
1207 | 1206 | |
1208 | 1207 | return call_user_func_array( |
@@ -1231,10 +1230,10 @@ discard block |
||
1231 | 1230 | $q = new $query_class( $form_id ); |
1232 | 1231 | |
1233 | 1232 | // Copy the WHERE clauses but substitute the field_ids to the respective ones |
1234 | - $q->where( $where_union_substitute( $query_parameters['where'], $fields, $where_union_substitute ) ); |
|
1233 | + $q->where( $where_union_substitute( $query_parameters[ 'where' ], $fields, $where_union_substitute ) ); |
|
1235 | 1234 | |
1236 | 1235 | // Copy the ORDER clause and substitute the field_ids to the respective ones |
1237 | - foreach ( $query_parameters['order'] as $order ) { |
|
1236 | + foreach ( $query_parameters[ 'order' ] as $order ) { |
|
1238 | 1237 | list( $column, $_order ) = $order; |
1239 | 1238 | |
1240 | 1239 | if ( $column && $column instanceof \GF_Query_Column ) { |
@@ -1248,15 +1247,15 @@ discard block |
||
1248 | 1247 | |
1249 | 1248 | add_filter( 'gform_gf_query_sql', $gf_query_sql_callback = function( $sql ) use ( &$unions_sql ) { |
1250 | 1249 | // Remove SQL_CALC_FOUND_ROWS as it's not needed in UNION clauses |
1251 | - $select = 'UNION ALL ' . str_replace( 'SQL_CALC_FOUND_ROWS ', '', $sql['select'] ); |
|
1250 | + $select = 'UNION ALL ' . str_replace( 'SQL_CALC_FOUND_ROWS ', '', $sql[ 'select' ] ); |
|
1252 | 1251 | |
1253 | 1252 | // Record the SQL |
1254 | - $unions_sql[] = array( |
|
1253 | + $unions_sql[ ] = array( |
|
1255 | 1254 | // Remove columns, we'll rebuild them |
1256 | 1255 | 'select' => preg_replace( '#DISTINCT (.*)#', 'DISTINCT ', $select ), |
1257 | - 'from' => $sql['from'], |
|
1258 | - 'join' => $sql['join'], |
|
1259 | - 'where' => $sql['where'], |
|
1256 | + 'from' => $sql[ 'from' ], |
|
1257 | + 'join' => $sql[ 'join' ], |
|
1258 | + 'where' => $sql[ 'where' ], |
|
1260 | 1259 | // Remove order and limit |
1261 | 1260 | ); |
1262 | 1261 | |
@@ -1273,11 +1272,11 @@ discard block |
||
1273 | 1272 | |
1274 | 1273 | add_filter( 'gform_gf_query_sql', $gf_query_sql_callback = function( $sql ) use ( $unions_sql ) { |
1275 | 1274 | // Remove SQL_CALC_FOUND_ROWS as it's not needed in UNION clauses |
1276 | - $sql['select'] = str_replace( 'SQL_CALC_FOUND_ROWS ', '', $sql['select'] ); |
|
1275 | + $sql[ 'select' ] = str_replace( 'SQL_CALC_FOUND_ROWS ', '', $sql[ 'select' ] ); |
|
1277 | 1276 | |
1278 | 1277 | // Remove columns, we'll rebuild them |
1279 | - preg_match( '#DISTINCT (`[motc]\d+`.`.*?`)#', $sql['select'], $select_match ); |
|
1280 | - $sql['select'] = preg_replace( '#DISTINCT (.*)#', 'DISTINCT ', $sql['select'] ); |
|
1278 | + preg_match( '#DISTINCT (`[motc]\d+`.`.*?`)#', $sql[ 'select' ], $select_match ); |
|
1279 | + $sql[ 'select' ] = preg_replace( '#DISTINCT (.*)#', 'DISTINCT ', $sql[ 'select' ] ); |
|
1281 | 1280 | |
1282 | 1281 | $unions = array(); |
1283 | 1282 | |
@@ -1288,30 +1287,30 @@ discard block |
||
1288 | 1287 | }; |
1289 | 1288 | |
1290 | 1289 | // Add all the order columns into the selects, so we can order by the whole union group |
1291 | - preg_match_all( '#(`[motc]\d+`.`.*?`)#', $sql['order'], $order_matches ); |
|
1290 | + preg_match_all( '#(`[motc]\d+`.`.*?`)#', $sql[ 'order' ], $order_matches ); |
|
1292 | 1291 | |
1293 | 1292 | $columns = array( |
1294 | - sprintf( '%s AS %s', $select_match[1], $column_to_alias( $select_match[1] ) ) |
|
1293 | + sprintf( '%s AS %s', $select_match[ 1 ], $column_to_alias( $select_match[ 1 ] ) ) |
|
1295 | 1294 | ); |
1296 | 1295 | |
1297 | 1296 | foreach ( array_slice( $order_matches, 1 ) as $match ) { |
1298 | - $columns[] = sprintf( '%s AS %s', $match[0], $column_to_alias( $match[0] ) ); |
|
1297 | + $columns[ ] = sprintf( '%s AS %s', $match[ 0 ], $column_to_alias( $match[ 0 ] ) ); |
|
1299 | 1298 | |
1300 | 1299 | // Rewrite the order columns to the shared aliases |
1301 | - $sql['order'] = str_replace( $match[0], $column_to_alias( $match[0] ), $sql['order'] ); |
|
1300 | + $sql[ 'order' ] = str_replace( $match[ 0 ], $column_to_alias( $match[ 0 ] ), $sql[ 'order' ] ); |
|
1302 | 1301 | } |
1303 | 1302 | |
1304 | 1303 | $columns = array_unique( $columns ); |
1305 | 1304 | |
1306 | 1305 | // Add the columns to every UNION |
1307 | 1306 | foreach ( $unions_sql as $union_sql ) { |
1308 | - $union_sql['select'] .= implode( ', ', $columns ); |
|
1309 | - $unions []= implode( ' ', $union_sql ); |
|
1307 | + $union_sql[ 'select' ] .= implode( ', ', $columns ); |
|
1308 | + $unions [ ] = implode( ' ', $union_sql ); |
|
1310 | 1309 | } |
1311 | 1310 | |
1312 | 1311 | // Add the columns to the main SELECT, but only grab the entry id column |
1313 | - $sql['select'] = 'SELECT SQL_CALC_FOUND_ROWS t1_id FROM (' . $sql['select'] . implode( ', ', $columns ); |
|
1314 | - $sql['order'] = implode( ' ', $unions ) . ') AS u ' . $sql['order']; |
|
1312 | + $sql[ 'select' ] = 'SELECT SQL_CALC_FOUND_ROWS t1_id FROM (' . $sql[ 'select' ] . implode( ', ', $columns ); |
|
1313 | + $sql[ 'order' ] = implode( ' ', $unions ) . ') AS u ' . $sql[ 'order' ]; |
|
1315 | 1314 | |
1316 | 1315 | return $sql; |
1317 | 1316 | } ); |
@@ -1356,20 +1355,20 @@ discard block |
||
1356 | 1355 | } ); |
1357 | 1356 | } else { |
1358 | 1357 | $entries = $this->form->entries |
1359 | - ->filter( \GV\GF_Entry_Filter::from_search_criteria( $parameters['search_criteria'] ) ) |
|
1358 | + ->filter( \GV\GF_Entry_Filter::from_search_criteria( $parameters[ 'search_criteria' ] ) ) |
|
1360 | 1359 | ->offset( $this->settings->get( 'offset' ) ) |
1361 | - ->limit( $parameters['paging']['page_size'] ) |
|
1360 | + ->limit( $parameters[ 'paging' ][ 'page_size' ] ) |
|
1362 | 1361 | ->page( $page ); |
1363 | 1362 | |
1364 | - if ( ! empty( $parameters['sorting'] ) && is_array( $parameters['sorting'] && ! isset( $parameters['sorting']['key'] ) ) ) { |
|
1363 | + if ( ! empty( $parameters[ 'sorting' ] ) && is_array( $parameters[ 'sorting' ] && ! isset( $parameters[ 'sorting' ][ 'key' ] ) ) ) { |
|
1365 | 1364 | // Pluck off multisort arrays |
1366 | - $parameters['sorting'] = $parameters['sorting'][0]; |
|
1365 | + $parameters[ 'sorting' ] = $parameters[ 'sorting' ][ 0 ]; |
|
1367 | 1366 | } |
1368 | 1367 | |
1369 | - if ( ! empty( $parameters['sorting'] ) && ! empty( $parameters['sorting']['key'] ) ) { |
|
1368 | + if ( ! empty( $parameters[ 'sorting' ] ) && ! empty( $parameters[ 'sorting' ][ 'key' ] ) ) { |
|
1370 | 1369 | $field = new \GV\Field(); |
1371 | - $field->ID = $parameters['sorting']['key']; |
|
1372 | - $direction = strtolower( $parameters['sorting']['direction'] ) == 'asc' ? \GV\Entry_Sort::ASC : \GV\Entry_Sort::DESC; |
|
1370 | + $field->ID = $parameters[ 'sorting' ][ 'key' ]; |
|
1371 | + $direction = strtolower( $parameters[ 'sorting' ][ 'direction' ] ) == 'asc' ? \GV\Entry_Sort::ASC : \GV\Entry_Sort::DESC; |
|
1373 | 1372 | $entries = $entries->sort( new \GV\Entry_Sort( $field, $direction ) ); |
1374 | 1373 | } |
1375 | 1374 | } |
@@ -1454,7 +1453,7 @@ discard block |
||
1454 | 1453 | $allowed = $headers = array(); |
1455 | 1454 | |
1456 | 1455 | foreach ( $view->fields->by_position( "directory_*" )->by_visible( $view )->all() as $id => $field ) { |
1457 | - $allowed[] = $field; |
|
1456 | + $allowed[ ] = $field; |
|
1458 | 1457 | } |
1459 | 1458 | |
1460 | 1459 | $renderer = new Field_Renderer(); |
@@ -1476,17 +1475,17 @@ discard block |
||
1476 | 1475 | } ); |
1477 | 1476 | |
1478 | 1477 | foreach ( array_diff( $allowed_field_ids, wp_list_pluck( $allowed, 'ID' ) ) as $field_id ) { |
1479 | - $allowed[] = is_numeric( $field_id ) ? \GV\GF_Field::by_id( $view->form, $field_id ) : \GV\Internal_Field::by_id( $field_id ); |
|
1478 | + $allowed[ ] = is_numeric( $field_id ) ? \GV\GF_Field::by_id( $view->form, $field_id ) : \GV\Internal_Field::by_id( $field_id ); |
|
1480 | 1479 | } |
1481 | 1480 | |
1482 | 1481 | foreach ( $allowed as $field ) { |
1483 | 1482 | $source = is_numeric( $field->ID ) ? $view->form : new \GV\Internal_Source(); |
1484 | 1483 | |
1485 | - $return[] = $renderer->render( $field, $view, $source, $entry, gravityview()->request, '\GV\Field_CSV_Template' ); |
|
1484 | + $return[ ] = $renderer->render( $field, $view, $source, $entry, gravityview()->request, '\GV\Field_CSV_Template' ); |
|
1486 | 1485 | |
1487 | 1486 | if ( ! $headers_done ) { |
1488 | 1487 | $label = $field->get_label( $view, $source, $entry ); |
1489 | - $headers[] = $label ? $label : $field->ID; |
|
1488 | + $headers[ ] = $label ? $label : $field->ID; |
|
1490 | 1489 | } |
1491 | 1490 | } |
1492 | 1491 |