Completed
Push — master ( 022e44...5d3455 )
by Zack
08:11 queued 31s
created
includes/connector-functions.php 1 patch
Doc Comments   +3 added lines, -5 removed lines patch added patch discarded remove patch
@@ -41,7 +41,6 @@  discard block
 block discarded – undo
41 41
  *
42 42
  * @see GVCommon::get_forms()
43 43
  * @access public
44
- * @param mixed $form_id
45 44
  * @return array (id, title)
46 45
  */
47 46
 function gravityview_get_forms() {
@@ -53,7 +52,7 @@  discard block
 block discarded – undo
53 52
  *
54 53
  * @see GVCommon::get_form_fields()
55 54
  * @access public
56
- * @param string|array $form_id (default: '') or $form object
55
+ * @param string|array $form (default: '') or $form object
57 56
  * @return array
58 57
  */
59 58
 function gravityview_get_form_fields( $form = '', $add_default_properties = false, $include_parent_field = true ) {
@@ -91,6 +90,7 @@  discard block
 block discarded – undo
91 90
  * @param int|array $form_ids The ID of the form or an array IDs of the Forms. Zero for all forms.
92 91
  * @param mixed $passed_criteria (default: null)
93 92
  * @param mixed &$total (default: null)
93
+ * @param integer $total
94 94
  * @return mixed False: Error fetching entries. Array: Multi-dimensional array of Gravity Forms entry arrays
95 95
  */
96 96
 function gravityview_get_entries( $form_ids = null, $passed_criteria = null, &$total = null ) {
@@ -103,7 +103,6 @@  discard block
 block discarded – undo
103 103
  * Since 1.4, supports custom entry slugs. The way that GravityView fetches an entry based on the custom slug is by searching `gravityview_unique_id` meta. The `$entry_slug` is fetched by getting the current query var set by `is_single_entry()`
104 104
  *
105 105
  * @access public
106
- * @param mixed $entry_id
107 106
  * @param boolean $force_allow_ids Force the get_entry() method to allow passed entry IDs, even if the `gravityview_custom_entry_slug_allow_id` filter returns false.
108 107
  * @param boolean $check_entry_display Check whether the entry is visible for the current View configuration. Default: true {@since 1.14}
109 108
  * @return array|boolean
@@ -177,7 +176,7 @@  discard block
 block discarded – undo
177 176
  *
178 177
  * @param int $view_id ID of the View you want the form of
179 178
  *
180
- * @return int
179
+ * @return string
181 180
  */
182 181
 function gravityview_get_form_id( $view_id ) {
183 182
 	return GVCommon::get_meta_form_id( $view_id );
@@ -188,7 +187,6 @@  discard block
 block discarded – undo
188 187
  *
189 188
  * @see GravityView_Template::template_id
190 189
  *
191
- * @param int $view_id The ID of the View to get the layout of
192 190
  *
193 191
  * @return string GravityView_Template::template_id value. Empty string if not.
194 192
  */
Please login to merge, or discard this patch.
includes/class-common.php 4 patches
Indentation   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -213,13 +213,13 @@  discard block
 block discarded – undo
213 213
 
214 214
 				if ( $add_default_properties && ! empty( $field['inputs'] ) ) {
215 215
 					foreach ( $field['inputs'] as $input ) {
216
-                        /**
217
-                         * @hack
218
-                         * In case of email/email confirmation, the input for email has the same id as the parent field
219
-                         */
220
-                        if( 'email' == rgar( $field, 'type' ) && false === strpos( $input['id'], '.' ) ) {
221
-                            continue;
222
-                        }
216
+						/**
217
+						 * @hack
218
+						 * In case of email/email confirmation, the input for email has the same id as the parent field
219
+						 */
220
+						if( 'email' == rgar( $field, 'type' ) && false === strpos( $input['id'], '.' ) ) {
221
+							continue;
222
+						}
223 223
 						$fields[ (string)$input['id'] ] = array(
224 224
 							'label' => rgar( $input, 'label' ),
225 225
 							'customLabel' => rgar( $input, 'customLabel' ),
@@ -466,7 +466,7 @@  discard block
 block discarded – undo
466 466
 		} elseif ( 'delete' === RGForms::get( 'action' ) ) {
467 467
 			$criteria['context_view_id'] = isset( $_GET['view_id'] ) ? $_GET['view_id'] : null;
468 468
 		} elseif( !isset( $criteria['context_view_id'] ) ) {
469
-            // Prevent overriding the Context View ID: Some widgets could set the context_view_id (e.g. Recent Entries widget)
469
+			// Prevent overriding the Context View ID: Some widgets could set the context_view_id (e.g. Recent Entries widget)
470 470
 			$criteria['context_view_id'] = null;
471 471
 		}
472 472
 
@@ -1082,7 +1082,7 @@  discard block
 block discarded – undo
1082 1082
 			),
1083 1083
 		);
1084 1084
 
1085
-        $fields = $date_created + $fields;
1085
+		$fields = $date_created + $fields;
1086 1086
 
1087 1087
 		$blacklist_field_types = apply_filters( 'gravityview_blacklist_field_types', $blacklist, NULL );
1088 1088
 
@@ -1094,13 +1094,13 @@  discard block
 block discarded – undo
1094 1094
 			}
1095 1095
 		}
1096 1096
 
1097
-        /**
1098
-         * @filter `gravityview/common/sortable_fields` Filter the sortable fields
1099
-         * @since 1.12
1100
-         * @param array $fields Sub-set of GF form fields that are sortable
1101
-         * @param int $formid The Gravity Forms form ID that the fields are from
1102
-         */
1103
-        $fields = apply_filters( 'gravityview/common/sortable_fields', $fields, $formid );
1097
+		/**
1098
+		 * @filter `gravityview/common/sortable_fields` Filter the sortable fields
1099
+		 * @since 1.12
1100
+		 * @param array $fields Sub-set of GF form fields that are sortable
1101
+		 * @param int $formid The Gravity Forms form ID that the fields are from
1102
+		 */
1103
+		$fields = apply_filters( 'gravityview/common/sortable_fields', $fields, $formid );
1104 1104
 
1105 1105
 		return $fields;
1106 1106
 	}
@@ -1365,17 +1365,17 @@  discard block
 block discarded – undo
1365 1365
 	}
1366 1366
 
1367 1367
 
1368
-    /**
1369
-     * Display updated/error notice
1370
-     *
1371
-     * @param string $notice text/HTML of notice
1372
-     * @param string $class CSS class for notice (`updated` or `error`)
1373
-     *
1374
-     * @return string
1375
-     */
1376
-    public static function generate_notice( $notice, $class = '' ) {
1377
-        return '<div class="gv-notice '.gravityview_sanitize_html_class( $class ) .'">'. $notice .'</div>';
1378
-    }
1368
+	/**
1369
+	 * Display updated/error notice
1370
+	 *
1371
+	 * @param string $notice text/HTML of notice
1372
+	 * @param string $class CSS class for notice (`updated` or `error`)
1373
+	 *
1374
+	 * @return string
1375
+	 */
1376
+	public static function generate_notice( $notice, $class = '' ) {
1377
+		return '<div class="gv-notice '.gravityview_sanitize_html_class( $class ) .'">'. $notice .'</div>';
1378
+	}
1379 1379
 
1380 1380
 
1381 1381
 
Please login to merge, or discard this patch.
Doc Comments   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -167,7 +167,6 @@  discard block
 block discarded – undo
167 167
 	 * Returns the list of available forms
168 168
 	 *
169 169
 	 * @access public
170
-	 * @param mixed $form_id
171 170
 	 * @return array Empty array if GFAPI isn't available or no forms. Otherwise, associative array with id, title keys
172 171
 	 */
173 172
 	public static function get_forms() {
@@ -188,7 +187,7 @@  discard block
 block discarded – undo
188 187
 	 * Return array of fields' id and label, for a given Form ID
189 188
 	 *
190 189
 	 * @access public
191
-	 * @param string|array $form_id (default: '') or $form object
190
+	 * @param string|array $form (default: '') or $form object
192 191
 	 * @return array
193 192
 	 */
194 193
 	public static function get_form_fields( $form = '', $add_default_properties = false, $include_parent_field = true ) {
Please login to merge, or discard this patch.
Braces   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -290,7 +290,7 @@  discard block
 block discarded – undo
290 290
 					$has_poll_fields = true;
291 291
 				}
292 292
 
293
-				if( GFCommon::is_product_field( $field['type'] ) ){
293
+				if( GFCommon::is_product_field( $field['type'] ) ) {
294 294
 					$has_product_fields = true;
295 295
 				}
296 296
 
@@ -373,7 +373,7 @@  discard block
 block discarded – undo
373 373
 
374 374
 		$fields = array();
375 375
 
376
-		foreach ( $extra_fields as $key => $field ){
376
+		foreach ( $extra_fields as $key => $field ) {
377 377
 			if ( ! empty( $only_default_column ) && ! empty( $field['is_default_column'] ) ) {
378 378
 				$fields[ $key ] = array( 'label' => $field['label'], 'type' => 'entry_meta' );
379 379
 			}
@@ -913,7 +913,7 @@  discard block
 block discarded – undo
913 913
 	 * @return array|null Array: Gravity Forms field array; NULL: Gravity Forms GFFormsModel does not exist
914 914
 	 */
915 915
 	public static function get_field( $form, $field_id ) {
916
-		if ( class_exists( 'GFFormsModel' ) ){
916
+		if ( class_exists( 'GFFormsModel' ) ) {
917 917
 			return GFFormsModel::get_field( $form, $field_id );
918 918
 		} else {
919 919
 			return null;
@@ -960,7 +960,7 @@  discard block
 block discarded – undo
960 960
 			$shortcodes = array();
961 961
 
962 962
 			preg_match_all( '/' . get_shortcode_regex() . '/s', $content, $matches, PREG_SET_ORDER );
963
-			if ( empty( $matches ) ){
963
+			if ( empty( $matches ) ) {
964 964
 				return false;
965 965
 			}
966 966
 
@@ -1423,7 +1423,7 @@  discard block
 block discarded – undo
1423 1423
 	public static function array_merge_recursive_distinct( array &$array1, array &$array2 ) {
1424 1424
 		$merged = $array1;
1425 1425
 
1426
-		foreach ( $array2 as $key => &$value )  {
1426
+		foreach ( $array2 as $key => &$value ) {
1427 1427
 			if ( is_array( $value ) && isset( $merged[ $key ] ) && is_array( $merged[ $key ] ) ) {
1428 1428
 				$merged[ $key ] = self::array_merge_recursive_distinct( $merged[ $key ], $value );
1429 1429
 			} else {
Please login to merge, or discard this patch.
Spacing   +109 added lines, -109 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
 	}
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
 
176 176
 		$results = GFAPI::get_entries( 0, $search_criteria, null, $paging );
177 177
 
178
-		$result = ( ! empty( $results ) && ! empty( $results[0]['id'] ) ) ? $results[0]['id'] : null;
178
+		$result = ( ! empty( $results ) && ! empty( $results[ 0 ][ 'id' ] ) ) ? $results[ 0 ][ 'id' ] : null;
179 179
 
180 180
 		return $result;
181 181
 	}
@@ -193,9 +193,9 @@  discard block
 block discarded – undo
193 193
 		if ( class_exists( 'GFAPI' ) ) {
194 194
 			$gf_forms = GFAPI::get_forms();
195 195
 			foreach ( $gf_forms as $form ) {
196
-				$forms[] = array(
197
-					'id' => $form['id'],
198
-					'title' => $form['title'],
196
+				$forms[ ] = array(
197
+					'id' => $form[ 'id' ],
198
+					'title' => $form[ 'title' ],
199 199
 				);
200 200
 			}
201 201
 		}
@@ -227,9 +227,9 @@  discard block
 block discarded – undo
227 227
 		}
228 228
 
229 229
 		if ( $form ) {
230
-			foreach ( $form['fields'] as $field ) {
231
-				if ( $include_parent_field || empty( $field['inputs'] ) ) {
232
-					$fields[ $field['id'] ] = array(
230
+			foreach ( $form[ 'fields' ] as $field ) {
231
+				if ( $include_parent_field || empty( $field[ 'inputs' ] ) ) {
232
+					$fields[ $field[ 'id' ] ] = array(
233 233
 						'label' => rgar( $field, 'label' ),
234 234
 						'parent' => null,
235 235
 						'type' => rgar( $field, 'type' ),
@@ -238,16 +238,16 @@  discard block
 block discarded – undo
238 238
 					);
239 239
 				}
240 240
 
241
-				if ( $add_default_properties && ! empty( $field['inputs'] ) ) {
242
-					foreach ( $field['inputs'] as $input ) {
241
+				if ( $add_default_properties && ! empty( $field[ 'inputs' ] ) ) {
242
+					foreach ( $field[ 'inputs' ] as $input ) {
243 243
                         /**
244 244
                          * @hack
245 245
                          * In case of email/email confirmation, the input for email has the same id as the parent field
246 246
                          */
247
-                        if( 'email' == rgar( $field, 'type' ) && false === strpos( $input['id'], '.' ) ) {
247
+                        if ( 'email' == rgar( $field, 'type' ) && false === strpos( $input[ 'id' ], '.' ) ) {
248 248
                             continue;
249 249
                         }
250
-						$fields[ (string)$input['id'] ] = array(
250
+						$fields[ (string)$input[ 'id' ] ] = array(
251 251
 							'label' => rgar( $input, 'label' ),
252 252
 							'customLabel' => rgar( $input, 'customLabel' ),
253 253
 							'parent' => $field,
@@ -259,11 +259,11 @@  discard block
 block discarded – undo
259 259
 				}
260 260
 
261 261
 				/** @since 1.14 */
262
-				if( 'list' === $field['type'] && !empty( $field['enableColumns'] ) ) {
262
+				if ( 'list' === $field[ 'type' ] && ! empty( $field[ 'enableColumns' ] ) ) {
263 263
 
264
-					foreach ( (array)$field['choices'] as $key => $input ) {
264
+					foreach ( (array)$field[ 'choices' ] as $key => $input ) {
265 265
 
266
-						$input_id = sprintf( '%d.%d', $field['id'], $key ); // {field_id}.{column_key}
266
+						$input_id = sprintf( '%d.%d', $field[ 'id' ], $key ); // {field_id}.{column_key}
267 267
 
268 268
 						$fields[ $input_id ] = array(
269 269
 							'label'       => rgar( $input, 'text' ),
@@ -279,25 +279,25 @@  discard block
 block discarded – undo
279 279
 				/**
280 280
 				 * @since 1.8
281 281
 				 */
282
-				if( 'quiz' === $field['type'] ) {
282
+				if ( 'quiz' === $field[ 'type' ] ) {
283 283
 					$has_quiz_fields = true;
284 284
 				}
285 285
 
286 286
 				/**
287 287
 				 * @since 1.8
288 288
 				 */
289
-				if( 'poll' === $field['type'] ) {
289
+				if ( 'poll' === $field[ 'type' ] ) {
290 290
 					$has_poll_fields = true;
291 291
 				}
292 292
 
293
-				if( GFCommon::is_product_field( $field['type'] ) ){
293
+				if ( GFCommon::is_product_field( $field[ 'type' ] ) ) {
294 294
 					$has_product_fields = true;
295 295
 				}
296 296
 
297 297
 				/**
298 298
 				 * @hack Version 1.9
299 299
 				 */
300
-				$field_for_is_post_field = class_exists( 'GF_Fields' ) ? (object) $field : (array) $field;
300
+				$field_for_is_post_field = class_exists( 'GF_Fields' ) ? (object)$field : (array)$field;
301 301
 
302 302
 				if ( GFCommon::is_post_field( $field_for_is_post_field ) ) {
303 303
 					$has_post_fields = true;
@@ -309,7 +309,7 @@  discard block
 block discarded – undo
309 309
 		 * @since 1.7
310 310
 		 */
311 311
 		if ( $has_post_fields ) {
312
-			$fields['post_id'] = array(
312
+			$fields[ 'post_id' ] = array(
313 313
 				'label' => __( 'Post ID', 'gravityview' ),
314 314
 				'type' => 'post_id',
315 315
 			);
@@ -320,10 +320,10 @@  discard block
 block discarded – undo
320 320
 			$payment_fields = GravityView_Fields::get_all( 'pricing' );
321 321
 
322 322
 			foreach ( $payment_fields as $payment_field ) {
323
-				if( isset( $fields["{$payment_field->name}"] ) ) {
323
+				if ( isset( $fields[ "{$payment_field->name}" ] ) ) {
324 324
 					continue;
325 325
 				}
326
-				$fields["{$payment_field->name}"] = array(
326
+				$fields[ "{$payment_field->name}" ] = array(
327 327
 					'label' => $payment_field->label,
328 328
 					'desc' => $payment_field->description,
329 329
 					'type' => $payment_field->name,
@@ -334,25 +334,25 @@  discard block
 block discarded – undo
334 334
 		/**
335 335
 		 * @since 1.8
336 336
 		 */
337
-		if( $has_quiz_fields ) {
337
+		if ( $has_quiz_fields ) {
338 338
 
339
-			$fields['gquiz_score']   = array(
339
+			$fields[ 'gquiz_score' ] = array(
340 340
 				'label' => __( 'Quiz Score Total', 'gravityview' ),
341 341
 				'type'  => 'quiz_score',
342 342
 				'desc'  => __( 'Displays the number of correct Quiz answers the user submitted.', 'gravityview' ),
343 343
 			);
344
-			$fields['gquiz_percent'] = array(
344
+			$fields[ 'gquiz_percent' ] = array(
345 345
 				'label' => __( 'Quiz Percentage Grade', 'gravityview' ),
346 346
 				'type'  => 'quiz_percent',
347 347
 				'desc'  => __( 'Displays the percentage of correct Quiz answers the user submitted.', 'gravityview' ),
348 348
 			);
349
-			$fields['gquiz_grade']   = array(
349
+			$fields[ 'gquiz_grade' ] = array(
350 350
 				/* translators: This is a field type used by the Gravity Forms Quiz Addon. "A" is 100-90, "B" is 89-80, "C" is 79-70, etc.  */
351 351
 				'label' => __( 'Quiz Letter Grade', 'gravityview' ),
352 352
 				'type'  => 'quiz_grade',
353 353
 				'desc'  => __( 'Displays the Grade the user achieved based on Letter Grading configured in the Quiz Settings.', 'gravityview' ),
354 354
 			);
355
-			$fields['gquiz_is_pass'] = array(
355
+			$fields[ 'gquiz_is_pass' ] = array(
356 356
 				'label' => __( 'Quiz Pass/Fail', 'gravityview' ),
357 357
 				'type'  => 'quiz_is_pass',
358 358
 				'desc'  => __( 'Displays either Passed or Failed based on the Pass/Fail settings configured in the Quiz Settings.', 'gravityview' ),
@@ -374,9 +374,9 @@  discard block
 block discarded – undo
374 374
 
375 375
 		$fields = array();
376 376
 
377
-		foreach ( $extra_fields as $key => $field ){
378
-			if ( ! empty( $only_default_column ) && ! empty( $field['is_default_column'] ) ) {
379
-				$fields[ $key ] = array( 'label' => $field['label'], 'type' => 'entry_meta' );
377
+		foreach ( $extra_fields as $key => $field ) {
378
+			if ( ! empty( $only_default_column ) && ! empty( $field[ 'is_default_column' ] ) ) {
379
+				$fields[ $key ] = array( 'label' => $field[ 'label' ], 'type' => 'entry_meta' );
380 380
 			}
381 381
 		}
382 382
 
@@ -416,32 +416,32 @@  discard block
 block discarded – undo
416 416
 			'search_criteria' => null,
417 417
 			'sorting' => null,
418 418
 			'paging' => null,
419
-			'cache' => (isset( $passed_criteria['cache'] ) ? $passed_criteria['cache'] : true),
419
+			'cache' => ( isset( $passed_criteria[ 'cache' ] ) ? $passed_criteria[ 'cache' ] : true ),
420 420
 		);
421 421
 
422 422
 		$criteria = wp_parse_args( $passed_criteria, $search_criteria_defaults );
423 423
 
424
-		if ( ! empty( $criteria['search_criteria']['field_filters'] ) ) {
425
-			foreach ( $criteria['search_criteria']['field_filters'] as &$filter ) {
424
+		if ( ! empty( $criteria[ 'search_criteria' ][ 'field_filters' ] ) ) {
425
+			foreach ( $criteria[ 'search_criteria' ][ 'field_filters' ] as &$filter ) {
426 426
 
427 427
 				if ( ! is_array( $filter ) ) {
428 428
 					continue;
429 429
 				}
430 430
 
431 431
 				// By default, we want searches to be wildcard for each field.
432
-				$filter['operator'] = empty( $filter['operator'] ) ? 'contains' : $filter['operator'];
432
+				$filter[ 'operator' ] = empty( $filter[ 'operator' ] ) ? 'contains' : $filter[ 'operator' ];
433 433
 
434 434
 				/**
435 435
 				 * @filter `gravityview_search_operator` Modify the search operator for the field (contains, is, isnot, etc)
436 436
 				 * @param string $operator Existing search operator
437 437
 				 * @param array $filter array with `key`, `value`, `operator`, `type` keys
438 438
 				 */
439
-				$filter['operator'] = apply_filters( 'gravityview_search_operator', $filter['operator'], $filter );
439
+				$filter[ 'operator' ] = apply_filters( 'gravityview_search_operator', $filter[ 'operator' ], $filter );
440 440
 			}
441 441
 
442 442
 			// don't send just the [mode] without any field filter.
443
-			if( count( $criteria['search_criteria']['field_filters'] ) === 1 && array_key_exists( 'mode' , $criteria['search_criteria']['field_filters'] ) ) {
444
-				unset( $criteria['search_criteria']['field_filters']['mode'] );
443
+			if ( count( $criteria[ 'search_criteria' ][ 'field_filters' ] ) === 1 && array_key_exists( 'mode', $criteria[ 'search_criteria' ][ 'field_filters' ] ) ) {
444
+				unset( $criteria[ 'search_criteria' ][ 'field_filters' ][ 'mode' ] );
445 445
 			}
446 446
 
447 447
 		}
@@ -452,21 +452,21 @@  discard block
 block discarded – undo
452 452
 		 * Prepare date formats to be in Gravity Forms DB format;
453 453
 		 * $passed_criteria may include date formats incompatible with Gravity Forms.
454 454
 		 */
455
-		foreach ( array('start_date', 'end_date' ) as $key ) {
455
+		foreach ( array( 'start_date', 'end_date' ) as $key ) {
456 456
 
457
-			if ( ! empty( $criteria['search_criteria'][ $key ] ) ) {
457
+			if ( ! empty( $criteria[ 'search_criteria' ][ $key ] ) ) {
458 458
 
459 459
 				// Use date_create instead of new DateTime so it returns false if invalid date format.
460
-				$date = date_create( $criteria['search_criteria'][ $key ] );
460
+				$date = date_create( $criteria[ 'search_criteria' ][ $key ] );
461 461
 
462 462
 				if ( $date ) {
463 463
 					// Gravity Forms wants dates in the `Y-m-d H:i:s` format.
464
-					$criteria['search_criteria'][ $key ] = $date->format( 'Y-m-d H:i:s' );
464
+					$criteria[ 'search_criteria' ][ $key ] = $date->format( 'Y-m-d H:i:s' );
465 465
 				} else {
466 466
 					// If it's an invalid date, unset it. Gravity Forms freaks out otherwise.
467
-					unset( $criteria['search_criteria'][ $key ] );
467
+					unset( $criteria[ 'search_criteria' ][ $key ] );
468 468
 
469
-					do_action( 'gravityview_log_error', '[filter_get_entries_criteria] '.$key.' Date format not valid:', $criteria['search_criteria'][ $key ] );
469
+					do_action( 'gravityview_log_error', '[filter_get_entries_criteria] ' . $key . ' Date format not valid:', $criteria[ 'search_criteria' ][ $key ] );
470 470
 				}
471 471
 			}
472 472
 		}
@@ -474,12 +474,12 @@  discard block
 block discarded – undo
474 474
 
475 475
 		// When multiple views are embedded, OR single entry, calculate the context view id and send it to the advanced filter
476 476
 		if ( class_exists( 'GravityView_View_Data' ) && GravityView_View_Data::getInstance()->has_multiple_views() || GravityView_frontend::getInstance()->getSingleEntry() ) {
477
-			$criteria['context_view_id'] = GravityView_frontend::getInstance()->get_context_view_id();
477
+			$criteria[ 'context_view_id' ] = GravityView_frontend::getInstance()->get_context_view_id();
478 478
 		} elseif ( 'delete' === RGForms::get( 'action' ) ) {
479
-			$criteria['context_view_id'] = isset( $_GET['view_id'] ) ? $_GET['view_id'] : null;
480
-		} elseif( !isset( $criteria['context_view_id'] ) ) {
479
+			$criteria[ 'context_view_id' ] = isset( $_GET[ 'view_id' ] ) ? $_GET[ 'view_id' ] : null;
480
+		} elseif ( ! isset( $criteria[ 'context_view_id' ] ) ) {
481 481
             // Prevent overriding the Context View ID: Some widgets could set the context_view_id (e.g. Recent Entries widget)
482
-			$criteria['context_view_id'] = null;
482
+			$criteria[ 'context_view_id' ] = null;
483 483
 		}
484 484
 
485 485
 		/**
@@ -488,7 +488,7 @@  discard block
 block discarded – undo
488 488
 		 * @param array $form_ids Forms to search
489 489
 		 * @param int $view_id ID of the view being used to search
490 490
 		 */
491
-		$criteria = apply_filters( 'gravityview_search_criteria', $criteria, $form_ids, $criteria['context_view_id'] );
491
+		$criteria = apply_filters( 'gravityview_search_criteria', $criteria, $form_ids, $criteria[ 'context_view_id' ] );
492 492
 
493 493
 		return (array)$criteria;
494 494
 
@@ -519,7 +519,7 @@  discard block
 block discarded – undo
519 519
 		/** Reduce # of database calls */
520 520
 		add_filter( 'gform_is_encrypted_field', '__return_false' );
521 521
 
522
-		if ( ! empty( $criteria['cache'] ) ) {
522
+		if ( ! empty( $criteria[ 'cache' ] ) ) {
523 523
 
524 524
 			$Cache = new GravityView_Cache( $form_ids, $criteria );
525 525
 
@@ -527,7 +527,7 @@  discard block
 block discarded – undo
527 527
 
528 528
 				// Still update the total count when using cached results
529 529
 				if ( ! is_null( $total ) ) {
530
-					$total = GFAPI::count_entries( $form_ids, $criteria['search_criteria'] );
530
+					$total = GFAPI::count_entries( $form_ids, $criteria[ 'search_criteria' ] );
531 531
 				}
532 532
 
533 533
 				$return = $entries;
@@ -547,9 +547,9 @@  discard block
 block discarded – undo
547 547
 			$entries = apply_filters( 'gravityview_before_get_entries', null, $criteria, $passed_criteria, $total );
548 548
 
549 549
 			// No entries returned from gravityview_before_get_entries
550
-			if( is_null( $entries ) ) {
550
+			if ( is_null( $entries ) ) {
551 551
 
552
-				$entries = GFAPI::get_entries( $form_ids, $criteria['search_criteria'], $criteria['sorting'], $criteria['paging'], $total );
552
+				$entries = GFAPI::get_entries( $form_ids, $criteria[ 'search_criteria' ], $criteria[ 'sorting' ], $criteria[ 'paging' ], $total );
553 553
 
554 554
 				if ( is_wp_error( $entries ) ) {
555 555
 					do_action( 'gravityview_log_error', $entries->get_error_message(), $entries );
@@ -558,7 +558,7 @@  discard block
 block discarded – undo
558 558
 				}
559 559
 			}
560 560
 
561
-			if ( ! empty( $criteria['cache'] ) && isset( $Cache ) ) {
561
+			if ( ! empty( $criteria[ 'cache' ] ) && isset( $Cache ) ) {
562 562
 
563 563
 				// Cache results
564 564
 				$Cache->set( $entries, 'entries' );
@@ -645,7 +645,7 @@  discard block
 block discarded – undo
645 645
 			 */
646 646
 			$check_entry_display = apply_filters( 'gravityview/common/get_entry/check_entry_display', $check_entry_display, $entry );
647 647
 
648
-			if( $check_entry_display ) {
648
+			if ( $check_entry_display ) {
649 649
 				// Is the entry allowed
650 650
 				$entry = self::check_entry_display( $entry );
651 651
 			}
@@ -678,12 +678,12 @@  discard block
 block discarded – undo
678 678
 
679 679
 		$value = false;
680 680
 
681
-		if( 'context' === $val1 ) {
681
+		if ( 'context' === $val1 ) {
682 682
 
683 683
 			$matching_contexts = array( $val2 );
684 684
 
685 685
 			// We allow for non-standard contexts.
686
-			switch( $val2 ) {
686
+			switch ( $val2 ) {
687 687
 				// Check for either single or edit
688 688
 				case 'singular':
689 689
 					$matching_contexts = array( 'single', 'edit' );
@@ -743,7 +743,7 @@  discard block
 block discarded – undo
743 743
 			return false;
744 744
 		}
745 745
 
746
-		if ( empty( $entry['form_id'] ) ) {
746
+		if ( empty( $entry[ 'form_id' ] ) ) {
747 747
 			do_action( 'gravityview_log_debug', '[apply_filters_to_entry] Entry is empty! Entry:', $entry );
748 748
 			return false;
749 749
 		}
@@ -751,26 +751,26 @@  discard block
 block discarded – undo
751 751
 		$criteria = self::calculate_get_entries_criteria();
752 752
 
753 753
 		// Make sure the current View is connected to the same form as the Entry
754
-		if( ! empty( $criteria['context_view_id'] ) ) {
755
-			$context_view_id = intval( $criteria['context_view_id'] );
754
+		if ( ! empty( $criteria[ 'context_view_id' ] ) ) {
755
+			$context_view_id = intval( $criteria[ 'context_view_id' ] );
756 756
 			$context_form_id = gravityview_get_form_id( $context_view_id );
757
-			if( intval( $context_form_id ) !== intval( $entry['form_id'] ) ) {
758
-				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'] );
757
+			if ( intval( $context_form_id ) !== intval( $entry[ 'form_id' ] ) ) {
758
+				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' ] );
759 759
 				return false;
760 760
 			}
761 761
 		}
762 762
 
763
-		if ( empty( $criteria['search_criteria'] ) || ! is_array( $criteria['search_criteria'] ) ) {
763
+		if ( empty( $criteria[ 'search_criteria' ] ) || ! is_array( $criteria[ 'search_criteria' ] ) ) {
764 764
 			do_action( 'gravityview_log_debug', '[apply_filters_to_entry] Entry approved! No search criteria found:', $criteria );
765 765
 			return $entry;
766 766
 		}
767 767
 
768
-		$search_criteria = $criteria['search_criteria'];
768
+		$search_criteria = $criteria[ 'search_criteria' ];
769 769
 		unset( $criteria );
770 770
 
771 771
 		// check entry status
772
-		if ( array_key_exists( 'status', $search_criteria ) && $search_criteria['status'] != $entry['status'] ) {
773
-			do_action( 'gravityview_log_debug', sprintf( '[apply_filters_to_entry] Entry status - %s - is not valid according to filter:', $entry['status'] ), $search_criteria );
772
+		if ( array_key_exists( 'status', $search_criteria ) && $search_criteria[ 'status' ] != $entry[ 'status' ] ) {
773
+			do_action( 'gravityview_log_debug', sprintf( '[apply_filters_to_entry] Entry status - %s - is not valid according to filter:', $entry[ 'status' ] ), $search_criteria );
774 774
 			return false;
775 775
 		}
776 776
 
@@ -778,37 +778,37 @@  discard block
 block discarded – undo
778 778
 		// @todo: Does it make sense to apply the Date create filters to the single entry?
779 779
 
780 780
 		// field_filters
781
-		if ( empty( $search_criteria['field_filters'] ) || ! is_array( $search_criteria['field_filters'] ) ) {
781
+		if ( empty( $search_criteria[ 'field_filters' ] ) || ! is_array( $search_criteria[ 'field_filters' ] ) ) {
782 782
 			do_action( 'gravityview_log_debug', '[apply_filters_to_entry] Entry approved! No field filters criteria found:', $search_criteria );
783 783
 			return $entry;
784 784
 		}
785 785
 
786
-		$filters = $search_criteria['field_filters'];
786
+		$filters = $search_criteria[ 'field_filters' ];
787 787
 		unset( $search_criteria );
788 788
 
789
-		$mode = array_key_exists( 'mode', $filters ) ? strtolower( $filters['mode'] ) : 'all';
790
-		unset( $filters['mode'] );
789
+		$mode = array_key_exists( 'mode', $filters ) ? strtolower( $filters[ 'mode' ] ) : 'all';
790
+		unset( $filters[ 'mode' ] );
791 791
 
792
-		$form = self::get_form( $entry['form_id'] );
792
+		$form = self::get_form( $entry[ 'form_id' ] );
793 793
 
794 794
 		foreach ( $filters as $filter ) {
795 795
 
796
-			if ( ! isset( $filter['key'] ) ) {
796
+			if ( ! isset( $filter[ 'key' ] ) ) {
797 797
 				continue;
798 798
 			}
799 799
 
800
-			$k = $filter['key'];
800
+			$k = $filter[ 'key' ];
801 801
 
802 802
 			if ( in_array( $k, array( 'created_by', 'payment_status' ) ) ) {
803 803
 				$field_value = $entry[ $k ];
804 804
 				$field = null;
805 805
 			} else {
806 806
 				$field = self::get_field( $form, $k );
807
-				$field_value  = GFFormsModel::get_lead_field_value( $entry, $field );
807
+				$field_value = GFFormsModel::get_lead_field_value( $entry, $field );
808 808
 			}
809 809
 
810
-			$operator = isset( $filter['operator'] ) ? strtolower( $filter['operator'] ) : 'is';
811
-			$is_value_match = GFFormsModel::is_value_match( $field_value, $filter['value'], $operator, $field );
810
+			$operator = isset( $filter[ 'operator' ] ) ? strtolower( $filter[ 'operator' ] ) : 'is';
811
+			$is_value_match = GFFormsModel::is_value_match( $field_value, $filter[ 'value' ], $operator, $field );
812 812
 
813 813
 			// verify if we are already free to go!
814 814
 			if ( ! $is_value_match && 'all' === $mode ) {
@@ -866,18 +866,18 @@  discard block
 block discarded – undo
866 866
 		 * Gravity Forms code to adjust date to locally-configured Time Zone
867 867
 		 * @see GFCommon::format_date() for original code
868 868
 		 */
869
-		$date_gmt_time   = mysql2date( 'G', $date_string );
869
+		$date_gmt_time = mysql2date( 'G', $date_string );
870 870
 		$date_local_timestamp = GFCommon::get_local_timestamp( $date_gmt_time );
871 871
 
872
-		$format  = rgar( $atts, 'format' );
873
-		$is_human  = ! empty( $atts['human'] );
874
-		$is_diff  = ! empty( $atts['diff'] );
875
-		$is_raw = ! empty( $atts['raw'] );
876
-		$is_timestamp = ! empty( $atts['timestamp'] );
877
-		$include_time = ! empty( $atts['time'] );
872
+		$format = rgar( $atts, 'format' );
873
+		$is_human = ! empty( $atts[ 'human' ] );
874
+		$is_diff = ! empty( $atts[ 'diff' ] );
875
+		$is_raw = ! empty( $atts[ 'raw' ] );
876
+		$is_timestamp = ! empty( $atts[ 'timestamp' ] );
877
+		$include_time = ! empty( $atts[ 'time' ] );
878 878
 
879 879
 		// If we're using time diff, we want to have a different default format
880
-		if( empty( $format ) ) {
880
+		if ( empty( $format ) ) {
881 881
 			/* translators: %s: relative time from now, used for generic date comparisons. "1 day ago", or "20 seconds ago" */
882 882
 			$format = $is_diff ? esc_html__( '%s ago', 'gravityview' ) : get_option( 'date_format' );
883 883
 		}
@@ -885,7 +885,7 @@  discard block
 block discarded – undo
885 885
 		// If raw was specified, don't modify the stored value
886 886
 		if ( $is_raw ) {
887 887
 			$formatted_date = $date_string;
888
-		} elseif( $is_timestamp ) {
888
+		} elseif ( $is_timestamp ) {
889 889
 			$formatted_date = $date_local_timestamp;
890 890
 		} elseif ( $is_diff ) {
891 891
 			$formatted_date = sprintf( $format, human_time_diff( $date_gmt_time ) );
@@ -913,7 +913,7 @@  discard block
 block discarded – undo
913 913
 		}
914 914
 
915 915
 		$field = self::get_field( $form, $field_id );
916
-		return isset( $field['label'] ) ?  $field['label'] : '';
916
+		return isset( $field[ 'label' ] ) ? $field[ 'label' ] : '';
917 917
 
918 918
 	}
919 919
 
@@ -931,7 +931,7 @@  discard block
 block discarded – undo
931 931
 	 * @return array|null Array: Gravity Forms field array; NULL: Gravity Forms GFFormsModel does not exist
932 932
 	 */
933 933
 	public static function get_field( $form, $field_id ) {
934
-		if ( class_exists( 'GFFormsModel' ) ){
934
+		if ( class_exists( 'GFFormsModel' ) ) {
935 935
 			return GFFormsModel::get_field( $form, $field_id );
936 936
 		} else {
937 937
 			return null;
@@ -978,19 +978,19 @@  discard block
 block discarded – undo
978 978
 			$shortcodes = array();
979 979
 
980 980
 			preg_match_all( '/' . get_shortcode_regex() . '/s', $content, $matches, PREG_SET_ORDER );
981
-			if ( empty( $matches ) ){
981
+			if ( empty( $matches ) ) {
982 982
 				return false;
983 983
 			}
984 984
 
985 985
 			foreach ( $matches as $shortcode ) {
986
-				if ( $tag === $shortcode[2] ) {
986
+				if ( $tag === $shortcode[ 2 ] ) {
987 987
 
988 988
 					// Changed this to $shortcode instead of true so we get the parsed atts.
989
-					$shortcodes[] = $shortcode;
989
+					$shortcodes[ ] = $shortcode;
990 990
 
991
-				} else if ( isset( $shortcode[5] ) && $results = self::has_shortcode_r( $shortcode[5], $tag ) ) {
992
-					foreach( $results as $result ) {
993
-						$shortcodes[] = $result;
991
+				} else if ( isset( $shortcode[ 5 ] ) && $results = self::has_shortcode_r( $shortcode[ 5 ], $tag ) ) {
992
+					foreach ( $results as $result ) {
993
+						$shortcodes[ ] = $result;
994 994
 					}
995 995
 				}
996 996
 			}
@@ -1141,7 +1141,7 @@  discard block
 block discarded – undo
1141 1141
 	 * @return string         html
1142 1142
 	 */
1143 1143
 	public static function get_sortable_fields( $formid, $current = '' ) {
1144
-		$output = '<option value="" ' . selected( '', $current, false ).'>' . esc_html__( 'Default', 'gravityview' ) .'</option>';
1144
+		$output = '<option value="" ' . selected( '', $current, false ) . '>' . esc_html__( 'Default', 'gravityview' ) . '</option>';
1145 1145
 
1146 1146
 		if ( empty( $formid ) ) {
1147 1147
 			return $output;
@@ -1154,11 +1154,11 @@  discard block
 block discarded – undo
1154 1154
 			$blacklist_field_types = apply_filters( 'gravityview_blacklist_field_types', array( 'list', 'textarea' ), null );
1155 1155
 
1156 1156
 			foreach ( $fields as $id => $field ) {
1157
-				if ( in_array( $field['type'], $blacklist_field_types ) ) {
1157
+				if ( in_array( $field[ 'type' ], $blacklist_field_types ) ) {
1158 1158
 					continue;
1159 1159
 				}
1160 1160
 
1161
-				$output .= '<option value="'. $id .'" '. selected( $id, $current, false ).'>'. esc_attr( $field['label'] ) .'</option>';
1161
+				$output .= '<option value="' . $id . '" ' . selected( $id, $current, false ) . '>' . esc_attr( $field[ 'label' ] ) . '</option>';
1162 1162
 			}
1163 1163
 		}
1164 1164
 
@@ -1193,9 +1193,9 @@  discard block
 block discarded – undo
1193 1193
 		$blacklist_field_types = apply_filters( 'gravityview_blacklist_field_types', $blacklist, NULL );
1194 1194
 
1195 1195
 		// TODO: Convert to using array_filter
1196
-		foreach( $fields as $id => $field ) {
1196
+		foreach ( $fields as $id => $field ) {
1197 1197
 
1198
-			if( in_array( $field['type'], $blacklist_field_types ) ) {
1198
+			if ( in_array( $field[ 'type' ], $blacklist_field_types ) ) {
1199 1199
 				unset( $fields[ $id ] );
1200 1200
 			}
1201 1201
 		}
@@ -1236,14 +1236,14 @@  discard block
 block discarded – undo
1236 1236
 	 * @param  int|array  $field field key or field array
1237 1237
 	 * @return boolean
1238 1238
 	 */
1239
-	public static function is_field_numeric(  $form = null, $field = '' ) {
1239
+	public static function is_field_numeric( $form = null, $field = '' ) {
1240 1240
 
1241 1241
 		if ( ! is_array( $form ) && ! is_array( $field ) ) {
1242 1242
 			$form = self::get_form( $form );
1243 1243
 		}
1244 1244
 
1245 1245
 		// If entry meta, it's a string. Otherwise, numeric
1246
-		if( ! is_numeric( $field ) && is_string( $field ) ) {
1246
+		if ( ! is_numeric( $field ) && is_string( $field ) ) {
1247 1247
 			$type = $field;
1248 1248
 		} else {
1249 1249
 			$type = self::get_field_type( $form, $field );
@@ -1257,9 +1257,9 @@  discard block
 block discarded – undo
1257 1257
 		$numeric_types = apply_filters( 'gravityview/common/numeric_types', array( 'number', 'time' ) );
1258 1258
 
1259 1259
 		// Defer to GravityView_Field setting, if the field type is registered and `is_numeric` is true
1260
-		if( $gv_field = GravityView_Fields::get( $type ) ) {
1261
-			if( true === $gv_field->is_numeric ) {
1262
-				$numeric_types[] = $gv_field->is_numeric;
1260
+		if ( $gv_field = GravityView_Fields::get( $type ) ) {
1261
+			if ( true === $gv_field->is_numeric ) {
1262
+				$numeric_types[ ] = $gv_field->is_numeric;
1263 1263
 			}
1264 1264
 		}
1265 1265
 
@@ -1409,11 +1409,11 @@  discard block
 block discarded – undo
1409 1409
 		$final_atts = array_filter( $final_atts );
1410 1410
 
1411 1411
 		// If the href wasn't passed as an attribute, use the value passed to the function
1412
-		if ( empty( $final_atts['href'] ) && ! empty( $href ) ) {
1413
-			$final_atts['href'] = $href;
1412
+		if ( empty( $final_atts[ 'href' ] ) && ! empty( $href ) ) {
1413
+			$final_atts[ 'href' ] = $href;
1414 1414
 		}
1415 1415
 
1416
-		$final_atts['href'] = esc_url_raw( $href );
1416
+		$final_atts[ 'href' ] = esc_url_raw( $href );
1417 1417
 
1418 1418
 		// Sort the attributes alphabetically, to help testing
1419 1419
 		ksort( $final_atts );
@@ -1424,7 +1424,7 @@  discard block
 block discarded – undo
1424 1424
 			$output .= sprintf( ' %s="%s"', $attr, esc_attr( $value ) );
1425 1425
 		}
1426 1426
 
1427
-		if( '' !== $output ) {
1427
+		if ( '' !== $output ) {
1428 1428
 			$output = '<a' . $output . '>' . $anchor_text . '</a>';
1429 1429
 		}
1430 1430
 
@@ -1448,7 +1448,7 @@  discard block
 block discarded – undo
1448 1448
 	public static function array_merge_recursive_distinct( array &$array1, array &$array2 ) {
1449 1449
 		$merged = $array1;
1450 1450
 
1451
-		foreach ( $array2 as $key => &$value )  {
1451
+		foreach ( $array2 as $key => &$value ) {
1452 1452
 			if ( is_array( $value ) && isset( $merged[ $key ] ) && is_array( $merged[ $key ] ) ) {
1453 1453
 				$merged[ $key ] = self::array_merge_recursive_distinct( $merged[ $key ], $value );
1454 1454
 			} else {
@@ -1483,7 +1483,7 @@  discard block
 block discarded – undo
1483 1483
 		 * `$context` is where are we using this information (e.g. change_entry_creator, search_widget ..)
1484 1484
 		 * @param array $settings Settings array, with `number` key defining the # of users to display
1485 1485
 		 */
1486
-		$get_users_settings = apply_filters( 'gravityview/get_users/'. $context, apply_filters( 'gravityview_change_entry_creator_user_parameters', $get_users_settings ) );
1486
+		$get_users_settings = apply_filters( 'gravityview/get_users/' . $context, apply_filters( 'gravityview_change_entry_creator_user_parameters', $get_users_settings ) );
1487 1487
 
1488 1488
 		return get_users( $get_users_settings );
1489 1489
 	}
@@ -1498,7 +1498,7 @@  discard block
 block discarded – undo
1498 1498
      * @return string
1499 1499
      */
1500 1500
     public static function generate_notice( $notice, $class = '' ) {
1501
-        return '<div class="gv-notice '.gravityview_sanitize_html_class( $class ) .'">'. $notice .'</div>';
1501
+        return '<div class="gv-notice ' . gravityview_sanitize_html_class( $class ) . '">' . $notice . '</div>';
1502 1502
     }
1503 1503
 
1504 1504
 
Please login to merge, or discard this patch.
includes/class-gravityview-merge-tags.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -122,7 +122,7 @@
 block discarded – undo
122 122
 
123 123
 		$atts = array(
124 124
 			'format' => self::get_format_from_modifiers( $exploded, false ),
125
-		    'human' => in_array( 'human', $exploded ), // {date_created:human}
125
+			'human' => in_array( 'human', $exploded ), // {date_created:human}
126 126
 			'diff' => in_array( 'diff', $exploded ), // {date_created:diff}
127 127
 			'raw' => in_array( 'raw', $exploded ), // {date_created:raw}
128 128
 			'timestamp' => in_array( 'timestamp', $exploded ), // {date_created:timestamp}
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 	 * @param  bool       $esc_html     Pass return value through `esc_html()`
42 42
 	 * @return string                  Text with variables maybe replaced
43 43
 	 */
44
-	public static function replace_variables($text, $form = array(), $entry = array(), $url_encode = false, $esc_html = true ) {
44
+	public static function replace_variables( $text, $form = array(), $entry = array(), $url_encode = false, $esc_html = true ) {
45 45
 
46 46
 		/**
47 47
 		 * @filter `gravityview_do_replace_variables` Turn off merge tag variable replacements.\n
@@ -64,9 +64,9 @@  discard block
 block discarded – undo
64 64
 		 *
65 65
 		 * @internal Reported to GF Support on 12/3
66 66
 		 */
67
-		$form['title']  = isset( $form['title'] ) ? $form['title'] : '';
68
-		$form['id']     = isset( $form['id'] ) ? $form['id'] : '';
69
-		$form['fields'] = isset( $form['fields'] ) ? $form['fields'] : array();
67
+		$form[ 'title' ]  = isset( $form[ 'title' ] ) ? $form[ 'title' ] : '';
68
+		$form[ 'id' ]     = isset( $form[ 'id' ] ) ? $form[ 'id' ] : '';
69
+		$form[ 'fields' ] = isset( $form[ 'fields' ] ) ? $form[ 'fields' ] : array();
70 70
 
71 71
 		return GFCommon::replace_variables( $text, $form, $entry, $url_encode, $esc_html );
72 72
 	}
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
 	 *
87 87
 	 * @return mixed
88 88
 	 */
89
-	public static function replace_gv_merge_tags(  $text, $form = array(), $entry = array(), $url_encode = false, $esc_html = false ) {
89
+	public static function replace_gv_merge_tags( $text, $form = array(), $entry = array(), $url_encode = false, $esc_html = false ) {
90 90
 
91 91
 		/**
92 92
 		 * This prevents the gform_replace_merge_tags filter from being called twice, as defined in:
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
 		 * @see GFCommon::replace_variables_prepopulate()
95 95
 		 * @todo Remove eventually: Gravity Forms fixed this issue in 1.9.14
96 96
 		 */
97
-		if( false === $form ) {
97
+		if ( false === $form ) {
98 98
 			return $text;
99 99
 		}
100 100
 
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
 			'diff' => in_array( 'diff', $exploded ), // {date_created:diff}
127 127
 			'raw' => in_array( 'raw', $exploded ), // {date_created:raw}
128 128
 			'timestamp' => in_array( 'timestamp', $exploded ), // {date_created:timestamp}
129
-			'time' => in_array( 'time', $exploded ),  // {date_created:time}
129
+			'time' => in_array( 'time', $exploded ), // {date_created:time}
130 130
 		);
131 131
 
132 132
 		$formatted_date = GVCommon::format_date( $date_created, $atts );
@@ -189,14 +189,14 @@  discard block
 block discarded – undo
189 189
 		preg_match_all( "/{get:(.*?)}/ism", $text, $matches, PREG_SET_ORDER );
190 190
 
191 191
 		// If there are no matches OR the Entry `created_by` isn't set or is 0 (no user)
192
-		if( empty( $matches ) ) {
192
+		if ( empty( $matches ) ) {
193 193
 			return $text;
194 194
 		}
195 195
 
196 196
 		foreach ( $matches as $match ) {
197 197
 
198
-			$full_tag = $match[0];
199
-			$property = $match[1];
198
+			$full_tag = $match[ 0 ];
199
+			$property = $match[ 1 ];
200 200
 
201 201
 			$value = stripslashes_deep( rgget( $property ) );
202 202
 
@@ -220,7 +220,7 @@  discard block
 block discarded – undo
220 220
 			 * @since 1.15
221 221
 			 * @param bool $esc_html Whether to esc_html() the value. Default: `true`
222 222
 			 */
223
-			$esc_html = apply_filters('gravityview/merge_tags/get/esc_html/' . $property, true );
223
+			$esc_html = apply_filters( 'gravityview/merge_tags/get/esc_html/' . $property, true );
224 224
 
225 225
 			$value = $esc_html ? esc_html( $value ) : $value;
226 226
 
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
 			 * @param[in] array $form Gravity Forms form array
232 232
 			 * @param[in] array $entry Entry array
233 233
 			 */
234
-			$value = apply_filters('gravityview/merge_tags/get/value/' . $property, $value, $text, $form, $entry );
234
+			$value = apply_filters( 'gravityview/merge_tags/get/value/' . $property, $value, $text, $form, $entry );
235 235
 
236 236
 			$text = str_replace( $full_tag, $value, $text );
237 237
 		}
Please login to merge, or discard this patch.
includes/class-admin-views.php 2 patches
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -1037,15 +1037,15 @@
 block discarded – undo
1037 1037
 		GFForms::register_scripts();
1038 1038
 
1039 1039
 		$scripts = array(
1040
-		    'sack',
1041
-		    'gform_gravityforms',
1042
-		    'gform_forms',
1043
-		    'gform_form_admin',
1044
-		    'jquery-ui-autocomplete'
1040
+			'sack',
1041
+			'gform_gravityforms',
1042
+			'gform_forms',
1043
+			'gform_form_admin',
1044
+			'jquery-ui-autocomplete'
1045 1045
 		);
1046 1046
 
1047 1047
 		if ( wp_is_mobile() ) {
1048
-				    $scripts[] = 'jquery-touch-punch';
1048
+					$scripts[] = 'jquery-touch-punch';
1049 1049
 		}
1050 1050
 
1051 1051
 		foreach ($scripts as $script) {
Please login to merge, or discard this patch.
Spacing   +171 added lines, -171 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,37 +134,37 @@  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
 			return $menu_items;
139 139
 		}
140 140
 
141 141
 		$sub_menu_items = array();
142 142
 		foreach ( (array)$connected_views as $view ) {
143 143
 
144
-			if( ! GVCommon::has_cap( 'edit_gravityview', $view->ID ) ) {
144
+			if ( ! GVCommon::has_cap( 'edit_gravityview', $view->ID ) ) {
145 145
 				continue;
146 146
 			}
147 147
 
148
-			$label = empty( $view->post_title ) ? sprintf( __('No Title (View #%d)', 'gravityview' ), $view->ID ) : $view->post_title;
148
+			$label = empty( $view->post_title ) ? sprintf( __( 'No Title (View #%d)', 'gravityview' ), $view->ID ) : $view->post_title;
149 149
 
150
-			$sub_menu_items[] = array(
150
+			$sub_menu_items[ ] = array(
151 151
 				'label' => esc_attr( $label ),
152
-				'url' => admin_url( 'post.php?action=edit&post='.$view->ID ),
152
+				'url' => admin_url( 'post.php?action=edit&post=' . $view->ID ),
153 153
 			);
154 154
 		}
155 155
 
156 156
 		// If there were no items added, then let's create the parent menu
157
-		if( $sub_menu_items ) {
157
+		if ( $sub_menu_items ) {
158 158
 
159 159
 			// Make sure Gravity Forms uses the submenu; if there's only one item, it uses a link instead of a dropdown
160
-			$sub_menu_items[] = array(
160
+			$sub_menu_items[ ] = array(
161 161
 				'url' => '#',
162 162
 				'label' => '',
163 163
 				'menu_class' => 'hidden',
164 164
 				'capabilities' => '',
165 165
 			);
166 166
 
167
-			$menu_items['gravityview'] = array(
167
+			$menu_items[ 'gravityview' ] = array(
168 168
 				'label'          => __( 'Connected Views', 'gravityview' ),
169 169
 				'icon'           => '<i class="fa fa-lg gv-icon-astronaut-head gv-icon"></i>',
170 170
 				'title'          => __( 'GravityView Views using this form as a data source', 'gravityview' ),
@@ -194,8 +194,8 @@  discard block
 block discarded – undo
194 194
 		$add = array( 'captcha', 'page' );
195 195
 
196 196
 		// Don't allowing editing the following values:
197
-		if( $context === 'edit' ) {
198
-			$add[] = 'post_id';
197
+		if ( $context === 'edit' ) {
198
+			$add[ ] = 'post_id';
199 199
 		}
200 200
 
201 201
 		$return = array_merge( $array, $add );
@@ -218,32 +218,32 @@  discard block
 block discarded – undo
218 218
 		foreach ( $default_args as $key => $arg ) {
219 219
 
220 220
 			// If an arg has `tooltip` defined, but it's false, don't display a tooltip
221
-			if( isset( $arg['tooltip'] ) && empty( $arg['tooltip'] ) ) { continue; }
221
+			if ( isset( $arg[ 'tooltip' ] ) && empty( $arg[ 'tooltip' ] ) ) { continue; }
222 222
 
223 223
 			// By default, use `tooltip` if defined.
224
-			$tooltip = empty( $arg['tooltip'] ) ? NULL : $arg['tooltip'];
224
+			$tooltip = empty( $arg[ 'tooltip' ] ) ? NULL : $arg[ 'tooltip' ];
225 225
 
226 226
 			// Otherwise, use the description as a tooltip.
227
-			if( empty( $tooltip ) && !empty( $arg['desc'] ) ) {
228
-				$tooltip = $arg['desc'];
227
+			if ( empty( $tooltip ) && ! empty( $arg[ 'desc' ] ) ) {
228
+				$tooltip = $arg[ 'desc' ];
229 229
 			}
230 230
 
231 231
 			// If there's no tooltip set, continue
232
-			if( empty( $tooltip ) ) {
232
+			if ( empty( $tooltip ) ) {
233 233
 				continue;
234 234
 			}
235 235
 
236 236
 			// Add the tooltip
237
-			$gv_tooltips[ 'gv_'.$key ] = array(
238
-				'title'	=> $arg['label'],
237
+			$gv_tooltips[ 'gv_' . $key ] = array(
238
+				'title'	=> $arg[ 'label' ],
239 239
 				'value'	=> $tooltip,
240 240
 			);
241 241
 
242 242
 		}
243 243
 
244
-		$gv_tooltips['gv_css_merge_tags'] = array(
245
-			'title' => __('CSS Merge Tags', 'gravityview'),
246
-			'value' => sprintf( __( 'Developers: The CSS classes will be sanitized using the %ssanitize_title_with_dashes()%s function.', 'gravityview'), '<code>', '</code>' )
244
+		$gv_tooltips[ 'gv_css_merge_tags' ] = array(
245
+			'title' => __( 'CSS Merge Tags', 'gravityview' ),
246
+			'value' => sprintf( __( 'Developers: The CSS classes will be sanitized using the %ssanitize_title_with_dashes()%s function.', 'gravityview' ), '<code>', '</code>' )
247 247
 		);
248 248
 
249 249
 		/**
@@ -254,9 +254,9 @@  discard block
 block discarded – undo
254 254
 
255 255
 		foreach ( $gv_tooltips as $key => $tooltip ) {
256 256
 
257
-			$title = empty( $tooltip['title'] ) ? '' : '<h6>'.esc_html( $tooltip['title'] ) .'</h6>';
257
+			$title = empty( $tooltip[ 'title' ] ) ? '' : '<h6>' . esc_html( $tooltip[ 'title' ] ) . '</h6>';
258 258
 
259
-			$tooltips[ $key ] = $title . wpautop( esc_html( $tooltip['value'] ) );
259
+			$tooltips[ $key ] = $title . wpautop( esc_html( $tooltip[ 'value' ] ) );
260 260
 		}
261 261
 
262 262
 		return $tooltips;
@@ -270,7 +270,7 @@  discard block
 block discarded – undo
270 270
 	 *
271 271
 	 * @return void
272 272
 	 */
273
-	public function add_custom_column_content( $column_name = NULL, $post_id )	{
273
+	public function add_custom_column_content( $column_name = NULL, $post_id ) {
274 274
 
275 275
 		$output = '';
276 276
 
@@ -292,7 +292,7 @@  discard block
 block discarded – undo
292 292
 				// Generate backup if label doesn't exist: `example_name` => `Example Name`
293 293
 				$template_id_pretty = ucwords( implode( ' ', explode( '_', $template_id ) ) );
294 294
 
295
-				$output = $template ? $template['label'] : $template_id_pretty;
295
+				$output = $template ? $template[ 'label' ] : $template_id_pretty;
296 296
 
297 297
 				break;
298 298
 
@@ -333,44 +333,44 @@  discard block
 block discarded – undo
333 333
 	static public function get_connected_form_links( $form, $include_form_link = true ) {
334 334
 
335 335
 		// Either the form is empty or the form ID is 0, not yet set.
336
-		if( empty( $form ) ) {
336
+		if ( empty( $form ) ) {
337 337
 			return '';
338 338
 		}
339 339
 
340 340
 		// The $form is passed as the form ID
341
-		if( !is_array( $form ) ) {
341
+		if ( ! is_array( $form ) ) {
342 342
 			$form = gravityview_get_form( $form );
343 343
 		}
344 344
 
345
-		$form_id = $form['id'];
345
+		$form_id = $form[ 'id' ];
346 346
 		$links = array();
347 347
 
348
-		if( GVCommon::has_cap( 'gravityforms_edit_forms' ) ) {
348
+		if ( GVCommon::has_cap( 'gravityforms_edit_forms' ) ) {
349 349
 			$form_url = admin_url( sprintf( 'admin.php?page=gf_edit_forms&amp;id=%d', $form_id ) );
350
-			$form_link = '<strong class="gv-form-title">'.gravityview_get_link( $form_url, $form['title'], 'class=row-title' ).'</strong>';
351
-			$links[] = '<span>'.gravityview_get_link( $form_url, __('Edit Form', 'gravityview') ).'</span>';
350
+			$form_link = '<strong class="gv-form-title">' . gravityview_get_link( $form_url, $form[ 'title' ], 'class=row-title' ) . '</strong>';
351
+			$links[ ] = '<span>' . gravityview_get_link( $form_url, __( 'Edit Form', 'gravityview' ) ) . '</span>';
352 352
 		} else {
353
-			$form_link = '<strong class="gv-form-title">'. esc_html( $form['title'] ). '</strong>';
353
+			$form_link = '<strong class="gv-form-title">' . esc_html( $form[ 'title' ] ) . '</strong>';
354 354
 		}
355 355
 
356
-		if( GVCommon::has_cap( 'gravityforms_view_entries' ) ) {
356
+		if ( GVCommon::has_cap( 'gravityforms_view_entries' ) ) {
357 357
 			$entries_url = admin_url( sprintf( 'admin.php?page=gf_entries&amp;id=%d', $form_id ) );
358
-			$links[] = '<span>'.gravityview_get_link( $entries_url, __('Entries', 'gravityview') ).'</span>';
358
+			$links[ ] = '<span>' . gravityview_get_link( $entries_url, __( 'Entries', 'gravityview' ) ) . '</span>';
359 359
 		}
360 360
 
361
-		if( GVCommon::has_cap( array( 'gravityforms_edit_settings', 'gravityview_view_settings' ) ) ) {
361
+		if ( GVCommon::has_cap( array( 'gravityforms_edit_settings', 'gravityview_view_settings' ) ) ) {
362 362
 			$settings_url = admin_url( sprintf( 'admin.php?page=gf_edit_forms&amp;view=settings&amp;id=%d', $form_id ) );
363
-			$links[] = '<span>'.gravityview_get_link( $settings_url, __('Settings', 'gravityview'), 'title='.__('Edit settings for this form', 'gravityview') ).'</span>';
363
+			$links[ ] = '<span>' . gravityview_get_link( $settings_url, __( 'Settings', 'gravityview' ), 'title=' . __( 'Edit settings for this form', 'gravityview' ) ) . '</span>';
364 364
 		}
365 365
 
366
-		if( GVCommon::has_cap( array("gravityforms_edit_forms", "gravityforms_create_form", "gravityforms_preview_forms") ) ) {
366
+		if ( GVCommon::has_cap( array( "gravityforms_edit_forms", "gravityforms_create_form", "gravityforms_preview_forms" ) ) ) {
367 367
 			$preview_url = site_url( sprintf( '?gf_page=preview&amp;id=%d', $form_id ) );
368
-			$links[] = '<span>'.gravityview_get_link( $preview_url, __('Preview Form', 'gravityview'), 'title='.__('Preview this form', 'gravityview') ).'</span>';
368
+			$links[ ] = '<span>' . gravityview_get_link( $preview_url, __( 'Preview Form', 'gravityview' ), 'title=' . __( 'Preview this form', 'gravityview' ) ) . '</span>';
369 369
 		}
370 370
 
371 371
 		$output = '';
372 372
 
373
-		if( !empty( $include_form_link ) ) {
373
+		if ( ! empty( $include_form_link ) ) {
374 374
 			$output .= $form_link;
375 375
 		}
376 376
 
@@ -382,7 +382,7 @@  discard block
 block discarded – undo
382 382
 		 */
383 383
 		$links = apply_filters( 'gravityview_connected_form_links', $links, $form );
384 384
 
385
-		$output .= '<div class="row-actions">'. implode( ' | ', $links ) .'</div>';
385
+		$output .= '<div class="row-actions">' . implode( ' | ', $links ) . '</div>';
386 386
 
387 387
 		return $output;
388 388
 	}
@@ -396,8 +396,8 @@  discard block
 block discarded – undo
396 396
 		// Get the date column and save it for later to add back in.
397 397
 		// This adds it after the Data Source column.
398 398
 		// This way, we don't need to do array_slice, array_merge, etc.
399
-		$date = $columns['date'];
400
-		unset( $columns['date'] );
399
+		$date = $columns[ 'date' ];
400
+		unset( $columns[ 'date' ] );
401 401
 
402 402
 		$data_source_required_caps = array(
403 403
 			'gravityforms_edit_forms',
@@ -408,14 +408,14 @@  discard block
 block discarded – undo
408 408
 			'gravityforms_preview_forms',
409 409
 		);
410 410
 
411
-		if( GVCommon::has_cap( $data_source_required_caps ) ) {
412
-			$columns['gv_connected_form'] = __( 'Data Source', 'gravityview' );
411
+		if ( GVCommon::has_cap( $data_source_required_caps ) ) {
412
+			$columns[ 'gv_connected_form' ] = __( 'Data Source', 'gravityview' );
413 413
 		}
414 414
 
415
-		$columns['gv_template'] = _x( 'Template', 'Column title that shows what template is being used for Views', 'gravityview' );
415
+		$columns[ 'gv_template' ] = _x( 'Template', 'Column title that shows what template is being used for Views', 'gravityview' );
416 416
 
417 417
 		// Add the date back in.
418
-		$columns['date'] = $date;
418
+		$columns[ 'date' ] = $date;
419 419
 
420 420
 		return $columns;
421 421
 	}
@@ -429,12 +429,12 @@  discard block
 block discarded – undo
429 429
 	 */
430 430
 	function save_postdata( $post_id ) {
431 431
 
432
-		if( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ){
432
+		if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
433 433
 			return;
434 434
 		}
435 435
 
436 436
 		// validate post_type
437
-		if ( ! isset( $_POST['post_type'] ) || 'gravityview' != $_POST['post_type'] ) {
437
+		if ( ! isset( $_POST[ 'post_type' ] ) || 'gravityview' != $_POST[ 'post_type' ] ) {
438 438
 			return;
439 439
 		}
440 440
 
@@ -449,67 +449,67 @@  discard block
 block discarded – undo
449 449
 		$statii = array();
450 450
 
451 451
 		// check if this is a start fresh View
452
-		if ( isset( $_POST['gravityview_select_form_nonce'] ) && wp_verify_nonce( $_POST['gravityview_select_form_nonce'], 'gravityview_select_form' ) ) {
452
+		if ( isset( $_POST[ 'gravityview_select_form_nonce' ] ) && wp_verify_nonce( $_POST[ 'gravityview_select_form_nonce' ], 'gravityview_select_form' ) ) {
453 453
 
454
-			$form_id = !empty( $_POST['gravityview_form_id'] ) ? $_POST['gravityview_form_id'] : '';
454
+			$form_id = ! empty( $_POST[ 'gravityview_form_id' ] ) ? $_POST[ 'gravityview_form_id' ] : '';
455 455
 			// save form id
456
-			$statii['form_id'] = update_post_meta( $post_id, '_gravityview_form_id', $form_id );
456
+			$statii[ 'form_id' ] = update_post_meta( $post_id, '_gravityview_form_id', $form_id );
457 457
 
458 458
 		}
459 459
 
460
-		if( false === GVCommon::has_cap( 'gravityforms_create_form' ) && empty( $statii['form_id'] ) ) {
460
+		if ( false === GVCommon::has_cap( 'gravityforms_create_form' ) && empty( $statii[ 'form_id' ] ) ) {
461 461
 			do_action( 'gravityview_log_error', __METHOD__ . ' - Current user does not have the capability to create a new Form.', wp_get_current_user() );
462 462
 			return;
463 463
 		}
464 464
 
465 465
 		// Was this a start fresh?
466
-		if ( ! empty( $_POST['gravityview_form_id_start_fresh'] ) ) {
467
-			$statii['start_fresh'] = add_post_meta( $post_id, '_gravityview_start_fresh', 1 );
466
+		if ( ! empty( $_POST[ 'gravityview_form_id_start_fresh' ] ) ) {
467
+			$statii[ 'start_fresh' ] = add_post_meta( $post_id, '_gravityview_start_fresh', 1 );
468 468
 		} else {
469
-			$statii['start_fresh'] = delete_post_meta( $post_id, '_gravityview_start_fresh' );
469
+			$statii[ 'start_fresh' ] = delete_post_meta( $post_id, '_gravityview_start_fresh' );
470 470
 		}
471 471
 
472 472
 		// Check if we have a template id
473
-		if ( isset( $_POST['gravityview_select_template_nonce'] ) && wp_verify_nonce( $_POST['gravityview_select_template_nonce'], 'gravityview_select_template' ) ) {
473
+		if ( isset( $_POST[ 'gravityview_select_template_nonce' ] ) && wp_verify_nonce( $_POST[ 'gravityview_select_template_nonce' ], 'gravityview_select_template' ) ) {
474 474
 
475
-			$template_id = !empty( $_POST['gravityview_directory_template'] ) ? $_POST['gravityview_directory_template'] : '';
475
+			$template_id = ! empty( $_POST[ 'gravityview_directory_template' ] ) ? $_POST[ 'gravityview_directory_template' ] : '';
476 476
 
477 477
 			// now save template id
478
-			$statii['directory_template'] = update_post_meta( $post_id, '_gravityview_directory_template', $template_id );
478
+			$statii[ 'directory_template' ] = update_post_meta( $post_id, '_gravityview_directory_template', $template_id );
479 479
 		}
480 480
 
481 481
 
482 482
 		// save View Configuration metabox
483
-		if ( isset( $_POST['gravityview_view_configuration_nonce'] ) && wp_verify_nonce( $_POST['gravityview_view_configuration_nonce'], 'gravityview_view_configuration' ) ) {
483
+		if ( isset( $_POST[ 'gravityview_view_configuration_nonce' ] ) && wp_verify_nonce( $_POST[ 'gravityview_view_configuration_nonce' ], 'gravityview_view_configuration' ) ) {
484 484
 
485 485
 			// template settings
486
-			if( empty( $_POST['template_settings'] ) ) {
487
-				$_POST['template_settings'] = array();
486
+			if ( empty( $_POST[ 'template_settings' ] ) ) {
487
+				$_POST[ 'template_settings' ] = array();
488 488
 			}
489
-			$statii['template_settings'] = update_post_meta( $post_id, '_gravityview_template_settings', $_POST['template_settings'] );
489
+			$statii[ 'template_settings' ] = update_post_meta( $post_id, '_gravityview_template_settings', $_POST[ 'template_settings' ] );
490 490
 
491 491
 			$fields = array();
492 492
 
493 493
 			// Directory&single Visible Fields
494
-			if( !empty( $preset_fields ) ) {
494
+			if ( ! empty( $preset_fields ) ) {
495 495
 
496 496
 				$fields = $preset_fields;
497 497
 
498
-			} elseif( !empty( $_POST['fields'] ) ) {
498
+			} elseif ( ! empty( $_POST[ 'fields' ] ) ) {
499 499
 				$fields = _gravityview_process_posted_fields();
500 500
 			}
501 501
 
502
-			$statii['directory_fields'] = update_post_meta( $post_id, '_gravityview_directory_fields', $fields );
502
+			$statii[ 'directory_fields' ] = update_post_meta( $post_id, '_gravityview_directory_fields', $fields );
503 503
 
504 504
 			// Directory Visible Widgets
505
-			if( empty( $_POST['widgets'] ) ) {
506
-				$_POST['widgets'] = array();
505
+			if ( empty( $_POST[ 'widgets' ] ) ) {
506
+				$_POST[ 'widgets' ] = array();
507 507
 			}
508
-			$statii['directory_widgets'] = update_post_meta( $post_id, '_gravityview_directory_widgets', $_POST['widgets'] );
508
+			$statii[ 'directory_widgets' ] = update_post_meta( $post_id, '_gravityview_directory_widgets', $_POST[ 'widgets' ] );
509 509
 
510 510
 		} // end save view configuration
511 511
 
512
-		do_action('gravityview_log_debug', '[save_postdata] Update Post Meta Statuses (also returns false if nothing changed)', array_map( 'intval', $statii ) );
512
+		do_action( 'gravityview_log_debug', '[save_postdata] Update Post Meta Statuses (also returns false if nothing changed)', array_map( 'intval', $statii ) );
513 513
 	}
514 514
 
515 515
 	/**
@@ -541,20 +541,20 @@  discard block
 block discarded – undo
541 541
 
542 542
 		$output = '';
543 543
 
544
-		if( !empty( $fields ) ) {
544
+		if ( ! empty( $fields ) ) {
545 545
 
546
-			foreach( $fields as $id => $details ) {
546
+			foreach ( $fields as $id => $details ) {
547 547
 
548
-				if( in_array( $details['type'], $blacklist_field_types ) ) {
548
+				if ( in_array( $details[ 'type' ], $blacklist_field_types ) ) {
549 549
 					continue;
550 550
 				}
551 551
 
552 552
 				// Edit mode only allows editing the parent fields, not single inputs.
553
-				if( $context === 'edit' && !empty( $details['parent'] ) ) {
553
+				if ( $context === 'edit' && ! empty( $details[ 'parent' ] ) ) {
554 554
 					continue;
555 555
 				}
556 556
 
557
-				$output .= new GravityView_Admin_View_Field( $details['label'], $id, $details );
557
+				$output .= new GravityView_Admin_View_Field( $details[ 'label' ], $id, $details );
558 558
 
559 559
 			} // End foreach
560 560
 		}
@@ -562,7 +562,7 @@  discard block
 block discarded – undo
562 562
 		echo $output;
563 563
 
564 564
 		// For the EDIT view we only want to allow the form fields.
565
-		if( $context === 'edit' ) {
565
+		if ( $context === 'edit' ) {
566 566
 			return;
567 567
 		}
568 568
 
@@ -586,16 +586,16 @@  discard block
 block discarded – undo
586 586
 		$additional_fields = apply_filters( 'gravityview_additional_fields', array(
587 587
 			array(
588 588
 				'label_text' => __( '+ Add All Fields', 'gravityview' ),
589
-				'desc' => __('Add all the available fields at once.', 'gravityview'),
589
+				'desc' => __( 'Add all the available fields at once.', 'gravityview' ),
590 590
 				'field_id' => 'all-fields',
591 591
 				'label_type' => 'field',
592 592
 				'input_type' => NULL,
593 593
 				'field_options' => NULL,
594 594
 				'settings_html'	=> NULL,
595 595
 			)
596
-		));
596
+		) );
597 597
 
598
-		if( !empty( $additional_fields )) {
598
+		if ( ! empty( $additional_fields ) ) {
599 599
 			foreach ( (array)$additional_fields as $item ) {
600 600
 
601 601
 				// Prevent items from not having index set
@@ -606,16 +606,16 @@  discard block
 block discarded – undo
606 606
 					'input_type' => NULL,
607 607
 					'field_options' => NULL,
608 608
 					'settings_html'	=> NULL,
609
-				));
609
+				) );
610 610
 
611 611
 				// Backward compat.
612
-				if( !empty( $item['field_options'] ) ) {
612
+				if ( ! empty( $item[ 'field_options' ] ) ) {
613 613
 					// Use settings_html from now on.
614
-					$item['settings_html'] = $item['field_options'];
614
+					$item[ 'settings_html' ] = $item[ 'field_options' ];
615 615
 				}
616 616
 
617 617
 				// Render a label for each of them
618
-				echo new GravityView_Admin_View_Field( $item['label_text'], $item['field_id'], $item );
618
+				echo new GravityView_Admin_View_Field( $item[ 'label_text' ], $item[ 'field_id' ], $item );
619 619
 
620 620
 			}
621 621
 		}
@@ -628,64 +628,64 @@  discard block
 block discarded – undo
628 628
 	 * @param  string $zone   Either 'single', 'directory', 'header', 'footer'
629 629
 	 * @return array
630 630
 	 */
631
-	function get_entry_default_fields($form, $zone) {
631
+	function get_entry_default_fields( $form, $zone ) {
632 632
 
633 633
 		$entry_default_fields = array();
634 634
 
635
-		if( in_array( $zone, array( 'directory', 'single' ) ) ) {
635
+		if ( in_array( $zone, array( 'directory', 'single' ) ) ) {
636 636
 
637 637
 			$entry_default_fields = array(
638 638
 				'id' => array(
639
-					'label' => __('Entry ID', 'gravityview'),
639
+					'label' => __( 'Entry ID', 'gravityview' ),
640 640
 					'type' => 'id',
641
-					'desc'	=> __('The unique ID of the entry.', 'gravityview'),
641
+					'desc'	=> __( 'The unique ID of the entry.', 'gravityview' ),
642 642
 				),
643 643
 				'date_created' => array(
644
-					'label' => __('Entry Date', 'gravityview'),
645
-					'desc'	=> __('The date the entry was created.', 'gravityview'),
644
+					'label' => __( 'Entry Date', 'gravityview' ),
645
+					'desc'	=> __( 'The date the entry was created.', 'gravityview' ),
646 646
 					'type' => 'date_created',
647 647
 				),
648 648
 				'source_url' => array(
649
-					'label' => __('Source URL', 'gravityview'),
649
+					'label' => __( 'Source URL', 'gravityview' ),
650 650
 					'type' => 'source_url',
651
-					'desc'	=> __('The URL of the page where the form was submitted.', 'gravityview'),
651
+					'desc'	=> __( 'The URL of the page where the form was submitted.', 'gravityview' ),
652 652
 				),
653 653
 				'ip' => array(
654
-					'label' => __('User IP', 'gravityview'),
654
+					'label' => __( 'User IP', 'gravityview' ),
655 655
 					'type' => 'ip',
656
-					'desc'	=> __('The IP Address of the user who created the entry.', 'gravityview'),
656
+					'desc'	=> __( 'The IP Address of the user who created the entry.', 'gravityview' ),
657 657
 				),
658 658
 				'created_by' => array(
659
-					'label' => __('User', 'gravityview'),
659
+					'label' => __( 'User', 'gravityview' ),
660 660
 					'type' => 'created_by',
661
-					'desc'	=> __('Details of the logged-in user who created the entry (if any).', 'gravityview'),
661
+					'desc'	=> __( 'Details of the logged-in user who created the entry (if any).', 'gravityview' ),
662 662
 				),
663 663
 
664 664
 				/**
665 665
 				 * @since  1.2
666 666
 				 */
667 667
 				'custom'	=> array(
668
-					'label'	=> __('Custom Content', 'gravityview'),
668
+					'label'	=> __( 'Custom Content', 'gravityview' ),
669 669
 					'type'	=> 'custom',
670
-					'desc'	=> __('Insert custom text or HTML.', 'gravityview'),
670
+					'desc'	=> __( 'Insert custom text or HTML.', 'gravityview' ),
671 671
 				),
672 672
 
673 673
 				/**
674 674
 				 * @since 1.7.2
675 675
 				 */
676 676
 				'other_entries' => array(
677
-					'label'	=> __('Other Entries', 'gravityview'),
677
+					'label'	=> __( 'Other Entries', 'gravityview' ),
678 678
 					'type'	=> 'other_entries',
679
-					'desc'	=> __('Display other entries created by the entry creator.', 'gravityview'),
679
+					'desc'	=> __( 'Display other entries created by the entry creator.', 'gravityview' ),
680 680
 				),
681 681
 			);
682 682
 
683 683
 
684
-			if( 'single' !== $zone) {
684
+			if ( 'single' !== $zone ) {
685 685
 
686
-				$entry_default_fields['entry_link'] = array(
687
-					'label' => __('Link to Entry', 'gravityview'),
688
-					'desc'	=> __('A dedicated link to the single entry with customizable text.', 'gravityview'),
686
+				$entry_default_fields[ 'entry_link' ] = array(
687
+					'label' => __( 'Link to Entry', 'gravityview' ),
688
+					'desc'	=> __( 'A dedicated link to the single entry with customizable text.', 'gravityview' ),
689 689
 					'type' => 'entry_link',
690 690
 				);
691 691
 			}
@@ -699,7 +699,7 @@  discard block
 block discarded – undo
699 699
 		 * @param  string|array $form form_ID or form object
700 700
 		 * @param  string $zone   Either 'single', 'directory', 'header', 'footer'
701 701
 		 */
702
-		return apply_filters( 'gravityview_entry_default_fields', $entry_default_fields, $form, $zone);
702
+		return apply_filters( 'gravityview_entry_default_fields', $entry_default_fields, $form, $zone );
703 703
 	}
704 704
 
705 705
 	/**
@@ -710,7 +710,7 @@  discard block
 block discarded – undo
710 710
 	 */
711 711
 	function get_available_fields( $form = '', $zone = NULL ) {
712 712
 
713
-		if( empty( $form ) ) {
713
+		if ( empty( $form ) ) {
714 714
 			do_action( 'gravityview_log_error', '[get_available_fields] $form is empty' );
715 715
 			return array();
716 716
 		}
@@ -719,7 +719,7 @@  discard block
 block discarded – undo
719 719
 		$fields = gravityview_get_form_fields( $form, true );
720 720
 
721 721
 		// get meta fields ( only if form was already created )
722
-		if( !is_array( $form ) ) {
722
+		if ( ! is_array( $form ) ) {
723 723
 			$meta_fields = gravityview_get_entry_meta( $form );
724 724
 		} else {
725 725
 			$meta_fields = array();
@@ -743,11 +743,11 @@  discard block
 block discarded – undo
743 743
 
744 744
 		$widgets = $this->get_registered_widgets();
745 745
 
746
-		if( !empty( $widgets ) ) {
746
+		if ( ! empty( $widgets ) ) {
747 747
 
748
-			foreach( $widgets as $id => $details ) {
748
+			foreach ( $widgets as $id => $details ) {
749 749
 
750
-				echo new GravityView_Admin_View_Widget( $details['label'], $id, $details );
750
+				echo new GravityView_Admin_View_Widget( $details[ 'label' ], $id, $details );
751 751
 
752 752
 			}
753 753
 		}
@@ -781,7 +781,7 @@  discard block
 block discarded – undo
781 781
 	function render_active_areas( $template_id, $type, $zone, $rows, $values ) {
782 782
 		global $post;
783 783
 
784
-		if( $type === 'widget' ) {
784
+		if ( $type === 'widget' ) {
785 785
 			$button_label = __( 'Add Widget', 'gravityview' );
786 786
 		} else {
787 787
 			$button_label = __( 'Add Field', 'gravityview' );
@@ -790,15 +790,15 @@  discard block
 block discarded – undo
790 790
 		$available_items = array();
791 791
 
792 792
 		// if saved values, get available fields to label everyone
793
-		if( !empty( $values ) && ( !empty( $post->ID ) || !empty( $_POST['template_id'] ) ) ) {
793
+		if ( ! empty( $values ) && ( ! empty( $post->ID ) || ! empty( $_POST[ 'template_id' ] ) ) ) {
794 794
 
795
-			if( !empty( $_POST['template_id'] ) ) {
796
-				$form = GravityView_Ajax::pre_get_form_fields( $_POST['template_id'] );
795
+			if ( ! empty( $_POST[ 'template_id' ] ) ) {
796
+				$form = GravityView_Ajax::pre_get_form_fields( $_POST[ 'template_id' ] );
797 797
 			} else {
798 798
 				$form = gravityview_get_form_id( $post->ID );
799 799
 			}
800 800
 
801
-			if( 'field' === $type ) {
801
+			if ( 'field' === $type ) {
802 802
 				$available_items = $this->get_available_fields( $form, $zone );
803 803
 			} else {
804 804
 				$available_items = $this->get_registered_widgets();
@@ -806,39 +806,39 @@  discard block
 block discarded – undo
806 806
 
807 807
 		}
808 808
 
809
-		foreach( $rows as $row ) :
810
-			foreach( $row as $col => $areas ) :
811
-				$column = ($col == '2-2') ? '1-2' : $col; ?>
809
+		foreach ( $rows as $row ) :
810
+			foreach ( $row as $col => $areas ) :
811
+				$column = ( $col == '2-2' ) ? '1-2' : $col; ?>
812 812
 
813 813
 				<div class="gv-grid-col-<?php echo esc_attr( $column ); ?>">
814 814
 
815
-					<?php foreach( $areas as $area ) : 	?>
815
+					<?php foreach ( $areas as $area ) : 	?>
816 816
 
817 817
 						<div class="gv-droppable-area">
818
-							<div class="active-drop active-drop-<?php echo esc_attr( $type ); ?>" data-areaid="<?php echo esc_attr( $zone .'_'. $area['areaid'] ); ?>">
818
+							<div class="active-drop active-drop-<?php echo esc_attr( $type ); ?>" data-areaid="<?php echo esc_attr( $zone . '_' . $area[ 'areaid' ] ); ?>">
819 819
 
820 820
 								<?php // render saved fields
821 821
 
822
-								if( !empty( $values[ $zone .'_'. $area['areaid'] ] ) ) {
822
+								if ( ! empty( $values[ $zone . '_' . $area[ 'areaid' ] ] ) ) {
823 823
 
824
-									foreach( $values[ $zone .'_'. $area['areaid'] ] as $uniqid => $field ) {
824
+									foreach ( $values[ $zone . '_' . $area[ 'areaid' ] ] as $uniqid => $field ) {
825 825
 
826 826
 										$input_type = NULL;
827
-										$original_item = isset( $available_items[ $field['id'] ] ) ? $available_items[ $field['id'] ] : false ;
827
+										$original_item = isset( $available_items[ $field[ 'id' ] ] ) ? $available_items[ $field[ 'id' ] ] : false;
828 828
 
829
-										if( !$original_item ) {
829
+										if ( ! $original_item ) {
830 830
 
831
-											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 ));
831
+											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 ) );
832 832
 
833 833
 											$original_item = $field;
834 834
 										} else {
835 835
 
836
-											$input_type = isset( $original_item['type'] ) ? $original_item['type'] : NULL;
836
+											$input_type = isset( $original_item[ 'type' ] ) ? $original_item[ 'type' ] : NULL;
837 837
 
838 838
 										}
839 839
 
840 840
 										// Field options dialog box
841
-										$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 );
841
+										$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 );
842 842
 
843 843
 										$item = array(
844 844
 											'input_type' => $input_type,
@@ -847,16 +847,16 @@  discard block
 block discarded – undo
847 847
 										);
848 848
 
849 849
 										// Merge the values with the current item to pass things like widget descriptions and original field names
850
-										if( $original_item ) {
850
+										if ( $original_item ) {
851 851
 											$item = wp_parse_args( $item, $original_item );
852 852
 										}
853 853
 
854
-										switch( $type ) {
854
+										switch ( $type ) {
855 855
 											case 'widget':
856
-												echo new GravityView_Admin_View_Widget( $item['label'], $field['id'], $item, $field );
856
+												echo new GravityView_Admin_View_Widget( $item[ 'label' ], $field[ 'id' ], $item, $field );
857 857
 												break;
858 858
 											default:
859
-												echo new GravityView_Admin_View_Field( $item['label'], $field['id'], $item, $field );
859
+												echo new GravityView_Admin_View_Field( $item[ 'label' ], $field[ 'id' ], $item, $field );
860 860
 										}
861 861
 
862 862
 
@@ -866,11 +866,11 @@  discard block
 block discarded – undo
866 866
 
867 867
 								} // End if zone is not empty ?>
868 868
 
869
-								<span class="drop-message"><?php echo sprintf(esc_attr__('"+ %s" or drag existing %ss here.', 'gravityview'), $button_label, $type ); ?></span>
869
+								<span class="drop-message"><?php echo sprintf( esc_attr__( '"+ %s" or drag existing %ss here.', 'gravityview' ), $button_label, $type ); ?></span>
870 870
 							</div>
871 871
 							<div class="gv-droppable-area-action">
872
-								<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>
873
-								<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>
872
+								<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>
873
+								<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>
874 874
 							</div>
875 875
 						</div>
876 876
 
@@ -892,7 +892,7 @@  discard block
 block discarded – undo
892 892
 		$default_widget_areas = GravityView_Plugin::get_default_widget_areas();
893 893
 
894 894
 		$widgets = array();
895
-		if( !empty( $post_id ) ) {
895
+		if ( ! empty( $post_id ) ) {
896 896
 			$widgets = get_post_meta( $post_id, '_gravityview_directory_widgets', true );
897 897
 
898 898
 		}
@@ -923,19 +923,19 @@  discard block
 block discarded – undo
923 923
 	 */
924 924
 	function render_directory_active_areas( $template_id = '', $context = 'single', $post_id = '', $echo = false ) {
925 925
 
926
-		if( empty( $template_id ) ) {
926
+		if ( empty( $template_id ) ) {
927 927
 			do_action( 'gravityview_log_debug', '[render_directory_active_areas] $template_id is empty' );
928 928
 			return;
929 929
 		}
930 930
 
931 931
 		$template_areas = apply_filters( 'gravityview_template_active_areas', array(), $template_id, $context );
932 932
 
933
-		if( empty( $template_areas ) ) {
933
+		if ( empty( $template_areas ) ) {
934 934
 
935 935
 			do_action( 'gravityview_log_debug', '[render_directory_active_areas] No areas defined. Maybe template %s is disabled.', $template_id );
936 936
 			$output = '<div>';
937
-			$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>';
938
-			$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>';
937
+			$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>';
938
+			$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>';
939 939
 			$output .= '</div>';
940 940
 		} else {
941 941
 
@@ -950,7 +950,7 @@  discard block
 block discarded – undo
950 950
 
951 951
 		}
952 952
 
953
-		if( $echo ) {
953
+		if ( $echo ) {
954 954
 			echo $output;
955 955
 		}
956 956
 
@@ -970,25 +970,25 @@  discard block
 block discarded – undo
970 970
 		$is_widgets_page = ( $pagenow === 'widgets.php' );
971 971
 
972 972
 		// Add the GV font (with the Astronaut)
973
-		wp_enqueue_style( 'gravityview_global', plugins_url('assets/css/admin-global.css', GRAVITYVIEW_FILE), array(), GravityView_Plugin::version );
973
+		wp_enqueue_style( 'gravityview_global', plugins_url( 'assets/css/admin-global.css', GRAVITYVIEW_FILE ), array(), GravityView_Plugin::version );
974 974
 
975
-		wp_register_script( 'gravityview-jquery-cookie', plugins_url('includes/lib/jquery-cookie/jquery_cookie.js', GRAVITYVIEW_FILE), array( 'jquery' ), GravityView_Plugin::version, true );
975
+		wp_register_script( 'gravityview-jquery-cookie', plugins_url( 'includes/lib/jquery-cookie/jquery_cookie.js', GRAVITYVIEW_FILE ), array( 'jquery' ), GravityView_Plugin::version, true );
976 976
 
977 977
 		// Don't process any scripts below here if it's not a GravityView page.
978
-		if( !gravityview_is_admin_page($hook) && !$is_widgets_page ) { return; }
978
+		if ( ! gravityview_is_admin_page( $hook ) && ! $is_widgets_page ) { return; }
979 979
 
980 980
 		// Only enqueue the following on single pages
981
-		if( gravityview_is_admin_page($hook, 'single') || $is_widgets_page ) {
981
+		if ( gravityview_is_admin_page( $hook, 'single' ) || $is_widgets_page ) {
982 982
 
983 983
 			wp_enqueue_script( 'jquery-ui-datepicker' );
984
-			wp_enqueue_style( 'gravityview_views_datepicker', plugins_url('assets/css/admin-datepicker.css', GRAVITYVIEW_FILE), GravityView_Plugin::version );
984
+			wp_enqueue_style( 'gravityview_views_datepicker', plugins_url( 'assets/css/admin-datepicker.css', GRAVITYVIEW_FILE ), GravityView_Plugin::version );
985 985
 
986
-			$script_debug = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min';
986
+			$script_debug = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
987 987
 
988 988
 			//enqueue scripts
989 989
 			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 );
990 990
 
991
-			wp_localize_script('gravityview_views_scripts', 'gvGlobals', array(
991
+			wp_localize_script( 'gravityview_views_scripts', 'gvGlobals', array(
992 992
 				'cookiepath' => COOKIEPATH,
993 993
 				'nonce' => wp_create_nonce( 'gravityview_ajaxviews' ),
994 994
 				'label_viewname' => __( 'Enter View name here', 'gravityview' ),
@@ -1001,9 +1001,9 @@  discard block
 block discarded – undo
1001 1001
 				'loading_error' => esc_html__( 'There was an error loading dynamic content.', 'gravityview' ),
1002 1002
 				'field_loaderror' => __( 'Error while adding the field. Please try again or contact GravityView support.', 'gravityview' ),
1003 1003
 				'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' ),
1004
-			));
1004
+			) );
1005 1005
 
1006
-			wp_enqueue_style( 'gravityview_views_styles', plugins_url( 'assets/css/admin-views.css', GRAVITYVIEW_FILE ), array('dashicons', 'wp-jquery-ui-dialog' ), GravityView_Plugin::version );
1006
+			wp_enqueue_style( 'gravityview_views_styles', plugins_url( 'assets/css/admin-views.css', GRAVITYVIEW_FILE ), array( 'dashicons', 'wp-jquery-ui-dialog' ), GravityView_Plugin::version );
1007 1007
 
1008 1008
 			self::enqueue_gravity_forms_scripts();
1009 1009
 
@@ -1022,10 +1022,10 @@  discard block
 block discarded – undo
1022 1022
 		);
1023 1023
 
1024 1024
 		if ( wp_is_mobile() ) {
1025
-				    $scripts[] = 'jquery-touch-punch';
1025
+				    $scripts[ ] = 'jquery-touch-punch';
1026 1026
 		}
1027 1027
 
1028
-		foreach ($scripts as $script) {
1028
+		foreach ( $scripts as $script ) {
1029 1029
 			wp_enqueue_script( $script );
1030 1030
 		}
1031 1031
 	}
@@ -1034,11 +1034,11 @@  discard block
 block discarded – undo
1034 1034
 
1035 1035
 		$filter = current_filter();
1036 1036
 
1037
-		if( preg_match('/script/ism', $filter ) ) {
1037
+		if ( preg_match( '/script/ism', $filter ) ) {
1038 1038
 			$allow_scripts = array( 'jquery-ui-core', 'jquery-ui-dialog', 'jquery-ui-tabs', 'jquery-ui-draggable', 'jquery-ui-droppable', 'jquery-ui-sortable', 'jquery-ui-tooltip', 'gravityview_views_scripts', 'gravityview-support', 'gravityview-jquery-cookie', 'gravityview_views_datepicker',
1039 1039
 			'sack', 'gform_gravityforms', 'gform_forms', 'gform_form_admin', 'jquery-ui-autocomplete' );
1040 1040
 			$registered = array_merge( $registered, $allow_scripts );
1041
-		} elseif( preg_match('/style/ism', $filter ) ) {
1041
+		} elseif ( preg_match( '/style/ism', $filter ) ) {
1042 1042
 			$allow_styles = array( 'dashicons', 'wp-jquery-ui-dialog', 'gravityview_views_styles', 'gravityview_global', 'gravityview_views_datepicker' );
1043 1043
 			$registered = array_merge( $registered, $allow_styles );
1044 1044
 		}
Please login to merge, or discard this patch.
includes/class-gravityview-roles-capabilities.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
 	 */
34 34
 	public static function get_instance() {
35 35
 
36
-		if( ! self::$instance ) {
36
+		if ( ! self::$instance ) {
37 37
 			self::$instance = new self;
38 38
 		}
39 39
 
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 		add_filter( 'members_get_capabilities', array( 'GravityView_Roles_Capabilities', 'merge_with_all_caps' ) );
57 57
 		add_action( 'members_register_cap_groups', array( $this, 'members_register_cap_group' ), 20 );
58 58
 		add_filter( 'user_has_cap', array( $this, 'filter_user_has_cap' ), 10, 4 );
59
-        add_action( 'admin_init', array( $this, 'add_caps') );
59
+        add_action( 'admin_init', array( $this, 'add_caps' ) );
60 60
 	}
61 61
 
62 62
 
@@ -77,18 +77,18 @@  discard block
 block discarded – undo
77 77
 	public function filter_user_has_cap( $usercaps = array(), $caps = array(), $args = array(), $user = NULL ) {
78 78
 
79 79
 		// Empty caps_to_check array
80
-		if( ! $usercaps || ! $caps ) {
80
+		if ( ! $usercaps || ! $caps ) {
81 81
 			return $usercaps;
82 82
 		}
83 83
 
84 84
 		/**
85 85
 		 * Enable all GravityView caps_to_check if `gravityview_full_access` is enabled
86 86
 		 */
87
-		if( ! empty( $usercaps['gravityview_full_access'] ) ) {
87
+		if ( ! empty( $usercaps[ 'gravityview_full_access' ] ) ) {
88 88
 
89 89
 			$all_gravityview_caps = self::all_caps();
90 90
 
91
-			foreach( $all_gravityview_caps as $gv_cap ) {
91
+			foreach ( $all_gravityview_caps as $gv_cap ) {
92 92
 				$usercaps[ $gv_cap ] = true;
93 93
 			}
94 94
 
@@ -304,7 +304,7 @@  discard block
 block discarded – undo
304 304
 		$all = $administrator;
305 305
 
306 306
 		// If role is set, return caps_to_check for just that role.
307
-		if( $single_role ) {
307
+		if ( $single_role ) {
308 308
 			$caps = isset( ${$single_role} ) ? ${$single_role} : false;
309 309
 			return $flat_array ? $caps : array( $single_role => $caps );
310 310
 		}
@@ -334,7 +334,7 @@  discard block
 block discarded – undo
334 334
 
335 335
 		$has_cap = false;
336 336
 
337
-		if( empty( $caps_to_check ) ) {
337
+		if ( empty( $caps_to_check ) ) {
338 338
 			return $has_cap;
339 339
 		}
340 340
 
@@ -342,13 +342,13 @@  discard block
 block discarded – undo
342 342
 		$caps_to_check = self::maybe_add_full_access_caps( $caps_to_check );
343 343
 
344 344
 		foreach ( $caps_to_check as $cap ) {
345
-			if( ! is_null( $object_id ) ) {
345
+			if ( ! is_null( $object_id ) ) {
346 346
 				$has_cap = $user_id ? user_can( $user_id, $cap, $object_id ) : current_user_can( $cap, $object_id );
347 347
 			} else {
348 348
 				$has_cap = $user_id ? user_can( $user_id, $cap ) : current_user_can( $cap );
349 349
 			}
350 350
 			// At the first successful response, stop checking
351
-			if( $has_cap ) {
351
+			if ( $has_cap ) {
352 352
 				break;
353 353
 			}
354 354
 		}
@@ -372,15 +372,15 @@  discard block
 block discarded – undo
372 372
 		$all_gravityview_caps = self::all_caps();
373 373
 
374 374
 		// Are there any $caps_to_check that are from GravityView?
375
-		if( $has_gravityview_caps = array_intersect( $caps_to_check, $all_gravityview_caps ) ) {
376
-			$caps_to_check[] = 'gravityview_full_access';
375
+		if ( $has_gravityview_caps = array_intersect( $caps_to_check, $all_gravityview_caps ) ) {
376
+			$caps_to_check[ ] = 'gravityview_full_access';
377 377
 		}
378 378
 
379 379
 		$all_gravity_forms_caps = class_exists( 'GFCommon' ) ? GFCommon::all_caps() : array();
380 380
 
381 381
 		// Are there any $caps_to_check that are from Gravity Forms?
382
-		if( $all_gravity_forms_caps = array_intersect( $caps_to_check, $all_gravity_forms_caps ) ) {
383
-			$caps_to_check[] = 'gform_full_access';
382
+		if ( $all_gravity_forms_caps = array_intersect( $caps_to_check, $all_gravity_forms_caps ) ) {
383
+			$caps_to_check[ ] = 'gform_full_access';
384 384
 		}
385 385
 
386 386
 		return array_unique( $caps_to_check );
@@ -402,7 +402,7 @@  discard block
 block discarded – undo
402 402
 			$capabilities = self::all_caps();
403 403
 
404 404
 			// Loop through each role and remove GV caps_to_check
405
-			foreach( $wp_roles->get_names() as $role_slug => $role_name ) {
405
+			foreach ( $wp_roles->get_names() as $role_slug => $role_name ) {
406 406
 				foreach ( $capabilities as $cap ) {
407 407
 					$wp_roles->remove_cap( $role_slug, $cap );
408 408
 				}
Please login to merge, or discard this patch.
includes/class-gv-license-handler.php 1 patch
Spacing   +62 added lines, -62 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
 	 * @return GV_License_Handler
35 35
 	 */
36 36
 	public static function get_instance( GravityView_Settings $GFAddOn ) {
37
-		if( empty( self::$instance ) ) {
37
+		if ( empty( self::$instance ) ) {
38 38
 			self::$instance = new self( $GFAddOn );
39 39
 		}
40 40
 		return self::$instance;
@@ -60,37 +60,37 @@  discard block
 block discarded – undo
60 60
 		$status = trim( $this->Addon->get_app_setting( 'license_key_status' ) );
61 61
 		$key = trim( $this->Addon->get_app_setting( 'license_key' ) );
62 62
 
63
-		if( !empty( $key ) ) {
63
+		if ( ! empty( $key ) ) {
64 64
 			$response = $this->Addon->get_app_setting( 'license_key_response' );
65
-			$response = is_array( $response ) ? (object) $response : json_decode( $response );
65
+			$response = is_array( $response ) ? (object)$response : json_decode( $response );
66 66
 		} else {
67 67
 			$response = array();
68 68
 		}
69 69
 
70 70
 		wp_localize_script( 'gv-admin-edd-license', 'GVGlobals', array(
71 71
 			'license_box' => $this->get_license_message( $response )
72
-		));
72
+		) );
73 73
 
74 74
 
75 75
 		$fields = array(
76 76
 			array(
77 77
 				'name'  => 'edd-activate',
78
-				'value' => __('Activate License', 'gravityview'),
79
-				'data-pending_text' => __('Verifying license&hellip;', 'gravityview'),
78
+				'value' => __( 'Activate License', 'gravityview' ),
79
+				'data-pending_text' => __( 'Verifying license&hellip;', 'gravityview' ),
80 80
 				'data-edd_action' => 'activate_license',
81 81
 				'class' => 'button-primary',
82 82
 			),
83 83
 			array(
84 84
 				'name'  => 'edd-deactivate',
85
-				'value' => __('Deactivate License', 'gravityview'),
86
-				'data-pending_text' => __('Deactivating license&hellip;', 'gravityview'),
85
+				'value' => __( 'Deactivate License', 'gravityview' ),
86
+				'data-pending_text' => __( 'Deactivating license&hellip;', 'gravityview' ),
87 87
 				'data-edd_action' => 'deactivate_license',
88 88
 				'class' => ( empty( $status ) ? 'button-primary hide' : 'button-primary' ),
89 89
 			),
90 90
 			array(
91 91
 				'name'  => 'edd-check',
92
-				'value' => __('Check License', 'gravityview'),
93
-				'data-pending_text' => __('Verifying license&hellip;', 'gravityview'),
92
+				'value' => __( 'Check License', 'gravityview' ),
93
+				'data-pending_text' => __( 'Verifying license&hellip;', 'gravityview' ),
94 94
 				'title' => 'Check the license before saving it',
95 95
 				'data-edd_action' => 'check_license',
96 96
 				'class' => 'button-secondary',
@@ -100,17 +100,17 @@  discard block
 block discarded – undo
100 100
 
101 101
 		$class = 'button gv-edd-action';
102 102
 
103
-		$class .= ( !empty( $key ) && $status !== 'valid' ) ? '' : ' hide';
103
+		$class .= ( ! empty( $key ) && $status !== 'valid' ) ? '' : ' hide';
104 104
 
105 105
 		$disabled_attribute = GVCommon::has_cap( 'gravityview_edit_settings' ) ? false : 'disabled';
106 106
 
107 107
 		$submit = '<div class="gv-edd-button-wrapper">';
108 108
 		foreach ( $fields as $field ) {
109
-			$field['type'] = 'button';
110
-			$field['class'] = isset( $field['class'] ) ? $field['class'] . ' '. $class : $class;
111
-			$field['style'] = 'margin-left: 10px;';
112
-			if( $disabled_attribute ) {
113
-				$field['disabled'] = $disabled_attribute;
109
+			$field[ 'type' ] = 'button';
110
+			$field[ 'class' ] = isset( $field[ 'class' ] ) ? $field[ 'class' ] . ' ' . $class : $class;
111
+			$field[ 'style' ] = 'margin-left: 10px;';
112
+			if ( $disabled_attribute ) {
113
+				$field[ 'disabled' ] = $disabled_attribute;
114 114
 			}
115 115
 			$submit .= $this->Addon->settings_submit( $field, $echo );
116 116
 		}
@@ -126,8 +126,8 @@  discard block
 block discarded – undo
126 126
 	 */
127 127
 	private function setup_edd() {
128 128
 
129
-		if( !class_exists('EDD_SL_Plugin_Updater') ) {
130
-			require_once( GRAVITYVIEW_DIR . 'includes/lib/EDD_SL_Plugin_Updater.php');
129
+		if ( ! class_exists( 'EDD_SL_Plugin_Updater' ) ) {
130
+			require_once( GRAVITYVIEW_DIR . 'includes/lib/EDD_SL_Plugin_Updater.php' );
131 131
 		}
132 132
 
133 133
 		// setup the updater
@@ -163,8 +163,8 @@  discard block
 block discarded – undo
163 163
 			'url'       => home_url(),
164 164
 		);
165 165
 
166
-		if( !empty( $action ) ) {
167
-			$settings['edd_action'] = esc_attr( $action );
166
+		if ( ! empty( $action ) ) {
167
+			$settings[ 'edd_action' ] = esc_attr( $action );
168 168
 		}
169 169
 
170 170
 		$settings = array_map( 'urlencode', $settings );
@@ -178,14 +178,14 @@  discard block
 block discarded – undo
178 178
 	 */
179 179
 	private function _license_get_remote_response( $data, $license = '' ) {
180 180
 
181
-		$api_params = $this->_get_edd_settings( $data['edd_action'], $license );
181
+		$api_params = $this->_get_edd_settings( $data[ 'edd_action' ], $license );
182 182
 
183 183
 		$url = add_query_arg( $api_params, self::url );
184 184
 
185 185
 		$response = wp_remote_get( $url, array(
186 186
 			'timeout'   => 15,
187 187
 			'sslverify' => false,
188
-		));
188
+		) );
189 189
 
190 190
 		if ( is_wp_error( $response ) ) {
191 191
 			return array();
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
 		// Not JSON
197 197
 		if ( empty( $license_data ) ) {
198 198
 
199
-			delete_transient( 'gravityview_' . esc_attr( $data['field_id'] ) . '_valid' );
199
+			delete_transient( 'gravityview_' . esc_attr( $data[ 'field_id' ] ) . '_valid' );
200 200
 
201 201
 			// Change status
202 202
 			return array();
@@ -218,12 +218,12 @@  discard block
 block discarded – undo
218 218
 	 */
219 219
 	function get_license_message( $license_data ) {
220 220
 
221
-		if( empty( $license_data ) ) {
221
+		if ( empty( $license_data ) ) {
222 222
 			$class = 'hide';
223 223
 			$message = '';
224 224
 		} else {
225 225
 
226
-			if( ! empty( $license_data->error ) ) {
226
+			if ( ! empty( $license_data->error ) ) {
227 227
 				$class = 'error';
228 228
 				$string_key = $license_data->license;
229 229
 			} else {
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
 				$string_key = $license_data->license;
232 232
 			}
233 233
 
234
-			$message = sprintf( '<p><strong>%s: %s</strong></p>', $this->strings('status'), $this->strings( $string_key, $license_data ) );
234
+			$message = sprintf( '<p><strong>%s: %s</strong></p>', $this->strings( 'status' ), $this->strings( $string_key, $license_data ) );
235 235
 		}
236 236
 
237 237
 		return $this->generate_license_box( $message, $class );
@@ -272,16 +272,16 @@  discard block
 block discarded – undo
272 272
 	 */
273 273
 	public function license_call( $array = array() ) {
274 274
 
275
-		$is_ajax = ( defined('DOING_AJAX') && DOING_AJAX );
276
-		$data = empty( $array ) ? $_POST['data'] : $array;
275
+		$is_ajax = ( defined( 'DOING_AJAX' ) && DOING_AJAX );
276
+		$data = empty( $array ) ? $_POST[ 'data' ] : $array;
277 277
 		$has_cap = GVCommon::has_cap( 'gravityview_edit_settings' );
278 278
 
279
-		if ( $is_ajax && empty( $data['license'] ) ) {
280
-			die( - 1 );
279
+		if ( $is_ajax && empty( $data[ 'license' ] ) ) {
280
+			die( -1 );
281 281
 		}
282 282
 
283 283
 		// If the user isn't allowed to edit settings, show an error message
284
-		if( ! $has_cap ) {
284
+		if ( ! $has_cap ) {
285 285
 			$license_data = new stdClass();
286 286
 			$license_data->error = 'capability';
287 287
 			$license_data->message = $this->get_license_message( $license_data );
@@ -304,9 +304,9 @@  discard block
 block discarded – undo
304 304
 
305 305
 			$json = json_encode( $license_data );
306 306
 
307
-			$update_license = ( ! isset( $data['update'] ) || ! empty( $data['update'] ) );
307
+			$update_license = ( ! isset( $data[ 'update' ] ) || ! empty( $data[ 'update' ] ) );
308 308
 
309
-			$is_check_action_button = ( 'check_license' === $data['edd_action'] && defined( 'DOING_AJAX' ) && DOING_AJAX );
309
+			$is_check_action_button = ( 'check_license' === $data[ 'edd_action' ] && defined( 'DOING_AJAX' ) && DOING_AJAX );
310 310
 
311 311
 			// Failed is the response from trying to de-activate a license and it didn't work.
312 312
 			// This likely happened because people entered in a different key and clicked "Deactivate",
@@ -314,8 +314,8 @@  discard block
 block discarded – undo
314 314
 			// most likely a mistake.
315 315
 			if ( $license_data->license !== 'failed' && ! $is_check_action_button && $update_license ) {
316 316
 
317
-				if ( ! empty( $data['field_id'] ) ) {
318
-					set_transient( 'gravityview_' . esc_attr( $data['field_id'] ) . '_valid', $license_data, DAY_IN_SECONDS );
317
+				if ( ! empty( $data[ 'field_id' ] ) ) {
318
+					set_transient( 'gravityview_' . esc_attr( $data[ 'field_id' ] ) . '_valid', $license_data, DAY_IN_SECONDS );
319 319
 				}
320 320
 
321 321
 				$this->license_call_update_settings( $license_data, $data );
@@ -326,7 +326,7 @@  discard block
 block discarded – undo
326 326
 		if ( $is_ajax ) {
327 327
 			exit( $json );
328 328
 		} else { // Non-ajax call
329
-			return ( rgget('format', $data ) === 'object' ) ? $license_data : $json;
329
+			return ( rgget( 'format', $data ) === 'object' ) ? $license_data : $json;
330 330
 		}
331 331
 	}
332 332
 
@@ -340,9 +340,9 @@  discard block
 block discarded – undo
340 340
 		// Update option with passed data license
341 341
 		$settings = $this->Addon->get_app_settings();
342 342
 
343
-        $settings['license_key'] = $license_data->license_key = trim( $data['license'] );
344
-		$settings['license_key_status'] = $license_data->license;
345
-		$settings['license_key_response'] = (array)$license_data;
343
+        $settings[ 'license_key' ] = $license_data->license_key = trim( $data[ 'license' ] );
344
+		$settings[ 'license_key_status' ] = $license_data->license;
345
+		$settings[ 'license_key_response' ] = (array)$license_data;
346 346
 
347 347
 		$this->Addon->update_app_settings( $settings );
348 348
 	}
@@ -354,7 +354,7 @@  discard block
 block discarded – undo
354 354
 	 * @return string Renewal or account URL
355 355
 	 */
356 356
 	private function get_license_renewal_url( $license_data ) {
357
-		$renew_license_url = ( ! empty( $license_data ) && !empty( $license_data->license_key ) ) ? sprintf( 'https://gravityview.co/checkout/?download_id=17&edd_license_key=%s&utm_source=admin_notice&utm_medium=admin&utm_content=expired&utm_campaign=Activation', $license_data->license_key ) : 'https://gravityview.co/account/';
357
+		$renew_license_url = ( ! empty( $license_data ) && ! empty( $license_data->license_key ) ) ? sprintf( 'https://gravityview.co/checkout/?download_id=17&edd_license_key=%s&utm_source=admin_notice&utm_medium=admin&utm_content=expired&utm_campaign=Activation', $license_data->license_key ) : 'https://gravityview.co/account/';
358 358
 		return $renew_license_url;
359 359
 	}
360 360
 
@@ -368,30 +368,30 @@  discard block
 block discarded – undo
368 368
 
369 369
 
370 370
 		$strings = array(
371
-			'status' => esc_html__('Status', 'gravityview'),
372
-			'error' => esc_html__('There was an error processing the request.', 'gravityview'),
373
-			'failed'  => esc_html__('Could not deactivate the license. The license key you attempted to deactivate may not be active or valid.', 'gravityview'),
374
-			'site_inactive' => esc_html__('The license key is valid, but it has not been activated for this site.', 'gravityview'),
375
-			'no_activations_left' => esc_html__('Invalid: this license has reached its activation limit.', 'gravityview') . ' ' . sprintf( esc_html__('You can manage license activations %son your GravityView account page%s.', 'gravityview'), '<a href="https://gravityview.co/account/#licenses">', '</a>' ),
376
-			'deactivated' => esc_html__('The license has been deactivated.', 'gravityview'),
377
-			'valid' => esc_html__('The license key is valid and active.', 'gravityview'),
378
-			'invalid' => esc_html__('The license key entered is invalid.', 'gravityview'),
379
-			'missing' => esc_html__('The license key was not defined.', 'gravityview'),
380
-			'revoked' => esc_html__('This license key has been revoked.', 'gravityview'),
381
-			'expired' => sprintf( esc_html__('This license key has expired. %sRenew your license on the GravityView website%s to receive updates and support.', 'gravityview'), '<a href="'. esc_url( $this->get_license_renewal_url( $license_data ) ) .'">', '</a>' ),
371
+			'status' => esc_html__( 'Status', 'gravityview' ),
372
+			'error' => esc_html__( 'There was an error processing the request.', 'gravityview' ),
373
+			'failed'  => esc_html__( 'Could not deactivate the license. The license key you attempted to deactivate may not be active or valid.', 'gravityview' ),
374
+			'site_inactive' => esc_html__( 'The license key is valid, but it has not been activated for this site.', 'gravityview' ),
375
+			'no_activations_left' => esc_html__( 'Invalid: this license has reached its activation limit.', 'gravityview' ) . ' ' . sprintf( esc_html__( 'You can manage license activations %son your GravityView account page%s.', 'gravityview' ), '<a href="https://gravityview.co/account/#licenses">', '</a>' ),
376
+			'deactivated' => esc_html__( 'The license has been deactivated.', 'gravityview' ),
377
+			'valid' => esc_html__( 'The license key is valid and active.', 'gravityview' ),
378
+			'invalid' => esc_html__( 'The license key entered is invalid.', 'gravityview' ),
379
+			'missing' => esc_html__( 'The license key was not defined.', 'gravityview' ),
380
+			'revoked' => esc_html__( 'This license key has been revoked.', 'gravityview' ),
381
+			'expired' => sprintf( esc_html__( 'This license key has expired. %sRenew your license on the GravityView website%s to receive updates and support.', 'gravityview' ), '<a href="' . esc_url( $this->get_license_renewal_url( $license_data ) ) . '">', '</a>' ),
382 382
 			'capability' => esc_html__( 'You don\'t have the ability to edit plugin settings.', 'gravityview' ),
383 383
 
384
-			'verifying_license' => esc_html__('Verifying license&hellip;', 'gravityview'),
385
-			'activate_license' => esc_html__('Activate License', 'gravityview'),
386
-			'deactivate_license' => esc_html__('Deactivate License', 'gravityview'),
387
-			'check_license' => esc_html__('Verify License', 'gravityview'),
384
+			'verifying_license' => esc_html__( 'Verifying license&hellip;', 'gravityview' ),
385
+			'activate_license' => esc_html__( 'Activate License', 'gravityview' ),
386
+			'deactivate_license' => esc_html__( 'Deactivate License', 'gravityview' ),
387
+			'check_license' => esc_html__( 'Verify License', 'gravityview' ),
388 388
 		);
389 389
 
390
-		if( empty( $status ) ) {
390
+		if ( empty( $status ) ) {
391 391
 			return $strings;
392 392
 		}
393 393
 
394
-		if( isset( $strings[ $status ] ) ) {
394
+		if ( isset( $strings[ $status ] ) ) {
395 395
 			return $strings[ $status ];
396 396
 		}
397 397
 
@@ -401,19 +401,19 @@  discard block
 block discarded – undo
401 401
 	public function validate_license_key( $value, $field ) {
402 402
 
403 403
 		// No license? No status.
404
-		if( empty( $value ) ) {
404
+		if ( empty( $value ) ) {
405 405
 			return NULL;
406 406
 		}
407 407
 
408
-		$response = $this->license_call(array(
408
+		$response = $this->license_call( array(
409 409
 			'license' => $this->Addon->get_app_setting( 'license_key' ),
410 410
 			'edd_action' => 'check_license',
411
-			'field_id' => $field['name'],
412
-		));
411
+			'field_id' => $field[ 'name' ],
412
+		) );
413 413
 
414 414
 		$response = is_string( $response ) ? json_decode( $response, true ) : $response;
415 415
 
416
-		switch( $response['license'] ) {
416
+		switch ( $response[ 'license' ] ) {
417 417
 			case 'valid':
418 418
 				$return = true;
419 419
 				break;
Please login to merge, or discard this patch.
includes/class-gravityview-admin-bar.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
 			$wp_admin_bar->add_menu( array(
63 63
 				'id' => 'edit-entry',
64 64
 				'title' => __( 'Edit Entry', 'gravityview' ),
65
-				'href' => esc_url_raw( admin_url( sprintf( 'admin.php?page=gf_entries&amp;screen_mode=edit&amp;view=entry&amp;id=%d&lid=%d', $entry['form_id'], $entry['id'] ) ) ),
65
+				'href' => esc_url_raw( admin_url( sprintf( 'admin.php?page=gf_entries&amp;screen_mode=edit&amp;view=entry&amp;id=%d&lid=%d', $entry[ 'form_id' ], $entry[ 'id' ] ) ) ),
66 66
 			) );
67 67
 
68 68
 		}
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 		/** @var WP_Admin_Bar $wp_admin_bar */
79 79
 		global $wp_admin_bar;
80 80
 
81
-		if( GVCommon::has_cap('edit_gravityviews') ) {
81
+		if ( GVCommon::has_cap( 'edit_gravityviews' ) ) {
82 82
 
83 83
 			$view_data = GravityView_View_Data::getInstance();
84 84
 
@@ -89,11 +89,11 @@  discard block
 block discarded – undo
89 89
 			if ( ! $this->gravityview_view->isGravityviewPostType() && ! empty( $views ) && ! $view_data->has_multiple_views() ) {
90 90
 				$view = reset( $views );
91 91
 
92
-				if( GVCommon::has_cap( 'edit_gravityview', $view['id'] ) ) {
92
+				if ( GVCommon::has_cap( 'edit_gravityview', $view[ 'id' ] ) ) {
93 93
 					$wp_admin_bar->add_menu( array(
94 94
 						'id'    => 'edit-view',
95 95
 						'title' => __( 'Edit View', 'gravityview' ),
96
-						'href'  => esc_url_raw( admin_url( sprintf( 'post.php?post=%d&action=edit', $view['id'] ) ) ),
96
+						'href'  => esc_url_raw( admin_url( sprintf( 'post.php?post=%d&action=edit', $view[ 'id' ] ) ) ),
97 97
 					) );
98 98
 				}
99 99
 			}
Please login to merge, or discard this patch.
includes/fields/class-gravityview-field.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
 
111 111
 		add_filter( 'gravityview/sortable/field_blacklist', array( $this, '_filter_sortable_fields' ), 1 );
112 112
 
113
-		if( $this->_custom_merge_tag ) {
113
+		if ( $this->_custom_merge_tag ) {
114 114
 			add_filter( 'gform_custom_merge_tags', array( $this, '_filter_gform_custom_merge_tags' ), 10, 4 );
115 115
 			add_filter( 'gform_replace_merge_tags', array( $this, '_filter_gform_replace_merge_tags' ), 10, 7 );
116 116
 		}
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
 	 *
133 133
 	 * @return string Original text if {_custom_merge_tag} isn't found. Otherwise, replaced text.
134 134
 	 */
135
-	public function _filter_gform_replace_merge_tags( $text, $form = array(), $entry = array(), $url_encode = false, $esc_html = false  ) {
135
+	public function _filter_gform_replace_merge_tags( $text, $form = array(), $entry = array(), $url_encode = false, $esc_html = false ) {
136 136
 
137 137
 		/**
138 138
 		 * This prevents the gform_replace_merge_tags filter from being called twice, as defined in:
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
 		 * @see GFCommon::replace_variables_prepopulate()
141 141
 		 * @todo Remove eventually: Gravity Forms fixed this issue in 1.9.14
142 142
 		 */
143
-		if( false === $form ) {
143
+		if ( false === $form ) {
144 144
 			return $text;
145 145
 		}
146 146
 
@@ -173,19 +173,19 @@  discard block
 block discarded – undo
173 173
 	 */
174 174
 	public function replace_merge_tag( $matches = array(), $text = '', $form = array(), $entry = array(), $url_encode = false, $esc_html = false ) {
175 175
 
176
-		foreach( $matches as $match ) {
176
+		foreach ( $matches as $match ) {
177 177
 
178
-			$full_tag = $match[0];
178
+			$full_tag = $match[ 0 ];
179 179
 
180 180
 			// Strip the Merge Tags
181
-			$tag = str_replace( array( '{', '}'), '', $full_tag );
181
+			$tag = str_replace( array( '{', '}' ), '', $full_tag );
182 182
 
183 183
 			// Replace the value from the entry, if exists
184
-			if( isset( $entry[ $tag ] ) ) {
184
+			if ( isset( $entry[ $tag ] ) ) {
185 185
 
186 186
 				$value = $entry[ $tag ];
187 187
 
188
-				if( is_callable( array( $this, 'get_content') ) ) {
188
+				if ( is_callable( array( $this, 'get_content' ) ) ) {
189 189
 					$value = $this->get_content( $value );
190 190
 				}
191 191
 
@@ -258,8 +258,8 @@  discard block
 block discarded – undo
258 258
 	 */
259 259
 	public function _filter_sortable_fields( $not_sortable ) {
260 260
 
261
-		if( ! $this->is_sortable ) {
262
-			$not_sortable[] = $this->name;
261
+		if ( ! $this->is_sortable ) {
262
+			$not_sortable[ ] = $this->name;
263 263
 		}
264 264
 
265 265
 		return $not_sortable;
@@ -288,7 +288,7 @@  discard block
 block discarded – undo
288 288
 			'date_display' => array(
289 289
 				'type' => 'text',
290 290
 				'label' => __( 'Override Date Format', 'gravityview' ),
291
-				'desc' => sprintf( __( 'Define how the date is displayed (using %sthe PHP date format%s)', 'gravityview'), '<a href="https://codex.wordpress.org/Formatting_Date_and_Time">', '</a>' ),
291
+				'desc' => sprintf( __( 'Define how the date is displayed (using %sthe PHP date format%s)', 'gravityview' ), '<a href="https://codex.wordpress.org/Formatting_Date_and_Time">', '</a>' ),
292 292
 				/**
293 293
 				 * @filter `gravityview_date_format` Override the date format with a [PHP date format](https://codex.wordpress.org/Formatting_Date_and_Time)
294 294
 				 * @param[in,out] null|string $date_format Date Format (default: null)
@@ -313,7 +313,7 @@  discard block
 block discarded – undo
313 313
 
314 314
 		$options = $this->field_support_options();
315 315
 
316
-		if( isset( $options[ $key ] ) ) {
316
+		if ( isset( $options[ $key ] ) ) {
317 317
 			$field_options[ $key ] = $options[ $key ];
318 318
 		}
319 319
 
Please login to merge, or discard this patch.
includes/fields/class-gravityview-field-radio.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@
 block discarded – undo
9 9
 
10 10
 	var $name = 'radio';
11 11
 
12
-	var $search_operators = array( 'is', 'in', 'not in', 'isnot', 'contains');
12
+	var $search_operators = array( 'is', 'in', 'not in', 'isnot', 'contains' );
13 13
 
14 14
 	var $_gf_field_class_name = 'GF_Field_Radio';
15 15
 
Please login to merge, or discard this patch.