Completed
Pull Request — master (#605)
by Zack
19:32 queued 10:54
created
includes/class-gravityview-merge-tags.php 1 patch
Spacing   +45 added lines, -45 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
 	private function add_hooks() {
21 21
 
22 22
 		/** @see GFCommon::replace_variables_prepopulate **/
23
-		add_filter( 'gform_replace_merge_tags', array( 'GravityView_Merge_Tags', 'replace_gv_merge_tags' ), 10, 7 );
23
+		add_filter('gform_replace_merge_tags', array('GravityView_Merge_Tags', 'replace_gv_merge_tags'), 10, 7);
24 24
 
25 25
 	}
26 26
 
@@ -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
@@ -53,9 +53,9 @@  discard block
 block discarded – undo
53 53
 		 * @param[in]  array      $form        GF Form array
54 54
 		 * @param[in]  array      $entry        GF Entry array
55 55
 		 */
56
-		$do_replace_variables = apply_filters( 'gravityview/merge_tags/do_replace_variables', true, $text, $form, $entry );
56
+		$do_replace_variables = apply_filters('gravityview/merge_tags/do_replace_variables', true, $text, $form, $entry);
57 57
 
58
-		if ( strpos( $text, '{' ) === false || ! $do_replace_variables ) {
58
+		if (strpos($text, '{') === false || !$do_replace_variables) {
59 59
 			return $text;
60 60
 		}
61 61
 
@@ -64,11 +64,11 @@  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
-		return GFCommon::replace_variables( $text, $form, $entry, $url_encode, $esc_html );
71
+		return GFCommon::replace_variables($text, $form, $entry, $url_encode, $esc_html);
72 72
 	}
73 73
 
74 74
 	/**
@@ -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,52 +94,52 @@  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
 
101
-		$text = self::replace_get_variables( $text, $form, $entry, $url_encode );
101
+		$text = self::replace_get_variables($text, $form, $entry, $url_encode);
102 102
 
103 103
 		return $text;
104 104
 	}
105 105
 
106
-	public static function format_date( $date_created, $full_tag, $property ) {
106
+	public static function format_date($date_created, $full_tag, $property) {
107 107
 
108
-		$site_date_format  = get_option( 'date_format' );
108
+		$site_date_format = get_option('date_format');
109 109
 
110 110
 		/**
111 111
 		 * Gravity Forms code to adjust date to locally-configured Time Zone
112 112
 		 * @see GFCommon::format_date()
113 113
 		 */
114
-		$entry_gmt_time   = mysql2date( 'G', $date_created );
115
-		$entry_local_timestamp = GFCommon::get_local_timestamp( $entry_gmt_time );
114
+		$entry_gmt_time = mysql2date('G', $date_created);
115
+		$entry_local_timestamp = GFCommon::get_local_timestamp($entry_gmt_time);
116 116
 
117 117
 		// Expand all modifiers, skipping escaped colons. str_replace worked better than preg_split( "/(?<!\\):/" )
118
-		$exploded = explode( ':', str_replace( '\:', '|COLON|', $property ) );
118
+		$exploded = explode(':', str_replace('\:', '|COLON|', $property));
119 119
 
120
-		$is_human  = in_array( 'human', $exploded ); // {date_created:human}
121
-		$is_diff  = in_array( 'diff', $exploded ); // {date_created:diff}
122
-		$is_raw = in_array( 'raw', $exploded ); // {date_created:raw}
123
-		$is_timestamp = in_array( 'timestamp', $exploded ); // {date_created:timestamp}
120
+		$is_human = in_array('human', $exploded); // {date_created:human}
121
+		$is_diff  = in_array('diff', $exploded); // {date_created:diff}
122
+		$is_raw = in_array('raw', $exploded); // {date_created:raw}
123
+		$is_timestamp = in_array('timestamp', $exploded); // {date_created:timestamp}
124 124
 
125 125
 		// If {date_created:raw} was specified, don't modify the stored value
126
-		if ( $is_raw ) {
126
+		if ($is_raw) {
127 127
 			$formatted_date = $date_created;
128
-		} elseif( $is_timestamp ) {
128
+		} elseif ($is_timestamp) {
129 129
 			$formatted_date = $entry_local_timestamp;
130
-		} elseif ( $is_diff ) {
130
+		} elseif ($is_diff) {
131 131
 
132 132
 			/* translators: %s is the time (seconds, hours, days, weeks, months, years) since entry was created */
133
-			$relative_format = self::get_format_from_modifiers( $exploded, esc_html__( '%s ago', 'gravityview' ) );
133
+			$relative_format = self::get_format_from_modifiers($exploded, esc_html__('%s ago', 'gravityview'));
134 134
 
135
-			$formatted_date = sprintf( $relative_format, human_time_diff( $entry_gmt_time ) );
135
+			$formatted_date = sprintf($relative_format, human_time_diff($entry_gmt_time));
136 136
 
137 137
 		} else {
138 138
 
139
-			$include_time = in_array( 'time', $exploded );  // {date_created:time}
140
-			$match_date_format = self::get_format_from_modifiers( $exploded, $site_date_format );
139
+			$include_time = in_array('time', $exploded); // {date_created:time}
140
+			$match_date_format = self::get_format_from_modifiers($exploded, $site_date_format);
141 141
 
142
-			$formatted_date = GFCommon::format_date( $date_created, $is_human, $match_date_format, $include_time );
142
+			$formatted_date = GFCommon::format_date($date_created, $is_human, $match_date_format, $include_time);
143 143
 		}
144 144
 
145 145
 		return $formatted_date;
@@ -158,16 +158,16 @@  discard block
 block discarded – undo
158 158
 	 *
159 159
 	 * @return string If format is found, the passed format. Otherwise, the backup.
160 160
 	 */
161
-	private static function get_format_from_modifiers( $exploded, $backup = '' ) {
161
+	private static function get_format_from_modifiers($exploded, $backup = '') {
162 162
 
163 163
 		$return = $backup;
164 164
 
165
-		$format_key_index = array_search( 'format', $exploded );
165
+		$format_key_index = array_search('format', $exploded);
166 166
 
167 167
 		// If there's a "format:[php date format string]" date format, grab it
168
-		if ( false !== $format_key_index && isset( $exploded[ $format_key_index + 1 ] ) ) {
168
+		if (false !== $format_key_index && isset($exploded[$format_key_index + 1])) {
169 169
 			// Return escaped colons placeholder
170
-			$return = str_replace( '|COLON|', ':', $exploded[ $format_key_index + 1 ] );
170
+			$return = str_replace('|COLON|', ':', $exploded[$format_key_index + 1]);
171 171
 		}
172 172
 
173 173
 		return $return;
@@ -194,22 +194,22 @@  discard block
 block discarded – undo
194 194
 	 * @param array $entry Entry array
195 195
 	 * @param bool $url_encode Whether to URL-encode output
196 196
 	 */
197
-	public static function replace_get_variables( $text, $form = array(), $entry = array(), $url_encode = false ) {
197
+	public static function replace_get_variables($text, $form = array(), $entry = array(), $url_encode = false) {
198 198
 
199 199
 		// Is there is {get:[xyz]} merge tag?
200
-		preg_match_all( "/{get:(.*?)}/ism", $text, $matches, PREG_SET_ORDER );
200
+		preg_match_all("/{get:(.*?)}/ism", $text, $matches, PREG_SET_ORDER);
201 201
 
202 202
 		// If there are no matches OR the Entry `created_by` isn't set or is 0 (no user)
203
-		if( empty( $matches ) ) {
203
+		if (empty($matches)) {
204 204
 			return $text;
205 205
 		}
206 206
 
207
-		foreach ( $matches as $match ) {
207
+		foreach ($matches as $match) {
208 208
 
209 209
 			$full_tag = $match[0];
210 210
 			$property = $match[1];
211 211
 
212
-			$value = stripslashes_deep( rgget( $property ) );
212
+			$value = stripslashes_deep(rgget($property));
213 213
 
214 214
 			/**
215 215
 			 * @filter `gravityview/merge_tags/get/glue/` Modify the glue used to convert an array of `{get}` values from an array to string
@@ -217,11 +217,11 @@  discard block
 block discarded – undo
217 217
 			 * @param[in,out] string $glue String used to `implode()` $_GET values Default: ', '
218 218
 			 * @param[in] string $property The current name of the $_GET parameter being combined
219 219
 			 */
220
-			$glue = apply_filters( 'gravityview/merge_tags/get/glue/', ', ', $property );
220
+			$glue = apply_filters('gravityview/merge_tags/get/glue/', ', ', $property);
221 221
 
222
-			$value = is_array( $value ) ? implode( $glue, $value ) : $value;
222
+			$value = is_array($value) ? implode($glue, $value) : $value;
223 223
 
224
-			$value = $url_encode ? urlencode( $value ) : $value;
224
+			$value = $url_encode ? urlencode($value) : $value;
225 225
 
226 226
 			/**
227 227
 			 * @filter `gravityview/merge_tags/get/esc_html/{url parameter name}` Disable esc_html() from running on `{get}` merge tag
@@ -231,9 +231,9 @@  discard block
 block discarded – undo
231 231
 			 * @since 1.15
232 232
 			 * @param bool $esc_html Whether to esc_html() the value. Default: `true`
233 233
 			 */
234
-			$esc_html = apply_filters('gravityview/merge_tags/get/esc_html/' . $property, true );
234
+			$esc_html = apply_filters('gravityview/merge_tags/get/esc_html/'.$property, true);
235 235
 
236
-			$value = $esc_html ? esc_html( $value ) : $value;
236
+			$value = $esc_html ? esc_html($value) : $value;
237 237
 
238 238
 			/**
239 239
 			 * @filter `gravityview/merge_tags/get/esc_html/{url parameter name}` Modify the value of the `{get}` replacement before being used
@@ -242,12 +242,12 @@  discard block
 block discarded – undo
242 242
 			 * @param[in] array $form Gravity Forms form array
243 243
 			 * @param[in] array $entry Entry array
244 244
 			 */
245
-			$value = apply_filters('gravityview/merge_tags/get/value/' . $property, $value, $text, $form, $entry );
245
+			$value = apply_filters('gravityview/merge_tags/get/value/'.$property, $value, $text, $form, $entry);
246 246
 
247
-			$text = str_replace( $full_tag, $value, $text );
247
+			$text = str_replace($full_tag, $value, $text);
248 248
 		}
249 249
 
250
-		unset( $value, $glue, $matches );
250
+		unset($value, $glue, $matches);
251 251
 
252 252
 		return $text;
253 253
 	}
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.
includes/fields/class-gravityview-field-payment-amount.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
 
15 15
 	var $is_numeric = true;
16 16
 
17
-	var $search_operators = array( 'is', 'isnot', 'greater_than', 'less_than', 'contains' );
17
+	var $search_operators = array('is', 'isnot', 'greater_than', 'less_than', 'contains');
18 18
 
19 19
 	var $group = 'pricing';
20 20
 
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
 	 * GravityView_Field_Payment_Amount constructor.
25 25
 	 */
26 26
 	public function __construct() {
27
-		$this->label = esc_attr__( 'Payment Amount', 'gravityview' );
27
+		$this->label = esc_attr__('Payment Amount', 'gravityview');
28 28
 		parent::__construct();
29 29
 	}
30 30
 
@@ -41,23 +41,23 @@  discard block
 block discarded – undo
41 41
 	 *
42 42
 	 * @return string Original text if {date_created} isn't found. Otherwise, replaced text.
43 43
 	 */
44
-	public function replace_merge_tag( $matches = array(), $text = '', $form = array(), $entry = array(), $url_encode = false, $esc_html = false  ) {
44
+	public function replace_merge_tag($matches = array(), $text = '', $form = array(), $entry = array(), $url_encode = false, $esc_html = false) {
45 45
 
46 46
 		$return = $text;
47 47
 
48
-		foreach ( $matches as $match ) {
48
+		foreach ($matches as $match) {
49 49
 
50 50
 			$full_tag = $match[0];
51
-			$modifier = isset( $match[1] ) ? $match[1] : false;
51
+			$modifier = isset($match[1]) ? $match[1] : false;
52 52
 
53
-			$amount = rgar( $entry, 'payment_amount' );
53
+			$amount = rgar($entry, 'payment_amount');
54 54
 
55
-			$formatted_amount = ( 'raw' === $modifier ) ? $amount : GFCommon::to_money( $amount, rgar( $entry, 'currency' ) );
55
+			$formatted_amount = ('raw' === $modifier) ? $amount : GFCommon::to_money($amount, rgar($entry, 'currency'));
56 56
 
57
-			$return = str_replace( $full_tag, $formatted_amount, $return );
57
+			$return = str_replace($full_tag, $formatted_amount, $return);
58 58
 		}
59 59
 
60
-		unset( $formatted_amount, $amount, $full_tag, $matches );
60
+		unset($formatted_amount, $amount, $full_tag, $matches);
61 61
 
62 62
 		return $return;
63 63
 	}
Please login to merge, or discard this patch.
includes/fields/class-gravityview-field-payment-date.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
 
13 13
 	var $is_searchable = true;
14 14
 
15
-	var $search_operators = array( 'less_than', 'greater_than', 'is', 'isnot' );
15
+	var $search_operators = array('less_than', 'greater_than', 'is', 'isnot');
16 16
 
17 17
 	var $group = 'pricing';
18 18
 
@@ -22,8 +22,8 @@  discard block
 block discarded – undo
22 22
 	 * GravityView_Field_Date_Created constructor.
23 23
 	 */
24 24
 	public function __construct() {
25
-		$this->label = esc_attr__( 'Payment Date', 'gravityview' );
26
-		$this->description = esc_attr__( 'The date the payment was received.', 'gravityview' );
25
+		$this->label = esc_attr__('Payment Date', 'gravityview');
26
+		$this->description = esc_attr__('The date the payment was received.', 'gravityview');
27 27
 		parent::__construct();
28 28
 	}
29 29
 }
Please login to merge, or discard this patch.
includes/fields/class-gravityview-field-payment-method.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
 
15 15
 	var $is_numeric = false;
16 16
 
17
-	var $search_operators = array( 'is', 'isnot' );
17
+	var $search_operators = array('is', 'isnot');
18 18
 
19 19
 	var $group = 'pricing';
20 20
 
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
 	 * GravityView_Field_Date_Created constructor.
25 25
 	 */
26 26
 	public function __construct() {
27
-		$this->label = esc_attr__( 'Payment Method', 'gravityview' );
27
+		$this->label = esc_attr__('Payment Method', 'gravityview');
28 28
 		parent::__construct();
29 29
 	}
30 30
 }
Please login to merge, or discard this patch.
includes/fields/class-gravityview-field-payment-status.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
 
13 13
 	var $is_searchable = true;
14 14
 
15
-	var $search_operators = array( 'is', 'in', 'not in', 'isnot' );
15
+	var $search_operators = array('is', 'in', 'not in', 'isnot');
16 16
 
17 17
 	var $group = 'pricing';
18 18
 
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
 	 * GravityView_Field_Date_Created constructor.
23 23
 	 */
24 24
 	public function __construct() {
25
-		$this->label = esc_attr__( 'Payment Status', 'gravityview' );
25
+		$this->label = esc_attr__('Payment Status', 'gravityview');
26 26
 		parent::__construct();
27 27
 	}
28 28
 }
Please login to merge, or discard this patch.
includes/fields/class-gravityview-field.php 1 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 1 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.