@@ -45,7 +45,6 @@ discard block |
||
45 | 45 | * Trick the GF fileupload field to render with the proper HTML ID to enable the plupload JS to work properly |
46 | 46 | * |
47 | 47 | * @param array $form The Form Object currently being processed. |
48 | - * @param string|array $value The field value. From default/dynamic population, $_POST, or a resumed incomplete submission. |
|
49 | 48 | * @param null|array $entry Null or the Entry Object currently being edited. |
50 | 49 | * @param GF_Field_FileUpload $field Gravity Forms field |
51 | 50 | * |
@@ -74,6 +73,7 @@ discard block |
||
74 | 73 | * |
75 | 74 | * @since 2.0 |
76 | 75 | * @param \GV\Template_Context The context. |
76 | + * @param GV\Template_Context $context |
|
77 | 77 | * |
78 | 78 | * @return array Array of file output, with `file_path` and `html` keys (see comments above) |
79 | 79 | */ |
@@ -26,21 +26,21 @@ discard block |
||
26 | 26 | |
27 | 27 | public function field_options( $field_options, $template_id, $field_id, $context, $input_type, $form_id ) { |
28 | 28 | |
29 | - unset( $field_options['search_filter'] ); |
|
29 | + unset( $field_options[ 'search_filter' ] ); |
|
30 | 30 | |
31 | - if( 'edit' === $context ) { |
|
31 | + if ( 'edit' === $context ) { |
|
32 | 32 | return $field_options; |
33 | 33 | } |
34 | 34 | |
35 | - $add_options['link_to_file'] = array( |
|
35 | + $add_options[ 'link_to_file' ] = array( |
|
36 | 36 | 'type' => 'checkbox', |
37 | 37 | 'label' => __( 'Display as a Link:', 'gravityview' ), |
38 | - 'desc' => __('Display the uploaded files as links, rather than embedded content.', 'gravityview'), |
|
38 | + 'desc' => __( 'Display the uploaded files as links, rather than embedded content.', 'gravityview' ), |
|
39 | 39 | 'value' => false, |
40 | 40 | 'merge_tags' => false, |
41 | 41 | ); |
42 | 42 | |
43 | - $add_options['image_width'] = array( |
|
43 | + $add_options[ 'image_width' ] = array( |
|
44 | 44 | 'type' => 'text', |
45 | 45 | 'label' => __( 'Custom Width:', 'gravityview' ), |
46 | 46 | 'desc' => __( 'Override the default image width (250).', 'gravityview' ), |
@@ -129,14 +129,14 @@ discard block |
||
129 | 129 | $base_id = null; |
130 | 130 | |
131 | 131 | $is_single = gravityview_get_context() === 'single'; |
132 | - $lightbox = ! empty( $gravityview_view->atts['lightbox'] ); |
|
132 | + $lightbox = ! empty( $gravityview_view->atts[ 'lightbox' ] ); |
|
133 | 133 | $field_compat = $gravityview_view->getCurrentField(); |
134 | 134 | } |
135 | 135 | |
136 | 136 | $output_arr = array(); |
137 | 137 | |
138 | 138 | // Get an array of file paths for the field. |
139 | - $file_paths = \GV\Utils::get( $field , 'multipleFiles' ) ? json_decode( $value ) : array( $value ); |
|
139 | + $file_paths = \GV\Utils::get( $field, 'multipleFiles' ) ? json_decode( $value ) : array( $value ); |
|
140 | 140 | |
141 | 141 | // The $value JSON was probably truncated; let's check lead_detail_long. |
142 | 142 | if ( ! is_array( $file_paths ) ) { |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | $rendered = null; |
156 | 156 | |
157 | 157 | // If the site is HTTPS, use HTTPS |
158 | - if ( function_exists('set_url_scheme') ) { |
|
158 | + if ( function_exists( 'set_url_scheme' ) ) { |
|
159 | 159 | $file_path = set_url_scheme( $file_path ); |
160 | 160 | } |
161 | 161 | |
@@ -166,8 +166,8 @@ discard block |
||
166 | 166 | $file_path_info = pathinfo( $file_path ); |
167 | 167 | |
168 | 168 | // If pathinfo() gave us the extension of the file, run the switch statement using that. |
169 | - $extension = empty( $file_path_info['extension'] ) ? NULL : strtolower( $file_path_info['extension'] ); |
|
170 | - $basename = $file_path_info['basename']; |
|
169 | + $extension = empty( $file_path_info[ 'extension' ] ) ? NULL : strtolower( $file_path_info[ 'extension' ] ); |
|
170 | + $basename = $file_path_info[ 'basename' ]; |
|
171 | 171 | |
172 | 172 | // Get the secure download URL |
173 | 173 | $is_secure = false; |
@@ -206,7 +206,7 @@ discard block |
||
206 | 206 | */ |
207 | 207 | $audio_settings = apply_filters( 'gravityview_audio_settings', array( |
208 | 208 | 'src' => $insecure_file_path, // Needs to be insecure path so WP can parse extension |
209 | - 'class' => 'wp-audio-shortcode gv-audio gv-field-id-'.$field_settings['id'] |
|
209 | + 'class' => 'wp-audio-shortcode gv-audio gv-field-id-' . $field_settings[ 'id' ] |
|
210 | 210 | ), $context ); |
211 | 211 | |
212 | 212 | /** |
@@ -242,7 +242,7 @@ discard block |
||
242 | 242 | */ |
243 | 243 | $video_settings = apply_filters( 'gravityview_video_settings', array( |
244 | 244 | 'src' => $insecure_file_path, // Needs to be insecure path so WP can parse extension |
245 | - 'class' => 'wp-video-shortcode gv-video gv-field-id-'.$field_settings['id'] |
|
245 | + 'class' => 'wp-video-shortcode gv-video gv-field-id-' . $field_settings[ 'id' ] |
|
246 | 246 | ), $context ); |
247 | 247 | |
248 | 248 | /** |
@@ -275,13 +275,13 @@ discard block |
||
275 | 275 | $width = \GV\Utils::get( $field_settings, 'image_width', 250 ); |
276 | 276 | $image_atts = array( |
277 | 277 | 'src' => $file_path, |
278 | - 'class' => 'gv-image gv-field-id-' . $field_settings['id'], |
|
279 | - 'alt' => $field_settings['label'], |
|
280 | - 'width' => ( $is_single ? null : ( $width ? $width: 250 ) ) |
|
278 | + 'class' => 'gv-image gv-field-id-' . $field_settings[ 'id' ], |
|
279 | + 'alt' => $field_settings[ 'label' ], |
|
280 | + 'width' => ( $is_single ? null : ( $width ? $width : 250 ) ) |
|
281 | 281 | ); |
282 | 282 | |
283 | 283 | if ( $is_secure ) { |
284 | - $image_atts['validate_src'] = false; |
|
284 | + $image_atts[ 'validate_src' ] = false; |
|
285 | 285 | } |
286 | 286 | |
287 | 287 | /** |
@@ -302,7 +302,7 @@ discard block |
||
302 | 302 | |
303 | 303 | unset( $gv_entry ); |
304 | 304 | |
305 | - if ( $lightbox && empty( $field_settings['show_as_link'] ) ) { |
|
305 | + if ( $lightbox && empty( $field_settings[ 'show_as_link' ] ) ) { |
|
306 | 306 | $lightbox_link_atts = array( |
307 | 307 | 'rel' => sprintf( "%s-%s", $gv_class, $entry_slug ), |
308 | 308 | 'class' => '', |
@@ -318,7 +318,7 @@ discard block |
||
318 | 318 | } |
319 | 319 | |
320 | 320 | // Show as link should render the image regardless. |
321 | - if ( ! empty( $field_settings['show_as_link'] ) ) { |
|
321 | + if ( ! empty( $field_settings[ 'show_as_link' ] ) ) { |
|
322 | 322 | $text = $rendered; |
323 | 323 | } |
324 | 324 | } |
@@ -335,7 +335,7 @@ discard block |
||
335 | 335 | $disable_wrapped_link = apply_filters( 'gravityview/fields/fileupload/disable_link', false, $field_compat, $context ); |
336 | 336 | |
337 | 337 | // Output textualized content where |
338 | - if ( ! $disable_wrapped_link && ( ! empty( $field_settings['link_to_file'] ) || ! empty( $field_settings['show_as_link'] ) ) ) { |
|
338 | + if ( ! $disable_wrapped_link && ( ! empty( $field_settings[ 'link_to_file' ] ) || ! empty( $field_settings[ 'show_as_link' ] ) ) ) { |
|
339 | 339 | /** |
340 | 340 | * Modify the link text (defaults to the file name) |
341 | 341 | * |
@@ -348,7 +348,7 @@ discard block |
||
348 | 348 | */ |
349 | 349 | $content = apply_filters( 'gravityview/fields/fileupload/link_content', $text, $field_compat, $context ); |
350 | 350 | |
351 | - if ( empty( $field_settings['show_as_link'] ) ) { |
|
351 | + if ( empty( $field_settings[ 'show_as_link' ] ) ) { |
|
352 | 352 | /** |
353 | 353 | * @filter `gravityview/fields/fileupload/link_atts` Modify the link attributes for a file upload field |
354 | 354 | * @param array|string $link_atts Array or attributes string |
@@ -364,7 +364,7 @@ discard block |
||
364 | 364 | $content = empty( $rendered ) ? $text : $rendered; |
365 | 365 | } |
366 | 366 | |
367 | - $output_arr[] = array( |
|
367 | + $output_arr[ ] = array( |
|
368 | 368 | 'file_path' => $file_path, |
369 | 369 | 'content' => $content |
370 | 370 | ); |
@@ -72,7 +72,7 @@ |
||
72 | 72 | * |
73 | 73 | * @param mixed $value The value in. |
74 | 74 | * |
75 | - * @return mixed The value out. |
|
75 | + * @return string The value out. |
|
76 | 76 | */ |
77 | 77 | public function get_value( $value ) { |
78 | 78 | return $this->get_string_from_value( $value ); |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | public function get_content( $output, $entry = array(), $field_settings = array(), $field = array() ) { |
61 | 61 | |
62 | 62 | /** Overridden by a template. */ |
63 | - if( ! empty( $field['field_path'] ) ) { return $output; } |
|
63 | + if ( ! empty( $field[ 'field_path' ] ) ) { return $output; } |
|
64 | 64 | |
65 | 65 | return $this->get_string_from_value( $output ); |
66 | 66 | } |
@@ -92,11 +92,11 @@ discard block |
||
92 | 92 | switch ( intval( $value ) ) { |
93 | 93 | case self::NOT_FULFILLED: |
94 | 94 | default: |
95 | - $return = __('Not Fulfilled', 'gravityview'); |
|
95 | + $return = __( 'Not Fulfilled', 'gravityview' ); |
|
96 | 96 | break; |
97 | 97 | |
98 | 98 | case self::FULFILLED: |
99 | - $return = __('Fulfilled', 'gravityview'); |
|
99 | + $return = __( 'Fulfilled', 'gravityview' ); |
|
100 | 100 | break; |
101 | 101 | } |
102 | 102 | |
@@ -116,13 +116,13 @@ discard block |
||
116 | 116 | * |
117 | 117 | * @return string Original text if {is_fulfilled} isn't found. Otherwise, "Not Fulfilled" or "Fulfilled" |
118 | 118 | */ |
119 | - public function replace_merge_tag( $matches = array(), $text = '', $form = array(), $entry = array(), $url_encode = false, $esc_html = false ) { |
|
119 | + public function replace_merge_tag( $matches = array(), $text = '', $form = array(), $entry = array(), $url_encode = false, $esc_html = false ) { |
|
120 | 120 | |
121 | 121 | $return = $text; |
122 | 122 | |
123 | 123 | foreach ( $matches as $match ) { |
124 | 124 | |
125 | - $full_tag = $match[0]; |
|
125 | + $full_tag = $match[ 0 ]; |
|
126 | 126 | |
127 | 127 | $fulfilled = \GV\Utils::get( $entry, 'is_fulfilled' ); |
128 | 128 |
@@ -69,7 +69,7 @@ |
||
69 | 69 | * @param \GV\Entry $entry The entry. |
70 | 70 | * @param \GV\Request $request The request context. |
71 | 71 | * |
72 | - * @return mixed $value The filtered value. |
|
72 | + * @return string $value The filtered value. |
|
73 | 73 | */ |
74 | 74 | public function get_value( $value, $field, $view, $source, $entry, $request ) { |
75 | 75 | return $this->get_content( $value, $entry->as_entry(), $field->as_configuration() ); |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | public function get_content( $output = '', $entry = array(), $field_settings = array(), $field = array() ) { |
50 | 50 | |
51 | 51 | /** Overridden by a template. */ |
52 | - if( ! empty( $field['field_path'] ) ) { return $output; } |
|
52 | + if ( ! empty( $field[ 'field_path' ] ) ) { return $output; } |
|
53 | 53 | |
54 | 54 | $amount = \GV\Utils::get( $entry, 'payment_amount' ); |
55 | 55 | $return = GFCommon::to_money( $amount, \GV\Utils::get( $entry, 'currency' ) ); |
@@ -88,14 +88,14 @@ discard block |
||
88 | 88 | * |
89 | 89 | * @return string Original text if {date_created} isn't found. Otherwise, replaced text. |
90 | 90 | */ |
91 | - public function replace_merge_tag( $matches = array(), $text = '', $form = array(), $entry = array(), $url_encode = false, $esc_html = false ) { |
|
91 | + public function replace_merge_tag( $matches = array(), $text = '', $form = array(), $entry = array(), $url_encode = false, $esc_html = false ) { |
|
92 | 92 | |
93 | 93 | $return = $text; |
94 | 94 | |
95 | 95 | foreach ( $matches as $match ) { |
96 | 96 | |
97 | - $full_tag = $match[0]; |
|
98 | - $modifier = isset( $match[1] ) ? $match[1] : false; |
|
97 | + $full_tag = $match[ 0 ]; |
|
98 | + $modifier = isset( $match[ 1 ] ) ? $match[ 1 ] : false; |
|
99 | 99 | |
100 | 100 | $amount = \GV\Utils::get( $entry, 'payment_amount' ); |
101 | 101 |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | printf( '<body style="padding: 0; margin: 0; font-family: -apple-system, BlinkMacSystemFont, \'Segoe UI\', Roboto, Oxygen-Sans, Ubuntu, Cantarell, \'Helvetica Neue\', sans-serif;">' ); |
26 | 26 | printf( '<img src="' . plugins_url( 'assets/images/astronaut-200x263.png', GRAVITYVIEW_FILE ) . '" alt="The GravityView Astronaut Says:" style="float: left; height: 60px; margin-right : 10px;" />' ); |
27 | 27 | printf( __( "%sGravityView requires PHP Version %s or newer.%s \n\nYou're using Version %s. Please ask your host to upgrade your server's PHP.", 'gravityview' ), |
28 | - '<h3 style="font-size:16px; margin: 0 0 8px 0;">', GV_MIN_PHP_VERSION , "</h3>\n\n", $version ); |
|
28 | + '<h3 style="font-size:16px; margin: 0 0 8px 0;">', GV_MIN_PHP_VERSION, "</h3>\n\n", $version ); |
|
29 | 29 | printf( '</body>' ); |
30 | 30 | } |
31 | 31 | |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | } |
35 | 35 | |
36 | 36 | /** The future branch of GravityView requires PHP 5.3+ namespaces and SPL. */ |
37 | -if ( version_compare( phpversion(), '5.3.0' , '<' ) ) { |
|
37 | +if ( version_compare( phpversion(), '5.3.0', '<' ) ) { |
|
38 | 38 | require GRAVITYVIEW_DIR . 'future/_stubs.php'; |
39 | 39 | |
40 | 40 | /** All looks fine. */ |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | */ |
77 | 77 | public static function remove() { |
78 | 78 | $shortcode = new static(); |
79 | - unset( self::$shortcodes[$shortcode->name] ); |
|
79 | + unset( self::$shortcodes[ $shortcode->name ] ); |
|
80 | 80 | remove_shortcode( $shortcode->name ); |
81 | 81 | } |
82 | 82 | |
@@ -108,14 +108,14 @@ discard block |
||
108 | 108 | preg_match_all( '/' . get_shortcode_regex() . '/', $content, $matches, PREG_SET_ORDER ); |
109 | 109 | |
110 | 110 | foreach ( $matches as $shortcode ) { |
111 | - $shortcode_name = $shortcode[2]; |
|
111 | + $shortcode_name = $shortcode[ 2 ]; |
|
112 | 112 | |
113 | - $shortcode_atts = shortcode_parse_atts( $shortcode[3] ); |
|
114 | - $shortcode_content = $shortcode[5]; |
|
113 | + $shortcode_atts = shortcode_parse_atts( $shortcode[ 3 ] ); |
|
114 | + $shortcode_content = $shortcode[ 5 ]; |
|
115 | 115 | |
116 | 116 | /** This is a registered GravityView shortcode. */ |
117 | - if ( !empty( self::$shortcodes[$shortcode_name] ) ) { |
|
118 | - $shortcode = clone self::$shortcodes[$shortcode_name]; |
|
117 | + if ( ! empty( self::$shortcodes[ $shortcode_name ] ) ) { |
|
118 | + $shortcode = clone self::$shortcodes[ $shortcode_name ]; |
|
119 | 119 | } else { |
120 | 120 | /** This is some generic shortcode. */ |
121 | 121 | $shortcode = new self; |
@@ -62,7 +62,6 @@ |
||
62 | 62 | * |
63 | 63 | * Internal static cache for gets, and whatnot. |
64 | 64 | * This is not persistent, resets across requests. |
65 | - |
|
66 | 65 | * @internal |
67 | 66 | */ |
68 | 67 | private static $cache = array(); |
@@ -230,8 +230,9 @@ |
||
230 | 230 | * Check permissions. |
231 | 231 | */ |
232 | 232 | while ( $error = $view->can_render( null, $request ) ) { |
233 | - if ( ! is_wp_error( $error ) ) |
|
234 | - break; |
|
233 | + if ( ! is_wp_error( $error ) ) { |
|
234 | + break; |
|
235 | + } |
|
235 | 236 | |
236 | 237 | switch ( str_replace( 'gravityview/', '', $error->get_error_code() ) ) { |
237 | 238 | case 'post_password_required': |
@@ -795,6 +795,7 @@ |
||
795 | 795 | * Retrieve the entries for the current view and request. |
796 | 796 | * |
797 | 797 | * @param \GV\Request The request. Unused for now. |
798 | + * @param Request $request |
|
798 | 799 | * |
799 | 800 | * @return \GV\Entry_Collection The entries. |
800 | 801 | */ |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | $supports = array( 'title', 'revisions' ); |
126 | 126 | |
127 | 127 | if ( $is_hierarchical ) { |
128 | - $supports[] = 'page-attributes'; |
|
128 | + $supports[ ] = 'page-attributes'; |
|
129 | 129 | } |
130 | 130 | |
131 | 131 | /** |
@@ -229,12 +229,12 @@ discard block |
||
229 | 229 | $tsv_rule = array( sprintf( '%s/([^/]+)/tsv/?', $slug ), 'index.php?gravityview=$matches[1]&tsv=1', 'top' ); |
230 | 230 | |
231 | 231 | add_filter( 'query_vars', function( $query_vars ) { |
232 | - $query_vars[] = 'csv'; |
|
233 | - $query_vars[] = 'tsv'; |
|
232 | + $query_vars[ ] = 'csv'; |
|
233 | + $query_vars[ ] = 'tsv'; |
|
234 | 234 | return $query_vars; |
235 | 235 | } ); |
236 | 236 | |
237 | - if ( ! isset( $wp_rewrite->extra_rules_top[ $csv_rule[0] ] ) ) { |
|
237 | + if ( ! isset( $wp_rewrite->extra_rules_top[ $csv_rule[ 0 ] ] ) ) { |
|
238 | 238 | call_user_func_array( 'add_rewrite_rule', $csv_rule ); |
239 | 239 | call_user_func_array( 'add_rewrite_rule', $tsv_rule ); |
240 | 240 | } |
@@ -295,7 +295,7 @@ discard block |
||
295 | 295 | |
296 | 296 | $message = esc_html__( 'You can only see this message because you are able to edit this View.', 'gravityview' ); |
297 | 297 | |
298 | - $image = sprintf( '<img alt="%s" src="%s" style="margin-top: 10px;" />', esc_attr__( 'Data Source', 'gravityview' ), esc_url( plugins_url( 'assets/images/screenshots/data-source.png', GRAVITYVIEW_FILE ) ) ); |
|
298 | + $image = sprintf( '<img alt="%s" src="%s" style="margin-top: 10px;" />', esc_attr__( 'Data Source', 'gravityview' ), esc_url( plugins_url( 'assets/images/screenshots/data-source.png', GRAVITYVIEW_FILE ) ) ); |
|
299 | 299 | |
300 | 300 | return \GVCommon::generate_notice( '<h3>' . $title . '</h3>' . wpautop( $message . $image ), 'notice' ); |
301 | 301 | } |
@@ -321,13 +321,13 @@ discard block |
||
321 | 321 | return $content; |
322 | 322 | } |
323 | 323 | |
324 | - $is_admin_and_can_view = $view->settings->get( 'admin_show_all_statuses' ) && \GVCommon::has_cap('gravityview_moderate_entries', $view->ID ); |
|
324 | + $is_admin_and_can_view = $view->settings->get( 'admin_show_all_statuses' ) && \GVCommon::has_cap( 'gravityview_moderate_entries', $view->ID ); |
|
325 | 325 | |
326 | 326 | /** |
327 | 327 | * Editing a single entry. |
328 | 328 | */ |
329 | 329 | if ( $entry = $request->is_edit_entry( $view->form ? $view->form->ID : 0 ) ) { |
330 | - if ( $entry['status'] != 'active' ) { |
|
330 | + if ( $entry[ 'status' ] != 'active' ) { |
|
331 | 331 | gravityview()->log->notice( 'Entry ID #{entry_id} is not active', array( 'entry_id' => $entry->ID ) ); |
332 | 332 | return __( 'You are not allowed to view this content.', 'gravityview' ); |
333 | 333 | } |
@@ -338,7 +338,7 @@ discard block |
||
338 | 338 | } |
339 | 339 | |
340 | 340 | if ( $view->settings->get( 'show_only_approved' ) && ! $is_admin_and_can_view ) { |
341 | - if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $entry->ID, \GravityView_Entry_Approval::meta_key ) ) ) { |
|
341 | + if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $entry->ID, \GravityView_Entry_Approval::meta_key ) ) ) { |
|
342 | 342 | gravityview()->log->error( 'Entry ID #{entry_id} is not approved for viewing', array( 'entry_id' => $entry->ID ) ); |
343 | 343 | return __( 'You are not allowed to view this content.', 'gravityview' ); |
344 | 344 | } |
@@ -361,7 +361,7 @@ discard block |
||
361 | 361 | |
362 | 362 | foreach ( $entryset as $e ) { |
363 | 363 | |
364 | - if ( 'active' !== $e['status'] ) { |
|
364 | + if ( 'active' !== $e[ 'status' ] ) { |
|
365 | 365 | gravityview()->log->notice( 'Entry ID #{entry_id} is not active', array( 'entry_id' => $e->ID ) ); |
366 | 366 | return __( 'You are not allowed to view this content.', 'gravityview' ); |
367 | 367 | } |
@@ -372,7 +372,7 @@ discard block |
||
372 | 372 | } |
373 | 373 | |
374 | 374 | if ( $show_only_approved && ! $is_admin_and_can_view ) { |
375 | - if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $e->ID, \GravityView_Entry_Approval::meta_key ) ) ) { |
|
375 | + if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $e->ID, \GravityView_Entry_Approval::meta_key ) ) ) { |
|
376 | 376 | gravityview()->log->error( 'Entry ID #{entry_id} is not approved for viewing', array( 'entry_id' => $e->ID ) ); |
377 | 377 | return __( 'You are not allowed to view this content.', 'gravityview' ); |
378 | 378 | } |
@@ -547,7 +547,7 @@ discard block |
||
547 | 547 | $join_column = is_numeric( $join_column ) ? GF_Field::by_id( $join, $join_column ) : Internal_Field::by_id( $join_column ); |
548 | 548 | $join_on_column = is_numeric( $join_on_column ) ? GF_Field::by_id( $join_on, $join_on_column ) : Internal_Field::by_id( $join_on_column ); |
549 | 549 | |
550 | - $joins [] = new Join( $join, $join_column, $join_on, $join_on_column ); |
|
550 | + $joins [ ] = new Join( $join, $join_column, $join_on, $join_on_column ); |
|
551 | 551 | } |
552 | 552 | |
553 | 553 | return $joins; |
@@ -637,13 +637,13 @@ discard block |
||
637 | 637 | } |
638 | 638 | |
639 | 639 | foreach ( $_fields as $field ) { |
640 | - if ( ! empty( $field['unions'] ) ) { |
|
641 | - foreach ( $field['unions'] as $form_id => $field_id ) { |
|
640 | + if ( ! empty( $field[ 'unions' ] ) ) { |
|
641 | + foreach ( $field[ 'unions' ] as $form_id => $field_id ) { |
|
642 | 642 | if ( ! isset( $unions[ $form_id ] ) ) { |
643 | 643 | $unions[ $form_id ] = array(); |
644 | 644 | } |
645 | 645 | |
646 | - $unions[ $form_id ][ $field['id'] ] = |
|
646 | + $unions[ $form_id ][ $field[ 'id' ] ] = |
|
647 | 647 | is_numeric( $field_id ) ? \GV\GF_Field::by_id( \GV\GF_Form::by_id( $form_id ), $field_id ) : \GV\Internal_Field::by_id( $field_id ); |
648 | 648 | } |
649 | 649 | } |
@@ -698,7 +698,7 @@ discard block |
||
698 | 698 | if ( ! $view->form ) { |
699 | 699 | gravityview()->log->error( 'View #{view_id} tried attaching non-existent Form #{form_id} to it.', array( |
700 | 700 | 'view_id' => $view->ID, |
701 | - 'form_id' => $view->_gravityview_form_id ? : 0, |
|
701 | + 'form_id' => $view->_gravityview_form_id ?: 0, |
|
702 | 702 | ) ); |
703 | 703 | } |
704 | 704 | |
@@ -937,11 +937,11 @@ discard block |
||
937 | 937 | * Remove multiple sorting before calling legacy filters. |
938 | 938 | * This allows us to fake it till we make it. |
939 | 939 | */ |
940 | - if ( ! empty( $parameters['sort_field'] ) && is_array( $parameters['sort_field'] ) ) { |
|
940 | + if ( ! empty( $parameters[ 'sort_field' ] ) && is_array( $parameters[ 'sort_field' ] ) ) { |
|
941 | 941 | $has_multisort = true; |
942 | - $parameters['sort_field'] = reset( $parameters['sort_field'] ); |
|
943 | - if ( ! empty( $parameters['sort_direction'] ) && is_array( $parameters['sort_direction'] ) ) { |
|
944 | - $parameters['sort_direction'] = reset( $parameters['sort_direction'] ); |
|
942 | + $parameters[ 'sort_field' ] = reset( $parameters[ 'sort_field' ] ); |
|
943 | + if ( ! empty( $parameters[ 'sort_direction' ] ) && is_array( $parameters[ 'sort_direction' ] ) ) { |
|
944 | + $parameters[ 'sort_direction' ] = reset( $parameters[ 'sort_direction' ] ); |
|
945 | 945 | } |
946 | 946 | } |
947 | 947 | |
@@ -950,31 +950,30 @@ discard block |
||
950 | 950 | */ |
951 | 951 | $parameters = \GravityView_frontend::get_view_entries_parameters( $parameters, $this->form->ID ); |
952 | 952 | |
953 | - $parameters['context_view_id'] = $this->ID; |
|
953 | + $parameters[ 'context_view_id' ] = $this->ID; |
|
954 | 954 | $parameters = \GVCommon::calculate_get_entries_criteria( $parameters, $this->form->ID ); |
955 | 955 | |
956 | 956 | if ( ! is_array( $parameters ) ) { |
957 | 957 | $parameters = array(); |
958 | 958 | } |
959 | 959 | |
960 | - if ( ! is_array( $parameters['search_criteria'] ) ) { |
|
961 | - $parameters['search_criteria'] = array(); |
|
960 | + if ( ! is_array( $parameters[ 'search_criteria' ] ) ) { |
|
961 | + $parameters[ 'search_criteria' ] = array(); |
|
962 | 962 | } |
963 | 963 | |
964 | - if ( ( ! isset( $parameters['search_criteria']['field_filters'] ) ) || ( ! is_array( $parameters['search_criteria']['field_filters'] ) ) ) { |
|
965 | - $parameters['search_criteria']['field_filters'] = array(); |
|
964 | + if ( ( ! isset( $parameters[ 'search_criteria' ][ 'field_filters' ] ) ) || ( ! is_array( $parameters[ 'search_criteria' ][ 'field_filters' ] ) ) ) { |
|
965 | + $parameters[ 'search_criteria' ][ 'field_filters' ] = array(); |
|
966 | 966 | } |
967 | 967 | |
968 | 968 | if ( $request instanceof REST\Request ) { |
969 | 969 | $atts = $this->settings->as_atts(); |
970 | 970 | $paging_parameters = wp_parse_args( $request->get_paging(), array( |
971 | - 'paging' => array( 'page_size' => $atts['page_size'] ), |
|
971 | + 'paging' => array( 'page_size' => $atts[ 'page_size' ] ), |
|
972 | 972 | ) ); |
973 | - $parameters['paging'] = $paging_parameters['paging']; |
|
973 | + $parameters[ 'paging' ] = $paging_parameters[ 'paging' ]; |
|
974 | 974 | } |
975 | 975 | |
976 | - $page = Utils::get( $parameters['paging'], 'current_page' ) ? |
|
977 | - : ( ( ( $parameters['paging']['offset'] - $this->settings->get( 'offset' ) ) / \GV\Utils::get( $parameters, 'paging/page_size', 25 ) ) + 1 ); |
|
976 | + $page = Utils::get( $parameters[ 'paging' ], 'current_page' ) ?: ( ( ( $parameters[ 'paging' ][ 'offset' ] - $this->settings->get( 'offset' ) ) / \GV\Utils::get( $parameters, 'paging/page_size', 25 ) ) + 1 ); |
|
978 | 977 | |
979 | 978 | /** |
980 | 979 | * Cleanup duplicate field_filter parameters to simplify the query. |
@@ -982,14 +981,14 @@ discard block |
||
982 | 981 | $unique_field_filters = array(); |
983 | 982 | foreach ( Utils::get( $parameters, 'search_criteria/field_filters', array() ) as $key => $filter ) { |
984 | 983 | if ( 'mode' === $key ) { |
985 | - $unique_field_filters['mode'] = $filter; |
|
984 | + $unique_field_filters[ 'mode' ] = $filter; |
|
986 | 985 | } else if ( ! in_array( $filter, $unique_field_filters ) ) { |
987 | - $unique_field_filters[] = $filter; |
|
986 | + $unique_field_filters[ ] = $filter; |
|
988 | 987 | } |
989 | 988 | } |
990 | - $parameters['search_criteria']['field_filters'] = $unique_field_filters; |
|
989 | + $parameters[ 'search_criteria' ][ 'field_filters' ] = $unique_field_filters; |
|
991 | 990 | |
992 | - if ( ! empty( $parameters['search_criteria']['field_filters'] ) ) { |
|
991 | + if ( ! empty( $parameters[ 'search_criteria' ][ 'field_filters' ] ) ) { |
|
993 | 992 | gravityview()->log->notice( 'search_criteria/field_filters is not empty, third-party code may be using legacy search_criteria filters.' ); |
994 | 993 | } |
995 | 994 | |
@@ -998,7 +997,7 @@ discard block |
||
998 | 997 | $query_class = $this->get_query_class(); |
999 | 998 | |
1000 | 999 | /** @type \GF_Query $query */ |
1001 | - $query = new $query_class( $this->form->ID, $parameters['search_criteria'], Utils::get( $parameters, 'sorting' ) ); |
|
1000 | + $query = new $query_class( $this->form->ID, $parameters[ 'search_criteria' ], Utils::get( $parameters, 'sorting' ) ); |
|
1002 | 1001 | |
1003 | 1002 | /** |
1004 | 1003 | * Apply multisort. |
@@ -1009,15 +1008,15 @@ discard block |
||
1009 | 1008 | $view_setting_sort_field_ids = \GV\Utils::get( $atts, 'sort_field', array() ); |
1010 | 1009 | $view_setting_sort_directions = \GV\Utils::get( $atts, 'sort_direction', array() ); |
1011 | 1010 | |
1012 | - $has_sort_query_param = ! empty( $_GET['sort'] ) && is_array( $_GET['sort'] ); |
|
1011 | + $has_sort_query_param = ! empty( $_GET[ 'sort' ] ) && is_array( $_GET[ 'sort' ] ); |
|
1013 | 1012 | |
1014 | - if( $has_sort_query_param ) { |
|
1015 | - $has_sort_query_param = array_filter( array_values( $_GET['sort'] ) ); |
|
1013 | + if ( $has_sort_query_param ) { |
|
1014 | + $has_sort_query_param = array_filter( array_values( $_GET[ 'sort' ] ) ); |
|
1016 | 1015 | } |
1017 | 1016 | |
1018 | 1017 | if ( $this->settings->get( 'sort_columns' ) && $has_sort_query_param ) { |
1019 | - $sort_field_ids = array_keys( $_GET['sort'] ); |
|
1020 | - $sort_directions = array_values( $_GET['sort'] ); |
|
1018 | + $sort_field_ids = array_keys( $_GET[ 'sort' ] ); |
|
1019 | + $sort_directions = array_values( $_GET[ 'sort' ] ); |
|
1021 | 1020 | } else { |
1022 | 1021 | $sort_field_ids = $view_setting_sort_field_ids; |
1023 | 1022 | $sort_directions = $view_setting_sort_directions; |
@@ -1025,7 +1024,7 @@ discard block |
||
1025 | 1024 | |
1026 | 1025 | $skip_first = false; |
1027 | 1026 | |
1028 | - foreach ( (array) $sort_field_ids as $key => $sort_field_id ) { |
|
1027 | + foreach ( (array)$sort_field_ids as $key => $sort_field_id ) { |
|
1029 | 1028 | |
1030 | 1029 | if ( ! $skip_first && ! $has_sort_query_param ) { |
1031 | 1030 | $skip_first = true; // Skip the first one, it's already in the query |
@@ -1055,15 +1054,15 @@ discard block |
||
1055 | 1054 | |
1056 | 1055 | $merged_time = false; |
1057 | 1056 | |
1058 | - foreach ( $q['order'] as $oid => $order ) { |
|
1059 | - if ( $order[0] instanceof \GF_Query_Column ) { |
|
1060 | - $column = $order[0]; |
|
1061 | - } else if ( $order[0] instanceof \GF_Query_Call ) { |
|
1062 | - if ( count( $order[0]->columns ) != 1 || ! $order[0]->columns[0] instanceof \GF_Query_Column ) { |
|
1057 | + foreach ( $q[ 'order' ] as $oid => $order ) { |
|
1058 | + if ( $order[ 0 ] instanceof \GF_Query_Column ) { |
|
1059 | + $column = $order[ 0 ]; |
|
1060 | + } else if ( $order[ 0 ] instanceof \GF_Query_Call ) { |
|
1061 | + if ( count( $order[ 0 ]->columns ) != 1 || ! $order[ 0 ]->columns[ 0 ] instanceof \GF_Query_Column ) { |
|
1063 | 1062 | $orders[ $oid ] = $order; |
1064 | 1063 | continue; // Need something that resembles a single sort |
1065 | 1064 | } |
1066 | - $column = $order[0]->columns[0]; |
|
1065 | + $column = $order[ 0 ]->columns[ 0 ]; |
|
1067 | 1066 | } |
1068 | 1067 | |
1069 | 1068 | if ( ( ! $field = \GFAPI::get_field( $column->source, $column->field_id ) ) || $field->type !== 'time' ) { |
@@ -1077,7 +1076,7 @@ discard block |
||
1077 | 1076 | |
1078 | 1077 | $orders[ $oid ] = array( |
1079 | 1078 | new \GV\Mocks\GF_Query_Call_TIMESORT( 'timesort', array( $column, $sql ) ), |
1080 | - $order[1] // Mock it! |
|
1079 | + $order[ 1 ] // Mock it! |
|
1081 | 1080 | ); |
1082 | 1081 | |
1083 | 1082 | $merged_time = true; |
@@ -1088,15 +1087,15 @@ discard block |
||
1088 | 1087 | * ORDER again. |
1089 | 1088 | */ |
1090 | 1089 | if ( ! empty( $orders ) && $_orders = $query->_order_generate( $orders ) ) { |
1091 | - $sql['order'] = 'ORDER BY ' . implode( ', ', $_orders ); |
|
1090 | + $sql[ 'order' ] = 'ORDER BY ' . implode( ', ', $_orders ); |
|
1092 | 1091 | } |
1093 | 1092 | } |
1094 | 1093 | |
1095 | 1094 | return $sql; |
1096 | 1095 | } ); |
1097 | 1096 | |
1098 | - $query->limit( $parameters['paging']['page_size'] ) |
|
1099 | - ->offset( ( ( $page - 1 ) * $parameters['paging']['page_size'] ) + $this->settings->get( 'offset' ) ); |
|
1097 | + $query->limit( $parameters[ 'paging' ][ 'page_size' ] ) |
|
1098 | + ->offset( ( ( $page - 1 ) * $parameters[ 'paging' ][ 'page_size' ] ) + $this->settings->get( 'offset' ) ); |
|
1100 | 1099 | |
1101 | 1100 | /** |
1102 | 1101 | * Any joins? |
@@ -1119,7 +1118,7 @@ discard block |
||
1119 | 1118 | |
1120 | 1119 | $query_parameters = $query->_introspect(); |
1121 | 1120 | |
1122 | - $query->where( \GF_Query_Condition::_and( $query_parameters['where'], $condition ) ); |
|
1121 | + $query->where( \GF_Query_Condition::_and( $query_parameters[ 'where' ], $condition ) ); |
|
1123 | 1122 | } |
1124 | 1123 | |
1125 | 1124 | /** |
@@ -1153,7 +1152,7 @@ discard block |
||
1153 | 1152 | } |
1154 | 1153 | |
1155 | 1154 | $q = $query->_introspect(); |
1156 | - $query->where( \GF_Query_Condition::_and( $q['where'], $condition ) ); |
|
1155 | + $query->where( \GF_Query_Condition::_and( $q[ 'where' ], $condition ) ); |
|
1157 | 1156 | |
1158 | 1157 | if ( $this->settings->get( 'show_only_approved' ) && ! $is_admin_and_can_view ) { |
1159 | 1158 | |
@@ -1178,7 +1177,7 @@ discard block |
||
1178 | 1177 | |
1179 | 1178 | $query_parameters = $query->_introspect(); |
1180 | 1179 | |
1181 | - $query->where( \GF_Query_Condition::_and( $query_parameters['where'], $condition ) ); |
|
1180 | + $query->where( \GF_Query_Condition::_and( $query_parameters[ 'where' ], $condition ) ); |
|
1182 | 1181 | } |
1183 | 1182 | } |
1184 | 1183 | |
@@ -1202,7 +1201,7 @@ discard block |
||
1202 | 1201 | $conditions = array(); |
1203 | 1202 | |
1204 | 1203 | foreach ( $condition->expressions as $_condition ) { |
1205 | - $conditions[] = $recurse( $_condition, $fields, $recurse ); |
|
1204 | + $conditions[ ] = $recurse( $_condition, $fields, $recurse ); |
|
1206 | 1205 | } |
1207 | 1206 | |
1208 | 1207 | return call_user_func_array( |
@@ -1231,10 +1230,10 @@ discard block |
||
1231 | 1230 | $q = new $query_class( $form_id ); |
1232 | 1231 | |
1233 | 1232 | // Copy the WHERE clauses but substitute the field_ids to the respective ones |
1234 | - $q->where( $where_union_substitute( $query_parameters['where'], $fields, $where_union_substitute ) ); |
|
1233 | + $q->where( $where_union_substitute( $query_parameters[ 'where' ], $fields, $where_union_substitute ) ); |
|
1235 | 1234 | |
1236 | 1235 | // Copy the ORDER clause and substitute the field_ids to the respective ones |
1237 | - foreach ( $query_parameters['order'] as $order ) { |
|
1236 | + foreach ( $query_parameters[ 'order' ] as $order ) { |
|
1238 | 1237 | list( $column, $_order ) = $order; |
1239 | 1238 | |
1240 | 1239 | if ( $column && $column instanceof \GF_Query_Column ) { |
@@ -1248,15 +1247,15 @@ discard block |
||
1248 | 1247 | |
1249 | 1248 | add_filter( 'gform_gf_query_sql', $gf_query_sql_callback = function( $sql ) use ( &$unions_sql ) { |
1250 | 1249 | // Remove SQL_CALC_FOUND_ROWS as it's not needed in UNION clauses |
1251 | - $select = 'UNION ALL ' . str_replace( 'SQL_CALC_FOUND_ROWS ', '', $sql['select'] ); |
|
1250 | + $select = 'UNION ALL ' . str_replace( 'SQL_CALC_FOUND_ROWS ', '', $sql[ 'select' ] ); |
|
1252 | 1251 | |
1253 | 1252 | // Record the SQL |
1254 | - $unions_sql[] = array( |
|
1253 | + $unions_sql[ ] = array( |
|
1255 | 1254 | // Remove columns, we'll rebuild them |
1256 | 1255 | 'select' => preg_replace( '#DISTINCT (.*)#', 'DISTINCT ', $select ), |
1257 | - 'from' => $sql['from'], |
|
1258 | - 'join' => $sql['join'], |
|
1259 | - 'where' => $sql['where'], |
|
1256 | + 'from' => $sql[ 'from' ], |
|
1257 | + 'join' => $sql[ 'join' ], |
|
1258 | + 'where' => $sql[ 'where' ], |
|
1260 | 1259 | // Remove order and limit |
1261 | 1260 | ); |
1262 | 1261 | |
@@ -1273,11 +1272,11 @@ discard block |
||
1273 | 1272 | |
1274 | 1273 | add_filter( 'gform_gf_query_sql', $gf_query_sql_callback = function( $sql ) use ( $unions_sql ) { |
1275 | 1274 | // Remove SQL_CALC_FOUND_ROWS as it's not needed in UNION clauses |
1276 | - $sql['select'] = str_replace( 'SQL_CALC_FOUND_ROWS ', '', $sql['select'] ); |
|
1275 | + $sql[ 'select' ] = str_replace( 'SQL_CALC_FOUND_ROWS ', '', $sql[ 'select' ] ); |
|
1277 | 1276 | |
1278 | 1277 | // Remove columns, we'll rebuild them |
1279 | - preg_match( '#DISTINCT (`[motc]\d+`.`.*?`)#', $sql['select'], $select_match ); |
|
1280 | - $sql['select'] = preg_replace( '#DISTINCT (.*)#', 'DISTINCT ', $sql['select'] ); |
|
1278 | + preg_match( '#DISTINCT (`[motc]\d+`.`.*?`)#', $sql[ 'select' ], $select_match ); |
|
1279 | + $sql[ 'select' ] = preg_replace( '#DISTINCT (.*)#', 'DISTINCT ', $sql[ 'select' ] ); |
|
1281 | 1280 | |
1282 | 1281 | $unions = array(); |
1283 | 1282 | |
@@ -1288,30 +1287,30 @@ discard block |
||
1288 | 1287 | }; |
1289 | 1288 | |
1290 | 1289 | // Add all the order columns into the selects, so we can order by the whole union group |
1291 | - preg_match_all( '#(`[motc]\d+`.`.*?`)#', $sql['order'], $order_matches ); |
|
1290 | + preg_match_all( '#(`[motc]\d+`.`.*?`)#', $sql[ 'order' ], $order_matches ); |
|
1292 | 1291 | |
1293 | 1292 | $columns = array( |
1294 | - sprintf( '%s AS %s', $select_match[1], $column_to_alias( $select_match[1] ) ) |
|
1293 | + sprintf( '%s AS %s', $select_match[ 1 ], $column_to_alias( $select_match[ 1 ] ) ) |
|
1295 | 1294 | ); |
1296 | 1295 | |
1297 | 1296 | foreach ( array_slice( $order_matches, 1 ) as $match ) { |
1298 | - $columns[] = sprintf( '%s AS %s', $match[0], $column_to_alias( $match[0] ) ); |
|
1297 | + $columns[ ] = sprintf( '%s AS %s', $match[ 0 ], $column_to_alias( $match[ 0 ] ) ); |
|
1299 | 1298 | |
1300 | 1299 | // Rewrite the order columns to the shared aliases |
1301 | - $sql['order'] = str_replace( $match[0], $column_to_alias( $match[0] ), $sql['order'] ); |
|
1300 | + $sql[ 'order' ] = str_replace( $match[ 0 ], $column_to_alias( $match[ 0 ] ), $sql[ 'order' ] ); |
|
1302 | 1301 | } |
1303 | 1302 | |
1304 | 1303 | $columns = array_unique( $columns ); |
1305 | 1304 | |
1306 | 1305 | // Add the columns to every UNION |
1307 | 1306 | foreach ( $unions_sql as $union_sql ) { |
1308 | - $union_sql['select'] .= implode( ', ', $columns ); |
|
1309 | - $unions []= implode( ' ', $union_sql ); |
|
1307 | + $union_sql[ 'select' ] .= implode( ', ', $columns ); |
|
1308 | + $unions [ ] = implode( ' ', $union_sql ); |
|
1310 | 1309 | } |
1311 | 1310 | |
1312 | 1311 | // Add the columns to the main SELECT, but only grab the entry id column |
1313 | - $sql['select'] = 'SELECT SQL_CALC_FOUND_ROWS t1_id FROM (' . $sql['select'] . implode( ', ', $columns ); |
|
1314 | - $sql['order'] = implode( ' ', $unions ) . ') AS u ' . $sql['order']; |
|
1312 | + $sql[ 'select' ] = 'SELECT SQL_CALC_FOUND_ROWS t1_id FROM (' . $sql[ 'select' ] . implode( ', ', $columns ); |
|
1313 | + $sql[ 'order' ] = implode( ' ', $unions ) . ') AS u ' . $sql[ 'order' ]; |
|
1315 | 1314 | |
1316 | 1315 | return $sql; |
1317 | 1316 | } ); |
@@ -1356,20 +1355,20 @@ discard block |
||
1356 | 1355 | } ); |
1357 | 1356 | } else { |
1358 | 1357 | $entries = $this->form->entries |
1359 | - ->filter( \GV\GF_Entry_Filter::from_search_criteria( $parameters['search_criteria'] ) ) |
|
1358 | + ->filter( \GV\GF_Entry_Filter::from_search_criteria( $parameters[ 'search_criteria' ] ) ) |
|
1360 | 1359 | ->offset( $this->settings->get( 'offset' ) ) |
1361 | - ->limit( $parameters['paging']['page_size'] ) |
|
1360 | + ->limit( $parameters[ 'paging' ][ 'page_size' ] ) |
|
1362 | 1361 | ->page( $page ); |
1363 | 1362 | |
1364 | - if ( ! empty( $parameters['sorting'] ) && is_array( $parameters['sorting'] && ! isset( $parameters['sorting']['key'] ) ) ) { |
|
1363 | + if ( ! empty( $parameters[ 'sorting' ] ) && is_array( $parameters[ 'sorting' ] && ! isset( $parameters[ 'sorting' ][ 'key' ] ) ) ) { |
|
1365 | 1364 | // Pluck off multisort arrays |
1366 | - $parameters['sorting'] = $parameters['sorting'][0]; |
|
1365 | + $parameters[ 'sorting' ] = $parameters[ 'sorting' ][ 0 ]; |
|
1367 | 1366 | } |
1368 | 1367 | |
1369 | - if ( ! empty( $parameters['sorting'] ) && ! empty( $parameters['sorting']['key'] ) ) { |
|
1368 | + if ( ! empty( $parameters[ 'sorting' ] ) && ! empty( $parameters[ 'sorting' ][ 'key' ] ) ) { |
|
1370 | 1369 | $field = new \GV\Field(); |
1371 | - $field->ID = $parameters['sorting']['key']; |
|
1372 | - $direction = strtolower( $parameters['sorting']['direction'] ) == 'asc' ? \GV\Entry_Sort::ASC : \GV\Entry_Sort::DESC; |
|
1370 | + $field->ID = $parameters[ 'sorting' ][ 'key' ]; |
|
1371 | + $direction = strtolower( $parameters[ 'sorting' ][ 'direction' ] ) == 'asc' ? \GV\Entry_Sort::ASC : \GV\Entry_Sort::DESC; |
|
1373 | 1372 | $entries = $entries->sort( new \GV\Entry_Sort( $field, $direction ) ); |
1374 | 1373 | } |
1375 | 1374 | } |
@@ -1454,7 +1453,7 @@ discard block |
||
1454 | 1453 | $allowed = $headers = array(); |
1455 | 1454 | |
1456 | 1455 | foreach ( $view->fields->by_position( "directory_*" )->by_visible( $view )->all() as $id => $field ) { |
1457 | - $allowed[] = $field; |
|
1456 | + $allowed[ ] = $field; |
|
1458 | 1457 | } |
1459 | 1458 | |
1460 | 1459 | $renderer = new Field_Renderer(); |
@@ -1476,17 +1475,17 @@ discard block |
||
1476 | 1475 | } ); |
1477 | 1476 | |
1478 | 1477 | foreach ( array_diff( $allowed_field_ids, wp_list_pluck( $allowed, 'ID' ) ) as $field_id ) { |
1479 | - $allowed[] = is_numeric( $field_id ) ? \GV\GF_Field::by_id( $view->form, $field_id ) : \GV\Internal_Field::by_id( $field_id ); |
|
1478 | + $allowed[ ] = is_numeric( $field_id ) ? \GV\GF_Field::by_id( $view->form, $field_id ) : \GV\Internal_Field::by_id( $field_id ); |
|
1480 | 1479 | } |
1481 | 1480 | |
1482 | 1481 | foreach ( $allowed as $field ) { |
1483 | 1482 | $source = is_numeric( $field->ID ) ? $view->form : new \GV\Internal_Source(); |
1484 | 1483 | |
1485 | - $return[] = $renderer->render( $field, $view, $source, $entry, gravityview()->request, '\GV\Field_CSV_Template' ); |
|
1484 | + $return[ ] = $renderer->render( $field, $view, $source, $entry, gravityview()->request, '\GV\Field_CSV_Template' ); |
|
1486 | 1485 | |
1487 | 1486 | if ( ! $headers_done ) { |
1488 | 1487 | $label = $field->get_label( $view, $source, $entry ); |
1489 | - $headers[] = $label ? $label : $field->ID; |
|
1488 | + $headers[ ] = $label ? $label : $field->ID; |
|
1490 | 1489 | } |
1491 | 1490 | } |
1492 | 1491 |
@@ -163,14 +163,14 @@ |
||
163 | 163 | return $settings; |
164 | 164 | } |
165 | 165 | |
166 | - /** |
|
166 | + /** |
|
167 | 167 | * Get the Widget ID. |
168 | 168 | * |
169 | - * @return string The Widget ID. |
|
170 | - */ |
|
171 | - public function get_widget_id() { |
|
172 | - return $this->widget_id; |
|
173 | - } |
|
169 | + * @return string The Widget ID. |
|
170 | + */ |
|
171 | + public function get_widget_id() { |
|
172 | + return $this->widget_id; |
|
173 | + } |
|
174 | 174 | |
175 | 175 | /** |
176 | 176 | * Get the widget settings |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | $enable_custom_class = apply_filters( 'gravityview/widget/enable_custom_class', false, $this ); |
152 | 152 | |
153 | 153 | if ( $enable_custom_class ) { |
154 | - $settings['custom_class'] = array( |
|
154 | + $settings[ 'custom_class' ] = array( |
|
155 | 155 | 'type' => 'text', |
156 | 156 | 'label' => __( 'Custom CSS Class:', 'gravityview' ), |
157 | 157 | 'desc' => __( 'This class will be added to the widget container', 'gravityview' ), |
@@ -203,8 +203,8 @@ discard block |
||
203 | 203 | */ |
204 | 204 | public static function get_default_widget_areas() { |
205 | 205 | $default_areas = array( |
206 | - array( '1-1' => array( array( 'areaid' => 'top', 'title' => __( 'Top', 'gravityview' ) , 'subtitle' => '' ) ) ), |
|
207 | - array( '1-2' => array( array( 'areaid' => 'left', 'title' => __( 'Left', 'gravityview' ) , 'subtitle' => '' ) ), '2-2' => array( array( 'areaid' => 'right', 'title' => __( 'Right', 'gravityview' ) , 'subtitle' => '' ) ) ), |
|
206 | + array( '1-1' => array( array( 'areaid' => 'top', 'title' => __( 'Top', 'gravityview' ), 'subtitle' => '' ) ) ), |
|
207 | + array( '1-2' => array( array( 'areaid' => 'left', 'title' => __( 'Left', 'gravityview' ), 'subtitle' => '' ) ), '2-2' => array( array( 'areaid' => 'right', 'title' => __( 'Right', 'gravityview' ), 'subtitle' => '' ) ) ), |
|
208 | 208 | ); |
209 | 209 | |
210 | 210 | /** |
@@ -234,7 +234,7 @@ discard block |
||
234 | 234 | } |
235 | 235 | |
236 | 236 | $widgets[ $this->get_widget_id() ] = array( |
237 | - 'label' => $this->widget_label , |
|
237 | + 'label' => $this->widget_label, |
|
238 | 238 | 'description' => $this->widget_description, |
239 | 239 | 'subtitle' => $this->widget_subtitle, |
240 | 240 | 'class' => get_called_class(), |
@@ -255,7 +255,7 @@ discard block |
||
255 | 255 | */ |
256 | 256 | public function assign_widget_options( $options = array(), $template = '', $widget = '' ) { |
257 | 257 | if ( $this->get_widget_id() === $widget ) { |
258 | - if( $settings = $this->get_settings() ) { |
|
258 | + if ( $settings = $this->get_settings() ) { |
|
259 | 259 | $options = array_merge( $options, $settings ); |
260 | 260 | } |
261 | 261 | } |
@@ -306,7 +306,7 @@ discard block |
||
306 | 306 | return; |
307 | 307 | } |
308 | 308 | |
309 | - add_shortcode( $this->shortcode_name, array( $this, 'render_shortcode') ); |
|
309 | + add_shortcode( $this->shortcode_name, array( $this, 'render_shortcode' ) ); |
|
310 | 310 | } |
311 | 311 | |
312 | 312 | /** |
@@ -393,7 +393,7 @@ |
||
393 | 393 | * @internal |
394 | 394 | * @since 2.0 |
395 | 395 | * |
396 | - * @return \GV\Widget|null The widget implementation from configuration or none. |
|
396 | + * @return Widget The widget implementation from configuration or none. |
|
397 | 397 | */ |
398 | 398 | public static function from_configuration( $configuration ) { |
399 | 399 | $registered_widgets = self::registered(); |
@@ -34,7 +34,7 @@ |
||
34 | 34 | global $post; |
35 | 35 | |
36 | 36 | if ( $post ) { |
37 | - $context['post'] = $post; |
|
37 | + $context[ 'post' ] = $post; |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | \GV\Mocks\Legacy_Context::push( $context ); |
@@ -113,14 +113,14 @@ |
||
113 | 113 | |
114 | 114 | /** Require critical legacy core files. @todo Deprecate */ |
115 | 115 | require_once $this->plugin->dir( 'includes/helper-functions.php' ); |
116 | - require_once $this->plugin->dir( 'includes/class-common.php'); |
|
117 | - require_once $this->plugin->dir( 'includes/connector-functions.php'); |
|
116 | + require_once $this->plugin->dir( 'includes/class-common.php' ); |
|
117 | + require_once $this->plugin->dir( 'includes/connector-functions.php' ); |
|
118 | 118 | require_once $this->plugin->dir( 'includes/class-gravityview-compatibility.php' ); |
119 | 119 | require_once $this->plugin->dir( 'includes/class-gravityview-roles-capabilities.php' ); |
120 | 120 | require_once $this->plugin->dir( 'includes/class-gravityview-admin-notices.php' ); |
121 | 121 | require_once $this->plugin->dir( 'includes/class-admin.php' ); |
122 | - require_once $this->plugin->dir( 'includes/class-post-types.php'); |
|
123 | - require_once $this->plugin->dir( 'includes/class-cache.php'); |
|
122 | + require_once $this->plugin->dir( 'includes/class-post-types.php' ); |
|
123 | + require_once $this->plugin->dir( 'includes/class-cache.php' ); |
|
124 | 124 | |
125 | 125 | /** |
126 | 126 | * GravityView extensions and widgets. |