Completed
Push — develop ( 4df9ef...dbeb5a )
by Zack
18:03
created
includes/class-gravityview-merge-tags.php 1 patch
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
 
75 75
 		foreach ( $modifiers as $passed_modifier ) {
76 76
 
77
-			foreach( $gv_modifiers as $gv_modifier => $method ) {
77
+			foreach ( $gv_modifiers as $gv_modifier => $method ) {
78 78
 
79 79
 				// Uses ^ to only match the first modifier, to enforce same order as passed by GF
80 80
 				preg_match( '/^' . $gv_modifier . '/ism', $passed_modifier, $matches );
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
 	 */
119 119
 	private static function modifier_timestamp( $raw_value, $matches ) {
120 120
 
121
-		if( empty( $matches[0] ) ) {
121
+		if ( empty( $matches[ 0 ] ) ) {
122 122
 			return $raw_value;
123 123
 		}
124 124
 
@@ -147,11 +147,11 @@  discard block
 block discarded – undo
147 147
 	 */
148 148
 	private static function modifier_maxwords( $raw_value, $matches, $field = null ) {
149 149
 
150
-		if( ! is_string( $raw_value ) || empty( $matches[1] ) || ! function_exists( 'wp_trim_words' ) ) {
150
+		if ( ! is_string( $raw_value ) || empty( $matches[ 1 ] ) || ! function_exists( 'wp_trim_words' ) ) {
151 151
 			return $raw_value;
152 152
 		}
153 153
 
154
-		$max = intval( $matches[1] );
154
+		$max = intval( $matches[ 1 ] );
155 155
 
156 156
 		$more_placeholder = '[GVMORE]';
157 157
 
@@ -220,7 +220,7 @@  discard block
 block discarded – undo
220 220
 	private static function modifier_explode( $raw_value, $matches, $value, $field = null ) {
221 221
 
222 222
 		// For JSON-encoded arrays
223
-		if( $json_array = json_decode( $raw_value, true ) ) {
223
+		if ( $json_array = json_decode( $raw_value, true ) ) {
224 224
 			return implode( ' ', $json_array );
225 225
 		}
226 226
 
@@ -241,13 +241,13 @@  discard block
 block discarded – undo
241 241
 	 */
242 242
 	private static function modifier_strings( $raw_value, $matches, $value = '', $field = null ) {
243 243
 
244
-		if( empty( $matches[0] ) ) {
244
+		if ( empty( $matches[ 0 ] ) ) {
245 245
 			return $raw_value;
246 246
 		}
247 247
 
248 248
 		$return = $raw_value;
249 249
 
250
-		switch( $matches[0] ) {
250
+		switch ( $matches[ 0 ] ) {
251 251
 			case 'urlencode':
252 252
 				$return = urlencode( $raw_value );
253 253
 				break;
@@ -329,9 +329,9 @@  discard block
 block discarded – undo
329 329
 		 * @internal Fixed $form['title'] in Gravity Forms
330 330
 		 * @see      https://github.com/gravityforms/gravityforms/pull/27/files
331 331
 		 */
332
-		$form['title']  = isset( $form['title'] ) ? $form['title'] : '';
333
-		$form['id']     = isset( $form['id'] ) ? $form['id'] : '';
334
-		$form['fields'] = isset( $form['fields'] ) ? $form['fields'] : array();
332
+		$form[ 'title' ]  = isset( $form[ 'title' ] ) ? $form[ 'title' ] : '';
333
+		$form[ 'id' ]     = isset( $form[ 'id' ] ) ? $form[ 'id' ] : '';
334
+		$form[ 'fields' ] = isset( $form[ 'fields' ] ) ? $form[ 'fields' ] : array();
335 335
 
336 336
 		return GFCommon::replace_variables( $text, $form, $entry, $url_encode, $esc_html, $nl2br, $format, $aux_data );
337 337
 	}
@@ -392,7 +392,7 @@  discard block
 block discarded – undo
392 392
 		// Is there is {gv_entry_link} or {gv_entry_link:[post id]} or {gv_entry_link:[post id]:[action]} merge tag?
393 393
 		preg_match_all( "/{gv_entry_link(?:\:(\d+)\:?(.*?))?}/ism", $original_text, $matches, PREG_SET_ORDER );
394 394
 
395
-		if( empty( $matches ) ) {
395
+		if ( empty( $matches ) ) {
396 396
 			return $original_text;
397 397
 		}
398 398
 
@@ -413,18 +413,18 @@  discard block
 block discarded – undo
413 413
 		 * }
414 414
 		 */
415 415
 		foreach ( $matches as $match ) {
416
-			$full_tag = $match[0];
416
+			$full_tag = $match[ 0 ];
417 417
 
418 418
 			$link_args = array(
419 419
 				'return' => 'url',
420
-				'entry_id' => $entry['id'],
420
+				'entry_id' => $entry[ 'id' ],
421 421
 				'post_id' => \GV\Utils::get( $match, 1, null ),
422 422
 				'action' => \GV\Utils::get( $match, 2, 'read' ),
423 423
 			);
424 424
 
425 425
 			$entry_link = $Shortcode->read_shortcode( $link_args, null, 'gv_entry_link_merge_tag' );
426 426
 
427
-			if( $url_encode ) {
427
+			if ( $url_encode ) {
428 428
 				$entry_link = urlencode( $entry_link );
429 429
 			}
430 430
 
@@ -461,7 +461,7 @@  discard block
 block discarded – undo
461 461
 			'diff' => in_array( 'diff', $exploded ), // {date_created:diff}
462 462
 			'raw' => in_array( 'raw', $exploded ), // {date_created:raw}
463 463
 			'timestamp' => in_array( 'timestamp', $exploded ), // {date_created:timestamp}
464
-			'time' => in_array( 'time', $exploded ),  // {date_created:time}
464
+			'time' => in_array( 'time', $exploded ), // {date_created:time}
465 465
 		);
466 466
 
467 467
 		$formatted_date = GVCommon::format_date( $date_created, $atts );
@@ -538,8 +538,8 @@  discard block
 block discarded – undo
538 538
 			return $original_text;
539 539
 		}
540 540
 
541
-		foreach ( (array) $matches as $match ) {
542
-			$full_tag = $match[0];
541
+		foreach ( (array)$matches as $match ) {
542
+			$full_tag = $match[ 0 ];
543 543
 			$modifier = \GV\Utils::get( $match, 2, 'permalink' );
544 544
 
545 545
 			$replacement = false;
@@ -557,7 +557,7 @@  discard block
 block discarded – undo
557 557
 					$replacement = esc_html( $replacement );
558 558
 				}
559 559
 
560
-				if( $url_encode ) {
560
+				if ( $url_encode ) {
561 561
 					$replacement = urlencode( $replacement );
562 562
 				}
563 563
 
@@ -597,14 +597,14 @@  discard block
 block discarded – undo
597 597
 		preg_match_all( "/{get:(.*?)}/ism", $text, $matches, PREG_SET_ORDER );
598 598
 
599 599
 		// If there are no matches OR the Entry `created_by` isn't set or is 0 (no user)
600
-		if( empty( $matches ) ) {
600
+		if ( empty( $matches ) ) {
601 601
 			return $text;
602 602
 		}
603 603
 
604 604
 		foreach ( $matches as $match ) {
605 605
 
606
-			$full_tag = $match[0];
607
-			$property = $match[1];
606
+			$full_tag = $match[ 0 ];
607
+			$property = $match[ 1 ];
608 608
 
609 609
 			$value = stripslashes_deep( \GV\Utils::_GET( $property ) );
610 610
 
@@ -628,7 +628,7 @@  discard block
 block discarded – undo
628 628
 			 * @since 1.15
629 629
 			 * @param bool $esc_html Whether to esc_html() the value. Default: `true`
630 630
 			 */
631
-			$esc_html = apply_filters('gravityview/merge_tags/get/esc_html/' . $property, true );
631
+			$esc_html = apply_filters( 'gravityview/merge_tags/get/esc_html/' . $property, true );
632 632
 
633 633
 			$value = $esc_html ? esc_html( $value ) : $value;
634 634
 
@@ -639,7 +639,7 @@  discard block
 block discarded – undo
639 639
 			 * @param[in] array $form Gravity Forms form array
640 640
 			 * @param[in] array $entry Entry array
641 641
 			 */
642
-			$value = apply_filters('gravityview/merge_tags/get/value/' . $property, $value, $text, $form, $entry );
642
+			$value = apply_filters( 'gravityview/merge_tags/get/value/' . $property, $value, $text, $form, $entry );
643 643
 
644 644
 			$text = str_replace( $full_tag, $value, $text );
645 645
 		}
Please login to merge, or discard this patch.
includes/class-admin-add-shortcode.php 1 patch
Spacing   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -20,12 +20,12 @@  discard block
 block discarded – undo
20 20
 
21 21
 	function __construct() {
22 22
 
23
-			add_action( 'media_buttons', array( $this, 'add_shortcode_button'), 30);
23
+			add_action( 'media_buttons', array( $this, 'add_shortcode_button' ), 30 );
24 24
 
25
-			add_action( 'admin_footer',	array( $this, 'add_shortcode_popup') );
25
+			add_action( 'admin_footer', array( $this, 'add_shortcode_popup' ) );
26 26
 
27 27
 			// adding styles and scripts
28
-			add_action( 'admin_enqueue_scripts', array( $this, 'add_scripts_and_styles') );
28
+			add_action( 'admin_enqueue_scripts', array( $this, 'add_scripts_and_styles' ) );
29 29
 
30 30
 			// ajax - populate sort fields based on the selected view
31 31
 			add_action( 'wp_ajax_gv_sortable_fields', array( $this, 'get_sortable_fields' ) );
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
 	 */
41 41
 	function is_post_editor_screen() {
42 42
 		global $current_screen, $pagenow;
43
-		return !empty( $current_screen->post_type ) && 'gravityview' != $current_screen->post_type && in_array( $pagenow , array( 'post.php' , 'post-new.php' ) );
43
+		return ! empty( $current_screen->post_type ) && 'gravityview' != $current_screen->post_type && in_array( $pagenow, array( 'post.php', 'post-new.php' ) );
44 44
 	}
45 45
 
46 46
 
@@ -55,15 +55,15 @@  discard block
 block discarded – undo
55 55
 		/**
56 56
 		 * @since 1.15.3
57 57
 		 */
58
-		if( ! GVCommon::has_cap( array( 'publish_gravityviews' ) ) ) {
58
+		if ( ! GVCommon::has_cap( array( 'publish_gravityviews' ) ) ) {
59 59
 			return;
60 60
 		}
61 61
 
62
-		if( !$this->is_post_editor_screen() ) {
62
+		if ( ! $this->is_post_editor_screen() ) {
63 63
 			return;
64 64
 		}
65 65
 		?>
66
-		<a href="#TB_inline?width=600&amp;height=800&amp;inlineId=select_gravityview_view" class="thickbox hide-if-no-js button gform_media_link" id="add_gravityview" title="<?php esc_attr_e("Insert View", 'gravityview'); ?>"><span class="icon gv-icon-astronaut-head"></span><?php esc_html_e( 'Add View', 'gravityview' ); ?></a>
66
+		<a href="#TB_inline?width=600&amp;height=800&amp;inlineId=select_gravityview_view" class="thickbox hide-if-no-js button gform_media_link" id="add_gravityview" title="<?php esc_attr_e( "Insert View", 'gravityview' ); ?>"><span class="icon gv-icon-astronaut-head"></span><?php esc_html_e( 'Add View', 'gravityview' ); ?></a>
67 67
 		<?php
68 68
 
69 69
 	}
@@ -79,16 +79,16 @@  discard block
 block discarded – undo
79 79
 	function add_shortcode_popup() {
80 80
 		global $post;
81 81
 
82
-		if( !$this->is_post_editor_screen() ) {
82
+		if ( ! $this->is_post_editor_screen() ) {
83 83
 			return;
84 84
 		}
85 85
 
86
-		$post_type = get_post_type_object($post->post_type);
86
+		$post_type = get_post_type_object( $post->post_type );
87 87
 
88
-		$views = get_posts( array('post_type' => 'gravityview', 'posts_per_page' => -1 ) );
88
+		$views = get_posts( array( 'post_type' => 'gravityview', 'posts_per_page' => -1 ) );
89 89
 
90 90
 		// If there are no views set up yet, we get outta here.
91
-		if( empty( $views ) ) {
91
+		if ( empty( $views ) ) {
92 92
 			echo '<div id="select_gravityview_view"><div class="wrap">' . GravityView_Admin::no_views_text() . '</div></div>';
93 93
 			return;
94 94
 		}
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
 				<div class="wrap">
100 100
 
101 101
 					<h2 class=""><?php esc_html_e( 'Embed a View', 'gravityview' ); ?></h2>
102
-					<p class="subtitle"><?php printf( esc_attr ( __( 'Use this form to embed a View into this %s. %sLearn more about using shortcodes.%s', 'gravityview') ), $post_type->labels->singular_name, '<a href="https://docs.gravityview.co/article/73-using-the-shortcode" target="_blank" rel="noopener noreferrer">', '</a>' ); ?></p>
102
+					<p class="subtitle"><?php printf( esc_attr( __( 'Use this form to embed a View into this %s. %sLearn more about using shortcodes.%s', 'gravityview' ) ), $post_type->labels->singular_name, '<a href="https://docs.gravityview.co/article/73-using-the-shortcode" target="_blank" rel="noopener noreferrer">', '</a>' ); ?></p>
103 103
 
104 104
 					<div>
105 105
 						<h3><label for="gravityview_id"><?php esc_html_e( 'Select a View', 'gravityview' ); ?></label></h3>
@@ -107,9 +107,9 @@  discard block
 block discarded – undo
107 107
 						<select name="gravityview_id" id="gravityview_id">
108 108
 							<option value=""><?php esc_html_e( '&mdash; Select a View to Insert &mdash;', 'gravityview' ); ?></option>
109 109
 							<?php
110
-							foreach( $views as $view ) {
111
-								$title = empty( $view->post_title ) ? __('(no title)', 'gravityview') : $view->post_title;
112
-								echo '<option value="'. $view->ID .'">'. esc_html( sprintf('%s #%d', $title, $view->ID ) ) .'</option>';
110
+							foreach ( $views as $view ) {
111
+								$title = empty( $view->post_title ) ? __( '(no title)', 'gravityview' ) : $view->post_title;
112
+								echo '<option value="' . $view->ID . '">' . esc_html( sprintf( '%s #%d', $title, $view->ID ) ) . '</option>';
113 113
 							}
114 114
 							?>
115 115
 						</select>
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
 
126 126
 						foreach ( $settings as $key => $setting ) {
127 127
 
128
-							if( empty( $setting['show_in_shortcode'] ) ) { continue; }
128
+							if ( empty( $setting[ 'show_in_shortcode' ] ) ) { continue; }
129 129
 
130 130
 							GravityView_Render_Settings::render_setting_row( $key, array(), NULL, 'gravityview_%s', 'gravityview_%s' );
131 131
 						}
@@ -134,8 +134,8 @@  discard block
 block discarded – undo
134 134
 					</table>
135 135
 
136 136
 					<div class="submit">
137
-						<input type="submit" class="button button-primary button-large alignleft hide-if-js" value="<?php esc_attr_e('Insert View', 'gravityview' ); ?>" id="insert_gravityview_view" />
138
-						<input class="button button-secondary alignright" type="submit" onclick="tb_remove(); return false;" value="<?php esc_attr_e("Cancel", 'gravityview'); ?>" />
137
+						<input type="submit" class="button button-primary button-large alignleft hide-if-js" value="<?php esc_attr_e( 'Insert View', 'gravityview' ); ?>" id="insert_gravityview_view" />
138
+						<input class="button button-secondary alignright" type="submit" onclick="tb_remove(); return false;" value="<?php esc_attr_e( "Cancel", 'gravityview' ); ?>" />
139 139
 					</div>
140 140
 
141 141
 				</div>
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
 	 */
157 157
 	function add_scripts_and_styles() {
158 158
 
159
-		if( ! $this->is_post_editor_screen() ) {
159
+		if ( ! $this->is_post_editor_screen() ) {
160 160
 			return;
161 161
 		}
162 162
 
@@ -167,22 +167,22 @@  discard block
 block discarded – undo
167 167
 
168 168
 		$protocol = is_ssl() ? 'https://' : 'http://';
169 169
 
170
-		wp_enqueue_style( 'jquery-ui-datepicker', $protocol.'ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/themes/smoothness/jquery-ui.css', array(), GravityView_Plugin::version );
170
+		wp_enqueue_style( 'jquery-ui-datepicker', $protocol . 'ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/themes/smoothness/jquery-ui.css', array(), GravityView_Plugin::version );
171 171
 
172 172
 		//enqueue styles
173
-		wp_register_style( 'gravityview_postedit_styles', plugins_url('assets/css/admin-post-edit.css', GRAVITYVIEW_FILE), array(), GravityView_Plugin::version );
173
+		wp_register_style( 'gravityview_postedit_styles', plugins_url( 'assets/css/admin-post-edit.css', GRAVITYVIEW_FILE ), array(), GravityView_Plugin::version );
174 174
 		wp_enqueue_style( 'gravityview_postedit_styles' );
175 175
 
176
-		$script_debug = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min';
176
+		$script_debug = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
177 177
 
178 178
 		// custom js
179
-		wp_register_script( 'gravityview_postedit_scripts',  plugins_url('assets/js/admin-post-edit'.$script_debug.'.js', GRAVITYVIEW_FILE), array( 'jquery', 'jquery-ui-datepicker' ), GravityView_Plugin::version );
179
+		wp_register_script( 'gravityview_postedit_scripts', plugins_url( 'assets/js/admin-post-edit' . $script_debug . '.js', GRAVITYVIEW_FILE ), array( 'jquery', 'jquery-ui-datepicker' ), GravityView_Plugin::version );
180 180
 		wp_enqueue_script( 'gravityview_postedit_scripts' );
181
-		wp_localize_script('gravityview_postedit_scripts', 'gvGlobals', array(
182
-			'nonce' => wp_create_nonce( 'gravityview_ajaxaddshortcode'),
181
+		wp_localize_script( 'gravityview_postedit_scripts', 'gvGlobals', array(
182
+			'nonce' => wp_create_nonce( 'gravityview_ajaxaddshortcode' ),
183 183
 			'loading_text' => esc_html__( 'Loading&hellip;', 'gravityview' ),
184
-			'alert_1' => esc_html__( 'Please select a View', 'gravityview'),
185
-		));
184
+			'alert_1' => esc_html__( 'Please select a View', 'gravityview' ),
185
+		) );
186 186
 
187 187
 	}
188 188
 
@@ -198,16 +198,16 @@  discard block
 block discarded – undo
198 198
 	function get_sortable_fields() {
199 199
 
200 200
 		// Not properly formatted request
201
-		if ( empty( $_POST['viewid'] ) || !is_numeric( $_POST['viewid'] ) ) {
201
+		if ( empty( $_POST[ 'viewid' ] ) || ! is_numeric( $_POST[ 'viewid' ] ) ) {
202 202
 			exit( false );
203 203
 		}
204 204
 
205 205
 		// Not valid request
206
-		if( empty( $_POST['nonce'] ) || ! wp_verify_nonce( $_POST['nonce'], 'gravityview_ajaxaddshortcode' ) ) {
206
+		if ( empty( $_POST[ 'nonce' ] ) || ! wp_verify_nonce( $_POST[ 'nonce' ], 'gravityview_ajaxaddshortcode' ) ) {
207 207
 			exit( false );
208 208
 		}
209 209
 
210
-		$viewid = (int)$_POST['viewid'];
210
+		$viewid = (int)$_POST[ 'viewid' ];
211 211
 
212 212
 		// fetch form id assigned to the view
213 213
 		$formid = gravityview_get_form_id( $viewid );
Please login to merge, or discard this patch.
includes/fields/class-gravityview-field-custom.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
 
41 41
 	function field_options( $field_options, $template_id, $field_id, $context, $input_type ) {
42 42
 
43
-		unset ( $field_options['search_filter'], $field_options['show_as_link'] );
43
+		unset ( $field_options[ 'search_filter' ], $field_options[ 'show_as_link' ] );
44 44
 
45 45
 		$new_fields = array(
46 46
 			'content' => array(
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 		);
69 69
 
70 70
 		if ( 'edit' === $context ) {
71
-			unset( $field_options['custom_label'], $field_options['show_label'], $field_options['allow_edit_cap'], $new_fields['wpautop'], $new_fields['oembed'] );
71
+			unset( $field_options[ 'custom_label' ], $field_options[ 'show_label' ], $field_options[ 'allow_edit_cap' ], $new_fields[ 'wpautop' ], $new_fields[ 'oembed' ] );
72 72
 		}
73 73
 
74 74
 		return $new_fields + $field_options;
@@ -102,9 +102,9 @@  discard block
 block discarded – undo
102 102
 
103 103
 		// Loop through the configured Edit Entry fields and add Custom Content fields if there are any
104 104
 		// TODO: Make this available to other custom GV field types
105
-		foreach ( (array) $edit_fields as $edit_field ) {
105
+		foreach ( (array)$edit_fields as $edit_field ) {
106 106
 
107
-			if( 'custom' === \GV\Utils::get( $edit_field, 'id') ) {
107
+			if ( 'custom' === \GV\Utils::get( $edit_field, 'id' ) ) {
108 108
 
109 109
 				$field_data = array(
110 110
 					'label' => \GV\Utils::get( $edit_field, 'custom_label' ),
@@ -117,13 +117,13 @@  discard block
 block discarded – undo
117 117
 					$field_data[ $key ] = GravityView_Merge_Tags::replace_variables( $field_datum, $form, $entry, false, false );
118 118
 				}
119 119
 
120
-				$field_data['cssClass'] = \GV\Utils::get( $edit_field, 'custom_class' );
120
+				$field_data[ 'cssClass' ] = \GV\Utils::get( $edit_field, 'custom_class' );
121 121
 
122
-				$new_fields[] = new GF_Field_HTML( $field_data );
122
+				$new_fields[ ] = new GF_Field_HTML( $field_data );
123 123
 
124 124
 			} else {
125
-				if( isset( $fields[ $i ] ) ) {
126
-					$new_fields[] =  $fields[ $i ];
125
+				if ( isset( $fields[ $i ] ) ) {
126
+					$new_fields[ ] = $fields[ $i ];
127 127
 				}
128 128
 				$i++;
129 129
 			}
Please login to merge, or discard this patch.
includes/fields/class-gravityview-field-is-starred.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 	private function add_hooks() {
38 38
 	    /** @see \GV\Field::get_value_filters */
39 39
 		add_filter( "gravityview/field/{$this->name}/output", array( $this, 'get_content' ), 4, 2 );
40
-		add_action( 'gravityview/template/after', array( $this, 'print_script'), 10, 1 );
40
+		add_action( 'gravityview/template/after', array( $this, 'print_script' ), 10, 1 );
41 41
 		add_filter( 'gravityview_entry_default_fields', array( $this, 'add_default_field' ), 10, 3 );
42 42
 	}
43 43
 
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
 	 */
53 53
 	function add_default_field( $entry_default_fields = array(), $form = array(), $zone = '' ) {
54 54
 
55
-		if( 'edit' !== $zone ) {
55
+		if ( 'edit' !== $zone ) {
56 56
 			$entry_default_fields[ $this->name ] = array(
57 57
 				'label' => $this->label,
58 58
 				'desc'  => $this->description,
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
 	public function get_content( $output, $template ) {
77 77
 		$entry = $template->entry;
78 78
 
79
-	    $star_url = GFCommon::get_base_url() .'/images/star' . intval( $entry['is_starred'] ) .'.png';
79
+	    $star_url = GFCommon::get_base_url() . '/images/star' . intval( $entry[ 'is_starred' ] ) . '.png';
80 80
 
81 81
 		$entry_id = '';
82 82
 
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
 		}
86 86
 
87 87
 		// if( $show_as_star )
88
-		$output = '<img class="gv-star-image" '.$entry_id.' data-is_starred="'. intval( $entry['is_starred'] ) .'" src="'. esc_attr( $star_url ) .'" />';
88
+		$output = '<img class="gv-star-image" ' . $entry_id . ' data-is_starred="' . intval( $entry[ 'is_starred' ] ) . '" src="' . esc_attr( $star_url ) . '" />';
89 89
 
90 90
 		self::$has_star_field = true;
91 91
 
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
 	 */
103 103
 	public function print_script( $context ) {
104 104
 
105
-		if( ! self::$has_star_field ) {
105
+		if ( ! self::$has_star_field ) {
106 106
 			return;
107 107
 		}
108 108
 
Please login to merge, or discard this patch.
includes/fields/class-gravityview-field-date.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -31,11 +31,11 @@  discard block
 block discarded – undo
31 31
 
32 32
 	function field_options( $field_options, $template_id = '', $field_id = '', $context = '', $input_type = '' ) {
33 33
 
34
-		if( 'edit' === $context ) {
34
+		if ( 'edit' === $context ) {
35 35
 			return $field_options;
36 36
 		}
37 37
 
38
-		$this->add_field_support('date_display', $field_options );
38
+		$this->add_field_support( 'date_display', $field_options );
39 39
 
40 40
 		return $field_options;
41 41
 	}
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
 		$field_input_id = gravityview_get_input_id_from_id( $field_id );
84 84
 
85 85
 		$date_field_output = '';
86
-		switch( $field_input_id ) {
86
+		switch ( $field_input_id ) {
87 87
 			case 1:
88 88
 				$date_field_output = \GV\Utils::get( $parsed_date, 'day' );
89 89
 				break;
Please login to merge, or discard this patch.
includes/fields/class-gravityview-field-fileupload.php 1 patch
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -24,16 +24,16 @@  discard block
 block discarded – undo
24 24
 
25 25
 	function field_options( $field_options, $template_id, $field_id, $context, $input_type ) {
26 26
 
27
-		unset( $field_options['search_filter'] );
27
+		unset( $field_options[ 'search_filter' ] );
28 28
 
29
-		if( 'edit' === $context ) {
29
+		if ( 'edit' === $context ) {
30 30
 			return $field_options;
31 31
 		}
32 32
 
33
-		$add_options['link_to_file'] = array(
33
+		$add_options[ 'link_to_file' ] = array(
34 34
 			'type' => 'checkbox',
35 35
 			'label' => __( 'Display as a Link:', 'gravityview' ),
36
-			'desc' => __('Display the uploaded files as links, rather than embedded content.', 'gravityview'),
36
+			'desc' => __( 'Display the uploaded files as links, rather than embedded content.', 'gravityview' ),
37 37
 			'value' => false,
38 38
 			'merge_tags' => false,
39 39
 		);
@@ -116,14 +116,14 @@  discard block
 block discarded – undo
116 116
 			$base_id = null;
117 117
 
118 118
 			$is_single = gravityview_get_context() === 'single';
119
-			$lightbox = ! empty( $gravityview_view->atts['lightbox'] );
119
+			$lightbox = ! empty( $gravityview_view->atts[ 'lightbox' ] );
120 120
 			$field_compat = $gravityview_view->getCurrentField();
121 121
 		}
122 122
 
123 123
 		$output_arr = array();
124 124
 
125 125
 		// Get an array of file paths for the field.
126
-		$file_paths = \GV\Utils::get( $field , 'multipleFiles' ) ? json_decode( $value ) : array( $value );
126
+		$file_paths = \GV\Utils::get( $field, 'multipleFiles' ) ? json_decode( $value ) : array( $value );
127 127
 
128 128
 		// The $value JSON was probably truncated; let's check lead_detail_long.
129 129
 		if ( ! is_array( $file_paths ) ) {
@@ -137,10 +137,10 @@  discard block
 block discarded – undo
137 137
 		}
138 138
 
139 139
 		// Process each file path
140
-		foreach( $file_paths as $file_path ) {
140
+		foreach ( $file_paths as $file_path ) {
141 141
 
142 142
 			// If the site is HTTPS, use HTTPS
143
-			if(function_exists('set_url_scheme')) { $file_path = set_url_scheme( $file_path ); }
143
+			if ( function_exists( 'set_url_scheme' ) ) { $file_path = set_url_scheme( $file_path ); }
144 144
 
145 145
 			// This is from Gravity Forms's code
146 146
 			$file_path = esc_attr( str_replace( " ", "%20", $file_path ) );
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
 			$file_path_info = pathinfo( $file_path );
161 161
 
162 162
 			// If the field is set to link to the single entry, link to it.
163
-			$link = !empty( $field_settings['show_as_link'] ) ? GravityView_API::entry_link( $entry, $field, $base_id ) : $file_path;
163
+			$link = ! empty( $field_settings[ 'show_as_link' ] ) ? GravityView_API::entry_link( $entry, $field, $base_id ) : $file_path;
164 164
 
165 165
 			$html_format = NULL;
166 166
 
@@ -170,8 +170,8 @@  discard block
 block discarded – undo
170 170
 
171 171
 			$image_atts = array(
172 172
 				'src' => $file_path,
173
-				'class' => 'gv-image gv-field-id-'.$field_settings['id'],
174
-				'alt' => $field_settings['label'],
173
+				'class' => 'gv-image gv-field-id-' . $field_settings[ 'id' ],
174
+				'alt' => $field_settings[ 'label' ],
175 175
 				'width' => ( $is_single ? NULL : 250 )
176 176
 			);
177 177
 
@@ -189,20 +189,20 @@  discard block
 block discarded – undo
189 189
 			$content = $image->html();
190 190
 
191 191
 			// The new default content is the image, if it exists. If not, use the file name as the content.
192
-			$content = !empty( $content ) ? $content : $file_path_info['basename'];
192
+			$content = ! empty( $content ) ? $content : $file_path_info[ 'basename' ];
193 193
 
194 194
 			// If pathinfo() gave us the extension of the file, run the switch statement using that.
195
-			$extension = empty( $file_path_info['extension'] ) ? NULL : strtolower( $file_path_info['extension'] );
195
+			$extension = empty( $file_path_info[ 'extension' ] ) ? NULL : strtolower( $file_path_info[ 'extension' ] );
196 196
 
197 197
 
198
-			switch( true ) {
198
+			switch ( true ) {
199 199
 
200 200
 				// Audio file
201 201
 				case in_array( $extension, wp_get_audio_extensions() ):
202 202
 
203 203
 					$disable_lightbox = true;
204 204
 
205
-					if( shortcode_exists( 'audio' ) ) {
205
+					if ( shortcode_exists( 'audio' ) ) {
206 206
 
207 207
 						$disable_wrapped_link = true;
208 208
 
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
 						 */
216 216
 						$audio_settings = apply_filters( 'gravityview_audio_settings', array(
217 217
 							'src' => $file_path,
218
-							'class' => 'wp-audio-shortcode gv-audio gv-field-id-'.$field_settings['id']
218
+							'class' => 'wp-audio-shortcode gv-audio gv-field-id-' . $field_settings[ 'id' ]
219 219
 						), $context );
220 220
 
221 221
 						/**
@@ -234,7 +234,7 @@  discard block
 block discarded – undo
234 234
 
235 235
 					$disable_lightbox = true;
236 236
 
237
-					if( shortcode_exists( 'video' ) ) {
237
+					if ( shortcode_exists( 'video' ) ) {
238 238
 
239 239
 						$disable_wrapped_link = true;
240 240
 
@@ -247,7 +247,7 @@  discard block
 block discarded – undo
247 247
 						 */
248 248
 						$video_settings = apply_filters( 'gravityview_video_settings', array(
249 249
 							'src' => $file_path,
250
-							'class' => 'wp-video-shortcode gv-video gv-field-id-'.$field_settings['id']
250
+							'class' => 'wp-video-shortcode gv-video gv-field-id-' . $field_settings[ 'id' ]
251 251
 						), $context );
252 252
 
253 253
 						/**
@@ -270,7 +270,7 @@  discard block
 block discarded – undo
270 270
 					break;
271 271
 
272 272
 				// if not image, do not set the lightbox (@since 1.5.3)
273
-				case !in_array( $extension, array( 'jpg', 'jpeg', 'jpe', 'gif', 'png' ) ):
273
+				case ! in_array( $extension, array( 'jpg', 'jpeg', 'jpe', 'gif', 'png' ) ):
274 274
 
275 275
 					$disable_lightbox = true;
276 276
 
@@ -280,10 +280,10 @@  discard block
 block discarded – undo
280 280
 
281 281
 			// If using Link to File, override the content.
282 282
 			// (We do this here so that the $disable_lightbox can be set. Yes, there's a little more processing time, but oh well.)
283
-			if( !empty( $field_settings['link_to_file'] ) ) {
283
+			if ( ! empty( $field_settings[ 'link_to_file' ] ) ) {
284 284
 
285 285
 				// Force the content to be the file name
286
-				$content =  $file_path_info["basename"];
286
+				$content = $file_path_info[ "basename" ];
287 287
 
288 288
 				// Restore the wrapped link
289 289
 				$disable_wrapped_link = false;
@@ -291,13 +291,13 @@  discard block
 block discarded – undo
291 291
 			}
292 292
 
293 293
 			// Whether to use lightbox or not
294
-			if ( $disable_lightbox || ! $lightbox || ! empty( $field_settings['show_as_link'] ) ) {
294
+			if ( $disable_lightbox || ! $lightbox || ! empty( $field_settings[ 'show_as_link' ] ) ) {
295 295
 
296
-				$link_atts = empty( $field_settings['show_as_link'] ) ? array( 'target' => '_blank' ) : array();
296
+				$link_atts = empty( $field_settings[ 'show_as_link' ] ) ? array( 'target' => '_blank' ) : array();
297 297
 
298 298
 			} else {
299 299
 
300
-				$entry_slug = GravityView_API::get_entry_slug( $entry['id'], $entry );
300
+				$entry_slug = GravityView_API::get_entry_slug( $entry[ 'id' ], $entry );
301 301
 
302 302
 				$link_atts = array(
303 303
 					'rel' => sprintf( "%s-%s", $gv_class, $entry_slug ),
@@ -327,7 +327,7 @@  discard block
 block discarded – undo
327 327
 			$disable_wrapped_link = apply_filters( 'gravityview/fields/fileupload/disable_link', $disable_wrapped_link, $field_compat, $context );
328 328
 
329 329
 			// If the HTML output hasn't been overridden by the switch statement above, use the default format
330
-			if ( !empty( $content ) && empty( $disable_wrapped_link ) ) {
330
+			if ( ! empty( $content ) && empty( $disable_wrapped_link ) ) {
331 331
 
332 332
 				/**
333 333
 				 * Modify the link text (defaults to the file name)
@@ -344,7 +344,7 @@  discard block
 block discarded – undo
344 344
                 $content = gravityview_get_link( $link, $content, $link_atts );
345 345
 			}
346 346
 
347
-			$output_arr[] = array(
347
+			$output_arr[ ] = array(
348 348
 				'file_path' => $file_path,
349 349
 				'content' => $content
350 350
 			);
Please login to merge, or discard this patch.
includes/fields/class-gravityview-field-payment-amount.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 	public function get_content( $output = '', $entry = array(), $field_settings = array(), $field = array() ) {
50 50
 
51 51
 		/** Overridden by a template. */
52
-		if( ! empty( $field['field_path'] ) ) { return $output; }
52
+		if ( ! empty( $field[ 'field_path' ] ) ) { return $output; }
53 53
 
54 54
 		$amount = \GV\Utils::get( $entry, 'payment_amount' );
55 55
 		$return = GFCommon::to_money( $amount, \GV\Utils::get( $entry, 'currency' ) );
@@ -88,14 +88,14 @@  discard block
 block discarded – undo
88 88
 	 *
89 89
 	 * @return string Original text if {date_created} isn't found. Otherwise, replaced text.
90 90
 	 */
91
-	public function replace_merge_tag( $matches = array(), $text = '', $form = array(), $entry = array(), $url_encode = false, $esc_html = false  ) {
91
+	public function replace_merge_tag( $matches = array(), $text = '', $form = array(), $entry = array(), $url_encode = false, $esc_html = false ) {
92 92
 
93 93
 		$return = $text;
94 94
 
95 95
 		foreach ( $matches as $match ) {
96 96
 
97
-			$full_tag = $match[0];
98
-			$modifier = isset( $match[1] ) ? $match[1] : false;
97
+			$full_tag = $match[ 0 ];
98
+			$modifier = isset( $match[ 1 ] ) ? $match[ 1 ] : false;
99 99
 
100 100
 			$amount = \GV\Utils::get( $entry, 'payment_amount' );
101 101
 
Please login to merge, or discard this patch.
includes/fields/class-gravityview-field-is-approved.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
 	 */
93 93
 	function add_default_field( $entry_default_fields, $form, $zone ) {
94 94
 
95
-		if( 'edit' !== $zone ) {
95
+		if ( 'edit' !== $zone ) {
96 96
 			$entry_default_fields[ $this->name ] = array(
97 97
 				'label' => $this->label,
98 98
 				'desc'  => $this->description,
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
 
118 118
 		$merge_tags = array(
119 119
 			array(
120
-				'label' => __('Approval Status', 'gravityview'),
120
+				'label' => __( 'Approval Status', 'gravityview' ),
121 121
 				'tag' => '{approval_status}'
122 122
 			),
123 123
 		);
@@ -157,10 +157,10 @@  discard block
 block discarded – undo
157 157
 				gravityview()->log->error( 'No entry data available. Returning empty string.' );
158 158
 				$replacement = '';
159 159
 			} else {
160
-				$replacement = GravityView_Entry_Approval::get_entry_status( $entry, $match[1] );
160
+				$replacement = GravityView_Entry_Approval::get_entry_status( $entry, $match[ 1 ] );
161 161
 			}
162 162
 
163
-			$return = str_replace( $match[0], $replacement, $return );
163
+			$return = str_replace( $match[ 0 ], $replacement, $return );
164 164
 		}
165 165
 
166 166
 		return $return;
@@ -168,25 +168,25 @@  discard block
 block discarded – undo
168 168
 
169 169
 	function field_options( $field_options, $template_id, $field_id, $context, $input_type ) {
170 170
 
171
-		$field_options['approved_label'] = array(
171
+		$field_options[ 'approved_label' ] = array(
172 172
 			'type' => 'text',
173 173
 			'label' => __( 'Approved Label', 'gravityview' ),
174 174
 			'desc' => __( 'If the entry is approved, display this value', 'gravityview' ),
175
-			'placeholder' => GravityView_Entry_Approval_Status::get_label('approved'),
175
+			'placeholder' => GravityView_Entry_Approval_Status::get_label( 'approved' ),
176 176
 		);
177 177
 
178
-		$field_options['disapproved_label'] = array(
178
+		$field_options[ 'disapproved_label' ] = array(
179 179
 			'type' => 'text',
180 180
 			'label' => __( 'Disapproved Label', 'gravityview' ),
181 181
 			'desc' => __( 'If the entry is not approved, display this value', 'gravityview' ),
182
-			'placeholder' => GravityView_Entry_Approval_Status::get_label('disapproved'),
182
+			'placeholder' => GravityView_Entry_Approval_Status::get_label( 'disapproved' ),
183 183
 		);
184 184
 
185
-		$field_options['unapproved_label'] = array(
185
+		$field_options[ 'unapproved_label' ] = array(
186 186
 			'type' => 'text',
187 187
 			'label' => __( 'Unapproved Label', 'gravityview' ),
188 188
 			'desc' => __( 'If the entry has not yet been approved or disapproved, display this value', 'gravityview' ),
189
-			'placeholder' => GravityView_Entry_Approval_Status::get_label('unapproved'),
189
+			'placeholder' => GravityView_Entry_Approval_Status::get_label( 'unapproved' ),
190 190
 		);
191 191
 
192 192
 		return $field_options;
Please login to merge, or discard this patch.
includes/fields/class-gravityview-field-approval.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
 
25 25
 		$this->label = esc_attr__( 'Approve Entries', 'gravityview' );
26 26
 
27
-		$this->description =  esc_attr__( 'Approve and reject entries from the View.', 'gravityview' );
27
+		$this->description = esc_attr__( 'Approve and reject entries from the View.', 'gravityview' );
28 28
 
29 29
 		$this->add_hooks();
30 30
 
@@ -46,11 +46,11 @@  discard block
 block discarded – undo
46 46
 	 */
47 47
 	function field_options( $field_options, $template_id = '', $field_id = '', $context = '', $input_type = '' ) {
48 48
 
49
-		unset( $field_options['only_loggedin'] );
49
+		unset( $field_options[ 'only_loggedin' ] );
50 50
 
51
-		unset( $field_options['new_window'] );
51
+		unset( $field_options[ 'new_window' ] );
52 52
 
53
-		unset( $field_options['show_as_link'] );
53
+		unset( $field_options[ 'show_as_link' ] );
54 54
 
55 55
 		return $field_options;
56 56
 	}
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
 
71 71
 		add_action( 'gravityview/field/approval/load_scripts', array( $this, 'enqueue_and_localize_script' ) );
72 72
 
73
-		add_action( 'gravityview_datatables_scripts_styles',  array( $this, 'enqueue_and_localize_script' ) );
73
+		add_action( 'gravityview_datatables_scripts_styles', array( $this, 'enqueue_and_localize_script' ) );
74 74
 
75 75
 		add_filter( 'gravityview_get_entries', array( $this, 'modify_search_parameters' ), 1000 );
76 76
 
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
 	public function maybe_prevent_field_render( $html, $args ) {
93 93
 
94 94
 		// If the field is `entry_approval` type but the user doesn't have the moderate entries cap, don't render.
95
-		if( $this->name === \GV\Utils::get( $args['field'], 'id' ) && ! GVCommon::has_cap('gravityview_moderate_entries') ) {
95
+		if ( $this->name === \GV\Utils::get( $args[ 'field' ], 'id' ) && ! GVCommon::has_cap( 'gravityview_moderate_entries' ) ) {
96 96
 			return '';
97 97
 		}
98 98
 
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
 	public function modify_search_parameters( $parameters ) {
123 123
 
124 124
 		if ( $this->name === \GV\Utils::get( $parameters, 'sorting/key' ) ) {
125
-			$parameters['sorting']['key'] = 'is_approved';
125
+			$parameters[ 'sorting' ][ 'key' ] = 'is_approved';
126 126
 		}
127 127
 
128 128
 		return $parameters;
@@ -138,18 +138,18 @@  discard block
 block discarded – undo
138 138
 	function register_scripts_and_styles() {
139 139
 		$script_debug = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
140 140
 
141
-		wp_register_script( 'gravityview-field-approval', GRAVITYVIEW_URL . 'assets/js/field-approval'.$script_debug.'.js', array( 'jquery' ), GravityView_Plugin::version, true );
141
+		wp_register_script( 'gravityview-field-approval', GRAVITYVIEW_URL . 'assets/js/field-approval' . $script_debug . '.js', array( 'jquery' ), GravityView_Plugin::version, true );
142 142
 
143 143
 		$style_path = GRAVITYVIEW_DIR . 'templates/css/field-approval.css';
144 144
 
145
-		if( class_exists( 'GravityView_View' ) ) {
145
+		if ( class_exists( 'GravityView_View' ) ) {
146 146
 			/**
147 147
 			 * Override CSS file by placing in your theme's /gravityview/css/ sub-directory.
148 148
 			 */
149 149
 			$style_path = GravityView_View::getInstance()->locate_template( 'css/field-approval.css', false );
150 150
 		}
151 151
 
152
-		$style_url = plugins_url( 'css/field-approval.css', trailingslashit( dirname( $style_path ) )  );
152
+		$style_url = plugins_url( 'css/field-approval.css', trailingslashit( dirname( $style_path ) ) );
153 153
 
154 154
 		/**
155 155
 		 * @filter `gravityview/field/approval/css_url` URL to the Approval field CSS file.
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
 		 */
159 159
 		$style_url = apply_filters( 'gravityview/field/approval/css_url', $style_url );
160 160
 
161
-		if( ! empty( $style_url ) ) {
161
+		if ( ! empty( $style_url ) ) {
162 162
 			wp_register_style( 'gravityview-field-approval', $style_url, array( 'dashicons' ), GravityView_Plugin::version, 'screen' );
163 163
 		}
164 164
 
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
 	public function enqueue_and_localize_script() {
174 174
 
175 175
 		// The script is already registered and enqueued
176
-		if( wp_script_is( 'gravityview-field-approval', 'enqueued' ) ) {
176
+		if ( wp_script_is( 'gravityview-field-approval', 'enqueued' ) ) {
177 177
 			return;
178 178
 		}
179 179
 
@@ -183,9 +183,9 @@  discard block
 block discarded – undo
183 183
 
184 184
 		wp_localize_script( 'gravityview-field-approval', 'gvApproval', array(
185 185
 			'ajaxurl' => admin_url( 'admin-ajax.php' ),
186
-			'nonce' => wp_create_nonce('gravityview_entry_approval'),
186
+			'nonce' => wp_create_nonce( 'gravityview_entry_approval' ),
187 187
 			'status' => GravityView_Entry_Approval_Status::get_all(),
188
-		));
188
+		) );
189 189
 
190 190
 	}
191 191
 
@@ -202,8 +202,8 @@  discard block
 block discarded – undo
202 202
 	 */
203 203
 	public function filter_gravityview_entry_default_field( $entry_default_fields, $form, $context ) {
204 204
 
205
-		if ( ! isset( $entry_default_fields["{$this->name}"] ) && 'edit' !== $context ) {
206
-			$entry_default_fields["{$this->name}"] = array(
205
+		if ( ! isset( $entry_default_fields[ "{$this->name}" ] ) && 'edit' !== $context ) {
206
+			$entry_default_fields[ "{$this->name}" ] = array(
207 207
 				'label' => $this->label,
208 208
 				'desc'  => $this->description,
209 209
 				'type'  => $this->name,
Please login to merge, or discard this patch.