Completed
Pull Request — master (#836)
by
unknown
08:57 queued 05:20
created
future/includes/class-gv-shortcode-gravityview.php 1 patch
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -2,8 +2,9 @@
 block discarded – undo
2 2
 namespace GV\Shortcodes;
3 3
 
4 4
 /** If this file is called directly, abort. */
5
-if ( ! defined( 'GRAVITYVIEW_DIR' ) )
5
+if ( ! defined( 'GRAVITYVIEW_DIR' ) ) {
6 6
 	die();
7
+}
7 8
 
8 9
 /**
9 10
  * The base \GV\Shortcode class.
Please login to merge, or discard this patch.
includes/widgets/class-gravityview-widget.php 1 patch
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -51,14 +51,14 @@  discard block
 block discarded – undo
51 51
 	// hold widget View options
52 52
 	private $widget_options;
53 53
 
54
-	function __construct( $widget_label , $widget_id , $defaults = array(), $settings = array() ) {
54
+	function __construct( $widget_label, $widget_id, $defaults = array(), $settings = array() ) {
55 55
 
56 56
 
57 57
 		/**
58 58
 		 * The shortcode name is set to the lowercase name of the widget class, unless overridden by the class specifying a different value for $shortcode_name
59 59
 		 * @var string
60 60
 		 */
61
-		$this->shortcode_name = !isset( $this->shortcode_name ) ? strtolower( get_class($this) ) : $this->shortcode_name;
61
+		$this->shortcode_name = ! isset( $this->shortcode_name ) ? strtolower( get_class( $this ) ) : $this->shortcode_name;
62 62
 
63 63
 		$this->widget_label = $widget_label;
64 64
 		$this->widget_id = $widget_id;
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 		$this->settings = wp_parse_args( $settings, $this->settings );
70 70
 
71 71
 		// register widgets to be listed in the View Configuration
72
-		add_filter( 'gravityview_register_directory_widgets', array( $this, 'register_widget') );
72
+		add_filter( 'gravityview_register_directory_widgets', array( $this, 'register_widget' ) );
73 73
 
74 74
 		// widget options
75 75
 		add_filter( 'gravityview_template_widget_options', array( $this, 'assign_widget_options' ), 10, 3 );
@@ -78,10 +78,10 @@  discard block
 block discarded – undo
78 78
 		add_action( "gravityview_render_widget_{$widget_id}", array( $this, 'render_frontend' ), 10, 1 );
79 79
 
80 80
 		// register shortcodes
81
-		add_action( 'wp', array( $this, 'add_shortcode') );
81
+		add_action( 'wp', array( $this, 'add_shortcode' ) );
82 82
 
83 83
 		// Use shortcodes in text widgets.
84
-		add_filter('widget_text', array( $this, 'maybe_do_shortcode' ) );
84
+		add_filter( 'widget_text', array( $this, 'maybe_do_shortcode' ) );
85 85
 	}
86 86
 
87 87
 
@@ -99,14 +99,14 @@  discard block
 block discarded – undo
99 99
 		 * @param boolean $enable_custom_class False by default. Return true if you want to enable.
100 100
 		 * @param GravityView_Widget $this Current instance of GravityView_Widget
101 101
 		 */
102
-		$enable_custom_class = apply_filters('gravityview/widget/enable_custom_class', false, $this );
102
+		$enable_custom_class = apply_filters( 'gravityview/widget/enable_custom_class', false, $this );
103 103
 
104
-		if( $enable_custom_class ) {
104
+		if ( $enable_custom_class ) {
105 105
 
106
-			$settings['custom_class'] = array(
106
+			$settings[ 'custom_class' ] = array(
107 107
 				'type' => 'text',
108 108
 				'label' => __( 'Custom CSS Class:', 'gravityview' ),
109
-				'desc' => __( 'This class will be added to the widget container', 'gravityview'),
109
+				'desc' => __( 'This class will be added to the widget container', 'gravityview' ),
110 110
 				'value' => '',
111 111
 				'merge_tags' => true,
112 112
 			);
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
 	 * @return array|null   Settings array; NULL if not set
129 129
 	 */
130 130
 	public function get_settings() {
131
-		return !empty( $this->settings ) ? $this->settings : NULL;
131
+		return ! empty( $this->settings ) ? $this->settings : NULL;
132 132
 	}
133 133
 
134 134
 	/**
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
 	public function get_setting( $key ) {
140 140
 		$setting = NULL;
141 141
 
142
-		if( isset( $this->settings ) && is_array( $this->settings ) ) {
142
+		if ( isset( $this->settings ) && is_array( $this->settings ) ) {
143 143
 			$setting = isset( $this->settings[ $key ] ) ? $this->settings[ $key ] : NULL;
144 144
 		}
145 145
 
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
 	 */
155 155
 	function maybe_do_shortcode( $text, $widget = NULL ) {
156 156
 
157
-		if( !empty( $this->shortcode_name ) && has_shortcode( $text, $this->shortcode_name ) ) {
157
+		if ( ! empty( $this->shortcode_name ) && has_shortcode( $text, $this->shortcode_name ) ) {
158 158
 			return do_shortcode( $text );
159 159
 		}
160 160
 
@@ -183,26 +183,26 @@  discard block
 block discarded – undo
183 183
 			return;
184 184
 		}
185 185
 
186
-		if( empty( $this->shortcode_name ) ) { return; }
186
+		if ( empty( $this->shortcode_name ) ) { return; }
187 187
 
188 188
 		// If the widget shouldn't output on single entries, don't show it
189
-		if( empty( $this->show_on_single ) && class_exists('GravityView_frontend') && GravityView_frontend::is_single_entry() ) {
190
-			do_action('gravityview_log_debug', sprintf( '%s[add_shortcode]: Skipping; set to not run on single entry.', get_class($this)) );
189
+		if ( empty( $this->show_on_single ) && class_exists( 'GravityView_frontend' ) && GravityView_frontend::is_single_entry() ) {
190
+			do_action( 'gravityview_log_debug', sprintf( '%s[add_shortcode]: Skipping; set to not run on single entry.', get_class( $this ) ) );
191 191
 
192 192
 			add_shortcode( $this->shortcode_name, '__return_null' );
193 193
 			return;
194 194
 		}
195 195
 
196 196
 
197
-		if( !has_gravityview_shortcode( $post ) ) {
197
+		if ( ! has_gravityview_shortcode( $post ) ) {
198 198
 
199
-			do_action('gravityview_log_debug', sprintf( '%s[add_shortcode]: No shortcode present; not adding render_frontend shortcode.', get_class($this)) );
199
+			do_action( 'gravityview_log_debug', sprintf( '%s[add_shortcode]: No shortcode present; not adding render_frontend shortcode.', get_class( $this ) ) );
200 200
 
201 201
 			add_shortcode( $this->shortcode_name, '__return_null' );
202 202
 			return;
203 203
 		}
204 204
 
205
-		add_shortcode( $this->shortcode_name, array( $this, 'render_shortcode') );
205
+		add_shortcode( $this->shortcode_name, array( $this, 'render_shortcode' ) );
206 206
 	}
207 207
 
208 208
 	/**
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
 	 */
213 213
 	function register_widget( $widgets ) {
214 214
 		$widgets[ $this->widget_id ] = array(
215
-			'label' => $this->widget_label ,
215
+			'label' => $this->widget_label,
216 216
 			'description' => $this->widget_description,
217 217
 			'subtitle' => $this->widget_subtitle,
218 218
 		);
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
 	 */
230 230
 	public function assign_widget_options( $options = array(), $template = '', $widget = '' ) {
231 231
 
232
-		if( $this->widget_id === $widget ) {
232
+		if ( $this->widget_id === $widget ) {
233 233
 			$options = array_merge( $options, $this->settings );
234 234
 		}
235 235
 
@@ -242,9 +242,9 @@  discard block
 block discarded – undo
242 242
 	 *
243 243
 	 * @return void
244 244
 	 */
245
-	public function render_frontend( $widget_args, $content = '', $context = '') {
245
+	public function render_frontend( $widget_args, $content = '', $context = '' ) {
246 246
 		// to be defined by child class
247
-		if( !$this->pre_render_frontend() ) {
247
+		if ( ! $this->pre_render_frontend() ) {
248 248
 			return;
249 249
 		}
250 250
 	}
@@ -256,8 +256,8 @@  discard block
 block discarded – undo
256 256
 	public function pre_render_frontend() {
257 257
 		$gravityview_view = GravityView_View::getInstance();
258 258
 
259
-		if( empty( $gravityview_view ) ) {
260
-			do_action('gravityview_log_debug', sprintf( '%s[render_frontend]: $gravityview_view not instantiated yet.', get_class($this)) );
259
+		if ( empty( $gravityview_view ) ) {
260
+			do_action( 'gravityview_log_debug', sprintf( '%s[render_frontend]: $gravityview_view not instantiated yet.', get_class( $this ) ) );
261 261
 			return false;
262 262
 		}
263 263
 
@@ -268,8 +268,8 @@  discard block
 block discarded – undo
268 268
 		 */
269 269
 		$hide_until_search = apply_filters( 'gravityview/widget/hide_until_searched', $gravityview_view->hide_until_searched, $this );
270 270
 
271
-		if( $hide_until_search ) {
272
-			do_action('gravityview_log_debug', sprintf( '%s[render_frontend]: Hide View data until search is performed', get_class($this)) );
271
+		if ( $hide_until_search ) {
272
+			do_action( 'gravityview_log_debug', sprintf( '%s[render_frontend]: Hide View data until search is performed', get_class( $this ) ) );
273 273
 			return false;
274 274
 		}
275 275
 
Please login to merge, or discard this patch.
gravityview.php 1 patch
Braces   +5 added lines, -4 removed lines patch added patch discarded remove patch
@@ -312,8 +312,9 @@  discard block
 block discarded – undo
312 312
 	 */
313 313
 	public static function is_admin() {
314 314
 
315
-		if ( function_exists( 'gravityview' ) )
316
-			return gravityview()->request->is_admin();
315
+		if ( function_exists( 'gravityview' ) ) {
316
+					return gravityview()->request->is_admin();
317
+		}
317 318
 
318 319
 		$doing_ajax = defined( 'DOING_AJAX' ) ? DOING_AJAX : false;
319 320
 
@@ -382,7 +383,7 @@  discard block
 block discarded – undo
382 383
      * @param mixed $data Additional data to display
383 384
      * @return void
384 385
      */
385
-    public static function log_debug( $message, $data = null ){
386
+    public static function log_debug( $message, $data = null ) {
386 387
 	    /**
387 388
 	     * @action `gravityview_log_debug` Log a debug message that shows up in the Gravity Forms Logging Addon and also the Debug Bar plugin output
388 389
 	     * @param string $message Message to display
@@ -396,7 +397,7 @@  discard block
 block discarded – undo
396 397
      * @param  string $message log message
397 398
      * @return void
398 399
      */
399
-    public static function log_error( $message, $data = null ){
400
+    public static function log_error( $message, $data = null ) {
400 401
 	    /**
401 402
 	     * @action `gravityview_log_error` Log an error message that shows up in the Gravity Forms Logging Addon and also the Debug Bar plugin output
402 403
 	     * @param string $message Error message to display
Please login to merge, or discard this patch.
includes/class-gvlogic-shortcode.php 1 patch
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -232,7 +232,7 @@
 block discarded – undo
232 232
 	 * Does the if and the comparison match?
233 233
 	 * @uses GVCommon::matches_operation
234 234
 	 *
235
-	 * @return boolean True: yep; false: nope
235
+	 * @return boolean|null True: yep; false: nope
236 236
 	 */
237 237
 	private function set_is_match() {
238 238
 		$this->is_match = GVCommon::matches_operation( $this->if, $this->comparison, $this->operation );
Please login to merge, or discard this patch.
includes/fields/class-gravityview-field.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -245,7 +245,7 @@
 block discarded – undo
245 245
 	 * @param bool $url_encode Whether to URL-encode output
246 246
 	 * @param bool $esc_html Whether to apply `esc_html()` to output
247 247
 	 *
248
-	 * @return mixed
248
+	 * @return string
249 249
 	 */
250 250
 	public function replace_merge_tag( $matches = array(), $text = '', $form = array(), $entry = array(), $url_encode = false, $esc_html = false ) {
251 251
 
Please login to merge, or discard this patch.
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -134,17 +134,17 @@  discard block
 block discarded – undo
134 134
 
135 135
 		add_filter( 'gravityview/sortable/field_blacklist', array( $this, '_filter_sortable_fields' ), 1 );
136 136
 
137
-		if( $this->entry_meta_key ) {
137
+		if ( $this->entry_meta_key ) {
138 138
 			add_filter( 'gform_entry_meta', array( $this, 'add_entry_meta' ) );
139 139
 			add_filter( 'gravityview/common/sortable_fields', array( $this, 'add_sortable_field' ), 10, 2 );
140 140
 		}
141 141
 
142
-		if( $this->_custom_merge_tag ) {
142
+		if ( $this->_custom_merge_tag ) {
143 143
 			add_filter( 'gform_custom_merge_tags', array( $this, '_filter_gform_custom_merge_tags' ), 10, 4 );
144 144
 			add_filter( 'gform_replace_merge_tags', array( $this, '_filter_gform_replace_merge_tags' ), 10, 7 );
145 145
 		}
146 146
 
147
-		if( 'meta' === $this->group || '' !== $this->default_search_label ) {
147
+		if ( 'meta' === $this->group || '' !== $this->default_search_label ) {
148 148
 			add_filter( 'gravityview_search_field_label', array( $this, 'set_default_search_label' ), 10, 3 );
149 149
 		}
150 150
 
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
 		 * Auto-assign label from Gravity Forms label, if exists
153 153
 		 * @since 1.20
154 154
 		 */
155
-		if( empty( $this->label ) && ! empty( $this->_gf_field_class_name ) && class_exists( $this->_gf_field_class_name ) ) {
155
+		if ( empty( $this->label ) && ! empty( $this->_gf_field_class_name ) && class_exists( $this->_gf_field_class_name ) ) {
156 156
 			$this->label = ucfirst( GF_Fields::get( $this->name )->get_form_editor_field_title() );
157 157
 		}
158 158
 
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
 			'type'  => $this->name
176 176
 		);
177 177
 
178
-		$fields["{$this->entry_meta_key}"] = $added_field;
178
+		$fields[ "{$this->entry_meta_key}" ] = $added_field;
179 179
 
180 180
 		return $fields;
181 181
 	}
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
 	 */
196 196
 	function set_default_search_label( $label = '', $gf_field = null, $field = array() ) {
197 197
 
198
-		if( $this->name === $field['field'] && '' === $label ) {
198
+		if ( $this->name === $field[ 'field' ] && '' === $label ) {
199 199
 			$label = esc_html( $this->default_search_label );
200 200
 		}
201 201
 
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
 	 *
217 217
 	 * @return string Original text if {_custom_merge_tag} isn't found. Otherwise, replaced text.
218 218
 	 */
219
-	public function _filter_gform_replace_merge_tags( $text, $form = array(), $entry = array(), $url_encode = false, $esc_html = false  ) {
219
+	public function _filter_gform_replace_merge_tags( $text, $form = array(), $entry = array(), $url_encode = false, $esc_html = false ) {
220 220
 
221 221
 		// Is there is field merge tag? Strip whitespace off the ned, too.
222 222
 		preg_match_all( '/{' . preg_quote( $this->_custom_merge_tag ) . ':?(.*?)(?:\s)?}/ism', $text, $matches, PREG_SET_ORDER );
@@ -247,19 +247,19 @@  discard block
 block discarded – undo
247 247
 	 */
248 248
 	public function replace_merge_tag( $matches = array(), $text = '', $form = array(), $entry = array(), $url_encode = false, $esc_html = false ) {
249 249
 
250
-		foreach( $matches as $match ) {
250
+		foreach ( $matches as $match ) {
251 251
 
252
-			$full_tag = $match[0];
252
+			$full_tag = $match[ 0 ];
253 253
 
254 254
 			// Strip the Merge Tags
255
-			$tag = str_replace( array( '{', '}'), '', $full_tag );
255
+			$tag = str_replace( array( '{', '}' ), '', $full_tag );
256 256
 
257 257
 			// Replace the value from the entry, if exists
258
-			if( isset( $entry[ $tag ] ) ) {
258
+			if ( isset( $entry[ $tag ] ) ) {
259 259
 
260 260
 				$value = $entry[ $tag ];
261 261
 
262
-				if( is_callable( array( $this, 'get_content') ) ) {
262
+				if ( is_callable( array( $this, 'get_content' ) ) ) {
263 263
 					$value = $this->get_content( $value );
264 264
 				}
265 265
 
@@ -332,8 +332,8 @@  discard block
 block discarded – undo
332 332
 	 */
333 333
 	public function _filter_sortable_fields( $not_sortable ) {
334 334
 
335
-		if( ! $this->is_sortable ) {
336
-			$not_sortable[] = $this->name;
335
+		if ( ! $this->is_sortable ) {
336
+			$not_sortable[ ] = $this->name;
337 337
 		}
338 338
 
339 339
 		return $not_sortable;
@@ -350,7 +350,7 @@  discard block
 block discarded – undo
350 350
 	 */
351 351
 	function add_entry_meta( $entry_meta ) {
352 352
 
353
-		if( ! isset( $entry_meta["{$this->entry_meta_key}"] ) ) {
353
+		if ( ! isset( $entry_meta[ "{$this->entry_meta_key}" ] ) ) {
354 354
 
355 355
 			$added_meta = array(
356 356
 				'label'             => $this->label,
@@ -359,13 +359,13 @@  discard block
 block discarded – undo
359 359
 			);
360 360
 
361 361
 			if ( $this->entry_meta_update_callback && is_callable( $this->entry_meta_update_callback ) ) {
362
-				$added_meta['update_entry_meta_callback'] = $this->entry_meta_update_callback;
362
+				$added_meta[ 'update_entry_meta_callback' ] = $this->entry_meta_update_callback;
363 363
 			}
364 364
 
365
-			$entry_meta["{$this->entry_meta_key}"] = $added_meta;
365
+			$entry_meta[ "{$this->entry_meta_key}" ] = $added_meta;
366 366
 
367 367
 		} else {
368
-			do_action( 'gravityview_log_error', __METHOD__ . ' Entry meta already set: ' . $this->entry_meta_key, $entry_meta["{$this->entry_meta_key}"] );
368
+			do_action( 'gravityview_log_error', __METHOD__ . ' Entry meta already set: ' . $this->entry_meta_key, $entry_meta[ "{$this->entry_meta_key}" ] );
369 369
 		}
370 370
 
371 371
 		return $entry_meta;
@@ -394,7 +394,7 @@  discard block
 block discarded – undo
394 394
 			'date_display' => array(
395 395
 				'type' => 'text',
396 396
 				'label' => __( 'Override Date Format', 'gravityview' ),
397
-				'desc' => sprintf( __( 'Define how the date is displayed (using %sthe PHP date format%s)', 'gravityview'), '<a href="https://codex.wordpress.org/Formatting_Date_and_Time">', '</a>' ),
397
+				'desc' => sprintf( __( 'Define how the date is displayed (using %sthe PHP date format%s)', 'gravityview' ), '<a href="https://codex.wordpress.org/Formatting_Date_and_Time">', '</a>' ),
398 398
 				/**
399 399
 				 * @filter `gravityview_date_format` Override the date format with a [PHP date format](https://codex.wordpress.org/Formatting_Date_and_Time)
400 400
 				 * @param[in,out] null|string $date_format Date Format (default: null)
@@ -419,7 +419,7 @@  discard block
 block discarded – undo
419 419
 
420 420
 		$options = $this->field_support_options();
421 421
 
422
-		if( isset( $options[ $key ] ) ) {
422
+		if ( isset( $options[ $key ] ) ) {
423 423
 			$field_options[ $key ] = $options[ $key ];
424 424
 		}
425 425
 
@@ -483,11 +483,11 @@  discard block
 block discarded – undo
483 483
 		$connected_form = rgpost( 'form_id' );
484 484
 
485 485
 		// Otherwise, get the Form ID from the Post page
486
-		if( empty( $connected_form ) ) {
486
+		if ( empty( $connected_form ) ) {
487 487
 			$connected_form = gravityview_get_form_id( get_the_ID() );
488 488
 		}
489 489
 
490
-		if( empty( $connected_form ) ) {
490
+		if ( empty( $connected_form ) ) {
491 491
 			do_action( 'gravityview_log_error', sprintf( '%s: Form not found for form ID "%s"', __METHOD__, $connected_form ) );
492 492
 			return false;
493 493
 		}
Please login to merge, or discard this patch.
includes/fields/class-gravityview-fields.php 1 patch
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -77,7 +77,7 @@
 block discarded – undo
77 77
 	/**
78 78
 	 * Alias for get_instance()
79 79
 	 *
80
-	 * @param $field_name
80
+	 * @param string $field_name
81 81
 	 *
82 82
 	 * @return GravityView_Field|false
83 83
 	 */
Please login to merge, or discard this patch.
includes/fields/class-gravityview-field-date.php 1 patch
Indentation   -1 removed lines patch added patch discarded remove patch
@@ -40,7 +40,6 @@
 block discarded – undo
40 40
 	 * Get the default date format for a field based on the field ID and the time format setting
41 41
 	 *
42 42
 	 * @since 1.16.4
43
-
44 43
 	 * @param string $date_format The Gravity Forms date format for the field. Default: "mdy"
45 44
 	 * @param int $field_id The ID of the field. Used to figure out full date/day/month/year
46 45
 	 *
Please login to merge, or discard this patch.
includes/fields/class-gravityview-field-multiselect.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@
 block discarded – undo
13 13
 	 * @see GFCommon::get_field_filter_settings Gravity Forms suggests checkboxes should just be "contains"
14 14
 	 * @var array
15 15
 	 */
16
-	var $search_operators = array( 'is', 'in', 'not in', 'isnot', 'contains');
16
+	var $search_operators = array( 'is', 'in', 'not in', 'isnot', 'contains' );
17 17
 
18 18
 	var $is_searchable = true;
19 19
 
Please login to merge, or discard this patch.
includes/fields/class-gravityview-field-radio.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
 
12 12
 	var $is_searchable = true;
13 13
 
14
-	var $search_operators = array( 'is', 'in', 'not in', 'isnot', 'contains');
14
+	var $search_operators = array( 'is', 'in', 'not in', 'isnot', 'contains' );
15 15
 
16 16
 	var $_gf_field_class_name = 'GF_Field_Radio';
17 17
 
@@ -40,8 +40,8 @@  discard block
 block discarded – undo
40 40
 		// Set the $_field_id var
41 41
 		$field_options = parent::field_options( $field_options, $template_id, $field_id, $context, $input_type );
42 42
 		
43
-		if( $this->is_choice_value_enabled() ) {
44
-			$field_options['choice_display'] = array(
43
+		if ( $this->is_choice_value_enabled() ) {
44
+			$field_options[ 'choice_display' ] = array(
45 45
 				'type'    => 'radio',
46 46
 				'value'   => 'value',
47 47
 				'label'   => __( 'What should be displayed:', 'gravityview' ),
Please login to merge, or discard this patch.