Completed
Push — master ( 79386d...2cfa6f )
by Zack
18:13 queued 12:52
created
plugin-and-theme-hooks/abstract-gravityview-plugin-and-theme-hooks.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -91,9 +91,9 @@  discard block
 block discarded – undo
91 91
 	private function maybe_add_hooks() {
92 92
 		$class_exists = $this->class_name && class_exists( $this->class_name );
93 93
 		$function_exists = $this->function_name && function_exists( $this->function_name );
94
-		$constant_defined = $this->constant_name && defined("{$this->constant_name}");
94
+		$constant_defined = $this->constant_name && defined( "{$this->constant_name}" );
95 95
 
96
-		if( $class_exists || $function_exists || $constant_defined ) {
96
+		if ( $class_exists || $function_exists || $constant_defined ) {
97 97
 			$this->add_hooks();
98 98
 		}
99 99
 	}
@@ -104,19 +104,19 @@  discard block
 block discarded – undo
104 104
 	 * @return void
105 105
 	 */
106 106
 	protected function add_hooks() {
107
-		if( $this->content_meta_keys ) {
107
+		if ( $this->content_meta_keys ) {
108 108
 			add_filter( 'gravityview/data/parse/meta_keys', array( $this, 'merge_content_meta_keys' ), 10, 2 );
109 109
 		}
110 110
 
111
-		if( $this->script_handles ) {
111
+		if ( $this->script_handles ) {
112 112
 			add_filter( 'gravityview_noconflict_scripts', array( $this, 'merge_noconflict_scripts' ) );
113 113
 		}
114 114
 
115
-		if( $this->style_handles ) {
115
+		if ( $this->style_handles ) {
116 116
 			add_filter( 'gravityview_noconflict_styles', array( $this, 'merge_noconflict_styles' ) );
117 117
 		}
118 118
 
119
-		if( $this->post_type_support ) {
119
+		if ( $this->post_type_support ) {
120 120
 			add_filter( 'gravityview_post_type_support', array( $this, 'merge_post_type_support' ), 10, 2 );
121 121
 		}
122 122
 	}
Please login to merge, or discard this patch.
includes/fields/class-gravityview-field-password.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -49,17 +49,17 @@  discard block
 block discarded – undo
49 49
 	 *
50 50
 	 * @return string If a custom field label isn't set, return the field label for the password field
51 51
 	 */
52
-	function field_label( $label = '', $field = array(), $form = array(), $entry = array() ){
52
+	function field_label( $label = '', $field = array(), $form = array(), $entry = array() ) {
53 53
 
54 54
 		// If using a custom label, no need to fetch the parent label
55
-		if( ! is_numeric( $field['id'] ) || ! empty( $field['custom_label'] ) ) {
55
+		if ( ! is_numeric( $field[ 'id' ] ) || ! empty( $field[ 'custom_label' ] ) ) {
56 56
 			return $label;
57 57
 		}
58 58
 
59
-		$field_object = GFFormsModel::get_field( $form, $field['id'] );
59
+		$field_object = GFFormsModel::get_field( $form, $field[ 'id' ] );
60 60
 
61
-		if( $field_object && 'password' === $field_object->type ) {
62
-			$label = $field['label'];
61
+		if ( $field_object && 'password' === $field_object->type ) {
62
+			$label = $field[ 'label' ];
63 63
 		}
64 64
 
65 65
 		return $label;
@@ -79,17 +79,17 @@  discard block
 block discarded – undo
79 79
 	function add_form_fields( $fields = array(), $form = array(), $include_parent_field = true ) {
80 80
 
81 81
 		foreach ( $fields as $key => $field ) {
82
-			if( 'password' === $field['type'] ) {
82
+			if ( 'password' === $field[ 'type' ] ) {
83 83
 
84 84
 				// The Enter Password input
85
-				if( floor( $key ) === floatval( $key ) ) {
85
+				if ( floor( $key ) === floatval( $key ) ) {
86 86
 
87
-					if( ! empty( $field['parent'] ) ) {
88
-						$field['label']      = $field['parent']->label;
89
-						$field['adminOnly']  = $field['parent']->adminOnly;
90
-						$field['adminLabel'] = $field['parent']->adminLabel;
87
+					if ( ! empty( $field[ 'parent' ] ) ) {
88
+						$field[ 'label' ]      = $field[ 'parent' ]->label;
89
+						$field[ 'adminOnly' ]  = $field[ 'parent' ]->adminOnly;
90
+						$field[ 'adminLabel' ] = $field[ 'parent' ]->adminLabel;
91 91
 						// Don't show as a child input
92
-						unset( $field['parent'] );
92
+						unset( $field[ 'parent' ] );
93 93
 					}
94 94
 
95 95
 					$fields[ $key ] = $field;
Please login to merge, or discard this patch.
plugin-and-theme-hooks/class-gravityview-plugin-hooks-elegant-themes.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@
 block discarded – undo
34 34
 	 * Prevent Divi from adding their stuff to GV pages
35 35
 	 */
36 36
 	public function add_hooks_admin_init() {
37
-		if( GravityView_Admin::is_admin_page() ) {
37
+		if ( GravityView_Admin::is_admin_page() ) {
38 38
 			// Prevent Divi from adding import/export modal dialog
39 39
 			remove_action( 'admin_init', 'et_pb_register_builder_portabilities' );
40 40
 
Please login to merge, or discard this patch.
includes/class-oembed.php 1 patch
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
 	 */
43 43
 	static function getInstance() {
44 44
 
45
-		if( empty( self::$instance ) ) {
45
+		if ( empty( self::$instance ) ) {
46 46
 			self::$instance = new self;
47 47
 
48 48
 			self::$instance->initialize();
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
 		// Catch either
95 95
 		$match_regex = "(?:{$using_permalinks}|{$not_using_permalinks})";
96 96
 
97
-		return '#'.$match_regex.'#i';
97
+		return '#' . $match_regex . '#i';
98 98
 	}
99 99
 
100 100
 	/**
@@ -113,18 +113,18 @@  discard block
 block discarded – undo
113 113
 
114 114
 		$post_id = url_to_postid( $url );
115 115
 
116
-		if( empty( $post_id ) ) {
116
+		if ( empty( $post_id ) ) {
117 117
 
118 118
 			$args = array(
119 119
 				'post_status' => 'publish',
120 120
 				'name' => $slug,
121
-				'post_type' => array('any', 'gravityview'),
121
+				'post_type' => array( 'any', 'gravityview' ),
122 122
 			);
123 123
 
124 124
 			$posts = get_posts( $args );
125 125
 
126
-			if( !empty( $posts ) ) {
127
-				$post_id = $posts[0]->ID;
126
+			if ( ! empty( $posts ) ) {
127
+				$post_id = $posts[ 0 ]->ID;
128 128
 			}
129 129
 		}
130 130
 
@@ -157,17 +157,17 @@  discard block
 block discarded – undo
157 157
 	public function render_handler( $matches, $attr, $url, $rawattr ) {
158 158
 
159 159
 		// If not using permalinks, re-assign values for matching groups
160
-		if( !empty( $matches['entry_slug2'] ) ) {
161
-			$matches['is_cpt'] = $matches['is_cpt2'];
162
-			$matches['slug'] = $matches['slug2'];
163
-			$matches['entry_slug'] = $matches['entry_slug2'];
164
-			unset( $matches['is_cpt2'], $matches['slug2'], $matches['entry_slug2'] );
160
+		if ( ! empty( $matches[ 'entry_slug2' ] ) ) {
161
+			$matches[ 'is_cpt' ] = $matches[ 'is_cpt2' ];
162
+			$matches[ 'slug' ] = $matches[ 'slug2' ];
163
+			$matches[ 'entry_slug' ] = $matches[ 'entry_slug2' ];
164
+			unset( $matches[ 'is_cpt2' ], $matches[ 'slug2' ], $matches[ 'entry_slug2' ] );
165 165
 		}
166 166
 
167 167
 		// No Entry was found
168
-		if( empty( $matches['entry_slug'] ) ) {
168
+		if ( empty( $matches[ 'entry_slug' ] ) ) {
169 169
 
170
-			do_action('gravityview_log_error', 'GravityView_oEmbed[render_handler] $entry_slug not parsed by regex.', $matches );
170
+			do_action( 'gravityview_log_error', 'GravityView_oEmbed[render_handler] $entry_slug not parsed by regex.', $matches );
171 171
 
172 172
 			return '';
173 173
 		}
@@ -177,11 +177,11 @@  discard block
 block discarded – undo
177 177
 		// Setup the data used
178 178
 		$this->set_vars( $matches, $attr, $url, $rawattr );
179 179
 
180
-		if( is_admin() && !$this->is_full_oembed_preview ) {
180
+		if ( is_admin() && ! $this->is_full_oembed_preview ) {
181 181
 			$return = $this->render_admin( $matches, $attr, $url, $rawattr );
182 182
 		} else {
183 183
 
184
-			if( $this->is_full_oembed_preview ) {
184
+			if ( $this->is_full_oembed_preview ) {
185 185
 				$return .= $this->generate_preview_notice();
186 186
 			}
187 187
 
@@ -200,8 +200,8 @@  discard block
 block discarded – undo
200 200
 	private function generate_preview_notice() {
201 201
 		$floaty = GravityView_Admin::get_floaty();
202 202
 		$title = esc_html__( 'This will look better when it is embedded.', 'gravityview' );
203
-		$message = esc_html__('Styles don\'t get loaded when being previewed, so the content below will look strange. Don\'t be concerned!', 'gravityview');
204
-		return '<div class="updated notice">'. $floaty. '<h3>'.$title.'</h3><p>'.$message.'</p><br style="clear:both;" /></div>';
203
+		$message = esc_html__( 'Styles don\'t get loaded when being previewed, so the content below will look strange. Don\'t be concerned!', 'gravityview' );
204
+		return '<div class="updated notice">' . $floaty . '<h3>' . $title . '</h3><p>' . $message . '</p><br style="clear:both;" /></div>';
205 205
 	}
206 206
 
207 207
 	/**
@@ -214,14 +214,14 @@  discard block
 block discarded – undo
214 214
 	 */
215 215
 	private function set_vars( $matches, $attr, $url, $rawattr ) {
216 216
 
217
-		$this->entry_id = $matches['entry_slug'];
217
+		$this->entry_id = $matches[ 'entry_slug' ];
218 218
 
219
-		$post_id = $this->get_postid_from_url_and_slug( $url, $matches['slug'] );
219
+		$post_id = $this->get_postid_from_url_and_slug( $url, $matches[ 'slug' ] );
220 220
 
221 221
 		// The URL didn't have the View Custom Post Type structure.
222
-		if( empty( $matches['is_cpt'] ) || $matches['is_cpt'] !== 'gravityview' ) {
222
+		if ( empty( $matches[ 'is_cpt' ] ) || $matches[ 'is_cpt' ] !== 'gravityview' ) {
223 223
 
224
-			do_action('gravityview_log_debug', 'GravityView_oEmbed[render_handler] Embedding an entry inside a post or page', $matches );
224
+			do_action( 'gravityview_log_debug', 'GravityView_oEmbed[render_handler] Embedding an entry inside a post or page', $matches );
225 225
 
226 226
 			$this->view_id = GravityView_View_Data::getInstance()->maybe_get_view_id( $post_id );
227 227
 
@@ -232,7 +232,7 @@  discard block
 block discarded – undo
232 232
 		}
233 233
 
234 234
 		// The inline content has $_POST['type'] set to "embed", while the "Add Media" modal doesn't set that.
235
-		$this->is_full_oembed_preview = ( isset( $_POST['action'] ) && $_POST['action'] === 'parse-embed' && !isset( $_POST['type'] ) );
235
+		$this->is_full_oembed_preview = ( isset( $_POST[ 'action' ] ) && $_POST[ 'action' ] === 'parse-embed' && ! isset( $_POST[ 'type' ] ) );
236 236
 	}
237 237
 
238 238
 	/**
@@ -250,15 +250,15 @@  discard block
 block discarded – undo
250 250
 		// Floaty the astronaut
251 251
 		$image = GravityView_Admin::get_floaty();
252 252
 
253
-		$embed_heading = sprintf( esc_html__('Embed Entry %d', 'gravityview'), $this->entry_id );
253
+		$embed_heading = sprintf( esc_html__( 'Embed Entry %d', 'gravityview' ), $this->entry_id );
254 254
 
255
-		$embed_text = sprintf( esc_html__('This entry will be displayed as it is configured in View %d', 'gravityview'), $this->view_id );
255
+		$embed_text = sprintf( esc_html__( 'This entry will be displayed as it is configured in View %d', 'gravityview' ), $this->view_id );
256 256
 
257 257
 		return '
258 258
 		<div class="loading-placeholder" style="background-color:#e6f0f5;">
259
-			<h3 style="margin:0; padding:0; font-family: -apple-system, BlinkMacSystemFont, \'Segoe UI\', Roboto, Oxygen-Sans, Ubuntu, Cantarell, \'Helvetica Neue\', sans-serif;">'.$image.$embed_heading.'</h3>
259
+			<h3 style="margin:0; padding:0; font-family: -apple-system, BlinkMacSystemFont, \'Segoe UI\', Roboto, Oxygen-Sans, Ubuntu, Cantarell, \'Helvetica Neue\', sans-serif;">'.$image . $embed_heading . '</h3>
260 260
 			<p style="margin:0; padding:0; font-family: -apple-system, BlinkMacSystemFont, \'Segoe UI\', Roboto, Oxygen-Sans, Ubuntu, Cantarell, \'Helvetica Neue\', sans-serif;">
261
-				'.$embed_text.'
261
+				'.$embed_text . '
262 262
 			</p>
263 263
 			<br style="clear: both;">
264 264
 		</div>';
@@ -313,14 +313,14 @@  discard block
 block discarded – undo
313 313
 	private function render_frontend( $matches, $attr, $url, $rawattr ) {
314 314
 
315 315
 		// If it's already been parsed, don't re-output it.
316
-		if( !empty( $this->output[ $this->entry_id ] ) ) {
316
+		if ( ! empty( $this->output[ $this->entry_id ] ) ) {
317 317
 			return $this->output[ $this->entry_id ];
318 318
 		}
319 319
 
320 320
 		$entry_output = $this->generate_entry_output();
321 321
 
322 322
 		// Wrap a container div around the output to allow for custom styling
323
-		$output = sprintf('<div class="gravityview-oembed gravityview-oembed-entry gravityview-oembed-entry-'.$this->entry_id.'">%s</div>', $entry_output );
323
+		$output = sprintf( '<div class="gravityview-oembed gravityview-oembed-entry gravityview-oembed-entry-' . $this->entry_id . '">%s</div>', $entry_output );
324 324
 
325 325
 		/**
326 326
 		 * @filter `gravityview/oembed/entry` Filter the output of the oEmbed entry embed
@@ -333,7 +333,7 @@  discard block
 block discarded – undo
333 333
 		 *  @var string $url The original URL that was matched by the regex. \n
334 334
 		 *  @var array $rawattr The original unmodified attributes.
335 335
 		 */
336
-		$output = apply_filters('gravityview/oembed/entry', $output, $this, compact( $entry_output, $matches, $attr, $url, $rawattr ) );
336
+		$output = apply_filters( 'gravityview/oembed/entry', $output, $this, compact( $entry_output, $matches, $attr, $url, $rawattr ) );
337 337
 
338 338
 		unset( $entry_output );
339 339
 
Please login to merge, or discard this patch.
includes/class-admin-approve-entries.php 1 patch
Spacing   +89 added lines, -89 removed lines patch added patch discarded remove patch
@@ -43,25 +43,25 @@  discard block
 block discarded – undo
43 43
 		/** gf_entries page - entries table screen */
44 44
 
45 45
 		// capture bulk actions
46
-		add_action( 'gform_loaded', array( $this, 'process_bulk_action') );
46
+		add_action( 'gform_loaded', array( $this, 'process_bulk_action' ) );
47 47
 
48 48
 		// add hidden field with approve status
49 49
 		add_action( 'gform_entries_first_column_actions', array( $this, 'add_entry_approved_hidden_input' ), 1, 5 );
50 50
 
51 51
 		// process ajax approve entry requests
52
-		add_action('wp_ajax_gv_update_approved', array( $this, 'ajax_update_approved'));
52
+		add_action( 'wp_ajax_gv_update_approved', array( $this, 'ajax_update_approved' ) );
53 53
 
54 54
 		// when using the User opt-in field, check on entry submission
55 55
 		add_action( 'gform_after_submission', array( $this, 'after_submission' ), 10, 2 );
56 56
 
57 57
 		// in case entry is edited (on admin or frontend)
58
-		add_action( 'gform_after_update_entry', array( $this, 'after_update_entry_update_approved_meta' ), 10, 2);
58
+		add_action( 'gform_after_update_entry', array( $this, 'after_update_entry_update_approved_meta' ), 10, 2 );
59 59
 
60 60
 
61 61
 		add_filter( 'gravityview_tooltips', array( $this, 'tooltips' ) );
62 62
 
63 63
 		// adding styles and scripts
64
-		add_action( 'admin_enqueue_scripts', array( $this, 'add_scripts_and_styles') );
64
+		add_action( 'admin_enqueue_scripts', array( $this, 'add_scripts_and_styles' ) );
65 65
 		// bypass Gravity Forms no-conflict mode
66 66
 		add_filter( 'gform_noconflict_scripts', array( $this, 'register_gform_noconflict_script' ) );
67 67
 		add_filter( 'gform_noconflict_styles', array( $this, 'register_gform_noconflict_style' ) );
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
 		 * @param bool $show_filter_links True: show the "approved"/"disapproved" filter links. False: hide them.
91 91
 		 * @param array $form GF Form object of current form
92 92
 		 */
93
-		if( false === apply_filters( 'gravityview/approve_entries/show_filter_links_entry_list', true, $form ) ) {
93
+		if ( false === apply_filters( 'gravityview/approve_entries/show_filter_links_entry_list', true, $form ) ) {
94 94
 			return $filter_links;
95 95
 		}
96 96
 
@@ -111,19 +111,19 @@  discard block
 block discarded – undo
111 111
 		$approved_count = $disapproved_count = 0;
112 112
 
113 113
 		// Only count if necessary
114
-		if( $include_counts ) {
115
-			$approved_count = count( gravityview_get_entry_ids( $form['id'], array( 'status' => 'active', 'field_filters' => $field_filters_approved ) ) );
116
-			$disapproved_count = count( gravityview_get_entry_ids( $form['id'], array( 'status' => 'active', 'field_filters' => $field_filters_disapproved ) ) );
114
+		if ( $include_counts ) {
115
+			$approved_count = count( gravityview_get_entry_ids( $form[ 'id' ], array( 'status' => 'active', 'field_filters' => $field_filters_approved ) ) );
116
+			$disapproved_count = count( gravityview_get_entry_ids( $form[ 'id' ], array( 'status' => 'active', 'field_filters' => $field_filters_disapproved ) ) );
117 117
 		}
118 118
 
119
-		$filter_links[] = array(
119
+		$filter_links[ ] = array(
120 120
 			'id'            => 'gv_approved',
121 121
 			'field_filters' => $field_filters_approved,
122 122
 			'count'         => $approved_count,
123 123
 			'label'         => esc_html__( 'Approved', 'gravityview' ),
124 124
 		);
125 125
 
126
-		$filter_links[] = array(
126
+		$filter_links[ ] = array(
127 127
 			'id'            => 'gv_disapproved',
128 128
 			'field_filters' => $field_filters_disapproved,
129 129
 			'count'         => $disapproved_count,
@@ -142,9 +142,9 @@  discard block
 block discarded – undo
142 142
 	 */
143 143
 	function tooltips( $tooltips ) {
144 144
 
145
-		$tooltips['form_gravityview_fields'] = array(
146
-			'title' => __('GravityView Fields', 'gravityview'),
147
-			'value' => __( 'Allow administrators to approve or reject entries and users to opt-in or opt-out of their entries being displayed.', 'gravityview'),
145
+		$tooltips[ 'form_gravityview_fields' ] = array(
146
+			'title' => __( 'GravityView Fields', 'gravityview' ),
147
+			'value' => __( 'Allow administrators to approve or reject entries and users to opt-in or opt-out of their entries being displayed.', 'gravityview' ),
148 148
 		);
149 149
 
150 150
 		return $tooltips;
@@ -255,15 +255,15 @@  discard block
 block discarded – undo
255 255
 
256 256
 		$gv_bulk_action = false;
257 257
 
258
-		if( version_compare( GFForms::$version, '2.0', '>=' ) ) {
259
-			$bulk_action = ( '-1' !== rgpost('action') ) ? rgpost('action') : rgpost('action2');
258
+		if ( version_compare( GFForms::$version, '2.0', '>=' ) ) {
259
+			$bulk_action = ( '-1' !== rgpost( 'action' ) ) ? rgpost( 'action' ) : rgpost( 'action2' );
260 260
 		} else {
261 261
 			// GF 1.9.x - Bulk action 2 is the bottom bulk action select form.
262
-			$bulk_action = rgpost('bulk_action') ? rgpost('bulk_action') : rgpost('bulk_action2');
262
+			$bulk_action = rgpost( 'bulk_action' ) ? rgpost( 'bulk_action' ) : rgpost( 'bulk_action2' );
263 263
 		}
264 264
 
265 265
 		// Check the $bulk_action value against GV actions, see if they're the same. I hate strpos().
266
-		if( ! empty( $bulk_action ) && preg_match( '/^('. implode( '|', $this->bulk_action_prefixes ) .')/ism', $bulk_action ) ) {
266
+		if ( ! empty( $bulk_action ) && preg_match( '/^(' . implode( '|', $this->bulk_action_prefixes ) . ')/ism', $bulk_action ) ) {
267 267
 			$gv_bulk_action = $bulk_action;
268 268
 		}
269 269
 
@@ -288,7 +288,7 @@  discard block
 block discarded – undo
288 288
 		
289 289
 		// gforms_entry_list is the nonce that confirms we're on the right page
290 290
 		// gforms_update_note is sent when bulk editing entry notes. We don't want to process then.
291
-		if ( $bulk_action && rgpost('gforms_entry_list') && empty( $_POST['gforms_update_note'] ) ) {
291
+		if ( $bulk_action && rgpost( 'gforms_entry_list' ) && empty( $_POST[ 'gforms_update_note' ] ) ) {
292 292
 
293 293
 			check_admin_referer( 'gforms_entry_list', 'gforms_entry_list' );
294 294
 
@@ -306,13 +306,13 @@  discard block
 block discarded – undo
306 306
 			}
307 307
 
308 308
 			// All entries are set to be updated, not just the visible ones
309
-			if ( ! empty( $_POST['all_entries'] ) ) {
309
+			if ( ! empty( $_POST[ 'all_entries' ] ) ) {
310 310
 
311 311
 				// Convert the current entry search into GF-formatted search criteria
312 312
 				$search = array(
313
-					'search_field' => isset( $_POST['f'] ) ? $_POST['f'][0] : 0,
314
-					'search_value' => isset( $_POST['v'][0] ) ? $_POST['v'][0] : '',
315
-					'search_operator' => isset( $_POST['o'][0] ) ? $_POST['o'][0] : 'contains',
313
+					'search_field' => isset( $_POST[ 'f' ] ) ? $_POST[ 'f' ][ 0 ] : 0,
314
+					'search_value' => isset( $_POST[ 'v' ][ 0 ] ) ? $_POST[ 'v' ][ 0 ] : '',
315
+					'search_operator' => isset( $_POST[ 'o' ][ 0 ] ) ? $_POST[ 'o' ][ 0 ] : 'contains',
316 316
 				);
317 317
 
318 318
 				$search_criteria = GravityView_frontend::get_search_criteria( $search, $form_id );
@@ -323,7 +323,7 @@  discard block
 block discarded – undo
323 323
 			} else {
324 324
 
325 325
 				// Changed from 'lead' to 'entry' in 2.0
326
-				$entries = isset( $_POST['lead'] ) ? $_POST['lead'] : $_POST['entry'];
326
+				$entries = isset( $_POST[ 'lead' ] ) ? $_POST[ 'lead' ] : $_POST[ 'entry' ];
327 327
 
328 328
 			}
329 329
 
@@ -335,12 +335,12 @@  discard block
 block discarded – undo
335 335
 			$entry_count = count( $entries ) > 1 ? sprintf( __( '%d entries', 'gravityview' ), count( $entries ) ) : __( '1 entry', 'gravityview' );
336 336
 
337 337
 			switch ( $approved_status ) {
338
-				case $this->bulk_action_prefixes['approve']:
338
+				case $this->bulk_action_prefixes[ 'approve' ]:
339 339
 					self::update_bulk( $entries, 1, $form_id );
340 340
 					$this->bulk_update_message = sprintf( __( '%s approved.', 'gravityview' ), $entry_count );
341 341
 					break;
342 342
 
343
-				case $this->bulk_action_prefixes['unapprove']:
343
+				case $this->bulk_action_prefixes[ 'unapprove' ]:
344 344
 					self::update_bulk( $entries, 0, $form_id );
345 345
 					$this->bulk_update_message = sprintf( __( '%s disapproved.', 'gravityview' ), $entry_count );
346 346
 					break;
@@ -364,12 +364,12 @@  discard block
 block discarded – undo
364 364
 	 */
365 365
 	private static function update_bulk( $entries, $approved, $form_id ) {
366 366
 
367
-		if( empty($entries) || ( $entries !== true && !is_array($entries) ) ) {
367
+		if ( empty( $entries ) || ( $entries !== true && ! is_array( $entries ) ) ) {
368 368
 			do_action( 'gravityview_log_error', __METHOD__ . ' Entries were empty or malformed.', $entries );
369 369
 			return false;
370 370
 		}
371 371
 
372
-		if( ! GVCommon::has_cap( 'gravityview_moderate_entries' ) ) {
372
+		if ( ! GVCommon::has_cap( 'gravityview_moderate_entries' ) ) {
373 373
 			do_action( 'gravityview_log_error', __METHOD__ . ' User does not have the `gravityview_moderate_entries` capability.' );
374 374
 			return false;
375 375
 		}
@@ -379,7 +379,7 @@  discard block
 block discarded – undo
379 379
 		// calculate approved field id once instead of looping through in the update_approved() method
380 380
 		$approved_column_id = self::get_approved_column( $form_id );
381 381
 
382
-		foreach( $entries as $entry_id ) {
382
+		foreach ( $entries as $entry_id ) {
383 383
 			self::update_approved( (int)$entry_id, $approved, $form_id, $approved_column_id );
384 384
 		}
385 385
 	}
@@ -398,14 +398,14 @@  discard block
 block discarded – undo
398 398
 	 * @param int $approvedcolumn (default: 0)
399 399
 	 * @return boolean True: It worked; False: it failed
400 400
 	 */
401
-	public static function update_approved( $entry_id = 0, $approved = 0, $form_id = 0, $approvedcolumn = 0) {
401
+	public static function update_approved( $entry_id = 0, $approved = 0, $form_id = 0, $approvedcolumn = 0 ) {
402 402
 
403
-		if( !class_exists( 'GFAPI' ) ) {
403
+		if ( ! class_exists( 'GFAPI' ) ) {
404 404
 			do_action( 'gravityview_log_error', __METHOD__ . 'GFAPI does not exist' );
405 405
 			return false;
406 406
 		}
407 407
 
408
-		if( empty( $approvedcolumn ) ) {
408
+		if ( empty( $approvedcolumn ) ) {
409 409
 			$approvedcolumn = self::get_approved_column( $form_id );
410 410
 		}
411 411
 
@@ -424,7 +424,7 @@  discard block
 block discarded – undo
424 424
 		self::update_approved_meta( $entry_id, $approved, $form_id );
425 425
 
426 426
 		// add note to entry
427
-		if( $result === true ) {
427
+		if ( $result === true ) {
428 428
 
429 429
 			$note = empty( $approved ) ? __( 'Disapproved the Entry for GravityView', 'gravityview' ) : __( 'Approved the Entry for GravityView', 'gravityview' );
430 430
 
@@ -435,7 +435,7 @@  discard block
 block discarded – undo
435 435
 			 */
436 436
 			$add_note = apply_filters( 'gravityview/approve_entries/add-note', true );
437 437
 
438
-			if( $add_note && class_exists( 'GravityView_Entry_Notes' ) ) {
438
+			if ( $add_note && class_exists( 'GravityView_Entry_Notes' ) ) {
439 439
 				$current_user = wp_get_current_user();
440 440
 				GravityView_Entry_Notes::add_note( $entry_id, $current_user->ID, $current_user->display_name, $note );
441 441
 			}
@@ -447,7 +447,7 @@  discard block
 block discarded – undo
447 447
 			 */
448 448
 			do_action( 'gravityview_clear_form_cache', $form_id );
449 449
 
450
-		} else if( is_wp_error( $result ) ) {
450
+		} else if ( is_wp_error( $result ) ) {
451 451
 
452 452
 			do_action( 'gravityview_log_error', __METHOD__ . sprintf( ' - Entry approval not updated: %s', $result->get_error_message() ) );
453 453
 
@@ -468,7 +468,7 @@  discard block
 block discarded – undo
468 468
 	 * @param $form array Gravity Forms form object
469 469
 	 */
470 470
 	public function after_submission( $entry, $form ) {
471
-		$this->after_update_entry_update_approved_meta( $form , $entry['id'] );
471
+		$this->after_update_entry_update_approved_meta( $form, $entry[ 'id' ] );
472 472
 	}
473 473
 
474 474
 
@@ -484,18 +484,18 @@  discard block
 block discarded – undo
484 484
 	 */
485 485
 	public function after_update_entry_update_approved_meta( $form, $entry_id = NULL ) {
486 486
 
487
-		$approvedcolumn = self::get_approved_column( $form['id'] );
487
+		$approvedcolumn = self::get_approved_column( $form[ 'id' ] );
488 488
 
489 489
         /**
490 490
          * If the form doesn't contain the approve field, don't assume anything.
491 491
          */
492
-        if( empty( $approvedcolumn ) ) {
492
+        if ( empty( $approvedcolumn ) ) {
493 493
             return;
494 494
         }
495 495
 
496 496
 		$entry = GFAPI::get_entry( $entry_id );
497 497
 
498
-		self::update_approved_meta( $entry_id, $entry[ (string)$approvedcolumn ], $form['id'] );
498
+		self::update_approved_meta( $entry_id, $entry[ (string)$approvedcolumn ], $form[ 'id' ] );
499 499
 
500 500
 	}
501 501
 
@@ -520,7 +520,7 @@  discard block
 block discarded – undo
520 520
 		$is_approved = empty( $is_approved ) ? 0 : 'Approved';
521 521
 
522 522
 		// update entry meta
523
-		if( function_exists('gform_update_meta') ) {
523
+		if ( function_exists( 'gform_update_meta' ) ) {
524 524
 
525 525
 			gform_update_meta( $entry_id, 'is_approved', $is_approved, $form_id );
526 526
 
@@ -532,7 +532,7 @@  discard block
 block discarded – undo
532 532
 			 */
533 533
 			do_action( 'gravityview/approve_entries/updated', $entry_id, $is_approved );
534 534
 
535
-			if( empty( $is_approved ) ) {
535
+			if ( empty( $is_approved ) ) {
536 536
 
537 537
 				/**
538 538
 				 * @action `gravityview/approve_entries/disapproved` Triggered when an entry is rejected
@@ -554,7 +554,7 @@  discard block
 block discarded – undo
554 554
 
555 555
 		} else {
556 556
 
557
-			do_action('gravityview_log_error', __METHOD__ . ' - `gform_update_meta` does not exist.' );
557
+			do_action( 'gravityview_log_error', __METHOD__ . ' - `gform_update_meta` does not exist.' );
558 558
 
559 559
 		}
560 560
 	}
@@ -566,21 +566,21 @@  discard block
 block discarded – undo
566 566
 	 */
567 567
 	public function ajax_update_approved() {
568 568
 
569
-		if( empty( $_POST['entry_id'] ) || empty( $_POST['form_id'] ) ) {
569
+		if ( empty( $_POST[ 'entry_id' ] ) || empty( $_POST[ 'form_id' ] ) ) {
570 570
 
571 571
 			do_action( 'gravityview_log_error', __METHOD__ . ' entry_id or form_id are empty.', $_POST );
572 572
 
573 573
 			$result = false;
574 574
 		}
575 575
 
576
-		else if ( ! isset( $_POST['nonce'] ) || ! wp_verify_nonce( $_POST['nonce'], 'gravityview_ajaxgfentries' ) ) {
576
+		else if ( ! isset( $_POST[ 'nonce' ] ) || ! wp_verify_nonce( $_POST[ 'nonce' ], 'gravityview_ajaxgfentries' ) ) {
577 577
 
578 578
 			do_action( 'gravityview_log_error', __METHOD__ . ' Security check failed.', $_POST );
579 579
 
580 580
 			$result = false;
581 581
 		}
582 582
 
583
-		else if( ! GVCommon::has_cap( 'gravityview_moderate_entries', $_POST['entry_id'] ) ) {
583
+		else if ( ! GVCommon::has_cap( 'gravityview_moderate_entries', $_POST[ 'entry_id' ] ) ) {
584 584
 
585 585
 			do_action( 'gravityview_log_error', __METHOD__ . ' User does not have the `gravityview_moderate_entries` capability.' );
586 586
 
@@ -589,11 +589,11 @@  discard block
 block discarded – undo
589 589
 
590 590
 		else {
591 591
 
592
-			$result = self::update_approved( $_POST['entry_id'], $_POST['approved'], $_POST['form_id'] );
592
+			$result = self::update_approved( $_POST[ 'entry_id' ], $_POST[ 'approved' ], $_POST[ 'form_id' ] );
593 593
 
594
-			if( is_wp_error( $result ) ) {
594
+			if ( is_wp_error( $result ) ) {
595 595
 				/** @var WP_Error $result */
596
-				do_action( 'gravityview_log_error', __METHOD__ .' Error updating approval: ' . $result->get_error_message() );
596
+				do_action( 'gravityview_log_error', __METHOD__ . ' Error updating approval: ' . $result->get_error_message() );
597 597
 				$result = false;
598 598
 			}
599 599
 
@@ -613,29 +613,29 @@  discard block
 block discarded – undo
613 613
 	 */
614 614
 	static public function get_approved_column( $form ) {
615 615
 
616
-        if( empty( $form ) ) {
616
+        if ( empty( $form ) ) {
617 617
             return null;
618 618
         }
619 619
 
620
-        if( !is_array( $form ) ) {
620
+        if ( ! is_array( $form ) ) {
621 621
             $form = GVCommon::get_form( $form );
622 622
         }
623 623
 
624
-		foreach( $form['fields'] as $key => $field ) {
624
+		foreach ( $form[ 'fields' ] as $key => $field ) {
625 625
 
626
-            $field = (array) $field;
626
+            $field = (array)$field;
627 627
 
628
-			if( !empty( $field['gravityview_approved'] ) ) {
629
-				if( !empty($field['inputs'][0]['id']) ) {
630
-					return $field['inputs'][0]['id'];
628
+			if ( ! empty( $field[ 'gravityview_approved' ] ) ) {
629
+				if ( ! empty( $field[ 'inputs' ][ 0 ][ 'id' ] ) ) {
630
+					return $field[ 'inputs' ][ 0 ][ 'id' ];
631 631
 				}
632 632
 			}
633 633
 
634 634
             // Note: This is just for backward compatibility from GF Directory plugin and old GV versions - when using i18n it may not work..
635
-            if( 'checkbox' == $field['type'] && isset( $field['inputs'] ) && is_array( $field['inputs'] ) ) {
636
-                foreach ( $field['inputs'] as $key2 => $input ) {
637
-                    if ( strtolower( $input['label'] ) == 'approved' ) {
638
-                        return $input['id'];
635
+            if ( 'checkbox' == $field[ 'type' ] && isset( $field[ 'inputs' ] ) && is_array( $field[ 'inputs' ] ) ) {
636
+                foreach ( $field[ 'inputs' ] as $key2 => $input ) {
637
+                    if ( strtolower( $input[ 'label' ] ) == 'approved' ) {
638
+                        return $input[ 'id' ];
639 639
                     }
640 640
                 }
641 641
             }
@@ -657,18 +657,18 @@  discard block
 block discarded – undo
657 657
 	 *
658 658
 	 * @return void
659 659
 	 */
660
-	static public function add_entry_approved_hidden_input(  $form_id, $field_id, $value, $entry, $query_string ) {
660
+	static public function add_entry_approved_hidden_input( $form_id, $field_id, $value, $entry, $query_string ) {
661 661
 
662
-		if( ! GVCommon::has_cap( 'gravityview_moderate_entries', $entry['id'] ) ) {
662
+		if ( ! GVCommon::has_cap( 'gravityview_moderate_entries', $entry[ 'id' ] ) ) {
663 663
 			return;
664 664
 		}
665 665
 
666
-		if( empty( $entry['id'] ) ) {
666
+		if ( empty( $entry[ 'id' ] ) ) {
667 667
 			return;
668 668
 		}
669 669
 
670
-		if( gform_get_meta( $entry['id'], 'is_approved' ) ) {
671
-			echo '<input type="hidden" class="entry_approved" id="entry_approved_'. $entry['id'] .'" value="true" />';
670
+		if ( gform_get_meta( $entry[ 'id' ], 'is_approved' ) ) {
671
+			echo '<input type="hidden" class="entry_approved" id="entry_approved_' . $entry[ 'id' ] . '" value="true" />';
672 672
 		}
673 673
 	}
674 674
 
@@ -681,10 +681,10 @@  discard block
 block discarded – undo
681 681
 	 */
682 682
 	private function get_form_id() {
683 683
 
684
-		$form_id = GFForms::get('id');
684
+		$form_id = GFForms::get( 'id' );
685 685
 
686 686
 		// If there are no forms identified, use the first form. That's how GF does it.
687
-		if( empty( $form_id ) && class_exists('RGFormsModel') ) {
687
+		if ( empty( $form_id ) && class_exists( 'RGFormsModel' ) ) {
688 688
 			$form_id = $this->get_first_form_id();
689 689
 		}
690 690
 
@@ -704,14 +704,14 @@  discard block
 block discarded – undo
704 704
 
705 705
 		$forms = RGFormsModel::get_forms( null, 'title' );
706 706
 
707
-		if( ! isset( $forms[0] ) ) {
707
+		if ( ! isset( $forms[ 0 ] ) ) {
708 708
 			do_action( 'gravityview_log_error', __METHOD__ . ': No forms were found' );
709 709
 			return 0;
710 710
 		}
711 711
 
712
-		$first_form = $forms[0];
712
+		$first_form = $forms[ 0 ];
713 713
 
714
-		$form_id = is_object( $forms[0] ) ? $first_form->id : $first_form['id'];
714
+		$form_id = is_object( $forms[ 0 ] ) ? $first_form->id : $first_form[ 'id' ];
715 715
 
716 716
 		return intval( $form_id );
717 717
 	}
@@ -719,7 +719,7 @@  discard block
 block discarded – undo
719 719
 
720 720
 	function add_scripts_and_styles( $hook ) {
721 721
 
722
-		if( ! class_exists( 'RGForms' ) ) {
722
+		if ( ! class_exists( 'RGForms' ) ) {
723 723
 
724 724
 			do_action( 'gravityview_log_error', 'GravityView_Admin_ApproveEntries[add_scripts_and_styles] RGForms does not exist.' );
725 725
 
@@ -728,34 +728,34 @@  discard block
 block discarded – undo
728 728
 
729 729
 		// enqueue styles & scripts gf_entries
730 730
 		// But only if we're on the main Entries page, not on reports pages
731
-		if( GFForms::get_page() !== 'entry_list' ) {
731
+		if ( GFForms::get_page() !== 'entry_list' ) {
732 732
 			return;
733 733
 		}
734 734
 
735 735
 		$form_id = $this->get_form_id();
736 736
 
737 737
 		// Things are broken; no forms were found
738
-		if( empty( $form_id ) ) {
738
+		if ( empty( $form_id ) ) {
739 739
 			return;
740 740
 		}
741 741
 
742
-		wp_enqueue_style( 'gravityview_entries_list', plugins_url('assets/css/admin-entries-list.css', GRAVITYVIEW_FILE), array(), GravityView_Plugin::version );
742
+		wp_enqueue_style( 'gravityview_entries_list', plugins_url( 'assets/css/admin-entries-list.css', GRAVITYVIEW_FILE ), array(), GravityView_Plugin::version );
743 743
 
744
-		$script_debug = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min';
744
+		$script_debug = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
745 745
 
746
-		wp_enqueue_script( 'gravityview_gf_entries_scripts', plugins_url('assets/js/admin-entries-list'.$script_debug.'.js', GRAVITYVIEW_FILE), array( 'jquery' ), GravityView_Plugin::version );
746
+		wp_enqueue_script( 'gravityview_gf_entries_scripts', plugins_url( 'assets/js/admin-entries-list' . $script_debug . '.js', GRAVITYVIEW_FILE ), array( 'jquery' ), GravityView_Plugin::version );
747 747
 
748 748
 		wp_localize_script( 'gravityview_gf_entries_scripts', 'gvGlobals', array(
749
-			'nonce' => wp_create_nonce( 'gravityview_ajaxgfentries'),
749
+			'nonce' => wp_create_nonce( 'gravityview_ajaxgfentries' ),
750 750
 			'form_id' => $form_id,
751 751
 			'show_column' => (int)$this->show_approve_entry_column( $form_id ),
752 752
 			'add_bulk_action' => (int)GVCommon::has_cap( 'gravityview_moderate_entries' ),
753 753
 			'bulk_actions' => $this->get_bulk_actions( $form_id ),
754 754
 			'bulk_message' => $this->bulk_update_message,
755
-			'approve_title' => __( 'Entry not approved for directory viewing. Click to approve this entry.', 'gravityview'),
756
-			'unapprove_title' => __( 'Entry approved for directory viewing. Click to disapprove this entry.', 'gravityview'),
757
-			'column_title' => __( 'Show entry in directory view?', 'gravityview'),
758
-			'column_link' => esc_url( add_query_arg( array('sort' => self::get_approved_column( $form_id ) ) ) ),
755
+			'approve_title' => __( 'Entry not approved for directory viewing. Click to approve this entry.', 'gravityview' ),
756
+			'unapprove_title' => __( 'Entry approved for directory viewing. Click to disapprove this entry.', 'gravityview' ),
757
+			'column_title' => __( 'Show entry in directory view?', 'gravityview' ),
758
+			'column_link' => esc_url( add_query_arg( array( 'sort' => self::get_approved_column( $form_id ) ) ) ),
759 759
 		) );
760 760
 
761 761
 	}
@@ -775,11 +775,11 @@  discard block
 block discarded – undo
775 775
 			'GravityView' => array(
776 776
 				array(
777 777
 					'label' => __( 'Approve', 'gravityview' ),
778
-					'value' => sprintf( '%s-%d', $this->bulk_action_prefixes['approve'], $form_id ),
778
+					'value' => sprintf( '%s-%d', $this->bulk_action_prefixes[ 'approve' ], $form_id ),
779 779
 				),
780 780
 				array(
781 781
 					'label' => __( 'Disapprove', 'gravityview' ),
782
-					'value' => sprintf( '%s-%d', $this->bulk_action_prefixes['unapprove'], $form_id ),
782
+					'value' => sprintf( '%s-%d', $this->bulk_action_prefixes[ 'unapprove' ], $form_id ),
783 783
 				),
784 784
 			),
785 785
 		);
@@ -796,8 +796,8 @@  discard block
 block discarded – undo
796 796
 		// Sanitize the values, just to be sure.
797 797
 		foreach ( $bulk_actions as $key => $group ) {
798 798
 			foreach ( $group as $i => $action ) {
799
-				$bulk_actions[ $key ][ $i ]['label'] = esc_html( $bulk_actions[ $key ][ $i ]['label'] );
800
-				$bulk_actions[ $key ][ $i ]['value'] = esc_attr( $bulk_actions[ $key ][ $i ]['value'] );
799
+				$bulk_actions[ $key ][ $i ][ 'label' ] = esc_html( $bulk_actions[ $key ][ $i ][ 'label' ] );
800
+				$bulk_actions[ $key ][ $i ][ 'value' ] = esc_attr( $bulk_actions[ $key ][ $i ][ 'value' ] );
801 801
 			}
802 802
 		}
803 803
 
@@ -822,13 +822,13 @@  discard block
 block discarded – undo
822 822
 		 * @since 1.7.2
823 823
 		 * @param boolean $hide_if_no_connections
824 824
 		 */
825
-		$hide_if_no_connections = apply_filters('gravityview/approve_entries/hide-if-no-connections', false );
825
+		$hide_if_no_connections = apply_filters( 'gravityview/approve_entries/hide-if-no-connections', false );
826 826
 
827
-		if( $hide_if_no_connections ) {
827
+		if ( $hide_if_no_connections ) {
828 828
 
829 829
 			$connected_views = gravityview_get_connected_views( $form_id );
830 830
 
831
-			if( empty( $connected_views ) ) {
831
+			if ( empty( $connected_views ) ) {
832 832
 				$show_approve_column = false;
833 833
 			}
834 834
 		}
@@ -838,18 +838,18 @@  discard block
 block discarded – undo
838 838
 		 * @param boolean $show_approve_column Whether the column will be shown
839 839
 		 * @param int $form_id The ID of the Gravity Forms form for which entries are being shown
840 840
 		 */
841
-		$show_approve_column = apply_filters('gravityview/approve_entries/show-column', $show_approve_column, $form_id );
841
+		$show_approve_column = apply_filters( 'gravityview/approve_entries/show-column', $show_approve_column, $form_id );
842 842
 
843 843
 		return $show_approve_column;
844 844
 	}
845 845
 
846 846
 	function register_gform_noconflict_script( $scripts ) {
847
-		$scripts[] = 'gravityview_gf_entries_scripts';
847
+		$scripts[ ] = 'gravityview_gf_entries_scripts';
848 848
 		return $scripts;
849 849
 	}
850 850
 
851 851
 	function register_gform_noconflict_style( $styles ) {
852
-		$styles[] = 'gravityview_entries_list';
852
+		$styles[ ] = 'gravityview_entries_list';
853 853
 		return $styles;
854 854
 	}
855 855
 
Please login to merge, or discard this patch.
includes/widgets/search-widget/templates/search-field-select.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -10,8 +10,8 @@  discard block
 block discarded – undo
10 10
 $search_field = $gravityview_view->search_field;
11 11
 
12 12
 // Make sure that there are choices to display
13
-if( empty( $search_field['choices'] ) ) {
14
-	do_action('gravityview_log_debug', 'search-field-select.php - No choices for field' );
13
+if ( empty( $search_field[ 'choices' ] ) ) {
14
+	do_action( 'gravityview_log_debug', 'search-field-select.php - No choices for field' );
15 15
 	return;
16 16
 }
17 17
 
@@ -21,19 +21,19 @@  discard block
 block discarded – undo
21 21
  * @param string $default_option Default: `&mdash;` (—)
22 22
  * @param string $field_type Field type: "select" or "multiselect"
23 23
  */
24
-$default_option = apply_filters('gravityview/extension/search/select_default', '&mdash;', 'select' );
24
+$default_option = apply_filters( 'gravityview/extension/search/select_default', '&mdash;', 'select' );
25 25
 
26 26
 ?>
27 27
 <div class="gv-search-box gv-search-field-select">
28
-	<?php if( ! gv_empty( $search_field['label'], false ) ) { ?>
29
-		<label for="search-box-<?php echo esc_attr( $search_field['name'] ); ?>"><?php echo esc_html( $search_field['label'] ); ?></label>
28
+	<?php if ( ! gv_empty( $search_field[ 'label' ], false ) ) { ?>
29
+		<label for="search-box-<?php echo esc_attr( $search_field[ 'name' ] ); ?>"><?php echo esc_html( $search_field[ 'label' ] ); ?></label>
30 30
 	<?php } ?>
31 31
 	<p>
32
-		<select name="<?php echo esc_attr( $search_field['name'] ); ?>" id="search-box-<?php echo esc_attr( $search_field['name'] ); ?>">
33
-			<option value="" <?php gv_selected( '', $search_field['value'], true ); ?>><?php echo esc_html( $default_option ); ?></option>
32
+		<select name="<?php echo esc_attr( $search_field[ 'name' ] ); ?>" id="search-box-<?php echo esc_attr( $search_field[ 'name' ] ); ?>">
33
+			<option value="" <?php gv_selected( '', $search_field[ 'value' ], true ); ?>><?php echo esc_html( $default_option ); ?></option>
34 34
 			<?php
35
-			foreach( $search_field['choices'] as $choice ) : ?>
36
-				<option value="<?php echo esc_attr( $choice['value'] ); ?>" <?php gv_selected( esc_attr( $choice['value'] ), esc_attr( $search_field['value'] ), true ); ?>><?php echo esc_html( $choice['text'] ); ?></option>
35
+			foreach ( $search_field[ 'choices' ] as $choice ) : ?>
36
+				<option value="<?php echo esc_attr( $choice[ 'value' ] ); ?>" <?php gv_selected( esc_attr( $choice[ 'value' ] ), esc_attr( $search_field[ 'value' ] ), true ); ?>><?php echo esc_html( $choice[ 'text' ] ); ?></option>
37 37
 			<?php endforeach; ?>
38 38
 		</select>
39 39
 	</p>
Please login to merge, or discard this patch.
includes/class-gravityview-admin-bar.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -38,13 +38,13 @@  discard block
 block discarded – undo
38 38
 		/** @var WP_Admin_Bar $wp_admin_bar */
39 39
 		global $wp_admin_bar;
40 40
 
41
-		if( is_admin() || ! GVCommon::has_cap( array( 'edit_gravityviews', 'gravityview_edit_entry', 'gravityforms_edit_forms' ) ) ) {
41
+		if ( is_admin() || ! GVCommon::has_cap( array( 'edit_gravityviews', 'gravityview_edit_entry', 'gravityforms_edit_forms' ) ) ) {
42 42
 			return;
43 43
 		}
44 44
 
45 45
 		$view_data = GravityView_View_Data::getInstance()->get_views();
46 46
 
47
-		if( empty( $view_data ) ) {
47
+		if ( empty( $view_data ) ) {
48 48
 			return;
49 49
 		}
50 50
 
@@ -104,9 +104,9 @@  discard block
 block discarded – undo
104 104
 				'parent' => 'gravityview',
105 105
 				'title' => __( 'Edit Entry', 'gravityview' ),
106 106
 				'meta' => array(
107
-					'title' => sprintf( __( 'Edit Entry %s', 'gravityview' ), GravityView_API::get_entry_slug( $entry['id'], $entry ) ),
107
+					'title' => sprintf( __( 'Edit Entry %s', 'gravityview' ), GravityView_API::get_entry_slug( $entry[ 'id' ], $entry ) ),
108 108
 				),
109
-				'href' => esc_url_raw( admin_url( sprintf( 'admin.php?page=gf_entries&amp;screen_mode=edit&amp;view=entry&amp;id=%d&lid=%d', $entry['form_id'], $entry['id'] ) ) ),
109
+				'href' => esc_url_raw( admin_url( sprintf( 'admin.php?page=gf_entries&amp;screen_mode=edit&amp;view=entry&amp;id=%d&lid=%d', $entry[ 'form_id' ], $entry[ 'id' ] ) ) ),
110 110
 			) );
111 111
 
112 112
 		}
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
 		/** @var WP_Admin_Bar $wp_admin_bar */
123 123
 		global $wp_admin_bar;
124 124
 
125
-		if( GVCommon::has_cap( array( 'edit_gravityviews', 'edit_gravityview', 'gravityforms_edit_forms' ) ) ) {
125
+		if ( GVCommon::has_cap( array( 'edit_gravityviews', 'edit_gravityview', 'gravityforms_edit_forms' ) ) ) {
126 126
 
127 127
 			$view_data = GravityView_View_Data::getInstance();
128 128
 
@@ -139,32 +139,32 @@  discard block
 block discarded – undo
139 139
 					$edit_view_title = __( 'Edit View', 'gravityview' );
140 140
 					$edit_form_title = __( 'Edit Form', 'gravityview' );
141 141
 
142
-					if( sizeof( $views ) > 1 ) {
143
-						$edit_view_title = sprintf( _x( 'Edit View #%d', 'Edit View with the ID of %d', 'gravityview' ), $view['id'] );
144
-						$edit_form_title = sprintf( __( 'Edit Form #%d', 'Edit Form with the ID of %d', 'gravityview' ), $view['form_id'] );
142
+					if ( sizeof( $views ) > 1 ) {
143
+						$edit_view_title = sprintf( _x( 'Edit View #%d', 'Edit View with the ID of %d', 'gravityview' ), $view[ 'id' ] );
144
+						$edit_form_title = sprintf( __( 'Edit Form #%d', 'Edit Form with the ID of %d', 'gravityview' ), $view[ 'form_id' ] );
145 145
 					}
146 146
 
147
-					if( GVCommon::has_cap( 'edit_gravityview', $view['id'] ) && ! in_array( $view['id'], $added_views ) ) {
147
+					if ( GVCommon::has_cap( 'edit_gravityview', $view[ 'id' ] ) && ! in_array( $view[ 'id' ], $added_views ) ) {
148 148
 
149
-						$added_views[] = $view['id'];
149
+						$added_views[ ] = $view[ 'id' ];
150 150
 
151 151
 						$wp_admin_bar->add_menu( array(
152
-							'id'    => 'edit-view-' . $view['id'],
152
+							'id'    => 'edit-view-' . $view[ 'id' ],
153 153
 							'parent' => 'gravityview',
154 154
 							'title' => $edit_view_title,
155
-							'href'  => esc_url_raw( admin_url( sprintf( 'post.php?post=%d&action=edit', $view['id'] ) ) ),
155
+							'href'  => esc_url_raw( admin_url( sprintf( 'post.php?post=%d&action=edit', $view[ 'id' ] ) ) ),
156 156
 						) );
157 157
 					}
158 158
 
159
-					if ( ! empty( $view['form_id'] ) && GVCommon::has_cap( array( 'gravityforms_edit_forms' ), $view['form_id'] ) && ! in_array( $view['form_id'], $added_forms )  ) {
159
+					if ( ! empty( $view[ 'form_id' ] ) && GVCommon::has_cap( array( 'gravityforms_edit_forms' ), $view[ 'form_id' ] ) && ! in_array( $view[ 'form_id' ], $added_forms ) ) {
160 160
 
161
-						$added_forms[] = $view['form_id'];
161
+						$added_forms[ ] = $view[ 'form_id' ];
162 162
 
163 163
 						$wp_admin_bar->add_menu( array(
164
-							'id'    => 'edit-form-' . $view['form_id'],
164
+							'id'    => 'edit-form-' . $view[ 'form_id' ],
165 165
 							'parent' => 'gravityview',
166 166
 							'title' => $edit_form_title,
167
-							'href' => esc_url_raw( admin_url( sprintf( 'admin.php?page=gf_edit_forms&id=%d', $view['form_id'] ) ) ),
167
+							'href' => esc_url_raw( admin_url( sprintf( 'admin.php?page=gf_edit_forms&id=%d', $view[ 'form_id' ] ) ) ),
168 168
 						) );
169 169
 					}
170 170
 				}
Please login to merge, or discard this patch.
includes/admin/field-types/type_multiselect.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
 		?>
9 9
 		<label for="<?php echo $this->get_field_id(); ?>" class="<?php echo $this->get_label_class(); ?>"><?php
10 10
 
11
-			echo '<span class="gv-label">'.$this->get_field_label().'</span>';
11
+			echo '<span class="gv-label">' . $this->get_field_label() . '</span>';
12 12
 
13 13
 			echo $this->get_tooltip() . $this->get_field_desc();
14 14
 
@@ -20,13 +20,13 @@  discard block
 block discarded – undo
20 20
 	}
21 21
 
22 22
 	function render_input( $override_input = null ) {
23
-		if( isset( $override_input ) ) {
23
+		if ( isset( $override_input ) ) {
24 24
 			echo $override_input;
25 25
 			return;
26 26
 		}
27 27
 		?>
28 28
 		<select name="<?php echo esc_attr( $this->name ); ?>" id="<?php echo $this->get_field_id(); ?>">
29
-			<?php foreach( $this->field['options'] as $value => $label ) : ?>
29
+			<?php foreach ( $this->field[ 'options' ] as $value => $label ) : ?>
30 30
 				<option value="<?php echo esc_attr( $value ); ?>" <?php selected( $value, $this->value, true ); ?>><?php echo esc_html( $label ); ?></option>
31 31
 			<?php endforeach; ?>
32 32
 		</select>
Please login to merge, or discard this patch.
includes/helper-functions.php 1 patch
Spacing   +51 added lines, -51 removed lines patch added patch discarded remove patch
@@ -32,19 +32,19 @@  discard block
 block discarded – undo
32 32
 	// If there's an overriding CSS file in the current template folder, use it.
33 33
 	$template_css_path = trailingslashit( get_stylesheet_directory() ) . 'gravityview/css/' . $css_file;
34 34
 
35
-	if( file_exists( $template_css_path ) ) {
35
+	if ( file_exists( $template_css_path ) ) {
36 36
 		$path = trailingslashit( get_stylesheet_directory_uri() ) . 'gravityview/css/' . $css_file;
37
-		do_action( 'gravityview_log_debug', __FUNCTION__ . ': Stylesheet override ('. esc_attr( $css_file ) .')' );
37
+		do_action( 'gravityview_log_debug', __FUNCTION__ . ': Stylesheet override (' . esc_attr( $css_file ) . ')' );
38 38
 	} else {
39 39
 		// Default: use GravityView CSS file
40 40
 
41 41
 		// If no path is provided, assume default plugin templates CSS folder
42
-		if( '' === $dir_path ) {
42
+		if ( '' === $dir_path ) {
43 43
 			$dir_path = GRAVITYVIEW_DIR . 'templates/css/';
44 44
 		}
45 45
 		
46 46
 		// plugins_url() expects a path to a file, not directory. We append a file to be stripped.
47
-		$path = plugins_url( $css_file, trailingslashit( $dir_path )  . 'stripped-by-plugin_basename.php' );
47
+		$path = plugins_url( $css_file, trailingslashit( $dir_path ) . 'stripped-by-plugin_basename.php' );
48 48
 	}
49 49
 
50 50
 	return $path;
@@ -82,9 +82,9 @@  discard block
 block discarded – undo
82 82
 
83 83
 	$parsed_permalink = parse_url( get_permalink( $id ) );
84 84
 
85
-	$permalink_args =  isset( $parsed_permalink['query'] ) ? $parsed_permalink['query'] : false;
85
+	$permalink_args = isset( $parsed_permalink[ 'query' ] ) ? $parsed_permalink[ 'query' ] : false;
86 86
 
87
-	if( empty( $permalink_args ) ) {
87
+	if ( empty( $permalink_args ) ) {
88 88
 		return array();
89 89
 	}
90 90
 
@@ -109,15 +109,15 @@  discard block
 block discarded – undo
109 109
 function gv_selected( $value, $current, $echo = true, $type = 'selected' ) {
110 110
 
111 111
 	$output = '';
112
-	if( is_array( $current ) ) {
113
-		if( in_array( $value, $current ) ) {
112
+	if ( is_array( $current ) ) {
113
+		if ( in_array( $value, $current ) ) {
114 114
 			$output = __checked_selected_helper( true, true, false, $type );
115 115
 		}
116 116
 	} else {
117 117
 		$output = __checked_selected_helper( $value, $current, false, $type );
118 118
 	}
119 119
 
120
-	if( $echo ) {
120
+	if ( $echo ) {
121 121
 		echo $output;
122 122
 	}
123 123
 
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
 }
126 126
 
127 127
 
128
-if( ! function_exists( 'gravityview_sanitize_html_class' ) ) {
128
+if ( ! function_exists( 'gravityview_sanitize_html_class' ) ) {
129 129
 
130 130
 	/**
131 131
 	 * sanitize_html_class doesn't handle spaces (multiple classes). We remedy that.
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
  */
172 172
 function gravityview_strip_whitespace( $string ) {
173 173
 	$string = normalize_whitespace( $string );
174
-	return preg_replace('/[\r\n\t ]+/', ' ', $string );
174
+	return preg_replace( '/[\r\n\t ]+/', ' ', $string );
175 175
 }
176 176
 
177 177
 /**
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
  * @return string Included file contents
186 186
  */
187 187
 function gravityview_ob_include( $file_path, $object = NULL ) {
188
-	if( ! file_exists( $file_path ) ) {
188
+	if ( ! file_exists( $file_path ) ) {
189 189
 		do_action( 'gravityview_log_error', __FUNCTION__ . ': File path does not exist. ', $file_path );
190 190
 		return '';
191 191
 	}
@@ -203,7 +203,7 @@  discard block
 block discarded – undo
203 203
 
204 204
 	$width = $height * 0.7586206897;
205 205
 
206
-	if( function_exists('is_rtl') && is_rtl() ) {
206
+	if ( function_exists( 'is_rtl' ) && is_rtl() ) {
207 207
 		$style = 'margin:10px 10px 10px 0;';
208 208
 		$class = 'alignright';
209 209
 	} else {
@@ -211,7 +211,7 @@  discard block
 block discarded – undo
211 211
 		$class = 'alignleft';
212 212
 	}
213 213
 
214
-	return '<img src="'.plugins_url( 'assets/images/astronaut-200x263.png', GRAVITYVIEW_FILE ).'" class="'.$class.'" height="'.intval( $height ).'" width="'.round( $width, 2 ).'" alt="The GravityView Astronaut Says:" style="'.$style.'" />';
214
+	return '<img src="' . plugins_url( 'assets/images/astronaut-200x263.png', GRAVITYVIEW_FILE ) . '" class="' . $class . '" height="' . intval( $height ) . '" width="' . round( $width, 2 ) . '" alt="The GravityView Astronaut Says:" style="' . $style . '" />';
215 215
 }
216 216
 
217 217
 /**
@@ -234,9 +234,9 @@  discard block
 block discarded – undo
234 234
 function gravityview_number_format( $number, $decimals = '' ) {
235 235
 	global $wp_locale;
236 236
 
237
-	if( '' === $decimals ) {
237
+	if ( '' === $decimals ) {
238 238
 
239
-		$decimal_point = isset( $wp_locale ) ? $wp_locale->number_format['decimal_point'] : '.';
239
+		$decimal_point = isset( $wp_locale ) ? $wp_locale->number_format[ 'decimal_point' ] : '.';
240 240
 
241 241
 		/**
242 242
 		 * Calculate the position of the decimal point in the number
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
 	$parts = parse_url( $value );
266 266
 
267 267
 	// No domain? Strange...show the original text.
268
-	if( empty( $parts['host'] ) ) {
268
+	if ( empty( $parts[ 'host' ] ) ) {
269 269
 		return $value;
270 270
 	}
271 271
 
@@ -278,16 +278,16 @@  discard block
 block discarded – undo
278 278
 	 * @param boolean $enable Whether to strip the scheme. Return false to show scheme. (default: true)\n
279 279
 	 * If true: `http://example.com => example.com`
280 280
 	 */
281
-	if( false === apply_filters('gravityview_anchor_text_striphttp', true) ) {
281
+	if ( false === apply_filters( 'gravityview_anchor_text_striphttp', true ) ) {
282 282
 
283
-		if( isset( $parts['scheme'] ) ) {
284
-			$return .= $parts['scheme'];
283
+		if ( isset( $parts[ 'scheme' ] ) ) {
284
+			$return .= $parts[ 'scheme' ];
285 285
 		}
286 286
 
287 287
 	}
288 288
 
289 289
 	// The domain, which may contain a subdomain
290
-	$domain = $parts['host'];
290
+	$domain = $parts[ 'host' ];
291 291
 
292 292
 	/**
293 293
 	 * @filter `gravityview_anchor_text_stripwww` Strip www from the domain?
@@ -295,10 +295,10 @@  discard block
 block discarded – undo
295 295
 	 * @param boolean $enable Whether to strip www. Return false to show www. (default: true)\n
296 296
 	 * If true: `www.example.com => example.com`
297 297
 	 */
298
-	$strip_www = apply_filters('gravityview_anchor_text_stripwww', true );
298
+	$strip_www = apply_filters( 'gravityview_anchor_text_stripwww', true );
299 299
 
300
-	if( $strip_www ) {
301
-		$domain = str_replace('www.', '', $domain );
300
+	if ( $strip_www ) {
301
+		$domain = str_replace( 'www.', '', $domain );
302 302
 	}
303 303
 
304 304
 	/**
@@ -308,11 +308,11 @@  discard block
 block discarded – undo
308 308
 	 * If true: `http://demo.example.com => example.com` \n
309 309
 	 * If false: `http://demo.example.com => demo.example.com`
310 310
 	 */
311
-	$strip_subdomains = apply_filters('gravityview_anchor_text_nosubdomain', true);
311
+	$strip_subdomains = apply_filters( 'gravityview_anchor_text_nosubdomain', true );
312 312
 
313
-	if( $strip_subdomains ) {
313
+	if ( $strip_subdomains ) {
314 314
 
315
-		$domain = _gravityview_strip_subdomain( $parts['host'] );
315
+		$domain = _gravityview_strip_subdomain( $parts[ 'host' ] );
316 316
 
317 317
 	}
318 318
 
@@ -326,12 +326,12 @@  discard block
 block discarded – undo
326 326
 	 * If true: `http://example.com/sub/directory/page.html => example.com`  \n
327 327
 	 * If false: `http://example.com/sub/directory/page.html => example.com/sub/directory/page.html`
328 328
 	 */
329
-	$root_only = apply_filters('gravityview_anchor_text_rootonly', true);
329
+	$root_only = apply_filters( 'gravityview_anchor_text_rootonly', true );
330 330
 
331
-	if( empty( $root_only ) ) {
331
+	if ( empty( $root_only ) ) {
332 332
 
333
-		if( isset( $parts['path'] ) ) {
334
-			$return .= $parts['path'];
333
+		if ( isset( $parts[ 'path' ] ) ) {
334
+			$return .= $parts[ 'path' ];
335 335
 		}
336 336
 	}
337 337
 
@@ -341,12 +341,12 @@  discard block
 block discarded – undo
341 341
 	 * @param boolean $enable Whether to enable "root only". Return false to show full path. (default: true)\n
342 342
 	 * If true: `http://example.com/?query=example => example.com`
343 343
 	 */
344
-	$strip_query_string = apply_filters('gravityview_anchor_text_noquerystring', true );
344
+	$strip_query_string = apply_filters( 'gravityview_anchor_text_noquerystring', true );
345 345
 
346
-	if( empty( $strip_query_string ) ) {
346
+	if ( empty( $strip_query_string ) ) {
347 347
 
348
-		if( isset( $parts['query'] ) ) {
349
-			$return .= '?'.$parts['query'];
348
+		if ( isset( $parts[ 'query' ] ) ) {
349
+			$return .= '?' . $parts[ 'query' ];
350 350
 		}
351 351
 
352 352
 	}
@@ -363,8 +363,8 @@  discard block
 block discarded – undo
363 363
  */
364 364
 function _gravityview_strip_subdomain( $string_maybe_has_subdomain ) {
365 365
 
366
-	if( preg_match("/(?P<domain>[a-z0-9][a-z0-9\-]{1,63}\.(?:com\.|co\.|net\.|org\.|firm\.|me\.|school\.|law\.|gov\.|mod\.|msk\.|irkutsks\.|sa\.|act\.|police\.|plc\.|ac\.|tm\.|asso\.|biz\.|pro\.|cg\.|telememo\.)?[a-z\.]{2,6})$/i", $string_maybe_has_subdomain, $matches ) ) {
367
-		return $matches['domain'];
366
+	if ( preg_match( "/(?P<domain>[a-z0-9][a-z0-9\-]{1,63}\.(?:com\.|co\.|net\.|org\.|firm\.|me\.|school\.|law\.|gov\.|mod\.|msk\.|irkutsks\.|sa\.|act\.|police\.|plc\.|ac\.|tm\.|asso\.|biz\.|pro\.|cg\.|telememo\.)?[a-z\.]{2,6})$/i", $string_maybe_has_subdomain, $matches ) ) {
367
+		return $matches[ 'domain' ];
368 368
 	} else {
369 369
 		return $string_maybe_has_subdomain;
370 370
 	}
@@ -385,7 +385,7 @@  discard block
 block discarded – undo
385 385
  */
386 386
 function gv_empty( $value, $zero_is_empty = true, $allow_string_booleans = true ) {
387 387
 
388
-	if(
388
+	if (
389 389
 		! isset( $value ) // If it's not set, it's empty!
390 390
 		|| false === $value
391 391
 		|| null === $value
@@ -396,20 +396,20 @@  discard block
 block discarded – undo
396 396
 		return true;
397 397
 	}
398 398
 
399
-	if( is_string( $value ) && $allow_string_booleans ) {
399
+	if ( is_string( $value ) && $allow_string_booleans ) {
400 400
 
401 401
 		$value = trim( $value );
402 402
 		$value = strtolower( $value );
403 403
 
404 404
 		if ( in_array( $value, array( 'yes', 'true' ), true ) ) {
405 405
 			$value = true;
406
-		} else if( in_array( $value, array( 'no', 'false' ), true ) ) {
406
+		} else if ( in_array( $value, array( 'no', 'false' ), true ) ) {
407 407
 			$value = false;
408 408
 		}
409 409
 	}
410 410
 
411 411
 	// If zero isn't empty, then if $value is a number and it's empty, it's zero. Thus, return false.
412
-	if( ! $zero_is_empty && is_numeric( $value ) && empty( $value ) ) {
412
+	if ( ! $zero_is_empty && is_numeric( $value ) && empty( $value ) ) {
413 413
 		return false;
414 414
 	}
415 415
 
@@ -432,7 +432,7 @@  discard block
 block discarded – undo
432 432
 
433 433
 	// Use the original function, if exists.
434 434
 	// Requires WP 4.4+
435
-	if( function_exists( 'map_deep') ) {
435
+	if ( function_exists( 'map_deep' ) ) {
436 436
 		return map_deep( $value, $callback );
437 437
 	}
438 438
 
@@ -497,7 +497,7 @@  discard block
 block discarded – undo
497 497
 
498 498
 	$exploded = explode( '.', "{$field_id}" );
499 499
 
500
-	return isset( $exploded[1] ) ? intval( $exploded[1] ) : false;
500
+	return isset( $exploded[ 1 ] ) ? intval( $exploded[ 1 ] ) : false;
501 501
 }
502 502
 
503 503
 /**
@@ -538,13 +538,13 @@  discard block
 block discarded – undo
538 538
 	 */
539 539
 	$args = apply_filters( 'gravityview_get_terms_choices_args', $args );
540 540
 
541
-	$terms = get_terms( $args['taxonomy'], $args );
541
+	$terms = get_terms( $args[ 'taxonomy' ], $args );
542 542
 
543 543
 	$choices = array();
544 544
 
545 545
 	if ( is_array( $terms ) ) {
546 546
 		foreach ( $terms as $term_id => $term_name ) {
547
-			$choices[] = array(
547
+			$choices[ ] = array(
548 548
 				'text'  => $term_name,
549 549
 				'value' => $term_id
550 550
 			);
@@ -568,21 +568,21 @@  discard block
 block discarded – undo
568 568
 function _gravityview_process_posted_fields() {
569 569
 	$fields = array();
570 570
 
571
-	if( !empty( $_POST['gv_fields'] ) ) {
572
-		if ( ! is_array( $_POST['gv_fields'] ) ) {
571
+	if ( ! empty( $_POST[ 'gv_fields' ] ) ) {
572
+		if ( ! is_array( $_POST[ 'gv_fields' ] ) ) {
573 573
 
574 574
 			// We are not using parse_str() due to max_input_vars limitation with large View configurations
575 575
 			$fields_holder = array();
576
-			GVCommon::gv_parse_str( $_POST['gv_fields'], $fields_holder );
576
+			GVCommon::gv_parse_str( $_POST[ 'gv_fields' ], $fields_holder );
577 577
 
578
-			if ( isset( $fields_holder['fields'] ) ) {
579
-				$fields = $fields_holder['fields'];
578
+			if ( isset( $fields_holder[ 'fields' ] ) ) {
579
+				$fields = $fields_holder[ 'fields' ];
580 580
 			} else {
581 581
 				do_action( 'gravityview_log_error', '[save_postdata] No `fields` key was found after parsing $fields string', $fields_holder );
582 582
 			}
583 583
 
584 584
 		} else {
585
-			$fields = $_POST['gv_fields'];
585
+			$fields = $_POST[ 'gv_fields' ];
586 586
 		}
587 587
 	}
588 588
 
Please login to merge, or discard this patch.