Completed
Pull Request — master (#605)
by Zack
05:45
created
includes/fields/class-gravityview-field-email.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -7,16 +7,16 @@  discard block
 block discarded – undo
7 7
 
8 8
 	var $name = 'email';
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_Email';
13 13
 
14
-	function field_options( $field_options, $template_id = '', $field_id = '', $context = '', $input_type = '' ) {
14
+	function field_options($field_options, $template_id = '', $field_id = '', $context = '', $input_type = '') {
15 15
 
16 16
 		// It makes no sense to use this as the link.
17
-		unset( $field_options['show_as_link'] );
17
+		unset($field_options['show_as_link']);
18 18
 
19
-		if( 'edit' === $context ) {
19
+		if ('edit' === $context) {
20 20
 			return $field_options;
21 21
 		}
22 22
 
@@ -24,29 +24,29 @@  discard block
 block discarded – undo
24 24
 			'emailmailto' => array(
25 25
 				'type' => 'checkbox',
26 26
 				'value' => true,
27
-				'label' => __( 'Link the Email Address', 'gravityview' ),
28
-				'desc' => __( 'Clicking the link will generate a new email.', 'gravityview' ),
27
+				'label' => __('Link the Email Address', 'gravityview'),
28
+				'desc' => __('Clicking the link will generate a new email.', 'gravityview'),
29 29
 			),
30 30
 			'emailsubject' => array(
31 31
 				'type' => 'text',
32
-				'label' => __( 'Email Subject', 'gravityview' ),
32
+				'label' => __('Email Subject', 'gravityview'),
33 33
 				'value' => '',
34
-				'desc' => __( 'Set the default email subject line.', 'gravityview' ),
34
+				'desc' => __('Set the default email subject line.', 'gravityview'),
35 35
 				'merge_tags' => 'force',
36 36
 			),
37 37
 			'emailbody' => array(
38 38
 				'type' => 'textarea',
39
-				'label' => __( 'Email Body', 'gravityview' ),
39
+				'label' => __('Email Body', 'gravityview'),
40 40
 				'value' => '',
41
-				'desc' => __( 'Set the default email content.', 'gravityview' ),
41
+				'desc' => __('Set the default email content.', 'gravityview'),
42 42
 				'merge_tags' => 'force',
43 43
 				'class' => 'widefat',
44 44
 			),
45 45
 			'emailencrypt' => array(
46 46
 				'type' => 'checkbox',
47 47
 				'value' => true,
48
-				'label' => __( 'Encrypt Email Address', 'gravityview' ),
49
-				'desc' => __( 'Make it harder for spammers to get email addresses from your entries. Email addresses will not be visible with Javascript disabled.', 'gravityview' )
48
+				'label' => __('Encrypt Email Address', 'gravityview'),
49
+				'desc' => __('Make it harder for spammers to get email addresses from your entries. Email addresses will not be visible with Javascript disabled.', 'gravityview')
50 50
 			)
51 51
 		);
52 52
 
Please login to merge, or discard this patch.
includes/fields/class-gravityview-field-entry-link.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
 
8 8
 	var $name = 'entry_link';
9 9
 
10
-	var $contexts = array( 'multiple' );
10
+	var $contexts = array('multiple');
11 11
 
12 12
 	/**
13 13
 	 * @var bool
@@ -22,24 +22,24 @@  discard block
 block discarded – undo
22 22
 	var $is_searchable = false;
23 23
 
24 24
 	public function __construct() {
25
-		$this->label = esc_attr__( 'Link to Entry', 'gravityview' );
25
+		$this->label = esc_attr__('Link to Entry', 'gravityview');
26 26
 		$this->description = __('A dedicated link to the single entry with customizable text.', 'gravityview');
27 27
 		parent::__construct();
28 28
 	}
29 29
 
30
-	function field_options( $field_options, $template_id, $field_id, $context, $input_type ) {
30
+	function field_options($field_options, $template_id, $field_id, $context, $input_type) {
31 31
 
32 32
 		// Always a link!
33
-		unset( $field_options['show_as_link'], $field_options['search_filter'] );
33
+		unset($field_options['show_as_link'], $field_options['search_filter']);
34 34
 
35
-		if( 'edit' === $context ) {
35
+		if ('edit' === $context) {
36 36
 			return $field_options;
37 37
 		}
38 38
 
39 39
 		$add_options = array();
40 40
 		$add_options['entry_link_text'] = array(
41 41
 			'type' => 'text',
42
-			'label' => __( 'Link Text:', 'gravityview' ),
42
+			'label' => __('Link Text:', 'gravityview'),
43 43
 			'desc' => NULL,
44 44
 			'value' => __('View Details', 'gravityview'),
45 45
 			'merge_tags' => true,
Please login to merge, or discard this patch.
includes/fields/class-gravityview-field-fileupload.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -227,7 +227,7 @@
 block discarded – undo
227 227
 				 */
228 228
 				$content = apply_filters( 'gravityview/fields/fileupload/link_content', $content, $gravityview_view->getCurrentField() );
229 229
 
230
-                $content = gravityview_get_link( $link, $content, $link_atts );
230
+				$content = gravityview_get_link( $link, $content, $link_atts );
231 231
 			}
232 232
 
233 233
 			$output_arr[] = array(
Please login to merge, or discard this patch.
Spacing   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -11,17 +11,17 @@  discard block
 block discarded – undo
11 11
 
12 12
 	var $name = 'fileupload';
13 13
 
14
-	function field_options( $field_options, $template_id, $field_id, $context, $input_type ) {
14
+	function field_options($field_options, $template_id, $field_id, $context, $input_type) {
15 15
 
16
-		unset( $field_options['search_filter'] );
16
+		unset($field_options['search_filter']);
17 17
 
18
-		if( 'edit' === $context ) {
18
+		if ('edit' === $context) {
19 19
 			return $field_options;
20 20
 		}
21 21
 
22 22
 		$add_options['link_to_file'] = array(
23 23
 			'type' => 'checkbox',
24
-			'label' => __( 'Display as a Link:', 'gravityview' ),
24
+			'label' => __('Display as a Link:', 'gravityview'),
25 25
 			'desc' => __('Display the uploaded files as links, rather than embedded content.', 'gravityview'),
26 26
 			'value' => false,
27 27
 			'merge_tags' => false,
@@ -43,28 +43,28 @@  discard block
 block discarded – undo
43 43
 	 * @param  string $gv_class Field class to add to the output HTML
44 44
 	 * @return array           Array of file output, with `file_path` and `html` keys (see comments above)
45 45
 	 */
46
-	static function get_files_array( $value, $gv_class ) {
46
+	static function get_files_array($value, $gv_class) {
47 47
 
48 48
 		$gravityview_view = GravityView_View::getInstance();
49 49
 
50
-		extract( $gravityview_view->getCurrentField() );
50
+		extract($gravityview_view->getCurrentField());
51 51
 
52 52
 		$output_arr = array();
53 53
 
54 54
 		// Get an array of file paths for the field.
55
-		$file_paths = rgar( $field , 'multipleFiles' ) ? json_decode( $value ) : array( $value );
55
+		$file_paths = rgar($field, 'multipleFiles') ? json_decode($value) : array($value);
56 56
 
57 57
 		// Process each file path
58
-		foreach( $file_paths as $file_path ) {
58
+		foreach ($file_paths as $file_path) {
59 59
 
60 60
 			// If the site is HTTPS, use HTTPS
61
-			if(function_exists('set_url_scheme')) { $file_path = set_url_scheme($file_path); }
61
+			if (function_exists('set_url_scheme')) { $file_path = set_url_scheme($file_path); }
62 62
 
63 63
 			// This is from Gravity Forms's code
64 64
 			$file_path = esc_attr(str_replace(" ", "%20", $file_path));
65 65
 
66 66
 			// If the field is set to link to the single entry, link to it.
67
-			$link = !empty( $field_settings['show_as_link'] ) ? GravityView_API::entry_link( $entry, $field ) : $file_path;
67
+			$link = !empty($field_settings['show_as_link']) ? GravityView_API::entry_link($entry, $field) : $file_path;
68 68
 
69 69
 			// Get file path information
70 70
 			$file_path_info = pathinfo($file_path);
@@ -86,20 +86,20 @@  discard block
 block discarded – undo
86 86
 			$content = $image->html();
87 87
 
88 88
 			// The new default content is the image, if it exists. If not, use the file name as the content.
89
-			$content = !empty( $content ) ? $content : $file_path_info['basename'];
89
+			$content = !empty($content) ? $content : $file_path_info['basename'];
90 90
 
91 91
 			// If pathinfo() gave us the extension of the file, run the switch statement using that.
92
-			$extension = empty( $file_path_info['extension'] ) ? NULL : strtolower( $file_path_info['extension'] );
92
+			$extension = empty($file_path_info['extension']) ? NULL : strtolower($file_path_info['extension']);
93 93
 
94 94
 
95
-			switch( true ) {
95
+			switch (true) {
96 96
 
97 97
 				// Audio file
98
-				case in_array( $extension, wp_get_audio_extensions() ):
98
+				case in_array($extension, wp_get_audio_extensions()):
99 99
 
100 100
 					$disable_lightbox = true;
101 101
 
102
-					if( shortcode_exists( 'audio' ) ) {
102
+					if (shortcode_exists('audio')) {
103 103
 
104 104
 						$disable_wrapped_link = true;
105 105
 
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
 						 * @since  1.2
109 109
 						 * @param array $audio_settings Array with `src` and `class` keys
110 110
 						 */
111
-						$audio_settings = apply_filters( 'gravityview_audio_settings', array(
111
+						$audio_settings = apply_filters('gravityview_audio_settings', array(
112 112
 							'src' => $file_path,
113 113
 							'class' => 'wp-audio-shortcode gv-audio gv-field-id-'.$field_settings['id']
114 114
 						));
@@ -118,18 +118,18 @@  discard block
 block discarded – undo
118 118
 						 * @see http://codex.wordpress.org/Audio_Shortcode
119 119
 						 * @see https://developer.wordpress.org/reference/functions/wp_audio_shortcode/
120 120
 						 */
121
-						$content = wp_audio_shortcode( $audio_settings );
121
+						$content = wp_audio_shortcode($audio_settings);
122 122
 
123 123
 					}
124 124
 
125 125
 					break;
126 126
 
127 127
 				// Video file
128
-				case in_array( $extension, wp_get_video_extensions() ):
128
+				case in_array($extension, wp_get_video_extensions()):
129 129
 
130 130
 					$disable_lightbox = true;
131 131
 
132
-					if( shortcode_exists( 'video' ) ) {
132
+					if (shortcode_exists('video')) {
133 133
 
134 134
 						$disable_wrapped_link = true;
135 135
 
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
 						 * @since  1.2
139 139
 						 * @param array $video_settings Array with `src` and `class` keys
140 140
 						 */
141
-						$video_settings = apply_filters( 'gravityview_video_settings', array(
141
+						$video_settings = apply_filters('gravityview_video_settings', array(
142 142
 							'src' => $file_path,
143 143
 							'class' => 'wp-video-shortcode gv-video gv-field-id-'.$field_settings['id']
144 144
 						));
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
 						 * @see http://codex.wordpress.org/Video_Shortcode
149 149
 						 * @see https://developer.wordpress.org/reference/functions/wp_video_shortcode/
150 150
 						 */
151
-						$content = wp_video_shortcode( $video_settings );
151
+						$content = wp_video_shortcode($video_settings);
152 152
 
153 153
 					}
154 154
 
@@ -158,12 +158,12 @@  discard block
 block discarded – undo
158 158
 				case $extension === 'pdf':
159 159
 
160 160
 					// PDF needs to be displayed in an IFRAME
161
-					$link = add_query_arg( array( 'TB_iframe' => 'true' ), $link );
161
+					$link = add_query_arg(array('TB_iframe' => 'true'), $link);
162 162
 
163 163
 					break;
164 164
 
165 165
 				// if not image, do not set the lightbox (@since 1.5.3)
166
-				case !in_array( $extension, array( 'jpg', 'jpeg', 'jpe', 'gif', 'png' ) ):
166
+				case !in_array($extension, array('jpg', 'jpeg', 'jpe', 'gif', 'png')):
167 167
 
168 168
 					$disable_lightbox = true;
169 169
 
@@ -173,10 +173,10 @@  discard block
 block discarded – undo
173 173
 
174 174
 			// If using Link to File, override the content.
175 175
 			// (We do this here so that the $disable_lightbox can be set. Yes, there's a little more processing time, but oh well.)
176
-			if( !empty( $field_settings['link_to_file'] ) ) {
176
+			if (!empty($field_settings['link_to_file'])) {
177 177
 
178 178
 				// Force the content to be the file name
179
-				$content =  $file_path_info["basename"];
179
+				$content = $file_path_info["basename"];
180 180
 
181 181
 				// Restore the wrapped link
182 182
 				$disable_wrapped_link = false;
@@ -184,14 +184,14 @@  discard block
 block discarded – undo
184 184
 			}
185 185
 
186 186
 			// Whether to use lightbox or not
187
-			if( $disable_lightbox || empty( $gravityview_view->atts['lightbox'] ) || !empty( $field_settings['show_as_link'] ) ) {
187
+			if ($disable_lightbox || empty($gravityview_view->atts['lightbox']) || !empty($field_settings['show_as_link'])) {
188 188
 
189
-				$link_atts = empty( $field_settings['show_as_link'] ) ? array( 'target' => '_blank' ) : array();
189
+				$link_atts = empty($field_settings['show_as_link']) ? array('target' => '_blank') : array();
190 190
 
191 191
 			} else {
192 192
 
193 193
 				$link_atts = array(
194
-					'rel' => sprintf( "%s-%s", $gv_class, $entry['id'] ),
194
+					'rel' => sprintf("%s-%s", $gv_class, $entry['id']),
195 195
 					'target' => '_blank',
196 196
 					'class' => 'thickbox',
197 197
 				);
@@ -203,7 +203,7 @@  discard block
 block discarded – undo
203 203
 			 * @param array|string $link_atts Array or attributes string
204 204
 			 * @param array $field Current GravityView field array
205 205
 			 */
206
-			$link_atts = apply_filters( 'gravityview/fields/fileupload/link_atts', $link_atts, $gravityview_view->getCurrentField() );
206
+			$link_atts = apply_filters('gravityview/fields/fileupload/link_atts', $link_atts, $gravityview_view->getCurrentField());
207 207
 
208 208
 			/**
209 209
 			 * @filter `gravityview/fields/fileupload/disable_link` Filter to alter the default behaviour of wrapping images (or image names) with a link to the content object
@@ -212,10 +212,10 @@  discard block
 block discarded – undo
212 212
 			 * @param array $gravityview_view->field_data
213 213
 			 * @see GravityView_API:field_value() for info about $gravityview_view->field_data
214 214
 			 */
215
-			$disable_wrapped_link = apply_filters( 'gravityview/fields/fileupload/disable_link', $disable_wrapped_link, $gravityview_view->getCurrentField() );
215
+			$disable_wrapped_link = apply_filters('gravityview/fields/fileupload/disable_link', $disable_wrapped_link, $gravityview_view->getCurrentField());
216 216
 
217 217
 			// If the HTML output hasn't been overridden by the switch statement above, use the default format
218
-			if( !empty( $content ) && empty( $disable_wrapped_link ) ) {
218
+			if (!empty($content) && empty($disable_wrapped_link)) {
219 219
 
220 220
 				/**
221 221
 				 * Modify the link text (defaults to the file name)
@@ -225,9 +225,9 @@  discard block
 block discarded – undo
225 225
 				 * @param string $content The existing anchor content. Could be `<img>` tag, audio/video embed or the file name
226 226
 				 * @param array $field GravityView array of the current field being processed
227 227
 				 */
228
-				$content = apply_filters( 'gravityview/fields/fileupload/link_content', $content, $gravityview_view->getCurrentField() );
228
+				$content = apply_filters('gravityview/fields/fileupload/link_content', $content, $gravityview_view->getCurrentField());
229 229
 
230
-                $content = gravityview_get_link( $link, $content, $link_atts );
230
+                $content = gravityview_get_link($link, $content, $link_atts);
231 231
 			}
232 232
 
233 233
 			$output_arr[] = array(
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
 		 *  @type string $content The generated output for the file \n
246 246
 		 * @param array $field GravityView array of the current field being processed
247 247
 		 */
248
-		$output_arr = apply_filters( 'gravityview/fields/fileupload/files_array', $output_arr, $gravityview_view->getCurrentField() );
248
+		$output_arr = apply_filters('gravityview/fields/fileupload/files_array', $output_arr, $gravityview_view->getCurrentField());
249 249
 
250 250
 		return $output_arr;
251 251
 	}
Please login to merge, or discard this patch.
includes/fields/class-gravityview-field-gquiz_score.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -10,20 +10,20 @@
 block discarded – undo
10 10
 	var $label = 'Quiz Score';
11 11
 
12 12
 	public function __construct() {
13
-		$this->label = esc_attr__( 'Quiz Score', 'gravityview' );
13
+		$this->label = esc_attr__('Quiz Score', 'gravityview');
14 14
 		parent::__construct();
15 15
 	}
16 16
 
17
-	function field_options( $field_options, $template_id, $field_id, $context, $input_type ) {
17
+	function field_options($field_options, $template_id, $field_id, $context, $input_type) {
18 18
 
19
-		if( 'edit' === $context ) {
19
+		if ('edit' === $context) {
20 20
 			return $field_options;
21 21
 		}
22 22
 
23 23
 		$new_fields = array(
24 24
 			'quiz_use_max_score' => array(
25 25
 				'type' => 'checkbox',
26
-				'label' => __( 'Show Max Score?', 'gravityview' ),
26
+				'label' => __('Show Max Score?', 'gravityview'),
27 27
 				'desc' => __('Display score as the a fraction: "[score]/[max score]". If unchecked, will display score.', 'gravityview'),
28 28
 				'value' => true,
29 29
 				'merge_tags' => false,
Please login to merge, or discard this patch.
includes/fields/class-gravityview-field-post-id.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -11,19 +11,19 @@
 block discarded – undo
11 11
 
12 12
 	var $label = 'Post ID';
13 13
 
14
-	var $search_operators = array( 'is', 'isnot', 'greater_than', 'less_than' );
14
+	var $search_operators = array('is', 'isnot', 'greater_than', 'less_than');
15 15
 
16 16
 	/**
17 17
 	 * GravityView_Field_Post_ID constructor.
18 18
 	 */
19 19
 	public function __construct() {
20
-		$this->label = __( 'Post ID', 'gravityview' );
20
+		$this->label = __('Post ID', 'gravityview');
21 21
 		parent::__construct();
22 22
 	}
23 23
 
24
-	function field_options( $field_options, $template_id, $field_id, $context, $input_type ) {
24
+	function field_options($field_options, $template_id, $field_id, $context, $input_type) {
25 25
 
26
-		$this->add_field_support('link_to_post', $field_options );
26
+		$this->add_field_support('link_to_post', $field_options);
27 27
 
28 28
 		return $field_options;
29 29
 	}
Please login to merge, or discard this patch.
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-textarea.php 2 patches
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -21,13 +21,13 @@
 block discarded – undo
21 21
 			'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' ),
22 22
 		);
23 23
 
24
-        $field_options['make_clickable'] = array(
25
-            'type' => 'checkbox',
26
-            'merge_tags' => false,
27
-            'value' => 0,
28
-            'label' => __( 'Convert text URLs to HTML links', 'gravityview' ),
29
-            'tooltip' => __( 'Converts URI, www, FTP, and email addresses in HTML links', 'gravityview' ),
30
-        );
24
+		$field_options['make_clickable'] = array(
25
+			'type' => 'checkbox',
26
+			'merge_tags' => false,
27
+			'value' => 0,
28
+			'label' => __( 'Convert text URLs to HTML links', 'gravityview' ),
29
+			'tooltip' => __( 'Converts URI, www, FTP, and email addresses in HTML links', 'gravityview' ),
30
+		);
31 31
 
32 32
 		return $field_options;
33 33
 	}
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -7,15 +7,15 @@  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 $group = 'standard';
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
 
@@ -23,16 +23,16 @@  discard block
 block discarded – undo
23 23
 			'type' => 'number',
24 24
 			'merge_tags' => false,
25 25
 			'value' => null,
26
-			'label' => __( 'Maximum words shown', 'gravityview' ),
27
-			'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' ),
26
+			'label' => __('Maximum words shown', 'gravityview'),
27
+			'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'),
28 28
 		);
29 29
 
30 30
         $field_options['make_clickable'] = array(
31 31
             'type' => 'checkbox',
32 32
             'merge_tags' => false,
33 33
             'value' => 0,
34
-            'label' => __( 'Convert text URLs to HTML links', 'gravityview' ),
35
-            'tooltip' => __( 'Converts URI, www, FTP, and email addresses in HTML links', 'gravityview' ),
34
+            'label' => __('Convert text URLs to HTML links', 'gravityview'),
35
+            'tooltip' => __('Converts URI, www, FTP, and email addresses in HTML links', 'gravityview'),
36 36
         );
37 37
 
38 38
 		return $field_options;
Please login to merge, or discard this patch.
includes/fields/class-gravityview-field-time.php 2 patches
Indentation   -1 removed lines patch added patch discarded remove patch
@@ -255,7 +255,6 @@
 block discarded – undo
255 255
 	 * Get the default date format for a field based on the field ID and the time format setting
256 256
 	 *
257 257
 	 * @since 1.14
258
-
259 258
 	 * @param string $time_format The time format ("12" or "24"). Default: "12" {@since 1.14}
260 259
 	 * @param int $field_id The ID of the field. Used to figure out full time/hours/minutes/am/pm {@since 1.14}
261 260
 	 *
Please login to merge, or discard this patch.
Spacing   +41 added lines, -41 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
 
@@ -44,9 +44,9 @@  discard block
 block discarded – undo
44 44
 
45 45
 		parent::__construct();
46 46
 
47
-		add_filter( 'gravityview/sorting/time', array( $this, 'modify_sort_id' ), 10, 2 );
47
+		add_filter('gravityview/sorting/time', array($this, 'modify_sort_id'), 10, 2);
48 48
 
49
-		add_filter('gravityview_search_criteria', array( $this, '_maybe_filter_gravity_forms_query' ), 10, 4 );
49
+		add_filter('gravityview_search_criteria', array($this, '_maybe_filter_gravity_forms_query'), 10, 4);
50 50
 	}
51 51
 
52 52
 	/**
@@ -60,14 +60,14 @@  discard block
 block discarded – undo
60 60
 	 *
61 61
 	 * @return string Modified sort key imploded with $_sort_divider, like `5|:time:|12|:time:|h:i A`
62 62
 	 */
63
-	public function modify_sort_id( $sort_field_id, $form_id ) {
63
+	public function modify_sort_id($sort_field_id, $form_id) {
64 64
 
65
-		$time_format = self::_get_time_format_for_field( $sort_field_id, $form_id );
65
+		$time_format = self::_get_time_format_for_field($sort_field_id, $form_id);
66 66
 
67
-		$date_format = self::date_format( $time_format, $sort_field_id );
67
+		$date_format = self::date_format($time_format, $sort_field_id);
68 68
 
69 69
 		// Should look something like `5|:time:|12|:time:|h:i A`
70
-		$new_sort_field_id = implode( $this->_sort_divider, array( $sort_field_id, $time_format, $date_format ) );
70
+		$new_sort_field_id = implode($this->_sort_divider, array($sort_field_id, $time_format, $date_format));
71 71
 
72 72
 		return $new_sort_field_id;
73 73
 	}
@@ -84,25 +84,25 @@  discard block
 block discarded – undo
84 84
 	 *
85 85
 	 * @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
86 86
 	 */
87
-	public function _maybe_filter_gravity_forms_query( $criteria, $form_ids, $view_id ) {
87
+	public function _maybe_filter_gravity_forms_query($criteria, $form_ids, $view_id) {
88 88
 
89 89
 		// If the search is being sorted
90
-		if( ! empty( $criteria['sorting']['key'] ) ) {
90
+		if (!empty($criteria['sorting']['key'])) {
91 91
 
92
-			$pieces = explode( $this->_sort_divider, $criteria['sorting']['key'] );
92
+			$pieces = explode($this->_sort_divider, $criteria['sorting']['key']);
93 93
 
94 94
 			/**
95 95
 			 * And the sort key matches the key set in modify_sort_id(), then modify the Gravity Forms query SQL
96 96
 			 * @see modify_sort_id()
97 97
 			 */
98
-			if( ! empty( $pieces[1] ) ) {
98
+			if (!empty($pieces[1])) {
99 99
 
100 100
 				// Pass these to the _modify_query_sort_by_time_hack() method
101 101
 				$this->_time_format = $pieces[1];
102 102
 				$this->_date_format = $pieces[2];
103 103
 
104 104
 				// Remove fake input IDs (5.1 doesn't exist. Use 5)
105
-				$criteria['sorting']['key'] = floor( $pieces[0] );
105
+				$criteria['sorting']['key'] = floor($pieces[0]);
106 106
 
107 107
 				/**
108 108
 				 * Make sure sorting is numeric (# of seconds). IMPORTANT.
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
 				$criteria['sorting']['is_numeric'] = true;
112 112
 
113 113
 				// Modify the Gravity Forms WP Query
114
-				add_filter('query', array( $this, '_modify_query_sort_by_time_hack' ) );
114
+				add_filter('query', array($this, '_modify_query_sort_by_time_hack'));
115 115
 			}
116 116
 		}
117 117
 
@@ -127,22 +127,22 @@  discard block
 block discarded – undo
127 127
 	 *
128 128
 	 * @return string Modified query, if the query matches the expected Gravity Forms SQL string used for sorting time fields. Otherwise, original query.
129 129
 	 */
130
-	function _modify_query_sort_by_time_hack( $query ) {
130
+	function _modify_query_sort_by_time_hack($query) {
131 131
 
132 132
 		/**
133 133
 		 * If this is a Gravity Forms entry selection sorting query, generated by sort_by_field_query(),
134 134
 		 * then we want to modify the query.
135 135
 		 * @see GFFormsModel::sort_by_field_query()
136 136
 		 */
137
-		if( strpos( $query, self::GF_SORTING_SQL ) > 0 ) {
137
+		if (strpos($query, self::GF_SORTING_SQL) > 0) {
138 138
 
139
-			if( $this->_time_format === '24' ) {
139
+			if ($this->_time_format === '24') {
140 140
 				$sql_str_to_date = "STR_TO_DATE( `value`, '%H:%i' )";
141 141
 			} else {
142 142
 				$sql_str_to_date = "STR_TO_DATE( `value`, '%h:%i %p' )";
143 143
 			}
144 144
 
145
-			switch ( $this->_date_format ) {
145
+			switch ($this->_date_format) {
146 146
 				case 'h':
147 147
 				case 'H':
148 148
 					$modification = "TIME_FORMAT( {$sql_str_to_date}, '%H' )";
@@ -160,40 +160,40 @@  discard block
 block discarded – undo
160 160
 			 * Convert the time (12:30 pm) to the MySQL `TIME_TO_SEC()` value for that time (45000)
161 161
 			 * This way, Gravity Forms is able to sort numerically.
162 162
 			 */
163
-			$replacement_query = str_replace( 'value', "{$modification} as value", self::GF_SORTING_SQL );
163
+			$replacement_query = str_replace('value', "{$modification} as value", self::GF_SORTING_SQL);
164 164
 
165 165
 			/**
166 166
 			 * Replace it in the main query
167 167
 			 */
168
-			$query = str_replace( self::GF_SORTING_SQL, $replacement_query, $query );
168
+			$query = str_replace(self::GF_SORTING_SQL, $replacement_query, $query);
169 169
 
170 170
 			/**
171 171
 			 * REMOVE the Gravity Forms WP Query modifications!
172 172
 			 */
173
-			remove_filter( 'query', array( $this, '_modify_query_sort_by_time_hack' ) );
173
+			remove_filter('query', array($this, '_modify_query_sort_by_time_hack'));
174 174
 		}
175 175
 
176 176
 		return $query;
177 177
 	}
178 178
 
179 179
 
180
-	function field_options( $field_options, $template_id = '', $field_id = '', $context = '', $input_type = '' ) {
180
+	function field_options($field_options, $template_id = '', $field_id = '', $context = '', $input_type = '') {
181 181
 
182 182
 		// Set variables
183
-		parent::field_options( $field_options, $template_id, $field_id, $context, $input_type );
183
+		parent::field_options($field_options, $template_id, $field_id, $context, $input_type);
184 184
 
185
-		if( 'edit' === $context ) {
185
+		if ('edit' === $context) {
186 186
 			return $field_options;
187 187
 		}
188 188
 
189 189
 		/**
190 190
 		 * Set default date format based on field ID and Form ID
191 191
 		 */
192
-		add_filter('gravityview_date_format', array( $this, '_filter_date_display_date_format' ) );
192
+		add_filter('gravityview_date_format', array($this, '_filter_date_display_date_format'));
193 193
 
194
-		$this->add_field_support('date_display', $field_options );
194
+		$this->add_field_support('date_display', $field_options);
195 195
 
196
-		remove_filter('gravityview_date_format', array( $this, '_filter_date_display_date_format' ) );
196
+		remove_filter('gravityview_date_format', array($this, '_filter_date_display_date_format'));
197 197
 
198 198
 		return $field_options;
199 199
 	}
@@ -208,9 +208,9 @@  discard block
 block discarded – undo
208 208
 	private function _get_time_format() {
209 209
 		global $post;
210 210
 
211
-		$current_form = isset( $_POST['form_id'] ) ? intval( $_POST['form_id'] ) : gravityview_get_form_id( $post->ID );
211
+		$current_form = isset($_POST['form_id']) ? intval($_POST['form_id']) : gravityview_get_form_id($post->ID);
212 212
 
213
-		return self::_get_time_format_for_field( $this->_field_id, $current_form );
213
+		return self::_get_time_format_for_field($this->_field_id, $current_form);
214 214
 	}
215 215
 
216 216
 	/**
@@ -222,17 +222,17 @@  discard block
 block discarded – undo
222 222
 	 * @param int $form_id ID for Gravity Forms form
223 223
 	 * @return string Either "12" or "24". "12" is default.
224 224
 	 */
225
-	static public function _get_time_format_for_field( $field_id, $form_id = 0 ) {
225
+	static public function _get_time_format_for_field($field_id, $form_id = 0) {
226 226
 
227 227
 		// GF defaults to 12, so should we.
228 228
 		$time_format = '12';
229 229
 
230
-		if( $form_id ) {
231
-			$form = GFAPI::get_form( $form_id );
230
+		if ($form_id) {
231
+			$form = GFAPI::get_form($form_id);
232 232
 
233
-			if ( $form ) {
234
-				$field = GFFormsModel::get_field( $form, floor( $field_id ) );
235
-				if ( $field && $field instanceof GF_Field_Time ) {
233
+			if ($form) {
234
+				$field = GFFormsModel::get_field($form, floor($field_id));
235
+				if ($field && $field instanceof GF_Field_Time) {
236 236
 					$field->sanitize_settings(); // Make sure time is set
237 237
 					$time_format = $field->timeFormat;
238 238
 				}
@@ -254,7 +254,7 @@  discard block
 block discarded – undo
254 254
 		$time_format = $this->_get_time_format();
255 255
 		$field_id = $this->_field_id;
256 256
 
257
-		return self::date_format( $time_format, $field_id );
257
+		return self::date_format($time_format, $field_id);
258 258
 	}
259 259
 
260 260
 	/**
@@ -267,19 +267,19 @@  discard block
 block discarded – undo
267 267
 	 *
268 268
 	 * @return string PHP date format for the time
269 269
 	 */
270
-	static public function date_format( $time_format = '12', $field_id = 0 ) {
270
+	static public function date_format($time_format = '12', $field_id = 0) {
271 271
 
272
-		$field_id_array = explode( '.', $field_id );
272
+		$field_id_array = explode('.', $field_id);
273 273
 
274
-		$field_input_id = isset( $field_id_array[1] ) ? intval( $field_id_array[1] ) : 0;
274
+		$field_input_id = isset($field_id_array[1]) ? intval($field_id_array[1]) : 0;
275 275
 
276 276
 		$default = 'h:i A';
277 277
 
278 278
 		// This doesn't take into account 24-hour
279
-		switch( $field_input_id ) {
279
+		switch ($field_input_id) {
280 280
 			// Hours
281 281
 			case 1:
282
-				return ( $time_format === '12' ) ? 'h' : 'H';
282
+				return ($time_format === '12') ? 'h' : 'H';
283 283
 				break;
284 284
 			// Minutes
285 285
 			case 2:
@@ -291,7 +291,7 @@  discard block
 block discarded – undo
291 291
 				break;
292 292
 			// Full time field
293 293
 			case 0:
294
-				return ( $time_format === '12' ) ? $default : 'H:i';
294
+				return ($time_format === '12') ? $default : 'H:i';
295 295
 				break;
296 296
 		}
297 297
 
Please login to merge, or discard this patch.
includes/fields/class-gravityview-field-post-image.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -7,18 +7,18 @@
 block discarded – undo
7 7
 
8 8
 	var $name = 'post_image';
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'] );
12
+		unset ($field_options['search_filter']);
13 13
 
14
-		if( 'edit' === $context ) {
14
+		if ('edit' === $context) {
15 15
 			return $field_options;
16 16
 		}
17 17
 
18
-		$this->add_field_support('link_to_post', $field_options );
18
+		$this->add_field_support('link_to_post', $field_options);
19 19
 
20 20
 		// @since 1.5.4
21
-		$this->add_field_support('dynamic_data', $field_options );
21
+		$this->add_field_support('dynamic_data', $field_options);
22 22
 
23 23
 		return $field_options;
24 24
 	}
Please login to merge, or discard this patch.