Completed
Push — develop ( bd6ad5...7b688d )
by Zack
04:29
created
includes/fields/class-gravityview-field-html.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -7,9 +7,9 @@
 block discarded – undo
7 7
 
8 8
 	var $name = 'html';
9 9
 
10
-	function field_options( $field_options, $template_id, $field_id, $context, $input_type ) {
10
+	function field_options($field_options, $template_id, $field_id, $context, $input_type) {
11 11
 
12
-		unset ( $field_options['search_filter'], $field_options['show_as_link'] );
12
+		unset ($field_options['search_filter'], $field_options['show_as_link']);
13 13
 
14 14
 		return $field_options;
15 15
 	}
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
@@ -4,7 +4,7 @@
 block discarded – undo
4 4
 
5 5
 	var $name = 'checkbox';
6 6
 
7
-	var $search_operators = array( 'is', 'in', 'not in', 'isnot', 'contains');
7
+	var $search_operators = array('is', 'in', 'not in', 'isnot', 'contains');
8 8
 
9 9
 	var $_gf_field_class_name = 'GF_Field_Checkbox';
10 10
 
Please login to merge, or discard this patch.
includes/fields/class-gravityview-field-section.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
 	function __construct() {
11 11
 		parent::__construct();
12 12
 
13
-		add_filter( 'gravityview_field_entry_value_section', array( $this, 'prevent_empty_field' ) );
13
+		add_filter('gravityview_field_entry_value_section', array($this, 'prevent_empty_field'));
14 14
 	}
15 15
 
16 16
 	/**
@@ -22,13 +22,13 @@  discard block
 block discarded – undo
22 22
 	 *
23 23
 	 * @return string If output was empty, return an empty HTML comment tag. Otherwise, return output.
24 24
 	 */
25
-	function prevent_empty_field( $output = '' ) {
26
-		return empty( $output ) ? '<!-- -->' : $output;
25
+	function prevent_empty_field($output = '') {
26
+		return empty($output) ? '<!-- -->' : $output;
27 27
 	}
28 28
 
29
-	function field_options( $field_options, $template_id, $field_id, $context, $input_type ) {
29
+	function field_options($field_options, $template_id, $field_id, $context, $input_type) {
30 30
 
31
-		unset ( $field_options['search_filter'], $field_options['show_as_link'] );
31
+		unset ($field_options['search_filter'], $field_options['show_as_link']);
32 32
 
33 33
 		// Set the default CSS class to gv-section, which applies a border and top/bottom margin
34 34
 		$field_options['custom_class']['value'] = 'gv-section';
Please login to merge, or discard this patch.
includes/fields/class-gravityview-field-text.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@
 block discarded – undo
6 6
 
7 7
 	var $_gf_field_class_name = 'GF_Field_Text';
8 8
 
9
-	var $search_operators = array( 'contains', 'is', 'isnot', 'starts_with', 'ends_with' );
9
+	var $search_operators = array('contains', 'is', 'isnot', 'starts_with', 'ends_with');
10 10
 
11 11
 	var $group = 'standard';
12 12
 
Please login to merge, or discard this patch.
includes/fields/class-gravityview-field-post-category.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -7,20 +7,20 @@
 block discarded – undo
7 7
 
8 8
 	var $name = 'post_tags';
9 9
 
10
-	var $search_operators = array( 'is', 'in', 'not in', 'isnot', 'contains');
10
+	var $search_operators = array('is', 'in', 'not in', 'isnot', 'contains');
11 11
 
12 12
 	var $_gf_field_class_name = 'GF_Field_Post_Tags';
13 13
 
14 14
 	var $group = 'post';
15 15
 
16
-	function field_options( $field_options, $template_id, $field_id, $context, $input_type ) {
16
+	function field_options($field_options, $template_id, $field_id, $context, $input_type) {
17 17
 
18
-		if( 'edit' === $context ) {
18
+		if ('edit' === $context) {
19 19
 			return $field_options;
20 20
 		}
21 21
 
22
-		$this->add_field_support('dynamic_data', $field_options );
23
-		$this->add_field_support('link_to_term', $field_options );
22
+		$this->add_field_support('dynamic_data', $field_options);
23
+		$this->add_field_support('link_to_term', $field_options);
24 24
 
25 25
 		return $field_options;
26 26
 	}
Please login to merge, or discard this patch.
includes/fields/class-gravityview-field.php 2 patches
Doc Comments   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
 	 * @param bool $url_encode Whether to URL-encode output
176 176
 	 * @param bool $esc_html Whether to apply `esc_html()` to output
177 177
 	 *
178
-	 * @return mixed
178
+	 * @return string
179 179
 	 */
180 180
 	public function replace_merge_tag( $matches = array(), $text = '', $form = array(), $entry = array(), $url_encode = false, $esc_html = false ) {
181 181
 
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
 	 *
203 203
 	 * @since 1.8.4
204 204
 	 *
205
-	 * @param array $existing_merge_tags
205
+	 * @param array $custom_merge_tags
206 206
 	 * @param int $form_id GF Form ID
207 207
 	 * @param GF_Field[] $fields Array of fields in the form
208 208
 	 * @param string $element_id The ID of the input that Merge Tags are being used on
@@ -341,10 +341,10 @@  discard block
 block discarded – undo
341 341
 	 * </pre>
342 342
 	 *
343 343
 	 * @param  [type]      $field_options [description]
344
-	 * @param  [type]      $template_id   [description]
345
-	 * @param  [type]      $field_id      [description]
346
-	 * @param  [type]      $context       [description]
347
-	 * @param  [type]      $input_type    [description]
344
+	 * @param  string      $template_id   [description]
345
+	 * @param  string      $field_id      [description]
346
+	 * @param  string      $context       [description]
347
+	 * @param  string      $input_type    [description]
348 348
 	 * @return [type]                     [description]
349 349
 	 */
350 350
 	function field_options( $field_options, $template_id, $field_id, $context, $input_type ) {
Please login to merge, or discard this patch.
Spacing   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
 	 * @type array
74 74
 	 * @since 1.15.2
75 75
 	 */
76
-	var $contexts = array( 'single', 'multiple', 'edit', 'export' );
76
+	var $contexts = array('single', 'multiple', 'edit', 'export');
77 77
 
78 78
 	/**
79 79
 	 * @internal Not yet implemented
@@ -105,23 +105,23 @@  discard block
 block discarded – undo
105 105
 		/**
106 106
 		 * If this is a Gravity Forms field, use their labels. Spare our translation team!
107 107
 		 */
108
-		if( ! empty( $this->_gf_field_class_name ) && class_exists( $this->_gf_field_class_name ) ) {
108
+		if (!empty($this->_gf_field_class_name) && class_exists($this->_gf_field_class_name)) {
109 109
 			/** @var GF_Field $GF_Field */
110 110
 			$GF_Field = new $this->_gf_field_class_name;
111 111
 			$this->label = $GF_Field->get_form_editor_field_title();
112 112
 		}
113 113
 
114 114
 		// Modify the field options based on the name of the field type
115
-		add_filter( sprintf( 'gravityview_template_%s_options', $this->name ), array( &$this, 'field_options' ), 10, 5 );
115
+		add_filter(sprintf('gravityview_template_%s_options', $this->name), array(&$this, 'field_options'), 10, 5);
116 116
 
117
-		add_filter( 'gravityview/sortable/field_blacklist', array( $this, '_filter_sortable_fields' ), 1 );
117
+		add_filter('gravityview/sortable/field_blacklist', array($this, '_filter_sortable_fields'), 1);
118 118
 
119
-		if( $this->_custom_merge_tag ) {
120
-			add_filter( 'gform_custom_merge_tags', array( $this, '_filter_gform_custom_merge_tags' ), 10, 4 );
121
-			add_filter( 'gform_replace_merge_tags', array( $this, '_filter_gform_replace_merge_tags' ), 10, 7 );
119
+		if ($this->_custom_merge_tag) {
120
+			add_filter('gform_custom_merge_tags', array($this, '_filter_gform_custom_merge_tags'), 10, 4);
121
+			add_filter('gform_replace_merge_tags', array($this, '_filter_gform_replace_merge_tags'), 10, 7);
122 122
 		}
123 123
 
124
-		GravityView_Fields::register( $this );
124
+		GravityView_Fields::register($this);
125 125
 	}
126 126
 
127 127
 	/**
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
 	 *
139 139
 	 * @return string Original text if {_custom_merge_tag} isn't found. Otherwise, replaced text.
140 140
 	 */
141
-	public function _filter_gform_replace_merge_tags( $text, $form = array(), $entry = array(), $url_encode = false, $esc_html = false  ) {
141
+	public function _filter_gform_replace_merge_tags($text, $form = array(), $entry = array(), $url_encode = false, $esc_html = false) {
142 142
 
143 143
 		/**
144 144
 		 * This prevents the gform_replace_merge_tags filter from being called twice, as defined in:
@@ -146,19 +146,19 @@  discard block
 block discarded – undo
146 146
 		 * @see GFCommon::replace_variables_prepopulate()
147 147
 		 * @todo Remove eventually: Gravity Forms fixed this issue in 1.9.14
148 148
 		 */
149
-		if( false === $form ) {
149
+		if (false === $form) {
150 150
 			return $text;
151 151
 		}
152 152
 
153 153
 		// Is there is field merge tag? Strip whitespace off the ned, too.
154
-		preg_match_all( '/{' . preg_quote( $this->_custom_merge_tag ) . ':?(.*?)(?:\s)?}/ism', $text, $matches, PREG_SET_ORDER );
154
+		preg_match_all('/{'.preg_quote($this->_custom_merge_tag).':?(.*?)(?:\s)?}/ism', $text, $matches, PREG_SET_ORDER);
155 155
 
156 156
 		// If there are no matches, return original text
157
-		if ( empty( $matches ) ) {
157
+		if (empty($matches)) {
158 158
 			return $text;
159 159
 		}
160 160
 
161
-		return $this->replace_merge_tag( $matches, $text, $form, $entry, $url_encode, $esc_html );
161
+		return $this->replace_merge_tag($matches, $text, $form, $entry, $url_encode, $esc_html);
162 162
 	}
163 163
 
164 164
 	/**
@@ -177,18 +177,18 @@  discard block
 block discarded – undo
177 177
 	 *
178 178
 	 * @return mixed
179 179
 	 */
180
-	public function replace_merge_tag( $matches = array(), $text = '', $form = array(), $entry = array(), $url_encode = false, $esc_html = false ) {
180
+	public function replace_merge_tag($matches = array(), $text = '', $form = array(), $entry = array(), $url_encode = false, $esc_html = false) {
181 181
 
182
-		foreach( $matches as $match ) {
182
+		foreach ($matches as $match) {
183 183
 
184 184
 			$full_tag = $match[0];
185 185
 
186 186
 			// Strip the Merge Tags
187
-			$tag = str_replace( array( '{', '}'), '', $full_tag );
187
+			$tag = str_replace(array('{', '}'), '', $full_tag);
188 188
 
189 189
 			// Replace the value from the entry, if exists
190
-			if( isset( $entry[ $tag ] ) ) {
191
-				$text = str_replace( $full_tag, $entry[ $tag ], $text );
190
+			if (isset($entry[$tag])) {
191
+				$text = str_replace($full_tag, $entry[$tag], $text);
192 192
 			}
193 193
 		}
194 194
 
@@ -209,13 +209,13 @@  discard block
 block discarded – undo
209 209
 	 *
210 210
 	 * @return array Modified merge tags
211 211
 	 */
212
-	public function _filter_gform_custom_merge_tags( $custom_merge_tags = array(), $form_id, $fields = array(), $element_id = '' ) {
212
+	public function _filter_gform_custom_merge_tags($custom_merge_tags = array(), $form_id, $fields = array(), $element_id = '') {
213 213
 
214
-		$form = GVCommon::get_form( $form_id );
214
+		$form = GVCommon::get_form($form_id);
215 215
 
216
-		$field_merge_tags = $this->custom_merge_tags( $form, $fields );
216
+		$field_merge_tags = $this->custom_merge_tags($form, $fields);
217 217
 
218
-		return array_merge( $custom_merge_tags, $field_merge_tags );
218
+		return array_merge($custom_merge_tags, $field_merge_tags);
219 219
 	}
220 220
 
221 221
 	/**
@@ -230,13 +230,13 @@  discard block
 block discarded – undo
230 230
 	 *
231 231
 	 * @return array Merge tag array with `label` and `tag` keys based on class `label` and `_custom_merge_tag` variables
232 232
 	 */
233
-	protected function custom_merge_tags( $form = array(), $fields = array() ) {
233
+	protected function custom_merge_tags($form = array(), $fields = array()) {
234 234
 
235 235
 		// Use variables to make it unnecessary for other fields to override
236 236
 		$merge_tags = array(
237 237
 			array(
238 238
 				'label' => $this->label,
239
-				'tag' => '{' . $this->_custom_merge_tag . '}',
239
+				'tag' => '{'.$this->_custom_merge_tag.'}',
240 240
 			),
241 241
 		);
242 242
 
@@ -253,9 +253,9 @@  discard block
 block discarded – undo
253 253
 	 *
254 254
 	 * @return array
255 255
 	 */
256
-	public function _filter_sortable_fields( $not_sortable ) {
256
+	public function _filter_sortable_fields($not_sortable) {
257 257
 
258
-		if( ! $this->is_sortable ) {
258
+		if (!$this->is_sortable) {
259 259
 			$not_sortable[] = $this->name;
260 260
 		}
261 261
 
@@ -266,35 +266,35 @@  discard block
 block discarded – undo
266 266
 		$options = array(
267 267
 			'link_to_post' => array(
268 268
 				'type' => 'checkbox',
269
-				'label' => __( 'Link to the post', 'gravityview' ),
270
-				'desc' => __( 'Link to the post created by the entry.', 'gravityview' ),
269
+				'label' => __('Link to the post', 'gravityview'),
270
+				'desc' => __('Link to the post created by the entry.', 'gravityview'),
271 271
 				'value' => false,
272 272
 			),
273 273
 			'link_to_term' => array(
274 274
 				'type' => 'checkbox',
275
-				'label' => __( 'Link to the category or tag', 'gravityview' ),
276
-				'desc' => __( 'Link to the current category or tag. "Link to single entry" must be unchecked.', 'gravityview' ),
275
+				'label' => __('Link to the category or tag', 'gravityview'),
276
+				'desc' => __('Link to the current category or tag. "Link to single entry" must be unchecked.', 'gravityview'),
277 277
 				'value' => false,
278 278
 			),
279 279
 			'dynamic_data' => array(
280 280
 				'type' => 'checkbox',
281
-				'label' => __( 'Use the live post data', 'gravityview' ),
282
-				'desc' => __( 'Instead of using the entry data, instead use the current post data.', 'gravityview' ),
281
+				'label' => __('Use the live post data', 'gravityview'),
282
+				'desc' => __('Instead of using the entry data, instead use the current post data.', 'gravityview'),
283 283
 				'value' => true,
284 284
 			),
285 285
 			'date_display' => array(
286 286
 				'type' => 'text',
287
-				'label' => __( 'Override Date Format', 'gravityview' ),
288
-				'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>' ),
287
+				'label' => __('Override Date Format', 'gravityview'),
288
+				'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>'),
289 289
 				/**
290 290
 				 * @filter `gravityview_date_format` Override the date format with a [PHP date format](https://codex.wordpress.org/Formatting_Date_and_Time)
291 291
 				 * @param[in,out] null|string $date_format Date Format (default: null)
292 292
 				 */
293
-				'value' => apply_filters( 'gravityview_date_format', null )
293
+				'value' => apply_filters('gravityview_date_format', null)
294 294
 			),
295 295
 			'new_window' => array(
296 296
 				'type' => 'checkbox',
297
-				'label' => __( 'Open link in a new tab or window?', 'gravityview' ),
297
+				'label' => __('Open link in a new tab or window?', 'gravityview'),
298 298
 				'value' => false,
299 299
 			),
300 300
 		);
@@ -303,15 +303,15 @@  discard block
 block discarded – undo
303 303
 		 * @filter `gravityview_field_support_options` Modify the settings that a field supports
304 304
 		 * @param array $options Options multidimensional array with each key being the input name, with each array setting having `type`, `label`, `desc` and `value` (default values) keys
305 305
 		 */
306
-		return apply_filters( 'gravityview_field_support_options', $options );
306
+		return apply_filters('gravityview_field_support_options', $options);
307 307
 	}
308 308
 
309
-	function add_field_support( $key = '', &$field_options ) {
309
+	function add_field_support($key = '', &$field_options) {
310 310
 
311 311
 		$options = $this->field_support_options();
312 312
 
313
-		if( isset( $options[ $key ] ) ) {
314
-			$field_options[ $key ] = $options[ $key ];
313
+		if (isset($options[$key])) {
314
+			$field_options[$key] = $options[$key];
315 315
 		}
316 316
 
317 317
 		return $field_options;
@@ -347,7 +347,7 @@  discard block
 block discarded – undo
347 347
 	 * @param  [type]      $input_type    [description]
348 348
 	 * @return [type]                     [description]
349 349
 	 */
350
-	function field_options( $field_options, $template_id, $field_id, $context, $input_type ) {
350
+	function field_options($field_options, $template_id, $field_id, $context, $input_type) {
351 351
 
352 352
 		$this->_field_options = $field_options;
353 353
 		$this->_field_id = $field_id;
Please login to merge, or discard this patch.
includes/fields/class-gravityview-fields.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -77,7 +77,7 @@
 block discarded – undo
77 77
 	/**
78 78
 	 * Alias for get_instance()
79 79
 	 *
80
-	 * @param $field_name
80
+	 * @param string $field_name
81 81
 	 *
82 82
 	 * @return GravityView_Field
83 83
 	 */
Please login to merge, or discard this patch.
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -23,17 +23,17 @@  discard block
 block discarded – undo
23 23
 	 *
24 24
 	 * @return void
25 25
 	 */
26
-	public static function register( $field ) {
27
-		if ( ! is_subclass_of( $field, 'GravityView_Field' ) ) {
28
-			throw new Exception( 'Must be a subclass of GravityView_Field' );
26
+	public static function register($field) {
27
+		if (!is_subclass_of($field, 'GravityView_Field')) {
28
+			throw new Exception('Must be a subclass of GravityView_Field');
29 29
 		}
30
-		if ( empty( $field->name ) ) {
31
-			throw new Exception( 'The name must be set' );
30
+		if (empty($field->name)) {
31
+			throw new Exception('The name must be set');
32 32
 		}
33
-		if ( isset( self::$_fields[ $field->name ] ) ) {
34
-			throw new Exception( 'Field type already registered: ' . $field->name );
33
+		if (isset(self::$_fields[$field->name])) {
34
+			throw new Exception('Field type already registered: '.$field->name);
35 35
 		}
36
-		self::$_fields[ $field->name ] = $field;
36
+		self::$_fields[$field->name] = $field;
37 37
 	}
38 38
 
39 39
 	/**
@@ -41,15 +41,15 @@  discard block
 block discarded – undo
41 41
 	 *
42 42
 	 * @return GravityView_Field | bool
43 43
 	 */
44
-	public static function create( $properties ) {
45
-		$type = isset( $properties['type'] ) ? $properties['type'] : '';
46
-		$type = empty( $properties['inputType'] ) ? $type : $properties['inputType'];
47
-		if ( empty( $type ) || ! isset( self::$_fields[ $type ] ) ) {
48
-			return new GravityView_Field( $properties );
44
+	public static function create($properties) {
45
+		$type = isset($properties['type']) ? $properties['type'] : '';
46
+		$type = empty($properties['inputType']) ? $type : $properties['inputType'];
47
+		if (empty($type) || !isset(self::$_fields[$type])) {
48
+			return new GravityView_Field($properties);
49 49
 		}
50
-		$class      = self::$_fields[ $type ];
51
-		$class_name = get_class( $class );
52
-		$field      = new $class_name( $properties );
50
+		$class      = self::$_fields[$type];
51
+		$class_name = get_class($class);
52
+		$field      = new $class_name($properties);
53 53
 
54 54
 		return $field;
55 55
 	}
@@ -61,8 +61,8 @@  discard block
 block discarded – undo
61 61
 	 *
62 62
 	 * @return bool True: yes, it exists; False: nope
63 63
 	 */
64
-	public static function exists( $field_name ) {
65
-		return isset( self::$_fields["{$field_name}"] );
64
+	public static function exists($field_name) {
65
+		return isset(self::$_fields["{$field_name}"]);
66 66
 	}
67 67
 
68 68
 	/**
@@ -70,8 +70,8 @@  discard block
 block discarded – undo
70 70
 	 *
71 71
 	 * @return GravityView_Field
72 72
 	 */
73
-	public static function get_instance( $field_name ) {
74
-		return isset( self::$_fields[ $field_name ] ) ? self::$_fields[ $field_name ] : false;
73
+	public static function get_instance($field_name) {
74
+		return isset(self::$_fields[$field_name]) ? self::$_fields[$field_name] : false;
75 75
 	}
76 76
 
77 77
 	/**
@@ -81,8 +81,8 @@  discard block
 block discarded – undo
81 81
 	 *
82 82
 	 * @return GravityView_Field
83 83
 	 */
84
-	public static function get( $field_name ) {
85
-		return self::get_instance( $field_name );
84
+	public static function get($field_name) {
85
+		return self::get_instance($field_name);
86 86
 	}
87 87
 
88 88
 	/**
Please login to merge, or discard this patch.
includes/fields/class-gravityview-field-created-by.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -9,14 +9,14 @@  discard block
 block discarded – undo
9 9
 
10 10
 	var $name = 'created_by';
11 11
 
12
-	var $search_operators = array( 'is', 'isnot' );
12
+	var $search_operators = array('is', 'isnot');
13 13
 
14 14
 	var $group = 'meta';
15 15
 
16 16
 	var $_custom_merge_tag = 'created_by';
17 17
 
18 18
 	public function __construct() {
19
-		$this->label = esc_attr__( 'Created By', 'gravityview' );
19
+		$this->label = esc_attr__('Created By', 'gravityview');
20 20
 		parent::__construct();
21 21
 	}
22 22
 
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
 	 *
31 31
 	 * @return array Modified merge tags
32 32
 	 */
33
-	protected function custom_merge_tags( $form = array(), $fields = array() ) {
33
+	protected function custom_merge_tags($form = array(), $fields = array()) {
34 34
 
35 35
 		$merge_tags = array(
36 36
 			array(
@@ -75,52 +75,52 @@  discard block
 block discarded – undo
75 75
 	 *
76 76
 	 * @return string Text, with user variables replaced, if they existed
77 77
 	 */
78
-	public function replace_merge_tag( $matches = array(), $text = '', $form = array(), $entry = array(), $url_encode = false, $esc_html = false ) {
78
+	public function replace_merge_tag($matches = array(), $text = '', $form = array(), $entry = array(), $url_encode = false, $esc_html = false) {
79 79
 
80 80
 		// If there are no matches OR the Entry `created_by` isn't set or is 0 (no user)
81
-		if( empty( $entry['created_by'] ) ) {
81
+		if (empty($entry['created_by'])) {
82 82
 			return $text;
83 83
 		}
84 84
 
85 85
 		// Get the creator of the entry
86
-		$entry_creator = new WP_User( $entry['created_by'] );
86
+		$entry_creator = new WP_User($entry['created_by']);
87 87
 
88
-		foreach ( $matches as $match ) {
88
+		foreach ($matches as $match) {
89 89
 
90 90
 			$full_tag = $match[0];
91 91
 			$property = $match[1];
92 92
 
93
-			switch( $property ) {
93
+			switch ($property) {
94 94
 				/** @since 1.13.2 */
95 95
 				case 'roles':
96
-					$value = implode( ', ', $entry_creator->roles );
96
+					$value = implode(', ', $entry_creator->roles);
97 97
 					break;
98 98
 				default:
99
-					$value = $entry_creator->get( $property );
99
+					$value = $entry_creator->get($property);
100 100
 			}
101 101
 
102
-			$value = $url_encode ? urlencode( $value ) : $value;
102
+			$value = $url_encode ? urlencode($value) : $value;
103 103
 
104
-			$value = $esc_html ? esc_html( $value ) : $value;
104
+			$value = $esc_html ? esc_html($value) : $value;
105 105
 
106
-			$text = str_replace( $full_tag, $value, $text );
106
+			$text = str_replace($full_tag, $value, $text);
107 107
 		}
108 108
 
109
-		unset( $entry_creator );
109
+		unset($entry_creator);
110 110
 
111 111
 		return $text;
112 112
 	}
113 113
 
114
-	function field_options( $field_options, $template_id, $field_id, $context, $input_type ) {
114
+	function field_options($field_options, $template_id, $field_id, $context, $input_type) {
115 115
 
116
-		if( 'edit' === $context ) {
116
+		if ('edit' === $context) {
117 117
 			return $field_options;
118 118
 		}
119 119
 
120 120
 		$field_options['name_display'] = array(
121 121
 			'type' => 'select',
122
-			'label' => __( 'User Format', 'gravityview' ),
123
-			'desc' => __( 'How should the User information be displayed?', 'gravityview'),
122
+			'label' => __('User Format', 'gravityview'),
123
+			'desc' => __('How should the User information be displayed?', 'gravityview'),
124 124
 			'choices' => array(
125 125
 				'display_name' => __('Display Name (Example: "Ellen Ripley")', 'gravityview'),
126 126
 				'user_login' => __('Username (Example: "nostromo")', 'gravityview'),
Please login to merge, or discard this patch.
includes/fields/class-gravityview-field-date-created.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -9,11 +9,11 @@  discard block
 block discarded – undo
9 9
 
10 10
 	var $name = 'date_created';
11 11
 
12
-	var $search_operators = array( 'less_than', 'greater_than', 'is', 'isnot' );
12
+	var $search_operators = array('less_than', 'greater_than', 'is', 'isnot');
13 13
 
14 14
 	var $group = 'meta';
15 15
 
16
-	var $contexts = array( 'single', 'multiple', 'export' );
16
+	var $contexts = array('single', 'multiple', 'export');
17 17
 
18 18
 	var $_custom_merge_tag = 'date_created';
19 19
 
@@ -21,18 +21,18 @@  discard block
 block discarded – undo
21 21
 	 * GravityView_Field_Date_Created constructor.
22 22
 	 */
23 23
 	public function __construct() {
24
-		$this->label = esc_attr__( 'Date Created', 'gravityview' );
25
-		$this->description = esc_attr__( 'The date the entry was created.', 'gravityview' );
24
+		$this->label = esc_attr__('Date Created', 'gravityview');
25
+		$this->description = esc_attr__('The date the entry was created.', 'gravityview');
26 26
 		parent::__construct();
27 27
 	}
28 28
 
29
-	function field_options( $field_options, $template_id, $field_id, $context, $input_type ) {
29
+	function field_options($field_options, $template_id, $field_id, $context, $input_type) {
30 30
 
31
-		if( 'edit' === $context ) {
31
+		if ('edit' === $context) {
32 32
 			return $field_options;
33 33
 		}
34 34
 
35
-		$this->add_field_support('date_display', $field_options );
35
+		$this->add_field_support('date_display', $field_options);
36 36
 
37 37
 		return $field_options;
38 38
 	}
@@ -52,27 +52,27 @@  discard block
 block discarded – undo
52 52
 	 *
53 53
 	 * @return string Original text if {date_created} isn't found. Otherwise, replaced text.
54 54
 	 */
55
-	public function replace_merge_tag( $matches = array(), $text = '', $form = array(), $entry = array(), $url_encode = false, $esc_html = false  ) {
55
+	public function replace_merge_tag($matches = array(), $text = '', $form = array(), $entry = array(), $url_encode = false, $esc_html = false) {
56 56
 
57 57
 		$return = $text;
58 58
 
59 59
 		/** Use $this->name instead of date_created because Payment Date uses this as well*/
60
-		$date_created = rgar( $entry, $this->name );
60
+		$date_created = rgar($entry, $this->name);
61 61
 
62
-		foreach ( $matches as $match ) {
62
+		foreach ($matches as $match) {
63 63
 
64 64
 			$full_tag          = $match[0];
65 65
 			$property          = $match[1];
66 66
 
67
-			$formatted_date = GravityView_Merge_Tags::format_date( $date_created, $full_tag, $property );
67
+			$formatted_date = GravityView_Merge_Tags::format_date($date_created, $full_tag, $property);
68 68
 
69
-			$return = str_replace( $full_tag, $formatted_date, $return );
69
+			$return = str_replace($full_tag, $formatted_date, $return);
70 70
 		}
71 71
 
72 72
 		return $return;
73 73
 	}
74 74
 
75
-	public static function format( $value, $format = '', $context = 'display' ) {
75
+	public static function format($value, $format = '', $context = 'display') {
76 76
 
77 77
 		/**
78 78
 		 * @filter `gravityview_date_created_adjust_timezone` Whether to adjust the timezone for entries. \n
@@ -81,16 +81,16 @@  discard block
 block discarded – undo
81 81
 		 * @param[out,in] boolean $adjust_tz  Use timezone-adjusted datetime? If true, adjusts date based on blog's timezone setting. If false, uses UTC setting. Default: true
82 82
 		 * @param[in] string $context Where the filter is being called from. `display` in this case.
83 83
 		 */
84
-		$adjust_tz = apply_filters( 'gravityview_date_created_adjust_timezone', true, $context );
84
+		$adjust_tz = apply_filters('gravityview_date_created_adjust_timezone', true, $context);
85 85
 
86 86
 		/**
87 87
 		 * date_created is stored in UTC format. Fetch in the current blog's timezone if $adjust_tz is true
88 88
 		 */
89
-		$tz_value = $adjust_tz ? get_date_from_gmt( $value ) : $value;
89
+		$tz_value = $adjust_tz ? get_date_from_gmt($value) : $value;
90 90
 
91
-		if( $format ) {
91
+		if ($format) {
92 92
 
93
-			$output = date_i18n( $format, strtotime( $tz_value ) );
93
+			$output = date_i18n($format, strtotime($tz_value));
94 94
 
95 95
 		} else {
96 96
 
@@ -99,9 +99,9 @@  discard block
 block discarded – undo
99 99
 			 * @see https://codex.wordpress.org/Formatting_Date_and_Time
100 100
 			 * @param null|string Date Format (default: $field->dateFormat)
101 101
 			 */
102
-			$format = apply_filters( 'gravityview_date_format', rgar($field, "dateFormat") );
102
+			$format = apply_filters('gravityview_date_format', rgar($field, "dateFormat"));
103 103
 
104
-			$output = GFCommon::date_display( $tz_value, $format );
104
+			$output = GFCommon::date_display($tz_value, $format);
105 105
 		}
106 106
 
107 107
 		return $output;
Please login to merge, or discard this patch.