Completed
Push — develop ( fc0354...e2ac27 )
by Zack
11:27 queued 07:24
created
includes/fields/class-gravityview-field-source-url.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -7,35 +7,35 @@
 block discarded – undo
7 7
 
8 8
 	var $name = 'source_url';
9 9
 
10
-	var $search_operators = array( 'is', 'isnot', 'contains', 'starts_with', 'ends_with' );
10
+	var $search_operators = array('is', 'isnot', 'contains', 'starts_with', 'ends_with');
11 11
 
12 12
 	var $label = 'Source URL';
13 13
 
14 14
 	public function __construct() {
15
-		$this->label = esc_attr__( 'Source URL', 'gravityview' );
15
+		$this->label = esc_attr__('Source URL', 'gravityview');
16 16
 		parent::__construct();
17 17
 	}
18 18
 
19
-	function field_options( $field_options, $template_id, $field_id, $context, $input_type ) {
19
+	function field_options($field_options, $template_id, $field_id, $context, $input_type) {
20 20
 
21 21
 		// Don't link to entry; doesn't make sense.
22
-		unset( $field_options['show_as_link'] );
22
+		unset($field_options['show_as_link']);
23 23
 
24
-		if( 'edit' === $context ) {
24
+		if ('edit' === $context) {
25 25
 			return $field_options;
26 26
 		}
27 27
 
28 28
 		$add_options = array();
29 29
 		$add_options['link_to_source'] = array(
30 30
 			'type' => 'checkbox',
31
-			'label' => __( 'Link to URL:', 'gravityview' ),
31
+			'label' => __('Link to URL:', 'gravityview'),
32 32
 			'desc' => __('Display as a link to the Source URL', 'gravityview'),
33 33
 			'value' => false,
34 34
 			'merge_tags' => false,
35 35
 		);
36 36
 		$add_options['source_link_text'] = array(
37 37
 			'type' => 'text',
38
-			'label' => __( 'Link Text:', 'gravityview' ),
38
+			'label' => __('Link Text:', 'gravityview'),
39 39
 			'desc' => __('Customize the link text. If empty, the link text will be the the URL.', 'gravityview'),
40 40
 			'value' => NULL,
41 41
 			'merge_tags' => true,
Please login to merge, or discard this patch.
includes/fields/class-gravityview-field-text.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -6,12 +6,12 @@
 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 $label = 'Single Line Text';
12 12
 
13 13
 	public function __construct() {
14
-		$this->label = esc_attr__( 'Single Line Text', 'gravityview' );
14
+		$this->label = esc_attr__('Single Line Text', 'gravityview');
15 15
 		parent::__construct();
16 16
 	}
17 17
 }
Please login to merge, or discard this patch.
includes/fields/class-gravityview-field-textarea.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -7,20 +7,20 @@  discard block
 block discarded – undo
7 7
 
8 8
 	var $name = 'textarea';
9 9
 
10
-	var $search_operators = array( 'is', 'isnot', 'contains', 'starts_with', 'ends_with' );
10
+	var $search_operators = array('is', 'isnot', 'contains', 'starts_with', 'ends_with');
11 11
 
12 12
 	var $_gf_field_class_name = 'GF_Field_Textarea';
13 13
 
14 14
 	var $label = 'Paragraph Text';
15 15
 
16 16
 	public function __construct() {
17
-		$this->label = esc_attr__( 'Paragraph Text', 'gravityview' );
17
+		$this->label = esc_attr__('Paragraph Text', 'gravityview');
18 18
 		parent::__construct();
19 19
 	}
20 20
 
21
-	function field_options( $field_options, $template_id = '', $field_id = '', $context = '', $input_type = '' ) {
21
+	function field_options($field_options, $template_id = '', $field_id = '', $context = '', $input_type = '') {
22 22
 
23
-		if( 'edit' === $context ) {
23
+		if ('edit' === $context) {
24 24
 			return $field_options;
25 25
 		}
26 26
 
@@ -28,16 +28,16 @@  discard block
 block discarded – undo
28 28
 			'type' => 'number',
29 29
 			'merge_tags' => false,
30 30
 			'value' => null,
31
-			'label' => __( 'Maximum words shown', 'gravityview' ),
32
-			'tooltip' => __( 'Enter the number of words to be shown. If specified it truncates the text. Leave it blank if you want to show the full text.', 'gravityview' ),
31
+			'label' => __('Maximum words shown', 'gravityview'),
32
+			'tooltip' => __('Enter the number of words to be shown. If specified it truncates the text. Leave it blank if you want to show the full text.', 'gravityview'),
33 33
 		);
34 34
 
35 35
         $field_options['make_clickable'] = array(
36 36
             'type' => 'checkbox',
37 37
             'merge_tags' => false,
38 38
             'value' => 0,
39
-            'label' => __( 'Convert text URLs to HTML links', 'gravityview' ),
40
-            'tooltip' => __( 'Converts URI, www, FTP, and email addresses in HTML links', 'gravityview' ),
39
+            'label' => __('Convert text URLs to HTML links', 'gravityview'),
40
+            'tooltip' => __('Converts URI, www, FTP, and email addresses in HTML links', 'gravityview'),
41 41
         );
42 42
 
43 43
 		return $field_options;
Please login to merge, or discard this patch.
includes/fields/class-gravityview-field-time.php 1 patch
Spacing   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
 
8 8
 	var $name = 'time';
9 9
 
10
-	var $search_operators = array( 'is', 'isnot', 'greater_than', 'less_than' );
10
+	var $search_operators = array('is', 'isnot', 'greater_than', 'less_than');
11 11
 
12 12
 	var $_gf_field_class_name = 'GF_Field_Time';
13 13
 
@@ -42,13 +42,13 @@  discard block
 block discarded – undo
42 42
 	 */
43 43
 	public function __construct() {
44 44
 
45
-		$this->label = esc_attr__( 'Time', 'gravityview' );
45
+		$this->label = esc_attr__('Time', 'gravityview');
46 46
 
47 47
 		parent::__construct();
48 48
 
49
-		add_filter( 'gravityview/sorting/time', array( $this, 'modify_sort_id' ), 10, 2 );
49
+		add_filter('gravityview/sorting/time', array($this, 'modify_sort_id'), 10, 2);
50 50
 
51
-		add_filter('gravityview_search_criteria', array( $this, '_maybe_filter_gravity_forms_query' ), 10, 4 );
51
+		add_filter('gravityview_search_criteria', array($this, '_maybe_filter_gravity_forms_query'), 10, 4);
52 52
 	}
53 53
 
54 54
 	/**
@@ -62,14 +62,14 @@  discard block
 block discarded – undo
62 62
 	 *
63 63
 	 * @return string Modified sort key imploded with $_sort_divider, like `5|:time:|12|:time:|h:i A`
64 64
 	 */
65
-	public function modify_sort_id( $sort_field_id, $form_id ) {
65
+	public function modify_sort_id($sort_field_id, $form_id) {
66 66
 
67
-		$time_format = self::_get_time_format_for_field( $sort_field_id, $form_id );
67
+		$time_format = self::_get_time_format_for_field($sort_field_id, $form_id);
68 68
 
69
-		$date_format = self::date_format( $time_format, $sort_field_id );
69
+		$date_format = self::date_format($time_format, $sort_field_id);
70 70
 
71 71
 		// Should look something like `5|:time:|12|:time:|h:i A`
72
-		$new_sort_field_id = implode( $this->_sort_divider, array( $sort_field_id, $time_format, $date_format ) );
72
+		$new_sort_field_id = implode($this->_sort_divider, array($sort_field_id, $time_format, $date_format));
73 73
 
74 74
 		return $new_sort_field_id;
75 75
 	}
@@ -86,25 +86,25 @@  discard block
 block discarded – undo
86 86
 	 *
87 87
 	 * @return $criteria If a match, the sorting will be updated to set `is_numeric` to true and make sure the field ID is an int
88 88
 	 */
89
-	public function _maybe_filter_gravity_forms_query( $criteria, $form_ids, $view_id ) {
89
+	public function _maybe_filter_gravity_forms_query($criteria, $form_ids, $view_id) {
90 90
 
91 91
 		// If the search is being sorted
92
-		if( ! empty( $criteria['sorting']['key'] ) ) {
92
+		if (!empty($criteria['sorting']['key'])) {
93 93
 
94
-			$pieces = explode( $this->_sort_divider, $criteria['sorting']['key'] );
94
+			$pieces = explode($this->_sort_divider, $criteria['sorting']['key']);
95 95
 
96 96
 			/**
97 97
 			 * And the sort key matches the key set in modify_sort_id(), then modify the Gravity Forms query SQL
98 98
 			 * @see modify_sort_id()
99 99
 			 */
100
-			if( ! empty( $pieces[1] ) ) {
100
+			if (!empty($pieces[1])) {
101 101
 
102 102
 				// Pass these to the _modify_query_sort_by_time_hack() method
103 103
 				$this->_time_format = $pieces[1];
104 104
 				$this->_date_format = $pieces[2];
105 105
 
106 106
 				// Remove fake input IDs (5.1 doesn't exist. Use 5)
107
-				$criteria['sorting']['key'] = floor( $pieces[0] );
107
+				$criteria['sorting']['key'] = floor($pieces[0]);
108 108
 
109 109
 				/**
110 110
 				 * Make sure sorting is numeric (# of seconds). IMPORTANT.
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
 				$criteria['sorting']['is_numeric'] = true;
114 114
 
115 115
 				// Modify the Gravity Forms WP Query
116
-				add_filter('query', array( $this, '_modify_query_sort_by_time_hack' ) );
116
+				add_filter('query', array($this, '_modify_query_sort_by_time_hack'));
117 117
 			}
118 118
 		}
119 119
 
@@ -129,22 +129,22 @@  discard block
 block discarded – undo
129 129
 	 *
130 130
 	 * @return string Modified query, if the query matches the expected Gravity Forms SQL string used for sorting time fields. Otherwise, original query.
131 131
 	 */
132
-	function _modify_query_sort_by_time_hack( $query ) {
132
+	function _modify_query_sort_by_time_hack($query) {
133 133
 
134 134
 		/**
135 135
 		 * If this is a Gravity Forms entry selection sorting query, generated by sort_by_field_query(),
136 136
 		 * then we want to modify the query.
137 137
 		 * @see GFFormsModel::sort_by_field_query()
138 138
 		 */
139
-		if( strpos( $query, self::GF_SORTING_SQL ) > 0 ) {
139
+		if (strpos($query, self::GF_SORTING_SQL) > 0) {
140 140
 
141
-			if( $this->_time_format === '24' ) {
141
+			if ($this->_time_format === '24') {
142 142
 				$sql_str_to_date = "STR_TO_DATE( `value`, '%H:%i' )";
143 143
 			} else {
144 144
 				$sql_str_to_date = "STR_TO_DATE( `value`, '%h:%i %p' )";
145 145
 			}
146 146
 
147
-			switch ( $this->_date_format ) {
147
+			switch ($this->_date_format) {
148 148
 				case 'h':
149 149
 				case 'H':
150 150
 					$modification = "TIME_FORMAT( {$sql_str_to_date}, '%H' )";
@@ -162,40 +162,40 @@  discard block
 block discarded – undo
162 162
 			 * Convert the time (12:30 pm) to the MySQL `TIME_TO_SEC()` value for that time (45000)
163 163
 			 * This way, Gravity Forms is able to sort numerically.
164 164
 			 */
165
-			$replacement_query = str_replace( 'value', "{$modification} as value", self::GF_SORTING_SQL );
165
+			$replacement_query = str_replace('value', "{$modification} as value", self::GF_SORTING_SQL);
166 166
 
167 167
 			/**
168 168
 			 * Replace it in the main query
169 169
 			 */
170
-			$query = str_replace( self::GF_SORTING_SQL, $replacement_query, $query );
170
+			$query = str_replace(self::GF_SORTING_SQL, $replacement_query, $query);
171 171
 
172 172
 			/**
173 173
 			 * REMOVE the Gravity Forms WP Query modifications!
174 174
 			 */
175
-			remove_filter( 'query', array( $this, '_modify_query_sort_by_time_hack' ) );
175
+			remove_filter('query', array($this, '_modify_query_sort_by_time_hack'));
176 176
 		}
177 177
 
178 178
 		return $query;
179 179
 	}
180 180
 
181 181
 
182
-	function field_options( $field_options, $template_id = '', $field_id = '', $context = '', $input_type = '' ) {
182
+	function field_options($field_options, $template_id = '', $field_id = '', $context = '', $input_type = '') {
183 183
 
184 184
 		// Set variables
185
-		parent::field_options( $field_options, $template_id, $field_id, $context, $input_type );
185
+		parent::field_options($field_options, $template_id, $field_id, $context, $input_type);
186 186
 
187
-		if( 'edit' === $context ) {
187
+		if ('edit' === $context) {
188 188
 			return $field_options;
189 189
 		}
190 190
 
191 191
 		/**
192 192
 		 * Set default date format based on field ID and Form ID
193 193
 		 */
194
-		add_filter('gravityview_date_format', array( $this, '_filter_date_display_date_format' ) );
194
+		add_filter('gravityview_date_format', array($this, '_filter_date_display_date_format'));
195 195
 
196
-		$this->add_field_support('date_display', $field_options );
196
+		$this->add_field_support('date_display', $field_options);
197 197
 
198
-		remove_filter('gravityview_date_format', array( $this, '_filter_date_display_date_format' ) );
198
+		remove_filter('gravityview_date_format', array($this, '_filter_date_display_date_format'));
199 199
 
200 200
 		return $field_options;
201 201
 	}
@@ -210,9 +210,9 @@  discard block
 block discarded – undo
210 210
 	private function _get_time_format() {
211 211
 		global $post;
212 212
 
213
-		$current_form = isset( $_POST['form_id'] ) ? intval( $_POST['form_id'] ) : gravityview_get_form_id( $post->ID );
213
+		$current_form = isset($_POST['form_id']) ? intval($_POST['form_id']) : gravityview_get_form_id($post->ID);
214 214
 
215
-		return self::_get_time_format_for_field( $this->_field_id, $current_form );
215
+		return self::_get_time_format_for_field($this->_field_id, $current_form);
216 216
 	}
217 217
 
218 218
 	/**
@@ -224,17 +224,17 @@  discard block
 block discarded – undo
224 224
 	 * @param int $form_id ID for Gravity Forms form
225 225
 	 * @return string Either "12" or "24". "12" is default.
226 226
 	 */
227
-	static public function _get_time_format_for_field( $field_id, $form_id = 0 ) {
227
+	static public function _get_time_format_for_field($field_id, $form_id = 0) {
228 228
 
229 229
 		// GF defaults to 12, so should we.
230 230
 		$time_format = '12';
231 231
 
232
-		if( $form_id ) {
233
-			$form = GFAPI::get_form( $form_id );
232
+		if ($form_id) {
233
+			$form = GFAPI::get_form($form_id);
234 234
 
235
-			if ( $form ) {
236
-				$field = GFFormsModel::get_field( $form, floor( $field_id ) );
237
-				if ( $field && $field instanceof GF_Field_Time ) {
235
+			if ($form) {
236
+				$field = GFFormsModel::get_field($form, floor($field_id));
237
+				if ($field && $field instanceof GF_Field_Time) {
238 238
 					$field->sanitize_settings(); // Make sure time is set
239 239
 					$time_format = $field->timeFormat;
240 240
 				}
@@ -256,7 +256,7 @@  discard block
 block discarded – undo
256 256
 		$time_format = $this->_get_time_format();
257 257
 		$field_id = $this->_field_id;
258 258
 
259
-		return self::date_format( $time_format, $field_id );
259
+		return self::date_format($time_format, $field_id);
260 260
 	}
261 261
 
262 262
 	/**
@@ -269,19 +269,19 @@  discard block
 block discarded – undo
269 269
 	 *
270 270
 	 * @return string PHP date format for the time
271 271
 	 */
272
-	static public function date_format( $time_format = '12', $field_id = 0 ) {
272
+	static public function date_format($time_format = '12', $field_id = 0) {
273 273
 
274
-		$field_id_array = explode( '.', $field_id );
274
+		$field_id_array = explode('.', $field_id);
275 275
 
276
-		$field_input_id = isset( $field_id_array[1] ) ? intval( $field_id_array[1] ) : 0;
276
+		$field_input_id = isset($field_id_array[1]) ? intval($field_id_array[1]) : 0;
277 277
 
278 278
 		$default = 'h:i A';
279 279
 
280 280
 		// This doesn't take into account 24-hour
281
-		switch( $field_input_id ) {
281
+		switch ($field_input_id) {
282 282
 			// Hours
283 283
 			case 1:
284
-				return ( $time_format === '12' ) ? 'h' : 'H';
284
+				return ($time_format === '12') ? 'h' : 'H';
285 285
 				break;
286 286
 			// Minutes
287 287
 			case 2:
@@ -293,7 +293,7 @@  discard block
 block discarded – undo
293 293
 				break;
294 294
 			// Full time field
295 295
 			case 0:
296
-				return ( $time_format === '12' ) ? $default : 'H:i';
296
+				return ($time_format === '12') ? $default : 'H:i';
297 297
 				break;
298 298
 		}
299 299
 
Please login to merge, or discard this patch.
includes/fields/class-gravityview-field-website.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -7,23 +7,23 @@  discard block
 block discarded – undo
7 7
 
8 8
 	var $name = 'website';
9 9
 
10
-	var $search_operators = array( 'is', 'isnot', 'contains', 'starts_with', 'ends_with' );
10
+	var $search_operators = array('is', 'isnot', 'contains', 'starts_with', 'ends_with');
11 11
 
12 12
 	var $_gf_field_class_name = 'GF_Field_Website';
13 13
 
14 14
 	var $label = 'Website';
15 15
 
16 16
 	public function __construct() {
17
-		$this->label = esc_attr__( 'Website', 'gravityview' );
17
+		$this->label = esc_attr__('Website', 'gravityview');
18 18
 		parent::__construct();
19 19
 	}
20 20
 
21
-	function field_options( $field_options, $template_id = '', $field_id = '', $context = '', $input_type = '' ) {
21
+	function field_options($field_options, $template_id = '', $field_id = '', $context = '', $input_type = '') {
22 22
 
23 23
 		// It makes no sense to use this as the link.
24
-		unset( $field_options['show_as_link'] );
24
+		unset($field_options['show_as_link']);
25 25
 
26
-		if( 'edit' === $context ) {
26
+		if ('edit' === $context) {
27 27
 			return $field_options;
28 28
 		}
29 29
 
@@ -32,8 +32,8 @@  discard block
 block discarded – undo
32 32
 		 */
33 33
 		$field_options['anchor_text'] = array(
34 34
 			'type' => 'text',
35
-			'label' => __( 'Link Text:', 'gravityview' ),
36
-			'desc' => __( 'Define custom link text. Leave blank to display the URL', 'gravityview' ),
35
+			'label' => __('Link Text:', 'gravityview'),
36
+			'desc' => __('Define custom link text. Leave blank to display the URL', 'gravityview'),
37 37
 			'value' => '',
38 38
 			'merge_tags' => 'force',
39 39
 		);
@@ -41,15 +41,15 @@  discard block
 block discarded – undo
41 41
 		$field_options['truncatelink'] = array(
42 42
 			'type' => 'checkbox',
43 43
 			'value' => true,
44
-			'label' => __( 'Shorten Link Display', 'gravityview' ),
45
-			'tooltip' => __( 'Only show the domain for a URL instead of the whole link.', 'gravityview' ),
46
-			'desc' => __( 'Don’t show the full URL, only show the domain.', 'gravityview' )
44
+			'label' => __('Shorten Link Display', 'gravityview'),
45
+			'tooltip' => __('Only show the domain for a URL instead of the whole link.', 'gravityview'),
46
+			'desc' => __('Don’t show the full URL, only show the domain.', 'gravityview')
47 47
 		);
48 48
 
49 49
 		$field_options['open_same_window'] = array(
50 50
 			'type' => 'checkbox',
51 51
 			'value' => false,
52
-			'label' => __( 'Open link in the same window?', 'gravityview' ),
52
+			'label' => __('Open link in the same window?', 'gravityview'),
53 53
 		);
54 54
 
55 55
 		return $field_options;
Please login to merge, or discard this patch.