@@ -20,16 +20,16 @@ discard block |
||
| 20 | 20 | |
| 21 | 21 | function field_options( $field_options, $template_id, $field_id, $context, $input_type ) { |
| 22 | 22 | |
| 23 | - unset( $field_options['search_filter'] ); |
|
| 23 | + unset( $field_options[ 'search_filter' ] ); |
|
| 24 | 24 | |
| 25 | - if( 'edit' === $context ) { |
|
| 25 | + if ( 'edit' === $context ) { |
|
| 26 | 26 | return $field_options; |
| 27 | 27 | } |
| 28 | 28 | |
| 29 | - $add_options['link_to_file'] = array( |
|
| 29 | + $add_options[ 'link_to_file' ] = array( |
|
| 30 | 30 | 'type' => 'checkbox', |
| 31 | 31 | 'label' => __( 'Display as a Link:', 'gravityview' ), |
| 32 | - 'desc' => __('Display the uploaded files as links, rather than embedded content.', 'gravityview'), |
|
| 32 | + 'desc' => __( 'Display the uploaded files as links, rather than embedded content.', 'gravityview' ), |
|
| 33 | 33 | 'value' => false, |
| 34 | 34 | 'merge_tags' => false, |
| 35 | 35 | ); |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | $output_arr = array(); |
| 66 | 66 | |
| 67 | 67 | // Get an array of file paths for the field. |
| 68 | - $file_paths = rgar( $field , 'multipleFiles' ) ? json_decode( $value ) : array( $value ); |
|
| 68 | + $file_paths = rgar( $field, 'multipleFiles' ) ? json_decode( $value ) : array( $value ); |
|
| 69 | 69 | |
| 70 | 70 | // The $value JSON was probably truncated; let's check lead_detail_long. |
| 71 | 71 | if ( ! is_array( $file_paths ) ) { |
@@ -79,19 +79,19 @@ discard block |
||
| 79 | 79 | } |
| 80 | 80 | |
| 81 | 81 | // Process each file path |
| 82 | - foreach( $file_paths as $file_path ) { |
|
| 82 | + foreach ( $file_paths as $file_path ) { |
|
| 83 | 83 | |
| 84 | 84 | // If the site is HTTPS, use HTTPS |
| 85 | - if(function_exists('set_url_scheme')) { $file_path = set_url_scheme($file_path); } |
|
| 85 | + if ( function_exists( 'set_url_scheme' ) ) { $file_path = set_url_scheme( $file_path ); } |
|
| 86 | 86 | |
| 87 | 87 | // This is from Gravity Forms's code |
| 88 | - $file_path = esc_attr(str_replace(" ", "%20", $file_path)); |
|
| 88 | + $file_path = esc_attr( str_replace( " ", "%20", $file_path ) ); |
|
| 89 | 89 | |
| 90 | 90 | // If the field is set to link to the single entry, link to it. |
| 91 | - $link = !empty( $field_settings['show_as_link'] ) ? GravityView_API::entry_link( $entry, $field ) : $file_path; |
|
| 91 | + $link = ! empty( $field_settings[ 'show_as_link' ] ) ? GravityView_API::entry_link( $entry, $field ) : $file_path; |
|
| 92 | 92 | |
| 93 | 93 | // Get file path information |
| 94 | - $file_path_info = pathinfo($file_path); |
|
| 94 | + $file_path_info = pathinfo( $file_path ); |
|
| 95 | 95 | |
| 96 | 96 | $html_format = NULL; |
| 97 | 97 | |
@@ -100,30 +100,30 @@ discard block |
||
| 100 | 100 | $disable_wrapped_link = false; |
| 101 | 101 | |
| 102 | 102 | // Is this an image? |
| 103 | - $image = new GravityView_Image(array( |
|
| 103 | + $image = new GravityView_Image( array( |
|
| 104 | 104 | 'src' => $file_path, |
| 105 | - 'class' => 'gv-image gv-field-id-'.$field_settings['id'], |
|
| 106 | - 'alt' => $field_settings['label'], |
|
| 107 | - 'width' => (gravityview_get_context() === 'single' ? NULL : 250) |
|
| 108 | - )); |
|
| 105 | + 'class' => 'gv-image gv-field-id-' . $field_settings[ 'id' ], |
|
| 106 | + 'alt' => $field_settings[ 'label' ], |
|
| 107 | + 'width' => ( gravityview_get_context() === 'single' ? NULL : 250 ) |
|
| 108 | + ) ); |
|
| 109 | 109 | |
| 110 | 110 | $content = $image->html(); |
| 111 | 111 | |
| 112 | 112 | // The new default content is the image, if it exists. If not, use the file name as the content. |
| 113 | - $content = !empty( $content ) ? $content : $file_path_info['basename']; |
|
| 113 | + $content = ! empty( $content ) ? $content : $file_path_info[ 'basename' ]; |
|
| 114 | 114 | |
| 115 | 115 | // If pathinfo() gave us the extension of the file, run the switch statement using that. |
| 116 | - $extension = empty( $file_path_info['extension'] ) ? NULL : strtolower( $file_path_info['extension'] ); |
|
| 116 | + $extension = empty( $file_path_info[ 'extension' ] ) ? NULL : strtolower( $file_path_info[ 'extension' ] ); |
|
| 117 | 117 | |
| 118 | 118 | |
| 119 | - switch( true ) { |
|
| 119 | + switch ( true ) { |
|
| 120 | 120 | |
| 121 | 121 | // Audio file |
| 122 | 122 | case in_array( $extension, wp_get_audio_extensions() ): |
| 123 | 123 | |
| 124 | 124 | $disable_lightbox = true; |
| 125 | 125 | |
| 126 | - if( shortcode_exists( 'audio' ) ) { |
|
| 126 | + if ( shortcode_exists( 'audio' ) ) { |
|
| 127 | 127 | |
| 128 | 128 | $disable_wrapped_link = true; |
| 129 | 129 | |
@@ -134,8 +134,8 @@ discard block |
||
| 134 | 134 | */ |
| 135 | 135 | $audio_settings = apply_filters( 'gravityview_audio_settings', array( |
| 136 | 136 | 'src' => $file_path, |
| 137 | - 'class' => 'wp-audio-shortcode gv-audio gv-field-id-'.$field_settings['id'] |
|
| 138 | - )); |
|
| 137 | + 'class' => 'wp-audio-shortcode gv-audio gv-field-id-' . $field_settings[ 'id' ] |
|
| 138 | + ) ); |
|
| 139 | 139 | |
| 140 | 140 | /** |
| 141 | 141 | * Generate the audio shortcode |
@@ -153,7 +153,7 @@ discard block |
||
| 153 | 153 | |
| 154 | 154 | $disable_lightbox = true; |
| 155 | 155 | |
| 156 | - if( shortcode_exists( 'video' ) ) { |
|
| 156 | + if ( shortcode_exists( 'video' ) ) { |
|
| 157 | 157 | |
| 158 | 158 | $disable_wrapped_link = true; |
| 159 | 159 | |
@@ -164,8 +164,8 @@ discard block |
||
| 164 | 164 | */ |
| 165 | 165 | $video_settings = apply_filters( 'gravityview_video_settings', array( |
| 166 | 166 | 'src' => $file_path, |
| 167 | - 'class' => 'wp-video-shortcode gv-video gv-field-id-'.$field_settings['id'] |
|
| 168 | - )); |
|
| 167 | + 'class' => 'wp-video-shortcode gv-video gv-field-id-' . $field_settings[ 'id' ] |
|
| 168 | + ) ); |
|
| 169 | 169 | |
| 170 | 170 | /** |
| 171 | 171 | * Generate the video shortcode |
@@ -187,7 +187,7 @@ discard block |
||
| 187 | 187 | break; |
| 188 | 188 | |
| 189 | 189 | // if not image, do not set the lightbox (@since 1.5.3) |
| 190 | - case !in_array( $extension, array( 'jpg', 'jpeg', 'jpe', 'gif', 'png' ) ): |
|
| 190 | + case ! in_array( $extension, array( 'jpg', 'jpeg', 'jpe', 'gif', 'png' ) ): |
|
| 191 | 191 | |
| 192 | 192 | $disable_lightbox = true; |
| 193 | 193 | |
@@ -197,10 +197,10 @@ discard block |
||
| 197 | 197 | |
| 198 | 198 | // If using Link to File, override the content. |
| 199 | 199 | // (We do this here so that the $disable_lightbox can be set. Yes, there's a little more processing time, but oh well.) |
| 200 | - if( !empty( $field_settings['link_to_file'] ) ) { |
|
| 200 | + if ( ! empty( $field_settings[ 'link_to_file' ] ) ) { |
|
| 201 | 201 | |
| 202 | 202 | // Force the content to be the file name |
| 203 | - $content = $file_path_info["basename"]; |
|
| 203 | + $content = $file_path_info[ "basename" ]; |
|
| 204 | 204 | |
| 205 | 205 | // Restore the wrapped link |
| 206 | 206 | $disable_wrapped_link = false; |
@@ -208,13 +208,13 @@ discard block |
||
| 208 | 208 | } |
| 209 | 209 | |
| 210 | 210 | // Whether to use lightbox or not |
| 211 | - if( $disable_lightbox || empty( $gravityview_view->atts['lightbox'] ) || !empty( $field_settings['show_as_link'] ) ) { |
|
| 211 | + if ( $disable_lightbox || empty( $gravityview_view->atts[ 'lightbox' ] ) || ! empty( $field_settings[ 'show_as_link' ] ) ) { |
|
| 212 | 212 | |
| 213 | - $link_atts = empty( $field_settings['show_as_link'] ) ? array( 'target' => '_blank' ) : array(); |
|
| 213 | + $link_atts = empty( $field_settings[ 'show_as_link' ] ) ? array( 'target' => '_blank' ) : array(); |
|
| 214 | 214 | |
| 215 | 215 | } else { |
| 216 | 216 | |
| 217 | - $entry_slug = GravityView_API::get_entry_slug( $entry['id'], $entry ); |
|
| 217 | + $entry_slug = GravityView_API::get_entry_slug( $entry[ 'id' ], $entry ); |
|
| 218 | 218 | |
| 219 | 219 | $link_atts = array( |
| 220 | 220 | 'rel' => sprintf( "%s-%s", $gv_class, $entry_slug ), |
@@ -240,7 +240,7 @@ discard block |
||
| 240 | 240 | $disable_wrapped_link = apply_filters( 'gravityview/fields/fileupload/disable_link', $disable_wrapped_link, $gravityview_view->getCurrentField() ); |
| 241 | 241 | |
| 242 | 242 | // If the HTML output hasn't been overridden by the switch statement above, use the default format |
| 243 | - if( !empty( $content ) && empty( $disable_wrapped_link ) ) { |
|
| 243 | + if ( ! empty( $content ) && empty( $disable_wrapped_link ) ) { |
|
| 244 | 244 | |
| 245 | 245 | /** |
| 246 | 246 | * Modify the link text (defaults to the file name) |
@@ -255,7 +255,7 @@ discard block |
||
| 255 | 255 | $content = gravityview_get_link( $link, $content, $link_atts ); |
| 256 | 256 | } |
| 257 | 257 | |
| 258 | - $output_arr[] = array( |
|
| 258 | + $output_arr[ ] = array( |
|
| 259 | 259 | 'file_path' => $file_path, |
| 260 | 260 | 'content' => $content |
| 261 | 261 | ); |
@@ -221,11 +221,11 @@ discard block |
||
| 221 | 221 | * |
| 222 | 222 | * If the user doesn't have the `gravityview_support_port` capability, returns false; then |
| 223 | 223 | * If global setting is "hide", returns false; then |
| 224 | - * If user preference is not set, return global setting; then |
|
| 225 | - * If user preference is set, return that setting. |
|
| 224 | + * If user preference is not set, return global setting; then |
|
| 225 | + * If user preference is set, return that setting. |
|
| 226 | 226 | * |
| 227 | 227 | * @since 1.15 |
| 228 | - * @since 1.17.5 Changed behavior to respect global setting |
|
| 228 | + * @since 1.17.5 Changed behavior to respect global setting |
|
| 229 | 229 | * |
| 230 | 230 | * @param int $user Optional. ID of the user to check, defaults to 0 for current user. |
| 231 | 231 | * |
@@ -240,7 +240,7 @@ discard block |
||
| 240 | 240 | $global_setting = GravityView_Settings::getSetting( 'support_port' ); |
| 241 | 241 | |
| 242 | 242 | if ( empty( $global_setting ) ) { |
| 243 | - return false; |
|
| 243 | + return false; |
|
| 244 | 244 | } |
| 245 | 245 | |
| 246 | 246 | // Get the per-user Support Port setting |
@@ -276,7 +276,7 @@ discard block |
||
| 276 | 276 | * Modifies the output of profile.php to add GravityView Support preference |
| 277 | 277 | * |
| 278 | 278 | * @since 1.15 |
| 279 | - * @since 1.17.5 Only show if global setting is active |
|
| 279 | + * @since 1.17.5 Only show if global setting is active |
|
| 280 | 280 | * |
| 281 | 281 | * @param WP_User $user Current user info |
| 282 | 282 | * |
@@ -287,7 +287,7 @@ discard block |
||
| 287 | 287 | $global_setting = GravityView_Settings::getSetting( 'support_port' ); |
| 288 | 288 | |
| 289 | 289 | if ( empty( $global_setting ) ) { |
| 290 | - return; |
|
| 290 | + return; |
|
| 291 | 291 | } |
| 292 | 292 | |
| 293 | 293 | /** |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | 'type' => 'radio', |
| 64 | 64 | 'full_width' => true, |
| 65 | 65 | 'label' => esc_html__( 'Search Mode', 'gravityview' ), |
| 66 | - 'desc' => __('Should search results match all search fields, or any?', 'gravityview'), |
|
| 66 | + 'desc' => __( 'Should search results match all search fields, or any?', 'gravityview' ), |
|
| 67 | 67 | 'value' => 'any', |
| 68 | 68 | 'class' => 'hide-if-js', |
| 69 | 69 | 'options' => array( |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | |
| 86 | 86 | // admin - add scripts - run at 1100 to make sure GravityView_Admin_Views::add_scripts_and_styles() runs first at 999 |
| 87 | 87 | add_action( 'admin_enqueue_scripts', array( $this, 'add_scripts_and_styles' ), 1100 ); |
| 88 | - add_action( 'wp_enqueue_scripts', array( $this, 'register_scripts') ); |
|
| 88 | + add_action( 'wp_enqueue_scripts', array( $this, 'register_scripts' ) ); |
|
| 89 | 89 | add_filter( 'gravityview_noconflict_scripts', array( $this, 'register_no_conflict' ) ); |
| 90 | 90 | |
| 91 | 91 | // ajax - get the searchable fields |
@@ -212,7 +212,7 @@ discard block |
||
| 212 | 212 | $script_min = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
| 213 | 213 | $script_source = empty( $script_min ) ? '/source' : ''; |
| 214 | 214 | |
| 215 | - wp_enqueue_script( 'gravityview_searchwidget_admin', plugins_url( 'assets/js'.$script_source.'/admin-search-widget'.$script_min.'.js', __FILE__ ), array( 'jquery', 'gravityview_views_scripts' ), GravityView_Plugin::version ); |
|
| 215 | + wp_enqueue_script( 'gravityview_searchwidget_admin', plugins_url( 'assets/js' . $script_source . '/admin-search-widget' . $script_min . '.js', __FILE__ ), array( 'jquery', 'gravityview_views_scripts' ), GravityView_Plugin::version ); |
|
| 216 | 216 | |
| 217 | 217 | wp_localize_script( 'gravityview_searchwidget_admin', 'gvSearchVar', array( |
| 218 | 218 | 'nonce' => wp_create_nonce( 'gravityview_ajaxsearchwidget' ), |
@@ -234,7 +234,7 @@ discard block |
||
| 234 | 234 | * @return array Scripts allowed in no-conflict mode, plus the search widget script |
| 235 | 235 | */ |
| 236 | 236 | public function register_no_conflict( $allowed ) { |
| 237 | - $allowed[] = 'gravityview_searchwidget_admin'; |
|
| 237 | + $allowed[ ] = 'gravityview_searchwidget_admin'; |
|
| 238 | 238 | return $allowed; |
| 239 | 239 | } |
| 240 | 240 | |
@@ -247,24 +247,24 @@ discard block |
||
| 247 | 247 | */ |
| 248 | 248 | public static function get_searchable_fields() { |
| 249 | 249 | |
| 250 | - if ( ! isset( $_POST['nonce'] ) || ! wp_verify_nonce( $_POST['nonce'], 'gravityview_ajaxsearchwidget' ) ) { |
|
| 250 | + if ( ! isset( $_POST[ 'nonce' ] ) || ! wp_verify_nonce( $_POST[ 'nonce' ], 'gravityview_ajaxsearchwidget' ) ) { |
|
| 251 | 251 | exit( '0' ); |
| 252 | 252 | } |
| 253 | 253 | |
| 254 | 254 | $form = ''; |
| 255 | 255 | |
| 256 | 256 | // Fetch the form for the current View |
| 257 | - if ( ! empty( $_POST['view_id'] ) ) { |
|
| 257 | + if ( ! empty( $_POST[ 'view_id' ] ) ) { |
|
| 258 | 258 | |
| 259 | - $form = gravityview_get_form_id( $_POST['view_id'] ); |
|
| 259 | + $form = gravityview_get_form_id( $_POST[ 'view_id' ] ); |
|
| 260 | 260 | |
| 261 | - } elseif ( ! empty( $_POST['formid'] ) ) { |
|
| 261 | + } elseif ( ! empty( $_POST[ 'formid' ] ) ) { |
|
| 262 | 262 | |
| 263 | - $form = (int) $_POST['formid']; |
|
| 263 | + $form = (int)$_POST[ 'formid' ]; |
|
| 264 | 264 | |
| 265 | - } elseif ( ! empty( $_POST['template_id'] ) && class_exists( 'GravityView_Ajax' ) ) { |
|
| 265 | + } elseif ( ! empty( $_POST[ 'template_id' ] ) && class_exists( 'GravityView_Ajax' ) ) { |
|
| 266 | 266 | |
| 267 | - $form = GravityView_Ajax::pre_get_form_fields( $_POST['template_id'] ); |
|
| 267 | + $form = GravityView_Ajax::pre_get_form_fields( $_POST[ 'template_id' ] ); |
|
| 268 | 268 | |
| 269 | 269 | } |
| 270 | 270 | |
@@ -309,8 +309,8 @@ discard block |
||
| 309 | 309 | ) |
| 310 | 310 | ); |
| 311 | 311 | |
| 312 | - foreach( $custom_fields as $custom_field_key => $custom_field ) { |
|
| 313 | - $output .= sprintf( '<option value="%s" %s data-inputtypes="%s" data-placeholder="%s">%s</option>', $custom_field_key, selected( $custom_field_key, $current, false ), $custom_field['type'], self::get_field_label( array('field' => $custom_field_key ) ), $custom_field['text'] ); |
|
| 312 | + foreach ( $custom_fields as $custom_field_key => $custom_field ) { |
|
| 313 | + $output .= sprintf( '<option value="%s" %s data-inputtypes="%s" data-placeholder="%s">%s</option>', $custom_field_key, selected( $custom_field_key, $current, false ), $custom_field[ 'type' ], self::get_field_label( array( 'field' => $custom_field_key ) ), $custom_field[ 'text' ] ); |
|
| 314 | 314 | } |
| 315 | 315 | |
| 316 | 316 | // Get fields with sub-inputs and no parent |
@@ -332,13 +332,13 @@ discard block |
||
| 332 | 332 | |
| 333 | 333 | foreach ( $fields as $id => $field ) { |
| 334 | 334 | |
| 335 | - if ( in_array( $field['type'], $blacklist_field_types ) ) { |
|
| 335 | + if ( in_array( $field[ 'type' ], $blacklist_field_types ) ) { |
|
| 336 | 336 | continue; |
| 337 | 337 | } |
| 338 | 338 | |
| 339 | - $types = self::get_search_input_types( $id, $field['type'] ); |
|
| 339 | + $types = self::get_search_input_types( $id, $field[ 'type' ] ); |
|
| 340 | 340 | |
| 341 | - $output .= '<option value="'. $id .'" '. selected( $id, $current, false ).'data-inputtypes="'. esc_attr( $types ) .'">'. esc_html( $field['label'] ) .'</option>'; |
|
| 341 | + $output .= '<option value="' . $id . '" ' . selected( $id, $current, false ) . 'data-inputtypes="' . esc_attr( $types ) . '">' . esc_html( $field[ 'label' ] ) . '</option>'; |
|
| 342 | 342 | } |
| 343 | 343 | } |
| 344 | 344 | |
@@ -360,7 +360,7 @@ discard block |
||
| 360 | 360 | public static function get_search_input_types( $id = '', $field_type = null ) { |
| 361 | 361 | |
| 362 | 362 | // @todo - This needs to be improved - many fields have . including products and addresses |
| 363 | - if ( false !== strpos( (string) $id, '.' ) && in_array( $field_type, array( 'checkbox' ) ) || in_array( $id, array( 'is_fulfilled' ) ) ) { |
|
| 363 | + if ( false !== strpos( (string)$id, '.' ) && in_array( $field_type, array( 'checkbox' ) ) || in_array( $id, array( 'is_fulfilled' ) ) ) { |
|
| 364 | 364 | $input_type = 'boolean'; // on/off checkbox |
| 365 | 365 | } elseif ( in_array( $field_type, array( 'checkbox', 'post_category', 'multiselect' ) ) ) { |
| 366 | 366 | $input_type = 'multi'; //multiselect |
@@ -402,19 +402,19 @@ discard block |
||
| 402 | 402 | $post_id = 0; |
| 403 | 403 | |
| 404 | 404 | // We're in the WordPress Widget context, and an overriding post ID has been set. |
| 405 | - if ( ! empty( $widget_args['post_id'] ) ) { |
|
| 406 | - $post_id = absint( $widget_args['post_id'] ); |
|
| 405 | + if ( ! empty( $widget_args[ 'post_id' ] ) ) { |
|
| 406 | + $post_id = absint( $widget_args[ 'post_id' ] ); |
|
| 407 | 407 | } |
| 408 | 408 | // We're in the WordPress Widget context, and the base View ID should be used |
| 409 | - else if ( ! empty( $widget_args['view_id'] ) ) { |
|
| 410 | - $post_id = absint( $widget_args['view_id'] ); |
|
| 409 | + else if ( ! empty( $widget_args[ 'view_id' ] ) ) { |
|
| 410 | + $post_id = absint( $widget_args[ 'view_id' ] ); |
|
| 411 | 411 | } |
| 412 | 412 | |
| 413 | 413 | $args = gravityview_get_permalink_query_args( $post_id ); |
| 414 | 414 | |
| 415 | 415 | // Add hidden fields to the search form |
| 416 | 416 | foreach ( $args as $key => $value ) { |
| 417 | - $search_fields[] = array( |
|
| 417 | + $search_fields[ ] = array( |
|
| 418 | 418 | 'name' => $key, |
| 419 | 419 | 'input' => 'hidden', |
| 420 | 420 | 'value' => $value, |
@@ -435,7 +435,7 @@ discard block |
||
| 435 | 435 | */ |
| 436 | 436 | public function filter_entries( $search_criteria ) { |
| 437 | 437 | |
| 438 | - if( 'post' === $this->search_method ) { |
|
| 438 | + if ( 'post' === $this->search_method ) { |
|
| 439 | 439 | $get = $_POST; |
| 440 | 440 | } else { |
| 441 | 441 | $get = $_GET; |
@@ -452,15 +452,15 @@ discard block |
||
| 452 | 452 | $get = gv_map_deep( $get, 'rawurldecode' ); |
| 453 | 453 | |
| 454 | 454 | // add free search |
| 455 | - if ( ! empty( $get['gv_search'] ) ) { |
|
| 455 | + if ( ! empty( $get[ 'gv_search' ] ) ) { |
|
| 456 | 456 | |
| 457 | 457 | // Search for a piece |
| 458 | - $words = explode( ' ', $get['gv_search'] ); |
|
| 458 | + $words = explode( ' ', $get[ 'gv_search' ] ); |
|
| 459 | 459 | |
| 460 | 460 | $words = array_filter( $words ); |
| 461 | 461 | |
| 462 | 462 | foreach ( $words as $word ) { |
| 463 | - $search_criteria['field_filters'][] = array( |
|
| 463 | + $search_criteria[ 'field_filters' ][ ] = array( |
|
| 464 | 464 | 'key' => null, // The field ID to search |
| 465 | 465 | 'value' => $word, // The value to search |
| 466 | 466 | 'operator' => 'contains', // What to search in. Options: `is` or `contains` |
@@ -469,8 +469,8 @@ discard block |
||
| 469 | 469 | } |
| 470 | 470 | |
| 471 | 471 | //start date & end date |
| 472 | - $curr_start = !empty( $get['gv_start'] ) ? $get['gv_start'] : ''; |
|
| 473 | - $curr_end = !empty( $get['gv_start'] ) ? $get['gv_end'] : ''; |
|
| 472 | + $curr_start = ! empty( $get[ 'gv_start' ] ) ? $get[ 'gv_start' ] : ''; |
|
| 473 | + $curr_end = ! empty( $get[ 'gv_start' ] ) ? $get[ 'gv_end' ] : ''; |
|
| 474 | 474 | |
| 475 | 475 | /** |
| 476 | 476 | * @filter `gravityview_date_created_adjust_timezone` Whether to adjust the timezone for entries. \n |
@@ -485,16 +485,16 @@ discard block |
||
| 485 | 485 | /** |
| 486 | 486 | * Don't set $search_criteria['start_date'] if start_date is empty as it may lead to bad query results (GFAPI::get_entries) |
| 487 | 487 | */ |
| 488 | - if( !empty( $curr_start ) ) { |
|
| 489 | - $search_criteria['start_date'] = $adjust_tz ? get_gmt_from_date( $curr_start ) : $curr_start; |
|
| 488 | + if ( ! empty( $curr_start ) ) { |
|
| 489 | + $search_criteria[ 'start_date' ] = $adjust_tz ? get_gmt_from_date( $curr_start ) : $curr_start; |
|
| 490 | 490 | } |
| 491 | - if( !empty( $curr_end ) ) { |
|
| 492 | - $search_criteria['end_date'] = $adjust_tz ? get_gmt_from_date( $curr_end ) : $curr_end; |
|
| 491 | + if ( ! empty( $curr_end ) ) { |
|
| 492 | + $search_criteria[ 'end_date' ] = $adjust_tz ? get_gmt_from_date( $curr_end ) : $curr_end; |
|
| 493 | 493 | } |
| 494 | 494 | |
| 495 | 495 | // search for a specific entry ID |
| 496 | 496 | if ( ! empty( $get[ 'gv_id' ] ) ) { |
| 497 | - $search_criteria['field_filters'][] = array( |
|
| 497 | + $search_criteria[ 'field_filters' ][ ] = array( |
|
| 498 | 498 | 'key' => 'id', |
| 499 | 499 | 'value' => absint( $get[ 'gv_id' ] ), |
| 500 | 500 | 'operator' => '=', |
@@ -503,36 +503,36 @@ discard block |
||
| 503 | 503 | |
| 504 | 504 | // search for a specific Created_by ID |
| 505 | 505 | if ( ! empty( $get[ 'gv_by' ] ) ) { |
| 506 | - $search_criteria['field_filters'][] = array( |
|
| 506 | + $search_criteria[ 'field_filters' ][ ] = array( |
|
| 507 | 507 | 'key' => 'created_by', |
| 508 | - 'value' => absint( $get['gv_by'] ), |
|
| 508 | + 'value' => absint( $get[ 'gv_by' ] ), |
|
| 509 | 509 | 'operator' => '=', |
| 510 | 510 | ); |
| 511 | 511 | } |
| 512 | 512 | |
| 513 | 513 | |
| 514 | 514 | // Get search mode passed in URL |
| 515 | - $mode = isset( $get['mode'] ) && in_array( $get['mode'], array( 'any', 'all' ) ) ? $get['mode'] : 'any'; |
|
| 515 | + $mode = isset( $get[ 'mode' ] ) && in_array( $get[ 'mode' ], array( 'any', 'all' ) ) ? $get[ 'mode' ] : 'any'; |
|
| 516 | 516 | |
| 517 | 517 | // get the other search filters |
| 518 | 518 | foreach ( $get as $key => $value ) { |
| 519 | 519 | |
| 520 | - if ( 0 !== strpos( $key, 'filter_' ) || empty( $value ) || ( is_array( $value ) && count( $value ) === 1 && empty( $value[0] ) ) ) { |
|
| 520 | + if ( 0 !== strpos( $key, 'filter_' ) || empty( $value ) || ( is_array( $value ) && count( $value ) === 1 && empty( $value[ 0 ] ) ) ) { |
|
| 521 | 521 | continue; |
| 522 | 522 | } |
| 523 | 523 | |
| 524 | 524 | // could return simple filter or multiple filters |
| 525 | 525 | $filter = $this->prepare_field_filter( $key, $value ); |
| 526 | 526 | |
| 527 | - if ( isset( $filter[0]['value'] ) ) { |
|
| 528 | - $search_criteria['field_filters'] = array_merge( $search_criteria['field_filters'], $filter ); |
|
| 527 | + if ( isset( $filter[ 0 ][ 'value' ] ) ) { |
|
| 528 | + $search_criteria[ 'field_filters' ] = array_merge( $search_criteria[ 'field_filters' ], $filter ); |
|
| 529 | 529 | |
| 530 | 530 | // if date range type, set search mode to ALL |
| 531 | - if ( ! empty( $filter[0]['operator'] ) && in_array( $filter[0]['operator'], array( '>=', '<=', '>', '<' ) ) ) { |
|
| 531 | + if ( ! empty( $filter[ 0 ][ 'operator' ] ) && in_array( $filter[ 0 ][ 'operator' ], array( '>=', '<=', '>', '<' ) ) ) { |
|
| 532 | 532 | $mode = 'all'; |
| 533 | 533 | } |
| 534 | - } elseif( !empty( $filter ) ) { |
|
| 535 | - $search_criteria['field_filters'][] = $filter; |
|
| 534 | + } elseif ( ! empty( $filter ) ) { |
|
| 535 | + $search_criteria[ 'field_filters' ][ ] = $filter; |
|
| 536 | 536 | } |
| 537 | 537 | } |
| 538 | 538 | |
@@ -541,7 +541,7 @@ discard block |
||
| 541 | 541 | * @since 1.5.1 |
| 542 | 542 | * @param[out,in] string $mode Search mode (`any` vs `all`) |
| 543 | 543 | */ |
| 544 | - $search_criteria['field_filters']['mode'] = apply_filters( 'gravityview/search/mode', $mode ); |
|
| 544 | + $search_criteria[ 'field_filters' ][ 'mode' ] = apply_filters( 'gravityview/search/mode', $mode ); |
|
| 545 | 545 | |
| 546 | 546 | do_action( 'gravityview_log_debug', sprintf( '%s[filter_entries] Returned Search Criteria: ', get_class( $this ) ), $search_criteria ); |
| 547 | 547 | |
@@ -567,7 +567,7 @@ discard block |
||
| 567 | 567 | $field_id = str_replace( 'filter_', '', $key ); |
| 568 | 568 | |
| 569 | 569 | // calculates field_id, removing 'filter_' and for '_' for advanced fields ( like name or checkbox ) |
| 570 | - if ( preg_match('/^[0-9_]+$/ism', $field_id ) ) { |
|
| 570 | + if ( preg_match( '/^[0-9_]+$/ism', $field_id ) ) { |
|
| 571 | 571 | $field_id = str_replace( '_', '.', $field_id ); |
| 572 | 572 | } |
| 573 | 573 | |
@@ -581,11 +581,11 @@ discard block |
||
| 581 | 581 | 'value' => $value, |
| 582 | 582 | ); |
| 583 | 583 | |
| 584 | - switch ( $form_field['type'] ) { |
|
| 584 | + switch ( $form_field[ 'type' ] ) { |
|
| 585 | 585 | |
| 586 | 586 | case 'select': |
| 587 | 587 | case 'radio': |
| 588 | - $filter['operator'] = 'is'; |
|
| 588 | + $filter[ 'operator' ] = 'is'; |
|
| 589 | 589 | break; |
| 590 | 590 | |
| 591 | 591 | case 'post_category': |
@@ -599,7 +599,7 @@ discard block |
||
| 599 | 599 | |
| 600 | 600 | foreach ( $value as $val ) { |
| 601 | 601 | $cat = get_term( $val, 'category' ); |
| 602 | - $filter[] = array( |
|
| 602 | + $filter[ ] = array( |
|
| 603 | 603 | 'key' => $field_id, |
| 604 | 604 | 'value' => esc_attr( $cat->name ) . ':' . $val, |
| 605 | 605 | 'operator' => 'is', |
@@ -618,18 +618,18 @@ discard block |
||
| 618 | 618 | $filter = array(); |
| 619 | 619 | |
| 620 | 620 | foreach ( $value as $val ) { |
| 621 | - $filter[] = array( 'key' => $field_id, 'value' => $val ); |
|
| 621 | + $filter[ ] = array( 'key' => $field_id, 'value' => $val ); |
|
| 622 | 622 | } |
| 623 | 623 | |
| 624 | 624 | break; |
| 625 | 625 | |
| 626 | 626 | case 'checkbox': |
| 627 | 627 | // convert checkbox on/off into the correct search filter |
| 628 | - if ( false !== strpos( $field_id, '.' ) && ! empty( $form_field['inputs'] ) && ! empty( $form_field['choices'] ) ) { |
|
| 629 | - foreach ( $form_field['inputs'] as $k => $input ) { |
|
| 630 | - if ( $input['id'] == $field_id ) { |
|
| 631 | - $filter['value'] = $form_field['choices'][ $k ]['value']; |
|
| 632 | - $filter['operator'] = 'is'; |
|
| 628 | + if ( false !== strpos( $field_id, '.' ) && ! empty( $form_field[ 'inputs' ] ) && ! empty( $form_field[ 'choices' ] ) ) { |
|
| 629 | + foreach ( $form_field[ 'inputs' ] as $k => $input ) { |
|
| 630 | + if ( $input[ 'id' ] == $field_id ) { |
|
| 631 | + $filter[ 'value' ] = $form_field[ 'choices' ][ $k ][ 'value' ]; |
|
| 632 | + $filter[ 'operator' ] = 'is'; |
|
| 633 | 633 | break; |
| 634 | 634 | } |
| 635 | 635 | } |
@@ -639,7 +639,7 @@ discard block |
||
| 639 | 639 | $filter = array(); |
| 640 | 640 | |
| 641 | 641 | foreach ( $value as $val ) { |
| 642 | - $filter[] = array( |
|
| 642 | + $filter[ ] = array( |
|
| 643 | 643 | 'key' => $field_id, |
| 644 | 644 | 'value' => $val, |
| 645 | 645 | 'operator' => 'is', |
@@ -660,9 +660,9 @@ discard block |
||
| 660 | 660 | foreach ( $words as $word ) { |
| 661 | 661 | if ( ! empty( $word ) && strlen( $word ) > 1 ) { |
| 662 | 662 | // Keep the same key for each filter |
| 663 | - $filter['value'] = $word; |
|
| 663 | + $filter[ 'value' ] = $word; |
|
| 664 | 664 | // Add a search for the value |
| 665 | - $filters[] = $filter; |
|
| 665 | + $filters[ ] = $filter; |
|
| 666 | 666 | } |
| 667 | 667 | } |
| 668 | 668 | |
@@ -689,19 +689,19 @@ discard block |
||
| 689 | 689 | * @since 1.16.3 |
| 690 | 690 | * Safeguard until GF implements '<=' operator |
| 691 | 691 | */ |
| 692 | - if( !GFFormsModel::is_valid_operator( $operator ) && $operator === '<=' ) { |
|
| 692 | + if ( ! GFFormsModel::is_valid_operator( $operator ) && $operator === '<=' ) { |
|
| 693 | 693 | $operator = '<'; |
| 694 | 694 | $date = date( 'Y-m-d', strtotime( $date . ' +1 day' ) ); |
| 695 | 695 | } |
| 696 | 696 | |
| 697 | - $filter[] = array( |
|
| 697 | + $filter[ ] = array( |
|
| 698 | 698 | 'key' => $field_id, |
| 699 | 699 | 'value' => self::get_formatted_date( $date, 'Y-m-d' ), |
| 700 | 700 | 'operator' => $operator, |
| 701 | 701 | ); |
| 702 | 702 | } |
| 703 | 703 | } else { |
| 704 | - $filter['value'] = self::get_formatted_date( $value, 'Y-m-d' ); |
|
| 704 | + $filter[ 'value' ] = self::get_formatted_date( $value, 'Y-m-d' ); |
|
| 705 | 705 | } |
| 706 | 706 | |
| 707 | 707 | break; |
@@ -732,7 +732,7 @@ discard block |
||
| 732 | 732 | 'ymd_dot' => 'Y.m.d', |
| 733 | 733 | ); |
| 734 | 734 | |
| 735 | - if ( ! empty( $field->dateFormat ) && isset( $datepicker[ $field->dateFormat ] ) ){ |
|
| 735 | + if ( ! empty( $field->dateFormat ) && isset( $datepicker[ $field->dateFormat ] ) ) { |
|
| 736 | 736 | $format = $datepicker[ $field->dateFormat ]; |
| 737 | 737 | } |
| 738 | 738 | |
@@ -763,7 +763,7 @@ discard block |
||
| 763 | 763 | public function add_template_path( $file_paths ) { |
| 764 | 764 | |
| 765 | 765 | // Index 100 is the default GravityView template path. |
| 766 | - $file_paths[102] = self::$file . 'templates/'; |
|
| 766 | + $file_paths[ 102 ] = self::$file . 'templates/'; |
|
| 767 | 767 | |
| 768 | 768 | return $file_paths; |
| 769 | 769 | } |
@@ -782,7 +782,7 @@ discard block |
||
| 782 | 782 | $has_date = false; |
| 783 | 783 | |
| 784 | 784 | foreach ( $search_fields as $k => $field ) { |
| 785 | - if ( in_array( $field['input'], array( 'date', 'date_range', 'entry_date' ) ) ) { |
|
| 785 | + if ( in_array( $field[ 'input' ], array( 'date', 'date_range', 'entry_date' ) ) ) { |
|
| 786 | 786 | $has_date = true; |
| 787 | 787 | break; |
| 788 | 788 | } |
@@ -809,7 +809,7 @@ discard block |
||
| 809 | 809 | } |
| 810 | 810 | |
| 811 | 811 | // get configured search fields |
| 812 | - $search_fields = ! empty( $widget_args['search_fields'] ) ? json_decode( $widget_args['search_fields'], true ) : ''; |
|
| 812 | + $search_fields = ! empty( $widget_args[ 'search_fields' ] ) ? json_decode( $widget_args[ 'search_fields' ], true ) : ''; |
|
| 813 | 813 | |
| 814 | 814 | if ( empty( $search_fields ) || ! is_array( $search_fields ) ) { |
| 815 | 815 | do_action( 'gravityview_log_debug', sprintf( '%s[render_frontend] No search fields configured for widget:', get_class( $this ) ), $widget_args ); |
@@ -824,34 +824,34 @@ discard block |
||
| 824 | 824 | |
| 825 | 825 | $updated_field = $this->get_search_filter_details( $updated_field ); |
| 826 | 826 | |
| 827 | - switch ( $field['field'] ) { |
|
| 827 | + switch ( $field[ 'field' ] ) { |
|
| 828 | 828 | |
| 829 | 829 | case 'search_all': |
| 830 | - $updated_field['key'] = 'search_all'; |
|
| 831 | - $updated_field['input'] = 'search_all'; |
|
| 832 | - $updated_field['value'] = $this->rgget_or_rgpost( 'gv_search' ); |
|
| 830 | + $updated_field[ 'key' ] = 'search_all'; |
|
| 831 | + $updated_field[ 'input' ] = 'search_all'; |
|
| 832 | + $updated_field[ 'value' ] = $this->rgget_or_rgpost( 'gv_search' ); |
|
| 833 | 833 | break; |
| 834 | 834 | |
| 835 | 835 | case 'entry_date': |
| 836 | - $updated_field['key'] = 'entry_date'; |
|
| 837 | - $updated_field['input'] = 'entry_date'; |
|
| 838 | - $updated_field['value'] = array( |
|
| 836 | + $updated_field[ 'key' ] = 'entry_date'; |
|
| 837 | + $updated_field[ 'input' ] = 'entry_date'; |
|
| 838 | + $updated_field[ 'value' ] = array( |
|
| 839 | 839 | 'start' => $this->rgget_or_rgpost( 'gv_start' ), |
| 840 | 840 | 'end' => $this->rgget_or_rgpost( 'gv_end' ), |
| 841 | 841 | ); |
| 842 | 842 | break; |
| 843 | 843 | |
| 844 | 844 | case 'entry_id': |
| 845 | - $updated_field['key'] = 'entry_id'; |
|
| 846 | - $updated_field['input'] = 'entry_id'; |
|
| 847 | - $updated_field['value'] = $this->rgget_or_rgpost( 'gv_id' ); |
|
| 845 | + $updated_field[ 'key' ] = 'entry_id'; |
|
| 846 | + $updated_field[ 'input' ] = 'entry_id'; |
|
| 847 | + $updated_field[ 'value' ] = $this->rgget_or_rgpost( 'gv_id' ); |
|
| 848 | 848 | break; |
| 849 | 849 | |
| 850 | 850 | case 'created_by': |
| 851 | - $updated_field['key'] = 'created_by'; |
|
| 852 | - $updated_field['name'] = 'gv_by'; |
|
| 853 | - $updated_field['value'] = $this->rgget_or_rgpost( 'gv_by' ); |
|
| 854 | - $updated_field['choices'] = self::get_created_by_choices(); |
|
| 851 | + $updated_field[ 'key' ] = 'created_by'; |
|
| 852 | + $updated_field[ 'name' ] = 'gv_by'; |
|
| 853 | + $updated_field[ 'value' ] = $this->rgget_or_rgpost( 'gv_by' ); |
|
| 854 | + $updated_field[ 'choices' ] = self::get_created_by_choices(); |
|
| 855 | 855 | break; |
| 856 | 856 | } |
| 857 | 857 | |
@@ -869,16 +869,16 @@ discard block |
||
| 869 | 869 | */ |
| 870 | 870 | $gravityview_view->search_fields = apply_filters( 'gravityview_widget_search_filters', $search_fields, $this, $widget_args ); |
| 871 | 871 | |
| 872 | - $gravityview_view->search_layout = ! empty( $widget_args['search_layout'] ) ? $widget_args['search_layout'] : 'horizontal'; |
|
| 872 | + $gravityview_view->search_layout = ! empty( $widget_args[ 'search_layout' ] ) ? $widget_args[ 'search_layout' ] : 'horizontal'; |
|
| 873 | 873 | |
| 874 | 874 | /** @since 1.14 */ |
| 875 | - $gravityview_view->search_mode = ! empty( $widget_args['search_mode'] ) ? $widget_args['search_mode'] : 'any'; |
|
| 875 | + $gravityview_view->search_mode = ! empty( $widget_args[ 'search_mode' ] ) ? $widget_args[ 'search_mode' ] : 'any'; |
|
| 876 | 876 | |
| 877 | - $custom_class = ! empty( $widget_args['custom_class'] ) ? $widget_args['custom_class'] : ''; |
|
| 877 | + $custom_class = ! empty( $widget_args[ 'custom_class' ] ) ? $widget_args[ 'custom_class' ] : ''; |
|
| 878 | 878 | |
| 879 | 879 | $gravityview_view->search_class = self::get_search_class( $custom_class ); |
| 880 | 880 | |
| 881 | - $gravityview_view->search_clear = ! empty( $widget_args['search_clear'] ) ? $widget_args['search_clear'] : false; |
|
| 881 | + $gravityview_view->search_clear = ! empty( $widget_args[ 'search_clear' ] ) ? $widget_args[ 'search_clear' ] : false; |
|
| 882 | 882 | |
| 883 | 883 | if ( $this->has_date_field( $search_fields ) ) { |
| 884 | 884 | // enqueue datepicker stuff only if needed! |
@@ -900,10 +900,10 @@ discard block |
||
| 900 | 900 | public static function get_search_class( $custom_class = '' ) { |
| 901 | 901 | $gravityview_view = GravityView_View::getInstance(); |
| 902 | 902 | |
| 903 | - $search_class = 'gv-search-'.$gravityview_view->search_layout; |
|
| 903 | + $search_class = 'gv-search-' . $gravityview_view->search_layout; |
|
| 904 | 904 | |
| 905 | - if ( ! empty( $custom_class ) ) { |
|
| 906 | - $search_class .= ' '.$custom_class; |
|
| 905 | + if ( ! empty( $custom_class ) ) { |
|
| 906 | + $search_class .= ' ' . $custom_class; |
|
| 907 | 907 | } |
| 908 | 908 | |
| 909 | 909 | /** |
@@ -945,11 +945,11 @@ discard block |
||
| 945 | 945 | |
| 946 | 946 | $label = rgget( 'label', $field ); |
| 947 | 947 | |
| 948 | - if( '' === $label ) { |
|
| 948 | + if ( '' === $label ) { |
|
| 949 | 949 | |
| 950 | - $label = isset( $form_field['label'] ) ? $form_field['label'] : ''; |
|
| 950 | + $label = isset( $form_field[ 'label' ] ) ? $form_field[ 'label' ] : ''; |
|
| 951 | 951 | |
| 952 | - switch( $field['field'] ) { |
|
| 952 | + switch ( $field[ 'field' ] ) { |
|
| 953 | 953 | case 'search_all': |
| 954 | 954 | $label = __( 'Search Entries:', 'gravityview' ); |
| 955 | 955 | break; |
@@ -961,10 +961,10 @@ discard block |
||
| 961 | 961 | break; |
| 962 | 962 | default: |
| 963 | 963 | // If this is a field input, not a field |
| 964 | - if ( strpos( $field['field'], '.' ) > 0 && ! empty( $form_field['inputs'] ) ) { |
|
| 964 | + if ( strpos( $field[ 'field' ], '.' ) > 0 && ! empty( $form_field[ 'inputs' ] ) ) { |
|
| 965 | 965 | |
| 966 | 966 | // Get the label for the field in question, which returns an array |
| 967 | - $items = wp_list_filter( $form_field['inputs'], array( 'id' => $field['field'] ) ); |
|
| 967 | + $items = wp_list_filter( $form_field[ 'inputs' ], array( 'id' => $field[ 'field' ] ) ); |
|
| 968 | 968 | |
| 969 | 969 | // Get the item with the `label` key |
| 970 | 970 | $values = wp_list_pluck( $items, 'label' ); |
@@ -1003,32 +1003,32 @@ discard block |
||
| 1003 | 1003 | $form = $gravityview_view->getForm(); |
| 1004 | 1004 | |
| 1005 | 1005 | // for advanced field ids (eg, first name / last name ) |
| 1006 | - $name = 'filter_' . str_replace( '.', '_', $field['field'] ); |
|
| 1006 | + $name = 'filter_' . str_replace( '.', '_', $field[ 'field' ] ); |
|
| 1007 | 1007 | |
| 1008 | 1008 | // get searched value from $_GET/$_POST (string or array) |
| 1009 | 1009 | $value = $this->rgget_or_rgpost( $name ); |
| 1010 | 1010 | |
| 1011 | 1011 | // get form field details |
| 1012 | - $form_field = gravityview_get_field( $form, $field['field'] ); |
|
| 1012 | + $form_field = gravityview_get_field( $form, $field[ 'field' ] ); |
|
| 1013 | 1013 | |
| 1014 | 1014 | $filter = array( |
| 1015 | - 'key' => $field['field'], |
|
| 1015 | + 'key' => $field[ 'field' ], |
|
| 1016 | 1016 | 'name' => $name, |
| 1017 | 1017 | 'label' => self::get_field_label( $field, $form_field ), |
| 1018 | - 'input' => $field['input'], |
|
| 1018 | + 'input' => $field[ 'input' ], |
|
| 1019 | 1019 | 'value' => $value, |
| 1020 | - 'type' => $form_field['type'], |
|
| 1020 | + 'type' => $form_field[ 'type' ], |
|
| 1021 | 1021 | ); |
| 1022 | 1022 | |
| 1023 | 1023 | // collect choices |
| 1024 | - if ( 'post_category' === $form_field['type'] && ! empty( $form_field['displayAllCategories'] ) && empty( $form_field['choices'] ) ) { |
|
| 1025 | - $filter['choices'] = gravityview_get_terms_choices(); |
|
| 1026 | - } elseif ( ! empty( $form_field['choices'] ) ) { |
|
| 1027 | - $filter['choices'] = $form_field['choices']; |
|
| 1024 | + if ( 'post_category' === $form_field[ 'type' ] && ! empty( $form_field[ 'displayAllCategories' ] ) && empty( $form_field[ 'choices' ] ) ) { |
|
| 1025 | + $filter[ 'choices' ] = gravityview_get_terms_choices(); |
|
| 1026 | + } elseif ( ! empty( $form_field[ 'choices' ] ) ) { |
|
| 1027 | + $filter[ 'choices' ] = $form_field[ 'choices' ]; |
|
| 1028 | 1028 | } |
| 1029 | 1029 | |
| 1030 | - if ( 'date_range' === $field['input'] && empty( $value ) ) { |
|
| 1031 | - $filter['value'] = array( 'start' => '', 'end' => '' ); |
|
| 1030 | + if ( 'date_range' === $field[ 'input' ] && empty( $value ) ) { |
|
| 1031 | + $filter[ 'value' ] = array( 'start' => '', 'end' => '' ); |
|
| 1032 | 1032 | } |
| 1033 | 1033 | |
| 1034 | 1034 | return $filter; |
@@ -1052,7 +1052,7 @@ discard block |
||
| 1052 | 1052 | |
| 1053 | 1053 | $choices = array(); |
| 1054 | 1054 | foreach ( $users as $user ) { |
| 1055 | - $choices[] = array( |
|
| 1055 | + $choices[ ] = array( |
|
| 1056 | 1056 | 'value' => $user->ID, |
| 1057 | 1057 | 'text' => $user->display_name, |
| 1058 | 1058 | ); |
@@ -1107,7 +1107,7 @@ discard block |
||
| 1107 | 1107 | */ |
| 1108 | 1108 | public function add_datepicker_js_dependency( $js_dependencies ) { |
| 1109 | 1109 | |
| 1110 | - $js_dependencies[] = 'jquery-ui-datepicker'; |
|
| 1110 | + $js_dependencies[ ] = 'jquery-ui-datepicker'; |
|
| 1111 | 1111 | |
| 1112 | 1112 | return $js_dependencies; |
| 1113 | 1113 | } |
@@ -1151,7 +1151,7 @@ discard block |
||
| 1151 | 1151 | 'isRTL' => is_rtl(), |
| 1152 | 1152 | ), $view_data ); |
| 1153 | 1153 | |
| 1154 | - $localizations['datepicker'] = $datepicker_settings; |
|
| 1154 | + $localizations[ 'datepicker' ] = $datepicker_settings; |
|
| 1155 | 1155 | |
| 1156 | 1156 | return $localizations; |
| 1157 | 1157 | |
@@ -1180,7 +1180,7 @@ discard block |
||
| 1180 | 1180 | * @return void |
| 1181 | 1181 | */ |
| 1182 | 1182 | private function maybe_enqueue_flexibility() { |
| 1183 | - if ( isset( $_SERVER['HTTP_USER_AGENT'] ) && preg_match( '/MSIE [8-9]/', $_SERVER['HTTP_USER_AGENT'] ) ) { |
|
| 1183 | + if ( isset( $_SERVER[ 'HTTP_USER_AGENT' ] ) && preg_match( '/MSIE [8-9]/', $_SERVER[ 'HTTP_USER_AGENT' ] ) ) { |
|
| 1184 | 1184 | wp_enqueue_script( 'gv-flexibility' ); |
| 1185 | 1185 | } |
| 1186 | 1186 | } |
@@ -1202,7 +1202,7 @@ discard block |
||
| 1202 | 1202 | add_filter( 'gravityview_js_localization', array( $this, 'add_datepicker_localization' ), 10, 2 ); |
| 1203 | 1203 | |
| 1204 | 1204 | $scheme = is_ssl() ? 'https://' : 'http://'; |
| 1205 | - wp_enqueue_style( 'jquery-ui-datepicker', $scheme.'ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/themes/smoothness/jquery-ui.css' ); |
|
| 1205 | + wp_enqueue_style( 'jquery-ui-datepicker', $scheme . 'ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/themes/smoothness/jquery-ui.css' ); |
|
| 1206 | 1206 | |
| 1207 | 1207 | /** |
| 1208 | 1208 | * @filter `gravityview_search_datepicker_class` |