Completed
Pull Request — master (#815)
by Zack
10:24 queued 07:03
created
includes/fields/class-gravityview-field-approval.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
 
23 23
 		$this->label = esc_attr__( 'Approve Entries', 'gravityview' );
24 24
 
25
-		$this->description =  esc_attr__( 'Approve and reject entries from the View.', 'gravityview' );
25
+		$this->description = esc_attr__( 'Approve and reject entries from the View.', 'gravityview' );
26 26
 
27 27
 		$this->add_hooks();
28 28
 
@@ -44,11 +44,11 @@  discard block
 block discarded – undo
44 44
 	 */
45 45
 	function field_options( $field_options, $template_id = '', $field_id = '', $context = '', $input_type = '' ) {
46 46
 
47
-		unset( $field_options['only_loggedin'] );
47
+		unset( $field_options[ 'only_loggedin' ] );
48 48
 
49
-		unset( $field_options['new_window'] );
49
+		unset( $field_options[ 'new_window' ] );
50 50
 
51
-		unset( $field_options['show_as_link'] );
51
+		unset( $field_options[ 'show_as_link' ] );
52 52
 
53 53
 		return $field_options;
54 54
 	}
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 
69 69
 		add_action( 'gravityview/field/approval/load_scripts', array( $this, 'enqueue_and_localize_script' ) );
70 70
 
71
-		add_action( 'gravityview_datatables_scripts_styles',  array( $this, 'enqueue_and_localize_script' ) );
71
+		add_action( 'gravityview_datatables_scripts_styles', array( $this, 'enqueue_and_localize_script' ) );
72 72
 
73 73
 		add_filter( 'gravityview_get_entries', array( $this, 'modify_search_parameters' ), 1000 );
74 74
 
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
 	public function maybe_prevent_field_render( $html, $args ) {
89 89
 
90 90
 		// If the field is `entry_approval` type but the user doesn't have the moderate entries cap, don't render.
91
-		if( $this->name === rgar( $args['field'], 'id' ) && ! GVCommon::has_cap('gravityview_moderate_entries') ) {
91
+		if ( $this->name === rgar( $args[ 'field' ], 'id' ) && ! GVCommon::has_cap( 'gravityview_moderate_entries' ) ) {
92 92
 			return '';
93 93
 		}
94 94
 
@@ -104,8 +104,8 @@  discard block
 block discarded – undo
104 104
 	 */
105 105
 	public function modify_search_parameters( $parameters ) {
106 106
 
107
-		if( $this->name === rgars( $parameters, 'sorting/key' ) ) {
108
-			$parameters['sorting']['key'] = 'is_approved';
107
+		if ( $this->name === rgars( $parameters, 'sorting/key' ) ) {
108
+			$parameters[ 'sorting' ][ 'key' ] = 'is_approved';
109 109
 		}
110 110
 
111 111
 		return $parameters;
@@ -121,18 +121,18 @@  discard block
 block discarded – undo
121 121
 	function register_scripts_and_styles() {
122 122
 		$script_debug = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
123 123
 
124
-		wp_register_script( 'gravityview-field-approval', GRAVITYVIEW_URL . 'assets/js/field-approval'.$script_debug.'.js', array( 'jquery' ), GravityView_Plugin::version, true );
124
+		wp_register_script( 'gravityview-field-approval', GRAVITYVIEW_URL . 'assets/js/field-approval' . $script_debug . '.js', array( 'jquery' ), GravityView_Plugin::version, true );
125 125
 
126 126
 		$style_path = GRAVITYVIEW_DIR . 'templates/css/field-approval.css';
127 127
 
128
-		if( class_exists( 'GravityView_View' ) ) {
128
+		if ( class_exists( 'GravityView_View' ) ) {
129 129
 			/**
130 130
 			 * Override CSS file by placing in your theme's /gravityview/css/ sub-directory.
131 131
 			 */
132 132
 			$style_path = GravityView_View::getInstance()->locate_template( 'css/field-approval.css', false );
133 133
 		}
134 134
 
135
-		$style_url = plugins_url( 'css/field-approval.css', trailingslashit( dirname( $style_path ) )  );
135
+		$style_url = plugins_url( 'css/field-approval.css', trailingslashit( dirname( $style_path ) ) );
136 136
 
137 137
 		/**
138 138
 		 * @filter `gravityview/field/approval/css_url` URL to the Approval field CSS file.
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
 		 */
142 142
 		$style_url = apply_filters( 'gravityview/field/approval/css_url', $style_url );
143 143
 
144
-		if( ! empty( $style_url ) ) {
144
+		if ( ! empty( $style_url ) ) {
145 145
 			wp_register_style( 'gravityview-field-approval', $style_url, array( 'dashicons' ), GravityView_Plugin::version, 'screen' );
146 146
 		}
147 147
 
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
 	public function enqueue_and_localize_script() {
157 157
 
158 158
 		// The script is already registered and enqueued
159
-		if( wp_script_is( 'gravityview-field-approval', 'enqueued' ) ) {
159
+		if ( wp_script_is( 'gravityview-field-approval', 'enqueued' ) ) {
160 160
 			return;
161 161
 		}
162 162
 
@@ -166,9 +166,9 @@  discard block
 block discarded – undo
166 166
 
167 167
 		wp_localize_script( 'gravityview-field-approval', 'gvApproval', array(
168 168
 			'ajaxurl' => admin_url( 'admin-ajax.php' ),
169
-			'nonce' => wp_create_nonce('gravityview_entry_approval'),
169
+			'nonce' => wp_create_nonce( 'gravityview_entry_approval' ),
170 170
 			'status' => GravityView_Entry_Approval_Status::get_all(),
171
-		));
171
+		) );
172 172
 
173 173
 	}
174 174
 
@@ -185,8 +185,8 @@  discard block
 block discarded – undo
185 185
 	 */
186 186
 	public function filter_gravityview_entry_default_field( $entry_default_fields, $form, $context ) {
187 187
 
188
-		if ( ! isset( $entry_default_fields["{$this->name}"] ) ) {
189
-			$entry_default_fields["{$this->name}"] = array(
188
+		if ( ! isset( $entry_default_fields[ "{$this->name}" ] ) ) {
189
+			$entry_default_fields[ "{$this->name}" ] = array(
190 190
 				'label' => $this->label,
191 191
 				'desc'  => $this->description,
192 192
 				'type'  => $this->name,
Please login to merge, or discard this patch.
includes/class-gravityview-compatibility.php 1 patch
Spacing   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
 	 * @return GravityView_Compatibility
77 77
 	 */
78 78
 	public static function getInstance() {
79
-		if( self::$instance ) {
79
+		if ( self::$instance ) {
80 80
 			return self::$instance;
81 81
 		}
82 82
 		return new self;
@@ -123,10 +123,10 @@  discard block
 block discarded – undo
123 123
 		// If Gravity Forms doesn't exist or is outdated, load the admin view class to
124 124
 		// show the notice, but not load any post types or process shortcodes.
125 125
 		// Without Gravity Forms, there is no GravityView. Beautiful, really.
126
-		if( ! self::is_valid() ) {
126
+		if ( ! self::is_valid() ) {
127 127
 
128 128
 			// If the plugin's not loaded, might as well hide the shortcode for people.
129
-			add_shortcode( 'gravityview', array( $this, '_shortcode_gf_notice') );
129
+			add_shortcode( 'gravityview', array( $this, '_shortcode_gf_notice' ) );
130 130
 
131 131
 		}
132 132
 	}
@@ -152,15 +152,15 @@  discard block
 block discarded – undo
152 152
 	 */
153 153
 	public function _shortcode_gf_notice( $atts = array(), $content = null, $shortcode = 'gravityview' ) {
154 154
 
155
-		if( ! GVCommon::has_cap( 'activate_plugins' ) ) {
155
+		if ( ! GVCommon::has_cap( 'activate_plugins' ) ) {
156 156
 			return null;
157 157
 		}
158 158
 
159 159
 		$notices = self::get_notices();
160 160
 
161
-		$message = '<div style="border:1px solid red; padding: 15px;"><p style="text-align:center;"><em>' . esc_html__( 'You are seeing this notice because you are an administrator. Other users of the site will see nothing.', 'gravityview') . '</em></p>';
162
-		foreach( (array)$notices as $notice ) {
163
-			$message .= wpautop( $notice['message'] );
161
+		$message = '<div style="border:1px solid red; padding: 15px;"><p style="text-align:center;"><em>' . esc_html__( 'You are seeing this notice because you are an administrator. Other users of the site will see nothing.', 'gravityview' ) . '</em></p>';
162
+		foreach ( (array)$notices as $notice ) {
163
+			$message .= wpautop( $notice[ 'message' ] );
164 164
 		}
165 165
 		$message .= '</div>';
166 166
 
@@ -178,11 +178,11 @@  discard block
 block discarded – undo
178 178
 	 */
179 179
 	public static function check_php() {
180 180
 
181
-		if( false === version_compare( phpversion(), GV_MIN_PHP_VERSION , '>=' ) ) {
181
+		if ( false === version_compare( phpversion(), GV_MIN_PHP_VERSION, '>=' ) ) {
182 182
 
183
-			self::$notices['php_version'] = array(
183
+			self::$notices[ 'php_version' ] = array(
184 184
 				'class' => 'error',
185
-				'message' => sprintf( __( "%sGravityView requires PHP Version %s or newer.%s \n\nYou're using Version %s. Please ask your host to upgrade your server's PHP.", 'gravityview' ), '<h3>', GV_MIN_PHP_VERSION, "</h3>\n\n", '<span style="font-family: Consolas, Courier, monospace;">'.phpversion().'</span>' ),
185
+				'message' => sprintf( __( "%sGravityView requires PHP Version %s or newer.%s \n\nYou're using Version %s. Please ask your host to upgrade your server's PHP.", 'gravityview' ), '<h3>', GV_MIN_PHP_VERSION, "</h3>\n\n", '<span style="font-family: Consolas, Courier, monospace;">' . phpversion() . '</span>' ),
186 186
 				'cap' => 'manage_options',
187 187
 				'dismiss' => 'php_version',
188 188
 			);
@@ -190,14 +190,14 @@  discard block
 block discarded – undo
190 190
 			return false;
191 191
 		}
192 192
 
193
-		if( false === version_compare( phpversion(), GV_FUTURE_MIN_PHP_VERSION , '>=' ) ) {
193
+		if ( false === version_compare( phpversion(), GV_FUTURE_MIN_PHP_VERSION, '>=' ) ) {
194 194
 
195 195
 			// Show the notice on every update. Yes, annoying, but not as annoying as a plugin breaking.
196
-			$key = sprintf('php_%s_%s', GV_FUTURE_MIN_PHP_VERSION, GravityView_Plugin::version );
196
+			$key = sprintf( 'php_%s_%s', GV_FUTURE_MIN_PHP_VERSION, GravityView_Plugin::version );
197 197
 
198 198
 			self::$notices[ $key ] = array(
199 199
 				'class' => 'error',
200
-				'message' => sprintf( __( "%sGravityView will soon require PHP Version %s.%s \n\nYou're using Version %s. Please ask your host to upgrade your server's PHP.", 'gravityview' ), '<h3>', GV_FUTURE_MIN_PHP_VERSION, "</h3>\n\n", '<span style="font-family: Consolas, Courier, monospace;">'.phpversion().'</span>' ),
200
+				'message' => sprintf( __( "%sGravityView will soon require PHP Version %s.%s \n\nYou're using Version %s. Please ask your host to upgrade your server's PHP.", 'gravityview' ), '<h3>', GV_FUTURE_MIN_PHP_VERSION, "</h3>\n\n", '<span style="font-family: Consolas, Courier, monospace;">' . phpversion() . '</span>' ),
201 201
 				'cap' => 'manage_options',
202 202
 				'dismiss' => $key,
203 203
 			);
@@ -216,11 +216,11 @@  discard block
 block discarded – undo
216 216
 	public static function check_wordpress() {
217 217
 		global $wp_version;
218 218
 
219
-		if( version_compare( $wp_version, GV_MIN_WP_VERSION ) <= 0 ) {
219
+		if ( version_compare( $wp_version, GV_MIN_WP_VERSION ) <= 0 ) {
220 220
 
221
-			self::$notices['wp_version'] = array(
221
+			self::$notices[ 'wp_version' ] = array(
222 222
 				'class' => 'error',
223
-				'message' => sprintf( __( "%sGravityView requires WordPress %s or newer.%s \n\nYou're using Version %s. Please upgrade your WordPress installation.", 'gravityview' ), '<h3>', GV_MIN_WP_VERSION, "</h3>\n\n", '<span style="font-family: Consolas, Courier, monospace;">'.$wp_version.'</span>' ),
223
+				'message' => sprintf( __( "%sGravityView requires WordPress %s or newer.%s \n\nYou're using Version %s. Please upgrade your WordPress installation.", 'gravityview' ), '<h3>', GV_MIN_WP_VERSION, "</h3>\n\n", '<span style="font-family: Consolas, Courier, monospace;">' . $wp_version . '</span>' ),
224 224
 			    'cap' => 'update_core',
225 225
 				'dismiss' => 'wp_version',
226 226
 			);
@@ -243,17 +243,17 @@  discard block
 block discarded – undo
243 243
 	public static function check_gravityforms() {
244 244
 
245 245
 		// Bypass other checks: if the class exists
246
-		if( class_exists( 'GFCommon' ) ) {
246
+		if ( class_exists( 'GFCommon' ) ) {
247 247
 
248 248
 			// and the version's right, we're good.
249
-			if( true === version_compare( GFCommon::$version, GV_MIN_GF_VERSION, ">=" ) ) {
249
+			if ( true === version_compare( GFCommon::$version, GV_MIN_GF_VERSION, ">=" ) ) {
250 250
 				return true;
251 251
 			}
252 252
 
253 253
 			// Or the version's wrong
254
-			self::$notices['gf_version'] = array(
254
+			self::$notices[ 'gf_version' ] = array(
255 255
 				'class' => 'error',
256
-				'message' => sprintf( __( "%sGravityView requires Gravity Forms Version %s or newer.%s \n\nYou're using Version %s. Please update your Gravity Forms or purchase a license. %sGet Gravity Forms%s - starting at $39%s%s", 'gravityview' ), '<h3>', GV_MIN_GF_VERSION, "</h3>\n\n", '<span style="font-family: Consolas, Courier, monospace;">'.GFCommon::$version.'</span>', "\n\n".'<a href="http://katz.si/gravityforms" class="button button-secondary button-large button-hero">' , '<em>', '</em>', '</a>'),
256
+				'message' => sprintf( __( "%sGravityView requires Gravity Forms Version %s or newer.%s \n\nYou're using Version %s. Please update your Gravity Forms or purchase a license. %sGet Gravity Forms%s - starting at $39%s%s", 'gravityview' ), '<h3>', GV_MIN_GF_VERSION, "</h3>\n\n", '<span style="font-family: Consolas, Courier, monospace;">' . GFCommon::$version . '</span>', "\n\n" . '<a href="http://katz.si/gravityforms" class="button button-secondary button-large button-hero">', '<em>', '</em>', '</a>' ),
257 257
 				'cap' => 'update_plugins',
258 258
 				'dismiss' => 'gf_version',
259 259
 			);
@@ -268,42 +268,42 @@  discard block
 block discarded – undo
268 268
 		 * OR
269 269
 		 * It's the Network Admin and we just don't know whether the sites have GF activated themselves.
270 270
 		 */
271
-		if( true === $gf_status || is_network_admin() ) {
271
+		if ( true === $gf_status || is_network_admin() ) {
272 272
 			return true;
273 273
 		}
274 274
 
275 275
 		// If GFCommon doesn't exist, assume GF not active
276 276
 		$return = false;
277 277
 
278
-		switch( $gf_status ) {
278
+		switch ( $gf_status ) {
279 279
 			case 'inactive':
280 280
 
281 281
 				// Required for multisite
282
-				if( ! function_exists('wp_create_nonce') ) {
282
+				if ( ! function_exists( 'wp_create_nonce' ) ) {
283 283
 					require_once ABSPATH . WPINC . '/pluggable.php';
284 284
 				}
285 285
 
286 286
 				// Otherwise, throws an error on activation & deactivation "Use of undefined constant LOGGED_IN_COOKIE"
287
-				if( is_multisite() ) {
287
+				if ( is_multisite() ) {
288 288
 					wp_cookie_constants();
289 289
 				}
290 290
 
291 291
 				$return = false;
292 292
 
293
-				$button = function_exists('is_network_admin') && is_network_admin() ? '<strong><a href="#gravity-forms">' : '<strong><a href="'. wp_nonce_url( admin_url( 'plugins.php?action=activate&plugin=gravityforms/gravityforms.php' ), 'activate-plugin_gravityforms/gravityforms.php') . '" class="button button-large">';
293
+				$button = function_exists( 'is_network_admin' ) && is_network_admin() ? '<strong><a href="#gravity-forms">' : '<strong><a href="' . wp_nonce_url( admin_url( 'plugins.php?action=activate&plugin=gravityforms/gravityforms.php' ), 'activate-plugin_gravityforms/gravityforms.php' ) . '" class="button button-large">';
294 294
 
295
-				self::$notices['gf_inactive'] = array(
295
+				self::$notices[ 'gf_inactive' ] = array(
296 296
 					'class' => 'error',
297
-					'message' => sprintf( __( '%sGravityView requires Gravity Forms to be active. %sActivate Gravity Forms%s to use the GravityView plugin.', 'gravityview' ), '<h3>', "</h3>\n\n". $button, '</a></strong>' ),
297
+					'message' => sprintf( __( '%sGravityView requires Gravity Forms to be active. %sActivate Gravity Forms%s to use the GravityView plugin.', 'gravityview' ), '<h3>', "</h3>\n\n" . $button, '</a></strong>' ),
298 298
 					'cap' => 'activate_plugins',
299 299
 					'dismiss' => 'gf_inactive',
300 300
 				);
301 301
 
302 302
 				break;
303 303
 			default:
304
-				self::$notices['gf_installed'] = array(
304
+				self::$notices[ 'gf_installed' ] = array(
305 305
 					'class' => 'error',
306
-					'message' => sprintf( __( '%sGravityView requires Gravity Forms to be installed in order to run properly. %sGet Gravity Forms%s - starting at $39%s%s', 'gravityview' ), '<h3>', "</h3>\n\n".'<a href="http://katz.si/gravityforms" class="button button-secondary button-large button-hero">' , '<em>', '</em>', '</a>'),
306
+					'message' => sprintf( __( '%sGravityView requires Gravity Forms to be installed in order to run properly. %sGet Gravity Forms%s - starting at $39%s%s', 'gravityview' ), '<h3>', "</h3>\n\n" . '<a href="http://katz.si/gravityforms" class="button button-secondary button-large button-hero">', '<em>', '</em>', '</a>' ),
307 307
 					'cap' => 'install_plugins',
308 308
 					'dismiss' => 'gf_installed',
309 309
 				);
@@ -320,10 +320,10 @@  discard block
 block discarded – undo
320 320
 	 */
321 321
 	private static function check_gf_directory() {
322 322
 
323
-		if( class_exists( 'GFDirectory' ) ) {
324
-			self::$notices['gf_directory'] = array(
323
+		if ( class_exists( 'GFDirectory' ) ) {
324
+			self::$notices[ 'gf_directory' ] = array(
325 325
 				'class' => 'error is-dismissible',
326
-				'title' => __('Potential Conflict', 'gravityview' ),
326
+				'title' => __( 'Potential Conflict', 'gravityview' ),
327 327
 				'message' => __( 'GravityView and Gravity Forms Directory are both active. This may cause problems. If you experience issues, disable the Gravity Forms Directory plugin.', 'gravityview' ),
328 328
 				'dismiss' => 'gf_directory',
329 329
 				'cap' => 'activate_plugins',
@@ -342,21 +342,21 @@  discard block
 block discarded – undo
342 342
 	 */
343 343
 	public static function get_plugin_status( $location = '' ) {
344 344
 
345
-		if( ! function_exists('is_plugin_active') ) {
345
+		if ( ! function_exists( 'is_plugin_active' ) ) {
346 346
 			include_once( ABSPATH . '/wp-admin/includes/plugin.php' );
347 347
 		}
348 348
 
349
-		if( is_network_admin() && is_plugin_active_for_network( $location ) ) {
349
+		if ( is_network_admin() && is_plugin_active_for_network( $location ) ) {
350 350
 			return true;
351 351
 		}
352 352
 
353
-		if( !is_network_admin() && is_plugin_active( $location ) ) {
353
+		if ( ! is_network_admin() && is_plugin_active( $location ) ) {
354 354
 			return true;
355 355
 		}
356 356
 
357
-		if(
358
-			!file_exists( trailingslashit( WP_PLUGIN_DIR ) . $location ) &&
359
-			!file_exists( trailingslashit( WPMU_PLUGIN_DIR ) . $location )
357
+		if (
358
+			! file_exists( trailingslashit( WP_PLUGIN_DIR ) . $location ) &&
359
+			! file_exists( trailingslashit( WPMU_PLUGIN_DIR ) . $location )
360 360
 		) {
361 361
 			return false;
362 362
 		}
Please login to merge, or discard this patch.
includes/widgets/class-gravityview-widget-page-links.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -11,35 +11,35 @@  discard block
 block discarded – undo
11 11
 
12 12
 	function __construct() {
13 13
 
14
-		$this->widget_description = __('Links to multiple pages of results.', 'gravityview' );
14
+		$this->widget_description = __( 'Links to multiple pages of results.', 'gravityview' );
15 15
 
16 16
 		$default_values = array( 'header' => 1, 'footer' => 1 );
17 17
 		$settings = array( 'show_all' => array(
18 18
 			'type' => 'checkbox',
19 19
 			'label' => __( 'Show each page number', 'gravityview' ),
20
-			'desc' => __('Show every page number instead of summary (eg: 1 2 3 ... 8 »)', 'gravityview'),
20
+			'desc' => __( 'Show every page number instead of summary (eg: 1 2 3 ... 8 »)', 'gravityview' ),
21 21
 			'value' => false
22
-		));
23
-		parent::__construct( __( 'Page Links', 'gravityview' ) , 'page_links', $default_values, $settings );
22
+		) );
23
+		parent::__construct( __( 'Page Links', 'gravityview' ), 'page_links', $default_values, $settings );
24 24
 
25 25
 	}
26 26
 
27
-	public function render_frontend( $widget_args, $content = '', $context = '') {
27
+	public function render_frontend( $widget_args, $content = '', $context = '' ) {
28 28
 		$gravityview_view = GravityView_View::getInstance();
29 29
 
30
-		if( !$this->pre_render_frontend() ) {
30
+		if ( ! $this->pre_render_frontend() ) {
31 31
 			return;
32 32
 		}
33 33
 
34 34
 		$atts = shortcode_atts( array(
35 35
 			'page_size' => rgar( $gravityview_view->paging, 'page_size' ),
36 36
 			'total' => $gravityview_view->total_entries,
37
-			'show_all' => !empty( $this->settings['show_all']['default'] ),
38
-			'current' => (int) rgar( $_GET, 'pagenum', 1 ),
37
+			'show_all' => ! empty( $this->settings[ 'show_all' ][ 'default' ] ),
38
+			'current' => (int)rgar( $_GET, 'pagenum', 1 ),
39 39
 		), $widget_args, 'gravityview_widget_page_links' );
40 40
 		
41 41
 		$page_link_args = array(
42
-			'base' => add_query_arg('pagenum','%#%', gv_directory_link() ),
42
+			'base' => add_query_arg( 'pagenum', '%#%', gv_directory_link() ),
43 43
 			'format' => '&pagenum=%#%',
44 44
 			'add_args' => array(), //
45 45
 			'prev_text' => '&laquo;',
@@ -47,9 +47,9 @@  discard block
 block discarded – undo
47 47
 			'type' => 'list',
48 48
 			'end_size' => 1,
49 49
 			'mid_size' => 2,
50
-			'total' => empty( $atts['page_size'] ) ? 0 : ceil( $atts['total'] / $atts['page_size'] ),
51
-			'current' => $atts['current'],
52
-			'show_all' => !empty( $atts['show_all'] ), // to be available at backoffice
50
+			'total' => empty( $atts[ 'page_size' ] ) ? 0 : ceil( $atts[ 'total' ] / $atts[ 'page_size' ] ),
51
+			'current' => $atts[ 'current' ],
52
+			'show_all' => ! empty( $atts[ 'show_all' ] ), // to be available at backoffice
53 53
 		);
54 54
 
55 55
 		/**
@@ -57,14 +57,14 @@  discard block
 block discarded – undo
57 57
 		 * @since 1.1.4
58 58
 		 * @param array  $page_link_args Array of arguments for the `paginate_links()` function. [Read more about `paginate_links()`](http://developer.wordpress.org/reference/functions/paginate_links/)
59 59
 		 */
60
-		$page_link_args = apply_filters('gravityview_page_links_args', $page_link_args );
60
+		$page_link_args = apply_filters( 'gravityview_page_links_args', $page_link_args );
61 61
 
62 62
 		$page_links = paginate_links( $page_link_args );
63 63
 
64
-		if( !empty( $page_links )) {
65
-			$class = !empty( $widget_args['custom_class'] ) ? $widget_args['custom_class'] : '';
64
+		if ( ! empty( $page_links ) ) {
65
+			$class = ! empty( $widget_args[ 'custom_class' ] ) ? $widget_args[ 'custom_class' ] : '';
66 66
 			$class = gravityview_sanitize_html_class( 'gv-widget-page-links ' . $class );
67
-			echo '<div class="'.$class.'">'. $page_links .'</div>';
67
+			echo '<div class="' . $class . '">' . $page_links . '</div>';
68 68
 		} else {
69 69
 			do_action( 'gravityview_log_debug', 'GravityView_Widget_Page_Links[render_frontend] No page links; paginate_links() returned empty response.' );
70 70
 		}
Please login to merge, or discard this patch.
includes/widgets/search-widget/class-search-widget.php 1 patch
Spacing   +105 added lines, -105 removed lines patch added patch discarded remove patch
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
 				'type' => 'radio',
64 64
 				'full_width' => true,
65 65
 				'label' => esc_html__( 'Search Mode', 'gravityview' ),
66
-				'desc' => __('Should search results match all search fields, or any?', 'gravityview'),
66
+				'desc' => __( 'Should search results match all search fields, or any?', 'gravityview' ),
67 67
 				'value' => 'any',
68 68
 				'class' => 'hide-if-js',
69 69
 				'options' => array(
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
 
86 86
 		// admin - add scripts - run at 1100 to make sure GravityView_Admin_Views::add_scripts_and_styles() runs first at 999
87 87
 		add_action( 'admin_enqueue_scripts', array( $this, 'add_scripts_and_styles' ), 1100 );
88
-		add_action( 'wp_enqueue_scripts', array( $this, 'register_scripts') );
88
+		add_action( 'wp_enqueue_scripts', array( $this, 'register_scripts' ) );
89 89
 		add_filter( 'gravityview_noconflict_scripts', array( $this, 'register_no_conflict' ) );
90 90
 
91 91
 		// ajax - get the searchable fields
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
 		$script_min = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
213 213
 		$script_source = empty( $script_min ) ? '/source' : '';
214 214
 
215
-		wp_enqueue_script( 'gravityview_searchwidget_admin', plugins_url( 'assets/js'.$script_source.'/admin-search-widget'.$script_min.'.js', __FILE__ ), array( 'jquery', 'gravityview_views_scripts' ), GravityView_Plugin::version );
215
+		wp_enqueue_script( 'gravityview_searchwidget_admin', plugins_url( 'assets/js' . $script_source . '/admin-search-widget' . $script_min . '.js', __FILE__ ), array( 'jquery', 'gravityview_views_scripts' ), GravityView_Plugin::version );
216 216
 
217 217
 		wp_localize_script( 'gravityview_searchwidget_admin', 'gvSearchVar', array(
218 218
 			'nonce' => wp_create_nonce( 'gravityview_ajaxsearchwidget' ),
@@ -234,7 +234,7 @@  discard block
 block discarded – undo
234 234
 	 * @return array Scripts allowed in no-conflict mode, plus the search widget script
235 235
 	 */
236 236
 	public function register_no_conflict( $allowed ) {
237
-		$allowed[] = 'gravityview_searchwidget_admin';
237
+		$allowed[ ] = 'gravityview_searchwidget_admin';
238 238
 		return $allowed;
239 239
 	}
240 240
 
@@ -247,24 +247,24 @@  discard block
 block discarded – undo
247 247
 	 */
248 248
 	public static function get_searchable_fields() {
249 249
 
250
-		if ( ! isset( $_POST['nonce'] ) || ! wp_verify_nonce( $_POST['nonce'], 'gravityview_ajaxsearchwidget' ) ) {
250
+		if ( ! isset( $_POST[ 'nonce' ] ) || ! wp_verify_nonce( $_POST[ 'nonce' ], 'gravityview_ajaxsearchwidget' ) ) {
251 251
 			exit( '0' );
252 252
 		}
253 253
 
254 254
 		$form = '';
255 255
 
256 256
 		// Fetch the form for the current View
257
-		if ( ! empty( $_POST['view_id'] ) ) {
257
+		if ( ! empty( $_POST[ 'view_id' ] ) ) {
258 258
 
259
-			$form = gravityview_get_form_id( $_POST['view_id'] );
259
+			$form = gravityview_get_form_id( $_POST[ 'view_id' ] );
260 260
 
261
-		} elseif ( ! empty( $_POST['formid'] ) ) {
261
+		} elseif ( ! empty( $_POST[ 'formid' ] ) ) {
262 262
 
263
-			$form = (int) $_POST['formid'];
263
+			$form = (int)$_POST[ 'formid' ];
264 264
 
265
-		} elseif ( ! empty( $_POST['template_id'] ) && class_exists( 'GravityView_Ajax' ) ) {
265
+		} elseif ( ! empty( $_POST[ 'template_id' ] ) && class_exists( 'GravityView_Ajax' ) ) {
266 266
 
267
-			$form = GravityView_Ajax::pre_get_form_fields( $_POST['template_id'] );
267
+			$form = GravityView_Ajax::pre_get_form_fields( $_POST[ 'template_id' ] );
268 268
 
269 269
 		}
270 270
 
@@ -309,8 +309,8 @@  discard block
 block discarded – undo
309 309
 			)
310 310
 		);
311 311
 
312
-		foreach( $custom_fields as $custom_field_key => $custom_field ) {
313
-			$output .= sprintf( '<option value="%s" %s data-inputtypes="%s" data-placeholder="%s">%s</option>', $custom_field_key, selected( $custom_field_key, $current, false ), $custom_field['type'], self::get_field_label( array('field' => $custom_field_key ) ), $custom_field['text'] );
312
+		foreach ( $custom_fields as $custom_field_key => $custom_field ) {
313
+			$output .= sprintf( '<option value="%s" %s data-inputtypes="%s" data-placeholder="%s">%s</option>', $custom_field_key, selected( $custom_field_key, $current, false ), $custom_field[ 'type' ], self::get_field_label( array( 'field' => $custom_field_key ) ), $custom_field[ 'text' ] );
314 314
 		}
315 315
 
316 316
 		// Get fields with sub-inputs and no parent
@@ -332,13 +332,13 @@  discard block
 block discarded – undo
332 332
 
333 333
 			foreach ( $fields as $id => $field ) {
334 334
 
335
-				if ( in_array( $field['type'], $blacklist_field_types ) ) {
335
+				if ( in_array( $field[ 'type' ], $blacklist_field_types ) ) {
336 336
 					continue;
337 337
 				}
338 338
 
339
-				$types = self::get_search_input_types( $id, $field['type'] );
339
+				$types = self::get_search_input_types( $id, $field[ 'type' ] );
340 340
 
341
-				$output .= '<option value="'. $id .'" '. selected( $id, $current, false ).'data-inputtypes="'. esc_attr( $types ) .'">'. esc_html( $field['label'] ) .'</option>';
341
+				$output .= '<option value="' . $id . '" ' . selected( $id, $current, false ) . 'data-inputtypes="' . esc_attr( $types ) . '">' . esc_html( $field[ 'label' ] ) . '</option>';
342 342
 			}
343 343
 		}
344 344
 
@@ -361,7 +361,7 @@  discard block
 block discarded – undo
361 361
 	public static function get_search_input_types( $field_id = '', $field_type = null ) {
362 362
 
363 363
 		// @todo - This needs to be improved - many fields have . including products and addresses
364
-		if ( false !== strpos( (string) $field_id, '.' ) && in_array( $field_type, array( 'checkbox' ) ) || in_array( $field_id, array( 'is_fulfilled' ) ) ) {
364
+		if ( false !== strpos( (string)$field_id, '.' ) && in_array( $field_type, array( 'checkbox' ) ) || in_array( $field_id, array( 'is_fulfilled' ) ) ) {
365 365
 			$input_type = 'boolean'; // on/off checkbox
366 366
 		} elseif ( in_array( $field_type, array( 'checkbox', 'post_category', 'multiselect' ) ) ) {
367 367
 			$input_type = 'multi'; //multiselect
@@ -405,19 +405,19 @@  discard block
 block discarded – undo
405 405
 			$post_id = 0;
406 406
 
407 407
 			// We're in the WordPress Widget context, and an overriding post ID has been set.
408
-			if ( ! empty( $widget_args['post_id'] ) ) {
409
-				$post_id = absint( $widget_args['post_id'] );
408
+			if ( ! empty( $widget_args[ 'post_id' ] ) ) {
409
+				$post_id = absint( $widget_args[ 'post_id' ] );
410 410
 			}
411 411
 			// We're in the WordPress Widget context, and the base View ID should be used
412
-			else if ( ! empty( $widget_args['view_id'] ) ) {
413
-				$post_id = absint( $widget_args['view_id'] );
412
+			else if ( ! empty( $widget_args[ 'view_id' ] ) ) {
413
+				$post_id = absint( $widget_args[ 'view_id' ] );
414 414
 			}
415 415
 
416 416
 			$args = gravityview_get_permalink_query_args( $post_id );
417 417
 
418 418
 			// Add hidden fields to the search form
419 419
 			foreach ( $args as $key => $value ) {
420
-				$search_fields[] = array(
420
+				$search_fields[ ] = array(
421 421
 					'name'  => $key,
422 422
 					'input' => 'hidden',
423 423
 					'value' => $value,
@@ -438,7 +438,7 @@  discard block
 block discarded – undo
438 438
 	 */
439 439
 	public function filter_entries( $search_criteria ) {
440 440
 
441
-		if( 'post' === $this->search_method ) {
441
+		if ( 'post' === $this->search_method ) {
442 442
 			$get = $_POST;
443 443
 		} else {
444 444
 			$get = $_GET;
@@ -455,15 +455,15 @@  discard block
 block discarded – undo
455 455
 		$get = gv_map_deep( $get, 'rawurldecode' );
456 456
 
457 457
 		// add free search
458
-		if ( ! empty( $get['gv_search'] ) ) {
458
+		if ( ! empty( $get[ 'gv_search' ] ) ) {
459 459
 
460 460
 			// Search for a piece
461
-			$words = explode( ' ', $get['gv_search'] );
461
+			$words = explode( ' ', $get[ 'gv_search' ] );
462 462
 
463 463
 			$words = array_filter( $words );
464 464
 
465 465
 			foreach ( $words as $word ) {
466
-				$search_criteria['field_filters'][] = array(
466
+				$search_criteria[ 'field_filters' ][ ] = array(
467 467
 					'key' => null, // The field ID to search
468 468
 					'value' => $word, // The value to search
469 469
 					'operator' => 'contains', // What to search in. Options: `is` or `contains`
@@ -472,8 +472,8 @@  discard block
 block discarded – undo
472 472
 		}
473 473
 
474 474
 		//start date & end date
475
-		$curr_start = !empty( $get['gv_start'] ) ? $get['gv_start'] : '';
476
-		$curr_end = !empty( $get['gv_start'] ) ? $get['gv_end'] : '';
475
+		$curr_start = ! empty( $get[ 'gv_start' ] ) ? $get[ 'gv_start' ] : '';
476
+		$curr_end = ! empty( $get[ 'gv_start' ] ) ? $get[ 'gv_end' ] : '';
477 477
 
478 478
 		/**
479 479
 		 * @filter `gravityview_date_created_adjust_timezone` Whether to adjust the timezone for entries. \n
@@ -488,16 +488,16 @@  discard block
 block discarded – undo
488 488
 		/**
489 489
 		 * Don't set $search_criteria['start_date'] if start_date is empty as it may lead to bad query results (GFAPI::get_entries)
490 490
 		 */
491
-		if( !empty( $curr_start ) ) {
492
-			$search_criteria['start_date'] = $adjust_tz ? get_gmt_from_date( $curr_start ) : $curr_start;
491
+		if ( ! empty( $curr_start ) ) {
492
+			$search_criteria[ 'start_date' ] = $adjust_tz ? get_gmt_from_date( $curr_start ) : $curr_start;
493 493
 		}
494
-		if( !empty( $curr_end ) ) {
495
-			$search_criteria['end_date'] = $adjust_tz ? get_gmt_from_date( $curr_end ) : $curr_end;
494
+		if ( ! empty( $curr_end ) ) {
495
+			$search_criteria[ 'end_date' ] = $adjust_tz ? get_gmt_from_date( $curr_end ) : $curr_end;
496 496
 		}
497 497
 
498 498
 		// search for a specific entry ID
499 499
 		if ( ! empty( $get[ 'gv_id' ] ) ) {
500
-			$search_criteria['field_filters'][] = array(
500
+			$search_criteria[ 'field_filters' ][ ] = array(
501 501
 				'key' => 'id',
502 502
 				'value' => absint( $get[ 'gv_id' ] ),
503 503
 				'operator' => '=',
@@ -506,36 +506,36 @@  discard block
 block discarded – undo
506 506
 
507 507
 		// search for a specific Created_by ID
508 508
 		if ( ! empty( $get[ 'gv_by' ] ) ) {
509
-			$search_criteria['field_filters'][] = array(
509
+			$search_criteria[ 'field_filters' ][ ] = array(
510 510
 				'key' => 'created_by',
511
-				'value' => absint( $get['gv_by'] ),
511
+				'value' => absint( $get[ 'gv_by' ] ),
512 512
 				'operator' => '=',
513 513
 			);
514 514
 		}
515 515
 
516 516
 
517 517
 		// Get search mode passed in URL
518
-		$mode = isset( $get['mode'] ) && in_array( $get['mode'], array( 'any', 'all' ) ) ?  $get['mode'] : 'any';
518
+		$mode = isset( $get[ 'mode' ] ) && in_array( $get[ 'mode' ], array( 'any', 'all' ) ) ? $get[ 'mode' ] : 'any';
519 519
 
520 520
 		// get the other search filters
521 521
 		foreach ( $get as $key => $value ) {
522 522
 
523
-			if ( 0 !== strpos( $key, 'filter_' ) || empty( $value ) || ( is_array( $value ) && count( $value ) === 1 && empty( $value[0] ) ) ) {
523
+			if ( 0 !== strpos( $key, 'filter_' ) || empty( $value ) || ( is_array( $value ) && count( $value ) === 1 && empty( $value[ 0 ] ) ) ) {
524 524
 				continue;
525 525
 			}
526 526
 
527 527
 			// could return simple filter or multiple filters
528 528
 			$filter = $this->prepare_field_filter( $key, $value );
529 529
 
530
-			if ( isset( $filter[0]['value'] ) ) {
531
-				$search_criteria['field_filters'] = array_merge( $search_criteria['field_filters'], $filter );
530
+			if ( isset( $filter[ 0 ][ 'value' ] ) ) {
531
+				$search_criteria[ 'field_filters' ] = array_merge( $search_criteria[ 'field_filters' ], $filter );
532 532
 
533 533
 				// if date range type, set search mode to ALL
534
-				if ( ! empty( $filter[0]['operator'] ) && in_array( $filter[0]['operator'], array( '>=', '<=', '>', '<' ) ) ) {
534
+				if ( ! empty( $filter[ 0 ][ 'operator' ] ) && in_array( $filter[ 0 ][ 'operator' ], array( '>=', '<=', '>', '<' ) ) ) {
535 535
 					$mode = 'all';
536 536
 				}
537
-			} elseif( !empty( $filter ) ) {
538
-				$search_criteria['field_filters'][] = $filter;
537
+			} elseif ( ! empty( $filter ) ) {
538
+				$search_criteria[ 'field_filters' ][ ] = $filter;
539 539
 			}
540 540
 		}
541 541
 
@@ -544,7 +544,7 @@  discard block
 block discarded – undo
544 544
 		 * @since 1.5.1
545 545
 		 * @param[out,in] string $mode Search mode (`any` vs `all`)
546 546
 		 */
547
-		$search_criteria['field_filters']['mode'] = apply_filters( 'gravityview/search/mode', $mode );
547
+		$search_criteria[ 'field_filters' ][ 'mode' ] = apply_filters( 'gravityview/search/mode', $mode );
548 548
 
549 549
 		do_action( 'gravityview_log_debug', sprintf( '%s[filter_entries] Returned Search Criteria: ', get_class( $this ) ), $search_criteria );
550 550
 
@@ -570,7 +570,7 @@  discard block
 block discarded – undo
570 570
 		$field_id = str_replace( 'filter_', '', $key );
571 571
 
572 572
 		// calculates field_id, removing 'filter_' and for '_' for advanced fields ( like name or checkbox )
573
-		if ( preg_match('/^[0-9_]+$/ism', $field_id ) ) {
573
+		if ( preg_match( '/^[0-9_]+$/ism', $field_id ) ) {
574 574
 			$field_id = str_replace( '_', '.', $field_id );
575 575
 		}
576 576
 
@@ -584,11 +584,11 @@  discard block
 block discarded – undo
584 584
 			'value' => $value,
585 585
 		);
586 586
 
587
-		switch ( $form_field['type'] ) {
587
+		switch ( $form_field[ 'type' ] ) {
588 588
 
589 589
 			case 'select':
590 590
 			case 'radio':
591
-				$filter['operator'] = 'is';
591
+				$filter[ 'operator' ] = 'is';
592 592
 				break;
593 593
 
594 594
 			case 'post_category':
@@ -602,7 +602,7 @@  discard block
 block discarded – undo
602 602
 
603 603
 				foreach ( $value as $val ) {
604 604
 					$cat = get_term( $val, 'category' );
605
-					$filter[] = array(
605
+					$filter[ ] = array(
606 606
 						'key' => $field_id,
607 607
 						'value' => esc_attr( $cat->name ) . ':' . $val,
608 608
 						'operator' => 'is',
@@ -621,18 +621,18 @@  discard block
 block discarded – undo
621 621
 				$filter = array();
622 622
 
623 623
 				foreach ( $value as $val ) {
624
-					$filter[] = array( 'key' => $field_id, 'value' => $val );
624
+					$filter[ ] = array( 'key' => $field_id, 'value' => $val );
625 625
 				}
626 626
 
627 627
 				break;
628 628
 
629 629
 			case 'checkbox':
630 630
 				// convert checkbox on/off into the correct search filter
631
-				if ( false !== strpos( $field_id, '.' ) && ! empty( $form_field['inputs'] ) && ! empty( $form_field['choices'] ) ) {
632
-					foreach ( $form_field['inputs'] as $k => $input ) {
633
-						if ( $input['id'] == $field_id ) {
634
-							$filter['value'] = $form_field['choices'][ $k ]['value'];
635
-							$filter['operator'] = 'is';
631
+				if ( false !== strpos( $field_id, '.' ) && ! empty( $form_field[ 'inputs' ] ) && ! empty( $form_field[ 'choices' ] ) ) {
632
+					foreach ( $form_field[ 'inputs' ] as $k => $input ) {
633
+						if ( $input[ 'id' ] == $field_id ) {
634
+							$filter[ 'value' ] = $form_field[ 'choices' ][ $k ][ 'value' ];
635
+							$filter[ 'operator' ] = 'is';
636 636
 							break;
637 637
 						}
638 638
 					}
@@ -642,7 +642,7 @@  discard block
 block discarded – undo
642 642
 					$filter = array();
643 643
 
644 644
 					foreach ( $value as $val ) {
645
-						$filter[] = array(
645
+						$filter[ ] = array(
646 646
 							'key'   => $field_id,
647 647
 							'value' => $val,
648 648
 							'operator' => 'is',
@@ -663,9 +663,9 @@  discard block
 block discarded – undo
663 663
 					foreach ( $words as $word ) {
664 664
 						if ( ! empty( $word ) && strlen( $word ) > 1 ) {
665 665
 							// Keep the same key for each filter
666
-							$filter['value'] = $word;
666
+							$filter[ 'value' ] = $word;
667 667
 							// Add a search for the value
668
-							$filters[] = $filter;
668
+							$filters[ ] = $filter;
669 669
 						}
670 670
 					}
671 671
 
@@ -692,19 +692,19 @@  discard block
 block discarded – undo
692 692
 						 * @since 1.16.3
693 693
 						 * Safeguard until GF implements '<=' operator
694 694
 						 */
695
-						if( !GFFormsModel::is_valid_operator( $operator ) && $operator === '<=' ) {
695
+						if ( ! GFFormsModel::is_valid_operator( $operator ) && $operator === '<=' ) {
696 696
 							$operator = '<';
697 697
 							$date = date( 'Y-m-d', strtotime( $date . ' +1 day' ) );
698 698
 						}
699 699
 
700
-						$filter[] = array(
700
+						$filter[ ] = array(
701 701
 							'key' => $field_id,
702 702
 							'value' => self::get_formatted_date( $date, 'Y-m-d' ),
703 703
 							'operator' => $operator,
704 704
 						);
705 705
 					}
706 706
 				} else {
707
-					$filter['value'] = self::get_formatted_date( $value, 'Y-m-d' );
707
+					$filter[ 'value' ] = self::get_formatted_date( $value, 'Y-m-d' );
708 708
 				}
709 709
 
710 710
 				break;
@@ -735,7 +735,7 @@  discard block
 block discarded – undo
735 735
 			'ymd_dot' => 'Y.m.d',
736 736
 		);
737 737
 
738
-		if ( ! empty( $field->dateFormat ) && isset( $datepicker[ $field->dateFormat ] ) ){
738
+		if ( ! empty( $field->dateFormat ) && isset( $datepicker[ $field->dateFormat ] ) ) {
739 739
 			$format = $datepicker[ $field->dateFormat ];
740 740
 		}
741 741
 
@@ -766,7 +766,7 @@  discard block
 block discarded – undo
766 766
 	public function add_template_path( $file_paths ) {
767 767
 
768 768
 		// Index 100 is the default GravityView template path.
769
-		$file_paths[102] = self::$file . 'templates/';
769
+		$file_paths[ 102 ] = self::$file . 'templates/';
770 770
 
771 771
 		return $file_paths;
772 772
 	}
@@ -785,7 +785,7 @@  discard block
 block discarded – undo
785 785
 		$has_date = false;
786 786
 
787 787
 		foreach ( $search_fields as $k => $field ) {
788
-			if ( in_array( $field['input'], array( 'date', 'date_range', 'entry_date' ) ) ) {
788
+			if ( in_array( $field[ 'input' ], array( 'date', 'date_range', 'entry_date' ) ) ) {
789 789
 				$has_date = true;
790 790
 				break;
791 791
 			}
@@ -812,7 +812,7 @@  discard block
 block discarded – undo
812 812
 		}
813 813
 
814 814
 		// get configured search fields
815
-		$search_fields = ! empty( $widget_args['search_fields'] ) ? json_decode( $widget_args['search_fields'], true ) : '';
815
+		$search_fields = ! empty( $widget_args[ 'search_fields' ] ) ? json_decode( $widget_args[ 'search_fields' ], true ) : '';
816 816
 
817 817
 		if ( empty( $search_fields ) || ! is_array( $search_fields ) ) {
818 818
 			do_action( 'gravityview_log_debug', sprintf( '%s[render_frontend] No search fields configured for widget:', get_class( $this ) ), $widget_args );
@@ -827,34 +827,34 @@  discard block
 block discarded – undo
827 827
 
828 828
 			$updated_field = $this->get_search_filter_details( $updated_field );
829 829
 
830
-			switch ( $field['field'] ) {
830
+			switch ( $field[ 'field' ] ) {
831 831
 
832 832
 				case 'search_all':
833
-					$updated_field['key'] = 'search_all';
834
-					$updated_field['input'] = 'search_all';
835
-					$updated_field['value'] = $this->rgget_or_rgpost( 'gv_search' );
833
+					$updated_field[ 'key' ] = 'search_all';
834
+					$updated_field[ 'input' ] = 'search_all';
835
+					$updated_field[ 'value' ] = $this->rgget_or_rgpost( 'gv_search' );
836 836
 					break;
837 837
 
838 838
 				case 'entry_date':
839
-					$updated_field['key'] = 'entry_date';
840
-					$updated_field['input'] = 'entry_date';
841
-					$updated_field['value'] = array(
839
+					$updated_field[ 'key' ] = 'entry_date';
840
+					$updated_field[ 'input' ] = 'entry_date';
841
+					$updated_field[ 'value' ] = array(
842 842
 						'start' => $this->rgget_or_rgpost( 'gv_start' ),
843 843
 						'end' => $this->rgget_or_rgpost( 'gv_end' ),
844 844
 					);
845 845
 					break;
846 846
 
847 847
 				case 'entry_id':
848
-					$updated_field['key'] = 'entry_id';
849
-					$updated_field['input'] = 'entry_id';
850
-					$updated_field['value'] = $this->rgget_or_rgpost( 'gv_id' );
848
+					$updated_field[ 'key' ] = 'entry_id';
849
+					$updated_field[ 'input' ] = 'entry_id';
850
+					$updated_field[ 'value' ] = $this->rgget_or_rgpost( 'gv_id' );
851 851
 					break;
852 852
 
853 853
 				case 'created_by':
854
-					$updated_field['key'] = 'created_by';
855
-					$updated_field['name'] = 'gv_by';
856
-					$updated_field['value'] = $this->rgget_or_rgpost( 'gv_by' );
857
-					$updated_field['choices'] = self::get_created_by_choices();
854
+					$updated_field[ 'key' ] = 'created_by';
855
+					$updated_field[ 'name' ] = 'gv_by';
856
+					$updated_field[ 'value' ] = $this->rgget_or_rgpost( 'gv_by' );
857
+					$updated_field[ 'choices' ] = self::get_created_by_choices();
858 858
 					break;
859 859
 			}
860 860
 
@@ -872,16 +872,16 @@  discard block
 block discarded – undo
872 872
 		 */
873 873
 		$gravityview_view->search_fields = apply_filters( 'gravityview_widget_search_filters', $search_fields, $this, $widget_args );
874 874
 
875
-		$gravityview_view->search_layout = ! empty( $widget_args['search_layout'] ) ? $widget_args['search_layout'] : 'horizontal';
875
+		$gravityview_view->search_layout = ! empty( $widget_args[ 'search_layout' ] ) ? $widget_args[ 'search_layout' ] : 'horizontal';
876 876
 
877 877
 		/** @since 1.14 */
878
-		$gravityview_view->search_mode = ! empty( $widget_args['search_mode'] ) ? $widget_args['search_mode'] : 'any';
878
+		$gravityview_view->search_mode = ! empty( $widget_args[ 'search_mode' ] ) ? $widget_args[ 'search_mode' ] : 'any';
879 879
 
880
-		$custom_class = ! empty( $widget_args['custom_class'] ) ? $widget_args['custom_class'] : '';
880
+		$custom_class = ! empty( $widget_args[ 'custom_class' ] ) ? $widget_args[ 'custom_class' ] : '';
881 881
 
882 882
 		$gravityview_view->search_class = self::get_search_class( $custom_class );
883 883
 
884
-		$gravityview_view->search_clear = ! empty( $widget_args['search_clear'] ) ? $widget_args['search_clear'] : false;
884
+		$gravityview_view->search_clear = ! empty( $widget_args[ 'search_clear' ] ) ? $widget_args[ 'search_clear' ] : false;
885 885
 
886 886
 		if ( $this->has_date_field( $search_fields ) ) {
887 887
 			// enqueue datepicker stuff only if needed!
@@ -903,10 +903,10 @@  discard block
 block discarded – undo
903 903
 	public static function get_search_class( $custom_class = '' ) {
904 904
 		$gravityview_view = GravityView_View::getInstance();
905 905
 
906
-		$search_class = 'gv-search-'.$gravityview_view->search_layout;
906
+		$search_class = 'gv-search-' . $gravityview_view->search_layout;
907 907
 
908
-		if ( ! empty( $custom_class )  ) {
909
-			$search_class .= ' '.$custom_class;
908
+		if ( ! empty( $custom_class ) ) {
909
+			$search_class .= ' ' . $custom_class;
910 910
 		}
911 911
 
912 912
 		/**
@@ -948,11 +948,11 @@  discard block
 block discarded – undo
948 948
 
949 949
 		$label = rgget( 'label', $field );
950 950
 
951
-		if( '' === $label ) {
951
+		if ( '' === $label ) {
952 952
 
953
-			$label = isset( $form_field['label'] ) ? $form_field['label'] : '';
953
+			$label = isset( $form_field[ 'label' ] ) ? $form_field[ 'label' ] : '';
954 954
 
955
-			switch( $field['field'] ) {
955
+			switch ( $field[ 'field' ] ) {
956 956
 				case 'search_all':
957 957
 					$label = __( 'Search Entries:', 'gravityview' );
958 958
 					break;
@@ -964,10 +964,10 @@  discard block
 block discarded – undo
964 964
 					break;
965 965
 				default:
966 966
 					// If this is a field input, not a field
967
-					if ( strpos( $field['field'], '.' ) > 0 && ! empty( $form_field['inputs'] ) ) {
967
+					if ( strpos( $field[ 'field' ], '.' ) > 0 && ! empty( $form_field[ 'inputs' ] ) ) {
968 968
 
969 969
 						// Get the label for the field in question, which returns an array
970
-						$items = wp_list_filter( $form_field['inputs'], array( 'id' => $field['field'] ) );
970
+						$items = wp_list_filter( $form_field[ 'inputs' ], array( 'id' => $field[ 'field' ] ) );
971 971
 
972 972
 						// Get the item with the `label` key
973 973
 						$values = wp_list_pluck( $items, 'label' );
@@ -1006,32 +1006,32 @@  discard block
 block discarded – undo
1006 1006
 		$form = $gravityview_view->getForm();
1007 1007
 
1008 1008
 		// for advanced field ids (eg, first name / last name )
1009
-		$name = 'filter_' . str_replace( '.', '_', $field['field'] );
1009
+		$name = 'filter_' . str_replace( '.', '_', $field[ 'field' ] );
1010 1010
 
1011 1011
 		// get searched value from $_GET/$_POST (string or array)
1012 1012
 		$value = $this->rgget_or_rgpost( $name );
1013 1013
 
1014 1014
 		// get form field details
1015
-		$form_field = gravityview_get_field( $form, $field['field'] );
1015
+		$form_field = gravityview_get_field( $form, $field[ 'field' ] );
1016 1016
 
1017 1017
 		$filter = array(
1018
-			'key' => $field['field'],
1018
+			'key' => $field[ 'field' ],
1019 1019
 			'name' => $name,
1020 1020
 			'label' => self::get_field_label( $field, $form_field ),
1021
-			'input' => $field['input'],
1021
+			'input' => $field[ 'input' ],
1022 1022
 			'value' => $value,
1023
-			'type' => $form_field['type'],
1023
+			'type' => $form_field[ 'type' ],
1024 1024
 		);
1025 1025
 
1026 1026
 		// collect choices
1027
-		if ( 'post_category' === $form_field['type'] && ! empty( $form_field['displayAllCategories'] ) && empty( $form_field['choices'] ) ) {
1028
-			$filter['choices'] = gravityview_get_terms_choices();
1029
-		} elseif ( ! empty( $form_field['choices'] ) ) {
1030
-			$filter['choices'] = $form_field['choices'];
1027
+		if ( 'post_category' === $form_field[ 'type' ] && ! empty( $form_field[ 'displayAllCategories' ] ) && empty( $form_field[ 'choices' ] ) ) {
1028
+			$filter[ 'choices' ] = gravityview_get_terms_choices();
1029
+		} elseif ( ! empty( $form_field[ 'choices' ] ) ) {
1030
+			$filter[ 'choices' ] = $form_field[ 'choices' ];
1031 1031
 		}
1032 1032
 
1033
-		if ( 'date_range' === $field['input'] && empty( $value ) ) {
1034
-			$filter['value'] = array( 'start' => '', 'end' => '' );
1033
+		if ( 'date_range' === $field[ 'input' ] && empty( $value ) ) {
1034
+			$filter[ 'value' ] = array( 'start' => '', 'end' => '' );
1035 1035
 		}
1036 1036
 
1037 1037
 		return $filter;
@@ -1055,7 +1055,7 @@  discard block
 block discarded – undo
1055 1055
 
1056 1056
 		$choices = array();
1057 1057
 		foreach ( $users as $user ) {
1058
-			$choices[] = array(
1058
+			$choices[ ] = array(
1059 1059
 				'value' => $user->ID,
1060 1060
 				'text' => $user->display_name,
1061 1061
 			);
@@ -1110,7 +1110,7 @@  discard block
 block discarded – undo
1110 1110
 	 */
1111 1111
 	public function add_datepicker_js_dependency( $js_dependencies ) {
1112 1112
 
1113
-		$js_dependencies[] = 'jquery-ui-datepicker';
1113
+		$js_dependencies[ ] = 'jquery-ui-datepicker';
1114 1114
 
1115 1115
 		return $js_dependencies;
1116 1116
 	}
@@ -1154,7 +1154,7 @@  discard block
 block discarded – undo
1154 1154
 			'isRTL'             => is_rtl(),
1155 1155
 		), $view_data );
1156 1156
 
1157
-		$localizations['datepicker'] = $datepicker_settings;
1157
+		$localizations[ 'datepicker' ] = $datepicker_settings;
1158 1158
 
1159 1159
 		return $localizations;
1160 1160
 
@@ -1183,7 +1183,7 @@  discard block
 block discarded – undo
1183 1183
 	 * @return void
1184 1184
 	 */
1185 1185
 	private function maybe_enqueue_flexibility() {
1186
-		if ( isset( $_SERVER['HTTP_USER_AGENT'] ) && preg_match( '/MSIE [8-9]/', $_SERVER['HTTP_USER_AGENT'] ) ) {
1186
+		if ( isset( $_SERVER[ 'HTTP_USER_AGENT' ] ) && preg_match( '/MSIE [8-9]/', $_SERVER[ 'HTTP_USER_AGENT' ] ) ) {
1187 1187
 			wp_enqueue_script( 'gv-flexibility' );
1188 1188
 		}
1189 1189
 	}
@@ -1205,7 +1205,7 @@  discard block
 block discarded – undo
1205 1205
 		add_filter( 'gravityview_js_localization', array( $this, 'add_datepicker_localization' ), 10, 2 );
1206 1206
 
1207 1207
 		$scheme = is_ssl() ? 'https://' : 'http://';
1208
-		wp_enqueue_style( 'jquery-ui-datepicker', $scheme.'ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/themes/smoothness/jquery-ui.css' );
1208
+		wp_enqueue_style( 'jquery-ui-datepicker', $scheme . 'ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/themes/smoothness/jquery-ui.css' );
1209 1209
 
1210 1210
 		/**
1211 1211
 		 * @filter `gravityview_search_datepicker_class`
Please login to merge, or discard this patch.
includes/class-admin-views.php 1 patch
Spacing   +174 added lines, -174 removed lines patch added patch discarded remove patch
@@ -28,30 +28,30 @@  discard block
 block discarded – undo
28 28
 		add_filter( 'gravityview_blacklist_field_types', array( $this, 'default_field_blacklist' ), 10, 2 );
29 29
 
30 30
 		// Tooltips
31
-		add_filter( 'gform_tooltips', array( $this, 'tooltips') );
31
+		add_filter( 'gform_tooltips', array( $this, 'tooltips' ) );
32 32
 
33 33
 		// adding styles and scripts
34
-		add_action( 'admin_enqueue_scripts', array( 'GravityView_Admin_Views', 'add_scripts_and_styles'), 999 );
35
-		add_filter( 'gform_noconflict_styles', array( $this, 'register_no_conflict') );
36
-		add_filter( 'gform_noconflict_scripts', array( $this, 'register_no_conflict') );
37
-		add_filter( 'gravityview_noconflict_styles', array( $this, 'register_no_conflict') );
38
-		add_filter( 'gravityview_noconflict_scripts', array( $this, 'register_no_conflict') );
39
-
40
-		add_action( 'gravityview_render_directory_active_areas', array( $this, 'render_directory_active_areas'), 10, 4 );
41
-		add_action( 'gravityview_render_widgets_active_areas', array( $this, 'render_widgets_active_areas'), 10, 3 );
42
-		add_action( 'gravityview_render_available_fields', array( $this, 'render_available_fields'), 10, 2 );
43
-		add_action( 'gravityview_render_available_widgets', array( $this, 'render_available_widgets') );
44
-		add_action( 'gravityview_render_active_areas', array( $this, 'render_active_areas'), 10, 5 );
34
+		add_action( 'admin_enqueue_scripts', array( 'GravityView_Admin_Views', 'add_scripts_and_styles' ), 999 );
35
+		add_filter( 'gform_noconflict_styles', array( $this, 'register_no_conflict' ) );
36
+		add_filter( 'gform_noconflict_scripts', array( $this, 'register_no_conflict' ) );
37
+		add_filter( 'gravityview_noconflict_styles', array( $this, 'register_no_conflict' ) );
38
+		add_filter( 'gravityview_noconflict_scripts', array( $this, 'register_no_conflict' ) );
39
+
40
+		add_action( 'gravityview_render_directory_active_areas', array( $this, 'render_directory_active_areas' ), 10, 4 );
41
+		add_action( 'gravityview_render_widgets_active_areas', array( $this, 'render_widgets_active_areas' ), 10, 3 );
42
+		add_action( 'gravityview_render_available_fields', array( $this, 'render_available_fields' ), 10, 2 );
43
+		add_action( 'gravityview_render_available_widgets', array( $this, 'render_available_widgets' ) );
44
+		add_action( 'gravityview_render_active_areas', array( $this, 'render_active_areas' ), 10, 5 );
45 45
 
46 46
 		// @todo check if this hook is needed..
47 47
 		//add_action( 'gravityview_render_field_options', array( $this, 'render_field_options'), 10, 9 );
48 48
 
49 49
 		// Add Connected Form column
50
-		add_filter('manage_gravityview_posts_columns' , array( $this, 'add_post_type_columns' ) );
50
+		add_filter( 'manage_gravityview_posts_columns', array( $this, 'add_post_type_columns' ) );
51 51
 
52 52
 		add_filter( 'gform_toolbar_menu', array( 'GravityView_Admin_Views', 'gform_toolbar_menu' ), 10, 2 );
53 53
 
54
-		add_action( 'manage_gravityview_posts_custom_column', array( $this, 'add_custom_column_content'), 10, 2 );
54
+		add_action( 'manage_gravityview_posts_custom_column', array( $this, 'add_custom_column_content' ), 10, 2 );
55 55
 
56 56
 		add_action( 'restrict_manage_posts', array( $this, 'add_view_dropdown' ) );
57 57
 
@@ -66,11 +66,11 @@  discard block
 block discarded – undo
66 66
 	public function filter_pre_get_posts_by_gravityview_form_id( &$query ) {
67 67
 		global $pagenow;
68 68
 
69
-		if ( !is_admin() ) {
69
+		if ( ! is_admin() ) {
70 70
 			return;
71 71
 		}
72 72
 
73
-		if( 'edit.php' !== $pagenow || ! rgget( 'gravityview_form_id' ) || ! isset( $query->query_vars[ 'post_type' ] ) ) {
73
+		if ( 'edit.php' !== $pagenow || ! rgget( 'gravityview_form_id' ) || ! isset( $query->query_vars[ 'post_type' ] ) ) {
74 74
 			return;
75 75
 		}
76 76
 
@@ -87,18 +87,18 @@  discard block
 block discarded – undo
87 87
 	function add_view_dropdown() {
88 88
 		$current_screen = get_current_screen();
89 89
 
90
-		if( 'gravityview' !== $current_screen->post_type ) {
90
+		if ( 'gravityview' !== $current_screen->post_type ) {
91 91
 			return;
92 92
 		}
93 93
 
94 94
 		$forms = gravityview_get_forms();
95 95
 		$current_form = rgget( 'gravityview_form_id' );
96 96
 		// If there are no forms to select, show no forms.
97
-		if( !empty( $forms ) ) { ?>
97
+		if ( ! empty( $forms ) ) { ?>
98 98
 			<select name="gravityview_form_id" id="gravityview_form_id">
99 99
 				<option value="" <?php selected( '', $current_form, true ); ?>><?php esc_html_e( 'All forms', 'gravityview' ); ?></option>
100
-				<?php foreach( $forms as $form ) { ?>
101
-					<option value="<?php echo $form['id']; ?>" <?php selected( $form['id'], $current_form, true ); ?>><?php echo esc_html( $form['title'] ); ?></option>
100
+				<?php foreach ( $forms as $form ) { ?>
101
+					<option value="<?php echo $form[ 'id' ]; ?>" <?php selected( $form[ 'id' ], $current_form, true ); ?>><?php echo esc_html( $form[ 'title' ] ); ?></option>
102 102
 				<?php } ?>
103 103
 			</select>
104 104
 		<?php }
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
 	 */
112 112
 	public static function render_setting_row( $key = '', $current_settings = array(), $override_input = null, $name = 'template_settings[%s]', $id = 'gravityview_se_%s' ) {
113 113
 		_deprecated_function( 'GravityView_Admin_Views::render_setting_row', '1.1.7', 'GravityView_Render_Settings::render_setting_row' );
114
-		GravityView_Render_Settings::render_setting_row( $key, $current_settings, $override_input, $name , $id );
114
+		GravityView_Render_Settings::render_setting_row( $key, $current_settings, $override_input, $name, $id );
115 115
 	}
116 116
 
117 117
 	/**
@@ -134,9 +134,9 @@  discard block
 block discarded – undo
134 134
 
135 135
 		$connected_views = gravityview_get_connected_views( $id );
136 136
 
137
-		if( empty( $connected_views ) ) {
137
+		if ( empty( $connected_views ) ) {
138 138
 
139
-		    $menu_items['gravityview'] = array(
139
+		    $menu_items[ 'gravityview' ] = array(
140 140
 				'label'          => esc_attr__( 'Create a View', 'gravityview' ),
141 141
 				'icon'           => '<i class="fa fa-lg gv-icon-astronaut-head gv-icon"></i>',
142 142
 				'title'          => esc_attr__( 'Create a View using this form as a data source', 'gravityview' ),
@@ -152,22 +152,22 @@  discard block
 block discarded – undo
152 152
 		$sub_menu_items = array();
153 153
 		foreach ( (array)$connected_views as $view ) {
154 154
 
155
-			if( ! GVCommon::has_cap( 'edit_gravityview', $view->ID ) ) {
155
+			if ( ! GVCommon::has_cap( 'edit_gravityview', $view->ID ) ) {
156 156
 				continue;
157 157
 			}
158 158
 
159
-			$label = empty( $view->post_title ) ? sprintf( __('No Title (View #%d)', 'gravityview' ), $view->ID ) : $view->post_title;
159
+			$label = empty( $view->post_title ) ? sprintf( __( 'No Title (View #%d)', 'gravityview' ), $view->ID ) : $view->post_title;
160 160
 
161
-			$sub_menu_items[] = array(
161
+			$sub_menu_items[ ] = array(
162 162
 				'label' => esc_attr( $label ),
163
-				'url' => admin_url( 'post.php?action=edit&post='.$view->ID ),
163
+				'url' => admin_url( 'post.php?action=edit&post=' . $view->ID ),
164 164
 			);
165 165
 		}
166 166
 
167 167
 		// If there were no items added, then let's create the parent menu
168
-		if( $sub_menu_items ) {
168
+		if ( $sub_menu_items ) {
169 169
 
170
-		    $sub_menu_items[] = array(
170
+		    $sub_menu_items[ ] = array(
171 171
 			    'label' => esc_attr__( 'Create a View', 'gravityview' ),
172 172
                 'link_class' => 'gv-create-view',
173 173
 			    'title' => esc_attr__( 'Create a View using this form as a data source', 'gravityview' ),
@@ -176,14 +176,14 @@  discard block
 block discarded – undo
176 176
             );
177 177
 
178 178
 			// Make sure Gravity Forms uses the submenu; if there's only one item, it uses a link instead of a dropdown
179
-			$sub_menu_items[] = array(
179
+			$sub_menu_items[ ] = array(
180 180
 				'url' => '#',
181 181
 				'label' => '',
182 182
 				'menu_class' => 'hidden',
183 183
 				'capabilities' => '',
184 184
 			);
185 185
 
186
-			$menu_items['gravityview'] = array(
186
+			$menu_items[ 'gravityview' ] = array(
187 187
 				'label'          => __( 'Connected Views', 'gravityview' ),
188 188
 				'icon'           => '<i class="fa fa-lg gv-icon-astronaut-head gv-icon"></i>',
189 189
 				'title'          => __( 'GravityView Views using this form as a data source', 'gravityview' ),
@@ -212,8 +212,8 @@  discard block
 block discarded – undo
212 212
 		$add = array( 'captcha', 'page' );
213 213
 
214 214
 		// Don't allowing editing the following values:
215
-		if( $context === 'edit' ) {
216
-			$add[] = 'post_id';
215
+		if ( $context === 'edit' ) {
216
+			$add[ ] = 'post_id';
217 217
 		}
218 218
 
219 219
 		$return = array_merge( $array, $add );
@@ -236,32 +236,32 @@  discard block
 block discarded – undo
236 236
 		foreach ( $default_args as $key => $arg ) {
237 237
 
238 238
 			// If an arg has `tooltip` defined, but it's false, don't display a tooltip
239
-			if( isset( $arg['tooltip'] ) && empty( $arg['tooltip'] ) ) { continue; }
239
+			if ( isset( $arg[ 'tooltip' ] ) && empty( $arg[ 'tooltip' ] ) ) { continue; }
240 240
 
241 241
 			// By default, use `tooltip` if defined.
242
-			$tooltip = empty( $arg['tooltip'] ) ? NULL : $arg['tooltip'];
242
+			$tooltip = empty( $arg[ 'tooltip' ] ) ? NULL : $arg[ 'tooltip' ];
243 243
 
244 244
 			// Otherwise, use the description as a tooltip.
245
-			if( empty( $tooltip ) && !empty( $arg['desc'] ) ) {
246
-				$tooltip = $arg['desc'];
245
+			if ( empty( $tooltip ) && ! empty( $arg[ 'desc' ] ) ) {
246
+				$tooltip = $arg[ 'desc' ];
247 247
 			}
248 248
 
249 249
 			// If there's no tooltip set, continue
250
-			if( empty( $tooltip ) ) {
250
+			if ( empty( $tooltip ) ) {
251 251
 				continue;
252 252
 			}
253 253
 
254 254
 			// Add the tooltip
255
-			$gv_tooltips[ 'gv_'.$key ] = array(
256
-				'title'	=> $arg['label'],
255
+			$gv_tooltips[ 'gv_' . $key ] = array(
256
+				'title'	=> $arg[ 'label' ],
257 257
 				'value'	=> $tooltip,
258 258
 			);
259 259
 
260 260
 		}
261 261
 
262
-		$gv_tooltips['gv_css_merge_tags'] = array(
263
-			'title' => __('CSS Merge Tags', 'gravityview'),
264
-			'value' => sprintf( __( 'Developers: The CSS classes will be sanitized using the %ssanitize_title_with_dashes()%s function.', 'gravityview'), '<code>', '</code>' )
262
+		$gv_tooltips[ 'gv_css_merge_tags' ] = array(
263
+			'title' => __( 'CSS Merge Tags', 'gravityview' ),
264
+			'value' => sprintf( __( 'Developers: The CSS classes will be sanitized using the %ssanitize_title_with_dashes()%s function.', 'gravityview' ), '<code>', '</code>' )
265 265
 		);
266 266
 
267 267
 		/**
@@ -272,9 +272,9 @@  discard block
 block discarded – undo
272 272
 
273 273
 		foreach ( $gv_tooltips as $key => $tooltip ) {
274 274
 
275
-			$title = empty( $tooltip['title'] ) ? '' : '<h6>'.esc_html( $tooltip['title'] ) .'</h6>';
275
+			$title = empty( $tooltip[ 'title' ] ) ? '' : '<h6>' . esc_html( $tooltip[ 'title' ] ) . '</h6>';
276 276
 
277
-			$tooltips[ $key ] = $title . wpautop( esc_html( $tooltip['value'] ) );
277
+			$tooltips[ $key ] = $title . wpautop( esc_html( $tooltip[ 'value' ] ) );
278 278
 		}
279 279
 
280 280
 		return $tooltips;
@@ -288,7 +288,7 @@  discard block
 block discarded – undo
288 288
 	 *
289 289
 	 * @return void
290 290
 	 */
291
-	public function add_custom_column_content( $column_name = NULL, $post_id )	{
291
+	public function add_custom_column_content( $column_name = NULL, $post_id ) {
292 292
 
293 293
 		$output = '';
294 294
 
@@ -310,7 +310,7 @@  discard block
 block discarded – undo
310 310
 				// Generate backup if label doesn't exist: `example_name` => `Example Name`
311 311
 				$template_id_pretty = ucwords( implode( ' ', explode( '_', $template_id ) ) );
312 312
 
313
-				$output = $template ? $template['label'] : $template_id_pretty;
313
+				$output = $template ? $template[ 'label' ] : $template_id_pretty;
314 314
 
315 315
 				break;
316 316
 
@@ -351,44 +351,44 @@  discard block
 block discarded – undo
351 351
 	static public function get_connected_form_links( $form, $include_form_link = true ) {
352 352
 
353 353
 		// Either the form is empty or the form ID is 0, not yet set.
354
-		if( empty( $form ) ) {
354
+		if ( empty( $form ) ) {
355 355
 			return '';
356 356
 		}
357 357
 
358 358
 		// The $form is passed as the form ID
359
-		if( !is_array( $form ) ) {
359
+		if ( ! is_array( $form ) ) {
360 360
 			$form = gravityview_get_form( $form );
361 361
 		}
362 362
 
363
-		$form_id = $form['id'];
363
+		$form_id = $form[ 'id' ];
364 364
 		$links = array();
365 365
 
366
-		if( GVCommon::has_cap( 'gravityforms_edit_forms' ) ) {
366
+		if ( GVCommon::has_cap( 'gravityforms_edit_forms' ) ) {
367 367
 			$form_url = admin_url( sprintf( 'admin.php?page=gf_edit_forms&amp;id=%d', $form_id ) );
368
-			$form_link = '<strong class="gv-form-title">'.gravityview_get_link( $form_url, $form['title'], 'class=row-title' ).'</strong>';
369
-			$links[] = '<span>'.gravityview_get_link( $form_url, __('Edit Form', 'gravityview') ).'</span>';
368
+			$form_link = '<strong class="gv-form-title">' . gravityview_get_link( $form_url, $form[ 'title' ], 'class=row-title' ) . '</strong>';
369
+			$links[ ] = '<span>' . gravityview_get_link( $form_url, __( 'Edit Form', 'gravityview' ) ) . '</span>';
370 370
 		} else {
371
-			$form_link = '<strong class="gv-form-title">'. esc_html( $form['title'] ). '</strong>';
371
+			$form_link = '<strong class="gv-form-title">' . esc_html( $form[ 'title' ] ) . '</strong>';
372 372
 		}
373 373
 
374
-		if( GVCommon::has_cap( 'gravityforms_view_entries' ) ) {
374
+		if ( GVCommon::has_cap( 'gravityforms_view_entries' ) ) {
375 375
 			$entries_url = admin_url( sprintf( 'admin.php?page=gf_entries&amp;id=%d', $form_id ) );
376
-			$links[] = '<span>'.gravityview_get_link( $entries_url, __('Entries', 'gravityview') ).'</span>';
376
+			$links[ ] = '<span>' . gravityview_get_link( $entries_url, __( 'Entries', 'gravityview' ) ) . '</span>';
377 377
 		}
378 378
 
379
-		if( GVCommon::has_cap( array( 'gravityforms_edit_settings', 'gravityview_view_settings' ) ) ) {
379
+		if ( GVCommon::has_cap( array( 'gravityforms_edit_settings', 'gravityview_view_settings' ) ) ) {
380 380
 			$settings_url = admin_url( sprintf( 'admin.php?page=gf_edit_forms&amp;view=settings&amp;id=%d', $form_id ) );
381
-			$links[] = '<span>'.gravityview_get_link( $settings_url, __('Settings', 'gravityview'), 'title='.__('Edit settings for this form', 'gravityview') ).'</span>';
381
+			$links[ ] = '<span>' . gravityview_get_link( $settings_url, __( 'Settings', 'gravityview' ), 'title=' . __( 'Edit settings for this form', 'gravityview' ) ) . '</span>';
382 382
 		}
383 383
 
384
-		if( GVCommon::has_cap( array("gravityforms_edit_forms", "gravityforms_create_form", "gravityforms_preview_forms") ) ) {
384
+		if ( GVCommon::has_cap( array( "gravityforms_edit_forms", "gravityforms_create_form", "gravityforms_preview_forms" ) ) ) {
385 385
 			$preview_url = site_url( sprintf( '?gf_page=preview&amp;id=%d', $form_id ) );
386
-			$links[] = '<span>'.gravityview_get_link( $preview_url, __('Preview Form', 'gravityview'), 'title='.__('Preview this form', 'gravityview') ).'</span>';
386
+			$links[ ] = '<span>' . gravityview_get_link( $preview_url, __( 'Preview Form', 'gravityview' ), 'title=' . __( 'Preview this form', 'gravityview' ) ) . '</span>';
387 387
 		}
388 388
 
389 389
 		$output = '';
390 390
 
391
-		if( !empty( $include_form_link ) ) {
391
+		if ( ! empty( $include_form_link ) ) {
392 392
 			$output .= $form_link;
393 393
 		}
394 394
 
@@ -400,7 +400,7 @@  discard block
 block discarded – undo
400 400
 		 */
401 401
 		$links = apply_filters( 'gravityview_connected_form_links', $links, $form );
402 402
 
403
-		$output .= '<div class="row-actions">'. implode( ' | ', $links ) .'</div>';
403
+		$output .= '<div class="row-actions">' . implode( ' | ', $links ) . '</div>';
404 404
 
405 405
 		return $output;
406 406
 	}
@@ -414,8 +414,8 @@  discard block
 block discarded – undo
414 414
 		// Get the date column and save it for later to add back in.
415 415
 		// This adds it after the Data Source column.
416 416
 		// This way, we don't need to do array_slice, array_merge, etc.
417
-		$date = $columns['date'];
418
-		unset( $columns['date'] );
417
+		$date = $columns[ 'date' ];
418
+		unset( $columns[ 'date' ] );
419 419
 
420 420
 		$data_source_required_caps = array(
421 421
 			'gravityforms_edit_forms',
@@ -426,14 +426,14 @@  discard block
 block discarded – undo
426 426
 			'gravityforms_preview_forms',
427 427
 		);
428 428
 
429
-		if( GVCommon::has_cap( $data_source_required_caps ) ) {
430
-			$columns['gv_connected_form'] = __( 'Data Source', 'gravityview' );
429
+		if ( GVCommon::has_cap( $data_source_required_caps ) ) {
430
+			$columns[ 'gv_connected_form' ] = __( 'Data Source', 'gravityview' );
431 431
 		}
432 432
 
433
-		$columns['gv_template'] = _x( 'Template', 'Column title that shows what template is being used for Views', 'gravityview' );
433
+		$columns[ 'gv_template' ] = _x( 'Template', 'Column title that shows what template is being used for Views', 'gravityview' );
434 434
 
435 435
 		// Add the date back in.
436
-		$columns['date'] = $date;
436
+		$columns[ 'date' ] = $date;
437 437
 
438 438
 		return $columns;
439 439
 	}
@@ -447,12 +447,12 @@  discard block
 block discarded – undo
447 447
 	 */
448 448
 	function save_postdata( $post_id ) {
449 449
 
450
-		if( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ){
450
+		if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
451 451
 			return;
452 452
 		}
453 453
 
454 454
 		// validate post_type
455
-		if ( ! isset( $_POST['post_type'] ) || 'gravityview' != $_POST['post_type'] ) {
455
+		if ( ! isset( $_POST[ 'post_type' ] ) || 'gravityview' != $_POST[ 'post_type' ] ) {
456 456
 			return;
457 457
 		}
458 458
 
@@ -467,63 +467,63 @@  discard block
 block discarded – undo
467 467
 		$statii = array();
468 468
 
469 469
 		// check if this is a start fresh View
470
-		if ( isset( $_POST['gravityview_select_form_nonce'] ) && wp_verify_nonce( $_POST['gravityview_select_form_nonce'], 'gravityview_select_form' ) ) {
470
+		if ( isset( $_POST[ 'gravityview_select_form_nonce' ] ) && wp_verify_nonce( $_POST[ 'gravityview_select_form_nonce' ], 'gravityview_select_form' ) ) {
471 471
 
472
-			$form_id = !empty( $_POST['gravityview_form_id'] ) ? $_POST['gravityview_form_id'] : '';
472
+			$form_id = ! empty( $_POST[ 'gravityview_form_id' ] ) ? $_POST[ 'gravityview_form_id' ] : '';
473 473
 			// save form id
474
-			$statii['form_id'] = update_post_meta( $post_id, '_gravityview_form_id', $form_id );
474
+			$statii[ 'form_id' ] = update_post_meta( $post_id, '_gravityview_form_id', $form_id );
475 475
 
476 476
 		}
477 477
 
478
-		if( false === GVCommon::has_cap( 'gravityforms_create_form' ) && empty( $statii['form_id'] ) ) {
478
+		if ( false === GVCommon::has_cap( 'gravityforms_create_form' ) && empty( $statii[ 'form_id' ] ) ) {
479 479
 			do_action( 'gravityview_log_error', __METHOD__ . ' - Current user does not have the capability to create a new Form.', wp_get_current_user() );
480 480
 			return;
481 481
 		}
482 482
 
483 483
 		// Was this a start fresh?
484
-		if ( ! empty( $_POST['gravityview_form_id_start_fresh'] ) ) {
485
-			$statii['start_fresh'] = add_post_meta( $post_id, '_gravityview_start_fresh', 1 );
484
+		if ( ! empty( $_POST[ 'gravityview_form_id_start_fresh' ] ) ) {
485
+			$statii[ 'start_fresh' ] = add_post_meta( $post_id, '_gravityview_start_fresh', 1 );
486 486
 		} else {
487
-			$statii['start_fresh'] = delete_post_meta( $post_id, '_gravityview_start_fresh' );
487
+			$statii[ 'start_fresh' ] = delete_post_meta( $post_id, '_gravityview_start_fresh' );
488 488
 		}
489 489
 
490 490
 		// Check if we have a template id
491
-		if ( isset( $_POST['gravityview_select_template_nonce'] ) && wp_verify_nonce( $_POST['gravityview_select_template_nonce'], 'gravityview_select_template' ) ) {
491
+		if ( isset( $_POST[ 'gravityview_select_template_nonce' ] ) && wp_verify_nonce( $_POST[ 'gravityview_select_template_nonce' ], 'gravityview_select_template' ) ) {
492 492
 
493
-			$template_id = !empty( $_POST['gravityview_directory_template'] ) ? $_POST['gravityview_directory_template'] : '';
493
+			$template_id = ! empty( $_POST[ 'gravityview_directory_template' ] ) ? $_POST[ 'gravityview_directory_template' ] : '';
494 494
 
495 495
 			// now save template id
496
-			$statii['directory_template'] = update_post_meta( $post_id, '_gravityview_directory_template', $template_id );
496
+			$statii[ 'directory_template' ] = update_post_meta( $post_id, '_gravityview_directory_template', $template_id );
497 497
 		}
498 498
 
499 499
 
500 500
 		// save View Configuration metabox
501
-		if ( isset( $_POST['gravityview_view_configuration_nonce'] ) && wp_verify_nonce( $_POST['gravityview_view_configuration_nonce'], 'gravityview_view_configuration' ) ) {
501
+		if ( isset( $_POST[ 'gravityview_view_configuration_nonce' ] ) && wp_verify_nonce( $_POST[ 'gravityview_view_configuration_nonce' ], 'gravityview_view_configuration' ) ) {
502 502
 
503 503
 			// template settings
504
-			if( empty( $_POST['template_settings'] ) ) {
505
-				$_POST['template_settings'] = array();
504
+			if ( empty( $_POST[ 'template_settings' ] ) ) {
505
+				$_POST[ 'template_settings' ] = array();
506 506
 			}
507
-			$statii['template_settings'] = update_post_meta( $post_id, '_gravityview_template_settings', $_POST['template_settings'] );
507
+			$statii[ 'template_settings' ] = update_post_meta( $post_id, '_gravityview_template_settings', $_POST[ 'template_settings' ] );
508 508
 
509 509
 			$fields = array();
510 510
 
511 511
 			// Directory&single Visible Fields
512
-			if( !empty( $preset_fields ) ) {
512
+			if ( ! empty( $preset_fields ) ) {
513 513
 
514 514
 				$fields = $preset_fields;
515 515
 
516
-			} elseif( !empty( $_POST['gv_fields'] ) ) {
516
+			} elseif ( ! empty( $_POST[ 'gv_fields' ] ) ) {
517 517
 				$fields = _gravityview_process_posted_fields();
518 518
 			}
519 519
 
520
-			$statii['directory_fields'] = update_post_meta( $post_id, '_gravityview_directory_fields', $fields );
520
+			$statii[ 'directory_fields' ] = update_post_meta( $post_id, '_gravityview_directory_fields', $fields );
521 521
 
522 522
 			// Directory Visible Widgets
523
-			if( empty( $_POST['widgets'] ) ) {
524
-				$_POST['widgets'] = array();
523
+			if ( empty( $_POST[ 'widgets' ] ) ) {
524
+				$_POST[ 'widgets' ] = array();
525 525
 			}
526
-			$statii['directory_widgets'] = gravityview_set_directory_widgets( $post_id, $_POST['widgets'] );
526
+			$statii[ 'directory_widgets' ] = gravityview_set_directory_widgets( $post_id, $_POST[ 'widgets' ] );
527 527
 
528 528
 		} // end save view configuration
529 529
 
@@ -533,9 +533,9 @@  discard block
 block discarded – undo
533 533
 		 * @param array $statii Array of statuses of the post meta saving processes. If saving worked, each key should be mapped to a value of the post ID (`directory_widgets` => `124`). If failed (or didn't change), the value will be false.
534 534
 		 * @since 1.17.2
535 535
 		 */
536
-		do_action('gravityview_view_saved', $post_id, $statii );
536
+		do_action( 'gravityview_view_saved', $post_id, $statii );
537 537
 
538
-		do_action('gravityview_log_debug', '[save_postdata] Update Post Meta Statuses (also returns false if nothing changed)', array_map( 'intval', $statii ) );
538
+		do_action( 'gravityview_log_debug', '[save_postdata] Update Post Meta Statuses (also returns false if nothing changed)', array_map( 'intval', $statii ) );
539 539
 	}
540 540
 
541 541
 	/**
@@ -570,20 +570,20 @@  discard block
 block discarded – undo
570 570
 
571 571
 		$output = '';
572 572
 
573
-		if( !empty( $fields ) ) {
573
+		if ( ! empty( $fields ) ) {
574 574
 
575
-			foreach( $fields as $id => $details ) {
575
+			foreach ( $fields as $id => $details ) {
576 576
 
577
-				if( in_array( $details['type'], $blacklist_field_types ) ) {
577
+				if ( in_array( $details[ 'type' ], $blacklist_field_types ) ) {
578 578
 					continue;
579 579
 				}
580 580
 
581 581
 				// Edit mode only allows editing the parent fields, not single inputs.
582
-				if( $context === 'edit' && !empty( $details['parent'] ) ) {
582
+				if ( $context === 'edit' && ! empty( $details[ 'parent' ] ) ) {
583 583
 					continue;
584 584
 				}
585 585
 
586
-				$output .= new GravityView_Admin_View_Field( $details['label'], $id, $details );
586
+				$output .= new GravityView_Admin_View_Field( $details[ 'label' ], $id, $details );
587 587
 
588 588
 			} // End foreach
589 589
 		}
@@ -591,7 +591,7 @@  discard block
 block discarded – undo
591 591
 		echo $output;
592 592
 
593 593
 		// For the EDIT view we only want to allow the form fields.
594
-		if( $context === 'edit' ) {
594
+		if ( $context === 'edit' ) {
595 595
 			return;
596 596
 		}
597 597
 
@@ -615,16 +615,16 @@  discard block
 block discarded – undo
615 615
 		$additional_fields = apply_filters( 'gravityview_additional_fields', array(
616 616
 			array(
617 617
 				'label_text' => __( '+ Add All Fields', 'gravityview' ),
618
-				'desc' => __('Add all the available fields at once.', 'gravityview'),
618
+				'desc' => __( 'Add all the available fields at once.', 'gravityview' ),
619 619
 				'field_id' => 'all-fields',
620 620
 				'label_type' => 'field',
621 621
 				'input_type' => NULL,
622 622
 				'field_options' => NULL,
623 623
 				'settings_html'	=> NULL,
624 624
 			)
625
-		));
625
+		) );
626 626
 
627
-		if( !empty( $additional_fields )) {
627
+		if ( ! empty( $additional_fields ) ) {
628 628
 			foreach ( (array)$additional_fields as $item ) {
629 629
 
630 630
 				// Prevent items from not having index set
@@ -635,16 +635,16 @@  discard block
 block discarded – undo
635 635
 					'input_type' => NULL,
636 636
 					'field_options' => NULL,
637 637
 					'settings_html'	=> NULL,
638
-				));
638
+				) );
639 639
 
640 640
 				// Backward compat.
641
-				if( !empty( $item['field_options'] ) ) {
641
+				if ( ! empty( $item[ 'field_options' ] ) ) {
642 642
 					// Use settings_html from now on.
643
-					$item['settings_html'] = $item['field_options'];
643
+					$item[ 'settings_html' ] = $item[ 'field_options' ];
644 644
 				}
645 645
 
646 646
 				// Render a label for each of them
647
-				echo new GravityView_Admin_View_Field( $item['label_text'], $item['field_id'], $item );
647
+				echo new GravityView_Admin_View_Field( $item[ 'label_text' ], $item[ 'field_id' ], $item );
648 648
 
649 649
 			}
650 650
 		}
@@ -657,54 +657,54 @@  discard block
 block discarded – undo
657 657
 	 * @param  string $zone   Either 'single', 'directory', 'header', 'footer'
658 658
 	 * @return array
659 659
 	 */
660
-	function get_entry_default_fields($form, $zone) {
660
+	function get_entry_default_fields( $form, $zone ) {
661 661
 
662 662
 		$entry_default_fields = array();
663 663
 
664
-		if( in_array( $zone, array( 'directory', 'single' ) ) ) {
664
+		if ( in_array( $zone, array( 'directory', 'single' ) ) ) {
665 665
 
666 666
 			$entry_default_fields = array(
667 667
 				'id' => array(
668
-					'label' => __('Entry ID', 'gravityview'),
668
+					'label' => __( 'Entry ID', 'gravityview' ),
669 669
 					'type' => 'id',
670
-					'desc'	=> __('The unique ID of the entry.', 'gravityview'),
670
+					'desc'	=> __( 'The unique ID of the entry.', 'gravityview' ),
671 671
 				),
672 672
 				'date_created' => array(
673
-					'label' => __('Entry Date', 'gravityview'),
674
-					'desc'	=> __('The date the entry was created.', 'gravityview'),
673
+					'label' => __( 'Entry Date', 'gravityview' ),
674
+					'desc'	=> __( 'The date the entry was created.', 'gravityview' ),
675 675
 					'type' => 'date_created',
676 676
 				),
677 677
 				'source_url' => array(
678
-					'label' => __('Source URL', 'gravityview'),
678
+					'label' => __( 'Source URL', 'gravityview' ),
679 679
 					'type' => 'source_url',
680
-					'desc'	=> __('The URL of the page where the form was submitted.', 'gravityview'),
680
+					'desc'	=> __( 'The URL of the page where the form was submitted.', 'gravityview' ),
681 681
 				),
682 682
 				'ip' => array(
683
-					'label' => __('User IP', 'gravityview'),
683
+					'label' => __( 'User IP', 'gravityview' ),
684 684
 					'type' => 'ip',
685
-					'desc'	=> __('The IP Address of the user who created the entry.', 'gravityview'),
685
+					'desc'	=> __( 'The IP Address of the user who created the entry.', 'gravityview' ),
686 686
 				),
687 687
 				'created_by' => array(
688
-					'label' => __('User', 'gravityview'),
688
+					'label' => __( 'User', 'gravityview' ),
689 689
 					'type' => 'created_by',
690
-					'desc'	=> __('Details of the logged-in user who created the entry (if any).', 'gravityview'),
690
+					'desc'	=> __( 'Details of the logged-in user who created the entry (if any).', 'gravityview' ),
691 691
 				),
692 692
 
693 693
 				/**
694 694
 				 * @since 1.7.2
695 695
 				 */
696 696
 			    'other_entries' => array(
697
-				    'label'	=> __('Other Entries', 'gravityview'),
697
+				    'label'	=> __( 'Other Entries', 'gravityview' ),
698 698
 				    'type'	=> 'other_entries',
699
-				    'desc'	=> __('Display other entries created by the entry creator.', 'gravityview'),
699
+				    'desc'	=> __( 'Display other entries created by the entry creator.', 'gravityview' ),
700 700
 			    ),
701 701
 	        );
702 702
 
703
-			if( 'single' !== $zone) {
703
+			if ( 'single' !== $zone ) {
704 704
 
705
-				$entry_default_fields['entry_link'] = array(
706
-					'label' => __('Link to Entry', 'gravityview'),
707
-					'desc'	=> __('A dedicated link to the single entry with customizable text.', 'gravityview'),
705
+				$entry_default_fields[ 'entry_link' ] = array(
706
+					'label' => __( 'Link to Entry', 'gravityview' ),
707
+					'desc'	=> __( 'A dedicated link to the single entry with customizable text.', 'gravityview' ),
708 708
 					'type' => 'entry_link',
709 709
 				);
710 710
 			}
@@ -714,10 +714,10 @@  discard block
 block discarded – undo
714 714
 		/**
715 715
 		 * @since  1.2
716 716
 		 */
717
-		$entry_default_fields['custom']	= array(
718
-			'label'	=> __('Custom Content', 'gravityview'),
717
+		$entry_default_fields[ 'custom' ] = array(
718
+			'label'	=> __( 'Custom Content', 'gravityview' ),
719 719
 			'type'	=> 'custom',
720
-			'desc'	=> __('Insert custom text or HTML.', 'gravityview'),
720
+			'desc'	=> __( 'Insert custom text or HTML.', 'gravityview' ),
721 721
 		);
722 722
 
723 723
 		/**
@@ -726,7 +726,7 @@  discard block
 block discarded – undo
726 726
 		 * @param  string|array $form form_ID or form object
727 727
 		 * @param  string $zone   Either 'single', 'directory', 'header', 'footer'
728 728
 		 */
729
-		return apply_filters( 'gravityview_entry_default_fields', $entry_default_fields, $form, $zone);
729
+		return apply_filters( 'gravityview_entry_default_fields', $entry_default_fields, $form, $zone );
730 730
 	}
731 731
 
732 732
 	/**
@@ -737,7 +737,7 @@  discard block
 block discarded – undo
737 737
 	 */
738 738
 	function get_available_fields( $form = '', $zone = NULL ) {
739 739
 
740
-		if( empty( $form ) ) {
740
+		if ( empty( $form ) ) {
741 741
 			do_action( 'gravityview_log_error', '[get_available_fields] $form is empty' );
742 742
 			return array();
743 743
 		}
@@ -746,7 +746,7 @@  discard block
 block discarded – undo
746 746
 		$fields = gravityview_get_form_fields( $form, true );
747 747
 
748 748
 		// get meta fields ( only if form was already created )
749
-		if( !is_array( $form ) ) {
749
+		if ( ! is_array( $form ) ) {
750 750
 			$meta_fields = gravityview_get_entry_meta( $form );
751 751
 		} else {
752 752
 			$meta_fields = array();
@@ -770,11 +770,11 @@  discard block
 block discarded – undo
770 770
 
771 771
 		$widgets = $this->get_registered_widgets();
772 772
 
773
-		if( !empty( $widgets ) ) {
773
+		if ( ! empty( $widgets ) ) {
774 774
 
775
-			foreach( $widgets as $id => $details ) {
775
+			foreach ( $widgets as $id => $details ) {
776 776
 
777
-				echo new GravityView_Admin_View_Widget( $details['label'], $id, $details );
777
+				echo new GravityView_Admin_View_Widget( $details[ 'label' ], $id, $details );
778 778
 
779 779
 			}
780 780
 		}
@@ -808,7 +808,7 @@  discard block
 block discarded – undo
808 808
 	function render_active_areas( $template_id, $type, $zone, $rows, $values ) {
809 809
 		global $post;
810 810
 
811
-		if( $type === 'widget' ) {
811
+		if ( $type === 'widget' ) {
812 812
 			$button_label = __( 'Add Widget', 'gravityview' );
813 813
 		} else {
814 814
 			$button_label = __( 'Add Field', 'gravityview' );
@@ -817,15 +817,15 @@  discard block
 block discarded – undo
817 817
 		$available_items = array();
818 818
 
819 819
 		// if saved values, get available fields to label everyone
820
-		if( !empty( $values ) && ( !empty( $post->ID ) || !empty( $_POST['template_id'] ) ) ) {
820
+		if ( ! empty( $values ) && ( ! empty( $post->ID ) || ! empty( $_POST[ 'template_id' ] ) ) ) {
821 821
 
822
-			if( !empty( $_POST['template_id'] ) ) {
823
-				$form = GravityView_Ajax::pre_get_form_fields( $_POST['template_id'] );
822
+			if ( ! empty( $_POST[ 'template_id' ] ) ) {
823
+				$form = GravityView_Ajax::pre_get_form_fields( $_POST[ 'template_id' ] );
824 824
 			} else {
825 825
 				$form = gravityview_get_form_id( $post->ID );
826 826
 			}
827 827
 
828
-			if( 'field' === $type ) {
828
+			if ( 'field' === $type ) {
829 829
 				$available_items = $this->get_available_fields( $form, $zone );
830 830
 			} else {
831 831
 				$available_items = $this->get_registered_widgets();
@@ -833,39 +833,39 @@  discard block
 block discarded – undo
833 833
 
834 834
 		}
835 835
 
836
-		foreach( $rows as $row ) :
837
-			foreach( $row as $col => $areas ) :
838
-				$column = ($col == '2-2') ? '1-2' : $col; ?>
836
+		foreach ( $rows as $row ) :
837
+			foreach ( $row as $col => $areas ) :
838
+				$column = ( $col == '2-2' ) ? '1-2' : $col; ?>
839 839
 
840 840
 				<div class="gv-grid-col-<?php echo esc_attr( $column ); ?>">
841 841
 
842
-					<?php foreach( $areas as $area ) : 	?>
842
+					<?php foreach ( $areas as $area ) : 	?>
843 843
 
844 844
 						<div class="gv-droppable-area">
845
-							<div class="active-drop active-drop-<?php echo esc_attr( $type ); ?>" data-areaid="<?php echo esc_attr( $zone .'_'. $area['areaid'] ); ?>">
845
+							<div class="active-drop active-drop-<?php echo esc_attr( $type ); ?>" data-areaid="<?php echo esc_attr( $zone . '_' . $area[ 'areaid' ] ); ?>">
846 846
 
847 847
 								<?php // render saved fields
848 848
 
849
-								if( !empty( $values[ $zone .'_'. $area['areaid'] ] ) ) {
849
+								if ( ! empty( $values[ $zone . '_' . $area[ 'areaid' ] ] ) ) {
850 850
 
851
-									foreach( $values[ $zone .'_'. $area['areaid'] ] as $uniqid => $field ) {
851
+									foreach ( $values[ $zone . '_' . $area[ 'areaid' ] ] as $uniqid => $field ) {
852 852
 
853 853
 										$input_type = NULL;
854
-										$original_item = isset( $available_items[ $field['id'] ] ) ? $available_items[ $field['id'] ] : false ;
854
+										$original_item = isset( $available_items[ $field[ 'id' ] ] ) ? $available_items[ $field[ 'id' ] ] : false;
855 855
 
856
-										if( !$original_item ) {
856
+										if ( ! $original_item ) {
857 857
 
858
-											do_action('gravityview_log_error', 'An item was not available when rendering the output; maybe it was added by a plugin that is now de-activated.', array('available_items' => $available_items, 'field' => $field ));
858
+											do_action( 'gravityview_log_error', 'An item was not available when rendering the output; maybe it was added by a plugin that is now de-activated.', array( 'available_items' => $available_items, 'field' => $field ) );
859 859
 
860 860
 											$original_item = $field;
861 861
 										} else {
862 862
 
863
-											$input_type = isset( $original_item['type'] ) ? $original_item['type'] : NULL;
863
+											$input_type = isset( $original_item[ 'type' ] ) ? $original_item[ 'type' ] : NULL;
864 864
 
865 865
 										}
866 866
 
867 867
 										// Field options dialog box
868
-										$field_options = GravityView_Render_Settings::render_field_options( $type, $template_id, $field['id'], $original_item['label'], $zone .'_'. $area['areaid'], $input_type, $uniqid, $field, $zone, $original_item );
868
+										$field_options = GravityView_Render_Settings::render_field_options( $type, $template_id, $field[ 'id' ], $original_item[ 'label' ], $zone . '_' . $area[ 'areaid' ], $input_type, $uniqid, $field, $zone, $original_item );
869 869
 
870 870
 										$item = array(
871 871
 											'input_type' => $input_type,
@@ -874,16 +874,16 @@  discard block
 block discarded – undo
874 874
 										);
875 875
 
876 876
 										// Merge the values with the current item to pass things like widget descriptions and original field names
877
-										if( $original_item ) {
877
+										if ( $original_item ) {
878 878
 											$item = wp_parse_args( $item, $original_item );
879 879
 										}
880 880
 
881
-										switch( $type ) {
881
+										switch ( $type ) {
882 882
 											case 'widget':
883
-												echo new GravityView_Admin_View_Widget( $item['label'], $field['id'], $item, $field );
883
+												echo new GravityView_Admin_View_Widget( $item[ 'label' ], $field[ 'id' ], $item, $field );
884 884
 												break;
885 885
 											default:
886
-												echo new GravityView_Admin_View_Field( $item['label'], $field['id'], $item, $field );
886
+												echo new GravityView_Admin_View_Field( $item[ 'label' ], $field[ 'id' ], $item, $field );
887 887
 										}
888 888
 
889 889
 
@@ -893,11 +893,11 @@  discard block
 block discarded – undo
893 893
 
894 894
 								} // End if zone is not empty ?>
895 895
 
896
-								<span class="drop-message"><?php echo sprintf(esc_attr__('"+ %s" or drag existing %ss here.', 'gravityview'), $button_label, $type ); ?></span>
896
+								<span class="drop-message"><?php echo sprintf( esc_attr__( '"+ %s" or drag existing %ss here.', 'gravityview' ), $button_label, $type ); ?></span>
897 897
 							</div>
898 898
 							<div class="gv-droppable-area-action">
899
-								<a href="#" class="gv-add-field button-secondary" title="" data-objecttype="<?php echo esc_attr( $type ); ?>" data-areaid="<?php echo esc_attr( $zone .'_'. $area['areaid'] ); ?>" data-context="<?php echo esc_attr( $zone ); ?>"><?php echo '+ '.esc_html( $button_label ); ?></a>
900
-								<p class="gv-droppable-area-title"><strong><?php echo esc_html( $area['title'] ); ?></strong><?php if( !empty( $area['subtitle'] ) ) { ?><span class="gv-droppable-area-subtitle"> &ndash; <?php echo esc_html( $area['subtitle'] ); ?></span><?php } ?></p>
899
+								<a href="#" class="gv-add-field button-secondary" title="" data-objecttype="<?php echo esc_attr( $type ); ?>" data-areaid="<?php echo esc_attr( $zone . '_' . $area[ 'areaid' ] ); ?>" data-context="<?php echo esc_attr( $zone ); ?>"><?php echo '+ ' . esc_html( $button_label ); ?></a>
900
+								<p class="gv-droppable-area-title"><strong><?php echo esc_html( $area[ 'title' ] ); ?></strong><?php if ( ! empty( $area[ 'subtitle' ] ) ) { ?><span class="gv-droppable-area-subtitle"> &ndash; <?php echo esc_html( $area[ 'subtitle' ] ); ?></span><?php } ?></p>
901 901
 							</div>
902 902
 						</div>
903 903
 
@@ -919,7 +919,7 @@  discard block
 block discarded – undo
919 919
 		$default_widget_areas = GravityView_Plugin::get_default_widget_areas();
920 920
 
921 921
 		$widgets = array();
922
-		if( !empty( $post_id ) ) {
922
+		if ( ! empty( $post_id ) ) {
923 923
 			$widgets = gravityview_get_directory_widgets( $post_id );
924 924
 		}
925 925
 
@@ -949,7 +949,7 @@  discard block
 block discarded – undo
949 949
 	 */
950 950
 	function render_directory_active_areas( $template_id = '', $context = 'single', $post_id = '', $echo = false ) {
951 951
 
952
-		if( empty( $template_id ) ) {
952
+		if ( empty( $template_id ) ) {
953 953
 			do_action( 'gravityview_log_debug', '[render_directory_active_areas] $template_id is empty' );
954 954
 			return '';
955 955
 		}
@@ -963,12 +963,12 @@  discard block
 block discarded – undo
963 963
 		 */
964 964
 		$template_areas = apply_filters( 'gravityview_template_active_areas', array(), $template_id, $context );
965 965
 
966
-		if( empty( $template_areas ) ) {
966
+		if ( empty( $template_areas ) ) {
967 967
 
968 968
 			do_action( 'gravityview_log_debug', '[render_directory_active_areas] No areas defined. Maybe template %s is disabled.', $template_id );
969 969
 			$output = '<div>';
970
-			$output .= '<h2 class="description" style="font-size: 16px; margin:0">'. sprintf( esc_html__( 'This View is configured using the %s View type, which is disabled.', 'gravityview' ), '<em>'.$template_id.'</em>' ) .'</h2>';
971
-			$output .= '<p class="description" style="font-size: 14px; margin:0 0 1em 0;padding:0">'.esc_html__('The data is not lost; re-activate the associated plugin and the configuration will re-appear.', 'gravityview').'</p>';
970
+			$output .= '<h2 class="description" style="font-size: 16px; margin:0">' . sprintf( esc_html__( 'This View is configured using the %s View type, which is disabled.', 'gravityview' ), '<em>' . $template_id . '</em>' ) . '</h2>';
971
+			$output .= '<p class="description" style="font-size: 14px; margin:0 0 1em 0;padding:0">' . esc_html__( 'The data is not lost; re-activate the associated plugin and the configuration will re-appear.', 'gravityview' ) . '</p>';
972 972
 			$output .= '</div>';
973 973
 		} else {
974 974
 
@@ -983,7 +983,7 @@  discard block
 block discarded – undo
983 983
 
984 984
 		}
985 985
 
986
-		if( $echo ) {
986
+		if ( $echo ) {
987 987
 			echo $output;
988 988
 		}
989 989
 
@@ -1003,27 +1003,27 @@  discard block
 block discarded – undo
1003 1003
 		$is_widgets_page = ( $pagenow === 'widgets.php' );
1004 1004
 
1005 1005
 		// Add the GV font (with the Astronaut)
1006
-		wp_enqueue_style( 'gravityview_global', plugins_url('assets/css/admin-global.css', GRAVITYVIEW_FILE), array(), GravityView_Plugin::version );
1006
+		wp_enqueue_style( 'gravityview_global', plugins_url( 'assets/css/admin-global.css', GRAVITYVIEW_FILE ), array(), GravityView_Plugin::version );
1007 1007
 
1008
-		wp_register_script( 'gravityview-jquery-cookie', plugins_url('assets/lib/jquery.cookie/jquery.cookie.min.js', GRAVITYVIEW_FILE), array( 'jquery' ), GravityView_Plugin::version, true );
1008
+		wp_register_script( 'gravityview-jquery-cookie', plugins_url( 'assets/lib/jquery.cookie/jquery.cookie.min.js', GRAVITYVIEW_FILE ), array( 'jquery' ), GravityView_Plugin::version, true );
1009 1009
 
1010 1010
 		// Don't process any scripts below here if it's not a GravityView page.
1011
-		if( !gravityview_is_admin_page($hook) && !$is_widgets_page ) { return; }
1011
+		if ( ! gravityview_is_admin_page( $hook ) && ! $is_widgets_page ) { return; }
1012 1012
 
1013 1013
 		// Only enqueue the following on single pages
1014
-		if( gravityview_is_admin_page($hook, 'single') || $is_widgets_page ) {
1014
+		if ( gravityview_is_admin_page( $hook, 'single' ) || $is_widgets_page ) {
1015 1015
 
1016 1016
 			wp_enqueue_script( 'jquery-ui-datepicker' );
1017
-			wp_enqueue_style( 'gravityview_views_datepicker', plugins_url('assets/css/admin-datepicker.css', GRAVITYVIEW_FILE), GravityView_Plugin::version );
1017
+			wp_enqueue_style( 'gravityview_views_datepicker', plugins_url( 'assets/css/admin-datepicker.css', GRAVITYVIEW_FILE ), GravityView_Plugin::version );
1018 1018
 
1019
-			$script_debug = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min';
1019
+			$script_debug = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
1020 1020
 
1021 1021
 			//enqueue scripts
1022 1022
 			wp_enqueue_script( 'gravityview_views_scripts', plugins_url( 'assets/js/admin-views' . $script_debug . '.js', GRAVITYVIEW_FILE ), array( 'jquery-ui-tabs', 'jquery-ui-draggable', 'jquery-ui-droppable', 'jquery-ui-sortable', 'jquery-ui-tooltip', 'jquery-ui-dialog', 'gravityview-jquery-cookie', 'jquery-ui-datepicker', 'underscore' ), GravityView_Plugin::version );
1023 1023
 
1024
-			wp_localize_script('gravityview_views_scripts', 'gvGlobals', array(
1024
+			wp_localize_script( 'gravityview_views_scripts', 'gvGlobals', array(
1025 1025
 				'cookiepath' => COOKIEPATH,
1026
-                'passed_form_id' => (bool) rgget( 'form_id' ),
1026
+                'passed_form_id' => (bool)rgget( 'form_id' ),
1027 1027
 				'nonce' => wp_create_nonce( 'gravityview_ajaxviews' ),
1028 1028
 				'label_viewname' => __( 'Enter View name here', 'gravityview' ),
1029 1029
 				'label_close' => __( 'Close', 'gravityview' ),
@@ -1035,9 +1035,9 @@  discard block
 block discarded – undo
1035 1035
 				'loading_error' => esc_html__( 'There was an error loading dynamic content.', 'gravityview' ),
1036 1036
 				'field_loaderror' => __( 'Error while adding the field. Please try again or contact GravityView support.', 'gravityview' ),
1037 1037
 				'remove_all_fields' => __( 'Would you like to remove all fields in this zone? (You are seeing this message because you were holding down the ALT key)', 'gravityview' ),
1038
-			));
1038
+			) );
1039 1039
 
1040
-			wp_enqueue_style( 'gravityview_views_styles', plugins_url( 'assets/css/admin-views.css', GRAVITYVIEW_FILE ), array('dashicons', 'wp-jquery-ui-dialog' ), GravityView_Plugin::version );
1040
+			wp_enqueue_style( 'gravityview_views_styles', plugins_url( 'assets/css/admin-views.css', GRAVITYVIEW_FILE ), array( 'dashicons', 'wp-jquery-ui-dialog' ), GravityView_Plugin::version );
1041 1041
 
1042 1042
 			self::enqueue_gravity_forms_scripts();
1043 1043
 
@@ -1056,10 +1056,10 @@  discard block
 block discarded – undo
1056 1056
 		);
1057 1057
 
1058 1058
 		if ( wp_is_mobile() ) {
1059
-		    $scripts[] = 'jquery-touch-punch';
1059
+		    $scripts[ ] = 'jquery-touch-punch';
1060 1060
 		}
1061 1061
 
1062
-		foreach ($scripts as $script) {
1062
+		foreach ( $scripts as $script ) {
1063 1063
 			wp_enqueue_script( $script );
1064 1064
 		}
1065 1065
 	}
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(
@@ -60,8 +60,8 @@  discard block
 block discarded – undo
60 60
 			),
61 61
 		);
62 62
 
63
-		if( 'edit' === $context ) {
64
-			unset( $field_options['custom_label'], $field_options['show_label'], $field_options['allow_edit_cap'], $new_fields['wpautop'] );
63
+		if ( 'edit' === $context ) {
64
+			unset( $field_options[ 'custom_label' ], $field_options[ 'show_label' ], $field_options[ 'allow_edit_cap' ], $new_fields[ 'wpautop' ] );
65 65
 		}
66 66
 
67 67
 		return $new_fields + $field_options;
@@ -95,9 +95,9 @@  discard block
 block discarded – undo
95 95
 
96 96
 		// Loop through the configured Edit Entry fields and add Custom Content fields if there are any
97 97
 		// TODO: Make this available to other custom GV field types
98
-		foreach ( (array) $edit_fields as $edit_field ) {
98
+		foreach ( (array)$edit_fields as $edit_field ) {
99 99
 
100
-			if( 'custom' === rgar( $edit_field, 'id') ) {
100
+			if ( 'custom' === rgar( $edit_field, 'id' ) ) {
101 101
 
102 102
 				$field_data = array(
103 103
 					'label' => rgar( $edit_field, 'custom_label' ),
@@ -110,12 +110,12 @@  discard block
 block discarded – undo
110 110
 					$field_data[ $key ] = GravityView_Merge_Tags::replace_variables( $field_datum, $form, $entry, false, false );
111 111
 				}
112 112
 
113
-				$field_data['cssClass'] = rgar( $edit_field, 'custom_class' );
113
+				$field_data[ 'cssClass' ] = rgar( $edit_field, 'custom_class' );
114 114
 
115
-				$new_fields[] = new GF_Field_HTML( $field_data );
115
+				$new_fields[ ] = new GF_Field_HTML( $field_data );
116 116
 
117 117
 			} else {
118
-				$new_fields[] = $fields[ $i ];
118
+				$new_fields[ ] = $fields[ $i ];
119 119
 				$i++;
120 120
 			}
121 121
 
Please login to merge, or discard this patch.
includes/class-frontend-views.php 1 patch
Spacing   +112 added lines, -112 removed lines patch added patch discarded remove patch
@@ -85,9 +85,9 @@  discard block
 block discarded – undo
85 85
 	private function __construct() {}
86 86
 
87 87
 	private function initialize() {
88
-		add_action( 'wp', array( $this, 'parse_content'), 11 );
88
+		add_action( 'wp', array( $this, 'parse_content' ), 11 );
89 89
 		add_filter( 'parse_query', array( $this, 'parse_query_fix_frontpage' ), 10 );
90
-		add_action( 'template_redirect', array( $this, 'set_entry_data'), 1 );
90
+		add_action( 'template_redirect', array( $this, 'set_entry_data' ), 1 );
91 91
 
92 92
 		// Enqueue scripts and styles after GravityView_Template::register_styles()
93 93
 		add_action( 'wp_enqueue_scripts', array( $this, 'add_scripts_and_styles' ), 20 );
@@ -236,15 +236,15 @@  discard block
 block discarded – undo
236 236
 
237 237
 			$this->context_view_id = $view_id;
238 238
 
239
-		} elseif ( isset( $_GET['gvid'] ) && $this->getGvOutputData()->has_multiple_views() ) {
239
+		} elseif ( isset( $_GET[ 'gvid' ] ) && $this->getGvOutputData()->has_multiple_views() ) {
240 240
 			/**
241 241
 			 * used on a has_multiple_views context
242 242
 			 * @see GravityView_API::entry_link
243 243
 			 * @see GravityView_View_Data::getInstance()->has_multiple_views()
244 244
 			 */
245
-			$this->context_view_id = $_GET['gvid'];
245
+			$this->context_view_id = $_GET[ 'gvid' ];
246 246
 
247
-		} elseif ( ! $this->getGvOutputData()->has_multiple_views() )  {
247
+		} elseif ( ! $this->getGvOutputData()->has_multiple_views() ) {
248 248
 			$array_keys = array_keys( $this->getGvOutputData()->get_views() );
249 249
 			$this->context_view_id = array_pop( $array_keys );
250 250
 			unset( $array_keys );
@@ -279,24 +279,24 @@  discard block
 block discarded – undo
279 279
 		global $wp_rewrite;
280 280
 
281 281
 		$is_front_page = ( $query->is_home || $query->is_page );
282
-		$show_on_front = ( 'page' === get_option('show_on_front') );
283
-		$front_page_id = get_option('page_on_front');
282
+		$show_on_front = ( 'page' === get_option( 'show_on_front' ) );
283
+		$front_page_id = get_option( 'page_on_front' );
284 284
 
285
-		if (  $is_front_page && $show_on_front && $front_page_id ) {
285
+		if ( $is_front_page && $show_on_front && $front_page_id ) {
286 286
 
287 287
 			// Force to be an array, potentially a query string ( entry=16 )
288 288
 			$_query = wp_parse_args( $query->query );
289 289
 
290 290
 			// pagename can be set and empty depending on matched rewrite rules. Ignore an empty pagename.
291
-			if ( isset( $_query['pagename'] ) && '' === $_query['pagename'] ) {
292
-				unset( $_query['pagename'] );
291
+			if ( isset( $_query[ 'pagename' ] ) && '' === $_query[ 'pagename' ] ) {
292
+				unset( $_query[ 'pagename' ] );
293 293
 			}
294 294
 
295 295
 			// this is where will break from core wordpress
296 296
 			$ignore = array( 'preview', 'page', 'paged', 'cpage' );
297 297
 			$endpoints = rgobj( $wp_rewrite, 'endpoints' );
298
-			foreach ( (array) $endpoints as $endpoint ) {
299
-				$ignore[] = $endpoint[1];
298
+			foreach ( (array)$endpoints as $endpoint ) {
299
+				$ignore[ ] = $endpoint[ 1 ];
300 300
 			}
301 301
 			unset( $endpoints );
302 302
 
@@ -306,21 +306,21 @@  discard block
 block discarded – undo
306 306
 			// - The query includes keys that are associated with registered endpoints. `entry`, for example.
307 307
 			if ( empty( $_query ) || ! array_diff( array_keys( $_query ), $ignore ) ) {
308 308
 
309
-				$qv =& $query->query_vars;
309
+				$qv = & $query->query_vars;
310 310
 
311 311
 				// Prevent redirect when on the single entry endpoint
312
-				if( self::is_single_entry() ) {
312
+				if ( self::is_single_entry() ) {
313 313
 					add_filter( 'redirect_canonical', '__return_false' );
314 314
 				}
315 315
 
316 316
 				$query->is_page = true;
317 317
 				$query->is_home = false;
318
-				$qv['page_id']  = $front_page_id;
318
+				$qv[ 'page_id' ]  = $front_page_id;
319 319
 
320 320
 				// Correct <!--nextpage--> for page_on_front
321
-				if ( ! empty( $qv['paged'] ) ) {
322
-					$qv['page'] = $qv['paged'];
323
-					unset( $qv['paged'] );
321
+				if ( ! empty( $qv[ 'paged' ] ) ) {
322
+					$qv[ 'page' ] = $qv[ 'paged' ];
323
+					unset( $qv[ 'paged' ] );
324 324
 				}
325 325
 			}
326 326
 
@@ -338,7 +338,7 @@  discard block
 block discarded – undo
338 338
 		global $post;
339 339
 
340 340
 		// If in admin and NOT AJAX request, get outta here.
341
-		if ( GravityView_Plugin::is_admin() )  {
341
+		if ( GravityView_Plugin::is_admin() ) {
342 342
 			return;
343 343
 		}
344 344
 
@@ -350,7 +350,7 @@  discard block
 block discarded – undo
350 350
 
351 351
 		$this->setIsGravityviewPostType( get_post_type( $post ) === 'gravityview' );
352 352
 
353
-		$post_id = $this->getPostId() ? $this->getPostId() : (isset( $post ) ? $post->ID : null );
353
+		$post_id = $this->getPostId() ? $this->getPostId() : ( isset( $post ) ? $post->ID : null );
354 354
 		$this->setPostId( $post_id );
355 355
 		$post_has_shortcode = ! empty( $post->post_content ) ? gravityview_has_shortcode_r( $post->post_content, 'gravityview' ) : false;
356 356
 		$this->setPostHasShortcode( $this->isGravityviewPostType() ? null : ! empty( $post_has_shortcode ) );
@@ -386,7 +386,7 @@  discard block
 block discarded – undo
386 386
 
387 387
 		$search_method = GravityView_Widget_Search::getInstance()->get_search_method();
388 388
 
389
-		if( 'post' === $search_method ) {
389
+		if ( 'post' === $search_method ) {
390 390
 			$get = $_POST;
391 391
 		} else {
392 392
 			$get = $_GET;
@@ -442,20 +442,20 @@  discard block
 block discarded – undo
442 442
 		 * @param boolean $in_the_loop Whether to apply the filter to the menu title and the meta tag <title> - outside the loop
443 443
 		 * @param array $entry Current entry
444 444
 		 */
445
-		$apply_outside_loop = apply_filters( 'gravityview/single/title/out_loop' , in_the_loop(), $entry );
445
+		$apply_outside_loop = apply_filters( 'gravityview/single/title/out_loop', in_the_loop(), $entry );
446 446
 
447 447
 		if ( ! $apply_outside_loop ) {
448 448
 			return $title;
449 449
 		}
450 450
 
451 451
 		// User reported WooCommerce doesn't pass two args.
452
-		if ( empty( $passed_post_id ) )  {
452
+		if ( empty( $passed_post_id ) ) {
453 453
 			return $title;
454 454
 		}
455 455
 
456 456
 		// Don't modify the title for anything other than the current view/post.
457 457
 		// This is true for embedded shortcodes and Views.
458
-		if ( is_object( $post ) && (int) $post->ID !== (int) $passed_post_id ) {
458
+		if ( is_object( $post ) && (int)$post->ID !== (int)$passed_post_id ) {
459 459
 			return $title;
460 460
 		}
461 461
 
@@ -465,19 +465,19 @@  discard block
 block discarded – undo
465 465
 			$view_meta = $this->getGvOutputData()->get_view( $context_view_id );
466 466
 		} else {
467 467
 			foreach ( $this->getGvOutputData()->get_views() as $view_id => $view_data ) {
468
-				if ( intval( $view_data['form_id'] ) === intval( $entry['form_id'] ) ) {
468
+				if ( intval( $view_data[ 'form_id' ] ) === intval( $entry[ 'form_id' ] ) ) {
469 469
 					$view_meta = $view_data;
470 470
 					break;
471 471
 				}
472 472
 			}
473 473
 		}
474 474
 
475
-		if ( ! empty( $view_meta['atts']['single_title'] ) ) {
475
+		if ( ! empty( $view_meta[ 'atts' ][ 'single_title' ] ) ) {
476 476
 
477
-			$title = $view_meta['atts']['single_title'];
477
+			$title = $view_meta[ 'atts' ][ 'single_title' ];
478 478
 
479 479
 			// We are allowing HTML in the fields, so no escaping the output
480
-			$title = GravityView_API::replace_variables( $title, $view_meta['form'], $entry );
480
+			$title = GravityView_API::replace_variables( $title, $view_meta[ 'form' ], $entry );
481 481
 
482 482
 			$title = do_shortcode( $title );
483 483
 		}
@@ -572,7 +572,7 @@  discard block
 block discarded – undo
572 572
 
573 573
 		$context = GravityView_View::getInstance()->getContext();
574 574
 
575
-		switch( $context ) {
575
+		switch ( $context ) {
576 576
 			case 'directory':
577 577
 				$tab = __( 'Multiple Entries', 'gravityview' );
578 578
 				break;
@@ -586,9 +586,9 @@  discard block
 block discarded – undo
586 586
 		}
587 587
 
588 588
 
589
-		$title = sprintf( esc_html_x('The %s layout has not been configured.', 'Displayed when a View is not configured. %s is replaced by the tab label', 'gravityview' ), $tab );
589
+		$title = sprintf( esc_html_x( 'The %s layout has not been configured.', 'Displayed when a View is not configured. %s is replaced by the tab label', 'gravityview' ), $tab );
590 590
 		$edit_link = admin_url( sprintf( 'post.php?post=%d&action=edit#%s-view', $view_id, $context ) );
591
-		$action_text = sprintf( esc_html__('Add fields to %s', 'gravityview' ), $tab );
591
+		$action_text = sprintf( esc_html__( 'Add fields to %s', 'gravityview' ), $tab );
592 592
 		$message = esc_html__( 'You can only see this message because you are able to edit this View.', 'gravityview' );
593 593
 
594 594
 		$output = sprintf( '<h3>%s <strong><a href="%s">%s</a></strong></h3><p>%s</p>', $title, esc_url( $edit_link ), $action_text, $message );
@@ -621,7 +621,7 @@  discard block
 block discarded – undo
621 621
 	public function render_view( $passed_args ) {
622 622
 
623 623
 		// validate attributes
624
-		if ( empty( $passed_args['id'] ) ) {
624
+		if ( empty( $passed_args[ 'id' ] ) ) {
625 625
 			do_action( 'gravityview_log_error', '[render_view] Returning; no ID defined.', $passed_args );
626 626
 			return null;
627 627
 		}
@@ -643,7 +643,7 @@  discard block
 block discarded – undo
643 643
 			return null;
644 644
 		}
645 645
 
646
-		$view_id = $passed_args['id'];
646
+		$view_id = $passed_args[ 'id' ];
647 647
 
648 648
 		$view_data = $this->getGvOutputData()->get_view( $view_id, $passed_args );
649 649
 
@@ -656,7 +656,7 @@  discard block
 block discarded – undo
656 656
 		$passed_args = array_filter( $passed_args, 'strlen' );
657 657
 
658 658
 		//Override shortcode args over View template settings
659
-		$atts = wp_parse_args( $passed_args, $view_data['atts'] );
659
+		$atts = wp_parse_args( $passed_args, $view_data[ 'atts' ] );
660 660
 
661 661
 		do_action( 'gravityview_log_debug', '[render_view] Arguments after merging with View settings: ', $atts );
662 662
 
@@ -679,14 +679,14 @@  discard block
 block discarded – undo
679 679
 		 * @since 1.15
680 680
 		 * @since 1.17.2 Added check for if a user has no caps but is logged in (member of multisite, but not any site). Treat as if logged-out.
681 681
 		 */
682
-		if( is_user_logged_in() && ! ( empty( wp_get_current_user()->caps ) && empty( wp_get_current_user()->roles ) ) && false === GVCommon::has_cap( 'read_gravityview', $view_id ) ) {
682
+		if ( is_user_logged_in() && ! ( empty( wp_get_current_user()->caps ) && empty( wp_get_current_user()->roles ) ) && false === GVCommon::has_cap( 'read_gravityview', $view_id ) ) {
683 683
 
684 684
 			do_action( 'gravityview_log_debug', sprintf( '%s Returning: View %d is not visible by current user.', __METHOD__, $view_id ) );
685 685
 
686 686
 			return null;
687 687
 		}
688 688
 
689
-		if( $this->isGravityviewPostType() ) {
689
+		if ( $this->isGravityviewPostType() ) {
690 690
 
691 691
 			/**
692 692
 			 * @filter `gravityview_direct_access` Should Views be directly accessible, or only visible using the shortcode?
@@ -698,9 +698,9 @@  discard block
 block discarded – undo
698 698
 			 */
699 699
 			$direct_access = apply_filters( 'gravityview_direct_access', true, $view_id );
700 700
 
701
-			$embed_only = ! empty( $atts['embed_only'] );
701
+			$embed_only = ! empty( $atts[ 'embed_only' ] );
702 702
 
703
-			if( ! $direct_access || ( $embed_only && ! GVCommon::has_cap( 'read_private_gravityviews' ) ) ) {
703
+			if ( ! $direct_access || ( $embed_only && ! GVCommon::has_cap( 'read_private_gravityviews' ) ) ) {
704 704
 				return __( 'You are not allowed to view this content.', 'gravityview' );
705 705
 			}
706 706
 		}
@@ -715,7 +715,7 @@  discard block
 block discarded – undo
715 715
 
716 716
 		$gravityview_view = new GravityView_View( $view_data );
717 717
 
718
-		$post_id = ! empty( $atts['post_id'] ) ? intval( $atts['post_id'] ) : $this->getPostId();
718
+		$post_id = ! empty( $atts[ 'post_id' ] ) ? intval( $atts[ 'post_id' ] ) : $this->getPostId();
719 719
 
720 720
 		$gravityview_view->setPostId( $post_id );
721 721
 
@@ -725,20 +725,20 @@  discard block
 block discarded – undo
725 725
 			do_action( 'gravityview_log_debug', '[render_view] Executing Directory View' );
726 726
 
727 727
 			//fetch template and slug
728
-			$view_slug = apply_filters( 'gravityview_template_slug_'. $view_data['template_id'], 'table', 'directory' );
728
+			$view_slug = apply_filters( 'gravityview_template_slug_' . $view_data[ 'template_id' ], 'table', 'directory' );
729 729
 
730 730
 			do_action( 'gravityview_log_debug', '[render_view] View template slug: ', $view_slug );
731 731
 
732 732
 			/**
733 733
 			 * Disable fetching initial entries for views that don't need it (DataTables)
734 734
 			 */
735
-			$get_entries = apply_filters( 'gravityview_get_view_entries_'.$view_slug, true );
735
+			$get_entries = apply_filters( 'gravityview_get_view_entries_' . $view_slug, true );
736 736
 
737 737
 			/**
738 738
 			 * Hide View data until search is performed
739 739
 			 * @since 1.5.4
740 740
 			 */
741
-			if ( ! empty( $atts['hide_until_searched'] ) && ! $this->isSearch() ) {
741
+			if ( ! empty( $atts[ 'hide_until_searched' ] ) && ! $this->isSearch() ) {
742 742
 				$gravityview_view->setHideUntilSearched( true );
743 743
 				$get_entries = false;
744 744
 			}
@@ -746,23 +746,23 @@  discard block
 block discarded – undo
746 746
 
747 747
 			if ( $get_entries ) {
748 748
 
749
-				if ( ! empty( $atts['sort_columns'] ) ) {
749
+				if ( ! empty( $atts[ 'sort_columns' ] ) ) {
750 750
 					// add filter to enable column sorting
751
-					add_filter( 'gravityview/template/field_label', array( $this, 'add_columns_sort_links' ) , 100, 3 );
751
+					add_filter( 'gravityview/template/field_label', array( $this, 'add_columns_sort_links' ), 100, 3 );
752 752
 				}
753 753
 
754
-				$view_entries = self::get_view_entries( $atts, $view_data['form_id'] );
754
+				$view_entries = self::get_view_entries( $atts, $view_data[ 'form_id' ] );
755 755
 
756
-				do_action( 'gravityview_log_debug', sprintf( '[render_view] Get Entries. Found %s entries total, showing %d entries', $view_entries['count'], sizeof( $view_entries['entries'] ) ) );
756
+				do_action( 'gravityview_log_debug', sprintf( '[render_view] Get Entries. Found %s entries total, showing %d entries', $view_entries[ 'count' ], sizeof( $view_entries[ 'entries' ] ) ) );
757 757
 
758 758
 			} else {
759 759
 
760 760
 				$view_entries = array( 'count' => null, 'entries' => null, 'paging' => null );
761 761
 
762
-				do_action( 'gravityview_log_debug', '[render_view] Not fetching entries because `gravityview_get_view_entries_'.$view_slug.'` is false' );
762
+				do_action( 'gravityview_log_debug', '[render_view] Not fetching entries because `gravityview_get_view_entries_' . $view_slug . '` is false' );
763 763
 			}
764 764
 
765
-			$gravityview_view->setPaging( $view_entries['paging'] );
765
+			$gravityview_view->setPaging( $view_entries[ 'paging' ] );
766 766
 			$gravityview_view->setContext( 'directory' );
767 767
 			$sections = array( 'header', 'body', 'footer' );
768 768
 
@@ -776,7 +776,7 @@  discard block
 block discarded – undo
776 776
 			 * @action `gravityview_render_entry_{View ID}` Before rendering a single entry for a specific View ID
777 777
 			 * @since 1.17
778 778
 			 */
779
-			do_action( 'gravityview_render_entry_'.$view_data['id'] );
779
+			do_action( 'gravityview_render_entry_' . $view_data[ 'id' ] );
780 780
 
781 781
 			$entry = $this->getEntry();
782 782
 
@@ -803,20 +803,20 @@  discard block
 block discarded – undo
803 803
 			// We're in single view, but the view being processed is not the same view the single entry belongs to.
804 804
 			// important: do not remove this as it prevents fake attempts of displaying entries from other views/forms
805 805
 			if ( $this->getGvOutputData()->has_multiple_views() && $view_id != $this->get_context_view_id() ) {
806
-				do_action( 'gravityview_log_debug', '[render_view] In single entry view, but the entry does not belong to this View. Perhaps there are multiple views on the page. View ID: '. $view_id );
806
+				do_action( 'gravityview_log_debug', '[render_view] In single entry view, but the entry does not belong to this View. Perhaps there are multiple views on the page. View ID: ' . $view_id );
807 807
 				return null;
808 808
 			}
809 809
 
810 810
 			//fetch template and slug
811
-			$view_slug = apply_filters( 'gravityview_template_slug_' . $view_data['template_id'], 'table', 'single' );
811
+			$view_slug = apply_filters( 'gravityview_template_slug_' . $view_data[ 'template_id' ], 'table', 'single' );
812 812
 			do_action( 'gravityview_log_debug', '[render_view] View single template slug: ', $view_slug );
813 813
 
814 814
 			//fetch entry detail
815
-			$view_entries['count'] = 1;
816
-			$view_entries['entries'][] = $entry;
817
-			do_action( 'gravityview_log_debug', '[render_view] Get single entry: ', $view_entries['entries'] );
815
+			$view_entries[ 'count' ] = 1;
816
+			$view_entries[ 'entries' ][ ] = $entry;
817
+			do_action( 'gravityview_log_debug', '[render_view] Get single entry: ', $view_entries[ 'entries' ] );
818 818
 
819
-			$back_link_label = isset( $atts['back_link_label'] ) ? $atts['back_link_label'] : null;
819
+			$back_link_label = isset( $atts[ 'back_link_label' ] ) ? $atts[ 'back_link_label' ] : null;
820 820
 
821 821
 			// set back link label
822 822
 			$gravityview_view->setBackLinkLabel( $back_link_label );
@@ -826,11 +826,11 @@  discard block
 block discarded – undo
826 826
 		}
827 827
 
828 828
 		// add template style
829
-		self::add_style( $view_data['template_id'] );
829
+		self::add_style( $view_data[ 'template_id' ] );
830 830
 
831 831
 		// Prepare to render view and set vars
832
-		$gravityview_view->setEntries( $view_entries['entries'] );
833
-		$gravityview_view->setTotalEntries( $view_entries['count'] );
832
+		$gravityview_view->setEntries( $view_entries[ 'entries' ] );
833
+		$gravityview_view->setTotalEntries( $view_entries[ 'count' ] );
834 834
 
835 835
 		// If Edit
836 836
 		if ( 'edit' === gravityview_get_context() ) {
@@ -843,11 +843,11 @@  discard block
 block discarded – undo
843 843
 
844 844
 		} else {
845 845
 			// finaly we'll render some html
846
-			$sections = apply_filters( 'gravityview_render_view_sections', $sections, $view_data['template_id'] );
846
+			$sections = apply_filters( 'gravityview_render_view_sections', $sections, $view_data[ 'template_id' ] );
847 847
 
848 848
 			do_action( 'gravityview_log_debug', '[render_view] Sections to render: ', $sections );
849 849
 			foreach ( $sections as $section ) {
850
-				do_action( 'gravityview_log_debug', '[render_view] Rendering '. $section . ' section.' );
850
+				do_action( 'gravityview_log_debug', '[render_view] Rendering ' . $section . ' section.' );
851 851
 				$gravityview_view->render( $view_slug, $section, false );
852 852
 			}
853 853
 		}
@@ -901,7 +901,7 @@  discard block
 block discarded – undo
901 901
 				$datetime_format = 'Y-m-d H:i:s';
902 902
 				$search_is_outside_view_bounds = false;
903 903
 
904
-				if( ! empty( $search_criteria[ $key ] ) ) {
904
+				if ( ! empty( $search_criteria[ $key ] ) ) {
905 905
 
906 906
 					$search_date = strtotime( $search_criteria[ $key ] );
907 907
 
@@ -929,14 +929,14 @@  discard block
 block discarded – undo
929 929
 				if ( empty( $search_criteria[ $key ] ) || $search_is_outside_view_bounds ) {
930 930
 
931 931
 					// Then we override the search and re-set the start date
932
-					$return_search_criteria[ $key ] = date_i18n( $datetime_format , $date, true );
932
+					$return_search_criteria[ $key ] = date_i18n( $datetime_format, $date, true );
933 933
 				}
934 934
 			}
935 935
 		}
936 936
 
937
-		if( isset( $return_search_criteria['start_date'] ) && isset( $return_search_criteria['end_date'] ) ) {
937
+		if ( isset( $return_search_criteria[ 'start_date' ] ) && isset( $return_search_criteria[ 'end_date' ] ) ) {
938 938
 			// The start date is AFTER the end date. This will result in no results, but let's not force the issue.
939
-			if ( strtotime( $return_search_criteria['start_date'] ) > strtotime( $return_search_criteria['end_date'] ) ) {
939
+			if ( strtotime( $return_search_criteria[ 'start_date' ] ) > strtotime( $return_search_criteria[ 'end_date' ] ) ) {
940 940
 				do_action( 'gravityview_log_error', __METHOD__ . ' Invalid search: the start date is after the end date.', $return_search_criteria );
941 941
 			}
942 942
 		}
@@ -955,19 +955,19 @@  discard block
 block discarded – undo
955 955
 	public static function process_search_only_approved( $args, $search_criteria ) {
956 956
 
957 957
 		/** @since 1.19 */
958
-		if( ! empty( $args['admin_show_all_statuses'] ) && GVCommon::has_cap('gravityview_moderate_entries') ) {
958
+		if ( ! empty( $args[ 'admin_show_all_statuses' ] ) && GVCommon::has_cap( 'gravityview_moderate_entries' ) ) {
959 959
 			do_action( 'gravityview_log_debug', __METHOD__ . ': User can moderate entries; showing all approval statuses' );
960 960
 			return $search_criteria;
961 961
 		}
962 962
 
963
-		if ( ! empty( $args['show_only_approved'] ) ) {
963
+		if ( ! empty( $args[ 'show_only_approved' ] ) ) {
964 964
 
965
-			$search_criteria['field_filters'][] = array(
965
+			$search_criteria[ 'field_filters' ][ ] = array(
966 966
 				'key' => GravityView_Entry_Approval::meta_key,
967 967
 				'value' => GravityView_Entry_Approval_Status::APPROVED
968 968
 			);
969 969
 
970
-			$search_criteria['field_filters']['mode'] = 'all'; // force all the criterias to be met
970
+			$search_criteria[ 'field_filters' ][ 'mode' ] = 'all'; // force all the criterias to be met
971 971
 
972 972
 			do_action( 'gravityview_log_debug', '[process_search_only_approved] Search Criteria if show only approved: ', $search_criteria );
973 973
 		}
@@ -994,18 +994,18 @@  discard block
 block discarded – undo
994 994
 	 */
995 995
 	public static function is_entry_approved( $entry, $args = array() ) {
996 996
 
997
-		if ( empty( $entry['id'] ) || ( array_key_exists( 'show_only_approved', $args ) && ! $args['show_only_approved'] ) ) {
997
+		if ( empty( $entry[ 'id' ] ) || ( array_key_exists( 'show_only_approved', $args ) && ! $args[ 'show_only_approved' ] ) ) {
998 998
 			// is implicitly approved if entry is null or View settings doesn't require to check for approval
999 999
 			return true;
1000 1000
 		}
1001 1001
 
1002 1002
 		/** @since 1.19 */
1003
-		if( ! empty( $args['admin_show_all_statuses'] ) && GVCommon::has_cap('gravityview_moderate_entries') ) {
1003
+		if ( ! empty( $args[ 'admin_show_all_statuses' ] ) && GVCommon::has_cap( 'gravityview_moderate_entries' ) ) {
1004 1004
 			do_action( 'gravityview_log_debug', __METHOD__ . ': User can moderate entries, so entry is approved for viewing' );
1005 1005
 			return true;
1006 1006
 		}
1007 1007
 
1008
-		$is_approved = gform_get_meta( $entry['id'], GravityView_Entry_Approval::meta_key );
1008
+		$is_approved = gform_get_meta( $entry[ 'id' ], GravityView_Entry_Approval::meta_key );
1009 1009
 
1010 1010
 		return GravityView_Entry_Approval_Status::is_approved( $is_approved );
1011 1011
 	}
@@ -1039,26 +1039,26 @@  discard block
 block discarded – undo
1039 1039
 		do_action( 'gravityview_log_debug', '[get_search_criteria] Search Criteria after hook gravityview_fe_search_criteria: ', $search_criteria );
1040 1040
 
1041 1041
 		// implicity search
1042
-		if ( ! empty( $args['search_value'] ) ) {
1042
+		if ( ! empty( $args[ 'search_value' ] ) ) {
1043 1043
 
1044 1044
 			// Search operator options. Options: `is` or `contains`
1045
-			$operator = ! empty( $args['search_operator'] ) && in_array( $args['search_operator'], array( 'is', 'isnot', '>', '<', 'contains' ) ) ? $args['search_operator'] : 'contains';
1045
+			$operator = ! empty( $args[ 'search_operator' ] ) && in_array( $args[ 'search_operator' ], array( 'is', 'isnot', '>', '<', 'contains' ) ) ? $args[ 'search_operator' ] : 'contains';
1046 1046
 
1047
-			$search_criteria['field_filters'][] = array(
1047
+			$search_criteria[ 'field_filters' ][ ] = array(
1048 1048
 				'key' => rgget( 'search_field', $args ), // The field ID to search
1049
-				'value' => _wp_specialchars( $args['search_value'] ), // The value to search. Encode ampersands but not quotes.
1049
+				'value' => _wp_specialchars( $args[ 'search_value' ] ), // The value to search. Encode ampersands but not quotes.
1050 1050
 				'operator' => $operator,
1051 1051
 			);
1052 1052
 		}
1053 1053
 
1054
-		if( $search_criteria !== $original_search_criteria ) {
1054
+		if ( $search_criteria !== $original_search_criteria ) {
1055 1055
 			do_action( 'gravityview_log_debug', '[get_search_criteria] Search Criteria after implicity search: ', $search_criteria );
1056 1056
 		}
1057 1057
 
1058 1058
 		// Handle setting date range
1059 1059
 		$search_criteria = self::process_search_dates( $args, $search_criteria );
1060 1060
 
1061
-		if( $search_criteria !== $original_search_criteria ) {
1061
+		if ( $search_criteria !== $original_search_criteria ) {
1062 1062
 			do_action( 'gravityview_log_debug', '[get_search_criteria] Search Criteria after date params: ', $search_criteria );
1063 1063
 		}
1064 1064
 
@@ -1069,7 +1069,7 @@  discard block
 block discarded – undo
1069 1069
 		 * @filter `gravityview_status` Modify entry status requirements to be included in search results.
1070 1070
 		 * @param string $status Default: `active`. Accepts all Gravity Forms entry statuses, including `spam` and `trash`
1071 1071
 		 */
1072
-		$search_criteria['status'] = apply_filters( 'gravityview_status', 'active', $args );
1072
+		$search_criteria[ 'status' ] = apply_filters( 'gravityview_status', 'active', $args );
1073 1073
 
1074 1074
 		return $search_criteria;
1075 1075
 	}
@@ -1115,16 +1115,16 @@  discard block
 block discarded – undo
1115 1115
 		$search_criteria = self::get_search_criteria( $args, $form_id );
1116 1116
 
1117 1117
 		// Paging & offset
1118
-		$page_size = ! empty( $args['page_size'] ) ? intval( $args['page_size'] ) : apply_filters( 'gravityview_default_page_size', 25 );
1118
+		$page_size = ! empty( $args[ 'page_size' ] ) ? intval( $args[ 'page_size' ] ) : apply_filters( 'gravityview_default_page_size', 25 );
1119 1119
 
1120 1120
 		if ( -1 === $page_size ) {
1121 1121
 			$page_size = PHP_INT_MAX;
1122 1122
 		}
1123 1123
 
1124
-		if ( isset( $args['offset'] ) ) {
1125
-			$offset = intval( $args['offset'] );
1124
+		if ( isset( $args[ 'offset' ] ) ) {
1125
+			$offset = intval( $args[ 'offset' ] );
1126 1126
 		} else {
1127
-			$curr_page = empty( $_GET['pagenum'] ) ? 1 : intval( $_GET['pagenum'] );
1127
+			$curr_page = empty( $_GET[ 'pagenum' ] ) ? 1 : intval( $_GET[ 'pagenum' ] );
1128 1128
 			$offset = ( $curr_page - 1 ) * $page_size;
1129 1129
 		}
1130 1130
 
@@ -1142,7 +1142,7 @@  discard block
 block discarded – undo
1142 1142
 			'search_criteria' => $search_criteria,
1143 1143
 			'sorting' => $sorting,
1144 1144
 			'paging' => $paging,
1145
-			'cache' => isset( $args['cache'] ) ? $args['cache'] : true,
1145
+			'cache' => isset( $args[ 'cache' ] ) ? $args[ 'cache' ] : true,
1146 1146
 		);
1147 1147
 
1148 1148
 		/**
@@ -1167,7 +1167,7 @@  discard block
 block discarded – undo
1167 1167
 		 * @param array $parameters Array with `search_criteria`, `sorting` and `paging` keys.
1168 1168
 		 * @param array $args View configuration args.
1169 1169
 		 */
1170
-		$parameters = apply_filters( 'gravityview_get_entries_'.$args['id'], $parameters, $args, $form_id );
1170
+		$parameters = apply_filters( 'gravityview_get_entries_' . $args[ 'id' ], $parameters, $args, $form_id );
1171 1171
 
1172 1172
 		do_action( 'gravityview_log_debug', __METHOD__ . ': $parameters passed to gravityview_get_entries(): ', $parameters );
1173 1173
 
@@ -1207,8 +1207,8 @@  discard block
 block discarded – undo
1207 1207
 	 */
1208 1208
 	public static function updateViewSorting( $args, $form_id ) {
1209 1209
 		$sorting = array();
1210
-		$sort_field_id = isset( $_GET['sort'] ) ? $_GET['sort'] : rgar( $args, 'sort_field' );
1211
-		$sort_direction = isset( $_GET['dir'] ) ? $_GET['dir'] : rgar( $args, 'sort_direction' );
1210
+		$sort_field_id = isset( $_GET[ 'sort' ] ) ? $_GET[ 'sort' ] : rgar( $args, 'sort_field' );
1211
+		$sort_direction = isset( $_GET[ 'dir' ] ) ? $_GET[ 'dir' ] : rgar( $args, 'sort_direction' );
1212 1212
 
1213 1213
 		$sort_field_id = self::_override_sorting_id_by_field_type( $sort_field_id, $form_id );
1214 1214
 
@@ -1248,11 +1248,11 @@  discard block
 block discarded – undo
1248 1248
 
1249 1249
 		$sort_field = GFFormsModel::get_field( $form, $sort_field_id );
1250 1250
 
1251
-		if( ! $sort_field ) {
1251
+		if ( ! $sort_field ) {
1252 1252
 			return $sort_field_id;
1253 1253
 		}
1254 1254
 
1255
-		switch ( $sort_field['type'] ) {
1255
+		switch ( $sort_field[ 'type' ] ) {
1256 1256
 
1257 1257
 			case 'address':
1258 1258
 				// Sorting by full address
@@ -1269,7 +1269,7 @@  discard block
 block discarded – undo
1269 1269
 					 */
1270 1270
 					$address_part = apply_filters( 'gravityview/sorting/address', 'city', $sort_field_id, $form_id );
1271 1271
 
1272
-					switch( strtolower( $address_part ) ){
1272
+					switch ( strtolower( $address_part ) ) {
1273 1273
 						case 'street':
1274 1274
 							$sort_field_id .= '.1';
1275 1275
 							break;
@@ -1349,7 +1349,7 @@  discard block
 block discarded – undo
1349 1349
 		 */
1350 1350
 		$single_entry = apply_filters( 'gravityview/is_single_entry', $single_entry );
1351 1351
 
1352
-		if ( empty( $single_entry ) ){
1352
+		if ( empty( $single_entry ) ) {
1353 1353
 			return false;
1354 1354
 		} else {
1355 1355
 			return $single_entry;
@@ -1376,7 +1376,7 @@  discard block
 block discarded – undo
1376 1376
 				 * Don't enqueue the scripts or styles if it's not going to be displayed.
1377 1377
 				 * @since 1.15
1378 1378
 				 */
1379
-				if( is_user_logged_in() && false === GVCommon::has_cap( 'read_gravityview', $view_id ) ) {
1379
+				if ( is_user_logged_in() && false === GVCommon::has_cap( 'read_gravityview', $view_id ) ) {
1380 1380
 					continue;
1381 1381
 				}
1382 1382
 
@@ -1385,19 +1385,19 @@  discard block
 block discarded – undo
1385 1385
 				$css_dependencies = array();
1386 1386
 
1387 1387
 				// If the thickbox is enqueued, add dependencies
1388
-				if ( ! empty( $data['atts']['lightbox'] ) ) {
1388
+				if ( ! empty( $data[ 'atts' ][ 'lightbox' ] ) ) {
1389 1389
 
1390 1390
 					/**
1391 1391
 					 * @filter `gravity_view_lightbox_script` Override the lightbox script to enqueue. Default: `thickbox`
1392 1392
 					 * @param string $script_slug If you want to use a different lightbox script, return the name of it here.
1393 1393
 					 */
1394
-					$js_dependencies[] = apply_filters( 'gravity_view_lightbox_script', 'thickbox' );
1394
+					$js_dependencies[ ] = apply_filters( 'gravity_view_lightbox_script', 'thickbox' );
1395 1395
 
1396 1396
 					/**
1397 1397
 					 * @filter `gravity_view_lightbox_style` Modify the lightbox CSS slug. Default: `thickbox`
1398 1398
 					 * @param string $script_slug If you want to use a different lightbox script, return the name of its CSS file here.
1399 1399
 					 */
1400
-					$css_dependencies[] = apply_filters( 'gravity_view_lightbox_style', 'thickbox' );
1400
+					$css_dependencies[ ] = apply_filters( 'gravity_view_lightbox_style', 'thickbox' );
1401 1401
 				}
1402 1402
 
1403 1403
 				/**
@@ -1405,25 +1405,25 @@  discard block
 block discarded – undo
1405 1405
 				 * @see https://github.com/katzwebservices/GravityView/issues/536
1406 1406
 				 * @since 1.15
1407 1407
 				 */
1408
-				if( gravityview_view_has_single_checkbox_or_radio( $data['form'], $data['fields'] ) ) {
1409
-					$css_dependencies[] = 'dashicons';
1408
+				if ( gravityview_view_has_single_checkbox_or_radio( $data[ 'form' ], $data[ 'fields' ] ) ) {
1409
+					$css_dependencies[ ] = 'dashicons';
1410 1410
 				}
1411 1411
 
1412 1412
 				wp_register_script( 'gravityview-jquery-cookie', plugins_url( 'assets/lib/jquery.cookie/jquery.cookie.min.js', GRAVITYVIEW_FILE ), array( 'jquery' ), GravityView_Plugin::version, true );
1413 1413
 
1414 1414
 				$script_debug = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
1415 1415
 
1416
-				wp_register_script( 'gravityview-fe-view', plugins_url( 'assets/js/fe-views' . $script_debug . '.js', GRAVITYVIEW_FILE ), apply_filters( 'gravityview_js_dependencies', $js_dependencies ) , GravityView_Plugin::version, true );
1416
+				wp_register_script( 'gravityview-fe-view', plugins_url( 'assets/js/fe-views' . $script_debug . '.js', GRAVITYVIEW_FILE ), apply_filters( 'gravityview_js_dependencies', $js_dependencies ), GravityView_Plugin::version, true );
1417 1417
 
1418 1418
 				wp_enqueue_script( 'gravityview-fe-view' );
1419 1419
 
1420
-				if ( ! empty( $data['atts']['sort_columns'] ) ) {
1420
+				if ( ! empty( $data[ 'atts' ][ 'sort_columns' ] ) ) {
1421 1421
 					wp_enqueue_style( 'gravityview_font', plugins_url( 'assets/css/font.css', GRAVITYVIEW_FILE ), $css_dependencies, GravityView_Plugin::version, 'all' );
1422 1422
 				}
1423 1423
 
1424 1424
 				$this->enqueue_default_style( $css_dependencies );
1425 1425
 
1426
-				self::add_style( $data['template_id'] );
1426
+				self::add_style( $data[ 'template_id' ] );
1427 1427
 			}
1428 1428
 
1429 1429
 			if ( 'wp_print_footer_scripts' === current_filter() ) {
@@ -1485,7 +1485,7 @@  discard block
 block discarded – undo
1485 1485
 		} elseif ( empty( $template_id ) ) {
1486 1486
 			do_action( 'gravityview_log_error', '[add_style] Cannot add template style; template_id is empty' );
1487 1487
 		} else {
1488
-			do_action( 'gravityview_log_error', sprintf( '[add_style] Cannot add template style; %s is not registered', 'gravityview_style_'.$template_id ) );
1488
+			do_action( 'gravityview_log_error', sprintf( '[add_style] Cannot add template style; %s is not registered', 'gravityview_style_' . $template_id ) );
1489 1489
 		}
1490 1490
 
1491 1491
 	}
@@ -1510,11 +1510,11 @@  discard block
 block discarded – undo
1510 1510
 		 * Not a table-based template; don't add sort icons
1511 1511
 		 * @since 1.12
1512 1512
 		 */
1513
-		if( ! preg_match( '/table/ism', GravityView_View::getInstance()->getTemplatePartSlug() ) ) {
1513
+		if ( ! preg_match( '/table/ism', GravityView_View::getInstance()->getTemplatePartSlug() ) ) {
1514 1514
 			return $label;
1515 1515
 		}
1516 1516
 
1517
-		if ( ! $this->is_field_sortable( $field['id'], $form ) ) {
1517
+		if ( ! $this->is_field_sortable( $field[ 'id' ], $form ) ) {
1518 1518
 			return $label;
1519 1519
 		}
1520 1520
 
@@ -1522,29 +1522,29 @@  discard block
 block discarded – undo
1522 1522
 
1523 1523
 		$class = 'gv-sort';
1524 1524
 
1525
-		$sort_field_id = self::_override_sorting_id_by_field_type( $field['id'], $form['id'] );
1525
+		$sort_field_id = self::_override_sorting_id_by_field_type( $field[ 'id' ], $form[ 'id' ] );
1526 1526
 
1527 1527
 		$sort_args = array(
1528
-			'sort' => $field['id'],
1528
+			'sort' => $field[ 'id' ],
1529 1529
 			'dir' => 'asc',
1530 1530
 		);
1531 1531
 
1532
-		if ( ! empty( $sorting['key'] ) && (string) $sort_field_id === (string) $sorting['key'] ) {
1532
+		if ( ! empty( $sorting[ 'key' ] ) && (string)$sort_field_id === (string)$sorting[ 'key' ] ) {
1533 1533
 			//toggle sorting direction.
1534
-			if ( 'asc' === $sorting['direction'] ) {
1535
-				$sort_args['dir'] = 'desc';
1534
+			if ( 'asc' === $sorting[ 'direction' ] ) {
1535
+				$sort_args[ 'dir' ] = 'desc';
1536 1536
 				$class .= ' gv-icon-sort-desc';
1537 1537
 			} else {
1538
-				$sort_args['dir'] = 'asc';
1538
+				$sort_args[ 'dir' ] = 'asc';
1539 1539
 				$class .= ' gv-icon-sort-asc';
1540 1540
 			}
1541 1541
 		} else {
1542 1542
 			$class .= ' gv-icon-caret-up-down';
1543 1543
 		}
1544 1544
 
1545
-		$url = add_query_arg( $sort_args, remove_query_arg( array('pagenum') ) );
1545
+		$url = add_query_arg( $sort_args, remove_query_arg( array( 'pagenum' ) ) );
1546 1546
 
1547
-		return '<a href="'. esc_url_raw( $url ) .'" class="'. $class .'" ></a>&nbsp;'. $label;
1547
+		return '<a href="' . esc_url_raw( $url ) . '" class="' . $class . '" ></a>&nbsp;' . $label;
1548 1548
 
1549 1549
 	}
1550 1550
 
@@ -1562,7 +1562,7 @@  discard block
 block discarded – undo
1562 1562
 
1563 1563
 		$field_type = $field_id;
1564 1564
 
1565
-		if( is_numeric( $field_id ) ) {
1565
+		if ( is_numeric( $field_id ) ) {
1566 1566
 			$field = GFFormsModel::get_field( $form, $field_id );
1567 1567
 			$field_type = $field->type;
1568 1568
 		}
@@ -1585,7 +1585,7 @@  discard block
 block discarded – undo
1585 1585
 			return false;
1586 1586
 		}
1587 1587
 
1588
-		return apply_filters( "gravityview/sortable/formfield_{$form['id']}_{$field_id}", apply_filters( "gravityview/sortable/field_{$field_id}", true, $form ) );
1588
+		return apply_filters( "gravityview/sortable/formfield_{$form[ 'id' ]}_{$field_id}", apply_filters( "gravityview/sortable/field_{$field_id}", true, $form ) );
1589 1589
 
1590 1590
 	}
1591 1591
 
Please login to merge, or discard this patch.
includes/fields/class-gravityview-field-address.php 1 patch
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -54,8 +54,8 @@  discard block
 block discarded – undo
54 54
 
55 55
 			if ( 'address' === rgar( $search_field, 'type' ) ) {
56 56
 
57
-				$field_id = intval( floor( $search_field['key'] ) );
58
-				$input_id = gravityview_get_input_id_from_id( $search_field['key'] );
57
+				$field_id = intval( floor( $search_field[ 'key' ] ) );
58
+				$input_id = gravityview_get_input_id_from_id( $search_field[ 'key' ] );
59 59
 				$form = GravityView_View::getInstance()->getForm();
60 60
 
61 61
 				/** @var GF_Field_Address $address_field */
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 				$choices = array();
65 65
 
66 66
 				$method_name = 'get_choices_' . self::get_input_type_from_input_id( $input_id );
67
-				if( method_exists( $this, $method_name ) ) {
67
+				if ( method_exists( $this, $method_name ) ) {
68 68
 					/**
69 69
 					 * @uses GravityView_Field_Address::get_choices_country()
70 70
 					 * @uses GravityView_Field_Address::get_choices_state()
@@ -72,12 +72,12 @@  discard block
 block discarded – undo
72 72
 					$choices = $this->{$method_name}( $address_field );
73 73
 				}
74 74
 
75
-				if( ! empty( $choices ) ) {
76
-					$search_field['choices'] = $choices;
77
-					$search_field['type'] = rgar( $search_field, 'input');
75
+				if ( ! empty( $choices ) ) {
76
+					$search_field[ 'choices' ] = $choices;
77
+					$search_field[ 'type' ] = rgar( $search_field, 'input' );
78 78
 				} else {
79
-					$search_field['type'] = 'text';
80
-					$search_field['input'] = 'input_text';
79
+					$search_field[ 'type' ] = 'text';
80
+					$search_field[ 'input' ] = 'input_text';
81 81
 				}
82 82
 			}
83 83
 		}
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
 		$country_choices = array();
104 104
 
105 105
 		foreach ( $countries as $key => $country ) {
106
-			$country_choices[] = array(
106
+			$country_choices[ ] = array(
107 107
 				'value' => $country,
108 108
 				'text' => $country,
109 109
 			);
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
 	 */
128 128
 	private function get_choices_state( $address_field ) {
129 129
 
130
-		$address_type = empty( $address_field->addressType ) ? $address_field->get_default_address_type( $form['id'] ) : $address_field->addressType;
130
+		$address_type = empty( $address_field->addressType ) ? $address_field->get_default_address_type( $form[ 'id' ] ) : $address_field->addressType;
131 131
 
132 132
 		$state_choices = array();
133 133
 
@@ -139,19 +139,19 @@  discard block
 block discarded – undo
139 139
 				$states = GFCommon::get_canadian_provinces();
140 140
 				break;
141 141
 			default:
142
-				$states = empty( $address_types[ $address_type ]['states'] ) ? array() : $address_types[ $address_type ]['states'];
142
+				$states = empty( $address_types[ $address_type ][ 'states' ] ) ? array() : $address_types[ $address_type ][ 'states' ];
143 143
 				break;
144 144
 		}
145 145
 
146 146
 		foreach ( $states as $key => $state ) {
147 147
 
148
-			if( 'us' === $address_type ) {
148
+			if ( 'us' === $address_type ) {
149 149
 				$value = GFCommon::get_us_state_code( $state );
150 150
 			} else {
151 151
 				$value = $state;
152 152
 			}
153 153
 
154
-			$state_choices[] = array(
154
+			$state_choices[ ] = array(
155 155
 				'value' => $value,
156 156
 				'text' => $state,
157 157
 			);
@@ -174,13 +174,13 @@  discard block
 block discarded – undo
174 174
 		// Use the same inputs as the "text" input type allows
175 175
 		$text_inputs = rgar( $input_types, 'text' );
176 176
 
177
-		$input_types['street'] = $text_inputs;
178
-		$input_types['street2'] = $text_inputs;
179
-		$input_types['city'] = $text_inputs;
177
+		$input_types[ 'street' ] = $text_inputs;
178
+		$input_types[ 'street2' ] = $text_inputs;
179
+		$input_types[ 'city' ] = $text_inputs;
180 180
 
181
-		$input_types['state'] = array( 'select', 'radio', 'link' ) + $text_inputs;
182
-		$input_types['zip'] = array( 'input_text' );
183
-		$input_types['country'] = array( 'select', 'radio', 'link' ) + $text_inputs;
181
+		$input_types[ 'state' ] = array( 'select', 'radio', 'link' ) + $text_inputs;
182
+		$input_types[ 'zip' ] = array( 'input_text' );
183
+		$input_types[ 'country' ] = array( 'select', 'radio', 'link' ) + $text_inputs;
184 184
 
185 185
 		return $input_types;
186 186
 	}
@@ -201,10 +201,10 @@  discard block
 block discarded – undo
201 201
 		// Is this search field for an input (eg: 4.2) or the whole address field (eg: 4)?
202 202
 		$input_id = gravityview_get_input_id_from_id( $field_id );
203 203
 
204
-		if( 'address' === $field_type && $input_id ) {
204
+		if ( 'address' === $field_type && $input_id ) {
205 205
 
206 206
 			// If the input ID matches an expected address input, set to that. Otherwise, keep existing input type.
207
-			if( $address_field_name = self::get_input_type_from_input_id( $input_id ) ) {
207
+			if ( $address_field_name = self::get_input_type_from_input_id( $input_id ) ) {
208 208
 				$input_type = $address_field_name;
209 209
 			}
210 210
 		}
@@ -253,20 +253,20 @@  discard block
 block discarded – undo
253 253
 	function field_options( $field_options, $template_id = '', $field_id = '', $context = '', $input_type = '' ) {
254 254
 
255 255
 		// If this is NOT the full address field, return default options.
256
-		if( floor( $field_id ) !== floatval( $field_id ) ) {
256
+		if ( floor( $field_id ) !== floatval( $field_id ) ) {
257 257
 			return $field_options;
258 258
 		}
259 259
 
260
-		if( 'edit' === $context ) {
260
+		if ( 'edit' === $context ) {
261 261
 			return $field_options;
262 262
 		}
263 263
 
264 264
 		$add_options = array();
265 265
 
266
-		$add_options['show_map_link'] = array(
266
+		$add_options[ 'show_map_link' ] = array(
267 267
 			'type' => 'checkbox',
268 268
 			'label' => __( 'Show Map Link:', 'gravityview' ),
269
-			'desc' => __('Display a "Map It" link below the address', 'gravityview'),
269
+			'desc' => __( 'Display a "Map It" link below the address', 'gravityview' ),
270 270
 			'value' => true,
271 271
 			'merge_tags' => false,
272 272
 		);
Please login to merge, or discard this patch.
includes/class-common.php 1 patch
Spacing   +102 added lines, -102 removed lines patch added patch discarded remove patch
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
 
125 125
 		$entry = self::get_entry( $entry_slug, true );
126 126
 
127
-		$form = self::get_form( $entry['form_id'] );
127
+		$form = self::get_form( $entry[ 'form_id' ] );
128 128
 
129 129
 		return $form;
130 130
 	}
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
 
183 183
 		$results = GFAPI::get_entries( intval( $form_id ), $search_criteria, null, $paging );
184 184
 
185
-		$result = ( ! empty( $results ) && ! empty( $results[0]['id'] ) ) ? $results[0]['id'] : null;
185
+		$result = ( ! empty( $results ) && ! empty( $results[ 0 ][ 'id' ] ) ) ? $results[ 0 ][ 'id' ] : null;
186 186
 
187 187
 		return $result;
188 188
 	}
@@ -199,10 +199,10 @@  discard block
 block discarded – undo
199 199
 	 *
200 200
 	 * @return array Empty array if GFAPI class isn't available or no forms. Otherwise, the array of Forms
201 201
 	 */
202
-	public static function get_forms(  $active = true, $trash = false ) {
202
+	public static function get_forms( $active = true, $trash = false ) {
203 203
 		$forms = array();
204 204
 		if ( class_exists( 'GFAPI' ) ) {
205
-			if( 'any' === $active ) {
205
+			if ( 'any' === $active ) {
206 206
 				$active_forms = GFAPI::get_forms( true, $trash );
207 207
 				$inactive_forms = GFAPI::get_forms( false, $trash );
208 208
 				$forms = array_merge( array_filter( $active_forms ), array_filter( $inactive_forms ) );
@@ -233,9 +233,9 @@  discard block
 block discarded – undo
233 233
 		$has_post_fields = false;
234 234
 
235 235
 		if ( $form ) {
236
-			foreach ( $form['fields'] as $field ) {
237
-				if ( $include_parent_field || empty( $field['inputs'] ) ) {
238
-					$fields["{$field['id']}"] = array(
236
+			foreach ( $form[ 'fields' ] as $field ) {
237
+				if ( $include_parent_field || empty( $field[ 'inputs' ] ) ) {
238
+					$fields[ "{$field[ 'id' ]}" ] = array(
239 239
 						'label' => rgar( $field, 'label' ),
240 240
 						'parent' => null,
241 241
 						'type' => rgar( $field, 'type' ),
@@ -244,10 +244,10 @@  discard block
 block discarded – undo
244 244
 					);
245 245
 				}
246 246
 
247
-				if ( $add_default_properties && ! empty( $field['inputs'] ) ) {
248
-					foreach ( $field['inputs'] as $input ) {
247
+				if ( $add_default_properties && ! empty( $field[ 'inputs' ] ) ) {
248
+					foreach ( $field[ 'inputs' ] as $input ) {
249 249
 
250
-						if( ! empty( $input['isHidden'] ) ) {
250
+						if ( ! empty( $input[ 'isHidden' ] ) ) {
251 251
 							continue;
252 252
 						}
253 253
 
@@ -255,10 +255,10 @@  discard block
 block discarded – undo
255 255
                          * @hack
256 256
                          * In case of email/email confirmation, the input for email has the same id as the parent field
257 257
                          */
258
-						if( 'email' === $field['type'] && false === strpos( $input['id'], '.' ) ) {
258
+						if ( 'email' === $field[ 'type' ] && false === strpos( $input[ 'id' ], '.' ) ) {
259 259
                             continue;
260 260
                         }
261
-						$fields["{$input['id']}"] = array(
261
+						$fields[ "{$input[ 'id' ]}" ] = array(
262 262
 							'label' => rgar( $input, 'label' ),
263 263
 							'customLabel' => rgar( $input, 'customLabel' ),
264 264
 							'parent' => $field,
@@ -270,7 +270,7 @@  discard block
 block discarded – undo
270 270
 				}
271 271
 
272 272
 
273
-				if( GFCommon::is_product_field( $field['type'] ) ){
273
+				if ( GFCommon::is_product_field( $field[ 'type' ] ) ) {
274 274
 					$has_product_fields = true;
275 275
 				}
276 276
 
@@ -284,7 +284,7 @@  discard block
 block discarded – undo
284 284
 		 * @since 1.7
285 285
 		 */
286 286
 		if ( $has_post_fields ) {
287
-			$fields['post_id'] = array(
287
+			$fields[ 'post_id' ] = array(
288 288
 				'label' => __( 'Post ID', 'gravityview' ),
289 289
 				'type' => 'post_id',
290 290
 			);
@@ -295,10 +295,10 @@  discard block
 block discarded – undo
295 295
 			$payment_fields = GravityView_Fields::get_all( 'pricing' );
296 296
 
297 297
 			foreach ( $payment_fields as $payment_field ) {
298
-				if( isset( $fields["{$payment_field->name}"] ) ) {
298
+				if ( isset( $fields[ "{$payment_field->name}" ] ) ) {
299 299
 					continue;
300 300
 				}
301
-				$fields["{$payment_field->name}"] = array(
301
+				$fields[ "{$payment_field->name}" ] = array(
302 302
 					'label' => $payment_field->label,
303 303
 					'desc' => $payment_field->description,
304 304
 					'type' => $payment_field->name,
@@ -330,9 +330,9 @@  discard block
 block discarded – undo
330 330
 
331 331
 		$fields = array();
332 332
 
333
-		foreach ( $extra_fields as $key => $field ){
334
-			if ( ! empty( $only_default_column ) && ! empty( $field['is_default_column'] ) ) {
335
-				$fields[ $key ] = array( 'label' => $field['label'], 'type' => 'entry_meta' );
333
+		foreach ( $extra_fields as $key => $field ) {
334
+			if ( ! empty( $only_default_column ) && ! empty( $field[ 'is_default_column' ] ) ) {
335
+				$fields[ $key ] = array( 'label' => $field[ 'label' ], 'type' => 'entry_meta' );
336 336
 			}
337 337
 		}
338 338
 
@@ -372,32 +372,32 @@  discard block
 block discarded – undo
372 372
 			'search_criteria' => null,
373 373
 			'sorting' => null,
374 374
 			'paging' => null,
375
-			'cache' => (isset( $passed_criteria['cache'] ) ? $passed_criteria['cache'] : true),
375
+			'cache' => ( isset( $passed_criteria[ 'cache' ] ) ? $passed_criteria[ 'cache' ] : true ),
376 376
 		);
377 377
 
378 378
 		$criteria = wp_parse_args( $passed_criteria, $search_criteria_defaults );
379 379
 
380
-		if ( ! empty( $criteria['search_criteria']['field_filters'] ) ) {
381
-			foreach ( $criteria['search_criteria']['field_filters'] as &$filter ) {
380
+		if ( ! empty( $criteria[ 'search_criteria' ][ 'field_filters' ] ) ) {
381
+			foreach ( $criteria[ 'search_criteria' ][ 'field_filters' ] as &$filter ) {
382 382
 
383 383
 				if ( ! is_array( $filter ) ) {
384 384
 					continue;
385 385
 				}
386 386
 
387 387
 				// By default, we want searches to be wildcard for each field.
388
-				$filter['operator'] = empty( $filter['operator'] ) ? 'contains' : $filter['operator'];
388
+				$filter[ 'operator' ] = empty( $filter[ 'operator' ] ) ? 'contains' : $filter[ 'operator' ];
389 389
 
390 390
 				/**
391 391
 				 * @filter `gravityview_search_operator` Modify the search operator for the field (contains, is, isnot, etc)
392 392
 				 * @param string $operator Existing search operator
393 393
 				 * @param array $filter array with `key`, `value`, `operator`, `type` keys
394 394
 				 */
395
-				$filter['operator'] = apply_filters( 'gravityview_search_operator', $filter['operator'], $filter );
395
+				$filter[ 'operator' ] = apply_filters( 'gravityview_search_operator', $filter[ 'operator' ], $filter );
396 396
 			}
397 397
 
398 398
 			// don't send just the [mode] without any field filter.
399
-			if( count( $criteria['search_criteria']['field_filters'] ) === 1 && array_key_exists( 'mode' , $criteria['search_criteria']['field_filters'] ) ) {
400
-				unset( $criteria['search_criteria']['field_filters']['mode'] );
399
+			if ( count( $criteria[ 'search_criteria' ][ 'field_filters' ] ) === 1 && array_key_exists( 'mode', $criteria[ 'search_criteria' ][ 'field_filters' ] ) ) {
400
+				unset( $criteria[ 'search_criteria' ][ 'field_filters' ][ 'mode' ] );
401 401
 			}
402 402
 
403 403
 		}
@@ -408,21 +408,21 @@  discard block
 block discarded – undo
408 408
 		 * Prepare date formats to be in Gravity Forms DB format;
409 409
 		 * $passed_criteria may include date formats incompatible with Gravity Forms.
410 410
 		 */
411
-		foreach ( array('start_date', 'end_date' ) as $key ) {
411
+		foreach ( array( 'start_date', 'end_date' ) as $key ) {
412 412
 
413
-			if ( ! empty( $criteria['search_criteria'][ $key ] ) ) {
413
+			if ( ! empty( $criteria[ 'search_criteria' ][ $key ] ) ) {
414 414
 
415 415
 				// Use date_create instead of new DateTime so it returns false if invalid date format.
416
-				$date = date_create( $criteria['search_criteria'][ $key ] );
416
+				$date = date_create( $criteria[ 'search_criteria' ][ $key ] );
417 417
 
418 418
 				if ( $date ) {
419 419
 					// Gravity Forms wants dates in the `Y-m-d H:i:s` format.
420
-					$criteria['search_criteria'][ $key ] = $date->format( 'Y-m-d H:i:s' );
420
+					$criteria[ 'search_criteria' ][ $key ] = $date->format( 'Y-m-d H:i:s' );
421 421
 				} else {
422 422
 					// If it's an invalid date, unset it. Gravity Forms freaks out otherwise.
423
-					unset( $criteria['search_criteria'][ $key ] );
423
+					unset( $criteria[ 'search_criteria' ][ $key ] );
424 424
 
425
-					do_action( 'gravityview_log_error', '[filter_get_entries_criteria] '.$key.' Date format not valid:', $criteria['search_criteria'][ $key ] );
425
+					do_action( 'gravityview_log_error', '[filter_get_entries_criteria] ' . $key . ' Date format not valid:', $criteria[ 'search_criteria' ][ $key ] );
426 426
 				}
427 427
 			}
428 428
 		}
@@ -430,12 +430,12 @@  discard block
 block discarded – undo
430 430
 
431 431
 		// When multiple views are embedded, OR single entry, calculate the context view id and send it to the advanced filter
432 432
 		if ( class_exists( 'GravityView_View_Data' ) && GravityView_View_Data::getInstance()->has_multiple_views() || GravityView_frontend::getInstance()->getSingleEntry() ) {
433
-			$criteria['context_view_id'] = GravityView_frontend::getInstance()->get_context_view_id();
433
+			$criteria[ 'context_view_id' ] = GravityView_frontend::getInstance()->get_context_view_id();
434 434
 		} elseif ( 'delete' === RGForms::get( 'action' ) ) {
435
-			$criteria['context_view_id'] = isset( $_GET['view_id'] ) ? intval( $_GET['view_id'] ) : null;
436
-		} elseif( !isset( $criteria['context_view_id'] ) ) {
435
+			$criteria[ 'context_view_id' ] = isset( $_GET[ 'view_id' ] ) ? intval( $_GET[ 'view_id' ] ) : null;
436
+		} elseif ( ! isset( $criteria[ 'context_view_id' ] ) ) {
437 437
             // Prevent overriding the Context View ID: Some widgets could set the context_view_id (e.g. Recent Entries widget)
438
-			$criteria['context_view_id'] = null;
438
+			$criteria[ 'context_view_id' ] = null;
439 439
 		}
440 440
 
441 441
 		/**
@@ -444,7 +444,7 @@  discard block
 block discarded – undo
444 444
 		 * @param array $form_ids Forms to search
445 445
 		 * @param int $view_id ID of the view being used to search
446 446
 		 */
447
-		$criteria = apply_filters( 'gravityview_search_criteria', $criteria, $form_ids, $criteria['context_view_id'] );
447
+		$criteria = apply_filters( 'gravityview_search_criteria', $criteria, $form_ids, $criteria[ 'context_view_id' ] );
448 448
 
449 449
 		return (array)$criteria;
450 450
 
@@ -475,7 +475,7 @@  discard block
 block discarded – undo
475 475
 		/** Reduce # of database calls */
476 476
 		add_filter( 'gform_is_encrypted_field', '__return_false' );
477 477
 
478
-		if ( ! empty( $criteria['cache'] ) ) {
478
+		if ( ! empty( $criteria[ 'cache' ] ) ) {
479 479
 
480 480
 			$Cache = new GravityView_Cache( $form_ids, $criteria );
481 481
 
@@ -483,7 +483,7 @@  discard block
 block discarded – undo
483 483
 
484 484
 				// Still update the total count when using cached results
485 485
 				if ( ! is_null( $total ) ) {
486
-					$total = GFAPI::count_entries( $form_ids, $criteria['search_criteria'] );
486
+					$total = GFAPI::count_entries( $form_ids, $criteria[ 'search_criteria' ] );
487 487
 				}
488 488
 
489 489
 				$return = $entries;
@@ -503,9 +503,9 @@  discard block
 block discarded – undo
503 503
 			$entries = apply_filters( 'gravityview_before_get_entries', null, $criteria, $passed_criteria, $total );
504 504
 
505 505
 			// No entries returned from gravityview_before_get_entries
506
-			if( is_null( $entries ) ) {
506
+			if ( is_null( $entries ) ) {
507 507
 
508
-				$entries = GFAPI::get_entries( $form_ids, $criteria['search_criteria'], $criteria['sorting'], $criteria['paging'], $total );
508
+				$entries = GFAPI::get_entries( $form_ids, $criteria[ 'search_criteria' ], $criteria[ 'sorting' ], $criteria[ 'paging' ], $total );
509 509
 
510 510
 				if ( is_wp_error( $entries ) ) {
511 511
 					do_action( 'gravityview_log_error', $entries->get_error_message(), $entries );
@@ -514,7 +514,7 @@  discard block
 block discarded – undo
514 514
 				}
515 515
 			}
516 516
 
517
-			if ( ! empty( $criteria['cache'] ) && isset( $Cache ) ) {
517
+			if ( ! empty( $criteria[ 'cache' ] ) && isset( $Cache ) ) {
518 518
 
519 519
 				// Cache results
520 520
 				$Cache->set( $entries, 'entries' );
@@ -619,7 +619,7 @@  discard block
 block discarded – undo
619 619
 			 */
620 620
 			$check_entry_display = apply_filters( 'gravityview/common/get_entry/check_entry_display', $check_entry_display, $entry );
621 621
 
622
-			if( $check_entry_display ) {
622
+			if ( $check_entry_display ) {
623 623
 				// Is the entry allowed
624 624
 				$entry = self::check_entry_display( $entry );
625 625
 			}
@@ -652,12 +652,12 @@  discard block
 block discarded – undo
652 652
 
653 653
 		$value = false;
654 654
 
655
-		if( 'context' === $val1 ) {
655
+		if ( 'context' === $val1 ) {
656 656
 
657 657
 			$matching_contexts = array( $val2 );
658 658
 
659 659
 			// We allow for non-standard contexts.
660
-			switch( $val2 ) {
660
+			switch ( $val2 ) {
661 661
 				// Check for either single or edit
662 662
 				case 'singular':
663 663
 					$matching_contexts = array( 'single', 'edit' );
@@ -717,7 +717,7 @@  discard block
 block discarded – undo
717 717
 			return false;
718 718
 		}
719 719
 
720
-		if ( empty( $entry['form_id'] ) ) {
720
+		if ( empty( $entry[ 'form_id' ] ) ) {
721 721
 			do_action( 'gravityview_log_debug', '[apply_filters_to_entry] Entry is empty! Entry:', $entry );
722 722
 			return false;
723 723
 		}
@@ -725,26 +725,26 @@  discard block
 block discarded – undo
725 725
 		$criteria = self::calculate_get_entries_criteria();
726 726
 
727 727
 		// Make sure the current View is connected to the same form as the Entry
728
-		if( ! empty( $criteria['context_view_id'] ) ) {
729
-			$context_view_id = intval( $criteria['context_view_id'] );
728
+		if ( ! empty( $criteria[ 'context_view_id' ] ) ) {
729
+			$context_view_id = intval( $criteria[ 'context_view_id' ] );
730 730
 			$context_form_id = gravityview_get_form_id( $context_view_id );
731
-			if( intval( $context_form_id ) !== intval( $entry['form_id'] ) ) {
732
-				do_action( 'gravityview_log_debug', sprintf( '[apply_filters_to_entry] Entry form ID does not match current View connected form ID:', $entry['form_id'] ), $criteria['context_view_id'] );
731
+			if ( intval( $context_form_id ) !== intval( $entry[ 'form_id' ] ) ) {
732
+				do_action( 'gravityview_log_debug', sprintf( '[apply_filters_to_entry] Entry form ID does not match current View connected form ID:', $entry[ 'form_id' ] ), $criteria[ 'context_view_id' ] );
733 733
 				return false;
734 734
 			}
735 735
 		}
736 736
 
737
-		if ( empty( $criteria['search_criteria'] ) || ! is_array( $criteria['search_criteria'] ) ) {
737
+		if ( empty( $criteria[ 'search_criteria' ] ) || ! is_array( $criteria[ 'search_criteria' ] ) ) {
738 738
 			do_action( 'gravityview_log_debug', '[apply_filters_to_entry] Entry approved! No search criteria found:', $criteria );
739 739
 			return $entry;
740 740
 		}
741 741
 
742
-		$search_criteria = $criteria['search_criteria'];
742
+		$search_criteria = $criteria[ 'search_criteria' ];
743 743
 		unset( $criteria );
744 744
 
745 745
 		// check entry status
746
-		if ( array_key_exists( 'status', $search_criteria ) && $search_criteria['status'] != $entry['status'] ) {
747
-			do_action( 'gravityview_log_debug', sprintf( '[apply_filters_to_entry] Entry status - %s - is not valid according to filter:', $entry['status'] ), $search_criteria );
746
+		if ( array_key_exists( 'status', $search_criteria ) && $search_criteria[ 'status' ] != $entry[ 'status' ] ) {
747
+			do_action( 'gravityview_log_debug', sprintf( '[apply_filters_to_entry] Entry status - %s - is not valid according to filter:', $entry[ 'status' ] ), $search_criteria );
748 748
 			return false;
749 749
 		}
750 750
 
@@ -752,39 +752,39 @@  discard block
 block discarded – undo
752 752
 		// @todo: Does it make sense to apply the Date create filters to the single entry?
753 753
 
754 754
 		// field_filters
755
-		if ( empty( $search_criteria['field_filters'] ) || ! is_array( $search_criteria['field_filters'] ) ) {
755
+		if ( empty( $search_criteria[ 'field_filters' ] ) || ! is_array( $search_criteria[ 'field_filters' ] ) ) {
756 756
 			do_action( 'gravityview_log_debug', '[apply_filters_to_entry] Entry approved! No field filters criteria found:', $search_criteria );
757 757
 			return $entry;
758 758
 		}
759 759
 
760
-		$filters = $search_criteria['field_filters'];
760
+		$filters = $search_criteria[ 'field_filters' ];
761 761
 		unset( $search_criteria );
762 762
 
763
-		$mode = array_key_exists( 'mode', $filters ) ? strtolower( $filters['mode'] ) : 'all';
764
-		unset( $filters['mode'] );
763
+		$mode = array_key_exists( 'mode', $filters ) ? strtolower( $filters[ 'mode' ] ) : 'all';
764
+		unset( $filters[ 'mode' ] );
765 765
 
766
-		$form = self::get_form( $entry['form_id'] );
766
+		$form = self::get_form( $entry[ 'form_id' ] );
767 767
 
768 768
 		foreach ( $filters as $filter ) {
769 769
 
770
-			if ( ! isset( $filter['key'] ) ) {
770
+			if ( ! isset( $filter[ 'key' ] ) ) {
771 771
 				continue;
772 772
 			}
773 773
 
774
-			$k = $filter['key'];
774
+			$k = $filter[ 'key' ];
775 775
 
776 776
 			if ( in_array( $k, array( 'created_by', 'payment_status' ) ) ) {
777 777
 				$field_value = $entry[ $k ];
778 778
 				$field = null;
779 779
 			} else {
780 780
 				$field = self::get_field( $form, $k );
781
-				$field_value  = GFFormsModel::get_lead_field_value( $entry, $field );
781
+				$field_value = GFFormsModel::get_lead_field_value( $entry, $field );
782 782
 				 // If it's a complex field, then fetch the input's value
783 783
 				$field_value = is_array( $field_value ) ? rgar( $field_value, $k ) : $field_value;
784 784
 			}
785 785
 
786
-			$operator = isset( $filter['operator'] ) ? strtolower( $filter['operator'] ) : 'is';
787
-			$is_value_match = GFFormsModel::is_value_match( $field_value, $filter['value'], $operator, $field );
786
+			$operator = isset( $filter[ 'operator' ] ) ? strtolower( $filter[ 'operator' ] ) : 'is';
787
+			$is_value_match = GFFormsModel::is_value_match( $field_value, $filter[ 'value' ], $operator, $field );
788 788
 
789 789
 			// verify if we are already free to go!
790 790
 			if ( ! $is_value_match && 'all' === $mode ) {
@@ -842,18 +842,18 @@  discard block
 block discarded – undo
842 842
 		 * Gravity Forms code to adjust date to locally-configured Time Zone
843 843
 		 * @see GFCommon::format_date() for original code
844 844
 		 */
845
-		$date_gmt_time   = mysql2date( 'G', $date_string );
845
+		$date_gmt_time = mysql2date( 'G', $date_string );
846 846
 		$date_local_timestamp = GFCommon::get_local_timestamp( $date_gmt_time );
847 847
 
848
-		$format  = rgar( $atts, 'format' );
849
-		$is_human  = ! empty( $atts['human'] );
850
-		$is_diff  = ! empty( $atts['diff'] );
851
-		$is_raw = ! empty( $atts['raw'] );
852
-		$is_timestamp = ! empty( $atts['timestamp'] );
853
-		$include_time = ! empty( $atts['time'] );
848
+		$format = rgar( $atts, 'format' );
849
+		$is_human = ! empty( $atts[ 'human' ] );
850
+		$is_diff = ! empty( $atts[ 'diff' ] );
851
+		$is_raw = ! empty( $atts[ 'raw' ] );
852
+		$is_timestamp = ! empty( $atts[ 'timestamp' ] );
853
+		$include_time = ! empty( $atts[ 'time' ] );
854 854
 
855 855
 		// If we're using time diff, we want to have a different default format
856
-		if( empty( $format ) ) {
856
+		if ( empty( $format ) ) {
857 857
 			/* translators: %s: relative time from now, used for generic date comparisons. "1 day ago", or "20 seconds ago" */
858 858
 			$format = $is_diff ? esc_html__( '%s ago', 'gravityview' ) : get_option( 'date_format' );
859 859
 		}
@@ -861,7 +861,7 @@  discard block
 block discarded – undo
861 861
 		// If raw was specified, don't modify the stored value
862 862
 		if ( $is_raw ) {
863 863
 			$formatted_date = $date_string;
864
-		} elseif( $is_timestamp ) {
864
+		} elseif ( $is_timestamp ) {
865 865
 			$formatted_date = $date_local_timestamp;
866 866
 		} elseif ( $is_diff ) {
867 867
 			$formatted_date = sprintf( $format, human_time_diff( $date_gmt_time ) );
@@ -895,7 +895,7 @@  discard block
 block discarded – undo
895 895
 
896 896
 		$label = rgar( $field, 'label' );
897 897
 
898
-		if( floor( $field_id ) !== floatval( $field_id ) ) {
898
+		if ( floor( $field_id ) !== floatval( $field_id ) ) {
899 899
 			$label = GFFormsModel::get_choice_text( $field, $field_value, $field_id );
900 900
 		}
901 901
 
@@ -923,7 +923,7 @@  discard block
 block discarded – undo
923 923
 			$form = GFAPI::get_form( $form );
924 924
 		}
925 925
 
926
-		if ( class_exists( 'GFFormsModel' ) ){
926
+		if ( class_exists( 'GFFormsModel' ) ) {
927 927
 			return GFFormsModel::get_field( $form, $field_id );
928 928
 		} else {
929 929
 			return null;
@@ -970,19 +970,19 @@  discard block
 block discarded – undo
970 970
 			$shortcodes = array();
971 971
 
972 972
 			preg_match_all( '/' . get_shortcode_regex() . '/s', $content, $matches, PREG_SET_ORDER );
973
-			if ( empty( $matches ) ){
973
+			if ( empty( $matches ) ) {
974 974
 				return false;
975 975
 			}
976 976
 
977 977
 			foreach ( $matches as $shortcode ) {
978
-				if ( $tag === $shortcode[2] ) {
978
+				if ( $tag === $shortcode[ 2 ] ) {
979 979
 
980 980
 					// Changed this to $shortcode instead of true so we get the parsed atts.
981
-					$shortcodes[] = $shortcode;
981
+					$shortcodes[ ] = $shortcode;
982 982
 
983
-				} else if ( isset( $shortcode[5] ) && $results = self::has_shortcode_r( $shortcode[5], $tag ) ) {
984
-					foreach( $results as $result ) {
985
-						$shortcodes[] = $result;
983
+				} else if ( isset( $shortcode[ 5 ] ) && $results = self::has_shortcode_r( $shortcode[ 5 ], $tag ) ) {
984
+					foreach ( $results as $result ) {
985
+						$shortcodes[ ] = $result;
986 986
 					}
987 987
 				}
988 988
 			}
@@ -1126,7 +1126,7 @@  discard block
 block discarded – undo
1126 1126
 	public static function get_directory_fields( $post_id, $apply_filter = true ) {
1127 1127
 		$fields = get_post_meta( $post_id, '_gravityview_directory_fields', true );
1128 1128
 
1129
-		if( $apply_filter ) {
1129
+		if ( $apply_filter ) {
1130 1130
 			/**
1131 1131
 			 * @filter `gravityview/configuration/fields` Filter the View fields' configuration array
1132 1132
 			 * @since 1.6.5
@@ -1149,7 +1149,7 @@  discard block
 block discarded – undo
1149 1149
 	 * @return string         html
1150 1150
 	 */
1151 1151
 	public static function get_sortable_fields( $formid, $current = '' ) {
1152
-		$output = '<option value="" ' . selected( '', $current, false ).'>' . esc_html__( 'Default', 'gravityview' ) .'</option>';
1152
+		$output = '<option value="" ' . selected( '', $current, false ) . '>' . esc_html__( 'Default', 'gravityview' ) . '</option>';
1153 1153
 
1154 1154
 		if ( empty( $formid ) ) {
1155 1155
 			return $output;
@@ -1162,11 +1162,11 @@  discard block
 block discarded – undo
1162 1162
 			$blacklist_field_types = apply_filters( 'gravityview_blacklist_field_types', array( 'list', 'textarea' ), null );
1163 1163
 
1164 1164
 			foreach ( $fields as $id => $field ) {
1165
-				if ( in_array( $field['type'], $blacklist_field_types ) ) {
1165
+				if ( in_array( $field[ 'type' ], $blacklist_field_types ) ) {
1166 1166
 					continue;
1167 1167
 				}
1168 1168
 
1169
-				$output .= '<option value="'. $id .'" '. selected( $id, $current, false ).'>'. esc_attr( $field['label'] ) .'</option>';
1169
+				$output .= '<option value="' . $id . '" ' . selected( $id, $current, false ) . '>' . esc_attr( $field[ 'label' ] ) . '</option>';
1170 1170
 			}
1171 1171
 		}
1172 1172
 
@@ -1201,9 +1201,9 @@  discard block
 block discarded – undo
1201 1201
 		$blacklist_field_types = apply_filters( 'gravityview_blacklist_field_types', $blacklist, NULL );
1202 1202
 
1203 1203
 		// TODO: Convert to using array_filter
1204
-		foreach( $fields as $id => $field ) {
1204
+		foreach ( $fields as $id => $field ) {
1205 1205
 
1206
-			if( in_array( $field['type'], $blacklist_field_types ) ) {
1206
+			if ( in_array( $field[ 'type' ], $blacklist_field_types ) ) {
1207 1207
 				unset( $fields[ $id ] );
1208 1208
 			}
1209 1209
 		}
@@ -1244,14 +1244,14 @@  discard block
 block discarded – undo
1244 1244
 	 * @param  int|array  $field field key or field array
1245 1245
 	 * @return boolean
1246 1246
 	 */
1247
-	public static function is_field_numeric(  $form = null, $field = '' ) {
1247
+	public static function is_field_numeric( $form = null, $field = '' ) {
1248 1248
 
1249 1249
 		if ( ! is_array( $form ) && ! is_array( $field ) ) {
1250 1250
 			$form = self::get_form( $form );
1251 1251
 		}
1252 1252
 
1253 1253
 		// If entry meta, it's a string. Otherwise, numeric
1254
-		if( ! is_numeric( $field ) && is_string( $field ) ) {
1254
+		if ( ! is_numeric( $field ) && is_string( $field ) ) {
1255 1255
 			$type = $field;
1256 1256
 		} else {
1257 1257
 			$type = self::get_field_type( $form, $field );
@@ -1265,9 +1265,9 @@  discard block
 block discarded – undo
1265 1265
 		$numeric_types = apply_filters( 'gravityview/common/numeric_types', array( 'number', 'time' ) );
1266 1266
 
1267 1267
 		// Defer to GravityView_Field setting, if the field type is registered and `is_numeric` is true
1268
-		if( $gv_field = GravityView_Fields::get( $type ) ) {
1269
-			if( true === $gv_field->is_numeric ) {
1270
-				$numeric_types[] = $gv_field->is_numeric;
1268
+		if ( $gv_field = GravityView_Fields::get( $type ) ) {
1269
+			if ( true === $gv_field->is_numeric ) {
1270
+				$numeric_types[ ] = $gv_field->is_numeric;
1271 1271
 			}
1272 1272
 		}
1273 1273
 
@@ -1417,18 +1417,18 @@  discard block
 block discarded – undo
1417 1417
 		$final_atts = array_filter( $final_atts );
1418 1418
 
1419 1419
 		// If the href wasn't passed as an attribute, use the value passed to the function
1420
-		if ( empty( $final_atts['href'] ) && ! empty( $href ) ) {
1421
-			$final_atts['href'] = $href;
1420
+		if ( empty( $final_atts[ 'href' ] ) && ! empty( $href ) ) {
1421
+			$final_atts[ 'href' ] = $href;
1422 1422
 		}
1423 1423
 
1424
-		$final_atts['href'] = esc_url_raw( $href );
1424
+		$final_atts[ 'href' ] = esc_url_raw( $href );
1425 1425
 
1426 1426
 		/**
1427 1427
 		 * Fix potential security issue with target=_blank
1428 1428
 		 * @see https://dev.to/ben/the-targetblank-vulnerability-by-example
1429 1429
 		 */
1430
-		if( '_blank' === rgar( $final_atts, 'target' ) ) {
1431
-			$final_atts['rel'] = trim( rgar( $final_atts, 'rel', '' ) . ' noopener noreferrer' );
1430
+		if ( '_blank' === rgar( $final_atts, 'target' ) ) {
1431
+			$final_atts[ 'rel' ] = trim( rgar( $final_atts, 'rel', '' ) . ' noopener noreferrer' );
1432 1432
 		}
1433 1433
 
1434 1434
 		// Sort the attributes alphabetically, to help testing
@@ -1440,7 +1440,7 @@  discard block
 block discarded – undo
1440 1440
 			$output .= sprintf( ' %s="%s"', $attr, esc_attr( $value ) );
1441 1441
 		}
1442 1442
 
1443
-		if( '' !== $output ) {
1443
+		if ( '' !== $output ) {
1444 1444
 			$output = '<a' . $output . '>' . $anchor_text . '</a>';
1445 1445
 		}
1446 1446
 
@@ -1467,7 +1467,7 @@  discard block
 block discarded – undo
1467 1467
 			if ( is_array( $value ) && isset( $merged[ $key ] ) && is_array( $merged[ $key ] ) ) {
1468 1468
 				$merged[ $key ] = self::array_merge_recursive_distinct( $merged[ $key ], $value );
1469 1469
 			} else if ( is_numeric( $key ) && isset( $merged[ $key ] ) ) {
1470
-				$merged[] = $value;
1470
+				$merged[ ] = $value;
1471 1471
 			} else {
1472 1472
 				$merged[ $key ] = $value;
1473 1473
 			}
@@ -1500,7 +1500,7 @@  discard block
 block discarded – undo
1500 1500
 		 * `$context` is where are we using this information (e.g. change_entry_creator, search_widget ..)
1501 1501
 		 * @param array $settings Settings array, with `number` key defining the # of users to display
1502 1502
 		 */
1503
-		$get_users_settings = apply_filters( 'gravityview/get_users/'. $context, apply_filters( 'gravityview_change_entry_creator_user_parameters', $get_users_settings ) );
1503
+		$get_users_settings = apply_filters( 'gravityview/get_users/' . $context, apply_filters( 'gravityview_change_entry_creator_user_parameters', $get_users_settings ) );
1504 1504
 
1505 1505
 		return get_users( $get_users_settings );
1506 1506
 	}
@@ -1520,11 +1520,11 @@  discard block
 block discarded – undo
1520 1520
     public static function generate_notice( $notice, $class = '', $cap = '', $object_id = null ) {
1521 1521
 
1522 1522
     	// If $cap is defined, only show notice if user has capability
1523
-    	if( $cap && ! GVCommon::has_cap( $cap, $object_id ) ) {
1523
+    	if ( $cap && ! GVCommon::has_cap( $cap, $object_id ) ) {
1524 1524
     		return '';
1525 1525
 	    }
1526 1526
 
1527
-        return '<div class="gv-notice '.gravityview_sanitize_html_class( $class ) .'">'. $notice .'</div>';
1527
+        return '<div class="gv-notice ' . gravityview_sanitize_html_class( $class ) . '">' . $notice . '</div>';
1528 1528
     }
1529 1529
 
1530 1530
 	/**
Please login to merge, or discard this patch.