@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | |
25 | 25 | function load() { |
26 | 26 | |
27 | - if( !is_admin() ) { |
|
27 | + if ( ! is_admin() ) { |
|
28 | 28 | return; |
29 | 29 | } |
30 | 30 | |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | add_filter( 'gravityview_template_edit_link_options', array( $this, 'edit_link_field_options' ), 10, 5 ); |
39 | 39 | |
40 | 40 | // add tooltips |
41 | - add_filter( 'gravityview/metaboxes/tooltips', array( $this, 'tooltips') ); |
|
41 | + add_filter( 'gravityview/metaboxes/tooltips', array( $this, 'tooltips' ) ); |
|
42 | 42 | |
43 | 43 | // custom fields' options for zone EDIT |
44 | 44 | add_filter( 'gravityview_template_field_options', array( $this, 'field_options' ), 10, 6 ); |
@@ -77,12 +77,12 @@ discard block |
||
77 | 77 | */ |
78 | 78 | function add_default_field( $entry_default_fields, $form = array(), $zone = '' ) { |
79 | 79 | |
80 | - if( $zone !== 'edit' ) { |
|
80 | + if ( $zone !== 'edit' ) { |
|
81 | 81 | |
82 | - $entry_default_fields['edit_link'] = array( |
|
83 | - 'label' => __('Link to Edit Entry', 'gravityview'), |
|
82 | + $entry_default_fields[ 'edit_link' ] = array( |
|
83 | + 'label' => __( 'Link to Edit Entry', 'gravityview' ), |
|
84 | 84 | 'type' => 'edit_link', |
85 | - 'desc' => __('A link to edit the entry. Visible based on View settings.', 'gravityview'), |
|
85 | + 'desc' => __( 'A link to edit the entry. Visible based on View settings.', 'gravityview' ), |
|
86 | 86 | 'icon' => 'dashicons-welcome-write-blog', |
87 | 87 | ); |
88 | 88 | |
@@ -107,12 +107,12 @@ discard block |
||
107 | 107 | $caps = $visibility_caps; |
108 | 108 | |
109 | 109 | // If we're configuring fields in the edit context, we want a limited selection |
110 | - if( $context === 'edit' ) { |
|
110 | + if ( $context === 'edit' ) { |
|
111 | 111 | |
112 | 112 | // Remove other built-in caps. |
113 | - unset( $caps['publish_posts'], $caps['gravityforms_view_entries'], $caps['delete_others_posts'] ); |
|
113 | + unset( $caps[ 'publish_posts' ], $caps[ 'gravityforms_view_entries' ], $caps[ 'delete_others_posts' ] ); |
|
114 | 114 | |
115 | - $caps['read'] = _x('Entry Creator','User capability', 'gravityview'); |
|
115 | + $caps[ 'read' ] = _x( 'Entry Creator', 'User capability', 'gravityview' ); |
|
116 | 116 | } |
117 | 117 | |
118 | 118 | return $caps; |
@@ -132,20 +132,20 @@ discard block |
||
132 | 132 | function edit_link_field_options( $field_options, $template_id, $field_id, $context, $input_type ) { |
133 | 133 | |
134 | 134 | // Always a link, never a filter |
135 | - unset( $field_options['show_as_link'], $field_options['search_filter'] ); |
|
135 | + unset( $field_options[ 'show_as_link' ], $field_options[ 'search_filter' ] ); |
|
136 | 136 | |
137 | 137 | // Edit Entry link should only appear to visitors capable of editing entries |
138 | - unset( $field_options['only_loggedin'], $field_options['only_loggedin_cap'] ); |
|
138 | + unset( $field_options[ 'only_loggedin' ], $field_options[ 'only_loggedin_cap' ] ); |
|
139 | 139 | |
140 | - $add_option['edit_link'] = array( |
|
140 | + $add_option[ 'edit_link' ] = array( |
|
141 | 141 | 'type' => 'text', |
142 | 142 | 'label' => __( 'Edit Link Text', 'gravityview' ), |
143 | 143 | 'desc' => NULL, |
144 | - 'value' => __('Edit Entry', 'gravityview'), |
|
144 | + 'value' => __( 'Edit Entry', 'gravityview' ), |
|
145 | 145 | 'merge_tags' => true, |
146 | 146 | ); |
147 | 147 | |
148 | - $add_option['new_window'] = array( |
|
148 | + $add_option[ 'new_window' ] = array( |
|
149 | 149 | 'type' => 'checkbox', |
150 | 150 | 'label' => __( 'Open link in a new tab or window?', 'gravityview' ), |
151 | 151 | 'value' => false, |
@@ -165,9 +165,9 @@ discard block |
||
165 | 165 | |
166 | 166 | $return = $tooltips; |
167 | 167 | |
168 | - $return['allow_edit_cap'] = array( |
|
169 | - 'title' => __('Limiting Edit Access', 'gravityview'), |
|
170 | - 'value' => __('Change this setting if you don\'t want the user who created the entry to be able to edit this field.', 'gravityview'), |
|
168 | + $return[ 'allow_edit_cap' ] = array( |
|
169 | + 'title' => __( 'Limiting Edit Access', 'gravityview' ), |
|
170 | + 'value' => __( 'Change this setting if you don\'t want the user who created the entry to be able to edit this field.', 'gravityview' ), |
|
171 | 171 | ); |
172 | 172 | |
173 | 173 | return $return; |
@@ -188,12 +188,12 @@ discard block |
||
188 | 188 | public function field_options( $field_options, $template_id, $field_id, $context, $input_type, $form_id ) { |
189 | 189 | |
190 | 190 | // We only want to modify the settings for the edit context |
191 | - if( 'edit' !== $context ) { |
|
191 | + if ( 'edit' !== $context ) { |
|
192 | 192 | return $field_options; |
193 | 193 | } |
194 | 194 | |
195 | 195 | // Entry field is only for logged in users |
196 | - unset( $field_options['only_loggedin'], $field_options['only_loggedin_cap'] ); |
|
196 | + unset( $field_options[ 'only_loggedin' ], $field_options[ 'only_loggedin_cap' ] ); |
|
197 | 197 | |
198 | 198 | $add_options = array( |
199 | 199 | 'allow_edit_cap' => array( |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | |
21 | 21 | if ( ! empty( $passed_post ) ) { |
22 | 22 | $id_or_id_array = $this->maybe_get_view_id( $passed_post ); |
23 | - foreach( is_array( $id_or_id_array ) ? $id_or_id_array : array( $id_or_id_array ) as $view_id ) { |
|
23 | + foreach ( is_array( $id_or_id_array ) ? $id_or_id_array : array( $id_or_id_array ) as $view_id ) { |
|
24 | 24 | if ( \GV\View::exists( $view_id ) && ! $this->views->contains( $view_id ) ) { |
25 | 25 | $this->views->add( \GV\View::by_id( $view_id ) ); |
26 | 26 | } |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | foreach ( $passed_post as &$post ) { |
79 | 79 | $views = \GV\View_Collection::from_post( $post ); |
80 | 80 | foreach ( $views->all() as $view ) { |
81 | - $ids []= $view->ID; |
|
81 | + $ids [ ] = $view->ID; |
|
82 | 82 | |
83 | 83 | /** And as a side-effect... add each view to the global scope. */ |
84 | 84 | if ( ! $this->views->contains( $view->ID ) ) { |
@@ -92,18 +92,18 @@ discard block |
||
92 | 92 | if ( is_string( $passed_post ) ) { |
93 | 93 | $shortcodes = \GV\Shortcode::parse( $passed_post ); |
94 | 94 | foreach ( $shortcodes as $shortcode ) { |
95 | - if ( $shortcode->name == 'gravityview' && !empty( $shortcode->atts['id'] ) ) { |
|
96 | - $ids []= $shortcode->atts['id']; |
|
95 | + if ( $shortcode->name == 'gravityview' && ! empty( $shortcode->atts[ 'id' ] ) ) { |
|
96 | + $ids [ ] = $shortcode->atts[ 'id' ]; |
|
97 | 97 | |
98 | 98 | /** And as a side-effect... add each view to the global scope. */ |
99 | - if ( ! $this->views->contains( $shortcode->atts['id'] ) && \GV\View::exists( $shortcode->atts['id'] ) ) { |
|
100 | - $this->views->add( $shortcode->atts['id'] ); |
|
99 | + if ( ! $this->views->contains( $shortcode->atts[ 'id' ] ) && \GV\View::exists( $shortcode->atts[ 'id' ] ) ) { |
|
100 | + $this->views->add( $shortcode->atts[ 'id' ] ); |
|
101 | 101 | } |
102 | 102 | } |
103 | 103 | } |
104 | 104 | } else { |
105 | 105 | $id = $this->get_id_from_atts( $passed_post ); |
106 | - $ids[] = intval( $id ); |
|
106 | + $ids[ ] = intval( $id ); |
|
107 | 107 | } |
108 | 108 | } |
109 | 109 | |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | |
114 | 114 | // If it's just one ID, return that. |
115 | 115 | // Otherwise, return array of IDs |
116 | - return ( count( $ids ) === 1 ) ? $ids[0] : $ids; |
|
116 | + return ( count( $ids ) === 1 ) ? $ids[ 0 ] : $ids; |
|
117 | 117 | } |
118 | 118 | |
119 | 119 | /** |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | */ |
122 | 122 | public static function getInstance( $passed_post = NULL ) { |
123 | 123 | |
124 | - if( empty( self::$instance ) ) { |
|
124 | + if ( empty( self::$instance ) ) { |
|
125 | 125 | self::$instance = new GravityView_View_Data( $passed_post ); |
126 | 126 | } |
127 | 127 | |
@@ -137,8 +137,8 @@ discard block |
||
137 | 137 | return array(); |
138 | 138 | } |
139 | 139 | return array_combine( |
140 | - array_map( function ( $view ) { return $view->ID; }, $this->views->all() ), |
|
141 | - array_map( function ( $view ) { return $view->as_data(); }, $this->views->all() ) |
|
140 | + array_map( function( $view ) { return $view->ID; }, $this->views->all() ), |
|
141 | + array_map( function( $view ) { return $view->as_data(); }, $this->views->all() ) |
|
142 | 142 | ); |
143 | 143 | } |
144 | 144 | |
@@ -252,22 +252,22 @@ discard block |
||
252 | 252 | public function parse_post_content( $content ) { |
253 | 253 | $ids = array(); |
254 | 254 | foreach ( \GV\Shortcode::parse( $content ) as $shortcode ) { |
255 | - if ( $shortcode->name == 'gravityview' && is_numeric( $shortcode->atts['id'] ) ) { |
|
256 | - if ( \GV\View::exists( $shortcode->atts['id'] ) && ! $this->views->contains( $shortcode->atts['id'] ) ) { |
|
257 | - $this->views->add( \GV\View::by_id( $shortcode->atts['id'] ) ); |
|
255 | + if ( $shortcode->name == 'gravityview' && is_numeric( $shortcode->atts[ 'id' ] ) ) { |
|
256 | + if ( \GV\View::exists( $shortcode->atts[ 'id' ] ) && ! $this->views->contains( $shortcode->atts[ 'id' ] ) ) { |
|
257 | + $this->views->add( \GV\View::by_id( $shortcode->atts[ 'id' ] ) ); |
|
258 | 258 | } |
259 | 259 | /** |
260 | 260 | * The original function outputs the ID even though it wasn't added by ::add_view() |
261 | 261 | * Wether this is a bug or not remains a mystery. But we need to emulate this behavior |
262 | 262 | * until better times. |
263 | 263 | */ |
264 | - $ids []= $shortcode->atts['id']; |
|
264 | + $ids [ ] = $shortcode->atts[ 'id' ]; |
|
265 | 265 | } |
266 | 266 | } |
267 | 267 | if ( empty ( $ids ) ) { |
268 | 268 | return null; |
269 | 269 | } |
270 | - return ( sizeof( $ids ) === 1 ) ? $ids[0] : $ids; |
|
270 | + return ( sizeof( $ids ) === 1 ) ? $ids[ 0 ] : $ids; |
|
271 | 271 | } |
272 | 272 | |
273 | 273 | /** |
@@ -290,7 +290,7 @@ discard block |
||
290 | 290 | // Not invalid if not set! |
291 | 291 | if ( empty( $post_id ) || empty( $view_id ) ) { |
292 | 292 | |
293 | - if( $empty_is_valid ) { |
|
293 | + if ( $empty_is_valid ) { |
|
294 | 294 | return true; |
295 | 295 | } |
296 | 296 | |
@@ -323,7 +323,7 @@ discard block |
||
323 | 323 | $view_ids_in_post = array_map( function( $view ) { return $view->ID; }, $views->all() ); |
324 | 324 | |
325 | 325 | // The post or page specified does not contain the shortcode. |
326 | - if ( false === in_array( $view_id, (array) $view_ids_in_post ) ) { |
|
326 | + if ( false === in_array( $view_id, (array)$view_ids_in_post ) ) { |
|
327 | 327 | $message = sprintf( esc_html__( 'The Post ID entered is not valid. You may have entered a post or page that does not contain the selected View. Make sure the post contains the following shortcode: %s', 'gravityview' ), '<br /><code>[gravityview id="' . intval( $view_id ) . '"]</code>' ); |
328 | 328 | } |
329 | 329 | } |
@@ -331,7 +331,7 @@ discard block |
||
331 | 331 | if ( ! $message ) { |
332 | 332 | // It's a View |
333 | 333 | if ( \GV\View::exists( $post_id ) ) { |
334 | - $message = esc_html__( 'The ID is already a View.', 'gravityview' );; |
|
334 | + $message = esc_html__( 'The ID is already a View.', 'gravityview' ); ; |
|
335 | 335 | } |
336 | 336 | } |
337 | 337 |
@@ -33,10 +33,10 @@ discard block |
||
33 | 33 | * @since 1.0 |
34 | 34 | */ |
35 | 35 | public function __construct() { |
36 | - add_action( 'admin_menu', array( $this, 'admin_menus'), 200 ); |
|
36 | + add_action( 'admin_menu', array( $this, 'admin_menus' ), 200 ); |
|
37 | 37 | add_action( 'admin_head', array( $this, 'admin_head' ) ); |
38 | - add_action( 'admin_init', array( $this, 'welcome' ) ); |
|
39 | - add_filter( 'gravityview_is_admin_page', array( $this, 'is_dashboard_page'), 10, 2 ); |
|
38 | + add_action( 'admin_init', array( $this, 'welcome' ) ); |
|
39 | + add_filter( 'gravityview_is_admin_page', array( $this, 'is_dashboard_page' ), 10, 2 ); |
|
40 | 40 | } |
41 | 41 | |
42 | 42 | /** |
@@ -51,8 +51,8 @@ discard block |
||
51 | 51 | // Add help page to GravityView menu |
52 | 52 | add_submenu_page( |
53 | 53 | 'edit.php?post_type=gravityview', |
54 | - __('GravityView: Getting Started', 'gravityview'), |
|
55 | - __('Getting Started', 'gravityview'), |
|
54 | + __( 'GravityView: Getting Started', 'gravityview' ), |
|
55 | + __( 'Getting Started', 'gravityview' ), |
|
56 | 56 | $this->minimum_capability, |
57 | 57 | 'gv-getting-started', |
58 | 58 | array( $this, 'getting_started_screen' ) |
@@ -85,10 +85,10 @@ discard block |
||
85 | 85 | * |
86 | 86 | * @return boolean $is_page True: yep; false: nope |
87 | 87 | */ |
88 | - public function is_dashboard_page($is_page = false, $hook = NULL) { |
|
88 | + public function is_dashboard_page( $is_page = false, $hook = NULL ) { |
|
89 | 89 | global $plugin_page; |
90 | 90 | |
91 | - if($is_page) { return $is_page; } |
|
91 | + if ( $is_page ) { return $is_page; } |
|
92 | 92 | |
93 | 93 | return in_array( $plugin_page, array( 'gv-about', 'gv-credits', 'gv-getting-started' ) ); |
94 | 94 | } |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | remove_submenu_page( 'edit.php?post_type=gravityview', 'gv-credits' ); |
106 | 106 | remove_submenu_page( 'edit.php?post_type=gravityview', 'gv-changelog' ); |
107 | 107 | |
108 | - if( !$this->is_dashboard_page() ) { return; } |
|
108 | + if ( ! $this->is_dashboard_page() ) { return; } |
|
109 | 109 | |
110 | 110 | ?> |
111 | 111 | <style type="text/css" media="screen" xmlns="http://www.w3.org/1999/html"> |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | // Don't fetch -beta, etc. |
129 | 129 | list( $display_version ) = explode( '-', GravityView_Plugin::version ); |
130 | 130 | |
131 | - $selected = !empty( $plugin_page ) ? $plugin_page : 'gv-getting-started'; |
|
131 | + $selected = ! empty( $plugin_page ) ? $plugin_page : 'gv-getting-started'; |
|
132 | 132 | |
133 | 133 | echo gravityview_get_floaty( 132 ); |
134 | 134 | ?> |
@@ -137,13 +137,13 @@ discard block |
||
137 | 137 | <div class="about-text"><?php esc_html_e( 'Thank you for installing GravityView. Beautifully display your Gravity Forms entries.', 'gravityview' ); ?></div> |
138 | 138 | |
139 | 139 | <h2 class="nav-tab-wrapper clear"> |
140 | - <a class="nav-tab <?php echo $selected == 'gv-getting-started' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'gv-getting-started', 'post_type' => 'gravityview'), 'edit.php' ) ) ); ?>"> |
|
140 | + <a class="nav-tab <?php echo $selected == 'gv-getting-started' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'gv-getting-started', 'post_type' => 'gravityview' ), 'edit.php' ) ) ); ?>"> |
|
141 | 141 | <?php _e( "Getting Started", 'gravityview' ); ?> |
142 | 142 | </a> |
143 | - <a class="nav-tab <?php echo $selected == 'gv-changelog' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'gv-changelog', 'post_type' => 'gravityview'), 'edit.php' ) ) ); ?>"> |
|
143 | + <a class="nav-tab <?php echo $selected == 'gv-changelog' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'gv-changelog', 'post_type' => 'gravityview' ), 'edit.php' ) ) ); ?>"> |
|
144 | 144 | <?php _e( "List of Changes", 'gravityview' ); ?> |
145 | 145 | </a> |
146 | - <a class="nav-tab <?php echo $selected == 'gv-credits' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'gv-credits', 'post_type' => 'gravityview'), 'edit.php' ) ) ); ?>"> |
|
146 | + <a class="nav-tab <?php echo $selected == 'gv-credits' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'gv-credits', 'post_type' => 'gravityview' ), 'edit.php' ) ) ); ?>"> |
|
147 | 147 | <?php _e( 'Credits', 'gravityview' ); ?> |
148 | 148 | </a> |
149 | 149 | </h2> |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | <h3>Create a View</h3> |
178 | 178 | |
179 | 179 | <ol class="ol-decimal"> |
180 | - <li>Go to <a href="<?php echo admin_url('post-new.php?post_type=gravityview'); ?>">Views > New View</a></li> |
|
180 | + <li>Go to <a href="<?php echo admin_url( 'post-new.php?post_type=gravityview' ); ?>">Views > New View</a></li> |
|
181 | 181 | <li>If you want to <strong>create a new form</strong>, click the "Use a Form Preset" button</li> |
182 | 182 | <li>If you want to <strong>use an existing form’s entries</strong>, select from the dropdown.</li> |
183 | 183 | <li>Select the type of View you would like to create. There are two core types of Views: <strong>Table</strong> and <strong>Listing</strong>. |
@@ -631,7 +631,7 @@ discard block |
||
631 | 631 | </ul> |
632 | 632 | |
633 | 633 | <h4><?php esc_attr_e( 'Want to contribute?', 'gravityview' ); ?></h4> |
634 | - <p><?php echo sprintf( esc_attr__( 'If you want to contribute to the code, %syou can on Github%s. If your contributions are accepted, you will be thanked here.', 'gravityview'), '<a href="https://github.com/gravityview/GravityView">', '</a>' ); ?></p> |
|
634 | + <p><?php echo sprintf( esc_attr__( 'If you want to contribute to the code, %syou can on Github%s. If your contributions are accepted, you will be thanked here.', 'gravityview' ), '<a href="https://github.com/gravityview/GravityView">', '</a>' ); ?></p> |
|
635 | 635 | </div> |
636 | 636 | </div> |
637 | 637 | |
@@ -673,7 +673,7 @@ discard block |
||
673 | 673 | global $plugin_page; |
674 | 674 | |
675 | 675 | // Bail if we're just editing the plugin |
676 | - if( $plugin_page === 'plugin-editor.php' ) { return; } |
|
676 | + if ( $plugin_page === 'plugin-editor.php' ) { return; } |
|
677 | 677 | |
678 | 678 | // Bail if no activation redirect |
679 | 679 | if ( ! get_transient( '_gv_activation_redirect' ) ) { return; } |
@@ -684,7 +684,7 @@ discard block |
||
684 | 684 | $upgrade = get_option( 'gv_version_upgraded_from' ); |
685 | 685 | |
686 | 686 | // Don't do anything if they've already seen the new version info |
687 | - if( $upgrade === GravityView_Plugin::version ) { |
|
687 | + if ( $upgrade === GravityView_Plugin::version ) { |
|
688 | 688 | return; |
689 | 689 | } |
690 | 690 | |
@@ -692,10 +692,10 @@ discard block |
||
692 | 692 | update_option( 'gv_version_upgraded_from', GravityView_Plugin::version ); |
693 | 693 | |
694 | 694 | // Bail if activating from network, or bulk |
695 | - if ( is_network_admin() || isset( $_GET['activate-multi'] ) ) { return; } |
|
695 | + if ( is_network_admin() || isset( $_GET[ 'activate-multi' ] ) ) { return; } |
|
696 | 696 | |
697 | 697 | // First time install |
698 | - if( ! $upgrade ) { |
|
698 | + if ( ! $upgrade ) { |
|
699 | 699 | wp_safe_redirect( admin_url( 'edit.php?post_type=gravityview&page=gv-getting-started' ) ); exit; |
700 | 700 | } |
701 | 701 | // Update |
@@ -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 ); |
@@ -234,18 +234,18 @@ discard block |
||
234 | 234 | |
235 | 235 | if ( ! empty( $view_id ) ) { |
236 | 236 | |
237 | - $this->context_view_id = (int) $view_id; |
|
237 | + $this->context_view_id = (int)$view_id; |
|
238 | 238 | |
239 | - } elseif ( isset( $_GET['gvid'] ) && $multiple_views ) { |
|
239 | + } elseif ( isset( $_GET[ 'gvid' ] ) && $multiple_views ) { |
|
240 | 240 | /** |
241 | 241 | * used on a has_multiple_views context |
242 | 242 | * @see GravityView_API::entry_link |
243 | 243 | */ |
244 | - $this->context_view_id = (int) $_GET['gvid']; |
|
244 | + $this->context_view_id = (int)$_GET[ 'gvid' ]; |
|
245 | 245 | |
246 | 246 | } elseif ( ! $multiple_views ) { |
247 | 247 | $array_keys = array_keys( $this->getGvOutputData()->get_views() ); |
248 | - $this->context_view_id = (int) array_pop( $array_keys ); |
|
248 | + $this->context_view_id = (int)array_pop( $array_keys ); |
|
249 | 249 | unset( $array_keys ); |
250 | 250 | } |
251 | 251 | |
@@ -278,25 +278,25 @@ discard block |
||
278 | 278 | global $wp_rewrite; |
279 | 279 | |
280 | 280 | $is_front_page = ( $query->is_home || $query->is_page ); |
281 | - $show_on_front = ( 'page' === get_option('show_on_front') ); |
|
282 | - $front_page_id = get_option('page_on_front'); |
|
281 | + $show_on_front = ( 'page' === get_option( 'show_on_front' ) ); |
|
282 | + $front_page_id = get_option( 'page_on_front' ); |
|
283 | 283 | |
284 | - if ( $is_front_page && $show_on_front && $front_page_id ) { |
|
284 | + if ( $is_front_page && $show_on_front && $front_page_id ) { |
|
285 | 285 | |
286 | 286 | // Force to be an array, potentially a query string ( entry=16 ) |
287 | 287 | $_query = wp_parse_args( $query->query ); |
288 | 288 | |
289 | 289 | // pagename can be set and empty depending on matched rewrite rules. Ignore an empty pagename. |
290 | - if ( isset( $_query['pagename'] ) && '' === $_query['pagename'] ) { |
|
291 | - unset( $_query['pagename'] ); |
|
290 | + if ( isset( $_query[ 'pagename' ] ) && '' === $_query[ 'pagename' ] ) { |
|
291 | + unset( $_query[ 'pagename' ] ); |
|
292 | 292 | } |
293 | 293 | |
294 | 294 | // this is where will break from core wordpress |
295 | 295 | /** @internal Don't use this filter; it will be unnecessary soon - it's just a patch for specific use case */ |
296 | 296 | $ignore = apply_filters( 'gravityview/internal/ignored_endpoints', array( 'preview', 'page', 'paged', 'cpage' ), $query ); |
297 | 297 | $endpoints = \GV\Utils::get( $wp_rewrite, 'endpoints' ); |
298 | - foreach ( (array) $endpoints as $endpoint ) { |
|
299 | - $ignore[] = $endpoint[1]; |
|
298 | + foreach ( (array)$endpoints as $endpoint ) { |
|
299 | + $ignore[ ] = $endpoint[ 1 ]; |
|
300 | 300 | } |
301 | 301 | unset( $endpoints ); |
302 | 302 | |
@@ -306,21 +306,21 @@ discard block |
||
306 | 306 | // - The query includes keys that are associated with registered endpoints. `entry`, for example. |
307 | 307 | if ( empty( $_query ) || ! array_diff( array_keys( $_query ), $ignore ) ) { |
308 | 308 | |
309 | - $qv =& $query->query_vars; |
|
309 | + $qv = & $query->query_vars; |
|
310 | 310 | |
311 | 311 | // Prevent redirect when on the single entry endpoint |
312 | - if( self::is_single_entry() ) { |
|
312 | + if ( self::is_single_entry() ) { |
|
313 | 313 | add_filter( 'redirect_canonical', '__return_false' ); |
314 | 314 | } |
315 | 315 | |
316 | 316 | $query->is_page = true; |
317 | 317 | $query->is_home = false; |
318 | - $qv['page_id'] = $front_page_id; |
|
318 | + $qv[ 'page_id' ] = $front_page_id; |
|
319 | 319 | |
320 | 320 | // Correct <!--nextpage--> for page_on_front |
321 | - if ( ! empty( $qv['paged'] ) ) { |
|
322 | - $qv['page'] = $qv['paged']; |
|
323 | - unset( $qv['paged'] ); |
|
321 | + if ( ! empty( $qv[ 'paged' ] ) ) { |
|
322 | + $qv[ 'page' ] = $qv[ 'paged' ]; |
|
323 | + unset( $qv[ 'paged' ] ); |
|
324 | 324 | } |
325 | 325 | } |
326 | 326 | |
@@ -351,11 +351,11 @@ discard block |
||
351 | 351 | $blocks = parse_blocks( $post_content ); |
352 | 352 | |
353 | 353 | foreach ( $blocks as $block ) { |
354 | - if ( empty( $block['attrs']['ref'] ) ) { |
|
354 | + if ( empty( $block[ 'attrs' ][ 'ref' ] ) ) { |
|
355 | 355 | continue; |
356 | 356 | } |
357 | 357 | |
358 | - $block_post = get_post( $block['attrs']['ref'] ); |
|
358 | + $block_post = get_post( $block[ 'attrs' ][ 'ref' ] ); |
|
359 | 359 | |
360 | 360 | if ( $block_post ) { |
361 | 361 | $post_content .= $block_post->post_content; |
@@ -408,7 +408,7 @@ discard block |
||
408 | 408 | |
409 | 409 | $search_method = GravityView_Widget_Search::getInstance()->get_search_method(); |
410 | 410 | |
411 | - if( 'post' === $search_method ) { |
|
411 | + if ( 'post' === $search_method ) { |
|
412 | 412 | $get = $_POST; |
413 | 413 | } else { |
414 | 414 | $get = $_GET; |
@@ -460,7 +460,7 @@ discard block |
||
460 | 460 | $gventry = gravityview()->request->is_entry(); |
461 | 461 | |
462 | 462 | // If this is the directory view, return. |
463 | - if( ! $gventry ) { |
|
463 | + if ( ! $gventry ) { |
|
464 | 464 | return $passed_title; |
465 | 465 | } |
466 | 466 | |
@@ -478,19 +478,19 @@ discard block |
||
478 | 478 | } |
479 | 479 | |
480 | 480 | // WooCommerce doesn't $post_id |
481 | - if ( empty( $passed_post_id ) ) { |
|
481 | + if ( empty( $passed_post_id ) ) { |
|
482 | 482 | return $passed_title; |
483 | 483 | } |
484 | 484 | |
485 | 485 | // Don't modify the title for anything other than the current view/post. |
486 | 486 | // This is true for embedded shortcodes and Views. |
487 | - if ( is_object( $post ) && (int) $post->ID !== (int) $passed_post_id ) { |
|
487 | + if ( is_object( $post ) && (int)$post->ID !== (int)$passed_post_id ) { |
|
488 | 488 | return $passed_title; |
489 | 489 | } |
490 | 490 | |
491 | 491 | $view = gravityview()->request->is_view(); |
492 | 492 | |
493 | - if( $view ) { |
|
493 | + if ( $view ) { |
|
494 | 494 | return $this->_get_single_entry_title( $view, $entry, $passed_title ); |
495 | 495 | } |
496 | 496 | |
@@ -513,7 +513,7 @@ discard block |
||
513 | 513 | $view_collection = \GV\View_Collection::from_post( $post ); |
514 | 514 | |
515 | 515 | // We have multiple Views, but no gvid...this isn't valid security |
516 | - if( 1 < $view_collection->count() ) { |
|
516 | + if ( 1 < $view_collection->count() ) { |
|
517 | 517 | return $passed_title; |
518 | 518 | } |
519 | 519 | |
@@ -547,18 +547,18 @@ discard block |
||
547 | 547 | */ |
548 | 548 | $check_entry_display = apply_filters( 'gravityview/single/title/check_entry_display', true, $entry, $view ); |
549 | 549 | |
550 | - if( $check_entry_display ) { |
|
550 | + if ( $check_entry_display ) { |
|
551 | 551 | |
552 | 552 | $check_display = GVCommon::check_entry_display( $entry, $view ); |
553 | 553 | |
554 | - if( is_wp_error( $check_display ) ) { |
|
554 | + if ( is_wp_error( $check_display ) ) { |
|
555 | 555 | return $passed_title; |
556 | 556 | } |
557 | 557 | } |
558 | 558 | |
559 | 559 | $title = $view->settings->get( 'single_title', $passed_title ); |
560 | 560 | |
561 | - $form = GVCommon::get_form( $entry['form_id'] ); |
|
561 | + $form = GVCommon::get_form( $entry[ 'form_id' ] ); |
|
562 | 562 | |
563 | 563 | // We are allowing HTML in the fields, so no escaping the output |
564 | 564 | $title = GravityView_API::replace_variables( $title, $form, $entry ); |
@@ -629,7 +629,7 @@ discard block |
||
629 | 629 | |
630 | 630 | $context = GravityView_View::getInstance()->getContext(); |
631 | 631 | |
632 | - switch( $context ) { |
|
632 | + switch ( $context ) { |
|
633 | 633 | case 'directory': |
634 | 634 | $tab = __( 'Multiple Entries', 'gravityview' ); |
635 | 635 | break; |
@@ -643,12 +643,12 @@ discard block |
||
643 | 643 | } |
644 | 644 | |
645 | 645 | |
646 | - $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 ); |
|
646 | + $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 ); |
|
647 | 647 | $edit_link = admin_url( sprintf( 'post.php?post=%d&action=edit#%s-view', $view_id, $context ) ); |
648 | - $action_text = sprintf( esc_html__('Add fields to %s', 'gravityview' ), $tab ); |
|
648 | + $action_text = sprintf( esc_html__( 'Add fields to %s', 'gravityview' ), $tab ); |
|
649 | 649 | $message = esc_html__( 'You can only see this message because you are able to edit this View.', 'gravityview' ); |
650 | 650 | |
651 | - $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 ) ) ); |
|
651 | + $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 ) ) ); |
|
652 | 652 | $output = sprintf( '<h3>%s <strong><a href="%s">%s</a></strong></h3><p>%s</p>', $title, esc_url( $edit_link ), $action_text, $message ); |
653 | 653 | |
654 | 654 | echo GVCommon::generate_notice( $output . $image, 'gv-error error', 'edit_gravityview', $view_id ); |
@@ -695,7 +695,7 @@ discard block |
||
695 | 695 | $direct_access = apply_filters( 'gravityview_direct_access', true, $view->ID ); |
696 | 696 | $embed_only = $view->settings->get( 'embed_only' ); |
697 | 697 | |
698 | - if( ! $direct_access || ( $embed_only && ! GVCommon::has_cap( 'read_private_gravityviews' ) ) ) { |
|
698 | + if ( ! $direct_access || ( $embed_only && ! GVCommon::has_cap( 'read_private_gravityviews' ) ) ) { |
|
699 | 699 | return __( 'You are not allowed to view this content.', 'gravityview' ); |
700 | 700 | } |
701 | 701 | |
@@ -742,7 +742,7 @@ discard block |
||
742 | 742 | $datetime_format = 'Y-m-d H:i:s'; |
743 | 743 | $search_is_outside_view_bounds = false; |
744 | 744 | |
745 | - if( ! empty( $search_criteria[ $key ] ) ) { |
|
745 | + if ( ! empty( $search_criteria[ $key ] ) ) { |
|
746 | 746 | |
747 | 747 | $search_date = strtotime( $search_criteria[ $key ], GFCommon::get_local_timestamp() ); |
748 | 748 | |
@@ -770,14 +770,14 @@ discard block |
||
770 | 770 | if ( empty( $search_criteria[ $key ] ) || $search_is_outside_view_bounds ) { |
771 | 771 | |
772 | 772 | // Then we override the search and re-set the start date |
773 | - $return_search_criteria[ $key ] = date_i18n( $datetime_format , $date, true ); |
|
773 | + $return_search_criteria[ $key ] = date_i18n( $datetime_format, $date, true ); |
|
774 | 774 | } |
775 | 775 | } |
776 | 776 | } |
777 | 777 | |
778 | - if( isset( $return_search_criteria['start_date'] ) && isset( $return_search_criteria['end_date'] ) ) { |
|
778 | + if ( isset( $return_search_criteria[ 'start_date' ] ) && isset( $return_search_criteria[ 'end_date' ] ) ) { |
|
779 | 779 | // The start date is AFTER the end date. This will result in no results, but let's not force the issue. |
780 | - if ( strtotime( $return_search_criteria['start_date'] ) > strtotime( $return_search_criteria['end_date'] ) ) { |
|
780 | + if ( strtotime( $return_search_criteria[ 'start_date' ] ) > strtotime( $return_search_criteria[ 'end_date' ] ) ) { |
|
781 | 781 | gravityview()->log->error( 'Invalid search: the start date is after the end date.', array( 'data' => $return_search_criteria ) ); |
782 | 782 | } |
783 | 783 | } |
@@ -796,19 +796,19 @@ discard block |
||
796 | 796 | public static function process_search_only_approved( $args, $search_criteria ) { |
797 | 797 | |
798 | 798 | /** @since 1.19 */ |
799 | - if( ! empty( $args['admin_show_all_statuses'] ) && GVCommon::has_cap('gravityview_moderate_entries') ) { |
|
799 | + if ( ! empty( $args[ 'admin_show_all_statuses' ] ) && GVCommon::has_cap( 'gravityview_moderate_entries' ) ) { |
|
800 | 800 | gravityview()->log->debug( 'User can moderate entries; showing all approval statuses' ); |
801 | 801 | return $search_criteria; |
802 | 802 | } |
803 | 803 | |
804 | - if ( ! empty( $args['show_only_approved'] ) ) { |
|
804 | + if ( ! empty( $args[ 'show_only_approved' ] ) ) { |
|
805 | 805 | |
806 | - $search_criteria['field_filters'][] = array( |
|
806 | + $search_criteria[ 'field_filters' ][ ] = array( |
|
807 | 807 | 'key' => GravityView_Entry_Approval::meta_key, |
808 | 808 | 'value' => GravityView_Entry_Approval_Status::APPROVED |
809 | 809 | ); |
810 | 810 | |
811 | - $search_criteria['field_filters']['mode'] = 'all'; // force all the criterias to be met |
|
811 | + $search_criteria[ 'field_filters' ][ 'mode' ] = 'all'; // force all the criterias to be met |
|
812 | 812 | |
813 | 813 | gravityview()->log->debug( '[process_search_only_approved] Search Criteria if show only approved: ', array( 'data' => $search_criteria ) ); |
814 | 814 | } |
@@ -835,18 +835,18 @@ discard block |
||
835 | 835 | */ |
836 | 836 | public static function is_entry_approved( $entry, $args = array() ) { |
837 | 837 | |
838 | - if ( empty( $entry['id'] ) || ( array_key_exists( 'show_only_approved', $args ) && ! $args['show_only_approved'] ) ) { |
|
838 | + if ( empty( $entry[ 'id' ] ) || ( array_key_exists( 'show_only_approved', $args ) && ! $args[ 'show_only_approved' ] ) ) { |
|
839 | 839 | // is implicitly approved if entry is null or View settings doesn't require to check for approval |
840 | 840 | return true; |
841 | 841 | } |
842 | 842 | |
843 | 843 | /** @since 1.19 */ |
844 | - if( ! empty( $args['admin_show_all_statuses'] ) && GVCommon::has_cap('gravityview_moderate_entries') ) { |
|
844 | + if ( ! empty( $args[ 'admin_show_all_statuses' ] ) && GVCommon::has_cap( 'gravityview_moderate_entries' ) ) { |
|
845 | 845 | gravityview()->log->debug( 'User can moderate entries, so entry is approved for viewing' ); |
846 | 846 | return true; |
847 | 847 | } |
848 | 848 | |
849 | - $is_approved = gform_get_meta( $entry['id'], GravityView_Entry_Approval::meta_key ); |
|
849 | + $is_approved = gform_get_meta( $entry[ 'id' ], GravityView_Entry_Approval::meta_key ); |
|
850 | 850 | |
851 | 851 | return GravityView_Entry_Approval_Status::is_approved( $is_approved ); |
852 | 852 | } |
@@ -870,7 +870,7 @@ discard block |
||
870 | 870 | * Compatibility with filters hooking in `gravityview_search_criteria` instead of `gravityview_fe_search_criteria`. |
871 | 871 | */ |
872 | 872 | $criteria = apply_filters( 'gravityview_search_criteria', array(), array( $form_id ), \GV\Utils::get( $args, 'id' ) ); |
873 | - $search_criteria = isset( $criteria['search_criteria'] ) ? $criteria['search_criteria'] : array( 'field_filters' => array() ); |
|
873 | + $search_criteria = isset( $criteria[ 'search_criteria' ] ) ? $criteria[ 'search_criteria' ] : array( 'field_filters' => array() ); |
|
874 | 874 | |
875 | 875 | /** |
876 | 876 | * @filter `gravityview_fe_search_criteria` Modify the search criteria |
@@ -890,29 +890,29 @@ discard block |
||
890 | 890 | gravityview()->log->debug( '[get_search_criteria] Search Criteria after hook gravityview_fe_search_criteria: ', array( 'data' =>$search_criteria ) ); |
891 | 891 | |
892 | 892 | // implicity search |
893 | - if ( ! empty( $args['search_value'] ) ) { |
|
893 | + if ( ! empty( $args[ 'search_value' ] ) ) { |
|
894 | 894 | |
895 | 895 | // Search operator options. Options: `is` or `contains` |
896 | - $operator = ! empty( $args['search_operator'] ) && in_array( $args['search_operator'], array( 'is', 'isnot', '>', '<', 'contains' ) ) ? $args['search_operator'] : 'contains'; |
|
896 | + $operator = ! empty( $args[ 'search_operator' ] ) && in_array( $args[ 'search_operator' ], array( 'is', 'isnot', '>', '<', 'contains' ) ) ? $args[ 'search_operator' ] : 'contains'; |
|
897 | 897 | |
898 | - $search_criteria['field_filters'][] = array( |
|
898 | + $search_criteria[ 'field_filters' ][ ] = array( |
|
899 | 899 | 'key' => \GV\Utils::_GET( 'search_field', \GV\Utils::get( $args, 'search_field' ) ), // The field ID to search |
900 | - 'value' => _wp_specialchars( $args['search_value'] ), // The value to search. Encode ampersands but not quotes. |
|
900 | + 'value' => _wp_specialchars( $args[ 'search_value' ] ), // The value to search. Encode ampersands but not quotes. |
|
901 | 901 | 'operator' => $operator, |
902 | 902 | ); |
903 | 903 | |
904 | 904 | // Lock search mode to "all" with implicit presearch filter. |
905 | - $search_criteria['field_filters']['mode'] = 'all'; |
|
905 | + $search_criteria[ 'field_filters' ][ 'mode' ] = 'all'; |
|
906 | 906 | } |
907 | 907 | |
908 | - if( $search_criteria !== $original_search_criteria ) { |
|
908 | + if ( $search_criteria !== $original_search_criteria ) { |
|
909 | 909 | gravityview()->log->debug( '[get_search_criteria] Search Criteria after implicity search: ', array( 'data' => $search_criteria ) ); |
910 | 910 | } |
911 | 911 | |
912 | 912 | // Handle setting date range |
913 | 913 | $search_criteria = self::process_search_dates( $args, $search_criteria ); |
914 | 914 | |
915 | - if( $search_criteria !== $original_search_criteria ) { |
|
915 | + if ( $search_criteria !== $original_search_criteria ) { |
|
916 | 916 | gravityview()->log->debug( '[get_search_criteria] Search Criteria after date params: ', array( 'data' => $search_criteria ) ); |
917 | 917 | } |
918 | 918 | |
@@ -923,7 +923,7 @@ discard block |
||
923 | 923 | * @filter `gravityview_status` Modify entry status requirements to be included in search results. |
924 | 924 | * @param string $status Default: `active`. Accepts all Gravity Forms entry statuses, including `spam` and `trash` |
925 | 925 | */ |
926 | - $search_criteria['status'] = apply_filters( 'gravityview_status', 'active', $args ); |
|
926 | + $search_criteria[ 'status' ] = apply_filters( 'gravityview_status', 'active', $args ); |
|
927 | 927 | |
928 | 928 | return $search_criteria; |
929 | 929 | } |
@@ -1035,7 +1035,7 @@ discard block |
||
1035 | 1035 | 'search_criteria' => $search_criteria, |
1036 | 1036 | 'sorting' => self::updateViewSorting( $args, $form_id ), |
1037 | 1037 | 'paging' => $paging, |
1038 | - 'cache' => isset( $args['cache'] ) ? $args['cache'] : true, |
|
1038 | + 'cache' => isset( $args[ 'cache' ] ) ? $args[ 'cache' ] : true, |
|
1039 | 1039 | ); |
1040 | 1040 | |
1041 | 1041 | /** |
@@ -1060,7 +1060,7 @@ discard block |
||
1060 | 1060 | * @param array $parameters Array with `search_criteria`, `sorting` and `paging` keys. |
1061 | 1061 | * @param array $args View configuration args. |
1062 | 1062 | */ |
1063 | - $parameters = apply_filters( 'gravityview_get_entries_'.\GV\Utils::get( $args, 'id' ), $parameters, $args, $form_id ); |
|
1063 | + $parameters = apply_filters( 'gravityview_get_entries_' . \GV\Utils::get( $args, 'id' ), $parameters, $args, $form_id ); |
|
1064 | 1064 | |
1065 | 1065 | gravityview()->log->debug( '$parameters passed to gravityview_get_entries(): ', array( 'data' => $parameters ) ); |
1066 | 1066 | |
@@ -1085,17 +1085,17 @@ discard block |
||
1085 | 1085 | $default_page_size = apply_filters( 'gravityview_default_page_size', 25 ); |
1086 | 1086 | |
1087 | 1087 | // Paging & offset |
1088 | - $page_size = ! empty( $args['page_size'] ) ? intval( $args['page_size'] ) : $default_page_size; |
|
1088 | + $page_size = ! empty( $args[ 'page_size' ] ) ? intval( $args[ 'page_size' ] ) : $default_page_size; |
|
1089 | 1089 | |
1090 | 1090 | if ( -1 === $page_size ) { |
1091 | 1091 | $page_size = PHP_INT_MAX; |
1092 | 1092 | } |
1093 | 1093 | |
1094 | - $curr_page = empty( $_GET['pagenum'] ) ? 1 : intval( $_GET['pagenum'] ); |
|
1094 | + $curr_page = empty( $_GET[ 'pagenum' ] ) ? 1 : intval( $_GET[ 'pagenum' ] ); |
|
1095 | 1095 | $offset = ( $curr_page - 1 ) * $page_size; |
1096 | 1096 | |
1097 | - if ( ! empty( $args['offset'] ) ) { |
|
1098 | - $offset += intval( $args['offset'] ); |
|
1097 | + if ( ! empty( $args[ 'offset' ] ) ) { |
|
1098 | + $offset += intval( $args[ 'offset' ] ); |
|
1099 | 1099 | } |
1100 | 1100 | |
1101 | 1101 | $paging = array( |
@@ -1120,11 +1120,11 @@ discard block |
||
1120 | 1120 | public static function updateViewSorting( $args, $form_id ) { |
1121 | 1121 | $sorting = array(); |
1122 | 1122 | |
1123 | - $has_values = isset( $_GET['sort'] ); |
|
1123 | + $has_values = isset( $_GET[ 'sort' ] ); |
|
1124 | 1124 | |
1125 | - if ( $has_values && is_array( $_GET['sort'] ) ) { |
|
1126 | - $sorts = array_keys( $_GET['sort'] ); |
|
1127 | - $dirs = array_values( $_GET['sort'] ); |
|
1125 | + if ( $has_values && is_array( $_GET[ 'sort' ] ) ) { |
|
1126 | + $sorts = array_keys( $_GET[ 'sort' ] ); |
|
1127 | + $dirs = array_values( $_GET[ 'sort' ] ); |
|
1128 | 1128 | |
1129 | 1129 | if ( $has_values = array_filter( $dirs ) ) { |
1130 | 1130 | $sort_field_id = end( $sorts ); |
@@ -1133,11 +1133,11 @@ discard block |
||
1133 | 1133 | } |
1134 | 1134 | |
1135 | 1135 | if ( ! isset( $sort_field_id ) ) { |
1136 | - $sort_field_id = isset( $_GET['sort'] ) ? $_GET['sort'] : \GV\Utils::get( $args, 'sort_field' ); |
|
1136 | + $sort_field_id = isset( $_GET[ 'sort' ] ) ? $_GET[ 'sort' ] : \GV\Utils::get( $args, 'sort_field' ); |
|
1137 | 1137 | } |
1138 | 1138 | |
1139 | 1139 | if ( ! isset( $sort_direction ) ) { |
1140 | - $sort_direction = isset( $_GET['dir'] ) ? $_GET['dir'] : \GV\Utils::get( $args, 'sort_direction' ); |
|
1140 | + $sort_direction = isset( $_GET[ 'dir' ] ) ? $_GET[ 'dir' ] : \GV\Utils::get( $args, 'sort_direction' ); |
|
1141 | 1141 | } |
1142 | 1142 | |
1143 | 1143 | if ( is_array( $sort_field_id ) ) { |
@@ -1169,10 +1169,10 @@ discard block |
||
1169 | 1169 | $form = GFAPI::get_form( $form_id ); |
1170 | 1170 | |
1171 | 1171 | // Get the first GF_Field field ID, set as the key for entry randomization |
1172 | - if ( ! empty( $form['fields'] ) ) { |
|
1172 | + if ( ! empty( $form[ 'fields' ] ) ) { |
|
1173 | 1173 | |
1174 | 1174 | /** @var GF_Field $field */ |
1175 | - foreach ( $form['fields'] as $field ) { |
|
1175 | + foreach ( $form[ 'fields' ] as $field ) { |
|
1176 | 1176 | if ( ! is_a( $field, 'GF_Field' ) ) { |
1177 | 1177 | continue; |
1178 | 1178 | } |
@@ -1217,7 +1217,7 @@ discard block |
||
1217 | 1217 | if ( is_array( $sort_field_id ) ) { |
1218 | 1218 | $modified_ids = array(); |
1219 | 1219 | foreach ( $sort_field_id as $_sort_field_id ) { |
1220 | - $modified_ids []= self::_override_sorting_id_by_field_type( $_sort_field_id, $form_id ); |
|
1220 | + $modified_ids [ ] = self::_override_sorting_id_by_field_type( $_sort_field_id, $form_id ); |
|
1221 | 1221 | } |
1222 | 1222 | return $modified_ids; |
1223 | 1223 | } |
@@ -1226,11 +1226,11 @@ discard block |
||
1226 | 1226 | |
1227 | 1227 | $sort_field = GFFormsModel::get_field( $form, $sort_field_id ); |
1228 | 1228 | |
1229 | - if( ! $sort_field ) { |
|
1229 | + if ( ! $sort_field ) { |
|
1230 | 1230 | return $sort_field_id; |
1231 | 1231 | } |
1232 | 1232 | |
1233 | - switch ( $sort_field['type'] ) { |
|
1233 | + switch ( $sort_field[ 'type' ] ) { |
|
1234 | 1234 | |
1235 | 1235 | case 'address': |
1236 | 1236 | // Sorting by full address |
@@ -1247,7 +1247,7 @@ discard block |
||
1247 | 1247 | */ |
1248 | 1248 | $address_part = apply_filters( 'gravityview/sorting/address', 'city', $sort_field_id, $form_id ); |
1249 | 1249 | |
1250 | - switch( strtolower( $address_part ) ){ |
|
1250 | + switch ( strtolower( $address_part ) ) { |
|
1251 | 1251 | case 'street': |
1252 | 1252 | $sort_field_id .= '.1'; |
1253 | 1253 | break; |
@@ -1320,7 +1320,7 @@ discard block |
||
1320 | 1320 | if ( ! class_exists( '\GV\Entry' ) ) { |
1321 | 1321 | |
1322 | 1322 | // Not using gravityview()->log->error(), since that may not exist yet either! |
1323 | - do_action( 'gravityview_log_error', '\GV\Entry not defined yet. Backtrace: ' . wp_debug_backtrace_summary() ); |
|
1323 | + do_action( 'gravityview_log_error', '\GV\Entry not defined yet. Backtrace: ' . wp_debug_backtrace_summary() ); |
|
1324 | 1324 | |
1325 | 1325 | return null; |
1326 | 1326 | } |
@@ -1337,7 +1337,7 @@ discard block |
||
1337 | 1337 | */ |
1338 | 1338 | $single_entry = apply_filters( 'gravityview/is_single_entry', $single_entry ); |
1339 | 1339 | |
1340 | - if ( empty( $single_entry ) ){ |
|
1340 | + if ( empty( $single_entry ) ) { |
|
1341 | 1341 | return false; |
1342 | 1342 | } else { |
1343 | 1343 | return $single_entry; |
@@ -1358,7 +1358,7 @@ discard block |
||
1358 | 1358 | $views = $this->getGvOutputData()->get_views(); |
1359 | 1359 | |
1360 | 1360 | foreach ( $views as $view_id => $data ) { |
1361 | - $view = \GV\View::by_id( $data['id'] ); |
|
1361 | + $view = \GV\View::by_id( $data[ 'id' ] ); |
|
1362 | 1362 | $view_id = $view->ID; |
1363 | 1363 | $template_id = gravityview_get_template_id( $view->ID ); |
1364 | 1364 | $data = $view->as_data(); |
@@ -1367,7 +1367,7 @@ discard block |
||
1367 | 1367 | * Don't enqueue the scripts or styles if it's not going to be displayed. |
1368 | 1368 | * @since 1.15 |
1369 | 1369 | */ |
1370 | - if( is_user_logged_in() && false === GVCommon::has_cap( 'read_gravityview', $view_id ) ) { |
|
1370 | + if ( is_user_logged_in() && false === GVCommon::has_cap( 'read_gravityview', $view_id ) ) { |
|
1371 | 1371 | continue; |
1372 | 1372 | } |
1373 | 1373 | |
@@ -1396,7 +1396,7 @@ discard block |
||
1396 | 1396 | * @param \GV\View The View. |
1397 | 1397 | */ |
1398 | 1398 | $js_dependency = apply_filters( 'gravityview_lightbox_script', $js_dependency, $view ); |
1399 | - $js_dependencies[] = $js_dependency; |
|
1399 | + $js_dependencies[ ] = $js_dependency; |
|
1400 | 1400 | |
1401 | 1401 | /** |
1402 | 1402 | * @filter `gravity_view_lightbox_style` Modify the lightbox CSS slug. Default: `thickbox` |
@@ -1412,7 +1412,7 @@ discard block |
||
1412 | 1412 | * @param \GV\View The View. |
1413 | 1413 | */ |
1414 | 1414 | $css_dependency = apply_filters( 'gravityview_lightbox_style', $css_dependency, $view ); |
1415 | - $css_dependencies[] = $css_dependency; |
|
1415 | + $css_dependencies[ ] = $css_dependency; |
|
1416 | 1416 | } |
1417 | 1417 | |
1418 | 1418 | /** |
@@ -1420,19 +1420,19 @@ discard block |
||
1420 | 1420 | * @see https://github.com/katzwebservices/GravityView/issues/536 |
1421 | 1421 | * @since 1.15 |
1422 | 1422 | */ |
1423 | - if( gravityview_view_has_single_checkbox_or_radio( $data['form'], $data['fields'] ) ) { |
|
1424 | - $css_dependencies[] = 'dashicons'; |
|
1423 | + if ( gravityview_view_has_single_checkbox_or_radio( $data[ 'form' ], $data[ 'fields' ] ) ) { |
|
1424 | + $css_dependencies[ ] = 'dashicons'; |
|
1425 | 1425 | } |
1426 | 1426 | |
1427 | 1427 | wp_register_script( 'gravityview-jquery-cookie', plugins_url( 'assets/lib/jquery.cookie/jquery.cookie.min.js', GRAVITYVIEW_FILE ), array( 'jquery' ), GravityView_Plugin::version, true ); |
1428 | 1428 | |
1429 | 1429 | $script_debug = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
1430 | 1430 | |
1431 | - 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 ); |
|
1431 | + 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 ); |
|
1432 | 1432 | |
1433 | 1433 | wp_enqueue_script( 'gravityview-fe-view' ); |
1434 | 1434 | |
1435 | - if ( ! empty( $data['atts']['sort_columns'] ) ) { |
|
1435 | + if ( ! empty( $data[ 'atts' ][ 'sort_columns' ] ) ) { |
|
1436 | 1436 | wp_enqueue_style( 'gravityview_font', plugins_url( 'assets/css/font.css', GRAVITYVIEW_FILE ), $css_dependencies, GravityView_Plugin::version, 'all' ); |
1437 | 1437 | } |
1438 | 1438 | |
@@ -1495,7 +1495,7 @@ discard block |
||
1495 | 1495 | public static function add_style( $template_id ) { |
1496 | 1496 | |
1497 | 1497 | if ( ! empty( $template_id ) && wp_style_is( 'gravityview_style_' . $template_id, 'registered' ) ) { |
1498 | - gravityview()->log->debug( 'Adding extra template style for {template_id}', array( 'template_id' => $template_id ) ); |
|
1498 | + gravityview()->log->debug( 'Adding extra template style for {template_id}', array( 'template_id' => $template_id ) ); |
|
1499 | 1499 | wp_enqueue_style( 'gravityview_style_' . $template_id ); |
1500 | 1500 | } elseif ( empty( $template_id ) ) { |
1501 | 1501 | gravityview()->log->error( 'Cannot add template style; template_id is empty' ); |
@@ -1526,11 +1526,11 @@ discard block |
||
1526 | 1526 | * Not a table-based template; don't add sort icons |
1527 | 1527 | * @since 1.12 |
1528 | 1528 | */ |
1529 | - if( ! preg_match( '/table/ism', GravityView_View::getInstance()->getTemplatePartSlug() ) ) { |
|
1529 | + if ( ! preg_match( '/table/ism', GravityView_View::getInstance()->getTemplatePartSlug() ) ) { |
|
1530 | 1530 | return $label; |
1531 | 1531 | } |
1532 | 1532 | |
1533 | - if ( ! $this->is_field_sortable( $field['id'], $form ) ) { |
|
1533 | + if ( ! $this->is_field_sortable( $field[ 'id' ], $form ) ) { |
|
1534 | 1534 | return $label; |
1535 | 1535 | } |
1536 | 1536 | |
@@ -1538,29 +1538,29 @@ discard block |
||
1538 | 1538 | |
1539 | 1539 | $class = 'gv-sort'; |
1540 | 1540 | |
1541 | - $sort_field_id = self::_override_sorting_id_by_field_type( $field['id'], $form['id'] ); |
|
1541 | + $sort_field_id = self::_override_sorting_id_by_field_type( $field[ 'id' ], $form[ 'id' ] ); |
|
1542 | 1542 | |
1543 | 1543 | $sort_args = array( |
1544 | - 'sort' => $field['id'], |
|
1544 | + 'sort' => $field[ 'id' ], |
|
1545 | 1545 | 'dir' => 'asc', |
1546 | 1546 | ); |
1547 | 1547 | |
1548 | - if ( ! empty( $sorting['key'] ) && (string) $sort_field_id === (string) $sorting['key'] ) { |
|
1548 | + if ( ! empty( $sorting[ 'key' ] ) && (string)$sort_field_id === (string)$sorting[ 'key' ] ) { |
|
1549 | 1549 | //toggle sorting direction. |
1550 | - if ( 'asc' === $sorting['direction'] ) { |
|
1551 | - $sort_args['dir'] = 'desc'; |
|
1550 | + if ( 'asc' === $sorting[ 'direction' ] ) { |
|
1551 | + $sort_args[ 'dir' ] = 'desc'; |
|
1552 | 1552 | $class .= ' gv-icon-sort-desc'; |
1553 | 1553 | } else { |
1554 | - $sort_args['dir'] = 'asc'; |
|
1554 | + $sort_args[ 'dir' ] = 'asc'; |
|
1555 | 1555 | $class .= ' gv-icon-sort-asc'; |
1556 | 1556 | } |
1557 | 1557 | } else { |
1558 | 1558 | $class .= ' gv-icon-caret-up-down'; |
1559 | 1559 | } |
1560 | 1560 | |
1561 | - $url = add_query_arg( $sort_args, remove_query_arg( array('pagenum') ) ); |
|
1561 | + $url = add_query_arg( $sort_args, remove_query_arg( array( 'pagenum' ) ) ); |
|
1562 | 1562 | |
1563 | - return '<a href="'. esc_url_raw( $url ) .'" class="'. $class .'" ></a> '. $label; |
|
1563 | + return '<a href="' . esc_url_raw( $url ) . '" class="' . $class . '" ></a> ' . $label; |
|
1564 | 1564 | |
1565 | 1565 | } |
1566 | 1566 | |
@@ -1578,7 +1578,7 @@ discard block |
||
1578 | 1578 | |
1579 | 1579 | $field_type = $field_id; |
1580 | 1580 | |
1581 | - if( is_numeric( $field_id ) ) { |
|
1581 | + if ( is_numeric( $field_id ) ) { |
|
1582 | 1582 | $field = GFFormsModel::get_field( $form, $field_id ); |
1583 | 1583 | $field_type = $field ? $field->type : $field_id; |
1584 | 1584 | } |
@@ -1601,7 +1601,7 @@ discard block |
||
1601 | 1601 | return false; |
1602 | 1602 | } |
1603 | 1603 | |
1604 | - return apply_filters( "gravityview/sortable/formfield_{$form['id']}_{$field_id}", apply_filters( "gravityview/sortable/field_{$field_id}", true, $form ) ); |
|
1604 | + return apply_filters( "gravityview/sortable/formfield_{$form[ 'id' ]}_{$field_id}", apply_filters( "gravityview/sortable/field_{$field_id}", true, $form ) ); |
|
1605 | 1605 | |
1606 | 1606 | } |
1607 | 1607 |