Completed
Push — master ( 2cfa6f...8927a4 )
by Zack
10:00 queued 06:05
created
includes/wordpress-widgets/class-gravityview-recent-entries-widget.php 1 patch
Spacing   +64 added lines, -64 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
 
13 13
 	function __construct( ) {
14 14
 
15
-		$name = __('GravityView Recent Entries', 'gravityview');
15
+		$name = __( 'GravityView Recent Entries', 'gravityview' );
16 16
 
17 17
 		$widget_options = array(
18 18
 			'description' => __( 'Display the most recent entries for a View', 'gravityview' ),
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
 
26 26
 	private function initialize() {
27 27
 
28
-		add_action('admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts') );
28
+		add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ) );
29 29
 
30 30
 		add_action( 'wp_ajax_gv_get_view_merge_tag_data', array( $this, 'ajax_get_view_merge_tag_data' ) );
31 31
 
@@ -38,21 +38,21 @@  discard block
 block discarded – undo
38 38
 	 */
39 39
 	function ajax_get_view_merge_tag_data() {
40 40
 
41
-		if ( ! isset( $_POST['nonce'] ) || ! wp_verify_nonce( $_POST['nonce'], 'gravityview_ajax_widget' ) ) {
41
+		if ( ! isset( $_POST[ 'nonce' ] ) || ! wp_verify_nonce( $_POST[ 'nonce' ], 'gravityview_ajax_widget' ) ) {
42 42
 			exit( false );
43 43
 		}
44 44
 
45
-		$form_id  = gravityview_get_form_id( $_POST['view_id'] );
45
+		$form_id = gravityview_get_form_id( $_POST[ 'view_id' ] );
46 46
 
47 47
 		$form = RGFormsModel::get_form_meta( $form_id );
48 48
 
49 49
 		$output = array(
50 50
 			'form' => array(
51
-				'id' => $form['id'],
52
-				'title' => $form['title'],
53
-				'fields' => $form['fields'],
51
+				'id' => $form[ 'id' ],
52
+				'title' => $form[ 'title' ],
53
+				'fields' => $form[ 'fields' ],
54 54
 			),
55
-			'mergeTags' => GFCommon::get_merge_tags( $form['fields'], '', false ),
55
+			'mergeTags' => GFCommon::get_merge_tags( $form[ 'fields' ], '', false ),
56 56
 		);
57 57
 
58 58
 		echo json_encode( $output );
@@ -68,19 +68,19 @@  discard block
 block discarded – undo
68 68
 	function admin_enqueue_scripts() {
69 69
 		global $pagenow;
70 70
 
71
-		if( $pagenow === 'widgets.php' ) {
71
+		if ( $pagenow === 'widgets.php' ) {
72 72
 
73
-			$script_debug = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min';
73
+			$script_debug = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
74 74
 
75 75
 			GravityView_Admin_Views::enqueue_gravity_forms_scripts();
76 76
 
77
-			wp_enqueue_script( 'gravityview_widgets', plugins_url('assets/js/admin-widgets'.$script_debug.'.js', GRAVITYVIEW_FILE), array( 'jquery', 'gform_gravityforms' ), GravityView_Plugin::version );
77
+			wp_enqueue_script( 'gravityview_widgets', plugins_url( 'assets/js/admin-widgets' . $script_debug . '.js', GRAVITYVIEW_FILE ), array( 'jquery', 'gform_gravityforms' ), GravityView_Plugin::version );
78 78
 
79 79
 			wp_localize_script( 'gravityview_widgets', 'GVWidgets', array(
80 80
 				'nonce' => wp_create_nonce( 'gravityview_ajax_widget' )
81
-			));
81
+			) );
82 82
 
83
-			wp_enqueue_style( 'gravityview_views_styles', plugins_url('assets/css/admin-views.css', GRAVITYVIEW_FILE), array('dashicons' ), GravityView_Plugin::version );
83
+			wp_enqueue_style( 'gravityview_views_styles', plugins_url( 'assets/css/admin-views.css', GRAVITYVIEW_FILE ), array( 'dashicons' ), GravityView_Plugin::version );
84 84
 		}
85 85
 
86 86
 	}
@@ -95,19 +95,19 @@  discard block
 block discarded – undo
95 95
 	function widget( $args, $instance ) {
96 96
 
97 97
 		// Don't have the Customizer render too soon.
98
-		if( empty( $instance['view_id'] ) ) {
98
+		if ( empty( $instance[ 'view_id' ] ) ) {
99 99
 			return;
100 100
 		}
101 101
 
102
-		$args['id']        = ( isset( $args['id'] ) ) ? $args['id'] : 'gv_recent_entries';
103
-		$instance['title'] = ( isset( $instance['title'] ) ) ? $instance['title'] : '';
102
+		$args[ 'id' ]        = ( isset( $args[ 'id' ] ) ) ? $args[ 'id' ] : 'gv_recent_entries';
103
+		$instance[ 'title' ] = ( isset( $instance[ 'title' ] ) ) ? $instance[ 'title' ] : '';
104 104
 
105
-		$title = apply_filters( 'widget_title', $instance[ 'title' ], $instance, $args['id'] );
105
+		$title = apply_filters( 'widget_title', $instance[ 'title' ], $instance, $args[ 'id' ] );
106 106
 
107
-		echo $args['before_widget'];
107
+		echo $args[ 'before_widget' ];
108 108
 
109
-		if ( !empty( $title ) ) {
110
-			echo $args['before_title'] . $title . $args['after_title'];
109
+		if ( ! empty( $title ) ) {
110
+			echo $args[ 'before_title' ] . $title . $args[ 'after_title' ];
111 111
 		}
112 112
 
113 113
 		/**
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
 		 */
128 128
 		do_action( 'gravityview/widget/recent-entries/after_widget', $args, $instance );
129 129
 
130
-		echo $args['after_widget'];
130
+		echo $args[ 'after_widget' ];
131 131
 	}
132 132
 
133 133
 	/**
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
 	 */
142 142
 	private function get_output( $instance ) {
143 143
 
144
-		$form_id = gravityview_get_form_id( $instance['view_id'] );
144
+		$form_id = gravityview_get_form_id( $instance[ 'view_id' ] );
145 145
 
146 146
 		$form = gravityview_get_form( $form_id );
147 147
 
@@ -151,13 +151,13 @@  discard block
 block discarded – undo
151 151
 		 * @since 1.6.1
152 152
 		 * @var int $entry_link_post_id The ID to use as the parent post for the entry
153 153
 		 */
154
-		$entry_link_post_id = ( empty( $instance['error_post_id'] ) && !empty( $instance['post_id'] ) ) ? $instance['post_id'] : $instance['view_id'];
154
+		$entry_link_post_id = ( empty( $instance[ 'error_post_id' ] ) && ! empty( $instance[ 'post_id' ] ) ) ? $instance[ 'post_id' ] : $instance[ 'view_id' ];
155 155
 
156 156
 		/**
157 157
 		 * Generate list output
158 158
 		 * @since 1.7.2
159 159
 		 */
160
-		$List = new GravityView_Entry_List( $entries, $entry_link_post_id, $form, $instance['link_format'], $instance['after_link'], 'recent-entries-widget' );
160
+		$List = new GravityView_Entry_List( $entries, $entry_link_post_id, $form, $instance[ 'link_format' ], $instance[ 'after_link' ], 'recent-entries-widget' );
161 161
 
162 162
 		$output = $List->get_output();
163 163
 
@@ -182,30 +182,30 @@  discard block
 block discarded – undo
182 182
 	private function get_entries( $instance, $form_id ) {
183 183
 
184 184
 		// Get the settings for the View ID
185
-		$view_settings = gravityview_get_template_settings( $instance['view_id'] );
185
+		$view_settings = gravityview_get_template_settings( $instance[ 'view_id' ] );
186 186
 
187 187
         // Set the context view ID to avoid conflicts with the Advanced Filter extension.
188
-        $criteria['context_view_id'] = $instance['view_id'];
188
+        $criteria[ 'context_view_id' ] = $instance[ 'view_id' ];
189 189
 
190
-		$instance['limit'] = isset( $instance['limit'] ) ? $instance['limit'] : 10;
191
-		$view_settings['id'] = $instance['view_id'];
192
-		$view_settings['page_size'] = $instance['limit'];
190
+		$instance[ 'limit' ] = isset( $instance[ 'limit' ] ) ? $instance[ 'limit' ] : 10;
191
+		$view_settings[ 'id' ] = $instance[ 'view_id' ];
192
+		$view_settings[ 'page_size' ] = $instance[ 'limit' ];
193 193
 
194 194
 		// Prepare paging criteria
195
-		$criteria['paging'] = array(
195
+		$criteria[ 'paging' ] = array(
196 196
 			'offset' => 0,
197
-			'page_size' => $instance['limit']
197
+			'page_size' => $instance[ 'limit' ]
198 198
 		);
199 199
 
200 200
 		// Prepare Search Criteria
201
-		$criteria['search_criteria'] = array( 'field_filters' => array() );
202
-		$criteria['search_criteria'] = GravityView_frontend::process_search_only_approved( $view_settings, $criteria['search_criteria']);
203
-		$criteria['search_criteria']['status'] = apply_filters( 'gravityview_status', 'active', $view_settings );
201
+		$criteria[ 'search_criteria' ] = array( 'field_filters' => array() );
202
+		$criteria[ 'search_criteria' ] = GravityView_frontend::process_search_only_approved( $view_settings, $criteria[ 'search_criteria' ] );
203
+		$criteria[ 'search_criteria' ][ 'status' ] = apply_filters( 'gravityview_status', 'active', $view_settings );
204 204
 
205 205
 		/**
206 206
 		 * Modify the search parameters before the entries are fetched
207 207
 		 */
208
-		$criteria = apply_filters('gravityview/widget/recent-entries/criteria', $criteria, $instance, $form_id );
208
+		$criteria = apply_filters( 'gravityview/widget/recent-entries/criteria', $criteria, $instance, $form_id );
209 209
 
210 210
 		$results = GVCommon::get_entries( $form_id, $criteria );
211 211
 
@@ -226,23 +226,23 @@  discard block
 block discarded – undo
226 226
 		$instance = $new_instance;
227 227
 
228 228
 		// Force positive number
229
-		$instance['limit'] = empty( $instance['limit'] ) ? 10 : absint( $instance['limit'] );
229
+		$instance[ 'limit' ] = empty( $instance[ 'limit' ] ) ? 10 : absint( $instance[ 'limit' ] );
230 230
 
231
-		$instance['view_id'] = intval( $instance['view_id'] );
231
+		$instance[ 'view_id' ] = intval( $instance[ 'view_id' ] );
232 232
 
233
-		$instance['link_format'] = trim( rtrim( $instance['link_format'] ) );
233
+		$instance[ 'link_format' ] = trim( rtrim( $instance[ 'link_format' ] ) );
234 234
 
235
-		$instance['link_format'] = empty( $instance['link_format'] ) ? $old_instance['link_format'] : $instance['link_format'];
235
+		$instance[ 'link_format' ] = empty( $instance[ 'link_format' ] ) ? $old_instance[ 'link_format' ] : $instance[ 'link_format' ];
236 236
 
237
-		$instance['post_id'] = empty( $instance['post_id'] ) ? '' : intval( $instance['post_id'] );
237
+		$instance[ 'post_id' ] = empty( $instance[ 'post_id' ] ) ? '' : intval( $instance[ 'post_id' ] );
238 238
 
239
-		$is_valid_embed_id = GravityView_View_Data::is_valid_embed_id( $instance['post_id'], $instance['view_id'] );
239
+		$is_valid_embed_id = GravityView_View_Data::is_valid_embed_id( $instance[ 'post_id' ], $instance[ 'view_id' ] );
240 240
 
241 241
 		//check if post_id is a valid post with embedded View
242
-		$instance['error_post_id'] = is_wp_error( $is_valid_embed_id ) ? $is_valid_embed_id->get_error_message() : NULL;
242
+		$instance[ 'error_post_id' ] = is_wp_error( $is_valid_embed_id ) ? $is_valid_embed_id->get_error_message() : NULL;
243 243
 
244 244
 		// Share that the widget isn't brand new
245
-		$instance['updated']  = 1;
245
+		$instance[ 'updated' ] = 1;
246 246
 
247 247
 		/**
248 248
 		 * Modify the updated instance. This will allow for validating any added instance settings externally.
@@ -264,22 +264,22 @@  discard block
 block discarded – undo
264 264
 
265 265
 		// Set up some default widget settings.
266 266
 		$defaults = array(
267
-			'title' 			=> __('Recent Entries', 'gravityview'),
267
+			'title' 			=> __( 'Recent Entries', 'gravityview' ),
268 268
 			'view_id'           => NULL,
269 269
 			'post_id'           => NULL,
270 270
 			'limit'            => 10,
271
-			'link_format'       => __('Entry #{entry_id}', 'gravityview'),
271
+			'link_format'       => __( 'Entry #{entry_id}', 'gravityview' ),
272 272
 			'after_link'        => ''
273 273
 		);
274 274
 
275
-		$instance = wp_parse_args( (array) $instance, $defaults );
275
+		$instance = wp_parse_args( (array)$instance, $defaults );
276 276
 
277 277
 		?>
278 278
 
279 279
 		<!-- Title -->
280 280
 		<p>
281 281
 			<label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php _e( 'Title:', 'gravityview' ) ?></label>
282
-			<input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" type="text" value="<?php echo esc_attr( $instance['title'] ); ?>" />
282
+			<input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" type="text" value="<?php echo esc_attr( $instance[ 'title' ] ); ?>" />
283 283
 		</p>
284 284
 
285 285
 		<!-- Download -->
@@ -292,7 +292,7 @@  discard block
 block discarded – undo
292 292
 		$views = get_posts( $args );
293 293
 
294 294
 		// If there are no views set up yet, we get outta here.
295
-		if( empty( $views ) ) {
295
+		if ( empty( $views ) ) {
296 296
 			echo '<div id="select_gravityview_view"><div class="wrap">' . GravityView_Admin::no_views_text() . '</div></div>';
297 297
 			return;
298 298
 		}
@@ -304,10 +304,10 @@  discard block
 block discarded – undo
304 304
 		 * Display errors generated for invalid embed IDs
305 305
 		 * @see GravityView_View_Data::is_valid_embed_id
306 306
 		 */
307
-		if( isset( $instance['updated'] ) && empty( $instance['view_id'] ) ) {
307
+		if ( isset( $instance[ 'updated' ] ) && empty( $instance[ 'view_id' ] ) ) {
308 308
 			?>
309 309
 			<div class="error inline hide-on-view-change">
310
-				<p><?php esc_html_e('Please select a View to search.', 'gravityview'); ?></p>
310
+				<p><?php esc_html_e( 'Please select a View to search.', 'gravityview' ); ?></p>
311 311
 			</div>
312 312
 			<?php
313 313
 			unset ( $error );
@@ -315,14 +315,14 @@  discard block
 block discarded – undo
315 315
 		?>
316 316
 
317 317
 		<p>
318
-			<label for="<?php echo esc_attr( $this->get_field_id( 'view_id' ) ); ?>"><?php esc_html_e('Select a View', 'gravityview'); ?></label>
318
+			<label for="<?php echo esc_attr( $this->get_field_id( 'view_id' ) ); ?>"><?php esc_html_e( 'Select a View', 'gravityview' ); ?></label>
319 319
 			<select class="widefat gv-recent-entries-select-view" name="<?php echo esc_attr( $this->get_field_name( 'view_id' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'view_id' ) ); ?>">
320 320
 				<option value=""><?php esc_html_e( '&mdash; Select a View as Entries Source &mdash;', 'gravityview' ); ?></option>
321 321
 				<?php
322 322
 
323
-				foreach( $views as $view ) {
324
-					$title = empty( $view->post_title ) ? __('(no title)', 'gravityview') : $view->post_title;
325
-					echo '<option value="'. $view->ID .'"'.selected( absint( $instance['view_id'] ), $view->ID ).'>'. esc_html( sprintf('%s #%d', $title, $view->ID ) ) .'</option>';
323
+				foreach ( $views as $view ) {
324
+					$title = empty( $view->post_title ) ? __( '(no title)', 'gravityview' ) : $view->post_title;
325
+					echo '<option value="' . $view->ID . '"' . selected( absint( $instance[ 'view_id' ] ), $view->ID ) . '>' . esc_html( sprintf( '%s #%d', $title, $view->ID ) ) . '</option>';
326 326
 				}
327 327
 
328 328
 				?>
@@ -334,10 +334,10 @@  discard block
 block discarded – undo
334 334
 		 * Display errors generated for invalid embed IDs
335 335
 		 * @see GravityView_View_Data::is_valid_embed_id
336 336
 		 */
337
-		if( !empty( $instance['error_post_id'] ) ) {
337
+		if ( ! empty( $instance[ 'error_post_id' ] ) ) {
338 338
 			?>
339 339
 			<div class="error inline">
340
-				<p><?php echo $instance['error_post_id']; ?></p>
340
+				<p><?php echo $instance[ 'error_post_id' ]; ?></p>
341 341
 			</div>
342 342
 			<?php
343 343
 			unset ( $error );
@@ -345,11 +345,11 @@  discard block
 block discarded – undo
345 345
 		?>
346 346
 
347 347
 		<p>
348
-			<label for="<?php echo $this->get_field_id('post_id'); ?>"><?php esc_html_e( 'If Embedded, Page ID:', 'gravityview' ); ?></label>
349
-			<input class="code" size="3" id="<?php echo $this->get_field_id('post_id'); ?>" name="<?php echo $this->get_field_name('post_id'); ?>" type="text" value="<?php echo esc_attr( $instance['post_id'] ); ?>" />
348
+			<label for="<?php echo $this->get_field_id( 'post_id' ); ?>"><?php esc_html_e( 'If Embedded, Page ID:', 'gravityview' ); ?></label>
349
+			<input class="code" size="3" id="<?php echo $this->get_field_id( 'post_id' ); ?>" name="<?php echo $this->get_field_name( 'post_id' ); ?>" type="text" value="<?php echo esc_attr( $instance[ 'post_id' ] ); ?>" />
350 350
 			<span class="howto"><?php
351
-				esc_html_e('To have a search performed on an embedded View, enter the ID of the post or page where the View is embedded.', 'gravityview' );
352
-				echo ' '.gravityview_get_link('http://docs.gravityview.co/article/222-the-search-widget', __('Learn more&hellip;', 'gravityview' ), 'target=_blank' );
351
+				esc_html_e( 'To have a search performed on an embedded View, enter the ID of the post or page where the View is embedded.', 'gravityview' );
352
+				echo ' ' . gravityview_get_link( 'http://docs.gravityview.co/article/222-the-search-widget', __( 'Learn more&hellip;', 'gravityview' ), 'target=_blank' );
353 353
 				?></span>
354 354
 		</p>
355 355
 
@@ -357,21 +357,21 @@  discard block
 block discarded – undo
357 357
 			<label for="<?php echo $this->get_field_id( 'limit' ); ?>">
358 358
 				<span><?php _e( 'Number of entries to show:', 'gravityview' ); ?></span>
359 359
 			</label>
360
-			<input class="code" id="<?php echo $this->get_field_id( 'limit' ); ?>" name="<?php echo $this->get_field_name( 'limit' ); ?>" type="number" value="<?php echo intval( $instance['limit'] ); ?>" size="3" />
360
+			<input class="code" id="<?php echo $this->get_field_id( 'limit' ); ?>" name="<?php echo $this->get_field_name( 'limit' ); ?>" type="number" value="<?php echo intval( $instance[ 'limit' ] ); ?>" size="3" />
361 361
 		</p>
362 362
 
363 363
 		<p>
364 364
 			<label for="<?php echo $this->get_field_id( 'link_format' ); ?>">
365 365
 				<span><?php _e( 'Entry link text (required)', 'gravityview' ); ?></span>
366 366
 			</label>
367
-			<input id="<?php echo $this->get_field_id( 'link_format' ); ?>" name="<?php echo $this->get_field_name( 'link_format' ); ?>" type="text" value="<?php echo esc_attr( $instance['link_format'] ); ?>" class="widefat merge-tag-support mt-position-right mt-hide_all_fields" />
367
+			<input id="<?php echo $this->get_field_id( 'link_format' ); ?>" name="<?php echo $this->get_field_name( 'link_format' ); ?>" type="text" value="<?php echo esc_attr( $instance[ 'link_format' ] ); ?>" class="widefat merge-tag-support mt-position-right mt-hide_all_fields" />
368 368
 		</p>
369 369
 
370 370
 		<p>
371 371
 			<label for="<?php echo $this->get_field_id( 'after_link' ); ?>">
372 372
 				<span><?php _e( 'Text or HTML to display after the link (optional)', 'gravityview' ); ?></span>
373 373
 			</label>
374
-			<textarea id="<?php echo $this->get_field_id( 'after_link' ); ?>" name="<?php echo $this->get_field_name( 'after_link' ); ?>" rows="5" class="widefat code merge-tag-support mt-position-right mt-hide_all_fields"><?php echo esc_textarea( $instance['after_link'] ); ?></textarea>
374
+			<textarea id="<?php echo $this->get_field_id( 'after_link' ); ?>" name="<?php echo $this->get_field_name( 'after_link' ); ?>" rows="5" class="widefat code merge-tag-support mt-position-right mt-hide_all_fields"><?php echo esc_textarea( $instance[ 'after_link' ] ); ?></textarea>
375 375
 		</p>
376 376
 
377 377
 		<?php
@@ -381,7 +381,7 @@  discard block
 block discarded – undo
381 381
 		 * @param GravityView_Recent_Entries_Widget $this WP_Widget object
382 382
 		 * @param array $instance Current widget instance
383 383
 		 */
384
-		do_action( 'gravityview_recent_entries_widget_form' , $this, $instance );
384
+		do_action( 'gravityview_recent_entries_widget_form', $this, $instance );
385 385
 
386 386
 		?>
387 387
 
Please login to merge, or discard this patch.
includes/class-gravityview-entry-approval-status.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -113,16 +113,16 @@  discard block
 block discarded – undo
113 113
 		$new_value = $old_value;
114 114
 
115 115
 		// Meta value does not exist yet
116
-		if( false === $old_value ) {
116
+		if ( false === $old_value ) {
117 117
 			return self::UNAPPROVED;
118 118
 		}
119 119
 
120 120
 		// Meta value does not exist yet
121
-		if( true === $old_value ) {
121
+		if ( true === $old_value ) {
122 122
 			return self::APPROVED;
123 123
 		}
124 124
 
125
-		switch ( (string) $old_value ) {
125
+		switch ( (string)$old_value ) {
126 126
 
127 127
 			// Approved values
128 128
 			case 'Approved':
@@ -247,9 +247,9 @@  discard block
 block discarded – undo
247 247
 		foreach ( $choices as $key => $choice ) {
248 248
 
249 249
 			// Is the passed status value the same as the choice value or key?
250
-			if ( $status === $choice['value'] || $status === $key ) {
250
+			if ( $status === $choice[ 'value' ] || $status === $key ) {
251 251
 
252
-				if( 'key' === $attr_key ) {
252
+				if ( 'key' === $attr_key ) {
253 253
 					return $key;
254 254
 				} else {
255 255
 					return rgar( $choice, $attr_key, false );
Please login to merge, or discard this patch.
includes/class-post-types.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
 		// Load even when invalid to allow for export
20 20
 		add_action( 'init', array( 'GravityView_Post_Types', 'init_post_types' ) );
21 21
 
22
-		if( GravityView_Compatibility::is_valid() ) {
22
+		if ( GravityView_Compatibility::is_valid() ) {
23 23
 			add_action( 'init', array( 'GravityView_Post_Types', 'init_rewrite' ) );
24 24
 		}
25 25
 	}
@@ -43,8 +43,8 @@  discard block
 block discarded – undo
43 43
 
44 44
 		$supports = array( 'title', 'revisions' );
45 45
 
46
-		if( $is_hierarchical ) {
47
-			$supports[] = 'page-attributes';
46
+		if ( $is_hierarchical ) {
47
+			$supports[ ] = 'page-attributes';
48 48
 		}
49 49
 
50 50
 		/**
Please login to merge, or discard this patch.
includes/extensions/entry-notes/class-gravityview-field-notes.php 1 patch
Spacing   +79 added lines, -79 removed lines patch added patch discarded remove patch
@@ -63,18 +63,18 @@  discard block
 block discarded – undo
63 63
 
64 64
 		add_shortcode( 'gv_note_add', array( 'GravityView_Field_Notes', 'get_add_note_part' ) );
65 65
 
66
-		add_action( 'wp', array( $this, 'maybe_delete_notes'), 1000 );
67
-		add_action( 'wp_ajax_nopriv_gv_delete_notes', array( $this, 'maybe_delete_notes') );
68
-		add_action( 'wp_ajax_gv_delete_notes', array( $this, 'maybe_delete_notes') );
66
+		add_action( 'wp', array( $this, 'maybe_delete_notes' ), 1000 );
67
+		add_action( 'wp_ajax_nopriv_gv_delete_notes', array( $this, 'maybe_delete_notes' ) );
68
+		add_action( 'wp_ajax_gv_delete_notes', array( $this, 'maybe_delete_notes' ) );
69 69
 
70
-		add_action( 'wp', array( $this, 'maybe_add_note'), 1000 );
71
-		add_action( 'wp_ajax_nopriv_gv_note_add', array( $this, 'maybe_add_note') );
72
-		add_action( 'wp_ajax_gv_note_add', array( $this, 'maybe_add_note') );
70
+		add_action( 'wp', array( $this, 'maybe_add_note' ), 1000 );
71
+		add_action( 'wp_ajax_nopriv_gv_note_add', array( $this, 'maybe_add_note' ) );
72
+		add_action( 'wp_ajax_gv_note_add', array( $this, 'maybe_add_note' ) );
73 73
 
74 74
 		// add template path to check for field
75 75
 		add_filter( 'gravityview_template_paths', array( $this, 'add_template_path' ) );
76 76
 
77
-		add_action( 'wp_enqueue_scripts', array( $this, 'register_scripts') );
77
+		add_action( 'wp_enqueue_scripts', array( $this, 'register_scripts' ) );
78 78
 		add_action( 'gravityview/field/notes/scripts', array( $this, 'enqueue_scripts' ) );
79 79
 		
80 80
 		add_filter( 'gravityview_entry_default_fields', array( $this, 'add_entry_default_field' ), 10, 3 );
@@ -96,8 +96,8 @@  discard block
 block discarded – undo
96 96
 	 */
97 97
 	public function add_entry_default_field( $entry_default_fields, $form, $zone ) {
98 98
 
99
-		if( in_array( $zone, array( 'directory', 'single' ) ) ) {
100
-			$entry_default_fields['notes'] = array(
99
+		if ( in_array( $zone, array( 'directory', 'single' ) ) ) {
100
+			$entry_default_fields[ 'notes' ] = array(
101 101
 				'label' => __( 'Entry Notes', 'gravityview' ),
102 102
 				'type'  => 'notes',
103 103
 				'desc'  => __( 'Display, add, and delete notes for an entry.', 'gravityview' ),
@@ -130,23 +130,23 @@  discard block
 block discarded – undo
130 130
 	public function enqueue_scripts() {
131 131
 		global $wp_actions;
132 132
 
133
-		if( ! wp_script_is( 'gravityview-notes', 'enqueued' ) ) {
133
+		if ( ! wp_script_is( 'gravityview-notes', 'enqueued' ) ) {
134 134
 			wp_enqueue_style( 'gravityview-notes' );
135 135
 			wp_enqueue_script( 'gravityview-notes' );
136 136
 		}
137 137
 
138
-		if( ! wp_script_is( 'gravityview-notes', 'done' ) ) {
138
+		if ( ! wp_script_is( 'gravityview-notes', 'done' ) ) {
139 139
 
140 140
 			$strings = self::strings();
141 141
 
142 142
 			wp_localize_script( 'gravityview-notes', 'GVNotes', array(
143 143
 				'ajaxurl' => admin_url( 'admin-ajax.php' ),
144 144
 				'text' => array(
145
-					'processing' => $strings['processing'],
146
-					'delete_confirm' => $strings['delete-confirm'],
147
-					'note_added' => $strings['added-note'],
148
-					'error_invalid' => $strings['error-invalid'],
149
-					'error_empty_note' => $strings['error-empty-note'],
145
+					'processing' => $strings[ 'processing' ],
146
+					'delete_confirm' => $strings[ 'delete-confirm' ],
147
+					'note_added' => $strings[ 'added-note' ],
148
+					'error_invalid' => $strings[ 'error-invalid' ],
149
+					'error_empty_note' => $strings[ 'error-empty-note' ],
150 150
 				),
151 151
 			) );
152 152
 		}
@@ -163,22 +163,22 @@  discard block
 block discarded – undo
163 163
 	 */
164 164
 	function maybe_add_note() {
165 165
 
166
-		if( ! GVCommon::has_cap( 'gravityview_add_entry_notes' ) ) {
166
+		if ( ! GVCommon::has_cap( 'gravityview_add_entry_notes' ) ) {
167 167
 			do_action( 'gravityview_log_error', __METHOD__ . ': The user isnt allowed to add entry notes.' );
168 168
 			return;
169 169
 		}
170 170
 
171
-		if( 'gv_note_add' === rgpost('action') ) {
171
+		if ( 'gv_note_add' === rgpost( 'action' ) ) {
172 172
 
173 173
 			$post = wp_unslash( $_POST );
174 174
 
175
-			if( $this->doing_ajax ) {
176
-				parse_str( $post['data'], $data );
175
+			if ( $this->doing_ajax ) {
176
+				parse_str( $post[ 'data' ], $data );
177 177
 			} else {
178 178
 				$data = $post;
179 179
 			}
180 180
 
181
-			$this->process_add_note( (array) $data );
181
+			$this->process_add_note( (array)$data );
182 182
 		}
183 183
 	}
184 184
 
@@ -205,23 +205,23 @@  discard block
 block discarded – undo
205 205
 		$error = false;
206 206
 		$success = false;
207 207
 
208
-		if( empty( $data['entry-slug'] ) ) {
208
+		if ( empty( $data[ 'entry-slug' ] ) ) {
209 209
 
210
-			$error = self::strings('error-invalid');
210
+			$error = self::strings( 'error-invalid' );
211 211
 			do_action( 'gravityview_log_error', __METHOD__ . ': The note is missing an Entry ID.' );
212 212
 
213 213
 		} else {
214 214
 
215
-			$valid = wp_verify_nonce( $data['gv_note_add'], 'gv_note_add_' . $data['entry-slug'] );
215
+			$valid = wp_verify_nonce( $data[ 'gv_note_add' ], 'gv_note_add_' . $data[ 'entry-slug' ] );
216 216
 			
217 217
 			$has_cap = GVCommon::has_cap( 'gravityview_add_entry_notes' );
218 218
 
219
-			if( ! $has_cap ) {
219
+			if ( ! $has_cap ) {
220 220
 				$error = self::strings( 'error-cap-add' );
221 221
 				do_action( 'gravityview_log_error', __METHOD__ . ': Adding a note failed: the user does not have the "gravityview_add_entry_notes" capability.' );
222 222
 			} elseif ( $valid ) {
223 223
 
224
-				$entry = gravityview_get_entry( $data['entry-slug'], true, false );
224
+				$entry = gravityview_get_entry( $data[ 'entry-slug' ], true, false );
225 225
 
226 226
 				$added = $this->add_note( $entry, $data );
227 227
 
@@ -239,22 +239,22 @@  discard block
 block discarded – undo
239 239
 					$this->maybe_send_entry_notes( $note, $entry, $data );
240 240
 
241 241
 					if ( $note ) {
242
-						$success = self::display_note( $note, ! empty( $data['show-delete'] ) );
243
-						do_action( 'gravityview_log_debug', __METHOD__ . ': The note was successfully created', compact('note', 'data') );
242
+						$success = self::display_note( $note, ! empty( $data[ 'show-delete' ] ) );
243
+						do_action( 'gravityview_log_debug', __METHOD__ . ': The note was successfully created', compact( 'note', 'data' ) );
244 244
 					} else {
245
-						$error = self::strings('error-add-note');
246
-						do_action( 'gravityview_log_error', __METHOD__ . ': The note was not successfully created', compact('note', 'data') );
245
+						$error = self::strings( 'error-add-note' );
246
+						do_action( 'gravityview_log_error', __METHOD__ . ': The note was not successfully created', compact( 'note', 'data' ) );
247 247
 					}
248 248
 				}
249 249
 			} else {
250
-				$error = self::strings('error-invalid');
250
+				$error = self::strings( 'error-invalid' );
251 251
 				do_action( 'gravityview_log_error', __METHOD__ . ': Nonce validation failed; the note was not created' );
252 252
 			}
253 253
 		}
254 254
 
255 255
 
256
-		if( $this->doing_ajax ) {
257
-			if( $success ) {
256
+		if ( $this->doing_ajax ) {
257
+			if ( $success ) {
258 258
 				wp_send_json_success( array( 'html' => $success ) );
259 259
 			} else {
260 260
 				$error = $error ? $error : self::strings( 'error-invalid' );
@@ -280,11 +280,11 @@  discard block
 block discarded – undo
280 280
 			return;
281 281
 		}
282 282
 
283
-		if ( isset( $_POST['action'] ) && 'gv_delete_notes' === $_POST['action'] ) {
283
+		if ( isset( $_POST[ 'action' ] ) && 'gv_delete_notes' === $_POST[ 'action' ] ) {
284 284
 
285 285
 			$post = wp_unslash( $_POST );
286 286
 			if ( $this->doing_ajax ) {
287
-				parse_str( $post['data'], $data );
287
+				parse_str( $post[ 'data' ], $data );
288 288
 			} else {
289 289
 				$data = $post;
290 290
 			}
@@ -315,18 +315,18 @@  discard block
 block discarded – undo
315 315
 	 */
316 316
 	function process_delete_notes( $data ) {
317 317
 
318
-		$valid = wp_verify_nonce( $data['gv_delete_notes'], 'gv_delete_notes_' . $data['entry-slug'] );
318
+		$valid = wp_verify_nonce( $data[ 'gv_delete_notes' ], 'gv_delete_notes_' . $data[ 'entry-slug' ] );
319 319
 		$has_cap = GVCommon::has_cap( 'gravityview_delete_entry_notes' );
320 320
 		$success = false;
321 321
 
322 322
 		if ( $valid && $has_cap ) {
323
-			GravityView_Entry_Notes::delete_notes( $data['note'] );
323
+			GravityView_Entry_Notes::delete_notes( $data[ 'note' ] );
324 324
 			$success = true;
325 325
 		}
326 326
 
327
-		if( $this->doing_ajax ) {
327
+		if ( $this->doing_ajax ) {
328 328
 
329
-			if( $success ) {
329
+			if ( $success ) {
330 330
 				wp_send_json_success();
331 331
 			} else {
332 332
 				if ( ! $valid ) {
@@ -359,13 +359,13 @@  discard block
 block discarded – undo
359 359
 
360 360
 	public function field_options( $field_options, $template_id, $field_id, $context, $input_type ) {
361 361
 
362
-		unset( $field_options['show_as_link'] );
362
+		unset( $field_options[ 'show_as_link' ] );
363 363
 
364 364
 		$notes_options = array(
365 365
 			'notes' => array(
366 366
 				'type' => 'checkboxes',
367
-				'label' => __('Note Settings', 'gravityview'),
368
-				'desc' => sprintf( _x('Only users with specific capabilities will be able to view, add and delete notes. %sRead more%s.', '%s is opening and closing HTML link', 'gravityview' ), '<a href="https://docs.gravityview.co/article/311-gravityview-capabilities">', '</a>' ),
367
+				'label' => __( 'Note Settings', 'gravityview' ),
368
+				'desc' => sprintf( _x( 'Only users with specific capabilities will be able to view, add and delete notes. %sRead more%s.', '%s is opening and closing HTML link', 'gravityview' ), '<a href="https://docs.gravityview.co/article/311-gravityview-capabilities">', '</a>' ),
369 369
 				'options' => array(
370 370
 					'view' => array(
371 371
 						'label' => __( 'Display notes?', 'gravityview' ),
@@ -417,7 +417,7 @@  discard block
 block discarded – undo
417 417
 			'processing' => __( 'Processing&hellip;', 'gravityview' ),
418 418
 			'other-email' => __( 'Other email address', 'gravityview' ),
419 419
 			'email-label' => __( 'Email address', 'gravityview' ),
420
-			'email-placeholder' => _x('[email protected]', 'Example email address used as a placeholder', 'gravityview'),
420
+			'email-placeholder' => _x( '[email protected]', 'Example email address used as a placeholder', 'gravityview' ),
421 421
 			'subject-label' => __( 'Subject', 'gravityview' ),
422 422
 			'subject' => __( 'Email subject', 'gravityview' ),
423 423
 			'default-email-subject' => __( 'New entry note', 'gravityview' ),
@@ -437,7 +437,7 @@  discard block
 block discarded – undo
437 437
 		 */
438 438
 		$strings = gv_map_deep( apply_filters( 'gravityview/field/notes/strings', $strings ), 'esc_html' );
439 439
 
440
-		if( $key ) {
440
+		if ( $key ) {
441 441
 			return isset( $strings[ $key ] ) ? $strings[ $key ] : '';
442 442
 		}
443 443
 
@@ -456,7 +456,7 @@  discard block
 block discarded – undo
456 456
 	 */
457 457
 	static public function display_note( $note, $show_delete = false ) {
458 458
 
459
-		if( ! is_object( $note ) ) {
459
+		if ( ! is_object( $note ) ) {
460 460
 			return '';
461 461
 		}
462 462
 
@@ -497,7 +497,7 @@  discard block
 block discarded – undo
497 497
 		$note_row = ob_get_clean();
498 498
 
499 499
 		$replacements = array(
500
-			'{note_id}' => $note_content['note_id'],
500
+			'{note_id}' => $note_content[ 'note_id' ],
501 501
 			'{row_class}' => 'gv-note',
502 502
 			'{note_detail}' => $note_detail_html
503 503
 		);
@@ -529,13 +529,13 @@  discard block
 block discarded – undo
529 529
 
530 530
 		$user_data = get_userdata( $current_user->ID );
531 531
 
532
-		$note_content = trim( $data['gv-note-content'] );
532
+		$note_content = trim( $data[ 'gv-note-content' ] );
533 533
 
534
-		if( empty( $note_content ) ) {
534
+		if ( empty( $note_content ) ) {
535 535
 			return new WP_Error( 'gv-add-note-empty', __( 'The note is empty.', 'gravityview' ) );
536 536
 		}
537 537
 
538
-		$return = GravityView_Entry_Notes::add_note( $entry['id'], $user_data->ID, $user_data->display_name, $note_content, 'gravityview/field/notes' );
538
+		$return = GravityView_Entry_Notes::add_note( $entry[ 'id' ], $user_data->ID, $user_data->display_name, $note_content, 'gravityview/field/notes' );
539 539
 
540 540
 		return $return;
541 541
 	}
@@ -551,7 +551,7 @@  discard block
 block discarded – undo
551 551
 	 */
552 552
 	public static function get_add_note_part() {
553 553
 
554
-		if( ! GVCommon::has_cap( 'gravityview_add_entry_notes' ) ) {
554
+		if ( ! GVCommon::has_cap( 'gravityview_add_entry_notes' ) ) {
555 555
 			do_action( 'gravityview_log_error', __METHOD__ . ': User does not have permission to add entry notes ("gravityview_add_entry_notes").' );
556 556
 			return '';
557 557
 		}
@@ -564,19 +564,19 @@  discard block
 block discarded – undo
564 564
 
565 565
 		$visibility_settings = $gravityview_view->getCurrentFieldSetting( 'notes' );
566 566
 		$entry = $gravityview_view->getCurrentEntry();
567
-		$entry_slug = GravityView_API::get_entry_slug( $entry['id'], $entry );
567
+		$entry_slug = GravityView_API::get_entry_slug( $entry[ 'id' ], $entry );
568 568
 		$nonce_field = wp_nonce_field( 'gv_note_add_' . $entry_slug, 'gv_note_add', false, false );
569 569
 
570 570
 		// Only generate the dropdown if the field settings allow it
571 571
 		$email_fields = '';
572
-		if( ! empty( $visibility_settings['email'] ) ) {
572
+		if ( ! empty( $visibility_settings[ 'email' ] ) ) {
573 573
 			$email_fields = self::get_note_email_fields( $entry_slug );
574 574
 		}
575 575
 
576 576
 		$add_note_html = str_replace( '{entry_slug}', $entry_slug, $add_note_html );
577 577
 		$add_note_html = str_replace( '{nonce_field}', $nonce_field, $add_note_html );
578
-		$add_note_html = str_replace( '{show_delete}', intval( $visibility_settings['delete'] ), $add_note_html );
579
-		$add_note_html   = str_replace( '{email_fields}', $email_fields, $add_note_html );
578
+		$add_note_html = str_replace( '{show_delete}', intval( $visibility_settings[ 'delete' ] ), $add_note_html );
579
+		$add_note_html = str_replace( '{email_fields}', $email_fields, $add_note_html );
580 580
 		$add_note_html = str_replace( '{url}', esc_url_raw( add_query_arg( array() ) ), $add_note_html );
581 581
 
582 582
 		return $add_note_html;
@@ -601,8 +601,8 @@  discard block
 block discarded – undo
601 601
 		$note_emails = array();
602 602
 
603 603
 		foreach ( $email_fields as $email_field ) {
604
-			if ( ! empty( $entry["{$email_field->id}"] ) && is_email( $entry["{$email_field->id}"] ) ) {
605
-				$note_emails[] = $entry["{$email_field->id}"];
604
+			if ( ! empty( $entry[ "{$email_field->id}" ] ) && is_email( $entry[ "{$email_field->id}" ] ) ) {
605
+				$note_emails[ ] = $entry[ "{$email_field->id}" ];
606 606
 			}
607 607
 		}
608 608
 
@@ -614,7 +614,7 @@  discard block
 block discarded – undo
614 614
 		 */
615 615
 		$note_emails = apply_filters( 'gravityview/field/notes/emails', $note_emails, $entry );
616 616
 
617
-		return (array) $note_emails;
617
+		return (array)$note_emails;
618 618
 	}
619 619
 
620 620
 	/**
@@ -630,7 +630,7 @@  discard block
 block discarded – undo
630 630
 	 */
631 631
 	private static function get_note_email_fields( $entry_slug = '' ) {
632 632
 
633
-		if( ! GVCommon::has_cap( 'gravityview_email_entry_notes' ) ) {
633
+		if ( ! GVCommon::has_cap( 'gravityview_email_entry_notes' ) ) {
634 634
 			do_action( 'gravityview_log_error', __METHOD__ . ': User does not have permission to email entry notes ("gravityview_email_entry_notes").' );
635 635
 			return '';
636 636
 		}
@@ -652,27 +652,27 @@  discard block
 block discarded – undo
652 652
 
653 653
 		if ( ! empty( $note_emails ) || $include_custom ) { ?>
654 654
 			<div class="gv-note-email-container">
655
-				<label for="gv-note-email-to-<?php echo $entry_slug_esc; ?>" class="screen-reader-text"><?php echo $strings['also-email'];  ?></label>
655
+				<label for="gv-note-email-to-<?php echo $entry_slug_esc; ?>" class="screen-reader-text"><?php echo $strings[ 'also-email' ]; ?></label>
656 656
 				<select class="gv-note-email-to" name="gv-note-to" id="gv-note-email-to-<?php echo $entry_slug_esc; ?>">
657
-					<option value=""><?php echo $strings['also-email'];  ?></option>
657
+					<option value=""><?php echo $strings[ 'also-email' ]; ?></option>
658 658
 					<?php foreach ( $note_emails as  $email ) {
659 659
 						?>
660 660
 						<option value="<?php echo esc_attr( $email ); ?>"><?php echo esc_html( $email ); ?></option>
661 661
 					<?php }
662
-					if( $include_custom ) { ?>
663
-					<option value="custom"><?php echo self::strings('other-email'); ?></option>
662
+					if ( $include_custom ) { ?>
663
+					<option value="custom"><?php echo self::strings( 'other-email' ); ?></option>
664 664
 					<?php } ?>
665 665
 				</select>
666 666
 				<fieldset class="gv-note-to-container">
667
-					<?php if( $include_custom ) { ?>
667
+					<?php if ( $include_custom ) { ?>
668 668
 					<div class='gv-note-to-custom-container'>
669
-						<label for="gv-note-email-to-custom-<?php echo $entry_slug_esc; ?>"><?php echo $strings['email-label']; ?></label>
670
-						<input type="text" name="gv-note-to-custom" placeholder="<?php echo $strings['email-placeholder']; ?>" id="gv-note-to-custom-<?php echo $entry_slug_esc; ?>" value="" />
669
+						<label for="gv-note-email-to-custom-<?php echo $entry_slug_esc; ?>"><?php echo $strings[ 'email-label' ]; ?></label>
670
+						<input type="text" name="gv-note-to-custom" placeholder="<?php echo $strings[ 'email-placeholder' ]; ?>" id="gv-note-to-custom-<?php echo $entry_slug_esc; ?>" value="" />
671 671
 					</div>
672 672
 					<?php } ?>
673 673
 		            <div class='gv-note-subject-container'>
674
-		                <label for="gv-note-subject-<?php echo $entry_slug_esc; ?>"><?php echo $strings['subject-label']; ?></label>
675
-		                <input type="text" name="gv-note-subject" placeholder="<?php echo $strings['subject']; ?>" id="gv-note-subject-<?php echo $entry_slug_esc; ?>" value="" />
674
+		                <label for="gv-note-subject-<?php echo $entry_slug_esc; ?>"><?php echo $strings[ 'subject-label' ]; ?></label>
675
+		                <input type="text" name="gv-note-subject" placeholder="<?php echo $strings[ 'subject' ]; ?>" id="gv-note-subject-<?php echo $entry_slug_esc; ?>" value="" />
676 676
 		            </div>
677 677
 				</fieldset>
678 678
 			</div>
@@ -695,7 +695,7 @@  discard block
 block discarded – undo
695 695
 	 */
696 696
 	private function maybe_send_entry_notes( $note = false, $entry, $data ) {
697 697
 
698
-		if( ! $note || ! GVCommon::has_cap('gravityview_email_entry_notes') ) {
698
+		if ( ! $note || ! GVCommon::has_cap( 'gravityview_email_entry_notes' ) ) {
699 699
 			do_action( 'gravityview_log_debug', __METHOD__ . ': User doesnt have "gravityview_email_entry_notes" cap, or $note is empty', $note );
700 700
 			return;
701 701
 		}
@@ -703,7 +703,7 @@  discard block
 block discarded – undo
703 703
 		do_action( 'gravityview_log_debug', __METHOD__ . ': $data', $data );
704 704
 
705 705
 		//emailing notes if configured
706
-		if ( ! empty( $data['gv-note-to'] ) ) {
706
+		if ( ! empty( $data[ 'gv-note-to' ] ) ) {
707 707
 
708 708
 			$default_data = array(
709 709
 				'gv-note-to' => '',
@@ -713,11 +713,11 @@  discard block
 block discarded – undo
713 713
                 'current-url' => '',
714 714
 			);
715 715
 
716
-			$current_user  = wp_get_current_user();
716
+			$current_user = wp_get_current_user();
717 717
 			$email_data = wp_parse_args( $data, $default_data );
718 718
 
719
-			$from    = $current_user->user_email;
720
-			$to = $email_data['gv-note-to'];
719
+			$from = $current_user->user_email;
720
+			$to = $email_data[ 'gv-note-to' ];
721 721
 
722 722
 			/**
723 723
 			 * Documented in get_note_email_fields
@@ -725,8 +725,8 @@  discard block
 block discarded – undo
725 725
 			 */
726 726
 			$include_custom = apply_filters( 'gravityview/field/notes/custom-email', true );
727 727
 
728
-			if( 'custom' === $to && $include_custom ) {
729
-				$to = $email_data['gv-note-to-custom'];
728
+			if ( 'custom' === $to && $include_custom ) {
729
+				$to = $email_data[ 'gv-note-to-custom' ];
730 730
 				do_action( 'gravityview_log_debug', __METHOD__ . ': Sending note to a custom email address: ' . $to );
731 731
 			}
732 732
 
@@ -737,13 +737,13 @@  discard block
 block discarded – undo
737 737
 
738 738
 			$bcc = false;
739 739
 			$reply_to = $from;
740
-			$subject = trim( $email_data['gv-note-subject'] );
740
+			$subject = trim( $email_data[ 'gv-note-subject' ] );
741 741
 
742 742
 			// We use empty() here because GF uses empty to check against, too. `0` isn't a valid subject to GF
743 743
 			$subject = empty( $subject ) ? self::strings( 'default-email-subject' ) : $subject;
744
-			$message = $email_data['gv-note-content'];
744
+			$message = $email_data[ 'gv-note-content' ];
745 745
 			$email_footer = self::strings( 'email-footer' );
746
-			$from_name     = $current_user->display_name;
746
+			$from_name = $current_user->display_name;
747 747
 			$message_format = 'html';
748 748
 
749 749
 			/**
@@ -774,7 +774,7 @@  discard block
 block discarded – undo
774 774
 
775 775
 			GVCommon::send_email( $from, $to, $bcc, $reply_to, $subject, $message, $from_name, $message_format, '', $entry, false );
776 776
 
777
-			$form  = isset( $entry['form_id'] ) ? GFAPI::get_form( $entry['form_id'] ) : array();
777
+			$form = isset( $entry[ 'form_id' ] ) ? GFAPI::get_form( $entry[ 'form_id' ] ) : array();
778 778
 
779 779
 			/**
780 780
 			 * @see https://www.gravityhelp.com/documentation/article/10146-2/ It's here for compatibility with Gravity Forms
@@ -800,7 +800,7 @@  discard block
 block discarded – undo
800 800
 
801 801
 	    $output = '';
802 802
 
803
-		if( ! empty( $email_footer ) ) {
803
+		if ( ! empty( $email_footer ) ) {
804 804
 		    $url = rgar( $email_data, 'current-url' );
805 805
 			$url = html_entity_decode( $url );
806 806
 			$url = site_url( $url );
Please login to merge, or discard this patch.
includes/class-cache.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
 		/**
80 80
 		 * @see RGFormsModel::update_lead_property() Trigger when any entry property changes
81 81
 		 */
82
-		foreach( $this->lead_db_columns as $column ) {
82
+		foreach ( $this->lead_db_columns as $column ) {
83 83
 			add_action( 'gform_update_' . $column, array( $this, 'entry_status_changed' ), 10, 3 );
84 84
 		}
85 85
 
@@ -112,9 +112,9 @@  discard block
 block discarded – undo
112 112
 			return;
113 113
 		}
114 114
 
115
-		do_action( 'gravityview_log_debug', __METHOD__ . ' adding form ' . $entry['form_id'] . ' to blacklist because entry #' . $lead_id . ' was deleted', array( 'value' => $property_value, 'previous' => $previous_value ) );
115
+		do_action( 'gravityview_log_debug', __METHOD__ . ' adding form ' . $entry[ 'form_id' ] . ' to blacklist because entry #' . $lead_id . ' was deleted', array( 'value' => $property_value, 'previous' => $previous_value ) );
116 116
 		
117
-		$this->blacklist_add( $entry['form_id'] );
117
+		$this->blacklist_add( $entry[ 'form_id' ] );
118 118
 	}
119 119
 
120 120
 	/**
@@ -127,9 +127,9 @@  discard block
 block discarded – undo
127 127
 	 */
128 128
 	public function entry_updated( $form, $lead_id ) {
129 129
 
130
-		do_action( 'gravityview_log_debug', 'GravityView_Cache[entry_updated] adding form ' . $form['id'] . ' to blacklist because entry #' . $lead_id . ' was updated' );
130
+		do_action( 'gravityview_log_debug', 'GravityView_Cache[entry_updated] adding form ' . $form[ 'id' ] . ' to blacklist because entry #' . $lead_id . ' was updated' );
131 131
 
132
-		$this->blacklist_add( $form['id'] );
132
+		$this->blacklist_add( $form[ 'id' ] );
133 133
 	}
134 134
 
135 135
 	/**
@@ -144,9 +144,9 @@  discard block
 block discarded – undo
144 144
 	 */
145 145
 	public function entry_created( $entry, $form ) {
146 146
 
147
-		do_action( 'gravityview_log_debug', 'GravityView_Cache[entry_created] adding form ' . $form['id'] . ' to blacklist because entry #' . $entry['id'] . ' was created' );
147
+		do_action( 'gravityview_log_debug', 'GravityView_Cache[entry_created] adding form ' . $form[ 'id' ] . ' to blacklist because entry #' . $entry[ 'id' ] . ' was created' );
148 148
 
149
-		$this->blacklist_add( $form['id'] );
149
+		$this->blacklist_add( $form[ 'id' ] );
150 150
 	}
151 151
 
152 152
 	/**
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
 		// Normally just one form, but supports multiple forms
166 166
 		//
167 167
 		// Array of IDs 12, 5, 14 would result in `f-12f-5f-14`
168
-		$forms = 'f:' . implode( '&f:', (array) $form_ids );
168
+		$forms = 'f:' . implode( '&f:', (array)$form_ids );
169 169
 
170 170
 		// Prefix for transient keys
171 171
 		// Now the prefix would be: `gv-cache-f-12f-5f-14`
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
 		) );
223 223
 
224 224
 		// Add the passed form IDs
225
-		$blacklist = array_merge( (array) $blacklist, $form_ids );
225
+		$blacklist = array_merge( (array)$blacklist, $form_ids );
226 226
 
227 227
 		// Don't duplicate
228 228
 		$blacklist = array_unique( $blacklist );
@@ -242,7 +242,7 @@  discard block
 block discarded – undo
242 242
 
243 243
 		$blacklist = get_option( self::BLACKLIST_OPTION_NAME, array() );
244 244
 
245
-		$updated_list = array_diff( $blacklist, (array) $form_ids );
245
+		$updated_list = array_diff( $blacklist, (array)$form_ids );
246 246
 
247 247
 		do_action( 'gravityview_log_debug', 'GravityView_Cache[blacklist_remove] Removing form IDs from cache blacklist', array(
248 248
 			'$form_ids'     => $form_ids,
@@ -275,7 +275,7 @@  discard block
 block discarded – undo
275 275
 			return false;
276 276
 		}
277 277
 
278
-		foreach ( (array) $form_ids as $form_id ) {
278
+		foreach ( (array)$form_ids as $form_id ) {
279 279
 
280 280
 			if ( in_array( $form_id, $blacklist ) ) {
281 281
 
@@ -347,7 +347,7 @@  discard block
 block discarded – undo
347 347
 			 * @filter `gravityview_cache_time_{$filter_name}` Modify the cache time for a type of cache
348 348
 			 * @param int $time_in_seconds Default: `DAY_IN_SECONDS`
349 349
 			 */
350
-			$cache_time = (int) apply_filters( 'gravityview_cache_time_' . $filter_name, DAY_IN_SECONDS );
350
+			$cache_time = (int)apply_filters( 'gravityview_cache_time_' . $filter_name, DAY_IN_SECONDS );
351 351
 
352 352
 			do_action( 'gravityview_log_debug', 'GravityView_Cache[set] Setting cache with transient key ' . $this->key . ' for ' . $cache_time . ' seconds' );
353 353
 
@@ -383,7 +383,7 @@  discard block
 block discarded – undo
383 383
 			return;
384 384
 		}
385 385
 
386
-		foreach ( (array) $form_ids as $form_id ) {
386
+		foreach ( (array)$form_ids as $form_id ) {
387 387
 
388 388
 			$key = $this->get_cache_key_prefix( $form_id );
389 389
 
@@ -497,7 +497,7 @@  discard block
 block discarded – undo
497 497
 
498 498
 		if ( GVCommon::has_cap( 'edit_gravityviews' ) ) {
499 499
 
500
-			if ( isset( $_GET['cache'] ) || isset( $_GET['nocache'] ) ) {
500
+			if ( isset( $_GET[ 'cache' ] ) || isset( $_GET[ 'nocache' ] ) ) {
501 501
 
502 502
 				do_action( 'gravityview_log_debug', 'GravityView_Cache[use_cache] Not using cache: ?cache or ?nocache is in the URL' );
503 503
 
@@ -526,7 +526,7 @@  discard block
 block discarded – undo
526 526
 		 */
527 527
 		$use_cache = apply_filters( 'gravityview_use_cache', $use_cache, $this );
528 528
 
529
-		return (boolean) $use_cache;
529
+		return (boolean)$use_cache;
530 530
 	}
531 531
 
532 532
 }
Please login to merge, or discard this patch.
includes/class-gravityview-shortcode.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -49,8 +49,8 @@  discard block
 block discarded – undo
49 49
 		do_action( 'gravityview_log_debug', __FUNCTION__ . ' $passed_atts: ', $passed_atts );
50 50
 
51 51
 		// Get details about the current View
52
-		if( !empty( $passed_atts['detail'] ) ) {
53
-			return $this->get_view_detail( $passed_atts['detail'] );
52
+		if ( ! empty( $passed_atts[ 'detail' ] ) ) {
53
+			return $this->get_view_detail( $passed_atts[ 'detail' ] );
54 54
 		}
55 55
 
56 56
 		$atts = $this->parse_and_sanitize_atts( $passed_atts );
@@ -86,16 +86,16 @@  discard block
 block discarded – undo
86 86
 		$filtered_atts = shortcode_atts( $supported_atts, $passed_atts, 'gravityview' );
87 87
 
88 88
 		// Only keep the passed attributes after making sure that they're valid pairs
89
-		$filtered_atts = function_exists( 'array_intersect_key' ) ? array_intersect_key( (array) $passed_atts, $filtered_atts ) : $filtered_atts;
89
+		$filtered_atts = function_exists( 'array_intersect_key' ) ? array_intersect_key( (array)$passed_atts, $filtered_atts ) : $filtered_atts;
90 90
 
91 91
 		$atts = array();
92 92
 
93
-		foreach( $filtered_atts as $key => $passed_value ) {
93
+		foreach ( $filtered_atts as $key => $passed_value ) {
94 94
 
95 95
 			// Allow using GravityView merge tags in shortcode attributes, like {get} and {created_by}
96 96
 			$passed_value = GravityView_Merge_Tags::replace_variables( $passed_value );
97 97
 
98
-			switch( $defaults[ $key ]['type'] ) {
98
+			switch ( $defaults[ $key ][ 'type' ] ) {
99 99
 
100 100
 				/**
101 101
 				 * Make sure number fields are numeric.
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
 				 * @see http://php.net/manual/en/function.is-numeric.php#107326
104 104
 				 */
105 105
 				case 'number':
106
-					if( is_numeric( $passed_value ) ) {
106
+					if ( is_numeric( $passed_value ) ) {
107 107
 						$atts[ $key ] = ( $passed_value + 0 );
108 108
 					}
109 109
 					break;
@@ -118,8 +118,8 @@  discard block
 block discarded – undo
118 118
 				 */
119 119
 				case 'select':
120 120
 				case 'radio':
121
-					$options = isset( $defaults[ $key ]['choices'] ) ? $defaults[ $key ]['choices'] : $defaults[ $key ]['options'];
122
-					if( in_array( $passed_value, array_keys( $options ) ) ) {
121
+					$options = isset( $defaults[ $key ][ 'choices' ] ) ? $defaults[ $key ][ 'choices' ] : $defaults[ $key ][ 'options' ];
122
+					if ( in_array( $passed_value, array_keys( $options ) ) ) {
123 123
 						$atts[ $key ] = $passed_value;
124 124
 					}
125 125
 					break;
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
 		$gravityview_view = GravityView_View::getInstance();
149 149
 		$return = '';
150 150
 
151
-		switch( $detail ) {
151
+		switch ( $detail ) {
152 152
 			case 'total_entries':
153 153
 				$return = number_format_i18n( $gravityview_view->getTotalEntries() );
154 154
 				break;
Please login to merge, or discard this patch.
includes/class-gravityview-entry-approval.php 1 patch
Spacing   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -39,13 +39,13 @@  discard block
 block discarded – undo
39 39
 	private function add_hooks() {
40 40
 
41 41
 		// in case entry is edited (on admin or frontend)
42
-		add_action( 'gform_after_update_entry', array( $this, 'after_update_entry_update_approved_meta' ), 10, 2);
42
+		add_action( 'gform_after_update_entry', array( $this, 'after_update_entry_update_approved_meta' ), 10, 2 );
43 43
 
44 44
 		// when using the User opt-in field, check on entry submission
45 45
 		add_action( 'gform_after_submission', array( $this, 'after_submission' ), 10, 2 );
46 46
 
47 47
 		// process ajax approve entry requests
48
-		add_action('wp_ajax_gv_update_approved', array( $this, 'ajax_update_approved'));
48
+		add_action( 'wp_ajax_gv_update_approved', array( $this, 'ajax_update_approved' ) );
49 49
 
50 50
 	}
51 51
 
@@ -62,13 +62,13 @@  discard block
 block discarded – undo
62 62
 	 */
63 63
 	public static function get_entry_status( $entry, $value_or_label = 'label' ) {
64 64
 
65
-		$entry_id = is_array( $entry ) ? $entry['id'] : GVCommon::get_entry_id( $entry );
65
+		$entry_id = is_array( $entry ) ? $entry[ 'id' ] : GVCommon::get_entry_id( $entry );
66 66
 
67 67
 		$status = gform_get_meta( $entry_id, self::meta_key );
68 68
 
69 69
 		$status = GravityView_Entry_Approval_Status::maybe_convert_status( $status );
70 70
 
71
-		if( 'value' === $value_or_label ) {
71
+		if ( 'value' === $value_or_label ) {
72 72
 			return $status;
73 73
 		}
74 74
 
@@ -93,16 +93,16 @@  discard block
 block discarded – undo
93 93
 	 */
94 94
 	public function ajax_update_approved() {
95 95
 
96
-		$form_id = intval( rgpost('form_id') );
96
+		$form_id = intval( rgpost( 'form_id' ) );
97 97
 
98
-		$entry_id = GVCommon::get_entry_id( rgpost('entry_slug') );
98
+		$entry_id = GVCommon::get_entry_id( rgpost( 'entry_slug' ) );
99 99
 
100
-		$approval_status = rgpost('approved');
100
+		$approval_status = rgpost( 'approved' );
101 101
 
102
-		$nonce = rgpost('nonce');
102
+		$nonce = rgpost( 'nonce' );
103 103
 
104 104
 		// Valid status
105
-		if( ! GravityView_Entry_Approval_Status::is_valid( $approval_status ) ) {
105
+		if ( ! GravityView_Entry_Approval_Status::is_valid( $approval_status ) ) {
106 106
 
107 107
 			do_action( 'gravityview_log_error', __METHOD__ . ': Invalid approval status', $_POST );
108 108
 
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
 
134 134
 			do_action( 'gravityview_log_error', __METHOD__ . ' User does not have the `gravityview_moderate_entries` capability.' );
135 135
 
136
-			$result = new WP_Error( 'Missing Cap: gravityview_moderate_entries', __( 'You do not have permission to edit this entry.', 'gravityview') );
136
+			$result = new WP_Error( 'Missing Cap: gravityview_moderate_entries', __( 'You do not have permission to edit this entry.', 'gravityview' ) );
137 137
 
138 138
 		}
139 139
 
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
 	 * @param $form array Gravity Forms form object
167 167
 	 */
168 168
 	public function after_submission( $entry, $form ) {
169
-		$this->after_update_entry_update_approved_meta( $form , $entry['id'] );
169
+		$this->after_update_entry_update_approved_meta( $form, $entry[ 'id' ] );
170 170
 	}
171 171
 
172 172
 	/**
@@ -180,18 +180,18 @@  discard block
 block discarded – undo
180 180
 	 */
181 181
 	public function after_update_entry_update_approved_meta( $form, $entry_id = NULL ) {
182 182
 
183
-		$approved_column = self::get_approved_column( $form['id'] );
183
+		$approved_column = self::get_approved_column( $form[ 'id' ] );
184 184
 
185 185
 		/**
186 186
 		 * If the form doesn't contain the approve field, don't assume anything.
187 187
 		 */
188
-		if( empty( $approved_column ) ) {
188
+		if ( empty( $approved_column ) ) {
189 189
 			return;
190 190
 		}
191 191
 
192 192
 		$entry = GFAPI::get_entry( $entry_id );
193 193
 
194
-		self::update_approved_meta( $entry_id, $entry[ (string)$approved_column ], $form['id'] );
194
+		self::update_approved_meta( $entry_id, $entry[ (string)$approved_column ], $form[ 'id' ] );
195 195
 	}
196 196
 
197 197
 	/**
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
 
231 231
 		$success = true;
232 232
 		foreach ( $entries as $entry_id ) {
233
-			$update_success = self::update_approved( (int) $entry_id, $approved, $form_id, $approved_column_id );
233
+			$update_success = self::update_approved( (int)$entry_id, $approved, $form_id, $approved_column_id );
234 234
 
235 235
 			if ( ! $update_success ) {
236 236
 				$success = false;
@@ -256,12 +256,12 @@  discard block
 block discarded – undo
256 256
 	 */
257 257
 	public static function update_approved( $entry_id = 0, $approved = 0, $form_id = 0, $approvedcolumn = 0 ) {
258 258
 
259
-		if( !class_exists( 'GFAPI' ) ) {
259
+		if ( ! class_exists( 'GFAPI' ) ) {
260 260
 			do_action( 'gravityview_log_error', __METHOD__ . 'GFAPI does not exist' );
261 261
 			return false;
262 262
 		}
263 263
 
264
-		if( ! GravityView_Entry_Approval_Status::is_valid( $approved ) ) {
264
+		if ( ! GravityView_Entry_Approval_Status::is_valid( $approved ) ) {
265 265
 			do_action( 'gravityview_log_error', __METHOD__ . ': Not a valid approval value.' );
266 266
 			return false;
267 267
 		}
@@ -278,7 +278,7 @@  discard block
 block discarded – undo
278 278
 		// If the form has an Approve/Reject field, update that value
279 279
 		$result = self::update_approved_column( $entry_id, $approved, $form_id, $approvedcolumn );
280 280
 
281
-		if( is_wp_error( $result ) ) {
281
+		if ( is_wp_error( $result ) ) {
282 282
 			do_action( 'gravityview_log_error', __METHOD__ . sprintf( ' - Entry approval not updated: %s', $result->get_error_message() ) );
283 283
 			return false;
284 284
 		}
@@ -290,7 +290,7 @@  discard block
 block discarded – undo
290 290
 
291 291
 		// add note to entry if approval field updating worked or there was no approved field
292 292
 		// There's no validation for the meta
293
-		if( true === $result ) {
293
+		if ( true === $result ) {
294 294
 
295 295
 			// Add an entry note
296 296
 			self::add_approval_status_updated_note( $entry_id, $approved );
@@ -343,7 +343,7 @@  discard block
 block discarded – undo
343 343
 
344 344
 		$note_id = false;
345 345
 
346
-		if( $add_note && class_exists( 'GravityView_Entry_Notes' ) ) {
346
+		if ( $add_note && class_exists( 'GravityView_Entry_Notes' ) ) {
347 347
 
348 348
 			$current_user = wp_get_current_user();
349 349
 
@@ -365,7 +365,7 @@  discard block
 block discarded – undo
365 365
 	 */
366 366
 	private static function update_approved_column( $entry_id = 0, $status = '0', $form_id = 0, $approvedcolumn = 0 ) {
367 367
 
368
-		if( empty( $approvedcolumn ) ) {
368
+		if ( empty( $approvedcolumn ) ) {
369 369
 			$approvedcolumn = self::get_approved_column( $form_id );
370 370
 		}
371 371
 
@@ -413,16 +413,16 @@  discard block
 block discarded – undo
413 413
 	private static function update_approved_meta( $entry_id, $status, $form_id = 0 ) {
414 414
 
415 415
 		if ( ! GravityView_Entry_Approval_Status::is_valid( $status ) ) {
416
-			do_action('gravityview_log_error', __METHOD__ . ': $is_approved not valid value', $status );
416
+			do_action( 'gravityview_log_error', __METHOD__ . ': $is_approved not valid value', $status );
417 417
 			return;
418 418
 		}
419 419
 
420 420
 		$status = GravityView_Entry_Approval_Status::maybe_convert_status( $status );
421 421
 
422 422
 		// update entry meta
423
-		if( function_exists('gform_update_meta') ) {
423
+		if ( function_exists( 'gform_update_meta' ) ) {
424 424
 
425
-			if( GravityView_Entry_Approval_Status::is_unapproved( $status ) ) {
425
+			if ( GravityView_Entry_Approval_Status::is_unapproved( $status ) ) {
426 426
 				gform_delete_meta( $entry_id, self::meta_key );
427 427
 			} else {
428 428
 				gform_update_meta( $entry_id, self::meta_key, $status, $form_id );
@@ -445,11 +445,11 @@  discard block
 block discarded – undo
445 445
 			 * @since 1.18 Added "unapproved"
446 446
 			 * @param  int $entry_id ID of the Gravity Forms entry
447 447
 			 */
448
-			do_action( 'gravityview/approve_entries/' . $action , $entry_id );
448
+			do_action( 'gravityview/approve_entries/' . $action, $entry_id );
449 449
 
450 450
 		} else {
451 451
 
452
-			do_action('gravityview_log_error', __METHOD__ . ' - `gform_update_meta` does not exist.' );
452
+			do_action( 'gravityview_log_error', __METHOD__ . ' - `gform_update_meta` does not exist.' );
453 453
 
454 454
 		}
455 455
 	}
@@ -464,29 +464,29 @@  discard block
 block discarded – undo
464 464
 	 */
465 465
 	static public function get_approved_column( $form ) {
466 466
 
467
-		if( empty( $form ) ) {
467
+		if ( empty( $form ) ) {
468 468
 			return null;
469 469
 		}
470 470
 
471
-		if( !is_array( $form ) ) {
471
+		if ( ! is_array( $form ) ) {
472 472
 			$form = GVCommon::get_form( $form );
473 473
 		}
474 474
 
475
-		foreach( $form['fields'] as $key => $field ) {
475
+		foreach ( $form[ 'fields' ] as $key => $field ) {
476 476
 
477
-			$field = (array) $field;
477
+			$field = (array)$field;
478 478
 
479
-			if( !empty( $field['gravityview_approved'] ) ) {
480
-				if( !empty($field['inputs'][0]['id']) ) {
481
-					return $field['inputs'][0]['id'];
479
+			if ( ! empty( $field[ 'gravityview_approved' ] ) ) {
480
+				if ( ! empty( $field[ 'inputs' ][ 0 ][ 'id' ] ) ) {
481
+					return $field[ 'inputs' ][ 0 ][ 'id' ];
482 482
 				}
483 483
 			}
484 484
 
485 485
 			// Note: This is just for backward compatibility from GF Directory plugin and old GV versions - when using i18n it may not work..
486
-			if( 'checkbox' == $field['type'] && isset( $field['inputs'] ) && is_array( $field['inputs'] ) ) {
487
-				foreach ( $field['inputs'] as $key2 => $input ) {
488
-					if ( strtolower( $input['label'] ) == 'approved' ) {
489
-						return $input['id'];
486
+			if ( 'checkbox' == $field[ 'type' ] && isset( $field[ 'inputs' ] ) && is_array( $field[ 'inputs' ] ) ) {
487
+				foreach ( $field[ 'inputs' ] as $key2 => $input ) {
488
+					if ( strtolower( $input[ 'label' ] ) == 'approved' ) {
489
+						return $input[ 'id' ];
490 490
 					}
491 491
 				}
492 492
 			}
Please login to merge, or discard this patch.
includes/extensions/edit-entry/class-edit-entry-user-registration.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -52,9 +52,9 @@  discard block
 block discarded – undo
52 52
 	     * @since 1.11
53 53
 	     * @param boolean $boolean Whether to trigger update on user registration (default: true)
54 54
 	     */
55
-	    if( apply_filters( 'gravityview/edit_entry/user_registration/trigger_update', true ) ) {
55
+	    if ( apply_filters( 'gravityview/edit_entry/user_registration/trigger_update', true ) ) {
56 56
 
57
-	    	add_action( 'gravityview/edit_entry/after_update' , array( $this, 'update_user' ), 10, 2 );
57
+	    	add_action( 'gravityview/edit_entry/after_update', array( $this, 'update_user' ), 10, 2 );
58 58
 
59 59
 		    // last resort in case the current user display name don't match any of the defaults
60 60
 		    add_action( 'gform_user_updated', array( $this, 'restore_display_name' ), 10, 4 );
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
      */
73 73
     public function update_user( $form = array(), $entry_id = 0 ) {
74 74
 
75
-        if( ! class_exists( 'GFAPI' ) || ! class_exists( 'GF_User_Registration' ) || empty( $entry_id ) ) {
75
+        if ( ! class_exists( 'GFAPI' ) || ! class_exists( 'GF_User_Registration' ) || empty( $entry_id ) ) {
76 76
             return;
77 77
         }
78 78
 
@@ -101,15 +101,15 @@  discard block
 block discarded – undo
101 101
          */
102 102
         $preserve_role = apply_filters( 'gravityview/edit_entry/user_registration/preserve_role', true, $config, $form, $entry );
103 103
 
104
-        if( $preserve_role ) {
105
-            $config['meta']['role'] = 'gfur_preserve_role';
104
+        if ( $preserve_role ) {
105
+            $config[ 'meta' ][ 'role' ] = 'gfur_preserve_role';
106 106
         }
107 107
 
108 108
         /**
109 109
          * Make sure the current display name is not changed with the update user method.
110 110
          * @since 1.15
111 111
          */
112
-        $config['meta']['displayname'] = $this->match_current_display_name( $entry['created_by'] );
112
+        $config[ 'meta' ][ 'displayname' ] = $this->match_current_display_name( $entry[ 'created_by' ] );
113 113
 
114 114
 
115 115
         /**
@@ -123,13 +123,13 @@  discard block
 block discarded – undo
123 123
 
124 124
 
125 125
         // Make sure the feed is active
126
-	    if ( ! $config['is_active'] ) {
126
+	    if ( ! $config[ 'is_active' ] ) {
127 127
 			return;
128 128
 	    }
129 129
 
130 130
 	    // If an Update feed, make sure the conditions are met.
131
-	    if( rgars( $config, 'meta/feedType' ) === 'update' ) {
132
-	    	if( ! $gf_user_registration->is_feed_condition_met( $config, $form, $entry ) ) {
131
+	    if ( rgars( $config, 'meta/feedType' ) === 'update' ) {
132
+	    	if ( ! $gf_user_registration->is_feed_condition_met( $config, $form, $entry ) ) {
133 133
 			    return;
134 134
 		    }
135 135
 	    }
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
 
165 165
         // In case we can't find the current display name format, or it is the 'nickname' format (which Gravity Forms doesn't support)
166 166
         //   trigger last resort method at the 'gform_user_updated' hook
167
-        if( false === $format || 'nickname' === $format ) {
167
+        if ( false === $format || 'nickname' === $format ) {
168 168
             $this->_user_before_update = $user;
169 169
             $format = 'nickname';
170 170
         }
@@ -184,18 +184,18 @@  discard block
 block discarded – undo
184 184
     public function generate_display_names( $profileuser ) {
185 185
 
186 186
         $public_display = array();
187
-        $public_display['nickname']  = $profileuser->nickname;
188
-        $public_display['username']  = $profileuser->user_login;
187
+        $public_display[ 'nickname' ]  = $profileuser->nickname;
188
+        $public_display[ 'username' ]  = $profileuser->user_login;
189 189
 
190
-        if ( !empty($profileuser->first_name) )
191
-            $public_display['firstname'] = $profileuser->first_name;
190
+        if ( ! empty( $profileuser->first_name ) )
191
+            $public_display[ 'firstname' ] = $profileuser->first_name;
192 192
 
193
-        if ( !empty($profileuser->last_name) )
194
-            $public_display['lastname'] = $profileuser->last_name;
193
+        if ( ! empty( $profileuser->last_name ) )
194
+            $public_display[ 'lastname' ] = $profileuser->last_name;
195 195
 
196
-        if ( !empty($profileuser->first_name) && !empty($profileuser->last_name) ) {
197
-            $public_display['firstlast'] = $profileuser->first_name . ' ' . $profileuser->last_name;
198
-            $public_display['lastfirst'] = $profileuser->last_name . ' ' . $profileuser->first_name;
196
+        if ( ! empty( $profileuser->first_name ) && ! empty( $profileuser->last_name ) ) {
197
+            $public_display[ 'firstlast' ] = $profileuser->first_name . ' ' . $profileuser->last_name;
198
+            $public_display[ 'lastfirst' ] = $profileuser->last_name . ' ' . $profileuser->first_name;
199 199
         }
200 200
 
201 201
         $public_display = array_map( 'trim', $public_display );
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
          */
226 226
         $restore_display_name = apply_filters( 'gravityview/edit_entry/restore_display_name', true );
227 227
 
228
-        $is_update_feed = ( $config && rgars( $config, 'meta/feed_type') === 'update' );
228
+        $is_update_feed = ( $config && rgars( $config, 'meta/feed_type' ) === 'update' );
229 229
 
230 230
         /**
231 231
          * Don't restore display name:
@@ -234,7 +234,7 @@  discard block
 block discarded – undo
234 234
          *   - or we don't need as we found the correct format before updating user.
235 235
          * @since 1.14.4
236 236
          */
237
-        if( ! $restore_display_name || $is_update_feed || is_null( $this->_user_before_update ) ) {
237
+        if ( ! $restore_display_name || $is_update_feed || is_null( $this->_user_before_update ) ) {
238 238
             return;
239 239
         }
240 240
 
@@ -260,10 +260,10 @@  discard block
 block discarded – undo
260 260
 
261 261
         $updated = wp_update_user( $restored_user );
262 262
 
263
-        if( is_wp_error( $updated ) ) {
264
-            do_action('gravityview_log_error', __METHOD__ . sprintf( ' - There was an error updating user #%d details', $user_id ), $updated );
263
+        if ( is_wp_error( $updated ) ) {
264
+            do_action( 'gravityview_log_error', __METHOD__ . sprintf( ' - There was an error updating user #%d details', $user_id ), $updated );
265 265
         } else {
266
-            do_action('gravityview_log_debug', __METHOD__ . sprintf( ' - User #%d details restored', $user_id ) );
266
+            do_action( 'gravityview_log_debug', __METHOD__ . sprintf( ' - User #%d details restored', $user_id ) );
267 267
         }
268 268
 
269 269
         $this->_user_before_update = null;
Please login to merge, or discard this patch.