@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | * @return void |
| 93 | 93 | */ |
| 94 | 94 | public static function connected_form_warning( $form_id = 0 ) { |
| 95 | - global $pagenow; |
|
| 95 | + global $pagenow; |
|
| 96 | 96 | |
| 97 | 97 | if ( empty( $form_id ) || $pagenow === 'post-new.php' ) { |
| 98 | 98 | return; |
@@ -238,7 +238,7 @@ discard block |
||
| 238 | 238 | 7 => sprintf(__( 'View saved. %sView on website.%s', 'gravityview' ), '<a href="'.get_permalink( $post_id ).'">', '</a>') . $new_form_text, |
| 239 | 239 | 8 => __( 'View submitted.', 'gravityview' ), |
| 240 | 240 | 9 => sprintf( |
| 241 | - /* translators: Date and time the View is scheduled to be published */ |
|
| 241 | + /* translators: Date and time the View is scheduled to be published */ |
|
| 242 | 242 | __( 'View scheduled for: %1$s.', 'gravityview' ), |
| 243 | 243 | // translators: Publish box date format, see http://php.net/date |
| 244 | 244 | date_i18n( __( 'M j, Y @ G:i', 'gravityview' ), strtotime( ( isset( $post->post_date ) ? $post->post_date : NULL ) ) ) |
@@ -295,7 +295,6 @@ discard block |
||
| 295 | 295 | * |
| 296 | 296 | * @deprecated since 1.12 |
| 297 | 297 | * @see GravityView_Compatibility::get_plugin_status() |
| 298 | - |
|
| 299 | 298 | * @return boolean|string True: plugin is active; False: plugin file doesn't exist at path; 'inactive' it's inactive |
| 300 | 299 | */ |
| 301 | 300 | static function get_plugin_status( $location = '' ) { |
@@ -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 | |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | add_filter( 'post_updated_messages', array( $this, 'post_updated_messages' ) ); |
| 49 | 49 | add_filter( 'bulk_post_updated_messages', array( $this, 'post_updated_messages' ) ); |
| 50 | 50 | |
| 51 | - add_filter( 'plugin_action_links_'. plugin_basename( GRAVITYVIEW_FILE ) , array( $this, 'plugin_action_links' ) ); |
|
| 51 | + add_filter( 'plugin_action_links_' . plugin_basename( GRAVITYVIEW_FILE ), array( $this, 'plugin_action_links' ) ); |
|
| 52 | 52 | |
| 53 | 53 | add_action( 'plugins_loaded', array( $this, 'backend_actions' ), 100 ); |
| 54 | 54 | |
@@ -64,9 +64,9 @@ discard block |
||
| 64 | 64 | */ |
| 65 | 65 | public static function no_views_text() { |
| 66 | 66 | |
| 67 | - if ( isset( $_REQUEST['post_status'] ) && 'trash' === $_REQUEST['post_status'] ) { |
|
| 67 | + if ( isset( $_REQUEST[ 'post_status' ] ) && 'trash' === $_REQUEST[ 'post_status' ] ) { |
|
| 68 | 68 | return __( 'No Views found in Trash', 'gravityview' ); |
| 69 | - } elseif( ! empty( $_GET['s'] ) ) { |
|
| 69 | + } elseif ( ! empty( $_GET[ 's' ] ) ) { |
|
| 70 | 70 | return __( 'No Views found.', 'gravityview' ); |
| 71 | 71 | } |
| 72 | 72 | |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | $error .= ' ' . esc_html__( 'or select another form.', 'gravityview' ); |
| 111 | 111 | } |
| 112 | 112 | |
| 113 | - if( $error ) { |
|
| 113 | + if ( $error ) { |
|
| 114 | 114 | ?> |
| 115 | 115 | <div class="wp-dialog notice-warning inline error wp-clearfix"> |
| 116 | 116 | <?php echo gravityview_get_floaty(); ?> |
@@ -129,23 +129,23 @@ discard block |
||
| 129 | 129 | public function backend_actions() { |
| 130 | 130 | |
| 131 | 131 | /** @define "GRAVITYVIEW_DIR" "../" */ |
| 132 | - include_once( GRAVITYVIEW_DIR .'includes/admin/class.field.type.php' ); |
|
| 133 | - include_once( GRAVITYVIEW_DIR .'includes/admin/class.render.settings.php' ); |
|
| 134 | - include_once( GRAVITYVIEW_DIR .'includes/admin/class-gravityview-admin-view-item.php' ); |
|
| 135 | - include_once( GRAVITYVIEW_DIR .'includes/admin/class-gravityview-admin-view-field.php' ); |
|
| 136 | - include_once( GRAVITYVIEW_DIR .'includes/admin/class-gravityview-admin-view-widget.php' ); |
|
| 137 | - include_once( GRAVITYVIEW_DIR .'includes/class-admin-views.php' ); |
|
| 138 | - include_once( GRAVITYVIEW_DIR .'includes/class-admin-welcome.php' ); |
|
| 139 | - include_once( GRAVITYVIEW_DIR .'includes/class-admin-installer.php' ); |
|
| 140 | - include_once( GRAVITYVIEW_DIR .'includes/class-admin-add-shortcode.php' ); |
|
| 141 | - include_once( GRAVITYVIEW_DIR .'includes/class-admin-approve-entries.php' ); |
|
| 132 | + include_once( GRAVITYVIEW_DIR . 'includes/admin/class.field.type.php' ); |
|
| 133 | + include_once( GRAVITYVIEW_DIR . 'includes/admin/class.render.settings.php' ); |
|
| 134 | + include_once( GRAVITYVIEW_DIR . 'includes/admin/class-gravityview-admin-view-item.php' ); |
|
| 135 | + include_once( GRAVITYVIEW_DIR . 'includes/admin/class-gravityview-admin-view-field.php' ); |
|
| 136 | + include_once( GRAVITYVIEW_DIR . 'includes/admin/class-gravityview-admin-view-widget.php' ); |
|
| 137 | + include_once( GRAVITYVIEW_DIR . 'includes/class-admin-views.php' ); |
|
| 138 | + include_once( GRAVITYVIEW_DIR . 'includes/class-admin-welcome.php' ); |
|
| 139 | + include_once( GRAVITYVIEW_DIR . 'includes/class-admin-installer.php' ); |
|
| 140 | + include_once( GRAVITYVIEW_DIR . 'includes/class-admin-add-shortcode.php' ); |
|
| 141 | + include_once( GRAVITYVIEW_DIR . 'includes/class-admin-approve-entries.php' ); |
|
| 142 | 142 | |
| 143 | 143 | /** |
| 144 | 144 | * @action `gravityview_include_backend_actions` Triggered after all GravityView admin files are loaded |
| 145 | 145 | * |
| 146 | 146 | * Nice place to insert extensions' backend stuff |
| 147 | 147 | */ |
| 148 | - do_action('gravityview_include_backend_actions'); |
|
| 148 | + do_action( 'gravityview_include_backend_actions' ); |
|
| 149 | 149 | } |
| 150 | 150 | |
| 151 | 151 | /** |
@@ -161,12 +161,12 @@ discard block |
||
| 161 | 161 | |
| 162 | 162 | $actions = array(); |
| 163 | 163 | |
| 164 | - if( GVCommon::has_cap( 'gravityview_view_settings' ) ) { |
|
| 165 | - $actions[] = sprintf( '<a href="%s">%s</a>', admin_url( 'edit.php?post_type=gravityview&page=gravityview_settings' ), esc_html__( 'Settings', 'gravityview' ) ); |
|
| 164 | + if ( GVCommon::has_cap( 'gravityview_view_settings' ) ) { |
|
| 165 | + $actions[ ] = sprintf( '<a href="%s">%s</a>', admin_url( 'edit.php?post_type=gravityview&page=gravityview_settings' ), esc_html__( 'Settings', 'gravityview' ) ); |
|
| 166 | 166 | } |
| 167 | 167 | |
| 168 | - if( GVCommon::has_cap( 'gravityview_support_port' ) ) { |
|
| 169 | - $actions[] = '<a href="https://docs.gravityview.co">' . esc_html__( 'Support', 'gravityview' ) . '</a>'; |
|
| 168 | + if ( GVCommon::has_cap( 'gravityview_support_port' ) ) { |
|
| 169 | + $actions[ ] = '<a href="https://docs.gravityview.co">' . esc_html__( 'Support', 'gravityview' ) . '</a>'; |
|
| 170 | 170 | } |
| 171 | 171 | |
| 172 | 172 | return array_merge( $actions, $links ); |
@@ -194,7 +194,7 @@ discard block |
||
| 194 | 194 | // By default, there will only be one item being modified. |
| 195 | 195 | // When in the `bulk_post_updated_messages` filter, there will be passed a number |
| 196 | 196 | // of modified items that will override this array. |
| 197 | - $bulk_counts = is_null( $bulk_counts ) ? array( 'updated' => 1 , 'locked' => 1 , 'deleted' => 1 , 'trashed' => 1, 'untrashed' => 1 ) : $bulk_counts; |
|
| 197 | + $bulk_counts = is_null( $bulk_counts ) ? array( 'updated' => 1, 'locked' => 1, 'deleted' => 1, 'trashed' => 1, 'untrashed' => 1 ) : $bulk_counts; |
|
| 198 | 198 | |
| 199 | 199 | // If we're starting fresh, a new form was created. |
| 200 | 200 | // We should let the user know this is the case. |
@@ -202,60 +202,60 @@ discard block |
||
| 202 | 202 | |
| 203 | 203 | $new_form_text = ''; |
| 204 | 204 | |
| 205 | - if( !empty( $start_fresh ) ) { |
|
| 205 | + if ( ! empty( $start_fresh ) ) { |
|
| 206 | 206 | |
| 207 | 207 | // Get the form that was created |
| 208 | 208 | $connected_form = gravityview_get_form_id( $post_id ); |
| 209 | 209 | |
| 210 | - if( !empty( $connected_form ) ) { |
|
| 210 | + if ( ! empty( $connected_form ) ) { |
|
| 211 | 211 | $form = gravityview_get_form( $connected_form ); |
| 212 | - $form_name = esc_attr( $form['title'] ); |
|
| 212 | + $form_name = esc_attr( $form[ 'title' ] ); |
|
| 213 | 213 | $image = self::get_floaty(); |
| 214 | - $new_form_text .= '<h3>'.$image.sprintf( __( 'A new form was created for this View: "%s"', 'gravityview' ), $form_name ).'</h3>'; |
|
| 215 | - $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 |
|
| 214 | + $new_form_text .= '<h3>' . $image . sprintf( __( 'A new form was created for this View: "%s"', 'gravityview' ), $form_name ) . '</h3>'; |
|
| 215 | + $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 |
|
| 216 | 216 | |
| 217 | 217 | 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. |
| 218 | - ', '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>'); |
|
| 218 | + ', '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>' ); |
|
| 219 | 219 | $new_form_text = wpautop( $new_form_text ); |
| 220 | 220 | |
| 221 | 221 | delete_post_meta( $post_id, '_gravityview_start_fresh' ); |
| 222 | 222 | } |
| 223 | 223 | } |
| 224 | 224 | |
| 225 | - $messages['gravityview'] = array( |
|
| 225 | + $messages[ 'gravityview' ] = array( |
|
| 226 | 226 | 0 => '', // Unused. Messages start at index 1. |
| 227 | 227 | /* translators: %s and %s are HTML tags linking to the View on the website */ |
| 228 | - 1 => sprintf(__( 'View updated. %sView on website.%s', 'gravityview' ), '<a href="'.get_permalink( $post_id ).'">', '</a>'), |
|
| 228 | + 1 => sprintf( __( 'View updated. %sView on website.%s', 'gravityview' ), '<a href="' . get_permalink( $post_id ) . '">', '</a>' ), |
|
| 229 | 229 | /* translators: %s and %s are HTML tags linking to the View on the website */ |
| 230 | - 2 => sprintf(__( 'View updated. %sView on website.%s', 'gravityview' ), '<a href="'.get_permalink( $post_id ).'">', '</a>'), |
|
| 230 | + 2 => sprintf( __( 'View updated. %sView on website.%s', 'gravityview' ), '<a href="' . get_permalink( $post_id ) . '">', '</a>' ), |
|
| 231 | 231 | 3 => __( 'View deleted.', 'gravityview' ), |
| 232 | 232 | /* translators: %s and %s are HTML tags linking to the View on the website */ |
| 233 | - 4 => sprintf(__( 'View updated. %sView on website.%s', 'gravityview' ), '<a href="'.get_permalink( $post_id ).'">', '</a>'), |
|
| 233 | + 4 => sprintf( __( 'View updated. %sView on website.%s', 'gravityview' ), '<a href="' . get_permalink( $post_id ) . '">', '</a>' ), |
|
| 234 | 234 | /* translators: %s: date and time of the revision */ |
| 235 | - 5 => isset( $_GET['revision'] ) ? sprintf( __( 'View restored to revision from %s', 'gravityview' ), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false, |
|
| 235 | + 5 => isset( $_GET[ 'revision' ] ) ? sprintf( __( 'View restored to revision from %s', 'gravityview' ), wp_post_revision_title( (int)$_GET[ 'revision' ], false ) ) : false, |
|
| 236 | 236 | /* translators: %s and %s are HTML tags linking to the View on the website */ |
| 237 | - 6 => sprintf(__( 'View published. %sView on website.%s', 'gravityview' ), '<a href="'.get_permalink( $post_id ).'">', '</a>') . $new_form_text, |
|
| 237 | + 6 => sprintf( __( 'View published. %sView on website.%s', 'gravityview' ), '<a href="' . get_permalink( $post_id ) . '">', '</a>' ) . $new_form_text, |
|
| 238 | 238 | /* translators: %s and %s are HTML tags linking to the View on the website */ |
| 239 | - 7 => sprintf(__( 'View saved. %sView on website.%s', 'gravityview' ), '<a href="'.get_permalink( $post_id ).'">', '</a>') . $new_form_text, |
|
| 239 | + 7 => sprintf( __( 'View saved. %sView on website.%s', 'gravityview' ), '<a href="' . get_permalink( $post_id ) . '">', '</a>' ) . $new_form_text, |
|
| 240 | 240 | 8 => __( 'View submitted.', 'gravityview' ), |
| 241 | 241 | 9 => sprintf( |
| 242 | 242 | /* translators: Date and time the View is scheduled to be published */ |
| 243 | 243 | __( 'View scheduled for: %1$s.', 'gravityview' ), |
| 244 | 244 | // translators: Publish box date format, see http://php.net/date |
| 245 | - date_i18n( __( 'M j, Y @ G:i', 'gravityview' ), strtotime( ( isset( $post->post_date ) ? $post->post_date : NULL ) ) ) |
|
| 245 | + date_i18n( __( 'M j, Y @ G:i', 'gravityview' ), strtotime( ( isset( $post->post_date ) ? $post->post_date : NULL ) ) ) |
|
| 246 | 246 | ) . $new_form_text, |
| 247 | 247 | /* translators: %s and %s are HTML tags linking to the View on the website */ |
| 248 | - 10 => sprintf(__( 'View draft updated. %sView on website.%s', 'gravityview' ), '<a href="'.get_permalink( $post_id ).'">', '</a>') . $new_form_text, |
|
| 248 | + 10 => sprintf( __( 'View draft updated. %sView on website.%s', 'gravityview' ), '<a href="' . get_permalink( $post_id ) . '">', '</a>' ) . $new_form_text, |
|
| 249 | 249 | |
| 250 | 250 | /** |
| 251 | 251 | * These apply to `bulk_post_updated_messages` |
| 252 | 252 | * @file wp-admin/edit.php |
| 253 | 253 | */ |
| 254 | - 'updated' => _n( '%s View updated.', '%s Views updated.', $bulk_counts['updated'], 'gravityview' ), |
|
| 255 | - 'locked' => _n( '%s View not updated, somebody is editing it.', '%s Views not updated, somebody is editing them.', $bulk_counts['locked'], 'gravityview' ), |
|
| 256 | - 'deleted' => _n( '%s View permanently deleted.', '%s Views permanently deleted.', $bulk_counts['deleted'], 'gravityview' ), |
|
| 257 | - 'trashed' => _n( '%s View moved to the Trash.', '%s Views moved to the Trash.', $bulk_counts['trashed'], 'gravityview' ), |
|
| 258 | - 'untrashed' => _n( '%s View restored from the Trash.', '%s Views restored from the Trash.', $bulk_counts['untrashed'], 'gravityview' ), |
|
| 254 | + 'updated' => _n( '%s View updated.', '%s Views updated.', $bulk_counts[ 'updated' ], 'gravityview' ), |
|
| 255 | + 'locked' => _n( '%s View not updated, somebody is editing it.', '%s Views not updated, somebody is editing them.', $bulk_counts[ 'locked' ], 'gravityview' ), |
|
| 256 | + 'deleted' => _n( '%s View permanently deleted.', '%s Views permanently deleted.', $bulk_counts[ 'deleted' ], 'gravityview' ), |
|
| 257 | + 'trashed' => _n( '%s View moved to the Trash.', '%s Views moved to the Trash.', $bulk_counts[ 'trashed' ], 'gravityview' ), |
|
| 258 | + 'untrashed' => _n( '%s View restored from the Trash.', '%s Views restored from the Trash.', $bulk_counts[ 'untrashed' ], 'gravityview' ), |
|
| 259 | 259 | ); |
| 260 | 260 | |
| 261 | 261 | return $messages; |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | 'args' => $this->create_sub_item_args() |
| 122 | 122 | ), |
| 123 | 123 | ) ); |
| 124 | - register_rest_route( $namespace, sprintf( '/%s/(?P<id>[\d]+)/%s/(?P<s_id>[\w-]+)%s', $base, $sub_type, $format ) , array( |
|
| 124 | + register_rest_route( $namespace, sprintf( '/%s/(?P<id>[\d]+)/%s/(?P<s_id>[\w-]+)%s', $base, $sub_type, $format ), array( |
|
| 125 | 125 | array( |
| 126 | 126 | 'methods' => \WP_REST_Server::READABLE, |
| 127 | 127 | 'callback' => array( $this, 'get_sub_item' ), |
@@ -372,7 +372,7 @@ discard block |
||
| 372 | 372 | * @return \WP_REST_Response |
| 373 | 373 | */ |
| 374 | 374 | protected function not_implemented( ) { |
| 375 | - $error = new \WP_Error( 'not-implemented-yet', __( 'Endpoint Not Yet Implemented.', 'gravityview' ) ); |
|
| 375 | + $error = new \WP_Error( 'not-implemented-yet', __( 'Endpoint Not Yet Implemented.', 'gravityview' ) ); |
|
| 376 | 376 | return new \WP_REST_Response( $error, 501 ); |
| 377 | 377 | } |
| 378 | 378 | |
@@ -7,15 +7,15 @@ |
||
| 7 | 7 | |
| 8 | 8 | $gravityview_view = GravityView_View::getInstance(); |
| 9 | 9 | $view_id = $gravityview_view->getViewId(); |
| 10 | -$value = $gravityview_view->search_field['value']; |
|
| 11 | -$label = $gravityview_view->search_field['label']; |
|
| 10 | +$value = $gravityview_view->search_field[ 'value' ]; |
|
| 11 | +$label = $gravityview_view->search_field[ 'label' ]; |
|
| 12 | 12 | |
| 13 | 13 | $html_input_type = RGFormsModel::is_html5_enabled() ? 'search' : 'text'; |
| 14 | 14 | ?> |
| 15 | 15 | |
| 16 | 16 | <div class="gv-search-box gv-search-field-text gv-search-field-search_all"> |
| 17 | 17 | <div class="gv-search"> |
| 18 | - <?php if( ! gv_empty( $label, false, false ) ) { ?> |
|
| 18 | + <?php if ( ! gv_empty( $label, false, false ) ) { ?> |
|
| 19 | 19 | <label for="gv_search_<?php echo $view_id; ?>"><?php echo esc_html( $label ); ?></label> |
| 20 | 20 | <?php } ?> |
| 21 | 21 | <p><input type="<?php echo $html_input_type; ?>" name="gv_search" id="gv_search_<?php echo $view_id; ?>" value="<?php echo esc_attr( $value ); ?>" /></p> |
@@ -7,13 +7,13 @@ |
||
| 7 | 7 | |
| 8 | 8 | $gravityview_view = GravityView_View::getInstance(); |
| 9 | 9 | $view_id = $gravityview_view->getViewId(); |
| 10 | -$value = $gravityview_view->search_field['value']; |
|
| 11 | -$label = $gravityview_view->search_field['label']; |
|
| 10 | +$value = $gravityview_view->search_field[ 'value' ]; |
|
| 11 | +$label = $gravityview_view->search_field[ 'label' ]; |
|
| 12 | 12 | ?> |
| 13 | 13 | |
| 14 | 14 | <div class="gv-search-box gv-search-field-entry_id"> |
| 15 | 15 | <div class="gv-search"> |
| 16 | - <?php if( ! gv_empty( $label, false, false ) ) { ?> |
|
| 16 | + <?php if ( ! gv_empty( $label, false, false ) ) { ?> |
|
| 17 | 17 | <label for="gv_entry_id_<?php echo $view_id; ?>"><?php echo esc_html( $label ); ?></label> |
| 18 | 18 | <?php } ?> |
| 19 | 19 | <p><input type="text" name="gv_id" id="gv_entry_id_<?php echo $view_id; ?>" value="<?php echo esc_attr( $value ); ?>" /></p> |
@@ -7,17 +7,17 @@ |
||
| 7 | 7 | |
| 8 | 8 | $gravityview_view = GravityView_View::getInstance(); |
| 9 | 9 | $view_id = $gravityview_view->getViewId(); |
| 10 | -$value = $gravityview_view->search_field['value']; |
|
| 11 | -$label = $gravityview_view->search_field['label']; |
|
| 10 | +$value = $gravityview_view->search_field[ 'value' ]; |
|
| 11 | +$label = $gravityview_view->search_field[ 'label' ]; |
|
| 12 | 12 | |
| 13 | 13 | ?> |
| 14 | 14 | |
| 15 | 15 | <div class="gv-search-box gv-search-date gv-search-date-range gv-search-field-entry_date"> |
| 16 | - <?php if( ! gv_empty( $label, false, false ) ) { ?> |
|
| 16 | + <?php if ( ! gv_empty( $label, false, false ) ) { ?> |
|
| 17 | 17 | <label for="gv_start_date_<?php echo $view_id; ?>"><?php echo esc_html( $label ); ?></label> |
| 18 | 18 | <?php } ?> |
| 19 | 19 | <p> |
| 20 | - <input name="gv_start" id="gv_start_date_<?php echo $view_id; ?>" type="text" class="<?php echo esc_attr( $gravityview_view->datepicker_class ); ?>" placeholder="<?php esc_attr_e('Start date', 'gravityview' ); ?>" value="<?php echo $value['start']; ?>"> |
|
| 21 | - <input name="gv_end" id="gv_end_date_<?php echo $view_id; ?>" type="text" class="<?php echo esc_attr( $gravityview_view->datepicker_class ); ?>" placeholder="<?php esc_attr_e('End date', 'gravityview' ); ?>" value="<?php echo $value['end']; ?>"> |
|
| 20 | + <input name="gv_start" id="gv_start_date_<?php echo $view_id; ?>" type="text" class="<?php echo esc_attr( $gravityview_view->datepicker_class ); ?>" placeholder="<?php esc_attr_e( 'Start date', 'gravityview' ); ?>" value="<?php echo $value[ 'start' ]; ?>"> |
|
| 21 | + <input name="gv_end" id="gv_end_date_<?php echo $view_id; ?>" type="text" class="<?php echo esc_attr( $gravityview_view->datepicker_class ); ?>" placeholder="<?php esc_attr_e( 'End date', 'gravityview' ); ?>" value="<?php echo $value[ 'end' ]; ?>"> |
|
| 22 | 22 | </p> |
| 23 | 23 | </div> |
| 24 | 24 | \ No newline at end of file |
@@ -7,17 +7,17 @@ |
||
| 7 | 7 | |
| 8 | 8 | $gravityview_view = GravityView_View::getInstance(); |
| 9 | 9 | $view_id = $gravityview_view->getViewId(); |
| 10 | -$value = $gravityview_view->search_field['value']; |
|
| 11 | -$label = $gravityview_view->search_field['label']; |
|
| 12 | -$name = $gravityview_view->search_field['name']; |
|
| 10 | +$value = $gravityview_view->search_field[ 'value' ]; |
|
| 11 | +$label = $gravityview_view->search_field[ 'label' ]; |
|
| 12 | +$name = $gravityview_view->search_field[ 'name' ]; |
|
| 13 | 13 | ?> |
| 14 | 14 | |
| 15 | 15 | <div class="gv-search-box gv-search-date gv-search-date-range"> |
| 16 | - <?php if( ! gv_empty( $label, false, false ) ) { ?> |
|
| 17 | - <label for="search-box-<?php echo esc_attr( $name ).'-start'; ?>"><?php echo esc_html( $label ); ?></label> |
|
| 16 | + <?php if ( ! gv_empty( $label, false, false ) ) { ?> |
|
| 17 | + <label for="search-box-<?php echo esc_attr( $name ) . '-start'; ?>"><?php echo esc_html( $label ); ?></label> |
|
| 18 | 18 | <?php } ?> |
| 19 | 19 | <p> |
| 20 | - <input name="<?php echo esc_attr( $name ).'[start]'; ?>" id="search-box-<?php echo esc_attr( $name ).'-start'; ?>" type="text" class="<?php echo esc_html( $gravityview_view->datepicker_class ); ?>" placeholder="<?php esc_attr_e('Start date', 'gravityview' ); ?>" value="<?php echo esc_attr( $value['start'] ); ?>"> |
|
| 21 | - <input name="<?php echo esc_attr( $name ).'[end]'; ?>" id="search-box-<?php echo esc_attr( $name ).'-end'; ?>" type="text" class="<?php echo esc_html( $gravityview_view->datepicker_class ); ?>" placeholder="<?php esc_attr_e('End date', 'gravityview' ); ?>" value="<?php echo esc_attr( $value['end'] ); ?>"> |
|
| 20 | + <input name="<?php echo esc_attr( $name ) . '[start]'; ?>" id="search-box-<?php echo esc_attr( $name ) . '-start'; ?>" type="text" class="<?php echo esc_html( $gravityview_view->datepicker_class ); ?>" placeholder="<?php esc_attr_e( 'Start date', 'gravityview' ); ?>" value="<?php echo esc_attr( $value[ 'start' ] ); ?>"> |
|
| 21 | + <input name="<?php echo esc_attr( $name ) . '[end]'; ?>" id="search-box-<?php echo esc_attr( $name ) . '-end'; ?>" type="text" class="<?php echo esc_html( $gravityview_view->datepicker_class ); ?>" placeholder="<?php esc_attr_e( 'End date', 'gravityview' ); ?>" value="<?php echo esc_attr( $value[ 'end' ] ); ?>"> |
|
| 22 | 22 | </p> |
| 23 | 23 | </div> |
| 24 | 24 | \ No newline at end of file |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | |
| 114 | 114 | $args = array(); |
| 115 | 115 | |
| 116 | - $view_id = is_null ( $view ) ? null : $view->ID; |
|
| 116 | + $view_id = is_null( $view ) ? null : $view->ID; |
|
| 117 | 117 | |
| 118 | 118 | $permalink = null; |
| 119 | 119 | |
@@ -126,8 +126,8 @@ discard block |
||
| 126 | 126 | |
| 127 | 127 | $view_collection = View_Collection::from_post( $post ); |
| 128 | 128 | |
| 129 | - if( 1 < $view_collection->count() ) { |
|
| 130 | - $args['gvid'] = $view_id; |
|
| 129 | + if ( 1 < $view_collection->count() ) { |
|
| 130 | + $args[ 'gvid' ] = $view_id; |
|
| 131 | 131 | } |
| 132 | 132 | } |
| 133 | 133 | } |
@@ -156,21 +156,21 @@ discard block |
||
| 156 | 156 | */ |
| 157 | 157 | $link_parts = explode( '?', $permalink ); |
| 158 | 158 | |
| 159 | - $query = ! empty( $link_parts[1] ) ? '?' . $link_parts[1] : ''; |
|
| 159 | + $query = ! empty( $link_parts[ 1 ] ) ? '?' . $link_parts[ 1 ] : ''; |
|
| 160 | 160 | |
| 161 | - $permalink = trailingslashit( $link_parts[0] ) . $entry_endpoint_name . '/'. $entry_slug .'/' . $query; |
|
| 161 | + $permalink = trailingslashit( $link_parts[ 0 ] ) . $entry_endpoint_name . '/' . $entry_slug . '/' . $query; |
|
| 162 | 162 | } else { |
| 163 | 163 | $args[ $entry_endpoint_name ] = $entry_slug; |
| 164 | 164 | } |
| 165 | 165 | |
| 166 | 166 | if ( $track_directory ) { |
| 167 | - if ( ! empty( $_GET['pagenum'] ) ) { |
|
| 168 | - $args['pagenum'] = intval( $_GET['pagenum'] ); |
|
| 167 | + if ( ! empty( $_GET[ 'pagenum' ] ) ) { |
|
| 168 | + $args[ 'pagenum' ] = intval( $_GET[ 'pagenum' ] ); |
|
| 169 | 169 | } |
| 170 | 170 | |
| 171 | 171 | if ( $sort = Utils::_GET( 'sort' ) ) { |
| 172 | - $args['sort'] = $sort; |
|
| 173 | - $args['dir'] = Utils::_GET( 'dir' ); |
|
| 172 | + $args[ 'sort' ] = $sort; |
|
| 173 | + $args[ 'dir' ] = Utils::_GET( 'dir' ); |
|
| 174 | 174 | } |
| 175 | 175 | } |
| 176 | 176 | |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | 'total' => wp_count_posts( 'gravityview' )->publish, |
| 64 | 64 | ); |
| 65 | 65 | foreach ( $items as $item ) { |
| 66 | - $data['views'][] = $this->prepare_view_for_response( $item, $request ); |
|
| 66 | + $data[ 'views' ][ ] = $this->prepare_view_for_response( $item, $request ); |
|
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | return new \WP_REST_Response( $data, 200 ); |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | |
| 83 | 83 | $url = $request->get_url_params(); |
| 84 | 84 | |
| 85 | - $view_id = intval( $url['id'] ); |
|
| 85 | + $view_id = intval( $url[ 'id' ] ); |
|
| 86 | 86 | |
| 87 | 87 | $item = get_post( $view_id ); |
| 88 | 88 | |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | // Only output the fields that should be displayed. |
| 112 | 112 | $allowed = array(); |
| 113 | 113 | foreach ( $view->fields->by_position( "{$context}_*" )->by_visible()->all() as $field ) { |
| 114 | - $allowed[] = $field->ID; |
|
| 114 | + $allowed[ ] = $field->ID; |
|
| 115 | 115 | } |
| 116 | 116 | |
| 117 | 117 | /** |
@@ -156,10 +156,10 @@ discard block |
||
| 156 | 156 | public function get_sub_items( $request ) { |
| 157 | 157 | |
| 158 | 158 | $url = $request->get_url_params(); |
| 159 | - $view_id = intval( $url['id'] ); |
|
| 159 | + $view_id = intval( $url[ 'id' ] ); |
|
| 160 | 160 | $format = \GV\Utils::get( $url, 'format', 'json' ); |
| 161 | 161 | |
| 162 | - if( $post_id = $request->get_param('post_id') ) { |
|
| 162 | + if ( $post_id = $request->get_param( 'post_id' ) ) { |
|
| 163 | 163 | global $post; |
| 164 | 164 | |
| 165 | 165 | $post = get_post( $post_id ); |
@@ -215,7 +215,7 @@ discard block |
||
| 215 | 215 | |
| 216 | 216 | $data = array( 'entries' => $entries->all(), 'total' => $entries->total() ); |
| 217 | 217 | |
| 218 | - foreach ( $data['entries'] as &$entry ) { |
|
| 218 | + foreach ( $data[ 'entries' ] as &$entry ) { |
|
| 219 | 219 | $entry = $this->prepare_entry_for_response( $view, $entry, $request, 'directory' ); |
| 220 | 220 | } |
| 221 | 221 | |
@@ -234,8 +234,8 @@ discard block |
||
| 234 | 234 | */ |
| 235 | 235 | public function get_sub_item( $request ) { |
| 236 | 236 | $url = $request->get_url_params(); |
| 237 | - $view_id = intval( $url['id'] ); |
|
| 238 | - $entry_id = intval( $url['s_id'] ); |
|
| 237 | + $view_id = intval( $url[ 'id' ] ); |
|
| 238 | + $entry_id = intval( $url[ 's_id' ] ); |
|
| 239 | 239 | $format = \GV\Utils::get( $url, 'format', 'json' ); |
| 240 | 240 | |
| 241 | 241 | $view = \GV\View::by_id( $view_id ); |
@@ -270,32 +270,32 @@ discard block |
||
| 270 | 270 | // Add all the WP_Post data |
| 271 | 271 | $view_post = $view_post->to_array(); |
| 272 | 272 | |
| 273 | - unset( $view_post['to_ping'], $view_post['ping_status'], $view_post['pinged'], $view_post['post_type'], $view_post['filter'], $view_post['post_category'], $view_post['tags_input'], $view_post['post_content'], $view_post['post_content_filtered'] ); |
|
| 273 | + unset( $view_post[ 'to_ping' ], $view_post[ 'ping_status' ], $view_post[ 'pinged' ], $view_post[ 'post_type' ], $view_post[ 'filter' ], $view_post[ 'post_category' ], $view_post[ 'tags_input' ], $view_post[ 'post_content' ], $view_post[ 'post_content_filtered' ] ); |
|
| 274 | 274 | |
| 275 | 275 | $return = wp_parse_args( $item, $view_post ); |
| 276 | 276 | |
| 277 | - $return['title'] = $return['post_title']; |
|
| 277 | + $return[ 'title' ] = $return[ 'post_title' ]; |
|
| 278 | 278 | |
| 279 | - $return['settings'] = isset( $return['atts'] ) ? $return['atts'] : array(); |
|
| 280 | - unset( $return['atts'], $return['view_id'] ); |
|
| 279 | + $return[ 'settings' ] = isset( $return[ 'atts' ] ) ? $return[ 'atts' ] : array(); |
|
| 280 | + unset( $return[ 'atts' ], $return[ 'view_id' ] ); |
|
| 281 | 281 | |
| 282 | - $return['search_criteria'] = array( |
|
| 282 | + $return[ 'search_criteria' ] = array( |
|
| 283 | 283 | 'page_size' => rgars( $return, 'settings/page_size' ), |
| 284 | 284 | 'sort_field' => rgars( $return, 'settings/sort_field' ), |
| 285 | 285 | 'sort_direction' => rgars( $return, 'settings/sort_direction' ), |
| 286 | 286 | 'offset' => rgars( $return, 'settings/offset' ), |
| 287 | 287 | ); |
| 288 | 288 | |
| 289 | - unset( $return['settings']['page_size'], $return['settings']['sort_field'], $return['settings']['sort_direction'] ); |
|
| 289 | + unset( $return[ 'settings' ][ 'page_size' ], $return[ 'settings' ][ 'sort_field' ], $return[ 'settings' ][ 'sort_direction' ] ); |
|
| 290 | 290 | |
| 291 | 291 | // Redact for non-logged ins |
| 292 | 292 | if ( ! \GVCommon::has_cap( 'edit_others_gravityviews' ) ) { |
| 293 | - unset( $return['settings'] ); |
|
| 294 | - unset( $return['search_criteria'] ); |
|
| 293 | + unset( $return[ 'settings' ] ); |
|
| 294 | + unset( $return[ 'search_criteria' ] ); |
|
| 295 | 295 | } |
| 296 | 296 | |
| 297 | 297 | if ( ! \GFCommon::current_user_can_any( 'gravityforms_edit_forms' ) ) { |
| 298 | - unset( $return['form'] ); |
|
| 298 | + unset( $return[ 'form' ] ); |
|
| 299 | 299 | } |
| 300 | 300 | |
| 301 | 301 | return $return; |
@@ -306,7 +306,7 @@ discard block |
||
| 306 | 306 | $view_id = func_get_arg( 1 ); // $view_id override |
| 307 | 307 | } else { |
| 308 | 308 | $url = $request->get_url_params(); |
| 309 | - $view_id = intval( $url['id'] ); |
|
| 309 | + $view_id = intval( $url[ 'id' ] ); |
|
| 310 | 310 | } |
| 311 | 311 | |
| 312 | 312 | if ( ! $view = \GV\View::by_id( $view_id ) ) { |
@@ -359,8 +359,8 @@ discard block |
||
| 359 | 359 | } |
| 360 | 360 | |
| 361 | 361 | $url = $request->get_url_params(); |
| 362 | - $view_id = intval( $url['id'] ); |
|
| 363 | - $entry_id = intval( $url['s_id'] ); |
|
| 362 | + $view_id = intval( $url[ 'id' ] ); |
|
| 363 | + $entry_id = intval( $url[ 's_id' ] ); |
|
| 364 | 364 | |
| 365 | 365 | $view = \GV\View::by_id( $view_id ); |
| 366 | 366 | |
@@ -368,11 +368,11 @@ discard block |
||
| 368 | 368 | return new \WP_Error( 'rest_forbidden', 'You are not allowed to view this content.', 'gravityview' ); |
| 369 | 369 | } |
| 370 | 370 | |
| 371 | - if ( $entry['form_id'] != $view->form->ID ) { |
|
| 371 | + if ( $entry[ 'form_id' ] != $view->form->ID ) { |
|
| 372 | 372 | return new \WP_Error( 'rest_forbidden', 'You are not allowed to view this content.', 'gravityview' ); |
| 373 | 373 | } |
| 374 | 374 | |
| 375 | - if ( $entry['status'] != 'active' ) { |
|
| 375 | + if ( $entry[ 'status' ] != 'active' ) { |
|
| 376 | 376 | return new \WP_Error( 'rest_forbidden', 'You are not allowed to view this content.', 'gravityview' ); |
| 377 | 377 | } |
| 378 | 378 | |
@@ -380,10 +380,10 @@ discard block |
||
| 380 | 380 | return new \WP_Error( 'rest_forbidden', 'You are not allowed to view this content.', 'gravityview' ); |
| 381 | 381 | } |
| 382 | 382 | |
| 383 | - $is_admin_and_can_view = $view->settings->get( 'admin_show_all_statuses' ) && \GVCommon::has_cap('gravityview_moderate_entries', $view->ID ); |
|
| 383 | + $is_admin_and_can_view = $view->settings->get( 'admin_show_all_statuses' ) && \GVCommon::has_cap( 'gravityview_moderate_entries', $view->ID ); |
|
| 384 | 384 | |
| 385 | 385 | if ( $view->settings->get( 'show_only_approved' ) && ! $is_admin_and_can_view ) { |
| 386 | - if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $entry->ID, \GravityView_Entry_Approval::meta_key ) ) ) { |
|
| 386 | + if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $entry->ID, \GravityView_Entry_Approval::meta_key ) ) ) { |
|
| 387 | 387 | return new \WP_Error( 'rest_forbidden', 'You are not allowed to view this content.', 'gravityview' ); |
| 388 | 388 | } |
| 389 | 389 | } |
@@ -319,8 +319,9 @@ |
||
| 319 | 319 | } |
| 320 | 320 | |
| 321 | 321 | while ( $error = $view->can_render( array( 'rest' ), $request ) ) { |
| 322 | - if ( ! is_wp_error( $error ) ) |
|
| 323 | - break; |
|
| 322 | + if ( ! is_wp_error( $error ) ) { |
|
| 323 | + break; |
|
| 324 | + } |
|
| 324 | 325 | |
| 325 | 326 | switch ( str_replace( 'gravityview/', '', $error->get_error_code() ) ) { |
| 326 | 327 | case 'rest_disabled': |
@@ -79,8 +79,9 @@ |
||
| 79 | 79 | * Check permissions. |
| 80 | 80 | */ |
| 81 | 81 | while ( $error = $view->can_render( array( 'shortcode' ), $request ) ) { |
| 82 | - if ( ! is_wp_error( $error ) ) |
|
| 83 | - break; |
|
| 82 | + if ( ! is_wp_error( $error ) ) { |
|
| 83 | + break; |
|
| 84 | + } |
|
| 84 | 85 | |
| 85 | 86 | switch ( str_replace( 'gravityview/', '', $error->get_error_code() ) ) { |
| 86 | 87 | case 'post_password_required': |
@@ -41,8 +41,8 @@ discard block |
||
| 41 | 41 | 'detail' => null, |
| 42 | 42 | ) ); |
| 43 | 43 | |
| 44 | - if ( ! $view_id = $atts['id'] ? : $atts['view_id'] ) { |
|
| 45 | - if ( $atts['detail'] && $view = $request->is_view() ) { |
|
| 44 | + if ( ! $view_id = $atts[ 'id' ] ?: $atts[ 'view_id' ] ) { |
|
| 45 | + if ( $atts[ 'detail' ] && $view = $request->is_view() ) { |
|
| 46 | 46 | $view_id = $view->ID; |
| 47 | 47 | } |
| 48 | 48 | } |
@@ -111,12 +111,12 @@ discard block |
||
| 111 | 111 | } |
| 112 | 112 | } |
| 113 | 113 | |
| 114 | - $is_admin_and_can_view = $view->settings->get( 'admin_show_all_statuses' ) && \GVCommon::has_cap('gravityview_moderate_entries', $view->ID ); |
|
| 114 | + $is_admin_and_can_view = $view->settings->get( 'admin_show_all_statuses' ) && \GVCommon::has_cap( 'gravityview_moderate_entries', $view->ID ); |
|
| 115 | 115 | |
| 116 | 116 | /** |
| 117 | 117 | * View details. |
| 118 | 118 | */ |
| 119 | - if ( $atts['detail'] ) { |
|
| 119 | + if ( $atts[ 'detail' ] ) { |
|
| 120 | 120 | return self::_return( $this->detail( $view, $entries, $atts ) ); |
| 121 | 121 | |
| 122 | 122 | /** |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | return self::_return( '' ); |
| 133 | 133 | } |
| 134 | 134 | |
| 135 | - if ( $entry['status'] != 'active' ) { |
|
| 135 | + if ( $entry[ 'status' ] != 'active' ) { |
|
| 136 | 136 | gravityview()->log->notice( 'Entry ID #{entry_id} is not active', array( 'entry_id' => $entry->ID ) ); |
| 137 | 137 | return self::_return( __( 'You are not allowed to view this content.', 'gravityview' ) ); |
| 138 | 138 | } |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | } |
| 144 | 144 | |
| 145 | 145 | if ( $view->settings->get( 'show_only_approved' ) && ! $is_admin_and_can_view ) { |
| 146 | - if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $entry->ID, \GravityView_Entry_Approval::meta_key ) ) ) { |
|
| 146 | + if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $entry->ID, \GravityView_Entry_Approval::meta_key ) ) ) { |
|
| 147 | 147 | gravityview()->log->error( 'Entry ID #{entry_id} is not approved for viewing', array( 'entry_id' => $entry->ID ) ); |
| 148 | 148 | return self::_return( __( 'You are not allowed to view this content.', 'gravityview' ) ); |
| 149 | 149 | } |
@@ -163,7 +163,7 @@ discard block |
||
| 163 | 163 | return self::_return( '' ); |
| 164 | 164 | } |
| 165 | 165 | |
| 166 | - if ( $entry['status'] != 'active' ) { |
|
| 166 | + if ( $entry[ 'status' ] != 'active' ) { |
|
| 167 | 167 | gravityview()->log->notice( 'Entry ID #{entry_id} is not active', array( 'entry_id' => $entry->ID ) ); |
| 168 | 168 | return self::_return( __( 'You are not allowed to view this content.', 'gravityview' ) ); |
| 169 | 169 | } |
@@ -174,7 +174,7 @@ discard block |
||
| 174 | 174 | } |
| 175 | 175 | |
| 176 | 176 | if ( $view->settings->get( 'show_only_approved' ) && ! $is_admin_and_can_view ) { |
| 177 | - if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $entry->ID, \GravityView_Entry_Approval::meta_key ) ) ) { |
|
| 177 | + if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $entry->ID, \GravityView_Entry_Approval::meta_key ) ) ) { |
|
| 178 | 178 | gravityview()->log->error( 'Entry ID #{entry_id} is not approved for viewing', array( 'entry_id' => $entry->ID ) ); |
| 179 | 179 | return self::_return( __( 'You are not allowed to view this content.', 'gravityview' ) ); |
| 180 | 180 | } |
@@ -182,7 +182,7 @@ discard block |
||
| 182 | 182 | |
| 183 | 183 | $error = \GVCommon::check_entry_display( $entry->as_entry() ); |
| 184 | 184 | |
| 185 | - if( is_wp_error( $error ) ) { |
|
| 185 | + if ( is_wp_error( $error ) ) { |
|
| 186 | 186 | gravityview()->log->error( 'Entry ID #{entry_id} is not approved for viewing: {message}', array( 'entry_id' => $entry->ID, 'message' => $error->get_error_message() ) ); |
| 187 | 187 | return self::_return( __( 'You are not allowed to view this content.', 'gravityview' ) ); |
| 188 | 188 | } |
@@ -198,10 +198,10 @@ discard block |
||
| 198 | 198 | |
| 199 | 199 | // Mock the request with the actual View, not the global one |
| 200 | 200 | $mock_request = new \GV\Mock_Request(); |
| 201 | - $mock_request->returns['is_view'] = $view; |
|
| 202 | - $mock_request->returns['is_entry'] = $request->is_entry(); |
|
| 203 | - $mock_request->returns['is_edit_entry'] = $request->is_edit_entry(); |
|
| 204 | - $mock_request->returns['is_search'] = $request->is_search(); |
|
| 201 | + $mock_request->returns[ 'is_view' ] = $view; |
|
| 202 | + $mock_request->returns[ 'is_entry' ] = $request->is_entry(); |
|
| 203 | + $mock_request->returns[ 'is_edit_entry' ] = $request->is_edit_entry(); |
|
| 204 | + $mock_request->returns[ 'is_search' ] = $request->is_search(); |
|
| 205 | 205 | |
| 206 | 206 | $request = $mock_request; |
| 207 | 207 | } |
@@ -237,16 +237,16 @@ discard block |
||
| 237 | 237 | $filtered_atts = shortcode_atts( $supported_atts, $passed_atts, 'gravityview' ); |
| 238 | 238 | |
| 239 | 239 | // Only keep the passed attributes after making sure that they're valid pairs |
| 240 | - $filtered_atts = array_intersect_key( (array) $passed_atts, $filtered_atts ); |
|
| 240 | + $filtered_atts = array_intersect_key( (array)$passed_atts, $filtered_atts ); |
|
| 241 | 241 | |
| 242 | 242 | $atts = array(); |
| 243 | 243 | |
| 244 | - foreach( $filtered_atts as $key => $passed_value ) { |
|
| 244 | + foreach ( $filtered_atts as $key => $passed_value ) { |
|
| 245 | 245 | |
| 246 | 246 | // Allow using GravityView merge tags in shortcode attributes, like {get} and {created_by} |
| 247 | 247 | $passed_value = \GravityView_Merge_Tags::replace_variables( $passed_value ); |
| 248 | 248 | |
| 249 | - switch( $defaults[ $key ]['type'] ) { |
|
| 249 | + switch ( $defaults[ $key ][ 'type' ] ) { |
|
| 250 | 250 | |
| 251 | 251 | /** |
| 252 | 252 | * Make sure number fields are numeric. |
@@ -254,7 +254,7 @@ discard block |
||
| 254 | 254 | * @see http://php.net/manual/en/function.is-numeric.php#107326 |
| 255 | 255 | */ |
| 256 | 256 | case 'number': |
| 257 | - if( is_numeric( $passed_value ) ) { |
|
| 257 | + if ( is_numeric( $passed_value ) ) { |
|
| 258 | 258 | $atts[ $key ] = ( $passed_value + 0 ); |
| 259 | 259 | } |
| 260 | 260 | break; |
@@ -269,8 +269,8 @@ discard block |
||
| 269 | 269 | */ |
| 270 | 270 | case 'select': |
| 271 | 271 | case 'radio': |
| 272 | - $options = isset( $defaults[ $key ]['choices'] ) ? $defaults[ $key ]['choices'] : $defaults[ $key ]['options']; |
|
| 273 | - if( in_array( $passed_value, array_keys( $options ) ) ) { |
|
| 272 | + $options = isset( $defaults[ $key ][ 'choices' ] ) ? $defaults[ $key ][ 'choices' ] : $defaults[ $key ][ 'options' ]; |
|
| 273 | + if ( in_array( $passed_value, array_keys( $options ) ) ) { |
|
| 274 | 274 | $atts[ $key ] = $passed_value; |
| 275 | 275 | } |
| 276 | 276 | break; |
@@ -282,7 +282,7 @@ discard block |
||
| 282 | 282 | } |
| 283 | 283 | } |
| 284 | 284 | |
| 285 | - $atts['detail'] = \GV\Utils::get( $passed_atts, 'detail', null ); |
|
| 285 | + $atts[ 'detail' ] = \GV\Utils::get( $passed_atts, 'detail', null ); |
|
| 286 | 286 | |
| 287 | 287 | return $atts; |
| 288 | 288 | } |
@@ -299,7 +299,7 @@ discard block |
||
| 299 | 299 | private function detail( $view, $entries, $atts ) { |
| 300 | 300 | $output = ''; |
| 301 | 301 | |
| 302 | - switch ( $key = $atts['detail'] ): |
|
| 302 | + switch ( $key = $atts[ 'detail' ] ): |
|
| 303 | 303 | case 'total_entries': |
| 304 | 304 | $output = number_format_i18n( $entries->total() ); |
| 305 | 305 | break; |