@@ -11,10 +11,10 @@ |
||
| 11 | 11 | ?> |
| 12 | 12 | |
| 13 | 13 | <div class="gv-search-box gv-search-date"> |
| 14 | - <?php if( ! gv_empty( $search_field['label'], false, false ) ) { ?> |
|
| 15 | - <label for="search-box-<?php echo esc_attr( $search_field['name'] ); ?>"><?php echo esc_html( $search_field['label'] ); ?></label> |
|
| 14 | + <?php if ( ! gv_empty( $search_field[ 'label' ], false, false ) ) { ?> |
|
| 15 | + <label for="search-box-<?php echo esc_attr( $search_field[ 'name' ] ); ?>"><?php echo esc_html( $search_field[ 'label' ] ); ?></label> |
|
| 16 | 16 | <?php } ?> |
| 17 | 17 | <p> |
| 18 | - <input type="text" name="<?php echo esc_attr( $search_field['name'] ); ?>" id="search-box-<?php echo esc_attr( $search_field['name'] ); ?>" value="<?php echo esc_attr( $search_field['value'] ); ?>" class="<?php echo esc_html( $gravityview_view->datepicker_class ); ?>" > |
|
| 18 | + <input type="text" name="<?php echo esc_attr( $search_field[ 'name' ] ); ?>" id="search-box-<?php echo esc_attr( $search_field[ 'name' ] ); ?>" value="<?php echo esc_attr( $search_field[ 'value' ] ); ?>" class="<?php echo esc_html( $gravityview_view->datepicker_class ); ?>" > |
|
| 19 | 19 | </p> |
| 20 | 20 | </div> |
| 21 | 21 | \ No newline at end of file |
@@ -10,10 +10,10 @@ |
||
| 10 | 10 | |
| 11 | 11 | ?> |
| 12 | 12 | <div class="gv-search-box gv-search-field-text"> |
| 13 | - <?php if( ! gv_empty( $search_field['label'], false, false ) ) { ?> |
|
| 14 | - <label for="search-box-<?php echo esc_attr( $search_field['name'] ); ?>"><?php echo esc_html( $search_field['label'] ); ?></label> |
|
| 13 | + <?php if ( ! gv_empty( $search_field[ 'label' ], false, false ) ) { ?> |
|
| 14 | + <label for="search-box-<?php echo esc_attr( $search_field[ 'name' ] ); ?>"><?php echo esc_html( $search_field[ 'label' ] ); ?></label> |
|
| 15 | 15 | <?php } ?> |
| 16 | 16 | <p> |
| 17 | - <input type="text" name="<?php echo esc_attr( $search_field['name'] ); ?>" id="search-box-<?php echo esc_attr( $search_field['name'] ); ?>" value="<?php echo esc_attr( $search_field['value'] ); ?>"> |
|
| 17 | + <input type="text" name="<?php echo esc_attr( $search_field[ 'name' ] ); ?>" id="search-box-<?php echo esc_attr( $search_field[ 'name' ] ); ?>" value="<?php echo esc_attr( $search_field[ 'value' ] ); ?>"> |
|
| 18 | 18 | </p> |
| 19 | 19 | </div> |
| 20 | 20 | \ No newline at end of file |
@@ -12,8 +12,8 @@ |
||
| 12 | 12 | ?> |
| 13 | 13 | |
| 14 | 14 | <div class="gv-search-box gv-search-field-single_checkbox"> |
| 15 | - <label for="search-box-<?php echo esc_attr( $search_field['name'] ); ?>" class="gv-check-radio"> |
|
| 16 | - <input type="checkbox" name="<?php echo esc_attr( $search_field['name'] ); ?>" value="1" id="search-box-<?php echo esc_attr( $search_field['name'] ); ?>" <?php checked( '1', $search_field['value'], true ); ?>> |
|
| 17 | - <?php if( ! gv_empty( $search_field['label'], false, false ) ) { echo esc_html( $search_field['label'] ); } ?> |
|
| 15 | + <label for="search-box-<?php echo esc_attr( $search_field[ 'name' ] ); ?>" class="gv-check-radio"> |
|
| 16 | + <input type="checkbox" name="<?php echo esc_attr( $search_field[ 'name' ] ); ?>" value="1" id="search-box-<?php echo esc_attr( $search_field[ 'name' ] ); ?>" <?php checked( '1', $search_field[ 'value' ], true ); ?>> |
|
| 17 | + <?php if ( ! gv_empty( $search_field[ 'label' ], false, false ) ) { echo esc_html( $search_field[ 'label' ] ); } ?> |
|
| 18 | 18 | </label> |
| 19 | 19 | </div> |
| 20 | 20 | \ No newline at end of file |
@@ -42,16 +42,16 @@ discard block |
||
| 42 | 42 | |
| 43 | 43 | $args = wp_parse_args( $args, $defaults ); |
| 44 | 44 | |
| 45 | - $forms = gravityview_get_forms( (bool) $args['active'], (bool) $args['trash'] ); |
|
| 45 | + $forms = gravityview_get_forms( (bool)$args[ 'active' ], (bool)$args[ 'trash' ] ); |
|
| 46 | 46 | |
| 47 | - if( array() === $args['options'] ) { |
|
| 47 | + if ( array() === $args[ 'options' ] ) { |
|
| 48 | 48 | foreach ( $forms as $form ) { |
| 49 | 49 | |
| 50 | - if ( in_array( $form['id'], $args['exclude'] ) ) { |
|
| 50 | + if ( in_array( $form[ 'id' ], $args[ 'exclude' ] ) ) { |
|
| 51 | 51 | continue; |
| 52 | 52 | } |
| 53 | 53 | |
| 54 | - $args['options'][ $form['id'] ] = esc_html( $form['title'] ); |
|
| 54 | + $args[ 'options' ][ $form[ 'id' ] ] = esc_html( $form[ 'title' ] ); |
|
| 55 | 55 | } |
| 56 | 56 | } |
| 57 | 57 | |
@@ -83,15 +83,15 @@ discard block |
||
| 83 | 83 | |
| 84 | 84 | $args = wp_parse_args( $args, $defaults ); |
| 85 | 85 | |
| 86 | - if( empty( $args['form_id'] ) ) { |
|
| 86 | + if ( empty( $args[ 'form_id' ] ) ) { |
|
| 87 | 87 | return ''; |
| 88 | 88 | } |
| 89 | 89 | |
| 90 | - $fields = GVCommon::get_sortable_fields_array( $args['form_id'] ); |
|
| 90 | + $fields = GVCommon::get_sortable_fields_array( $args[ 'form_id' ] ); |
|
| 91 | 91 | |
| 92 | - if( array() === $args['options'] ) { |
|
| 92 | + if ( array() === $args[ 'options' ] ) { |
|
| 93 | 93 | foreach ( $fields as $field_id => $field ) { |
| 94 | - $args['options'][ $field_id ] = esc_html( $field['label'] ); |
|
| 94 | + $args[ 'options' ][ $field_id ] = esc_html( $field[ 'label' ] ); |
|
| 95 | 95 | } |
| 96 | 96 | } |
| 97 | 97 | |
@@ -127,43 +127,43 @@ discard block |
||
| 127 | 127 | $args = wp_parse_args( $args, $defaults ); |
| 128 | 128 | |
| 129 | 129 | $data_elements = ''; |
| 130 | - foreach ( $args['data'] as $key => $value ) { |
|
| 130 | + foreach ( $args[ 'data' ] as $key => $value ) { |
|
| 131 | 131 | $data_elements .= ' data-' . esc_attr( $key ) . '="' . esc_attr( $value ) . '"'; |
| 132 | 132 | } |
| 133 | 133 | |
| 134 | - if( $args['multiple'] ) { |
|
| 134 | + if ( $args[ 'multiple' ] ) { |
|
| 135 | 135 | $multiple = ' MULTIPLE'; |
| 136 | 136 | } else { |
| 137 | 137 | $multiple = ''; |
| 138 | 138 | } |
| 139 | 139 | |
| 140 | - if( $args['placeholder'] ) { |
|
| 141 | - $placeholder = $args['placeholder']; |
|
| 140 | + if ( $args[ 'placeholder' ] ) { |
|
| 141 | + $placeholder = $args[ 'placeholder' ]; |
|
| 142 | 142 | } else { |
| 143 | 143 | $placeholder = ''; |
| 144 | 144 | } |
| 145 | 145 | |
| 146 | - $disabled = $args['disabled'] ? ' disabled="disabled"' : ''; |
|
| 147 | - $class = implode( ' ', array_map( 'sanitize_html_class', explode( ' ', $args['class'] ) ) ); |
|
| 148 | - $output = '<select name="' . esc_attr( $args['name'] ) . '" id="' . esc_attr( str_replace( '-', '_', $args['id'] ) ) . '" class="gravityview-select ' . $class . '"' . $multiple . $disabled . ' data-placeholder="' . $placeholder . '"'. $data_elements . '>'; |
|
| 146 | + $disabled = $args[ 'disabled' ] ? ' disabled="disabled"' : ''; |
|
| 147 | + $class = implode( ' ', array_map( 'sanitize_html_class', explode( ' ', $args[ 'class' ] ) ) ); |
|
| 148 | + $output = '<select name="' . esc_attr( $args[ 'name' ] ) . '" id="' . esc_attr( str_replace( '-', '_', $args[ 'id' ] ) ) . '" class="gravityview-select ' . $class . '"' . $multiple . $disabled . ' data-placeholder="' . $placeholder . '"' . $data_elements . '>'; |
|
| 149 | 149 | |
| 150 | - if ( ! empty( $args['options'] ) ) { |
|
| 150 | + if ( ! empty( $args[ 'options' ] ) ) { |
|
| 151 | 151 | |
| 152 | - if ( $args['show_option_none'] ) { |
|
| 153 | - if( $args['multiple'] ) { |
|
| 154 | - $selected = selected( true, in_array( -1, $args['selected'] ), false ); |
|
| 152 | + if ( $args[ 'show_option_none' ] ) { |
|
| 153 | + if ( $args[ 'multiple' ] ) { |
|
| 154 | + $selected = selected( true, in_array( -1, $args[ 'selected' ] ), false ); |
|
| 155 | 155 | } else { |
| 156 | - $selected = selected( $args['selected'], -1, false ); |
|
| 156 | + $selected = selected( $args[ 'selected' ], -1, false ); |
|
| 157 | 157 | } |
| 158 | - $output .= '<option value="-1"' . $selected . '>' . esc_html( $args['show_option_none'] ) . '</option>'; |
|
| 158 | + $output .= '<option value="-1"' . $selected . '>' . esc_html( $args[ 'show_option_none' ] ) . '</option>'; |
|
| 159 | 159 | } |
| 160 | 160 | |
| 161 | - foreach( $args['options'] as $key => $option ) { |
|
| 161 | + foreach ( $args[ 'options' ] as $key => $option ) { |
|
| 162 | 162 | |
| 163 | - if( $args['multiple'] && is_array( $args['selected'] ) ) { |
|
| 164 | - $selected = selected( true, in_array( $key, $args['selected'], true ), false ); |
|
| 163 | + if ( $args[ 'multiple' ] && is_array( $args[ 'selected' ] ) ) { |
|
| 164 | + $selected = selected( true, in_array( $key, $args[ 'selected' ], true ), false ); |
|
| 165 | 165 | } else { |
| 166 | - $selected = selected( $args['selected'], $key, false ); |
|
| 166 | + $selected = selected( $args[ 'selected' ], $key, false ); |
|
| 167 | 167 | } |
| 168 | 168 | |
| 169 | 169 | $output .= '<option value="' . esc_attr( $key ) . '"' . $selected . '>' . esc_html( $option ) . '</option>'; |
@@ -43,12 +43,12 @@ discard block |
||
| 43 | 43 | function parse_um_profile_post_content( $args = array() ) { |
| 44 | 44 | global $ultimatemember; |
| 45 | 45 | |
| 46 | - if( ! $ultimatemember || ! is_object( $ultimatemember ) || ! class_exists( 'GravityView_View_Data' ) ) { |
|
| 46 | + if ( ! $ultimatemember || ! is_object( $ultimatemember ) || ! class_exists( 'GravityView_View_Data' ) ) { |
|
| 47 | 47 | return; |
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | // @todo Support Ultimate Member 2.0 - for now, prevent fatal error |
| 51 | - if( ! isset( $ultimatemember->profile ) ) { |
|
| 51 | + if ( ! isset( $ultimatemember->profile ) ) { |
|
| 52 | 52 | return; |
| 53 | 53 | } |
| 54 | 54 | |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | return; |
| 65 | 65 | } |
| 66 | 66 | |
| 67 | - GravityView_View_Data::getInstance()->parse_post_content( $active_tab[0]->post_content ); |
|
| 67 | + GravityView_View_Data::getInstance()->parse_post_content( $active_tab[ 0 ]->post_content ); |
|
| 68 | 68 | |
| 69 | 69 | wp_reset_postdata(); |
| 70 | 70 | } |
@@ -141,7 +141,7 @@ |
||
| 141 | 141 | global $wpdb; |
| 142 | 142 | |
| 143 | 143 | if ( version_compare( GravityView_GFFormsModel::get_database_version(), '2.3-dev-1', '>=' ) |
| 144 | - && method_exists( 'GFFormsModel', 'get_entry_notes_table_name' ) ) { |
|
| 144 | + && method_exists( 'GFFormsModel', 'get_entry_notes_table_name' ) ) { |
|
| 145 | 145 | $notes_table = GFFormsModel::get_entry_notes_table_name(); |
| 146 | 146 | } else { |
| 147 | 147 | $notes_table = GFFormsModel::get_lead_notes_table_name(); |
@@ -67,10 +67,10 @@ discard block |
||
| 67 | 67 | // Make sure the keys are all set |
| 68 | 68 | $note = wp_parse_args( $note, $default_note ); |
| 69 | 69 | |
| 70 | - GFFormsModel::add_note( intval( $note['lead_id'] ), intval( $note['user_id'] ), esc_attr( $note['user_name'] ), $note['note'], esc_attr( $note['note_type'] ) ); |
|
| 70 | + GFFormsModel::add_note( intval( $note[ 'lead_id' ] ), intval( $note[ 'user_id' ] ), esc_attr( $note[ 'user_name' ] ), $note[ 'note' ], esc_attr( $note[ 'note_type' ] ) ); |
|
| 71 | 71 | |
| 72 | 72 | // If last_error is empty string, there was no error. |
| 73 | - if( empty( $wpdb->last_error ) ) { |
|
| 73 | + if ( empty( $wpdb->last_error ) ) { |
|
| 74 | 74 | $return = $wpdb->insert_id; |
| 75 | 75 | } else { |
| 76 | 76 | $return = new WP_Error( 'gravityview-add-note', $wpdb->last_error ); |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | */ |
| 97 | 97 | public static function delete_notes( $note_ids = array() ) { |
| 98 | 98 | |
| 99 | - if( !is_array( $note_ids ) ) { |
|
| 99 | + if ( ! is_array( $note_ids ) ) { |
|
| 100 | 100 | |
| 101 | 101 | gravityview()->log->error( 'Note IDs not an array. Not processing delete request.', array( 'data' => $note_ids ) ); |
| 102 | 102 | |
@@ -157,7 +157,7 @@ discard block |
||
| 157 | 157 | ) |
| 158 | 158 | ); |
| 159 | 159 | |
| 160 | - return $results ? $results[0] : false; |
|
| 160 | + return $results ? $results[ 0 ] : false; |
|
| 161 | 161 | } |
| 162 | 162 | |
| 163 | 163 | /** |
@@ -170,8 +170,8 @@ discard block |
||
| 170 | 170 | */ |
| 171 | 171 | public static function filter_avatar( $avatar = '', $note = null ) { |
| 172 | 172 | |
| 173 | - if( 'gravityview' === $note->note_type && -1 === (int)$note->user_id ) { |
|
| 174 | - $avatar = sprintf( '<img src="%s" width="48" height="48" alt="GravityView" class="avatar avatar-48 gravityview-avatar" />', esc_url_raw( plugins_url( 'assets/images/floaty-avatar.png', GRAVITYVIEW_FILE ) ) ); |
|
| 173 | + if ( 'gravityview' === $note->note_type && -1 === (int)$note->user_id ) { |
|
| 174 | + $avatar = sprintf( '<img src="%s" width="48" height="48" alt="GravityView" class="avatar avatar-48 gravityview-avatar" />', esc_url_raw( plugins_url( 'assets/images/floaty-avatar.png', GRAVITYVIEW_FILE ) ) ); |
|
| 175 | 175 | } |
| 176 | 176 | |
| 177 | 177 | return $avatar; |
@@ -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': |
@@ -134,7 +134,7 @@ discard block |
||
| 134 | 134 | $supports = array( 'title', 'revisions' ); |
| 135 | 135 | |
| 136 | 136 | if ( $is_hierarchical ) { |
| 137 | - $supports[] = 'page-attributes'; |
|
| 137 | + $supports[ ] = 'page-attributes'; |
|
| 138 | 138 | } |
| 139 | 139 | |
| 140 | 140 | /** |
@@ -243,12 +243,12 @@ discard block |
||
| 243 | 243 | $tsv_rule = array( sprintf( '%s/([^/]+)/tsv/?', $slug ), 'index.php?gravityview=$matches[1]&tsv=1', 'top' ); |
| 244 | 244 | |
| 245 | 245 | add_filter( 'query_vars', function( $query_vars ) { |
| 246 | - $query_vars[] = 'csv'; |
|
| 247 | - $query_vars[] = 'tsv'; |
|
| 246 | + $query_vars[ ] = 'csv'; |
|
| 247 | + $query_vars[ ] = 'tsv'; |
|
| 248 | 248 | return $query_vars; |
| 249 | 249 | } ); |
| 250 | 250 | |
| 251 | - if ( ! isset( $wp_rewrite->extra_rules_top[ $csv_rule[0] ] ) ) { |
|
| 251 | + if ( ! isset( $wp_rewrite->extra_rules_top[ $csv_rule[ 0 ] ] ) ) { |
|
| 252 | 252 | call_user_func_array( 'add_rewrite_rule', $csv_rule ); |
| 253 | 253 | call_user_func_array( 'add_rewrite_rule', $tsv_rule ); |
| 254 | 254 | } |
@@ -309,7 +309,7 @@ discard block |
||
| 309 | 309 | |
| 310 | 310 | $message = esc_html__( 'You can only see this message because you are able to edit this View.', 'gk-gravityview' ); |
| 311 | 311 | |
| 312 | - $image = sprintf( '<img alt="%s" src="%s" style="margin-top: 10px;" />', esc_attr__( 'Data Source', 'gk-gravityview' ), esc_url( plugins_url( 'assets/images/screenshots/data-source.png', GRAVITYVIEW_FILE ) ) ); |
|
| 312 | + $image = sprintf( '<img alt="%s" src="%s" style="margin-top: 10px;" />', esc_attr__( 'Data Source', 'gk-gravityview' ), esc_url( plugins_url( 'assets/images/screenshots/data-source.png', GRAVITYVIEW_FILE ) ) ); |
|
| 313 | 313 | |
| 314 | 314 | return \GVCommon::generate_notice( '<h3>' . $title . '</h3>' . wpautop( $message . $image ), 'notice' ); |
| 315 | 315 | } |
@@ -335,13 +335,13 @@ discard block |
||
| 335 | 335 | return $content; |
| 336 | 336 | } |
| 337 | 337 | |
| 338 | - $is_admin_and_can_view = $view->settings->get( 'admin_show_all_statuses' ) && \GVCommon::has_cap('gravityview_moderate_entries', $view->ID ); |
|
| 338 | + $is_admin_and_can_view = $view->settings->get( 'admin_show_all_statuses' ) && \GVCommon::has_cap( 'gravityview_moderate_entries', $view->ID ); |
|
| 339 | 339 | |
| 340 | 340 | /** |
| 341 | 341 | * Editing a single entry. |
| 342 | 342 | */ |
| 343 | 343 | if ( $entry = $request->is_edit_entry( $view->form ? $view->form->ID : 0 ) ) { |
| 344 | - if ( $entry['status'] != 'active' ) { |
|
| 344 | + if ( $entry[ 'status' ] != 'active' ) { |
|
| 345 | 345 | gravityview()->log->notice( 'Entry ID #{entry_id} is not active', array( 'entry_id' => $entry->ID ) ); |
| 346 | 346 | return __( 'You are not allowed to view this content.', 'gk-gravityview' ); |
| 347 | 347 | } |
@@ -352,7 +352,7 @@ discard block |
||
| 352 | 352 | } |
| 353 | 353 | |
| 354 | 354 | if ( $view->settings->get( 'show_only_approved' ) && ! $is_admin_and_can_view ) { |
| 355 | - if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $entry->ID, \GravityView_Entry_Approval::meta_key ) ) ) { |
|
| 355 | + if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $entry->ID, \GravityView_Entry_Approval::meta_key ) ) ) { |
|
| 356 | 356 | gravityview()->log->error( 'Entry ID #{entry_id} is not approved for viewing', array( 'entry_id' => $entry->ID ) ); |
| 357 | 357 | return __( 'You are not allowed to view this content.', 'gk-gravityview' ); |
| 358 | 358 | } |
@@ -375,7 +375,7 @@ discard block |
||
| 375 | 375 | |
| 376 | 376 | foreach ( $entryset as $e ) { |
| 377 | 377 | |
| 378 | - if ( 'active' !== $e['status'] ) { |
|
| 378 | + if ( 'active' !== $e[ 'status' ] ) { |
|
| 379 | 379 | gravityview()->log->notice( 'Entry ID #{entry_id} is not active', array( 'entry_id' => $e->ID ) ); |
| 380 | 380 | return __( 'You are not allowed to view this content.', 'gk-gravityview' ); |
| 381 | 381 | } |
@@ -386,7 +386,7 @@ discard block |
||
| 386 | 386 | } |
| 387 | 387 | |
| 388 | 388 | if ( $show_only_approved && ! $is_admin_and_can_view ) { |
| 389 | - if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $e->ID, \GravityView_Entry_Approval::meta_key ) ) ) { |
|
| 389 | + if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $e->ID, \GravityView_Entry_Approval::meta_key ) ) ) { |
|
| 390 | 390 | gravityview()->log->error( 'Entry ID #{entry_id} is not approved for viewing', array( 'entry_id' => $e->ID ) ); |
| 391 | 391 | return __( 'You are not allowed to view this content.', 'gk-gravityview' ); |
| 392 | 392 | } |
@@ -561,7 +561,7 @@ discard block |
||
| 561 | 561 | $join_column = is_numeric( $join_column ) ? GF_Field::by_id( $join, $join_column ) : Internal_Field::by_id( $join_column ); |
| 562 | 562 | $join_on_column = is_numeric( $join_on_column ) ? GF_Field::by_id( $join_on, $join_on_column ) : Internal_Field::by_id( $join_on_column ); |
| 563 | 563 | |
| 564 | - $joins [] = new Join( $join, $join_column, $join_on, $join_on_column ); |
|
| 564 | + $joins [ ] = new Join( $join, $join_column, $join_on, $join_on_column ); |
|
| 565 | 565 | } |
| 566 | 566 | |
| 567 | 567 | return $joins; |
@@ -651,13 +651,13 @@ discard block |
||
| 651 | 651 | } |
| 652 | 652 | |
| 653 | 653 | foreach ( $_fields as $field ) { |
| 654 | - if ( ! empty( $field['unions'] ) ) { |
|
| 655 | - foreach ( $field['unions'] as $form_id => $field_id ) { |
|
| 654 | + if ( ! empty( $field[ 'unions' ] ) ) { |
|
| 655 | + foreach ( $field[ 'unions' ] as $form_id => $field_id ) { |
|
| 656 | 656 | if ( ! isset( $unions[ $form_id ] ) ) { |
| 657 | 657 | $unions[ $form_id ] = array(); |
| 658 | 658 | } |
| 659 | 659 | |
| 660 | - $unions[ $form_id ][ $field['id'] ] = |
|
| 660 | + $unions[ $form_id ][ $field[ 'id' ] ] = |
|
| 661 | 661 | 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 ); |
| 662 | 662 | } |
| 663 | 663 | } |
@@ -710,10 +710,10 @@ discard block |
||
| 710 | 710 | /** Get connected form. */ |
| 711 | 711 | $view->form = GF_Form::by_id( $view->_gravityview_form_id ); |
| 712 | 712 | global $pagenow; |
| 713 | - if ( ! $view->form && 'post-new.php' !== $pagenow ) { |
|
| 713 | + if ( ! $view->form && 'post-new.php' !== $pagenow ) { |
|
| 714 | 714 | gravityview()->log->error( 'View #{view_id} tried attaching non-existent Form #{form_id} to it.', array( |
| 715 | 715 | 'view_id' => $view->ID, |
| 716 | - 'form_id' => $view->_gravityview_form_id ? : 0, |
|
| 716 | + 'form_id' => $view->_gravityview_form_id ?: 0, |
|
| 717 | 717 | ) ); |
| 718 | 718 | } |
| 719 | 719 | |
@@ -843,7 +843,7 @@ discard block |
||
| 843 | 843 | * @since 2.0 |
| 844 | 844 | * @return bool Whether the offset exists or not, limited to GravityView_View_Data::$views element keys. |
| 845 | 845 | */ |
| 846 | - #[\ReturnTypeWillChange] |
|
| 846 | + #[\ReturnTypeWillChange ] |
|
| 847 | 847 | public function offsetExists( $offset ) { |
| 848 | 848 | $data_keys = array( 'id', 'view_id', 'form_id', 'template_id', 'atts', 'fields', 'widgets', 'form' ); |
| 849 | 849 | return in_array( $offset, $data_keys ); |
@@ -860,7 +860,7 @@ discard block |
||
| 860 | 860 | * |
| 861 | 861 | * @return mixed The value of the requested view data key limited to GravityView_View_Data::$views element keys. If offset not found, return null. |
| 862 | 862 | */ |
| 863 | - #[\ReturnTypeWillChange] |
|
| 863 | + #[\ReturnTypeWillChange ] |
|
| 864 | 864 | public function offsetGet( $offset ) { |
| 865 | 865 | |
| 866 | 866 | gravityview()->log->notice( 'This is a \GV\View object should not be accessed as an array.' ); |
@@ -897,7 +897,7 @@ discard block |
||
| 897 | 897 | * |
| 898 | 898 | * @return void |
| 899 | 899 | */ |
| 900 | - #[\ReturnTypeWillChange] |
|
| 900 | + #[\ReturnTypeWillChange ] |
|
| 901 | 901 | public function offsetSet( $offset, $value ) { |
| 902 | 902 | gravityview()->log->error( 'The old view data is no longer mutable. This is a \GV\View object should not be accessed as an array.' ); |
| 903 | 903 | } |
@@ -910,7 +910,7 @@ discard block |
||
| 910 | 910 | * @since 2.0 |
| 911 | 911 | * @return void |
| 912 | 912 | */ |
| 913 | - #[\ReturnTypeWillChange] |
|
| 913 | + #[\ReturnTypeWillChange ] |
|
| 914 | 914 | public function offsetUnset( $offset ) { |
| 915 | 915 | gravityview()->log->error( 'The old view data is no longer mutable. This is a \GV\View object should not be accessed as an array.' ); |
| 916 | 916 | } |
@@ -961,11 +961,11 @@ discard block |
||
| 961 | 961 | * Remove multiple sorting before calling legacy filters. |
| 962 | 962 | * This allows us to fake it till we make it. |
| 963 | 963 | */ |
| 964 | - if ( ! empty( $parameters['sort_field'] ) && is_array( $parameters['sort_field'] ) ) { |
|
| 964 | + if ( ! empty( $parameters[ 'sort_field' ] ) && is_array( $parameters[ 'sort_field' ] ) ) { |
|
| 965 | 965 | $has_multisort = true; |
| 966 | - $parameters['sort_field'] = reset( $parameters['sort_field'] ); |
|
| 967 | - if ( ! empty( $parameters['sort_direction'] ) && is_array( $parameters['sort_direction'] ) ) { |
|
| 968 | - $parameters['sort_direction'] = reset( $parameters['sort_direction'] ); |
|
| 966 | + $parameters[ 'sort_field' ] = reset( $parameters[ 'sort_field' ] ); |
|
| 967 | + if ( ! empty( $parameters[ 'sort_direction' ] ) && is_array( $parameters[ 'sort_direction' ] ) ) { |
|
| 968 | + $parameters[ 'sort_direction' ] = reset( $parameters[ 'sort_direction' ] ); |
|
| 969 | 969 | } |
| 970 | 970 | } |
| 971 | 971 | |
@@ -974,31 +974,30 @@ discard block |
||
| 974 | 974 | */ |
| 975 | 975 | $parameters = \GravityView_frontend::get_view_entries_parameters( $parameters, $this->form->ID ); |
| 976 | 976 | |
| 977 | - $parameters['context_view_id'] = $this->ID; |
|
| 977 | + $parameters[ 'context_view_id' ] = $this->ID; |
|
| 978 | 978 | $parameters = \GVCommon::calculate_get_entries_criteria( $parameters, $this->form->ID ); |
| 979 | 979 | |
| 980 | 980 | if ( ! is_array( $parameters ) ) { |
| 981 | 981 | $parameters = array(); |
| 982 | 982 | } |
| 983 | 983 | |
| 984 | - if ( ! is_array( $parameters['search_criteria'] ) ) { |
|
| 985 | - $parameters['search_criteria'] = array(); |
|
| 984 | + if ( ! is_array( $parameters[ 'search_criteria' ] ) ) { |
|
| 985 | + $parameters[ 'search_criteria' ] = array(); |
|
| 986 | 986 | } |
| 987 | 987 | |
| 988 | - if ( ( ! isset( $parameters['search_criteria']['field_filters'] ) ) || ( ! is_array( $parameters['search_criteria']['field_filters'] ) ) ) { |
|
| 989 | - $parameters['search_criteria']['field_filters'] = array(); |
|
| 988 | + if ( ( ! isset( $parameters[ 'search_criteria' ][ 'field_filters' ] ) ) || ( ! is_array( $parameters[ 'search_criteria' ][ 'field_filters' ] ) ) ) { |
|
| 989 | + $parameters[ 'search_criteria' ][ 'field_filters' ] = array(); |
|
| 990 | 990 | } |
| 991 | 991 | |
| 992 | 992 | if ( $request instanceof REST\Request ) { |
| 993 | 993 | $atts = $this->settings->as_atts(); |
| 994 | 994 | $paging_parameters = wp_parse_args( $request->get_paging(), array( |
| 995 | - 'paging' => array( 'page_size' => $atts['page_size'] ), |
|
| 995 | + 'paging' => array( 'page_size' => $atts[ 'page_size' ] ), |
|
| 996 | 996 | ) ); |
| 997 | - $parameters['paging'] = $paging_parameters['paging']; |
|
| 997 | + $parameters[ 'paging' ] = $paging_parameters[ 'paging' ]; |
|
| 998 | 998 | } |
| 999 | 999 | |
| 1000 | - $page = Utils::get( $parameters['paging'], 'current_page' ) ? |
|
| 1001 | - : ( ( ( $parameters['paging']['offset'] - $this->settings->get( 'offset' ) ) / \GV\Utils::get( $parameters, 'paging/page_size', 25 ) ) + 1 ); |
|
| 1000 | + $page = Utils::get( $parameters[ 'paging' ], 'current_page' ) ?: ( ( ( $parameters[ 'paging' ][ 'offset' ] - $this->settings->get( 'offset' ) ) / \GV\Utils::get( $parameters, 'paging/page_size', 25 ) ) + 1 ); |
|
| 1002 | 1001 | |
| 1003 | 1002 | /** |
| 1004 | 1003 | * Cleanup duplicate field_filter parameters to simplify the query. |
@@ -1006,14 +1005,14 @@ discard block |
||
| 1006 | 1005 | $unique_field_filters = array(); |
| 1007 | 1006 | foreach ( Utils::get( $parameters, 'search_criteria/field_filters', array() ) as $key => $filter ) { |
| 1008 | 1007 | if ( 'mode' === $key ) { |
| 1009 | - $unique_field_filters['mode'] = $filter; |
|
| 1008 | + $unique_field_filters[ 'mode' ] = $filter; |
|
| 1010 | 1009 | } else if ( ! in_array( $filter, $unique_field_filters ) ) { |
| 1011 | - $unique_field_filters[] = $filter; |
|
| 1010 | + $unique_field_filters[ ] = $filter; |
|
| 1012 | 1011 | } |
| 1013 | 1012 | } |
| 1014 | - $parameters['search_criteria']['field_filters'] = $unique_field_filters; |
|
| 1013 | + $parameters[ 'search_criteria' ][ 'field_filters' ] = $unique_field_filters; |
|
| 1015 | 1014 | |
| 1016 | - if ( ! empty( $parameters['search_criteria']['field_filters'] ) ) { |
|
| 1015 | + if ( ! empty( $parameters[ 'search_criteria' ][ 'field_filters' ] ) ) { |
|
| 1017 | 1016 | gravityview()->log->notice( 'search_criteria/field_filters is not empty, third-party code may be using legacy search_criteria filters.' ); |
| 1018 | 1017 | } |
| 1019 | 1018 | |
@@ -1022,7 +1021,7 @@ discard block |
||
| 1022 | 1021 | $query_class = $this->get_query_class(); |
| 1023 | 1022 | |
| 1024 | 1023 | /** @type \GF_Query $query */ |
| 1025 | - $query = new $query_class( $this->form->ID, $parameters['search_criteria'], Utils::get( $parameters, 'sorting' ) ); |
|
| 1024 | + $query = new $query_class( $this->form->ID, $parameters[ 'search_criteria' ], Utils::get( $parameters, 'sorting' ) ); |
|
| 1026 | 1025 | |
| 1027 | 1026 | /** |
| 1028 | 1027 | * Apply multisort. |
@@ -1033,15 +1032,15 @@ discard block |
||
| 1033 | 1032 | $view_setting_sort_field_ids = \GV\Utils::get( $atts, 'sort_field', array() ); |
| 1034 | 1033 | $view_setting_sort_directions = \GV\Utils::get( $atts, 'sort_direction', array() ); |
| 1035 | 1034 | |
| 1036 | - $has_sort_query_param = ! empty( $_GET['sort'] ) && is_array( $_GET['sort'] ); |
|
| 1035 | + $has_sort_query_param = ! empty( $_GET[ 'sort' ] ) && is_array( $_GET[ 'sort' ] ); |
|
| 1037 | 1036 | |
| 1038 | - if( $has_sort_query_param ) { |
|
| 1039 | - $has_sort_query_param = array_filter( array_values( $_GET['sort'] ) ); |
|
| 1037 | + if ( $has_sort_query_param ) { |
|
| 1038 | + $has_sort_query_param = array_filter( array_values( $_GET[ 'sort' ] ) ); |
|
| 1040 | 1039 | } |
| 1041 | 1040 | |
| 1042 | 1041 | if ( $this->settings->get( 'sort_columns' ) && $has_sort_query_param ) { |
| 1043 | - $sort_field_ids = array_keys( $_GET['sort'] ); |
|
| 1044 | - $sort_directions = array_values( $_GET['sort'] ); |
|
| 1042 | + $sort_field_ids = array_keys( $_GET[ 'sort' ] ); |
|
| 1043 | + $sort_directions = array_values( $_GET[ 'sort' ] ); |
|
| 1045 | 1044 | } else { |
| 1046 | 1045 | $sort_field_ids = $view_setting_sort_field_ids; |
| 1047 | 1046 | $sort_directions = $view_setting_sort_directions; |
@@ -1049,7 +1048,7 @@ discard block |
||
| 1049 | 1048 | |
| 1050 | 1049 | $skip_first = false; |
| 1051 | 1050 | |
| 1052 | - foreach ( (array) $sort_field_ids as $key => $sort_field_id ) { |
|
| 1051 | + foreach ( (array)$sort_field_ids as $key => $sort_field_id ) { |
|
| 1053 | 1052 | |
| 1054 | 1053 | if ( ! $skip_first && ! $has_sort_query_param ) { |
| 1055 | 1054 | $skip_first = true; // Skip the first one, it's already in the query |
@@ -1079,18 +1078,18 @@ discard block |
||
| 1079 | 1078 | |
| 1080 | 1079 | $merged_time = false; |
| 1081 | 1080 | |
| 1082 | - foreach ( $q['order'] as $oid => $order ) { |
|
| 1081 | + foreach ( $q[ 'order' ] as $oid => $order ) { |
|
| 1083 | 1082 | |
| 1084 | 1083 | $column = null; |
| 1085 | 1084 | |
| 1086 | - if ( $order[0] instanceof \GF_Query_Column ) { |
|
| 1087 | - $column = $order[0]; |
|
| 1088 | - } else if ( $order[0] instanceof \GF_Query_Call ) { |
|
| 1089 | - if ( count( $order[0]->columns ) != 1 || ! $order[0]->columns[0] instanceof \GF_Query_Column ) { |
|
| 1085 | + if ( $order[ 0 ] instanceof \GF_Query_Column ) { |
|
| 1086 | + $column = $order[ 0 ]; |
|
| 1087 | + } else if ( $order[ 0 ] instanceof \GF_Query_Call ) { |
|
| 1088 | + if ( count( $order[ 0 ]->columns ) != 1 || ! $order[ 0 ]->columns[ 0 ] instanceof \GF_Query_Column ) { |
|
| 1090 | 1089 | $orders[ $oid ] = $order; |
| 1091 | 1090 | continue; // Need something that resembles a single sort |
| 1092 | 1091 | } |
| 1093 | - $column = $order[0]->columns[0]; |
|
| 1092 | + $column = $order[ 0 ]->columns[ 0 ]; |
|
| 1094 | 1093 | } |
| 1095 | 1094 | |
| 1096 | 1095 | if ( ! $column || ( ! $field = \GFAPI::get_field( $column->source, $column->field_id ) ) || $field->type !== 'time' ) { |
@@ -1104,7 +1103,7 @@ discard block |
||
| 1104 | 1103 | |
| 1105 | 1104 | $orders[ $oid ] = array( |
| 1106 | 1105 | new \GV\Mocks\GF_Query_Call_TIMESORT( 'timesort', array( $column, $sql ) ), |
| 1107 | - $order[1] // Mock it! |
|
| 1106 | + $order[ 1 ] // Mock it! |
|
| 1108 | 1107 | ); |
| 1109 | 1108 | |
| 1110 | 1109 | $merged_time = true; |
@@ -1115,15 +1114,15 @@ discard block |
||
| 1115 | 1114 | * ORDER again. |
| 1116 | 1115 | */ |
| 1117 | 1116 | if ( ! empty( $orders ) && $_orders = $query->_order_generate( $orders ) ) { |
| 1118 | - $sql['order'] = 'ORDER BY ' . implode( ', ', $_orders ); |
|
| 1117 | + $sql[ 'order' ] = 'ORDER BY ' . implode( ', ', $_orders ); |
|
| 1119 | 1118 | } |
| 1120 | 1119 | } |
| 1121 | 1120 | |
| 1122 | 1121 | return $sql; |
| 1123 | 1122 | } ); |
| 1124 | 1123 | |
| 1125 | - $query->limit( $parameters['paging']['page_size'] ) |
|
| 1126 | - ->offset( ( ( $page - 1 ) * $parameters['paging']['page_size'] ) + $this->settings->get( 'offset' ) ); |
|
| 1124 | + $query->limit( $parameters[ 'paging' ][ 'page_size' ] ) |
|
| 1125 | + ->offset( ( ( $page - 1 ) * $parameters[ 'paging' ][ 'page_size' ] ) + $this->settings->get( 'offset' ) ); |
|
| 1127 | 1126 | |
| 1128 | 1127 | /** |
| 1129 | 1128 | * Any joins? |
@@ -1143,7 +1142,7 @@ discard block |
||
| 1143 | 1142 | |
| 1144 | 1143 | $query_parameters = $query->_introspect(); |
| 1145 | 1144 | |
| 1146 | - $query->where( \GF_Query_Condition::_and( $query_parameters['where'], $condition ) ); |
|
| 1145 | + $query->where( \GF_Query_Condition::_and( $query_parameters[ 'where' ], $condition ) ); |
|
| 1147 | 1146 | } |
| 1148 | 1147 | |
| 1149 | 1148 | // Filter to active entries only |
@@ -1161,7 +1160,7 @@ discard block |
||
| 1161 | 1160 | ); |
| 1162 | 1161 | |
| 1163 | 1162 | $q = $query->_introspect(); |
| 1164 | - $query->where( \GF_Query_Condition::_and( $q['where'], $status_conditions ) ); |
|
| 1163 | + $query->where( \GF_Query_Condition::_and( $q[ 'where' ], $status_conditions ) ); |
|
| 1165 | 1164 | |
| 1166 | 1165 | /** |
| 1167 | 1166 | * Applies legacy modifications to Query for is_approved settings. |
@@ -1189,7 +1188,7 @@ discard block |
||
| 1189 | 1188 | $conditions = array(); |
| 1190 | 1189 | |
| 1191 | 1190 | foreach ( $condition->expressions as $_condition ) { |
| 1192 | - $conditions[] = $recurse( $_condition, $fields, $recurse ); |
|
| 1191 | + $conditions[ ] = $recurse( $_condition, $fields, $recurse ); |
|
| 1193 | 1192 | } |
| 1194 | 1193 | |
| 1195 | 1194 | return call_user_func_array( |
@@ -1218,10 +1217,10 @@ discard block |
||
| 1218 | 1217 | $q = new $query_class( $form_id ); |
| 1219 | 1218 | |
| 1220 | 1219 | // Copy the WHERE clauses but substitute the field_ids to the respective ones |
| 1221 | - $q->where( $where_union_substitute( $query_parameters['where'], $fields, $where_union_substitute ) ); |
|
| 1220 | + $q->where( $where_union_substitute( $query_parameters[ 'where' ], $fields, $where_union_substitute ) ); |
|
| 1222 | 1221 | |
| 1223 | 1222 | // Copy the ORDER clause and substitute the field_ids to the respective ones |
| 1224 | - foreach ( $query_parameters['order'] as $order ) { |
|
| 1223 | + foreach ( $query_parameters[ 'order' ] as $order ) { |
|
| 1225 | 1224 | [ $column, $_order ] = $order; |
| 1226 | 1225 | |
| 1227 | 1226 | if ( $column && $column instanceof \GF_Query_Column ) { |
@@ -1235,15 +1234,15 @@ discard block |
||
| 1235 | 1234 | |
| 1236 | 1235 | add_filter( 'gform_gf_query_sql', $gf_query_sql_callback = function( $sql ) use ( &$unions_sql ) { |
| 1237 | 1236 | // Remove SQL_CALC_FOUND_ROWS as it's not needed in UNION clauses |
| 1238 | - $select = 'UNION ALL ' . str_replace( 'SQL_CALC_FOUND_ROWS ', '', $sql['select'] ); |
|
| 1237 | + $select = 'UNION ALL ' . str_replace( 'SQL_CALC_FOUND_ROWS ', '', $sql[ 'select' ] ); |
|
| 1239 | 1238 | |
| 1240 | 1239 | // Record the SQL |
| 1241 | - $unions_sql[] = array( |
|
| 1240 | + $unions_sql[ ] = array( |
|
| 1242 | 1241 | // Remove columns, we'll rebuild them |
| 1243 | 1242 | 'select' => preg_replace( '#DISTINCT (.*)#', 'DISTINCT ', $select ), |
| 1244 | - 'from' => $sql['from'], |
|
| 1245 | - 'join' => $sql['join'], |
|
| 1246 | - 'where' => $sql['where'], |
|
| 1243 | + 'from' => $sql[ 'from' ], |
|
| 1244 | + 'join' => $sql[ 'join' ], |
|
| 1245 | + 'where' => $sql[ 'where' ], |
|
| 1247 | 1246 | // Remove order and limit |
| 1248 | 1247 | ); |
| 1249 | 1248 | |
@@ -1260,11 +1259,11 @@ discard block |
||
| 1260 | 1259 | |
| 1261 | 1260 | add_filter( 'gform_gf_query_sql', $gf_query_sql_callback = function( $sql ) use ( $unions_sql ) { |
| 1262 | 1261 | // Remove SQL_CALC_FOUND_ROWS as it's not needed in UNION clauses |
| 1263 | - $sql['select'] = str_replace( 'SQL_CALC_FOUND_ROWS ', '', $sql['select'] ); |
|
| 1262 | + $sql[ 'select' ] = str_replace( 'SQL_CALC_FOUND_ROWS ', '', $sql[ 'select' ] ); |
|
| 1264 | 1263 | |
| 1265 | 1264 | // Remove columns, we'll rebuild them |
| 1266 | - preg_match( '#DISTINCT (`[motc]\d+`.`.*?`)#', $sql['select'], $select_match ); |
|
| 1267 | - $sql['select'] = preg_replace( '#DISTINCT (.*)#', 'DISTINCT ', $sql['select'] ); |
|
| 1265 | + preg_match( '#DISTINCT (`[motc]\d+`.`.*?`)#', $sql[ 'select' ], $select_match ); |
|
| 1266 | + $sql[ 'select' ] = preg_replace( '#DISTINCT (.*)#', 'DISTINCT ', $sql[ 'select' ] ); |
|
| 1268 | 1267 | |
| 1269 | 1268 | $unions = array(); |
| 1270 | 1269 | |
@@ -1275,30 +1274,30 @@ discard block |
||
| 1275 | 1274 | }; |
| 1276 | 1275 | |
| 1277 | 1276 | // Add all the order columns into the selects, so we can order by the whole union group |
| 1278 | - preg_match_all( '#(`[motc]\d+`.`.*?`)#', $sql['order'], $order_matches ); |
|
| 1277 | + preg_match_all( '#(`[motc]\d+`.`.*?`)#', $sql[ 'order' ], $order_matches ); |
|
| 1279 | 1278 | |
| 1280 | 1279 | $columns = array( |
| 1281 | - sprintf( '%s AS %s', $select_match[1], $column_to_alias( $select_match[1] ) ) |
|
| 1280 | + sprintf( '%s AS %s', $select_match[ 1 ], $column_to_alias( $select_match[ 1 ] ) ) |
|
| 1282 | 1281 | ); |
| 1283 | 1282 | |
| 1284 | 1283 | foreach ( array_slice( $order_matches, 1 ) as $match ) { |
| 1285 | - $columns[] = sprintf( '%s AS %s', $match[0], $column_to_alias( $match[0] ) ); |
|
| 1284 | + $columns[ ] = sprintf( '%s AS %s', $match[ 0 ], $column_to_alias( $match[ 0 ] ) ); |
|
| 1286 | 1285 | |
| 1287 | 1286 | // Rewrite the order columns to the shared aliases |
| 1288 | - $sql['order'] = str_replace( $match[0], $column_to_alias( $match[0] ), $sql['order'] ); |
|
| 1287 | + $sql[ 'order' ] = str_replace( $match[ 0 ], $column_to_alias( $match[ 0 ] ), $sql[ 'order' ] ); |
|
| 1289 | 1288 | } |
| 1290 | 1289 | |
| 1291 | 1290 | $columns = array_unique( $columns ); |
| 1292 | 1291 | |
| 1293 | 1292 | // Add the columns to every UNION |
| 1294 | 1293 | foreach ( $unions_sql as $union_sql ) { |
| 1295 | - $union_sql['select'] .= implode( ', ', $columns ); |
|
| 1296 | - $unions []= implode( ' ', $union_sql ); |
|
| 1294 | + $union_sql[ 'select' ] .= implode( ', ', $columns ); |
|
| 1295 | + $unions [ ] = implode( ' ', $union_sql ); |
|
| 1297 | 1296 | } |
| 1298 | 1297 | |
| 1299 | 1298 | // Add the columns to the main SELECT, but only grab the entry id column |
| 1300 | - $sql['select'] = 'SELECT SQL_CALC_FOUND_ROWS t1_id FROM (' . $sql['select'] . implode( ', ', $columns ); |
|
| 1301 | - $sql['order'] = implode( ' ', $unions ) . ') AS u ' . $sql['order']; |
|
| 1299 | + $sql[ 'select' ] = 'SELECT SQL_CALC_FOUND_ROWS t1_id FROM (' . $sql[ 'select' ] . implode( ', ', $columns ); |
|
| 1300 | + $sql[ 'order' ] = implode( ' ', $unions ) . ') AS u ' . $sql[ 'order' ]; |
|
| 1302 | 1301 | |
| 1303 | 1302 | return $sql; |
| 1304 | 1303 | } ); |
@@ -1343,20 +1342,20 @@ discard block |
||
| 1343 | 1342 | } ); |
| 1344 | 1343 | } else { |
| 1345 | 1344 | $entries = $this->form->entries |
| 1346 | - ->filter( \GV\GF_Entry_Filter::from_search_criteria( $parameters['search_criteria'] ) ) |
|
| 1345 | + ->filter( \GV\GF_Entry_Filter::from_search_criteria( $parameters[ 'search_criteria' ] ) ) |
|
| 1347 | 1346 | ->offset( $this->settings->get( 'offset' ) ) |
| 1348 | - ->limit( $parameters['paging']['page_size'] ) |
|
| 1347 | + ->limit( $parameters[ 'paging' ][ 'page_size' ] ) |
|
| 1349 | 1348 | ->page( $page ); |
| 1350 | 1349 | |
| 1351 | - if ( ! empty( $parameters['sorting'] ) && is_array( $parameters['sorting'] && ! isset( $parameters['sorting']['key'] ) ) ) { |
|
| 1350 | + if ( ! empty( $parameters[ 'sorting' ] ) && is_array( $parameters[ 'sorting' ] && ! isset( $parameters[ 'sorting' ][ 'key' ] ) ) ) { |
|
| 1352 | 1351 | // Pluck off multisort arrays |
| 1353 | - $parameters['sorting'] = $parameters['sorting'][0]; |
|
| 1352 | + $parameters[ 'sorting' ] = $parameters[ 'sorting' ][ 0 ]; |
|
| 1354 | 1353 | } |
| 1355 | 1354 | |
| 1356 | - if ( ! empty( $parameters['sorting'] ) && ! empty( $parameters['sorting']['key'] ) ) { |
|
| 1355 | + if ( ! empty( $parameters[ 'sorting' ] ) && ! empty( $parameters[ 'sorting' ][ 'key' ] ) ) { |
|
| 1357 | 1356 | $field = new \GV\Field(); |
| 1358 | - $field->ID = $parameters['sorting']['key']; |
|
| 1359 | - $direction = strtolower( $parameters['sorting']['direction'] ) == 'asc' ? \GV\Entry_Sort::ASC : \GV\Entry_Sort::DESC; |
|
| 1357 | + $field->ID = $parameters[ 'sorting' ][ 'key' ]; |
|
| 1358 | + $direction = strtolower( $parameters[ 'sorting' ][ 'direction' ] ) == 'asc' ? \GV\Entry_Sort::ASC : \GV\Entry_Sort::DESC; |
|
| 1360 | 1359 | $entries = $entries->sort( new \GV\Entry_Sort( $field, $direction ) ); |
| 1361 | 1360 | } |
| 1362 | 1361 | } |
@@ -1440,7 +1439,7 @@ discard block |
||
| 1440 | 1439 | $allowed = $headers = array(); |
| 1441 | 1440 | |
| 1442 | 1441 | foreach ( $view->fields->by_position( "directory_*" )->by_visible( $view )->all() as $id => $field ) { |
| 1443 | - $allowed[] = $field; |
|
| 1442 | + $allowed[ ] = $field; |
|
| 1444 | 1443 | } |
| 1445 | 1444 | |
| 1446 | 1445 | $renderer = new Field_Renderer(); |
@@ -1462,17 +1461,17 @@ discard block |
||
| 1462 | 1461 | } ); |
| 1463 | 1462 | |
| 1464 | 1463 | foreach ( array_diff( $allowed_field_ids, wp_list_pluck( $allowed, 'ID' ) ) as $field_id ) { |
| 1465 | - $allowed[] = is_numeric( $field_id ) ? \GV\GF_Field::by_id( $view->form, $field_id ) : \GV\Internal_Field::by_id( $field_id ); |
|
| 1464 | + $allowed[ ] = is_numeric( $field_id ) ? \GV\GF_Field::by_id( $view->form, $field_id ) : \GV\Internal_Field::by_id( $field_id ); |
|
| 1466 | 1465 | } |
| 1467 | 1466 | |
| 1468 | 1467 | foreach ( $allowed as $field ) { |
| 1469 | 1468 | $source = is_numeric( $field->ID ) ? $view->form : new \GV\Internal_Source(); |
| 1470 | 1469 | |
| 1471 | - $return[] = $renderer->render( $field, $view, $source, $entry, gravityview()->request, '\GV\Field_CSV_Template' ); |
|
| 1470 | + $return[ ] = $renderer->render( $field, $view, $source, $entry, gravityview()->request, '\GV\Field_CSV_Template' ); |
|
| 1472 | 1471 | |
| 1473 | 1472 | if ( ! $headers_done ) { |
| 1474 | 1473 | $label = $field->get_label( $view, $source, $entry ); |
| 1475 | - $headers[] = $label ? $label : $field->ID; |
|
| 1474 | + $headers[ ] = $label ? $label : $field->ID; |
|
| 1476 | 1475 | } |
| 1477 | 1476 | } |
| 1478 | 1477 | |
@@ -1570,7 +1569,7 @@ discard block |
||
| 1570 | 1569 | * @return void |
| 1571 | 1570 | */ |
| 1572 | 1571 | public function set_anchor_id( $counter = 1 ) { |
| 1573 | - $this->anchor_id = sprintf( 'gv-view-%d-%d', $this->ID, (int) $counter ); |
|
| 1572 | + $this->anchor_id = sprintf( 'gv-view-%d-%d', $this->ID, (int)$counter ); |
|
| 1574 | 1573 | } |
| 1575 | 1574 | |
| 1576 | 1575 | /** |
@@ -1630,7 +1629,7 @@ discard block |
||
| 1630 | 1629 | * @param Join $join Which join we are dealing with. |
| 1631 | 1630 | * @param self $view Instance of the view we are dealing with. |
| 1632 | 1631 | */ |
| 1633 | - $should_apply = (bool) apply_filters( 'gravityview/view/get_entries/should_apply_legacy_join_is_approved_query_conditions', true, $query, $join, $this ); |
|
| 1632 | + $should_apply = (bool)apply_filters( 'gravityview/view/get_entries/should_apply_legacy_join_is_approved_query_conditions', true, $query, $join, $this ); |
|
| 1634 | 1633 | if ( ! $should_apply ) { |
| 1635 | 1634 | return; |
| 1636 | 1635 | } |
@@ -1660,6 +1659,6 @@ discard block |
||
| 1660 | 1659 | |
| 1661 | 1660 | $query_parameters = $query->_introspect(); |
| 1662 | 1661 | |
| 1663 | - $query->where( \GF_Query_Condition::_and( $query_parameters['where'], $condition ) ); |
|
| 1662 | + $query->where( \GF_Query_Condition::_and( $query_parameters[ 'where' ], $condition ) ); |
|
| 1664 | 1663 | } |
| 1665 | 1664 | } |
@@ -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 |
@@ -165,7 +165,7 @@ discard block |
||
| 165 | 165 | $enable_custom_class = apply_filters( 'gravityview/widget/enable_custom_class', false, $this ); |
| 166 | 166 | |
| 167 | 167 | if ( $enable_custom_class ) { |
| 168 | - $settings['custom_class'] = array( |
|
| 168 | + $settings[ 'custom_class' ] = array( |
|
| 169 | 169 | 'type' => 'text', |
| 170 | 170 | 'label' => __( 'Custom CSS Class:', 'gk-gravityview' ), |
| 171 | 171 | 'desc' => __( 'This class will be added to the widget container', 'gk-gravityview' ), |
@@ -223,7 +223,7 @@ discard block |
||
| 223 | 223 | '1-1' => array( |
| 224 | 224 | array( |
| 225 | 225 | 'areaid' => 'top', |
| 226 | - 'title' => __( 'Top', 'gk-gravityview' ) , |
|
| 226 | + 'title' => __( 'Top', 'gk-gravityview' ), |
|
| 227 | 227 | 'subtitle' => '' |
| 228 | 228 | ), |
| 229 | 229 | ), |
@@ -232,14 +232,14 @@ discard block |
||
| 232 | 232 | '1-2' => array( |
| 233 | 233 | array( |
| 234 | 234 | 'areaid' => 'left', |
| 235 | - 'title' => __( 'Left', 'gk-gravityview' ) , |
|
| 235 | + 'title' => __( 'Left', 'gk-gravityview' ), |
|
| 236 | 236 | 'subtitle' => '' |
| 237 | 237 | ), |
| 238 | 238 | ), |
| 239 | 239 | '2-2' => array( |
| 240 | 240 | array( |
| 241 | 241 | 'areaid' => 'right', |
| 242 | - 'title' => __( 'Right', 'gk-gravityview' ) , |
|
| 242 | + 'title' => __( 'Right', 'gk-gravityview' ), |
|
| 243 | 243 | 'subtitle' => '' |
| 244 | 244 | ), |
| 245 | 245 | ), |
@@ -274,7 +274,7 @@ discard block |
||
| 274 | 274 | } |
| 275 | 275 | |
| 276 | 276 | $widgets[ $this->get_widget_id() ] = array( |
| 277 | - 'label' => $this->widget_label , |
|
| 277 | + 'label' => $this->widget_label, |
|
| 278 | 278 | 'description' => $this->widget_description, |
| 279 | 279 | 'subtitle' => $this->widget_subtitle, |
| 280 | 280 | 'icon' => $this->icon, |
@@ -296,7 +296,7 @@ discard block |
||
| 296 | 296 | */ |
| 297 | 297 | public function assign_widget_options( $options = array(), $template = '', $widget = '' ) { |
| 298 | 298 | if ( $this->get_widget_id() === $widget ) { |
| 299 | - if( $settings = $this->get_settings() ) { |
|
| 299 | + if ( $settings = $this->get_settings() ) { |
|
| 300 | 300 | $options = array_merge( $options, $settings ); |
| 301 | 301 | } |
| 302 | 302 | } |
@@ -350,7 +350,7 @@ discard block |
||
| 350 | 350 | return; |
| 351 | 351 | } |
| 352 | 352 | |
| 353 | - add_shortcode( $this->shortcode_name, array( $this, 'render_shortcode') ); |
|
| 353 | + add_shortcode( $this->shortcode_name, array( $this, 'render_shortcode' ) ); |
|
| 354 | 354 | } |
| 355 | 355 | |
| 356 | 356 | /** |