Completed
Pull Request — develop (#1810)
by
unknown
17:08
created
includes/plugin-and-theme-hooks/class-gravityview-theme-hooks-wpml.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 
65 65
 		add_filter( 'icl_ls_languages', array( $this, 'wpml_ls_filter' ) );
66 66
 
67
-		add_filter( 'gravityview_directory_link', array( $this, 'filter_gravityview_back_link') );
67
+		add_filter( 'gravityview_directory_link', array( $this, 'filter_gravityview_back_link' ) );
68 68
 	}
69 69
 
70 70
 	/**
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
 	function filter_gravityview_back_link( $link ) {
85 85
 		global $wpml_url_filters;
86 86
 
87
-		if( $wpml_url_filters ) {
87
+		if ( $wpml_url_filters ) {
88 88
 			$link = $wpml_url_filters->permalink_filter( $link, GravityView_frontend::getInstance()->getPostId() );
89 89
 		}
90 90
 
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
 	private function remove_url_hooks() {
102 102
 		global $wpml_url_filters;
103 103
 
104
-		if( ! $wpml_url_filters ) {
104
+		if ( ! $wpml_url_filters ) {
105 105
 			return;
106 106
 		}
107 107
 
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
 	private function add_url_hooks() {
130 130
 		global $wpml_url_filters;
131 131
 
132
-		if( ! $wpml_url_filters ) {
132
+		if ( ! $wpml_url_filters ) {
133 133
 			return;
134 134
 		}
135 135
 
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
 					break;
227 227
 			}
228 228
 
229
-			$languages[ $lang_code ]['url'] = $entry_link;
229
+			$languages[ $lang_code ][ 'url' ] = $entry_link;
230 230
 		}
231 231
 
232 232
 		$this->add_url_hooks();
Please login to merge, or discard this patch.
includes/fields/class-gravityview-field-time.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
 
63 63
 		add_filter( 'gravityview/sorting/time', array( $this, 'modify_sort_id' ), 10, 2 );
64 64
 
65
-		add_filter('gravityview_search_criteria', array( $this, '_maybe_filter_gravity_forms_query' ), 10, 4 );
65
+		add_filter( 'gravityview_search_criteria', array( $this, '_maybe_filter_gravity_forms_query' ), 10, 4 );
66 66
 	}
67 67
 
68 68
 	/**
@@ -103,35 +103,35 @@  discard block
 block discarded – undo
103 103
 	public function _maybe_filter_gravity_forms_query( $criteria, $form_ids, $view_id ) {
104 104
 
105 105
 		// If the search is not being sorted, return early
106
-		if( empty( $criteria['sorting']['key'] ) ) {
106
+		if ( empty( $criteria[ 'sorting' ][ 'key' ] ) ) {
107 107
 			return $criteria;
108 108
 		}
109 109
 
110
-		$pieces = explode( $this->_sort_divider, $criteria['sorting']['key'] );
110
+		$pieces = explode( $this->_sort_divider, $criteria[ 'sorting' ][ 'key' ] );
111 111
 
112 112
 		/**
113 113
 		 * If the sort key does not match the key set in modify_sort_id(), do not modify the Gravity Forms query SQL
114 114
 		 * @see modify_sort_id()
115 115
 		 */
116
-		if( empty( $pieces[1] ) ) {
116
+		if ( empty( $pieces[ 1 ] ) ) {
117 117
 			return $criteria;
118 118
 		}
119 119
 
120 120
 		// Pass these to the _modify_query_sort_by_time_hack() method
121
-		$this->_time_format = $pieces[1];
122
-		$this->_date_format = $pieces[2];
121
+		$this->_time_format = $pieces[ 1 ];
122
+		$this->_date_format = $pieces[ 2 ];
123 123
 
124 124
 		// Remove fake input IDs (5.1 doesn't exist. Use 5)
125
-		$criteria['sorting']['key'] = floor( $pieces[0] );
125
+		$criteria[ 'sorting' ][ 'key' ] = floor( $pieces[ 0 ] );
126 126
 
127 127
 		/**
128 128
 		 * Make sure sorting is numeric (# of seconds). IMPORTANT.
129 129
 		 * @see GVCommon::is_field_numeric() is_numeric should also be set here
130 130
 		 */
131
-		$criteria['sorting']['is_numeric'] = true;
131
+		$criteria[ 'sorting' ][ 'is_numeric' ] = true;
132 132
 
133 133
 		// Modify the Gravity Forms WP Query
134
-		add_filter('query', array( $this, '_modify_query_sort_by_time_hack' ) );
134
+		add_filter( 'query', array( $this, '_modify_query_sort_by_time_hack' ) );
135 135
 
136 136
 		return $criteria;
137 137
 	}
@@ -152,9 +152,9 @@  discard block
 block discarded – undo
152 152
 		 * then we want to modify the query.
153 153
 		 * @see GFFormsModel::sort_by_field_query()
154 154
 		 */
155
-		if( strpos( $query, self::GF_SORTING_SQL ) > 0 ) {
155
+		if ( strpos( $query, self::GF_SORTING_SQL ) > 0 ) {
156 156
 
157
-			if( $this->_time_format === '24' ) {
157
+			if ( $this->_time_format === '24' ) {
158 158
 				$sql_str_to_date = "STR_TO_DATE( `value`, '%H:%i' )";
159 159
 			} else {
160 160
 				$sql_str_to_date = "STR_TO_DATE( `value`, '%h:%i %p' )";
@@ -200,18 +200,18 @@  discard block
 block discarded – undo
200 200
 		// Set variables
201 201
 		parent::field_options( $field_options, $template_id, $field_id, $context, $input_type, $form_id );
202 202
 
203
-		if( 'edit' === $context ) {
203
+		if ( 'edit' === $context ) {
204 204
 			return $field_options;
205 205
 		}
206 206
 
207 207
 		/**
208 208
 		 * Set default date format based on field ID and Form ID
209 209
 		 */
210
-		add_filter('gravityview_date_format', array( $this, '_filter_date_display_date_format' ) );
210
+		add_filter( 'gravityview_date_format', array( $this, '_filter_date_display_date_format' ) );
211 211
 
212
-		$this->add_field_support('date_display', $field_options );
212
+		$this->add_field_support( 'date_display', $field_options );
213 213
 
214
-		remove_filter('gravityview_date_format', array( $this, '_filter_date_display_date_format' ) );
214
+		remove_filter( 'gravityview_date_format', array( $this, '_filter_date_display_date_format' ) );
215 215
 
216 216
 		return $field_options;
217 217
 	}
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
 	private function _get_time_format() {
227 227
 		global $post;
228 228
 
229
-		$current_form = isset( $_POST['form_id'] ) ? intval( $_POST['form_id'] ) : gravityview_get_form_id( $post->ID );
229
+		$current_form = isset( $_POST[ 'form_id' ] ) ? intval( $_POST[ 'form_id' ] ) : gravityview_get_form_id( $post->ID );
230 230
 
231 231
 		return self::_get_time_format_for_field( $this->_field_id, $current_form );
232 232
 	}
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
 		// GF defaults to 12, so should we.
246 246
 		$time_format = '12';
247 247
 
248
-		if( $form_id ) {
248
+		if ( $form_id ) {
249 249
 			$form = GFAPI::get_form( $form_id );
250 250
 
251 251
 			if ( $form ) {
@@ -292,7 +292,7 @@  discard block
 block discarded – undo
292 292
 		$default = 'h:i A';
293 293
 
294 294
 		// This doesn't take into account 24-hour
295
-		switch( $field_input_id ) {
295
+		switch ( $field_input_id ) {
296 296
 			// Hours
297 297
 			case 1:
298 298
 				return ( $time_format === '12' ) ? 'h' : 'H';
Please login to merge, or discard this patch.
includes/fields/class-gravityview-field-hidden.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 	function edit_entry_fix_hidden_fields( $fields ) {
50 50
 
51 51
 		/** @type GF_Field $field */
52
-		foreach( $fields as &$field ) {
52
+		foreach ( $fields as &$field ) {
53 53
 
54 54
 			if ( 'hidden' === $field->type ) {
55 55
 
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
 				 */
63 63
 				$reveal_hidden_field = apply_filters( 'gravityview/edit_entry/reveal_hidden_field', false, $field );
64 64
 
65
-				if( ! $reveal_hidden_field ) {
65
+				if ( ! $reveal_hidden_field ) {
66 66
 					continue;
67 67
 				}
68 68
 
Please login to merge, or discard this patch.
plugin-and-theme-hooks/class-gravityview-plugin-hooks-gravity-perks.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@
 block discarded – undo
50 50
 	public function edit_entry_fix_uid_fields( $fields ) {
51 51
 
52 52
 		/** @type \GF_Field $field */
53
-		foreach( $fields as &$field ) {
53
+		foreach ( $fields as &$field ) {
54 54
 			if ( 'uid' === $field->type ) {
55 55
 
56 56
 				// Replace GF_Field with GF_Field_Text, copying all the data from $field
Please login to merge, or discard this patch.
future/includes/class-gv-field.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
 	 * @return \GV\Field The field implementation from configuration (\GV\GF_Field, \GV\Internal_Field).
167 167
 	 */
168 168
 	public static function from_configuration( $configuration ) {
169
-		if ( empty( $configuration['id'] ) ) {
169
+		if ( empty( $configuration[ 'id' ] ) ) {
170 170
 			$field = new self();
171 171
 			gravityview()->log->error( 'Trying to get field from configuration without a field ID.', array( 'data' => $configuration ) );
172 172
 			$field->update_configuration( $configuration );
@@ -179,8 +179,8 @@  discard block
 block discarded – undo
179 179
 		} else {
180 180
 			$trace = debug_backtrace( DEBUG_BACKTRACE_IGNORE_ARGS );
181 181
 		}
182
-		$trace = $trace[1];
183
-		if ( $trace['function'] == 'from_configuration' && $trace['class'] == __CLASS__ ) {
182
+		$trace = $trace[ 1 ];
183
+		if ( $trace[ 'function' ] == 'from_configuration' && $trace[ 'class' ] == __CLASS__ ) {
184 184
 			$field = new self();
185 185
 			gravityview()->log->error( 'Infinite loop protection tripped. Returning default class here.' );
186 186
 			$field->update_configuration( $configuration );
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
 		}
189 189
 
190 190
 		/** @type \GV\GF_Field|\GV\Internal_Field $field_class Determine the field implementation to use, and try to use. */
191
-		$field_class = is_numeric( $configuration['id'] ) ? '\GV\GF_Field' : '\GV\Internal_Field';
191
+		$field_class = is_numeric( $configuration[ 'id' ] ) ? '\GV\GF_Field' : '\GV\Internal_Field';
192 192
 
193 193
 		/**
194 194
 		 * @filter `gravityview/field/class` Filter the field class about to be created from the configuration.
@@ -227,24 +227,24 @@  discard block
 block discarded – undo
227 227
 	public function update_configuration( $configuration ) {
228 228
 		$configuration = wp_parse_args( $configuration, $this->as_configuration() );
229 229
 
230
-		if ( $this->ID != $configuration['id'] ) {
230
+		if ( $this->ID != $configuration[ 'id' ] ) {
231 231
 			/** Smelling trouble here... */
232 232
 			gravityview()->log->warning( 'ID is being changed for {field_class} instance, but implementation is not. Use ::from_configuration instead', array( 'field_class', __CLASS__ ) );
233 233
 		}
234 234
 
235
-		$this->ID = $configuration['id'];
236
-		$this->label = $configuration['label'];
237
-		$this->show_label = $configuration['show_label'] == '1';
238
-		$this->custom_label = $configuration['custom_label'];
239
-		$this->custom_class = $configuration['custom_class'];
240
-		$this->cap = $configuration['only_loggedin'] == '1' ? $configuration['only_loggedin_cap'] : '';
241
-		$this->search_filter = $configuration['search_filter'] == '1';
242
-		$this->show_as_link = $configuration['show_as_link'] == '1';
235
+		$this->ID = $configuration[ 'id' ];
236
+		$this->label = $configuration[ 'label' ];
237
+		$this->show_label = $configuration[ 'show_label' ] == '1';
238
+		$this->custom_label = $configuration[ 'custom_label' ];
239
+		$this->custom_class = $configuration[ 'custom_class' ];
240
+		$this->cap = $configuration[ 'only_loggedin' ] == '1' ? $configuration[ 'only_loggedin_cap' ] : '';
241
+		$this->search_filter = $configuration[ 'search_filter' ] == '1';
242
+		$this->show_as_link = $configuration[ 'show_as_link' ] == '1';
243 243
 
244 244
 		/** Shared among all field types (sort of). */
245 245
 		$shared_configuration_keys = array(
246 246
 			'id', 'label', 'show_label', 'custom_label', 'custom_class',
247
-			'only_loggedin' ,'only_loggedin_cap', 'search_filter', 'show_as_link',
247
+			'only_loggedin', 'only_loggedin_cap', 'search_filter', 'show_as_link',
248 248
 		);
249 249
 
250 250
 		/** Everything else goes into the properties for now. @todo subclasses! */
@@ -273,7 +273,7 @@  discard block
 block discarded – undo
273 273
 
274 274
 		/** A custom label is available. */
275 275
 		if ( ! empty( $this->custom_label ) ) {
276
-			return \GravityView_API::replace_variables( $this->custom_label, $source ? $source->form ? : null : null, $entry ? $entry->as_entry() : null );
276
+			return \GravityView_API::replace_variables( $this->custom_label, $source ? $source->form ?: null : null, $entry ? $entry->as_entry() : null );
277 277
 		}
278 278
 
279 279
 		return '';
@@ -359,7 +359,7 @@  discard block
 block discarded – undo
359 359
 	 * @return mixed|null The value for the given configuration key, null if doesn't exist.
360 360
 	 */
361 361
 	public function __get( $key ) {
362
-		switch( $key ) {
362
+		switch ( $key ) {
363 363
 			default:
364 364
 				if ( isset( $this->configuration[ $key ] ) ) {
365 365
 					return $this->configuration[ $key ];
@@ -377,7 +377,7 @@  discard block
 block discarded – undo
377 377
 	 * @return boolean Whether this $key is set or not.
378 378
 	 */
379 379
 	public function __isset( $key ) {
380
-		switch( $key ) {
380
+		switch ( $key ) {
381 381
 			default:
382 382
 				return isset( $this->configuration[ $key ] );
383 383
 		}
Please login to merge, or discard this patch.
class-gravityview-plugin-hooks-gravityformspartialentries.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
 
54 54
 		$partial_entries_addon = GF_Partial_Entries::get_instance();
55 55
 
56
-		$feed_settings = $partial_entries_addon->get_feed_settings( $form['id'] );
56
+		$feed_settings = $partial_entries_addon->get_feed_settings( $form[ 'id' ] );
57 57
 
58 58
 		$is_enabled = \GV\Utils::get( $feed_settings, 'enable', 0 );
59 59
 
@@ -70,14 +70,14 @@  discard block
 block discarded – undo
70 70
 		}
71 71
 
72 72
 		// Set the expected $_POST key for the Add-On to use
73
-		$_POST['partial_entry_id'] = $partial_entry_id;
73
+		$_POST[ 'partial_entry_id' ] = $partial_entry_id;
74 74
 
75 75
 		gravityview()->log->debug( 'Saving partial entry (ID #{partial_entry_id}) for Entry #{entry_id}', array(
76 76
 			'partial_entry_id' => $partial_entry_id,
77 77
 			'entry_id'         => $entry_id
78 78
 		) );
79 79
 
80
-		$partial_entries_addon->maybe_save_partial_entry( $form['id'] );
80
+		$partial_entries_addon->maybe_save_partial_entry( $form[ 'id' ] );
81 81
 	}
82 82
 }
83 83
 
Please login to merge, or discard this patch.
includes/fields/class-gravityview-fields.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -42,8 +42,8 @@  discard block
 block discarded – undo
42 42
 	 * @return GravityView_Field | bool
43 43
 	 */
44 44
 	public static function create( $properties ) {
45
-		$type = isset( $properties['type'] ) ? $properties['type'] : '';
46
-		$type = empty( $properties['inputType'] ) ? $type : $properties['inputType'];
45
+		$type = isset( $properties[ 'type' ] ) ? $properties[ 'type' ] : '';
46
+		$type = empty( $properties[ 'inputType' ] ) ? $type : $properties[ 'inputType' ];
47 47
 		if ( empty( $type ) || ! isset( self::$_fields[ $type ] ) ) {
48 48
 			return new GravityView_Field( $properties );
49 49
 		}
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
 	 * @return bool True: yes, it exists; False: nope
63 63
 	 */
64 64
 	public static function exists( $field_name ) {
65
-		return isset( self::$_fields["{$field_name}"] );
65
+		return isset( self::$_fields[ "{$field_name}" ] );
66 66
 	}
67 67
 
68 68
 	/**
@@ -96,8 +96,8 @@  discard block
 block discarded – undo
96 96
 
97 97
 		$field_type = is_a( $gf_field, 'GF_Field' ) ? get_class( $gf_field ) : $gf_field;
98 98
 
99
-		foreach( self::$_fields as $field ) {
100
-			if( $field_type === $field->_gf_field_class_name ) {
99
+		foreach ( self::$_fields as $field ) {
100
+			if ( $field_type === $field->_gf_field_class_name ) {
101 101
 				return $field;
102 102
 			}
103 103
 		}
@@ -116,13 +116,13 @@  discard block
 block discarded – undo
116 116
 	 */
117 117
 	public static function get_all( $groups = '' ) {
118 118
 
119
-		if( '' !== $groups ) {
119
+		if ( '' !== $groups ) {
120 120
 			$return_fields = self::$_fields;
121 121
 
122
-			$groups = (array) $groups;
122
+			$groups = (array)$groups;
123 123
 
124 124
 			foreach ( $return_fields as $key => $field ) {
125
-				if( ! in_array( $field->group, $groups, true ) ) {
125
+				if ( ! in_array( $field->group, $groups, true ) ) {
126 126
 					unset( $return_fields[ $key ] );
127 127
 				}
128 128
 			}
Please login to merge, or discard this patch.
includes/admin/field-types/type_textarea.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
 		?>
10 10
 		<label for="<?php echo $this->get_field_id(); ?>" class="<?php echo $this->get_label_class(); ?>"><?php
11 11
 
12
-			echo '<span class="gv-label">'.$this->get_field_label().'</span>';
12
+			echo '<span class="gv-label">' . $this->get_field_label() . '</span>';
13 13
 			echo $this->get_tooltip() . $this->get_field_desc();
14 14
 		?><div>
15 15
 				<?php $this->render_input(); ?>
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
 	}
20 20
 
21 21
 	function render_input( $override_input = null ) {
22
-		if( isset( $override_input ) ) {
22
+		if ( isset( $override_input ) ) {
23 23
 			echo $override_input;
24 24
 			return;
25 25
 		}
@@ -28,10 +28,10 @@  discard block
 block discarded – undo
28 28
 
29 29
 		$show_mt = $this->show_merge_tags();
30 30
 
31
-        if( $show_mt && $this->field['merge_tags'] !== false || $this->field['merge_tags'] === 'force' ) {
31
+        if ( $show_mt && $this->field[ 'merge_tags' ] !== false || $this->field[ 'merge_tags' ] === 'force' ) {
32 32
             $class .= ' merge-tag-support mt-position-right ';
33 33
 
34
-            if( empty( $this->field['show_all_fields'] ) ) {
34
+            if ( empty( $this->field[ 'show_all_fields' ] ) ) {
35 35
             	$class .= ' mt-hide_all_fields ';
36 36
             }
37 37
         }
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 #		$this->codemirror( $this->get_field_id() );
50 50
 
51 51
 		?>
52
-		<textarea name="<?php echo esc_attr( $this->name ); ?>" placeholder="<?php echo esc_attr( $placeholder ); ?>" id="<?php echo $this->get_field_id(); ?>" class="<?php echo gravityview_sanitize_html_class( $class ); ?>" rows="<?php echo absint( $rows ); ?>"><?php echo esc_textarea(  $this->value ); ?></textarea>
52
+		<textarea name="<?php echo esc_attr( $this->name ); ?>" placeholder="<?php echo esc_attr( $placeholder ); ?>" id="<?php echo $this->get_field_id(); ?>" class="<?php echo gravityview_sanitize_html_class( $class ); ?>" rows="<?php echo absint( $rows ); ?>"><?php echo esc_textarea( $this->value ); ?></textarea>
53 53
        	<?php
54 54
 	}
55 55
 
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
         ?>
67 67
 
68 68
         <script>
69
-	        wp.codeEditor.initialize( "<?php echo $field_id;?>", {});
69
+	        wp.codeEditor.initialize( "<?php echo $field_id; ?>", {});
70 70
         </script>
71 71
     <?php
72 72
     }
Please login to merge, or discard this patch.
future/includes/class-gv-collection-view.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
 			 * @deprecated
115 115
 			 * @see The `gravityview/view_collection/from_post/meta_keys` filter.
116 116
 			 */
117
-			$meta_keys = (array) apply_filters_deprecated( 'gravityview/data/parse/meta_keys', array( $meta_keys, $post->ID ), '2.0.7', 'gravityview/view_collection/from_post/meta_keys' );
117
+			$meta_keys = (array)apply_filters_deprecated( 'gravityview/data/parse/meta_keys', array( $meta_keys, $post->ID ), '2.0.7', 'gravityview/view_collection/from_post/meta_keys' );
118 118
 
119 119
 			/** What about inside post meta values? */
120 120
 			foreach ( $meta_keys as $meta_key ) {
@@ -168,12 +168,12 @@  discard block
 block discarded – undo
168 168
 
169 169
 		/** Let's find us some [gravityview] shortcodes perhaps. */
170 170
 		foreach ( Shortcode::parse( $content ) as $shortcode ) {
171
-			if ( $shortcode->name != 'gravityview' || empty( $shortcode->atts['id'] ) ) {
171
+			if ( $shortcode->name != 'gravityview' || empty( $shortcode->atts[ 'id' ] ) ) {
172 172
 				continue;
173 173
 			}
174 174
 
175
-			if ( is_numeric( $shortcode->atts['id'] ) ) {
176
-				$view = View::by_id( $shortcode->atts['id'] );
175
+			if ( is_numeric( $shortcode->atts[ 'id' ] ) ) {
176
+				$view = View::by_id( $shortcode->atts[ 'id' ] );
177 177
 				if ( ! $view ) {
178 178
 					continue;
179 179
 				}
Please login to merge, or discard this patch.