@@ -4,10 +4,10 @@ discard block |
||
| 4 | 4 | |
| 5 | 5 | function __construct() { |
| 6 | 6 | |
| 7 | - if( ! is_admin() ) { return; } |
|
| 7 | + if ( ! is_admin() ) { return; } |
|
| 8 | 8 | |
| 9 | 9 | // If Gravity Forms isn't active or compatibile, stop loading |
| 10 | - if( false === GravityView_Compatibility::is_valid() ) { |
|
| 10 | + if ( false === GravityView_Compatibility::is_valid() ) { |
|
| 11 | 11 | return; |
| 12 | 12 | } |
| 13 | 13 | |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | require_once( GRAVITYVIEW_DIR . 'includes/class-gravityview-migrate.php' ); |
| 26 | 26 | |
| 27 | 27 | // Don't load tooltips if on Gravity Forms, otherwise it overrides translations |
| 28 | - if( class_exists( 'GFCommon' ) && class_exists( 'GFForms' ) && !GFForms::is_gravity_page() ) { |
|
| 28 | + if ( class_exists( 'GFCommon' ) && class_exists( 'GFForms' ) && ! GFForms::is_gravity_page() ) { |
|
| 29 | 29 | require_once( GFCommon::get_base_path() . '/tooltips.php' ); |
| 30 | 30 | } |
| 31 | 31 | |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | add_filter( 'post_updated_messages', array( $this, 'post_updated_messages' ) ); |
| 54 | 54 | add_filter( 'bulk_post_updated_messages', array( $this, 'post_updated_messages' ) ); |
| 55 | 55 | |
| 56 | - add_filter( 'plugin_action_links_'. plugin_basename( GRAVITYVIEW_FILE ) , array( $this, 'plugin_action_links' ) ); |
|
| 56 | + add_filter( 'plugin_action_links_' . plugin_basename( GRAVITYVIEW_FILE ), array( $this, 'plugin_action_links' ) ); |
|
| 57 | 57 | |
| 58 | 58 | add_action( 'plugins_loaded', array( $this, 'backend_actions' ), 100 ); |
| 59 | 59 | |
@@ -68,22 +68,22 @@ discard block |
||
| 68 | 68 | public function backend_actions() { |
| 69 | 69 | |
| 70 | 70 | /** @define "GRAVITYVIEW_DIR" "../" */ |
| 71 | - include_once( GRAVITYVIEW_DIR .'includes/admin/class.field.type.php' ); |
|
| 72 | - include_once( GRAVITYVIEW_DIR .'includes/admin/class.render.settings.php' ); |
|
| 73 | - include_once( GRAVITYVIEW_DIR .'includes/admin/class-gravityview-admin-view-item.php' ); |
|
| 74 | - include_once( GRAVITYVIEW_DIR .'includes/admin/class-gravityview-admin-view-field.php' ); |
|
| 75 | - include_once( GRAVITYVIEW_DIR .'includes/admin/class-gravityview-admin-view-widget.php' ); |
|
| 76 | - include_once( GRAVITYVIEW_DIR .'includes/class-admin-views.php' ); |
|
| 77 | - include_once( GRAVITYVIEW_DIR .'includes/class-admin-welcome.php' ); |
|
| 78 | - include_once( GRAVITYVIEW_DIR .'includes/class-admin-add-shortcode.php' ); |
|
| 79 | - include_once( GRAVITYVIEW_DIR .'includes/class-admin-approve-entries.php' ); |
|
| 71 | + include_once( GRAVITYVIEW_DIR . 'includes/admin/class.field.type.php' ); |
|
| 72 | + include_once( GRAVITYVIEW_DIR . 'includes/admin/class.render.settings.php' ); |
|
| 73 | + include_once( GRAVITYVIEW_DIR . 'includes/admin/class-gravityview-admin-view-item.php' ); |
|
| 74 | + include_once( GRAVITYVIEW_DIR . 'includes/admin/class-gravityview-admin-view-field.php' ); |
|
| 75 | + include_once( GRAVITYVIEW_DIR . 'includes/admin/class-gravityview-admin-view-widget.php' ); |
|
| 76 | + include_once( GRAVITYVIEW_DIR . 'includes/class-admin-views.php' ); |
|
| 77 | + include_once( GRAVITYVIEW_DIR . 'includes/class-admin-welcome.php' ); |
|
| 78 | + include_once( GRAVITYVIEW_DIR . 'includes/class-admin-add-shortcode.php' ); |
|
| 79 | + include_once( GRAVITYVIEW_DIR . 'includes/class-admin-approve-entries.php' ); |
|
| 80 | 80 | |
| 81 | 81 | /** |
| 82 | 82 | * @action `gravityview_include_backend_actions` Triggered after all GravityView admin files are loaded |
| 83 | 83 | * |
| 84 | 84 | * Nice place to insert extensions' backend stuff |
| 85 | 85 | */ |
| 86 | - do_action('gravityview_include_backend_actions'); |
|
| 86 | + do_action( 'gravityview_include_backend_actions' ); |
|
| 87 | 87 | } |
| 88 | 88 | |
| 89 | 89 | /** |
@@ -99,12 +99,12 @@ discard block |
||
| 99 | 99 | |
| 100 | 100 | $actions = array(); |
| 101 | 101 | |
| 102 | - if( GVCommon::has_cap( 'gravityview_view_settings' ) ) { |
|
| 103 | - $actions[] = sprintf( '<a href="%s">%s</a>', admin_url( 'edit.php?post_type=gravityview&page=gravityview_settings' ), esc_html__( 'Settings', 'gravityview' ) ); |
|
| 102 | + if ( GVCommon::has_cap( 'gravityview_view_settings' ) ) { |
|
| 103 | + $actions[ ] = sprintf( '<a href="%s">%s</a>', admin_url( 'edit.php?post_type=gravityview&page=gravityview_settings' ), esc_html__( 'Settings', 'gravityview' ) ); |
|
| 104 | 104 | } |
| 105 | 105 | |
| 106 | - if( GVCommon::has_cap( 'gravityview_support_port' ) ) { |
|
| 107 | - $actions[] = '<a href="http://docs.gravityview.co">' . esc_html__( 'Support', 'gravityview' ) . '</a>'; |
|
| 106 | + if ( GVCommon::has_cap( 'gravityview_support_port' ) ) { |
|
| 107 | + $actions[ ] = '<a href="http://docs.gravityview.co">' . esc_html__( 'Support', 'gravityview' ) . '</a>'; |
|
| 108 | 108 | } |
| 109 | 109 | |
| 110 | 110 | return array_merge( $actions, $links ); |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | // By default, there will only be one item being modified. |
| 133 | 133 | // When in the `bulk_post_updated_messages` filter, there will be passed a number |
| 134 | 134 | // of modified items that will override this array. |
| 135 | - $bulk_counts = is_null( $bulk_counts ) ? array( 'updated' => 1 , 'locked' => 1 , 'deleted' => 1 , 'trashed' => 1, 'untrashed' => 1 ) : $bulk_counts; |
|
| 135 | + $bulk_counts = is_null( $bulk_counts ) ? array( 'updated' => 1, 'locked' => 1, 'deleted' => 1, 'trashed' => 1, 'untrashed' => 1 ) : $bulk_counts; |
|
| 136 | 136 | |
| 137 | 137 | // If we're starting fresh, a new form was created. |
| 138 | 138 | // We should let the user know this is the case. |
@@ -140,60 +140,60 @@ discard block |
||
| 140 | 140 | |
| 141 | 141 | $new_form_text = ''; |
| 142 | 142 | |
| 143 | - if( !empty( $start_fresh ) ) { |
|
| 143 | + if ( ! empty( $start_fresh ) ) { |
|
| 144 | 144 | |
| 145 | 145 | // Get the form that was created |
| 146 | 146 | $connected_form = gravityview_get_form_id( $post_id ); |
| 147 | 147 | |
| 148 | - if( !empty( $connected_form ) ) { |
|
| 148 | + if ( ! empty( $connected_form ) ) { |
|
| 149 | 149 | $form = gravityview_get_form( $connected_form ); |
| 150 | - $form_name = esc_attr( $form['title'] ); |
|
| 150 | + $form_name = esc_attr( $form[ 'title' ] ); |
|
| 151 | 151 | $image = self::get_floaty(); |
| 152 | - $new_form_text .= '<h3>'.$image.sprintf( __( 'A new form was created for this View: "%s"', 'gravityview' ), $form_name ).'</h3>'; |
|
| 153 | - $new_form_text .= sprintf( __( '%sThere are no entries for the new form, so the View will also be empty.%s To start collecting entries, you can add submissions through %sthe preview form%s and also embed the form on a post or page using this code: %s |
|
| 152 | + $new_form_text .= '<h3>' . $image . sprintf( __( 'A new form was created for this View: "%s"', 'gravityview' ), $form_name ) . '</h3>'; |
|
| 153 | + $new_form_text .= sprintf( __( '%sThere are no entries for the new form, so the View will also be empty.%s To start collecting entries, you can add submissions through %sthe preview form%s and also embed the form on a post or page using this code: %s |
|
| 154 | 154 | |
| 155 | 155 | You can %sedit the form%s in Gravity Forms and the updated fields will be available here. Don’t forget to %scustomize the form settings%s. |
| 156 | - ', 'gravityview' ), '<strong>', '</strong>', '<a href="'.site_url( '?gf_page=preview&id='.$connected_form ).'">', '</a>', '<code>[gravityform id="'.$connected_form.'" name="'.$form_name.'"]</code>', '<a href="'.admin_url( 'admin.php?page=gf_edit_forms&id='.$connected_form ).'">', '</a>', '<a href="'.admin_url( 'admin.php?page=gf_edit_forms&view=settings&id='.$connected_form ).'">', '</a>'); |
|
| 156 | + ', 'gravityview' ), '<strong>', '</strong>', '<a href="' . site_url( '?gf_page=preview&id=' . $connected_form ) . '">', '</a>', '<code>[gravityform id="' . $connected_form . '" name="' . $form_name . '"]</code>', '<a href="' . admin_url( 'admin.php?page=gf_edit_forms&id=' . $connected_form ) . '">', '</a>', '<a href="' . admin_url( 'admin.php?page=gf_edit_forms&view=settings&id=' . $connected_form ) . '">', '</a>' ); |
|
| 157 | 157 | $new_form_text = wpautop( $new_form_text ); |
| 158 | 158 | |
| 159 | 159 | delete_post_meta( $post_id, '_gravityview_start_fresh' ); |
| 160 | 160 | } |
| 161 | 161 | } |
| 162 | 162 | |
| 163 | - $messages['gravityview'] = array( |
|
| 163 | + $messages[ 'gravityview' ] = array( |
|
| 164 | 164 | 0 => '', // Unused. Messages start at index 1. |
| 165 | 165 | /* translators: %s and %s are HTML tags linking to the View on the website */ |
| 166 | - 1 => sprintf(__( 'View updated. %sView on website.%s', 'gravityview' ), '<a href="'.get_permalink( $post_id ).'">', '</a>'), |
|
| 166 | + 1 => sprintf( __( 'View updated. %sView on website.%s', 'gravityview' ), '<a href="' . get_permalink( $post_id ) . '">', '</a>' ), |
|
| 167 | 167 | /* translators: %s and %s are HTML tags linking to the View on the website */ |
| 168 | - 2 => sprintf(__( 'View updated. %sView on website.%s', 'gravityview' ), '<a href="'.get_permalink( $post_id ).'">', '</a>'), |
|
| 168 | + 2 => sprintf( __( 'View updated. %sView on website.%s', 'gravityview' ), '<a href="' . get_permalink( $post_id ) . '">', '</a>' ), |
|
| 169 | 169 | 3 => __( 'View deleted.', 'gravityview' ), |
| 170 | 170 | /* translators: %s and %s are HTML tags linking to the View on the website */ |
| 171 | - 4 => sprintf(__( 'View updated. %sView on website.%s', 'gravityview' ), '<a href="'.get_permalink( $post_id ).'">', '</a>'), |
|
| 171 | + 4 => sprintf( __( 'View updated. %sView on website.%s', 'gravityview' ), '<a href="' . get_permalink( $post_id ) . '">', '</a>' ), |
|
| 172 | 172 | /* translators: %s: date and time of the revision */ |
| 173 | - 5 => isset( $_GET['revision'] ) ? sprintf( __( 'View restored to revision from %s', 'gravityview' ), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false, |
|
| 173 | + 5 => isset( $_GET[ 'revision' ] ) ? sprintf( __( 'View restored to revision from %s', 'gravityview' ), wp_post_revision_title( (int)$_GET[ 'revision' ], false ) ) : false, |
|
| 174 | 174 | /* translators: %s and %s are HTML tags linking to the View on the website */ |
| 175 | - 6 => sprintf(__( 'View published. %sView on website.%s', 'gravityview' ), '<a href="'.get_permalink( $post_id ).'">', '</a>') . $new_form_text, |
|
| 175 | + 6 => sprintf( __( 'View published. %sView on website.%s', 'gravityview' ), '<a href="' . get_permalink( $post_id ) . '">', '</a>' ) . $new_form_text, |
|
| 176 | 176 | /* translators: %s and %s are HTML tags linking to the View on the website */ |
| 177 | - 7 => sprintf(__( 'View saved. %sView on website.%s', 'gravityview' ), '<a href="'.get_permalink( $post_id ).'">', '</a>') . $new_form_text, |
|
| 177 | + 7 => sprintf( __( 'View saved. %sView on website.%s', 'gravityview' ), '<a href="' . get_permalink( $post_id ) . '">', '</a>' ) . $new_form_text, |
|
| 178 | 178 | 8 => __( 'View submitted.', 'gravityview' ), |
| 179 | 179 | 9 => sprintf( |
| 180 | 180 | /* translators: Date and time the View is scheduled to be published */ |
| 181 | 181 | __( 'View scheduled for: %1$s.', 'gravityview' ), |
| 182 | 182 | // translators: Publish box date format, see http://php.net/date |
| 183 | - date_i18n( __( 'M j, Y @ G:i', 'gravityview' ), strtotime( ( isset( $post->post_date ) ? $post->post_date : NULL ) ) ) |
|
| 183 | + date_i18n( __( 'M j, Y @ G:i', 'gravityview' ), strtotime( ( isset( $post->post_date ) ? $post->post_date : NULL ) ) ) |
|
| 184 | 184 | ) . $new_form_text, |
| 185 | 185 | /* translators: %s and %s are HTML tags linking to the View on the website */ |
| 186 | - 10 => sprintf(__( 'View draft updated. %sView on website.%s', 'gravityview' ), '<a href="'.get_permalink( $post_id ).'">', '</a>') . $new_form_text, |
|
| 186 | + 10 => sprintf( __( 'View draft updated. %sView on website.%s', 'gravityview' ), '<a href="' . get_permalink( $post_id ) . '">', '</a>' ) . $new_form_text, |
|
| 187 | 187 | |
| 188 | 188 | /** |
| 189 | 189 | * These apply to `bulk_post_updated_messages` |
| 190 | 190 | * @file wp-admin/edit.php |
| 191 | 191 | */ |
| 192 | - 'updated' => _n( '%s View updated.', '%s Views updated.', $bulk_counts['updated'], 'gravityview' ), |
|
| 193 | - 'locked' => _n( '%s View not updated, somebody is editing it.', '%s Views not updated, somebody is editing them.', $bulk_counts['locked'], 'gravityview' ), |
|
| 194 | - 'deleted' => _n( '%s View permanently deleted.', '%s Views permanently deleted.', $bulk_counts['deleted'], 'gravityview' ), |
|
| 195 | - 'trashed' => _n( '%s View moved to the Trash.', '%s Views moved to the Trash.', $bulk_counts['trashed'], 'gravityview' ), |
|
| 196 | - 'untrashed' => _n( '%s View restored from the Trash.', '%s Views restored from the Trash.', $bulk_counts['untrashed'], 'gravityview' ), |
|
| 192 | + 'updated' => _n( '%s View updated.', '%s Views updated.', $bulk_counts[ 'updated' ], 'gravityview' ), |
|
| 193 | + 'locked' => _n( '%s View not updated, somebody is editing it.', '%s Views not updated, somebody is editing them.', $bulk_counts[ 'locked' ], 'gravityview' ), |
|
| 194 | + 'deleted' => _n( '%s View permanently deleted.', '%s Views permanently deleted.', $bulk_counts[ 'deleted' ], 'gravityview' ), |
|
| 195 | + 'trashed' => _n( '%s View moved to the Trash.', '%s Views moved to the Trash.', $bulk_counts[ 'trashed' ], 'gravityview' ), |
|
| 196 | + 'untrashed' => _n( '%s View restored from the Trash.', '%s Views restored from the Trash.', $bulk_counts[ 'untrashed' ], 'gravityview' ), |
|
| 197 | 197 | ); |
| 198 | 198 | |
| 199 | 199 | return $messages; |
@@ -253,29 +253,29 @@ discard block |
||
| 253 | 253 | static function is_admin_page( $hook = '', $page = NULL ) { |
| 254 | 254 | global $current_screen, $plugin_page, $pagenow, $post; |
| 255 | 255 | |
| 256 | - if( ! is_admin() ) { return false; } |
|
| 256 | + if ( ! is_admin() ) { return false; } |
|
| 257 | 257 | |
| 258 | 258 | $is_page = false; |
| 259 | 259 | |
| 260 | - $is_gv_screen = (!empty($current_screen) && isset($current_screen->post_type) && $current_screen->post_type === 'gravityview'); |
|
| 260 | + $is_gv_screen = ( ! empty( $current_screen ) && isset( $current_screen->post_type ) && $current_screen->post_type === 'gravityview' ); |
|
| 261 | 261 | |
| 262 | - $is_gv_post_type_get = (isset($_GET['post_type']) && $_GET['post_type'] === 'gravityview'); |
|
| 262 | + $is_gv_post_type_get = ( isset( $_GET[ 'post_type' ] ) && $_GET[ 'post_type' ] === 'gravityview' ); |
|
| 263 | 263 | |
| 264 | - $is_gv_settings_get = isset( $_GET['page'] ) && $_GET['page'] === 'gravityview_settings'; |
|
| 264 | + $is_gv_settings_get = isset( $_GET[ 'page' ] ) && $_GET[ 'page' ] === 'gravityview_settings'; |
|
| 265 | 265 | |
| 266 | - if( empty( $post ) && $pagenow === 'post.php' && !empty( $_GET['post'] ) ) { |
|
| 267 | - $gv_post = get_post( intval( $_GET['post'] ) ); |
|
| 268 | - $is_gv_post_type = (!empty($gv_post) && !empty($gv_post->post_type) && $gv_post->post_type === 'gravityview'); |
|
| 266 | + if ( empty( $post ) && $pagenow === 'post.php' && ! empty( $_GET[ 'post' ] ) ) { |
|
| 267 | + $gv_post = get_post( intval( $_GET[ 'post' ] ) ); |
|
| 268 | + $is_gv_post_type = ( ! empty( $gv_post ) && ! empty( $gv_post->post_type ) && $gv_post->post_type === 'gravityview' ); |
|
| 269 | 269 | } else { |
| 270 | - $is_gv_post_type = (!empty($post) && !empty($post->post_type) && $post->post_type === 'gravityview'); |
|
| 270 | + $is_gv_post_type = ( ! empty( $post ) && ! empty( $post->post_type ) && $post->post_type === 'gravityview' ); |
|
| 271 | 271 | } |
| 272 | 272 | |
| 273 | - if( $is_gv_screen || $is_gv_post_type || $is_gv_post_type || $is_gv_post_type_get || $is_gv_settings_get ) { |
|
| 273 | + if ( $is_gv_screen || $is_gv_post_type || $is_gv_post_type || $is_gv_post_type_get || $is_gv_settings_get ) { |
|
| 274 | 274 | |
| 275 | 275 | // $_GET `post_type` variable |
| 276 | - if(in_array($pagenow, array( 'post.php' , 'post-new.php' )) ) { |
|
| 276 | + if ( in_array( $pagenow, array( 'post.php', 'post-new.php' ) ) ) { |
|
| 277 | 277 | $is_page = 'single'; |
| 278 | - } else if ( in_array( $plugin_page, array( 'gravityview_settings', 'gravityview_page_gravityview_settings' ) ) || ( !empty( $_GET['page'] ) && $_GET['page'] === 'gravityview_settings' ) ) { |
|
| 278 | + } else if ( in_array( $plugin_page, array( 'gravityview_settings', 'gravityview_page_gravityview_settings' ) ) || ( ! empty( $_GET[ 'page' ] ) && $_GET[ 'page' ] === 'gravityview_settings' ) ) { |
|
| 279 | 279 | $is_page = 'settings'; |
| 280 | 280 | } else { |
| 281 | 281 | $is_page = 'views'; |
@@ -290,7 +290,7 @@ discard block |
||
| 290 | 290 | $is_page = apply_filters( 'gravityview_is_admin_page', $is_page, $hook ); |
| 291 | 291 | |
| 292 | 292 | // If the current page is the same as the compared page |
| 293 | - if( !empty( $page ) ) { |
|
| 293 | + if ( ! empty( $page ) ) { |
|
| 294 | 294 | return $is_page === $page; |
| 295 | 295 | } |
| 296 | 296 | |
@@ -311,6 +311,6 @@ discard block |
||
| 311 | 311 | * |
| 312 | 312 | * @return bool|string|void If `false`, not a GravityView page. `true` if $page is passed and is the same as current page. Otherwise, the name of the page (`single`, `settings`, or `views`) |
| 313 | 313 | */ |
| 314 | -function gravityview_is_admin_page($hook = '', $page = NULL) { |
|
| 314 | +function gravityview_is_admin_page( $hook = '', $page = NULL ) { |
|
| 315 | 315 | return GravityView_Admin::is_admin_page( $hook, $page ); |
| 316 | 316 | } |
@@ -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,15 +234,15 @@ discard block |
||
| 234 | 234 | |
| 235 | 235 | $this->context_view_id = $view_id; |
| 236 | 236 | |
| 237 | - } elseif ( isset( $_GET['gvid'] ) && $this->getGvOutputData()->has_multiple_views() ) { |
|
| 237 | + } elseif ( isset( $_GET[ 'gvid' ] ) && $this->getGvOutputData()->has_multiple_views() ) { |
|
| 238 | 238 | /** |
| 239 | 239 | * used on a has_multiple_views context |
| 240 | 240 | * @see GravityView_API::entry_link |
| 241 | 241 | * @see GravityView_View_Data::getInstance()->has_multiple_views() |
| 242 | 242 | */ |
| 243 | - $this->context_view_id = $_GET['gvid']; |
|
| 243 | + $this->context_view_id = $_GET[ 'gvid' ]; |
|
| 244 | 244 | |
| 245 | - } elseif ( ! $this->getGvOutputData()->has_multiple_views() ) { |
|
| 245 | + } elseif ( ! $this->getGvOutputData()->has_multiple_views() ) { |
|
| 246 | 246 | $array_keys = array_keys( $this->getGvOutputData()->get_views() ); |
| 247 | 247 | $this->context_view_id = array_pop( $array_keys ); |
| 248 | 248 | unset( $array_keys ); |
@@ -277,24 +277,24 @@ discard block |
||
| 277 | 277 | global $wp_rewrite; |
| 278 | 278 | |
| 279 | 279 | $is_front_page = ( $query->is_home || $query->is_page ); |
| 280 | - $show_on_front = ( 'page' === get_option('show_on_front') ); |
|
| 281 | - $front_page_id = get_option('page_on_front'); |
|
| 280 | + $show_on_front = ( 'page' === get_option( 'show_on_front' ) ); |
|
| 281 | + $front_page_id = get_option( 'page_on_front' ); |
|
| 282 | 282 | |
| 283 | - if ( $is_front_page && $show_on_front && $front_page_id ) { |
|
| 283 | + if ( $is_front_page && $show_on_front && $front_page_id ) { |
|
| 284 | 284 | |
| 285 | 285 | // Force to be an array, potentially a query string ( entry=16 ) |
| 286 | 286 | $_query = wp_parse_args( $query->query ); |
| 287 | 287 | |
| 288 | 288 | // pagename can be set and empty depending on matched rewrite rules. Ignore an empty pagename. |
| 289 | - if ( isset( $_query['pagename'] ) && '' === $_query['pagename'] ) { |
|
| 290 | - unset( $_query['pagename'] ); |
|
| 289 | + if ( isset( $_query[ 'pagename' ] ) && '' === $_query[ 'pagename' ] ) { |
|
| 290 | + unset( $_query[ 'pagename' ] ); |
|
| 291 | 291 | } |
| 292 | 292 | |
| 293 | 293 | // this is where will break from core wordpress |
| 294 | 294 | $ignore = array( 'preview', 'page', 'paged', 'cpage' ); |
| 295 | 295 | $endpoints = rgobj( $wp_rewrite, 'endpoints' ); |
| 296 | - foreach ( (array) $endpoints as $endpoint ) { |
|
| 297 | - $ignore[] = $endpoint[1]; |
|
| 296 | + foreach ( (array)$endpoints as $endpoint ) { |
|
| 297 | + $ignore[ ] = $endpoint[ 1 ]; |
|
| 298 | 298 | } |
| 299 | 299 | unset( $endpoints ); |
| 300 | 300 | |
@@ -304,21 +304,21 @@ discard block |
||
| 304 | 304 | // - The query includes keys that are associated with registered endpoints. `entry`, for example. |
| 305 | 305 | if ( empty( $_query ) || ! array_diff( array_keys( $_query ), $ignore ) ) { |
| 306 | 306 | |
| 307 | - $qv =& $query->query_vars; |
|
| 307 | + $qv = & $query->query_vars; |
|
| 308 | 308 | |
| 309 | 309 | // Prevent redirect when on the single entry endpoint |
| 310 | - if( self::is_single_entry() ) { |
|
| 310 | + if ( self::is_single_entry() ) { |
|
| 311 | 311 | add_filter( 'redirect_canonical', '__return_false' ); |
| 312 | 312 | } |
| 313 | 313 | |
| 314 | 314 | $query->is_page = true; |
| 315 | 315 | $query->is_home = false; |
| 316 | - $qv['page_id'] = $front_page_id; |
|
| 316 | + $qv[ 'page_id' ] = $front_page_id; |
|
| 317 | 317 | |
| 318 | 318 | // Correct <!--nextpage--> for page_on_front |
| 319 | - if ( ! empty( $qv['paged'] ) ) { |
|
| 320 | - $qv['page'] = $qv['paged']; |
|
| 321 | - unset( $qv['paged'] ); |
|
| 319 | + if ( ! empty( $qv[ 'paged' ] ) ) { |
|
| 320 | + $qv[ 'page' ] = $qv[ 'paged' ]; |
|
| 321 | + unset( $qv[ 'paged' ] ); |
|
| 322 | 322 | } |
| 323 | 323 | } |
| 324 | 324 | |
@@ -336,7 +336,7 @@ discard block |
||
| 336 | 336 | global $post; |
| 337 | 337 | |
| 338 | 338 | // If in admin and NOT AJAX request, get outta here. |
| 339 | - if ( GravityView_Plugin::is_admin() ) { |
|
| 339 | + if ( GravityView_Plugin::is_admin() ) { |
|
| 340 | 340 | return; |
| 341 | 341 | } |
| 342 | 342 | |
@@ -348,7 +348,7 @@ discard block |
||
| 348 | 348 | |
| 349 | 349 | $this->setIsGravityviewPostType( get_post_type( $post ) === 'gravityview' ); |
| 350 | 350 | |
| 351 | - $post_id = $this->getPostId() ? $this->getPostId() : (isset( $post ) ? $post->ID : null ); |
|
| 351 | + $post_id = $this->getPostId() ? $this->getPostId() : ( isset( $post ) ? $post->ID : null ); |
|
| 352 | 352 | $this->setPostId( $post_id ); |
| 353 | 353 | $post_has_shortcode = ! empty( $post->post_content ) ? gravityview_has_shortcode_r( $post->post_content, 'gravityview' ) : false; |
| 354 | 354 | $this->setPostHasShortcode( $this->isGravityviewPostType() ? null : ! empty( $post_has_shortcode ) ); |
@@ -384,7 +384,7 @@ discard block |
||
| 384 | 384 | |
| 385 | 385 | $search_method = GravityView_Widget_Search::getInstance()->get_search_method(); |
| 386 | 386 | |
| 387 | - if( 'post' === $search_method ) { |
|
| 387 | + if ( 'post' === $search_method ) { |
|
| 388 | 388 | $get = $_POST; |
| 389 | 389 | } else { |
| 390 | 390 | $get = $_GET; |
@@ -440,20 +440,20 @@ discard block |
||
| 440 | 440 | * @param boolean $in_the_loop Whether to apply the filter to the menu title and the meta tag <title> - outside the loop |
| 441 | 441 | * @param array $entry Current entry |
| 442 | 442 | */ |
| 443 | - $apply_outside_loop = apply_filters( 'gravityview/single/title/out_loop' , in_the_loop(), $entry ); |
|
| 443 | + $apply_outside_loop = apply_filters( 'gravityview/single/title/out_loop', in_the_loop(), $entry ); |
|
| 444 | 444 | |
| 445 | 445 | if ( ! $apply_outside_loop ) { |
| 446 | 446 | return $title; |
| 447 | 447 | } |
| 448 | 448 | |
| 449 | 449 | // User reported WooCommerce doesn't pass two args. |
| 450 | - if ( empty( $passed_post_id ) ) { |
|
| 450 | + if ( empty( $passed_post_id ) ) { |
|
| 451 | 451 | return $title; |
| 452 | 452 | } |
| 453 | 453 | |
| 454 | 454 | // Don't modify the title for anything other than the current view/post. |
| 455 | 455 | // This is true for embedded shortcodes and Views. |
| 456 | - if ( is_object( $post ) && (int) $post->ID !== (int) $passed_post_id ) { |
|
| 456 | + if ( is_object( $post ) && (int)$post->ID !== (int)$passed_post_id ) { |
|
| 457 | 457 | return $title; |
| 458 | 458 | } |
| 459 | 459 | |
@@ -463,19 +463,19 @@ discard block |
||
| 463 | 463 | $view_meta = $this->getGvOutputData()->get_view( $context_view_id ); |
| 464 | 464 | } else { |
| 465 | 465 | foreach ( $this->getGvOutputData()->get_views() as $view_id => $view_data ) { |
| 466 | - if ( intval( $view_data['form_id'] ) === intval( $entry['form_id'] ) ) { |
|
| 466 | + if ( intval( $view_data[ 'form_id' ] ) === intval( $entry[ 'form_id' ] ) ) { |
|
| 467 | 467 | $view_meta = $view_data; |
| 468 | 468 | break; |
| 469 | 469 | } |
| 470 | 470 | } |
| 471 | 471 | } |
| 472 | 472 | |
| 473 | - if ( ! empty( $view_meta['atts']['single_title'] ) ) { |
|
| 473 | + if ( ! empty( $view_meta[ 'atts' ][ 'single_title' ] ) ) { |
|
| 474 | 474 | |
| 475 | - $title = $view_meta['atts']['single_title']; |
|
| 475 | + $title = $view_meta[ 'atts' ][ 'single_title' ]; |
|
| 476 | 476 | |
| 477 | 477 | // We are allowing HTML in the fields, so no escaping the output |
| 478 | - $title = GravityView_API::replace_variables( $title, $view_meta['form'], $entry ); |
|
| 478 | + $title = GravityView_API::replace_variables( $title, $view_meta[ 'form' ], $entry ); |
|
| 479 | 479 | |
| 480 | 480 | $title = do_shortcode( $title ); |
| 481 | 481 | } |
@@ -576,7 +576,7 @@ discard block |
||
| 576 | 576 | public function render_view( $passed_args ) { |
| 577 | 577 | |
| 578 | 578 | // validate attributes |
| 579 | - if ( empty( $passed_args['id'] ) ) { |
|
| 579 | + if ( empty( $passed_args[ 'id' ] ) ) { |
|
| 580 | 580 | do_action( 'gravityview_log_error', '[render_view] Returning; no ID defined.', $passed_args ); |
| 581 | 581 | return null; |
| 582 | 582 | } |
@@ -598,7 +598,7 @@ discard block |
||
| 598 | 598 | return null; |
| 599 | 599 | } |
| 600 | 600 | |
| 601 | - $view_id = $passed_args['id']; |
|
| 601 | + $view_id = $passed_args[ 'id' ]; |
|
| 602 | 602 | |
| 603 | 603 | $view_data = $this->getGvOutputData()->get_view( $view_id, $passed_args ); |
| 604 | 604 | |
@@ -611,7 +611,7 @@ discard block |
||
| 611 | 611 | $passed_args = array_filter( $passed_args, 'strlen' ); |
| 612 | 612 | |
| 613 | 613 | //Override shortcode args over View template settings |
| 614 | - $atts = wp_parse_args( $passed_args, $view_data['atts'] ); |
|
| 614 | + $atts = wp_parse_args( $passed_args, $view_data[ 'atts' ] ); |
|
| 615 | 615 | |
| 616 | 616 | do_action( 'gravityview_log_debug', '[render_view] Arguments after merging with View settings: ', $atts ); |
| 617 | 617 | |
@@ -634,14 +634,14 @@ discard block |
||
| 634 | 634 | * @since 1.15 |
| 635 | 635 | * @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. |
| 636 | 636 | */ |
| 637 | - 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 ) ) { |
|
| 637 | + 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 ) ) { |
|
| 638 | 638 | |
| 639 | 639 | do_action( 'gravityview_log_debug', sprintf( '%s Returning: View %d is not visible by current user.', __METHOD__, $view_id ) ); |
| 640 | 640 | |
| 641 | 641 | return null; |
| 642 | 642 | } |
| 643 | 643 | |
| 644 | - if( $this->isGravityviewPostType() ) { |
|
| 644 | + if ( $this->isGravityviewPostType() ) { |
|
| 645 | 645 | |
| 646 | 646 | /** |
| 647 | 647 | * @filter `gravityview_direct_access` Should Views be directly accessible, or only visible using the shortcode? |
@@ -653,9 +653,9 @@ discard block |
||
| 653 | 653 | */ |
| 654 | 654 | $direct_access = apply_filters( 'gravityview_direct_access', true, $view_id ); |
| 655 | 655 | |
| 656 | - $embed_only = ! empty( $atts['embed_only'] ); |
|
| 656 | + $embed_only = ! empty( $atts[ 'embed_only' ] ); |
|
| 657 | 657 | |
| 658 | - if( ! $direct_access || ( $embed_only && ! GVCommon::has_cap( 'read_private_gravityviews' ) ) ) { |
|
| 658 | + if ( ! $direct_access || ( $embed_only && ! GVCommon::has_cap( 'read_private_gravityviews' ) ) ) { |
|
| 659 | 659 | return __( 'You are not allowed to view this content.', 'gravityview' ); |
| 660 | 660 | } |
| 661 | 661 | } |
@@ -670,7 +670,7 @@ discard block |
||
| 670 | 670 | |
| 671 | 671 | $gravityview_view = new GravityView_View( $view_data ); |
| 672 | 672 | |
| 673 | - $post_id = ! empty( $atts['post_id'] ) ? intval( $atts['post_id'] ) : $this->getPostId(); |
|
| 673 | + $post_id = ! empty( $atts[ 'post_id' ] ) ? intval( $atts[ 'post_id' ] ) : $this->getPostId(); |
|
| 674 | 674 | |
| 675 | 675 | $gravityview_view->setPostId( $post_id ); |
| 676 | 676 | |
@@ -680,20 +680,20 @@ discard block |
||
| 680 | 680 | do_action( 'gravityview_log_debug', '[render_view] Executing Directory View' ); |
| 681 | 681 | |
| 682 | 682 | //fetch template and slug |
| 683 | - $view_slug = apply_filters( 'gravityview_template_slug_'. $view_data['template_id'], 'table', 'directory' ); |
|
| 683 | + $view_slug = apply_filters( 'gravityview_template_slug_' . $view_data[ 'template_id' ], 'table', 'directory' ); |
|
| 684 | 684 | |
| 685 | 685 | do_action( 'gravityview_log_debug', '[render_view] View template slug: ', $view_slug ); |
| 686 | 686 | |
| 687 | 687 | /** |
| 688 | 688 | * Disable fetching initial entries for views that don't need it (DataTables) |
| 689 | 689 | */ |
| 690 | - $get_entries = apply_filters( 'gravityview_get_view_entries_'.$view_slug, true ); |
|
| 690 | + $get_entries = apply_filters( 'gravityview_get_view_entries_' . $view_slug, true ); |
|
| 691 | 691 | |
| 692 | 692 | /** |
| 693 | 693 | * Hide View data until search is performed |
| 694 | 694 | * @since 1.5.4 |
| 695 | 695 | */ |
| 696 | - if ( ! empty( $atts['hide_until_searched'] ) && ! $this->isSearch() ) { |
|
| 696 | + if ( ! empty( $atts[ 'hide_until_searched' ] ) && ! $this->isSearch() ) { |
|
| 697 | 697 | $gravityview_view->setHideUntilSearched( true ); |
| 698 | 698 | $get_entries = false; |
| 699 | 699 | } |
@@ -701,23 +701,23 @@ discard block |
||
| 701 | 701 | |
| 702 | 702 | if ( $get_entries ) { |
| 703 | 703 | |
| 704 | - if ( ! empty( $atts['sort_columns'] ) ) { |
|
| 704 | + if ( ! empty( $atts[ 'sort_columns' ] ) ) { |
|
| 705 | 705 | // add filter to enable column sorting |
| 706 | - add_filter( 'gravityview/template/field_label', array( $this, 'add_columns_sort_links' ) , 100, 3 ); |
|
| 706 | + add_filter( 'gravityview/template/field_label', array( $this, 'add_columns_sort_links' ), 100, 3 ); |
|
| 707 | 707 | } |
| 708 | 708 | |
| 709 | - $view_entries = self::get_view_entries( $atts, $view_data['form_id'] ); |
|
| 709 | + $view_entries = self::get_view_entries( $atts, $view_data[ 'form_id' ] ); |
|
| 710 | 710 | |
| 711 | - do_action( 'gravityview_log_debug', sprintf( '[render_view] Get Entries. Found %s entries total, showing %d entries', $view_entries['count'], sizeof( $view_entries['entries'] ) ) ); |
|
| 711 | + do_action( 'gravityview_log_debug', sprintf( '[render_view] Get Entries. Found %s entries total, showing %d entries', $view_entries[ 'count' ], sizeof( $view_entries[ 'entries' ] ) ) ); |
|
| 712 | 712 | |
| 713 | 713 | } else { |
| 714 | 714 | |
| 715 | 715 | $view_entries = array( 'count' => null, 'entries' => null, 'paging' => null ); |
| 716 | 716 | |
| 717 | - do_action( 'gravityview_log_debug', '[render_view] Not fetching entries because `gravityview_get_view_entries_'.$view_slug.'` is false' ); |
|
| 717 | + do_action( 'gravityview_log_debug', '[render_view] Not fetching entries because `gravityview_get_view_entries_' . $view_slug . '` is false' ); |
|
| 718 | 718 | } |
| 719 | 719 | |
| 720 | - $gravityview_view->setPaging( $view_entries['paging'] ); |
|
| 720 | + $gravityview_view->setPaging( $view_entries[ 'paging' ] ); |
|
| 721 | 721 | $gravityview_view->setContext( 'directory' ); |
| 722 | 722 | $sections = array( 'header', 'body', 'footer' ); |
| 723 | 723 | |
@@ -731,7 +731,7 @@ discard block |
||
| 731 | 731 | * @action `gravityview_render_entry_{View ID}` Before rendering a single entry for a specific View ID |
| 732 | 732 | * @since 1.17 |
| 733 | 733 | */ |
| 734 | - do_action( 'gravityview_render_entry_'.$view_data['id'] ); |
|
| 734 | + do_action( 'gravityview_render_entry_' . $view_data[ 'id' ] ); |
|
| 735 | 735 | |
| 736 | 736 | $entry = $this->getEntry(); |
| 737 | 737 | |
@@ -758,20 +758,20 @@ discard block |
||
| 758 | 758 | // We're in single view, but the view being processed is not the same view the single entry belongs to. |
| 759 | 759 | // important: do not remove this as it prevents fake attempts of displaying entries from other views/forms |
| 760 | 760 | if ( $this->getGvOutputData()->has_multiple_views() && $view_id != $this->get_context_view_id() ) { |
| 761 | - 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 ); |
|
| 761 | + 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 ); |
|
| 762 | 762 | return null; |
| 763 | 763 | } |
| 764 | 764 | |
| 765 | 765 | //fetch template and slug |
| 766 | - $view_slug = apply_filters( 'gravityview_template_slug_' . $view_data['template_id'], 'table', 'single' ); |
|
| 766 | + $view_slug = apply_filters( 'gravityview_template_slug_' . $view_data[ 'template_id' ], 'table', 'single' ); |
|
| 767 | 767 | do_action( 'gravityview_log_debug', '[render_view] View single template slug: ', $view_slug ); |
| 768 | 768 | |
| 769 | 769 | //fetch entry detail |
| 770 | - $view_entries['count'] = 1; |
|
| 771 | - $view_entries['entries'][] = $entry; |
|
| 772 | - do_action( 'gravityview_log_debug', '[render_view] Get single entry: ', $view_entries['entries'] ); |
|
| 770 | + $view_entries[ 'count' ] = 1; |
|
| 771 | + $view_entries[ 'entries' ][ ] = $entry; |
|
| 772 | + do_action( 'gravityview_log_debug', '[render_view] Get single entry: ', $view_entries[ 'entries' ] ); |
|
| 773 | 773 | |
| 774 | - $back_link_label = isset( $atts['back_link_label'] ) ? $atts['back_link_label'] : null; |
|
| 774 | + $back_link_label = isset( $atts[ 'back_link_label' ] ) ? $atts[ 'back_link_label' ] : null; |
|
| 775 | 775 | |
| 776 | 776 | // set back link label |
| 777 | 777 | $gravityview_view->setBackLinkLabel( $back_link_label ); |
@@ -781,11 +781,11 @@ discard block |
||
| 781 | 781 | } |
| 782 | 782 | |
| 783 | 783 | // add template style |
| 784 | - self::add_style( $view_data['template_id'] ); |
|
| 784 | + self::add_style( $view_data[ 'template_id' ] ); |
|
| 785 | 785 | |
| 786 | 786 | // Prepare to render view and set vars |
| 787 | - $gravityview_view->setEntries( $view_entries['entries'] ); |
|
| 788 | - $gravityview_view->setTotalEntries( $view_entries['count'] ); |
|
| 787 | + $gravityview_view->setEntries( $view_entries[ 'entries' ] ); |
|
| 788 | + $gravityview_view->setTotalEntries( $view_entries[ 'count' ] ); |
|
| 789 | 789 | |
| 790 | 790 | // If Edit |
| 791 | 791 | if ( 'edit' === gravityview_get_context() ) { |
@@ -798,11 +798,11 @@ discard block |
||
| 798 | 798 | |
| 799 | 799 | } else { |
| 800 | 800 | // finaly we'll render some html |
| 801 | - $sections = apply_filters( 'gravityview_render_view_sections', $sections, $view_data['template_id'] ); |
|
| 801 | + $sections = apply_filters( 'gravityview_render_view_sections', $sections, $view_data[ 'template_id' ] ); |
|
| 802 | 802 | |
| 803 | 803 | do_action( 'gravityview_log_debug', '[render_view] Sections to render: ', $sections ); |
| 804 | 804 | foreach ( $sections as $section ) { |
| 805 | - do_action( 'gravityview_log_debug', '[render_view] Rendering '. $section . ' section.' ); |
|
| 805 | + do_action( 'gravityview_log_debug', '[render_view] Rendering ' . $section . ' section.' ); |
|
| 806 | 806 | $gravityview_view->render( $view_slug, $section, false ); |
| 807 | 807 | } |
| 808 | 808 | } |
@@ -856,7 +856,7 @@ discard block |
||
| 856 | 856 | $datetime_format = 'Y-m-d H:i:s'; |
| 857 | 857 | $search_is_outside_view_bounds = false; |
| 858 | 858 | |
| 859 | - if( ! empty( $search_criteria[ $key ] ) ) { |
|
| 859 | + if ( ! empty( $search_criteria[ $key ] ) ) { |
|
| 860 | 860 | |
| 861 | 861 | $search_date = strtotime( $search_criteria[ $key ] ); |
| 862 | 862 | |
@@ -884,14 +884,14 @@ discard block |
||
| 884 | 884 | if ( empty( $search_criteria[ $key ] ) || $search_is_outside_view_bounds ) { |
| 885 | 885 | |
| 886 | 886 | // Then we override the search and re-set the start date |
| 887 | - $return_search_criteria[ $key ] = date_i18n( $datetime_format , $date, true ); |
|
| 887 | + $return_search_criteria[ $key ] = date_i18n( $datetime_format, $date, true ); |
|
| 888 | 888 | } |
| 889 | 889 | } |
| 890 | 890 | } |
| 891 | 891 | |
| 892 | - if( isset( $return_search_criteria['start_date'] ) && isset( $return_search_criteria['end_date'] ) ) { |
|
| 892 | + if ( isset( $return_search_criteria[ 'start_date' ] ) && isset( $return_search_criteria[ 'end_date' ] ) ) { |
|
| 893 | 893 | // The start date is AFTER the end date. This will result in no results, but let's not force the issue. |
| 894 | - if ( strtotime( $return_search_criteria['start_date'] ) > strtotime( $return_search_criteria['end_date'] ) ) { |
|
| 894 | + if ( strtotime( $return_search_criteria[ 'start_date' ] ) > strtotime( $return_search_criteria[ 'end_date' ] ) ) { |
|
| 895 | 895 | do_action( 'gravityview_log_error', __METHOD__ . ' Invalid search: the start date is after the end date.', $return_search_criteria ); |
| 896 | 896 | } |
| 897 | 897 | } |
@@ -909,9 +909,9 @@ discard block |
||
| 909 | 909 | */ |
| 910 | 910 | public static function process_search_only_approved( $args, $search_criteria ) { |
| 911 | 911 | |
| 912 | - if ( ! empty( $args['show_only_approved'] ) ) { |
|
| 913 | - $search_criteria['field_filters'][] = array( 'key' => 'is_approved', 'value' => 'Approved' ); |
|
| 914 | - $search_criteria['field_filters']['mode'] = 'all'; // force all the criterias to be met |
|
| 912 | + if ( ! empty( $args[ 'show_only_approved' ] ) ) { |
|
| 913 | + $search_criteria[ 'field_filters' ][ ] = array( 'key' => 'is_approved', 'value' => 'Approved' ); |
|
| 914 | + $search_criteria[ 'field_filters' ][ 'mode' ] = 'all'; // force all the criterias to be met |
|
| 915 | 915 | |
| 916 | 916 | do_action( 'gravityview_log_debug', '[process_search_only_approved] Search Criteria if show only approved: ', $search_criteria ); |
| 917 | 917 | } |
@@ -935,12 +935,12 @@ discard block |
||
| 935 | 935 | */ |
| 936 | 936 | public static function is_entry_approved( $entry, $args = array() ) { |
| 937 | 937 | |
| 938 | - if ( empty( $entry['id'] ) || ( array_key_exists( 'show_only_approved', $args ) && ! $args['show_only_approved'] ) ) { |
|
| 938 | + if ( empty( $entry[ 'id' ] ) || ( array_key_exists( 'show_only_approved', $args ) && ! $args[ 'show_only_approved' ] ) ) { |
|
| 939 | 939 | // is implicitly approved if entry is null or View settings doesn't require to check for approval |
| 940 | 940 | return true; |
| 941 | 941 | } |
| 942 | 942 | |
| 943 | - $is_approved = gform_get_meta( $entry['id'], 'is_approved' ); |
|
| 943 | + $is_approved = gform_get_meta( $entry[ 'id' ], 'is_approved' ); |
|
| 944 | 944 | |
| 945 | 945 | if ( $is_approved ) { |
| 946 | 946 | return true; |
@@ -978,26 +978,26 @@ discard block |
||
| 978 | 978 | do_action( 'gravityview_log_debug', '[get_search_criteria] Search Criteria after hook gravityview_fe_search_criteria: ', $search_criteria ); |
| 979 | 979 | |
| 980 | 980 | // implicity search |
| 981 | - if ( ! empty( $args['search_value'] ) ) { |
|
| 981 | + if ( ! empty( $args[ 'search_value' ] ) ) { |
|
| 982 | 982 | |
| 983 | 983 | // Search operator options. Options: `is` or `contains` |
| 984 | - $operator = ! empty( $args['search_operator'] ) && in_array( $args['search_operator'], array( 'is', 'isnot', '>', '<', 'contains' ) ) ? $args['search_operator'] : 'contains'; |
|
| 984 | + $operator = ! empty( $args[ 'search_operator' ] ) && in_array( $args[ 'search_operator' ], array( 'is', 'isnot', '>', '<', 'contains' ) ) ? $args[ 'search_operator' ] : 'contains'; |
|
| 985 | 985 | |
| 986 | - $search_criteria['field_filters'][] = array( |
|
| 986 | + $search_criteria[ 'field_filters' ][ ] = array( |
|
| 987 | 987 | 'key' => rgget( 'search_field', $args ), // The field ID to search |
| 988 | - 'value' => _wp_specialchars( $args['search_value'] ), // The value to search. Encode ampersands but not quotes. |
|
| 988 | + 'value' => _wp_specialchars( $args[ 'search_value' ] ), // The value to search. Encode ampersands but not quotes. |
|
| 989 | 989 | 'operator' => $operator, |
| 990 | 990 | ); |
| 991 | 991 | } |
| 992 | 992 | |
| 993 | - if( $search_criteria !== $original_search_criteria ) { |
|
| 993 | + if ( $search_criteria !== $original_search_criteria ) { |
|
| 994 | 994 | do_action( 'gravityview_log_debug', '[get_search_criteria] Search Criteria after implicity search: ', $search_criteria ); |
| 995 | 995 | } |
| 996 | 996 | |
| 997 | 997 | // Handle setting date range |
| 998 | 998 | $search_criteria = self::process_search_dates( $args, $search_criteria ); |
| 999 | 999 | |
| 1000 | - if( $search_criteria !== $original_search_criteria ) { |
|
| 1000 | + if ( $search_criteria !== $original_search_criteria ) { |
|
| 1001 | 1001 | do_action( 'gravityview_log_debug', '[get_search_criteria] Search Criteria after date params: ', $search_criteria ); |
| 1002 | 1002 | } |
| 1003 | 1003 | |
@@ -1008,7 +1008,7 @@ discard block |
||
| 1008 | 1008 | * @filter `gravityview_status` Modify entry status requirements to be included in search results. |
| 1009 | 1009 | * @param string $status Default: `active`. Accepts all Gravity Forms entry statuses, including `spam` and `trash` |
| 1010 | 1010 | */ |
| 1011 | - $search_criteria['status'] = apply_filters( 'gravityview_status', 'active', $args ); |
|
| 1011 | + $search_criteria[ 'status' ] = apply_filters( 'gravityview_status', 'active', $args ); |
|
| 1012 | 1012 | |
| 1013 | 1013 | return $search_criteria; |
| 1014 | 1014 | } |
@@ -1054,16 +1054,16 @@ discard block |
||
| 1054 | 1054 | $search_criteria = self::get_search_criteria( $args, $form_id ); |
| 1055 | 1055 | |
| 1056 | 1056 | // Paging & offset |
| 1057 | - $page_size = ! empty( $args['page_size'] ) ? intval( $args['page_size'] ) : apply_filters( 'gravityview_default_page_size', 25 ); |
|
| 1057 | + $page_size = ! empty( $args[ 'page_size' ] ) ? intval( $args[ 'page_size' ] ) : apply_filters( 'gravityview_default_page_size', 25 ); |
|
| 1058 | 1058 | |
| 1059 | 1059 | if ( -1 === $page_size ) { |
| 1060 | 1060 | $page_size = PHP_INT_MAX; |
| 1061 | 1061 | } |
| 1062 | 1062 | |
| 1063 | - if ( isset( $args['offset'] ) ) { |
|
| 1064 | - $offset = intval( $args['offset'] ); |
|
| 1063 | + if ( isset( $args[ 'offset' ] ) ) { |
|
| 1064 | + $offset = intval( $args[ 'offset' ] ); |
|
| 1065 | 1065 | } else { |
| 1066 | - $curr_page = empty( $_GET['pagenum'] ) ? 1 : intval( $_GET['pagenum'] ); |
|
| 1066 | + $curr_page = empty( $_GET[ 'pagenum' ] ) ? 1 : intval( $_GET[ 'pagenum' ] ); |
|
| 1067 | 1067 | $offset = ( $curr_page - 1 ) * $page_size; |
| 1068 | 1068 | } |
| 1069 | 1069 | |
@@ -1081,7 +1081,7 @@ discard block |
||
| 1081 | 1081 | 'search_criteria' => $search_criteria, |
| 1082 | 1082 | 'sorting' => $sorting, |
| 1083 | 1083 | 'paging' => $paging, |
| 1084 | - 'cache' => isset( $args['cache'] ) ? $args['cache'] : true, |
|
| 1084 | + 'cache' => isset( $args[ 'cache' ] ) ? $args[ 'cache' ] : true, |
|
| 1085 | 1085 | ); |
| 1086 | 1086 | |
| 1087 | 1087 | /** |
@@ -1106,7 +1106,7 @@ discard block |
||
| 1106 | 1106 | * @param array $parameters Array with `search_criteria`, `sorting` and `paging` keys. |
| 1107 | 1107 | * @param array $args View configuration args. |
| 1108 | 1108 | */ |
| 1109 | - $parameters = apply_filters( 'gravityview_get_entries_'.$args['id'], $parameters, $args, $form_id ); |
|
| 1109 | + $parameters = apply_filters( 'gravityview_get_entries_' . $args[ 'id' ], $parameters, $args, $form_id ); |
|
| 1110 | 1110 | |
| 1111 | 1111 | do_action( 'gravityview_log_debug', __METHOD__ . ': $parameters passed to gravityview_get_entries(): ', $parameters ); |
| 1112 | 1112 | |
@@ -1146,8 +1146,8 @@ discard block |
||
| 1146 | 1146 | */ |
| 1147 | 1147 | public static function updateViewSorting( $args, $form_id ) { |
| 1148 | 1148 | $sorting = array(); |
| 1149 | - $sort_field_id = isset( $_GET['sort'] ) ? $_GET['sort'] : rgar( $args, 'sort_field' ); |
|
| 1150 | - $sort_direction = isset( $_GET['dir'] ) ? $_GET['dir'] : rgar( $args, 'sort_direction' ); |
|
| 1149 | + $sort_field_id = isset( $_GET[ 'sort' ] ) ? $_GET[ 'sort' ] : rgar( $args, 'sort_field' ); |
|
| 1150 | + $sort_direction = isset( $_GET[ 'dir' ] ) ? $_GET[ 'dir' ] : rgar( $args, 'sort_direction' ); |
|
| 1151 | 1151 | |
| 1152 | 1152 | $sort_field_id = self::_override_sorting_id_by_field_type( $sort_field_id, $form_id ); |
| 1153 | 1153 | |
@@ -1187,7 +1187,7 @@ discard block |
||
| 1187 | 1187 | |
| 1188 | 1188 | $sort_field = GFFormsModel::get_field( $form, $sort_field_id ); |
| 1189 | 1189 | |
| 1190 | - switch ( $sort_field['type'] ) { |
|
| 1190 | + switch ( $sort_field[ 'type' ] ) { |
|
| 1191 | 1191 | |
| 1192 | 1192 | case 'address': |
| 1193 | 1193 | // Sorting by full address |
@@ -1204,7 +1204,7 @@ discard block |
||
| 1204 | 1204 | */ |
| 1205 | 1205 | $address_part = apply_filters( 'gravityview/sorting/address', 'city', $sort_field_id, $form_id ); |
| 1206 | 1206 | |
| 1207 | - switch( strtolower( $address_part ) ){ |
|
| 1207 | + switch ( strtolower( $address_part ) ) { |
|
| 1208 | 1208 | case 'street': |
| 1209 | 1209 | $sort_field_id .= '.1'; |
| 1210 | 1210 | break; |
@@ -1284,7 +1284,7 @@ discard block |
||
| 1284 | 1284 | */ |
| 1285 | 1285 | $single_entry = apply_filters( 'gravityview/is_single_entry', $single_entry ); |
| 1286 | 1286 | |
| 1287 | - if ( empty( $single_entry ) ){ |
|
| 1287 | + if ( empty( $single_entry ) ) { |
|
| 1288 | 1288 | return false; |
| 1289 | 1289 | } else { |
| 1290 | 1290 | return $single_entry; |
@@ -1311,7 +1311,7 @@ discard block |
||
| 1311 | 1311 | * Don't enqueue the scripts or styles if it's not going to be displayed. |
| 1312 | 1312 | * @since 1.15 |
| 1313 | 1313 | */ |
| 1314 | - if( is_user_logged_in() && false === GVCommon::has_cap( 'read_gravityview', $view_id ) ) { |
|
| 1314 | + if ( is_user_logged_in() && false === GVCommon::has_cap( 'read_gravityview', $view_id ) ) { |
|
| 1315 | 1315 | continue; |
| 1316 | 1316 | } |
| 1317 | 1317 | |
@@ -1320,19 +1320,19 @@ discard block |
||
| 1320 | 1320 | $css_dependencies = array(); |
| 1321 | 1321 | |
| 1322 | 1322 | // If the thickbox is enqueued, add dependencies |
| 1323 | - if ( ! empty( $data['atts']['lightbox'] ) ) { |
|
| 1323 | + if ( ! empty( $data[ 'atts' ][ 'lightbox' ] ) ) { |
|
| 1324 | 1324 | |
| 1325 | 1325 | /** |
| 1326 | 1326 | * @filter `gravity_view_lightbox_script` Override the lightbox script to enqueue. Default: `thickbox` |
| 1327 | 1327 | * @param string $script_slug If you want to use a different lightbox script, return the name of it here. |
| 1328 | 1328 | */ |
| 1329 | - $js_dependencies[] = apply_filters( 'gravity_view_lightbox_script', 'thickbox' ); |
|
| 1329 | + $js_dependencies[ ] = apply_filters( 'gravity_view_lightbox_script', 'thickbox' ); |
|
| 1330 | 1330 | |
| 1331 | 1331 | /** |
| 1332 | 1332 | * @filter `gravity_view_lightbox_style` Modify the lightbox CSS slug. Default: `thickbox` |
| 1333 | 1333 | * @param string $script_slug If you want to use a different lightbox script, return the name of its CSS file here. |
| 1334 | 1334 | */ |
| 1335 | - $css_dependencies[] = apply_filters( 'gravity_view_lightbox_style', 'thickbox' ); |
|
| 1335 | + $css_dependencies[ ] = apply_filters( 'gravity_view_lightbox_style', 'thickbox' ); |
|
| 1336 | 1336 | } |
| 1337 | 1337 | |
| 1338 | 1338 | /** |
@@ -1340,25 +1340,25 @@ discard block |
||
| 1340 | 1340 | * @see https://github.com/katzwebservices/GravityView/issues/536 |
| 1341 | 1341 | * @since 1.15 |
| 1342 | 1342 | */ |
| 1343 | - if( gravityview_view_has_single_checkbox_or_radio( $data['form'], $data['fields'] ) ) { |
|
| 1344 | - $css_dependencies[] = 'dashicons'; |
|
| 1343 | + if ( gravityview_view_has_single_checkbox_or_radio( $data[ 'form' ], $data[ 'fields' ] ) ) { |
|
| 1344 | + $css_dependencies[ ] = 'dashicons'; |
|
| 1345 | 1345 | } |
| 1346 | 1346 | |
| 1347 | 1347 | wp_register_script( 'gravityview-jquery-cookie', plugins_url( 'assets/lib/jquery.cookie/jquery.cookie.min.js', GRAVITYVIEW_FILE ), array( 'jquery' ), GravityView_Plugin::version, true ); |
| 1348 | 1348 | |
| 1349 | 1349 | $script_debug = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
| 1350 | 1350 | |
| 1351 | - 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 ); |
|
| 1351 | + 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 ); |
|
| 1352 | 1352 | |
| 1353 | 1353 | wp_enqueue_script( 'gravityview-fe-view' ); |
| 1354 | 1354 | |
| 1355 | - if ( ! empty( $data['atts']['sort_columns'] ) ) { |
|
| 1355 | + if ( ! empty( $data[ 'atts' ][ 'sort_columns' ] ) ) { |
|
| 1356 | 1356 | wp_enqueue_style( 'gravityview_font', plugins_url( 'assets/css/font.css', GRAVITYVIEW_FILE ), $css_dependencies, GravityView_Plugin::version, 'all' ); |
| 1357 | 1357 | } |
| 1358 | 1358 | |
| 1359 | 1359 | $this->enqueue_default_style( $css_dependencies ); |
| 1360 | 1360 | |
| 1361 | - self::add_style( $data['template_id'] ); |
|
| 1361 | + self::add_style( $data[ 'template_id' ] ); |
|
| 1362 | 1362 | } |
| 1363 | 1363 | |
| 1364 | 1364 | if ( 'wp_print_footer_scripts' === current_filter() ) { |
@@ -1420,7 +1420,7 @@ discard block |
||
| 1420 | 1420 | } elseif ( empty( $template_id ) ) { |
| 1421 | 1421 | do_action( 'gravityview_log_error', '[add_style] Cannot add template style; template_id is empty' ); |
| 1422 | 1422 | } else { |
| 1423 | - do_action( 'gravityview_log_error', sprintf( '[add_style] Cannot add template style; %s is not registered', 'gravityview_style_'.$template_id ) ); |
|
| 1423 | + do_action( 'gravityview_log_error', sprintf( '[add_style] Cannot add template style; %s is not registered', 'gravityview_style_' . $template_id ) ); |
|
| 1424 | 1424 | } |
| 1425 | 1425 | |
| 1426 | 1426 | } |
@@ -1445,11 +1445,11 @@ discard block |
||
| 1445 | 1445 | * Not a table-based template; don't add sort icons |
| 1446 | 1446 | * @since 1.12 |
| 1447 | 1447 | */ |
| 1448 | - if( ! preg_match( '/table/ism', GravityView_View::getInstance()->getTemplatePartSlug() ) ) { |
|
| 1448 | + if ( ! preg_match( '/table/ism', GravityView_View::getInstance()->getTemplatePartSlug() ) ) { |
|
| 1449 | 1449 | return $label; |
| 1450 | 1450 | } |
| 1451 | 1451 | |
| 1452 | - if ( ! $this->is_field_sortable( $field['id'], $form ) ) { |
|
| 1452 | + if ( ! $this->is_field_sortable( $field[ 'id' ], $form ) ) { |
|
| 1453 | 1453 | return $label; |
| 1454 | 1454 | } |
| 1455 | 1455 | |
@@ -1457,29 +1457,29 @@ discard block |
||
| 1457 | 1457 | |
| 1458 | 1458 | $class = 'gv-sort'; |
| 1459 | 1459 | |
| 1460 | - $sort_field_id = self::_override_sorting_id_by_field_type( $field['id'], $form['id'] ); |
|
| 1460 | + $sort_field_id = self::_override_sorting_id_by_field_type( $field[ 'id' ], $form[ 'id' ] ); |
|
| 1461 | 1461 | |
| 1462 | 1462 | $sort_args = array( |
| 1463 | - 'sort' => $field['id'], |
|
| 1463 | + 'sort' => $field[ 'id' ], |
|
| 1464 | 1464 | 'dir' => 'asc', |
| 1465 | 1465 | ); |
| 1466 | 1466 | |
| 1467 | - if ( ! empty( $sorting['key'] ) && (string) $sort_field_id === (string) $sorting['key'] ) { |
|
| 1467 | + if ( ! empty( $sorting[ 'key' ] ) && (string)$sort_field_id === (string)$sorting[ 'key' ] ) { |
|
| 1468 | 1468 | //toggle sorting direction. |
| 1469 | - if ( 'asc' === $sorting['direction'] ) { |
|
| 1470 | - $sort_args['dir'] = 'desc'; |
|
| 1469 | + if ( 'asc' === $sorting[ 'direction' ] ) { |
|
| 1470 | + $sort_args[ 'dir' ] = 'desc'; |
|
| 1471 | 1471 | $class .= ' gv-icon-sort-desc'; |
| 1472 | 1472 | } else { |
| 1473 | - $sort_args['dir'] = 'asc'; |
|
| 1473 | + $sort_args[ 'dir' ] = 'asc'; |
|
| 1474 | 1474 | $class .= ' gv-icon-sort-asc'; |
| 1475 | 1475 | } |
| 1476 | 1476 | } else { |
| 1477 | 1477 | $class .= ' gv-icon-caret-up-down'; |
| 1478 | 1478 | } |
| 1479 | 1479 | |
| 1480 | - $url = add_query_arg( $sort_args, remove_query_arg( array('pagenum') ) ); |
|
| 1480 | + $url = add_query_arg( $sort_args, remove_query_arg( array( 'pagenum' ) ) ); |
|
| 1481 | 1481 | |
| 1482 | - return '<a href="'. esc_url_raw( $url ) .'" class="'. $class .'" ></a> '. $label; |
|
| 1482 | + return '<a href="' . esc_url_raw( $url ) . '" class="' . $class . '" ></a> ' . $label; |
|
| 1483 | 1483 | |
| 1484 | 1484 | } |
| 1485 | 1485 | |
@@ -1497,7 +1497,7 @@ discard block |
||
| 1497 | 1497 | |
| 1498 | 1498 | $field_type = $field_id; |
| 1499 | 1499 | |
| 1500 | - if( is_numeric( $field_id ) ) { |
|
| 1500 | + if ( is_numeric( $field_id ) ) { |
|
| 1501 | 1501 | $field = GFFormsModel::get_field( $form, $field_id ); |
| 1502 | 1502 | $field_type = $field->type; |
| 1503 | 1503 | } |
@@ -1520,7 +1520,7 @@ discard block |
||
| 1520 | 1520 | return false; |
| 1521 | 1521 | } |
| 1522 | 1522 | |
| 1523 | - return apply_filters( "gravityview/sortable/formfield_{$form['id']}_{$field_id}", apply_filters( "gravityview/sortable/field_{$field_id}", true, $form ) ); |
|
| 1523 | + return apply_filters( "gravityview/sortable/formfield_{$form[ 'id' ]}_{$field_id}", apply_filters( "gravityview/sortable/field_{$field_id}", true, $form ) ); |
|
| 1524 | 1524 | |
| 1525 | 1525 | } |
| 1526 | 1526 | |