@@ -8,7 +8,7 @@ discard block |
||
| 8 | 8 | ?> |
| 9 | 9 | <label for="<?php echo $this->get_field_id(); ?>" class="<?php echo $this->get_label_class(); ?>"><?php |
| 10 | 10 | |
| 11 | - echo '<span class="gv-label">'.$this->get_field_label().'</span>'; |
|
| 11 | + echo '<span class="gv-label">' . $this->get_field_label() . '</span>'; |
|
| 12 | 12 | |
| 13 | 13 | echo $this->get_tooltip() . $this->get_field_desc(); |
| 14 | 14 | |
@@ -20,13 +20,13 @@ discard block |
||
| 20 | 20 | } |
| 21 | 21 | |
| 22 | 22 | function render_input( $override_input = null ) { |
| 23 | - if( isset( $override_input ) ) { |
|
| 23 | + if ( isset( $override_input ) ) { |
|
| 24 | 24 | echo $override_input; |
| 25 | 25 | return; |
| 26 | 26 | } |
| 27 | 27 | ?> |
| 28 | 28 | <select name="<?php echo esc_attr( $this->name ); ?>" id="<?php echo $this->get_field_id(); ?>"> |
| 29 | - <?php foreach( $this->field['options'] as $value => $label ) : ?> |
|
| 29 | + <?php foreach ( $this->field[ 'options' ] as $value => $label ) : ?> |
|
| 30 | 30 | <option value="<?php echo esc_attr( $value ); ?>" <?php selected( $value, $this->value, true ); ?>><?php echo esc_html( $label ); ?></option> |
| 31 | 31 | <?php endforeach; ?> |
| 32 | 32 | </select> |
@@ -28,30 +28,30 @@ discard block |
||
| 28 | 28 | add_filter( 'gravityview_blacklist_field_types', array( $this, 'default_field_blacklist' ), 10, 2 ); |
| 29 | 29 | |
| 30 | 30 | // Tooltips |
| 31 | - add_filter( 'gform_tooltips', array( $this, 'tooltips') ); |
|
| 31 | + add_filter( 'gform_tooltips', array( $this, 'tooltips' ) ); |
|
| 32 | 32 | |
| 33 | 33 | // adding styles and scripts |
| 34 | - add_action( 'admin_enqueue_scripts', array( 'GravityView_Admin_Views', 'add_scripts_and_styles'), 999 ); |
|
| 35 | - add_filter( 'gform_noconflict_styles', array( $this, 'register_no_conflict') ); |
|
| 36 | - add_filter( 'gform_noconflict_scripts', array( $this, 'register_no_conflict') ); |
|
| 37 | - add_filter( 'gravityview_noconflict_styles', array( $this, 'register_no_conflict') ); |
|
| 38 | - add_filter( 'gravityview_noconflict_scripts', array( $this, 'register_no_conflict') ); |
|
| 39 | - |
|
| 40 | - add_action( 'gravityview_render_directory_active_areas', array( $this, 'render_directory_active_areas'), 10, 4 ); |
|
| 41 | - add_action( 'gravityview_render_widgets_active_areas', array( $this, 'render_widgets_active_areas'), 10, 3 ); |
|
| 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 ); |
|
| 34 | + add_action( 'admin_enqueue_scripts', array( 'GravityView_Admin_Views', 'add_scripts_and_styles' ), 999 ); |
|
| 35 | + add_filter( 'gform_noconflict_styles', array( $this, 'register_no_conflict' ) ); |
|
| 36 | + add_filter( 'gform_noconflict_scripts', array( $this, 'register_no_conflict' ) ); |
|
| 37 | + add_filter( 'gravityview_noconflict_styles', array( $this, 'register_no_conflict' ) ); |
|
| 38 | + add_filter( 'gravityview_noconflict_scripts', array( $this, 'register_no_conflict' ) ); |
|
| 39 | + |
|
| 40 | + add_action( 'gravityview_render_directory_active_areas', array( $this, 'render_directory_active_areas' ), 10, 4 ); |
|
| 41 | + add_action( 'gravityview_render_widgets_active_areas', array( $this, 'render_widgets_active_areas' ), 10, 3 ); |
|
| 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 | |
| 54 | - add_action( 'manage_gravityview_posts_custom_column', array( $this, 'add_custom_column_content'), 10, 2 ); |
|
| 54 | + add_action( 'manage_gravityview_posts_custom_column', array( $this, 'add_custom_column_content' ), 10, 2 ); |
|
| 55 | 55 | |
| 56 | 56 | add_action( 'restrict_manage_posts', array( $this, 'add_view_dropdown' ) ); |
| 57 | 57 | |
@@ -66,11 +66,11 @@ discard block |
||
| 66 | 66 | public function filter_pre_get_posts_by_gravityview_form_id( &$query ) { |
| 67 | 67 | global $pagenow; |
| 68 | 68 | |
| 69 | - if ( !is_admin() ) { |
|
| 69 | + if ( ! is_admin() ) { |
|
| 70 | 70 | return; |
| 71 | 71 | } |
| 72 | 72 | |
| 73 | - if( 'edit.php' !== $pagenow || ! rgget( 'gravityview_form_id' ) || ! isset( $query->query_vars[ 'post_type' ] ) ) { |
|
| 73 | + if ( 'edit.php' !== $pagenow || ! rgget( 'gravityview_form_id' ) || ! isset( $query->query_vars[ 'post_type' ] ) ) { |
|
| 74 | 74 | return; |
| 75 | 75 | } |
| 76 | 76 | |
@@ -87,18 +87,18 @@ discard block |
||
| 87 | 87 | function add_view_dropdown() { |
| 88 | 88 | $current_screen = get_current_screen(); |
| 89 | 89 | |
| 90 | - if( 'gravityview' !== $current_screen->post_type ) { |
|
| 90 | + if ( 'gravityview' !== $current_screen->post_type ) { |
|
| 91 | 91 | return; |
| 92 | 92 | } |
| 93 | 93 | |
| 94 | 94 | $forms = gravityview_get_forms(); |
| 95 | 95 | $current_form = rgget( 'gravityview_form_id' ); |
| 96 | 96 | // If there are no forms to select, show no forms. |
| 97 | - if( !empty( $forms ) ) { ?> |
|
| 97 | + if ( ! empty( $forms ) ) { ?> |
|
| 98 | 98 | <select name="gravityview_form_id" id="gravityview_form_id"> |
| 99 | 99 | <option value="" <?php selected( '', $current_form, true ); ?>><?php esc_html_e( 'All forms', 'gravityview' ); ?></option> |
| 100 | - <?php foreach( $forms as $form ) { ?> |
|
| 101 | - <option value="<?php echo $form['id']; ?>" <?php selected( $form['id'], $current_form, true ); ?>><?php echo esc_html( $form['title'] ); ?></option> |
|
| 100 | + <?php foreach ( $forms as $form ) { ?> |
|
| 101 | + <option value="<?php echo $form[ 'id' ]; ?>" <?php selected( $form[ 'id' ], $current_form, true ); ?>><?php echo esc_html( $form[ 'title' ] ); ?></option> |
|
| 102 | 102 | <?php } ?> |
| 103 | 103 | </select> |
| 104 | 104 | <?php } |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | */ |
| 112 | 112 | public static function render_setting_row( $key = '', $current_settings = array(), $override_input = null, $name = 'template_settings[%s]', $id = 'gravityview_se_%s' ) { |
| 113 | 113 | _deprecated_function( 'GravityView_Admin_Views::render_setting_row', '1.1.7', 'GravityView_Render_Settings::render_setting_row' ); |
| 114 | - GravityView_Render_Settings::render_setting_row( $key, $current_settings, $override_input, $name , $id ); |
|
| 114 | + GravityView_Render_Settings::render_setting_row( $key, $current_settings, $override_input, $name, $id ); |
|
| 115 | 115 | } |
| 116 | 116 | |
| 117 | 117 | /** |
@@ -134,37 +134,37 @@ discard block |
||
| 134 | 134 | |
| 135 | 135 | $connected_views = gravityview_get_connected_views( $id ); |
| 136 | 136 | |
| 137 | - if( empty( $connected_views ) ) { |
|
| 137 | + if ( empty( $connected_views ) ) { |
|
| 138 | 138 | return $menu_items; |
| 139 | 139 | } |
| 140 | 140 | |
| 141 | 141 | $sub_menu_items = array(); |
| 142 | 142 | foreach ( (array)$connected_views as $view ) { |
| 143 | 143 | |
| 144 | - if( ! GVCommon::has_cap( 'edit_gravityview', $view->ID ) ) { |
|
| 144 | + if ( ! GVCommon::has_cap( 'edit_gravityview', $view->ID ) ) { |
|
| 145 | 145 | continue; |
| 146 | 146 | } |
| 147 | 147 | |
| 148 | - $label = empty( $view->post_title ) ? sprintf( __('No Title (View #%d)', 'gravityview' ), $view->ID ) : $view->post_title; |
|
| 148 | + $label = empty( $view->post_title ) ? sprintf( __( 'No Title (View #%d)', 'gravityview' ), $view->ID ) : $view->post_title; |
|
| 149 | 149 | |
| 150 | - $sub_menu_items[] = array( |
|
| 150 | + $sub_menu_items[ ] = array( |
|
| 151 | 151 | 'label' => esc_attr( $label ), |
| 152 | - 'url' => admin_url( 'post.php?action=edit&post='.$view->ID ), |
|
| 152 | + 'url' => admin_url( 'post.php?action=edit&post=' . $view->ID ), |
|
| 153 | 153 | ); |
| 154 | 154 | } |
| 155 | 155 | |
| 156 | 156 | // If there were no items added, then let's create the parent menu |
| 157 | - if( $sub_menu_items ) { |
|
| 157 | + if ( $sub_menu_items ) { |
|
| 158 | 158 | |
| 159 | 159 | // Make sure Gravity Forms uses the submenu; if there's only one item, it uses a link instead of a dropdown |
| 160 | - $sub_menu_items[] = array( |
|
| 160 | + $sub_menu_items[ ] = array( |
|
| 161 | 161 | 'url' => '#', |
| 162 | 162 | 'label' => '', |
| 163 | 163 | 'menu_class' => 'hidden', |
| 164 | 164 | 'capabilities' => '', |
| 165 | 165 | ); |
| 166 | 166 | |
| 167 | - $menu_items['gravityview'] = array( |
|
| 167 | + $menu_items[ 'gravityview' ] = array( |
|
| 168 | 168 | 'label' => __( 'Connected Views', 'gravityview' ), |
| 169 | 169 | 'icon' => '<i class="fa fa-lg gv-icon-astronaut-head gv-icon"></i>', |
| 170 | 170 | 'title' => __( 'GravityView Views using this form as a data source', 'gravityview' ), |
@@ -194,8 +194,8 @@ discard block |
||
| 194 | 194 | $add = array( 'captcha', 'page' ); |
| 195 | 195 | |
| 196 | 196 | // Don't allowing editing the following values: |
| 197 | - if( $context === 'edit' ) { |
|
| 198 | - $add[] = 'post_id'; |
|
| 197 | + if ( $context === 'edit' ) { |
|
| 198 | + $add[ ] = 'post_id'; |
|
| 199 | 199 | } |
| 200 | 200 | |
| 201 | 201 | $return = array_merge( $array, $add ); |
@@ -218,32 +218,32 @@ discard block |
||
| 218 | 218 | foreach ( $default_args as $key => $arg ) { |
| 219 | 219 | |
| 220 | 220 | // If an arg has `tooltip` defined, but it's false, don't display a tooltip |
| 221 | - if( isset( $arg['tooltip'] ) && empty( $arg['tooltip'] ) ) { continue; } |
|
| 221 | + if ( isset( $arg[ 'tooltip' ] ) && empty( $arg[ 'tooltip' ] ) ) { continue; } |
|
| 222 | 222 | |
| 223 | 223 | // By default, use `tooltip` if defined. |
| 224 | - $tooltip = empty( $arg['tooltip'] ) ? NULL : $arg['tooltip']; |
|
| 224 | + $tooltip = empty( $arg[ 'tooltip' ] ) ? NULL : $arg[ 'tooltip' ]; |
|
| 225 | 225 | |
| 226 | 226 | // Otherwise, use the description as a tooltip. |
| 227 | - if( empty( $tooltip ) && !empty( $arg['desc'] ) ) { |
|
| 228 | - $tooltip = $arg['desc']; |
|
| 227 | + if ( empty( $tooltip ) && ! empty( $arg[ 'desc' ] ) ) { |
|
| 228 | + $tooltip = $arg[ 'desc' ]; |
|
| 229 | 229 | } |
| 230 | 230 | |
| 231 | 231 | // If there's no tooltip set, continue |
| 232 | - if( empty( $tooltip ) ) { |
|
| 232 | + if ( empty( $tooltip ) ) { |
|
| 233 | 233 | continue; |
| 234 | 234 | } |
| 235 | 235 | |
| 236 | 236 | // Add the tooltip |
| 237 | - $gv_tooltips[ 'gv_'.$key ] = array( |
|
| 238 | - 'title' => $arg['label'], |
|
| 237 | + $gv_tooltips[ 'gv_' . $key ] = array( |
|
| 238 | + 'title' => $arg[ 'label' ], |
|
| 239 | 239 | 'value' => $tooltip, |
| 240 | 240 | ); |
| 241 | 241 | |
| 242 | 242 | } |
| 243 | 243 | |
| 244 | - $gv_tooltips['gv_css_merge_tags'] = array( |
|
| 245 | - 'title' => __('CSS Merge Tags', 'gravityview'), |
|
| 246 | - 'value' => sprintf( __( 'Developers: The CSS classes will be sanitized using the %ssanitize_title_with_dashes()%s function.', 'gravityview'), '<code>', '</code>' ) |
|
| 244 | + $gv_tooltips[ 'gv_css_merge_tags' ] = array( |
|
| 245 | + 'title' => __( 'CSS Merge Tags', 'gravityview' ), |
|
| 246 | + 'value' => sprintf( __( 'Developers: The CSS classes will be sanitized using the %ssanitize_title_with_dashes()%s function.', 'gravityview' ), '<code>', '</code>' ) |
|
| 247 | 247 | ); |
| 248 | 248 | |
| 249 | 249 | /** |
@@ -254,9 +254,9 @@ discard block |
||
| 254 | 254 | |
| 255 | 255 | foreach ( $gv_tooltips as $key => $tooltip ) { |
| 256 | 256 | |
| 257 | - $title = empty( $tooltip['title'] ) ? '' : '<h6>'.esc_html( $tooltip['title'] ) .'</h6>'; |
|
| 257 | + $title = empty( $tooltip[ 'title' ] ) ? '' : '<h6>' . esc_html( $tooltip[ 'title' ] ) . '</h6>'; |
|
| 258 | 258 | |
| 259 | - $tooltips[ $key ] = $title . wpautop( esc_html( $tooltip['value'] ) ); |
|
| 259 | + $tooltips[ $key ] = $title . wpautop( esc_html( $tooltip[ 'value' ] ) ); |
|
| 260 | 260 | } |
| 261 | 261 | |
| 262 | 262 | return $tooltips; |
@@ -270,7 +270,7 @@ discard block |
||
| 270 | 270 | * |
| 271 | 271 | * @return void |
| 272 | 272 | */ |
| 273 | - public function add_custom_column_content( $column_name = NULL, $post_id ) { |
|
| 273 | + public function add_custom_column_content( $column_name = NULL, $post_id ) { |
|
| 274 | 274 | |
| 275 | 275 | $output = ''; |
| 276 | 276 | |
@@ -292,7 +292,7 @@ discard block |
||
| 292 | 292 | // Generate backup if label doesn't exist: `example_name` => `Example Name` |
| 293 | 293 | $template_id_pretty = ucwords( implode( ' ', explode( '_', $template_id ) ) ); |
| 294 | 294 | |
| 295 | - $output = $template ? $template['label'] : $template_id_pretty; |
|
| 295 | + $output = $template ? $template[ 'label' ] : $template_id_pretty; |
|
| 296 | 296 | |
| 297 | 297 | break; |
| 298 | 298 | |
@@ -333,44 +333,44 @@ discard block |
||
| 333 | 333 | static public function get_connected_form_links( $form, $include_form_link = true ) { |
| 334 | 334 | |
| 335 | 335 | // Either the form is empty or the form ID is 0, not yet set. |
| 336 | - if( empty( $form ) ) { |
|
| 336 | + if ( empty( $form ) ) { |
|
| 337 | 337 | return ''; |
| 338 | 338 | } |
| 339 | 339 | |
| 340 | 340 | // The $form is passed as the form ID |
| 341 | - if( !is_array( $form ) ) { |
|
| 341 | + if ( ! is_array( $form ) ) { |
|
| 342 | 342 | $form = gravityview_get_form( $form ); |
| 343 | 343 | } |
| 344 | 344 | |
| 345 | - $form_id = $form['id']; |
|
| 345 | + $form_id = $form[ 'id' ]; |
|
| 346 | 346 | $links = array(); |
| 347 | 347 | |
| 348 | - if( GVCommon::has_cap( 'gravityforms_edit_forms' ) ) { |
|
| 348 | + if ( GVCommon::has_cap( 'gravityforms_edit_forms' ) ) { |
|
| 349 | 349 | $form_url = admin_url( sprintf( 'admin.php?page=gf_edit_forms&id=%d', $form_id ) ); |
| 350 | - $form_link = '<strong class="gv-form-title">'.gravityview_get_link( $form_url, $form['title'], 'class=row-title' ).'</strong>'; |
|
| 351 | - $links[] = '<span>'.gravityview_get_link( $form_url, __('Edit Form', 'gravityview') ).'</span>'; |
|
| 350 | + $form_link = '<strong class="gv-form-title">' . gravityview_get_link( $form_url, $form[ 'title' ], 'class=row-title' ) . '</strong>'; |
|
| 351 | + $links[ ] = '<span>' . gravityview_get_link( $form_url, __( 'Edit Form', 'gravityview' ) ) . '</span>'; |
|
| 352 | 352 | } else { |
| 353 | - $form_link = '<strong class="gv-form-title">'. esc_html( $form['title'] ). '</strong>'; |
|
| 353 | + $form_link = '<strong class="gv-form-title">' . esc_html( $form[ 'title' ] ) . '</strong>'; |
|
| 354 | 354 | } |
| 355 | 355 | |
| 356 | - if( GVCommon::has_cap( 'gravityforms_view_entries' ) ) { |
|
| 356 | + if ( GVCommon::has_cap( 'gravityforms_view_entries' ) ) { |
|
| 357 | 357 | $entries_url = admin_url( sprintf( 'admin.php?page=gf_entries&id=%d', $form_id ) ); |
| 358 | - $links[] = '<span>'.gravityview_get_link( $entries_url, __('Entries', 'gravityview') ).'</span>'; |
|
| 358 | + $links[ ] = '<span>' . gravityview_get_link( $entries_url, __( 'Entries', 'gravityview' ) ) . '</span>'; |
|
| 359 | 359 | } |
| 360 | 360 | |
| 361 | - if( GVCommon::has_cap( array( 'gravityforms_edit_settings', 'gravityview_view_settings' ) ) ) { |
|
| 361 | + if ( GVCommon::has_cap( array( 'gravityforms_edit_settings', 'gravityview_view_settings' ) ) ) { |
|
| 362 | 362 | $settings_url = admin_url( sprintf( 'admin.php?page=gf_edit_forms&view=settings&id=%d', $form_id ) ); |
| 363 | - $links[] = '<span>'.gravityview_get_link( $settings_url, __('Settings', 'gravityview'), 'title='.__('Edit settings for this form', 'gravityview') ).'</span>'; |
|
| 363 | + $links[ ] = '<span>' . gravityview_get_link( $settings_url, __( 'Settings', 'gravityview' ), 'title=' . __( 'Edit settings for this form', 'gravityview' ) ) . '</span>'; |
|
| 364 | 364 | } |
| 365 | 365 | |
| 366 | - if( GVCommon::has_cap( array("gravityforms_edit_forms", "gravityforms_create_form", "gravityforms_preview_forms") ) ) { |
|
| 366 | + if ( GVCommon::has_cap( array( "gravityforms_edit_forms", "gravityforms_create_form", "gravityforms_preview_forms" ) ) ) { |
|
| 367 | 367 | $preview_url = site_url( sprintf( '?gf_page=preview&id=%d', $form_id ) ); |
| 368 | - $links[] = '<span>'.gravityview_get_link( $preview_url, __('Preview Form', 'gravityview'), 'title='.__('Preview this form', 'gravityview') ).'</span>'; |
|
| 368 | + $links[ ] = '<span>' . gravityview_get_link( $preview_url, __( 'Preview Form', 'gravityview' ), 'title=' . __( 'Preview this form', 'gravityview' ) ) . '</span>'; |
|
| 369 | 369 | } |
| 370 | 370 | |
| 371 | 371 | $output = ''; |
| 372 | 372 | |
| 373 | - if( !empty( $include_form_link ) ) { |
|
| 373 | + if ( ! empty( $include_form_link ) ) { |
|
| 374 | 374 | $output .= $form_link; |
| 375 | 375 | } |
| 376 | 376 | |
@@ -382,7 +382,7 @@ discard block |
||
| 382 | 382 | */ |
| 383 | 383 | $links = apply_filters( 'gravityview_connected_form_links', $links, $form ); |
| 384 | 384 | |
| 385 | - $output .= '<div class="row-actions">'. implode( ' | ', $links ) .'</div>'; |
|
| 385 | + $output .= '<div class="row-actions">' . implode( ' | ', $links ) . '</div>'; |
|
| 386 | 386 | |
| 387 | 387 | return $output; |
| 388 | 388 | } |
@@ -396,8 +396,8 @@ discard block |
||
| 396 | 396 | // Get the date column and save it for later to add back in. |
| 397 | 397 | // This adds it after the Data Source column. |
| 398 | 398 | // This way, we don't need to do array_slice, array_merge, etc. |
| 399 | - $date = $columns['date']; |
|
| 400 | - unset( $columns['date'] ); |
|
| 399 | + $date = $columns[ 'date' ]; |
|
| 400 | + unset( $columns[ 'date' ] ); |
|
| 401 | 401 | |
| 402 | 402 | $data_source_required_caps = array( |
| 403 | 403 | 'gravityforms_edit_forms', |
@@ -408,14 +408,14 @@ discard block |
||
| 408 | 408 | 'gravityforms_preview_forms', |
| 409 | 409 | ); |
| 410 | 410 | |
| 411 | - if( GVCommon::has_cap( $data_source_required_caps ) ) { |
|
| 412 | - $columns['gv_connected_form'] = __( 'Data Source', 'gravityview' ); |
|
| 411 | + if ( GVCommon::has_cap( $data_source_required_caps ) ) { |
|
| 412 | + $columns[ 'gv_connected_form' ] = __( 'Data Source', 'gravityview' ); |
|
| 413 | 413 | } |
| 414 | 414 | |
| 415 | - $columns['gv_template'] = _x( 'Template', 'Column title that shows what template is being used for Views', 'gravityview' ); |
|
| 415 | + $columns[ 'gv_template' ] = _x( 'Template', 'Column title that shows what template is being used for Views', 'gravityview' ); |
|
| 416 | 416 | |
| 417 | 417 | // Add the date back in. |
| 418 | - $columns['date'] = $date; |
|
| 418 | + $columns[ 'date' ] = $date; |
|
| 419 | 419 | |
| 420 | 420 | return $columns; |
| 421 | 421 | } |
@@ -429,12 +429,12 @@ discard block |
||
| 429 | 429 | */ |
| 430 | 430 | function save_postdata( $post_id ) { |
| 431 | 431 | |
| 432 | - if( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ){ |
|
| 432 | + if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) { |
|
| 433 | 433 | return; |
| 434 | 434 | } |
| 435 | 435 | |
| 436 | 436 | // validate post_type |
| 437 | - if ( ! isset( $_POST['post_type'] ) || 'gravityview' != $_POST['post_type'] ) { |
|
| 437 | + if ( ! isset( $_POST[ 'post_type' ] ) || 'gravityview' != $_POST[ 'post_type' ] ) { |
|
| 438 | 438 | return; |
| 439 | 439 | } |
| 440 | 440 | |
@@ -449,63 +449,63 @@ discard block |
||
| 449 | 449 | $statii = array(); |
| 450 | 450 | |
| 451 | 451 | // check if this is a start fresh View |
| 452 | - if ( isset( $_POST['gravityview_select_form_nonce'] ) && wp_verify_nonce( $_POST['gravityview_select_form_nonce'], 'gravityview_select_form' ) ) { |
|
| 452 | + if ( isset( $_POST[ 'gravityview_select_form_nonce' ] ) && wp_verify_nonce( $_POST[ 'gravityview_select_form_nonce' ], 'gravityview_select_form' ) ) { |
|
| 453 | 453 | |
| 454 | - $form_id = !empty( $_POST['gravityview_form_id'] ) ? $_POST['gravityview_form_id'] : ''; |
|
| 454 | + $form_id = ! empty( $_POST[ 'gravityview_form_id' ] ) ? $_POST[ 'gravityview_form_id' ] : ''; |
|
| 455 | 455 | // save form id |
| 456 | - $statii['form_id'] = update_post_meta( $post_id, '_gravityview_form_id', $form_id ); |
|
| 456 | + $statii[ 'form_id' ] = update_post_meta( $post_id, '_gravityview_form_id', $form_id ); |
|
| 457 | 457 | |
| 458 | 458 | } |
| 459 | 459 | |
| 460 | - if( false === GVCommon::has_cap( 'gravityforms_create_form' ) && empty( $statii['form_id'] ) ) { |
|
| 460 | + if ( false === GVCommon::has_cap( 'gravityforms_create_form' ) && empty( $statii[ 'form_id' ] ) ) { |
|
| 461 | 461 | do_action( 'gravityview_log_error', __METHOD__ . ' - Current user does not have the capability to create a new Form.', wp_get_current_user() ); |
| 462 | 462 | return; |
| 463 | 463 | } |
| 464 | 464 | |
| 465 | 465 | // Was this a start fresh? |
| 466 | - if ( ! empty( $_POST['gravityview_form_id_start_fresh'] ) ) { |
|
| 467 | - $statii['start_fresh'] = add_post_meta( $post_id, '_gravityview_start_fresh', 1 ); |
|
| 466 | + if ( ! empty( $_POST[ 'gravityview_form_id_start_fresh' ] ) ) { |
|
| 467 | + $statii[ 'start_fresh' ] = add_post_meta( $post_id, '_gravityview_start_fresh', 1 ); |
|
| 468 | 468 | } else { |
| 469 | - $statii['start_fresh'] = delete_post_meta( $post_id, '_gravityview_start_fresh' ); |
|
| 469 | + $statii[ 'start_fresh' ] = delete_post_meta( $post_id, '_gravityview_start_fresh' ); |
|
| 470 | 470 | } |
| 471 | 471 | |
| 472 | 472 | // Check if we have a template id |
| 473 | - if ( isset( $_POST['gravityview_select_template_nonce'] ) && wp_verify_nonce( $_POST['gravityview_select_template_nonce'], 'gravityview_select_template' ) ) { |
|
| 473 | + if ( isset( $_POST[ 'gravityview_select_template_nonce' ] ) && wp_verify_nonce( $_POST[ 'gravityview_select_template_nonce' ], 'gravityview_select_template' ) ) { |
|
| 474 | 474 | |
| 475 | - $template_id = !empty( $_POST['gravityview_directory_template'] ) ? $_POST['gravityview_directory_template'] : ''; |
|
| 475 | + $template_id = ! empty( $_POST[ 'gravityview_directory_template' ] ) ? $_POST[ 'gravityview_directory_template' ] : ''; |
|
| 476 | 476 | |
| 477 | 477 | // now save template id |
| 478 | - $statii['directory_template'] = update_post_meta( $post_id, '_gravityview_directory_template', $template_id ); |
|
| 478 | + $statii[ 'directory_template' ] = update_post_meta( $post_id, '_gravityview_directory_template', $template_id ); |
|
| 479 | 479 | } |
| 480 | 480 | |
| 481 | 481 | |
| 482 | 482 | // save View Configuration metabox |
| 483 | - if ( isset( $_POST['gravityview_view_configuration_nonce'] ) && wp_verify_nonce( $_POST['gravityview_view_configuration_nonce'], 'gravityview_view_configuration' ) ) { |
|
| 483 | + if ( isset( $_POST[ 'gravityview_view_configuration_nonce' ] ) && wp_verify_nonce( $_POST[ 'gravityview_view_configuration_nonce' ], 'gravityview_view_configuration' ) ) { |
|
| 484 | 484 | |
| 485 | 485 | // template settings |
| 486 | - if( empty( $_POST['template_settings'] ) ) { |
|
| 487 | - $_POST['template_settings'] = array(); |
|
| 486 | + if ( empty( $_POST[ 'template_settings' ] ) ) { |
|
| 487 | + $_POST[ 'template_settings' ] = array(); |
|
| 488 | 488 | } |
| 489 | - $statii['template_settings'] = update_post_meta( $post_id, '_gravityview_template_settings', $_POST['template_settings'] ); |
|
| 489 | + $statii[ 'template_settings' ] = update_post_meta( $post_id, '_gravityview_template_settings', $_POST[ 'template_settings' ] ); |
|
| 490 | 490 | |
| 491 | 491 | $fields = array(); |
| 492 | 492 | |
| 493 | 493 | // Directory&single Visible Fields |
| 494 | - if( !empty( $preset_fields ) ) { |
|
| 494 | + if ( ! empty( $preset_fields ) ) { |
|
| 495 | 495 | |
| 496 | 496 | $fields = $preset_fields; |
| 497 | 497 | |
| 498 | - } elseif( !empty( $_POST['gv_fields'] ) ) { |
|
| 498 | + } elseif ( ! empty( $_POST[ 'gv_fields' ] ) ) { |
|
| 499 | 499 | $fields = _gravityview_process_posted_fields(); |
| 500 | 500 | } |
| 501 | 501 | |
| 502 | - $statii['directory_fields'] = update_post_meta( $post_id, '_gravityview_directory_fields', $fields ); |
|
| 502 | + $statii[ 'directory_fields' ] = update_post_meta( $post_id, '_gravityview_directory_fields', $fields ); |
|
| 503 | 503 | |
| 504 | 504 | // Directory Visible Widgets |
| 505 | - if( empty( $_POST['widgets'] ) ) { |
|
| 506 | - $_POST['widgets'] = array(); |
|
| 505 | + if ( empty( $_POST[ 'widgets' ] ) ) { |
|
| 506 | + $_POST[ 'widgets' ] = array(); |
|
| 507 | 507 | } |
| 508 | - $statii['directory_widgets'] = update_post_meta( $post_id, '_gravityview_directory_widgets', $_POST['widgets'] ); |
|
| 508 | + $statii[ 'directory_widgets' ] = update_post_meta( $post_id, '_gravityview_directory_widgets', $_POST[ 'widgets' ] ); |
|
| 509 | 509 | |
| 510 | 510 | } // end save view configuration |
| 511 | 511 | |
@@ -515,9 +515,9 @@ discard block |
||
| 515 | 515 | * @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. |
| 516 | 516 | * @since 1.17.2 |
| 517 | 517 | */ |
| 518 | - do_action('gravityview_view_saved', $post_id, $statii ); |
|
| 518 | + do_action( 'gravityview_view_saved', $post_id, $statii ); |
|
| 519 | 519 | |
| 520 | - do_action('gravityview_log_debug', '[save_postdata] Update Post Meta Statuses (also returns false if nothing changed)', array_map( 'intval', $statii ) ); |
|
| 520 | + do_action( 'gravityview_log_debug', '[save_postdata] Update Post Meta Statuses (also returns false if nothing changed)', array_map( 'intval', $statii ) ); |
|
| 521 | 521 | } |
| 522 | 522 | |
| 523 | 523 | /** |
@@ -549,20 +549,20 @@ discard block |
||
| 549 | 549 | |
| 550 | 550 | $output = ''; |
| 551 | 551 | |
| 552 | - if( !empty( $fields ) ) { |
|
| 552 | + if ( ! empty( $fields ) ) { |
|
| 553 | 553 | |
| 554 | - foreach( $fields as $id => $details ) { |
|
| 554 | + foreach ( $fields as $id => $details ) { |
|
| 555 | 555 | |
| 556 | - if( in_array( $details['type'], $blacklist_field_types ) ) { |
|
| 556 | + if ( in_array( $details[ 'type' ], $blacklist_field_types ) ) { |
|
| 557 | 557 | continue; |
| 558 | 558 | } |
| 559 | 559 | |
| 560 | 560 | // Edit mode only allows editing the parent fields, not single inputs. |
| 561 | - if( $context === 'edit' && !empty( $details['parent'] ) ) { |
|
| 561 | + if ( $context === 'edit' && ! empty( $details[ 'parent' ] ) ) { |
|
| 562 | 562 | continue; |
| 563 | 563 | } |
| 564 | 564 | |
| 565 | - $output .= new GravityView_Admin_View_Field( $details['label'], $id, $details ); |
|
| 565 | + $output .= new GravityView_Admin_View_Field( $details[ 'label' ], $id, $details ); |
|
| 566 | 566 | |
| 567 | 567 | } // End foreach |
| 568 | 568 | } |
@@ -570,7 +570,7 @@ discard block |
||
| 570 | 570 | echo $output; |
| 571 | 571 | |
| 572 | 572 | // For the EDIT view we only want to allow the form fields. |
| 573 | - if( $context === 'edit' ) { |
|
| 573 | + if ( $context === 'edit' ) { |
|
| 574 | 574 | return; |
| 575 | 575 | } |
| 576 | 576 | |
@@ -594,16 +594,16 @@ discard block |
||
| 594 | 594 | $additional_fields = apply_filters( 'gravityview_additional_fields', array( |
| 595 | 595 | array( |
| 596 | 596 | 'label_text' => __( '+ Add All Fields', 'gravityview' ), |
| 597 | - 'desc' => __('Add all the available fields at once.', 'gravityview'), |
|
| 597 | + 'desc' => __( 'Add all the available fields at once.', 'gravityview' ), |
|
| 598 | 598 | 'field_id' => 'all-fields', |
| 599 | 599 | 'label_type' => 'field', |
| 600 | 600 | 'input_type' => NULL, |
| 601 | 601 | 'field_options' => NULL, |
| 602 | 602 | 'settings_html' => NULL, |
| 603 | 603 | ) |
| 604 | - )); |
|
| 604 | + ) ); |
|
| 605 | 605 | |
| 606 | - if( !empty( $additional_fields )) { |
|
| 606 | + if ( ! empty( $additional_fields ) ) { |
|
| 607 | 607 | foreach ( (array)$additional_fields as $item ) { |
| 608 | 608 | |
| 609 | 609 | // Prevent items from not having index set |
@@ -614,16 +614,16 @@ discard block |
||
| 614 | 614 | 'input_type' => NULL, |
| 615 | 615 | 'field_options' => NULL, |
| 616 | 616 | 'settings_html' => NULL, |
| 617 | - )); |
|
| 617 | + ) ); |
|
| 618 | 618 | |
| 619 | 619 | // Backward compat. |
| 620 | - if( !empty( $item['field_options'] ) ) { |
|
| 620 | + if ( ! empty( $item[ 'field_options' ] ) ) { |
|
| 621 | 621 | // Use settings_html from now on. |
| 622 | - $item['settings_html'] = $item['field_options']; |
|
| 622 | + $item[ 'settings_html' ] = $item[ 'field_options' ]; |
|
| 623 | 623 | } |
| 624 | 624 | |
| 625 | 625 | // Render a label for each of them |
| 626 | - echo new GravityView_Admin_View_Field( $item['label_text'], $item['field_id'], $item ); |
|
| 626 | + echo new GravityView_Admin_View_Field( $item[ 'label_text' ], $item[ 'field_id' ], $item ); |
|
| 627 | 627 | |
| 628 | 628 | } |
| 629 | 629 | } |
@@ -636,63 +636,63 @@ discard block |
||
| 636 | 636 | * @param string $zone Either 'single', 'directory', 'header', 'footer' |
| 637 | 637 | * @return array |
| 638 | 638 | */ |
| 639 | - function get_entry_default_fields($form, $zone) { |
|
| 639 | + function get_entry_default_fields( $form, $zone ) { |
|
| 640 | 640 | |
| 641 | 641 | $entry_default_fields = array(); |
| 642 | 642 | |
| 643 | - if( in_array( $zone, array( 'directory', 'single' ) ) ) { |
|
| 643 | + if ( in_array( $zone, array( 'directory', 'single' ) ) ) { |
|
| 644 | 644 | |
| 645 | 645 | $entry_default_fields = array( |
| 646 | 646 | 'id' => array( |
| 647 | - 'label' => __('Entry ID', 'gravityview'), |
|
| 647 | + 'label' => __( 'Entry ID', 'gravityview' ), |
|
| 648 | 648 | 'type' => 'id', |
| 649 | - 'desc' => __('The unique ID of the entry.', 'gravityview'), |
|
| 649 | + 'desc' => __( 'The unique ID of the entry.', 'gravityview' ), |
|
| 650 | 650 | ), |
| 651 | 651 | 'date_created' => array( |
| 652 | - 'label' => __('Entry Date', 'gravityview'), |
|
| 653 | - 'desc' => __('The date the entry was created.', 'gravityview'), |
|
| 652 | + 'label' => __( 'Entry Date', 'gravityview' ), |
|
| 653 | + 'desc' => __( 'The date the entry was created.', 'gravityview' ), |
|
| 654 | 654 | 'type' => 'date_created', |
| 655 | 655 | ), |
| 656 | 656 | 'source_url' => array( |
| 657 | - 'label' => __('Source URL', 'gravityview'), |
|
| 657 | + 'label' => __( 'Source URL', 'gravityview' ), |
|
| 658 | 658 | 'type' => 'source_url', |
| 659 | - 'desc' => __('The URL of the page where the form was submitted.', 'gravityview'), |
|
| 659 | + 'desc' => __( 'The URL of the page where the form was submitted.', 'gravityview' ), |
|
| 660 | 660 | ), |
| 661 | 661 | 'ip' => array( |
| 662 | - 'label' => __('User IP', 'gravityview'), |
|
| 662 | + 'label' => __( 'User IP', 'gravityview' ), |
|
| 663 | 663 | 'type' => 'ip', |
| 664 | - 'desc' => __('The IP Address of the user who created the entry.', 'gravityview'), |
|
| 664 | + 'desc' => __( 'The IP Address of the user who created the entry.', 'gravityview' ), |
|
| 665 | 665 | ), |
| 666 | 666 | 'created_by' => array( |
| 667 | - 'label' => __('User', 'gravityview'), |
|
| 667 | + 'label' => __( 'User', 'gravityview' ), |
|
| 668 | 668 | 'type' => 'created_by', |
| 669 | - 'desc' => __('Details of the logged-in user who created the entry (if any).', 'gravityview'), |
|
| 669 | + 'desc' => __( 'Details of the logged-in user who created the entry (if any).', 'gravityview' ), |
|
| 670 | 670 | ), |
| 671 | 671 | |
| 672 | 672 | /** |
| 673 | 673 | * @since 1.2 |
| 674 | 674 | */ |
| 675 | 675 | 'custom' => array( |
| 676 | - 'label' => __('Custom Content', 'gravityview'), |
|
| 676 | + 'label' => __( 'Custom Content', 'gravityview' ), |
|
| 677 | 677 | 'type' => 'custom', |
| 678 | - 'desc' => __('Insert custom text or HTML.', 'gravityview'), |
|
| 678 | + 'desc' => __( 'Insert custom text or HTML.', 'gravityview' ), |
|
| 679 | 679 | ), |
| 680 | 680 | |
| 681 | 681 | /** |
| 682 | 682 | * @since 1.7.2 |
| 683 | 683 | */ |
| 684 | 684 | 'other_entries' => array( |
| 685 | - 'label' => __('Other Entries', 'gravityview'), |
|
| 685 | + 'label' => __( 'Other Entries', 'gravityview' ), |
|
| 686 | 686 | 'type' => 'other_entries', |
| 687 | - 'desc' => __('Display other entries created by the entry creator.', 'gravityview'), |
|
| 687 | + 'desc' => __( 'Display other entries created by the entry creator.', 'gravityview' ), |
|
| 688 | 688 | ), |
| 689 | 689 | ); |
| 690 | 690 | |
| 691 | - if( 'single' !== $zone) { |
|
| 691 | + if ( 'single' !== $zone ) { |
|
| 692 | 692 | |
| 693 | - $entry_default_fields['entry_link'] = array( |
|
| 694 | - 'label' => __('Link to Entry', 'gravityview'), |
|
| 695 | - 'desc' => __('A dedicated link to the single entry with customizable text.', 'gravityview'), |
|
| 693 | + $entry_default_fields[ 'entry_link' ] = array( |
|
| 694 | + 'label' => __( 'Link to Entry', 'gravityview' ), |
|
| 695 | + 'desc' => __( 'A dedicated link to the single entry with customizable text.', 'gravityview' ), |
|
| 696 | 696 | 'type' => 'entry_link', |
| 697 | 697 | ); |
| 698 | 698 | } |
@@ -706,7 +706,7 @@ discard block |
||
| 706 | 706 | * @param string|array $form form_ID or form object |
| 707 | 707 | * @param string $zone Either 'single', 'directory', 'header', 'footer' |
| 708 | 708 | */ |
| 709 | - return apply_filters( 'gravityview_entry_default_fields', $entry_default_fields, $form, $zone); |
|
| 709 | + return apply_filters( 'gravityview_entry_default_fields', $entry_default_fields, $form, $zone ); |
|
| 710 | 710 | } |
| 711 | 711 | |
| 712 | 712 | /** |
@@ -717,7 +717,7 @@ discard block |
||
| 717 | 717 | */ |
| 718 | 718 | function get_available_fields( $form = '', $zone = NULL ) { |
| 719 | 719 | |
| 720 | - if( empty( $form ) ) { |
|
| 720 | + if ( empty( $form ) ) { |
|
| 721 | 721 | do_action( 'gravityview_log_error', '[get_available_fields] $form is empty' ); |
| 722 | 722 | return array(); |
| 723 | 723 | } |
@@ -726,7 +726,7 @@ discard block |
||
| 726 | 726 | $fields = gravityview_get_form_fields( $form, true ); |
| 727 | 727 | |
| 728 | 728 | // get meta fields ( only if form was already created ) |
| 729 | - if( !is_array( $form ) ) { |
|
| 729 | + if ( ! is_array( $form ) ) { |
|
| 730 | 730 | $meta_fields = gravityview_get_entry_meta( $form ); |
| 731 | 731 | } else { |
| 732 | 732 | $meta_fields = array(); |
@@ -750,11 +750,11 @@ discard block |
||
| 750 | 750 | |
| 751 | 751 | $widgets = $this->get_registered_widgets(); |
| 752 | 752 | |
| 753 | - if( !empty( $widgets ) ) { |
|
| 753 | + if ( ! empty( $widgets ) ) { |
|
| 754 | 754 | |
| 755 | - foreach( $widgets as $id => $details ) { |
|
| 755 | + foreach ( $widgets as $id => $details ) { |
|
| 756 | 756 | |
| 757 | - echo new GravityView_Admin_View_Widget( $details['label'], $id, $details ); |
|
| 757 | + echo new GravityView_Admin_View_Widget( $details[ 'label' ], $id, $details ); |
|
| 758 | 758 | |
| 759 | 759 | } |
| 760 | 760 | } |
@@ -788,7 +788,7 @@ discard block |
||
| 788 | 788 | function render_active_areas( $template_id, $type, $zone, $rows, $values ) { |
| 789 | 789 | global $post; |
| 790 | 790 | |
| 791 | - if( $type === 'widget' ) { |
|
| 791 | + if ( $type === 'widget' ) { |
|
| 792 | 792 | $button_label = __( 'Add Widget', 'gravityview' ); |
| 793 | 793 | } else { |
| 794 | 794 | $button_label = __( 'Add Field', 'gravityview' ); |
@@ -797,15 +797,15 @@ discard block |
||
| 797 | 797 | $available_items = array(); |
| 798 | 798 | |
| 799 | 799 | // if saved values, get available fields to label everyone |
| 800 | - if( !empty( $values ) && ( !empty( $post->ID ) || !empty( $_POST['template_id'] ) ) ) { |
|
| 800 | + if ( ! empty( $values ) && ( ! empty( $post->ID ) || ! empty( $_POST[ 'template_id' ] ) ) ) { |
|
| 801 | 801 | |
| 802 | - if( !empty( $_POST['template_id'] ) ) { |
|
| 803 | - $form = GravityView_Ajax::pre_get_form_fields( $_POST['template_id'] ); |
|
| 802 | + if ( ! empty( $_POST[ 'template_id' ] ) ) { |
|
| 803 | + $form = GravityView_Ajax::pre_get_form_fields( $_POST[ 'template_id' ] ); |
|
| 804 | 804 | } else { |
| 805 | 805 | $form = gravityview_get_form_id( $post->ID ); |
| 806 | 806 | } |
| 807 | 807 | |
| 808 | - if( 'field' === $type ) { |
|
| 808 | + if ( 'field' === $type ) { |
|
| 809 | 809 | $available_items = $this->get_available_fields( $form, $zone ); |
| 810 | 810 | } else { |
| 811 | 811 | $available_items = $this->get_registered_widgets(); |
@@ -813,39 +813,39 @@ discard block |
||
| 813 | 813 | |
| 814 | 814 | } |
| 815 | 815 | |
| 816 | - foreach( $rows as $row ) : |
|
| 817 | - foreach( $row as $col => $areas ) : |
|
| 818 | - $column = ($col == '2-2') ? '1-2' : $col; ?> |
|
| 816 | + foreach ( $rows as $row ) : |
|
| 817 | + foreach ( $row as $col => $areas ) : |
|
| 818 | + $column = ( $col == '2-2' ) ? '1-2' : $col; ?> |
|
| 819 | 819 | |
| 820 | 820 | <div class="gv-grid-col-<?php echo esc_attr( $column ); ?>"> |
| 821 | 821 | |
| 822 | - <?php foreach( $areas as $area ) : ?> |
|
| 822 | + <?php foreach ( $areas as $area ) : ?> |
|
| 823 | 823 | |
| 824 | 824 | <div class="gv-droppable-area"> |
| 825 | - <div class="active-drop active-drop-<?php echo esc_attr( $type ); ?>" data-areaid="<?php echo esc_attr( $zone .'_'. $area['areaid'] ); ?>"> |
|
| 825 | + <div class="active-drop active-drop-<?php echo esc_attr( $type ); ?>" data-areaid="<?php echo esc_attr( $zone . '_' . $area[ 'areaid' ] ); ?>"> |
|
| 826 | 826 | |
| 827 | 827 | <?php // render saved fields |
| 828 | 828 | |
| 829 | - if( !empty( $values[ $zone .'_'. $area['areaid'] ] ) ) { |
|
| 829 | + if ( ! empty( $values[ $zone . '_' . $area[ 'areaid' ] ] ) ) { |
|
| 830 | 830 | |
| 831 | - foreach( $values[ $zone .'_'. $area['areaid'] ] as $uniqid => $field ) { |
|
| 831 | + foreach ( $values[ $zone . '_' . $area[ 'areaid' ] ] as $uniqid => $field ) { |
|
| 832 | 832 | |
| 833 | 833 | $input_type = NULL; |
| 834 | - $original_item = isset( $available_items[ $field['id'] ] ) ? $available_items[ $field['id'] ] : false ; |
|
| 834 | + $original_item = isset( $available_items[ $field[ 'id' ] ] ) ? $available_items[ $field[ 'id' ] ] : false; |
|
| 835 | 835 | |
| 836 | - if( !$original_item ) { |
|
| 836 | + if ( ! $original_item ) { |
|
| 837 | 837 | |
| 838 | - do_action('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('available_items' => $available_items, 'field' => $field )); |
|
| 838 | + do_action( '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( 'available_items' => $available_items, 'field' => $field ) ); |
|
| 839 | 839 | |
| 840 | 840 | $original_item = $field; |
| 841 | 841 | } else { |
| 842 | 842 | |
| 843 | - $input_type = isset( $original_item['type'] ) ? $original_item['type'] : NULL; |
|
| 843 | + $input_type = isset( $original_item[ 'type' ] ) ? $original_item[ 'type' ] : NULL; |
|
| 844 | 844 | |
| 845 | 845 | } |
| 846 | 846 | |
| 847 | 847 | // Field options dialog box |
| 848 | - $field_options = GravityView_Render_Settings::render_field_options( $type, $template_id, $field['id'], $original_item['label'], $zone .'_'. $area['areaid'], $input_type, $uniqid, $field, $zone, $original_item ); |
|
| 848 | + $field_options = GravityView_Render_Settings::render_field_options( $type, $template_id, $field[ 'id' ], $original_item[ 'label' ], $zone . '_' . $area[ 'areaid' ], $input_type, $uniqid, $field, $zone, $original_item ); |
|
| 849 | 849 | |
| 850 | 850 | $item = array( |
| 851 | 851 | 'input_type' => $input_type, |
@@ -854,16 +854,16 @@ discard block |
||
| 854 | 854 | ); |
| 855 | 855 | |
| 856 | 856 | // Merge the values with the current item to pass things like widget descriptions and original field names |
| 857 | - if( $original_item ) { |
|
| 857 | + if ( $original_item ) { |
|
| 858 | 858 | $item = wp_parse_args( $item, $original_item ); |
| 859 | 859 | } |
| 860 | 860 | |
| 861 | - switch( $type ) { |
|
| 861 | + switch ( $type ) { |
|
| 862 | 862 | case 'widget': |
| 863 | - echo new GravityView_Admin_View_Widget( $item['label'], $field['id'], $item, $field ); |
|
| 863 | + echo new GravityView_Admin_View_Widget( $item[ 'label' ], $field[ 'id' ], $item, $field ); |
|
| 864 | 864 | break; |
| 865 | 865 | default: |
| 866 | - echo new GravityView_Admin_View_Field( $item['label'], $field['id'], $item, $field ); |
|
| 866 | + echo new GravityView_Admin_View_Field( $item[ 'label' ], $field[ 'id' ], $item, $field ); |
|
| 867 | 867 | } |
| 868 | 868 | |
| 869 | 869 | |
@@ -873,11 +873,11 @@ discard block |
||
| 873 | 873 | |
| 874 | 874 | } // End if zone is not empty ?> |
| 875 | 875 | |
| 876 | - <span class="drop-message"><?php echo sprintf(esc_attr__('"+ %s" or drag existing %ss here.', 'gravityview'), $button_label, $type ); ?></span> |
|
| 876 | + <span class="drop-message"><?php echo sprintf( esc_attr__( '"+ %s" or drag existing %ss here.', 'gravityview' ), $button_label, $type ); ?></span> |
|
| 877 | 877 | </div> |
| 878 | 878 | <div class="gv-droppable-area-action"> |
| 879 | - <a href="#" 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 ); ?>"><?php echo '+ '.esc_html( $button_label ); ?></a> |
|
| 880 | - <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> |
|
| 879 | + <a href="#" 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 ); ?>"><?php echo '+ ' . esc_html( $button_label ); ?></a> |
|
| 880 | + <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> |
|
| 881 | 881 | </div> |
| 882 | 882 | </div> |
| 883 | 883 | |
@@ -899,7 +899,7 @@ discard block |
||
| 899 | 899 | $default_widget_areas = GravityView_Plugin::get_default_widget_areas(); |
| 900 | 900 | |
| 901 | 901 | $widgets = array(); |
| 902 | - if( !empty( $post_id ) ) { |
|
| 902 | + if ( ! empty( $post_id ) ) { |
|
| 903 | 903 | $widgets = get_post_meta( $post_id, '_gravityview_directory_widgets', true ); |
| 904 | 904 | |
| 905 | 905 | } |
@@ -930,7 +930,7 @@ discard block |
||
| 930 | 930 | */ |
| 931 | 931 | function render_directory_active_areas( $template_id = '', $context = 'single', $post_id = '', $echo = false ) { |
| 932 | 932 | |
| 933 | - if( empty( $template_id ) ) { |
|
| 933 | + if ( empty( $template_id ) ) { |
|
| 934 | 934 | do_action( 'gravityview_log_debug', '[render_directory_active_areas] $template_id is empty' ); |
| 935 | 935 | return; |
| 936 | 936 | } |
@@ -944,12 +944,12 @@ discard block |
||
| 944 | 944 | */ |
| 945 | 945 | $template_areas = apply_filters( 'gravityview_template_active_areas', array(), $template_id, $context ); |
| 946 | 946 | |
| 947 | - if( empty( $template_areas ) ) { |
|
| 947 | + if ( empty( $template_areas ) ) { |
|
| 948 | 948 | |
| 949 | 949 | do_action( 'gravityview_log_debug', '[render_directory_active_areas] No areas defined. Maybe template %s is disabled.', $template_id ); |
| 950 | 950 | $output = '<div>'; |
| 951 | - $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>'; |
|
| 952 | - $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>'; |
|
| 951 | + $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>'; |
|
| 952 | + $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>'; |
|
| 953 | 953 | $output .= '</div>'; |
| 954 | 954 | } else { |
| 955 | 955 | |
@@ -964,7 +964,7 @@ discard block |
||
| 964 | 964 | |
| 965 | 965 | } |
| 966 | 966 | |
| 967 | - if( $echo ) { |
|
| 967 | + if ( $echo ) { |
|
| 968 | 968 | echo $output; |
| 969 | 969 | } |
| 970 | 970 | |
@@ -984,25 +984,25 @@ discard block |
||
| 984 | 984 | $is_widgets_page = ( $pagenow === 'widgets.php' ); |
| 985 | 985 | |
| 986 | 986 | // Add the GV font (with the Astronaut) |
| 987 | - wp_enqueue_style( 'gravityview_global', plugins_url('assets/css/admin-global.css', GRAVITYVIEW_FILE), array(), GravityView_Plugin::version ); |
|
| 987 | + wp_enqueue_style( 'gravityview_global', plugins_url( 'assets/css/admin-global.css', GRAVITYVIEW_FILE ), array(), GravityView_Plugin::version ); |
|
| 988 | 988 | |
| 989 | - wp_register_script( 'gravityview-jquery-cookie', plugins_url('assets/lib/jquery.cookie/jquery.cookie.min.js', GRAVITYVIEW_FILE), array( 'jquery' ), GravityView_Plugin::version, true ); |
|
| 989 | + wp_register_script( 'gravityview-jquery-cookie', plugins_url( 'assets/lib/jquery.cookie/jquery.cookie.min.js', GRAVITYVIEW_FILE ), array( 'jquery' ), GravityView_Plugin::version, true ); |
|
| 990 | 990 | |
| 991 | 991 | // Don't process any scripts below here if it's not a GravityView page. |
| 992 | - if( !gravityview_is_admin_page($hook) && !$is_widgets_page ) { return; } |
|
| 992 | + if ( ! gravityview_is_admin_page( $hook ) && ! $is_widgets_page ) { return; } |
|
| 993 | 993 | |
| 994 | 994 | // Only enqueue the following on single pages |
| 995 | - if( gravityview_is_admin_page($hook, 'single') || $is_widgets_page ) { |
|
| 995 | + if ( gravityview_is_admin_page( $hook, 'single' ) || $is_widgets_page ) { |
|
| 996 | 996 | |
| 997 | 997 | wp_enqueue_script( 'jquery-ui-datepicker' ); |
| 998 | - wp_enqueue_style( 'gravityview_views_datepicker', plugins_url('assets/css/admin-datepicker.css', GRAVITYVIEW_FILE), GravityView_Plugin::version ); |
|
| 998 | + wp_enqueue_style( 'gravityview_views_datepicker', plugins_url( 'assets/css/admin-datepicker.css', GRAVITYVIEW_FILE ), GravityView_Plugin::version ); |
|
| 999 | 999 | |
| 1000 | - $script_debug = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min'; |
|
| 1000 | + $script_debug = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
|
| 1001 | 1001 | |
| 1002 | 1002 | //enqueue scripts |
| 1003 | 1003 | 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' ), GravityView_Plugin::version ); |
| 1004 | 1004 | |
| 1005 | - wp_localize_script('gravityview_views_scripts', 'gvGlobals', array( |
|
| 1005 | + wp_localize_script( 'gravityview_views_scripts', 'gvGlobals', array( |
|
| 1006 | 1006 | 'cookiepath' => COOKIEPATH, |
| 1007 | 1007 | 'nonce' => wp_create_nonce( 'gravityview_ajaxviews' ), |
| 1008 | 1008 | 'label_viewname' => __( 'Enter View name here', 'gravityview' ), |
@@ -1015,9 +1015,9 @@ discard block |
||
| 1015 | 1015 | 'loading_error' => esc_html__( 'There was an error loading dynamic content.', 'gravityview' ), |
| 1016 | 1016 | 'field_loaderror' => __( 'Error while adding the field. Please try again or contact GravityView support.', 'gravityview' ), |
| 1017 | 1017 | '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' ), |
| 1018 | - )); |
|
| 1018 | + ) ); |
|
| 1019 | 1019 | |
| 1020 | - wp_enqueue_style( 'gravityview_views_styles', plugins_url( 'assets/css/admin-views.css', GRAVITYVIEW_FILE ), array('dashicons', 'wp-jquery-ui-dialog' ), GravityView_Plugin::version ); |
|
| 1020 | + wp_enqueue_style( 'gravityview_views_styles', plugins_url( 'assets/css/admin-views.css', GRAVITYVIEW_FILE ), array( 'dashicons', 'wp-jquery-ui-dialog' ), GravityView_Plugin::version ); |
|
| 1021 | 1021 | |
| 1022 | 1022 | self::enqueue_gravity_forms_scripts(); |
| 1023 | 1023 | |
@@ -1036,10 +1036,10 @@ discard block |
||
| 1036 | 1036 | ); |
| 1037 | 1037 | |
| 1038 | 1038 | if ( wp_is_mobile() ) { |
| 1039 | - $scripts[] = 'jquery-touch-punch'; |
|
| 1039 | + $scripts[ ] = 'jquery-touch-punch'; |
|
| 1040 | 1040 | } |
| 1041 | 1041 | |
| 1042 | - foreach ($scripts as $script) { |
|
| 1042 | + foreach ( $scripts as $script ) { |
|
| 1043 | 1043 | wp_enqueue_script( $script ); |
| 1044 | 1044 | } |
| 1045 | 1045 | } |
@@ -1048,11 +1048,11 @@ discard block |
||
| 1048 | 1048 | |
| 1049 | 1049 | $filter = current_filter(); |
| 1050 | 1050 | |
| 1051 | - if( preg_match('/script/ism', $filter ) ) { |
|
| 1051 | + if ( preg_match( '/script/ism', $filter ) ) { |
|
| 1052 | 1052 | $allow_scripts = array( 'jquery-ui-core', 'jquery-ui-dialog', 'jquery-ui-tabs', 'jquery-ui-draggable', 'jquery-ui-droppable', 'jquery-ui-sortable', 'jquery-ui-tooltip', 'gravityview_views_scripts', 'gravityview-support', 'gravityview-jquery-cookie', 'gravityview_views_datepicker', |
| 1053 | 1053 | 'sack', 'gform_gravityforms', 'gform_forms', 'gform_form_admin', 'jquery-ui-autocomplete' ); |
| 1054 | 1054 | $registered = array_merge( $registered, $allow_scripts ); |
| 1055 | - } elseif( preg_match('/style/ism', $filter ) ) { |
|
| 1055 | + } elseif ( preg_match( '/style/ism', $filter ) ) { |
|
| 1056 | 1056 | $allow_styles = array( 'dashicons', 'wp-jquery-ui-dialog', 'gravityview_views_styles', 'gravityview_global', 'gravityview_views_datepicker' ); |
| 1057 | 1057 | $registered = array_merge( $registered, $allow_styles ); |
| 1058 | 1058 | } |
@@ -124,7 +124,7 @@ discard block |
||
| 124 | 124 | |
| 125 | 125 | $entry = self::get_entry( $entry_slug, true ); |
| 126 | 126 | |
| 127 | - $form = self::get_form( $entry['form_id'] ); |
|
| 127 | + $form = self::get_form( $entry[ 'form_id' ] ); |
|
| 128 | 128 | |
| 129 | 129 | return $form; |
| 130 | 130 | } |
@@ -182,7 +182,7 @@ discard block |
||
| 182 | 182 | |
| 183 | 183 | $results = GFAPI::get_entries( intval( $form_id ), $search_criteria, null, $paging ); |
| 184 | 184 | |
| 185 | - $result = ( ! empty( $results ) && ! empty( $results[0]['id'] ) ) ? $results[0]['id'] : null; |
|
| 185 | + $result = ( ! empty( $results ) && ! empty( $results[ 0 ][ 'id' ] ) ) ? $results[ 0 ][ 'id' ] : null; |
|
| 186 | 186 | |
| 187 | 187 | return $result; |
| 188 | 188 | } |
@@ -200,9 +200,9 @@ discard block |
||
| 200 | 200 | if ( class_exists( 'GFAPI' ) ) { |
| 201 | 201 | $gf_forms = GFAPI::get_forms(); |
| 202 | 202 | foreach ( $gf_forms as $form ) { |
| 203 | - $forms[] = array( |
|
| 204 | - 'id' => $form['id'], |
|
| 205 | - 'title' => $form['title'], |
|
| 203 | + $forms[ ] = array( |
|
| 204 | + 'id' => $form[ 'id' ], |
|
| 205 | + 'title' => $form[ 'title' ], |
|
| 206 | 206 | ); |
| 207 | 207 | } |
| 208 | 208 | } |
@@ -229,10 +229,10 @@ discard block |
||
| 229 | 229 | $has_post_fields = false; |
| 230 | 230 | |
| 231 | 231 | if ( $form ) { |
| 232 | - foreach ( $form['fields'] as $field ) { |
|
| 232 | + foreach ( $form[ 'fields' ] as $field ) { |
|
| 233 | 233 | |
| 234 | - if ( $include_parent_field || empty( $field['inputs'] ) ) { |
|
| 235 | - $fields["{$field->id}"] = array( |
|
| 234 | + if ( $include_parent_field || empty( $field[ 'inputs' ] ) ) { |
|
| 235 | + $fields[ "{$field->id}" ] = array( |
|
| 236 | 236 | 'label' => rgar( $field, 'label' ), |
| 237 | 237 | 'parent' => null, |
| 238 | 238 | 'type' => rgar( $field, 'type' ), |
@@ -247,10 +247,10 @@ discard block |
||
| 247 | 247 | * @hack |
| 248 | 248 | * In case of email/email confirmation, the input for email has the same id as the parent field |
| 249 | 249 | */ |
| 250 | - if( 'email' === $field->type && false === strpos( $input['id'], '.' ) ) { |
|
| 250 | + if ( 'email' === $field->type && false === strpos( $input[ 'id' ], '.' ) ) { |
|
| 251 | 251 | continue; |
| 252 | 252 | } |
| 253 | - $fields["{$input['id']}"] = array( |
|
| 253 | + $fields[ "{$input[ 'id' ]}" ] = array( |
|
| 254 | 254 | 'label' => rgar( $input, 'label' ), |
| 255 | 255 | 'customLabel' => rgar( $input, 'customLabel' ), |
| 256 | 256 | 'parent' => $field, |
@@ -262,7 +262,7 @@ discard block |
||
| 262 | 262 | } |
| 263 | 263 | |
| 264 | 264 | |
| 265 | - if( GFCommon::is_product_field( $field->type ) ){ |
|
| 265 | + if ( GFCommon::is_product_field( $field->type ) ) { |
|
| 266 | 266 | $has_product_fields = true; |
| 267 | 267 | } |
| 268 | 268 | |
@@ -276,7 +276,7 @@ discard block |
||
| 276 | 276 | * @since 1.7 |
| 277 | 277 | */ |
| 278 | 278 | if ( $has_post_fields ) { |
| 279 | - $fields['post_id'] = array( |
|
| 279 | + $fields[ 'post_id' ] = array( |
|
| 280 | 280 | 'label' => __( 'Post ID', 'gravityview' ), |
| 281 | 281 | 'type' => 'post_id', |
| 282 | 282 | ); |
@@ -287,10 +287,10 @@ discard block |
||
| 287 | 287 | $payment_fields = GravityView_Fields::get_all( 'pricing' ); |
| 288 | 288 | |
| 289 | 289 | foreach ( $payment_fields as $payment_field ) { |
| 290 | - if( isset( $fields["{$payment_field->name}"] ) ) { |
|
| 290 | + if ( isset( $fields[ "{$payment_field->name}" ] ) ) { |
|
| 291 | 291 | continue; |
| 292 | 292 | } |
| 293 | - $fields["{$payment_field->name}"] = array( |
|
| 293 | + $fields[ "{$payment_field->name}" ] = array( |
|
| 294 | 294 | 'label' => $payment_field->label, |
| 295 | 295 | 'desc' => $payment_field->description, |
| 296 | 296 | 'type' => $payment_field->name, |
@@ -322,9 +322,9 @@ discard block |
||
| 322 | 322 | |
| 323 | 323 | $fields = array(); |
| 324 | 324 | |
| 325 | - foreach ( $extra_fields as $key => $field ){ |
|
| 326 | - if ( ! empty( $only_default_column ) && ! empty( $field['is_default_column'] ) ) { |
|
| 327 | - $fields[ $key ] = array( 'label' => $field['label'], 'type' => 'entry_meta' ); |
|
| 325 | + foreach ( $extra_fields as $key => $field ) { |
|
| 326 | + if ( ! empty( $only_default_column ) && ! empty( $field[ 'is_default_column' ] ) ) { |
|
| 327 | + $fields[ $key ] = array( 'label' => $field[ 'label' ], 'type' => 'entry_meta' ); |
|
| 328 | 328 | } |
| 329 | 329 | } |
| 330 | 330 | |
@@ -364,32 +364,32 @@ discard block |
||
| 364 | 364 | 'search_criteria' => null, |
| 365 | 365 | 'sorting' => null, |
| 366 | 366 | 'paging' => null, |
| 367 | - 'cache' => (isset( $passed_criteria['cache'] ) ? $passed_criteria['cache'] : true), |
|
| 367 | + 'cache' => ( isset( $passed_criteria[ 'cache' ] ) ? $passed_criteria[ 'cache' ] : true ), |
|
| 368 | 368 | ); |
| 369 | 369 | |
| 370 | 370 | $criteria = wp_parse_args( $passed_criteria, $search_criteria_defaults ); |
| 371 | 371 | |
| 372 | - if ( ! empty( $criteria['search_criteria']['field_filters'] ) ) { |
|
| 373 | - foreach ( $criteria['search_criteria']['field_filters'] as &$filter ) { |
|
| 372 | + if ( ! empty( $criteria[ 'search_criteria' ][ 'field_filters' ] ) ) { |
|
| 373 | + foreach ( $criteria[ 'search_criteria' ][ 'field_filters' ] as &$filter ) { |
|
| 374 | 374 | |
| 375 | 375 | if ( ! is_array( $filter ) ) { |
| 376 | 376 | continue; |
| 377 | 377 | } |
| 378 | 378 | |
| 379 | 379 | // By default, we want searches to be wildcard for each field. |
| 380 | - $filter['operator'] = empty( $filter['operator'] ) ? 'contains' : $filter['operator']; |
|
| 380 | + $filter[ 'operator' ] = empty( $filter[ 'operator' ] ) ? 'contains' : $filter[ 'operator' ]; |
|
| 381 | 381 | |
| 382 | 382 | /** |
| 383 | 383 | * @filter `gravityview_search_operator` Modify the search operator for the field (contains, is, isnot, etc) |
| 384 | 384 | * @param string $operator Existing search operator |
| 385 | 385 | * @param array $filter array with `key`, `value`, `operator`, `type` keys |
| 386 | 386 | */ |
| 387 | - $filter['operator'] = apply_filters( 'gravityview_search_operator', $filter['operator'], $filter ); |
|
| 387 | + $filter[ 'operator' ] = apply_filters( 'gravityview_search_operator', $filter[ 'operator' ], $filter ); |
|
| 388 | 388 | } |
| 389 | 389 | |
| 390 | 390 | // don't send just the [mode] without any field filter. |
| 391 | - if( count( $criteria['search_criteria']['field_filters'] ) === 1 && array_key_exists( 'mode' , $criteria['search_criteria']['field_filters'] ) ) { |
|
| 392 | - unset( $criteria['search_criteria']['field_filters']['mode'] ); |
|
| 391 | + if ( count( $criteria[ 'search_criteria' ][ 'field_filters' ] ) === 1 && array_key_exists( 'mode', $criteria[ 'search_criteria' ][ 'field_filters' ] ) ) { |
|
| 392 | + unset( $criteria[ 'search_criteria' ][ 'field_filters' ][ 'mode' ] ); |
|
| 393 | 393 | } |
| 394 | 394 | |
| 395 | 395 | } |
@@ -400,21 +400,21 @@ discard block |
||
| 400 | 400 | * Prepare date formats to be in Gravity Forms DB format; |
| 401 | 401 | * $passed_criteria may include date formats incompatible with Gravity Forms. |
| 402 | 402 | */ |
| 403 | - foreach ( array('start_date', 'end_date' ) as $key ) { |
|
| 403 | + foreach ( array( 'start_date', 'end_date' ) as $key ) { |
|
| 404 | 404 | |
| 405 | - if ( ! empty( $criteria['search_criteria'][ $key ] ) ) { |
|
| 405 | + if ( ! empty( $criteria[ 'search_criteria' ][ $key ] ) ) { |
|
| 406 | 406 | |
| 407 | 407 | // Use date_create instead of new DateTime so it returns false if invalid date format. |
| 408 | - $date = date_create( $criteria['search_criteria'][ $key ] ); |
|
| 408 | + $date = date_create( $criteria[ 'search_criteria' ][ $key ] ); |
|
| 409 | 409 | |
| 410 | 410 | if ( $date ) { |
| 411 | 411 | // Gravity Forms wants dates in the `Y-m-d H:i:s` format. |
| 412 | - $criteria['search_criteria'][ $key ] = $date->format( 'Y-m-d H:i:s' ); |
|
| 412 | + $criteria[ 'search_criteria' ][ $key ] = $date->format( 'Y-m-d H:i:s' ); |
|
| 413 | 413 | } else { |
| 414 | 414 | // If it's an invalid date, unset it. Gravity Forms freaks out otherwise. |
| 415 | - unset( $criteria['search_criteria'][ $key ] ); |
|
| 415 | + unset( $criteria[ 'search_criteria' ][ $key ] ); |
|
| 416 | 416 | |
| 417 | - do_action( 'gravityview_log_error', '[filter_get_entries_criteria] '.$key.' Date format not valid:', $criteria['search_criteria'][ $key ] ); |
|
| 417 | + do_action( 'gravityview_log_error', '[filter_get_entries_criteria] ' . $key . ' Date format not valid:', $criteria[ 'search_criteria' ][ $key ] ); |
|
| 418 | 418 | } |
| 419 | 419 | } |
| 420 | 420 | } |
@@ -422,12 +422,12 @@ discard block |
||
| 422 | 422 | |
| 423 | 423 | // When multiple views are embedded, OR single entry, calculate the context view id and send it to the advanced filter |
| 424 | 424 | if ( class_exists( 'GravityView_View_Data' ) && GravityView_View_Data::getInstance()->has_multiple_views() || GravityView_frontend::getInstance()->getSingleEntry() ) { |
| 425 | - $criteria['context_view_id'] = GravityView_frontend::getInstance()->get_context_view_id(); |
|
| 425 | + $criteria[ 'context_view_id' ] = GravityView_frontend::getInstance()->get_context_view_id(); |
|
| 426 | 426 | } elseif ( 'delete' === RGForms::get( 'action' ) ) { |
| 427 | - $criteria['context_view_id'] = isset( $_GET['view_id'] ) ? intval( $_GET['view_id'] ) : null; |
|
| 428 | - } elseif( !isset( $criteria['context_view_id'] ) ) { |
|
| 427 | + $criteria[ 'context_view_id' ] = isset( $_GET[ 'view_id' ] ) ? intval( $_GET[ 'view_id' ] ) : null; |
|
| 428 | + } elseif ( ! isset( $criteria[ 'context_view_id' ] ) ) { |
|
| 429 | 429 | // Prevent overriding the Context View ID: Some widgets could set the context_view_id (e.g. Recent Entries widget) |
| 430 | - $criteria['context_view_id'] = null; |
|
| 430 | + $criteria[ 'context_view_id' ] = null; |
|
| 431 | 431 | } |
| 432 | 432 | |
| 433 | 433 | /** |
@@ -436,7 +436,7 @@ discard block |
||
| 436 | 436 | * @param array $form_ids Forms to search |
| 437 | 437 | * @param int $view_id ID of the view being used to search |
| 438 | 438 | */ |
| 439 | - $criteria = apply_filters( 'gravityview_search_criteria', $criteria, $form_ids, $criteria['context_view_id'] ); |
|
| 439 | + $criteria = apply_filters( 'gravityview_search_criteria', $criteria, $form_ids, $criteria[ 'context_view_id' ] ); |
|
| 440 | 440 | |
| 441 | 441 | return (array)$criteria; |
| 442 | 442 | |
@@ -467,7 +467,7 @@ discard block |
||
| 467 | 467 | /** Reduce # of database calls */ |
| 468 | 468 | add_filter( 'gform_is_encrypted_field', '__return_false' ); |
| 469 | 469 | |
| 470 | - if ( ! empty( $criteria['cache'] ) ) { |
|
| 470 | + if ( ! empty( $criteria[ 'cache' ] ) ) { |
|
| 471 | 471 | |
| 472 | 472 | $Cache = new GravityView_Cache( $form_ids, $criteria ); |
| 473 | 473 | |
@@ -475,7 +475,7 @@ discard block |
||
| 475 | 475 | |
| 476 | 476 | // Still update the total count when using cached results |
| 477 | 477 | if ( ! is_null( $total ) ) { |
| 478 | - $total = GFAPI::count_entries( $form_ids, $criteria['search_criteria'] ); |
|
| 478 | + $total = GFAPI::count_entries( $form_ids, $criteria[ 'search_criteria' ] ); |
|
| 479 | 479 | } |
| 480 | 480 | |
| 481 | 481 | $return = $entries; |
@@ -495,9 +495,9 @@ discard block |
||
| 495 | 495 | $entries = apply_filters( 'gravityview_before_get_entries', null, $criteria, $passed_criteria, $total ); |
| 496 | 496 | |
| 497 | 497 | // No entries returned from gravityview_before_get_entries |
| 498 | - if( is_null( $entries ) ) { |
|
| 498 | + if ( is_null( $entries ) ) { |
|
| 499 | 499 | |
| 500 | - $entries = GFAPI::get_entries( $form_ids, $criteria['search_criteria'], $criteria['sorting'], $criteria['paging'], $total ); |
|
| 500 | + $entries = GFAPI::get_entries( $form_ids, $criteria[ 'search_criteria' ], $criteria[ 'sorting' ], $criteria[ 'paging' ], $total ); |
|
| 501 | 501 | |
| 502 | 502 | if ( is_wp_error( $entries ) ) { |
| 503 | 503 | do_action( 'gravityview_log_error', $entries->get_error_message(), $entries ); |
@@ -506,7 +506,7 @@ discard block |
||
| 506 | 506 | } |
| 507 | 507 | } |
| 508 | 508 | |
| 509 | - if ( ! empty( $criteria['cache'] ) && isset( $Cache ) ) { |
|
| 509 | + if ( ! empty( $criteria[ 'cache' ] ) && isset( $Cache ) ) { |
|
| 510 | 510 | |
| 511 | 511 | // Cache results |
| 512 | 512 | $Cache->set( $entries, 'entries' ); |
@@ -593,7 +593,7 @@ discard block |
||
| 593 | 593 | */ |
| 594 | 594 | $check_entry_display = apply_filters( 'gravityview/common/get_entry/check_entry_display', $check_entry_display, $entry ); |
| 595 | 595 | |
| 596 | - if( $check_entry_display ) { |
|
| 596 | + if ( $check_entry_display ) { |
|
| 597 | 597 | // Is the entry allowed |
| 598 | 598 | $entry = self::check_entry_display( $entry ); |
| 599 | 599 | } |
@@ -626,12 +626,12 @@ discard block |
||
| 626 | 626 | |
| 627 | 627 | $value = false; |
| 628 | 628 | |
| 629 | - if( 'context' === $val1 ) { |
|
| 629 | + if ( 'context' === $val1 ) { |
|
| 630 | 630 | |
| 631 | 631 | $matching_contexts = array( $val2 ); |
| 632 | 632 | |
| 633 | 633 | // We allow for non-standard contexts. |
| 634 | - switch( $val2 ) { |
|
| 634 | + switch ( $val2 ) { |
|
| 635 | 635 | // Check for either single or edit |
| 636 | 636 | case 'singular': |
| 637 | 637 | $matching_contexts = array( 'single', 'edit' ); |
@@ -691,7 +691,7 @@ discard block |
||
| 691 | 691 | return false; |
| 692 | 692 | } |
| 693 | 693 | |
| 694 | - if ( empty( $entry['form_id'] ) ) { |
|
| 694 | + if ( empty( $entry[ 'form_id' ] ) ) { |
|
| 695 | 695 | do_action( 'gravityview_log_debug', '[apply_filters_to_entry] Entry is empty! Entry:', $entry ); |
| 696 | 696 | return false; |
| 697 | 697 | } |
@@ -699,26 +699,26 @@ discard block |
||
| 699 | 699 | $criteria = self::calculate_get_entries_criteria(); |
| 700 | 700 | |
| 701 | 701 | // Make sure the current View is connected to the same form as the Entry |
| 702 | - if( ! empty( $criteria['context_view_id'] ) ) { |
|
| 703 | - $context_view_id = intval( $criteria['context_view_id'] ); |
|
| 702 | + if ( ! empty( $criteria[ 'context_view_id' ] ) ) { |
|
| 703 | + $context_view_id = intval( $criteria[ 'context_view_id' ] ); |
|
| 704 | 704 | $context_form_id = gravityview_get_form_id( $context_view_id ); |
| 705 | - if( intval( $context_form_id ) !== intval( $entry['form_id'] ) ) { |
|
| 706 | - do_action( 'gravityview_log_debug', sprintf( '[apply_filters_to_entry] Entry form ID does not match current View connected form ID:', $entry['form_id'] ), $criteria['context_view_id'] ); |
|
| 705 | + if ( intval( $context_form_id ) !== intval( $entry[ 'form_id' ] ) ) { |
|
| 706 | + do_action( 'gravityview_log_debug', sprintf( '[apply_filters_to_entry] Entry form ID does not match current View connected form ID:', $entry[ 'form_id' ] ), $criteria[ 'context_view_id' ] ); |
|
| 707 | 707 | return false; |
| 708 | 708 | } |
| 709 | 709 | } |
| 710 | 710 | |
| 711 | - if ( empty( $criteria['search_criteria'] ) || ! is_array( $criteria['search_criteria'] ) ) { |
|
| 711 | + if ( empty( $criteria[ 'search_criteria' ] ) || ! is_array( $criteria[ 'search_criteria' ] ) ) { |
|
| 712 | 712 | do_action( 'gravityview_log_debug', '[apply_filters_to_entry] Entry approved! No search criteria found:', $criteria ); |
| 713 | 713 | return $entry; |
| 714 | 714 | } |
| 715 | 715 | |
| 716 | - $search_criteria = $criteria['search_criteria']; |
|
| 716 | + $search_criteria = $criteria[ 'search_criteria' ]; |
|
| 717 | 717 | unset( $criteria ); |
| 718 | 718 | |
| 719 | 719 | // check entry status |
| 720 | - if ( array_key_exists( 'status', $search_criteria ) && $search_criteria['status'] != $entry['status'] ) { |
|
| 721 | - do_action( 'gravityview_log_debug', sprintf( '[apply_filters_to_entry] Entry status - %s - is not valid according to filter:', $entry['status'] ), $search_criteria ); |
|
| 720 | + if ( array_key_exists( 'status', $search_criteria ) && $search_criteria[ 'status' ] != $entry[ 'status' ] ) { |
|
| 721 | + do_action( 'gravityview_log_debug', sprintf( '[apply_filters_to_entry] Entry status - %s - is not valid according to filter:', $entry[ 'status' ] ), $search_criteria ); |
|
| 722 | 722 | return false; |
| 723 | 723 | } |
| 724 | 724 | |
@@ -726,37 +726,37 @@ discard block |
||
| 726 | 726 | // @todo: Does it make sense to apply the Date create filters to the single entry? |
| 727 | 727 | |
| 728 | 728 | // field_filters |
| 729 | - if ( empty( $search_criteria['field_filters'] ) || ! is_array( $search_criteria['field_filters'] ) ) { |
|
| 729 | + if ( empty( $search_criteria[ 'field_filters' ] ) || ! is_array( $search_criteria[ 'field_filters' ] ) ) { |
|
| 730 | 730 | do_action( 'gravityview_log_debug', '[apply_filters_to_entry] Entry approved! No field filters criteria found:', $search_criteria ); |
| 731 | 731 | return $entry; |
| 732 | 732 | } |
| 733 | 733 | |
| 734 | - $filters = $search_criteria['field_filters']; |
|
| 734 | + $filters = $search_criteria[ 'field_filters' ]; |
|
| 735 | 735 | unset( $search_criteria ); |
| 736 | 736 | |
| 737 | - $mode = array_key_exists( 'mode', $filters ) ? strtolower( $filters['mode'] ) : 'all'; |
|
| 738 | - unset( $filters['mode'] ); |
|
| 737 | + $mode = array_key_exists( 'mode', $filters ) ? strtolower( $filters[ 'mode' ] ) : 'all'; |
|
| 738 | + unset( $filters[ 'mode' ] ); |
|
| 739 | 739 | |
| 740 | - $form = self::get_form( $entry['form_id'] ); |
|
| 740 | + $form = self::get_form( $entry[ 'form_id' ] ); |
|
| 741 | 741 | |
| 742 | 742 | foreach ( $filters as $filter ) { |
| 743 | 743 | |
| 744 | - if ( ! isset( $filter['key'] ) ) { |
|
| 744 | + if ( ! isset( $filter[ 'key' ] ) ) { |
|
| 745 | 745 | continue; |
| 746 | 746 | } |
| 747 | 747 | |
| 748 | - $k = $filter['key']; |
|
| 748 | + $k = $filter[ 'key' ]; |
|
| 749 | 749 | |
| 750 | 750 | if ( in_array( $k, array( 'created_by', 'payment_status' ) ) ) { |
| 751 | 751 | $field_value = $entry[ $k ]; |
| 752 | 752 | $field = null; |
| 753 | 753 | } else { |
| 754 | 754 | $field = self::get_field( $form, $k ); |
| 755 | - $field_value = GFFormsModel::get_lead_field_value( $entry, $field ); |
|
| 755 | + $field_value = GFFormsModel::get_lead_field_value( $entry, $field ); |
|
| 756 | 756 | } |
| 757 | 757 | |
| 758 | - $operator = isset( $filter['operator'] ) ? strtolower( $filter['operator'] ) : 'is'; |
|
| 759 | - $is_value_match = GFFormsModel::is_value_match( $field_value, $filter['value'], $operator, $field ); |
|
| 758 | + $operator = isset( $filter[ 'operator' ] ) ? strtolower( $filter[ 'operator' ] ) : 'is'; |
|
| 759 | + $is_value_match = GFFormsModel::is_value_match( $field_value, $filter[ 'value' ], $operator, $field ); |
|
| 760 | 760 | |
| 761 | 761 | // verify if we are already free to go! |
| 762 | 762 | if ( ! $is_value_match && 'all' === $mode ) { |
@@ -814,18 +814,18 @@ discard block |
||
| 814 | 814 | * Gravity Forms code to adjust date to locally-configured Time Zone |
| 815 | 815 | * @see GFCommon::format_date() for original code |
| 816 | 816 | */ |
| 817 | - $date_gmt_time = mysql2date( 'G', $date_string ); |
|
| 817 | + $date_gmt_time = mysql2date( 'G', $date_string ); |
|
| 818 | 818 | $date_local_timestamp = GFCommon::get_local_timestamp( $date_gmt_time ); |
| 819 | 819 | |
| 820 | - $format = rgar( $atts, 'format' ); |
|
| 821 | - $is_human = ! empty( $atts['human'] ); |
|
| 822 | - $is_diff = ! empty( $atts['diff'] ); |
|
| 823 | - $is_raw = ! empty( $atts['raw'] ); |
|
| 824 | - $is_timestamp = ! empty( $atts['timestamp'] ); |
|
| 825 | - $include_time = ! empty( $atts['time'] ); |
|
| 820 | + $format = rgar( $atts, 'format' ); |
|
| 821 | + $is_human = ! empty( $atts[ 'human' ] ); |
|
| 822 | + $is_diff = ! empty( $atts[ 'diff' ] ); |
|
| 823 | + $is_raw = ! empty( $atts[ 'raw' ] ); |
|
| 824 | + $is_timestamp = ! empty( $atts[ 'timestamp' ] ); |
|
| 825 | + $include_time = ! empty( $atts[ 'time' ] ); |
|
| 826 | 826 | |
| 827 | 827 | // If we're using time diff, we want to have a different default format |
| 828 | - if( empty( $format ) ) { |
|
| 828 | + if ( empty( $format ) ) { |
|
| 829 | 829 | /* translators: %s: relative time from now, used for generic date comparisons. "1 day ago", or "20 seconds ago" */ |
| 830 | 830 | $format = $is_diff ? esc_html__( '%s ago', 'gravityview' ) : get_option( 'date_format' ); |
| 831 | 831 | } |
@@ -833,7 +833,7 @@ discard block |
||
| 833 | 833 | // If raw was specified, don't modify the stored value |
| 834 | 834 | if ( $is_raw ) { |
| 835 | 835 | $formatted_date = $date_string; |
| 836 | - } elseif( $is_timestamp ) { |
|
| 836 | + } elseif ( $is_timestamp ) { |
|
| 837 | 837 | $formatted_date = $date_local_timestamp; |
| 838 | 838 | } elseif ( $is_diff ) { |
| 839 | 839 | $formatted_date = sprintf( $format, human_time_diff( $date_gmt_time ) ); |
@@ -867,7 +867,7 @@ discard block |
||
| 867 | 867 | |
| 868 | 868 | $label = rgar( $field, 'label' ); |
| 869 | 869 | |
| 870 | - if( floor( $field_id ) !== floatval( $field_id ) ) { |
|
| 870 | + if ( floor( $field_id ) !== floatval( $field_id ) ) { |
|
| 871 | 871 | $label = GFFormsModel::get_choice_text( $field, $field_value, $field_id ); |
| 872 | 872 | } |
| 873 | 873 | |
@@ -888,7 +888,7 @@ discard block |
||
| 888 | 888 | * @return GF_Field|null Gravity Forms field object, or NULL: Gravity Forms GFFormsModel does not exist or field at $field_id doesn't exist. |
| 889 | 889 | */ |
| 890 | 890 | public static function get_field( $form, $field_id ) { |
| 891 | - if ( class_exists( 'GFFormsModel' ) ){ |
|
| 891 | + if ( class_exists( 'GFFormsModel' ) ) { |
|
| 892 | 892 | return GFFormsModel::get_field( $form, $field_id ); |
| 893 | 893 | } else { |
| 894 | 894 | return null; |
@@ -935,19 +935,19 @@ discard block |
||
| 935 | 935 | $shortcodes = array(); |
| 936 | 936 | |
| 937 | 937 | preg_match_all( '/' . get_shortcode_regex() . '/s', $content, $matches, PREG_SET_ORDER ); |
| 938 | - if ( empty( $matches ) ){ |
|
| 938 | + if ( empty( $matches ) ) { |
|
| 939 | 939 | return false; |
| 940 | 940 | } |
| 941 | 941 | |
| 942 | 942 | foreach ( $matches as $shortcode ) { |
| 943 | - if ( $tag === $shortcode[2] ) { |
|
| 943 | + if ( $tag === $shortcode[ 2 ] ) { |
|
| 944 | 944 | |
| 945 | 945 | // Changed this to $shortcode instead of true so we get the parsed atts. |
| 946 | - $shortcodes[] = $shortcode; |
|
| 946 | + $shortcodes[ ] = $shortcode; |
|
| 947 | 947 | |
| 948 | - } else if ( isset( $shortcode[5] ) && $results = self::has_shortcode_r( $shortcode[5], $tag ) ) { |
|
| 949 | - foreach( $results as $result ) { |
|
| 950 | - $shortcodes[] = $result; |
|
| 948 | + } else if ( isset( $shortcode[ 5 ] ) && $results = self::has_shortcode_r( $shortcode[ 5 ], $tag ) ) { |
|
| 949 | + foreach ( $results as $result ) { |
|
| 950 | + $shortcodes[ ] = $result; |
|
| 951 | 951 | } |
| 952 | 952 | } |
| 953 | 953 | } |
@@ -1108,7 +1108,7 @@ discard block |
||
| 1108 | 1108 | * @return string html |
| 1109 | 1109 | */ |
| 1110 | 1110 | public static function get_sortable_fields( $formid, $current = '' ) { |
| 1111 | - $output = '<option value="" ' . selected( '', $current, false ).'>' . esc_html__( 'Default', 'gravityview' ) .'</option>'; |
|
| 1111 | + $output = '<option value="" ' . selected( '', $current, false ) . '>' . esc_html__( 'Default', 'gravityview' ) . '</option>'; |
|
| 1112 | 1112 | |
| 1113 | 1113 | if ( empty( $formid ) ) { |
| 1114 | 1114 | return $output; |
@@ -1121,11 +1121,11 @@ discard block |
||
| 1121 | 1121 | $blacklist_field_types = apply_filters( 'gravityview_blacklist_field_types', array( 'list', 'textarea' ), null ); |
| 1122 | 1122 | |
| 1123 | 1123 | foreach ( $fields as $id => $field ) { |
| 1124 | - if ( in_array( $field['type'], $blacklist_field_types ) ) { |
|
| 1124 | + if ( in_array( $field[ 'type' ], $blacklist_field_types ) ) { |
|
| 1125 | 1125 | continue; |
| 1126 | 1126 | } |
| 1127 | 1127 | |
| 1128 | - $output .= '<option value="'. $id .'" '. selected( $id, $current, false ).'>'. esc_attr( $field['label'] ) .'</option>'; |
|
| 1128 | + $output .= '<option value="' . $id . '" ' . selected( $id, $current, false ) . '>' . esc_attr( $field[ 'label' ] ) . '</option>'; |
|
| 1129 | 1129 | } |
| 1130 | 1130 | } |
| 1131 | 1131 | |
@@ -1160,9 +1160,9 @@ discard block |
||
| 1160 | 1160 | $blacklist_field_types = apply_filters( 'gravityview_blacklist_field_types', $blacklist, NULL ); |
| 1161 | 1161 | |
| 1162 | 1162 | // TODO: Convert to using array_filter |
| 1163 | - foreach( $fields as $id => $field ) { |
|
| 1163 | + foreach ( $fields as $id => $field ) { |
|
| 1164 | 1164 | |
| 1165 | - if( in_array( $field['type'], $blacklist_field_types ) ) { |
|
| 1165 | + if ( in_array( $field[ 'type' ], $blacklist_field_types ) ) { |
|
| 1166 | 1166 | unset( $fields[ $id ] ); |
| 1167 | 1167 | } |
| 1168 | 1168 | } |
@@ -1203,14 +1203,14 @@ discard block |
||
| 1203 | 1203 | * @param int|array $field field key or field array |
| 1204 | 1204 | * @return boolean |
| 1205 | 1205 | */ |
| 1206 | - public static function is_field_numeric( $form = null, $field = '' ) { |
|
| 1206 | + public static function is_field_numeric( $form = null, $field = '' ) { |
|
| 1207 | 1207 | |
| 1208 | 1208 | if ( ! is_array( $form ) && ! is_array( $field ) ) { |
| 1209 | 1209 | $form = self::get_form( $form ); |
| 1210 | 1210 | } |
| 1211 | 1211 | |
| 1212 | 1212 | // If entry meta, it's a string. Otherwise, numeric |
| 1213 | - if( ! is_numeric( $field ) && is_string( $field ) ) { |
|
| 1213 | + if ( ! is_numeric( $field ) && is_string( $field ) ) { |
|
| 1214 | 1214 | $type = $field; |
| 1215 | 1215 | } else { |
| 1216 | 1216 | $type = self::get_field_type( $form, $field ); |
@@ -1224,9 +1224,9 @@ discard block |
||
| 1224 | 1224 | $numeric_types = apply_filters( 'gravityview/common/numeric_types', array( 'number', 'time' ) ); |
| 1225 | 1225 | |
| 1226 | 1226 | // Defer to GravityView_Field setting, if the field type is registered and `is_numeric` is true |
| 1227 | - if( $gv_field = GravityView_Fields::get( $type ) ) { |
|
| 1228 | - if( true === $gv_field->is_numeric ) { |
|
| 1229 | - $numeric_types[] = $gv_field->is_numeric; |
|
| 1227 | + if ( $gv_field = GravityView_Fields::get( $type ) ) { |
|
| 1228 | + if ( true === $gv_field->is_numeric ) { |
|
| 1229 | + $numeric_types[ ] = $gv_field->is_numeric; |
|
| 1230 | 1230 | } |
| 1231 | 1231 | } |
| 1232 | 1232 | |
@@ -1376,11 +1376,11 @@ discard block |
||
| 1376 | 1376 | $final_atts = array_filter( $final_atts ); |
| 1377 | 1377 | |
| 1378 | 1378 | // If the href wasn't passed as an attribute, use the value passed to the function |
| 1379 | - if ( empty( $final_atts['href'] ) && ! empty( $href ) ) { |
|
| 1380 | - $final_atts['href'] = $href; |
|
| 1379 | + if ( empty( $final_atts[ 'href' ] ) && ! empty( $href ) ) { |
|
| 1380 | + $final_atts[ 'href' ] = $href; |
|
| 1381 | 1381 | } |
| 1382 | 1382 | |
| 1383 | - $final_atts['href'] = esc_url_raw( $href ); |
|
| 1383 | + $final_atts[ 'href' ] = esc_url_raw( $href ); |
|
| 1384 | 1384 | |
| 1385 | 1385 | // Sort the attributes alphabetically, to help testing |
| 1386 | 1386 | ksort( $final_atts ); |
@@ -1391,7 +1391,7 @@ discard block |
||
| 1391 | 1391 | $output .= sprintf( ' %s="%s"', $attr, esc_attr( $value ) ); |
| 1392 | 1392 | } |
| 1393 | 1393 | |
| 1394 | - if( '' !== $output ) { |
|
| 1394 | + if ( '' !== $output ) { |
|
| 1395 | 1395 | $output = '<a' . $output . '>' . $anchor_text . '</a>'; |
| 1396 | 1396 | } |
| 1397 | 1397 | |
@@ -1418,7 +1418,7 @@ discard block |
||
| 1418 | 1418 | if ( is_array( $value ) && isset( $merged[ $key ] ) && is_array( $merged[ $key ] ) ) { |
| 1419 | 1419 | $merged[ $key ] = self::array_merge_recursive_distinct( $merged[ $key ], $value ); |
| 1420 | 1420 | } else if ( is_numeric( $key ) && isset( $merged[ $key ] ) ) { |
| 1421 | - $merged[] = $value; |
|
| 1421 | + $merged[ ] = $value; |
|
| 1422 | 1422 | } else { |
| 1423 | 1423 | $merged[ $key ] = $value; |
| 1424 | 1424 | } |
@@ -1451,7 +1451,7 @@ discard block |
||
| 1451 | 1451 | * `$context` is where are we using this information (e.g. change_entry_creator, search_widget ..) |
| 1452 | 1452 | * @param array $settings Settings array, with `number` key defining the # of users to display |
| 1453 | 1453 | */ |
| 1454 | - $get_users_settings = apply_filters( 'gravityview/get_users/'. $context, apply_filters( 'gravityview_change_entry_creator_user_parameters', $get_users_settings ) ); |
|
| 1454 | + $get_users_settings = apply_filters( 'gravityview/get_users/' . $context, apply_filters( 'gravityview_change_entry_creator_user_parameters', $get_users_settings ) ); |
|
| 1455 | 1455 | |
| 1456 | 1456 | return get_users( $get_users_settings ); |
| 1457 | 1457 | } |
@@ -1466,7 +1466,7 @@ discard block |
||
| 1466 | 1466 | * @return string |
| 1467 | 1467 | */ |
| 1468 | 1468 | public static function generate_notice( $notice, $class = '' ) { |
| 1469 | - return '<div class="gv-notice '.gravityview_sanitize_html_class( $class ) .'">'. $notice .'</div>'; |
|
| 1469 | + return '<div class="gv-notice ' . gravityview_sanitize_html_class( $class ) . '">' . $notice . '</div>'; |
|
| 1470 | 1470 | } |
| 1471 | 1471 | |
| 1472 | 1472 | /** |
@@ -262,7 +262,7 @@ discard block |
||
| 262 | 262 | } |
| 263 | 263 | |
| 264 | 264 | |
| 265 | - if( GFCommon::is_product_field( $field->type ) ){ |
|
| 265 | + if( GFCommon::is_product_field( $field->type ) ) { |
|
| 266 | 266 | $has_product_fields = true; |
| 267 | 267 | } |
| 268 | 268 | |
@@ -322,7 +322,7 @@ discard block |
||
| 322 | 322 | |
| 323 | 323 | $fields = array(); |
| 324 | 324 | |
| 325 | - foreach ( $extra_fields as $key => $field ){ |
|
| 325 | + foreach ( $extra_fields as $key => $field ) { |
|
| 326 | 326 | if ( ! empty( $only_default_column ) && ! empty( $field['is_default_column'] ) ) { |
| 327 | 327 | $fields[ $key ] = array( 'label' => $field['label'], 'type' => 'entry_meta' ); |
| 328 | 328 | } |
@@ -888,7 +888,7 @@ discard block |
||
| 888 | 888 | * @return GF_Field|null Gravity Forms field object, or NULL: Gravity Forms GFFormsModel does not exist or field at $field_id doesn't exist. |
| 889 | 889 | */ |
| 890 | 890 | public static function get_field( $form, $field_id ) { |
| 891 | - if ( class_exists( 'GFFormsModel' ) ){ |
|
| 891 | + if ( class_exists( 'GFFormsModel' ) ) { |
|
| 892 | 892 | return GFFormsModel::get_field( $form, $field_id ); |
| 893 | 893 | } else { |
| 894 | 894 | return null; |
@@ -935,7 +935,7 @@ discard block |
||
| 935 | 935 | $shortcodes = array(); |
| 936 | 936 | |
| 937 | 937 | preg_match_all( '/' . get_shortcode_regex() . '/s', $content, $matches, PREG_SET_ORDER ); |
| 938 | - if ( empty( $matches ) ){ |
|
| 938 | + if ( empty( $matches ) ) { |
|
| 939 | 939 | return false; |
| 940 | 940 | } |
| 941 | 941 | |
@@ -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 | - do_action( 'gravityview_log_debug', __FUNCTION__ . ': Stylesheet override ('. esc_attr( $css_file ) .')' ); |
|
| 37 | + do_action( 'gravityview_log_debug', __FUNCTION__ . ': Stylesheet override (' . 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 | do_action( 'gravityview_log_error', __FUNCTION__ . ': File path does not exist. ', $file_path ); |
| 190 | 190 | return ''; |
| 191 | 191 | } |
@@ -203,7 +203,7 @@ discard block |
||
| 203 | 203 | |
| 204 | 204 | $width = $height * 0.7586206897; |
| 205 | 205 | |
| 206 | - if( function_exists('is_rtl') && is_rtl() ) { |
|
| 206 | + if ( function_exists( 'is_rtl' ) && is_rtl() ) { |
|
| 207 | 207 | $style = 'margin:10px 10px 10px 0;'; |
| 208 | 208 | $class = 'alignright'; |
| 209 | 209 | } else { |
@@ -211,7 +211,7 @@ discard block |
||
| 211 | 211 | $class = 'alignleft'; |
| 212 | 212 | } |
| 213 | 213 | |
| 214 | - return '<img src="'.plugins_url( 'assets/images/astronaut-200x263.png', GRAVITYVIEW_FILE ).'" class="'.$class.'" height="'.intval( $height ).'" width="'.round( $width, 2 ).'" alt="The GravityView Astronaut Says:" style="'.$style.'" />'; |
|
| 214 | + return '<img src="' . plugins_url( 'assets/images/astronaut-200x263.png', GRAVITYVIEW_FILE ) . '" class="' . $class . '" height="' . intval( $height ) . '" width="' . round( $width, 2 ) . '" alt="The GravityView Astronaut Says:" style="' . $style . '" />'; |
|
| 215 | 215 | } |
| 216 | 216 | |
| 217 | 217 | /** |
@@ -234,9 +234,9 @@ discard block |
||
| 234 | 234 | function gravityview_number_format( $number, $decimals = '' ) { |
| 235 | 235 | global $wp_locale; |
| 236 | 236 | |
| 237 | - if( '' === $decimals ) { |
|
| 237 | + if ( '' === $decimals ) { |
|
| 238 | 238 | |
| 239 | - $decimal_point = isset( $wp_locale ) ? $wp_locale->number_format['decimal_point'] : '.'; |
|
| 239 | + $decimal_point = isset( $wp_locale ) ? $wp_locale->number_format[ 'decimal_point' ] : '.'; |
|
| 240 | 240 | |
| 241 | 241 | /** |
| 242 | 242 | * Calculate the position of the decimal point in the number |
@@ -265,7 +265,7 @@ discard block |
||
| 265 | 265 | $parts = parse_url( $value ); |
| 266 | 266 | |
| 267 | 267 | // No domain? Strange...show the original text. |
| 268 | - if( empty( $parts['host'] ) ) { |
|
| 268 | + if ( empty( $parts[ 'host' ] ) ) { |
|
| 269 | 269 | return $value; |
| 270 | 270 | } |
| 271 | 271 | |
@@ -278,16 +278,16 @@ discard block |
||
| 278 | 278 | * @param boolean $enable Whether to strip the scheme. Return false to show scheme. (default: true)\n |
| 279 | 279 | * If true: `http://example.com => example.com` |
| 280 | 280 | */ |
| 281 | - if( false === apply_filters('gravityview_anchor_text_striphttp', true) ) { |
|
| 281 | + if ( false === apply_filters( 'gravityview_anchor_text_striphttp', true ) ) { |
|
| 282 | 282 | |
| 283 | - if( isset( $parts['scheme'] ) ) { |
|
| 284 | - $return .= $parts['scheme']; |
|
| 283 | + if ( isset( $parts[ 'scheme' ] ) ) { |
|
| 284 | + $return .= $parts[ 'scheme' ]; |
|
| 285 | 285 | } |
| 286 | 286 | |
| 287 | 287 | } |
| 288 | 288 | |
| 289 | 289 | // The domain, which may contain a subdomain |
| 290 | - $domain = $parts['host']; |
|
| 290 | + $domain = $parts[ 'host' ]; |
|
| 291 | 291 | |
| 292 | 292 | /** |
| 293 | 293 | * @filter `gravityview_anchor_text_stripwww` Strip www from the domain? |
@@ -295,10 +295,10 @@ discard block |
||
| 295 | 295 | * @param boolean $enable Whether to strip www. Return false to show www. (default: true)\n |
| 296 | 296 | * If true: `www.example.com => example.com` |
| 297 | 297 | */ |
| 298 | - $strip_www = apply_filters('gravityview_anchor_text_stripwww', true ); |
|
| 298 | + $strip_www = apply_filters( 'gravityview_anchor_text_stripwww', true ); |
|
| 299 | 299 | |
| 300 | - if( $strip_www ) { |
|
| 301 | - $domain = str_replace('www.', '', $domain ); |
|
| 300 | + if ( $strip_www ) { |
|
| 301 | + $domain = str_replace( 'www.', '', $domain ); |
|
| 302 | 302 | } |
| 303 | 303 | |
| 304 | 304 | /** |
@@ -308,11 +308,11 @@ discard block |
||
| 308 | 308 | * If true: `http://demo.example.com => example.com` \n |
| 309 | 309 | * If false: `http://demo.example.com => demo.example.com` |
| 310 | 310 | */ |
| 311 | - $strip_subdomains = apply_filters('gravityview_anchor_text_nosubdomain', true); |
|
| 311 | + $strip_subdomains = apply_filters( 'gravityview_anchor_text_nosubdomain', true ); |
|
| 312 | 312 | |
| 313 | - if( $strip_subdomains ) { |
|
| 313 | + if ( $strip_subdomains ) { |
|
| 314 | 314 | |
| 315 | - $domain = _gravityview_strip_subdomain( $parts['host'] ); |
|
| 315 | + $domain = _gravityview_strip_subdomain( $parts[ 'host' ] ); |
|
| 316 | 316 | |
| 317 | 317 | } |
| 318 | 318 | |
@@ -326,12 +326,12 @@ discard block |
||
| 326 | 326 | * If true: `http://example.com/sub/directory/page.html => example.com` \n |
| 327 | 327 | * If false: `http://example.com/sub/directory/page.html => example.com/sub/directory/page.html` |
| 328 | 328 | */ |
| 329 | - $root_only = apply_filters('gravityview_anchor_text_rootonly', true); |
|
| 329 | + $root_only = apply_filters( 'gravityview_anchor_text_rootonly', true ); |
|
| 330 | 330 | |
| 331 | - if( empty( $root_only ) ) { |
|
| 331 | + if ( empty( $root_only ) ) { |
|
| 332 | 332 | |
| 333 | - if( isset( $parts['path'] ) ) { |
|
| 334 | - $return .= $parts['path']; |
|
| 333 | + if ( isset( $parts[ 'path' ] ) ) { |
|
| 334 | + $return .= $parts[ 'path' ]; |
|
| 335 | 335 | } |
| 336 | 336 | } |
| 337 | 337 | |
@@ -341,12 +341,12 @@ discard block |
||
| 341 | 341 | * @param boolean $enable Whether to enable "root only". Return false to show full path. (default: true)\n |
| 342 | 342 | * If true: `http://example.com/?query=example => example.com` |
| 343 | 343 | */ |
| 344 | - $strip_query_string = apply_filters('gravityview_anchor_text_noquerystring', true ); |
|
| 344 | + $strip_query_string = apply_filters( 'gravityview_anchor_text_noquerystring', true ); |
|
| 345 | 345 | |
| 346 | - if( empty( $strip_query_string ) ) { |
|
| 346 | + if ( empty( $strip_query_string ) ) { |
|
| 347 | 347 | |
| 348 | - if( isset( $parts['query'] ) ) { |
|
| 349 | - $return .= '?'.$parts['query']; |
|
| 348 | + if ( isset( $parts[ 'query' ] ) ) { |
|
| 349 | + $return .= '?' . $parts[ 'query' ]; |
|
| 350 | 350 | } |
| 351 | 351 | |
| 352 | 352 | } |
@@ -363,8 +363,8 @@ discard block |
||
| 363 | 363 | */ |
| 364 | 364 | function _gravityview_strip_subdomain( $string_maybe_has_subdomain ) { |
| 365 | 365 | |
| 366 | - 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 ) ) { |
|
| 367 | - return $matches['domain']; |
|
| 366 | + 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 ) ) { |
|
| 367 | + return $matches[ 'domain' ]; |
|
| 368 | 368 | } else { |
| 369 | 369 | return $string_maybe_has_subdomain; |
| 370 | 370 | } |
@@ -385,7 +385,7 @@ discard block |
||
| 385 | 385 | */ |
| 386 | 386 | function gv_empty( $value, $zero_is_empty = true, $allow_string_booleans = true ) { |
| 387 | 387 | |
| 388 | - if( |
|
| 388 | + if ( |
|
| 389 | 389 | ! isset( $value ) // If it's not set, it's empty! |
| 390 | 390 | || false === $value |
| 391 | 391 | || null === $value |
@@ -396,20 +396,20 @@ discard block |
||
| 396 | 396 | return true; |
| 397 | 397 | } |
| 398 | 398 | |
| 399 | - if( is_string( $value ) && $allow_string_booleans ) { |
|
| 399 | + if ( is_string( $value ) && $allow_string_booleans ) { |
|
| 400 | 400 | |
| 401 | 401 | $value = trim( $value ); |
| 402 | 402 | $value = strtolower( $value ); |
| 403 | 403 | |
| 404 | 404 | if ( in_array( $value, array( 'yes', 'true' ), true ) ) { |
| 405 | 405 | $value = true; |
| 406 | - } else if( in_array( $value, array( 'no', 'false' ), true ) ) { |
|
| 406 | + } else if ( in_array( $value, array( 'no', 'false' ), true ) ) { |
|
| 407 | 407 | $value = false; |
| 408 | 408 | } |
| 409 | 409 | } |
| 410 | 410 | |
| 411 | 411 | // If zero isn't empty, then if $value is a number and it's empty, it's zero. Thus, return false. |
| 412 | - if( ! $zero_is_empty && is_numeric( $value ) && empty( $value ) ) { |
|
| 412 | + if ( ! $zero_is_empty && is_numeric( $value ) && empty( $value ) ) { |
|
| 413 | 413 | return false; |
| 414 | 414 | } |
| 415 | 415 | |
@@ -432,7 +432,7 @@ discard block |
||
| 432 | 432 | |
| 433 | 433 | // Use the original function, if exists. |
| 434 | 434 | // Requires WP 4.4+ |
| 435 | - if( function_exists( 'map_deep') ) { |
|
| 435 | + if ( function_exists( 'map_deep' ) ) { |
|
| 436 | 436 | return map_deep( $value, $callback ); |
| 437 | 437 | } |
| 438 | 438 | |
@@ -497,7 +497,7 @@ discard block |
||
| 497 | 497 | |
| 498 | 498 | $exploded = explode( '.', "{$field_id}" ); |
| 499 | 499 | |
| 500 | - return isset( $exploded[1] ) ? intval( $exploded[1] ) : false; |
|
| 500 | + return isset( $exploded[ 1 ] ) ? intval( $exploded[ 1 ] ) : false; |
|
| 501 | 501 | } |
| 502 | 502 | |
| 503 | 503 | /** |
@@ -538,13 +538,13 @@ discard block |
||
| 538 | 538 | */ |
| 539 | 539 | $args = apply_filters( 'gravityview_get_terms_choices_args', $args ); |
| 540 | 540 | |
| 541 | - $terms = get_terms( $args['taxonomy'], $args ); |
|
| 541 | + $terms = get_terms( $args[ 'taxonomy' ], $args ); |
|
| 542 | 542 | |
| 543 | 543 | $choices = array(); |
| 544 | 544 | |
| 545 | 545 | if ( is_array( $terms ) ) { |
| 546 | 546 | foreach ( $terms as $term_id => $term_name ) { |
| 547 | - $choices[] = array( |
|
| 547 | + $choices[ ] = array( |
|
| 548 | 548 | 'text' => $term_name, |
| 549 | 549 | 'value' => $term_id |
| 550 | 550 | ); |
@@ -568,21 +568,21 @@ discard block |
||
| 568 | 568 | function _gravityview_process_posted_fields() { |
| 569 | 569 | $fields = array(); |
| 570 | 570 | |
| 571 | - if( !empty( $_POST['gv_fields'] ) ) { |
|
| 572 | - if ( ! is_array( $_POST['gv_fields'] ) ) { |
|
| 571 | + if ( ! empty( $_POST[ 'gv_fields' ] ) ) { |
|
| 572 | + if ( ! is_array( $_POST[ 'gv_fields' ] ) ) { |
|
| 573 | 573 | |
| 574 | 574 | // We are not using parse_str() due to max_input_vars limitation with large View configurations |
| 575 | 575 | $fields_holder = array(); |
| 576 | - GVCommon::gv_parse_str( $_POST['gv_fields'], $fields_holder ); |
|
| 576 | + GVCommon::gv_parse_str( $_POST[ 'gv_fields' ], $fields_holder ); |
|
| 577 | 577 | |
| 578 | - if ( isset( $fields_holder['fields'] ) ) { |
|
| 579 | - $fields = $fields_holder['fields']; |
|
| 578 | + if ( isset( $fields_holder[ 'fields' ] ) ) { |
|
| 579 | + $fields = $fields_holder[ 'fields' ]; |
|
| 580 | 580 | } else { |
| 581 | 581 | do_action( 'gravityview_log_error', '[save_postdata] No `fields` key was found after parsing $fields string', $fields_holder ); |
| 582 | 582 | } |
| 583 | 583 | |
| 584 | 584 | } else { |
| 585 | - $fields = $_POST['gv_fields']; |
|
| 585 | + $fields = $_POST[ 'gv_fields' ]; |
|
| 586 | 586 | } |
| 587 | 587 | } |
| 588 | 588 | |