@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | */ |
| 54 | 54 | $hide_coupon_fields = apply_filters( 'gravityview/edit_entry/hide-coupon-fields', $has_transaction_data ); |
| 55 | 55 | |
| 56 | - return (bool) $hide_coupon_fields; |
|
| 56 | + return (bool)$hide_coupon_fields; |
|
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | /** |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | public function edit_entry_field_blacklist( $blacklist = array(), $entry = array() ) { |
| 70 | 70 | |
| 71 | 71 | if ( $this->should_hide_coupon_fields( $entry ) ) { |
| 72 | - $blacklist[] = 'coupon'; |
|
| 72 | + $blacklist[ ] = 'coupon'; |
|
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | return $blacklist; |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | // No coupons match the codes provided |
| 108 | 108 | $discounts = gf_coupons()->get_coupons_by_codes( $coupon_codes, $form ); |
| 109 | 109 | |
| 110 | - if( ! $discounts ) { |
|
| 110 | + if ( ! $discounts ) { |
|
| 111 | 111 | return $value; |
| 112 | 112 | } |
| 113 | 113 | |
@@ -116,7 +116,7 @@ discard block |
||
| 116 | 116 | * @see GF_Field_Coupon::get_field_input |
| 117 | 117 | */ |
| 118 | 118 | $_POST = ! isset( $_POST ) ? array() : $_POST; |
| 119 | - $_POST[ 'gf_coupons_' . $form['id'] ] = json_encode( (array) $discounts ); |
|
| 119 | + $_POST[ 'gf_coupons_' . $form[ 'id' ] ] = json_encode( (array)$discounts ); |
|
| 120 | 120 | $_POST[ 'input_' . $field->id ] = implode( ',', $coupon_codes ); |
| 121 | 121 | |
| 122 | 122 | return $value; |
@@ -13,7 +13,7 @@ discard block |
||
| 13 | 13 | ?> |
| 14 | 14 | <label for="<?php echo $this->get_field_id(); ?>" class="<?php echo $this->get_label_class(); ?>"><?php |
| 15 | 15 | |
| 16 | - echo '<span class="gv-label">'.$this->get_field_label().'</span>'; |
|
| 16 | + echo '<span class="gv-label">' . $this->get_field_label() . '</span>'; |
|
| 17 | 17 | |
| 18 | 18 | echo $this->get_tooltip() . $this->get_field_desc(); |
| 19 | 19 | |
@@ -26,14 +26,14 @@ discard block |
||
| 26 | 26 | |
| 27 | 27 | function render_input( $override_input = null ) { |
| 28 | 28 | |
| 29 | - if( isset( $override_input ) ) { |
|
| 29 | + if ( isset( $override_input ) ) { |
|
| 30 | 30 | echo $override_input; |
| 31 | 31 | return; |
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | ?> |
| 35 | 35 | <select name="<?php echo esc_attr( $this->name ); ?>[]" id="<?php echo $this->get_field_id(); ?>" multiple="multiple"> |
| 36 | - <?php foreach( $this->field['options'] as $value => $label ) : ?> |
|
| 36 | + <?php foreach ( $this->field[ 'options' ] as $value => $label ) : ?> |
|
| 37 | 37 | <option value="<?php echo esc_attr( $value ); ?>" <?php selected( in_array( $value, (array)$this->value ), true, true ); ?>><?php echo esc_html( $label ); ?></option> |
| 38 | 38 | <?php endforeach; ?> |
| 39 | 39 | </select> |
@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | |
| 12 | 12 | $widget_ops = array( |
| 13 | 13 | 'classname' => 'widget_gravityview_search', |
| 14 | - 'description' => __( 'A search form for a specific GravityView.', 'gravityview') |
|
| 14 | + 'description' => __( 'A search form for a specific GravityView.', 'gravityview' ) |
|
| 15 | 15 | ); |
| 16 | 16 | |
| 17 | 17 | $widget_display = array( |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | } |
| 35 | 35 | |
| 36 | 36 | private function load_required_files() { |
| 37 | - if( !class_exists( 'GravityView_Widget_Search' ) ) { |
|
| 37 | + if ( ! class_exists( 'GravityView_Widget_Search' ) ) { |
|
| 38 | 38 | gravityview_register_gravityview_widgets(); |
| 39 | 39 | } |
| 40 | 40 | } |
@@ -53,30 +53,30 @@ discard block |
||
| 53 | 53 | public function widget( $args, $instance ) { |
| 54 | 54 | |
| 55 | 55 | // Don't show unless a View ID has been set. |
| 56 | - if( empty( $instance['view_id'] ) ) { |
|
| 56 | + if ( empty( $instance[ 'view_id' ] ) ) { |
|
| 57 | 57 | |
| 58 | - do_action('gravityview_log_debug', sprintf( '%s[widget]: No View ID has been defined. Not showing the widget.', get_class($this)), $instance ); |
|
| 58 | + do_action( 'gravityview_log_debug', sprintf( '%s[widget]: No View ID has been defined. Not showing the widget.', get_class( $this ) ), $instance ); |
|
| 59 | 59 | |
| 60 | 60 | return; |
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | /** This filter is documented in wp-includes/default-widgets.php */ |
| 64 | - $title = apply_filters( 'widget_title', empty( $instance['title'] ) ? '' : $instance['title'], $instance, $this->id_base ); |
|
| 64 | + $title = apply_filters( 'widget_title', empty( $instance[ 'title' ] ) ? '' : $instance[ 'title' ], $instance, $this->id_base ); |
|
| 65 | 65 | |
| 66 | - echo $args['before_widget']; |
|
| 66 | + echo $args[ 'before_widget' ]; |
|
| 67 | 67 | |
| 68 | 68 | if ( $title ) { |
| 69 | - echo $args['before_title'] . $title . $args['after_title']; |
|
| 69 | + echo $args[ 'before_title' ] . $title . $args[ 'after_title' ]; |
|
| 70 | 70 | } |
| 71 | 71 | |
| 72 | 72 | // @todo Add to the widget configuration form |
| 73 | - $instance['search_layout'] = apply_filters( 'gravityview/widget/search/layout', 'vertical', $instance ); |
|
| 73 | + $instance[ 'search_layout' ] = apply_filters( 'gravityview/widget/search/layout', 'vertical', $instance ); |
|
| 74 | 74 | |
| 75 | - $instance['context'] = 'wp_widget'; |
|
| 75 | + $instance[ 'context' ] = 'wp_widget'; |
|
| 76 | 76 | |
| 77 | 77 | // form |
| 78 | - $instance['form_id'] = GVCommon::get_meta_form_id( $instance['view_id'] ); |
|
| 79 | - $instance['form'] = GVCommon::get_form( $instance['form_id'] ); |
|
| 78 | + $instance[ 'form_id' ] = GVCommon::get_meta_form_id( $instance[ 'view_id' ] ); |
|
| 79 | + $instance[ 'form' ] = GVCommon::get_form( $instance[ 'form_id' ] ); |
|
| 80 | 80 | |
| 81 | 81 | // We don't want to overwrite existing context, etc. |
| 82 | 82 | $previous_view = GravityView_View::getInstance(); |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | */ |
| 93 | 93 | new GravityView_View( $previous_view ); |
| 94 | 94 | |
| 95 | - echo $args['after_widget']; |
|
| 95 | + echo $args[ 'after_widget' ]; |
|
| 96 | 96 | } |
| 97 | 97 | |
| 98 | 98 | /** |
@@ -102,27 +102,27 @@ discard block |
||
| 102 | 102 | |
| 103 | 103 | $instance = $old_instance; |
| 104 | 104 | |
| 105 | - if( $this->is_preview() ) { |
|
| 105 | + if ( $this->is_preview() ) { |
|
| 106 | 106 | //Oh! Sorry but still not fully compatible with customizer |
| 107 | 107 | return $instance; |
| 108 | 108 | } |
| 109 | 109 | |
| 110 | - $new_instance = wp_parse_args( (array) $new_instance, self::get_defaults() ); |
|
| 110 | + $new_instance = wp_parse_args( (array)$new_instance, self::get_defaults() ); |
|
| 111 | 111 | |
| 112 | - $instance['title'] = strip_tags( $new_instance['title'] ); |
|
| 113 | - $instance['view_id'] = absint( $new_instance['view_id'] ); |
|
| 114 | - $instance['search_fields'] = $new_instance['search_fields']; |
|
| 115 | - $instance['post_id'] = $new_instance['post_id']; |
|
| 116 | - $instance['search_clear'] = $new_instance['search_clear']; |
|
| 117 | - $instance['search_mode'] = $new_instance['search_mode']; |
|
| 112 | + $instance[ 'title' ] = strip_tags( $new_instance[ 'title' ] ); |
|
| 113 | + $instance[ 'view_id' ] = absint( $new_instance[ 'view_id' ] ); |
|
| 114 | + $instance[ 'search_fields' ] = $new_instance[ 'search_fields' ]; |
|
| 115 | + $instance[ 'post_id' ] = $new_instance[ 'post_id' ]; |
|
| 116 | + $instance[ 'search_clear' ] = $new_instance[ 'search_clear' ]; |
|
| 117 | + $instance[ 'search_mode' ] = $new_instance[ 'search_mode' ]; |
|
| 118 | 118 | |
| 119 | - $is_valid_embed_id = GravityView_View_Data::is_valid_embed_id( $new_instance['post_id'], $instance['view_id'] ); |
|
| 119 | + $is_valid_embed_id = GravityView_View_Data::is_valid_embed_id( $new_instance[ 'post_id' ], $instance[ 'view_id' ] ); |
|
| 120 | 120 | |
| 121 | 121 | //check if post_id is a valid post with embedded View |
| 122 | - $instance['error_post_id'] = is_wp_error( $is_valid_embed_id ) ? $is_valid_embed_id->get_error_message() : NULL; |
|
| 122 | + $instance[ 'error_post_id' ] = is_wp_error( $is_valid_embed_id ) ? $is_valid_embed_id->get_error_message() : NULL; |
|
| 123 | 123 | |
| 124 | 124 | // Share that the widget isn't brand new |
| 125 | - $instance['updated'] = 1; |
|
| 125 | + $instance[ 'updated' ] = 1; |
|
| 126 | 126 | |
| 127 | 127 | return $instance; |
| 128 | 128 | } |
@@ -133,28 +133,28 @@ discard block |
||
| 133 | 133 | public function form( $instance ) { |
| 134 | 134 | |
| 135 | 135 | // @todo Make compatible with Customizer |
| 136 | - if( $this->is_preview() ) { |
|
| 136 | + if ( $this->is_preview() ) { |
|
| 137 | 137 | |
| 138 | - $warning = sprintf( esc_html__( 'This widget is not configurable from this screen. Please configure it on the %sWidgets page%s.', 'gravityview' ), '<a href="'.admin_url('widgets.php').'">', '</a>' ); |
|
| 138 | + $warning = sprintf( esc_html__( 'This widget is not configurable from this screen. Please configure it on the %sWidgets page%s.', 'gravityview' ), '<a href="' . admin_url( 'widgets.php' ) . '">', '</a>' ); |
|
| 139 | 139 | |
| 140 | 140 | echo wpautop( GravityView_Admin::get_floaty() . $warning ); |
| 141 | 141 | |
| 142 | 142 | return; |
| 143 | 143 | } |
| 144 | 144 | |
| 145 | - $instance = wp_parse_args( (array) $instance, self::get_defaults() ); |
|
| 145 | + $instance = wp_parse_args( (array)$instance, self::get_defaults() ); |
|
| 146 | 146 | |
| 147 | - $title = $instance['title']; |
|
| 148 | - $view_id = $instance['view_id']; |
|
| 149 | - $post_id = $instance['post_id']; |
|
| 150 | - $search_fields = $instance['search_fields']; |
|
| 151 | - $search_clear = $instance['search_clear']; |
|
| 152 | - $search_mode = $instance['search_mode']; |
|
| 147 | + $title = $instance[ 'title' ]; |
|
| 148 | + $view_id = $instance[ 'view_id' ]; |
|
| 149 | + $post_id = $instance[ 'post_id' ]; |
|
| 150 | + $search_fields = $instance[ 'search_fields' ]; |
|
| 151 | + $search_clear = $instance[ 'search_clear' ]; |
|
| 152 | + $search_mode = $instance[ 'search_mode' ]; |
|
| 153 | 153 | |
| 154 | 154 | $views = GVCommon::get_all_views(); |
| 155 | 155 | |
| 156 | 156 | // If there are no views set up yet, we get outta here. |
| 157 | - if( empty( $views ) ) { ?> |
|
| 157 | + if ( empty( $views ) ) { ?> |
|
| 158 | 158 | <div id="select_gravityview_view"> |
| 159 | 159 | <div class="wrap"><?php echo GravityView_Admin::no_views_text(); ?></div> |
| 160 | 160 | </div> |
@@ -162,17 +162,17 @@ discard block |
||
| 162 | 162 | } |
| 163 | 163 | ?> |
| 164 | 164 | |
| 165 | - <p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:', 'gravityview'); ?> <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo esc_attr( $title ); ?>" /></label></p> |
|
| 165 | + <p><label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:', 'gravityview' ); ?> <input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo esc_attr( $title ); ?>" /></label></p> |
|
| 166 | 166 | |
| 167 | 167 | <?php |
| 168 | 168 | /** |
| 169 | 169 | * Display errors generated for invalid embed IDs |
| 170 | 170 | * @see GravityView_View_Data::is_valid_embed_id |
| 171 | 171 | */ |
| 172 | - if( isset( $instance['updated'] ) && empty( $instance['view_id'] ) ) { |
|
| 172 | + if ( isset( $instance[ 'updated' ] ) && empty( $instance[ 'view_id' ] ) ) { |
|
| 173 | 173 | ?> |
| 174 | 174 | <div class="error inline hide-on-view-change"> |
| 175 | - <p><?php esc_html_e('Please select a View to search.', 'gravityview'); ?></p> |
|
| 175 | + <p><?php esc_html_e( 'Please select a View to search.', 'gravityview' ); ?></p> |
|
| 176 | 176 | </div> |
| 177 | 177 | <?php |
| 178 | 178 | unset ( $error ); |
@@ -181,12 +181,12 @@ discard block |
||
| 181 | 181 | |
| 182 | 182 | <p> |
| 183 | 183 | <label for="gravityview_view_id"><?php _e( 'View:', 'gravityview' ); ?></label> |
| 184 | - <select id="gravityview_view_id" name="<?php echo $this->get_field_name('view_id'); ?>" class="widefat"> |
|
| 184 | + <select id="gravityview_view_id" name="<?php echo $this->get_field_name( 'view_id' ); ?>" class="widefat"> |
|
| 185 | 185 | <option value=""><?php esc_html_e( '— Select a View —', 'gravityview' ); ?></option> |
| 186 | 186 | <?php |
| 187 | - foreach( $views as $view_option ) { |
|
| 188 | - $title = empty( $view_option->post_title ) ? __('(no title)', 'gravityview') : $view_option->post_title; |
|
| 189 | - echo '<option value="'. $view_option->ID .'" ' . selected( esc_attr( $view_id ), $view_option->ID, false ) . '>'. esc_html( sprintf('%s #%d', $title, $view_option->ID ) ) .'</option>'; |
|
| 187 | + foreach ( $views as $view_option ) { |
|
| 188 | + $title = empty( $view_option->post_title ) ? __( '(no title)', 'gravityview' ) : $view_option->post_title; |
|
| 189 | + echo '<option value="' . $view_option->ID . '" ' . selected( esc_attr( $view_id ), $view_option->ID, false ) . '>' . esc_html( sprintf( '%s #%d', $title, $view_option->ID ) ) . '</option>'; |
|
| 190 | 190 | } |
| 191 | 191 | ?> |
| 192 | 192 | </select> |
@@ -198,10 +198,10 @@ discard block |
||
| 198 | 198 | * Display errors generated for invalid embed IDs |
| 199 | 199 | * @see GravityView_View_Data::is_valid_embed_id |
| 200 | 200 | */ |
| 201 | - if( !empty( $instance['error_post_id'] ) ) { |
|
| 201 | + if ( ! empty( $instance[ 'error_post_id' ] ) ) { |
|
| 202 | 202 | ?> |
| 203 | 203 | <div class="error inline"> |
| 204 | - <p><?php echo $instance['error_post_id']; ?></p> |
|
| 204 | + <p><?php echo $instance[ 'error_post_id' ]; ?></p> |
|
| 205 | 205 | </div> |
| 206 | 206 | <?php |
| 207 | 207 | unset ( $error ); |
@@ -209,40 +209,40 @@ discard block |
||
| 209 | 209 | ?> |
| 210 | 210 | |
| 211 | 211 | <p> |
| 212 | - <label for="<?php echo $this->get_field_id('post_id'); ?>"><?php esc_html_e( 'If Embedded, Page ID:', 'gravityview' ); ?></label> |
|
| 213 | - <input class="code" size="3" id="<?php echo $this->get_field_id('post_id'); ?>" name="<?php echo $this->get_field_name('post_id'); ?>" type="text" value="<?php echo esc_attr( $post_id ); ?>" /> |
|
| 212 | + <label for="<?php echo $this->get_field_id( 'post_id' ); ?>"><?php esc_html_e( 'If Embedded, Page ID:', 'gravityview' ); ?></label> |
|
| 213 | + <input class="code" size="3" id="<?php echo $this->get_field_id( 'post_id' ); ?>" name="<?php echo $this->get_field_name( 'post_id' ); ?>" type="text" value="<?php echo esc_attr( $post_id ); ?>" /> |
|
| 214 | 214 | <span class="howto"><?php |
| 215 | - esc_html_e('To have a search performed on an embedded View, enter the ID of the post or page where the View is embedded.', 'gravityview' ); |
|
| 216 | - echo ' '.gravityview_get_link('http://docs.gravityview.co/article/222-the-search-widget', __('Learn more…', 'gravityview' ), 'target=_blank' ); |
|
| 215 | + esc_html_e( 'To have a search performed on an embedded View, enter the ID of the post or page where the View is embedded.', 'gravityview' ); |
|
| 216 | + echo ' ' . gravityview_get_link( 'http://docs.gravityview.co/article/222-the-search-widget', __( 'Learn more…', 'gravityview' ), 'target=_blank' ); |
|
| 217 | 217 | ?></span> |
| 218 | 218 | </p> |
| 219 | 219 | |
| 220 | 220 | <p> |
| 221 | - <label for="<?php echo $this->get_field_id('search_clear'); ?>"><?php esc_html_e( 'Show Clear button', 'gravityview' ); ?>:</label> |
|
| 222 | - <input name="<?php echo $this->get_field_name('search_clear'); ?>" type="hidden" value="0"> |
|
| 223 | - <input id="<?php echo $this->get_field_id('search_clear'); ?>" name="<?php echo $this->get_field_name('search_clear'); ?>" type="checkbox" class="checkbox" value="1" <?php checked( $search_clear, 1, true ); ?>> |
|
| 221 | + <label for="<?php echo $this->get_field_id( 'search_clear' ); ?>"><?php esc_html_e( 'Show Clear button', 'gravityview' ); ?>:</label> |
|
| 222 | + <input name="<?php echo $this->get_field_name( 'search_clear' ); ?>" type="hidden" value="0"> |
|
| 223 | + <input id="<?php echo $this->get_field_id( 'search_clear' ); ?>" name="<?php echo $this->get_field_name( 'search_clear' ); ?>" type="checkbox" class="checkbox" value="1" <?php checked( $search_clear, 1, true ); ?>> |
|
| 224 | 224 | </p> |
| 225 | 225 | |
| 226 | 226 | <p> |
| 227 | 227 | <label><?php esc_html_e( 'Search Mode', 'gravityview' ); ?>:</label> |
| 228 | - <label for="<?php echo $this->get_field_id('search_mode'); ?>_any"> |
|
| 229 | - <input id="<?php echo $this->get_field_id('search_mode'); ?>_any" name="<?php echo $this->get_field_name('search_mode'); ?>" type="radio" class="radio" value="any" <?php checked( $search_mode, 'any', true ); ?>> |
|
| 228 | + <label for="<?php echo $this->get_field_id( 'search_mode' ); ?>_any"> |
|
| 229 | + <input id="<?php echo $this->get_field_id( 'search_mode' ); ?>_any" name="<?php echo $this->get_field_name( 'search_mode' ); ?>" type="radio" class="radio" value="any" <?php checked( $search_mode, 'any', true ); ?>> |
|
| 230 | 230 | <?php esc_html_e( 'Match Any Fields', 'gravityview' ); ?> |
| 231 | 231 | </label> |
| 232 | - <label for="<?php echo $this->get_field_id('search_mode'); ?>_all"> |
|
| 233 | - <input id="<?php echo $this->get_field_id('search_mode'); ?>_all" name="<?php echo $this->get_field_name('search_mode'); ?>" type="radio" class="radio" value="all" <?php checked( $search_mode, 'all', true ); ?>> |
|
| 232 | + <label for="<?php echo $this->get_field_id( 'search_mode' ); ?>_all"> |
|
| 233 | + <input id="<?php echo $this->get_field_id( 'search_mode' ); ?>_all" name="<?php echo $this->get_field_name( 'search_mode' ); ?>" type="radio" class="radio" value="all" <?php checked( $search_mode, 'all', true ); ?>> |
|
| 234 | 234 | <?php esc_html_e( 'Match All Fields', 'gravityview' ); ?> |
| 235 | 235 | </label> |
| 236 | - <span class="howto"><?php esc_html_e('Should search results match all search fields, or any?', 'gravityview' ); ?></span |
|
| 236 | + <span class="howto"><?php esc_html_e( 'Should search results match all search fields, or any?', 'gravityview' ); ?></span |
|
| 237 | 237 | </p> |
| 238 | 238 | |
| 239 | 239 | <hr /> |
| 240 | 240 | |
| 241 | 241 | <?php // @todo: move style to CSS ?> |
| 242 | 242 | <div style="margin-bottom: 1em;"> |
| 243 | - <label class="screen-reader-text" for="<?php echo $this->get_field_id('search_fields'); ?>"><?php _e( 'Searchable fields:', 'gravityview' ); ?></label> |
|
| 244 | - <div class="gv-widget-search-fields" title="<?php esc_html_e('Search Fields', 'gravityview'); ?>"> |
|
| 245 | - <input id="<?php echo $this->get_field_id('search_fields'); ?>" name="<?php echo $this->get_field_name('search_fields'); ?>" type="hidden" value="<?php echo esc_attr( $search_fields ); ?>" class="gv-search-fields-value"> |
|
| 243 | + <label class="screen-reader-text" for="<?php echo $this->get_field_id( 'search_fields' ); ?>"><?php _e( 'Searchable fields:', 'gravityview' ); ?></label> |
|
| 244 | + <div class="gv-widget-search-fields" title="<?php esc_html_e( 'Search Fields', 'gravityview' ); ?>"> |
|
| 245 | + <input id="<?php echo $this->get_field_id( 'search_fields' ); ?>" name="<?php echo $this->get_field_name( 'search_fields' ); ?>" type="hidden" value="<?php echo esc_attr( $search_fields ); ?>" class="gv-search-fields-value"> |
|
| 246 | 246 | </div> |
| 247 | 247 | |
| 248 | 248 | </div> |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | |
| 63 | 63 | add_filter( 'icl_ls_languages', array( $this, 'wpml_ls_filter' ) ); |
| 64 | 64 | |
| 65 | - add_filter( 'gravityview_directory_link', array( $this, 'filter_gravityview_back_link') ); |
|
| 65 | + add_filter( 'gravityview_directory_link', array( $this, 'filter_gravityview_back_link' ) ); |
|
| 66 | 66 | } |
| 67 | 67 | |
| 68 | 68 | /** |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | function filter_gravityview_back_link( $link ) { |
| 83 | 83 | global $wpml_url_filters; |
| 84 | 84 | |
| 85 | - if( $wpml_url_filters ) { |
|
| 85 | + if ( $wpml_url_filters ) { |
|
| 86 | 86 | $link = $wpml_url_filters->permalink_filter( $link, GravityView_frontend::getInstance()->getPostId() ); |
| 87 | 87 | } |
| 88 | 88 | |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | private function remove_url_hooks() { |
| 100 | 100 | global $wpml_url_filters; |
| 101 | 101 | |
| 102 | - if( ! $wpml_url_filters ) { |
|
| 102 | + if ( ! $wpml_url_filters ) { |
|
| 103 | 103 | return; |
| 104 | 104 | } |
| 105 | 105 | |
@@ -122,7 +122,7 @@ discard block |
||
| 122 | 122 | private function add_url_hooks() { |
| 123 | 123 | global $wpml_url_filters; |
| 124 | 124 | |
| 125 | - if( ! $wpml_url_filters ) { |
|
| 125 | + if ( ! $wpml_url_filters ) { |
|
| 126 | 126 | return; |
| 127 | 127 | } |
| 128 | 128 | |
@@ -161,7 +161,7 @@ discard block |
||
| 161 | 161 | |
| 162 | 162 | $this->remove_url_hooks(); |
| 163 | 163 | |
| 164 | - if( $translations ) { |
|
| 164 | + if ( $translations ) { |
|
| 165 | 165 | foreach ( $languages as $lang_code => $language ) { |
| 166 | 166 | |
| 167 | 167 | $lang_post_id = $translations[ $lang_code ]->element_id; |
@@ -194,7 +194,7 @@ discard block |
||
| 194 | 194 | break; |
| 195 | 195 | } |
| 196 | 196 | |
| 197 | - $languages[ $lang_code ]['url'] = $entry_link; |
|
| 197 | + $languages[ $lang_code ][ 'url' ] = $entry_link; |
|
| 198 | 198 | } |
| 199 | 199 | } |
| 200 | 200 | |
@@ -50,13 +50,13 @@ discard block |
||
| 50 | 50 | * |
| 51 | 51 | * @return array Blacklist, with "total" added. If not edit context, original field blacklist. Otherwise, blacklist including total. |
| 52 | 52 | */ |
| 53 | - public function add_to_blacklist( $blacklist = array(), $context = NULL ){ |
|
| 53 | + public function add_to_blacklist( $blacklist = array(), $context = NULL ) { |
|
| 54 | 54 | |
| 55 | - if( empty( $context ) || $context !== 'edit' ) { |
|
| 55 | + if ( empty( $context ) || $context !== 'edit' ) { |
|
| 56 | 56 | return $blacklist; |
| 57 | 57 | } |
| 58 | 58 | |
| 59 | - $blacklist[] = 'total'; |
|
| 59 | + $blacklist[ ] = 'total'; |
|
| 60 | 60 | |
| 61 | 61 | return $blacklist; |
| 62 | 62 | } |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | */ |
| 75 | 75 | function edit_entry_recalculate_totals( $form = array(), $entry_id = 0, $Edit_Entry_Render = null ) { |
| 76 | 76 | |
| 77 | - $original_form = GFAPI::get_form( $form['id'] ); |
|
| 77 | + $original_form = GFAPI::get_form( $form[ 'id' ] ); |
|
| 78 | 78 | |
| 79 | 79 | $total_fields = GFCommon::get_fields_by_type( $original_form, 'total' ); |
| 80 | 80 | |
@@ -85,12 +85,12 @@ discard block |
||
| 85 | 85 | |
| 86 | 86 | /** @var GF_Field_Total $total_field */ |
| 87 | 87 | foreach ( $total_fields as $total_field ) { |
| 88 | - $entry["{$total_field->id}"] = GFCommon::get_order_total( $original_form, $entry ); |
|
| 88 | + $entry[ "{$total_field->id}" ] = GFCommon::get_order_total( $original_form, $entry ); |
|
| 89 | 89 | } |
| 90 | 90 | |
| 91 | 91 | $return_entry = GFAPI::update_entry( $entry ); |
| 92 | 92 | |
| 93 | - if( is_wp_error( $return_entry ) ) { |
|
| 93 | + if ( is_wp_error( $return_entry ) ) { |
|
| 94 | 94 | do_action( 'gravityview_log_error', __METHOD__ . ': Updating the entry total fields failed', $return_entry ); |
| 95 | 95 | } else { |
| 96 | 96 | do_action( 'gravityview_log_debug', __METHOD__ . ': Updating the entry total fields succeeded' ); |
@@ -50,7 +50,7 @@ |
||
| 50 | 50 | * |
| 51 | 51 | * @return array Blacklist, with "total" added. If not edit context, original field blacklist. Otherwise, blacklist including total. |
| 52 | 52 | */ |
| 53 | - public function add_to_blacklist( $blacklist = array(), $context = NULL ){ |
|
| 53 | + public function add_to_blacklist( $blacklist = array(), $context = NULL ) { |
|
| 54 | 54 | |
| 55 | 55 | if( empty( $context ) || $context !== 'edit' ) { |
| 56 | 56 | return $blacklist; |
@@ -313,6 +313,7 @@ |
||
| 313 | 313 | * Add a callback for lazy loading/counting. |
| 314 | 314 | * |
| 315 | 315 | * @param callable $callback The callback to call when needed. |
| 316 | + * @param string $type |
|
| 316 | 317 | * |
| 317 | 318 | * @return void |
| 318 | 319 | */ |
@@ -103,11 +103,11 @@ discard block |
||
| 103 | 103 | |
| 104 | 104 | /** Call all lazy callbacks. */ |
| 105 | 105 | foreach ( $this->callbacks as $callback ) { |
| 106 | - if ( $callback[0] != 'count' ) { |
|
| 106 | + if ( $callback[ 0 ] != 'count' ) { |
|
| 107 | 107 | continue; |
| 108 | 108 | } |
| 109 | 109 | |
| 110 | - $total += $callback[1]( $this->filters ); |
|
| 110 | + $total += $callback[ 1 ]( $this->filters ); |
|
| 111 | 111 | } |
| 112 | 112 | |
| 113 | 113 | return $total - $this->offset; |
@@ -161,11 +161,11 @@ discard block |
||
| 161 | 161 | |
| 162 | 162 | /** Call all lazy callbacks. */ |
| 163 | 163 | foreach ( $this->callbacks as $i => $callback ) { |
| 164 | - if ( $callback[0] != 'fetch' ) { |
|
| 164 | + if ( $callback[ 0 ] != 'fetch' ) { |
|
| 165 | 165 | continue; |
| 166 | 166 | } |
| 167 | 167 | |
| 168 | - $this->merge( $callback[1]( $this->filters, $this->sorts, $offset ) ); |
|
| 168 | + $this->merge( $callback[ 1 ]( $this->filters, $this->sorts, $offset ) ); |
|
| 169 | 169 | } |
| 170 | 170 | |
| 171 | 171 | $this->fetched = $this->count(); |
@@ -321,7 +321,7 @@ discard block |
||
| 321 | 321 | return; |
| 322 | 322 | } |
| 323 | 323 | |
| 324 | - $this->callbacks []= array( $type, $callback ); |
|
| 324 | + $this->callbacks [ ] = array( $type, $callback ); |
|
| 325 | 325 | } |
| 326 | 326 | |
| 327 | 327 | /** |
@@ -38,7 +38,6 @@ |
||
| 38 | 38 | * Set an setting. |
| 39 | 39 | * |
| 40 | 40 | * @param mixed $key The key in this setting to retrieve. |
| 41 | - * @param mixed $default A default in case the key is not set. |
|
| 42 | 41 | * |
| 43 | 42 | * @api |
| 44 | 43 | * @since future |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | * @return void |
| 32 | 32 | */ |
| 33 | 33 | public function __set( $key, $value ) { |
| 34 | - $this->_context[$key] = $value; |
|
| 34 | + $this->_context[ $key ] = $value; |
|
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | /** |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | * @return mixed|null |
| 46 | 46 | */ |
| 47 | 47 | public function __get( $key ) { |
| 48 | - return isset( $this->_context[$key] ) ? $this->_context[$key] : null; |
|
| 48 | + return isset( $this->_context[ $key ] ) ? $this->_context[ $key ] : null; |
|
| 49 | 49 | } |
| 50 | 50 | } |
| 51 | 51 | |
@@ -298,7 +298,7 @@ |
||
| 298 | 298 | /** |
| 299 | 299 | * Determines if a view exists to begin with. |
| 300 | 300 | * |
| 301 | - * @param int|\WP_Post|null $view_id The WordPress post ID, a \WP_Post object or null for global $post; |
|
| 301 | + * @param int|\WP_Post|null $view The WordPress post ID, a \WP_Post object or null for global $post; |
|
| 302 | 302 | * |
| 303 | 303 | * @api |
| 304 | 304 | * @since future |
@@ -202,12 +202,12 @@ |
||
| 202 | 202 | } |
| 203 | 203 | |
| 204 | 204 | /** |
| 205 | - * @filter `gravityview/configuration/fields` Filter the View fields' configuration array |
|
| 206 | - * @since 1.6.5 |
|
| 207 | - * |
|
| 208 | - * @param $fields array Multi-array of fields with first level being the field zones |
|
| 209 | - * @param $view_id int The View the fields are being pulled for |
|
| 210 | - */ |
|
| 205 | + * @filter `gravityview/configuration/fields` Filter the View fields' configuration array |
|
| 206 | + * @since 1.6.5 |
|
| 207 | + * |
|
| 208 | + * @param $fields array Multi-array of fields with first level being the field zones |
|
| 209 | + * @param $view_id int The View the fields are being pulled for |
|
| 210 | + */ |
|
| 211 | 211 | $configuration = apply_filters( 'gravityview/configuration/fields', (array)$view->_gravityview_directory_fields, $view->ID ); |
| 212 | 212 | |
| 213 | 213 | /** Get all fields. */ |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | $supports = array( 'title', 'revisions' ); |
| 87 | 87 | |
| 88 | 88 | if ( $is_hierarchical ) { |
| 89 | - $supports[] = 'page-attributes'; |
|
| 89 | + $supports[ ] = 'page-attributes'; |
|
| 90 | 90 | } |
| 91 | 91 | |
| 92 | 92 | /** |
@@ -197,7 +197,7 @@ discard block |
||
| 197 | 197 | if ( ! $view->form ) { |
| 198 | 198 | gravityview()->log->error( 'View #{view_id} tried attaching non-existent Form #{form_id} to it.', array( |
| 199 | 199 | 'view_id' => $view->ID, |
| 200 | - 'form_id' => $view->_gravityview_form_id ? : 0, |
|
| 200 | + 'form_id' => $view->_gravityview_form_id ?: 0, |
|
| 201 | 201 | ) ); |
| 202 | 202 | } |
| 203 | 203 | |
@@ -335,7 +335,7 @@ discard block |
||
| 335 | 335 | |
| 336 | 336 | gravityview()->log->notice( 'This is a \GV\View object should not be accessed as an array.' ); |
| 337 | 337 | |
| 338 | - if ( ! isset( $this[$offset] ) ) { |
|
| 338 | + if ( ! isset( $this[ $offset ] ) ) { |
|
| 339 | 339 | return null; |
| 340 | 340 | } |
| 341 | 341 | |
@@ -353,7 +353,7 @@ discard block |
||
| 353 | 353 | return $this->template ? $this->template->ID : null; |
| 354 | 354 | default: |
| 355 | 355 | /** @todo move the rest out and get rid of _data completely! */ |
| 356 | - return $this->_data[$offset]; |
|
| 356 | + return $this->_data[ $offset ]; |
|
| 357 | 357 | } |
| 358 | 358 | } |
| 359 | 359 | |
@@ -402,7 +402,7 @@ discard block |
||
| 402 | 402 | array( 'form' => $this->form ? gravityview_get_form( $this->form->ID ) : null ), |
| 403 | 403 | array( 'atts' => $this->settings->as_atts() ), |
| 404 | 404 | array( 'fields' => $this->fields->by_visible()->as_configuration() ), |
| 405 | - array( 'template_id' => $this->template? $this->template->ID : null ), |
|
| 405 | + array( 'template_id' => $this->template ? $this->template->ID : null ), |
|
| 406 | 406 | $this->_data |
| 407 | 407 | ); |
| 408 | 408 | } |
@@ -153,7 +153,7 @@ discard block |
||
| 153 | 153 | |
| 154 | 154 | /** |
| 155 | 155 | * Sets the single entry ID and also the entry |
| 156 | - * @param bool|int|string $single_entry |
|
| 156 | + * @param boolean|string $single_entry |
|
| 157 | 157 | */ |
| 158 | 158 | public function setSingleEntry( $single_entry ) { |
| 159 | 159 | |
@@ -170,7 +170,7 @@ discard block |
||
| 170 | 170 | |
| 171 | 171 | /** |
| 172 | 172 | * Set the current entry |
| 173 | - * @param array|int $entry Entry array or entry slug or ID |
|
| 173 | + * @param boolean|string $entry Entry array or entry slug or ID |
|
| 174 | 174 | */ |
| 175 | 175 | public function setEntry( $entry ) { |
| 176 | 176 | |
@@ -228,7 +228,7 @@ discard block |
||
| 228 | 228 | * |
| 229 | 229 | * |
| 230 | 230 | * |
| 231 | - * @param null $view_id |
|
| 231 | + * @param string $view_id |
|
| 232 | 232 | */ |
| 233 | 233 | public function set_context_view_id( $view_id = null ) { |
| 234 | 234 | $multiple_views = defined( 'GRAVITYVIEW_FUTURE_CORE_LOADED' ) ? gravityview()->views->count() > 1 : ( $this->getGvOutputData() && $this->getGvOutputData()->has_multiple_views() ); |
@@ -1213,7 +1213,7 @@ discard block |
||
| 1213 | 1213 | * |
| 1214 | 1214 | * @uses gravityview_get_entries() |
| 1215 | 1215 | * @access public |
| 1216 | - * @param array $args\n |
|
| 1216 | + * @param array $args |
|
| 1217 | 1217 | * - $id - View id |
| 1218 | 1218 | * - $page_size - Page |
| 1219 | 1219 | * - $sort_field - form field id to sort |
@@ -1370,7 +1370,6 @@ discard block |
||
| 1370 | 1370 | * @since 1.19.5 |
| 1371 | 1371 | * |
| 1372 | 1372 | * @param $args |
| 1373 | - * @param int $form_id |
|
| 1374 | 1373 | */ |
| 1375 | 1374 | public static function get_search_criteria_paging( $args ) { |
| 1376 | 1375 | |
@@ -1785,7 +1784,7 @@ discard block |
||
| 1785 | 1784 | /** |
| 1786 | 1785 | * Checks if field (column) is sortable |
| 1787 | 1786 | * |
| 1788 | - * @param string $field Field settings |
|
| 1787 | + * @param string $field_id Field settings |
|
| 1789 | 1788 | * @param array $form Gravity Forms form array |
| 1790 | 1789 | * |
| 1791 | 1790 | * @since 1.7 |
@@ -458,7 +458,7 @@ discard block |
||
| 458 | 458 | } |
| 459 | 459 | |
| 460 | 460 | // User reported WooCommerce doesn't pass two args. |
| 461 | - if ( empty( $passed_post_id ) ) { |
|
| 461 | + if ( empty( $passed_post_id ) ) { |
|
| 462 | 462 | return $title; |
| 463 | 463 | } |
| 464 | 464 | |
@@ -494,8 +494,9 @@ discard block |
||
| 494 | 494 | } |
| 495 | 495 | |
| 496 | 496 | /** No matching form sources were found, happens when requesting an entry from a different form . */ |
| 497 | - if ( ! isset( $view ) ) |
|
| 498 | - return $title; |
|
| 497 | + if ( ! isset( $view ) ) { |
|
| 498 | + return $title; |
|
| 499 | + } |
|
| 499 | 500 | } else { |
| 500 | 501 | /** Deprecated. Use gravityview()->views->all() or gravityview()->request->all() */ |
| 501 | 502 | foreach ( $this->getGvOutputData()->get_views() as $view_id => $view_data ) { |
@@ -1478,7 +1479,7 @@ discard block |
||
| 1478 | 1479 | */ |
| 1479 | 1480 | $address_part = apply_filters( 'gravityview/sorting/address', 'city', $sort_field_id, $form_id ); |
| 1480 | 1481 | |
| 1481 | - switch( strtolower( $address_part ) ){ |
|
| 1482 | + switch( strtolower( $address_part ) ) { |
|
| 1482 | 1483 | case 'street': |
| 1483 | 1484 | $sort_field_id .= '.1'; |
| 1484 | 1485 | break; |
@@ -1563,7 +1564,7 @@ discard block |
||
| 1563 | 1564 | */ |
| 1564 | 1565 | $single_entry = apply_filters( 'gravityview/is_single_entry', $single_entry ); |
| 1565 | 1566 | |
| 1566 | - if ( empty( $single_entry ) ){ |
|
| 1567 | + if ( empty( $single_entry ) ) { |
|
| 1567 | 1568 | return false; |
| 1568 | 1569 | } else { |
| 1569 | 1570 | return $single_entry; |
@@ -85,9 +85,9 @@ discard block |
||
| 85 | 85 | private function __construct() {} |
| 86 | 86 | |
| 87 | 87 | private function initialize() { |
| 88 | - add_action( 'wp', array( $this, 'parse_content'), 11 ); |
|
| 88 | + add_action( 'wp', array( $this, 'parse_content' ), 11 ); |
|
| 89 | 89 | add_filter( 'parse_query', array( $this, 'parse_query_fix_frontpage' ), 10 ); |
| 90 | - add_action( 'template_redirect', array( $this, 'set_entry_data'), 1 ); |
|
| 90 | + add_action( 'template_redirect', array( $this, 'set_entry_data' ), 1 ); |
|
| 91 | 91 | |
| 92 | 92 | // Enqueue scripts and styles after GravityView_Template::register_styles() |
| 93 | 93 | add_action( 'wp_enqueue_scripts', array( $this, 'add_scripts_and_styles' ), 20 ); |
@@ -237,12 +237,12 @@ discard block |
||
| 237 | 237 | |
| 238 | 238 | $this->context_view_id = $view_id; |
| 239 | 239 | |
| 240 | - } elseif ( isset( $_GET['gvid'] ) && $multiple_views ) { |
|
| 240 | + } elseif ( isset( $_GET[ 'gvid' ] ) && $multiple_views ) { |
|
| 241 | 241 | /** |
| 242 | 242 | * used on a has_multiple_views context |
| 243 | 243 | * @see GravityView_API::entry_link |
| 244 | 244 | */ |
| 245 | - $this->context_view_id = $_GET['gvid']; |
|
| 245 | + $this->context_view_id = $_GET[ 'gvid' ]; |
|
| 246 | 246 | |
| 247 | 247 | } elseif ( ! $multiple_views ) { |
| 248 | 248 | if ( defined( 'GRAVITYVIEW_FUTURE_CORE_LOADED' ) ) { |
@@ -285,25 +285,25 @@ discard block |
||
| 285 | 285 | global $wp_rewrite; |
| 286 | 286 | |
| 287 | 287 | $is_front_page = ( $query->is_home || $query->is_page ); |
| 288 | - $show_on_front = ( 'page' === get_option('show_on_front') ); |
|
| 289 | - $front_page_id = get_option('page_on_front'); |
|
| 288 | + $show_on_front = ( 'page' === get_option( 'show_on_front' ) ); |
|
| 289 | + $front_page_id = get_option( 'page_on_front' ); |
|
| 290 | 290 | |
| 291 | - if ( $is_front_page && $show_on_front && $front_page_id ) { |
|
| 291 | + if ( $is_front_page && $show_on_front && $front_page_id ) { |
|
| 292 | 292 | |
| 293 | 293 | // Force to be an array, potentially a query string ( entry=16 ) |
| 294 | 294 | $_query = wp_parse_args( $query->query ); |
| 295 | 295 | |
| 296 | 296 | // pagename can be set and empty depending on matched rewrite rules. Ignore an empty pagename. |
| 297 | - if ( isset( $_query['pagename'] ) && '' === $_query['pagename'] ) { |
|
| 298 | - unset( $_query['pagename'] ); |
|
| 297 | + if ( isset( $_query[ 'pagename' ] ) && '' === $_query[ 'pagename' ] ) { |
|
| 298 | + unset( $_query[ 'pagename' ] ); |
|
| 299 | 299 | } |
| 300 | 300 | |
| 301 | 301 | // this is where will break from core wordpress |
| 302 | 302 | /** @internal Don't use this filter; it will be unnecessary soon - it's just a patch for specific use case */ |
| 303 | 303 | $ignore = apply_filters( 'gravityview/internal/ignored_endpoints', array( 'preview', 'page', 'paged', 'cpage' ), $query ); |
| 304 | 304 | $endpoints = rgobj( $wp_rewrite, 'endpoints' ); |
| 305 | - foreach ( (array) $endpoints as $endpoint ) { |
|
| 306 | - $ignore[] = $endpoint[1]; |
|
| 305 | + foreach ( (array)$endpoints as $endpoint ) { |
|
| 306 | + $ignore[ ] = $endpoint[ 1 ]; |
|
| 307 | 307 | } |
| 308 | 308 | unset( $endpoints ); |
| 309 | 309 | |
@@ -313,21 +313,21 @@ discard block |
||
| 313 | 313 | // - The query includes keys that are associated with registered endpoints. `entry`, for example. |
| 314 | 314 | if ( empty( $_query ) || ! array_diff( array_keys( $_query ), $ignore ) ) { |
| 315 | 315 | |
| 316 | - $qv =& $query->query_vars; |
|
| 316 | + $qv = & $query->query_vars; |
|
| 317 | 317 | |
| 318 | 318 | // Prevent redirect when on the single entry endpoint |
| 319 | - if( self::is_single_entry() ) { |
|
| 319 | + if ( self::is_single_entry() ) { |
|
| 320 | 320 | add_filter( 'redirect_canonical', '__return_false' ); |
| 321 | 321 | } |
| 322 | 322 | |
| 323 | 323 | $query->is_page = true; |
| 324 | 324 | $query->is_home = false; |
| 325 | - $qv['page_id'] = $front_page_id; |
|
| 325 | + $qv[ 'page_id' ] = $front_page_id; |
|
| 326 | 326 | |
| 327 | 327 | // Correct <!--nextpage--> for page_on_front |
| 328 | - if ( ! empty( $qv['paged'] ) ) { |
|
| 329 | - $qv['page'] = $qv['paged']; |
|
| 330 | - unset( $qv['paged'] ); |
|
| 328 | + if ( ! empty( $qv[ 'paged' ] ) ) { |
|
| 329 | + $qv[ 'page' ] = $qv[ 'paged' ]; |
|
| 330 | + unset( $qv[ 'paged' ] ); |
|
| 331 | 331 | } |
| 332 | 332 | } |
| 333 | 333 | |
@@ -360,7 +360,7 @@ discard block |
||
| 360 | 360 | |
| 361 | 361 | $this->setIsGravityviewPostType( get_post_type( $post ) === 'gravityview' ); |
| 362 | 362 | |
| 363 | - $post_id = $this->getPostId() ? $this->getPostId() : (isset( $post ) ? $post->ID : null ); |
|
| 363 | + $post_id = $this->getPostId() ? $this->getPostId() : ( isset( $post ) ? $post->ID : null ); |
|
| 364 | 364 | $this->setPostId( $post_id ); |
| 365 | 365 | $post_has_shortcode = ! empty( $post->post_content ) ? gravityview_has_shortcode_r( $post->post_content, 'gravityview' ) : false; |
| 366 | 366 | $this->setPostHasShortcode( $this->isGravityviewPostType() ? null : ! empty( $post_has_shortcode ) ); |
@@ -396,7 +396,7 @@ discard block |
||
| 396 | 396 | |
| 397 | 397 | $search_method = GravityView_Widget_Search::getInstance()->get_search_method(); |
| 398 | 398 | |
| 399 | - if( 'post' === $search_method ) { |
|
| 399 | + if ( 'post' === $search_method ) { |
|
| 400 | 400 | $get = $_POST; |
| 401 | 401 | } else { |
| 402 | 402 | $get = $_GET; |
@@ -452,20 +452,20 @@ discard block |
||
| 452 | 452 | * @param boolean $in_the_loop Whether to apply the filter to the menu title and the meta tag <title> - outside the loop |
| 453 | 453 | * @param array $entry Current entry |
| 454 | 454 | */ |
| 455 | - $apply_outside_loop = apply_filters( 'gravityview/single/title/out_loop' , in_the_loop(), $entry ); |
|
| 455 | + $apply_outside_loop = apply_filters( 'gravityview/single/title/out_loop', in_the_loop(), $entry ); |
|
| 456 | 456 | |
| 457 | 457 | if ( ! $apply_outside_loop ) { |
| 458 | 458 | return $title; |
| 459 | 459 | } |
| 460 | 460 | |
| 461 | 461 | // User reported WooCommerce doesn't pass two args. |
| 462 | - if ( empty( $passed_post_id ) ) { |
|
| 462 | + if ( empty( $passed_post_id ) ) { |
|
| 463 | 463 | return $title; |
| 464 | 464 | } |
| 465 | 465 | |
| 466 | 466 | // Don't modify the title for anything other than the current view/post. |
| 467 | 467 | // This is true for embedded shortcodes and Views. |
| 468 | - if ( is_object( $post ) && (int) $post->ID !== (int) $passed_post_id ) { |
|
| 468 | + if ( is_object( $post ) && (int)$post->ID !== (int)$passed_post_id ) { |
|
| 469 | 469 | return $title; |
| 470 | 470 | } |
| 471 | 471 | |
@@ -488,7 +488,7 @@ discard block |
||
| 488 | 488 | } else { |
| 489 | 489 | if ( defined( 'GRAVITYVIEW_FUTURE_CORE_LOADED' ) ) { |
| 490 | 490 | foreach ( gravityview()->views->all() as $_view ) { |
| 491 | - if ( intval( $_view->form->ID ) === intval( $entry['form_id'] ) ) { |
|
| 491 | + if ( intval( $_view->form->ID ) === intval( $entry[ 'form_id' ] ) ) { |
|
| 492 | 492 | $view = $_view; |
| 493 | 493 | break; |
| 494 | 494 | } |
@@ -500,7 +500,7 @@ discard block |
||
| 500 | 500 | } else { |
| 501 | 501 | /** Deprecated. Use gravityview()->views->all() or gravityview()->request->all() */ |
| 502 | 502 | foreach ( $this->getGvOutputData()->get_views() as $view_id => $view_data ) { |
| 503 | - if ( intval( $view_data['form_id'] ) === intval( $entry['form_id'] ) ) { |
|
| 503 | + if ( intval( $view_data[ 'form_id' ] ) === intval( $entry[ 'form_id' ] ) ) { |
|
| 504 | 504 | $view_meta = $view_data; |
| 505 | 505 | break; |
| 506 | 506 | } |
@@ -515,12 +515,12 @@ discard block |
||
| 515 | 515 | } |
| 516 | 516 | } else { |
| 517 | 517 | /** Deprecated stuff in the future. See the branch above. */ |
| 518 | - if ( ! empty( $view_meta['atts']['single_title'] ) ) { |
|
| 518 | + if ( ! empty( $view_meta[ 'atts' ][ 'single_title' ] ) ) { |
|
| 519 | 519 | |
| 520 | - $title = $view_meta['atts']['single_title']; |
|
| 520 | + $title = $view_meta[ 'atts' ][ 'single_title' ]; |
|
| 521 | 521 | |
| 522 | 522 | // We are allowing HTML in the fields, so no escaping the output |
| 523 | - $title = GravityView_API::replace_variables( $title, $view_meta['form'], $entry ); |
|
| 523 | + $title = GravityView_API::replace_variables( $title, $view_meta[ 'form' ], $entry ); |
|
| 524 | 524 | |
| 525 | 525 | $title = do_shortcode( $title ); |
| 526 | 526 | } |
@@ -558,7 +558,7 @@ discard block |
||
| 558 | 558 | } |
| 559 | 559 | |
| 560 | 560 | // Only render in the loop. Fixes issues with the_content filter being applied in places like the sidebar |
| 561 | - if( ! in_the_loop() ) { |
|
| 561 | + if ( ! in_the_loop() ) { |
|
| 562 | 562 | return $content; |
| 563 | 563 | } |
| 564 | 564 | |
@@ -633,7 +633,7 @@ discard block |
||
| 633 | 633 | |
| 634 | 634 | $context = GravityView_View::getInstance()->getContext(); |
| 635 | 635 | |
| 636 | - switch( $context ) { |
|
| 636 | + switch ( $context ) { |
|
| 637 | 637 | case 'directory': |
| 638 | 638 | $tab = __( 'Multiple Entries', 'gravityview' ); |
| 639 | 639 | break; |
@@ -647,12 +647,12 @@ discard block |
||
| 647 | 647 | } |
| 648 | 648 | |
| 649 | 649 | |
| 650 | - $title = sprintf( esc_html_x('The %s layout has not been configured.', 'Displayed when a View is not configured. %s is replaced by the tab label', 'gravityview' ), $tab ); |
|
| 650 | + $title = sprintf( esc_html_x( 'The %s layout has not been configured.', 'Displayed when a View is not configured. %s is replaced by the tab label', 'gravityview' ), $tab ); |
|
| 651 | 651 | $edit_link = admin_url( sprintf( 'post.php?post=%d&action=edit#%s-view', $view_id, $context ) ); |
| 652 | - $action_text = sprintf( esc_html__('Add fields to %s', 'gravityview' ), $tab ); |
|
| 652 | + $action_text = sprintf( esc_html__( 'Add fields to %s', 'gravityview' ), $tab ); |
|
| 653 | 653 | $message = esc_html__( 'You can only see this message because you are able to edit this View.', 'gravityview' ); |
| 654 | 654 | |
| 655 | - $image = sprintf( '<img alt="%s" src="%s" style="margin-top: 10px;" />', $tab, esc_url(plugins_url( sprintf( 'assets/images/tab-%s.png', $context ), GRAVITYVIEW_FILE ) ) ); |
|
| 655 | + $image = sprintf( '<img alt="%s" src="%s" style="margin-top: 10px;" />', $tab, esc_url( plugins_url( sprintf( 'assets/images/tab-%s.png', $context ), GRAVITYVIEW_FILE ) ) ); |
|
| 656 | 656 | $output = sprintf( '<h3>%s <strong><a href="%s">%s</a></strong></h3><p>%s</p>', $title, esc_url( $edit_link ), $action_text, $message ); |
| 657 | 657 | |
| 658 | 658 | echo GVCommon::generate_notice( $output . $image, 'gv-error error', 'edit_gravityview', $view_id ); |
@@ -683,7 +683,7 @@ discard block |
||
| 683 | 683 | public function render_view( $passed_args ) { |
| 684 | 684 | |
| 685 | 685 | // validate attributes |
| 686 | - if ( empty( $passed_args['id'] ) ) { |
|
| 686 | + if ( empty( $passed_args[ 'id' ] ) ) { |
|
| 687 | 687 | do_action( 'gravityview_log_error', '[render_view] Returning; no ID defined.', $passed_args ); |
| 688 | 688 | return null; |
| 689 | 689 | } |
@@ -705,7 +705,7 @@ discard block |
||
| 705 | 705 | return null; |
| 706 | 706 | } |
| 707 | 707 | |
| 708 | - $view_id = $passed_args['id']; |
|
| 708 | + $view_id = $passed_args[ 'id' ]; |
|
| 709 | 709 | |
| 710 | 710 | if ( defined( 'GRAVITYVIEW_FUTURE_CORE_LOADED' ) ) { |
| 711 | 711 | $view = gravityview()->views->get( $view_id ); |
@@ -742,7 +742,7 @@ discard block |
||
| 742 | 742 | $passed_args = array_filter( $passed_args, 'strlen' ); |
| 743 | 743 | |
| 744 | 744 | //Override shortcode args over View template settings |
| 745 | - $atts = wp_parse_args( $passed_args, $view_data['atts'] ); |
|
| 745 | + $atts = wp_parse_args( $passed_args, $view_data[ 'atts' ] ); |
|
| 746 | 746 | |
| 747 | 747 | do_action( 'gravityview_log_debug', '[render_view] Arguments after merging with View settings: ', $atts ); |
| 748 | 748 | } |
@@ -766,14 +766,14 @@ discard block |
||
| 766 | 766 | * @since 1.15 |
| 767 | 767 | * @since 1.17.2 Added check for if a user has no caps but is logged in (member of multisite, but not any site). Treat as if logged-out. |
| 768 | 768 | */ |
| 769 | - if( is_user_logged_in() && ! ( empty( wp_get_current_user()->caps ) && empty( wp_get_current_user()->roles ) ) && false === GVCommon::has_cap( 'read_gravityview', $view_id ) ) { |
|
| 769 | + if ( is_user_logged_in() && ! ( empty( wp_get_current_user()->caps ) && empty( wp_get_current_user()->roles ) ) && false === GVCommon::has_cap( 'read_gravityview', $view_id ) ) { |
|
| 770 | 770 | |
| 771 | 771 | do_action( 'gravityview_log_debug', sprintf( '%s Returning: View %d is not visible by current user.', __METHOD__, $view_id ) ); |
| 772 | 772 | |
| 773 | 773 | return null; |
| 774 | 774 | } |
| 775 | 775 | |
| 776 | - if( $this->isGravityviewPostType() ) { |
|
| 776 | + if ( $this->isGravityviewPostType() ) { |
|
| 777 | 777 | |
| 778 | 778 | /** |
| 779 | 779 | * @filter `gravityview_direct_access` Should Views be directly accessible, or only visible using the shortcode? |
@@ -789,10 +789,10 @@ discard block |
||
| 789 | 789 | $embed_only = $view->settings->get( 'embed_only' ); |
| 790 | 790 | } else { |
| 791 | 791 | /** Deprecated. View attributes moved to \GV\View::$settings. */ |
| 792 | - $embed_only = ! empty( $atts['embed_only'] ); |
|
| 792 | + $embed_only = ! empty( $atts[ 'embed_only' ] ); |
|
| 793 | 793 | } |
| 794 | 794 | |
| 795 | - if( ! $direct_access || ( $embed_only && ! GVCommon::has_cap( 'read_private_gravityviews' ) ) ) { |
|
| 795 | + if ( ! $direct_access || ( $embed_only && ! GVCommon::has_cap( 'read_private_gravityviews' ) ) ) { |
|
| 796 | 796 | return __( 'You are not allowed to view this content.', 'gravityview' ); |
| 797 | 797 | } |
| 798 | 798 | } |
@@ -808,13 +808,13 @@ discard block |
||
| 808 | 808 | if ( defined( 'GRAVITYVIEW_FUTURE_CORE_LOADED' ) ) { |
| 809 | 809 | $view_data = $view->as_data(); |
| 810 | 810 | $gravityview_view = new GravityView_View( $view_data ); |
| 811 | - $post_id = intval( $view->settings->get( 'post_id' ) ? : get_the_ID() ); |
|
| 811 | + $post_id = intval( $view->settings->get( 'post_id' ) ?: get_the_ID() ); |
|
| 812 | 812 | $template_id = $view->template ? $view->template->ID : null; |
| 813 | 813 | } else { |
| 814 | 814 | /** These constructs are deprecated. Use the new gravityview() wrapper. */ |
| 815 | 815 | $gravityview_view = new GravityView_View( $view_data ); |
| 816 | - $post_id = ! empty( $atts['post_id'] ) ? intval( $atts['post_id'] ) : get_the_ID(); |
|
| 817 | - $template_id = $view_data['template_id']; |
|
| 816 | + $post_id = ! empty( $atts[ 'post_id' ] ) ? intval( $atts[ 'post_id' ] ) : get_the_ID(); |
|
| 817 | + $template_id = $view_data[ 'template_id' ]; |
|
| 818 | 818 | } |
| 819 | 819 | |
| 820 | 820 | $gravityview_view->setPostId( $post_id ); |
@@ -825,20 +825,20 @@ discard block |
||
| 825 | 825 | do_action( 'gravityview_log_debug', '[render_view] Executing Directory View' ); |
| 826 | 826 | |
| 827 | 827 | //fetch template and slug |
| 828 | - $view_slug = apply_filters( 'gravityview_template_slug_'. $template_id, 'table', 'directory' ); |
|
| 828 | + $view_slug = apply_filters( 'gravityview_template_slug_' . $template_id, 'table', 'directory' ); |
|
| 829 | 829 | |
| 830 | 830 | do_action( 'gravityview_log_debug', '[render_view] View template slug: ', $view_slug ); |
| 831 | 831 | |
| 832 | 832 | /** |
| 833 | 833 | * Disable fetching initial entries for views that don't need it (DataTables) |
| 834 | 834 | */ |
| 835 | - $get_entries = apply_filters( 'gravityview_get_view_entries_'.$view_slug, true ); |
|
| 835 | + $get_entries = apply_filters( 'gravityview_get_view_entries_' . $view_slug, true ); |
|
| 836 | 836 | |
| 837 | 837 | if ( defined( 'GRAVITYVIEW_FUTURE_CORE_LOADED' ) ) { |
| 838 | 838 | $hide_until_searched = $view->settings->get( 'hide_until_searched' ); |
| 839 | 839 | } else { |
| 840 | 840 | /** $atts is deprecated, use \GV\View:$settings */ |
| 841 | - $hide_until_searched = ! empty( $atts['hide_until_searched'] ); |
|
| 841 | + $hide_until_searched = ! empty( $atts[ 'hide_until_searched' ] ); |
|
| 842 | 842 | } |
| 843 | 843 | |
| 844 | 844 | /** |
@@ -856,12 +856,12 @@ discard block |
||
| 856 | 856 | $sort_columns = $view->settings->get( 'sort_columns' ); |
| 857 | 857 | } else { |
| 858 | 858 | /** $atts is deprecated, use \GV\View:$settings */ |
| 859 | - $sort_columns = ! empty( $atts['sort_columns'] ); |
|
| 859 | + $sort_columns = ! empty( $atts[ 'sort_columns' ] ); |
|
| 860 | 860 | } |
| 861 | 861 | |
| 862 | 862 | if ( $sort_columns ) { |
| 863 | 863 | // add filter to enable column sorting |
| 864 | - add_filter( 'gravityview/template/field_label', array( $this, 'add_columns_sort_links' ) , 100, 3 ); |
|
| 864 | + add_filter( 'gravityview/template/field_label', array( $this, 'add_columns_sort_links' ), 100, 3 ); |
|
| 865 | 865 | } |
| 866 | 866 | |
| 867 | 867 | if ( defined( 'GRAVITYVIEW_FUTURE_CORE_LOADED' ) ) { |
@@ -869,19 +869,19 @@ discard block |
||
| 869 | 869 | } else { |
| 870 | 870 | /** $atts is deprecated, use \GV\View:$settings */ |
| 871 | 871 | /** $view_data is deprecated, use \GV\View properties */ |
| 872 | - $view_entries = self::get_view_entries( $atts, $view_data['form_id'] ); |
|
| 872 | + $view_entries = self::get_view_entries( $atts, $view_data[ 'form_id' ] ); |
|
| 873 | 873 | } |
| 874 | 874 | |
| 875 | - do_action( 'gravityview_log_debug', sprintf( '[render_view] Get Entries. Found %s entries total, showing %d entries', $view_entries['count'], sizeof( $view_entries['entries'] ) ) ); |
|
| 875 | + do_action( 'gravityview_log_debug', sprintf( '[render_view] Get Entries. Found %s entries total, showing %d entries', $view_entries[ 'count' ], sizeof( $view_entries[ 'entries' ] ) ) ); |
|
| 876 | 876 | |
| 877 | 877 | } else { |
| 878 | 878 | |
| 879 | 879 | $view_entries = array( 'count' => null, 'entries' => null, 'paging' => null ); |
| 880 | 880 | |
| 881 | - do_action( 'gravityview_log_debug', '[render_view] Not fetching entries because `gravityview_get_view_entries_'.$view_slug.'` is false' ); |
|
| 881 | + do_action( 'gravityview_log_debug', '[render_view] Not fetching entries because `gravityview_get_view_entries_' . $view_slug . '` is false' ); |
|
| 882 | 882 | } |
| 883 | 883 | |
| 884 | - $gravityview_view->setPaging( $view_entries['paging'] ); |
|
| 884 | + $gravityview_view->setPaging( $view_entries[ 'paging' ] ); |
|
| 885 | 885 | $gravityview_view->setContext( 'directory' ); |
| 886 | 886 | $sections = array( 'header', 'body', 'footer' ); |
| 887 | 887 | |
@@ -898,7 +898,7 @@ discard block |
||
| 898 | 898 | do_action( 'gravityview_render_entry_' . $view->ID ); |
| 899 | 899 | } else { |
| 900 | 900 | /** $view_data is depreacted, use \GV\View properties */ |
| 901 | - do_action( 'gravityview_render_entry_'.$view_data['id'] ); |
|
| 901 | + do_action( 'gravityview_render_entry_' . $view_data[ 'id' ] ); |
|
| 902 | 902 | } |
| 903 | 903 | |
| 904 | 904 | $entry = $this->getEntry(); |
@@ -909,7 +909,7 @@ discard block |
||
| 909 | 909 | do_action( 'gravityview_log_debug', '[render_view] Entry does not exist. This may be because of View filters limiting access.' ); |
| 910 | 910 | |
| 911 | 911 | // Only display warning once when multiple Views are embedded |
| 912 | - if( $view_id !== (int) GravityView_frontend::get_context_view_id() ) { |
|
| 912 | + if ( $view_id !== (int)GravityView_frontend::get_context_view_id() ) { |
|
| 913 | 913 | ob_end_clean(); |
| 914 | 914 | return null; |
| 915 | 915 | } |
@@ -934,7 +934,7 @@ discard block |
||
| 934 | 934 | // important: do not remove this as it prevents fake attempts of displaying entries from other views/forms |
| 935 | 935 | $multiple_views = defined( 'GRAVITYVIEW_FUTURE_CORE_LOADED' ) ? gravityview()->views->count() > 1 : $this->getGvOutputData()->has_multiple_views(); |
| 936 | 936 | if ( $multiple_views && $view_id != $this->get_context_view_id() ) { |
| 937 | - do_action( 'gravityview_log_debug', '[render_view] In single entry view, but the entry does not belong to this View. Perhaps there are multiple views on the page. View ID: '. $view_id ); |
|
| 937 | + do_action( 'gravityview_log_debug', '[render_view] In single entry view, but the entry does not belong to this View. Perhaps there are multiple views on the page. View ID: ' . $view_id ); |
|
| 938 | 938 | ob_end_clean(); |
| 939 | 939 | return null; |
| 940 | 940 | } |
@@ -944,14 +944,14 @@ discard block |
||
| 944 | 944 | do_action( 'gravityview_log_debug', '[render_view] View single template slug: ', $view_slug ); |
| 945 | 945 | |
| 946 | 946 | //fetch entry detail |
| 947 | - $view_entries['count'] = 1; |
|
| 948 | - $view_entries['entries'][] = $entry; |
|
| 949 | - do_action( 'gravityview_log_debug', '[render_view] Get single entry: ', $view_entries['entries'] ); |
|
| 947 | + $view_entries[ 'count' ] = 1; |
|
| 948 | + $view_entries[ 'entries' ][ ] = $entry; |
|
| 949 | + do_action( 'gravityview_log_debug', '[render_view] Get single entry: ', $view_entries[ 'entries' ] ); |
|
| 950 | 950 | |
| 951 | 951 | if ( defined( 'GRAVITYVIEW_FUTURE_CORE_LOADED' ) ) { |
| 952 | 952 | $back_link_label = $view->settings->get( 'back_link_label', null ); |
| 953 | 953 | } else { |
| 954 | - $back_link_label = isset( $atts['back_link_label'] ) ? $atts['back_link_label'] : null; |
|
| 954 | + $back_link_label = isset( $atts[ 'back_link_label' ] ) ? $atts[ 'back_link_label' ] : null; |
|
| 955 | 955 | } |
| 956 | 956 | |
| 957 | 957 | // set back link label |
@@ -965,8 +965,8 @@ discard block |
||
| 965 | 965 | self::add_style( $template_id ); |
| 966 | 966 | |
| 967 | 967 | // Prepare to render view and set vars |
| 968 | - $gravityview_view->setEntries( $view_entries['entries'] ); |
|
| 969 | - $gravityview_view->setTotalEntries( $view_entries['count'] ); |
|
| 968 | + $gravityview_view->setEntries( $view_entries[ 'entries' ] ); |
|
| 969 | + $gravityview_view->setTotalEntries( $view_entries[ 'count' ] ); |
|
| 970 | 970 | |
| 971 | 971 | // If Edit |
| 972 | 972 | if ( 'edit' === gravityview_get_context() ) { |
@@ -983,7 +983,7 @@ discard block |
||
| 983 | 983 | |
| 984 | 984 | do_action( 'gravityview_log_debug', '[render_view] Sections to render: ', $sections ); |
| 985 | 985 | foreach ( $sections as $section ) { |
| 986 | - do_action( 'gravityview_log_debug', '[render_view] Rendering '. $section . ' section.' ); |
|
| 986 | + do_action( 'gravityview_log_debug', '[render_view] Rendering ' . $section . ' section.' ); |
|
| 987 | 987 | $gravityview_view->render( $view_slug, $section, false ); |
| 988 | 988 | } |
| 989 | 989 | } |
@@ -1037,7 +1037,7 @@ discard block |
||
| 1037 | 1037 | $datetime_format = 'Y-m-d H:i:s'; |
| 1038 | 1038 | $search_is_outside_view_bounds = false; |
| 1039 | 1039 | |
| 1040 | - if( ! empty( $search_criteria[ $key ] ) ) { |
|
| 1040 | + if ( ! empty( $search_criteria[ $key ] ) ) { |
|
| 1041 | 1041 | |
| 1042 | 1042 | $search_date = strtotime( $search_criteria[ $key ] ); |
| 1043 | 1043 | |
@@ -1065,14 +1065,14 @@ discard block |
||
| 1065 | 1065 | if ( empty( $search_criteria[ $key ] ) || $search_is_outside_view_bounds ) { |
| 1066 | 1066 | |
| 1067 | 1067 | // Then we override the search and re-set the start date |
| 1068 | - $return_search_criteria[ $key ] = date_i18n( $datetime_format , $date, true ); |
|
| 1068 | + $return_search_criteria[ $key ] = date_i18n( $datetime_format, $date, true ); |
|
| 1069 | 1069 | } |
| 1070 | 1070 | } |
| 1071 | 1071 | } |
| 1072 | 1072 | |
| 1073 | - if( isset( $return_search_criteria['start_date'] ) && isset( $return_search_criteria['end_date'] ) ) { |
|
| 1073 | + if ( isset( $return_search_criteria[ 'start_date' ] ) && isset( $return_search_criteria[ 'end_date' ] ) ) { |
|
| 1074 | 1074 | // The start date is AFTER the end date. This will result in no results, but let's not force the issue. |
| 1075 | - if ( strtotime( $return_search_criteria['start_date'] ) > strtotime( $return_search_criteria['end_date'] ) ) { |
|
| 1075 | + if ( strtotime( $return_search_criteria[ 'start_date' ] ) > strtotime( $return_search_criteria[ 'end_date' ] ) ) { |
|
| 1076 | 1076 | do_action( 'gravityview_log_error', __METHOD__ . ' Invalid search: the start date is after the end date.', $return_search_criteria ); |
| 1077 | 1077 | } |
| 1078 | 1078 | } |
@@ -1091,19 +1091,19 @@ discard block |
||
| 1091 | 1091 | public static function process_search_only_approved( $args, $search_criteria ) { |
| 1092 | 1092 | |
| 1093 | 1093 | /** @since 1.19 */ |
| 1094 | - if( ! empty( $args['admin_show_all_statuses'] ) && GVCommon::has_cap('gravityview_moderate_entries') ) { |
|
| 1094 | + if ( ! empty( $args[ 'admin_show_all_statuses' ] ) && GVCommon::has_cap( 'gravityview_moderate_entries' ) ) { |
|
| 1095 | 1095 | do_action( 'gravityview_log_debug', __METHOD__ . ': User can moderate entries; showing all approval statuses' ); |
| 1096 | 1096 | return $search_criteria; |
| 1097 | 1097 | } |
| 1098 | 1098 | |
| 1099 | - if ( ! empty( $args['show_only_approved'] ) ) { |
|
| 1099 | + if ( ! empty( $args[ 'show_only_approved' ] ) ) { |
|
| 1100 | 1100 | |
| 1101 | - $search_criteria['field_filters'][] = array( |
|
| 1101 | + $search_criteria[ 'field_filters' ][ ] = array( |
|
| 1102 | 1102 | 'key' => GravityView_Entry_Approval::meta_key, |
| 1103 | 1103 | 'value' => GravityView_Entry_Approval_Status::APPROVED |
| 1104 | 1104 | ); |
| 1105 | 1105 | |
| 1106 | - $search_criteria['field_filters']['mode'] = 'all'; // force all the criterias to be met |
|
| 1106 | + $search_criteria[ 'field_filters' ][ 'mode' ] = 'all'; // force all the criterias to be met |
|
| 1107 | 1107 | |
| 1108 | 1108 | do_action( 'gravityview_log_debug', '[process_search_only_approved] Search Criteria if show only approved: ', $search_criteria ); |
| 1109 | 1109 | } |
@@ -1130,18 +1130,18 @@ discard block |
||
| 1130 | 1130 | */ |
| 1131 | 1131 | public static function is_entry_approved( $entry, $args = array() ) { |
| 1132 | 1132 | |
| 1133 | - if ( empty( $entry['id'] ) || ( array_key_exists( 'show_only_approved', $args ) && ! $args['show_only_approved'] ) ) { |
|
| 1133 | + if ( empty( $entry[ 'id' ] ) || ( array_key_exists( 'show_only_approved', $args ) && ! $args[ 'show_only_approved' ] ) ) { |
|
| 1134 | 1134 | // is implicitly approved if entry is null or View settings doesn't require to check for approval |
| 1135 | 1135 | return true; |
| 1136 | 1136 | } |
| 1137 | 1137 | |
| 1138 | 1138 | /** @since 1.19 */ |
| 1139 | - if( ! empty( $args['admin_show_all_statuses'] ) && GVCommon::has_cap('gravityview_moderate_entries') ) { |
|
| 1139 | + if ( ! empty( $args[ 'admin_show_all_statuses' ] ) && GVCommon::has_cap( 'gravityview_moderate_entries' ) ) { |
|
| 1140 | 1140 | do_action( 'gravityview_log_debug', __METHOD__ . ': User can moderate entries, so entry is approved for viewing' ); |
| 1141 | 1141 | return true; |
| 1142 | 1142 | } |
| 1143 | 1143 | |
| 1144 | - $is_approved = gform_get_meta( $entry['id'], GravityView_Entry_Approval::meta_key ); |
|
| 1144 | + $is_approved = gform_get_meta( $entry[ 'id' ], GravityView_Entry_Approval::meta_key ); |
|
| 1145 | 1145 | |
| 1146 | 1146 | return GravityView_Entry_Approval_Status::is_approved( $is_approved ); |
| 1147 | 1147 | } |
@@ -1175,29 +1175,29 @@ discard block |
||
| 1175 | 1175 | do_action( 'gravityview_log_debug', '[get_search_criteria] Search Criteria after hook gravityview_fe_search_criteria: ', $search_criteria ); |
| 1176 | 1176 | |
| 1177 | 1177 | // implicity search |
| 1178 | - if ( ! empty( $args['search_value'] ) ) { |
|
| 1178 | + if ( ! empty( $args[ 'search_value' ] ) ) { |
|
| 1179 | 1179 | |
| 1180 | 1180 | // Search operator options. Options: `is` or `contains` |
| 1181 | - $operator = ! empty( $args['search_operator'] ) && in_array( $args['search_operator'], array( 'is', 'isnot', '>', '<', 'contains' ) ) ? $args['search_operator'] : 'contains'; |
|
| 1181 | + $operator = ! empty( $args[ 'search_operator' ] ) && in_array( $args[ 'search_operator' ], array( 'is', 'isnot', '>', '<', 'contains' ) ) ? $args[ 'search_operator' ] : 'contains'; |
|
| 1182 | 1182 | |
| 1183 | - $search_criteria['field_filters'][] = array( |
|
| 1183 | + $search_criteria[ 'field_filters' ][ ] = array( |
|
| 1184 | 1184 | 'key' => rgget( 'search_field', $args ), // The field ID to search |
| 1185 | - 'value' => _wp_specialchars( $args['search_value'] ), // The value to search. Encode ampersands but not quotes. |
|
| 1185 | + 'value' => _wp_specialchars( $args[ 'search_value' ] ), // The value to search. Encode ampersands but not quotes. |
|
| 1186 | 1186 | 'operator' => $operator, |
| 1187 | 1187 | ); |
| 1188 | 1188 | |
| 1189 | 1189 | // Lock search mode to "all" with implicit presearch filter. |
| 1190 | - $search_criteria['field_filters']['mode'] = 'all'; |
|
| 1190 | + $search_criteria[ 'field_filters' ][ 'mode' ] = 'all'; |
|
| 1191 | 1191 | } |
| 1192 | 1192 | |
| 1193 | - if( $search_criteria !== $original_search_criteria ) { |
|
| 1193 | + if ( $search_criteria !== $original_search_criteria ) { |
|
| 1194 | 1194 | do_action( 'gravityview_log_debug', '[get_search_criteria] Search Criteria after implicity search: ', $search_criteria ); |
| 1195 | 1195 | } |
| 1196 | 1196 | |
| 1197 | 1197 | // Handle setting date range |
| 1198 | 1198 | $search_criteria = self::process_search_dates( $args, $search_criteria ); |
| 1199 | 1199 | |
| 1200 | - if( $search_criteria !== $original_search_criteria ) { |
|
| 1200 | + if ( $search_criteria !== $original_search_criteria ) { |
|
| 1201 | 1201 | do_action( 'gravityview_log_debug', '[get_search_criteria] Search Criteria after date params: ', $search_criteria ); |
| 1202 | 1202 | } |
| 1203 | 1203 | |
@@ -1208,7 +1208,7 @@ discard block |
||
| 1208 | 1208 | * @filter `gravityview_status` Modify entry status requirements to be included in search results. |
| 1209 | 1209 | * @param string $status Default: `active`. Accepts all Gravity Forms entry statuses, including `spam` and `trash` |
| 1210 | 1210 | */ |
| 1211 | - $search_criteria['status'] = apply_filters( 'gravityview_status', 'active', $args ); |
|
| 1211 | + $search_criteria[ 'status' ] = apply_filters( 'gravityview_status', 'active', $args ); |
|
| 1212 | 1212 | |
| 1213 | 1213 | return $search_criteria; |
| 1214 | 1214 | } |
@@ -1332,7 +1332,7 @@ discard block |
||
| 1332 | 1332 | 'search_criteria' => $search_criteria, |
| 1333 | 1333 | 'sorting' => self::updateViewSorting( $args, $form_id ), |
| 1334 | 1334 | 'paging' => $paging, |
| 1335 | - 'cache' => isset( $args['cache'] ) ? $args['cache'] : true, |
|
| 1335 | + 'cache' => isset( $args[ 'cache' ] ) ? $args[ 'cache' ] : true, |
|
| 1336 | 1336 | ); |
| 1337 | 1337 | |
| 1338 | 1338 | /** |
@@ -1357,7 +1357,7 @@ discard block |
||
| 1357 | 1357 | * @param array $parameters Array with `search_criteria`, `sorting` and `paging` keys. |
| 1358 | 1358 | * @param array $args View configuration args. |
| 1359 | 1359 | */ |
| 1360 | - $parameters = apply_filters( 'gravityview_get_entries_'.$args['id'], $parameters, $args, $form_id ); |
|
| 1360 | + $parameters = apply_filters( 'gravityview_get_entries_' . $args[ 'id' ], $parameters, $args, $form_id ); |
|
| 1361 | 1361 | |
| 1362 | 1362 | do_action( 'gravityview_log_debug', __METHOD__ . ': $parameters passed to gravityview_get_entries(): ', $parameters ); |
| 1363 | 1363 | |
@@ -1382,17 +1382,17 @@ discard block |
||
| 1382 | 1382 | $default_page_size = apply_filters( 'gravityview_default_page_size', 25 ); |
| 1383 | 1383 | |
| 1384 | 1384 | // Paging & offset |
| 1385 | - $page_size = ! empty( $args['page_size'] ) ? intval( $args['page_size'] ) : $default_page_size; |
|
| 1385 | + $page_size = ! empty( $args[ 'page_size' ] ) ? intval( $args[ 'page_size' ] ) : $default_page_size; |
|
| 1386 | 1386 | |
| 1387 | 1387 | if ( -1 === $page_size ) { |
| 1388 | 1388 | $page_size = PHP_INT_MAX; |
| 1389 | 1389 | } |
| 1390 | 1390 | |
| 1391 | - $curr_page = empty( $_GET['pagenum'] ) ? 1 : intval( $_GET['pagenum'] ); |
|
| 1391 | + $curr_page = empty( $_GET[ 'pagenum' ] ) ? 1 : intval( $_GET[ 'pagenum' ] ); |
|
| 1392 | 1392 | $offset = ( $curr_page - 1 ) * $page_size; |
| 1393 | 1393 | |
| 1394 | - if ( ! empty( $args['offset'] ) ) { |
|
| 1395 | - $offset += intval( $args['offset'] ); |
|
| 1394 | + if ( ! empty( $args[ 'offset' ] ) ) { |
|
| 1395 | + $offset += intval( $args[ 'offset' ] ); |
|
| 1396 | 1396 | } |
| 1397 | 1397 | |
| 1398 | 1398 | $paging = array( |
@@ -1416,8 +1416,8 @@ discard block |
||
| 1416 | 1416 | */ |
| 1417 | 1417 | public static function updateViewSorting( $args, $form_id ) { |
| 1418 | 1418 | $sorting = array(); |
| 1419 | - $sort_field_id = isset( $_GET['sort'] ) ? $_GET['sort'] : rgar( $args, 'sort_field' ); |
|
| 1420 | - $sort_direction = isset( $_GET['dir'] ) ? $_GET['dir'] : rgar( $args, 'sort_direction' ); |
|
| 1419 | + $sort_field_id = isset( $_GET[ 'sort' ] ) ? $_GET[ 'sort' ] : rgar( $args, 'sort_field' ); |
|
| 1420 | + $sort_direction = isset( $_GET[ 'dir' ] ) ? $_GET[ 'dir' ] : rgar( $args, 'sort_direction' ); |
|
| 1421 | 1421 | |
| 1422 | 1422 | $sort_field_id = self::_override_sorting_id_by_field_type( $sort_field_id, $form_id ); |
| 1423 | 1423 | |
@@ -1434,12 +1434,12 @@ discard block |
||
| 1434 | 1434 | $form = GFAPI::get_form( $form_id ); |
| 1435 | 1435 | |
| 1436 | 1436 | // Get the first GF_Field field ID, set as the key for entry randomization |
| 1437 | - if( ! empty( $form['fields'] ) ) { |
|
| 1437 | + if ( ! empty( $form[ 'fields' ] ) ) { |
|
| 1438 | 1438 | |
| 1439 | 1439 | /** @var GF_Field $field */ |
| 1440 | - foreach ( $form['fields'] as $field ) { |
|
| 1440 | + foreach ( $form[ 'fields' ] as $field ) { |
|
| 1441 | 1441 | |
| 1442 | - if( ! is_a( $field, 'GF_Field' ) ) { |
|
| 1442 | + if ( ! is_a( $field, 'GF_Field' ) ) { |
|
| 1443 | 1443 | continue; |
| 1444 | 1444 | } |
| 1445 | 1445 | |
@@ -1482,11 +1482,11 @@ discard block |
||
| 1482 | 1482 | |
| 1483 | 1483 | $sort_field = GFFormsModel::get_field( $form, $sort_field_id ); |
| 1484 | 1484 | |
| 1485 | - if( ! $sort_field ) { |
|
| 1485 | + if ( ! $sort_field ) { |
|
| 1486 | 1486 | return $sort_field_id; |
| 1487 | 1487 | } |
| 1488 | 1488 | |
| 1489 | - switch ( $sort_field['type'] ) { |
|
| 1489 | + switch ( $sort_field[ 'type' ] ) { |
|
| 1490 | 1490 | |
| 1491 | 1491 | case 'address': |
| 1492 | 1492 | // Sorting by full address |
@@ -1503,7 +1503,7 @@ discard block |
||
| 1503 | 1503 | */ |
| 1504 | 1504 | $address_part = apply_filters( 'gravityview/sorting/address', 'city', $sort_field_id, $form_id ); |
| 1505 | 1505 | |
| 1506 | - switch( strtolower( $address_part ) ){ |
|
| 1506 | + switch ( strtolower( $address_part ) ) { |
|
| 1507 | 1507 | case 'street': |
| 1508 | 1508 | $sort_field_id .= '.1'; |
| 1509 | 1509 | break; |
@@ -1588,7 +1588,7 @@ discard block |
||
| 1588 | 1588 | */ |
| 1589 | 1589 | $single_entry = apply_filters( 'gravityview/is_single_entry', $single_entry ); |
| 1590 | 1590 | |
| 1591 | - if ( empty( $single_entry ) ){ |
|
| 1591 | + if ( empty( $single_entry ) ) { |
|
| 1592 | 1592 | return false; |
| 1593 | 1593 | } else { |
| 1594 | 1594 | return $single_entry; |
@@ -1621,14 +1621,14 @@ discard block |
||
| 1621 | 1621 | $template_id = $view->template ? $view->template->ID : null; |
| 1622 | 1622 | $data = $view->as_data(); |
| 1623 | 1623 | } else { |
| 1624 | - $template_id = $data['template_id']; |
|
| 1624 | + $template_id = $data[ 'template_id' ]; |
|
| 1625 | 1625 | } |
| 1626 | 1626 | |
| 1627 | 1627 | /** |
| 1628 | 1628 | * Don't enqueue the scripts or styles if it's not going to be displayed. |
| 1629 | 1629 | * @since 1.15 |
| 1630 | 1630 | */ |
| 1631 | - if( is_user_logged_in() && false === GVCommon::has_cap( 'read_gravityview', $view_id ) ) { |
|
| 1631 | + if ( is_user_logged_in() && false === GVCommon::has_cap( 'read_gravityview', $view_id ) ) { |
|
| 1632 | 1632 | continue; |
| 1633 | 1633 | } |
| 1634 | 1634 | |
@@ -1640,7 +1640,7 @@ discard block |
||
| 1640 | 1640 | $lightbox = $view->settings->get( 'lightbox' ); |
| 1641 | 1641 | } else { |
| 1642 | 1642 | /** View data attributes are now stored in \GV\View::$settings */ |
| 1643 | - $lightbox = ! empty( $data['atts']['lightbox'] ); |
|
| 1643 | + $lightbox = ! empty( $data[ 'atts' ][ 'lightbox' ] ); |
|
| 1644 | 1644 | } |
| 1645 | 1645 | |
| 1646 | 1646 | // If the thickbox is enqueued, add dependencies |
@@ -1650,13 +1650,13 @@ discard block |
||
| 1650 | 1650 | * @filter `gravity_view_lightbox_script` Override the lightbox script to enqueue. Default: `thickbox` |
| 1651 | 1651 | * @param string $script_slug If you want to use a different lightbox script, return the name of it here. |
| 1652 | 1652 | */ |
| 1653 | - $js_dependencies[] = apply_filters( 'gravity_view_lightbox_script', 'thickbox' ); |
|
| 1653 | + $js_dependencies[ ] = apply_filters( 'gravity_view_lightbox_script', 'thickbox' ); |
|
| 1654 | 1654 | |
| 1655 | 1655 | /** |
| 1656 | 1656 | * @filter `gravity_view_lightbox_style` Modify the lightbox CSS slug. Default: `thickbox` |
| 1657 | 1657 | * @param string $script_slug If you want to use a different lightbox script, return the name of its CSS file here. |
| 1658 | 1658 | */ |
| 1659 | - $css_dependencies[] = apply_filters( 'gravity_view_lightbox_style', 'thickbox' ); |
|
| 1659 | + $css_dependencies[ ] = apply_filters( 'gravity_view_lightbox_style', 'thickbox' ); |
|
| 1660 | 1660 | } |
| 1661 | 1661 | |
| 1662 | 1662 | /** |
@@ -1664,19 +1664,19 @@ discard block |
||
| 1664 | 1664 | * @see https://github.com/katzwebservices/GravityView/issues/536 |
| 1665 | 1665 | * @since 1.15 |
| 1666 | 1666 | */ |
| 1667 | - if( gravityview_view_has_single_checkbox_or_radio( $data['form'], $data['fields'] ) ) { |
|
| 1668 | - $css_dependencies[] = 'dashicons'; |
|
| 1667 | + if ( gravityview_view_has_single_checkbox_or_radio( $data[ 'form' ], $data[ 'fields' ] ) ) { |
|
| 1668 | + $css_dependencies[ ] = 'dashicons'; |
|
| 1669 | 1669 | } |
| 1670 | 1670 | |
| 1671 | 1671 | wp_register_script( 'gravityview-jquery-cookie', plugins_url( 'assets/lib/jquery.cookie/jquery.cookie.min.js', GRAVITYVIEW_FILE ), array( 'jquery' ), GravityView_Plugin::version, true ); |
| 1672 | 1672 | |
| 1673 | 1673 | $script_debug = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
| 1674 | 1674 | |
| 1675 | - wp_register_script( 'gravityview-fe-view', plugins_url( 'assets/js/fe-views' . $script_debug . '.js', GRAVITYVIEW_FILE ), apply_filters( 'gravityview_js_dependencies', $js_dependencies ) , GravityView_Plugin::version, true ); |
|
| 1675 | + wp_register_script( 'gravityview-fe-view', plugins_url( 'assets/js/fe-views' . $script_debug . '.js', GRAVITYVIEW_FILE ), apply_filters( 'gravityview_js_dependencies', $js_dependencies ), GravityView_Plugin::version, true ); |
|
| 1676 | 1676 | |
| 1677 | 1677 | wp_enqueue_script( 'gravityview-fe-view' ); |
| 1678 | 1678 | |
| 1679 | - if ( ! empty( $data['atts']['sort_columns'] ) ) { |
|
| 1679 | + if ( ! empty( $data[ 'atts' ][ 'sort_columns' ] ) ) { |
|
| 1680 | 1680 | wp_enqueue_style( 'gravityview_font', plugins_url( 'assets/css/font.css', GRAVITYVIEW_FILE ), $css_dependencies, GravityView_Plugin::version, 'all' ); |
| 1681 | 1681 | } |
| 1682 | 1682 | |
@@ -1767,11 +1767,11 @@ discard block |
||
| 1767 | 1767 | * Not a table-based template; don't add sort icons |
| 1768 | 1768 | * @since 1.12 |
| 1769 | 1769 | */ |
| 1770 | - if( ! preg_match( '/table/ism', GravityView_View::getInstance()->getTemplatePartSlug() ) ) { |
|
| 1770 | + if ( ! preg_match( '/table/ism', GravityView_View::getInstance()->getTemplatePartSlug() ) ) { |
|
| 1771 | 1771 | return $label; |
| 1772 | 1772 | } |
| 1773 | 1773 | |
| 1774 | - if ( ! $this->is_field_sortable( $field['id'], $form ) ) { |
|
| 1774 | + if ( ! $this->is_field_sortable( $field[ 'id' ], $form ) ) { |
|
| 1775 | 1775 | return $label; |
| 1776 | 1776 | } |
| 1777 | 1777 | |
@@ -1779,29 +1779,29 @@ discard block |
||
| 1779 | 1779 | |
| 1780 | 1780 | $class = 'gv-sort'; |
| 1781 | 1781 | |
| 1782 | - $sort_field_id = self::_override_sorting_id_by_field_type( $field['id'], $form['id'] ); |
|
| 1782 | + $sort_field_id = self::_override_sorting_id_by_field_type( $field[ 'id' ], $form[ 'id' ] ); |
|
| 1783 | 1783 | |
| 1784 | 1784 | $sort_args = array( |
| 1785 | - 'sort' => $field['id'], |
|
| 1785 | + 'sort' => $field[ 'id' ], |
|
| 1786 | 1786 | 'dir' => 'asc', |
| 1787 | 1787 | ); |
| 1788 | 1788 | |
| 1789 | - if ( ! empty( $sorting['key'] ) && (string) $sort_field_id === (string) $sorting['key'] ) { |
|
| 1789 | + if ( ! empty( $sorting[ 'key' ] ) && (string)$sort_field_id === (string)$sorting[ 'key' ] ) { |
|
| 1790 | 1790 | //toggle sorting direction. |
| 1791 | - if ( 'asc' === $sorting['direction'] ) { |
|
| 1792 | - $sort_args['dir'] = 'desc'; |
|
| 1791 | + if ( 'asc' === $sorting[ 'direction' ] ) { |
|
| 1792 | + $sort_args[ 'dir' ] = 'desc'; |
|
| 1793 | 1793 | $class .= ' gv-icon-sort-desc'; |
| 1794 | 1794 | } else { |
| 1795 | - $sort_args['dir'] = 'asc'; |
|
| 1795 | + $sort_args[ 'dir' ] = 'asc'; |
|
| 1796 | 1796 | $class .= ' gv-icon-sort-asc'; |
| 1797 | 1797 | } |
| 1798 | 1798 | } else { |
| 1799 | 1799 | $class .= ' gv-icon-caret-up-down'; |
| 1800 | 1800 | } |
| 1801 | 1801 | |
| 1802 | - $url = add_query_arg( $sort_args, remove_query_arg( array('pagenum') ) ); |
|
| 1802 | + $url = add_query_arg( $sort_args, remove_query_arg( array( 'pagenum' ) ) ); |
|
| 1803 | 1803 | |
| 1804 | - return '<a href="'. esc_url_raw( $url ) .'" class="'. $class .'" ></a> '. $label; |
|
| 1804 | + return '<a href="' . esc_url_raw( $url ) . '" class="' . $class . '" ></a> ' . $label; |
|
| 1805 | 1805 | |
| 1806 | 1806 | } |
| 1807 | 1807 | |
@@ -1819,7 +1819,7 @@ discard block |
||
| 1819 | 1819 | |
| 1820 | 1820 | $field_type = $field_id; |
| 1821 | 1821 | |
| 1822 | - if( is_numeric( $field_id ) ) { |
|
| 1822 | + if ( is_numeric( $field_id ) ) { |
|
| 1823 | 1823 | $field = GFFormsModel::get_field( $form, $field_id ); |
| 1824 | 1824 | $field_type = $field->type; |
| 1825 | 1825 | } |
@@ -1842,7 +1842,7 @@ discard block |
||
| 1842 | 1842 | return false; |
| 1843 | 1843 | } |
| 1844 | 1844 | |
| 1845 | - return apply_filters( "gravityview/sortable/formfield_{$form['id']}_{$field_id}", apply_filters( "gravityview/sortable/field_{$field_id}", true, $form ) ); |
|
| 1845 | + return apply_filters( "gravityview/sortable/formfield_{$form[ 'id' ]}_{$field_id}", apply_filters( "gravityview/sortable/field_{$field_id}", true, $form ) ); |
|
| 1846 | 1846 | |
| 1847 | 1847 | } |
| 1848 | 1848 | |