Completed
Pull Request — master (#641)
by Zack
23:52 queued 19:59
created
includes/extensions/edit-entry/class-edit-entry-user-registration.php 1 patch
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -43,8 +43,8 @@  discard block
 block discarded – undo
43 43
 	     * @since 1.11
44 44
 	     * @param boolean $boolean Whether to trigger update on user registration (default: true)
45 45
 	     */
46
-        if( apply_filters( 'gravityview/edit_entry/user_registration/trigger_update', true ) ) {
47
-            add_action( 'gravityview/edit_entry/after_update' , array( $this, 'update_user' ), 10, 2 );
46
+        if ( apply_filters( 'gravityview/edit_entry/user_registration/trigger_update', true ) ) {
47
+            add_action( 'gravityview/edit_entry/after_update', array( $this, 'update_user' ), 10, 2 );
48 48
 
49 49
             // last resort in case the current user display name don't match any of the defaults
50 50
             add_action( 'gform_user_updated', array( $this, 'restore_display_name' ), 10, 4 );
@@ -62,14 +62,14 @@  discard block
 block discarded – undo
62 62
      */
63 63
     public function update_user( $form = array(), $entry_id = 0 ) {
64 64
 
65
-        if( !class_exists( 'GFAPI' ) || !class_exists( 'GFUser' ) || empty( $entry_id ) ) {
65
+        if ( ! class_exists( 'GFAPI' ) || ! class_exists( 'GFUser' ) || empty( $entry_id ) ) {
66 66
             return;
67 67
         }
68 68
 
69 69
         // support for GF User Registration 3.x
70
-        $gf_user_3 =  class_exists('GF_User_Registration') ? true : false;
70
+        $gf_user_3 = class_exists( 'GF_User_Registration' ) ? true : false;
71 71
 
72
-        if( $gf_user_3 ) {
72
+        if ( $gf_user_3 ) {
73 73
             $gf_user_registration = GF_User_Registration::get_instance();
74 74
         }
75 75
 
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
         /**
87 87
          * @since 1.14
88 88
          */
89
-        if( $gf_user_3 ) {
89
+        if ( $gf_user_3 ) {
90 90
             $config = $gf_user_registration->get_single_submission_feed( $entry, $form );
91 91
         } else {
92 92
             $config = GFUser::get_active_config( $form, $entry );
@@ -102,15 +102,15 @@  discard block
 block discarded – undo
102 102
          */
103 103
         $preserve_role = apply_filters( 'gravityview/edit_entry/user_registration/preserve_role', true, $config, $form, $entry );
104 104
 
105
-        if( $preserve_role ) {
106
-            $config['meta']['role'] = 'gfur_preserve_role';
105
+        if ( $preserve_role ) {
106
+            $config[ 'meta' ][ 'role' ] = 'gfur_preserve_role';
107 107
         }
108 108
 
109 109
         /**
110 110
          * Make sure the current display name is not changed with the update user method.
111 111
          * @since 1.15
112 112
          */
113
-        $config['meta']['displayname'] = $this->match_current_display_name( $entry['created_by'] );
113
+        $config[ 'meta' ][ 'displayname' ] = $this->match_current_display_name( $entry[ 'created_by' ] );
114 114
 
115 115
 
116 116
         /**
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
         $is_create_feed = ( $config && rgars( $config, $feed_pos ) === 'create' );
128 128
 
129 129
         // Only update if it's a create feed
130
-        if( ! $is_create_feed ) {
130
+        if ( ! $is_create_feed ) {
131 131
             return;
132 132
         }
133 133
 
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
         add_filter( 'send_email_change_email', '__return_false', 3 );
137 137
 
138 138
         // Trigger the User Registration update user method
139
-        if( $gf_user_3 ) {
139
+        if ( $gf_user_3 ) {
140 140
             $gf_user_registration->update_user( $entry, $form, $config );
141 141
         } else {
142 142
             GFUser::update_user( $entry, $form, $config );
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
 
167 167
         // In case we can't find the current display name format, or it is the 'nickname' format (which Gravity Forms doesn't support)
168 168
         //   trigger last resort method at the 'gform_user_updated' hook
169
-        if( false === $format || 'nickname' === $format ) {
169
+        if ( false === $format || 'nickname' === $format ) {
170 170
             $this->_user_before_update = $user;
171 171
             $format = 'nickname';
172 172
         }
@@ -186,18 +186,18 @@  discard block
 block discarded – undo
186 186
     public function generate_display_names( $profileuser ) {
187 187
 
188 188
         $public_display = array();
189
-        $public_display['nickname']  = $profileuser->nickname;
190
-        $public_display['username']  = $profileuser->user_login;
189
+        $public_display[ 'nickname' ]  = $profileuser->nickname;
190
+        $public_display[ 'username' ]  = $profileuser->user_login;
191 191
 
192
-        if ( !empty($profileuser->first_name) )
193
-            $public_display['firstname'] = $profileuser->first_name;
192
+        if ( ! empty( $profileuser->first_name ) )
193
+            $public_display[ 'firstname' ] = $profileuser->first_name;
194 194
 
195
-        if ( !empty($profileuser->last_name) )
196
-            $public_display['lastname'] = $profileuser->last_name;
195
+        if ( ! empty( $profileuser->last_name ) )
196
+            $public_display[ 'lastname' ] = $profileuser->last_name;
197 197
 
198
-        if ( !empty($profileuser->first_name) && !empty($profileuser->last_name) ) {
199
-            $public_display['firstlast'] = $profileuser->first_name . ' ' . $profileuser->last_name;
200
-            $public_display['lastfirst'] = $profileuser->last_name . ' ' . $profileuser->first_name;
198
+        if ( ! empty( $profileuser->first_name ) && ! empty( $profileuser->last_name ) ) {
199
+            $public_display[ 'firstlast' ] = $profileuser->first_name . ' ' . $profileuser->last_name;
200
+            $public_display[ 'lastfirst' ] = $profileuser->last_name . ' ' . $profileuser->first_name;
201 201
         }
202 202
 
203 203
         $public_display = array_map( 'trim', $public_display );
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
          */
228 228
         $restore_display_name = apply_filters( 'gravityview/edit_entry/restore_display_name', true );
229 229
 
230
-        $is_update_feed = ( $config && rgars( $config, 'meta/feed_type') === 'update' );
230
+        $is_update_feed = ( $config && rgars( $config, 'meta/feed_type' ) === 'update' );
231 231
 
232 232
         /**
233 233
          * Don't restore display name:
@@ -236,7 +236,7 @@  discard block
 block discarded – undo
236 236
          *   - or we don't need as we found the correct format before updating user.
237 237
          * @since 1.14.4
238 238
          */
239
-        if( ! $restore_display_name || $is_update_feed || is_null( $this->_user_before_update ) ) {
239
+        if ( ! $restore_display_name || $is_update_feed || is_null( $this->_user_before_update ) ) {
240 240
             return;
241 241
         }
242 242
 
@@ -262,10 +262,10 @@  discard block
 block discarded – undo
262 262
 
263 263
         $updated = wp_update_user( $restored_user );
264 264
 
265
-        if( is_wp_error( $updated ) ) {
266
-            do_action('gravityview_log_error', __METHOD__ . sprintf( ' - There was an error updating user #%d details', $user_id ), $updated );
265
+        if ( is_wp_error( $updated ) ) {
266
+            do_action( 'gravityview_log_error', __METHOD__ . sprintf( ' - There was an error updating user #%d details', $user_id ), $updated );
267 267
         } else {
268
-            do_action('gravityview_log_debug', __METHOD__ . sprintf( ' - User #%d details restored', $user_id ) );
268
+            do_action( 'gravityview_log_debug', __METHOD__ . sprintf( ' - User #%d details restored', $user_id ) );
269 269
         }
270 270
 
271 271
         $this->_user_before_update = null;
Please login to merge, or discard this patch.
includes/extensions/edit-entry/class-edit-entry.php 1 patch
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
 
37 37
         self::$file = plugin_dir_path( __FILE__ );
38 38
 
39
-        if( is_admin() ) {
39
+        if ( is_admin() ) {
40 40
             $this->load_components( 'admin' );
41 41
         }
42 42
 
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
 
56 56
     static function getInstance() {
57 57
 
58
-        if( empty( self::$instance ) ) {
58
+        if ( empty( self::$instance ) ) {
59 59
             self::$instance = new GravityView_Edit_Entry;
60 60
         }
61 61
 
@@ -81,10 +81,10 @@  discard block
 block discarded – undo
81 81
     private function add_hooks() {
82 82
 
83 83
         // Add front-end access to Gravity Forms delete file action
84
-        add_action( 'wp_ajax_nopriv_rg_delete_file', array( 'RGForms', 'delete_file') );
84
+        add_action( 'wp_ajax_nopriv_rg_delete_file', array( 'RGForms', 'delete_file' ) );
85 85
 
86 86
         // Make sure this hook is run for non-admins
87
-        add_action( 'wp_ajax_rg_delete_file', array( 'RGForms', 'delete_file') );
87
+        add_action( 'wp_ajax_rg_delete_file', array( 'RGForms', 'delete_file' ) );
88 88
 
89 89
         add_filter( 'gravityview_blacklist_field_types', array( $this, 'modify_field_blacklist' ), 10, 2 );
90 90
 
@@ -99,8 +99,8 @@  discard block
 block discarded – undo
99 99
 	 */
100 100
 	private function addon_specific_hooks() {
101 101
 
102
-		if( class_exists( 'GFSignature' ) && is_callable( array( 'GFSignature', 'get_instance' ) ) ) {
103
-			add_filter('gform_admin_pre_render', array( GFSignature::get_instance(), 'edit_lead_script'));
102
+		if ( class_exists( 'GFSignature' ) && is_callable( array( 'GFSignature', 'get_instance' ) ) ) {
103
+			add_filter( 'gform_admin_pre_render', array( GFSignature::get_instance(), 'edit_lead_script' ) );
104 104
 		}
105 105
 
106 106
 	}
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
      */
147 147
     public static function get_edit_link( $entry, $view_id, $post_id = null, $field_values = '' ) {
148 148
 
149
-        $nonce_key = self::get_nonce_key( $view_id, $entry['form_id'], $entry['id']  );
149
+        $nonce_key = self::get_nonce_key( $view_id, $entry[ 'form_id' ], $entry[ 'id' ] );
150 150
 
151 151
         $base = gv_entry_link( $entry, $post_id );
152 152
 
@@ -160,9 +160,9 @@  discard block
 block discarded – undo
160 160
 	     * Allow passing params to dynamically populate entry with values
161 161
 	     * @since 1.9.2
162 162
 	     */
163
-	    if( !empty( $field_values ) ) {
163
+	    if ( ! empty( $field_values ) ) {
164 164
 
165
-		    if( is_array( $field_values ) ) {
165
+		    if ( is_array( $field_values ) ) {
166 166
 			    // If already an array, no parse_str() needed
167 167
 			    $params = $field_values;
168 168
 		    } else {
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
 	 */
185 185
 	public function modify_field_blacklist( $fields = array(), $context = NULL ) {
186 186
 
187
-		if( empty( $context ) || $context !== 'edit' ) {
187
+		if ( empty( $context ) || $context !== 'edit' ) {
188 188
 			return $fields;
189 189
 		}
190 190
 
@@ -226,24 +226,24 @@  discard block
 block discarded – undo
226 226
         // If they can edit any entries (as defined in Gravity Forms)
227 227
         // Or if they can edit other people's entries
228 228
         // Then we're good.
229
-        if( GVCommon::has_cap( array( 'gravityforms_edit_entries', 'gravityview_edit_others_entries' ), $entry['id'] ) ) {
229
+        if ( GVCommon::has_cap( array( 'gravityforms_edit_entries', 'gravityview_edit_others_entries' ), $entry[ 'id' ] ) ) {
230 230
 
231
-            do_action('gravityview_log_debug', __METHOD__ . ' - User has ability to edit all entries.');
231
+            do_action( 'gravityview_log_debug', __METHOD__ . ' - User has ability to edit all entries.' );
232 232
 
233 233
             $user_can_edit = true;
234 234
 
235
-        } else if( !isset( $entry['created_by'] ) ) {
235
+        } else if ( ! isset( $entry[ 'created_by' ] ) ) {
236 236
 
237
-            do_action('gravityview_log_error', 'GravityView_Edit_Entry[check_user_cap_edit_entry] Entry `created_by` doesn\'t exist.');
237
+            do_action( 'gravityview_log_error', 'GravityView_Edit_Entry[check_user_cap_edit_entry] Entry `created_by` doesn\'t exist.' );
238 238
 
239 239
             $user_can_edit = false;
240 240
 
241 241
         } else {
242 242
 
243 243
             // get user_edit setting
244
-            if( empty( $view_id ) || $view_id == GravityView_View::getInstance()->getViewId() ) {
244
+            if ( empty( $view_id ) || $view_id == GravityView_View::getInstance()->getViewId() ) {
245 245
                 // if View ID not specified or is the current view
246
-                $user_edit = GravityView_View::getInstance()->getAtts('user_edit');
246
+                $user_edit = GravityView_View::getInstance()->getAtts( 'user_edit' );
247 247
             } else {
248 248
                 // in case is specified and not the current view
249 249
                 $user_edit = GVCommon::get_template_setting( $view_id, 'user_edit' );
@@ -252,21 +252,21 @@  discard block
 block discarded – undo
252 252
             $current_user = wp_get_current_user();
253 253
 
254 254
             // User edit is disabled
255
-            if( empty( $user_edit ) ) {
255
+            if ( empty( $user_edit ) ) {
256 256
 
257
-                do_action('gravityview_log_debug', 'GravityView_Edit_Entry[check_user_cap_edit_entry] User Edit is disabled. Returning false.' );
257
+                do_action( 'gravityview_log_debug', 'GravityView_Edit_Entry[check_user_cap_edit_entry] User Edit is disabled. Returning false.' );
258 258
 
259 259
                 $user_can_edit = false;
260 260
             }
261 261
 
262 262
             // User edit is enabled and the logged-in user is the same as the user who created the entry. We're good.
263
-            else if( is_user_logged_in() && intval( $current_user->ID ) === intval( $entry['created_by'] ) ) {
263
+            else if ( is_user_logged_in() && intval( $current_user->ID ) === intval( $entry[ 'created_by' ] ) ) {
264 264
 
265
-                do_action('gravityview_log_debug', sprintf( 'GravityView_Edit_Entry[check_user_cap_edit_entry] User %s created the entry.', $current_user->ID ) );
265
+                do_action( 'gravityview_log_debug', sprintf( 'GravityView_Edit_Entry[check_user_cap_edit_entry] User %s created the entry.', $current_user->ID ) );
266 266
 
267 267
                 $user_can_edit = true;
268 268
 
269
-            } else if( ! is_user_logged_in() ) {
269
+            } else if ( ! is_user_logged_in() ) {
270 270
 
271 271
                 do_action( 'gravityview_log_debug', __METHOD__ . ' No user defined; edit entry requires logged in user' );
272 272
             }
Please login to merge, or discard this patch.
includes/extensions/edit-entry/class-edit-entry-render.php 1 patch
Spacing   +207 added lines, -207 removed lines patch added patch discarded remove patch
@@ -102,16 +102,16 @@  discard block
 block discarded – undo
102 102
     function load() {
103 103
 
104 104
         /** @define "GRAVITYVIEW_DIR" "../../../" */
105
-        include_once( GRAVITYVIEW_DIR .'includes/class-admin-approve-entries.php' );
105
+        include_once( GRAVITYVIEW_DIR . 'includes/class-admin-approve-entries.php' );
106 106
 
107 107
         // Don't display an embedded form when editing an entry
108 108
         add_action( 'wp_head', array( $this, 'prevent_render_form' ) );
109 109
         add_action( 'wp_footer', array( $this, 'prevent_render_form' ) );
110 110
 
111 111
         // Stop Gravity Forms processing what is ours!
112
-        add_filter( 'wp', array( $this, 'prevent_maybe_process_form'), 8 );
112
+        add_filter( 'wp', array( $this, 'prevent_maybe_process_form' ), 8 );
113 113
 
114
-        add_filter( 'gravityview_is_edit_entry', array( $this, 'is_edit_entry') );
114
+        add_filter( 'gravityview_is_edit_entry', array( $this, 'is_edit_entry' ) );
115 115
 
116 116
         add_action( 'gravityview_edit_entry', array( $this, 'init' ) );
117 117
 
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
         add_filter( 'gform_plupload_settings', array( $this, 'modify_fileupload_settings' ), 10, 3 );
123 123
 
124 124
         // Add fields expected by GFFormDisplay::validate()
125
-        add_filter( 'gform_pre_validation', array( $this, 'gform_pre_validation') );
125
+        add_filter( 'gform_pre_validation', array( $this, 'gform_pre_validation' ) );
126 126
 
127 127
     }
128 128
 
@@ -137,8 +137,8 @@  discard block
 block discarded – undo
137 137
      * @return void
138 138
      */
139 139
     function prevent_render_form() {
140
-        if( $this->is_edit_entry() ) {
141
-            if( 'wp_head' === current_filter() ) {
140
+        if ( $this->is_edit_entry() ) {
141
+            if ( 'wp_head' === current_filter() ) {
142 142
                 add_filter( 'gform_shortcode_form', '__return_empty_string' );
143 143
             } else {
144 144
                 remove_filter( 'gform_shortcode_form', '__return_empty_string' );
@@ -153,10 +153,10 @@  discard block
 block discarded – undo
153 153
      */
154 154
     function prevent_maybe_process_form() {
155 155
 
156
-        do_action('gravityview_log_debug', 'GravityView_Edit_Entry[prevent_maybe_process_form] $_POSTed data (sanitized): ', esc_html( print_r( $_POST, true ) ) );
156
+        do_action( 'gravityview_log_debug', 'GravityView_Edit_Entry[prevent_maybe_process_form] $_POSTed data (sanitized): ', esc_html( print_r( $_POST, true ) ) );
157 157
 
158
-        if( $this->is_edit_entry_submission() && $this->verify_nonce() ) {
159
-            remove_action( 'wp',  array( 'RGForms', 'maybe_process_form'), 9 );
158
+        if ( $this->is_edit_entry_submission() && $this->verify_nonce() ) {
159
+            remove_action( 'wp', array( 'RGForms', 'maybe_process_form' ), 9 );
160 160
         }
161 161
     }
162 162
 
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
 
169 169
         $gf_page = ( 'entry' === RGForms::get( 'view' ) );
170 170
 
171
-        return ( $gf_page && isset( $_GET['edit'] ) || RGForms::post( 'action' ) === 'update' );
171
+        return ( $gf_page && isset( $_GET[ 'edit' ] ) || RGForms::post( 'action' ) === 'update' );
172 172
     }
173 173
 
174 174
 	/**
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
 	 * @return boolean
178 178
 	 */
179 179
 	public function is_edit_entry_submission() {
180
-		return !empty( $_POST[ self::$nonce_field ] );
180
+		return ! empty( $_POST[ self::$nonce_field ] );
181 181
 	}
182 182
 
183 183
     /**
@@ -188,13 +188,13 @@  discard block
 block discarded – undo
188 188
 
189 189
 
190 190
         $entries = $gravityview_view->getEntries();
191
-        $this->entry = $entries[0];
191
+        $this->entry = $entries[ 0 ];
192 192
 
193 193
         $this->original_form = $this->form = $gravityview_view->getForm();
194 194
         $this->form_id = $gravityview_view->getFormId();
195 195
         $this->view_id = $gravityview_view->getViewId();
196 196
 
197
-        self::$nonce_key = GravityView_Edit_Entry::get_nonce_key( $this->view_id, $this->form_id, $this->entry['id'] );
197
+        self::$nonce_key = GravityView_Edit_Entry::get_nonce_key( $this->view_id, $this->form_id, $this->entry[ 'id' ] );
198 198
     }
199 199
 
200 200
 
@@ -214,12 +214,12 @@  discard block
 block discarded – undo
214 214
         $this->setup_vars();
215 215
 
216 216
         // Multiple Views embedded, don't proceed if nonce fails
217
-        if( $gv_data->has_multiple_views() && ! wp_verify_nonce( $_GET['edit'], self::$nonce_key ) ) {
217
+        if ( $gv_data->has_multiple_views() && ! wp_verify_nonce( $_GET[ 'edit' ], self::$nonce_key ) ) {
218 218
             return;
219 219
         }
220 220
 
221 221
         // Sorry, you're not allowed here.
222
-        if( false === $this->user_can_edit_entry( true ) ) {
222
+        if ( false === $this->user_can_edit_entry( true ) ) {
223 223
             return;
224 224
         }
225 225
 
@@ -239,9 +239,9 @@  discard block
 block discarded – undo
239 239
     function print_scripts() {
240 240
         $gravityview_view = GravityView_View::getInstance();
241 241
 
242
-        wp_register_script( 'gform_gravityforms', GFCommon::get_base_url().'/js/gravityforms.js', array( 'jquery', 'gform_json', 'gform_placeholder', 'sack', 'plupload-all', 'gravityview-fe-view' ) );
242
+        wp_register_script( 'gform_gravityforms', GFCommon::get_base_url() . '/js/gravityforms.js', array( 'jquery', 'gform_json', 'gform_placeholder', 'sack', 'plupload-all', 'gravityview-fe-view' ) );
243 243
 
244
-        GFFormDisplay::enqueue_form_scripts($gravityview_view->getForm(), false);
244
+        GFFormDisplay::enqueue_form_scripts( $gravityview_view->getForm(), false );
245 245
 
246 246
         // Sack is required for images
247 247
         wp_print_scripts( array( 'sack', 'gform_gravityforms' ) );
@@ -253,32 +253,32 @@  discard block
 block discarded – undo
253 253
      */
254 254
     function process_save() {
255 255
 
256
-        if( empty( $_POST ) ) {
256
+        if ( empty( $_POST ) ) {
257 257
             return;
258 258
         }
259 259
 
260 260
         // Make sure the entry, view, and form IDs are all correct
261 261
         $valid = $this->verify_nonce();
262 262
 
263
-        if( !$valid ) {
264
-            do_action('gravityview_log_error', __METHOD__ . ' Nonce validation failed.' );
263
+        if ( ! $valid ) {
264
+            do_action( 'gravityview_log_error', __METHOD__ . ' Nonce validation failed.' );
265 265
             return;
266 266
         }
267 267
 
268
-        if( $this->entry['id'] !== $_POST['lid'] ) {
269
-            do_action('gravityview_log_error', __METHOD__ . ' Entry ID did not match posted entry ID.' );
268
+        if ( $this->entry[ 'id' ] !== $_POST[ 'lid' ] ) {
269
+            do_action( 'gravityview_log_error', __METHOD__ . ' Entry ID did not match posted entry ID.' );
270 270
             return;
271 271
         }
272 272
 
273
-        do_action('gravityview_log_debug', 'GravityView_Edit_Entry[process_save] $_POSTed data (sanitized): ', esc_html( print_r( $_POST, true ) ) );
273
+        do_action( 'gravityview_log_debug', 'GravityView_Edit_Entry[process_save] $_POSTed data (sanitized): ', esc_html( print_r( $_POST, true ) ) );
274 274
 
275 275
         $this->process_save_process_files( $this->form_id );
276 276
 
277 277
         $this->validate();
278 278
 
279
-        if( $this->is_valid ) {
279
+        if ( $this->is_valid ) {
280 280
 
281
-            do_action('gravityview_log_debug', 'GravityView_Edit_Entry[process_save] Submission is valid.' );
281
+            do_action( 'gravityview_log_debug', 'GravityView_Edit_Entry[process_save] Submission is valid.' );
282 282
 
283 283
             /**
284 284
              * @hack This step is needed to unset the adminOnly from form fields
@@ -288,12 +288,12 @@  discard block
 block discarded – undo
288 288
             /**
289 289
              * @hack to avoid the capability validation of the method save_lead for GF 1.9+
290 290
              */
291
-            unset( $_GET['page'] );
291
+            unset( $_GET[ 'page' ] );
292 292
 
293 293
             GFFormsModel::save_lead( $form, $this->entry );
294 294
 
295 295
             // If there's a post associated with the entry, process post fields
296
-            if( !empty( $this->entry['post_id'] ) ) {
296
+            if ( ! empty( $this->entry[ 'post_id' ] ) ) {
297 297
                 $this->maybe_update_post_fields( $form );
298 298
             }
299 299
 
@@ -305,7 +305,7 @@  discard block
 block discarded – undo
305 305
              * @param array $form Gravity Forms form array
306 306
              * @param string $entry_id Numeric ID of the entry that was updated
307 307
              */
308
-            do_action( 'gravityview/edit_entry/after_update', $this->form, $this->entry['id'] );
308
+            do_action( 'gravityview/edit_entry/after_update', $this->form, $this->entry[ 'id' ] );
309 309
         }
310 310
 
311 311
     } // process_save
@@ -339,11 +339,11 @@  discard block
 block discarded – undo
339 339
      * @return mixed
340 340
      */
341 341
     public function modify_fileupload_settings( $plupload_init, $form_id, $instance ) {
342
-        if( ! $this->is_edit_entry() ) {
342
+        if ( ! $this->is_edit_entry() ) {
343 343
             return $plupload_init;
344 344
         }
345 345
 
346
-        $plupload_init['gf_vars']['max_files'] = 0;
346
+        $plupload_init[ 'gf_vars' ][ 'max_files' ] = 0;
347 347
 
348 348
         return $plupload_init;
349 349
     }
@@ -356,13 +356,13 @@  discard block
 block discarded – undo
356 356
     private function form_prepare_for_save() {
357 357
         $form = $this->original_form;
358 358
 
359
-        foreach( $form['fields'] as &$field ) {
359
+        foreach ( $form[ 'fields' ] as &$field ) {
360 360
 
361 361
             $field->adminOnly = false;
362 362
 
363
-            if( isset( $field->inputs ) && is_array( $field->inputs ) ) {
364
-                foreach( $field->inputs as $key => $input ) {
365
-                    $field->inputs[ $key ][ 'id' ] = (string)$input['id'];
363
+            if ( isset( $field->inputs ) && is_array( $field->inputs ) ) {
364
+                foreach ( $field->inputs as $key => $input ) {
365
+                    $field->inputs[ $key ][ 'id' ] = (string)$input[ 'id' ];
366 366
                 }
367 367
             }
368 368
         }
@@ -380,11 +380,11 @@  discard block
 block discarded – undo
380 380
      */
381 381
     function maybe_update_post_fields( $form ) {
382 382
 
383
-        $post_id = $this->entry['post_id'];
383
+        $post_id = $this->entry[ 'post_id' ];
384 384
 
385 385
         // Security check
386
-        if( false === GVCommon::has_cap( 'edit_post', $post_id ) ) {
387
-            do_action( 'gravityview_log_error', 'The current user does not have the ability to edit Post #'.$post_id );
386
+        if ( false === GVCommon::has_cap( 'edit_post', $post_id ) ) {
387
+            do_action( 'gravityview_log_error', 'The current user does not have the ability to edit Post #' . $post_id );
388 388
             return;
389 389
         }
390 390
 
@@ -398,16 +398,16 @@  discard block
 block discarded – undo
398 398
 
399 399
             $field = RGFormsModel::get_field( $form, $field_id );
400 400
 
401
-            if( class_exists('GF_Fields') ) {
401
+            if ( class_exists( 'GF_Fields' ) ) {
402 402
                 $field = GF_Fields::create( $field );
403 403
             }
404 404
 
405
-            if( GFCommon::is_post_field( $field ) ) {
405
+            if ( GFCommon::is_post_field( $field ) ) {
406 406
 
407 407
                 // Get the value of the field, including $_POSTed value
408 408
                 $value = RGFormsModel::get_field_value( $field );
409 409
 
410
-                switch( $field->type ) {
410
+                switch ( $field->type ) {
411 411
 
412 412
                     case 'post_title':
413 413
                     case 'post_content':
@@ -425,14 +425,14 @@  discard block
 block discarded – undo
425 425
                         wp_set_post_categories( $post_id, $categories, false );
426 426
 
427 427
                         // if post_category is type checkbox, then value is an array of inputs
428
-                        if( isset( $value[ strval( $field_id ) ] ) ) {
429
-                            foreach( $value as $input_id => $val ) {
428
+                        if ( isset( $value[ strval( $field_id ) ] ) ) {
429
+                            foreach ( $value as $input_id => $val ) {
430 430
                                 $input_name = 'input_' . str_replace( '.', '_', $input_id );
431
-                                $this->entry[ strval( $input_id ) ] = RGFormsModel::prepare_value( $form, $field, $val, $input_name, $this->entry['id'] );
431
+                                $this->entry[ strval( $input_id ) ] = RGFormsModel::prepare_value( $form, $field, $val, $input_name, $this->entry[ 'id' ] );
432 432
                             }
433 433
                         } else {
434 434
                             $input_name = 'input_' . str_replace( '.', '_', $field_id );
435
-                            $this->entry[ strval( $field_id ) ] = RGFormsModel::prepare_value( $form, $field, $value, $input_name, $this->entry['id'] );
435
+                            $this->entry[ strval( $field_id ) ] = RGFormsModel::prepare_value( $form, $field, $value, $input_name, $this->entry[ 'id' ] );
436 436
                         }
437 437
 
438 438
                         break;
@@ -442,12 +442,12 @@  discard block
 block discarded – undo
442 442
                         $custom_field_name = $field->postCustomFieldName;
443 443
 
444 444
                         // Only certain custom field types are supported
445
-                        switch( $input_type ) {
445
+                        switch ( $input_type ) {
446 446
                             case 'fileupload':
447 447
                             /** @noinspection PhpMissingBreakStatementInspection */
448 448
                             case 'list':
449
-                                if( ! is_string( $value ) ) {
450
-                                    $value = function_exists('wp_json_encode') ? wp_json_encode( $value ) : json_encode( $value );
449
+                                if ( ! is_string( $value ) ) {
450
+                                    $value = function_exists( 'wp_json_encode' ) ? wp_json_encode( $value ) : json_encode( $value );
451 451
                                 }
452 452
                             // break; left intentionally out
453 453
                             default:
@@ -460,11 +460,11 @@  discard block
 block discarded – undo
460 460
 
461 461
                         $input_name = 'input_' . $field_id;
462 462
 
463
-                        if ( !empty( $_FILES[ $input_name ]['name'] ) ) {
463
+                        if ( ! empty( $_FILES[ $input_name ][ 'name' ] ) ) {
464 464
 
465 465
                             // We have a new image
466 466
 
467
-                            $value = RGFormsModel::prepare_value( $form, $field, $value, $input_name, $this->entry['id'] );
467
+                            $value = RGFormsModel::prepare_value( $form, $field, $value, $input_name, $this->entry[ 'id' ] );
468 468
 
469 469
                             // is this field set as featured image, if not, leave
470 470
                             if ( ! $field->postFeaturedImage ) {
@@ -474,9 +474,9 @@  discard block
 block discarded – undo
474 474
                             $ary = ! empty( $value ) ? explode( '|:|', $value ) : array();
475 475
                             $img_url = rgar( $ary, 0 );
476 476
 
477
-                            $img_title       = count( $ary ) > 1 ? $ary[1] : '';
478
-                            $img_caption     = count( $ary ) > 2 ? $ary[2] : '';
479
-                            $img_description = count( $ary ) > 3 ? $ary[3] : '';
477
+                            $img_title       = count( $ary ) > 1 ? $ary[ 1 ] : '';
478
+                            $img_caption     = count( $ary ) > 2 ? $ary[ 2 ] : '';
479
+                            $img_description = count( $ary ) > 3 ? $ary[ 3 ] : '';
480 480
 
481 481
                             $image_meta = array(
482 482
                                 'post_excerpt' => $img_caption,
@@ -485,7 +485,7 @@  discard block
 block discarded – undo
485 485
 
486 486
                             //adding title only if it is not empty. It will default to the file name if it is not in the array
487 487
                             if ( ! empty( $img_title ) ) {
488
-                                $image_meta['post_title'] = $img_title;
488
+                                $image_meta[ 'post_title' ] = $img_title;
489 489
                             }
490 490
 
491 491
                             //todo: As soon as \GFFormsModel::media_handle_upload becomes a public method, move this call to \GFFormsModel::media_handle_upload and remove the hack from this class.
@@ -498,7 +498,7 @@  discard block
 block discarded – undo
498 498
 
499 499
                             break;
500 500
 
501
-                        } elseif ( !empty( $_POST[ $input_name ] ) && is_array( $value ) ) {
501
+                        } elseif ( ! empty( $_POST[ $input_name ] ) && is_array( $value ) ) {
502 502
 
503 503
                             // Same image although the image title, caption or description might have changed
504 504
 
@@ -506,11 +506,11 @@  discard block
 block discarded – undo
506 506
                             $img_url = rgar( $ary, 0 );
507 507
 
508 508
                             // is this really the same image or something went wrong ?
509
-                            if( $img_url === $_POST[ $input_name ] ) {
509
+                            if ( $img_url === $_POST[ $input_name ] ) {
510 510
 
511
-                                $img_title       = isset( $value[ $field_id .'.1' ] ) ? $value[ $field_id .'.1' ] : '';
512
-                                $img_caption     = isset( $value[ $field_id .'.4' ] ) ? $value[ $field_id .'.4' ] : '';
513
-                                $img_description = isset( $value[ $field_id .'.7' ] ) ? $value[ $field_id .'.7' ] : '';
511
+                                $img_title       = isset( $value[ $field_id . '.1' ] ) ? $value[ $field_id . '.1' ] : '';
512
+                                $img_caption     = isset( $value[ $field_id . '.4' ] ) ? $value[ $field_id . '.4' ] : '';
513
+                                $img_description = isset( $value[ $field_id . '.7' ] ) ? $value[ $field_id . '.7' ] : '';
514 514
 
515 515
                                 $value = ! empty( $img_url ) ? $img_url . "|:|" . $img_title . "|:|" . $img_caption . "|:|" . $img_description : '';
516 516
 
@@ -544,12 +544,12 @@  discard block
 block discarded – undo
544 544
                 }
545 545
 
546 546
                 //ignore fields that have not changed
547
-                if ( $value === rgget( (string) $field_id, $this->entry ) ) {
547
+                if ( $value === rgget( (string)$field_id, $this->entry ) ) {
548 548
                     continue;
549 549
                 }
550 550
 
551 551
                 // update entry
552
-                if( 'post_category' !== $field->type ) {
552
+                if ( 'post_category' !== $field->type ) {
553 553
                     $this->entry[ strval( $field_id ) ] = $value;
554 554
                 }
555 555
 
@@ -559,25 +559,25 @@  discard block
 block discarded – undo
559 559
 
560 560
         }
561 561
 
562
-        if( $update_entry ) {
562
+        if ( $update_entry ) {
563 563
 
564 564
             $return_entry = GFAPI::update_entry( $this->entry );
565 565
 
566
-            if( is_wp_error( $return_entry ) ) {
566
+            if ( is_wp_error( $return_entry ) ) {
567 567
                 do_action( 'gravityview_log_error', 'Updating the entry post fields failed', $return_entry );
568 568
             } else {
569
-                do_action( 'gravityview_log_debug', 'Updating the entry post fields for post #'.$post_id.' succeeded' );
569
+                do_action( 'gravityview_log_debug', 'Updating the entry post fields for post #' . $post_id . ' succeeded' );
570 570
             }
571 571
 
572 572
         }
573 573
 
574 574
         $return_post = wp_update_post( $updated_post, true );
575 575
 
576
-        if( is_wp_error( $return_post ) ) {
576
+        if ( is_wp_error( $return_post ) ) {
577 577
             $return_post->add_data( $updated_post, '$updated_post' );
578 578
             do_action( 'gravityview_log_error', 'Updating the post content failed', $return_post );
579 579
         } else {
580
-            do_action( 'gravityview_log_debug', 'Updating the post content for post #'.$post_id.' succeeded', $updated_post );
580
+            do_action( 'gravityview_log_debug', 'Updating the post content for post #' . $post_id . ' succeeded', $updated_post );
581 581
         }
582 582
 
583 583
     }
@@ -594,18 +594,18 @@  discard block
 block discarded – undo
594 594
      */
595 595
     function after_update() {
596 596
 
597
-        do_action( 'gform_after_update_entry', $this->form, $this->entry['id'] );
598
-        do_action( "gform_after_update_entry_{$this->form['id']}", $this->form, $this->entry['id'] );
597
+        do_action( 'gform_after_update_entry', $this->form, $this->entry[ 'id' ] );
598
+        do_action( "gform_after_update_entry_{$this->form[ 'id' ]}", $this->form, $this->entry[ 'id' ] );
599 599
 
600 600
         // Re-define the entry now that we've updated it.
601
-        $entry = RGFormsModel::get_lead( $this->entry['id'] );
601
+        $entry = RGFormsModel::get_lead( $this->entry[ 'id' ] );
602 602
 
603 603
         $entry = GFFormsModel::set_entry_meta( $entry, $this->form );
604 604
 
605 605
         // We need to clear the cache because Gravity Forms caches the field values, which
606 606
         // we have just updated.
607
-        foreach ($this->form['fields'] as $key => $field) {
608
-            GFFormsModel::refresh_lead_field_value( $entry['id'], $field->id );
607
+        foreach ( $this->form[ 'fields' ] as $key => $field ) {
608
+            GFFormsModel::refresh_lead_field_value( $entry[ 'id' ], $field->id );
609 609
         }
610 610
 
611 611
         $this->entry = $entry;
@@ -623,7 +623,7 @@  discard block
 block discarded – undo
623 623
 
624 624
         <div class="gv-edit-entry-wrapper"><?php
625 625
 
626
-            $javascript = gravityview_ob_include( GravityView_Edit_Entry::$file .'/partials/inline-javascript.php', $this );
626
+            $javascript = gravityview_ob_include( GravityView_Edit_Entry::$file . '/partials/inline-javascript.php', $this );
627 627
 
628 628
             /**
629 629
              * Fixes weird wpautop() issue
@@ -639,7 +639,7 @@  discard block
 block discarded – undo
639 639
                      * @param string $edit_entry_title Modify the "Edit Entry" title
640 640
                      * @param GravityView_Edit_Entry_Render $this This object
641 641
                      */
642
-                    $edit_entry_title = apply_filters('gravityview_edit_entry_title', __('Edit Entry', 'gravityview'), $this );
642
+                    $edit_entry_title = apply_filters( 'gravityview_edit_entry_title', __( 'Edit Entry', 'gravityview' ), $this );
643 643
 
644 644
                     echo esc_attr( $edit_entry_title );
645 645
             ?></span>
@@ -679,20 +679,20 @@  discard block
 block discarded – undo
679 679
      */
680 680
     private function maybe_print_message() {
681 681
 
682
-        if( rgpost('action') === 'update' ) {
682
+        if ( rgpost( 'action' ) === 'update' ) {
683 683
 
684 684
             $back_link = esc_url( remove_query_arg( array( 'page', 'view', 'edit' ) ) );
685 685
 
686
-            if( ! $this->is_valid ){
686
+            if ( ! $this->is_valid ) {
687 687
 
688 688
                 // Keeping this compatible with Gravity Forms.
689
-                $validation_message = "<div class='validation_error'>" . __('There was a problem with your submission.', 'gravityview') . " " . __('Errors have been highlighted below.', 'gravityview') . "</div>";
690
-                $message = apply_filters("gform_validation_message_{$this->form['id']}", apply_filters("gform_validation_message", $validation_message, $this->form), $this->form);
689
+                $validation_message = "<div class='validation_error'>" . __( 'There was a problem with your submission.', 'gravityview' ) . " " . __( 'Errors have been highlighted below.', 'gravityview' ) . "</div>";
690
+                $message = apply_filters( "gform_validation_message_{$this->form[ 'id' ]}", apply_filters( "gform_validation_message", $validation_message, $this->form ), $this->form );
691 691
 
692
-                echo GVCommon::generate_notice( $message , 'gv-error' );
692
+                echo GVCommon::generate_notice( $message, 'gv-error' );
693 693
 
694 694
             } else {
695
-                $entry_updated_message = sprintf( esc_attr__('Entry Updated. %sReturn to Entry%s', 'gravityview'), '<a href="'. $back_link .'">', '</a>' );
695
+                $entry_updated_message = sprintf( esc_attr__( 'Entry Updated. %sReturn to Entry%s', 'gravityview' ), '<a href="' . $back_link . '">', '</a>' );
696 696
 
697 697
                 /**
698 698
                  * @filter `gravityview/edit_entry/success` Modify the edit entry success message (including the anchor link)
@@ -702,7 +702,7 @@  discard block
 block discarded – undo
702 702
                  * @param array $entry Gravity Forms entry array
703 703
                  * @param string $back_link URL to return to the original entry. @since 1.6
704 704
                  */
705
-                $message = apply_filters( 'gravityview/edit_entry/success', $entry_updated_message , $this->view_id, $this->entry, $back_link );
705
+                $message = apply_filters( 'gravityview/edit_entry/success', $entry_updated_message, $this->view_id, $this->entry, $back_link );
706 706
 
707 707
                 echo GVCommon::generate_notice( $message );
708 708
             }
@@ -723,15 +723,15 @@  discard block
 block discarded – undo
723 723
      */
724 724
     private function render_edit_form() {
725 725
 
726
-        add_filter( 'gform_pre_render', array( $this, 'filter_modify_form_fields'), 5000, 3 );
727
-        add_filter( 'gform_submit_button', array( $this, 'render_form_buttons') );
726
+        add_filter( 'gform_pre_render', array( $this, 'filter_modify_form_fields' ), 5000, 3 );
727
+        add_filter( 'gform_submit_button', array( $this, 'render_form_buttons' ) );
728 728
         add_filter( 'gform_disable_view_counter', '__return_true' );
729 729
 
730 730
         add_filter( 'gform_field_input', array( $this, 'verify_user_can_edit_post' ), 5, 5 );
731 731
         add_filter( 'gform_field_input', array( $this, 'modify_edit_field_input' ), 10, 5 );
732 732
 
733 733
         // We need to remove the fake $_GET['page'] arg to avoid rendering form as if in admin.
734
-        unset( $_GET['page'] );
734
+        unset( $_GET[ 'page' ] );
735 735
 
736 736
         // TODO: Make sure validation isn't handled by GF
737 737
         // TODO: Include CSS for file upload fields
@@ -739,7 +739,7 @@  discard block
 block discarded – undo
739 739
         // TODO: Product fields are not editable
740 740
         // TODO: Check Updated and Error messages
741 741
 
742
-        $html = GFFormDisplay::get_form( $this->form['id'], false, false, true, $this->entry );
742
+        $html = GFFormDisplay::get_form( $this->form[ 'id' ], false, false, true, $this->entry );
743 743
 
744 744
 	    remove_filter( 'gform_pre_render', array( $this, 'filter_modify_form_fields' ), 5000 );
745 745
         remove_filter( 'gform_submit_button', array( $this, 'render_form_buttons' ) );
@@ -756,7 +756,7 @@  discard block
 block discarded – undo
756 756
      * @return string
757 757
      */
758 758
     public function render_form_buttons() {
759
-        return gravityview_ob_include( GravityView_Edit_Entry::$file .'/partials/form-buttons.php', $this );
759
+        return gravityview_ob_include( GravityView_Edit_Entry::$file . '/partials/form-buttons.php', $this );
760 760
     }
761 761
 
762 762
 
@@ -776,17 +776,17 @@  discard block
 block discarded – undo
776 776
     public function filter_modify_form_fields( $form, $ajax = false, $field_values = '' ) {
777 777
 
778 778
         // In case we have validated the form, use it to inject the validation results into the form render
779
-        if( isset( $this->form_after_validation ) ) {
779
+        if ( isset( $this->form_after_validation ) ) {
780 780
             $form = $this->form_after_validation;
781 781
         } else {
782
-            $form['fields'] = $this->get_configured_edit_fields( $form, $this->view_id );
782
+            $form[ 'fields' ] = $this->get_configured_edit_fields( $form, $this->view_id );
783 783
         }
784 784
 
785 785
         $form = $this->filter_conditional_logic( $form );
786 786
 
787 787
         // for now we don't support Save and Continue feature.
788
-        if( ! self::$supports_save_and_continue ) {
789
-	        unset( $form['save'] );
788
+        if ( ! self::$supports_save_and_continue ) {
789
+	        unset( $form[ 'save' ] );
790 790
         }
791 791
 
792 792
         return $form;
@@ -807,29 +807,29 @@  discard block
 block discarded – undo
807 807
      */
808 808
     function verify_user_can_edit_post( $field_content = '', $field, $value, $lead_id = 0, $form_id ) {
809 809
 
810
-        if( GFCommon::is_post_field( $field ) ) {
810
+        if ( GFCommon::is_post_field( $field ) ) {
811 811
 
812 812
             $message = null;
813 813
 
814 814
             // First, make sure they have the capability to edit the post.
815
-            if( false === current_user_can( 'edit_post', $this->entry['post_id'] ) ) {
815
+            if ( false === current_user_can( 'edit_post', $this->entry[ 'post_id' ] ) ) {
816 816
 
817 817
                 /**
818 818
                  * @filter `gravityview/edit_entry/unsupported_post_field_text` Modify the message when someone isn't able to edit a post
819 819
                  * @param string $message The existing "You don't have permission..." text
820 820
                  */
821
-                $message = apply_filters('gravityview/edit_entry/unsupported_post_field_text', __('You don&rsquo;t have permission to edit this post.', 'gravityview') );
821
+                $message = apply_filters( 'gravityview/edit_entry/unsupported_post_field_text', __( 'You don&rsquo;t have permission to edit this post.', 'gravityview' ) );
822 822
 
823
-            } elseif( null === get_post( $this->entry['post_id'] ) ) {
823
+            } elseif ( null === get_post( $this->entry[ 'post_id' ] ) ) {
824 824
                 /**
825 825
                  * @filter `gravityview/edit_entry/no_post_text` Modify the message when someone is editing an entry attached to a post that no longer exists
826 826
                  * @param string $message The existing "This field is not editable; the post no longer exists." text
827 827
                  */
828
-                $message = apply_filters('gravityview/edit_entry/no_post_text', __('This field is not editable; the post no longer exists.', 'gravityview' ) );
828
+                $message = apply_filters( 'gravityview/edit_entry/no_post_text', __( 'This field is not editable; the post no longer exists.', 'gravityview' ) );
829 829
             }
830 830
 
831
-            if( $message ) {
832
-                $field_content = sprintf('<div class="ginput_container ginput_container_' . $field->type . '">%s</div>', wpautop( $message ) );
831
+            if ( $message ) {
832
+                $field_content = sprintf( '<div class="ginput_container ginput_container_' . $field->type . '">%s</div>', wpautop( $message ) );
833 833
             }
834 834
         }
835 835
 
@@ -854,8 +854,8 @@  discard block
 block discarded – undo
854 854
 
855 855
         // If the form has been submitted, then we don't need to pre-fill the values,
856 856
         // Except for fileupload type and when a field input is overridden- run always!!
857
-        if(
858
-            ( $this->is_edit_entry_submission() && !in_array( $field->type, array( 'fileupload', 'post_image' ) ) )
857
+        if (
858
+            ( $this->is_edit_entry_submission() && ! in_array( $field->type, array( 'fileupload', 'post_image' ) ) )
859 859
             && false === ( $gv_field && is_callable( array( $gv_field, 'get_field_input' ) ) )
860 860
             || ! empty( $field_content )
861 861
             || GFCommon::is_product_field( $field->type ) // Prevent product fields from appearing editable
@@ -864,8 +864,8 @@  discard block
 block discarded – undo
864 864
         }
865 865
 
866 866
         // Turn on Admin-style display for file upload fields only
867
-        if( 'fileupload' === $field->type ) {
868
-            $_GET['page'] = 'gf_entries';
867
+        if ( 'fileupload' === $field->type ) {
868
+            $_GET[ 'page' ] = 'gf_entries';
869 869
         }
870 870
 
871 871
         // SET SOME FIELD DEFAULTS TO PREVENT ISSUES
@@ -889,7 +889,7 @@  discard block
 block discarded – undo
889 889
 	    // Prevent any PHP warnings, like undefined index
890 890
 	    ob_start();
891 891
 
892
-        if( $gv_field && is_callable( array( $gv_field, 'get_field_input' ) ) ) {
892
+        if ( $gv_field && is_callable( array( $gv_field, 'get_field_input' ) ) ) {
893 893
             $return = $gv_field->get_field_input( $this->form, $field_value, $this->entry, $field );
894 894
         } else {
895 895
 	        $return = $field->get_field_input( $this->form, $field_value, $this->entry );
@@ -899,7 +899,7 @@  discard block
 block discarded – undo
899 899
 	    // If there was output, it's an error
900 900
 	    $warnings = ob_get_clean();
901 901
 
902
-	    if( !empty( $warnings ) ) {
902
+	    if ( ! empty( $warnings ) ) {
903 903
 		    do_action( 'gravityview_log_error', __METHOD__ . $warnings, $field_value );
904 904
 	    }
905 905
 
@@ -908,7 +908,7 @@  discard block
 block discarded – undo
908 908
          * We need the fileupload html field to render with the proper id
909 909
          *  ( <li id="field_80_16" ... > )
910 910
          */
911
-        unset( $_GET['page'] );
911
+        unset( $_GET[ 'page' ] );
912 912
 
913 913
         return $return;
914 914
     }
@@ -931,7 +931,7 @@  discard block
 block discarded – undo
931 931
         $override_saved_value = apply_filters( 'gravityview/edit_entry/pre_populate/override', false, $field );
932 932
 
933 933
         // We're dealing with multiple inputs (e.g. checkbox) but not time or date (as it doesn't store data in input IDs)
934
-        if( isset( $field->inputs ) && is_array( $field->inputs ) && !in_array( $field->type, array( 'time', 'date' ) ) ) {
934
+        if ( isset( $field->inputs ) && is_array( $field->inputs ) && ! in_array( $field->type, array( 'time', 'date' ) ) ) {
935 935
 
936 936
             $field_value = array();
937 937
 
@@ -940,10 +940,10 @@  discard block
 block discarded – undo
940 940
 
941 941
             foreach ( (array)$field->inputs as $input ) {
942 942
 
943
-                $input_id = strval( $input['id'] );
943
+                $input_id = strval( $input[ 'id' ] );
944 944
                 
945 945
                 if ( isset( $this->entry[ $input_id ] ) && ! gv_empty( $this->entry[ $input_id ], false, false ) ) {
946
-                    $field_value[ $input_id ] =  'post_category' === $field->type ? GFCommon::format_post_category( $this->entry[ $input_id ], true ) : $this->entry[ $input_id ];
946
+                    $field_value[ $input_id ] = 'post_category' === $field->type ? GFCommon::format_post_category( $this->entry[ $input_id ], true ) : $this->entry[ $input_id ];
947 947
                     $allow_pre_populated = false;
948 948
                 }
949 949
 
@@ -951,7 +951,7 @@  discard block
 block discarded – undo
951 951
 
952 952
             $pre_value = $field->get_value_submission( array(), false );
953 953
 
954
-            $field_value = ! $allow_pre_populated && ! ( $override_saved_value && !gv_empty( $pre_value, false, false ) ) ? $field_value : $pre_value;
954
+            $field_value = ! $allow_pre_populated && ! ( $override_saved_value && ! gv_empty( $pre_value, false, false ) ) ? $field_value : $pre_value;
955 955
 
956 956
         } else {
957 957
 
@@ -962,13 +962,13 @@  discard block
 block discarded – undo
962 962
 
963 963
             // saved field entry value (if empty, fallback to the pre-populated value, if exists)
964 964
             // or pre-populated value if not empty and set to override saved value
965
-            $field_value = !gv_empty( $this->entry[ $id ], false, false ) && ! ( $override_saved_value && !gv_empty( $pre_value, false, false ) ) ? $this->entry[ $id ] : $pre_value;
965
+            $field_value = ! gv_empty( $this->entry[ $id ], false, false ) && ! ( $override_saved_value && ! gv_empty( $pre_value, false, false ) ) ? $this->entry[ $id ] : $pre_value;
966 966
 
967 967
             // in case field is post_category but inputType is select, multi-select or radio, convert value into array of category IDs.
968
-            if ( 'post_category' === $field->type && !gv_empty( $field_value, false, false ) ) {
968
+            if ( 'post_category' === $field->type && ! gv_empty( $field_value, false, false ) ) {
969 969
                 $categories = array();
970 970
                 foreach ( explode( ',', $field_value ) as $cat_string ) {
971
-                    $categories[] = GFCommon::format_post_category( $cat_string, true );
971
+                    $categories[ ] = GFCommon::format_post_category( $cat_string, true );
972 972
                 }
973 973
                 $field_value = 'multiselect' === $field->get_input_type() ? $categories : implode( '', $categories );
974 974
             }
@@ -993,12 +993,12 @@  discard block
 block discarded – undo
993 993
      */
994 994
     function gform_pre_validation( $form ) {
995 995
 
996
-        if( ! $this->verify_nonce() ) {
996
+        if ( ! $this->verify_nonce() ) {
997 997
             return $form;
998 998
         }
999 999
 
1000 1000
         // Fix PHP warning regarding undefined index.
1001
-        foreach ( $form['fields'] as &$field) {
1001
+        foreach ( $form[ 'fields' ] as &$field ) {
1002 1002
 
1003 1003
             // This is because we're doing admin form pretending to be front-end, so Gravity Forms
1004 1004
             // expects certain field array items to be set.
@@ -1011,7 +1011,7 @@  discard block
 block discarded – undo
1011 1011
                 $field['emailConfirmEnabled'] = '';
1012 1012
             }*/
1013 1013
 
1014
-            switch( RGFormsModel::get_input_type( $field ) ) {
1014
+            switch ( RGFormsModel::get_input_type( $field ) ) {
1015 1015
 
1016 1016
                 /**
1017 1017
                  * 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.
@@ -1025,37 +1025,37 @@  discard block
 block discarded – undo
1025 1025
                     // Set the previous value
1026 1026
                     $entry = $this->get_entry();
1027 1027
 
1028
-                    $input_name = 'input_'.$field->id;
1029
-                    $form_id = $form['id'];
1028
+                    $input_name = 'input_' . $field->id;
1029
+                    $form_id = $form[ 'id' ];
1030 1030
 
1031 1031
                     $value = NULL;
1032 1032
 
1033 1033
                     // Use the previous entry value as the default.
1034
-                    if( isset( $entry[ $field->id ] ) ) {
1034
+                    if ( isset( $entry[ $field->id ] ) ) {
1035 1035
                         $value = $entry[ $field->id ];
1036 1036
                     }
1037 1037
 
1038 1038
                     // If this is a single upload file
1039
-                    if( !empty( $_FILES[ $input_name ] ) && !empty( $_FILES[ $input_name ]['name'] ) ) {
1040
-                        $file_path = GFFormsModel::get_file_upload_path( $form['id'], $_FILES[ $input_name ]['name'] );
1041
-                        $value = $file_path['url'];
1039
+                    if ( ! empty( $_FILES[ $input_name ] ) && ! empty( $_FILES[ $input_name ][ 'name' ] ) ) {
1040
+                        $file_path = GFFormsModel::get_file_upload_path( $form[ 'id' ], $_FILES[ $input_name ][ 'name' ] );
1041
+                        $value = $file_path[ 'url' ];
1042 1042
 
1043 1043
                     } else {
1044 1044
 
1045 1045
                         // Fix PHP warning on line 1498 of form_display.php for post_image fields
1046 1046
                         // Fix PHP Notice:  Undefined index:  size in form_display.php on line 1511
1047
-                        $_FILES[ $input_name ] = array('name' => '', 'size' => '' );
1047
+                        $_FILES[ $input_name ] = array( 'name' => '', 'size' => '' );
1048 1048
 
1049 1049
                     }
1050 1050
 
1051
-                    if( rgar($field, "multipleFiles") ) {
1051
+                    if ( rgar( $field, "multipleFiles" ) ) {
1052 1052
 
1053 1053
                         // If there are fresh uploads, process and merge them.
1054 1054
                         // Otherwise, use the passed values, which should be json-encoded array of URLs
1055
-                        if( isset( GFFormsModel::$uploaded_files[$form_id][$input_name] ) ) {
1055
+                        if ( isset( GFFormsModel::$uploaded_files[ $form_id ][ $input_name ] ) ) {
1056 1056
                             $value = empty( $value ) ? '[]' : $value;
1057 1057
                             $value = stripslashes_deep( $value );
1058
-                            $value = GFFormsModel::prepare_value( $form, $field, $value, $input_name, $entry['id'], array());
1058
+                            $value = GFFormsModel::prepare_value( $form, $field, $value, $input_name, $entry[ 'id' ], array() );
1059 1059
                         }
1060 1060
 
1061 1061
                     } else {
@@ -1073,14 +1073,14 @@  discard block
 block discarded – undo
1073 1073
 
1074 1074
                 case 'number':
1075 1075
                     // Fix "undefined index" issue at line 1286 in form_display.php
1076
-                    if( !isset( $_POST['input_'.$field->id ] ) ) {
1077
-                        $_POST['input_'.$field->id ] = NULL;
1076
+                    if ( ! isset( $_POST[ 'input_' . $field->id ] ) ) {
1077
+                        $_POST[ 'input_' . $field->id ] = NULL;
1078 1078
                     }
1079 1079
                     break;
1080 1080
                 case 'captcha':
1081 1081
                     // Fix issue with recaptcha_check_answer() on line 1458 in form_display.php
1082
-                    $_POST['recaptcha_challenge_field'] = NULL;
1083
-                    $_POST['recaptcha_response_field'] = NULL;
1082
+                    $_POST[ 'recaptcha_challenge_field' ] = NULL;
1083
+                    $_POST[ 'recaptcha_response_field' ] = NULL;
1084 1084
                     break;
1085 1085
             }
1086 1086
 
@@ -1116,7 +1116,7 @@  discard block
 block discarded – undo
1116 1116
          * You can enter whatever you want!
1117 1117
          * We try validating, and customize the results using `self::custom_validation()`
1118 1118
          */
1119
-        add_filter( 'gform_validation_'. $this->form_id, array( $this, 'custom_validation' ), 10, 4);
1119
+        add_filter( 'gform_validation_' . $this->form_id, array( $this, 'custom_validation' ), 10, 4 );
1120 1120
 
1121 1121
         // Needed by the validate funtion
1122 1122
         $failed_validation_page = NULL;
@@ -1124,14 +1124,14 @@  discard block
 block discarded – undo
1124 1124
 
1125 1125
         // Prevent entry limit from running when editing an entry, also
1126 1126
         // prevent form scheduling from preventing editing
1127
-        unset( $this->form['limitEntries'], $this->form['scheduleForm'] );
1127
+        unset( $this->form[ 'limitEntries' ], $this->form[ 'scheduleForm' ] );
1128 1128
 
1129 1129
         // Hide fields depending on Edit Entry settings
1130
-        $this->form['fields'] = $this->get_configured_edit_fields( $this->form, $this->view_id );
1130
+        $this->form[ 'fields' ] = $this->get_configured_edit_fields( $this->form, $this->view_id );
1131 1131
 
1132 1132
         $this->is_valid = GFFormDisplay::validate( $this->form, $field_values, 1, $failed_validation_page );
1133 1133
 
1134
-        remove_filter( 'gform_validation_'. $this->form_id, array( $this, 'custom_validation' ), 10 );
1134
+        remove_filter( 'gform_validation_' . $this->form_id, array( $this, 'custom_validation' ), 10 );
1135 1135
     }
1136 1136
 
1137 1137
 
@@ -1148,13 +1148,13 @@  discard block
 block discarded – undo
1148 1148
      */
1149 1149
     function custom_validation( $validation_results ) {
1150 1150
 
1151
-        do_action('gravityview_log_debug', 'GravityView_Edit_Entry[custom_validation] Validation results: ', $validation_results );
1151
+        do_action( 'gravityview_log_debug', 'GravityView_Edit_Entry[custom_validation] Validation results: ', $validation_results );
1152 1152
 
1153
-        do_action('gravityview_log_debug', 'GravityView_Edit_Entry[custom_validation] $_POSTed data (sanitized): ', esc_html( print_r( $_POST, true ) ) );
1153
+        do_action( 'gravityview_log_debug', 'GravityView_Edit_Entry[custom_validation] $_POSTed data (sanitized): ', esc_html( print_r( $_POST, true ) ) );
1154 1154
 
1155 1155
         $gv_valid = true;
1156 1156
 
1157
-        foreach ( $validation_results['form']['fields'] as $key => &$field ) {
1157
+        foreach ( $validation_results[ 'form' ][ 'fields' ] as $key => &$field ) {
1158 1158
 
1159 1159
             $value = RGFormsModel::get_field_value( $field );
1160 1160
             $field_type = RGFormsModel::get_input_type( $field );
@@ -1167,35 +1167,35 @@  discard block
 block discarded – undo
1167 1167
                 case 'post_image':
1168 1168
 
1169 1169
                     // in case nothing is uploaded but there are already files saved
1170
-                    if( !empty( $field->failed_validation ) && !empty( $field->isRequired ) && !empty( $value ) ) {
1170
+                    if ( ! empty( $field->failed_validation ) && ! empty( $field->isRequired ) && ! empty( $value ) ) {
1171 1171
                         $field->failed_validation = false;
1172 1172
                         unset( $field->validation_message );
1173 1173
                     }
1174 1174
 
1175 1175
                     // validate if multi file upload reached max number of files [maxFiles] => 2
1176
-                    if( rgobj( $field, 'maxFiles') && rgobj( $field, 'multipleFiles') ) {
1176
+                    if ( rgobj( $field, 'maxFiles' ) && rgobj( $field, 'multipleFiles' ) ) {
1177 1177
 
1178 1178
                         $input_name = 'input_' . $field->id;
1179 1179
                         //uploaded
1180
-                        $file_names = isset( GFFormsModel::$uploaded_files[ $validation_results['form']['id'] ][ $input_name ] ) ? GFFormsModel::$uploaded_files[ $validation_results['form']['id'] ][ $input_name ] : array();
1180
+                        $file_names = isset( GFFormsModel::$uploaded_files[ $validation_results[ 'form' ][ 'id' ] ][ $input_name ] ) ? GFFormsModel::$uploaded_files[ $validation_results[ 'form' ][ 'id' ] ][ $input_name ] : array();
1181 1181
 
1182 1182
                         //existent
1183 1183
                         $entry = $this->get_entry();
1184 1184
                         $value = NULL;
1185
-                        if( isset( $entry[ $field->id ] ) ) {
1185
+                        if ( isset( $entry[ $field->id ] ) ) {
1186 1186
                             $value = json_decode( $entry[ $field->id ], true );
1187 1187
                         }
1188 1188
 
1189 1189
                         // count uploaded files and existent entry files
1190 1190
                         $count_files = count( $file_names ) + count( $value );
1191 1191
 
1192
-                        if( $count_files > $field->maxFiles ) {
1192
+                        if ( $count_files > $field->maxFiles ) {
1193 1193
                             $field->validation_message = __( 'Maximum number of files reached', 'gravityview' );
1194 1194
                             $field->failed_validation = 1;
1195 1195
                             $gv_valid = false;
1196 1196
 
1197 1197
                             // in case of error make sure the newest upload files are removed from the upload input
1198
-                            GFFormsModel::$uploaded_files[ $validation_results['form']['id'] ] = null;
1198
+                            GFFormsModel::$uploaded_files[ $validation_results[ 'form' ][ 'id' ] ] = null;
1199 1199
                         }
1200 1200
 
1201 1201
                     }
@@ -1206,7 +1206,7 @@  discard block
 block discarded – undo
1206 1206
             }
1207 1207
 
1208 1208
             // This field has failed validation.
1209
-            if( !empty( $field->failed_validation ) ) {
1209
+            if ( ! empty( $field->failed_validation ) ) {
1210 1210
 
1211 1211
                 do_action( 'gravityview_log_debug', 'GravityView_Edit_Entry[custom_validation] Field is invalid.', array( 'field' => $field, 'value' => $value ) );
1212 1212
 
@@ -1224,32 +1224,32 @@  discard block
 block discarded – undo
1224 1224
                 }
1225 1225
 
1226 1226
                 // You can't continue inside a switch, so we do it after.
1227
-                if( empty( $field->failed_validation ) ) {
1227
+                if ( empty( $field->failed_validation ) ) {
1228 1228
                     continue;
1229 1229
                 }
1230 1230
 
1231 1231
                 // checks if the No Duplicates option is not validating entry against itself, since
1232 1232
                 // we're editing a stored entry, it would also assume it's a duplicate.
1233
-                if( !empty( $field->noDuplicates ) ) {
1233
+                if ( ! empty( $field->noDuplicates ) ) {
1234 1234
 
1235 1235
                     $entry = $this->get_entry();
1236 1236
 
1237 1237
                     // If the value of the entry is the same as the stored value
1238 1238
                     // Then we can assume it's not a duplicate, it's the same.
1239
-                    if( !empty( $entry ) && $value == $entry[ $field->id ] ) {
1239
+                    if ( ! empty( $entry ) && $value == $entry[ $field->id ] ) {
1240 1240
                         //if value submitted was not changed, then don't validate
1241 1241
                         $field->failed_validation = false;
1242 1242
 
1243 1243
                         unset( $field->validation_message );
1244 1244
 
1245
-                        do_action('gravityview_log_debug', 'GravityView_Edit_Entry[custom_validation] Field not a duplicate; it is the same entry.', $entry );
1245
+                        do_action( 'gravityview_log_debug', 'GravityView_Edit_Entry[custom_validation] Field not a duplicate; it is the same entry.', $entry );
1246 1246
 
1247 1247
                         continue;
1248 1248
                     }
1249 1249
                 }
1250 1250
 
1251 1251
                 // if here then probably we are facing the validation 'At least one field must be filled out'
1252
-                if( GFFormDisplay::is_empty( $field, $this->form_id  ) && empty( $field->isRequired ) ) {
1252
+                if ( GFFormDisplay::is_empty( $field, $this->form_id ) && empty( $field->isRequired ) ) {
1253 1253
                     unset( $field->validation_message );
1254 1254
 	                $field->validation_message = false;
1255 1255
                     continue;
@@ -1261,12 +1261,12 @@  discard block
 block discarded – undo
1261 1261
 
1262 1262
         }
1263 1263
 
1264
-        $validation_results['is_valid'] = $gv_valid;
1264
+        $validation_results[ 'is_valid' ] = $gv_valid;
1265 1265
 
1266
-        do_action('gravityview_log_debug', 'GravityView_Edit_Entry[custom_validation] Validation results.', $validation_results );
1266
+        do_action( 'gravityview_log_debug', 'GravityView_Edit_Entry[custom_validation] Validation results.', $validation_results );
1267 1267
 
1268 1268
         // We'll need this result when rendering the form ( on GFFormDisplay::get_form )
1269
-        $this->form_after_validation = $validation_results['form'];
1269
+        $this->form_after_validation = $validation_results[ 'form' ];
1270 1270
 
1271 1271
         return $validation_results;
1272 1272
     }
@@ -1279,7 +1279,7 @@  discard block
 block discarded – undo
1279 1279
      */
1280 1280
     private function get_entry() {
1281 1281
 
1282
-        if( empty( $this->entry ) ) {
1282
+        if ( empty( $this->entry ) ) {
1283 1283
             // Get the database value of the entry that's being edited
1284 1284
             $this->entry = gravityview_get_entry( GravityView_frontend::is_single_entry() );
1285 1285
         }
@@ -1306,13 +1306,13 @@  discard block
 block discarded – undo
1306 1306
         $properties = GravityView_View_Data::getInstance()->get_fields( $view_id );
1307 1307
 
1308 1308
         // If edit tab not yet configured, show all fields
1309
-        $edit_fields = !empty( $properties['edit_edit-fields'] ) ? $properties['edit_edit-fields'] : NULL;
1309
+        $edit_fields = ! empty( $properties[ 'edit_edit-fields' ] ) ? $properties[ 'edit_edit-fields' ] : NULL;
1310 1310
 
1311 1311
 	    // Show hidden fields as text fields
1312 1312
 	    $form = $this->fix_hidden_fields( $form );
1313 1313
 
1314 1314
         // Hide fields depending on admin settings
1315
-        $fields = $this->filter_fields( $form['fields'], $edit_fields );
1315
+        $fields = $this->filter_fields( $form[ 'fields' ], $edit_fields );
1316 1316
 
1317 1317
 	    // If Edit Entry fields are configured, remove adminOnly field settings. Otherwise, don't.
1318 1318
 	    $fields = $this->filter_admin_only_fields( $fields, $edit_fields, $form, $view_id );
@@ -1330,11 +1330,11 @@  discard block
 block discarded – undo
1330 1330
 	private function fix_hidden_fields( $form ) {
1331 1331
 
1332 1332
 		/** @var GF_Field $field */
1333
-		foreach( $form['fields'] as $key => $field ) {
1334
-			if( 'hidden' === $field->type ) {
1333
+		foreach ( $form[ 'fields' ] as $key => $field ) {
1334
+			if ( 'hidden' === $field->type ) {
1335 1335
 				$text_field = new GF_Field_Text( $field );
1336 1336
 				$text_field->type = 'text';
1337
-				$form['fields'][ $key ] = $text_field;
1337
+				$form[ 'fields' ][ $key ] = $text_field;
1338 1338
 			}
1339 1339
 		}
1340 1340
 
@@ -1355,7 +1355,7 @@  discard block
 block discarded – undo
1355 1355
      */
1356 1356
     private function filter_fields( $fields, $configured_fields ) {
1357 1357
 
1358
-        if( empty( $fields ) || !is_array( $fields ) ) {
1358
+        if ( empty( $fields ) || ! is_array( $fields ) ) {
1359 1359
             return $fields;
1360 1360
         }
1361 1361
 
@@ -1372,13 +1372,13 @@  discard block
 block discarded – undo
1372 1372
 	     */
1373 1373
 	    $hide_product_fields = apply_filters( 'gravityview/edit_entry/hide-product-fields', empty( self::$supports_product_fields ) );
1374 1374
 
1375
-	    if( $hide_product_fields ) {
1376
-		    $field_type_blacklist[] = 'option';
1377
-		    $field_type_blacklist[] = 'quantity';
1378
-            $field_type_blacklist[] = 'product';
1379
-            $field_type_blacklist[] = 'total';
1380
-            $field_type_blacklist[] = 'shipping';
1381
-            $field_type_blacklist[] = 'calculation';
1375
+	    if ( $hide_product_fields ) {
1376
+		    $field_type_blacklist[ ] = 'option';
1377
+		    $field_type_blacklist[ ] = 'quantity';
1378
+            $field_type_blacklist[ ] = 'product';
1379
+            $field_type_blacklist[ ] = 'total';
1380
+            $field_type_blacklist[ ] = 'shipping';
1381
+            $field_type_blacklist[ ] = 'calculation';
1382 1382
 	    }
1383 1383
 
1384 1384
         // First, remove blacklist or calculation fields
@@ -1386,17 +1386,17 @@  discard block
 block discarded – undo
1386 1386
 
1387 1387
             // Remove the fields that have calculation properties
1388 1388
             // @since 1.16.2
1389
-            if( $field->has_calculation() ) {
1389
+            if ( $field->has_calculation() ) {
1390 1390
                 unset( $fields[ $key ] );
1391 1391
             }
1392 1392
 
1393
-            if( in_array( $field->type, $field_type_blacklist ) ) {
1393
+            if ( in_array( $field->type, $field_type_blacklist ) ) {
1394 1394
                 unset( $fields[ $key ] );
1395 1395
             }
1396 1396
         }
1397 1397
 
1398 1398
         // The Edit tab has not been configured, so we return all fields by default.
1399
-        if( empty( $configured_fields ) ) {
1399
+        if ( empty( $configured_fields ) ) {
1400 1400
             return $fields;
1401 1401
         }
1402 1402
 
@@ -1406,8 +1406,8 @@  discard block
 block discarded – undo
1406 1406
 	        /** @var GF_Field $field */
1407 1407
 	        foreach ( $fields as $field ) {
1408 1408
 
1409
-                if( intval( $configured_field['id'] ) === intval( $field->id ) && $this->user_can_edit_field( $configured_field, false ) ) {
1410
-                    $edit_fields[] = $this->merge_field_properties( $field, $configured_field );
1409
+                if ( intval( $configured_field[ 'id' ] ) === intval( $field->id ) && $this->user_can_edit_field( $configured_field, false ) ) {
1410
+                    $edit_fields[ ] = $this->merge_field_properties( $field, $configured_field );
1411 1411
                     break;
1412 1412
                 }
1413 1413
 
@@ -1430,14 +1430,14 @@  discard block
 block discarded – undo
1430 1430
 
1431 1431
         $return_field = $field;
1432 1432
 
1433
-        if( empty( $field_setting['show_label'] ) ) {
1433
+        if ( empty( $field_setting[ 'show_label' ] ) ) {
1434 1434
             $return_field->label = '';
1435
-        } elseif ( !empty( $field_setting['custom_label'] ) ) {
1436
-            $return_field->label = $field_setting['custom_label'];
1435
+        } elseif ( ! empty( $field_setting[ 'custom_label' ] ) ) {
1436
+            $return_field->label = $field_setting[ 'custom_label' ];
1437 1437
         }
1438 1438
 
1439
-        if( !empty( $field_setting['custom_class'] ) ) {
1440
-            $return_field->cssClass .= ' '. gravityview_sanitize_html_class( $field_setting['custom_class'] );
1439
+        if ( ! empty( $field_setting[ 'custom_class' ] ) ) {
1440
+            $return_field->cssClass .= ' ' . gravityview_sanitize_html_class( $field_setting[ 'custom_class' ] );
1441 1441
         }
1442 1442
 
1443 1443
         /**
@@ -1475,16 +1475,16 @@  discard block
 block discarded – undo
1475 1475
 	     */
1476 1476
 	    $use_gf_adminonly_setting = apply_filters( 'gravityview/edit_entry/use_gf_admin_only_setting', empty( $edit_fields ), $form, $view_id );
1477 1477
 
1478
-	    if( $use_gf_adminonly_setting && false === GVCommon::has_cap( 'gravityforms_edit_entries', $this->entry['id'] ) ) {
1479
-            foreach( $fields as $k => $field ) {
1480
-                if( $field->adminOnly ) {
1478
+	    if ( $use_gf_adminonly_setting && false === GVCommon::has_cap( 'gravityforms_edit_entries', $this->entry[ 'id' ] ) ) {
1479
+            foreach ( $fields as $k => $field ) {
1480
+                if ( $field->adminOnly ) {
1481 1481
                     unset( $fields[ $k ] );
1482 1482
                 }
1483 1483
             }
1484 1484
             return $fields;
1485 1485
         }
1486 1486
 
1487
-	    foreach( $fields as &$field ) {
1487
+	    foreach ( $fields as &$field ) {
1488 1488
 		    $field->adminOnly = false;
1489 1489
         }
1490 1490
 
@@ -1511,16 +1511,16 @@  discard block
 block discarded – undo
1511 1511
          */
1512 1512
         $use_conditional_logic = apply_filters( 'gravityview/edit_entry/conditional_logic', true, $form );
1513 1513
 
1514
-        if( $use_conditional_logic ) {
1514
+        if ( $use_conditional_logic ) {
1515 1515
             return $form;
1516 1516
         }
1517 1517
 
1518
-        foreach( $form['fields'] as &$field ) {
1518
+        foreach ( $form[ 'fields' ] as &$field ) {
1519 1519
             /* @var GF_Field $field */
1520 1520
             $field->conditionalLogic = null;
1521 1521
         }
1522 1522
 
1523
-        unset( $form['button']['conditionalLogic'] );
1523
+        unset( $form[ 'button' ][ 'conditionalLogic' ] );
1524 1524
 
1525 1525
         return $form;
1526 1526
 
@@ -1537,7 +1537,7 @@  discard block
 block discarded – undo
1537 1537
      */
1538 1538
     function manage_conditional_logic( $has_conditional_logic, $form ) {
1539 1539
 
1540
-        if( ! $this->is_edit_entry() ) {
1540
+        if ( ! $this->is_edit_entry() ) {
1541 1541
             return $has_conditional_logic;
1542 1542
         }
1543 1543
 
@@ -1568,44 +1568,44 @@  discard block
 block discarded – undo
1568 1568
          *  2. There are two entries embedded using oEmbed
1569 1569
          *  3. One of the entries has just been saved
1570 1570
          */
1571
-        if( !empty( $_POST['lid'] ) && !empty( $_GET['entry'] ) && ( $_POST['lid'] !== $_GET['entry'] ) ) {
1571
+        if ( ! empty( $_POST[ 'lid' ] ) && ! empty( $_GET[ 'entry' ] ) && ( $_POST[ 'lid' ] !== $_GET[ 'entry' ] ) ) {
1572 1572
 
1573 1573
             $error = true;
1574 1574
 
1575 1575
         }
1576 1576
 
1577
-        if( !empty( $_GET['entry'] ) && (string)$this->entry['id'] !== $_GET['entry'] ) {
1577
+        if ( ! empty( $_GET[ 'entry' ] ) && (string)$this->entry[ 'id' ] !== $_GET[ 'entry' ] ) {
1578 1578
 
1579 1579
             $error = true;
1580 1580
 
1581
-        } elseif( ! $this->verify_nonce() ) {
1581
+        } elseif ( ! $this->verify_nonce() ) {
1582 1582
 
1583 1583
             /**
1584 1584
              * If the Entry is embedded, there may be two entries on the same page.
1585 1585
              * If that's the case, and one is being edited, the other should fail gracefully and not display an error.
1586 1586
              */
1587
-            if( GravityView_oEmbed::getInstance()->get_entry_id() ) {
1587
+            if ( GravityView_oEmbed::getInstance()->get_entry_id() ) {
1588 1588
                 $error = true;
1589 1589
             } else {
1590
-                $error = __( 'The link to edit this entry is not valid; it may have expired.', 'gravityview');
1590
+                $error = __( 'The link to edit this entry is not valid; it may have expired.', 'gravityview' );
1591 1591
             }
1592 1592
 
1593 1593
         }
1594 1594
 
1595
-        if( ! GravityView_Edit_Entry::check_user_cap_edit_entry( $this->entry ) ) {
1596
-            $error = __( 'You do not have permission to edit this entry.', 'gravityview');
1595
+        if ( ! GravityView_Edit_Entry::check_user_cap_edit_entry( $this->entry ) ) {
1596
+            $error = __( 'You do not have permission to edit this entry.', 'gravityview' );
1597 1597
         }
1598 1598
 
1599
-        if( $this->entry['status'] === 'trash' ) {
1600
-            $error = __('You cannot edit the entry; it is in the trash.', 'gravityview' );
1599
+        if ( $this->entry[ 'status' ] === 'trash' ) {
1600
+            $error = __( 'You cannot edit the entry; it is in the trash.', 'gravityview' );
1601 1601
         }
1602 1602
 
1603 1603
         // No errors; everything's fine here!
1604
-        if( empty( $error ) ) {
1604
+        if ( empty( $error ) ) {
1605 1605
             return true;
1606 1606
         }
1607 1607
 
1608
-        if( $echo && $error !== true ) {
1608
+        if ( $echo && $error !== true ) {
1609 1609
 
1610 1610
 	        $error = esc_html( $error );
1611 1611
 
@@ -1613,13 +1613,13 @@  discard block
 block discarded – undo
1613 1613
 	         * @since 1.9
1614 1614
 	         */
1615 1615
 	        if ( ! empty( $this->entry ) ) {
1616
-		        $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;" ) );
1616
+		        $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;" ) );
1617 1617
 	        }
1618 1618
 
1619
-            echo GVCommon::generate_notice( wpautop( $error ), 'gv-error error');
1619
+            echo GVCommon::generate_notice( wpautop( $error ), 'gv-error error' );
1620 1620
         }
1621 1621
 
1622
-        do_action('gravityview_log_error', 'GravityView_Edit_Entry[user_can_edit_entry]' . $error );
1622
+        do_action( 'gravityview_log_error', 'GravityView_Edit_Entry[user_can_edit_entry]' . $error );
1623 1623
 
1624 1624
         return false;
1625 1625
     }
@@ -1636,20 +1636,20 @@  discard block
 block discarded – undo
1636 1636
 
1637 1637
         $error = NULL;
1638 1638
 
1639
-        if( ! $this->check_user_cap_edit_field( $field ) ) {
1640
-            $error = __( 'You do not have permission to edit this field.', 'gravityview');
1639
+        if ( ! $this->check_user_cap_edit_field( $field ) ) {
1640
+            $error = __( 'You do not have permission to edit this field.', 'gravityview' );
1641 1641
         }
1642 1642
 
1643 1643
         // No errors; everything's fine here!
1644
-        if( empty( $error ) ) {
1644
+        if ( empty( $error ) ) {
1645 1645
             return true;
1646 1646
         }
1647 1647
 
1648
-        if( $echo ) {
1649
-            echo GVCommon::generate_notice( wpautop( esc_html( $error ) ), 'gv-error error');
1648
+        if ( $echo ) {
1649
+            echo GVCommon::generate_notice( wpautop( esc_html( $error ) ), 'gv-error error' );
1650 1650
         }
1651 1651
 
1652
-        do_action('gravityview_log_error', 'GravityView_Edit_Entry[user_can_edit_field]' . $error );
1652
+        do_action( 'gravityview_log_error', 'GravityView_Edit_Entry[user_can_edit_field]' . $error );
1653 1653
 
1654 1654
         return false;
1655 1655
 
@@ -1667,15 +1667,15 @@  discard block
 block discarded – undo
1667 1667
     private function check_user_cap_edit_field( $field ) {
1668 1668
 
1669 1669
         // If they can edit any entries (as defined in Gravity Forms), we're good.
1670
-        if( GVCommon::has_cap( array( 'gravityforms_edit_entries', 'gravityview_edit_others_entries' ) ) ) {
1670
+        if ( GVCommon::has_cap( array( 'gravityforms_edit_entries', 'gravityview_edit_others_entries' ) ) ) {
1671 1671
             return true;
1672 1672
         }
1673 1673
 
1674
-        $field_cap = isset( $field['allow_edit_cap'] ) ? $field['allow_edit_cap'] : false;
1674
+        $field_cap = isset( $field[ 'allow_edit_cap' ] ) ? $field[ 'allow_edit_cap' ] : false;
1675 1675
 
1676 1676
         // If the field has custom editing capaibilities set, check those
1677
-        if( $field_cap ) {
1678
-            return GVCommon::has_cap( $field['allow_edit_cap'] );
1677
+        if ( $field_cap ) {
1678
+            return GVCommon::has_cap( $field[ 'allow_edit_cap' ] );
1679 1679
         }
1680 1680
 
1681 1681
         return false;
@@ -1689,17 +1689,17 @@  discard block
 block discarded – undo
1689 1689
     public function verify_nonce() {
1690 1690
 
1691 1691
         // Verify form submitted for editing single
1692
-        if( $this->is_edit_entry_submission() ) {
1692
+        if ( $this->is_edit_entry_submission() ) {
1693 1693
             $valid = wp_verify_nonce( $_POST[ self::$nonce_field ], self::$nonce_field );
1694 1694
         }
1695 1695
 
1696 1696
         // Verify
1697
-        else if( ! $this->is_edit_entry() ) {
1697
+        else if ( ! $this->is_edit_entry() ) {
1698 1698
             $valid = false;
1699 1699
         }
1700 1700
 
1701 1701
         else {
1702
-            $valid = wp_verify_nonce( $_GET['edit'], self::$nonce_key );
1702
+            $valid = wp_verify_nonce( $_GET[ 'edit' ], self::$nonce_key );
1703 1703
         }
1704 1704
 
1705 1705
         /**
Please login to merge, or discard this patch.
includes/class-gravityview-settings.php 1 patch
Spacing   +75 added lines, -75 removed lines patch added patch discarded remove patch
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
 	 */
72 72
 	public function __construct( $prevent_multiple_instances = '' ) {
73 73
 
74
-		if( $prevent_multiple_instances === 'get_instance' ) {
74
+		if ( $prevent_multiple_instances === 'get_instance' ) {
75 75
 			return parent::__construct();
76 76
 		}
77 77
 
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
 	 */
84 84
 	public static function get_instance() {
85 85
 
86
-		if( empty( self::$instance ) ) {
86
+		if ( empty( self::$instance ) ) {
87 87
 			self::$instance = new self( 'get_instance' );
88 88
 		}
89 89
 
@@ -106,11 +106,11 @@  discard block
 block discarded – undo
106 106
 		 * Prevent Gravity Forms from showing the uninstall tab on the settings page
107 107
 		 * @hack
108 108
 		 */
109
-		if( $caps === $this->_capabilities_uninstall ) {
109
+		if ( $caps === $this->_capabilities_uninstall ) {
110 110
 			return false;
111 111
 		}
112 112
 
113
-		if( empty( $caps ) ) {
113
+		if ( empty( $caps ) ) {
114 114
 			$caps = array( 'gravityview_full_access' );
115 115
 		}
116 116
 
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
 		add_filter( 'gform_addon_app_settings_menu_gravityview', array( $this, 'modify_app_settings_menu_title' ) );
134 134
 
135 135
 		/** @since 1.7.6 */
136
-		add_action('network_admin_menu', array( $this, 'add_network_menu' ) );
136
+		add_action( 'network_admin_menu', array( $this, 'add_network_menu' ) );
137 137
 
138 138
 		parent::init_admin();
139 139
 	}
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
 	 */
148 148
 	public function modify_app_settings_menu_title( $setting_tabs ) {
149 149
 
150
-		$setting_tabs[0]['label'] = __( 'GravityView Settings', 'gravityview');
150
+		$setting_tabs[ 0 ][ 'label' ] = __( 'GravityView Settings', 'gravityview' );
151 151
 
152 152
 		return $setting_tabs;
153 153
 	}
@@ -164,11 +164,11 @@  discard block
 block discarded – undo
164 164
 	 */
165 165
 	private function _load_license_handler() {
166 166
 
167
-		if( !empty( $this->License_Handler ) ) {
167
+		if ( ! empty( $this->License_Handler ) ) {
168 168
 			return;
169 169
 		}
170 170
 
171
-		require_once( GRAVITYVIEW_DIR . 'includes/class-gv-license-handler.php');
171
+		require_once( GRAVITYVIEW_DIR . 'includes/class-gv-license-handler.php' );
172 172
 
173 173
 		$this->License_Handler = GV_License_Handler::get_instance( $this );
174 174
 	}
@@ -180,60 +180,60 @@  discard block
 block discarded – undo
180 180
 	function license_key_notice() {
181 181
 
182 182
 		// Only show on GravityView pages
183
-		if( ! gravityview_is_admin_page() ) {
183
+		if ( ! gravityview_is_admin_page() ) {
184 184
 			return;
185 185
 		}
186 186
 
187
-		$license_status = self::getSetting('license_key_status');
188
-		$license_id = self::getSetting('license_key');
187
+		$license_status = self::getSetting( 'license_key_status' );
188
+		$license_id = self::getSetting( 'license_key' );
189 189
 		$license_id = empty( $license_id ) ? 'license' : $license_id;
190 190
 
191
-		$message = esc_html__('Your GravityView license %s. This means you&rsquo;re missing out on updates and support! %sActivate your license%s or %sget a license here%s.', 'gravityview');
191
+		$message = esc_html__( 'Your GravityView license %s. This means you&rsquo;re missing out on updates and support! %sActivate your license%s or %sget a license here%s.', 'gravityview' );
192 192
 
193 193
 		/**
194 194
 		 * I wanted to remove the period from after the buttons in the string,
195 195
 		 * but didn't want to mess up the translation strings for the translators.
196 196
 		 */
197 197
 		$message = mb_substr( $message, 0, mb_strlen( $message ) - 1 );
198
-		$title = __('Inactive License', 'gravityview');
198
+		$title = __( 'Inactive License', 'gravityview' );
199 199
 		$status = '';
200 200
 		$update_below = false;
201 201
 		$primary_button_link = admin_url( 'edit.php?post_type=gravityview&amp;page=gravityview_settings' );
202 202
 		switch ( $license_status ) {
203 203
 			case 'invalid':
204
-				$title = __('Invalid License', 'gravityview');
205
-				$status = __('is invalid', 'gravityview');
204
+				$title = __( 'Invalid License', 'gravityview' );
205
+				$status = __( 'is invalid', 'gravityview' );
206 206
 				break;
207 207
 			case 'deactivated':
208
-				$status = __('is inactive', 'gravityview');
209
-				$update_below = __('Activate your license key below.', 'gravityview');
208
+				$status = __( 'is inactive', 'gravityview' );
209
+				$update_below = __( 'Activate your license key below.', 'gravityview' );
210 210
 				break;
211 211
 			/** @noinspection PhpMissingBreakStatementInspection */
212 212
 			case '':
213 213
 				$license_status = 'site_inactive';
214 214
 				// break intentionally left blank
215 215
 			case 'site_inactive':
216
-				$status = __('has not been activated', 'gravityview');
217
-				$update_below = __('Activate your license key below.', 'gravityview');
216
+				$status = __( 'has not been activated', 'gravityview' );
217
+				$update_below = __( 'Activate your license key below.', 'gravityview' );
218 218
 				break;
219 219
 		}
220
-		$url = 'https://gravityview.co/pricing/?utm_source=admin_notice&utm_medium=admin&utm_content='.$license_status.'&utm_campaign=Admin%20Notice';
220
+		$url = 'https://gravityview.co/pricing/?utm_source=admin_notice&utm_medium=admin&utm_content=' . $license_status . '&utm_campaign=Admin%20Notice';
221 221
 
222 222
 		// Show a different notice on settings page for inactive licenses (hide the buttons)
223
-		if( $update_below && gravityview_is_admin_page( '', 'settings' ) ) {
223
+		if ( $update_below && gravityview_is_admin_page( '', 'settings' ) ) {
224 224
 			$message = sprintf( $message, $status, '<div class="hidden">', '', '', '</div><a href="#" onclick="jQuery(\'#license_key\').focus(); return false;">' . $update_below . '</a>' );
225 225
 		} else {
226 226
 			$message = sprintf( $message, $status, "\n\n" . '<a href="' . $primary_button_link . '" class="button button-primary">', '</a>', '<a href="' . esc_url( $url ) . '" class="button button-secondary">', '</a>' );
227 227
 		}
228 228
 
229
-		if( !empty( $status ) ) {
229
+		if ( ! empty( $status ) ) {
230 230
 			GravityView_Admin_Notices::add_notice( array(
231 231
 				'message' => $message,
232 232
 				'class'	=> 'updated',
233 233
 				'title' => $title,
234 234
 				'cap' => 'gravityview_edit_settings',
235
-				'dismiss' => sha1( $license_status.'_'.$license_id ),
236
-			));
235
+				'dismiss' => sha1( $license_status . '_' . $license_id ),
236
+			) );
237 237
 		}
238 238
 	}
239 239
 
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
 
246 246
 		$styles = parent::styles();
247 247
 
248
-		$styles[] = array(
248
+		$styles[ ] = array(
249 249
 			'handle'  => 'gravityview_settings',
250 250
 			'src'     => plugins_url( 'assets/css/admin-settings.css', GRAVITYVIEW_FILE ),
251 251
 			'version' => GravityView_Plugin::version,
@@ -268,7 +268,7 @@  discard block
 block discarded – undo
268 268
 	 * @return void
269 269
 	 */
270 270
 	public function add_network_menu() {
271
-		if( GravityView_Plugin::is_network_activated() ) {
271
+		if ( GravityView_Plugin::is_network_activated() ) {
272 272
 			add_menu_page( __( 'Settings', 'gravityview' ), __( 'GravityView', 'gravityview' ), $this->_capabilities_app_settings, "{$this->_slug}_settings", array( $this, 'app_tab_page' ), 'none' );
273 273
 		}
274 274
 	}
@@ -285,7 +285,7 @@  discard block
 block discarded – undo
285 285
 		 * If multisite and not network admin, we don't want the settings to show.
286 286
 		 * @since 1.7.6
287 287
 		 */
288
-		$show_submenu = !is_multisite() ||  is_main_site() || !GravityView_Plugin::is_network_activated() || ( is_network_admin() && GravityView_Plugin::is_network_activated() );
288
+		$show_submenu = ! is_multisite() || is_main_site() || ! GravityView_Plugin::is_network_activated() || ( is_network_admin() && GravityView_Plugin::is_network_activated() );
289 289
 
290 290
 		/**
291 291
 		 * Override whether to show the Settings menu on a per-blog basis.
@@ -294,7 +294,7 @@  discard block
 block discarded – undo
294 294
 		 */
295 295
 		$show_submenu = apply_filters( 'gravityview/show-settings-menu', $show_submenu );
296 296
 
297
-		if( $show_submenu ) {
297
+		if ( $show_submenu ) {
298 298
 			add_submenu_page( 'edit.php?post_type=gravityview', __( 'Settings', 'gravityview' ), __( 'Settings', 'gravityview' ), $this->_capabilities_app_settings, $this->_slug . '_settings', array( $this, 'app_tab_page' ) );
299 299
 		}
300 300
 	}
@@ -325,7 +325,7 @@  discard block
 block discarded – undo
325 325
 		/**
326 326
 		 * Backward compatibility with Redux
327 327
 		 */
328
-		if( $setting_name === 'license' ) {
328
+		if ( $setting_name === 'license' ) {
329 329
 			return array(
330 330
 				'license' => parent::get_app_setting( 'license_key' ),
331 331
 				'status' => parent::get_app_setting( 'license_key_status' ),
@@ -389,7 +389,7 @@  discard block
 block discarded – undo
389 389
 
390 390
 		$return = $text . $activation;
391 391
 
392
-		if( $echo ) {
392
+		if ( $echo ) {
393 393
 			echo $return;
394 394
 		}
395 395
 
@@ -416,15 +416,15 @@  discard block
 block discarded – undo
416 416
 	 */
417 417
 	public function settings_submit( $field, $echo = true ) {
418 418
 
419
-		$field['type']  = ( isset($field['type']) && in_array( $field['type'], array('submit','reset','button') ) ) ? $field['type'] : 'submit';
419
+		$field[ 'type' ] = ( isset( $field[ 'type' ] ) && in_array( $field[ 'type' ], array( 'submit', 'reset', 'button' ) ) ) ? $field[ 'type' ] : 'submit';
420 420
 
421 421
 		$attributes    = $this->get_field_attributes( $field );
422 422
 		$default_value = rgar( $field, 'value' ) ? rgar( $field, 'value' ) : rgar( $field, 'default_value' );
423
-		$value         = $this->get_setting( $field['name'], $default_value );
423
+		$value         = $this->get_setting( $field[ 'name' ], $default_value );
424 424
 
425 425
 
426
-		$attributes['class'] = isset( $attributes['class'] ) ? esc_attr( $attributes['class'] ) : 'button-primary gfbutton';
427
-		$name    = ( $field['name'] === 'gform-settings-save' ) ? $field['name'] : '_gaddon_setting_'.$field['name'];
426
+		$attributes[ 'class' ] = isset( $attributes[ 'class' ] ) ? esc_attr( $attributes[ 'class' ] ) : 'button-primary gfbutton';
427
+		$name = ( $field[ 'name' ] === 'gform-settings-save' ) ? $field[ 'name' ] : '_gaddon_setting_' . $field[ 'name' ];
428 428
 
429 429
 		if ( empty( $value ) ) {
430 430
 			$value = __( 'Update Settings', 'gravityview' );
@@ -433,7 +433,7 @@  discard block
 block discarded – undo
433 433
 		$attributes = $this->get_field_attributes( $field );
434 434
 
435 435
 		$html = '<input
436
-                    type="' . $field['type'] . '"
436
+                    type="' . $field[ 'type' ] . '"
437 437
                     name="' . esc_attr( $name ) . '"
438 438
                     value="' . $value . '" ' .
439 439
 		        implode( ' ', $attributes ) .
@@ -455,16 +455,16 @@  discard block
 block discarded – undo
455 455
 	 * @return string
456 456
 	 */
457 457
 	public function settings_save( $field, $echo = true ) {
458
-		$field['type']  = 'submit';
459
-		$field['name']  = 'gform-settings-save';
460
-		$field['class'] = isset( $field['class'] ) ? $field['class'] : 'button-primary gfbutton';
458
+		$field[ 'type' ]  = 'submit';
459
+		$field[ 'name' ]  = 'gform-settings-save';
460
+		$field[ 'class' ] = isset( $field[ 'class' ] ) ? $field[ 'class' ] : 'button-primary gfbutton';
461 461
 
462 462
 		if ( ! rgar( $field, 'value' ) )
463
-			$field['value'] = __( 'Update Settings', 'gravityview' );
463
+			$field[ 'value' ] = __( 'Update Settings', 'gravityview' );
464 464
 
465 465
 		$output = $this->settings_submit( $field, false );
466 466
 
467
-		if( $echo ) {
467
+		if ( $echo ) {
468 468
 			echo $output;
469 469
 		}
470 470
 
@@ -481,8 +481,8 @@  discard block
 block discarded – undo
481 481
 		parent::single_setting_label( $field );
482 482
 
483 483
 		// Added by GravityView
484
-		if ( isset( $field['description'] ) ) {
485
-			echo '<span class="description">'. $field['description'] .'</span>';
484
+		if ( isset( $field[ 'description' ] ) ) {
485
+			echo '<span class="description">' . $field[ 'description' ] . '</span>';
486 486
 		}
487 487
 
488 488
 	}
@@ -544,11 +544,11 @@  discard block
 block discarded – undo
544 544
 
545 545
 		// If the posted key doesn't match the activated/deactivated key (set using the Activate License button, AJAX response),
546 546
 		// then we assume it's changed. If it's changed, unset the status and the previous response.
547
-		if( $local_key !== $response_key ) {
547
+		if ( $local_key !== $response_key ) {
548 548
 
549
-			unset( $posted_settings['license_key_response'] );
550
-			unset( $posted_settings['license_key_status'] );
551
-			GFCommon::add_error_message( __('The license key you entered has been saved, but not activated. Please activate the license.', 'gravityview' ) );
549
+			unset( $posted_settings[ 'license_key_response' ] );
550
+			unset( $posted_settings[ 'license_key_status' ] );
551
+			GFCommon::add_error_message( __( 'The license key you entered has been saved, but not activated. Please activate the license.', 'gravityview' ) );
552 552
 		}
553 553
 
554 554
 		return $posted_settings;
@@ -583,25 +583,25 @@  discard block
 block discarded – undo
583 583
 				'label'             => __( 'License Key', 'gravityview' ),
584 584
 				'description'          => __( 'Enter the license key that was sent to you on purchase. This enables plugin updates &amp; support.', 'gravityview' ),
585 585
 				'type'              => 'edd_license',
586
-				'data-pending-text' => __('Verifying license&hellip;', 'gravityview'),
587
-				'default_value'           => $default_settings['license_key'],
586
+				'data-pending-text' => __( 'Verifying license&hellip;', 'gravityview' ),
587
+				'default_value'           => $default_settings[ 'license_key' ],
588 588
 				'class'             => ( '' == $this->get_app_setting( 'license_key' ) ) ? 'activate code regular-text edd-license-key' : 'deactivate code regular-text edd-license-key',
589 589
 			),
590 590
 			array(
591 591
 				'name'       => 'license_key_response',
592
-				'default_value'  => $default_settings['license_key_response'],
592
+				'default_value'  => $default_settings[ 'license_key_response' ],
593 593
 				'type'     => 'hidden',
594 594
 			),
595 595
 			array(
596 596
 				'name'       => 'license_key_status',
597
-				'default_value'  => $default_settings['license_key_status'],
597
+				'default_value'  => $default_settings[ 'license_key_status' ],
598 598
 				'type'     => 'hidden',
599 599
 			),
600 600
 			array(
601 601
 				'name'       => 'support-email',
602 602
 				'type'     => 'text',
603 603
 				'validate' => 'email',
604
-				'default_value'  => $default_settings['support-email'],
604
+				'default_value'  => $default_settings[ 'support-email' ],
605 605
 				'label'    => __( 'Support Email', 'gravityview' ),
606 606
 				'description' => __( 'In order to provide responses to your support requests, please provide your email address.', 'gravityview' ),
607 607
 				'class'    => 'code regular-text',
@@ -613,44 +613,44 @@  discard block
 block discarded – undo
613 613
 				'name'         => 'support_port',
614 614
 				'type'       => 'radio',
615 615
 				'label'      => __( 'Show Support Port?', 'gravityview' ),
616
-				'default_value'    => $default_settings['support_port'],
616
+				'default_value'    => $default_settings[ 'support_port' ],
617 617
 				'horizontal' => 1,
618 618
 				'choices'    => array(
619 619
 					array(
620
-						'label' => _x('Show', 'Setting: Show or Hide', 'gravityview'),
620
+						'label' => _x( 'Show', 'Setting: Show or Hide', 'gravityview' ),
621 621
 						'value' => '1',
622 622
 					),
623 623
 					array(
624
-						'label' => _x('Hide', 'Setting: Show or Hide', 'gravityview'),
624
+						'label' => _x( 'Hide', 'Setting: Show or Hide', 'gravityview' ),
625 625
 						'value' => '0',
626 626
 					),
627 627
 				),
628
-				'tooltip' => '<p><img src="' . esc_url_raw( plugins_url('assets/images/screenshots/beacon.png', GRAVITYVIEW_FILE ) ) . '" alt="' . esc_attr__( 'The Support Port looks like this.', 'gravityview' ) . '" class="alignright" style="max-width:40px; margin:.5em;" />' . esc_html__('The Support Port provides quick access to how-to articles and tutorials. For administrators, it also makes it easy to contact support.', 'gravityview') . '</p>',
628
+				'tooltip' => '<p><img src="' . esc_url_raw( plugins_url( 'assets/images/screenshots/beacon.png', GRAVITYVIEW_FILE ) ) . '" alt="' . esc_attr__( 'The Support Port looks like this.', 'gravityview' ) . '" class="alignright" style="max-width:40px; margin:.5em;" />' . esc_html__( 'The Support Port provides quick access to how-to articles and tutorials. For administrators, it also makes it easy to contact support.', 'gravityview' ) . '</p>',
629 629
 				'description'   => __( 'Show the Support Port on GravityView pages?', 'gravityview' ),
630 630
 			),
631 631
 			array(
632 632
 				'name'         => 'no-conflict-mode',
633 633
 				'type'       => 'radio',
634 634
 				'label'      => __( 'No-Conflict Mode', 'gravityview' ),
635
-				'default_value'    => $default_settings['no-conflict-mode'],
635
+				'default_value'    => $default_settings[ 'no-conflict-mode' ],
636 636
 				'horizontal' => 1,
637 637
 				'choices'    => array(
638 638
 					array(
639
-						'label' => _x('On', 'Setting: On or off', 'gravityview'),
639
+						'label' => _x( 'On', 'Setting: On or off', 'gravityview' ),
640 640
 						'value' => '1',
641 641
 					),
642 642
 					array(
643
-						'label' => _x('Off', 'Setting: On or off', 'gravityview'),
643
+						'label' => _x( 'Off', 'Setting: On or off', 'gravityview' ),
644 644
 						'value' => '0',
645 645
 					),
646 646
 				),
647
-				'description'   => __( 'Set this to ON to prevent extraneous scripts and styles from being printed on GravityView admin pages, reducing conflicts with other plugins and themes.', 'gravityview' ) . ' ' . __('If your Edit View tabs are ugly, enable this setting.', 'gravityview'),
647
+				'description'   => __( 'Set this to ON to prevent extraneous scripts and styles from being printed on GravityView admin pages, reducing conflicts with other plugins and themes.', 'gravityview' ) . ' ' . __( 'If your Edit View tabs are ugly, enable this setting.', 'gravityview' ),
648 648
 			),
649 649
 			array(
650 650
 				'name'       => 'delete-on-uninstall',
651 651
 				'type'       => 'radio',
652 652
 				'label'      => __( 'Remove Data on Delete?', 'gravityview' ),
653
-				'default_value'    => $default_settings['delete-on-uninstall'],
653
+				'default_value'    => $default_settings[ 'delete-on-uninstall' ],
654 654
 				'horizontal' => 1,
655 655
 				'choices'    => array(
656 656
 					array(
@@ -676,20 +676,20 @@  discard block
 block discarded – undo
676 676
 		 * @since 1.7.4
677 677
 		 */
678 678
 		foreach ( $fields as &$field ) {
679
-			$field['name']          = isset( $field['name'] ) ? $field['name'] : rgget('id', $field );
680
-			$field['label']         = isset( $field['label'] ) ? $field['label'] : rgget('title', $field );
681
-			$field['default_value'] = isset( $field['default_value'] ) ? $field['default_value'] : rgget('default', $field );
682
-			$field['description']   = isset( $field['description'] ) ? $field['description'] : rgget('subtitle', $field );
679
+			$field[ 'name' ]          = isset( $field[ 'name' ] ) ? $field[ 'name' ] : rgget( 'id', $field );
680
+			$field[ 'label' ]         = isset( $field[ 'label' ] ) ? $field[ 'label' ] : rgget( 'title', $field );
681
+			$field[ 'default_value' ] = isset( $field[ 'default_value' ] ) ? $field[ 'default_value' ] : rgget( 'default', $field );
682
+			$field[ 'description' ]   = isset( $field[ 'description' ] ) ? $field[ 'description' ] : rgget( 'subtitle', $field );
683 683
 
684
-			if( $disabled_attribute ) {
685
-				$field['disabled']  = $disabled_attribute;
684
+			if ( $disabled_attribute ) {
685
+				$field[ 'disabled' ] = $disabled_attribute;
686 686
 			}
687 687
 		}
688 688
 
689 689
 
690 690
         $sections = array(
691 691
             array(
692
-                'description' =>      sprintf( '<span class="version-info description">%s</span>', sprintf( __('You are running GravityView version %s', 'gravityview'), GravityView_Plugin::version ) ),
692
+                'description' =>      sprintf( '<span class="version-info description">%s</span>', sprintf( __( 'You are running GravityView version %s', 'gravityview' ), GravityView_Plugin::version ) ),
693 693
                 'fields'      => $fields,
694 694
             )
695 695
         );
@@ -700,8 +700,8 @@  discard block
 block discarded – undo
700 700
             'type'     => 'save',
701 701
         );
702 702
 
703
-		if( $disabled_attribute ) {
704
-			$button['disabled'] = $disabled_attribute;
703
+		if ( $disabled_attribute ) {
704
+			$button[ 'disabled' ] = $disabled_attribute;
705 705
 		}
706 706
 
707 707
 
@@ -721,20 +721,20 @@  discard block
 block discarded – undo
721 721
 		// If there are extensions, add a section for them
722 722
 		if ( ! empty( $extension_sections ) ) {
723 723
 
724
-			if( $disabled_attribute ) {
724
+			if ( $disabled_attribute ) {
725 725
 				foreach ( $extension_sections as &$section ) {
726
-					foreach ( $section['fields'] as &$field ) {
727
-						$field['disabled'] = $disabled_attribute;
726
+					foreach ( $section[ 'fields' ] as &$field ) {
727
+						$field[ 'disabled' ] = $disabled_attribute;
728 728
 					}
729 729
 				}
730 730
 			}
731 731
 
732
-            $k = count( $extension_sections ) - 1 ;
733
-            $extension_sections[ $k ]['fields'][] = $button;
732
+            $k = count( $extension_sections ) - 1;
733
+            $extension_sections[ $k ][ 'fields' ][ ] = $button;
734 734
 			$sections = array_merge( $sections, $extension_sections );
735 735
 		} else {
736 736
             // add the 'update settings' button to the general section
737
-            $sections[0]['fields'][] = $button;
737
+            $sections[ 0 ][ 'fields' ][ ] = $button;
738 738
         }
739 739
 
740 740
 		return $sections;
Please login to merge, or discard this patch.