Completed
Pull Request — master (#605)
by Zack
05:45
created
includes/helper-functions.php 3 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -307,7 +307,7 @@
 block discarded – undo
307 307
 		! isset( $value ) // If it's not set, it's empty!
308 308
 		|| false === $value
309 309
 		|| null === $value
310
-	    || '' === $value // Empty string
310
+		|| '' === $value // Empty string
311 311
 		|| array() === $value // Empty array
312 312
 		|| ( is_object( $value ) && ! get_object_vars( $value ) ) // Empty object
313 313
 	) {
Please login to merge, or discard this patch.
Doc Comments   +2 added lines, -3 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
  *
29 29
  * We could do this in a cleaner fashion, but this prevents a lot of code duplication, checking for URL structure, etc.
30 30
  *
31
- * @param int|WP_Post $id        Optional. Post ID or post object. Default current post.
31
+ * @param integer $id        Optional. Post ID or post object. Default current post.
32 32
  *
33 33
  * @return array URL args, if exists. Empty array if not.
34 34
  */
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
  * @since 1.15 Added $object param
136 136
  *
137 137
  * @param string $file_path Full path to a file
138
- * @param mixed $object Pass pseudo-global to the included file
138
+ * @param GravityView_Edit_Entry_Render $object Pass pseudo-global to the included file
139 139
  * @return string Included file contents
140 140
  */
141 141
 function gravityview_ob_include( $file_path, $object = NULL ) {
@@ -310,7 +310,6 @@  discard block
 block discarded – undo
310 310
  * Do a _very_ basic match for second-level TLD domains, like `.co.uk`
311 311
  *
312 312
  * Ideally, we'd use https://github.com/jeremykendall/php-domain-parser to check for this, but it's too much work for such a basic functionality. Maybe if it's needed more in the future. So instead, we use [Basic matching regex](http://stackoverflow.com/a/12372310).
313
- * @param  string $domain Domain to check if it's a TLD or subdomain
314 313
  * @return string         Extracted domain if it has a subdomain
315 314
  */
316 315
 function _gravityview_strip_subdomain( $string_maybe_has_subdomain ) {
Please login to merge, or discard this patch.
Spacing   +73 added lines, -73 removed lines patch added patch discarded remove patch
@@ -15,8 +15,8 @@  discard block
 block discarded – undo
15 15
  *
16 16
  * @return bool true: $mixed is *not* an empty string; false: $mixed *is* an empty string
17 17
  */
18
-function gravityview_is_not_empty_string( $mixed = '' ) {
19
-	return ( $mixed !== '' );
18
+function gravityview_is_not_empty_string($mixed = '') {
19
+	return ($mixed !== '');
20 20
 }
21 21
 
22 22
 /**
@@ -32,17 +32,17 @@  discard block
 block discarded – undo
32 32
  *
33 33
  * @return array URL args, if exists. Empty array if not.
34 34
  */
35
-function gravityview_get_permalink_query_args( $id = 0 ) {
35
+function gravityview_get_permalink_query_args($id = 0) {
36 36
 
37
-	$parsed_permalink = parse_url( get_permalink( $id ) );
37
+	$parsed_permalink = parse_url(get_permalink($id));
38 38
 
39
-	$permalink_args =  isset( $parsed_permalink['query'] ) ? $parsed_permalink['query'] : false;
39
+	$permalink_args = isset($parsed_permalink['query']) ? $parsed_permalink['query'] : false;
40 40
 
41
-	if( empty( $permalink_args ) ) {
41
+	if (empty($permalink_args)) {
42 42
 		return array();
43 43
 	}
44 44
 
45
-	parse_str( $permalink_args, $args );
45
+	parse_str($permalink_args, $args);
46 46
 
47 47
 	return $args;
48 48
 }
@@ -60,18 +60,18 @@  discard block
 block discarded – undo
60 60
  *
61 61
  * @return string html attribute or empty string
62 62
  */
63
-function gv_selected( $value, $current, $echo = true, $type = 'selected' ) {
63
+function gv_selected($value, $current, $echo = true, $type = 'selected') {
64 64
 
65 65
 	$output = '';
66
-	if( is_array( $current ) ) {
67
-		if( in_array( $value, $current ) ) {
68
-			$output = __checked_selected_helper( true, true, false, $type );
66
+	if (is_array($current)) {
67
+		if (in_array($value, $current)) {
68
+			$output = __checked_selected_helper(true, true, false, $type);
69 69
 		}
70 70
 	} else {
71
-		$output = __checked_selected_helper( $value, $current, false, $type );
71
+		$output = __checked_selected_helper($value, $current, false, $type);
72 72
 	}
73 73
 
74
-	if( $echo ) {
74
+	if ($echo) {
75 75
 		echo $output;
76 76
 	}
77 77
 
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
 }
80 80
 
81 81
 
82
-if( ! function_exists( 'gravityview_sanitize_html_class' ) ) {
82
+if (!function_exists('gravityview_sanitize_html_class')) {
83 83
 
84 84
 	/**
85 85
 	 * sanitize_html_class doesn't handle spaces (multiple classes). We remedy that.
@@ -90,22 +90,22 @@  discard block
 block discarded – undo
90 90
 	 *
91 91
 	 * @return string            Sanitized CSS string
92 92
 	 */
93
-	function gravityview_sanitize_html_class( $classes ) {
93
+	function gravityview_sanitize_html_class($classes) {
94 94
 
95
-		if ( is_string( $classes ) ) {
96
-			$classes = explode( ' ', $classes );
95
+		if (is_string($classes)) {
96
+			$classes = explode(' ', $classes);
97 97
 		}
98 98
 
99 99
 		// If someone passes something not string or array, we get outta here.
100
-		if ( ! is_array( $classes ) ) {
100
+		if (!is_array($classes)) {
101 101
 			return $classes;
102 102
 		}
103 103
 
104
-		$classes = array_map( 'trim', $classes );
105
-		$classes = array_map( 'sanitize_html_class', $classes );
106
-		$classes = array_filter( $classes );
104
+		$classes = array_map('trim', $classes);
105
+		$classes = array_map('sanitize_html_class', $classes);
106
+		$classes = array_filter($classes);
107 107
 
108
-		return implode( ' ', $classes );
108
+		return implode(' ', $classes);
109 109
 	}
110 110
 }
111 111
 
@@ -123,9 +123,9 @@  discard block
 block discarded – undo
123 123
  *
124 124
  * @return string Stripped string!
125 125
  */
126
-function gravityview_strip_whitespace( $string ) {
127
-	$string = normalize_whitespace( $string );
128
-	return preg_replace('/[\r\n\t ]+/', ' ', $string );
126
+function gravityview_strip_whitespace($string) {
127
+	$string = normalize_whitespace($string);
128
+	return preg_replace('/[\r\n\t ]+/', ' ', $string);
129 129
 }
130 130
 
131 131
 /**
@@ -138,13 +138,13 @@  discard block
 block discarded – undo
138 138
  * @param mixed $object Pass pseudo-global to the included file
139 139
  * @return string Included file contents
140 140
  */
141
-function gravityview_ob_include( $file_path, $object = NULL ) {
142
-	if( ! file_exists( $file_path ) ) {
143
-		do_action( 'gravityview_log_error', __FUNCTION__ . ': File path does not exist. ', $file_path );
141
+function gravityview_ob_include($file_path, $object = NULL) {
142
+	if (!file_exists($file_path)) {
143
+		do_action('gravityview_log_error', __FUNCTION__.': File path does not exist. ', $file_path);
144 144
 		return '';
145 145
 	}
146 146
 	ob_start();
147
-	include( $file_path );
147
+	include($file_path);
148 148
 	return ob_get_clean();
149 149
 }
150 150
 
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
  */
156 156
 function gravityview_get_floaty() {
157 157
 
158
-	if( function_exists('is_rtl') && is_rtl() ) {
158
+	if (function_exists('is_rtl') && is_rtl()) {
159 159
 		$style = 'margin:10px 10px 10px 0;';
160 160
 		$class = 'alignright';
161 161
 	} else {
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
 		$class = 'alignleft';
164 164
 	}
165 165
 
166
-	return '<img src="'.plugins_url( 'assets/images/astronaut-200x263.png', GRAVITYVIEW_FILE ).'" class="'.$class.'" height="87" width="66" alt="The GravityView Astronaut Says:" style="'.$style.'" />';
166
+	return '<img src="'.plugins_url('assets/images/astronaut-200x263.png', GRAVITYVIEW_FILE).'" class="'.$class.'" height="87" width="66" alt="The GravityView Astronaut Says:" style="'.$style.'" />';
167 167
 }
168 168
 
169 169
 /**
@@ -183,21 +183,21 @@  discard block
 block discarded – undo
183 183
  *
184 184
  * @return string Converted number in string format.
185 185
  */
186
-function gravityview_number_format( $number, $decimals = '' ) {
186
+function gravityview_number_format($number, $decimals = '') {
187 187
 	global $wp_locale;
188 188
 
189
-	if( '' === $decimals ) {
189
+	if ('' === $decimals) {
190 190
 
191
-		$decimal_point = isset( $wp_locale ) ? $wp_locale->number_format['decimal_point'] : '.';
191
+		$decimal_point = isset($wp_locale) ? $wp_locale->number_format['decimal_point'] : '.';
192 192
 
193 193
 		/**
194 194
 		 * Calculate the position of the decimal point in the number
195 195
 		 * @see http://stackoverflow.com/a/2430144/480856
196 196
 		 */
197
-		$decimals = strlen( substr( strrchr( $number, $decimal_point ), 1 ) );
197
+		$decimals = strlen(substr(strrchr($number, $decimal_point), 1));
198 198
 	}
199 199
 
200
-	$number = number_format_i18n( $number, (int)$decimals );
200
+	$number = number_format_i18n($number, (int)$decimals);
201 201
 
202 202
 	return $number;
203 203
 }
@@ -211,13 +211,13 @@  discard block
 block discarded – undo
211 211
  * @param  string $value Existing URL
212 212
  * @return string        If parse_url doesn't find a 'host', returns original value. Otherwise, returns formatted link.
213 213
  */
214
-function gravityview_format_link( $value = null ) {
214
+function gravityview_format_link($value = null) {
215 215
 
216 216
 
217
-	$parts = parse_url( $value );
217
+	$parts = parse_url($value);
218 218
 
219 219
 	// No domain? Strange...show the original text.
220
-	if( empty( $parts['host'] ) ) {
220
+	if (empty($parts['host'])) {
221 221
 		return $value;
222 222
 	}
223 223
 
@@ -230,9 +230,9 @@  discard block
 block discarded – undo
230 230
 	 * @param boolean $enable Whether to strip the scheme. Return false to show scheme. (default: true)\n
231 231
 	 * If true: `http://example.com => example.com`
232 232
 	 */
233
-	if( false === apply_filters('gravityview_anchor_text_striphttp', true) ) {
233
+	if (false === apply_filters('gravityview_anchor_text_striphttp', true)) {
234 234
 
235
-		if( isset( $parts['scheme'] ) ) {
235
+		if (isset($parts['scheme'])) {
236 236
 			$return .= $parts['scheme'];
237 237
 		}
238 238
 
@@ -247,10 +247,10 @@  discard block
 block discarded – undo
247 247
 	 * @param boolean $enable Whether to strip www. Return false to show www. (default: true)\n
248 248
 	 * If true: `www.example.com => example.com`
249 249
 	 */
250
-	$strip_www = apply_filters('gravityview_anchor_text_stripwww', true );
250
+	$strip_www = apply_filters('gravityview_anchor_text_stripwww', true);
251 251
 
252
-	if( $strip_www ) {
253
-		$domain = str_replace('www.', '', $domain );
252
+	if ($strip_www) {
253
+		$domain = str_replace('www.', '', $domain);
254 254
 	}
255 255
 
256 256
 	/**
@@ -262,9 +262,9 @@  discard block
 block discarded – undo
262 262
 	 */
263 263
 	$strip_subdomains = apply_filters('gravityview_anchor_text_nosubdomain', true);
264 264
 
265
-	if( $strip_subdomains ) {
265
+	if ($strip_subdomains) {
266 266
 
267
-		$domain = _gravityview_strip_subdomain( $parts['host'] );
267
+		$domain = _gravityview_strip_subdomain($parts['host']);
268 268
 
269 269
 	}
270 270
 
@@ -280,9 +280,9 @@  discard block
 block discarded – undo
280 280
 	 */
281 281
 	$root_only = apply_filters('gravityview_anchor_text_rootonly', true);
282 282
 
283
-	if( empty( $root_only ) ) {
283
+	if (empty($root_only)) {
284 284
 
285
-		if( isset( $parts['path'] ) ) {
285
+		if (isset($parts['path'])) {
286 286
 			$return .= $parts['path'];
287 287
 		}
288 288
 	}
@@ -293,11 +293,11 @@  discard block
 block discarded – undo
293 293
 	 * @param boolean $enable Whether to enable "root only". Return false to show full path. (default: true)\n
294 294
 	 * If true: `http://example.com/?query=example => example.com`
295 295
 	 */
296
-	$strip_query_string = apply_filters('gravityview_anchor_text_noquerystring', true );
296
+	$strip_query_string = apply_filters('gravityview_anchor_text_noquerystring', true);
297 297
 
298
-	if( empty( $strip_query_string ) ) {
298
+	if (empty($strip_query_string)) {
299 299
 
300
-		if( isset( $parts['query'] ) ) {
300
+		if (isset($parts['query'])) {
301 301
 			$return .= '?'.$parts['query'];
302 302
 		}
303 303
 
@@ -313,9 +313,9 @@  discard block
 block discarded – undo
313 313
  * @param  string $domain Domain to check if it's a TLD or subdomain
314 314
  * @return string         Extracted domain if it has a subdomain
315 315
  */
316
-function _gravityview_strip_subdomain( $string_maybe_has_subdomain ) {
316
+function _gravityview_strip_subdomain($string_maybe_has_subdomain) {
317 317
 
318
-	if( preg_match("/(?P<domain>[a-z0-9][a-z0-9\-]{1,63}\.(?:com\.|co\.|net\.|org\.|firm\.|me\.|school\.|law\.|gov\.|mod\.|msk\.|irkutsks\.|sa\.|act\.|police\.|plc\.|ac\.|tm\.|asso\.|biz\.|pro\.|cg\.|telememo\.)?[a-z\.]{2,6})$/i", $string_maybe_has_subdomain, $matches ) ) {
318
+	if (preg_match("/(?P<domain>[a-z0-9][a-z0-9\-]{1,63}\.(?:com\.|co\.|net\.|org\.|firm\.|me\.|school\.|law\.|gov\.|mod\.|msk\.|irkutsks\.|sa\.|act\.|police\.|plc\.|ac\.|tm\.|asso\.|biz\.|pro\.|cg\.|telememo\.)?[a-z\.]{2,6})$/i", $string_maybe_has_subdomain, $matches)) {
319 319
 		return $matches['domain'];
320 320
 	} else {
321 321
 		return $string_maybe_has_subdomain;
@@ -335,37 +335,37 @@  discard block
 block discarded – undo
335 335
  * @param boolean $allow_string_booleans Whether to check if 'yes', 'true' => `true` and 'no', 'false' => `false`
336 336
  * @return boolean        True: empty; false: not empty
337 337
  */
338
-function gv_empty( $value, $zero_is_empty = true, $allow_string_booleans = true ) {
338
+function gv_empty($value, $zero_is_empty = true, $allow_string_booleans = true) {
339 339
 
340
-	if(
341
-		! isset( $value ) // If it's not set, it's empty!
340
+	if (
341
+		!isset($value) // If it's not set, it's empty!
342 342
 		|| false === $value
343 343
 		|| null === $value
344 344
 	    || '' === $value // Empty string
345 345
 		|| array() === $value // Empty array
346
-		|| ( is_object( $value ) && ! get_object_vars( $value ) ) // Empty object
346
+		|| (is_object($value) && !get_object_vars($value)) // Empty object
347 347
 	) {
348 348
 		return true;
349 349
 	}
350 350
 
351
-	if( is_string( $value ) && $allow_string_booleans ) {
351
+	if (is_string($value) && $allow_string_booleans) {
352 352
 
353
-		$value = trim( $value );
354
-		$value = strtolower( $value );
353
+		$value = trim($value);
354
+		$value = strtolower($value);
355 355
 
356
-		if ( in_array( $value, array( 'yes', 'true' ), true ) ) {
356
+		if (in_array($value, array('yes', 'true'), true)) {
357 357
 			$value = true;
358
-		} else if( in_array( $value, array( 'no', 'false' ), true ) ) {
358
+		} else if (in_array($value, array('no', 'false'), true)) {
359 359
 			$value = false;
360 360
 		}
361 361
 	}
362 362
 
363 363
 	// If zero isn't empty, then if $value is a number and it's empty, it's zero. Thus, return false.
364
-	if( ! $zero_is_empty && is_numeric( $value ) && empty( $value ) ) {
364
+	if (!$zero_is_empty && is_numeric($value) && empty($value)) {
365 365
 		return false;
366 366
 	}
367 367
 
368
-	return empty( $value );
368
+	return empty($value);
369 369
 }
370 370
 
371 371
 /**
@@ -378,17 +378,17 @@  discard block
 block discarded – undo
378 378
  *
379 379
  * @return bool True: it's a valid datetime, formatted as expected. False: it's not a date formatted as expected.
380 380
  */
381
-function gravityview_is_valid_datetime( $datetime, $expected_format = 'Y-m-d' ) {
381
+function gravityview_is_valid_datetime($datetime, $expected_format = 'Y-m-d') {
382 382
 
383 383
 	/**
384 384
 	 * @var bool|DateTime False if not a valid date, (like a relative date). DateTime if a date was created.
385 385
 	 */
386
-	$formatted_date = DateTime::createFromFormat( $expected_format, $datetime );
386
+	$formatted_date = DateTime::createFromFormat($expected_format, $datetime);
387 387
 
388 388
 	/**
389 389
 	 * @see http://stackoverflow.com/a/19271434/480856
390 390
 	 */
391
-	return ( $formatted_date && $formatted_date->format( $expected_format ) === $datetime );
391
+	return ($formatted_date && $formatted_date->format($expected_format) === $datetime);
392 392
 }
393 393
 
394 394
 /**
@@ -406,7 +406,7 @@  discard block
 block discarded – undo
406 406
  *
407 407
  * @return array Multidimensional array with `text` (Category Name) and `value` (Category ID) keys.
408 408
  */
409
-function gravityview_get_terms_choices( $args = array() ) {
409
+function gravityview_get_terms_choices($args = array()) {
410 410
 
411 411
 	$defaults = array(
412 412
 		'type'         => 'post',
@@ -420,21 +420,21 @@  discard block
 block discarded – undo
420 420
 		'fields'       => 'id=>name',
421 421
 	);
422 422
 
423
-	$args = wp_parse_args( $args, $defaults );
423
+	$args = wp_parse_args($args, $defaults);
424 424
 
425 425
 	/**
426 426
 	 * @filter `gravityview_get_terms_choices_args` Modify the arguments passed to `get_terms()`
427 427
 	 * @see get_terms()
428 428
 	 * @since 1.15.3
429 429
 	 */
430
-	$args = apply_filters( 'gravityview_get_terms_choices_args', $args );
430
+	$args = apply_filters('gravityview_get_terms_choices_args', $args);
431 431
 
432
-	$terms = get_terms( $args['taxonomy'], $args );
432
+	$terms = get_terms($args['taxonomy'], $args);
433 433
 
434 434
 	$choices = array();
435 435
 
436
-	if ( is_array( $terms ) ) {
437
-		foreach ( $terms as $term_id => $term_name ) {
436
+	if (is_array($terms)) {
437
+		foreach ($terms as $term_id => $term_name) {
438 438
 			$choices[] = array(
439 439
 				'text'  => $term_name,
440 440
 				'value' => $term_id
Please login to merge, or discard this patch.
includes/lib/class-gamajo-template-loader.php 2 patches
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -76,15 +76,15 @@  discard block
 block discarded – undo
76 76
 	 *
77 77
 	 * @return string
78 78
 	 */
79
-	public function get_template_part( $slug, $name = null, $load = true ) {
79
+	public function get_template_part($slug, $name = null, $load = true) {
80 80
 		// Execute code for this part
81
-		do_action( 'get_template_part_' . $slug, $slug, $name );
81
+		do_action('get_template_part_'.$slug, $slug, $name);
82 82
 
83 83
 		// Get files names of templates, for given slug and name.
84
-		$templates = $this->get_template_file_names( $slug, $name );
84
+		$templates = $this->get_template_file_names($slug, $name);
85 85
 
86 86
 		// Return the part that is found
87
-		return $this->locate_template( $templates, $load, false );
87
+		return $this->locate_template($templates, $load, false);
88 88
 	}
89 89
 
90 90
 	/**
@@ -97,12 +97,12 @@  discard block
 block discarded – undo
97 97
 	 *
98 98
 	 * @return array
99 99
 	 */
100
-	protected function get_template_file_names( $slug, $name ) {
100
+	protected function get_template_file_names($slug, $name) {
101 101
 		$templates = array();
102
-		if ( isset( $name ) ) {
103
-			$templates[] = $slug . '-' . $name . '.php';
102
+		if (isset($name)) {
103
+			$templates[] = $slug.'-'.$name.'.php';
104 104
 		}
105
-		$templates[] = $slug . '.php';
105
+		$templates[] = $slug.'.php';
106 106
 
107 107
 		/**
108 108
 		 * Allow template choices to be filtered.
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
 		 * @param string $slug Template slug.
117 117
 		 * @param string $name Template name.
118 118
 		 */
119
-		return apply_filters( $this->filter_prefix . '_get_template_part', $templates, $slug, $name );
119
+		return apply_filters($this->filter_prefix.'_get_template_part', $templates, $slug, $name);
120 120
 	}
121 121
 
122 122
 	/**
@@ -137,30 +137,30 @@  discard block
 block discarded – undo
137 137
 	 *
138 138
 	 * @return string The template filename if one is located.
139 139
 	 */
140
-	public function locate_template( $template_names, $load = false, $require_once = true ) {
140
+	public function locate_template($template_names, $load = false, $require_once = true) {
141 141
 		// No file found yet
142 142
 		$located = false;
143 143
 
144 144
 		// Remove empty entries
145
-		$template_names = array_filter( (array) $template_names );
145
+		$template_names = array_filter((array)$template_names);
146 146
 		$template_paths = $this->get_template_paths();
147 147
 
148 148
 		// Try to find a template file
149
-		foreach ( $template_names as $template_name ) {
149
+		foreach ($template_names as $template_name) {
150 150
 			// Trim off any slashes from the template name
151
-			$template_name = ltrim( $template_name, '/' );
151
+			$template_name = ltrim($template_name, '/');
152 152
 
153 153
 			// Try locating this template file by looping through the template paths
154
-			foreach ( $template_paths as $template_path ) {
155
-				if ( file_exists( $template_path . $template_name ) ) {
156
-					$located = $template_path . $template_name;
154
+			foreach ($template_paths as $template_path) {
155
+				if (file_exists($template_path.$template_name)) {
156
+					$located = $template_path.$template_name;
157 157
 					break 2;
158 158
 				}
159 159
 			}
160 160
 		}
161 161
 
162
-		if ( $load && $located ) {
163
-			load_template( $located, $require_once );
162
+		if ($load && $located) {
163
+			load_template($located, $require_once);
164 164
 		}
165 165
 
166 166
 		return $located;
@@ -178,16 +178,16 @@  discard block
 block discarded – undo
178 178
 	 * @return mixed|void
179 179
 	 */
180 180
 	protected function get_template_paths() {
181
-		$theme_directory = trailingslashit( $this->theme_template_directory );
181
+		$theme_directory = trailingslashit($this->theme_template_directory);
182 182
 
183 183
 		$file_paths = array(
184
-			10  => trailingslashit( get_template_directory() ) . $theme_directory,
184
+			10  => trailingslashit(get_template_directory()).$theme_directory,
185 185
 			100 => $this->get_templates_dir()
186 186
 		);
187 187
 
188 188
 		// Only add this conditionally, so non-child themes don't redundantly check active theme twice.
189
-		if ( is_child_theme() ) {
190
-			$file_paths[1] = trailingslashit( get_stylesheet_directory() ) . $theme_directory;
189
+		if (is_child_theme()) {
190
+			$file_paths[1] = trailingslashit(get_stylesheet_directory()).$theme_directory;
191 191
 		}
192 192
 
193 193
 		/**
@@ -197,12 +197,12 @@  discard block
 block discarded – undo
197 197
 		 *
198 198
 		 * @param array $var Default is directory in child theme at index 1, parent theme at 10, and plugin at 100.
199 199
 		 */
200
-		$file_paths = apply_filters( $this->filter_prefix . '_template_paths', $file_paths );
200
+		$file_paths = apply_filters($this->filter_prefix.'_template_paths', $file_paths);
201 201
 
202 202
 		// sort the file paths based on priority
203
-		ksort( $file_paths, SORT_NUMERIC );
203
+		ksort($file_paths, SORT_NUMERIC);
204 204
 
205
-		return array_map( 'trailingslashit', $file_paths );
205
+		return array_map('trailingslashit', $file_paths);
206 206
 	}
207 207
 
208 208
 	/**
@@ -215,6 +215,6 @@  discard block
 block discarded – undo
215 215
 	 * @return string
216 216
 	 */
217 217
 	protected function get_templates_dir() {
218
-		return trailingslashit( $this->plugin_directory ) . $this->plugin_template_directory;
218
+		return trailingslashit($this->plugin_directory).$this->plugin_template_directory;
219 219
 	}
220 220
 }
Please login to merge, or discard this patch.
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -1,14 +1,14 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Template Loader for Plugins.
4
- *
5
- * @package   Gamajo_Template_Loader
6
- * @author    Gary Jones
7
- * @link      http://github.com/GaryJones/Gamajo-Template-Loader
8
- * @copyright 2013 Gary Jones
9
- * @license   GPL-2.0+
10
- * @version   1.1.0
11
- */
3
+	 * Template Loader for Plugins.
4
+	 *
5
+	 * @package   Gamajo_Template_Loader
6
+	 * @author    Gary Jones
7
+	 * @link      http://github.com/GaryJones/Gamajo-Template-Loader
8
+	 * @copyright 2013 Gary Jones
9
+	 * @license   GPL-2.0+
10
+	 * @version   1.1.0
11
+	 */
12 12
 
13 13
 /**
14 14
  * Template loader.
Please login to merge, or discard this patch.
includes/load-plugin-and-theme-hooks.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -14,12 +14,12 @@
 block discarded – undo
14 14
 
15 15
 
16 16
 /** @define "GRAVITYVIEW_DIR" "../" */
17
-$include_path = GRAVITYVIEW_DIR . 'includes/plugin-and-theme-hooks/';
17
+$include_path = GRAVITYVIEW_DIR.'includes/plugin-and-theme-hooks/';
18 18
 
19 19
 // Abstract class
20
-require $include_path . 'abstract-gravityview-plugin-and-theme-hooks.php';
20
+require $include_path.'abstract-gravityview-plugin-and-theme-hooks.php';
21 21
 
22 22
 // Load all plugin and theme files automatically
23
-foreach ( glob( $include_path . 'class-gravityview-{plugin,theme}-hooks-*.php', GLOB_BRACE ) as $gv_hooks_filename ) {
23
+foreach (glob($include_path.'class-gravityview-{plugin,theme}-hooks-*.php', GLOB_BRACE) as $gv_hooks_filename) {
24 24
 	include $gv_hooks_filename;
25 25
 }
26 26
\ No newline at end of file
Please login to merge, or discard this patch.
plugin-and-theme-hooks/class-gravityview-plugin-hooks-yoast-seo.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -56,16 +56,16 @@  discard block
 block discarded – undo
56 56
 
57 57
 		parent::add_hooks();
58 58
 
59
-		if( gravityview_is_admin_page() ) {
59
+		if (gravityview_is_admin_page()) {
60 60
 
61 61
 				// Make Yoast metabox go down to the bottom please.
62
-			add_filter( 'wpseo_metabox_prio', array( $this, '__return_low' ) );
62
+			add_filter('wpseo_metabox_prio', array($this, '__return_low'));
63 63
 
64 64
 			// Prevent the SEO from being checked. Eesh.
65
-			add_filter( 'wpseo_use_page_analysis', '__return_false' );
65
+			add_filter('wpseo_use_page_analysis', '__return_false');
66 66
 
67 67
 			// WordPress SEO Plugin
68
-			add_filter( 'option_wpseo_titles', array( $this, 'hide_wordpress_seo_metabox' ) );
68
+			add_filter('option_wpseo_titles', array($this, 'hide_wordpress_seo_metabox'));
69 69
 		}
70 70
 	}
71 71
 
@@ -79,11 +79,11 @@  discard block
 block discarded – undo
79 79
 	 * @param  array       $options WP SEO options array
80 80
 	 * @return array               Modified array if on post-new.php
81 81
 	 */
82
-	function hide_wordpress_seo_metabox( $options = array() ) {
82
+	function hide_wordpress_seo_metabox($options = array()) {
83 83
 		global $pagenow;
84 84
 
85 85
 		// New View page
86
-		if( $pagenow === 'post-new.php' ) {
86
+		if ($pagenow === 'post-new.php') {
87 87
 			$options['hideeditbox-gravityview'] = true;
88 88
 		}
89 89
 
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
 	 * @param string $existing Existing priority. Default: `high`
100 100
 	 * @return string Returns 'low'
101 101
 	 */
102
-	function __return_low( $existing = 'high' ) {
102
+	function __return_low($existing = 'high') {
103 103
 		return 'low';
104 104
 	}
105 105
 }
Please login to merge, or discard this patch.
includes/plugin-and-theme-hooks/class-gravityview-theme-hooks-woothemes.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
 
66 66
 		parent::add_hooks();
67 67
 
68
-		add_action( 'admin_menu', array( $this, 'remove_meta_box' ), 11 );
68
+		add_action('admin_menu', array($this, 'remove_meta_box'), 11);
69 69
 	}
70 70
 
71 71
 	/**
@@ -75,11 +75,11 @@  discard block
 block discarded – undo
75 75
 	function remove_meta_box() {
76 76
 		global $pagenow;
77 77
 
78
-		$gv_page = gravityview_is_admin_page( '', 'single' );
78
+		$gv_page = gravityview_is_admin_page('', 'single');
79 79
 
80 80
 		// New View or Edit View page
81
-		if( $gv_page && $pagenow === 'post-new.php' ) {
82
-			remove_meta_box( 'woothemes-settings', 'gravityview', 'normal' );
81
+		if ($gv_page && $pagenow === 'post-new.php') {
82
+			remove_meta_box('woothemes-settings', 'gravityview', 'normal');
83 83
 		}
84 84
 	}
85 85
 
Please login to merge, or discard this patch.
includes/presets/business-data/class-gravityview-preset-business-data.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -21,15 +21,15 @@
 block discarded – undo
21 21
 		$settings = array(
22 22
 			'slug'          => 'table',
23 23
 			'type'          => 'preset',
24
-			'label'         => __( 'Business Data', 'gravityview' ),
25
-			'description'   => __( 'Display business information in a table.', 'gravityview' ),
26
-			'logo'          => plugins_url( 'includes/presets/business-data/logo-business-data.png', GRAVITYVIEW_FILE ),
24
+			'label'         => __('Business Data', 'gravityview'),
25
+			'description'   => __('Display business information in a table.', 'gravityview'),
26
+			'logo'          => plugins_url('includes/presets/business-data/logo-business-data.png', GRAVITYVIEW_FILE),
27 27
 			'preview'       => 'http://demo.gravityview.co/blog/view/business-table/',
28
-			'preset_form'   => GRAVITYVIEW_DIR . 'includes/presets/business-data/form-business-data.xml',
29
-			'preset_fields' => GRAVITYVIEW_DIR . 'includes/presets/business-data/fields-business-data.xml'
28
+			'preset_form'   => GRAVITYVIEW_DIR.'includes/presets/business-data/form-business-data.xml',
29
+			'preset_fields' => GRAVITYVIEW_DIR.'includes/presets/business-data/fields-business-data.xml'
30 30
 		);
31 31
 
32
-		parent::__construct( $id, $settings );
32
+		parent::__construct($id, $settings);
33 33
 	}
34 34
 }
35 35
 
Please login to merge, or discard this patch.
presets/business-listings/class-gravityview-preset-business-listings.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -21,15 +21,15 @@
 block discarded – undo
21 21
 		$settings = array(
22 22
 			'slug'          => 'list',
23 23
 			'type'          => 'preset',
24
-			'label'         => __( 'Business Listings', 'gravityview' ),
25
-			'description'   => __( 'Display business profiles.', 'gravityview' ),
26
-			'logo'          => plugins_url( 'includes/presets/business-listings/logo-business-listings.png', GRAVITYVIEW_FILE ),
24
+			'label'         => __('Business Listings', 'gravityview'),
25
+			'description'   => __('Display business profiles.', 'gravityview'),
26
+			'logo'          => plugins_url('includes/presets/business-listings/logo-business-listings.png', GRAVITYVIEW_FILE),
27 27
 			'preview'       => 'http://demo.gravityview.co/blog/view/business-listings/',
28
-			'preset_form'   => GRAVITYVIEW_DIR . 'includes/presets/business-listings/form-business-listings.xml',
29
-			'preset_fields' => GRAVITYVIEW_DIR . 'includes/presets/business-listings/fields-business-listings.xml'
28
+			'preset_form'   => GRAVITYVIEW_DIR.'includes/presets/business-listings/form-business-listings.xml',
29
+			'preset_fields' => GRAVITYVIEW_DIR.'includes/presets/business-listings/fields-business-listings.xml'
30 30
 		);
31 31
 
32
-		parent::__construct( $id, $settings );
32
+		parent::__construct($id, $settings);
33 33
 
34 34
 	}
35 35
 }
Please login to merge, or discard this patch.
includes/presets/default-edit/class-gravityview-default-template-edit.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -18,18 +18,18 @@  discard block
 block discarded – undo
18 18
  */
19 19
 class GravityView_Default_Template_Edit extends GravityView_Template {
20 20
 
21
-	function __construct( $id = 'default_table_edit', $settings = array(), $field_options = array(), $areas = array() ) {
21
+	function __construct($id = 'default_table_edit', $settings = array(), $field_options = array(), $areas = array()) {
22 22
 
23 23
 		$edit_settings = array(
24 24
 			'slug' => 'edit',
25 25
 			'type' => 'internal',
26
-			'label' =>  __( 'Edit Table', 'gravityview' ),
26
+			'label' =>  __('Edit Table', 'gravityview'),
27 27
 			'description' => __('Display items in a table view.', 'gravityview'),
28 28
 			'logo' => plugins_url('includes/presets/default-table/logo-default-table.png', GRAVITYVIEW_FILE),
29 29
 			'css_source' => plugins_url('templates/css/table-view.css', GRAVITYVIEW_FILE),
30 30
 		);
31 31
 
32
-		$settings = wp_parse_args( $settings, $edit_settings );
32
+		$settings = wp_parse_args($settings, $edit_settings);
33 33
 
34 34
 		/**
35 35
 		 * @see  GravityView_Admin_Views::get_default_field_options() for Generic Field Options
@@ -42,14 +42,14 @@  discard block
 block discarded – undo
42 42
 				'1-1' => array(
43 43
 					array(
44 44
 						'areaid' => 'edit-fields',
45
-						'title' => __('Visible Edit Fields', 'gravityview' )
45
+						'title' => __('Visible Edit Fields', 'gravityview')
46 46
 					)
47 47
 				)
48 48
 			)
49 49
 		);
50 50
 
51 51
 
52
-		parent::__construct( $id, $settings, $field_options, $areas );
52
+		parent::__construct($id, $settings, $field_options, $areas);
53 53
 
54 54
 	}
55 55
 
Please login to merge, or discard this patch.
includes/presets/default-list/class-gravityview-default-template-list.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -6,23 +6,23 @@  discard block
 block discarded – undo
6 6
  */
7 7
 class GravityView_Default_Template_List extends GravityView_Template {
8 8
 
9
-	function __construct( $id = 'default_list', $settings = array(), $field_options = array(), $areas = array() ) {
9
+	function __construct($id = 'default_list', $settings = array(), $field_options = array(), $areas = array()) {
10 10
 
11 11
 		$list_settings = array(
12 12
 			'slug'        => 'list',
13 13
 			'type'        => 'custom',
14
-			'label'       => __( 'List (default)', 'gravityview' ),
15
-			'description' => __( 'Display items in a listing view.', 'gravityview' ),
16
-			'logo'        => plugins_url( 'includes/presets/default-list/logo-default-list.png', GRAVITYVIEW_FILE ),
17
-			'css_source'  => plugins_url( 'templates/css/list-view.css', GRAVITYVIEW_FILE ),
14
+			'label'       => __('List (default)', 'gravityview'),
15
+			'description' => __('Display items in a listing view.', 'gravityview'),
16
+			'logo'        => plugins_url('includes/presets/default-list/logo-default-list.png', GRAVITYVIEW_FILE),
17
+			'css_source'  => plugins_url('templates/css/list-view.css', GRAVITYVIEW_FILE),
18 18
 		);
19 19
 
20
-		$settings = wp_parse_args( $settings, $list_settings );
20
+		$settings = wp_parse_args($settings, $list_settings);
21 21
 
22 22
 		$field_options = array(
23 23
 			'show_as_link' => array(
24 24
 				'type'    => 'checkbox',
25
-				'label'   => __( 'Link to single entry', 'gravityview' ),
25
+				'label'   => __('Link to single entry', 'gravityview'),
26 26
 				'value'   => false,
27 27
 				'context' => 'directory'
28 28
 			),
@@ -33,27 +33,27 @@  discard block
 block discarded – undo
33 33
 				'1-1' => array(
34 34
 					array(
35 35
 						'areaid'   => 'list-title',
36
-						'title'    => __( 'Listing Title', 'gravityview' ),
36
+						'title'    => __('Listing Title', 'gravityview'),
37 37
 						'subtitle' => ''
38 38
 					),
39 39
 					array(
40 40
 						'areaid'   => 'list-subtitle',
41
-						'title'    => __( 'Subheading', 'gravityview' ),
42
-						'subtitle' => __( 'Data placed here will be bold.', 'gravityview' ),
41
+						'title'    => __('Subheading', 'gravityview'),
42
+						'subtitle' => __('Data placed here will be bold.', 'gravityview'),
43 43
 					),
44 44
 				),
45 45
 				'1-3' => array(
46 46
 					array(
47 47
 						'areaid'   => 'list-image',
48
-						'title'    => __( 'Image', 'gravityview' ),
49
-						'subtitle' => __( 'Leave empty to remove.', 'gravityview' ),
48
+						'title'    => __('Image', 'gravityview'),
49
+						'subtitle' => __('Leave empty to remove.', 'gravityview'),
50 50
 					)
51 51
 				),
52 52
 				'2-3' => array(
53 53
 					array(
54 54
 						'areaid'   => 'list-description',
55
-						'title'    => __( 'Other Fields', 'gravityview' ),
56
-						'subtitle' => __( 'Below the subheading, a good place for description and other data.', 'gravityview' ),
55
+						'title'    => __('Other Fields', 'gravityview'),
56
+						'subtitle' => __('Below the subheading, a good place for description and other data.', 'gravityview'),
57 57
 					)
58 58
 				)
59 59
 			),
@@ -61,21 +61,21 @@  discard block
 block discarded – undo
61 61
 				'1-2' => array(
62 62
 					array(
63 63
 						'areaid'   => 'list-footer-left',
64
-						'title'    => __( 'Footer Left', 'gravityview' ),
64
+						'title'    => __('Footer Left', 'gravityview'),
65 65
 						'subtitle' => ''
66 66
 					)
67 67
 				),
68 68
 				'2-2' => array(
69 69
 					array(
70 70
 						'areaid'   => 'list-footer-right',
71
-						'title'    => __( 'Footer Right', 'gravityview' ),
71
+						'title'    => __('Footer Right', 'gravityview'),
72 72
 						'subtitle' => ''
73 73
 					)
74 74
 				)
75 75
 			)
76 76
 		);
77 77
 
78
-		parent::__construct( $id, $settings, $field_options, $areas );
78
+		parent::__construct($id, $settings, $field_options, $areas);
79 79
 
80 80
 	}
81 81
 }
Please login to merge, or discard this patch.