Completed
Push — develop ( 572bc7...60d03e )
by Zack
25:22 queued 04:21
created
plugin-and-theme-hooks/class-gravityview-plugin-hooks-gravity-flow.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
 
34 34
 		parent::add_hooks();
35 35
 
36
-		add_filter( 'gravityview/search/searchable_fields', array( $this, 'modify_search_bar_fields_dropdown'), 10, 2 );
36
+		add_filter( 'gravityview/search/searchable_fields', array( $this, 'modify_search_bar_fields_dropdown' ), 10, 2 );
37 37
 
38 38
 		add_filter( 'gravityview/admin/available_fields', array( $this, 'maybe_add_non_default_fields' ), 10, 3 );
39 39
 
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
 	 * @return void
54 54
 	 */
55 55
 	public function clear_cache_after_workflow( $form, $entry_id, $step_id, $starting_step_id ) {
56
-		do_action( 'gravityview_clear_form_cache', $form['id'] );
56
+		do_action( 'gravityview_clear_form_cache', $form[ 'id' ] );
57 57
 	}
58 58
 
59 59
 	/**
@@ -70,13 +70,13 @@  discard block
 block discarded – undo
70 70
 	 */
71 71
 	public static function get_status_options( $form_id = 0, $status_key = 'workflow_final_status' ) {
72 72
 
73
-		if( empty( $form_id ) ) {
73
+		if ( empty( $form_id ) ) {
74 74
 			$form_id = GravityView_View::getInstance()->getFormId();
75 75
 		}
76 76
 
77 77
 		$entry_meta = gravity_flow()->get_entry_meta( array(), $form_id );
78 78
 
79
-		return (array) \GV\Utils::get( $entry_meta, $status_key . '/filter/choices' );
79
+		return (array)\GV\Utils::get( $entry_meta, $status_key . '/filter/choices' );
80 80
 	}
81 81
 
82 82
 
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
 
99 99
 		$workflow_steps = $GFlow->get_steps();
100 100
 
101
-		if( $workflow_steps ) {
101
+		if ( $workflow_steps ) {
102 102
 
103 103
 			foreach ( $workflow_steps as $step ) {
104 104
 
@@ -110,12 +110,12 @@  discard block
 block discarded – undo
110 110
 				);
111 111
 			}
112 112
 
113
-			$fields['workflow_step'] = array(
113
+			$fields[ 'workflow_step' ] = array(
114 114
 				'label' => esc_html__( 'Workflow Step', 'gravityview' ),
115 115
 				'type'  => 'select',
116 116
 			);
117 117
 
118
-			$fields['workflow_final_status'] = array(
118
+			$fields[ 'workflow_final_status' ] = array(
119 119
 				'label' => esc_html__( 'Workflow Status', 'gravityview' ),
120 120
 				'type'  => 'select',
121 121
 			);
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
 		if ( ( $insert_at = array_search( 'workflow_final_status', wp_list_pluck( $fields, 'key' ) ) ) !== false ) {
132 132
 			$fields_end = array_splice( $fields, $insert_at + 1 );
133 133
 
134
-			$fields[] = array(
134
+			$fields[ ] = array(
135 135
 				'text' => __( 'Workflow Current Status Timestamp', 'gravityview' ),
136 136
 				'operators' => array( '>', '<' ),
137 137
 				'placeholder' => 'yyyy-mm-dd',
@@ -157,8 +157,8 @@  discard block
 block discarded – undo
157 157
 				$keys_end = array_splice( $keys, $insert_at + 1 );
158 158
 				$values_end = array_splice( $values, $insert_at + 1 );
159 159
 
160
-				$keys[] = 'workflow_current_status_timestamp';
161
-				$values[] = array(
160
+				$keys[ ] = 'workflow_current_status_timestamp';
161
+				$values[ ] = array(
162 162
 					'label' => __( 'Workflow Current Status Timestamp', 'gravityview' ),
163 163
 					'type' => 'workflow_current_status_timestamp',
164 164
 				);
Please login to merge, or discard this patch.
includes/extensions/lightbox/class-gravityview-lightbox-provider.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -23,8 +23,8 @@  discard block
 block discarded – undo
23 23
 		add_filter( 'gravityview/fields/fileupload/link_atts', array( $this, 'fileupload_link_atts' ), 10, 3 );
24 24
 		add_filter( 'gravityview/get_link/allowed_atts', array( $this, 'allowed_atts' ) );
25 25
 
26
-		add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts') );
27
-		add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_styles') );
26
+		add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
27
+		add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_styles' ) );
28 28
 
29 29
 		add_action( 'wp_footer', array( $this, 'output_footer' ) );
30 30
 	}
@@ -44,8 +44,8 @@  discard block
 block discarded – undo
44 44
 		remove_filter( 'gravityview/fields/fileupload/link_atts', array( $this, 'fileupload_link_atts' ), 10 );
45 45
 		remove_filter( 'gravityview/get_link/allowed_atts', array( $this, 'allowed_atts' ) );
46 46
 
47
-		remove_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts') );
48
-		remove_action( 'wp_enqueue_scripts', array( $this, 'enqueue_styles') );
47
+		remove_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
48
+		remove_action( 'wp_enqueue_scripts', array( $this, 'enqueue_styles' ) );
49 49
 
50 50
 		remove_action( 'wp_footer', array( $this, 'output_footer' ) );
51 51
 	}
Please login to merge, or discard this patch.
includes/extensions/lightbox/class-gravityview-lightbox.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
 	 */
39 39
 	public function set_provider( $provider = null ) {
40 40
 
41
-		if( gravityview()->request->is_admin() ) {
41
+		if ( gravityview()->request->is_admin() ) {
42 42
 			return;
43 43
 		}
44 44
 
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 		}
58 58
 
59 59
 		// We're switching providers; remove the hooks that were added.
60
-		if( self::$active_provider ) {
60
+		if ( self::$active_provider ) {
61 61
 			self::$active_provider->remove_hooks();
62 62
 		}
63 63
 
Please login to merge, or discard this patch.
lightbox/fancybox/class-gravityview-lightbox-provider-fancybox.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -102,17 +102,17 @@  discard block
 block discarded – undo
102 102
 	 */
103 103
 	public function allowed_atts( $atts = array() ) {
104 104
 
105
-		$atts['data-fancybox']         = null;
106
-		$atts['data-fancybox-trigger'] = null;
107
-		$atts['data-fancybox-index']   = null;
108
-		$atts['data-src']              = null;
109
-		$atts['data-type']             = null;
110
-		$atts['data-width']            = null;
111
-		$atts['data-height']           = null;
112
-		$atts['data-srcset']           = null;
113
-		$atts['data-caption']          = null;
114
-		$atts['data-options']          = null;
115
-		$atts['data-filter']           = null;
105
+		$atts[ 'data-fancybox' ]         = null;
106
+		$atts[ 'data-fancybox-trigger' ] = null;
107
+		$atts[ 'data-fancybox-index' ]   = null;
108
+		$atts[ 'data-src' ]              = null;
109
+		$atts[ 'data-type' ]             = null;
110
+		$atts[ 'data-width' ]            = null;
111
+		$atts[ 'data-height' ]           = null;
112
+		$atts[ 'data-srcset' ]           = null;
113
+		$atts[ 'data-caption' ]          = null;
114
+		$atts[ 'data-options' ]          = null;
115
+		$atts[ 'data-filter' ]           = null;
116 116
 
117 117
 		return $atts;
118 118
 	}
@@ -126,14 +126,14 @@  discard block
 block discarded – undo
126 126
 			return $link_atts;
127 127
 		}
128 128
 
129
-		$link_atts['class'] = \GV\Utils::get( $link_atts, 'class' ) . ' gravityview-fancybox';
129
+		$link_atts[ 'class' ] = \GV\Utils::get( $link_atts, 'class' ) . ' gravityview-fancybox';
130 130
 
131
-		$link_atts['class'] = sanitize_html_class( $link_atts['class'] );
131
+		$link_atts[ 'class' ] = sanitize_html_class( $link_atts[ 'class' ] );
132 132
 
133 133
 		if ( $context && ! empty( $context->field->field ) ) {
134 134
 			if ( $context->field->field->multipleFiles ) {
135 135
 				$entry = $context->entry->as_entry();
136
-				$link_atts['data-fancybox'] = 'gallery-' . sprintf( "%s-%s-%s", $entry['form_id'], $context->field->ID, $context->entry->get_slug() );
136
+				$link_atts[ 'data-fancybox' ] = 'gallery-' . sprintf( "%s-%s-%s", $entry[ 'form_id' ], $context->field->ID, $context->entry->get_slug() );
137 137
 			}
138 138
 		}
139 139
 
Please login to merge, or discard this patch.
future/lib/EDD_SL_Plugin_Updater.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -97,7 +97,7 @@
 block discarded – undo
97 97
 	 * @uses api_request()
98 98
 	 *
99 99
 	 * @param array   $_transient_data Update array build by WordPress.
100
-	 * @return array Modified update array with custom plugin data.
100
+	 * @return stdClass Modified update array with custom plugin data.
101 101
 	 */
102 102
 	public function check_update( $_transient_data ) {
103 103
 
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -10,7 +10,9 @@
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly
13
-if ( ! defined( 'ABSPATH' ) ) exit;
13
+if ( ! defined( 'ABSPATH' ) ) {
14
+	exit;
15
+}
14 16
 
15 17
 /**
16 18
  * Allows plugins to use their own update API.
Please login to merge, or discard this patch.
Spacing   +52 added lines, -52 removed lines patch added patch discarded remove patch
@@ -48,10 +48,10 @@  discard block
 block discarded – undo
48 48
 		$this->api_data    = $_api_data;
49 49
 		$this->name        = plugin_basename( $_plugin_file );
50 50
 		$this->slug        = basename( $_plugin_file, '.php' );
51
-		$this->version     = $_api_data['version'];
52
-		$this->wp_override = isset( $_api_data['wp_override'] ) ? (bool) $_api_data['wp_override'] : false;
53
-		$this->beta        = ! empty( $this->api_data['beta'] ) ? true : false;
54
-		$this->cache_key   = 'edd_sl_' . md5( serialize( $this->slug . $this->api_data['license'] . $this->beta ) );
51
+		$this->version     = $_api_data[ 'version' ];
52
+		$this->wp_override = isset( $_api_data[ 'wp_override' ] ) ? (bool)$_api_data[ 'wp_override' ] : false;
53
+		$this->beta        = ! empty( $this->api_data[ 'beta' ] ) ? true : false;
54
+		$this->cache_key   = 'edd_sl_' . md5( serialize( $this->slug . $this->api_data[ 'license' ] . $this->beta ) );
55 55
 
56 56
 		$edd_plugin_data[ $this->slug ] = $this->api_data;
57 57
 
@@ -170,11 +170,11 @@  discard block
 block discarded – undo
170 170
 			return;
171 171
 		}
172 172
 
173
-		if( ! current_user_can( 'update_plugins' ) ) {
173
+		if ( ! current_user_can( 'update_plugins' ) ) {
174 174
 			return;
175 175
 		}
176 176
 
177
-		if( ! is_multisite() ) {
177
+		if ( ! is_multisite() ) {
178 178
 			return;
179 179
 		}
180 180
 
@@ -281,7 +281,7 @@  discard block
 block discarded – undo
281 281
 					'<a target="_blank" class="thickbox" href="' . esc_url( $changelog_link ) . '">',
282 282
 					esc_html( $version_info->new_version ),
283 283
 					'</a>',
284
-					'<a href="' . esc_url( wp_nonce_url( self_admin_url( 'update.php?action=upgrade-plugin&plugin=' ) . $this->name, 'upgrade-plugin_' . $this->name ) ) .'">',
284
+					'<a href="' . esc_url( wp_nonce_url( self_admin_url( 'update.php?action=upgrade-plugin&plugin=' ) . $this->name, 'upgrade-plugin_' . $this->name ) ) . '">',
285 285
 					'</a>'
286 286
 				);
287 287
 			}
@@ -365,7 +365,7 @@  discard block
 block discarded – undo
365 365
 			$_data->contributors = $this->convert_object_to_array( $_data->contributors );
366 366
 		}
367 367
 
368
-		if( ! isset( $_data->plugin ) ) {
368
+		if ( ! isset( $_data->plugin ) ) {
369 369
 			$_data->plugin = $this->name;
370 370
 		}
371 371
 
@@ -404,7 +404,7 @@  discard block
 block discarded – undo
404 404
 
405 405
 		$verify_ssl = $this->verify_ssl();
406 406
 		if ( strpos( $url, 'https://' ) !== false && strpos( $url, 'edd_action=package_download' ) ) {
407
-			$args['sslverify'] = $verify_ssl;
407
+			$args[ 'sslverify' ] = $verify_ssl;
408 408
 		}
409 409
 		return $args;
410 410
 
@@ -432,9 +432,9 @@  discard block
 block discarded – undo
432 432
 		if ( ! is_array( $edd_plugin_url_available ) || ! isset( $edd_plugin_url_available[ $store_hash ] ) ) {
433 433
 			$test_url_parts = parse_url( $this->api_url );
434 434
 
435
-			$scheme = ! empty( $test_url_parts['scheme'] ) ? $test_url_parts['scheme']     : 'http';
436
-			$host   = ! empty( $test_url_parts['host'] )   ? $test_url_parts['host']       : '';
437
-			$port   = ! empty( $test_url_parts['port'] )   ? ':' . $test_url_parts['port'] : '';
435
+			$scheme = ! empty( $test_url_parts[ 'scheme' ] ) ? $test_url_parts[ 'scheme' ] : 'http';
436
+			$host   = ! empty( $test_url_parts[ 'host' ] ) ? $test_url_parts[ 'host' ] : '';
437
+			$port   = ! empty( $test_url_parts[ 'port' ] ) ? ':' . $test_url_parts[ 'port' ] : '';
438 438
 
439 439
 			if ( empty( $host ) ) {
440 440
 				$edd_plugin_url_available[ $store_hash ] = false;
@@ -451,27 +451,27 @@  discard block
 block discarded – undo
451 451
 
452 452
 		$data = array_merge( $this->api_data, $_data );
453 453
 
454
-		if ( $data['slug'] != $this->slug ) {
454
+		if ( $data[ 'slug' ] != $this->slug ) {
455 455
 			return;
456 456
 		}
457 457
 
458
-		if( $this->api_url == trailingslashit ( home_url() ) ) {
458
+		if ( $this->api_url == trailingslashit( home_url() ) ) {
459 459
 			return false; // Don't allow a plugin to ping itself
460 460
 		}
461 461
 
462 462
 		$api_params = array(
463 463
 			'edd_action' => 'get_version',
464
-			'license'    => ! empty( $data['license'] ) ? $data['license'] : '',
465
-			'item_name'  => isset( $data['item_name'] ) ? $data['item_name'] : false,
466
-			'item_id'    => isset( $data['item_id'] ) ? $data['item_id'] : false,
467
-			'version'    => isset( $data['version'] ) ? $data['version'] : false,
468
-			'slug'       => $data['slug'],
469
-			'author'     => $data['author'],
464
+			'license'    => ! empty( $data[ 'license' ] ) ? $data[ 'license' ] : '',
465
+			'item_name'  => isset( $data[ 'item_name' ] ) ? $data[ 'item_name' ] : false,
466
+			'item_id'    => isset( $data[ 'item_id' ] ) ? $data[ 'item_id' ] : false,
467
+			'version'    => isset( $data[ 'version' ] ) ? $data[ 'version' ] : false,
468
+			'slug'       => $data[ 'slug' ],
469
+			'author'     => $data[ 'author' ],
470 470
 			'url'        => home_url(),
471
-			'beta'       => ! empty( $data['beta'] ),
471
+			'beta'       => ! empty( $data[ 'beta' ] ),
472 472
 		);
473 473
 
474
-		$request    = wp_remote_post( $this->api_url, array( 'timeout' => 15, 'sslverify' => $verify_ssl, 'body' => $api_params ) );
474
+		$request = wp_remote_post( $this->api_url, array( 'timeout' => 15, 'sslverify' => $verify_ssl, 'body' => $api_params ) );
475 475
 
476 476
 		if ( ! is_wp_error( $request ) ) {
477 477
 			$request = json_decode( wp_remote_retrieve_body( $request ) );
@@ -491,9 +491,9 @@  discard block
 block discarded – undo
491 491
 			$request->icons = maybe_unserialize( $request->icons );
492 492
 		}
493 493
 
494
-		if( ! empty( $request->sections ) ) {
495
-			foreach( $request->sections as $key => $section ) {
496
-				$request->$key = (array) $section;
494
+		if ( ! empty( $request->sections ) ) {
495
+			foreach ( $request->sections as $key => $section ) {
496
+				$request->$key = (array)$section;
497 497
 			}
498 498
 		}
499 499
 
@@ -507,35 +507,35 @@  discard block
 block discarded – undo
507 507
 
508 508
 		global $edd_plugin_data;
509 509
 
510
-		if( empty( $_REQUEST['edd_sl_action'] ) || 'view_plugin_changelog' != $_REQUEST['edd_sl_action'] ) {
510
+		if ( empty( $_REQUEST[ 'edd_sl_action' ] ) || 'view_plugin_changelog' != $_REQUEST[ 'edd_sl_action' ] ) {
511 511
 			return;
512 512
 		}
513 513
 
514
-		if( empty( $_REQUEST['plugin'] ) ) {
514
+		if ( empty( $_REQUEST[ 'plugin' ] ) ) {
515 515
 			return;
516 516
 		}
517 517
 
518
-		if( empty( $_REQUEST['slug'] ) ) {
518
+		if ( empty( $_REQUEST[ 'slug' ] ) ) {
519 519
 			return;
520 520
 		}
521 521
 
522
-		if( ! current_user_can( 'update_plugins' ) ) {
522
+		if ( ! current_user_can( 'update_plugins' ) ) {
523 523
 			wp_die( __( 'You do not have permission to install plugin updates', 'gravityview' ), __( 'Error', 'gravityview' ), array( 'response' => 403 ) );
524 524
 		}
525 525
 
526
-		$data         = $edd_plugin_data[ $_REQUEST['slug'] ];
526
+		$data         = $edd_plugin_data[ $_REQUEST[ 'slug' ] ];
527 527
 		$version_info = $this->get_cached_version_info();
528 528
 
529
-		if( false === $version_info ) {
529
+		if ( false === $version_info ) {
530 530
 
531 531
 			$api_params = array(
532 532
 				'edd_action' => 'get_version',
533
-				'item_name'  => isset( $data['item_name'] ) ? $data['item_name'] : false,
534
-				'item_id'    => isset( $data['item_id'] ) ? $data['item_id'] : false,
535
-				'slug'       => $_REQUEST['slug'],
536
-				'author'     => $data['author'],
533
+				'item_name'  => isset( $data[ 'item_name' ] ) ? $data[ 'item_name' ] : false,
534
+				'item_id'    => isset( $data[ 'item_id' ] ) ? $data[ 'item_id' ] : false,
535
+				'slug'       => $_REQUEST[ 'slug' ],
536
+				'author'     => $data[ 'author' ],
537 537
 				'url'        => home_url(),
538
-				'beta'       => ! empty( $data['beta'] )
538
+				'beta'       => ! empty( $data[ 'beta' ] )
539 539
 			);
540 540
 
541 541
 			$verify_ssl = $this->verify_ssl();
@@ -551,22 +551,22 @@  discard block
 block discarded – undo
551 551
 				$version_info = false;
552 552
 			}
553 553
 
554
-			if( ! empty( $version_info ) ) {
555
-				foreach( $version_info->sections as $key => $section ) {
556
-					$version_info->$key = (array) $section;
554
+			if ( ! empty( $version_info ) ) {
555
+				foreach ( $version_info->sections as $key => $section ) {
556
+					$version_info->$key = (array)$section;
557 557
 				}
558 558
 			}
559 559
 
560 560
 			$this->set_version_info_cache( $version_info );
561 561
 
562 562
 			// Delete the unneeded option
563
-			delete_option( md5( 'edd_plugin_' . sanitize_key( $_REQUEST['plugin'] ) . '_' . $this->beta . '_version_info' ) );
563
+			delete_option( md5( 'edd_plugin_' . sanitize_key( $_REQUEST[ 'plugin' ] ) . '_' . $this->beta . '_version_info' ) );
564 564
 		}
565 565
 
566 566
 		if ( isset( $version_info->sections ) ) {
567 567
 			$sections = $this->convert_object_to_array( $version_info->sections );
568
-			if ( ! empty( $sections['changelog'] ) ) {
569
-				echo '<div style="background:#fff;padding:10px;">' . wp_kses_post( $sections['changelog'] ) . '</div>';
568
+			if ( ! empty( $sections[ 'changelog' ] ) ) {
569
+				echo '<div style="background:#fff;padding:10px;">' . wp_kses_post( $sections[ 'changelog' ] ) . '</div>';
570 570
 			}
571 571
 		}
572 572
 
@@ -581,25 +581,25 @@  discard block
 block discarded – undo
581 581
 	 */
582 582
 	public function get_cached_version_info( $cache_key = '' ) {
583 583
 
584
-		if( empty( $cache_key ) ) {
584
+		if ( empty( $cache_key ) ) {
585 585
 			$cache_key = $this->cache_key;
586 586
 		}
587 587
 
588 588
 		$cache = get_option( $cache_key );
589 589
 
590
-		if( empty( $cache['timeout'] ) || time() > $cache['timeout'] ) {
590
+		if ( empty( $cache[ 'timeout' ] ) || time() > $cache[ 'timeout' ] ) {
591 591
 			return false; // Cache is expired
592 592
 		}
593 593
 
594 594
 		// We need to turn the icons into an array, thanks to WP Core forcing these into an object at some point.
595
-		$cache['value'] = json_decode( $cache['value'] );
596
-		if ( ! empty( $cache['value']->icons ) ) {
597
-			$cache['value']->icons = (array) $cache['value']->icons;
595
+		$cache[ 'value' ] = json_decode( $cache[ 'value' ] );
596
+		if ( ! empty( $cache[ 'value' ]->icons ) ) {
597
+			$cache[ 'value' ]->icons = (array)$cache[ 'value' ]->icons;
598 598
 		} else {
599
-			$cache['value']->icons = array();
599
+			$cache[ 'value' ]->icons = array();
600 600
 		}
601 601
 
602
-		return $cache['value'];
602
+		return $cache[ 'value' ];
603 603
 
604 604
 	}
605 605
 
@@ -611,7 +611,7 @@  discard block
 block discarded – undo
611 611
 	 */
612 612
 	public function set_version_info_cache( $value = '', $cache_key = '' ) {
613 613
 
614
-		if( empty( $cache_key ) ) {
614
+		if ( empty( $cache_key ) ) {
615 615
 			$cache_key = $this->cache_key;
616 616
 		}
617 617
 
@@ -623,7 +623,7 @@  discard block
 block discarded – undo
623 623
 		update_option( $cache_key, $data, 'no' );
624 624
 
625 625
 		// Delete the duplicate option
626
-		delete_option( 'edd_api_request_' . md5( serialize( $this->slug . $this->api_data['license'] . $this->beta ) ) );
626
+		delete_option( 'edd_api_request_' . md5( serialize( $this->slug . $this->api_data[ 'license' ] . $this->beta ) ) );
627 627
 	}
628 628
 
629 629
 	/**
@@ -633,7 +633,7 @@  discard block
 block discarded – undo
633 633
 	 * @return bool
634 634
 	 */
635 635
 	private function verify_ssl() {
636
-		return (bool) apply_filters( 'edd_sl_api_request_verify_ssl', true, $this );
636
+		return (bool)apply_filters( 'edd_sl_api_request_verify_ssl', true, $this );
637 637
 	}
638 638
 
639 639
 }
Please login to merge, or discard this patch.
includes/load-plugin-and-theme-hooks.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -21,13 +21,13 @@
 block discarded – undo
21 21
 $plugin_hooks_files = glob( $include_path . 'class-gravityview-plugin-hooks-*.php' );
22 22
 
23 23
 // Load all plugin files automatically
24
-foreach ( (array) $plugin_hooks_files as $plugin_hooks_file ) {
24
+foreach ( (array)$plugin_hooks_files as $plugin_hooks_file ) {
25 25
 	include $plugin_hooks_file;
26 26
 }
27 27
 
28 28
 $theme_hooks_files = glob( $include_path . 'class-gravityview-theme-hooks-*.php' );
29 29
 
30 30
 // Load all theme files automatically
31
-foreach ( (array) $theme_hooks_files as $theme_hooks_file ) {
31
+foreach ( (array)$theme_hooks_files as $theme_hooks_file ) {
32 32
 	include $theme_hooks_file;
33 33
 }
Please login to merge, or discard this patch.
includes/plugin-and-theme-hooks/class-gravityview-theme-hooks-wpml.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 
65 65
 		add_filter( 'icl_ls_languages', array( $this, 'wpml_ls_filter' ) );
66 66
 
67
-		add_filter( 'gravityview_directory_link', array( $this, 'filter_gravityview_back_link') );
67
+		add_filter( 'gravityview_directory_link', array( $this, 'filter_gravityview_back_link' ) );
68 68
 	}
69 69
 
70 70
 	/**
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
 	function filter_gravityview_back_link( $link ) {
85 85
 		global $wpml_url_filters;
86 86
 
87
-		if( $wpml_url_filters ) {
87
+		if ( $wpml_url_filters ) {
88 88
 			$link = $wpml_url_filters->permalink_filter( $link, GravityView_frontend::getInstance()->getPostId() );
89 89
 		}
90 90
 
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
 	private function remove_url_hooks() {
102 102
 		global $wpml_url_filters;
103 103
 
104
-		if( ! $wpml_url_filters ) {
104
+		if ( ! $wpml_url_filters ) {
105 105
 			return;
106 106
 		}
107 107
 
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
 	private function add_url_hooks() {
130 130
 		global $wpml_url_filters;
131 131
 
132
-		if( ! $wpml_url_filters ) {
132
+		if ( ! $wpml_url_filters ) {
133 133
 			return;
134 134
 		}
135 135
 
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
 					break;
227 227
 			}
228 228
 
229
-			$languages[ $lang_code ]['url'] = $entry_link;
229
+			$languages[ $lang_code ][ 'url' ] = $entry_link;
230 230
 		}
231 231
 
232 232
 		$this->add_url_hooks();
Please login to merge, or discard this patch.
future/includes/class-gv-settings-addon.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -140,7 +140,7 @@
 block discarded – undo
140 140
 	 *
141 141
 	 * @param array $items Styles to exclude from no-conflict
142 142
 	 *
143
-	 * @return array
143
+	 * @return string[]
144 144
 	 */
145 145
 	public function register_no_conflict( $items ) {
146 146
 
Please login to merge, or discard this patch.
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -421,7 +421,7 @@
 block discarded – undo
421 421
     </header>
422 422
     <div class="gform-settings-panel__content" style="padding: 0 1rem 1.25rem">
423 423
 
424
-HTML;
424
+html;
425 425
 		} else {
426 426
 			echo '<div class="gv-uninstall-form-wrapper" style="font-size: 110%; padding: 15px 0;">';
427 427
 		}
Please login to merge, or discard this patch.
Spacing   +49 added lines, -49 removed lines patch added patch discarded remove patch
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
 		$setting_tabs = parent::get_app_settings_tabs();
119 119
 
120 120
 		foreach ( $setting_tabs as &$tab ) {
121
-			if ( 'uninstall' !== $tab['name'] ) {
121
+			if ( 'uninstall' !== $tab[ 'name' ] ) {
122 122
 				continue;
123 123
 			}
124 124
 
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
 			}
130 130
 
131 131
 			// Add trash can icon to resemble the look and feel of the GF Settings page
132
-			$tab['icon'] = 'dashicons-trash';
132
+			$tab[ 'icon' ] = 'dashicons-trash';
133 133
 		}
134 134
 
135 135
 		return array_filter( $setting_tabs );
@@ -144,8 +144,8 @@  discard block
 block discarded – undo
144 144
 	 */
145 145
 	public function register_no_conflict( $items ) {
146 146
 
147
-		$items[] = 'gform_settings';
148
-		$items[] = 'gv-admin-edd-license';
147
+		$items[ ] = 'gform_settings';
148
+		$items[ ] = 'gv-admin-edd-license';
149 149
 
150 150
 		return $items;
151 151
 	}
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
 
197 197
 		$href = add_query_arg( array( 'post_type' => 'gravityview', 'page' => 'gravityview_settings', 'view' => 'uninstall' ), admin_url( 'edit.php' ) );
198 198
 
199
-		$uninstall_button = '<a href="' . esc_url( $href ) . '" class="' . gravityview_sanitize_html_class( $html_class ). '">' . esc_html__( 'Uninstall GravityView', 'gravityview' ) . '</a>';
199
+		$uninstall_button = '<a href="' . esc_url( $href ) . '" class="' . gravityview_sanitize_html_class( $html_class ) . '">' . esc_html__( 'Uninstall GravityView', 'gravityview' ) . '</a>';
200 200
 
201 201
 		$html .= $uninstall_button;
202 202
 
@@ -215,10 +215,10 @@  discard block
 block discarded – undo
215 215
 	 */
216 216
 	public function settings_save( $field, $echo = true ) {
217 217
 
218
-		$field['type']  = 'submit';
219
-		$field['name']  = 'gform-settings-save';
220
-		$field['class'] = 'button button-primary primary button-hero';
221
-		$field['value'] = Utils::get( $field, 'value', __( 'Update Settings', 'gravityview' ) );
218
+		$field[ 'type' ]  = 'submit';
219
+		$field[ 'name' ]  = 'gform-settings-save';
220
+		$field[ 'class' ] = 'button button-primary primary button-hero';
221
+		$field[ 'value' ] = Utils::get( $field, 'value', __( 'Update Settings', 'gravityview' ) );
222 222
 
223 223
 		$html = $this->as_html( $field, false );
224 224
 
@@ -240,8 +240,8 @@  discard block
 block discarded – undo
240 240
 	 */
241 241
 	public function modify_app_settings_menu_title( $setting_tabs ) {
242 242
 
243
-		$setting_tabs[0]['label'] = __( 'GravityView Settings', 'gravityview' );
244
-		$setting_tabs[0]['icon']  = 'dashicons-admin-settings';
243
+		$setting_tabs[ 0 ][ 'label' ] = __( 'GravityView Settings', 'gravityview' );
244
+		$setting_tabs[ 0 ][ 'icon' ]  = 'dashicons-admin-settings';
245 245
 
246 246
 		return $setting_tabs;
247 247
 	}
@@ -489,7 +489,7 @@  discard block
 block discarded – undo
489 489
 					$i = 0;
490 490
 					while ( $i < 11 ) {
491 491
 						echo '<li class="inline number-scale"><label><input name="likely_to_refer" id="likely_to_refer_' . $i . '" value="' . $i . '" type="radio"> ' . $i . '</label></li>';
492
-						$i ++;
492
+						$i++;
493 493
 					}
494 494
 					?>
495 495
 				</ul>
@@ -694,14 +694,14 @@  discard block
 block discarded – undo
694 694
 	 */
695 695
 	public function as_html( $field, $echo = true ) {
696 696
 
697
-		$field['type'] = ( isset( $field['type'] ) && in_array( $field['type'], array( 'submit', 'reset', 'button' ) ) ) ? $field['type'] : 'submit';
697
+		$field[ 'type' ] = ( isset( $field[ 'type' ] ) && in_array( $field[ 'type' ], array( 'submit', 'reset', 'button' ) ) ) ? $field[ 'type' ] : 'submit';
698 698
 
699 699
 		$attributes    = $this->get_field_attributes( $field );
700 700
 		$default_value = Utils::get( $field, 'value', Utils::get( $field, 'default_value' ) );
701
-		$value         = $this->get( $field['name'], $default_value );
701
+		$value         = $this->get( $field[ 'name' ], $default_value );
702 702
 
703
-		$attributes['class'] = isset( $attributes['class'] ) ? esc_attr( $attributes['class'] ) : 'button-primary primary gfbutton';
704
-		$name                = ( $field['name'] === 'gform-settings-save' ) ? $field['name'] : '_gaddon_setting_' . $field['name'];
703
+		$attributes[ 'class' ] = isset( $attributes[ 'class' ] ) ? esc_attr( $attributes[ 'class' ] ) : 'button-primary primary gfbutton';
704
+		$name                = ( $field[ 'name' ] === 'gform-settings-save' ) ? $field[ 'name' ] : '_gaddon_setting_' . $field[ 'name' ];
705 705
 
706 706
 		if ( empty( $value ) ) {
707 707
 			$value = __( 'Update Settings', 'gravityview' );
@@ -710,7 +710,7 @@  discard block
 block discarded – undo
710 710
 		$attributes = $this->get_field_attributes( $field );
711 711
 
712 712
 		$html = '<input
713
-                    type="' . $field['type'] . '"
713
+                    type="' . $field[ 'type' ] . '"
714 714
                     name="' . esc_attr( $name ) . '"
715 715
                     value="' . $value . '" ' .
716 716
 				implode( ' ', $attributes ) .
@@ -744,7 +744,7 @@  discard block
 block discarded – undo
744 744
 	 */
745 745
 	public function is_save_postback() {
746 746
 
747
-		return isset( $_POST['gform-settings-save'] ) && isset( $_POST['_gravityview_save_settings_nonce'] );
747
+		return isset( $_POST[ 'gform-settings-save' ] ) && isset( $_POST[ '_gravityview_save_settings_nonce' ] );
748 748
 	}
749 749
 
750 750
 	/**
@@ -856,7 +856,7 @@  discard block
 block discarded – undo
856 856
 
857 857
 		$scripts = parent::scripts();
858 858
 
859
-		$scripts[] = array(
859
+		$scripts[ ] = array(
860 860
 				'handle'  => 'gform_tooltip_init',
861 861
 				'enqueue' => array(
862 862
 						array(
@@ -884,11 +884,11 @@  discard block
 block discarded – undo
884 884
 		);
885 885
 
886 886
 		// This file was removed from 2.5
887
-		if( ! gravityview()->plugin->is_GF_25() ) {
888
-			$deps[] = 'gform_tooltip';
887
+		if ( ! gravityview()->plugin->is_GF_25() ) {
888
+			$deps[ ] = 'gform_tooltip';
889 889
 		}
890 890
 
891
-		$styles[] = array(
891
+		$styles[ ] = array(
892 892
 			'handle'  => 'gravityview_settings',
893 893
 			'src'     => plugins_url( 'assets/css/admin-settings.css', GRAVITYVIEW_FILE ),
894 894
 			'version' => Plugin::$version,
@@ -975,7 +975,7 @@  discard block
 block discarded – undo
975 975
 						'name'          => 'support-email',
976 976
 						'type'          => 'text',
977 977
 						'validate'      => 'email',
978
-						'default_value' => $default_settings['support-email'],
978
+						'default_value' => $default_settings[ 'support-email' ],
979 979
 						'label'         => __( 'Support Email', 'gravityview' ),
980 980
 						'description'   => __( 'In order to provide responses to your support requests, please provide your email address.', 'gravityview' ),
981 981
 						'class'         => 'code regular-text',
@@ -987,7 +987,7 @@  discard block
 block discarded – undo
987 987
 						'name'          => 'support_port',
988 988
 						'type'          => 'radio',
989 989
 						'label'         => __( 'Show Support Port?', 'gravityview' ),
990
-						'default_value' => $default_settings['support_port'],
990
+						'default_value' => $default_settings[ 'support_port' ],
991 991
 						'horizontal'    => 1,
992 992
 						'choices'       => array(
993 993
 								array(
@@ -1006,7 +1006,7 @@  discard block
 block discarded – undo
1006 1006
 						'name'          => 'no-conflict-mode',
1007 1007
 						'type'          => 'radio',
1008 1008
 						'label'         => __( 'No-Conflict Mode', 'gravityview' ),
1009
-						'default_value' => $default_settings['no-conflict-mode'],
1009
+						'default_value' => $default_settings[ 'no-conflict-mode' ],
1010 1010
 						'horizontal'    => 1,
1011 1011
 						'choices'       => array(
1012 1012
 								array(
@@ -1028,7 +1028,7 @@  discard block
 block discarded – undo
1028 1028
 								'name'          => 'rest_api',
1029 1029
 								'type'          => 'radio',
1030 1030
 								'label'         => __( 'REST API', 'gravityview' ),
1031
-								'default_value' => $default_settings['rest_api'],
1031
+								'default_value' => $default_settings[ 'rest_api' ],
1032 1032
 								'horizontal'    => 1,
1033 1033
 								'choices'       => array(
1034 1034
 										array(
@@ -1047,7 +1047,7 @@  discard block
 block discarded – undo
1047 1047
 					'name' => 'powered_by',
1048 1048
 					'type' => 'checkbox',
1049 1049
 					'label' => __( 'Display "Powered By" Link', 'gravityview' ),
1050
-					'default_value' => $default_settings['powered_by'],
1050
+					'default_value' => $default_settings[ 'powered_by' ],
1051 1051
 					'choices' => array(
1052 1052
 						array(
1053 1053
 							'label' => esc_html__( 'Display a "Powered by GravityView" link', 'gravityview' ),
@@ -1072,7 +1072,7 @@  discard block
 block discarded – undo
1072 1072
 						'name'          => 'beta',
1073 1073
 						'type'          => 'checkbox',
1074 1074
 						'label'         => __( 'Become a Beta Tester', 'gravityview' ),
1075
-						'default_value' => $default_settings['beta'],
1075
+						'default_value' => $default_settings[ 'beta' ],
1076 1076
 						'horizontal'    => 1,
1077 1077
 						'choices'       => array(
1078 1078
 								array(
@@ -1106,17 +1106,17 @@  discard block
 block discarded – undo
1106 1106
 		 * @since 1.7.4
1107 1107
 		 */
1108 1108
 		foreach ( $fields as &$field ) {
1109
-			$field['name']          = isset( $field['name'] ) ? $field['name'] : Utils::get( $field, 'id' );
1110
-			$field['label']         = isset( $field['label'] ) ? $field['label'] : Utils::get( $field, 'title' );
1111
-			$field['default_value'] = isset( $field['default_value'] ) ? $field['default_value'] : Utils::get( $field, 'default' );
1112
-			$field['description']   = isset( $field['description'] ) ? $field['description'] : Utils::get( $field, 'subtitle' );
1109
+			$field[ 'name' ]          = isset( $field[ 'name' ] ) ? $field[ 'name' ] : Utils::get( $field, 'id' );
1110
+			$field[ 'label' ]         = isset( $field[ 'label' ] ) ? $field[ 'label' ] : Utils::get( $field, 'title' );
1111
+			$field[ 'default_value' ] = isset( $field[ 'default_value' ] ) ? $field[ 'default_value' ] : Utils::get( $field, 'default' );
1112
+			$field[ 'description' ]   = isset( $field[ 'description' ] ) ? $field[ 'description' ] : Utils::get( $field, 'subtitle' );
1113 1113
 
1114 1114
 			if ( $disabled_attribute ) {
1115
-				$field['disabled'] = $disabled_attribute;
1115
+				$field[ 'disabled' ] = $disabled_attribute;
1116 1116
 			}
1117 1117
 
1118
-			if ( empty( $field['disabled'] ) ) {
1119
-				unset( $field['disabled'] );
1118
+			if ( empty( $field[ 'disabled' ] ) ) {
1119
+				unset( $field[ 'disabled' ] );
1120 1120
 			}
1121 1121
 		}
1122 1122
 
@@ -1128,23 +1128,23 @@  discard block
 block discarded – undo
1128 1128
 					'description' => __( 'Enter the license key that was sent to you on purchase. This enables plugin updates &amp; support.', 'gravityview' ),
1129 1129
 					'type' => 'edd_license',
1130 1130
 					'data-pending-text' => __( 'Verifying license&hellip;', 'gravityview' ),
1131
-					'default_value' => $default_settings['license_key'],
1131
+					'default_value' => $default_settings[ 'license_key' ],
1132 1132
 					'class' => ( '' == $this->get( 'license_key' ) ) ? 'activate code regular-text edd-license-key' : 'deactivate code regular-text edd-license-key',
1133 1133
 			),
1134 1134
 			array(
1135 1135
 					'name' => 'license_key_response',
1136
-					'default_value' => $default_settings['license_key_response'],
1136
+					'default_value' => $default_settings[ 'license_key_response' ],
1137 1137
 					'type' => 'hidden',
1138 1138
 			),
1139 1139
 			array(
1140 1140
 					'name' => 'license_key_status',
1141
-					'default_value' => $default_settings['license_key_status'],
1141
+					'default_value' => $default_settings[ 'license_key_status' ],
1142 1142
 					'type' => 'hidden',
1143 1143
 			),
1144 1144
 		);
1145 1145
 
1146 1146
 		if ( defined( 'GRAVITYVIEW_LICENSE_KEY' ) && GRAVITYVIEW_LICENSE_KEY ) {
1147
-			$license_fields[0] = array_merge( $license_fields[0], array(
1147
+			$license_fields[ 0 ] = array_merge( $license_fields[ 0 ], array(
1148 1148
 				'disabled' => true,
1149 1149
 				'title'    => __( 'The license key is defined by your site\'s configuration file.', 'gravityview' ),
1150 1150
 			) );
@@ -1155,7 +1155,7 @@  discard block
 block discarded – undo
1155 1155
 
1156 1156
 		if ( \gravityview()->plugin->is_GF_25() ) {
1157 1157
 
1158
-			$sections[] = array(
1158
+			$sections[ ] = array(
1159 1159
 					'title'       => __( 'GravityView License', 'gravityview' ),
1160 1160
 					'class'       => 'gform-settings-panel--full gv-settings-panel--license',
1161 1161
 					'description' => $version_info,
@@ -1173,7 +1173,7 @@  discard block
 block discarded – undo
1173 1173
 			) );
1174 1174
 		}
1175 1175
 
1176
-		$sections[] = array(
1176
+		$sections[ ] = array(
1177 1177
 			'title' => ( gravityview()->plugin->is_GF_25() ? __( 'GravityView Settings', 'gravityview' ) : null ),
1178 1178
 			'class' => 'gform-settings-panel--full gv-settings-panel--core',
1179 1179
 			'fields'      => $fields,
@@ -1197,8 +1197,8 @@  discard block
 block discarded – undo
1197 1197
 
1198 1198
 			if ( $disabled_attribute ) {
1199 1199
 				foreach ( $extension_sections as &$section ) {
1200
-					foreach ( $section['fields'] as &$field ) {
1201
-						$field['disabled'] = $disabled_attribute;
1200
+					foreach ( $section[ 'fields' ] as &$field ) {
1201
+						$field[ 'disabled' ] = $disabled_attribute;
1202 1202
 					}
1203 1203
 				}
1204 1204
 			}
@@ -1264,7 +1264,7 @@  discard block
 block discarded – undo
1264 1264
 	public function settings_edd_license( $field, $echo = true ) {
1265 1265
 
1266 1266
 		if ( defined( 'GRAVITYVIEW_LICENSE_KEY' ) && GRAVITYVIEW_LICENSE_KEY ) {
1267
-			$field['input_type'] = 'password';
1267
+			$field[ 'input_type' ] = 'password';
1268 1268
 		}
1269 1269
 
1270 1270
 		$text = $this->settings_text( $field, false );
@@ -1316,7 +1316,7 @@  discard block
 block discarded – undo
1316 1316
 
1317 1317
 		?>
1318 1318
 
1319
-		<tr id="gaddon-setting-row-<?php echo esc_attr( $field['name'] ); ?>">
1319
+		<tr id="gaddon-setting-row-<?php echo esc_attr( $field[ 'name' ] ); ?>">
1320 1320
 			<td colspan="2">
1321 1321
 				<?php $this->single_setting( $field ); ?>
1322 1322
 			</td>
@@ -1342,8 +1342,8 @@  discard block
 block discarded – undo
1342 1342
 	 */
1343 1343
 	public function single_setting_row( $field ) {
1344 1344
 
1345
-		$field['gv_description'] = Utils::get( $field, 'description' );
1346
-		$field['description']    = Utils::get( $field, 'subtitle' );
1345
+		$field[ 'gv_description' ] = Utils::get( $field, 'description' );
1346
+		$field[ 'description' ]    = Utils::get( $field, 'subtitle' );
1347 1347
 		parent::single_setting_row( $field );
1348 1348
 	}
1349 1349
 
@@ -1404,8 +1404,8 @@  discard block
 block discarded – undo
1404 1404
 		// then we assume it's changed. If it's changed, unset the status and the previous response.
1405 1405
 		if ( ! $added_message && ( $local_key !== $response_key ) ) {
1406 1406
 
1407
-			unset( $posted_settings['license_key_response'] );
1408
-			unset( $posted_settings['license_key_status'] );
1407
+			unset( $posted_settings[ 'license_key_response' ] );
1408
+			unset( $posted_settings[ 'license_key_status' ] );
1409 1409
 
1410 1410
 			\GFCommon::add_error_message( __( 'The license key you entered has been saved, but not activated. Please activate the license.', 'gravityview' ) );
1411 1411
 
Please login to merge, or discard this patch.
php-compatibility/PHPCompatibility/AbstractFunctionCallParameterSniff.php 4 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -65,7 +65,7 @@
 block discarded – undo
65 65
     /**
66 66
      * Returns an array of tokens this test wants to listen for.
67 67
      *
68
-     * @return array
68
+     * @return integer[]
69 69
      */
70 70
     public function register()
71 71
     {
Please login to merge, or discard this patch.
Indentation   +153 added lines, -153 removed lines patch added patch discarded remove patch
@@ -24,157 +24,157 @@
 block discarded – undo
24 24
  */
25 25
 abstract class AbstractFunctionCallParameterSniff extends Sniff
26 26
 {
27
-    /**
28
-     * Is the sniff looking for a function call or a method call ?
29
-     *
30
-     * Note: the child class may need to do additional checks to make sure that
31
-     * the method called is of the right class/object.
32
-     * Checking that is outside of the scope of this abstract sniff.
33
-     *
34
-     * @var bool False (default) if the sniff is looking for function calls.
35
-     *           True if the sniff is looking for method calls.
36
-     */
37
-    protected $isMethod = false;
38
-
39
-    /**
40
-     * Functions the sniff is looking for. Should be defined in the child class.
41
-     *
42
-     * @var array The only requirement for this array is that the top level
43
-     *            array keys are the names of the functions you're looking for.
44
-     *            Other than that, the array can have arbitrary content
45
-     *            depending on your needs.
46
-     */
47
-    protected $targetFunctions = array();
48
-
49
-    /**
50
-     * List of tokens which when they preceed the $stackPtr indicate that this
51
-     * is not a function call.
52
-     *
53
-     * @var array
54
-     */
55
-    private $ignoreTokens = array(
56
-        \T_DOUBLE_COLON    => true,
57
-        \T_OBJECT_OPERATOR => true,
58
-        \T_FUNCTION        => true,
59
-        \T_NEW             => true,
60
-        \T_CONST           => true,
61
-        \T_USE             => true,
62
-    );
63
-
64
-
65
-    /**
66
-     * Returns an array of tokens this test wants to listen for.
67
-     *
68
-     * @return array
69
-     */
70
-    public function register()
71
-    {
72
-        // Handle case-insensitivity of function names.
73
-        $this->targetFunctions = $this->arrayKeysToLowercase($this->targetFunctions);
74
-
75
-        return array(\T_STRING);
76
-    }
77
-
78
-
79
-    /**
80
-     * Processes this test, when one of its tokens is encountered.
81
-     *
82
-     * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
83
-     * @param int                   $stackPtr  The position of the current token in
84
-     *                                         the stack passed in $tokens.
85
-     *
86
-     * @return int|void Integer stack pointer to skip forward or void to continue
87
-     *                  normal file processing.
88
-     */
89
-    public function process(File $phpcsFile, $stackPtr)
90
-    {
91
-        if ($this->bowOutEarly() === true) {
92
-            return;
93
-        }
94
-
95
-        $tokens     = $phpcsFile->getTokens();
96
-        $function   = $tokens[$stackPtr]['content'];
97
-        $functionLc = strtolower($function);
98
-
99
-        if (isset($this->targetFunctions[$functionLc]) === false) {
100
-            return;
101
-        }
102
-
103
-        $prevNonEmpty = $phpcsFile->findPrevious(Tokens::$emptyTokens, ($stackPtr - 1), null, true);
104
-
105
-        if ($this->isMethod === true) {
106
-            if ($tokens[$prevNonEmpty]['code'] !== \T_DOUBLE_COLON
107
-                && $tokens[$prevNonEmpty]['code'] !== \T_OBJECT_OPERATOR
108
-            ) {
109
-                // Not a call to a PHP method.
110
-                return;
111
-            }
112
-        } else {
113
-            if (isset($this->ignoreTokens[$tokens[$prevNonEmpty]['code']]) === true) {
114
-                // Not a call to a PHP function.
115
-                return;
116
-            }
117
-
118
-            if ($tokens[$prevNonEmpty]['code'] === \T_NS_SEPARATOR
119
-                && $tokens[$prevNonEmpty - 1]['code'] === \T_STRING
120
-            ) {
121
-                // Namespaced function.
122
-                return;
123
-            }
124
-        }
125
-
126
-        $parameters = $this->getFunctionCallParameters($phpcsFile, $stackPtr);
127
-
128
-        if (empty($parameters)) {
129
-            return $this->processNoParameters($phpcsFile, $stackPtr, $function);
130
-        } else {
131
-            return $this->processParameters($phpcsFile, $stackPtr, $function, $parameters);
132
-        }
133
-    }
134
-
135
-
136
-    /**
137
-     * Do a version check to determine if this sniff needs to run at all.
138
-     *
139
-     * If the check done in a child class is not specific to one PHP version,
140
-     * this function should return `false`.
141
-     *
142
-     * @return bool
143
-     */
144
-    abstract protected function bowOutEarly();
145
-
146
-
147
-    /**
148
-     * Process the parameters of a matched function.
149
-     *
150
-     * This method has to be made concrete in child classes.
151
-     *
152
-     * @param \PHP_CodeSniffer_File $phpcsFile    The file being scanned.
153
-     * @param int                   $stackPtr     The position of the current token in the stack.
154
-     * @param string                $functionName The token content (function name) which was matched.
155
-     * @param array                 $parameters   Array with information about the parameters.
156
-     *
157
-     * @return int|void Integer stack pointer to skip forward or void to continue
158
-     *                  normal file processing.
159
-     */
160
-    abstract public function processParameters(File $phpcsFile, $stackPtr, $functionName, $parameters);
161
-
162
-
163
-    /**
164
-     * Process the function if no parameters were found.
165
-     *
166
-     * Defaults to doing nothing. Can be overloaded in child classes to handle functions
167
-     * were parameters are expected, but none found.
168
-     *
169
-     * @param \PHP_CodeSniffer_File $phpcsFile    The file being scanned.
170
-     * @param int                   $stackPtr     The position of the current token in the stack.
171
-     * @param string                $functionName The token content (function name) which was matched.
172
-     *
173
-     * @return int|void Integer stack pointer to skip forward or void to continue
174
-     *                  normal file processing.
175
-     */
176
-    public function processNoParameters(File $phpcsFile, $stackPtr, $functionName)
177
-    {
178
-        return;
179
-    }
27
+	/**
28
+	 * Is the sniff looking for a function call or a method call ?
29
+	 *
30
+	 * Note: the child class may need to do additional checks to make sure that
31
+	 * the method called is of the right class/object.
32
+	 * Checking that is outside of the scope of this abstract sniff.
33
+	 *
34
+	 * @var bool False (default) if the sniff is looking for function calls.
35
+	 *           True if the sniff is looking for method calls.
36
+	 */
37
+	protected $isMethod = false;
38
+
39
+	/**
40
+	 * Functions the sniff is looking for. Should be defined in the child class.
41
+	 *
42
+	 * @var array The only requirement for this array is that the top level
43
+	 *            array keys are the names of the functions you're looking for.
44
+	 *            Other than that, the array can have arbitrary content
45
+	 *            depending on your needs.
46
+	 */
47
+	protected $targetFunctions = array();
48
+
49
+	/**
50
+	 * List of tokens which when they preceed the $stackPtr indicate that this
51
+	 * is not a function call.
52
+	 *
53
+	 * @var array
54
+	 */
55
+	private $ignoreTokens = array(
56
+		\T_DOUBLE_COLON    => true,
57
+		\T_OBJECT_OPERATOR => true,
58
+		\T_FUNCTION        => true,
59
+		\T_NEW             => true,
60
+		\T_CONST           => true,
61
+		\T_USE             => true,
62
+	);
63
+
64
+
65
+	/**
66
+	 * Returns an array of tokens this test wants to listen for.
67
+	 *
68
+	 * @return array
69
+	 */
70
+	public function register()
71
+	{
72
+		// Handle case-insensitivity of function names.
73
+		$this->targetFunctions = $this->arrayKeysToLowercase($this->targetFunctions);
74
+
75
+		return array(\T_STRING);
76
+	}
77
+
78
+
79
+	/**
80
+	 * Processes this test, when one of its tokens is encountered.
81
+	 *
82
+	 * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
83
+	 * @param int                   $stackPtr  The position of the current token in
84
+	 *                                         the stack passed in $tokens.
85
+	 *
86
+	 * @return int|void Integer stack pointer to skip forward or void to continue
87
+	 *                  normal file processing.
88
+	 */
89
+	public function process(File $phpcsFile, $stackPtr)
90
+	{
91
+		if ($this->bowOutEarly() === true) {
92
+			return;
93
+		}
94
+
95
+		$tokens     = $phpcsFile->getTokens();
96
+		$function   = $tokens[$stackPtr]['content'];
97
+		$functionLc = strtolower($function);
98
+
99
+		if (isset($this->targetFunctions[$functionLc]) === false) {
100
+			return;
101
+		}
102
+
103
+		$prevNonEmpty = $phpcsFile->findPrevious(Tokens::$emptyTokens, ($stackPtr - 1), null, true);
104
+
105
+		if ($this->isMethod === true) {
106
+			if ($tokens[$prevNonEmpty]['code'] !== \T_DOUBLE_COLON
107
+				&& $tokens[$prevNonEmpty]['code'] !== \T_OBJECT_OPERATOR
108
+			) {
109
+				// Not a call to a PHP method.
110
+				return;
111
+			}
112
+		} else {
113
+			if (isset($this->ignoreTokens[$tokens[$prevNonEmpty]['code']]) === true) {
114
+				// Not a call to a PHP function.
115
+				return;
116
+			}
117
+
118
+			if ($tokens[$prevNonEmpty]['code'] === \T_NS_SEPARATOR
119
+				&& $tokens[$prevNonEmpty - 1]['code'] === \T_STRING
120
+			) {
121
+				// Namespaced function.
122
+				return;
123
+			}
124
+		}
125
+
126
+		$parameters = $this->getFunctionCallParameters($phpcsFile, $stackPtr);
127
+
128
+		if (empty($parameters)) {
129
+			return $this->processNoParameters($phpcsFile, $stackPtr, $function);
130
+		} else {
131
+			return $this->processParameters($phpcsFile, $stackPtr, $function, $parameters);
132
+		}
133
+	}
134
+
135
+
136
+	/**
137
+	 * Do a version check to determine if this sniff needs to run at all.
138
+	 *
139
+	 * If the check done in a child class is not specific to one PHP version,
140
+	 * this function should return `false`.
141
+	 *
142
+	 * @return bool
143
+	 */
144
+	abstract protected function bowOutEarly();
145
+
146
+
147
+	/**
148
+	 * Process the parameters of a matched function.
149
+	 *
150
+	 * This method has to be made concrete in child classes.
151
+	 *
152
+	 * @param \PHP_CodeSniffer_File $phpcsFile    The file being scanned.
153
+	 * @param int                   $stackPtr     The position of the current token in the stack.
154
+	 * @param string                $functionName The token content (function name) which was matched.
155
+	 * @param array                 $parameters   Array with information about the parameters.
156
+	 *
157
+	 * @return int|void Integer stack pointer to skip forward or void to continue
158
+	 *                  normal file processing.
159
+	 */
160
+	abstract public function processParameters(File $phpcsFile, $stackPtr, $functionName, $parameters);
161
+
162
+
163
+	/**
164
+	 * Process the function if no parameters were found.
165
+	 *
166
+	 * Defaults to doing nothing. Can be overloaded in child classes to handle functions
167
+	 * were parameters are expected, but none found.
168
+	 *
169
+	 * @param \PHP_CodeSniffer_File $phpcsFile    The file being scanned.
170
+	 * @param int                   $stackPtr     The position of the current token in the stack.
171
+	 * @param string                $functionName The token content (function name) which was matched.
172
+	 *
173
+	 * @return int|void Integer stack pointer to skip forward or void to continue
174
+	 *                  normal file processing.
175
+	 */
176
+	public function processNoParameters(File $phpcsFile, $stackPtr, $functionName)
177
+	{
178
+		return;
179
+	}
180 180
 }
Please login to merge, or discard this patch.
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -70,9 +70,9 @@  discard block
 block discarded – undo
70 70
     public function register()
71 71
     {
72 72
         // Handle case-insensitivity of function names.
73
-        $this->targetFunctions = $this->arrayKeysToLowercase($this->targetFunctions);
73
+        $this->targetFunctions = $this->arrayKeysToLowercase( $this->targetFunctions );
74 74
 
75
-        return array(\T_STRING);
75
+        return array( \T_STRING );
76 76
     }
77 77
 
78 78
 
@@ -86,49 +86,49 @@  discard block
 block discarded – undo
86 86
      * @return int|void Integer stack pointer to skip forward or void to continue
87 87
      *                  normal file processing.
88 88
      */
89
-    public function process(File $phpcsFile, $stackPtr)
89
+    public function process( File $phpcsFile, $stackPtr )
90 90
     {
91
-        if ($this->bowOutEarly() === true) {
91
+        if ( $this->bowOutEarly() === true ) {
92 92
             return;
93 93
         }
94 94
 
95 95
         $tokens     = $phpcsFile->getTokens();
96
-        $function   = $tokens[$stackPtr]['content'];
97
-        $functionLc = strtolower($function);
96
+        $function   = $tokens[ $stackPtr ][ 'content' ];
97
+        $functionLc = strtolower( $function );
98 98
 
99
-        if (isset($this->targetFunctions[$functionLc]) === false) {
99
+        if ( isset( $this->targetFunctions[ $functionLc ] ) === false ) {
100 100
             return;
101 101
         }
102 102
 
103
-        $prevNonEmpty = $phpcsFile->findPrevious(Tokens::$emptyTokens, ($stackPtr - 1), null, true);
103
+        $prevNonEmpty = $phpcsFile->findPrevious( Tokens::$emptyTokens, ( $stackPtr - 1 ), null, true );
104 104
 
105
-        if ($this->isMethod === true) {
106
-            if ($tokens[$prevNonEmpty]['code'] !== \T_DOUBLE_COLON
107
-                && $tokens[$prevNonEmpty]['code'] !== \T_OBJECT_OPERATOR
105
+        if ( $this->isMethod === true ) {
106
+            if ( $tokens[ $prevNonEmpty ][ 'code' ] !== \T_DOUBLE_COLON
107
+                && $tokens[ $prevNonEmpty ][ 'code' ] !== \T_OBJECT_OPERATOR
108 108
             ) {
109 109
                 // Not a call to a PHP method.
110 110
                 return;
111 111
             }
112 112
         } else {
113
-            if (isset($this->ignoreTokens[$tokens[$prevNonEmpty]['code']]) === true) {
113
+            if ( isset( $this->ignoreTokens[ $tokens[ $prevNonEmpty ][ 'code' ] ] ) === true ) {
114 114
                 // Not a call to a PHP function.
115 115
                 return;
116 116
             }
117 117
 
118
-            if ($tokens[$prevNonEmpty]['code'] === \T_NS_SEPARATOR
119
-                && $tokens[$prevNonEmpty - 1]['code'] === \T_STRING
118
+            if ( $tokens[ $prevNonEmpty ][ 'code' ] === \T_NS_SEPARATOR
119
+                && $tokens[ $prevNonEmpty - 1 ][ 'code' ] === \T_STRING
120 120
             ) {
121 121
                 // Namespaced function.
122 122
                 return;
123 123
             }
124 124
         }
125 125
 
126
-        $parameters = $this->getFunctionCallParameters($phpcsFile, $stackPtr);
126
+        $parameters = $this->getFunctionCallParameters( $phpcsFile, $stackPtr );
127 127
 
128
-        if (empty($parameters)) {
129
-            return $this->processNoParameters($phpcsFile, $stackPtr, $function);
128
+        if ( empty( $parameters ) ) {
129
+            return $this->processNoParameters( $phpcsFile, $stackPtr, $function );
130 130
         } else {
131
-            return $this->processParameters($phpcsFile, $stackPtr, $function, $parameters);
131
+            return $this->processParameters( $phpcsFile, $stackPtr, $function, $parameters );
132 132
         }
133 133
     }
134 134
 
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
      * @return int|void Integer stack pointer to skip forward or void to continue
158 158
      *                  normal file processing.
159 159
      */
160
-    abstract public function processParameters(File $phpcsFile, $stackPtr, $functionName, $parameters);
160
+    abstract public function processParameters( File $phpcsFile, $stackPtr, $functionName, $parameters );
161 161
 
162 162
 
163 163
     /**
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
      * @return int|void Integer stack pointer to skip forward or void to continue
174 174
      *                  normal file processing.
175 175
      */
176
-    public function processNoParameters(File $phpcsFile, $stackPtr, $functionName)
176
+    public function processNoParameters( File $phpcsFile, $stackPtr, $functionName )
177 177
     {
178 178
         return;
179 179
     }
Please login to merge, or discard this patch.
Braces   +4 added lines, -8 removed lines patch added patch discarded remove patch
@@ -22,8 +22,7 @@  discard block
 block discarded – undo
22 22
  * @package  PHPCompatibility
23 23
  * @author   Juliette Reinders Folmer <[email protected]>
24 24
  */
25
-abstract class AbstractFunctionCallParameterSniff extends Sniff
26
-{
25
+abstract class AbstractFunctionCallParameterSniff extends Sniff {
27 26
     /**
28 27
      * Is the sniff looking for a function call or a method call ?
29 28
      *
@@ -67,8 +66,7 @@  discard block
 block discarded – undo
67 66
      *
68 67
      * @return array
69 68
      */
70
-    public function register()
71
-    {
69
+    public function register() {
72 70
         // Handle case-insensitivity of function names.
73 71
         $this->targetFunctions = $this->arrayKeysToLowercase($this->targetFunctions);
74 72
 
@@ -86,8 +84,7 @@  discard block
 block discarded – undo
86 84
      * @return int|void Integer stack pointer to skip forward or void to continue
87 85
      *                  normal file processing.
88 86
      */
89
-    public function process(File $phpcsFile, $stackPtr)
90
-    {
87
+    public function process(File $phpcsFile, $stackPtr) {
91 88
         if ($this->bowOutEarly() === true) {
92 89
             return;
93 90
         }
@@ -173,8 +170,7 @@  discard block
 block discarded – undo
173 170
      * @return int|void Integer stack pointer to skip forward or void to continue
174 171
      *                  normal file processing.
175 172
      */
176
-    public function processNoParameters(File $phpcsFile, $stackPtr, $functionName)
177
-    {
173
+    public function processNoParameters(File $phpcsFile, $stackPtr, $functionName) {
178 174
         return;
179 175
     }
180 176
 }
Please login to merge, or discard this patch.