@@ -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; |
@@ -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 | |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | |
| 76 | 76 | $atts = shortcode_atts( self::$defaults, $atts ); |
| 77 | 77 | |
| 78 | - $atts['action'] = 'edit'; |
|
| 78 | + $atts[ 'action' ] = 'edit'; |
|
| 79 | 79 | |
| 80 | 80 | return $this->shortcode( $atts, $content, $context ); |
| 81 | 81 | } |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | |
| 92 | 92 | $atts = shortcode_atts( self::$defaults, $atts ); |
| 93 | 93 | |
| 94 | - $atts['action'] = 'delete'; |
|
| 94 | + $atts[ 'action' ] = 'delete'; |
|
| 95 | 95 | |
| 96 | 96 | return $this->shortcode( $atts, $content, $context ); |
| 97 | 97 | } |
@@ -131,7 +131,7 @@ discard block |
||
| 131 | 131 | |
| 132 | 132 | $this->settings = shortcode_atts( self::$defaults, $atts, $context ); |
| 133 | 133 | |
| 134 | - $this->view_id = empty( $this->settings['view_id'] ) ? GravityView_View::getInstance()->getViewId() : absint( $this->settings['view_id'] ); |
|
| 134 | + $this->view_id = empty( $this->settings[ 'view_id' ] ) ? GravityView_View::getInstance()->getViewId() : absint( $this->settings[ 'view_id' ] ); |
|
| 135 | 135 | |
| 136 | 136 | if ( empty( $this->view_id ) ) { |
| 137 | 137 | gravityview()->log->error( 'A View ID was not defined and we are not inside a View' ); |
@@ -139,10 +139,10 @@ discard block |
||
| 139 | 139 | return null; |
| 140 | 140 | } |
| 141 | 141 | |
| 142 | - $this->entry = $this->get_entry( $this->settings['entry_id'] ); |
|
| 142 | + $this->entry = $this->get_entry( $this->settings[ 'entry_id' ] ); |
|
| 143 | 143 | |
| 144 | 144 | if ( empty( $this->entry ) ) { |
| 145 | - gravityview()->log->error( 'An Entry ID was not defined or found. Entry ID: {entry_id}', array( 'entry_id' => $this->settings['entry_id'] ) ); |
|
| 145 | + gravityview()->log->error( 'An Entry ID was not defined or found. Entry ID: {entry_id}', array( 'entry_id' => $this->settings[ 'entry_id' ] ) ); |
|
| 146 | 146 | |
| 147 | 147 | return null; |
| 148 | 148 | } |
@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | gravityview()->log->debug( '{context} atts:', array( 'context' => $context, 'data' => $atts ) ); |
| 151 | 151 | |
| 152 | 152 | if ( ! $this->has_cap() ) { |
| 153 | - gravityview()->log->error( 'User does not have the capability to {action} this entry: {entry_id}', array( 'action' => esc_attr( $this->settings['action'] ), 'entry_id' => $this->entry['id'] ) ); |
|
| 153 | + gravityview()->log->error( 'User does not have the capability to {action} this entry: {entry_id}', array( 'action' => esc_attr( $this->settings[ 'action' ] ), 'entry_id' => $this->entry[ 'id' ] ) ); |
|
| 154 | 154 | |
| 155 | 155 | return null; |
| 156 | 156 | } |
@@ -164,7 +164,7 @@ discard block |
||
| 164 | 164 | } |
| 165 | 165 | |
| 166 | 166 | // Get just the URL, not the tag |
| 167 | - if ( 'url' === $this->settings['return'] ) { |
|
| 167 | + if ( 'url' === $this->settings[ 'return' ] ) { |
|
| 168 | 168 | return $url; |
| 169 | 169 | } |
| 170 | 170 | |
@@ -185,13 +185,13 @@ discard block |
||
| 185 | 185 | */ |
| 186 | 186 | private function get_link_atts() { |
| 187 | 187 | |
| 188 | - wp_parse_str( $this->settings['link_atts'], $link_atts ); |
|
| 188 | + wp_parse_str( $this->settings[ 'link_atts' ], $link_atts ); |
|
| 189 | 189 | |
| 190 | - if ( 'delete' === $this->settings['action'] ) { |
|
| 191 | - $link_atts['onclick'] = isset( $link_atts['onclick'] ) ? $link_atts['onclick'] : GravityView_Delete_Entry::get_confirm_dialog(); |
|
| 190 | + if ( 'delete' === $this->settings[ 'action' ] ) { |
|
| 191 | + $link_atts[ 'onclick' ] = isset( $link_atts[ 'onclick' ] ) ? $link_atts[ 'onclick' ] : GravityView_Delete_Entry::get_confirm_dialog(); |
|
| 192 | 192 | } |
| 193 | 193 | |
| 194 | - return (array) $link_atts; |
|
| 194 | + return (array)$link_atts; |
|
| 195 | 195 | } |
| 196 | 196 | |
| 197 | 197 | /** |
@@ -211,7 +211,7 @@ discard block |
||
| 211 | 211 | return do_shortcode( $content ); |
| 212 | 212 | } |
| 213 | 213 | |
| 214 | - switch ( $this->settings['action'] ) { |
|
| 214 | + switch ( $this->settings[ 'action' ] ) { |
|
| 215 | 215 | case 'edit': |
| 216 | 216 | $anchor_text = __( 'Edit Entry', 'gravityview' ); |
| 217 | 217 | break; |
@@ -239,9 +239,9 @@ discard block |
||
| 239 | 239 | private function get_url() { |
| 240 | 240 | |
| 241 | 241 | // if post_id is not defined, default to view_id |
| 242 | - $post_id = empty( $this->settings['post_id'] ) ? $this->view_id : $this->settings['post_id']; |
|
| 242 | + $post_id = empty( $this->settings[ 'post_id' ] ) ? $this->view_id : $this->settings[ 'post_id' ]; |
|
| 243 | 243 | |
| 244 | - switch ( $this->settings['action'] ) { |
|
| 244 | + switch ( $this->settings[ 'action' ] ) { |
|
| 245 | 245 | case 'edit': |
| 246 | 246 | $url = GravityView_Edit_Entry::get_edit_link( $this->entry, $this->view_id, $post_id ); |
| 247 | 247 | break; |
@@ -266,7 +266,7 @@ discard block |
||
| 266 | 266 | */ |
| 267 | 267 | private function has_cap() { |
| 268 | 268 | |
| 269 | - switch ( $this->settings['action'] ) { |
|
| 269 | + switch ( $this->settings[ 'action' ] ) { |
|
| 270 | 270 | case 'edit': |
| 271 | 271 | $has_cap = GravityView_Edit_Entry::check_user_cap_edit_entry( $this->entry, $this->view_id ); |
| 272 | 272 | break; |
@@ -331,9 +331,9 @@ discard block |
||
| 331 | 331 | */ |
| 332 | 332 | private function maybe_add_field_values_query_args( $url ) { |
| 333 | 333 | |
| 334 | - if ( $url && ! empty( $this->settings['field_values'] ) ) { |
|
| 334 | + if ( $url && ! empty( $this->settings[ 'field_values' ] ) ) { |
|
| 335 | 335 | |
| 336 | - wp_parse_str( $this->settings['field_values'], $field_values ); |
|
| 336 | + wp_parse_str( $this->settings[ 'field_values' ], $field_values ); |
|
| 337 | 337 | |
| 338 | 338 | $url = add_query_arg( $field_values, $url ); |
| 339 | 339 | } |
@@ -28,31 +28,31 @@ discard block |
||
| 28 | 28 | add_filter( 'gravityview_blacklist_field_types', array( $this, 'default_field_blacklist' ), 10, 2 ); |
| 29 | 29 | |
| 30 | 30 | // Tooltips |
| 31 | - add_filter( 'gform_tooltips', array( $this, 'tooltips') ); |
|
| 31 | + add_filter( 'gform_tooltips', array( $this, 'tooltips' ) ); |
|
| 32 | 32 | |
| 33 | 33 | // adding styles and scripts |
| 34 | - add_action( 'admin_enqueue_scripts', array( 'GravityView_Admin_Views', 'add_scripts_and_styles'), 999 ); |
|
| 35 | - add_filter( 'gform_noconflict_styles', array( $this, 'register_no_conflict') ); |
|
| 36 | - add_filter( 'gform_noconflict_scripts', array( $this, 'register_no_conflict') ); |
|
| 37 | - add_filter( 'gravityview_noconflict_styles', array( $this, 'register_no_conflict') ); |
|
| 38 | - add_filter( 'gravityview_noconflict_scripts', array( $this, 'register_no_conflict') ); |
|
| 39 | - |
|
| 40 | - add_action( 'gravityview_render_directory_active_areas', array( $this, 'render_directory_active_areas'), 10, 4 ); |
|
| 41 | - add_action( 'gravityview_render_widgets_active_areas', array( $this, 'render_widgets_active_areas'), 10, 3 ); |
|
| 42 | - add_action( 'gravityview_render_field_pickers', array( $this, 'render_field_pickers') ); |
|
| 43 | - add_action( 'gravityview_render_available_fields', array( $this, 'render_available_fields'), 10, 2 ); |
|
| 44 | - add_action( 'gravityview_render_available_widgets', array( $this, 'render_available_widgets') ); |
|
| 45 | - add_action( 'gravityview_render_active_areas', array( $this, 'render_active_areas'), 10, 5 ); |
|
| 34 | + add_action( 'admin_enqueue_scripts', array( 'GravityView_Admin_Views', 'add_scripts_and_styles' ), 999 ); |
|
| 35 | + add_filter( 'gform_noconflict_styles', array( $this, 'register_no_conflict' ) ); |
|
| 36 | + add_filter( 'gform_noconflict_scripts', array( $this, 'register_no_conflict' ) ); |
|
| 37 | + add_filter( 'gravityview_noconflict_styles', array( $this, 'register_no_conflict' ) ); |
|
| 38 | + add_filter( 'gravityview_noconflict_scripts', array( $this, 'register_no_conflict' ) ); |
|
| 39 | + |
|
| 40 | + add_action( 'gravityview_render_directory_active_areas', array( $this, 'render_directory_active_areas' ), 10, 4 ); |
|
| 41 | + add_action( 'gravityview_render_widgets_active_areas', array( $this, 'render_widgets_active_areas' ), 10, 3 ); |
|
| 42 | + add_action( 'gravityview_render_field_pickers', array( $this, 'render_field_pickers' ) ); |
|
| 43 | + add_action( 'gravityview_render_available_fields', array( $this, 'render_available_fields' ), 10, 2 ); |
|
| 44 | + add_action( 'gravityview_render_available_widgets', array( $this, 'render_available_widgets' ) ); |
|
| 45 | + add_action( 'gravityview_render_active_areas', array( $this, 'render_active_areas' ), 10, 5 ); |
|
| 46 | 46 | |
| 47 | 47 | // @todo check if this hook is needed.. |
| 48 | 48 | //add_action( 'gravityview_render_field_options', array( $this, 'render_field_options'), 10, 9 ); |
| 49 | 49 | |
| 50 | 50 | // Add Connected Form column |
| 51 | - add_filter('manage_gravityview_posts_columns' , array( $this, 'add_post_type_columns' ) ); |
|
| 51 | + add_filter( 'manage_gravityview_posts_columns', array( $this, 'add_post_type_columns' ) ); |
|
| 52 | 52 | |
| 53 | 53 | add_filter( 'gform_toolbar_menu', array( 'GravityView_Admin_Views', 'gform_toolbar_menu' ), 10, 2 ); |
| 54 | 54 | |
| 55 | - add_action( 'manage_gravityview_posts_custom_column', array( $this, 'add_custom_column_content'), 10, 2 ); |
|
| 55 | + add_action( 'manage_gravityview_posts_custom_column', array( $this, 'add_custom_column_content' ), 10, 2 ); |
|
| 56 | 56 | |
| 57 | 57 | add_action( 'restrict_manage_posts', array( $this, 'add_view_dropdown' ) ); |
| 58 | 58 | |
@@ -71,11 +71,11 @@ discard block |
||
| 71 | 71 | */ |
| 72 | 72 | function suggest_support_articles( $localization_data = array() ) { |
| 73 | 73 | |
| 74 | - if( ! gravityview()->request->is_view() ) { |
|
| 74 | + if ( ! gravityview()->request->is_view() ) { |
|
| 75 | 75 | return $localization_data; |
| 76 | 76 | } |
| 77 | 77 | |
| 78 | - $localization_data['suggest'] = array( |
|
| 78 | + $localization_data[ 'suggest' ] = array( |
|
| 79 | 79 | '57ef23539033602e61d4a560', |
| 80 | 80 | '54c67bb9e4b0512429885513', |
| 81 | 81 | '54c67bb9e4b0512429885512', |
@@ -96,13 +96,13 @@ discard block |
||
| 96 | 96 | public function filter_pre_get_posts_by_gravityview_form_id( &$query ) { |
| 97 | 97 | global $pagenow; |
| 98 | 98 | |
| 99 | - if ( !is_admin() ) { |
|
| 99 | + if ( ! is_admin() ) { |
|
| 100 | 100 | return; |
| 101 | 101 | } |
| 102 | 102 | |
| 103 | - $form_id = isset( $_GET['gravityview_form_id'] ) ? (int) $_GET['gravityview_form_id'] : false; |
|
| 103 | + $form_id = isset( $_GET[ 'gravityview_form_id' ] ) ? (int)$_GET[ 'gravityview_form_id' ] : false; |
|
| 104 | 104 | |
| 105 | - if( 'edit.php' !== $pagenow || ! $form_id || ! isset( $query->query_vars[ 'post_type' ] ) ) { |
|
| 105 | + if ( 'edit.php' !== $pagenow || ! $form_id || ! isset( $query->query_vars[ 'post_type' ] ) ) { |
|
| 106 | 106 | return; |
| 107 | 107 | } |
| 108 | 108 | |
@@ -119,18 +119,18 @@ discard block |
||
| 119 | 119 | function add_view_dropdown() { |
| 120 | 120 | $current_screen = get_current_screen(); |
| 121 | 121 | |
| 122 | - if( 'gravityview' !== $current_screen->post_type ) { |
|
| 122 | + if ( 'gravityview' !== $current_screen->post_type ) { |
|
| 123 | 123 | return; |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | $forms = gravityview_get_forms(); |
| 127 | 127 | $current_form = \GV\Utils::_GET( 'gravityview_form_id' ); |
| 128 | 128 | // If there are no forms to select, show no forms. |
| 129 | - if( !empty( $forms ) ) { ?> |
|
| 129 | + if ( ! empty( $forms ) ) { ?> |
|
| 130 | 130 | <select name="gravityview_form_id" id="gravityview_form_id"> |
| 131 | 131 | <option value="" <?php selected( '', $current_form, true ); ?>><?php esc_html_e( 'All forms', 'gravityview' ); ?></option> |
| 132 | - <?php foreach( $forms as $form ) { ?> |
|
| 133 | - <option value="<?php echo $form['id']; ?>" <?php selected( $form['id'], $current_form, true ); ?>><?php echo esc_html( $form['title'] ); ?></option> |
|
| 132 | + <?php foreach ( $forms as $form ) { ?> |
|
| 133 | + <option value="<?php echo $form[ 'id' ]; ?>" <?php selected( $form[ 'id' ], $current_form, true ); ?>><?php echo esc_html( $form[ 'title' ] ); ?></option> |
|
| 134 | 134 | <?php } ?> |
| 135 | 135 | </select> |
| 136 | 136 | <?php } |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | */ |
| 144 | 144 | public static function render_setting_row( $key = '', $current_settings = array(), $override_input = null, $name = 'template_settings[%s]', $id = 'gravityview_se_%s' ) { |
| 145 | 145 | _deprecated_function( 'GravityView_Admin_Views::render_setting_row', '1.1.7', 'GravityView_Render_Settings::render_setting_row' ); |
| 146 | - GravityView_Render_Settings::render_setting_row( $key, $current_settings, $override_input, $name , $id ); |
|
| 146 | + GravityView_Render_Settings::render_setting_row( $key, $current_settings, $override_input, $name, $id ); |
|
| 147 | 147 | } |
| 148 | 148 | |
| 149 | 149 | /** |
@@ -166,9 +166,9 @@ discard block |
||
| 166 | 166 | |
| 167 | 167 | $connected_views = gravityview_get_connected_views( $id, array( 'post_status' => 'any' ) ); |
| 168 | 168 | |
| 169 | - if( empty( $connected_views ) ) { |
|
| 169 | + if ( empty( $connected_views ) ) { |
|
| 170 | 170 | |
| 171 | - $menu_items['gravityview'] = array( |
|
| 171 | + $menu_items[ 'gravityview' ] = array( |
|
| 172 | 172 | 'label' => esc_attr__( 'Create a View', 'gravityview' ), |
| 173 | 173 | 'icon' => '<i class="fa fa-lg gv-icon-astronaut-head gv-icon"></i>', |
| 174 | 174 | 'title' => esc_attr__( 'Create a View using this form as a data source', 'gravityview' ), |
@@ -184,22 +184,22 @@ discard block |
||
| 184 | 184 | $sub_menu_items = array(); |
| 185 | 185 | foreach ( (array)$connected_views as $view ) { |
| 186 | 186 | |
| 187 | - if( ! GVCommon::has_cap( 'edit_gravityview', $view->ID ) ) { |
|
| 187 | + if ( ! GVCommon::has_cap( 'edit_gravityview', $view->ID ) ) { |
|
| 188 | 188 | continue; |
| 189 | 189 | } |
| 190 | 190 | |
| 191 | - $label = empty( $view->post_title ) ? sprintf( __('No Title (View #%d)', 'gravityview' ), $view->ID ) : $view->post_title; |
|
| 191 | + $label = empty( $view->post_title ) ? sprintf( __( 'No Title (View #%d)', 'gravityview' ), $view->ID ) : $view->post_title; |
|
| 192 | 192 | |
| 193 | - $sub_menu_items[] = array( |
|
| 193 | + $sub_menu_items[ ] = array( |
|
| 194 | 194 | 'label' => esc_attr( $label ), |
| 195 | - 'url' => admin_url( 'post.php?action=edit&post='.$view->ID ), |
|
| 195 | + 'url' => admin_url( 'post.php?action=edit&post=' . $view->ID ), |
|
| 196 | 196 | ); |
| 197 | 197 | } |
| 198 | 198 | |
| 199 | 199 | // If there were no items added, then let's create the parent menu |
| 200 | - if( $sub_menu_items ) { |
|
| 200 | + if ( $sub_menu_items ) { |
|
| 201 | 201 | |
| 202 | - $sub_menu_items[] = array( |
|
| 202 | + $sub_menu_items[ ] = array( |
|
| 203 | 203 | 'label' => esc_attr__( 'Create a View', 'gravityview' ), |
| 204 | 204 | 'link_class' => 'gv-create-view', |
| 205 | 205 | 'title' => esc_attr__( 'Create a View using this form as a data source', 'gravityview' ), |
@@ -208,14 +208,14 @@ discard block |
||
| 208 | 208 | ); |
| 209 | 209 | |
| 210 | 210 | // Make sure Gravity Forms uses the submenu; if there's only one item, it uses a link instead of a dropdown |
| 211 | - $sub_menu_items[] = array( |
|
| 211 | + $sub_menu_items[ ] = array( |
|
| 212 | 212 | 'url' => '#', |
| 213 | 213 | 'label' => '', |
| 214 | 214 | 'menu_class' => 'hidden', |
| 215 | 215 | 'capabilities' => '', |
| 216 | 216 | ); |
| 217 | 217 | |
| 218 | - $menu_items['gravityview'] = array( |
|
| 218 | + $menu_items[ 'gravityview' ] = array( |
|
| 219 | 219 | 'label' => __( 'Connected Views', 'gravityview' ), |
| 220 | 220 | 'icon' => '<i class="fa fa-lg gv-icon-astronaut-head gv-icon"></i>', |
| 221 | 221 | 'title' => __( 'GravityView Views using this form as a data source', 'gravityview' ), |
@@ -244,8 +244,8 @@ discard block |
||
| 244 | 244 | $add = array( 'captcha', 'page' ); |
| 245 | 245 | |
| 246 | 246 | // Don't allowing editing the following values: |
| 247 | - if( $context === 'edit' ) { |
|
| 248 | - $add[] = 'post_id'; |
|
| 247 | + if ( $context === 'edit' ) { |
|
| 248 | + $add[ ] = 'post_id'; |
|
| 249 | 249 | } |
| 250 | 250 | |
| 251 | 251 | $return = array_merge( $array, $add ); |
@@ -268,32 +268,32 @@ discard block |
||
| 268 | 268 | foreach ( $default_args as $key => $arg ) { |
| 269 | 269 | |
| 270 | 270 | // If an arg has `tooltip` defined, but it's false, don't display a tooltip |
| 271 | - if( isset( $arg['tooltip'] ) && empty( $arg['tooltip'] ) ) { continue; } |
|
| 271 | + if ( isset( $arg[ 'tooltip' ] ) && empty( $arg[ 'tooltip' ] ) ) { continue; } |
|
| 272 | 272 | |
| 273 | 273 | // By default, use `tooltip` if defined. |
| 274 | - $tooltip = empty( $arg['tooltip'] ) ? NULL : $arg['tooltip']; |
|
| 274 | + $tooltip = empty( $arg[ 'tooltip' ] ) ? NULL : $arg[ 'tooltip' ]; |
|
| 275 | 275 | |
| 276 | 276 | // Otherwise, use the description as a tooltip. |
| 277 | - if( empty( $tooltip ) && !empty( $arg['desc'] ) ) { |
|
| 278 | - $tooltip = $arg['desc']; |
|
| 277 | + if ( empty( $tooltip ) && ! empty( $arg[ 'desc' ] ) ) { |
|
| 278 | + $tooltip = $arg[ 'desc' ]; |
|
| 279 | 279 | } |
| 280 | 280 | |
| 281 | 281 | // If there's no tooltip set, continue |
| 282 | - if( empty( $tooltip ) ) { |
|
| 282 | + if ( empty( $tooltip ) ) { |
|
| 283 | 283 | continue; |
| 284 | 284 | } |
| 285 | 285 | |
| 286 | 286 | // Add the tooltip |
| 287 | - $gv_tooltips[ 'gv_'.$key ] = array( |
|
| 288 | - 'title' => $arg['label'], |
|
| 287 | + $gv_tooltips[ 'gv_' . $key ] = array( |
|
| 288 | + 'title' => $arg[ 'label' ], |
|
| 289 | 289 | 'value' => $tooltip, |
| 290 | 290 | ); |
| 291 | 291 | |
| 292 | 292 | } |
| 293 | 293 | |
| 294 | - $gv_tooltips['gv_css_merge_tags'] = array( |
|
| 295 | - 'title' => __('CSS Merge Tags', 'gravityview'), |
|
| 296 | - 'value' => sprintf( __( 'Developers: The CSS classes will be sanitized using the %ssanitize_title_with_dashes()%s function.', 'gravityview'), '<code>', '</code>' ) |
|
| 294 | + $gv_tooltips[ 'gv_css_merge_tags' ] = array( |
|
| 295 | + 'title' => __( 'CSS Merge Tags', 'gravityview' ), |
|
| 296 | + 'value' => sprintf( __( 'Developers: The CSS classes will be sanitized using the %ssanitize_title_with_dashes()%s function.', 'gravityview' ), '<code>', '</code>' ) |
|
| 297 | 297 | ); |
| 298 | 298 | |
| 299 | 299 | /** |
@@ -311,9 +311,9 @@ discard block |
||
| 311 | 311 | |
| 312 | 312 | foreach ( $gv_tooltips as $key => $tooltip ) { |
| 313 | 313 | |
| 314 | - $title = empty( $tooltip['title'] ) ? '' : '<h6>'.esc_html( $tooltip['title'] ) .'</h6>'; |
|
| 314 | + $title = empty( $tooltip[ 'title' ] ) ? '' : '<h6>' . esc_html( $tooltip[ 'title' ] ) . '</h6>'; |
|
| 315 | 315 | |
| 316 | - $tooltips[ $key ] = $title . wpautop( esc_html( $tooltip['value'] ) ); |
|
| 316 | + $tooltips[ $key ] = $title . wpautop( esc_html( $tooltip[ 'value' ] ) ); |
|
| 317 | 317 | } |
| 318 | 318 | |
| 319 | 319 | return $tooltips; |
@@ -327,7 +327,7 @@ discard block |
||
| 327 | 327 | * |
| 328 | 328 | * @return void |
| 329 | 329 | */ |
| 330 | - public function add_custom_column_content( $column_name = NULL, $post_id ) { |
|
| 330 | + public function add_custom_column_content( $column_name = NULL, $post_id ) { |
|
| 331 | 331 | |
| 332 | 332 | $output = ''; |
| 333 | 333 | |
@@ -349,7 +349,7 @@ discard block |
||
| 349 | 349 | // Generate backup if label doesn't exist: `example_name` => `Example Name` |
| 350 | 350 | $template_id_pretty = ucwords( implode( ' ', explode( '_', $template_id ) ) ); |
| 351 | 351 | |
| 352 | - $output = $template ? $template['label'] : $template_id_pretty; |
|
| 352 | + $output = $template ? $template[ 'label' ] : $template_id_pretty; |
|
| 353 | 353 | |
| 354 | 354 | break; |
| 355 | 355 | |
@@ -390,44 +390,44 @@ discard block |
||
| 390 | 390 | static public function get_connected_form_links( $form, $include_form_link = true ) { |
| 391 | 391 | |
| 392 | 392 | // Either the form is empty or the form ID is 0, not yet set. |
| 393 | - if( empty( $form ) ) { |
|
| 393 | + if ( empty( $form ) ) { |
|
| 394 | 394 | return ''; |
| 395 | 395 | } |
| 396 | 396 | |
| 397 | 397 | // The $form is passed as the form ID |
| 398 | - if( !is_array( $form ) ) { |
|
| 398 | + if ( ! is_array( $form ) ) { |
|
| 399 | 399 | $form = gravityview_get_form( $form ); |
| 400 | 400 | } |
| 401 | 401 | |
| 402 | - $form_id = $form['id']; |
|
| 402 | + $form_id = $form[ 'id' ]; |
|
| 403 | 403 | $links = array(); |
| 404 | 404 | |
| 405 | - if( GVCommon::has_cap( 'gravityforms_edit_forms' ) ) { |
|
| 405 | + if ( GVCommon::has_cap( 'gravityforms_edit_forms' ) ) { |
|
| 406 | 406 | $form_url = admin_url( sprintf( 'admin.php?page=gf_edit_forms&id=%d', $form_id ) ); |
| 407 | - $form_link = '<strong class="gv-form-title">'.gravityview_get_link( $form_url, $form['title'], 'class=row-title' ).'</strong>'; |
|
| 408 | - $links[] = '<span>'.gravityview_get_link( $form_url, __('Edit Form', 'gravityview') ).'</span>'; |
|
| 407 | + $form_link = '<strong class="gv-form-title">' . gravityview_get_link( $form_url, $form[ 'title' ], 'class=row-title' ) . '</strong>'; |
|
| 408 | + $links[ ] = '<span>' . gravityview_get_link( $form_url, __( 'Edit Form', 'gravityview' ) ) . '</span>'; |
|
| 409 | 409 | } else { |
| 410 | - $form_link = '<strong class="gv-form-title">'. esc_html( $form['title'] ). '</strong>'; |
|
| 410 | + $form_link = '<strong class="gv-form-title">' . esc_html( $form[ 'title' ] ) . '</strong>'; |
|
| 411 | 411 | } |
| 412 | 412 | |
| 413 | - if( GVCommon::has_cap( 'gravityforms_view_entries' ) ) { |
|
| 413 | + if ( GVCommon::has_cap( 'gravityforms_view_entries' ) ) { |
|
| 414 | 414 | $entries_url = admin_url( sprintf( 'admin.php?page=gf_entries&id=%d', $form_id ) ); |
| 415 | - $links[] = '<span>'.gravityview_get_link( $entries_url, __('Entries', 'gravityview') ).'</span>'; |
|
| 415 | + $links[ ] = '<span>' . gravityview_get_link( $entries_url, __( 'Entries', 'gravityview' ) ) . '</span>'; |
|
| 416 | 416 | } |
| 417 | 417 | |
| 418 | - if( GVCommon::has_cap( array( 'gravityforms_edit_settings', 'gravityview_view_settings' ) ) ) { |
|
| 418 | + if ( GVCommon::has_cap( array( 'gravityforms_edit_settings', 'gravityview_view_settings' ) ) ) { |
|
| 419 | 419 | $settings_url = admin_url( sprintf( 'admin.php?page=gf_edit_forms&view=settings&id=%d', $form_id ) ); |
| 420 | - $links[] = '<span>'.gravityview_get_link( $settings_url, __('Settings', 'gravityview'), 'title='.__('Edit settings for this form', 'gravityview') ).'</span>'; |
|
| 420 | + $links[ ] = '<span>' . gravityview_get_link( $settings_url, __( 'Settings', 'gravityview' ), 'title=' . __( 'Edit settings for this form', 'gravityview' ) ) . '</span>'; |
|
| 421 | 421 | } |
| 422 | 422 | |
| 423 | - if( GVCommon::has_cap( array("gravityforms_edit_forms", "gravityforms_create_form", "gravityforms_preview_forms") ) ) { |
|
| 423 | + if ( GVCommon::has_cap( array( "gravityforms_edit_forms", "gravityforms_create_form", "gravityforms_preview_forms" ) ) ) { |
|
| 424 | 424 | $preview_url = site_url( sprintf( '?gf_page=preview&id=%d', $form_id ) ); |
| 425 | - $links[] = '<span>'.gravityview_get_link( $preview_url, __('Preview Form', 'gravityview'), 'title='.__('Preview this form', 'gravityview') ).'</span>'; |
|
| 425 | + $links[ ] = '<span>' . gravityview_get_link( $preview_url, __( 'Preview Form', 'gravityview' ), 'title=' . __( 'Preview this form', 'gravityview' ) ) . '</span>'; |
|
| 426 | 426 | } |
| 427 | 427 | |
| 428 | 428 | $output = ''; |
| 429 | 429 | |
| 430 | - if( !empty( $include_form_link ) ) { |
|
| 430 | + if ( ! empty( $include_form_link ) ) { |
|
| 431 | 431 | $output .= $form_link; |
| 432 | 432 | } |
| 433 | 433 | |
@@ -439,7 +439,7 @@ discard block |
||
| 439 | 439 | */ |
| 440 | 440 | $links = apply_filters( 'gravityview_connected_form_links', $links, $form ); |
| 441 | 441 | |
| 442 | - $output .= '<div class="row-actions">'. implode( ' | ', $links ) .'</div>'; |
|
| 442 | + $output .= '<div class="row-actions">' . implode( ' | ', $links ) . '</div>'; |
|
| 443 | 443 | |
| 444 | 444 | return $output; |
| 445 | 445 | } |
@@ -453,8 +453,8 @@ discard block |
||
| 453 | 453 | // Get the date column and save it for later to add back in. |
| 454 | 454 | // This adds it after the Data Source column. |
| 455 | 455 | // This way, we don't need to do array_slice, array_merge, etc. |
| 456 | - $date = $columns['date']; |
|
| 457 | - unset( $columns['date'] ); |
|
| 456 | + $date = $columns[ 'date' ]; |
|
| 457 | + unset( $columns[ 'date' ] ); |
|
| 458 | 458 | |
| 459 | 459 | $data_source_required_caps = array( |
| 460 | 460 | 'gravityforms_edit_forms', |
@@ -465,14 +465,14 @@ discard block |
||
| 465 | 465 | 'gravityforms_preview_forms', |
| 466 | 466 | ); |
| 467 | 467 | |
| 468 | - if( GVCommon::has_cap( $data_source_required_caps ) ) { |
|
| 469 | - $columns['gv_connected_form'] = __( 'Data Source', 'gravityview' ); |
|
| 468 | + if ( GVCommon::has_cap( $data_source_required_caps ) ) { |
|
| 469 | + $columns[ 'gv_connected_form' ] = __( 'Data Source', 'gravityview' ); |
|
| 470 | 470 | } |
| 471 | 471 | |
| 472 | - $columns['gv_template'] = _x( 'Template', 'Column title that shows what template is being used for Views', 'gravityview' ); |
|
| 472 | + $columns[ 'gv_template' ] = _x( 'Template', 'Column title that shows what template is being used for Views', 'gravityview' ); |
|
| 473 | 473 | |
| 474 | 474 | // Add the date back in. |
| 475 | - $columns['date'] = $date; |
|
| 475 | + $columns[ 'date' ] = $date; |
|
| 476 | 476 | |
| 477 | 477 | return $columns; |
| 478 | 478 | } |
@@ -486,12 +486,12 @@ discard block |
||
| 486 | 486 | */ |
| 487 | 487 | function save_postdata( $post_id ) { |
| 488 | 488 | |
| 489 | - if( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ){ |
|
| 489 | + if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) { |
|
| 490 | 490 | return; |
| 491 | 491 | } |
| 492 | 492 | |
| 493 | 493 | // validate post_type |
| 494 | - if ( ! isset( $_POST['post_type'] ) || 'gravityview' != $_POST['post_type'] ) { |
|
| 494 | + if ( ! isset( $_POST[ 'post_type' ] ) || 'gravityview' != $_POST[ 'post_type' ] ) { |
|
| 495 | 495 | return; |
| 496 | 496 | } |
| 497 | 497 | |
@@ -506,64 +506,64 @@ discard block |
||
| 506 | 506 | $statii = array(); |
| 507 | 507 | |
| 508 | 508 | // check if this is a start fresh View |
| 509 | - if ( isset( $_POST['gravityview_select_form_nonce'] ) && wp_verify_nonce( $_POST['gravityview_select_form_nonce'], 'gravityview_select_form' ) ) { |
|
| 509 | + if ( isset( $_POST[ 'gravityview_select_form_nonce' ] ) && wp_verify_nonce( $_POST[ 'gravityview_select_form_nonce' ], 'gravityview_select_form' ) ) { |
|
| 510 | 510 | |
| 511 | - $form_id = !empty( $_POST['gravityview_form_id'] ) ? $_POST['gravityview_form_id'] : ''; |
|
| 511 | + $form_id = ! empty( $_POST[ 'gravityview_form_id' ] ) ? $_POST[ 'gravityview_form_id' ] : ''; |
|
| 512 | 512 | // save form id |
| 513 | - $statii['form_id'] = update_post_meta( $post_id, '_gravityview_form_id', $form_id ); |
|
| 513 | + $statii[ 'form_id' ] = update_post_meta( $post_id, '_gravityview_form_id', $form_id ); |
|
| 514 | 514 | |
| 515 | 515 | } |
| 516 | 516 | |
| 517 | - if( false === GVCommon::has_cap( 'gravityforms_create_form' ) && empty( $statii['form_id'] ) ) { |
|
| 517 | + if ( false === GVCommon::has_cap( 'gravityforms_create_form' ) && empty( $statii[ 'form_id' ] ) ) { |
|
| 518 | 518 | gravityview()->log->error( 'Current user does not have the capability to create a new Form.', array( 'data' => wp_get_current_user() ) ); |
| 519 | 519 | return; |
| 520 | 520 | } |
| 521 | 521 | |
| 522 | 522 | // Was this a start fresh? |
| 523 | - if ( ! empty( $_POST['gravityview_form_id_start_fresh'] ) ) { |
|
| 524 | - $statii['start_fresh'] = add_post_meta( $post_id, '_gravityview_start_fresh', 1 ); |
|
| 523 | + if ( ! empty( $_POST[ 'gravityview_form_id_start_fresh' ] ) ) { |
|
| 524 | + $statii[ 'start_fresh' ] = add_post_meta( $post_id, '_gravityview_start_fresh', 1 ); |
|
| 525 | 525 | } else { |
| 526 | - $statii['start_fresh'] = delete_post_meta( $post_id, '_gravityview_start_fresh' ); |
|
| 526 | + $statii[ 'start_fresh' ] = delete_post_meta( $post_id, '_gravityview_start_fresh' ); |
|
| 527 | 527 | } |
| 528 | 528 | |
| 529 | 529 | // Check if we have a template id |
| 530 | - if ( isset( $_POST['gravityview_select_template_nonce'] ) && wp_verify_nonce( $_POST['gravityview_select_template_nonce'], 'gravityview_select_template' ) ) { |
|
| 530 | + if ( isset( $_POST[ 'gravityview_select_template_nonce' ] ) && wp_verify_nonce( $_POST[ 'gravityview_select_template_nonce' ], 'gravityview_select_template' ) ) { |
|
| 531 | 531 | |
| 532 | - $template_id = !empty( $_POST['gravityview_directory_template'] ) ? $_POST['gravityview_directory_template'] : ''; |
|
| 532 | + $template_id = ! empty( $_POST[ 'gravityview_directory_template' ] ) ? $_POST[ 'gravityview_directory_template' ] : ''; |
|
| 533 | 533 | |
| 534 | 534 | // now save template id |
| 535 | - $statii['directory_template'] = update_post_meta( $post_id, '_gravityview_directory_template', $template_id ); |
|
| 535 | + $statii[ 'directory_template' ] = update_post_meta( $post_id, '_gravityview_directory_template', $template_id ); |
|
| 536 | 536 | } |
| 537 | 537 | |
| 538 | 538 | |
| 539 | 539 | // save View Configuration metabox |
| 540 | - if ( isset( $_POST['gravityview_view_configuration_nonce'] ) && wp_verify_nonce( $_POST['gravityview_view_configuration_nonce'], 'gravityview_view_configuration' ) ) { |
|
| 540 | + if ( isset( $_POST[ 'gravityview_view_configuration_nonce' ] ) && wp_verify_nonce( $_POST[ 'gravityview_view_configuration_nonce' ], 'gravityview_view_configuration' ) ) { |
|
| 541 | 541 | |
| 542 | 542 | // template settings |
| 543 | - if( empty( $_POST['template_settings'] ) ) { |
|
| 544 | - $_POST['template_settings'] = array(); |
|
| 543 | + if ( empty( $_POST[ 'template_settings' ] ) ) { |
|
| 544 | + $_POST[ 'template_settings' ] = array(); |
|
| 545 | 545 | } |
| 546 | - $statii['template_settings'] = update_post_meta( $post_id, '_gravityview_template_settings', $_POST['template_settings'] ); |
|
| 546 | + $statii[ 'template_settings' ] = update_post_meta( $post_id, '_gravityview_template_settings', $_POST[ 'template_settings' ] ); |
|
| 547 | 547 | |
| 548 | 548 | $fields = array(); |
| 549 | 549 | |
| 550 | 550 | // Directory&single Visible Fields |
| 551 | - if( !empty( $preset_fields ) ) { |
|
| 551 | + if ( ! empty( $preset_fields ) ) { |
|
| 552 | 552 | |
| 553 | 553 | $fields = $preset_fields; |
| 554 | 554 | |
| 555 | - } elseif( !empty( $_POST['gv_fields'] ) ) { |
|
| 555 | + } elseif ( ! empty( $_POST[ 'gv_fields' ] ) ) { |
|
| 556 | 556 | $fields = _gravityview_process_posted_fields(); |
| 557 | 557 | } |
| 558 | 558 | |
| 559 | 559 | $fields = map_deep( $fields, 'addslashes' ); |
| 560 | - $statii['directory_fields'] = update_post_meta( $post_id, '_gravityview_directory_fields', $fields ); |
|
| 560 | + $statii[ 'directory_fields' ] = update_post_meta( $post_id, '_gravityview_directory_fields', $fields ); |
|
| 561 | 561 | |
| 562 | 562 | // Directory Visible Widgets |
| 563 | - if( empty( $_POST['widgets'] ) ) { |
|
| 564 | - $_POST['widgets'] = array(); |
|
| 563 | + if ( empty( $_POST[ 'widgets' ] ) ) { |
|
| 564 | + $_POST[ 'widgets' ] = array(); |
|
| 565 | 565 | } |
| 566 | - $statii['directory_widgets'] = gravityview_set_directory_widgets( $post_id, $_POST['widgets'] ); |
|
| 566 | + $statii[ 'directory_widgets' ] = gravityview_set_directory_widgets( $post_id, $_POST[ 'widgets' ] ); |
|
| 567 | 567 | |
| 568 | 568 | } // end save view configuration |
| 569 | 569 | |
@@ -573,7 +573,7 @@ discard block |
||
| 573 | 573 | * @param array $statii Array of statuses of the post meta saving processes. If saving worked, each key should be mapped to a value of the post ID (`directory_widgets` => `124`). If failed (or didn't change), the value will be false. |
| 574 | 574 | * @since 1.17.2 |
| 575 | 575 | */ |
| 576 | - do_action('gravityview_view_saved', $post_id, $statii ); |
|
| 576 | + do_action( 'gravityview_view_saved', $post_id, $statii ); |
|
| 577 | 577 | |
| 578 | 578 | gravityview()->log->debug( '[save_postdata] Update Post Meta Statuses (also returns false if nothing changed)', array( 'data' => array_map( 'intval', $statii ) ) ); |
| 579 | 579 | } |
@@ -617,20 +617,20 @@ discard block |
||
| 617 | 617 | |
| 618 | 618 | $output = ''; |
| 619 | 619 | |
| 620 | - if( !empty( $fields ) ) { |
|
| 620 | + if ( ! empty( $fields ) ) { |
|
| 621 | 621 | |
| 622 | - foreach( $fields as $id => $details ) { |
|
| 622 | + foreach ( $fields as $id => $details ) { |
|
| 623 | 623 | |
| 624 | - if( in_array( $details['type'], (array) $blacklist_field_types ) ) { |
|
| 624 | + if ( in_array( $details[ 'type' ], (array)$blacklist_field_types ) ) { |
|
| 625 | 625 | continue; |
| 626 | 626 | } |
| 627 | 627 | |
| 628 | 628 | // Edit mode only allows editing the parent fields, not single inputs. |
| 629 | - if( $context === 'edit' && !empty( $details['parent'] ) ) { |
|
| 629 | + if ( $context === 'edit' && ! empty( $details[ 'parent' ] ) ) { |
|
| 630 | 630 | continue; |
| 631 | 631 | } |
| 632 | 632 | |
| 633 | - $output .= new GravityView_Admin_View_Field( $details['label'], $id, $details, $settings = array(), $form ); |
|
| 633 | + $output .= new GravityView_Admin_View_Field( $details[ 'label' ], $id, $details, $settings = array(), $form ); |
|
| 634 | 634 | |
| 635 | 635 | } // End foreach |
| 636 | 636 | } |
@@ -638,7 +638,7 @@ discard block |
||
| 638 | 638 | echo $output; |
| 639 | 639 | |
| 640 | 640 | // For the EDIT view we only want to allow the form fields. |
| 641 | - if( $context === 'edit' ) { |
|
| 641 | + if ( $context === 'edit' ) { |
|
| 642 | 642 | return; |
| 643 | 643 | } |
| 644 | 644 | |
@@ -662,16 +662,16 @@ discard block |
||
| 662 | 662 | $additional_fields = apply_filters( 'gravityview_additional_fields', array( |
| 663 | 663 | array( |
| 664 | 664 | 'label_text' => __( '+ Add All Fields', 'gravityview' ), |
| 665 | - 'desc' => __('Add all the available fields at once.', 'gravityview'), |
|
| 665 | + 'desc' => __( 'Add all the available fields at once.', 'gravityview' ), |
|
| 666 | 666 | 'field_id' => 'all-fields', |
| 667 | 667 | 'label_type' => 'field', |
| 668 | 668 | 'input_type' => NULL, |
| 669 | 669 | 'field_options' => NULL, |
| 670 | 670 | 'settings_html' => NULL, |
| 671 | 671 | ) |
| 672 | - )); |
|
| 672 | + ) ); |
|
| 673 | 673 | |
| 674 | - if( !empty( $additional_fields )) { |
|
| 674 | + if ( ! empty( $additional_fields ) ) { |
|
| 675 | 675 | foreach ( (array)$additional_fields as $item ) { |
| 676 | 676 | |
| 677 | 677 | // Prevent items from not having index set |
@@ -682,16 +682,16 @@ discard block |
||
| 682 | 682 | 'input_type' => NULL, |
| 683 | 683 | 'field_options' => NULL, |
| 684 | 684 | 'settings_html' => NULL, |
| 685 | - )); |
|
| 685 | + ) ); |
|
| 686 | 686 | |
| 687 | 687 | // Backward compat. |
| 688 | - if( !empty( $item['field_options'] ) ) { |
|
| 688 | + if ( ! empty( $item[ 'field_options' ] ) ) { |
|
| 689 | 689 | // Use settings_html from now on. |
| 690 | - $item['settings_html'] = $item['field_options']; |
|
| 690 | + $item[ 'settings_html' ] = $item[ 'field_options' ]; |
|
| 691 | 691 | } |
| 692 | 692 | |
| 693 | 693 | // Render a label for each of them |
| 694 | - echo new GravityView_Admin_View_Field( $item['label_text'], $item['field_id'], $item, $settings = array(), $form ); |
|
| 694 | + echo new GravityView_Admin_View_Field( $item[ 'label_text' ], $item[ 'field_id' ], $item, $settings = array(), $form ); |
|
| 695 | 695 | |
| 696 | 696 | } |
| 697 | 697 | } |
@@ -704,54 +704,54 @@ discard block |
||
| 704 | 704 | * @param string $zone Either 'single', 'directory', 'header', 'footer' |
| 705 | 705 | * @return array |
| 706 | 706 | */ |
| 707 | - function get_entry_default_fields($form, $zone) { |
|
| 707 | + function get_entry_default_fields( $form, $zone ) { |
|
| 708 | 708 | |
| 709 | 709 | $entry_default_fields = array(); |
| 710 | 710 | |
| 711 | - if( in_array( $zone, array( 'directory', 'single' ) ) ) { |
|
| 711 | + if ( in_array( $zone, array( 'directory', 'single' ) ) ) { |
|
| 712 | 712 | |
| 713 | 713 | $entry_default_fields = array( |
| 714 | 714 | 'id' => array( |
| 715 | - 'label' => __('Entry ID', 'gravityview'), |
|
| 715 | + 'label' => __( 'Entry ID', 'gravityview' ), |
|
| 716 | 716 | 'type' => 'id', |
| 717 | - 'desc' => __('The unique ID of the entry.', 'gravityview'), |
|
| 717 | + 'desc' => __( 'The unique ID of the entry.', 'gravityview' ), |
|
| 718 | 718 | ), |
| 719 | 719 | 'date_created' => array( |
| 720 | - 'label' => __('Entry Date', 'gravityview'), |
|
| 721 | - 'desc' => __('The date the entry was created.', 'gravityview'), |
|
| 720 | + 'label' => __( 'Entry Date', 'gravityview' ), |
|
| 721 | + 'desc' => __( 'The date the entry was created.', 'gravityview' ), |
|
| 722 | 722 | 'type' => 'date_created', |
| 723 | 723 | ), |
| 724 | 724 | 'source_url' => array( |
| 725 | - 'label' => __('Source URL', 'gravityview'), |
|
| 725 | + 'label' => __( 'Source URL', 'gravityview' ), |
|
| 726 | 726 | 'type' => 'source_url', |
| 727 | - 'desc' => __('The URL of the page where the form was submitted.', 'gravityview'), |
|
| 727 | + 'desc' => __( 'The URL of the page where the form was submitted.', 'gravityview' ), |
|
| 728 | 728 | ), |
| 729 | 729 | 'ip' => array( |
| 730 | - 'label' => __('User IP', 'gravityview'), |
|
| 730 | + 'label' => __( 'User IP', 'gravityview' ), |
|
| 731 | 731 | 'type' => 'ip', |
| 732 | - 'desc' => __('The IP Address of the user who created the entry.', 'gravityview'), |
|
| 732 | + 'desc' => __( 'The IP Address of the user who created the entry.', 'gravityview' ), |
|
| 733 | 733 | ), |
| 734 | 734 | 'created_by' => array( |
| 735 | - 'label' => __('User', 'gravityview'), |
|
| 735 | + 'label' => __( 'User', 'gravityview' ), |
|
| 736 | 736 | 'type' => 'created_by', |
| 737 | - 'desc' => __('Details of the logged-in user who created the entry (if any).', 'gravityview'), |
|
| 737 | + 'desc' => __( 'Details of the logged-in user who created the entry (if any).', 'gravityview' ), |
|
| 738 | 738 | ), |
| 739 | 739 | |
| 740 | 740 | /** |
| 741 | 741 | * @since 1.7.2 |
| 742 | 742 | */ |
| 743 | 743 | 'other_entries' => array( |
| 744 | - 'label' => __('Other Entries', 'gravityview'), |
|
| 744 | + 'label' => __( 'Other Entries', 'gravityview' ), |
|
| 745 | 745 | 'type' => 'other_entries', |
| 746 | - 'desc' => __('Display other entries created by the entry creator.', 'gravityview'), |
|
| 746 | + 'desc' => __( 'Display other entries created by the entry creator.', 'gravityview' ), |
|
| 747 | 747 | ), |
| 748 | 748 | ); |
| 749 | 749 | |
| 750 | - if( 'single' !== $zone) { |
|
| 750 | + if ( 'single' !== $zone ) { |
|
| 751 | 751 | |
| 752 | - $entry_default_fields['entry_link'] = array( |
|
| 753 | - 'label' => __('Link to Entry', 'gravityview'), |
|
| 754 | - 'desc' => __('A dedicated link to the single entry with customizable text.', 'gravityview'), |
|
| 752 | + $entry_default_fields[ 'entry_link' ] = array( |
|
| 753 | + 'label' => __( 'Link to Entry', 'gravityview' ), |
|
| 754 | + 'desc' => __( 'A dedicated link to the single entry with customizable text.', 'gravityview' ), |
|
| 755 | 755 | 'type' => 'entry_link', |
| 756 | 756 | ); |
| 757 | 757 | } |
@@ -761,10 +761,10 @@ discard block |
||
| 761 | 761 | /** |
| 762 | 762 | * @since 1.2 |
| 763 | 763 | */ |
| 764 | - $entry_default_fields['custom'] = array( |
|
| 765 | - 'label' => __('Custom Content', 'gravityview'), |
|
| 764 | + $entry_default_fields[ 'custom' ] = array( |
|
| 765 | + 'label' => __( 'Custom Content', 'gravityview' ), |
|
| 766 | 766 | 'type' => 'custom', |
| 767 | - 'desc' => __('Insert custom text or HTML.', 'gravityview'), |
|
| 767 | + 'desc' => __( 'Insert custom text or HTML.', 'gravityview' ), |
|
| 768 | 768 | ); |
| 769 | 769 | |
| 770 | 770 | /** |
@@ -773,7 +773,7 @@ discard block |
||
| 773 | 773 | * @param string|array $form form_ID or form object |
| 774 | 774 | * @param string $zone Either 'single', 'directory', 'header', 'footer' |
| 775 | 775 | */ |
| 776 | - return apply_filters( 'gravityview_entry_default_fields', $entry_default_fields, $form, $zone); |
|
| 776 | + return apply_filters( 'gravityview_entry_default_fields', $entry_default_fields, $form, $zone ); |
|
| 777 | 777 | } |
| 778 | 778 | |
| 779 | 779 | /** |
@@ -784,7 +784,7 @@ discard block |
||
| 784 | 784 | */ |
| 785 | 785 | function get_available_fields( $form = '', $zone = NULL ) { |
| 786 | 786 | |
| 787 | - if( empty( $form ) ) { |
|
| 787 | + if ( empty( $form ) ) { |
|
| 788 | 788 | gravityview()->log->error( '$form is empty' ); |
| 789 | 789 | return array(); |
| 790 | 790 | } |
@@ -793,7 +793,7 @@ discard block |
||
| 793 | 793 | $fields = gravityview_get_form_fields( $form, true ); |
| 794 | 794 | |
| 795 | 795 | // get meta fields ( only if form was already created ) |
| 796 | - if( !is_array( $form ) ) { |
|
| 796 | + if ( ! is_array( $form ) ) { |
|
| 797 | 797 | $meta_fields = gravityview_get_entry_meta( $form ); |
| 798 | 798 | } else { |
| 799 | 799 | $meta_fields = array(); |
@@ -806,7 +806,7 @@ discard block |
||
| 806 | 806 | $fields = $fields + $meta_fields + $default_fields; |
| 807 | 807 | |
| 808 | 808 | // Move Custom Content to top |
| 809 | - $fields = array( 'custom' => $fields['custom'] ) + $fields; |
|
| 809 | + $fields = array( 'custom' => $fields[ 'custom' ] ) + $fields; |
|
| 810 | 810 | |
| 811 | 811 | return $fields; |
| 812 | 812 | } |
@@ -820,11 +820,11 @@ discard block |
||
| 820 | 820 | |
| 821 | 821 | $widgets = $this->get_registered_widgets(); |
| 822 | 822 | |
| 823 | - if( !empty( $widgets ) ) { |
|
| 823 | + if ( ! empty( $widgets ) ) { |
|
| 824 | 824 | |
| 825 | - foreach( $widgets as $id => $details ) { |
|
| 825 | + foreach ( $widgets as $id => $details ) { |
|
| 826 | 826 | |
| 827 | - echo new GravityView_Admin_View_Widget( $details['label'], $id, $details ); |
|
| 827 | + echo new GravityView_Admin_View_Widget( $details[ 'label' ], $id, $details ); |
|
| 828 | 828 | |
| 829 | 829 | } |
| 830 | 830 | } |
@@ -853,7 +853,7 @@ discard block |
||
| 853 | 853 | function render_active_areas( $template_id, $type, $zone, $rows, $values ) { |
| 854 | 854 | global $post; |
| 855 | 855 | |
| 856 | - if( $type === 'widget' ) { |
|
| 856 | + if ( $type === 'widget' ) { |
|
| 857 | 857 | $button_label = __( 'Add Widget', 'gravityview' ); |
| 858 | 858 | } else { |
| 859 | 859 | $button_label = __( 'Add Field', 'gravityview' ); |
@@ -865,10 +865,10 @@ discard block |
||
| 865 | 865 | $form_id = null; |
| 866 | 866 | |
| 867 | 867 | // if saved values, get available fields to label everyone |
| 868 | - if( !empty( $values ) && ( !empty( $post->ID ) || !empty( $_POST['template_id'] ) ) ) { |
|
| 868 | + if ( ! empty( $values ) && ( ! empty( $post->ID ) || ! empty( $_POST[ 'template_id' ] ) ) ) { |
|
| 869 | 869 | |
| 870 | - if( !empty( $_POST['template_id'] ) ) { |
|
| 871 | - $form = GravityView_Ajax::pre_get_form_fields( $_POST['template_id'] ); |
|
| 870 | + if ( ! empty( $_POST[ 'template_id' ] ) ) { |
|
| 871 | + $form = GravityView_Ajax::pre_get_form_fields( $_POST[ 'template_id' ] ); |
|
| 872 | 872 | } else { |
| 873 | 873 | $form_id = $form = gravityview_get_form_id( $post->ID ); |
| 874 | 874 | } |
@@ -886,44 +886,44 @@ discard block |
||
| 886 | 886 | } |
| 887 | 887 | } |
| 888 | 888 | |
| 889 | - foreach( $rows as $row ) : |
|
| 890 | - foreach( $row as $col => $areas ) : |
|
| 891 | - $column = ($col == '2-2') ? '1-2' : $col; ?> |
|
| 889 | + foreach ( $rows as $row ) : |
|
| 890 | + foreach ( $row as $col => $areas ) : |
|
| 891 | + $column = ( $col == '2-2' ) ? '1-2' : $col; ?> |
|
| 892 | 892 | |
| 893 | 893 | <div class="gv-grid-col-<?php echo esc_attr( $column ); ?>"> |
| 894 | 894 | |
| 895 | - <?php foreach( $areas as $area ) : ?> |
|
| 895 | + <?php foreach ( $areas as $area ) : ?> |
|
| 896 | 896 | |
| 897 | - <div class="gv-droppable-area" data-areaid="<?php echo esc_attr( $zone .'_'. $area['areaid'] ); ?>" data-context="<?php echo esc_attr( $zone ); ?>"> |
|
| 898 | - <div class="active-drop active-drop-<?php echo esc_attr( $type ); ?>" data-areaid="<?php echo esc_attr( $zone .'_'. $area['areaid'] ); ?>"> |
|
| 897 | + <div class="gv-droppable-area" data-areaid="<?php echo esc_attr( $zone . '_' . $area[ 'areaid' ] ); ?>" data-context="<?php echo esc_attr( $zone ); ?>"> |
|
| 898 | + <div class="active-drop active-drop-<?php echo esc_attr( $type ); ?>" data-areaid="<?php echo esc_attr( $zone . '_' . $area[ 'areaid' ] ); ?>"> |
|
| 899 | 899 | |
| 900 | 900 | <?php // render saved fields |
| 901 | 901 | |
| 902 | - if( ! empty( $values[ $zone .'_'. $area['areaid'] ] ) ) { |
|
| 902 | + if ( ! empty( $values[ $zone . '_' . $area[ 'areaid' ] ] ) ) { |
|
| 903 | 903 | |
| 904 | - foreach( $values[ $zone .'_'. $area['areaid'] ] as $uniqid => $field ) { |
|
| 904 | + foreach ( $values[ $zone . '_' . $area[ 'areaid' ] ] as $uniqid => $field ) { |
|
| 905 | 905 | |
| 906 | 906 | // Maybe has a form ID |
| 907 | - $form_id = empty( $field['form_id'] ) ? $form_id : $field['form_id']; |
|
| 907 | + $form_id = empty( $field[ 'form_id' ] ) ? $form_id : $field[ 'form_id' ]; |
|
| 908 | 908 | |
| 909 | 909 | $input_type = NULL; |
| 910 | 910 | |
| 911 | 911 | if ( $form_id ) { |
| 912 | - $original_item = isset( $available_items[ $form_id ] [ $field['id'] ] ) ? $available_items[ $form_id ] [ $field['id'] ] : false ; |
|
| 912 | + $original_item = isset( $available_items[ $form_id ] [ $field[ 'id' ] ] ) ? $available_items[ $form_id ] [ $field[ 'id' ] ] : false; |
|
| 913 | 913 | } else { |
| 914 | - $original_item = isset( $available_items[ $field['id'] ] ) ? $available_items[ $field['id'] ] : false ; |
|
| 914 | + $original_item = isset( $available_items[ $field[ 'id' ] ] ) ? $available_items[ $field[ 'id' ] ] : false; |
|
| 915 | 915 | } |
| 916 | 916 | |
| 917 | - if ( !$original_item ) { |
|
| 918 | - gravityview()->log->error( 'An item was not available when rendering the output; maybe it was added by a plugin that is now de-activated.', array(' data' => array('available_items' => $available_items, 'field' => $field ) ) ); |
|
| 917 | + if ( ! $original_item ) { |
|
| 918 | + gravityview()->log->error( 'An item was not available when rendering the output; maybe it was added by a plugin that is now de-activated.', array( ' data' => array( 'available_items' => $available_items, 'field' => $field ) ) ); |
|
| 919 | 919 | |
| 920 | 920 | $original_item = $field; |
| 921 | 921 | } else { |
| 922 | - $input_type = isset( $original_item['type'] ) ? $original_item['type'] : NULL; |
|
| 922 | + $input_type = isset( $original_item[ 'type' ] ) ? $original_item[ 'type' ] : NULL; |
|
| 923 | 923 | } |
| 924 | 924 | |
| 925 | 925 | // Field options dialog box |
| 926 | - $field_options = GravityView_Render_Settings::render_field_options( $form_id, $type, $template_id, $field['id'], $original_item['label'], $zone .'_'. $area['areaid'], $input_type, $uniqid, $field, $zone, $original_item ); |
|
| 926 | + $field_options = GravityView_Render_Settings::render_field_options( $form_id, $type, $template_id, $field[ 'id' ], $original_item[ 'label' ], $zone . '_' . $area[ 'areaid' ], $input_type, $uniqid, $field, $zone, $original_item ); |
|
| 927 | 927 | |
| 928 | 928 | $item = array( |
| 929 | 929 | 'input_type' => $input_type, |
@@ -936,23 +936,23 @@ discard block |
||
| 936 | 936 | $item = wp_parse_args( $item, $original_item ); |
| 937 | 937 | } |
| 938 | 938 | |
| 939 | - switch( $type ) { |
|
| 939 | + switch ( $type ) { |
|
| 940 | 940 | case 'widget': |
| 941 | - echo new GravityView_Admin_View_Widget( $item['label'], $field['id'], $item, $field ); |
|
| 941 | + echo new GravityView_Admin_View_Widget( $item[ 'label' ], $field[ 'id' ], $item, $field ); |
|
| 942 | 942 | break; |
| 943 | 943 | default: |
| 944 | - echo new GravityView_Admin_View_Field( $field['label'], $field['id'], $item, $field, $form_id ); |
|
| 944 | + echo new GravityView_Admin_View_Field( $field[ 'label' ], $field[ 'id' ], $item, $field, $form_id ); |
|
| 945 | 945 | } |
| 946 | 946 | } |
| 947 | 947 | |
| 948 | 948 | } // End if zone is not empty ?> |
| 949 | 949 | |
| 950 | - <span class="drop-message"><?php echo sprintf(esc_attr__('"+ %s" or drag existing %ss here.', 'gravityview'), $button_label, $type ); ?></span> |
|
| 950 | + <span class="drop-message"><?php echo sprintf( esc_attr__( '"+ %s" or drag existing %ss here.', 'gravityview' ), $button_label, $type ); ?></span> |
|
| 951 | 951 | </div> |
| 952 | 952 | <div class="gv-droppable-area-action"> |
| 953 | - <a href="#" class="gv-add-field button-secondary" title="" data-objecttype="<?php echo esc_attr( $type ); ?>" data-areaid="<?php echo esc_attr( $zone .'_'. $area['areaid'] ); ?>" data-context="<?php echo esc_attr( $zone ); ?>" data-formid="<?php echo $view ? esc_attr( $view->form ? $view->form->ID : '' ) : ''; ?>"><?php echo '+ '.esc_html( $button_label ); ?></a> |
|
| 953 | + <a href="#" class="gv-add-field button-secondary" title="" data-objecttype="<?php echo esc_attr( $type ); ?>" data-areaid="<?php echo esc_attr( $zone . '_' . $area[ 'areaid' ] ); ?>" data-context="<?php echo esc_attr( $zone ); ?>" data-formid="<?php echo $view ? esc_attr( $view->form ? $view->form->ID : '' ) : ''; ?>"><?php echo '+ ' . esc_html( $button_label ); ?></a> |
|
| 954 | 954 | |
| 955 | - <p class="gv-droppable-area-title"><strong><?php echo esc_html( $area['title'] ); ?></strong><?php if( !empty( $area['subtitle'] ) ) { ?><span class="gv-droppable-area-subtitle"> – <?php echo esc_html( $area['subtitle'] ); ?></span><?php } ?></p> |
|
| 955 | + <p class="gv-droppable-area-title"><strong><?php echo esc_html( $area[ 'title' ] ); ?></strong><?php if ( ! empty( $area[ 'subtitle' ] ) ) { ?><span class="gv-droppable-area-subtitle"> – <?php echo esc_html( $area[ 'subtitle' ] ); ?></span><?php } ?></p> |
|
| 956 | 956 | </div> |
| 957 | 957 | </div> |
| 958 | 958 | |
@@ -974,7 +974,7 @@ discard block |
||
| 974 | 974 | $default_widget_areas = GravityView_Widget::get_default_widget_areas(); |
| 975 | 975 | |
| 976 | 976 | $widgets = array(); |
| 977 | - if( !empty( $post_id ) ) { |
|
| 977 | + if ( ! empty( $post_id ) ) { |
|
| 978 | 978 | $widgets = gravityview_get_directory_widgets( $post_id ); |
| 979 | 979 | } |
| 980 | 980 | |
@@ -1007,7 +1007,7 @@ discard block |
||
| 1007 | 1007 | // list of available fields to be shown in the popup |
| 1008 | 1008 | $forms = gravityview_get_forms( 'any' ); |
| 1009 | 1009 | |
| 1010 | - $form_ids = array_map( function ($form) { return $form['id']; }, $forms); |
|
| 1010 | + $form_ids = array_map( function( $form ) { return $form[ 'id' ]; }, $forms ); |
|
| 1011 | 1011 | |
| 1012 | 1012 | foreach ( $form_ids as $form_id ) { |
| 1013 | 1013 | $filter_field_id = sprintf( 'gv-field-filter-%s-%d', $context, $form_id ); |
@@ -1020,7 +1020,7 @@ discard block |
||
| 1020 | 1020 | </div> |
| 1021 | 1021 | |
| 1022 | 1022 | <div id="available-fields-<?php echo $filter_field_id; ?>" aria-live="polite" role="listbox"> |
| 1023 | - <?php do_action('gravityview_render_available_fields', $form_id, $context ); ?> |
|
| 1023 | + <?php do_action( 'gravityview_render_available_fields', $form_id, $context ); ?> |
|
| 1024 | 1024 | </div> |
| 1025 | 1025 | |
| 1026 | 1026 | <div class="gv-no-results hidden description"><?php esc_html_e( 'No fields were found matching the search.', 'gravityview' ); ?></div> |
@@ -1039,7 +1039,7 @@ discard block |
||
| 1039 | 1039 | * @return string HTML of the active areas |
| 1040 | 1040 | */ |
| 1041 | 1041 | function render_directory_active_areas( $template_id = '', $context = 'single', $post_id = '', $echo = false ) { |
| 1042 | - if( empty( $template_id ) ) { |
|
| 1042 | + if ( empty( $template_id ) ) { |
|
| 1043 | 1043 | gravityview()->log->debug( '[render_directory_active_areas] {template_id} is empty', array( 'template_id' => $template_id ) ); |
| 1044 | 1044 | return ''; |
| 1045 | 1045 | } |
@@ -1053,12 +1053,12 @@ discard block |
||
| 1053 | 1053 | */ |
| 1054 | 1054 | $template_areas = apply_filters( 'gravityview_template_active_areas', array(), $template_id, $context ); |
| 1055 | 1055 | |
| 1056 | - if( empty( $template_areas ) ) { |
|
| 1056 | + if ( empty( $template_areas ) ) { |
|
| 1057 | 1057 | |
| 1058 | 1058 | gravityview()->log->debug( '[render_directory_active_areas] No areas defined. Maybe template {template_id} is disabled.', array( 'data' => $template_id ) ); |
| 1059 | 1059 | $output = '<div>'; |
| 1060 | - $output .= '<h2 class="description" style="font-size: 16px; margin:0">'. sprintf( esc_html__( 'This View is configured using the %s View type, which is disabled.', 'gravityview' ), '<em>'.$template_id.'</em>' ) .'</h2>'; |
|
| 1061 | - $output .= '<p class="description" style="font-size: 14px; margin:0 0 1em 0;padding:0">'.esc_html__('The data is not lost; re-activate the associated plugin and the configuration will re-appear.', 'gravityview').'</p>'; |
|
| 1060 | + $output .= '<h2 class="description" style="font-size: 16px; margin:0">' . sprintf( esc_html__( 'This View is configured using the %s View type, which is disabled.', 'gravityview' ), '<em>' . $template_id . '</em>' ) . '</h2>'; |
|
| 1061 | + $output .= '<p class="description" style="font-size: 14px; margin:0 0 1em 0;padding:0">' . esc_html__( 'The data is not lost; re-activate the associated plugin and the configuration will re-appear.', 'gravityview' ) . '</p>'; |
|
| 1062 | 1062 | $output .= '</div>'; |
| 1063 | 1063 | } else { |
| 1064 | 1064 | |
@@ -1073,7 +1073,7 @@ discard block |
||
| 1073 | 1073 | |
| 1074 | 1074 | } |
| 1075 | 1075 | |
| 1076 | - if( $echo ) { |
|
| 1076 | + if ( $echo ) { |
|
| 1077 | 1077 | echo $output; |
| 1078 | 1078 | } |
| 1079 | 1079 | |
@@ -1093,26 +1093,26 @@ discard block |
||
| 1093 | 1093 | $is_widgets_page = ( $pagenow === 'widgets.php' ); |
| 1094 | 1094 | |
| 1095 | 1095 | // Add the GV font (with the Astronaut) |
| 1096 | - wp_enqueue_style( 'gravityview_global', plugins_url('assets/css/admin-global.css', GRAVITYVIEW_FILE), array(), GravityView_Plugin::version ); |
|
| 1096 | + wp_enqueue_style( 'gravityview_global', plugins_url( 'assets/css/admin-global.css', GRAVITYVIEW_FILE ), array(), GravityView_Plugin::version ); |
|
| 1097 | 1097 | |
| 1098 | - wp_register_script( 'gravityview-jquery-cookie', plugins_url('assets/lib/jquery.cookie/jquery.cookie.min.js', GRAVITYVIEW_FILE), array( 'jquery' ), GravityView_Plugin::version, true ); |
|
| 1098 | + wp_register_script( 'gravityview-jquery-cookie', plugins_url( 'assets/lib/jquery.cookie/jquery.cookie.min.js', GRAVITYVIEW_FILE ), array( 'jquery' ), GravityView_Plugin::version, true ); |
|
| 1099 | 1099 | |
| 1100 | 1100 | // Don't process any scripts below here if it's not a GravityView page. |
| 1101 | - if( ! gravityview_is_admin_page( $hook, 'single' ) && ! $is_widgets_page ) { |
|
| 1101 | + if ( ! gravityview_is_admin_page( $hook, 'single' ) && ! $is_widgets_page ) { |
|
| 1102 | 1102 | return; |
| 1103 | 1103 | } |
| 1104 | 1104 | |
| 1105 | 1105 | wp_enqueue_script( 'jquery-ui-datepicker' ); |
| 1106 | - wp_enqueue_style( 'gravityview_views_datepicker', plugins_url('assets/css/admin-datepicker.css', GRAVITYVIEW_FILE), GravityView_Plugin::version ); |
|
| 1106 | + wp_enqueue_style( 'gravityview_views_datepicker', plugins_url( 'assets/css/admin-datepicker.css', GRAVITYVIEW_FILE ), GravityView_Plugin::version ); |
|
| 1107 | 1107 | |
| 1108 | - $script_debug = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min'; |
|
| 1108 | + $script_debug = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
|
| 1109 | 1109 | |
| 1110 | 1110 | //enqueue scripts |
| 1111 | 1111 | wp_enqueue_script( 'gravityview_views_scripts', plugins_url( 'assets/js/admin-views' . $script_debug . '.js', GRAVITYVIEW_FILE ), array( 'jquery-ui-tabs', 'jquery-ui-draggable', 'jquery-ui-droppable', 'jquery-ui-sortable', 'jquery-ui-tooltip', 'jquery-ui-dialog', 'gravityview-jquery-cookie', 'jquery-ui-datepicker', 'underscore' ), GravityView_Plugin::version ); |
| 1112 | 1112 | |
| 1113 | - wp_localize_script('gravityview_views_scripts', 'gvGlobals', array( |
|
| 1113 | + wp_localize_script( 'gravityview_views_scripts', 'gvGlobals', array( |
|
| 1114 | 1114 | 'cookiepath' => COOKIEPATH, |
| 1115 | - 'passed_form_id' => (bool) \GV\Utils::_GET( 'form_id' ), |
|
| 1115 | + 'passed_form_id' => (bool)\GV\Utils::_GET( 'form_id' ), |
|
| 1116 | 1116 | 'nonce' => wp_create_nonce( 'gravityview_ajaxviews' ), |
| 1117 | 1117 | 'label_viewname' => __( 'Enter View name here', 'gravityview' ), |
| 1118 | 1118 | 'label_close' => __( 'Close', 'gravityview' ), |
@@ -1124,9 +1124,9 @@ discard block |
||
| 1124 | 1124 | 'loading_error' => esc_html__( 'There was an error loading dynamic content.', 'gravityview' ), |
| 1125 | 1125 | 'field_loaderror' => __( 'Error while adding the field. Please try again or contact GravityView support.', 'gravityview' ), |
| 1126 | 1126 | 'remove_all_fields' => __( 'Would you like to remove all fields in this zone? (You are seeing this message because you were holding down the ALT key)', 'gravityview' ), |
| 1127 | - )); |
|
| 1127 | + ) ); |
|
| 1128 | 1128 | |
| 1129 | - wp_enqueue_style( 'gravityview_views_styles', plugins_url( 'assets/css/admin-views.css', GRAVITYVIEW_FILE ), array('dashicons', 'wp-jquery-ui-dialog' ), GravityView_Plugin::version ); |
|
| 1129 | + wp_enqueue_style( 'gravityview_views_styles', plugins_url( 'assets/css/admin-views.css', GRAVITYVIEW_FILE ), array( 'dashicons', 'wp-jquery-ui-dialog' ), GravityView_Plugin::version ); |
|
| 1130 | 1130 | |
| 1131 | 1131 | // Enqueue scripts needed for merge tags |
| 1132 | 1132 | self::enqueue_gravity_forms_scripts(); |
@@ -1151,7 +1151,7 @@ discard block |
||
| 1151 | 1151 | ); |
| 1152 | 1152 | |
| 1153 | 1153 | if ( wp_is_mobile() ) { |
| 1154 | - $scripts[] = 'jquery-touch-punch'; |
|
| 1154 | + $scripts[ ] = 'jquery-touch-punch'; |
|
| 1155 | 1155 | } |
| 1156 | 1156 | |
| 1157 | 1157 | wp_enqueue_script( $scripts ); |
@@ -49,7 +49,7 @@ |
||
| 49 | 49 | * |
| 50 | 50 | * @param array $items Scripts or styles to exclude from no-conflict |
| 51 | 51 | * |
| 52 | - * @return array |
|
| 52 | + * @return string[] |
|
| 53 | 53 | */ |
| 54 | 54 | public function register_noconflict( $items ) { |
| 55 | 55 | |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | */ |
| 54 | 54 | public function register_noconflict( $items ) { |
| 55 | 55 | |
| 56 | - $items[] = 'gravityview-admin-installer'; |
|
| 56 | + $items[ ] = 'gravityview-admin-installer'; |
|
| 57 | 57 | |
| 58 | 58 | return $items; |
| 59 | 59 | } |
@@ -72,17 +72,17 @@ discard block |
||
| 72 | 72 | return; |
| 73 | 73 | } |
| 74 | 74 | |
| 75 | - add_filter( 'plugins_api', function ( $data, $action, $args ) use ( $downloads_data ) { |
|
| 75 | + add_filter( 'plugins_api', function( $data, $action, $args ) use ( $downloads_data ) { |
|
| 76 | 76 | foreach ( $downloads_data as $extension ) { |
| 77 | - if ( empty( $extension['info'] ) || empty( $args->slug ) || $args->slug !== $extension['info']['slug'] ) { |
|
| 77 | + if ( empty( $extension[ 'info' ] ) || empty( $args->slug ) || $args->slug !== $extension[ 'info' ][ 'slug' ] ) { |
|
| 78 | 78 | continue; |
| 79 | 79 | } |
| 80 | 80 | |
| 81 | - return (object) array( |
|
| 82 | - 'slug' => $extension['info']['slug'], |
|
| 83 | - 'name' => $extension['info']['title'], |
|
| 84 | - 'version' => $extension['licensing']['version'], |
|
| 85 | - 'download_link' => $extension['files'][0]['file'], |
|
| 81 | + return (object)array( |
|
| 82 | + 'slug' => $extension[ 'info' ][ 'slug' ], |
|
| 83 | + 'name' => $extension[ 'info' ][ 'title' ], |
|
| 84 | + 'version' => $extension[ 'licensing' ][ 'version' ], |
|
| 85 | + 'download_link' => $extension[ 'files' ][ 0 ][ 'file' ], |
|
| 86 | 86 | ); |
| 87 | 87 | } |
| 88 | 88 | |
@@ -144,13 +144,13 @@ discard block |
||
| 144 | 144 | |
| 145 | 145 | foreach ( $all_plugins as $path => $plugin ) { |
| 146 | 146 | |
| 147 | - if ( empty( $plugin['TextDomain'] ) ) { |
|
| 147 | + if ( empty( $plugin[ 'TextDomain' ] ) ) { |
|
| 148 | 148 | continue; |
| 149 | 149 | } |
| 150 | 150 | |
| 151 | - $wp_plugins[ $plugin['TextDomain'] ] = array( |
|
| 151 | + $wp_plugins[ $plugin[ 'TextDomain' ] ] = array( |
|
| 152 | 152 | 'path' => $path, |
| 153 | - 'version' => $plugin['Version'], |
|
| 153 | + 'version' => $plugin[ 'Version' ], |
|
| 154 | 154 | 'activated' => is_plugin_active( $path ) |
| 155 | 155 | ); |
| 156 | 156 | } |
@@ -232,13 +232,13 @@ discard block |
||
| 232 | 232 | |
| 233 | 233 | $downloads_data = json_decode( wp_remote_retrieve_body( $response ), true ); |
| 234 | 234 | |
| 235 | - if ( empty( $downloads_data['products'] ) ) { |
|
| 235 | + if ( empty( $downloads_data[ 'products' ] ) ) { |
|
| 236 | 236 | return array(); |
| 237 | 237 | } |
| 238 | 238 | |
| 239 | - $this->set_downloads_data( $downloads_data['products'] ); |
|
| 239 | + $this->set_downloads_data( $downloads_data[ 'products' ] ); |
|
| 240 | 240 | |
| 241 | - return $downloads_data['products']; |
|
| 241 | + return $downloads_data[ 'products' ]; |
|
| 242 | 242 | } |
| 243 | 243 | |
| 244 | 244 | /** |
@@ -311,7 +311,7 @@ discard block |
||
| 311 | 311 | |
| 312 | 312 | foreach ( $downloads_data as $extension ) { |
| 313 | 313 | |
| 314 | - if ( empty( $extension['info'] ) ) { |
|
| 314 | + if ( empty( $extension[ 'info' ] ) ) { |
|
| 315 | 315 | continue; |
| 316 | 316 | } |
| 317 | 317 | |
@@ -340,29 +340,29 @@ discard block |
||
| 340 | 340 | |
| 341 | 341 | $details = $this->get_download_display_details( $download, $wp_plugins ); |
| 342 | 342 | |
| 343 | - $download_info = $details['download_info']; |
|
| 343 | + $download_info = $details[ 'download_info' ]; |
|
| 344 | 344 | |
| 345 | 345 | ?> |
| 346 | - <div class="item <?php echo esc_attr( $details['item_class'] ); ?>"> |
|
| 346 | + <div class="item <?php echo esc_attr( $details[ 'item_class' ] ); ?>"> |
|
| 347 | 347 | <div class="addon-inner"> |
| 348 | - <a href="<?php echo esc_url( $download_info['link'] ); ?>" rel="external noreferrer noopener" title="<?php esc_html_e( 'Visit the plugin page', 'gravityview' ); ?>"><img class="thumbnail" src="<?php echo esc_attr( $download_info['thumbnail'] ); ?>" alt="" /></a> |
|
| 349 | - <h3><?php echo esc_html( \GV\Utils::get( $download_info, 'installer_title', $download_info['title'] ) ); ?></h3> |
|
| 348 | + <a href="<?php echo esc_url( $download_info[ 'link' ] ); ?>" rel="external noreferrer noopener" title="<?php esc_html_e( 'Visit the plugin page', 'gravityview' ); ?>"><img class="thumbnail" src="<?php echo esc_attr( $download_info[ 'thumbnail' ] ); ?>" alt="" /></a> |
|
| 349 | + <h3><?php echo esc_html( \GV\Utils::get( $download_info, 'installer_title', $download_info[ 'title' ] ) ); ?></h3> |
|
| 350 | 350 | <div> |
| 351 | - <?php if( $details['status_label'] ) { ?> |
|
| 352 | - <div class="status <?php echo esc_attr( $details['status'] ); ?>" title="<?php printf( esc_attr__( 'Plugin status: %s', 'gravityview' ), esc_html( $details['status_label'] ) ); ?>"> |
|
| 353 | - <span class="dashicons dashicons-admin-plugins"></span> <span class="status-label"><?php echo esc_html( $details['status_label'] ); ?></span> |
|
| 351 | + <?php if ( $details[ 'status_label' ] ) { ?> |
|
| 352 | + <div class="status <?php echo esc_attr( $details[ 'status' ] ); ?>" title="<?php printf( esc_attr__( 'Plugin status: %s', 'gravityview' ), esc_html( $details[ 'status_label' ] ) ); ?>"> |
|
| 353 | + <span class="dashicons dashicons-admin-plugins"></span> <span class="status-label"><?php echo esc_html( $details[ 'status_label' ] ); ?></span> |
|
| 354 | 354 | </div> |
| 355 | 355 | <?php } ?> |
| 356 | 356 | |
| 357 | - <a data-status="<?php echo esc_attr( $details['status'] ); ?>" data-plugin-path="<?php echo esc_attr( $details['plugin_path'] ); ?>" href="<?php echo esc_url( $details['href'] ); ?>" class="button <?php echo esc_attr( $details['button_class'] ); ?>" title="<?php echo esc_attr( $details['button_title'] ); ?>"> |
|
| 358 | - <span class="title"><?php echo esc_html( $details['button_label'] ); ?></span> |
|
| 359 | - <?php if( $details['spinner'] ) { ?><span class="spinner"></span><?php } ?> |
|
| 357 | + <a data-status="<?php echo esc_attr( $details[ 'status' ] ); ?>" data-plugin-path="<?php echo esc_attr( $details[ 'plugin_path' ] ); ?>" href="<?php echo esc_url( $details[ 'href' ] ); ?>" class="button <?php echo esc_attr( $details[ 'button_class' ] ); ?>" title="<?php echo esc_attr( $details[ 'button_title' ] ); ?>"> |
|
| 358 | + <span class="title"><?php echo esc_html( $details[ 'button_label' ] ); ?></span> |
|
| 359 | + <?php if ( $details[ 'spinner' ] ) { ?><span class="spinner"></span><?php } ?> |
|
| 360 | 360 | </a> |
| 361 | 361 | </div> |
| 362 | 362 | |
| 363 | 363 | <div class="addon-excerpt"><?php |
| 364 | 364 | |
| 365 | - $excerpt = \GV\Utils::get( $download_info, 'installer_excerpt', $download_info['excerpt'] ); |
|
| 365 | + $excerpt = \GV\Utils::get( $download_info, 'installer_excerpt', $download_info[ 'excerpt' ] ); |
|
| 366 | 366 | |
| 367 | 367 | // Allow some pure HTML tags, but remove everything else from the excerpt. |
| 368 | 368 | $tags = array( '<strong>', '</strong>', '<em>', '</em>', '<code>', '</code>' ); |
@@ -402,7 +402,7 @@ discard block |
||
| 402 | 402 | */ |
| 403 | 403 | private function get_download_display_details( $download, $wp_plugins ) { |
| 404 | 404 | |
| 405 | - $download_info = wp_parse_args( (array) $download['info'], array( |
|
| 405 | + $download_info = wp_parse_args( (array)$download[ 'info' ], array( |
|
| 406 | 406 | 'thumbnail' => '', |
| 407 | 407 | 'title' => '', |
| 408 | 408 | 'textdomain' => '', |
@@ -414,9 +414,9 @@ discard block |
||
| 414 | 414 | 'installer_excerpt' => null, // May not be defined |
| 415 | 415 | ) ); |
| 416 | 416 | |
| 417 | - $wp_plugin = \GV\Utils::get( $wp_plugins, $download_info['textdomain'], false ); |
|
| 417 | + $wp_plugin = \GV\Utils::get( $wp_plugins, $download_info[ 'textdomain' ], false ); |
|
| 418 | 418 | |
| 419 | - $has_access = ! empty( $download['files'] ); |
|
| 419 | + $has_access = ! empty( $download[ 'files' ] ); |
|
| 420 | 420 | $spinner = true; |
| 421 | 421 | $href = $plugin_path = '#'; |
| 422 | 422 | $status = $item_class = $button_title = $button_class = ''; |
@@ -426,7 +426,7 @@ discard block |
||
| 426 | 426 | $required_license = $galactic_only ? __( 'All Access', 'gravityview' ) : __( 'Core + Extensions', 'gravityview' ); |
| 427 | 427 | |
| 428 | 428 | // The license is not active - no matter what level, this should not work |
| 429 | - if( ! $is_active && empty( $base_price ) ) { |
|
| 429 | + if ( ! $is_active && empty( $base_price ) ) { |
|
| 430 | 430 | $spinner = false; |
| 431 | 431 | $button_class = 'disabled disabled-license'; |
| 432 | 432 | $button_label = sprintf( __( 'Active %s License is Required.', 'gravityview' ), $required_license ); |
@@ -438,7 +438,7 @@ discard block |
||
| 438 | 438 | $status_label = ''; |
| 439 | 439 | $button_label = sprintf( __( 'Purchase Now for %s', 'gravityview' ), '$' . $base_price ); |
| 440 | 440 | $button_class = 'button-primary button-large'; |
| 441 | - $href = $download_info['link']; |
|
| 441 | + $href = $download_info[ 'link' ]; |
|
| 442 | 442 | $item_class = 'featured'; |
| 443 | 443 | } |
| 444 | 444 | |
@@ -451,7 +451,7 @@ discard block |
||
| 451 | 451 | $href = 'https://gravityview.co/pricing/?utm_source=admin-installer&utm_medium=admin&utm_campaign=Admin%20Notice&utm_content=' . $required_license; |
| 452 | 452 | } |
| 453 | 453 | |
| 454 | - elseif ( ! empty( $download_info['coming_soon'] ) ) { |
|
| 454 | + elseif ( ! empty( $download_info[ 'coming_soon' ] ) ) { |
|
| 455 | 455 | $spinner = false; |
| 456 | 456 | $status = 'notinstalled'; |
| 457 | 457 | $status_label = __( 'Coming Soon', 'gravityview' ); |
@@ -466,8 +466,8 @@ discard block |
||
| 466 | 466 | $href = add_query_arg( |
| 467 | 467 | array( |
| 468 | 468 | 'action' => 'install-plugin', |
| 469 | - 'plugin' => $download_info['slug'], |
|
| 470 | - '_wpnonce' => wp_create_nonce( 'install-plugin_' . $download_info['slug'] ), |
|
| 469 | + 'plugin' => $download_info[ 'slug' ], |
|
| 470 | + '_wpnonce' => wp_create_nonce( 'install-plugin_' . $download_info[ 'slug' ] ), |
|
| 471 | 471 | ), |
| 472 | 472 | self_admin_url( 'update.php' ) |
| 473 | 473 | ); |
@@ -479,25 +479,25 @@ discard block |
||
| 479 | 479 | } |
| 480 | 480 | |
| 481 | 481 | // Access and the plugin is installed but not active |
| 482 | - elseif ( false === $wp_plugin['activated'] ) { |
|
| 482 | + elseif ( false === $wp_plugin[ 'activated' ] ) { |
|
| 483 | 483 | $status = 'inactive'; |
| 484 | 484 | $status_label = __( 'Inactive', 'gravityview' ); |
| 485 | 485 | $button_label = __( 'Activate', 'gravityview' ); |
| 486 | - $plugin_path = $wp_plugin['path']; |
|
| 486 | + $plugin_path = $wp_plugin[ 'path' ]; |
|
| 487 | 487 | |
| 488 | 488 | } |
| 489 | 489 | |
| 490 | 490 | // Access and the plugin is installed and active |
| 491 | 491 | else { |
| 492 | 492 | |
| 493 | - $plugin_path = $wp_plugin['path']; |
|
| 493 | + $plugin_path = $wp_plugin[ 'path' ]; |
|
| 494 | 494 | $status = 'active'; |
| 495 | 495 | $status_label = __( 'Active', 'gravityview' ); |
| 496 | 496 | $button_label = __( 'Deactivate', 'gravityview' ); |
| 497 | 497 | |
| 498 | 498 | } |
| 499 | 499 | |
| 500 | - return compact( 'download_info','plugin_path', 'status', 'status_label', 'button_title', 'button_class', 'button_label', 'href', 'spinner', 'item_class', 'required_license', 'is_active' ); |
|
| 500 | + return compact( 'download_info', 'plugin_path', 'status', 'status_label', 'button_title', 'button_class', 'button_label', 'href', 'spinner', 'item_class', 'required_license', 'is_active' ); |
|
| 501 | 501 | } |
| 502 | 502 | |
| 503 | 503 | /** |
@@ -512,11 +512,11 @@ discard block |
||
| 512 | 512 | $base_price = \GV\Utils::get( $download, 'pricing/amount', 0 ); |
| 513 | 513 | $base_price = \GFCommon::to_number( $base_price ); |
| 514 | 514 | |
| 515 | - unset( $download['pricing']['amount'] ); |
|
| 515 | + unset( $download[ 'pricing' ][ 'amount' ] ); |
|
| 516 | 516 | |
| 517 | 517 | // Price options array, not single price |
| 518 | - if ( ! $base_price && ! empty( $download['pricing'] ) ) { |
|
| 519 | - $base_price = array_shift( $download['pricing'] ); |
|
| 518 | + if ( ! $base_price && ! empty( $download[ 'pricing' ] ) ) { |
|
| 519 | + $base_price = array_shift( $download[ 'pricing' ] ); |
|
| 520 | 520 | } |
| 521 | 521 | |
| 522 | 522 | return floatval( $base_price ); |
@@ -530,13 +530,13 @@ discard block |
||
| 530 | 530 | public function activate_download() { |
| 531 | 531 | $data = \GV\Utils::_POST( 'data', array() ); |
| 532 | 532 | |
| 533 | - if ( empty( $data['path'] ) ) { |
|
| 533 | + if ( empty( $data[ 'path' ] ) ) { |
|
| 534 | 534 | return; |
| 535 | 535 | } |
| 536 | 536 | |
| 537 | - $result = activate_plugin( $data['path'] ); |
|
| 537 | + $result = activate_plugin( $data[ 'path' ] ); |
|
| 538 | 538 | |
| 539 | - if ( is_wp_error( $result ) || ! is_plugin_active( $data['path'] ) ) { |
|
| 539 | + if ( is_wp_error( $result ) || ! is_plugin_active( $data[ 'path' ] ) ) { |
|
| 540 | 540 | wp_send_json_error( array( |
| 541 | 541 | 'error' => sprintf( __( 'Plugin activation failed: %s', 'gravityview' ), $result->get_error_message() ) |
| 542 | 542 | ) ); |
@@ -553,13 +553,13 @@ discard block |
||
| 553 | 553 | public function deactivate_download() { |
| 554 | 554 | $data = \GV\Utils::_POST( 'data', array() ); |
| 555 | 555 | |
| 556 | - if ( empty( $data['path'] ) ) { |
|
| 556 | + if ( empty( $data[ 'path' ] ) ) { |
|
| 557 | 557 | return; |
| 558 | 558 | } |
| 559 | 559 | |
| 560 | - deactivate_plugins( $data['path'] ); |
|
| 560 | + deactivate_plugins( $data[ 'path' ] ); |
|
| 561 | 561 | |
| 562 | - if( is_plugin_active( $data['path'] ) ) { |
|
| 562 | + if ( is_plugin_active( $data[ 'path' ] ) ) { |
|
| 563 | 563 | wp_send_json_error( array( |
| 564 | 564 | 'error' => sprintf( __( 'Plugin deactivation failed.', 'gravityview' ) ) |
| 565 | 565 | ) ); |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | * @return array |
| 103 | 103 | */ |
| 104 | 104 | public function modify_app_settings_menu_title( $setting_tabs ) { |
| 105 | - $setting_tabs[0]['label'] = __( 'GravityView Settings', 'gravityview' ); |
|
| 105 | + $setting_tabs[ 0 ][ 'label' ] = __( 'GravityView Settings', 'gravityview' ); |
|
| 106 | 106 | return $setting_tabs; |
| 107 | 107 | } |
| 108 | 108 | |
@@ -308,15 +308,15 @@ discard block |
||
| 308 | 308 | </ul> |
| 309 | 309 | <div class="gv-followup widefat"> |
| 310 | 310 | <p><strong><label for="gv-reason-details"><?php esc_html_e( 'Comments', 'gravityview' ); ?></label></strong></p> |
| 311 | - <textarea id="gv-reason-details" name="reason_details" data-default="<?php esc_attr_e('Please share your thoughts about GravityView', 'gravityview') ?>" placeholder="<?php esc_attr_e('Please share your thoughts about GravityView', 'gravityview'); ?>" class="large-text"></textarea> |
|
| 311 | + <textarea id="gv-reason-details" name="reason_details" data-default="<?php esc_attr_e( 'Please share your thoughts about GravityView', 'gravityview' ) ?>" placeholder="<?php esc_attr_e( 'Please share your thoughts about GravityView', 'gravityview' ); ?>" class="large-text"></textarea> |
|
| 312 | 312 | </div> |
| 313 | 313 | <div class="scale-description"> |
| 314 | 314 | <p><strong><?php esc_html_e( 'How likely are you to recommend GravityView?', 'gravityview' ); ?></strong></p> |
| 315 | 315 | <ul class="inline"> |
| 316 | 316 | <?php |
| 317 | 317 | $i = 0; |
| 318 | - while( $i < 11 ) { |
|
| 319 | - echo '<li class="inline number-scale"><label><input name="likely_to_refer" id="likely_to_refer_'.$i.'" value="'.$i.'" type="radio"> '.$i.'</label></li>'; |
|
| 318 | + while ( $i < 11 ) { |
|
| 319 | + echo '<li class="inline number-scale"><label><input name="likely_to_refer" id="likely_to_refer_' . $i . '" value="' . $i . '" type="radio"> ' . $i . '</label></li>'; |
|
| 320 | 320 | $i++; |
| 321 | 321 | } |
| 322 | 322 | ?> |
@@ -533,15 +533,15 @@ discard block |
||
| 533 | 533 | * @return string The HTML |
| 534 | 534 | */ |
| 535 | 535 | public function as_html( $field, $echo = true ) { |
| 536 | - $field['type'] = ( isset( $field['type'] ) && in_array( $field['type'], array( 'submit','reset','button' ) ) ) ? $field['type'] : 'submit'; |
|
| 536 | + $field[ 'type' ] = ( isset( $field[ 'type' ] ) && in_array( $field[ 'type' ], array( 'submit', 'reset', 'button' ) ) ) ? $field[ 'type' ] : 'submit'; |
|
| 537 | 537 | |
| 538 | 538 | $attributes = $this->get_field_attributes( $field ); |
| 539 | 539 | $default_value = Utils::get( $field, 'value', Utils::get( $field, 'default_value' ) ); |
| 540 | - $value = $this->get( $field['name'], $default_value ); |
|
| 540 | + $value = $this->get( $field[ 'name' ], $default_value ); |
|
| 541 | 541 | |
| 542 | 542 | |
| 543 | - $attributes['class'] = isset( $attributes['class'] ) ? esc_attr( $attributes['class'] ) : 'button-primary gfbutton'; |
|
| 544 | - $name = ( $field['name'] === 'gform-settings-save' ) ? $field['name'] : '_gaddon_setting_' . $field['name']; |
|
| 543 | + $attributes[ 'class' ] = isset( $attributes[ 'class' ] ) ? esc_attr( $attributes[ 'class' ] ) : 'button-primary gfbutton'; |
|
| 544 | + $name = ( $field[ 'name' ] === 'gform-settings-save' ) ? $field[ 'name' ] : '_gaddon_setting_' . $field[ 'name' ]; |
|
| 545 | 545 | |
| 546 | 546 | if ( empty( $value ) ) { |
| 547 | 547 | $value = __( 'Update Settings', 'gravityview' ); |
@@ -550,7 +550,7 @@ discard block |
||
| 550 | 550 | $attributes = $this->get_field_attributes( $field ); |
| 551 | 551 | |
| 552 | 552 | $html = '<input |
| 553 | - type="' . $field['type'] . '" |
|
| 553 | + type="' . $field[ 'type' ] . '" |
|
| 554 | 554 | name="' . esc_attr( $name ) . '" |
| 555 | 555 | value="' . $value . '" ' . |
| 556 | 556 | implode( ' ', $attributes ) . |
@@ -581,7 +581,7 @@ discard block |
||
| 581 | 581 | * @return bool |
| 582 | 582 | */ |
| 583 | 583 | public function is_save_postback() { |
| 584 | - return isset( $_POST['gform-settings-save'] ) && isset( $_POST['_gravityview_save_settings_nonce'] ); |
|
| 584 | + return isset( $_POST[ 'gform-settings-save' ] ) && isset( $_POST[ '_gravityview_save_settings_nonce' ] ); |
|
| 585 | 585 | } |
| 586 | 586 | |
| 587 | 587 | /** |
@@ -591,7 +591,7 @@ discard block |
||
| 591 | 591 | */ |
| 592 | 592 | public function license_key_notice() { |
| 593 | 593 | |
| 594 | - if( $this->is_save_postback() ) { |
|
| 594 | + if ( $this->is_save_postback() ) { |
|
| 595 | 595 | $settings = $this->get_posted_settings(); |
| 596 | 596 | $license_key = \GV\Utils::get( $settings, 'license_key' ); |
| 597 | 597 | $license_status = \GV\Utils::get( $settings, 'license_key_status', 'inactive' ); |
@@ -612,7 +612,7 @@ discard block |
||
| 612 | 612 | * but didn't want to mess up the translation strings for the translators. |
| 613 | 613 | */ |
| 614 | 614 | $message = mb_substr( $message, 0, mb_strlen( $message ) - 1 ); |
| 615 | - $title = __( 'Inactive License', 'gravityview'); |
|
| 615 | + $title = __( 'Inactive License', 'gravityview' ); |
|
| 616 | 616 | $status = ''; |
| 617 | 617 | $update_below = false; |
| 618 | 618 | $primary_button_link = admin_url( 'edit.php?post_type=gravityview&page=gravityview_settings' ); |
@@ -642,7 +642,7 @@ discard block |
||
| 642 | 642 | $update_below = __( 'Activate your license key below.', 'gravityview' ); |
| 643 | 643 | break; |
| 644 | 644 | } |
| 645 | - $url = 'https://gravityview.co/pricing/?utm_source=admin_notice&utm_medium=admin&utm_content='.$license_status.'&utm_campaign=Admin%20Notice'; |
|
| 645 | + $url = 'https://gravityview.co/pricing/?utm_source=admin_notice&utm_medium=admin&utm_content=' . $license_status . '&utm_campaign=Admin%20Notice'; |
|
| 646 | 646 | |
| 647 | 647 | // Show a different notice on settings page for inactive licenses (hide the buttons) |
| 648 | 648 | if ( $update_below && gravityview_is_admin_page( '', 'settings' ) ) { |
@@ -686,7 +686,7 @@ discard block |
||
| 686 | 686 | public function scripts() { |
| 687 | 687 | $scripts = parent::scripts(); |
| 688 | 688 | |
| 689 | - $scripts[] = array( |
|
| 689 | + $scripts[ ] = array( |
|
| 690 | 690 | 'handle' => 'gform_tooltip_init', |
| 691 | 691 | 'enqueue' => array( |
| 692 | 692 | array( |
@@ -705,7 +705,7 @@ discard block |
||
| 705 | 705 | public function styles() { |
| 706 | 706 | $styles = parent::styles(); |
| 707 | 707 | |
| 708 | - $styles[] = array( |
|
| 708 | + $styles[ ] = array( |
|
| 709 | 709 | 'handle' => 'gravityview_settings', |
| 710 | 710 | 'src' => plugins_url( 'assets/css/admin-settings.css', GRAVITYVIEW_FILE ), |
| 711 | 711 | 'version' => Plugin::$version, |
@@ -736,7 +736,7 @@ discard block |
||
| 736 | 736 | * If multisite and not network admin, we don't want the settings to show. |
| 737 | 737 | * @since 1.7.6 |
| 738 | 738 | */ |
| 739 | - $show_submenu = ( ! is_multisite() ) || is_main_site() || ( ! gravityview()->plugin->is_network_activated() ) || ( is_network_admin() && gravityview()->plugin->is_network_activated() ); |
|
| 739 | + $show_submenu = ( ! is_multisite() ) || is_main_site() || ( ! gravityview()->plugin->is_network_activated() ) || ( is_network_admin() && gravityview()->plugin->is_network_activated() ); |
|
| 740 | 740 | |
| 741 | 741 | /** |
| 742 | 742 | * Override whether to show the Settings menu on a per-blog basis. |
@@ -784,26 +784,26 @@ discard block |
||
| 784 | 784 | 'label' => __( 'License Key', 'gravityview' ), |
| 785 | 785 | 'description' => __( 'Enter the license key that was sent to you on purchase. This enables plugin updates & support.', 'gravityview' ) . $this->get_license_handler()->license_details( $this->get_app_setting( 'license_key_response' ) ), |
| 786 | 786 | 'type' => 'edd_license', |
| 787 | - 'disabled' => ( defined( 'GRAVITYVIEW_LICENSE_KEY' ) && GRAVITYVIEW_LICENSE_KEY ), |
|
| 787 | + 'disabled' => ( defined( 'GRAVITYVIEW_LICENSE_KEY' ) && GRAVITYVIEW_LICENSE_KEY ), |
|
| 788 | 788 | 'data-pending-text' => __( 'Verifying license…', 'gravityview' ), |
| 789 | - 'default_value' => $default_settings['license_key'], |
|
| 789 | + 'default_value' => $default_settings[ 'license_key' ], |
|
| 790 | 790 | 'class' => ( '' == $this->get( 'license_key' ) ) ? 'activate code regular-text edd-license-key' : 'deactivate code regular-text edd-license-key', |
| 791 | 791 | ), |
| 792 | 792 | array( |
| 793 | 793 | 'name' => 'license_key_response', |
| 794 | - 'default_value' => $default_settings['license_key_response'], |
|
| 794 | + 'default_value' => $default_settings[ 'license_key_response' ], |
|
| 795 | 795 | 'type' => 'hidden', |
| 796 | 796 | ), |
| 797 | 797 | array( |
| 798 | 798 | 'name' => 'license_key_status', |
| 799 | - 'default_value' => $default_settings['license_key_status'], |
|
| 799 | + 'default_value' => $default_settings[ 'license_key_status' ], |
|
| 800 | 800 | 'type' => 'hidden', |
| 801 | 801 | ), |
| 802 | 802 | array( |
| 803 | 803 | 'name' => 'support-email', |
| 804 | 804 | 'type' => 'text', |
| 805 | 805 | 'validate' => 'email', |
| 806 | - 'default_value' => $default_settings['support-email'], |
|
| 806 | + 'default_value' => $default_settings[ 'support-email' ], |
|
| 807 | 807 | 'label' => __( 'Support Email', 'gravityview' ), |
| 808 | 808 | 'description' => __( 'In order to provide responses to your support requests, please provide your email address.', 'gravityview' ), |
| 809 | 809 | 'class' => 'code regular-text', |
@@ -815,7 +815,7 @@ discard block |
||
| 815 | 815 | 'name' => 'support_port', |
| 816 | 816 | 'type' => 'radio', |
| 817 | 817 | 'label' => __( 'Show Support Port?', 'gravityview' ), |
| 818 | - 'default_value' => $default_settings['support_port'], |
|
| 818 | + 'default_value' => $default_settings[ 'support_port' ], |
|
| 819 | 819 | 'horizontal' => 1, |
| 820 | 820 | 'choices' => array( |
| 821 | 821 | array( |
@@ -834,7 +834,7 @@ discard block |
||
| 834 | 834 | 'name' => 'no-conflict-mode', |
| 835 | 835 | 'type' => 'radio', |
| 836 | 836 | 'label' => __( 'No-Conflict Mode', 'gravityview' ), |
| 837 | - 'default_value' => $default_settings['no-conflict-mode'], |
|
| 837 | + 'default_value' => $default_settings[ 'no-conflict-mode' ], |
|
| 838 | 838 | 'horizontal' => 1, |
| 839 | 839 | 'choices' => array( |
| 840 | 840 | array( |
@@ -856,7 +856,7 @@ discard block |
||
| 856 | 856 | 'name' => 'rest_api', |
| 857 | 857 | 'type' => 'radio', |
| 858 | 858 | 'label' => __( 'REST API', 'gravityview' ), |
| 859 | - 'default_value' => $default_settings['rest_api'], |
|
| 859 | + 'default_value' => $default_settings[ 'rest_api' ], |
|
| 860 | 860 | 'horizontal' => 1, |
| 861 | 861 | 'choices' => array( |
| 862 | 862 | array( |
@@ -875,7 +875,7 @@ discard block |
||
| 875 | 875 | 'name' => 'beta', |
| 876 | 876 | 'type' => 'checkbox', |
| 877 | 877 | 'label' => __( 'Become a Beta Tester', 'gravityview' ), |
| 878 | - 'default_value' => $default_settings['beta'], |
|
| 878 | + 'default_value' => $default_settings[ 'beta' ], |
|
| 879 | 879 | 'horizontal' => 1, |
| 880 | 880 | 'choices' => array( |
| 881 | 881 | array( |
@@ -908,17 +908,17 @@ discard block |
||
| 908 | 908 | * @since 1.7.4 |
| 909 | 909 | */ |
| 910 | 910 | foreach ( $fields as &$field ) { |
| 911 | - $field['name'] = isset( $field['name'] ) ? $field['name'] : Utils::get( $field, 'id' ); |
|
| 912 | - $field['label'] = isset( $field['label'] ) ? $field['label'] : Utils::get( $field, 'title' ); |
|
| 913 | - $field['default_value'] = isset( $field['default_value'] ) ? $field['default_value'] : Utils::get( $field, 'default' ); |
|
| 914 | - $field['description'] = isset( $field['description'] ) ? $field['description'] : Utils::get( $field, 'subtitle' ); |
|
| 911 | + $field[ 'name' ] = isset( $field[ 'name' ] ) ? $field[ 'name' ] : Utils::get( $field, 'id' ); |
|
| 912 | + $field[ 'label' ] = isset( $field[ 'label' ] ) ? $field[ 'label' ] : Utils::get( $field, 'title' ); |
|
| 913 | + $field[ 'default_value' ] = isset( $field[ 'default_value' ] ) ? $field[ 'default_value' ] : Utils::get( $field, 'default' ); |
|
| 914 | + $field[ 'description' ] = isset( $field[ 'description' ] ) ? $field[ 'description' ] : Utils::get( $field, 'subtitle' ); |
|
| 915 | 915 | |
| 916 | 916 | if ( $disabled_attribute ) { |
| 917 | - $field['disabled'] = $disabled_attribute; |
|
| 917 | + $field[ 'disabled' ] = $disabled_attribute; |
|
| 918 | 918 | } |
| 919 | 919 | |
| 920 | - if ( empty( $field['disabled'] ) ) { |
|
| 921 | - unset( $field['disabled'] ); |
|
| 920 | + if ( empty( $field[ 'disabled' ] ) ) { |
|
| 921 | + unset( $field[ 'disabled' ] ); |
|
| 922 | 922 | } |
| 923 | 923 | } |
| 924 | 924 | |
@@ -936,7 +936,7 @@ discard block |
||
| 936 | 936 | ); |
| 937 | 937 | |
| 938 | 938 | if ( $disabled_attribute ) { |
| 939 | - $button['disabled'] = $disabled_attribute; |
|
| 939 | + $button[ 'disabled' ] = $disabled_attribute; |
|
| 940 | 940 | } |
| 941 | 941 | |
| 942 | 942 | /** |
@@ -955,20 +955,20 @@ discard block |
||
| 955 | 955 | // If there are extensions, add a section for them |
| 956 | 956 | if ( ! empty( $extension_sections ) ) { |
| 957 | 957 | |
| 958 | - if( $disabled_attribute ) { |
|
| 958 | + if ( $disabled_attribute ) { |
|
| 959 | 959 | foreach ( $extension_sections as &$section ) { |
| 960 | - foreach ( $section['fields'] as &$field ) { |
|
| 961 | - $field['disabled'] = $disabled_attribute; |
|
| 960 | + foreach ( $section[ 'fields' ] as &$field ) { |
|
| 961 | + $field[ 'disabled' ] = $disabled_attribute; |
|
| 962 | 962 | } |
| 963 | 963 | } |
| 964 | 964 | } |
| 965 | 965 | |
| 966 | - $k = count( $extension_sections ) - 1 ; |
|
| 967 | - $extension_sections[ $k ]['fields'][] = $button; |
|
| 966 | + $k = count( $extension_sections ) - 1; |
|
| 967 | + $extension_sections[ $k ][ 'fields' ][ ] = $button; |
|
| 968 | 968 | $sections = array_merge( $sections, $extension_sections ); |
| 969 | 969 | } else { |
| 970 | 970 | // add the 'update settings' button to the general section |
| 971 | - $sections[0]['fields'][] = $button; |
|
| 971 | + $sections[ 0 ][ 'fields' ][ ] = $button; |
|
| 972 | 972 | } |
| 973 | 973 | |
| 974 | 974 | return $sections; |
@@ -1024,7 +1024,7 @@ discard block |
||
| 1024 | 1024 | protected function settings_edd_license( $field, $echo = true ) { |
| 1025 | 1025 | |
| 1026 | 1026 | if ( defined( 'GRAVITYVIEW_LICENSE_KEY' ) && GRAVITYVIEW_LICENSE_KEY ) { |
| 1027 | - $field['input_type'] = 'password'; |
|
| 1027 | + $field[ 'input_type' ] = 'password'; |
|
| 1028 | 1028 | } |
| 1029 | 1029 | |
| 1030 | 1030 | $text = $this->settings_text( $field, false ); |
@@ -1073,7 +1073,7 @@ discard block |
||
| 1073 | 1073 | public function single_setting_row_html( $field ) { |
| 1074 | 1074 | ?> |
| 1075 | 1075 | |
| 1076 | - <tr id="gaddon-setting-row-<?php echo esc_attr( $field['name'] ); ?>"> |
|
| 1076 | + <tr id="gaddon-setting-row-<?php echo esc_attr( $field[ 'name' ] ); ?>"> |
|
| 1077 | 1077 | <td colspan="2"> |
| 1078 | 1078 | <?php $this->single_setting( $field ); ?> |
| 1079 | 1079 | </td> |
@@ -1091,10 +1091,10 @@ discard block |
||
| 1091 | 1091 | * @return string |
| 1092 | 1092 | */ |
| 1093 | 1093 | public function settings_save( $field, $echo = true ) { |
| 1094 | - $field['type'] = 'submit'; |
|
| 1095 | - $field['name'] = 'gform-settings-save'; |
|
| 1096 | - $field['class'] = isset( $field['class'] ) ? $field['class'] : 'button-primary gfbutton'; |
|
| 1097 | - $field['value'] = Utils::get( $field, 'value', __( 'Update Settings', 'gravityview' ) ); |
|
| 1094 | + $field[ 'type' ] = 'submit'; |
|
| 1095 | + $field[ 'name' ] = 'gform-settings-save'; |
|
| 1096 | + $field[ 'class' ] = isset( $field[ 'class' ] ) ? $field[ 'class' ] : 'button-primary gfbutton'; |
|
| 1097 | + $field[ 'value' ] = Utils::get( $field, 'value', __( 'Update Settings', 'gravityview' ) ); |
|
| 1098 | 1098 | |
| 1099 | 1099 | $output = $this->settings_submit( $field, false ); |
| 1100 | 1100 | |
@@ -1125,8 +1125,8 @@ discard block |
||
| 1125 | 1125 | * @return void |
| 1126 | 1126 | */ |
| 1127 | 1127 | public function single_setting_row( $field ) { |
| 1128 | - $field['gv_description'] = Utils::get( $field, 'description' ); |
|
| 1129 | - $field['description'] = Utils::get( $field, 'subtitle' ); |
|
| 1128 | + $field[ 'gv_description' ] = Utils::get( $field, 'description' ); |
|
| 1129 | + $field[ 'description' ] = Utils::get( $field, 'subtitle' ); |
|
| 1130 | 1130 | parent::single_setting_row( $field ); |
| 1131 | 1131 | } |
| 1132 | 1132 | |
@@ -1138,7 +1138,7 @@ discard block |
||
| 1138 | 1138 | public function single_setting_label( $field ) { |
| 1139 | 1139 | parent::single_setting_label( $field ); |
| 1140 | 1140 | if ( $description = Utils::get( $field, 'gv_description' ) ) { |
| 1141 | - echo '<span class="description">'. $description .'</span>'; |
|
| 1141 | + echo '<span class="description">' . $description . '</span>'; |
|
| 1142 | 1142 | } |
| 1143 | 1143 | } |
| 1144 | 1144 | |
@@ -1175,9 +1175,9 @@ discard block |
||
| 1175 | 1175 | // If the posted key doesn't match the activated/deactivated key (set using the Activate License button, AJAX response), |
| 1176 | 1176 | // then we assume it's changed. If it's changed, unset the status and the previous response. |
| 1177 | 1177 | if ( $local_key !== $response_key ) { |
| 1178 | - unset( $posted_settings['license_key_response'] ); |
|
| 1179 | - unset( $posted_settings['license_key_status'] ); |
|
| 1180 | - \GFCommon::add_error_message( __('The license key you entered has been saved, but not activated. Please activate the license.', 'gravityview' ) ); |
|
| 1178 | + unset( $posted_settings[ 'license_key_response' ] ); |
|
| 1179 | + unset( $posted_settings[ 'license_key_status' ] ); |
|
| 1180 | + \GFCommon::add_error_message( __( 'The license key you entered has been saved, but not activated. Please activate the license.', 'gravityview' ) ); |
|
| 1181 | 1181 | } |
| 1182 | 1182 | return $posted_settings; |
| 1183 | 1183 | } |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | ); |
| 101 | 101 | |
| 102 | 102 | if ( ! empty( $action ) ) { |
| 103 | - $settings['edd_action'] = esc_attr( $action ); |
|
| 103 | + $settings[ 'edd_action' ] = esc_attr( $action ); |
|
| 104 | 104 | } |
| 105 | 105 | |
| 106 | 106 | return array_map( 'urlencode', $settings ); |
@@ -156,7 +156,7 @@ discard block |
||
| 156 | 156 | 'format' => 'json', |
| 157 | 157 | ) ); |
| 158 | 158 | |
| 159 | - if ( $is_ajax && empty( $data['license'] ) ) { |
|
| 159 | + if ( $is_ajax && empty( $data[ 'license' ] ) ) { |
|
| 160 | 160 | die( -1 ); |
| 161 | 161 | } |
| 162 | 162 | |
@@ -184,12 +184,12 @@ discard block |
||
| 184 | 184 | |
| 185 | 185 | $json = json_encode( $license_data ); |
| 186 | 186 | |
| 187 | - $update_license = Utils::get( $data, 'update' ) || 'gravityview_license' === Utils::_POST('action'); |
|
| 187 | + $update_license = Utils::get( $data, 'update' ) || 'gravityview_license' === Utils::_POST( 'action' ); |
|
| 188 | 188 | |
| 189 | 189 | $is_check_action_button = ( 'check_license' === Utils::get( $data, 'edd_action' ) && defined( 'DOING_AJAX' ) && DOING_AJAX ); |
| 190 | 190 | |
| 191 | 191 | if ( 'deactivate_license' === Utils::get( $data, 'edd_action' ) ) { |
| 192 | - do_action('gravityview/admin_installer/delete_downloads_data', true ); |
|
| 192 | + do_action( 'gravityview/admin_installer/delete_downloads_data', true ); |
|
| 193 | 193 | } |
| 194 | 194 | |
| 195 | 195 | if ( $is_check_action_button ) { |
@@ -201,7 +201,7 @@ discard block |
||
| 201 | 201 | // most likely a mistake. |
| 202 | 202 | } else if ( $license_data->license !== 'failed' && $update_license ) { |
| 203 | 203 | |
| 204 | - if ( ! empty( $data['field_id'] ) ) { |
|
| 204 | + if ( ! empty( $data[ 'field_id' ] ) ) { |
|
| 205 | 205 | set_transient( self::status_transient_key, $license_data, DAY_IN_SECONDS ); |
| 206 | 206 | } |
| 207 | 207 | |
@@ -228,7 +228,7 @@ discard block |
||
| 228 | 228 | if ( empty( $license_data ) ) { |
| 229 | 229 | $message = ''; |
| 230 | 230 | } else { |
| 231 | - if( ! empty( $license_data->error ) ) { |
|
| 231 | + if ( ! empty( $license_data->error ) ) { |
|
| 232 | 232 | $class = 'error'; |
| 233 | 233 | $string_key = $license_data->error; |
| 234 | 234 | } else { $class = $license_data->license; |
@@ -254,17 +254,17 @@ discard block |
||
| 254 | 254 | */ |
| 255 | 255 | public function license_details( $response = array() ) { |
| 256 | 256 | |
| 257 | - $response = (array) $response; |
|
| 257 | + $response = (array)$response; |
|
| 258 | 258 | |
| 259 | 259 | $return = ''; |
| 260 | 260 | $wrapper = '<span class="gv-license-details" aria-live="polite" aria-busy="false">%s</span>'; |
| 261 | 261 | |
| 262 | - if ( ! empty( $response['license_key'] ) ) { |
|
| 262 | + if ( ! empty( $response[ 'license_key' ] ) ) { |
|
| 263 | 263 | $return .= '<h3>' . esc_html__( 'License Details:', 'gravityview' ) . '</h3>'; |
| 264 | 264 | |
| 265 | 265 | if ( in_array( Utils::get( $response, 'license' ), array( 'invalid', 'deactivated' ) ) ) { |
| 266 | - $return .= $this->strings( $response['license'], $response ); |
|
| 267 | - } elseif ( ! empty( $response['license_name'] ) ) { |
|
| 266 | + $return .= $this->strings( $response[ 'license' ], $response ); |
|
| 267 | + } elseif ( ! empty( $response[ 'license_name' ] ) ) { |
|
| 268 | 268 | $response_keys = array( |
| 269 | 269 | 'license_name' => '', |
| 270 | 270 | 'license_limit' => '', |
@@ -278,19 +278,19 @@ discard block |
||
| 278 | 278 | // Make sure all the keys are set |
| 279 | 279 | $response = wp_parse_args( $response, $response_keys ); |
| 280 | 280 | |
| 281 | - $login_link = sprintf( '<a href="%s" class="howto" rel="external">%s</a>', esc_url( sprintf( 'https://gravityview.co/wp-login.php?username=%s', $response['customer_email'] ) ), esc_html__( 'Access your GravityView account', 'gravityview' ) ); |
|
| 282 | - $local_text = ( ! empty( $response['is_local'] ) ? '<span class="howto">' . __( 'This development site does not count toward license activation limits', 'gravityview' ) . '</span>' : '' ); |
|
| 281 | + $login_link = sprintf( '<a href="%s" class="howto" rel="external">%s</a>', esc_url( sprintf( 'https://gravityview.co/wp-login.php?username=%s', $response[ 'customer_email' ] ) ), esc_html__( 'Access your GravityView account', 'gravityview' ) ); |
|
| 282 | + $local_text = ( ! empty( $response[ 'is_local' ] ) ? '<span class="howto">' . __( 'This development site does not count toward license activation limits', 'gravityview' ) . '</span>' : '' ); |
|
| 283 | 283 | $details = array( |
| 284 | - 'license' => sprintf( esc_html__( 'License level: %s', 'gravityview' ), esc_html( $response['license_name'] ), esc_html( $response['license_limit'] ) ), |
|
| 285 | - 'licensed_to' => sprintf( esc_html_x( 'Licensed to: %1$s (%2$s)', '1: Customer name; 2: Customer email', 'gravityview' ), esc_html__( $response['customer_name'], 'gravityview' ), esc_html__( $response['customer_email'], 'gravityview' ) ) . $login_link, |
|
| 286 | - 'activations' => sprintf( esc_html__( 'Activations: %d of %s sites', 'gravityview' ), intval( $response['site_count'] ), esc_html( $response['license_limit'] ) ) . $local_text, |
|
| 287 | - 'expires' => 'lifetime' === $response['expires'] ? '' : sprintf( esc_html__( 'Renew on: %s', 'gravityview' ), date_i18n( get_option( 'date_format' ), strtotime( $response['expires'] ) - DAY_IN_SECONDS ) ), |
|
| 288 | - 'upgrade' => $this->get_upgrade_html( $response['upgrades'] ), |
|
| 284 | + 'license' => sprintf( esc_html__( 'License level: %s', 'gravityview' ), esc_html( $response[ 'license_name' ] ), esc_html( $response[ 'license_limit' ] ) ), |
|
| 285 | + 'licensed_to' => sprintf( esc_html_x( 'Licensed to: %1$s (%2$s)', '1: Customer name; 2: Customer email', 'gravityview' ), esc_html__( $response[ 'customer_name' ], 'gravityview' ), esc_html__( $response[ 'customer_email' ], 'gravityview' ) ) . $login_link, |
|
| 286 | + 'activations' => sprintf( esc_html__( 'Activations: %d of %s sites', 'gravityview' ), intval( $response[ 'site_count' ] ), esc_html( $response[ 'license_limit' ] ) ) . $local_text, |
|
| 287 | + 'expires' => 'lifetime' === $response[ 'expires' ] ? '' : sprintf( esc_html__( 'Renew on: %s', 'gravityview' ), date_i18n( get_option( 'date_format' ), strtotime( $response[ 'expires' ] ) - DAY_IN_SECONDS ) ), |
|
| 288 | + 'upgrade' => $this->get_upgrade_html( $response[ 'upgrades' ] ), |
|
| 289 | 289 | ); |
| 290 | 290 | |
| 291 | - if ( ! empty( $response['error'] ) && 'expired' === $response['error'] ) { |
|
| 292 | - unset( $details['upgrade'] ); |
|
| 293 | - $details['expires'] = '<div class="error inline"><p>' . $this->strings( 'expired', $response ) . '</p></div>'; |
|
| 291 | + if ( ! empty( $response[ 'error' ] ) && 'expired' === $response[ 'error' ] ) { |
|
| 292 | + unset( $details[ 'upgrade' ] ); |
|
| 293 | + $details[ 'expires' ] = '<div class="error inline"><p>' . $this->strings( 'expired', $response ) . '</p></div>'; |
|
| 294 | 294 | } |
| 295 | 295 | |
| 296 | 296 | $return .= '<ul><li>' . implode( '</li><li>', array_filter( $details ) ) . '</li></ul>'; |
@@ -316,20 +316,20 @@ discard block |
||
| 316 | 316 | if ( ! empty( $upgrades ) ) { |
| 317 | 317 | |
| 318 | 318 | $locale_parts = explode( '_', get_locale() ); |
| 319 | - $is_english = ( 'en' === $locale_parts[0] ); |
|
| 319 | + $is_english = ( 'en' === $locale_parts[ 0 ] ); |
|
| 320 | 320 | |
| 321 | 321 | $output .= '<h4>' . esc_html__( 'Upgrades available:', 'gravityview' ) . '</h4>'; |
| 322 | 322 | $output .= '<ul class="ul-disc">'; |
| 323 | 323 | |
| 324 | 324 | foreach ( $upgrades as $upgrade_id => $upgrade ) { |
| 325 | - $upgrade = (object) $upgrade; |
|
| 325 | + $upgrade = (object)$upgrade; |
|
| 326 | 326 | |
| 327 | 327 | $anchor_text = sprintf( esc_html_x( 'Upgrade to %1$s for %2$s', '1: GravityView upgrade name, 2: Cost of upgrade', 'gravityview' ), esc_attr( $upgrade->name ), esc_attr( $upgrade->price ) ); |
| 328 | 328 | |
| 329 | 329 | if ( $is_english && isset( $upgrade->description ) ) { |
| 330 | 330 | $message = esc_html( $upgrade->description ); |
| 331 | 331 | } else { |
| 332 | - switch( $upgrade->price_id ) { |
|
| 332 | + switch ( $upgrade->price_id ) { |
|
| 333 | 333 | // Interstellar |
| 334 | 334 | case 1: |
| 335 | 335 | default: |
@@ -388,7 +388,7 @@ discard block |
||
| 388 | 388 | 'invalid' => esc_html__( 'The license key entered is invalid.', 'gravityview' ), |
| 389 | 389 | 'missing' => esc_html__( 'Invalid license key.', 'gravityview' ), |
| 390 | 390 | 'revoked' => esc_html__( 'This license key has been revoked.', 'gravityview' ), |
| 391 | - 'expired' => sprintf( esc_html__( 'This license key has expired. %sRenew your license on the GravityView website%s to receive updates and support.', 'gravityview' ), '<a href="'. esc_url( $this->get_license_renewal_url( $license_data ) ) .'">', '</a>' ), |
|
| 391 | + 'expired' => sprintf( esc_html__( 'This license key has expired. %sRenew your license on the GravityView website%s to receive updates and support.', 'gravityview' ), '<a href="' . esc_url( $this->get_license_renewal_url( $license_data ) ) . '">', '</a>' ), |
|
| 392 | 392 | 'capability' => esc_html__( 'You don\'t have the ability to edit plugin settings.', 'gravityview' ), |
| 393 | 393 | |
| 394 | 394 | 'verifying_license' => esc_html__( 'Verifying license…', 'gravityview' ), |
@@ -417,7 +417,7 @@ discard block |
||
| 417 | 417 | |
| 418 | 418 | if ( ! empty( $license_data->renewal_url ) ) { |
| 419 | 419 | $renew_license_url = $license_data->renewal_url; |
| 420 | - } elseif( ! empty( $license_data->license_key ) ) { |
|
| 420 | + } elseif ( ! empty( $license_data->license_key ) ) { |
|
| 421 | 421 | $renew_license_url = sprintf( 'https://gravityview.co/checkout/?download_id=17&edd_license_key=%s', $license_data->license_key ); |
| 422 | 422 | } else { |
| 423 | 423 | $renew_license_url = 'https://gravityview.co/account/'; |
@@ -434,7 +434,7 @@ discard block |
||
| 434 | 434 | * @return array|\WP_Error |
| 435 | 435 | */ |
| 436 | 436 | private function _license_get_remote_response( $data, $license = '' ) { |
| 437 | - $api_params = $this->_get_edd_settings( $data['edd_action'], $license ); |
|
| 437 | + $api_params = $this->_get_edd_settings( $data[ 'edd_action' ], $license ); |
|
| 438 | 438 | |
| 439 | 439 | $url = add_query_arg( $api_params, self::url ); |
| 440 | 440 | |
@@ -474,9 +474,9 @@ discard block |
||
| 474 | 474 | private function license_call_update_settings( $license_data, $data ) { |
| 475 | 475 | $settings = array(); |
| 476 | 476 | |
| 477 | - $settings['license_key'] = $license_data->license_key = trim( $data['license'] ); |
|
| 478 | - $settings['license_key_status'] = $license_data->license; |
|
| 479 | - $settings['license_key_response'] = (array)$license_data; |
|
| 477 | + $settings[ 'license_key' ] = $license_data->license_key = trim( $data[ 'license' ] ); |
|
| 478 | + $settings[ 'license_key_status' ] = $license_data->license; |
|
| 479 | + $settings[ 'license_key_response' ] = (array)$license_data; |
|
| 480 | 480 | |
| 481 | 481 | $this->settings->set( $settings ); |
| 482 | 482 | } |
@@ -491,7 +491,7 @@ discard block |
||
| 491 | 491 | |
| 492 | 492 | if ( ! empty( $key ) ) { |
| 493 | 493 | $response = $this->settings->get( 'license_key_response' ); |
| 494 | - $response = is_array( $response ) ? (object) $response : json_decode( $response ); |
|
| 494 | + $response = is_array( $response ) ? (object)$response : json_decode( $response ); |
|
| 495 | 495 | } else { |
| 496 | 496 | $response = array(); |
| 497 | 497 | } |
@@ -533,11 +533,11 @@ discard block |
||
| 533 | 533 | |
| 534 | 534 | $submit = '<div class="gv-edd-button-wrapper">'; |
| 535 | 535 | foreach ( $fields as $field ) { |
| 536 | - $field['type'] = 'button'; |
|
| 537 | - $field['class'] = isset( $field['class'] ) ? $field['class'] . ' '. $class : $class; |
|
| 538 | - $field['style'] = 'margin-left: 10px;'; |
|
| 539 | - if( $disabled_attribute ) { |
|
| 540 | - $field['disabled'] = $disabled_attribute; |
|
| 536 | + $field[ 'type' ] = 'button'; |
|
| 537 | + $field[ 'class' ] = isset( $field[ 'class' ] ) ? $field[ 'class' ] . ' ' . $class : $class; |
|
| 538 | + $field[ 'style' ] = 'margin-left: 10px;'; |
|
| 539 | + if ( $disabled_attribute ) { |
|
| 540 | + $field[ 'disabled' ] = $disabled_attribute; |
|
| 541 | 541 | } |
| 542 | 542 | $submit .= $this->settings->as_html( $field, $echo ); |
| 543 | 543 | } |
@@ -616,7 +616,7 @@ discard block |
||
| 616 | 616 | 'url' => home_url(), |
| 617 | 617 | 'site_data' => $this->get_site_data(), |
| 618 | 618 | ), |
| 619 | - )); |
|
| 619 | + ) ); |
|
| 620 | 620 | |
| 621 | 621 | // make sure the response came back okay |
| 622 | 622 | if ( is_wp_error( $response ) ) { |
@@ -647,45 +647,45 @@ discard block |
||
| 647 | 647 | $theme_data = wp_get_theme(); |
| 648 | 648 | $theme = $theme_data->Name . ' ' . $theme_data->Version; |
| 649 | 649 | |
| 650 | - $data['gv_version'] = Plugin::$version; |
|
| 651 | - $data['php_version'] = phpversion(); |
|
| 652 | - $data['wp_version'] = get_bloginfo( 'version' ); |
|
| 653 | - $data['gf_version'] = \GFForms::$version; |
|
| 654 | - $data['server'] = Utils::get( $_SERVER, 'SERVER_SOFTWARE' ); |
|
| 655 | - $data['multisite'] = is_multisite(); |
|
| 656 | - $data['theme'] = $theme; |
|
| 657 | - $data['url'] = home_url(); |
|
| 658 | - $data['license_key'] = $this->settings->get( 'license_key' ); |
|
| 659 | - $data['beta'] = $this->settings->get( 'beta' ); |
|
| 650 | + $data[ 'gv_version' ] = Plugin::$version; |
|
| 651 | + $data[ 'php_version' ] = phpversion(); |
|
| 652 | + $data[ 'wp_version' ] = get_bloginfo( 'version' ); |
|
| 653 | + $data[ 'gf_version' ] = \GFForms::$version; |
|
| 654 | + $data[ 'server' ] = Utils::get( $_SERVER, 'SERVER_SOFTWARE' ); |
|
| 655 | + $data[ 'multisite' ] = is_multisite(); |
|
| 656 | + $data[ 'theme' ] = $theme; |
|
| 657 | + $data[ 'url' ] = home_url(); |
|
| 658 | + $data[ 'license_key' ] = $this->settings->get( 'license_key' ); |
|
| 659 | + $data[ 'beta' ] = $this->settings->get( 'beta' ); |
|
| 660 | 660 | |
| 661 | 661 | // View Data |
| 662 | 662 | $gravityview_posts = wp_count_posts( 'gravityview', 'readable' ); |
| 663 | 663 | |
| 664 | - $data['view_count'] = null; |
|
| 665 | - $data['view_first'] = null; |
|
| 666 | - $data['view_latest'] = null; |
|
| 664 | + $data[ 'view_count' ] = null; |
|
| 665 | + $data[ 'view_first' ] = null; |
|
| 666 | + $data[ 'view_latest' ] = null; |
|
| 667 | 667 | |
| 668 | 668 | if ( $gravityview_posts->publish ) { |
| 669 | - $data['view_count'] = $gravityview_posts->publish; |
|
| 669 | + $data[ 'view_count' ] = $gravityview_posts->publish; |
|
| 670 | 670 | |
| 671 | 671 | $first = get_posts( 'numberposts=1&post_type=gravityview&post_status=publish&order=ASC' ); |
| 672 | 672 | $latest = get_posts( 'numberposts=1&post_type=gravityview&post_status=publish&order=DESC' ); |
| 673 | 673 | |
| 674 | 674 | if ( $first = array_shift( $first ) ) { |
| 675 | - $data['view_first'] = $first->post_date; |
|
| 675 | + $data[ 'view_first' ] = $first->post_date; |
|
| 676 | 676 | } |
| 677 | 677 | if ( $latest = array_pop( $latest ) ) { |
| 678 | - $data['view_latest'] = $latest->post_date; |
|
| 678 | + $data[ 'view_latest' ] = $latest->post_date; |
|
| 679 | 679 | } |
| 680 | 680 | } |
| 681 | 681 | |
| 682 | 682 | // Form counts |
| 683 | 683 | if ( class_exists( 'GFFormsModel' ) ) { |
| 684 | 684 | $form_data = \GFFormsModel::get_form_count(); |
| 685 | - $data['forms_total'] = Utils::get( $form_data, 'total', 0 ); |
|
| 686 | - $data['forms_active'] = Utils::get( $form_data, 'active', 0 ); |
|
| 687 | - $data['forms_inactive'] = Utils::get( $form_data, 'inactive', 0 ); |
|
| 688 | - $data['forms_trash'] = Utils::get( $form_data, 'inactive', 0 ); |
|
| 685 | + $data[ 'forms_total' ] = Utils::get( $form_data, 'total', 0 ); |
|
| 686 | + $data[ 'forms_active' ] = Utils::get( $form_data, 'active', 0 ); |
|
| 687 | + $data[ 'forms_inactive' ] = Utils::get( $form_data, 'inactive', 0 ); |
|
| 688 | + $data[ 'forms_trash' ] = Utils::get( $form_data, 'inactive', 0 ); |
|
| 689 | 689 | } |
| 690 | 690 | |
| 691 | 691 | // Retrieve current plugin information |
@@ -693,13 +693,13 @@ discard block |
||
| 693 | 693 | include ABSPATH . '/wp-admin/includes/plugin.php'; |
| 694 | 694 | } |
| 695 | 695 | |
| 696 | - $data['integrations'] = self::get_related_plugins_and_extensions(); |
|
| 697 | - $data['active_plugins'] = get_option( 'active_plugins', array() ); |
|
| 698 | - $data['inactive_plugins'] = array(); |
|
| 699 | - $data['locale'] = get_locale(); |
|
| 696 | + $data[ 'integrations' ] = self::get_related_plugins_and_extensions(); |
|
| 697 | + $data[ 'active_plugins' ] = get_option( 'active_plugins', array() ); |
|
| 698 | + $data[ 'inactive_plugins' ] = array(); |
|
| 699 | + $data[ 'locale' ] = get_locale(); |
|
| 700 | 700 | |
| 701 | 701 | // Validate request on the GV server |
| 702 | - $data['hash'] = 'gv_version.url.locale:' . sha1( $data['gv_version'] . $data['url'] . $data['locale'] ); |
|
| 702 | + $data[ 'hash' ] = 'gv_version.url.locale:' . sha1( $data[ 'gv_version' ] . $data[ 'url' ] . $data[ 'locale' ] ); |
|
| 703 | 703 | |
| 704 | 704 | return $data; |
| 705 | 705 | } |
@@ -729,7 +729,7 @@ discard block |
||
| 729 | 729 | |
| 730 | 730 | $plugin_data = get_plugin_data( $active_plugin ); |
| 731 | 731 | |
| 732 | - $extensions[] = sprintf( '%s %s', $plugin_data['Name'], $plugin_data['Version'] ); |
|
| 732 | + $extensions[ ] = sprintf( '%s %s', $plugin_data[ 'Name' ], $plugin_data[ 'Version' ] ); |
|
| 733 | 733 | } |
| 734 | 734 | |
| 735 | 735 | if ( ! empty( $extensions ) ) { |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | |
| 133 | 133 | $format = '(?:\.(?P<format>html|json))?'; |
| 134 | 134 | |
| 135 | - register_rest_route( $namespace, sprintf( '/%s/(?P<id>[\d]+)/%s/(?P<s_id>[\w-]+)%s', $base, $sub_type, $format ) , array( |
|
| 135 | + register_rest_route( $namespace, sprintf( '/%s/(?P<id>[\d]+)/%s/(?P<s_id>[\w-]+)%s', $base, $sub_type, $format ), array( |
|
| 136 | 136 | array( |
| 137 | 137 | 'methods' => \WP_REST_Server::READABLE, |
| 138 | 138 | 'callback' => array( $this, 'get_sub_item' ), |
@@ -383,7 +383,7 @@ discard block |
||
| 383 | 383 | * @return \WP_REST_Response |
| 384 | 384 | */ |
| 385 | 385 | protected function not_implemented( ) { |
| 386 | - $error = new \WP_Error( 'not-implemented-yet', __( 'Endpoint Not Yet Implemented.', 'gravityview' ) ); |
|
| 386 | + $error = new \WP_Error( 'not-implemented-yet', __( 'Endpoint Not Yet Implemented.', 'gravityview' ) ); |
|
| 387 | 387 | return new \WP_REST_Response( $error, 501 ); |
| 388 | 388 | } |
| 389 | 389 | |
@@ -282,7 +282,7 @@ |
||
| 282 | 282 | /** |
| 283 | 283 | * Process edit entry form save |
| 284 | 284 | * |
| 285 | - * @param array $gv_data The View data. |
|
| 285 | + * @param GravityView_View_Data $gv_data The View data. |
|
| 286 | 286 | */ |
| 287 | 287 | private function process_save( $gv_data ) { |
| 288 | 288 | |
@@ -115,16 +115,16 @@ discard block |
||
| 115 | 115 | function load() { |
| 116 | 116 | |
| 117 | 117 | /** @define "GRAVITYVIEW_DIR" "../../../" */ |
| 118 | - include_once( GRAVITYVIEW_DIR .'includes/class-admin-approve-entries.php' ); |
|
| 118 | + include_once( GRAVITYVIEW_DIR . 'includes/class-admin-approve-entries.php' ); |
|
| 119 | 119 | |
| 120 | 120 | // Don't display an embedded form when editing an entry |
| 121 | 121 | add_action( 'wp_head', array( $this, 'prevent_render_form' ) ); |
| 122 | 122 | add_action( 'wp_footer', array( $this, 'prevent_render_form' ) ); |
| 123 | 123 | |
| 124 | 124 | // Stop Gravity Forms processing what is ours! |
| 125 | - add_filter( 'wp', array( $this, 'prevent_maybe_process_form'), 8 ); |
|
| 125 | + add_filter( 'wp', array( $this, 'prevent_maybe_process_form' ), 8 ); |
|
| 126 | 126 | |
| 127 | - add_filter( 'gravityview_is_edit_entry', array( $this, 'is_edit_entry') ); |
|
| 127 | + add_filter( 'gravityview_is_edit_entry', array( $this, 'is_edit_entry' ) ); |
|
| 128 | 128 | |
| 129 | 129 | add_action( 'gravityview_edit_entry', array( $this, 'init' ) ); |
| 130 | 130 | |
@@ -135,7 +135,7 @@ discard block |
||
| 135 | 135 | add_filter( 'gform_plupload_settings', array( $this, 'modify_fileupload_settings' ), 10, 3 ); |
| 136 | 136 | |
| 137 | 137 | // Add fields expected by GFFormDisplay::validate() |
| 138 | - add_filter( 'gform_pre_validation', array( $this, 'gform_pre_validation') ); |
|
| 138 | + add_filter( 'gform_pre_validation', array( $this, 'gform_pre_validation' ) ); |
|
| 139 | 139 | |
| 140 | 140 | // Fix multiselect value for GF 2.2 |
| 141 | 141 | add_filter( 'gravityview/edit_entry/field_value_multiselect', array( $this, 'fix_multiselect_value_serialization' ), 10, 3 ); |
@@ -152,8 +152,8 @@ discard block |
||
| 152 | 152 | * @return void |
| 153 | 153 | */ |
| 154 | 154 | public function prevent_render_form() { |
| 155 | - if( $this->is_edit_entry() ) { |
|
| 156 | - if( 'wp_head' === current_filter() ) { |
|
| 155 | + if ( $this->is_edit_entry() ) { |
|
| 156 | + if ( 'wp_head' === current_filter() ) { |
|
| 157 | 157 | add_filter( 'gform_shortcode_form', '__return_empty_string' ); |
| 158 | 158 | } else { |
| 159 | 159 | remove_filter( 'gform_shortcode_form', '__return_empty_string' ); |
@@ -168,13 +168,13 @@ discard block |
||
| 168 | 168 | */ |
| 169 | 169 | public function prevent_maybe_process_form() { |
| 170 | 170 | |
| 171 | - if( ! empty( $_POST ) ) { |
|
| 171 | + if ( ! empty( $_POST ) ) { |
|
| 172 | 172 | gravityview()->log->debug( 'GravityView_Edit_Entry[prevent_maybe_process_form] $_POSTed data (sanitized): ', array( 'data' => esc_html( print_r( $_POST, true ) ) ) ); |
| 173 | 173 | } |
| 174 | 174 | |
| 175 | - if( $this->is_edit_entry_submission() ) { |
|
| 176 | - remove_action( 'wp', array( 'RGForms', 'maybe_process_form'), 9 ); |
|
| 177 | - remove_action( 'wp', array( 'GFForms', 'maybe_process_form'), 9 ); |
|
| 175 | + if ( $this->is_edit_entry_submission() ) { |
|
| 176 | + remove_action( 'wp', array( 'RGForms', 'maybe_process_form' ), 9 ); |
|
| 177 | + remove_action( 'wp', array( 'GFForms', 'maybe_process_form' ), 9 ); |
|
| 178 | 178 | } |
| 179 | 179 | } |
| 180 | 180 | |
@@ -184,7 +184,7 @@ discard block |
||
| 184 | 184 | */ |
| 185 | 185 | public function is_edit_entry() { |
| 186 | 186 | |
| 187 | - $is_edit_entry = GravityView_frontend::is_single_entry() && ! empty( $_GET['edit'] ); |
|
| 187 | + $is_edit_entry = GravityView_frontend::is_single_entry() && ! empty( $_GET[ 'edit' ] ); |
|
| 188 | 188 | |
| 189 | 189 | return ( $is_edit_entry || $this->is_edit_entry_submission() ); |
| 190 | 190 | } |
@@ -195,7 +195,7 @@ discard block |
||
| 195 | 195 | * @return boolean |
| 196 | 196 | */ |
| 197 | 197 | public function is_edit_entry_submission() { |
| 198 | - return !empty( $_POST[ self::$nonce_field ] ); |
|
| 198 | + return ! empty( $_POST[ self::$nonce_field ] ); |
|
| 199 | 199 | } |
| 200 | 200 | |
| 201 | 201 | /** |
@@ -208,8 +208,8 @@ discard block |
||
| 208 | 208 | |
| 209 | 209 | |
| 210 | 210 | $entries = $gravityview_view->getEntries(); |
| 211 | - self::$original_entry = $entries[0]; |
|
| 212 | - $this->entry = $entries[0]; |
|
| 211 | + self::$original_entry = $entries[ 0 ]; |
|
| 212 | + $this->entry = $entries[ 0 ]; |
|
| 213 | 213 | |
| 214 | 214 | self::$original_form = $gravityview_view->getForm(); |
| 215 | 215 | $this->form = $gravityview_view->getForm(); |
@@ -217,7 +217,7 @@ discard block |
||
| 217 | 217 | $this->view_id = $gravityview_view->getViewId(); |
| 218 | 218 | $this->post_id = \GV\Utils::get( $post, 'ID', null ); |
| 219 | 219 | |
| 220 | - self::$nonce_key = GravityView_Edit_Entry::get_nonce_key( $this->view_id, $this->form_id, $this->entry['id'] ); |
|
| 220 | + self::$nonce_key = GravityView_Edit_Entry::get_nonce_key( $this->view_id, $this->form_id, $this->entry[ 'id' ] ); |
|
| 221 | 221 | } |
| 222 | 222 | |
| 223 | 223 | |
@@ -268,9 +268,9 @@ discard block |
||
| 268 | 268 | private function print_scripts() { |
| 269 | 269 | $gravityview_view = GravityView_View::getInstance(); |
| 270 | 270 | |
| 271 | - wp_register_script( 'gform_gravityforms', GFCommon::get_base_url().'/js/gravityforms.js', array( 'jquery', 'gform_json', 'gform_placeholder', 'sack', 'plupload-all', 'gravityview-fe-view' ) ); |
|
| 271 | + wp_register_script( 'gform_gravityforms', GFCommon::get_base_url() . '/js/gravityforms.js', array( 'jquery', 'gform_json', 'gform_placeholder', 'sack', 'plupload-all', 'gravityview-fe-view' ) ); |
|
| 272 | 272 | |
| 273 | - GFFormDisplay::enqueue_form_scripts( $gravityview_view->getForm(), false); |
|
| 273 | + GFFormDisplay::enqueue_form_scripts( $gravityview_view->getForm(), false ); |
|
| 274 | 274 | |
| 275 | 275 | wp_localize_script( 'gravityview-fe-view', 'gvGlobals', array( 'cookiepath' => COOKIEPATH ) ); |
| 276 | 276 | |
@@ -286,19 +286,19 @@ discard block |
||
| 286 | 286 | */ |
| 287 | 287 | private function process_save( $gv_data ) { |
| 288 | 288 | |
| 289 | - if ( empty( $_POST ) || ! isset( $_POST['lid'] ) ) { |
|
| 289 | + if ( empty( $_POST ) || ! isset( $_POST[ 'lid' ] ) ) { |
|
| 290 | 290 | return; |
| 291 | 291 | } |
| 292 | 292 | |
| 293 | 293 | // Make sure the entry, view, and form IDs are all correct |
| 294 | 294 | $valid = $this->verify_nonce(); |
| 295 | 295 | |
| 296 | - if ( !$valid ) { |
|
| 296 | + if ( ! $valid ) { |
|
| 297 | 297 | gravityview()->log->error( 'Nonce validation failed.' ); |
| 298 | 298 | return; |
| 299 | 299 | } |
| 300 | 300 | |
| 301 | - if ( $this->entry['id'] !== $_POST['lid'] ) { |
|
| 301 | + if ( $this->entry[ 'id' ] !== $_POST[ 'lid' ] ) { |
|
| 302 | 302 | gravityview()->log->error( 'Entry ID did not match posted entry ID.' ); |
| 303 | 303 | return; |
| 304 | 304 | } |
@@ -309,7 +309,7 @@ discard block |
||
| 309 | 309 | |
| 310 | 310 | $this->validate(); |
| 311 | 311 | |
| 312 | - if( $this->is_valid ) { |
|
| 312 | + if ( $this->is_valid ) { |
|
| 313 | 313 | |
| 314 | 314 | gravityview()->log->debug( 'Submission is valid.' ); |
| 315 | 315 | |
@@ -321,22 +321,22 @@ discard block |
||
| 321 | 321 | /** |
| 322 | 322 | * @hack to avoid the capability validation of the method save_lead for GF 1.9+ |
| 323 | 323 | */ |
| 324 | - unset( $_GET['page'] ); |
|
| 324 | + unset( $_GET[ 'page' ] ); |
|
| 325 | 325 | |
| 326 | - $date_created = $this->entry['date_created']; |
|
| 326 | + $date_created = $this->entry[ 'date_created' ]; |
|
| 327 | 327 | |
| 328 | 328 | /** |
| 329 | 329 | * @hack to force Gravity Forms to use $read_value_from_post in GFFormsModel::save_lead() |
| 330 | 330 | * @since 1.17.2 |
| 331 | 331 | */ |
| 332 | - unset( $this->entry['date_created'] ); |
|
| 332 | + unset( $this->entry[ 'date_created' ] ); |
|
| 333 | 333 | |
| 334 | 334 | GFFormsModel::save_lead( $form, $this->entry ); |
| 335 | 335 | |
| 336 | 336 | // Delete the values for hidden inputs |
| 337 | 337 | $this->unset_hidden_field_values(); |
| 338 | 338 | |
| 339 | - $this->entry['date_created'] = $date_created; |
|
| 339 | + $this->entry[ 'date_created' ] = $date_created; |
|
| 340 | 340 | |
| 341 | 341 | // Process calculation fields |
| 342 | 342 | $this->update_calculation_fields(); |
@@ -358,7 +358,7 @@ discard block |
||
| 358 | 358 | * @param GravityView_Edit_Entry_Render $this This object |
| 359 | 359 | * @param GravityView_View_Data $gv_data The View data |
| 360 | 360 | */ |
| 361 | - do_action( 'gravityview/edit_entry/after_update', $this->form, $this->entry['id'], $this, $gv_data ); |
|
| 361 | + do_action( 'gravityview/edit_entry/after_update', $this->form, $this->entry[ 'id' ], $this, $gv_data ); |
|
| 362 | 362 | |
| 363 | 363 | } else { |
| 364 | 364 | gravityview()->log->error( 'Submission is NOT valid.', array( 'entry' => $this->entry ) ); |
@@ -386,16 +386,16 @@ discard block |
||
| 386 | 386 | */ |
| 387 | 387 | $unset_hidden_field_values = apply_filters( 'gravityview/edit_entry/unset_hidden_field_values', true, $this ); |
| 388 | 388 | |
| 389 | - if( ! $unset_hidden_field_values ) { |
|
| 389 | + if ( ! $unset_hidden_field_values ) { |
|
| 390 | 390 | return; |
| 391 | 391 | } |
| 392 | 392 | |
| 393 | 393 | if ( version_compare( GravityView_GFFormsModel::get_database_version(), '2.3-dev-1', '>=' ) && method_exists( 'GFFormsModel', 'get_entry_meta_table_name' ) ) { |
| 394 | 394 | $entry_meta_table = GFFormsModel::get_entry_meta_table_name(); |
| 395 | - $current_fields = $wpdb->get_results( $wpdb->prepare( "SELECT meta_key, meta_value FROM $entry_meta_table WHERE entry_id=%d", $this->entry['id'] ) ); |
|
| 395 | + $current_fields = $wpdb->get_results( $wpdb->prepare( "SELECT meta_key, meta_value FROM $entry_meta_table WHERE entry_id=%d", $this->entry[ 'id' ] ) ); |
|
| 396 | 396 | } else { |
| 397 | 397 | $lead_detail_table = GFFormsModel::get_lead_details_table_name(); |
| 398 | - $current_fields = $wpdb->get_results( $wpdb->prepare( "SELECT id, field_number FROM $lead_detail_table WHERE lead_id=%d", $this->entry['id'] ) ); |
|
| 398 | + $current_fields = $wpdb->get_results( $wpdb->prepare( "SELECT id, field_number FROM $lead_detail_table WHERE lead_id=%d", $this->entry[ 'id' ] ) ); |
|
| 399 | 399 | } |
| 400 | 400 | |
| 401 | 401 | foreach ( $this->entry as $input_id => $field_value ) { |
@@ -476,7 +476,7 @@ discard block |
||
| 476 | 476 | } |
| 477 | 477 | |
| 478 | 478 | /** No file is being uploaded. */ |
| 479 | - if ( empty( $_FILES[ $input_name ]['name'] ) ) { |
|
| 479 | + if ( empty( $_FILES[ $input_name ][ 'name' ] ) ) { |
|
| 480 | 480 | /** So return the original upload */ |
| 481 | 481 | return $entry[ $input_id ]; |
| 482 | 482 | } |
@@ -494,11 +494,11 @@ discard block |
||
| 494 | 494 | * @return mixed |
| 495 | 495 | */ |
| 496 | 496 | public function modify_fileupload_settings( $plupload_init, $form_id, $instance ) { |
| 497 | - if( ! $this->is_edit_entry() ) { |
|
| 497 | + if ( ! $this->is_edit_entry() ) { |
|
| 498 | 498 | return $plupload_init; |
| 499 | 499 | } |
| 500 | 500 | |
| 501 | - $plupload_init['gf_vars']['max_files'] = 0; |
|
| 501 | + $plupload_init[ 'gf_vars' ][ 'max_files' ] = 0; |
|
| 502 | 502 | |
| 503 | 503 | return $plupload_init; |
| 504 | 504 | } |
@@ -513,22 +513,22 @@ discard block |
||
| 513 | 513 | $form = $this->form; |
| 514 | 514 | |
| 515 | 515 | /** @var GF_Field $field */ |
| 516 | - foreach( $form['fields'] as $k => &$field ) { |
|
| 516 | + foreach ( $form[ 'fields' ] as $k => &$field ) { |
|
| 517 | 517 | |
| 518 | 518 | /** |
| 519 | 519 | * Remove the fields with calculation formulas before save to avoid conflicts with GF logic |
| 520 | 520 | * @since 1.16.3 |
| 521 | 521 | * @var GF_Field $field |
| 522 | 522 | */ |
| 523 | - if( $field->has_calculation() ) { |
|
| 524 | - unset( $form['fields'][ $k ] ); |
|
| 523 | + if ( $field->has_calculation() ) { |
|
| 524 | + unset( $form[ 'fields' ][ $k ] ); |
|
| 525 | 525 | } |
| 526 | 526 | |
| 527 | 527 | $field->adminOnly = false; |
| 528 | 528 | |
| 529 | - if( isset( $field->inputs ) && is_array( $field->inputs ) ) { |
|
| 530 | - foreach( $field->inputs as $key => $input ) { |
|
| 531 | - $field->inputs[ $key ][ 'id' ] = (string)$input['id']; |
|
| 529 | + if ( isset( $field->inputs ) && is_array( $field->inputs ) ) { |
|
| 530 | + foreach ( $field->inputs as $key => $input ) { |
|
| 531 | + $field->inputs[ $key ][ 'id' ] = (string)$input[ 'id' ]; |
|
| 532 | 532 | } |
| 533 | 533 | } |
| 534 | 534 | } |
@@ -542,30 +542,30 @@ discard block |
||
| 542 | 542 | $update = false; |
| 543 | 543 | |
| 544 | 544 | // get the most up to date entry values |
| 545 | - $entry = GFAPI::get_entry( $this->entry['id'] ); |
|
| 545 | + $entry = GFAPI::get_entry( $this->entry[ 'id' ] ); |
|
| 546 | 546 | |
| 547 | - if( !empty( $this->fields_with_calculation ) ) { |
|
| 547 | + if ( ! empty( $this->fields_with_calculation ) ) { |
|
| 548 | 548 | $update = true; |
| 549 | 549 | foreach ( $this->fields_with_calculation as $calc_field ) { |
| 550 | 550 | $inputs = $calc_field->get_entry_inputs(); |
| 551 | 551 | if ( is_array( $inputs ) ) { |
| 552 | 552 | foreach ( $inputs as $input ) { |
| 553 | - $input_name = 'input_' . str_replace( '.', '_', $input['id'] ); |
|
| 554 | - $entry[ strval( $input['id'] ) ] = RGFormsModel::prepare_value( $form, $calc_field, '', $input_name, $entry['id'], $entry ); |
|
| 553 | + $input_name = 'input_' . str_replace( '.', '_', $input[ 'id' ] ); |
|
| 554 | + $entry[ strval( $input[ 'id' ] ) ] = RGFormsModel::prepare_value( $form, $calc_field, '', $input_name, $entry[ 'id' ], $entry ); |
|
| 555 | 555 | } |
| 556 | 556 | } else { |
| 557 | - $input_name = 'input_' . str_replace( '.', '_', $calc_field->id); |
|
| 558 | - $entry[ strval( $calc_field->id ) ] = RGFormsModel::prepare_value( $form, $calc_field, '', $input_name, $entry['id'], $entry ); |
|
| 557 | + $input_name = 'input_' . str_replace( '.', '_', $calc_field->id ); |
|
| 558 | + $entry[ strval( $calc_field->id ) ] = RGFormsModel::prepare_value( $form, $calc_field, '', $input_name, $entry[ 'id' ], $entry ); |
|
| 559 | 559 | } |
| 560 | 560 | } |
| 561 | 561 | |
| 562 | 562 | } |
| 563 | 563 | |
| 564 | - if( $update ) { |
|
| 564 | + if ( $update ) { |
|
| 565 | 565 | |
| 566 | 566 | $return_entry = GFAPI::update_entry( $entry ); |
| 567 | 567 | |
| 568 | - if( is_wp_error( $return_entry ) ) { |
|
| 568 | + if ( is_wp_error( $return_entry ) ) { |
|
| 569 | 569 | gravityview()->log->error( 'Updating the entry calculation fields failed', array( 'data' => $return_entry ) ); |
| 570 | 570 | } else { |
| 571 | 571 | gravityview()->log->debug( 'Updating the entry calculation fields succeeded' ); |
@@ -596,19 +596,19 @@ discard block |
||
| 596 | 596 | |
| 597 | 597 | $input_name = 'input_' . $field_id; |
| 598 | 598 | |
| 599 | - if ( !empty( $_FILES[ $input_name ]['name'] ) ) { |
|
| 599 | + if ( ! empty( $_FILES[ $input_name ][ 'name' ] ) ) { |
|
| 600 | 600 | |
| 601 | 601 | // We have a new image |
| 602 | 602 | |
| 603 | - $value = RGFormsModel::prepare_value( $form, $field, $value, $input_name, $entry['id'] ); |
|
| 603 | + $value = RGFormsModel::prepare_value( $form, $field, $value, $input_name, $entry[ 'id' ] ); |
|
| 604 | 604 | |
| 605 | 605 | $ary = ! empty( $value ) ? explode( '|:|', $value ) : array(); |
| 606 | 606 | $ary = stripslashes_deep( $ary ); |
| 607 | 607 | $img_url = \GV\Utils::get( $ary, 0 ); |
| 608 | 608 | |
| 609 | - $img_title = count( $ary ) > 1 ? $ary[1] : ''; |
|
| 610 | - $img_caption = count( $ary ) > 2 ? $ary[2] : ''; |
|
| 611 | - $img_description = count( $ary ) > 3 ? $ary[3] : ''; |
|
| 609 | + $img_title = count( $ary ) > 1 ? $ary[ 1 ] : ''; |
|
| 610 | + $img_caption = count( $ary ) > 2 ? $ary[ 2 ] : ''; |
|
| 611 | + $img_description = count( $ary ) > 3 ? $ary[ 3 ] : ''; |
|
| 612 | 612 | |
| 613 | 613 | $image_meta = array( |
| 614 | 614 | 'post_excerpt' => $img_caption, |
@@ -617,7 +617,7 @@ discard block |
||
| 617 | 617 | |
| 618 | 618 | //adding title only if it is not empty. It will default to the file name if it is not in the array |
| 619 | 619 | if ( ! empty( $img_title ) ) { |
| 620 | - $image_meta['post_title'] = $img_title; |
|
| 620 | + $image_meta[ 'post_title' ] = $img_title; |
|
| 621 | 621 | } |
| 622 | 622 | |
| 623 | 623 | /** |
@@ -675,15 +675,15 @@ discard block |
||
| 675 | 675 | */ |
| 676 | 676 | private function maybe_update_post_fields( $form ) { |
| 677 | 677 | |
| 678 | - if( empty( $this->entry['post_id'] ) ) { |
|
| 678 | + if ( empty( $this->entry[ 'post_id' ] ) ) { |
|
| 679 | 679 | gravityview()->log->debug( 'This entry has no post fields. Continuing...' ); |
| 680 | 680 | return; |
| 681 | 681 | } |
| 682 | 682 | |
| 683 | - $post_id = $this->entry['post_id']; |
|
| 683 | + $post_id = $this->entry[ 'post_id' ]; |
|
| 684 | 684 | |
| 685 | 685 | // Security check |
| 686 | - if( false === GVCommon::has_cap( 'edit_post', $post_id ) ) { |
|
| 686 | + if ( false === GVCommon::has_cap( 'edit_post', $post_id ) ) { |
|
| 687 | 687 | gravityview()->log->error( 'The current user does not have the ability to edit Post #{post_id}', array( 'post_id' => $post_id ) ); |
| 688 | 688 | return; |
| 689 | 689 | } |
@@ -696,25 +696,25 @@ discard block |
||
| 696 | 696 | |
| 697 | 697 | $field = RGFormsModel::get_field( $form, $field_id ); |
| 698 | 698 | |
| 699 | - if( ! $field ) { |
|
| 699 | + if ( ! $field ) { |
|
| 700 | 700 | continue; |
| 701 | 701 | } |
| 702 | 702 | |
| 703 | - if( GFCommon::is_post_field( $field ) && 'post_category' !== $field->type ) { |
|
| 703 | + if ( GFCommon::is_post_field( $field ) && 'post_category' !== $field->type ) { |
|
| 704 | 704 | |
| 705 | 705 | // Get the value of the field, including $_POSTed value |
| 706 | 706 | $value = RGFormsModel::get_field_value( $field ); |
| 707 | 707 | |
| 708 | 708 | // Use temporary entry variable, to make values available to fill_post_template() and update_post_image() |
| 709 | 709 | $entry_tmp = $this->entry; |
| 710 | - $entry_tmp["{$field_id}"] = $value; |
|
| 710 | + $entry_tmp[ "{$field_id}" ] = $value; |
|
| 711 | 711 | |
| 712 | - switch( $field->type ) { |
|
| 712 | + switch ( $field->type ) { |
|
| 713 | 713 | |
| 714 | 714 | case 'post_title': |
| 715 | 715 | $post_title = $value; |
| 716 | 716 | if ( \GV\Utils::get( $form, 'postTitleTemplateEnabled' ) ) { |
| 717 | - $post_title = $this->fill_post_template( $form['postTitleTemplate'], $form, $entry_tmp ); |
|
| 717 | + $post_title = $this->fill_post_template( $form[ 'postTitleTemplate' ], $form, $entry_tmp ); |
|
| 718 | 718 | } |
| 719 | 719 | $updated_post->post_title = $post_title; |
| 720 | 720 | $updated_post->post_name = $post_title; |
@@ -724,7 +724,7 @@ discard block |
||
| 724 | 724 | case 'post_content': |
| 725 | 725 | $post_content = $value; |
| 726 | 726 | if ( \GV\Utils::get( $form, 'postContentTemplateEnabled' ) ) { |
| 727 | - $post_content = $this->fill_post_template( $form['postContentTemplate'], $form, $entry_tmp, true ); |
|
| 727 | + $post_content = $this->fill_post_template( $form[ 'postContentTemplate' ], $form, $entry_tmp, true ); |
|
| 728 | 728 | } |
| 729 | 729 | $updated_post->post_content = $post_content; |
| 730 | 730 | unset( $post_content ); |
@@ -742,7 +742,7 @@ discard block |
||
| 742 | 742 | $value = $value[ $field_id ]; |
| 743 | 743 | } |
| 744 | 744 | |
| 745 | - if( ! empty( $field->customFieldTemplateEnabled ) ) { |
|
| 745 | + if ( ! empty( $field->customFieldTemplateEnabled ) ) { |
|
| 746 | 746 | $value = $this->fill_post_template( $field->customFieldTemplate, $form, $entry_tmp, true ); |
| 747 | 747 | } |
| 748 | 748 | |
@@ -760,7 +760,7 @@ discard block |
||
| 760 | 760 | } |
| 761 | 761 | |
| 762 | 762 | // update entry after |
| 763 | - $this->entry["{$field_id}"] = $value; |
|
| 763 | + $this->entry[ "{$field_id}" ] = $value; |
|
| 764 | 764 | |
| 765 | 765 | $update_entry = true; |
| 766 | 766 | |
@@ -769,11 +769,11 @@ discard block |
||
| 769 | 769 | |
| 770 | 770 | } |
| 771 | 771 | |
| 772 | - if( $update_entry ) { |
|
| 772 | + if ( $update_entry ) { |
|
| 773 | 773 | |
| 774 | 774 | $return_entry = GFAPI::update_entry( $this->entry ); |
| 775 | 775 | |
| 776 | - if( is_wp_error( $return_entry ) ) { |
|
| 776 | + if ( is_wp_error( $return_entry ) ) { |
|
| 777 | 777 | gravityview()->log->error( 'Updating the entry post fields failed', array( 'data' => array( '$this->entry' => $this->entry, '$return_entry' => $return_entry ) ) ); |
| 778 | 778 | } else { |
| 779 | 779 | gravityview()->log->debug( 'Updating the entry post fields for post #{post_id} succeeded', array( 'post_id' => $post_id ) ); |
@@ -783,7 +783,7 @@ discard block |
||
| 783 | 783 | |
| 784 | 784 | $return_post = wp_update_post( $updated_post, true ); |
| 785 | 785 | |
| 786 | - if( is_wp_error( $return_post ) ) { |
|
| 786 | + if ( is_wp_error( $return_post ) ) { |
|
| 787 | 787 | $return_post->add_data( $updated_post, '$updated_post' ); |
| 788 | 788 | gravityview()->log->error( 'Updating the post content failed', array( 'data' => compact( 'updated_post', 'return_post' ) ) ); |
| 789 | 789 | } else { |
@@ -805,7 +805,7 @@ discard block |
||
| 805 | 805 | $input_type = RGFormsModel::get_input_type( $field ); |
| 806 | 806 | |
| 807 | 807 | // Only certain custom field types are supported |
| 808 | - switch( $input_type ) { |
|
| 808 | + switch ( $input_type ) { |
|
| 809 | 809 | case 'fileupload': |
| 810 | 810 | case 'list': |
| 811 | 811 | case 'multiselect': |
@@ -842,7 +842,7 @@ discard block |
||
| 842 | 842 | $output = GFCommon::replace_variables( $output, $form, $entry, false, false, false ); |
| 843 | 843 | |
| 844 | 844 | // replace conditional shortcodes |
| 845 | - if( $do_shortcode ) { |
|
| 845 | + if ( $do_shortcode ) { |
|
| 846 | 846 | $output = do_shortcode( $output ); |
| 847 | 847 | } |
| 848 | 848 | |
@@ -861,19 +861,19 @@ discard block |
||
| 861 | 861 | */ |
| 862 | 862 | private function after_update() { |
| 863 | 863 | |
| 864 | - do_action( 'gform_after_update_entry', $this->form, $this->entry['id'], self::$original_entry ); |
|
| 865 | - do_action( "gform_after_update_entry_{$this->form['id']}", $this->form, $this->entry['id'], self::$original_entry ); |
|
| 864 | + do_action( 'gform_after_update_entry', $this->form, $this->entry[ 'id' ], self::$original_entry ); |
|
| 865 | + do_action( "gform_after_update_entry_{$this->form[ 'id' ]}", $this->form, $this->entry[ 'id' ], self::$original_entry ); |
|
| 866 | 866 | |
| 867 | 867 | // Re-define the entry now that we've updated it. |
| 868 | - $entry = RGFormsModel::get_lead( $this->entry['id'] ); |
|
| 868 | + $entry = RGFormsModel::get_lead( $this->entry[ 'id' ] ); |
|
| 869 | 869 | |
| 870 | 870 | $entry = GFFormsModel::set_entry_meta( $entry, $this->form ); |
| 871 | 871 | |
| 872 | 872 | if ( version_compare( GFFormsModel::get_database_version(), '2.3-dev-1', '<' ) ) { |
| 873 | 873 | // We need to clear the cache because Gravity Forms caches the field values, which |
| 874 | 874 | // we have just updated. |
| 875 | - foreach ($this->form['fields'] as $key => $field) { |
|
| 876 | - GFFormsModel::refresh_lead_field_value( $entry['id'], $field->id ); |
|
| 875 | + foreach ( $this->form[ 'fields' ] as $key => $field ) { |
|
| 876 | + GFFormsModel::refresh_lead_field_value( $entry[ 'id' ], $field->id ); |
|
| 877 | 877 | } |
| 878 | 878 | } |
| 879 | 879 | |
@@ -892,7 +892,7 @@ discard block |
||
| 892 | 892 | |
| 893 | 893 | <div class="gv-edit-entry-wrapper"><?php |
| 894 | 894 | |
| 895 | - $javascript = gravityview_ob_include( GravityView_Edit_Entry::$file .'/partials/inline-javascript.php', $this ); |
|
| 895 | + $javascript = gravityview_ob_include( GravityView_Edit_Entry::$file . '/partials/inline-javascript.php', $this ); |
|
| 896 | 896 | |
| 897 | 897 | /** |
| 898 | 898 | * Fixes weird wpautop() issue |
@@ -908,7 +908,7 @@ discard block |
||
| 908 | 908 | * @param string $edit_entry_title Modify the "Edit Entry" title |
| 909 | 909 | * @param GravityView_Edit_Entry_Render $this This object |
| 910 | 910 | */ |
| 911 | - $edit_entry_title = apply_filters('gravityview_edit_entry_title', __('Edit Entry', 'gravityview'), $this ); |
|
| 911 | + $edit_entry_title = apply_filters( 'gravityview_edit_entry_title', __( 'Edit Entry', 'gravityview' ), $this ); |
|
| 912 | 912 | |
| 913 | 913 | echo esc_attr( $edit_entry_title ); |
| 914 | 914 | ?></span> |
@@ -958,16 +958,16 @@ discard block |
||
| 958 | 958 | |
| 959 | 959 | $back_link = esc_url( remove_query_arg( array( 'page', 'view', 'edit' ) ) ); |
| 960 | 960 | |
| 961 | - if( ! $this->is_valid ){ |
|
| 961 | + if ( ! $this->is_valid ) { |
|
| 962 | 962 | |
| 963 | 963 | // Keeping this compatible with Gravity Forms. |
| 964 | - $validation_message = "<div class='validation_error'>" . __('There was a problem with your submission.', 'gravityview') . " " . __('Errors have been highlighted below.', 'gravityview') . "</div>"; |
|
| 965 | - $message = apply_filters("gform_validation_message_{$this->form['id']}", apply_filters("gform_validation_message", $validation_message, $this->form), $this->form); |
|
| 964 | + $validation_message = "<div class='validation_error'>" . __( 'There was a problem with your submission.', 'gravityview' ) . " " . __( 'Errors have been highlighted below.', 'gravityview' ) . "</div>"; |
|
| 965 | + $message = apply_filters( "gform_validation_message_{$this->form[ 'id' ]}", apply_filters( "gform_validation_message", $validation_message, $this->form ), $this->form ); |
|
| 966 | 966 | |
| 967 | - echo GVCommon::generate_notice( $message , 'gv-error' ); |
|
| 967 | + echo GVCommon::generate_notice( $message, 'gv-error' ); |
|
| 968 | 968 | |
| 969 | 969 | } else { |
| 970 | - $entry_updated_message = sprintf( esc_attr__('Entry Updated. %sReturn to Entry%s', 'gravityview'), '<a href="'. $back_link .'">', '</a>' ); |
|
| 970 | + $entry_updated_message = sprintf( esc_attr__( 'Entry Updated. %sReturn to Entry%s', 'gravityview' ), '<a href="' . $back_link . '">', '</a>' ); |
|
| 971 | 971 | |
| 972 | 972 | /** |
| 973 | 973 | * @filter `gravityview/edit_entry/success` Modify the edit entry success message (including the anchor link) |
@@ -977,7 +977,7 @@ discard block |
||
| 977 | 977 | * @param array $entry Gravity Forms entry array |
| 978 | 978 | * @param string $back_link URL to return to the original entry. @since 1.6 |
| 979 | 979 | */ |
| 980 | - $message = apply_filters( 'gravityview/edit_entry/success', $entry_updated_message , $this->view_id, $this->entry, $back_link ); |
|
| 980 | + $message = apply_filters( 'gravityview/edit_entry/success', $entry_updated_message, $this->view_id, $this->entry, $back_link ); |
|
| 981 | 981 | |
| 982 | 982 | echo GVCommon::generate_notice( $message ); |
| 983 | 983 | } |
@@ -1001,21 +1001,21 @@ discard block |
||
| 1001 | 1001 | */ |
| 1002 | 1002 | do_action( 'gravityview/edit-entry/render/before', $this ); |
| 1003 | 1003 | |
| 1004 | - add_filter( 'gform_pre_render', array( $this, 'filter_modify_form_fields'), 5000, 3 ); |
|
| 1005 | - add_filter( 'gform_submit_button', array( $this, 'render_form_buttons') ); |
|
| 1004 | + add_filter( 'gform_pre_render', array( $this, 'filter_modify_form_fields' ), 5000, 3 ); |
|
| 1005 | + add_filter( 'gform_submit_button', array( $this, 'render_form_buttons' ) ); |
|
| 1006 | 1006 | add_filter( 'gform_disable_view_counter', '__return_true' ); |
| 1007 | 1007 | |
| 1008 | 1008 | add_filter( 'gform_field_input', array( $this, 'verify_user_can_edit_post' ), 5, 5 ); |
| 1009 | 1009 | add_filter( 'gform_field_input', array( $this, 'modify_edit_field_input' ), 10, 5 ); |
| 1010 | 1010 | |
| 1011 | 1011 | // We need to remove the fake $_GET['page'] arg to avoid rendering form as if in admin. |
| 1012 | - unset( $_GET['page'] ); |
|
| 1012 | + unset( $_GET[ 'page' ] ); |
|
| 1013 | 1013 | |
| 1014 | 1014 | // TODO: Verify multiple-page forms |
| 1015 | 1015 | |
| 1016 | 1016 | ob_start(); // Prevent PHP warnings possibly caused by prefilling list fields for conditional logic |
| 1017 | 1017 | |
| 1018 | - $html = GFFormDisplay::get_form( $this->form['id'], false, false, true, $this->entry ); |
|
| 1018 | + $html = GFFormDisplay::get_form( $this->form[ 'id' ], false, false, true, $this->entry ); |
|
| 1019 | 1019 | |
| 1020 | 1020 | ob_get_clean(); |
| 1021 | 1021 | |
@@ -1041,7 +1041,7 @@ discard block |
||
| 1041 | 1041 | * @return string |
| 1042 | 1042 | */ |
| 1043 | 1043 | public function render_form_buttons() { |
| 1044 | - return gravityview_ob_include( GravityView_Edit_Entry::$file .'/partials/form-buttons.php', $this ); |
|
| 1044 | + return gravityview_ob_include( GravityView_Edit_Entry::$file . '/partials/form-buttons.php', $this ); |
|
| 1045 | 1045 | } |
| 1046 | 1046 | |
| 1047 | 1047 | |
@@ -1061,10 +1061,10 @@ discard block |
||
| 1061 | 1061 | public function filter_modify_form_fields( $form, $ajax = false, $field_values = '' ) { |
| 1062 | 1062 | |
| 1063 | 1063 | // In case we have validated the form, use it to inject the validation results into the form render |
| 1064 | - if( isset( $this->form_after_validation ) ) { |
|
| 1064 | + if ( isset( $this->form_after_validation ) ) { |
|
| 1065 | 1065 | $form = $this->form_after_validation; |
| 1066 | 1066 | } else { |
| 1067 | - $form['fields'] = $this->get_configured_edit_fields( $form, $this->view_id ); |
|
| 1067 | + $form[ 'fields' ] = $this->get_configured_edit_fields( $form, $this->view_id ); |
|
| 1068 | 1068 | } |
| 1069 | 1069 | |
| 1070 | 1070 | $form = $this->filter_conditional_logic( $form ); |
@@ -1072,8 +1072,8 @@ discard block |
||
| 1072 | 1072 | $form = $this->prefill_conditional_logic( $form ); |
| 1073 | 1073 | |
| 1074 | 1074 | // for now we don't support Save and Continue feature. |
| 1075 | - if( ! self::$supports_save_and_continue ) { |
|
| 1076 | - unset( $form['save'] ); |
|
| 1075 | + if ( ! self::$supports_save_and_continue ) { |
|
| 1076 | + unset( $form[ 'save' ] ); |
|
| 1077 | 1077 | } |
| 1078 | 1078 | |
| 1079 | 1079 | $form = $this->unselect_default_values( $form ); |
@@ -1096,31 +1096,31 @@ discard block |
||
| 1096 | 1096 | */ |
| 1097 | 1097 | public function verify_user_can_edit_post( $field_content = '', $field, $value, $lead_id = 0, $form_id ) { |
| 1098 | 1098 | |
| 1099 | - if( ! GFCommon::is_post_field( $field ) ) { |
|
| 1099 | + if ( ! GFCommon::is_post_field( $field ) ) { |
|
| 1100 | 1100 | return $field_content; |
| 1101 | 1101 | } |
| 1102 | 1102 | |
| 1103 | 1103 | $message = null; |
| 1104 | 1104 | |
| 1105 | 1105 | // First, make sure they have the capability to edit the post. |
| 1106 | - if( false === current_user_can( 'edit_post', $this->entry['post_id'] ) ) { |
|
| 1106 | + if ( false === current_user_can( 'edit_post', $this->entry[ 'post_id' ] ) ) { |
|
| 1107 | 1107 | |
| 1108 | 1108 | /** |
| 1109 | 1109 | * @filter `gravityview/edit_entry/unsupported_post_field_text` Modify the message when someone isn't able to edit a post |
| 1110 | 1110 | * @param string $message The existing "You don't have permission..." text |
| 1111 | 1111 | */ |
| 1112 | - $message = apply_filters('gravityview/edit_entry/unsupported_post_field_text', __('You don’t have permission to edit this post.', 'gravityview') ); |
|
| 1112 | + $message = apply_filters( 'gravityview/edit_entry/unsupported_post_field_text', __( 'You don’t have permission to edit this post.', 'gravityview' ) ); |
|
| 1113 | 1113 | |
| 1114 | - } elseif( null === get_post( $this->entry['post_id'] ) ) { |
|
| 1114 | + } elseif ( null === get_post( $this->entry[ 'post_id' ] ) ) { |
|
| 1115 | 1115 | /** |
| 1116 | 1116 | * @filter `gravityview/edit_entry/no_post_text` Modify the message when someone is editing an entry attached to a post that no longer exists |
| 1117 | 1117 | * @param string $message The existing "This field is not editable; the post no longer exists." text |
| 1118 | 1118 | */ |
| 1119 | - $message = apply_filters('gravityview/edit_entry/no_post_text', __('This field is not editable; the post no longer exists.', 'gravityview' ) ); |
|
| 1119 | + $message = apply_filters( 'gravityview/edit_entry/no_post_text', __( 'This field is not editable; the post no longer exists.', 'gravityview' ) ); |
|
| 1120 | 1120 | } |
| 1121 | 1121 | |
| 1122 | - if( $message ) { |
|
| 1123 | - $field_content = sprintf('<div class="ginput_container ginput_container_' . $field->type . '">%s</div>', wpautop( $message ) ); |
|
| 1122 | + if ( $message ) { |
|
| 1123 | + $field_content = sprintf( '<div class="ginput_container ginput_container_' . $field->type . '">%s</div>', wpautop( $message ) ); |
|
| 1124 | 1124 | } |
| 1125 | 1125 | |
| 1126 | 1126 | return $field_content; |
@@ -1144,8 +1144,8 @@ discard block |
||
| 1144 | 1144 | |
| 1145 | 1145 | // If the form has been submitted, then we don't need to pre-fill the values, |
| 1146 | 1146 | // Except for fileupload type and when a field input is overridden- run always!! |
| 1147 | - if( |
|
| 1148 | - ( $this->is_edit_entry_submission() && !in_array( $field->type, array( 'fileupload', 'post_image' ) ) ) |
|
| 1147 | + if ( |
|
| 1148 | + ( $this->is_edit_entry_submission() && ! in_array( $field->type, array( 'fileupload', 'post_image' ) ) ) |
|
| 1149 | 1149 | && false === ( $gv_field && is_callable( array( $gv_field, 'get_field_input' ) ) ) |
| 1150 | 1150 | && ! GFCommon::is_product_field( $field->type ) |
| 1151 | 1151 | || ! empty( $field_content ) |
@@ -1165,7 +1165,7 @@ discard block |
||
| 1165 | 1165 | $return = null; |
| 1166 | 1166 | |
| 1167 | 1167 | /** @var GravityView_Field $gv_field */ |
| 1168 | - if( $gv_field && is_callable( array( $gv_field, 'get_field_input' ) ) ) { |
|
| 1168 | + if ( $gv_field && is_callable( array( $gv_field, 'get_field_input' ) ) ) { |
|
| 1169 | 1169 | $return = $gv_field->get_field_input( $this->form, $field_value, $this->entry, $field ); |
| 1170 | 1170 | } else { |
| 1171 | 1171 | $return = $field->get_field_input( $this->form, $field_value, $this->entry ); |
@@ -1174,7 +1174,7 @@ discard block |
||
| 1174 | 1174 | // If there was output, it's an error |
| 1175 | 1175 | $warnings = ob_get_clean(); |
| 1176 | 1176 | |
| 1177 | - if( !empty( $warnings ) ) { |
|
| 1177 | + if ( ! empty( $warnings ) ) { |
|
| 1178 | 1178 | gravityview()->log->error( '{warning}', array( 'warning' => $warnings, 'data' => $field_value ) ); |
| 1179 | 1179 | } |
| 1180 | 1180 | |
@@ -1199,7 +1199,7 @@ discard block |
||
| 1199 | 1199 | $override_saved_value = apply_filters( 'gravityview/edit_entry/pre_populate/override', false, $field ); |
| 1200 | 1200 | |
| 1201 | 1201 | // We're dealing with multiple inputs (e.g. checkbox) but not time or date (as it doesn't store data in input IDs) |
| 1202 | - if( isset( $field->inputs ) && is_array( $field->inputs ) && !in_array( $field->type, array( 'time', 'date' ) ) ) { |
|
| 1202 | + if ( isset( $field->inputs ) && is_array( $field->inputs ) && ! in_array( $field->type, array( 'time', 'date' ) ) ) { |
|
| 1203 | 1203 | |
| 1204 | 1204 | $field_value = array(); |
| 1205 | 1205 | |
@@ -1208,10 +1208,10 @@ discard block |
||
| 1208 | 1208 | |
| 1209 | 1209 | foreach ( (array)$field->inputs as $input ) { |
| 1210 | 1210 | |
| 1211 | - $input_id = strval( $input['id'] ); |
|
| 1211 | + $input_id = strval( $input[ 'id' ] ); |
|
| 1212 | 1212 | |
| 1213 | 1213 | if ( isset( $this->entry[ $input_id ] ) && ! gv_empty( $this->entry[ $input_id ], false, false ) ) { |
| 1214 | - $field_value[ $input_id ] = 'post_category' === $field->type ? GFCommon::format_post_category( $this->entry[ $input_id ], true ) : $this->entry[ $input_id ]; |
|
| 1214 | + $field_value[ $input_id ] = 'post_category' === $field->type ? GFCommon::format_post_category( $this->entry[ $input_id ], true ) : $this->entry[ $input_id ]; |
|
| 1215 | 1215 | $allow_pre_populated = false; |
| 1216 | 1216 | } |
| 1217 | 1217 | |
@@ -1219,7 +1219,7 @@ discard block |
||
| 1219 | 1219 | |
| 1220 | 1220 | $pre_value = $field->get_value_submission( array(), false ); |
| 1221 | 1221 | |
| 1222 | - $field_value = ! $allow_pre_populated && ! ( $override_saved_value && !gv_empty( $pre_value, false, false ) ) ? $field_value : $pre_value; |
|
| 1222 | + $field_value = ! $allow_pre_populated && ! ( $override_saved_value && ! gv_empty( $pre_value, false, false ) ) ? $field_value : $pre_value; |
|
| 1223 | 1223 | |
| 1224 | 1224 | } else { |
| 1225 | 1225 | |
@@ -1230,13 +1230,13 @@ discard block |
||
| 1230 | 1230 | |
| 1231 | 1231 | // saved field entry value (if empty, fallback to the pre-populated value, if exists) |
| 1232 | 1232 | // or pre-populated value if not empty and set to override saved value |
| 1233 | - $field_value = isset( $this->entry[ $id ] ) && ! gv_empty( $this->entry[ $id ], false, false ) && ! ( $override_saved_value && !gv_empty( $pre_value, false, false ) ) ? $this->entry[ $id ] : $pre_value; |
|
| 1233 | + $field_value = isset( $this->entry[ $id ] ) && ! gv_empty( $this->entry[ $id ], false, false ) && ! ( $override_saved_value && ! gv_empty( $pre_value, false, false ) ) ? $this->entry[ $id ] : $pre_value; |
|
| 1234 | 1234 | |
| 1235 | 1235 | // in case field is post_category but inputType is select, multi-select or radio, convert value into array of category IDs. |
| 1236 | - if ( 'post_category' === $field->type && !gv_empty( $field_value, false, false ) ) { |
|
| 1236 | + if ( 'post_category' === $field->type && ! gv_empty( $field_value, false, false ) ) { |
|
| 1237 | 1237 | $categories = array(); |
| 1238 | 1238 | foreach ( explode( ',', $field_value ) as $cat_string ) { |
| 1239 | - $categories[] = GFCommon::format_post_category( $cat_string, true ); |
|
| 1239 | + $categories[ ] = GFCommon::format_post_category( $cat_string, true ); |
|
| 1240 | 1240 | } |
| 1241 | 1241 | $field_value = 'multiselect' === $field->get_input_type() ? $categories : implode( '', $categories ); |
| 1242 | 1242 | } |
@@ -1264,7 +1264,7 @@ discard block |
||
| 1264 | 1264 | * @param GF_Field $field Gravity Forms field object |
| 1265 | 1265 | * @param GravityView_Edit_Entry_Render $this Current object |
| 1266 | 1266 | */ |
| 1267 | - $field_value = apply_filters( 'gravityview/edit_entry/field_value_' . $field->type , $field_value, $field, $this ); |
|
| 1267 | + $field_value = apply_filters( 'gravityview/edit_entry/field_value_' . $field->type, $field_value, $field, $this ); |
|
| 1268 | 1268 | |
| 1269 | 1269 | return $field_value; |
| 1270 | 1270 | } |
@@ -1281,12 +1281,12 @@ discard block |
||
| 1281 | 1281 | */ |
| 1282 | 1282 | public function gform_pre_validation( $form ) { |
| 1283 | 1283 | |
| 1284 | - if( ! $this->verify_nonce() ) { |
|
| 1284 | + if ( ! $this->verify_nonce() ) { |
|
| 1285 | 1285 | return $form; |
| 1286 | 1286 | } |
| 1287 | 1287 | |
| 1288 | 1288 | // Fix PHP warning regarding undefined index. |
| 1289 | - foreach ( $form['fields'] as &$field) { |
|
| 1289 | + foreach ( $form[ 'fields' ] as &$field ) { |
|
| 1290 | 1290 | |
| 1291 | 1291 | // This is because we're doing admin form pretending to be front-end, so Gravity Forms |
| 1292 | 1292 | // expects certain field array items to be set. |
@@ -1294,7 +1294,7 @@ discard block |
||
| 1294 | 1294 | $field->{$key} = isset( $field->{$key} ) ? $field->{$key} : NULL; |
| 1295 | 1295 | } |
| 1296 | 1296 | |
| 1297 | - switch( RGFormsModel::get_input_type( $field ) ) { |
|
| 1297 | + switch ( RGFormsModel::get_input_type( $field ) ) { |
|
| 1298 | 1298 | |
| 1299 | 1299 | /** |
| 1300 | 1300 | * this whole fileupload hack is because in the admin, Gravity Forms simply doesn't update any fileupload field if it's empty, but it DOES in the frontend. |
@@ -1308,26 +1308,26 @@ discard block |
||
| 1308 | 1308 | // Set the previous value |
| 1309 | 1309 | $entry = $this->get_entry(); |
| 1310 | 1310 | |
| 1311 | - $input_name = 'input_'.$field->id; |
|
| 1312 | - $form_id = $form['id']; |
|
| 1311 | + $input_name = 'input_' . $field->id; |
|
| 1312 | + $form_id = $form[ 'id' ]; |
|
| 1313 | 1313 | |
| 1314 | 1314 | $value = NULL; |
| 1315 | 1315 | |
| 1316 | 1316 | // Use the previous entry value as the default. |
| 1317 | - if( isset( $entry[ $field->id ] ) ) { |
|
| 1317 | + if ( isset( $entry[ $field->id ] ) ) { |
|
| 1318 | 1318 | $value = $entry[ $field->id ]; |
| 1319 | 1319 | } |
| 1320 | 1320 | |
| 1321 | 1321 | // If this is a single upload file |
| 1322 | - if( !empty( $_FILES[ $input_name ] ) && !empty( $_FILES[ $input_name ]['name'] ) ) { |
|
| 1323 | - $file_path = GFFormsModel::get_file_upload_path( $form['id'], $_FILES[ $input_name ]['name'] ); |
|
| 1324 | - $value = $file_path['url']; |
|
| 1322 | + if ( ! empty( $_FILES[ $input_name ] ) && ! empty( $_FILES[ $input_name ][ 'name' ] ) ) { |
|
| 1323 | + $file_path = GFFormsModel::get_file_upload_path( $form[ 'id' ], $_FILES[ $input_name ][ 'name' ] ); |
|
| 1324 | + $value = $file_path[ 'url' ]; |
|
| 1325 | 1325 | |
| 1326 | 1326 | } else { |
| 1327 | 1327 | |
| 1328 | 1328 | // Fix PHP warning on line 1498 of form_display.php for post_image fields |
| 1329 | 1329 | // Fix PHP Notice: Undefined index: size in form_display.php on line 1511 |
| 1330 | - $_FILES[ $input_name ] = array('name' => '', 'size' => '' ); |
|
| 1330 | + $_FILES[ $input_name ] = array( 'name' => '', 'size' => '' ); |
|
| 1331 | 1331 | |
| 1332 | 1332 | } |
| 1333 | 1333 | |
@@ -1335,10 +1335,10 @@ discard block |
||
| 1335 | 1335 | |
| 1336 | 1336 | // If there are fresh uploads, process and merge them. |
| 1337 | 1337 | // Otherwise, use the passed values, which should be json-encoded array of URLs |
| 1338 | - if( isset( GFFormsModel::$uploaded_files[$form_id][$input_name] ) ) { |
|
| 1338 | + if ( isset( GFFormsModel::$uploaded_files[ $form_id ][ $input_name ] ) ) { |
|
| 1339 | 1339 | $value = empty( $value ) ? '[]' : $value; |
| 1340 | 1340 | $value = stripslashes_deep( $value ); |
| 1341 | - $value = GFFormsModel::prepare_value( $form, $field, $value, $input_name, $entry['id'], array()); |
|
| 1341 | + $value = GFFormsModel::prepare_value( $form, $field, $value, $input_name, $entry[ 'id' ], array() ); |
|
| 1342 | 1342 | } |
| 1343 | 1343 | |
| 1344 | 1344 | } else { |
@@ -1356,8 +1356,8 @@ discard block |
||
| 1356 | 1356 | |
| 1357 | 1357 | case 'number': |
| 1358 | 1358 | // Fix "undefined index" issue at line 1286 in form_display.php |
| 1359 | - if( !isset( $_POST['input_'.$field->id ] ) ) { |
|
| 1360 | - $_POST['input_'.$field->id ] = NULL; |
|
| 1359 | + if ( ! isset( $_POST[ 'input_' . $field->id ] ) ) { |
|
| 1360 | + $_POST[ 'input_' . $field->id ] = NULL; |
|
| 1361 | 1361 | } |
| 1362 | 1362 | break; |
| 1363 | 1363 | } |
@@ -1394,7 +1394,7 @@ discard block |
||
| 1394 | 1394 | * You can enter whatever you want! |
| 1395 | 1395 | * We try validating, and customize the results using `self::custom_validation()` |
| 1396 | 1396 | */ |
| 1397 | - add_filter( 'gform_validation_'. $this->form_id, array( $this, 'custom_validation' ), 10, 4); |
|
| 1397 | + add_filter( 'gform_validation_' . $this->form_id, array( $this, 'custom_validation' ), 10, 4 ); |
|
| 1398 | 1398 | |
| 1399 | 1399 | // Needed by the validate funtion |
| 1400 | 1400 | $failed_validation_page = NULL; |
@@ -1402,14 +1402,14 @@ discard block |
||
| 1402 | 1402 | |
| 1403 | 1403 | // Prevent entry limit from running when editing an entry, also |
| 1404 | 1404 | // prevent form scheduling from preventing editing |
| 1405 | - unset( $this->form['limitEntries'], $this->form['scheduleForm'] ); |
|
| 1405 | + unset( $this->form[ 'limitEntries' ], $this->form[ 'scheduleForm' ] ); |
|
| 1406 | 1406 | |
| 1407 | 1407 | // Hide fields depending on Edit Entry settings |
| 1408 | - $this->form['fields'] = $this->get_configured_edit_fields( $this->form, $this->view_id ); |
|
| 1408 | + $this->form[ 'fields' ] = $this->get_configured_edit_fields( $this->form, $this->view_id ); |
|
| 1409 | 1409 | |
| 1410 | 1410 | $this->is_valid = GFFormDisplay::validate( $this->form, $field_values, 1, $failed_validation_page ); |
| 1411 | 1411 | |
| 1412 | - remove_filter( 'gform_validation_'. $this->form_id, array( $this, 'custom_validation' ), 10 ); |
|
| 1412 | + remove_filter( 'gform_validation_' . $this->form_id, array( $this, 'custom_validation' ), 10 ); |
|
| 1413 | 1413 | } |
| 1414 | 1414 | |
| 1415 | 1415 | |
@@ -1432,7 +1432,7 @@ discard block |
||
| 1432 | 1432 | |
| 1433 | 1433 | $gv_valid = true; |
| 1434 | 1434 | |
| 1435 | - foreach ( $validation_results['form']['fields'] as $key => &$field ) { |
|
| 1435 | + foreach ( $validation_results[ 'form' ][ 'fields' ] as $key => &$field ) { |
|
| 1436 | 1436 | |
| 1437 | 1437 | $value = RGFormsModel::get_field_value( $field ); |
| 1438 | 1438 | $field_type = RGFormsModel::get_input_type( $field ); |
@@ -1445,35 +1445,35 @@ discard block |
||
| 1445 | 1445 | case 'post_image': |
| 1446 | 1446 | |
| 1447 | 1447 | // in case nothing is uploaded but there are already files saved |
| 1448 | - if( !empty( $field->failed_validation ) && !empty( $field->isRequired ) && !empty( $value ) ) { |
|
| 1448 | + if ( ! empty( $field->failed_validation ) && ! empty( $field->isRequired ) && ! empty( $value ) ) { |
|
| 1449 | 1449 | $field->failed_validation = false; |
| 1450 | 1450 | unset( $field->validation_message ); |
| 1451 | 1451 | } |
| 1452 | 1452 | |
| 1453 | 1453 | // validate if multi file upload reached max number of files [maxFiles] => 2 |
| 1454 | - if( \GV\Utils::get( $field, 'maxFiles') && \GV\Utils::get( $field, 'multipleFiles') ) { |
|
| 1454 | + if ( \GV\Utils::get( $field, 'maxFiles' ) && \GV\Utils::get( $field, 'multipleFiles' ) ) { |
|
| 1455 | 1455 | |
| 1456 | 1456 | $input_name = 'input_' . $field->id; |
| 1457 | 1457 | //uploaded |
| 1458 | - $file_names = isset( GFFormsModel::$uploaded_files[ $validation_results['form']['id'] ][ $input_name ] ) ? GFFormsModel::$uploaded_files[ $validation_results['form']['id'] ][ $input_name ] : array(); |
|
| 1458 | + $file_names = isset( GFFormsModel::$uploaded_files[ $validation_results[ 'form' ][ 'id' ] ][ $input_name ] ) ? GFFormsModel::$uploaded_files[ $validation_results[ 'form' ][ 'id' ] ][ $input_name ] : array(); |
|
| 1459 | 1459 | |
| 1460 | 1460 | //existent |
| 1461 | 1461 | $entry = $this->get_entry(); |
| 1462 | 1462 | $value = NULL; |
| 1463 | - if( isset( $entry[ $field->id ] ) ) { |
|
| 1463 | + if ( isset( $entry[ $field->id ] ) ) { |
|
| 1464 | 1464 | $value = json_decode( $entry[ $field->id ], true ); |
| 1465 | 1465 | } |
| 1466 | 1466 | |
| 1467 | 1467 | // count uploaded files and existent entry files |
| 1468 | 1468 | $count_files = count( $file_names ) + count( $value ); |
| 1469 | 1469 | |
| 1470 | - if( $count_files > $field->maxFiles ) { |
|
| 1470 | + if ( $count_files > $field->maxFiles ) { |
|
| 1471 | 1471 | $field->validation_message = __( 'Maximum number of files reached', 'gravityview' ); |
| 1472 | 1472 | $field->failed_validation = 1; |
| 1473 | 1473 | $gv_valid = false; |
| 1474 | 1474 | |
| 1475 | 1475 | // in case of error make sure the newest upload files are removed from the upload input |
| 1476 | - GFFormsModel::$uploaded_files[ $validation_results['form']['id'] ] = null; |
|
| 1476 | + GFFormsModel::$uploaded_files[ $validation_results[ 'form' ][ 'id' ] ] = null; |
|
| 1477 | 1477 | } |
| 1478 | 1478 | |
| 1479 | 1479 | } |
@@ -1484,7 +1484,7 @@ discard block |
||
| 1484 | 1484 | } |
| 1485 | 1485 | |
| 1486 | 1486 | // This field has failed validation. |
| 1487 | - if( !empty( $field->failed_validation ) ) { |
|
| 1487 | + if ( ! empty( $field->failed_validation ) ) { |
|
| 1488 | 1488 | |
| 1489 | 1489 | gravityview()->log->debug( 'GravityView_Edit_Entry[custom_validation] Field is invalid.', array( 'data' => array( 'field' => $field, 'value' => $value ) ) ); |
| 1490 | 1490 | |
@@ -1502,19 +1502,19 @@ discard block |
||
| 1502 | 1502 | } |
| 1503 | 1503 | |
| 1504 | 1504 | // You can't continue inside a switch, so we do it after. |
| 1505 | - if( empty( $field->failed_validation ) ) { |
|
| 1505 | + if ( empty( $field->failed_validation ) ) { |
|
| 1506 | 1506 | continue; |
| 1507 | 1507 | } |
| 1508 | 1508 | |
| 1509 | 1509 | // checks if the No Duplicates option is not validating entry against itself, since |
| 1510 | 1510 | // we're editing a stored entry, it would also assume it's a duplicate. |
| 1511 | - if( !empty( $field->noDuplicates ) ) { |
|
| 1511 | + if ( ! empty( $field->noDuplicates ) ) { |
|
| 1512 | 1512 | |
| 1513 | 1513 | $entry = $this->get_entry(); |
| 1514 | 1514 | |
| 1515 | 1515 | // If the value of the entry is the same as the stored value |
| 1516 | 1516 | // Then we can assume it's not a duplicate, it's the same. |
| 1517 | - if( !empty( $entry ) && $value == $entry[ $field->id ] ) { |
|
| 1517 | + if ( ! empty( $entry ) && $value == $entry[ $field->id ] ) { |
|
| 1518 | 1518 | //if value submitted was not changed, then don't validate |
| 1519 | 1519 | $field->failed_validation = false; |
| 1520 | 1520 | |
@@ -1527,7 +1527,7 @@ discard block |
||
| 1527 | 1527 | } |
| 1528 | 1528 | |
| 1529 | 1529 | // if here then probably we are facing the validation 'At least one field must be filled out' |
| 1530 | - if( GFFormDisplay::is_empty( $field, $this->form_id ) && empty( $field->isRequired ) ) { |
|
| 1530 | + if ( GFFormDisplay::is_empty( $field, $this->form_id ) && empty( $field->isRequired ) ) { |
|
| 1531 | 1531 | unset( $field->validation_message ); |
| 1532 | 1532 | $field->validation_message = false; |
| 1533 | 1533 | continue; |
@@ -1539,12 +1539,12 @@ discard block |
||
| 1539 | 1539 | |
| 1540 | 1540 | } |
| 1541 | 1541 | |
| 1542 | - $validation_results['is_valid'] = $gv_valid; |
|
| 1542 | + $validation_results[ 'is_valid' ] = $gv_valid; |
|
| 1543 | 1543 | |
| 1544 | 1544 | gravityview()->log->debug( 'GravityView_Edit_Entry[custom_validation] Validation results.', array( 'data' => $validation_results ) ); |
| 1545 | 1545 | |
| 1546 | 1546 | // We'll need this result when rendering the form ( on GFFormDisplay::get_form ) |
| 1547 | - $this->form_after_validation = $validation_results['form']; |
|
| 1547 | + $this->form_after_validation = $validation_results[ 'form' ]; |
|
| 1548 | 1548 | |
| 1549 | 1549 | return $validation_results; |
| 1550 | 1550 | } |
@@ -1557,7 +1557,7 @@ discard block |
||
| 1557 | 1557 | */ |
| 1558 | 1558 | public function get_entry() { |
| 1559 | 1559 | |
| 1560 | - if( empty( $this->entry ) ) { |
|
| 1560 | + if ( empty( $this->entry ) ) { |
|
| 1561 | 1561 | // Get the database value of the entry that's being edited |
| 1562 | 1562 | $this->entry = gravityview_get_entry( GravityView_frontend::is_single_entry() ); |
| 1563 | 1563 | } |
@@ -1589,10 +1589,10 @@ discard block |
||
| 1589 | 1589 | } |
| 1590 | 1590 | |
| 1591 | 1591 | // If edit tab not yet configured, show all fields |
| 1592 | - $edit_fields = !empty( $properties['edit_edit-fields'] ) ? $properties['edit_edit-fields'] : NULL; |
|
| 1592 | + $edit_fields = ! empty( $properties[ 'edit_edit-fields' ] ) ? $properties[ 'edit_edit-fields' ] : NULL; |
|
| 1593 | 1593 | |
| 1594 | 1594 | // Hide fields depending on admin settings |
| 1595 | - $fields = $this->filter_fields( $form['fields'], $edit_fields ); |
|
| 1595 | + $fields = $this->filter_fields( $form[ 'fields' ], $edit_fields ); |
|
| 1596 | 1596 | |
| 1597 | 1597 | // If Edit Entry fields are configured, remove adminOnly field settings. Otherwise, don't. |
| 1598 | 1598 | $fields = $this->filter_admin_only_fields( $fields, $edit_fields, $form, $view_id ); |
@@ -1624,7 +1624,7 @@ discard block |
||
| 1624 | 1624 | */ |
| 1625 | 1625 | private function filter_fields( $fields, $configured_fields ) { |
| 1626 | 1626 | |
| 1627 | - if( empty( $fields ) || !is_array( $fields ) ) { |
|
| 1627 | + if ( empty( $fields ) || ! is_array( $fields ) ) { |
|
| 1628 | 1628 | return $fields; |
| 1629 | 1629 | } |
| 1630 | 1630 | |
@@ -1637,18 +1637,18 @@ discard block |
||
| 1637 | 1637 | |
| 1638 | 1638 | // Remove the fields that have calculation properties and keep them to be used later |
| 1639 | 1639 | // @since 1.16.2 |
| 1640 | - if( $field->has_calculation() ) { |
|
| 1641 | - $this->fields_with_calculation[] = $field; |
|
| 1640 | + if ( $field->has_calculation() ) { |
|
| 1641 | + $this->fields_with_calculation[ ] = $field; |
|
| 1642 | 1642 | // don't remove the calculation fields on form render. |
| 1643 | 1643 | } |
| 1644 | 1644 | |
| 1645 | - if( in_array( $field->type, $field_type_blacklist ) ) { |
|
| 1645 | + if ( in_array( $field->type, $field_type_blacklist ) ) { |
|
| 1646 | 1646 | unset( $fields[ $key ] ); |
| 1647 | 1647 | } |
| 1648 | 1648 | } |
| 1649 | 1649 | |
| 1650 | 1650 | // The Edit tab has not been configured, so we return all fields by default. |
| 1651 | - if( empty( $configured_fields ) ) { |
|
| 1651 | + if ( empty( $configured_fields ) ) { |
|
| 1652 | 1652 | return $fields; |
| 1653 | 1653 | } |
| 1654 | 1654 | |
@@ -1657,8 +1657,8 @@ discard block |
||
| 1657 | 1657 | |
| 1658 | 1658 | /** @var GF_Field $field */ |
| 1659 | 1659 | foreach ( $fields as $field ) { |
| 1660 | - if( intval( $configured_field['id'] ) === intval( $field->id ) && $this->user_can_edit_field( $configured_field, false ) ) { |
|
| 1661 | - $edit_fields[] = $this->merge_field_properties( $field, $configured_field ); |
|
| 1660 | + if ( intval( $configured_field[ 'id' ] ) === intval( $field->id ) && $this->user_can_edit_field( $configured_field, false ) ) { |
|
| 1661 | + $edit_fields[ ] = $this->merge_field_properties( $field, $configured_field ); |
|
| 1662 | 1662 | break; |
| 1663 | 1663 | } |
| 1664 | 1664 | |
@@ -1681,14 +1681,14 @@ discard block |
||
| 1681 | 1681 | |
| 1682 | 1682 | $return_field = $field; |
| 1683 | 1683 | |
| 1684 | - if( empty( $field_setting['show_label'] ) ) { |
|
| 1684 | + if ( empty( $field_setting[ 'show_label' ] ) ) { |
|
| 1685 | 1685 | $return_field->label = ''; |
| 1686 | - } elseif ( !empty( $field_setting['custom_label'] ) ) { |
|
| 1687 | - $return_field->label = $field_setting['custom_label']; |
|
| 1686 | + } elseif ( ! empty( $field_setting[ 'custom_label' ] ) ) { |
|
| 1687 | + $return_field->label = $field_setting[ 'custom_label' ]; |
|
| 1688 | 1688 | } |
| 1689 | 1689 | |
| 1690 | - if( !empty( $field_setting['custom_class'] ) ) { |
|
| 1691 | - $return_field->cssClass .= ' '. gravityview_sanitize_html_class( $field_setting['custom_class'] ); |
|
| 1690 | + if ( ! empty( $field_setting[ 'custom_class' ] ) ) { |
|
| 1691 | + $return_field->cssClass .= ' ' . gravityview_sanitize_html_class( $field_setting[ 'custom_class' ] ); |
|
| 1692 | 1692 | } |
| 1693 | 1693 | |
| 1694 | 1694 | /** |
@@ -1726,16 +1726,16 @@ discard block |
||
| 1726 | 1726 | */ |
| 1727 | 1727 | $use_gf_adminonly_setting = apply_filters( 'gravityview/edit_entry/use_gf_admin_only_setting', empty( $edit_fields ), $form, $view_id ); |
| 1728 | 1728 | |
| 1729 | - if( $use_gf_adminonly_setting && false === GVCommon::has_cap( 'gravityforms_edit_entries', $this->entry['id'] ) ) { |
|
| 1730 | - foreach( $fields as $k => $field ) { |
|
| 1731 | - if( $field->adminOnly ) { |
|
| 1729 | + if ( $use_gf_adminonly_setting && false === GVCommon::has_cap( 'gravityforms_edit_entries', $this->entry[ 'id' ] ) ) { |
|
| 1730 | + foreach ( $fields as $k => $field ) { |
|
| 1731 | + if ( $field->adminOnly ) { |
|
| 1732 | 1732 | unset( $fields[ $k ] ); |
| 1733 | 1733 | } |
| 1734 | 1734 | } |
| 1735 | 1735 | return $fields; |
| 1736 | 1736 | } |
| 1737 | 1737 | |
| 1738 | - foreach( $fields as &$field ) { |
|
| 1738 | + foreach ( $fields as &$field ) { |
|
| 1739 | 1739 | $field->adminOnly = false; |
| 1740 | 1740 | } |
| 1741 | 1741 | |
@@ -1756,7 +1756,7 @@ discard block |
||
| 1756 | 1756 | */ |
| 1757 | 1757 | private function unselect_default_values( $form ) { |
| 1758 | 1758 | |
| 1759 | - foreach ( $form['fields'] as &$field ) { |
|
| 1759 | + foreach ( $form[ 'fields' ] as &$field ) { |
|
| 1760 | 1760 | |
| 1761 | 1761 | if ( empty( $field->choices ) ) { |
| 1762 | 1762 | continue; |
@@ -1764,7 +1764,7 @@ discard block |
||
| 1764 | 1764 | |
| 1765 | 1765 | foreach ( $field->choices as &$choice ) { |
| 1766 | 1766 | if ( \GV\Utils::get( $choice, 'isSelected' ) ) { |
| 1767 | - $choice['isSelected'] = false; |
|
| 1767 | + $choice[ 'isSelected' ] = false; |
|
| 1768 | 1768 | } |
| 1769 | 1769 | } |
| 1770 | 1770 | } |
@@ -1789,22 +1789,22 @@ discard block |
||
| 1789 | 1789 | */ |
| 1790 | 1790 | function prefill_conditional_logic( $form ) { |
| 1791 | 1791 | |
| 1792 | - if( ! GFFormDisplay::has_conditional_logic( $form ) ) { |
|
| 1792 | + if ( ! GFFormDisplay::has_conditional_logic( $form ) ) { |
|
| 1793 | 1793 | return $form; |
| 1794 | 1794 | } |
| 1795 | 1795 | |
| 1796 | 1796 | // Have Conditional Logic pre-fill fields as if the data were default values |
| 1797 | 1797 | /** @var GF_Field $field */ |
| 1798 | - foreach ( $form['fields'] as &$field ) { |
|
| 1798 | + foreach ( $form[ 'fields' ] as &$field ) { |
|
| 1799 | 1799 | |
| 1800 | - if( 'checkbox' === $field->type ) { |
|
| 1800 | + if ( 'checkbox' === $field->type ) { |
|
| 1801 | 1801 | foreach ( $field->get_entry_inputs() as $key => $input ) { |
| 1802 | - $input_id = $input['id']; |
|
| 1802 | + $input_id = $input[ 'id' ]; |
|
| 1803 | 1803 | $choice = $field->choices[ $key ]; |
| 1804 | 1804 | $value = \GV\Utils::get( $this->entry, $input_id ); |
| 1805 | 1805 | $match = RGFormsModel::choice_value_match( $field, $choice, $value ); |
| 1806 | - if( $match ) { |
|
| 1807 | - $field->choices[ $key ]['isSelected'] = true; |
|
| 1806 | + if ( $match ) { |
|
| 1807 | + $field->choices[ $key ][ 'isSelected' ] = true; |
|
| 1808 | 1808 | } |
| 1809 | 1809 | } |
| 1810 | 1810 | } else { |
@@ -1812,15 +1812,15 @@ discard block |
||
| 1812 | 1812 | // We need to run through each field to set the default values |
| 1813 | 1813 | foreach ( $this->entry as $field_id => $field_value ) { |
| 1814 | 1814 | |
| 1815 | - if( floatval( $field_id ) === floatval( $field->id ) ) { |
|
| 1815 | + if ( floatval( $field_id ) === floatval( $field->id ) ) { |
|
| 1816 | 1816 | |
| 1817 | - if( 'list' === $field->type ) { |
|
| 1817 | + if ( 'list' === $field->type ) { |
|
| 1818 | 1818 | $list_rows = maybe_unserialize( $field_value ); |
| 1819 | 1819 | |
| 1820 | 1820 | $list_field_value = array(); |
| 1821 | - foreach ( (array) $list_rows as $row ) { |
|
| 1822 | - foreach ( (array) $row as $column ) { |
|
| 1823 | - $list_field_value[] = $column; |
|
| 1821 | + foreach ( (array)$list_rows as $row ) { |
|
| 1822 | + foreach ( (array)$row as $column ) { |
|
| 1823 | + $list_field_value[ ] = $column; |
|
| 1824 | 1824 | } |
| 1825 | 1825 | } |
| 1826 | 1826 | |
@@ -1855,16 +1855,16 @@ discard block |
||
| 1855 | 1855 | */ |
| 1856 | 1856 | $use_conditional_logic = apply_filters( 'gravityview/edit_entry/conditional_logic', true, $form ); |
| 1857 | 1857 | |
| 1858 | - if( $use_conditional_logic ) { |
|
| 1858 | + if ( $use_conditional_logic ) { |
|
| 1859 | 1859 | return $form; |
| 1860 | 1860 | } |
| 1861 | 1861 | |
| 1862 | - foreach( $form['fields'] as &$field ) { |
|
| 1862 | + foreach ( $form[ 'fields' ] as &$field ) { |
|
| 1863 | 1863 | /* @var GF_Field $field */ |
| 1864 | 1864 | $field->conditionalLogic = null; |
| 1865 | 1865 | } |
| 1866 | 1866 | |
| 1867 | - unset( $form['button']['conditionalLogic'] ); |
|
| 1867 | + unset( $form[ 'button' ][ 'conditionalLogic' ] ); |
|
| 1868 | 1868 | |
| 1869 | 1869 | return $form; |
| 1870 | 1870 | |
@@ -1881,7 +1881,7 @@ discard block |
||
| 1881 | 1881 | */ |
| 1882 | 1882 | public function manage_conditional_logic( $has_conditional_logic, $form ) { |
| 1883 | 1883 | |
| 1884 | - if( ! $this->is_edit_entry() ) { |
|
| 1884 | + if ( ! $this->is_edit_entry() ) { |
|
| 1885 | 1885 | return $has_conditional_logic; |
| 1886 | 1886 | } |
| 1887 | 1887 | |
@@ -1913,44 +1913,44 @@ discard block |
||
| 1913 | 1913 | * 2. There are two entries embedded using oEmbed |
| 1914 | 1914 | * 3. One of the entries has just been saved |
| 1915 | 1915 | */ |
| 1916 | - if( !empty( $_POST['lid'] ) && !empty( $_GET['entry'] ) && ( $_POST['lid'] !== $_GET['entry'] ) ) { |
|
| 1916 | + if ( ! empty( $_POST[ 'lid' ] ) && ! empty( $_GET[ 'entry' ] ) && ( $_POST[ 'lid' ] !== $_GET[ 'entry' ] ) ) { |
|
| 1917 | 1917 | |
| 1918 | 1918 | $error = true; |
| 1919 | 1919 | |
| 1920 | 1920 | } |
| 1921 | 1921 | |
| 1922 | - if( !empty( $_GET['entry'] ) && (string)$this->entry['id'] !== $_GET['entry'] ) { |
|
| 1922 | + if ( ! empty( $_GET[ 'entry' ] ) && (string)$this->entry[ 'id' ] !== $_GET[ 'entry' ] ) { |
|
| 1923 | 1923 | |
| 1924 | 1924 | $error = true; |
| 1925 | 1925 | |
| 1926 | - } elseif( ! $this->verify_nonce() ) { |
|
| 1926 | + } elseif ( ! $this->verify_nonce() ) { |
|
| 1927 | 1927 | |
| 1928 | 1928 | /** |
| 1929 | 1929 | * If the Entry is embedded, there may be two entries on the same page. |
| 1930 | 1930 | * If that's the case, and one is being edited, the other should fail gracefully and not display an error. |
| 1931 | 1931 | */ |
| 1932 | - if( GravityView_oEmbed::getInstance()->get_entry_id() ) { |
|
| 1932 | + if ( GravityView_oEmbed::getInstance()->get_entry_id() ) { |
|
| 1933 | 1933 | $error = true; |
| 1934 | 1934 | } else { |
| 1935 | - $error = __( 'The link to edit this entry is not valid; it may have expired.', 'gravityview'); |
|
| 1935 | + $error = __( 'The link to edit this entry is not valid; it may have expired.', 'gravityview' ); |
|
| 1936 | 1936 | } |
| 1937 | 1937 | |
| 1938 | 1938 | } |
| 1939 | 1939 | |
| 1940 | - if( ! GravityView_Edit_Entry::check_user_cap_edit_entry( $this->entry ) ) { |
|
| 1941 | - $error = __( 'You do not have permission to edit this entry.', 'gravityview'); |
|
| 1940 | + if ( ! GravityView_Edit_Entry::check_user_cap_edit_entry( $this->entry ) ) { |
|
| 1941 | + $error = __( 'You do not have permission to edit this entry.', 'gravityview' ); |
|
| 1942 | 1942 | } |
| 1943 | 1943 | |
| 1944 | - if( $this->entry['status'] === 'trash' ) { |
|
| 1945 | - $error = __('You cannot edit the entry; it is in the trash.', 'gravityview' ); |
|
| 1944 | + if ( $this->entry[ 'status' ] === 'trash' ) { |
|
| 1945 | + $error = __( 'You cannot edit the entry; it is in the trash.', 'gravityview' ); |
|
| 1946 | 1946 | } |
| 1947 | 1947 | |
| 1948 | 1948 | // No errors; everything's fine here! |
| 1949 | - if( empty( $error ) ) { |
|
| 1949 | + if ( empty( $error ) ) { |
|
| 1950 | 1950 | return true; |
| 1951 | 1951 | } |
| 1952 | 1952 | |
| 1953 | - if( $echo && $error !== true ) { |
|
| 1953 | + if ( $echo && $error !== true ) { |
|
| 1954 | 1954 | |
| 1955 | 1955 | $error = esc_html( $error ); |
| 1956 | 1956 | |
@@ -1958,10 +1958,10 @@ discard block |
||
| 1958 | 1958 | * @since 1.9 |
| 1959 | 1959 | */ |
| 1960 | 1960 | if ( ! empty( $this->entry ) ) { |
| 1961 | - $error .= ' ' . gravityview_get_link( '#', _x('Go back.', 'Link shown when invalid Edit Entry link is clicked', 'gravityview' ), array( 'onclick' => "window.history.go(-1); return false;" ) ); |
|
| 1961 | + $error .= ' ' . gravityview_get_link( '#', _x( 'Go back.', 'Link shown when invalid Edit Entry link is clicked', 'gravityview' ), array( 'onclick' => "window.history.go(-1); return false;" ) ); |
|
| 1962 | 1962 | } |
| 1963 | 1963 | |
| 1964 | - echo GVCommon::generate_notice( wpautop( $error ), 'gv-error error'); |
|
| 1964 | + echo GVCommon::generate_notice( wpautop( $error ), 'gv-error error' ); |
|
| 1965 | 1965 | } |
| 1966 | 1966 | |
| 1967 | 1967 | gravityview()->log->error( '{error}', array( 'error' => $error ) ); |
@@ -1981,17 +1981,17 @@ discard block |
||
| 1981 | 1981 | |
| 1982 | 1982 | $error = NULL; |
| 1983 | 1983 | |
| 1984 | - if( ! $this->check_user_cap_edit_field( $field ) ) { |
|
| 1985 | - $error = __( 'You do not have permission to edit this field.', 'gravityview'); |
|
| 1984 | + if ( ! $this->check_user_cap_edit_field( $field ) ) { |
|
| 1985 | + $error = __( 'You do not have permission to edit this field.', 'gravityview' ); |
|
| 1986 | 1986 | } |
| 1987 | 1987 | |
| 1988 | 1988 | // No errors; everything's fine here! |
| 1989 | - if( empty( $error ) ) { |
|
| 1989 | + if ( empty( $error ) ) { |
|
| 1990 | 1990 | return true; |
| 1991 | 1991 | } |
| 1992 | 1992 | |
| 1993 | - if( $echo ) { |
|
| 1994 | - echo GVCommon::generate_notice( wpautop( esc_html( $error ) ), 'gv-error error'); |
|
| 1993 | + if ( $echo ) { |
|
| 1994 | + echo GVCommon::generate_notice( wpautop( esc_html( $error ) ), 'gv-error error' ); |
|
| 1995 | 1995 | } |
| 1996 | 1996 | |
| 1997 | 1997 | gravityview()->log->error( '{error}', array( 'error' => $error ) ); |
@@ -2012,14 +2012,14 @@ discard block |
||
| 2012 | 2012 | private function check_user_cap_edit_field( $field ) { |
| 2013 | 2013 | |
| 2014 | 2014 | // If they can edit any entries (as defined in Gravity Forms), we're good. |
| 2015 | - if( GVCommon::has_cap( array( 'gravityforms_edit_entries', 'gravityview_edit_others_entries' ) ) ) { |
|
| 2015 | + if ( GVCommon::has_cap( array( 'gravityforms_edit_entries', 'gravityview_edit_others_entries' ) ) ) { |
|
| 2016 | 2016 | return true; |
| 2017 | 2017 | } |
| 2018 | 2018 | |
| 2019 | - $field_cap = isset( $field['allow_edit_cap'] ) ? $field['allow_edit_cap'] : false; |
|
| 2019 | + $field_cap = isset( $field[ 'allow_edit_cap' ] ) ? $field[ 'allow_edit_cap' ] : false; |
|
| 2020 | 2020 | |
| 2021 | - if( $field_cap ) { |
|
| 2022 | - return GVCommon::has_cap( $field['allow_edit_cap'] ); |
|
| 2021 | + if ( $field_cap ) { |
|
| 2022 | + return GVCommon::has_cap( $field[ 'allow_edit_cap' ] ); |
|
| 2023 | 2023 | } |
| 2024 | 2024 | |
| 2025 | 2025 | return false; |
@@ -2033,17 +2033,17 @@ discard block |
||
| 2033 | 2033 | public function verify_nonce() { |
| 2034 | 2034 | |
| 2035 | 2035 | // Verify form submitted for editing single |
| 2036 | - if( $this->is_edit_entry_submission() ) { |
|
| 2036 | + if ( $this->is_edit_entry_submission() ) { |
|
| 2037 | 2037 | $valid = wp_verify_nonce( $_POST[ self::$nonce_field ], self::$nonce_field ); |
| 2038 | 2038 | } |
| 2039 | 2039 | |
| 2040 | 2040 | // Verify |
| 2041 | - else if( ! $this->is_edit_entry() ) { |
|
| 2041 | + else if ( ! $this->is_edit_entry() ) { |
|
| 2042 | 2042 | $valid = false; |
| 2043 | 2043 | } |
| 2044 | 2044 | |
| 2045 | 2045 | else { |
| 2046 | - $valid = wp_verify_nonce( $_GET['edit'], self::$nonce_key ); |
|
| 2046 | + $valid = wp_verify_nonce( $_GET[ 'edit' ], self::$nonce_key ); |
|
| 2047 | 2047 | } |
| 2048 | 2048 | |
| 2049 | 2049 | /** |