Completed
Push — master ( b90e50...afd846 )
by Andrew
8s
created
app/models/classy-user.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -60,13 +60,13 @@  discard block
 block discarded – undo
60 60
 	 * Main constructor function. Requires user id
61 61
 	 * @param int $uid
62 62
 	 */
63
-	public function __construct( $uid = null ) {
64
-		$this->ID = $this->verify_id( $uid );
63
+	public function __construct($uid = null) {
64
+		$this->ID = $this->verify_id($uid);
65 65
 
66 66
 		$this->init();
67 67
 	}
68 68
 
69
-	private function verify_id( $uid ) {
69
+	private function verify_id($uid) {
70 70
 		return $uid;
71 71
 	}
72 72
 
@@ -76,10 +76,10 @@  discard block
 block discarded – undo
76 76
 	private function init() {
77 77
 		$object = (array) $this->get_object();
78 78
 
79
-		$this->import( $object );
79
+		$this->import($object);
80 80
 
81
-		if ( isset( $this->first_name ) && isset( $this->last_name ) ) {
82
-			$this->name = $this->first_name . ' ' . $this->last_name;
81
+		if (isset($this->first_name) && isset($this->last_name)) {
82
+			$this->name = $this->first_name.' '.$this->last_name;
83 83
 		} else {
84 84
 			$this->name = 'Anonymous';
85 85
 		}
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
 	 * @return object
93 93
 	 */
94 94
 	private function get_object() {
95
-		return get_userdata( $this->ID );
95
+		return get_userdata($this->ID);
96 96
 	}
97 97
 
98 98
 	/**
@@ -156,8 +156,8 @@  discard block
 block discarded – undo
156 156
 	 * @return string
157 157
 	 */
158 158
 	public function link() {
159
-		if ( ! $this->link ) {
160
-			$this->link = get_author_posts_url( $this->ID );
159
+		if (!$this->link) {
160
+			$this->link = get_author_posts_url($this->ID);
161 161
 		}
162 162
 
163 163
 		return $this->link;
Please login to merge, or discard this patch.
app/classy/classy-helper.php 2 patches
Indentation   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -247,57 +247,57 @@
 block discarded – undo
247 247
 
248 248
 		$textdomain = Classy::textdomain();
249 249
 
250
-	    $archives_title = '';
250
+		$archives_title = '';
251 251
 
252
-	    if ( is_category() ) {
252
+		if ( is_category() ) {
253 253
 
254
-	        $archives_title = single_cat_title( '', false );
254
+			$archives_title = single_cat_title( '', false );
255 255
 
256
-	    } else if ( is_tag() ) {
256
+		} else if ( is_tag() ) {
257 257
 
258
-	        $archives_title = 'Tag: ' . single_tag_title( '', false );
258
+			$archives_title = 'Tag: ' . single_tag_title( '', false );
259 259
 
260
-	    } else if ( is_author() ) {
260
+		} else if ( is_author() ) {
261 261
 
262
-	        if ( have_posts() ) {
262
+			if ( have_posts() ) {
263 263
 
264
-	            the_post();
265
-	            $archives_title = 'Author: ' . get_the_author();
264
+				the_post();
265
+				$archives_title = 'Author: ' . get_the_author();
266 266
 
267
-	        }
267
+			}
268 268
 
269
-	        rewind_posts();
269
+			rewind_posts();
270 270
 
271
-	    } else if ( is_search() ) {
271
+		} else if ( is_search() ) {
272 272
 
273
-	        $archives_title = sprintf( __( 'Search Results for: %s', $textdomain ), '<span>' . get_search_query() . '</span>' );
273
+			$archives_title = sprintf( __( 'Search Results for: %s', $textdomain ), '<span>' . get_search_query() . '</span>' );
274 274
 
275
-	    } else if ( is_archive() ) {
275
+		} else if ( is_archive() ) {
276 276
 
277
-	        if ( is_day() ) {
277
+			if ( is_day() ) {
278 278
 
279
-	            $archives_title = get_the_date();
279
+				$archives_title = get_the_date();
280 280
 
281
-	        } elseif ( is_month() ) {
281
+			} elseif ( is_month() ) {
282 282
 
283
-	            $archives_title = get_the_date( _x( 'F Y', 'monthly archives date format', $textdomain ) );
283
+				$archives_title = get_the_date( _x( 'F Y', 'monthly archives date format', $textdomain ) );
284 284
 
285
-	        } elseif ( is_year() ) {
285
+			} elseif ( is_year() ) {
286 286
 
287
-	            $archives_title = get_the_date( _x( 'Y', 'yearly archives date format', $textdomain ) );
287
+				$archives_title = get_the_date( _x( 'Y', 'yearly archives date format', $textdomain ) );
288 288
 
289
-	        } else {
289
+			} else {
290 290
 
291
-	            $archives_title = 'Archives';
291
+				$archives_title = 'Archives';
292 292
 
293
-	        }
293
+			}
294 294
 		} else {
295 295
 
296
-	        $archives_title = 'Archives';
296
+			$archives_title = 'Archives';
297 297
 
298
-	    }
298
+		}
299 299
 
300
-	    return $archives_title;
300
+		return $archives_title;
301 301
 
302 302
 	}
303 303
 }
Please login to merge, or discard this patch.
Spacing   +91 added lines, -91 removed lines patch added patch discarded remove patch
@@ -15,44 +15,44 @@  discard block
 block discarded – undo
15 15
 	 * @param string  $allowed_tags
16 16
 	 * @return string
17 17
 	 */
18
-	public static function trim_words( $text, $num_words = 55, $more = null, $allowed_tags = 'p a span b i br blockquote' ) {
19
-		if ( null === $more ) {
20
-			$more = __( '&hellip;' );
18
+	public static function trim_words($text, $num_words = 55, $more = null, $allowed_tags = 'p a span b i br blockquote') {
19
+		if (null === $more) {
20
+			$more = __('&hellip;');
21 21
 		}
22 22
 
23 23
 		$original_text = $text;
24 24
 		$allowed_tag_string = '';
25 25
 
26
-		foreach ( explode( ' ', $allowed_tags ) as $tag ) {
27
-			$allowed_tag_string .= '<' . $tag . '>';
26
+		foreach (explode(' ', $allowed_tags) as $tag) {
27
+			$allowed_tag_string .= '<'.$tag.'>';
28 28
 		}
29 29
 
30
-		$text = strip_tags( $text, $allowed_tag_string );
30
+		$text = strip_tags($text, $allowed_tag_string);
31 31
 
32 32
 		/* translators: If your word count is based on single characters (East Asian characters),
33 33
 		enter 'characters'. Otherwise, enter 'words'. Do not translate into your own language. */
34 34
 
35
-		if ( 'characters' === _x( 'words', 'word count: words or characters?' ) && preg_match( '/^utf\-?8$/i', get_option( 'blog_charset' ) ) ) {
36
-			$text = trim( preg_replace( "/[\n\r\t ]+/", ' ', $text ), ' ' );
37
-			preg_match_all( '/./u', $text, $words_array );
38
-			$words_array = array_slice( $words_array[0], 0, $num_words + 1 );
35
+		if ('characters' === _x('words', 'word count: words or characters?') && preg_match('/^utf\-?8$/i', get_option('blog_charset'))) {
36
+			$text = trim(preg_replace("/[\n\r\t ]+/", ' ', $text), ' ');
37
+			preg_match_all('/./u', $text, $words_array);
38
+			$words_array = array_slice($words_array[0], 0, $num_words + 1);
39 39
 			$sep = '';
40 40
 		} else {
41
-			$words_array = preg_split( "/[\n\r\t ]+/", $text, $num_words + 1, PREG_SPLIT_NO_EMPTY );
41
+			$words_array = preg_split("/[\n\r\t ]+/", $text, $num_words + 1, PREG_SPLIT_NO_EMPTY);
42 42
 			$sep = ' ';
43 43
 		}
44 44
 
45
-		if ( count( $words_array ) > $num_words ) {
46
-			array_pop( $words_array );
47
-			$text = implode( $sep, $words_array );
48
-			$text = $text . $more;
45
+		if (count($words_array) > $num_words) {
46
+			array_pop($words_array);
47
+			$text = implode($sep, $words_array);
48
+			$text = $text.$more;
49 49
 		} else {
50
-			$text = implode( $sep, $words_array );
50
+			$text = implode($sep, $words_array);
51 51
 		}
52 52
 
53
-		$text = self::close_tags( $text );
53
+		$text = self::close_tags($text);
54 54
 
55
-		return apply_filters( 'wp_trim_words', $text, $num_words, $more, $original_text );
55
+		return apply_filters('wp_trim_words', $text, $num_words, $more, $original_text);
56 56
 	}
57 57
 
58 58
 
@@ -62,36 +62,36 @@  discard block
 block discarded – undo
62 62
 	 * @param string  $html
63 63
 	 * @return string
64 64
 	 */
65
-	public static function close_tags( $html ) {
65
+	public static function close_tags($html) {
66 66
 		//put all opened tags into an array
67
-		preg_match_all( '#<([a-z]+)(?: .*)?(?<![/|/ ])>#iU', $html, $result );
67
+		preg_match_all('#<([a-z]+)(?: .*)?(?<![/|/ ])>#iU', $html, $result);
68 68
 
69 69
 		$openedtags = $result[1];
70 70
 
71 71
 		//put all closed tags into an array
72
-		preg_match_all( '#</([a-z]+)>#iU', $html, $result );
72
+		preg_match_all('#</([a-z]+)>#iU', $html, $result);
73 73
 
74 74
 		$closedtags = $result[1];
75
-		$len_opened = count( $openedtags );
75
+		$len_opened = count($openedtags);
76 76
 
77 77
 		// all tags are closed
78
-		if ( count( $closedtags ) === $len_opened ) {
78
+		if (count($closedtags) === $len_opened) {
79 79
 			return $html;
80 80
 		}
81 81
 
82
-		$openedtags = array_reverse( $openedtags );
82
+		$openedtags = array_reverse($openedtags);
83 83
 
84 84
 		// close tags
85
-		for ( $i = 0; $i < $len_opened; $i++ ) {
86
-			if ( ! in_array( $openedtags[ $i ], $closedtags, true ) ) {
87
-				$html .= '</' . $openedtags[ $i ] . '>';
85
+		for ($i = 0; $i < $len_opened; $i++) {
86
+			if (!in_array($openedtags[$i], $closedtags, true)) {
87
+				$html .= '</'.$openedtags[$i].'>';
88 88
 			} else {
89
-				unset( $closedtags[ array_search( $openedtags[ $i ], $closedtags ) ] );
89
+				unset($closedtags[array_search($openedtags[$i], $closedtags)]);
90 90
 			}
91 91
 		}
92 92
 
93
-		$html = str_replace( array( '</br>', '</hr>', '</wbr>' ), '', $html );
94
-		$html = str_replace( array( '<br>', '<hr>', '<wbr>' ), array( '<br />', '<hr />', '<wbr />' ), $html );
93
+		$html = str_replace(array('</br>', '</hr>', '</wbr>'), '', $html);
94
+		$html = str_replace(array('<br>', '<hr>', '<wbr>'), array('<br />', '<hr />', '<wbr />'), $html);
95 95
 
96 96
 		return $html;
97 97
 	}
@@ -103,14 +103,14 @@  discard block
 block discarded – undo
103 103
 	 *
104 104
 	 * @return bool
105 105
 	 */
106
-	public static function error_log( $arg ) {
107
-		if ( ! WP_DEBUG ) {
106
+	public static function error_log($arg) {
107
+		if (!WP_DEBUG) {
108 108
 			return true;
109 109
 		}
110
-		if ( is_object( $arg ) || is_array( $arg ) ) {
111
-			$arg = print_r( $arg, true );
110
+		if (is_object($arg) || is_array($arg)) {
111
+			$arg = print_r($arg, true);
112 112
 		}
113
-		return error_log( $arg );
113
+		return error_log($arg);
114 114
 	}
115 115
 
116 116
 	/**
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
 	 * @param string  $args
120 120
 	 * @return array
121 121
 	 */
122
-	public static function paginate_links( $args = '' ) {
122
+	public static function paginate_links($args = '') {
123 123
 		$defaults = array(
124 124
 			'base' => '%_%', // http://example.com/all_posts.php%_% : %_% is replaced by format (below)
125 125
 			'format' => '?page=%#%', // ?page=%#% : %#% is replaced by the page number
@@ -127,43 +127,43 @@  discard block
 block discarded – undo
127 127
 			'current' => 0,
128 128
 			'show_all' => false,
129 129
 			'prev_next' => true,
130
-			'prev_text' => __( '&laquo; Previous' ),
131
-			'next_text' => __( 'Next &raquo;' ),
130
+			'prev_text' => __('&laquo; Previous'),
131
+			'next_text' => __('Next &raquo;'),
132 132
 			'end_size' => 1,
133 133
 			'mid_size' => 2,
134 134
 			'type' => 'array',
135 135
 			'add_args' => false, // array of query args to add
136 136
 			'add_fragment' => '',
137 137
 		);
138
-		$args = wp_parse_args( $args, $defaults );
138
+		$args = wp_parse_args($args, $defaults);
139 139
 		// Who knows what else people pass in $args
140
-		$args['total'] = intval( (int) $args['total'] );
141
-		if ( $args['total'] < 2 ) {
140
+		$args['total'] = intval((int) $args['total']);
141
+		if ($args['total'] < 2) {
142 142
 			return array();
143 143
 		}
144 144
 		$args['current'] = (int) $args['current'];
145 145
 		$args['end_size'] = 0 < (int) $args['end_size'] ? (int) $args['end_size'] : 1; // Out of bounds?  Make it the default.
146 146
 		$args['mid_size'] = 0 <= (int) $args['mid_size'] ? (int) $args['mid_size'] : 2;
147
-		$args['add_args'] = is_array( $args['add_args'] ) ? $args['add_args'] : false;
147
+		$args['add_args'] = is_array($args['add_args']) ? $args['add_args'] : false;
148 148
 		$page_links = array();
149 149
 		$dots = false;
150
-		if ( $args['prev_next'] && $args['current'] && 1 < $args['current'] ) {
151
-			$link = str_replace( '%_%', 2 === absint( $args['current'] ) ? '' : $args['format'], $args['base'] );
152
-			$link = str_replace( '%#%', $args['current'] - 1, $link );
153
-			if ( $args['add_args'] ) {
154
-				$link = add_query_arg( $args['add_args'], $link );
150
+		if ($args['prev_next'] && $args['current'] && 1 < $args['current']) {
151
+			$link = str_replace('%_%', 2 === absint($args['current']) ? '' : $args['format'], $args['base']);
152
+			$link = str_replace('%#%', $args['current'] - 1, $link);
153
+			if ($args['add_args']) {
154
+				$link = add_query_arg($args['add_args'], $link);
155 155
 			}
156 156
 			$link .= $args['add_fragment'];
157
-			$link = untrailingslashit( $link );
157
+			$link = untrailingslashit($link);
158 158
 			$page_links[] = array(
159 159
 				'class' => 'prev page-numbers',
160
-				'link' => esc_url( apply_filters( 'paginate_links', $link ) ),
160
+				'link' => esc_url(apply_filters('paginate_links', $link)),
161 161
 				'title' => $args['prev_text'],
162 162
 			);
163 163
 		}
164
-		for ( $n = 1; $n <= $args['total']; $n++ ) {
165
-			$n_display = number_format_i18n( $n );
166
-			if ( absint( $args['current'] ) === $n ) {
164
+		for ($n = 1; $n <= $args['total']; $n++) {
165
+			$n_display = number_format_i18n($n);
166
+			if (absint($args['current']) === $n) {
167 167
 				$page_links[] = array(
168 168
 					'class' => 'page-number page-numbers current',
169 169
 					'title' => $n_display,
@@ -173,42 +173,42 @@  discard block
 block discarded – undo
173 173
 				);
174 174
 				$dots = true;
175 175
 			} else {
176
-				if ( $args['show_all'] || ( $n <= $args['end_size'] || ( $args['current'] && $n >= $args['current'] - $args['mid_size'] && $n <= $args['current'] + $args['mid_size'] ) || $n > $args['total'] - $args['end_size'] ) ) {
177
-					$link = str_replace( '%_%', 1 === absint( $n ) ? '' : $args['format'], $args['base'] );
178
-					$link = str_replace( '%#%', $n, $link );
179
-					$link = trailingslashit( $link ) . ltrim( $args['add_fragment'], '/' );
180
-					if ( $args['add_args'] ) {
181
-						$link = rtrim( add_query_arg( $args['add_args'], $link ), '/' );
176
+				if ($args['show_all'] || ($n <= $args['end_size'] || ($args['current'] && $n >= $args['current'] - $args['mid_size'] && $n <= $args['current'] + $args['mid_size']) || $n > $args['total'] - $args['end_size'])) {
177
+					$link = str_replace('%_%', 1 === absint($n) ? '' : $args['format'], $args['base']);
178
+					$link = str_replace('%#%', $n, $link);
179
+					$link = trailingslashit($link).ltrim($args['add_fragment'], '/');
180
+					if ($args['add_args']) {
181
+						$link = rtrim(add_query_arg($args['add_args'], $link), '/');
182 182
 					}
183
-					$link = str_replace( ' ', '+', $link );
184
-					$link = untrailingslashit( $link );
183
+					$link = str_replace(' ', '+', $link);
184
+					$link = untrailingslashit($link);
185 185
 					$page_links[] = array(
186 186
 						'class' => 'page-number page-numbers',
187
-						'link' => esc_url( apply_filters( 'paginate_links', $link ) ),
187
+						'link' => esc_url(apply_filters('paginate_links', $link)),
188 188
 						'title' => $n_display,
189 189
 						'name' => $n_display,
190
-						'current' => absint( $args['current'] ) === $n,
190
+						'current' => absint($args['current']) === $n,
191 191
 					);
192 192
 					$dots = true;
193
-				} elseif ( $dots && ! $args['show_all'] ) {
193
+				} elseif ($dots && !$args['show_all']) {
194 194
 					$page_links[] = array(
195 195
 						'class' => 'dots',
196
-						'title' => __( '&hellip;' ),
196
+						'title' => __('&hellip;'),
197 197
 					);
198 198
 					$dots = false;
199 199
 				}
200 200
 			}
201 201
 		}
202
-		if ( $args['prev_next'] && $args['current'] && ( $args['current'] < $args['total'] || -1 === intval( $args['total'] ) ) ) {
203
-			$link = str_replace( '%_%', $args['format'], $args['base'] );
204
-			$link = str_replace( '%#%', $args['current'] + 1, $link );
205
-			if ( $args['add_args'] ) {
206
-				$link = add_query_arg( $args['add_args'], $link );
202
+		if ($args['prev_next'] && $args['current'] && ($args['current'] < $args['total'] || -1 === intval($args['total']))) {
203
+			$link = str_replace('%_%', $args['format'], $args['base']);
204
+			$link = str_replace('%#%', $args['current'] + 1, $link);
205
+			if ($args['add_args']) {
206
+				$link = add_query_arg($args['add_args'], $link);
207 207
 			}
208
-			$link = untrailingslashit( trailingslashit( $link ) . $args['add_fragment'] );
208
+			$link = untrailingslashit(trailingslashit($link).$args['add_fragment']);
209 209
 			$page_links[] = array(
210 210
 				'class' => 'next page-numbers',
211
-				'link' => esc_url( apply_filters( 'paginate_links', $link ) ),
211
+				'link' => esc_url(apply_filters('paginate_links', $link)),
212 212
 				'title' => $args['next_text'],
213 213
 			);
214 214
 		}
@@ -222,13 +222,13 @@  discard block
 block discarded – undo
222 222
 	 * @param  array $array
223 223
 	 * @return object
224 224
 	 */
225
-	public static function array_to_object( $array ) {
225
+	public static function array_to_object($array) {
226 226
 		$obj = new stdClass;
227 227
 
228
-		foreach ( $array as $k => $v ) {
229
-			if ( strlen( $k ) ) {
230
-				if ( is_array( $v ) ) {
231
-					$obj->{$k} = self::array_to_object( $v ); //RECURSION
228
+		foreach ($array as $k => $v) {
229
+			if (strlen($k)) {
230
+				if (is_array($v)) {
231
+					$obj->{$k} = self::array_to_object($v); //RECURSION
232 232
 				} else {
233 233
 					$obj->{$k} = $v;
234 234
 				}
@@ -251,42 +251,42 @@  discard block
 block discarded – undo
251 251
 
252 252
 	    $archives_title = '';
253 253
 
254
-	    if ( is_category() ) {
254
+	    if (is_category()) {
255 255
 
256
-	        $archives_title = single_cat_title( '', false );
256
+	        $archives_title = single_cat_title('', false);
257 257
 
258
-	    } else if ( is_tag() ) {
258
+	    } else if (is_tag()) {
259 259
 
260
-	        $archives_title = 'Tag: ' . single_tag_title( '', false );
260
+	        $archives_title = 'Tag: '.single_tag_title('', false);
261 261
 
262
-	    } else if ( is_author() ) {
262
+	    } else if (is_author()) {
263 263
 
264
-	        if ( have_posts() ) {
264
+	        if (have_posts()) {
265 265
 
266 266
 	            the_post();
267
-	            $archives_title = 'Author: ' . get_the_author();
267
+	            $archives_title = 'Author: '.get_the_author();
268 268
 
269 269
 	        }
270 270
 
271 271
 	        rewind_posts();
272 272
 
273
-	    } else if ( is_search() ) {
273
+	    } else if (is_search()) {
274 274
 
275
-	        $archives_title = sprintf( __( 'Search Results for: %s', $textdomain ), '<span>' . get_search_query() . '</span>' );
275
+	        $archives_title = sprintf(__('Search Results for: %s', $textdomain), '<span>'.get_search_query().'</span>');
276 276
 
277
-	    } else if ( is_archive() ) {
277
+	    } else if (is_archive()) {
278 278
 
279
-	        if ( is_day() ) {
279
+	        if (is_day()) {
280 280
 
281 281
 	            $archives_title = get_the_date();
282 282
 
283
-	        } elseif ( is_month() ) {
283
+	        } elseif (is_month()) {
284 284
 
285
-	            $archives_title = get_the_date( _x( 'F Y', 'monthly archives date format', $textdomain ) );
285
+	            $archives_title = get_the_date(_x('F Y', 'monthly archives date format', $textdomain));
286 286
 
287
-	        } elseif ( is_year() ) {
287
+	        } elseif (is_year()) {
288 288
 
289
-	            $archives_title = get_the_date( _x( 'Y', 'yearly archives date format', $textdomain ) );
289
+	            $archives_title = get_the_date(_x('Y', 'yearly archives date format', $textdomain));
290 290
 
291 291
 	        } else {
292 292
 
Please login to merge, or discard this patch.
app/classy/classy-basis.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -12,23 +12,23 @@
 block discarded – undo
12 12
 	 * @param  object/array $data
13 13
 	 * @return void
14 14
 	 */
15
-	protected function import( $data ) {
15
+	protected function import($data) {
16 16
 
17
-		if ( is_object( $data ) ) {
17
+		if (is_object($data)) {
18 18
 
19
-			$data = get_object_vars( $data );
19
+			$data = get_object_vars($data);
20 20
 
21 21
 		}
22 22
 
23
-		if ( is_array( $data ) ) {
23
+		if (is_array($data)) {
24 24
 
25
-			foreach ( $data as $key => $value ) {
25
+			foreach ($data as $key => $value) {
26 26
 
27
-				if ( ! empty( $key ) ) {
27
+				if (!empty($key)) {
28 28
 
29 29
 					$this->$key = $value;
30 30
 
31
-				} else if ( ! empty( $key ) && ! method_exists( $this, $key ) ) {
31
+				} else if (!empty($key) && !method_exists($this, $key)) {
32 32
 
33 33
 					$this->$key = $value;
34 34
 
Please login to merge, or discard this patch.
app/classy/classy-view.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -23,9 +23,9 @@  discard block
 block discarded – undo
23 23
 
24 24
 		$request = ClassyHierarchy::get_current_request();
25 25
 
26
-		$file = ClassyHierarchy::get_available_file( 'view', $request );
26
+		$file = ClassyHierarchy::get_available_file('view', $request);
27 27
 
28
-		$view = self::get_blade_view( $file );
28
+		$view = self::get_blade_view($file);
29 29
 
30 30
 		return $view;
31 31
 
@@ -38,9 +38,9 @@  discard block
 block discarded – undo
38 38
 	 * @param  string $view
39 39
 	 * @return string
40 40
 	 */
41
-	public static function get_blade_view( $view ) {
41
+	public static function get_blade_view($view) {
42 42
 
43
-		return str_replace( '/', '.', $view );
43
+		return str_replace('/', '.', $view);
44 44
 
45 45
 	}
46 46
 
@@ -54,21 +54,21 @@  discard block
 block discarded – undo
54 54
 
55 55
 		$templates = array();
56 56
 
57
-		$files = (array) glob( THEME_PATH . '/' . self::$folder . '/*/*.blade.php' );
57
+		$files = (array) glob(THEME_PATH.'/'.self::$folder.'/*/*.blade.php');
58 58
 
59
-		foreach ( $files as $filename ) {
59
+		foreach ($files as $filename) {
60 60
 
61
-			if ( ! empty( $filename ) ) {
61
+			if (!empty($filename)) {
62 62
 
63
-				if ( ! preg_match( '/\{\{\-\-\s*Template Name:(.*)\s*\-\-\}\}/mi', file_get_contents( $filename ), $header ) ) { continue; }
63
+				if (!preg_match('/\{\{\-\-\s*Template Name:(.*)\s*\-\-\}\}/mi', file_get_contents($filename), $header)) { continue; }
64 64
 
65
-				$template_name = trim( $header[1] );
65
+				$template_name = trim($header[1]);
66 66
 
67
-				preg_match( '/\/([^\/]*)\.blade.php$/is', $filename, $filename_match );
67
+				preg_match('/\/([^\/]*)\.blade.php$/is', $filename, $filename_match);
68 68
 
69
-				$template_file = 'classy-' . $filename_match[1];
69
+				$template_file = 'classy-'.$filename_match[1];
70 70
 
71
-				$templates[ $template_file ] = $template_name;
71
+				$templates[$template_file] = $template_name;
72 72
 
73 73
 			}
74 74
 		}
Please login to merge, or discard this patch.
app/classy/classy-menu-item.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -41,11 +41,11 @@  discard block
 block discarded – undo
41 41
 	 *
42 42
 	 * @param WP_Post $item
43 43
 	 */
44
-	public function __construct( $item ) {
44
+	public function __construct($item) {
45 45
 
46
-		if ( is_a( $item, 'WP_Post' ) ) {
46
+		if (is_a($item, 'WP_Post')) {
47 47
 
48
-			$this->import( $item );
48
+			$this->import($item);
49 49
 			$this->filter_classes();
50 50
 
51 51
 		}
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
 	 */
103 103
 	public function get_classes() {
104 104
 
105
-		return implode( ' ', $this->classes );
105
+		return implode(' ', $this->classes);
106 106
 
107 107
 	}
108 108
 
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
 	 *
112 112
 	 * @param string $class_name
113 113
 	 */
114
-	public function add_class( $class_name ) {
114
+	public function add_class($class_name) {
115 115
 
116 116
 		$this->classes[] = $class_name;
117 117
 
@@ -122,17 +122,17 @@  discard block
 block discarded – undo
122 122
 	 *
123 123
 	 * @param ClassyMenuItem $item
124 124
 	 */
125
-	public function add_child( $item ) {
125
+	public function add_child($item) {
126 126
 
127
-		if ( ! $this->has_child ) {
128
-			$this->add_class( 'menu-item-has-children' );
127
+		if (!$this->has_child) {
128
+			$this->add_class('menu-item-has-children');
129 129
 			$this->has_child = true;
130 130
 		}
131 131
 
132 132
 		$this->children[] = $item;
133 133
 		$item->level = $this->level + 1;
134 134
 
135
-		if ( $item->children ) {
135
+		if ($item->children) {
136 136
 			$this->update_child_levels();
137 137
 		}
138 138
 
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
 	 */
146 146
 	protected function filter_classes() {
147 147
 
148
-		$this->classes = apply_filters( 'nav_menu_css_class', $this->classes, $this );
148
+		$this->classes = apply_filters('nav_menu_css_class', $this->classes, $this);
149 149
 
150 150
 	}
151 151
 
@@ -156,9 +156,9 @@  discard block
 block discarded – undo
156 156
 	 */
157 157
 	protected function update_child_levels() {
158 158
 
159
-		if ( is_array( $this->children ) ) {
159
+		if (is_array($this->children)) {
160 160
 
161
-			foreach ( $this->children as $child ) {
161
+			foreach ($this->children as $child) {
162 162
 				$child->level = $this->level + 1;
163 163
 				$child->update_child_levels();
164 164
 			}
Please login to merge, or discard this patch.
comments.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -2,6 +2,6 @@
 block discarded – undo
2 2
 
3 3
 global $post;
4 4
 
5
-$classypost = new ClassyPost( $post );
5
+$classypost = new ClassyPost($post);
6 6
 
7
-Classy::render( 'layout.comments', array( 'post' => $classypost ) );
7
+Classy::render('layout.comments', array('post' => $classypost));
Please login to merge, or discard this patch.
app/classy/classy-scope.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -16,21 +16,21 @@  discard block
 block discarded – undo
16 16
 	 *
17 17
 	 * @return array
18 18
 	 */
19
-	public static function get_scope( $view_name = null ) {
19
+	public static function get_scope($view_name = null) {
20 20
 
21 21
 		$scope = self::get_common_scope();
22 22
 
23
-		if ( is_string( $view_name ) ) {
23
+		if (is_string($view_name)) {
24 24
 
25
-			$scope = self::extend_scope( $scope, $view_name );
25
+			$scope = self::extend_scope($scope, $view_name);
26 26
 
27 27
 		} else {
28 28
 
29 29
 			$request = ClassyHierarchy::get_current_request();
30 30
 
31
-			$file = ClassyHierarchy::get_available_file( 'scope', $request );
31
+			$file = ClassyHierarchy::get_available_file('scope', $request);
32 32
 
33
-			$scope = self::extend_scope( $scope, $file );
33
+			$scope = self::extend_scope($scope, $file);
34 34
 
35 35
 		}
36 36
 
@@ -44,9 +44,9 @@  discard block
 block discarded – undo
44 44
 	 *
45 45
 	 * @return array
46 46
 	 */
47
-	public static function extend_scope( $scope, $view_name ) {
47
+	public static function extend_scope($scope, $view_name) {
48 48
 
49
-		$scope = array_merge( $scope, self::require_scope( $view_name ) );
49
+		$scope = array_merge($scope, self::require_scope($view_name));
50 50
 
51 51
 		return $scope;
52 52
 
@@ -60,9 +60,9 @@  discard block
 block discarded – undo
60 60
 	 */
61 61
 	public static function get_common_scope() {
62 62
 
63
-		if ( null === self::$common ) {
63
+		if (null === self::$common) {
64 64
 
65
-			self::$common = self::require_scope( 'common' );
65
+			self::$common = self::require_scope('common');
66 66
 
67 67
 		}
68 68
 
@@ -76,19 +76,19 @@  discard block
 block discarded – undo
76 76
 	 * @param  string $filename
77 77
 	 * @return array
78 78
 	 */
79
-	public static function require_scope( $filename ) {
79
+	public static function require_scope($filename) {
80 80
 
81 81
 		$_return = array();
82 82
 
83
-		$file = ClassyHierarchy::get_file_path( 'scope', $filename );
83
+		$file = ClassyHierarchy::get_file_path('scope', $filename);
84 84
 
85
-		if ( file_exists( $file ) ) {
85
+		if (file_exists($file)) {
86 86
 
87 87
 			require $file;
88 88
 
89 89
 		}
90 90
 
91
-		if ( isset( $data ) ) {
91
+		if (isset($data)) {
92 92
 
93 93
 			$_return = $data;
94 94
 
Please login to merge, or discard this patch.
app/models/classy-image.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -12,10 +12,10 @@  discard block
 block discarded – undo
12 12
 	 * Main constructor function. Requires image id
13 13
 	 * @param int $pid
14 14
 	 */
15
-	public function __construct( $pid = null ) {
15
+	public function __construct($pid = null) {
16 16
 
17 17
 		// Checks if image with this id exists
18
-		if ( null !== $pid && wp_get_attachment_image_src( $pid ) ) {
18
+		if (null !== $pid && wp_get_attachment_image_src($pid)) {
19 19
 
20 20
 			$this->ID = $pid;
21 21
 
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
 	public static function get_default_image() {
34 34
 
35 35
 		// You can put here any url
36
-		return THEME_DIR . '/assets/noimage.png';
36
+		return THEME_DIR.'/assets/noimage.png';
37 37
 
38 38
 	}
39 39
 
@@ -42,11 +42,11 @@  discard block
 block discarded – undo
42 42
 	 * @param  string $size
43 43
 	 * @return string
44 44
 	 */
45
-	public function src( $size = 'medium' ) {
45
+	public function src($size = 'medium') {
46 46
 
47
-		if ( $this->ID ) {
47
+		if ($this->ID) {
48 48
 
49
-			$thumb = wp_get_attachment_image_src( $this->ID, $size );
49
+			$thumb = wp_get_attachment_image_src($this->ID, $size);
50 50
 
51 51
 			return $thumb[0];
52 52
 
Please login to merge, or discard this patch.
app/models/classy-post.php 1 patch
Spacing   +75 added lines, -75 removed lines patch added patch discarded remove patch
@@ -73,12 +73,12 @@  discard block
 block discarded – undo
73 73
 	 * Main constructor function. If ID won't be provided we will try to find it, based on your query
74 74
 	 * @param object/int $post
75 75
 	 */
76
-	public function __construct( $post = null ) {
77
-		if ( is_integer( $post ) ) {
76
+	public function __construct($post = null) {
77
+		if (is_integer($post)) {
78 78
 			$this->ID = $post;
79 79
 			$this->init();
80
-		} elseif ( is_a( $post, 'WP_Post' ) ) {
81
-			$this->import( $post );
80
+		} elseif (is_a($post, 'WP_Post')) {
81
+			$this->import($post);
82 82
 		}
83 83
 	}
84 84
 
@@ -88,8 +88,8 @@  discard block
 block discarded – undo
88 88
 	protected function init() {
89 89
 		$post = $this->get_object();
90 90
 
91
-		if ( is_a( $post, 'WP_Post' ) ) {
92
-			$this->import( $post );
91
+		if (is_a($post, 'WP_Post')) {
92
+			$this->import($post);
93 93
 		}
94 94
 	}
95 95
 
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
 	 */
101 101
 
102 102
 	public function get_object() {
103
-		$object = get_post( $this->ID );
103
+		$object = get_post($this->ID);
104 104
 
105 105
 		return $object;
106 106
 	}
@@ -111,10 +111,10 @@  discard block
 block discarded – undo
111 111
 	 * @return boolean
112 112
 	 */
113 113
 	public function can_edit() {
114
-		if ( ! function_exists( 'current_user_can' ) ) {
114
+		if (!function_exists('current_user_can')) {
115 115
 			return false;
116 116
 		}
117
-		if ( current_user_can( 'edit_post', $this->ID ) ) {
117
+		if (current_user_can('edit_post', $this->ID)) {
118 118
 			return true;
119 119
 		}
120 120
 		return false;
@@ -126,8 +126,8 @@  discard block
 block discarded – undo
126 126
 	 * @return string
127 127
 	 */
128 128
 	public function get_edit_url() {
129
-		if ( $this->can_edit() ) {
130
-			return get_edit_post_link( $this->ID );
129
+		if ($this->can_edit()) {
130
+			return get_edit_post_link($this->ID);
131 131
 		}
132 132
 	}
133 133
 
@@ -149,9 +149,9 @@  discard block
 block discarded – undo
149 149
 			'fields' => 'ids',
150 150
 		);
151 151
 
152
-		$images = get_children( $attrs );
152
+		$images = get_children($attrs);
153 153
 
154
-		if ( ! count( $images ) ) {
154
+		if (!count($images)) {
155 155
 			return false;
156 156
 		}
157 157
 
@@ -170,11 +170,11 @@  discard block
 block discarded – undo
170 170
 
171 171
 		$images = $this->get_attached_images();
172 172
 
173
-		if ( $images ) {
173
+		if ($images) {
174 174
 
175
-			foreach ( $images as $image_id ) {
175
+			foreach ($images as $image_id) {
176 176
 
177
-				$_return[] = new ClassyImage( $image_id );
177
+				$_return[] = new ClassyImage($image_id);
178 178
 
179 179
 			}
180 180
 		}
@@ -201,13 +201,13 @@  discard block
 block discarded – undo
201 201
 			'fields' => 'ids',
202 202
 		);
203 203
 
204
-		$images = get_children( $attrs );
204
+		$images = get_children($attrs);
205 205
 
206
-		if ( ! count( $images ) ) {
206
+		if (!count($images)) {
207 207
 			return false;
208 208
 		}
209 209
 
210
-		$images = array_values( $images );
210
+		$images = array_values($images);
211 211
 
212 212
 		return $images[0];
213 213
 
@@ -223,8 +223,8 @@  discard block
 block discarded – undo
223 223
 
224 224
 		$image_id = $this->get_first_attached_image_id();
225 225
 
226
-		if ( $image_id ) {
227
-			return new ClassyImage( $image_id );
226
+		if ($image_id) {
227
+			return new ClassyImage($image_id);
228 228
 		}
229 229
 
230 230
 		return new ClassyImage();
@@ -238,12 +238,12 @@  discard block
 block discarded – undo
238 238
 	 */
239 239
 	public function thumbnail() {
240 240
 
241
-		if ( function_exists( 'get_post_thumbnail_id' ) ) {
242
-			$image_id = get_post_thumbnail_id( $this->ID );
241
+		if (function_exists('get_post_thumbnail_id')) {
242
+			$image_id = get_post_thumbnail_id($this->ID);
243 243
 
244
-			if ( $image_id ) {
244
+			if ($image_id) {
245 245
 
246
-				return new ClassyImage( $image_id );
246
+				return new ClassyImage($image_id);
247 247
 
248 248
 			}
249 249
 		}
@@ -259,7 +259,7 @@  discard block
 block discarded – undo
259 259
 	 * @return string
260 260
 	 */
261 261
 	public function get_title() {
262
-		return apply_filters( 'the_title', $this->post_title, $this->ID );
262
+		return apply_filters('the_title', $this->post_title, $this->ID);
263 263
 	}
264 264
 
265 265
 	/**
@@ -278,24 +278,24 @@  discard block
 block discarded – undo
278 278
 	 * @param  integer $page Page number, in case our post has <!--nextpage--> tags
279 279
 	 * @return string        Post content
280 280
 	 */
281
-	public function get_content( $page = 0 ) {
282
-		if ( 0 === absint( $page ) && $this->post_content ) {
281
+	public function get_content($page = 0) {
282
+		if (0 === absint($page) && $this->post_content) {
283 283
 			return $this->post_content;
284 284
 		}
285 285
 
286 286
 		$content = $this->post_content;
287 287
 
288
-		if ( $page ) {
289
-			$contents = explode( '<!--nextpage-->', $content );
288
+		if ($page) {
289
+			$contents = explode('<!--nextpage-->', $content);
290 290
 
291 291
 			$page--;
292 292
 
293
-			if ( count( $contents ) > $page ) {
294
-				$content = $contents[ $page ];
293
+			if (count($contents) > $page) {
294
+				$content = $contents[$page];
295 295
 			}
296 296
 		}
297 297
 
298
-		$content = apply_filters( 'the_content', ($content) );
298
+		$content = apply_filters('the_content', ($content));
299 299
 
300 300
 		return $content;
301 301
 	}
@@ -316,7 +316,7 @@  discard block
 block discarded – undo
316 316
 	 * @return object
317 317
 	 */
318 318
 	public function get_post_type() {
319
-		return get_post_type_object( $this->post_type );
319
+		return get_post_type_object($this->post_type);
320 320
 	}
321 321
 
322 322
 	/**
@@ -325,11 +325,11 @@  discard block
 block discarded – undo
325 325
 	 * @return string
326 326
 	 */
327 327
 	public function get_permalink() {
328
-		if ( isset( $this->permalink ) ) {
328
+		if (isset($this->permalink)) {
329 329
 			return $this->permalink;
330 330
 		}
331 331
 
332
-		$this->permalink = get_permalink( $this->ID );
332
+		$this->permalink = get_permalink($this->ID);
333 333
 
334 334
 		return $this->permalink;
335 335
 	}
@@ -355,84 +355,84 @@  discard block
 block discarded – undo
355 355
 	 * @param  boolean $strip    Should we strip tags?
356 356
 	 * @return string            Post preview
357 357
 	 */
358
-	public function get_preview( $len = 50, $force = false, $readmore = 'Read More', $strip = true ) {
358
+	public function get_preview($len = 50, $force = false, $readmore = 'Read More', $strip = true) {
359 359
 		$text = '';
360 360
 		$trimmed = false;
361 361
 
362
-		if ( isset( $this->post_excerpt ) && strlen( $this->post_excerpt ) ) {
362
+		if (isset($this->post_excerpt) && strlen($this->post_excerpt)) {
363 363
 
364
-			if ( $force ) {
365
-				$text = ClassyHelper::trim_words( $this->post_excerpt, $len, false );
364
+			if ($force) {
365
+				$text = ClassyHelper::trim_words($this->post_excerpt, $len, false);
366 366
 				$trimmed = true;
367 367
 			} else {
368 368
 				$text = $this->post_excerpt;
369 369
 			}
370 370
 		}
371 371
 
372
-		if ( ! strlen( $text ) && preg_match( '/<!--\s?more(.*?)?-->/', $this->post_content, $readmore_matches ) ) {
372
+		if (!strlen($text) && preg_match('/<!--\s?more(.*?)?-->/', $this->post_content, $readmore_matches)) {
373 373
 
374
-			$pieces = explode( $readmore_matches[0], $this->post_content );
374
+			$pieces = explode($readmore_matches[0], $this->post_content);
375 375
 			$text = $pieces[0];
376 376
 
377
-			if ( $force ) {
378
-				$text = ClassyHelper::trim_words( $text, $len, false );
377
+			if ($force) {
378
+				$text = ClassyHelper::trim_words($text, $len, false);
379 379
 				$trimmed = true;
380 380
 			}
381 381
 
382
-			$text = do_shortcode( $text );
382
+			$text = do_shortcode($text);
383 383
 
384 384
 		}
385 385
 
386
-		if ( ! strlen( $text ) ) {
386
+		if (!strlen($text)) {
387 387
 
388
-			$text = ClassyHelper::trim_words( $this->get_content(), $len, false );
388
+			$text = ClassyHelper::trim_words($this->get_content(), $len, false);
389 389
 			$trimmed = true;
390 390
 
391 391
 		}
392 392
 
393
-		if ( ! strlen( trim( $text ) ) ) {
393
+		if (!strlen(trim($text))) {
394 394
 
395
-			return trim( $text );
395
+			return trim($text);
396 396
 
397 397
 		}
398 398
 
399
-		if ( $strip ) {
399
+		if ($strip) {
400 400
 
401
-			$text = trim( strip_tags( $text ) );
401
+			$text = trim(strip_tags($text));
402 402
 
403 403
 		}
404 404
 
405
-		if ( strlen( $text ) ) {
405
+		if (strlen($text)) {
406 406
 
407
-			$text = trim( $text );
408
-			$last = $text[ strlen( $text ) - 1 ];
407
+			$text = trim($text);
408
+			$last = $text[strlen($text) - 1];
409 409
 
410
-			if ( '.' !== $last && $trimmed ) {
410
+			if ('.' !== $last && $trimmed) {
411 411
 				$text .= ' &hellip; ';
412 412
 			}
413 413
 
414
-			if ( ! $strip ) {
415
-				$last_p_tag = strrpos( $text, '</p>' );
416
-				if ( false !== $last_p_tag ) {
417
-					$text = substr( $text, 0, $last_p_tag );
414
+			if (!$strip) {
415
+				$last_p_tag = strrpos($text, '</p>');
416
+				if (false !== $last_p_tag) {
417
+					$text = substr($text, 0, $last_p_tag);
418 418
 				}
419
-				if ( '.' !== $last && $trimmed ) {
419
+				if ('.' !== $last && $trimmed) {
420 420
 					$text .= ' &hellip; ';
421 421
 				}
422 422
 			}
423 423
 
424
-			if ( $readmore && isset( $readmore_matches ) && ! empty( $readmore_matches[1] ) ) {
425
-				$text .= ' <a href="' . $this->get_permalink() . '" class="read-more">' . trim( $readmore_matches[1] ) . '</a>';
426
-			} elseif ( $readmore ) {
427
-				$text .= ' <a href="' . $this->get_permalink() . '" class="read-more">' . trim( $readmore ) . '</a>';
424
+			if ($readmore && isset($readmore_matches) && !empty($readmore_matches[1])) {
425
+				$text .= ' <a href="'.$this->get_permalink().'" class="read-more">'.trim($readmore_matches[1]).'</a>';
426
+			} elseif ($readmore) {
427
+				$text .= ' <a href="'.$this->get_permalink().'" class="read-more">'.trim($readmore).'</a>';
428 428
 			}
429 429
 
430
-			if ( ! $strip ) {
430
+			if (!$strip) {
431 431
 				$text .= '</p>';
432 432
 			}
433 433
 		}
434 434
 
435
-		return trim( $text );
435
+		return trim($text);
436 436
 	}
437 437
 
438 438
 	/**
@@ -443,7 +443,7 @@  discard block
 block discarded – undo
443 443
 	 *
444 444
 	 * @return array
445 445
 	 */
446
-	public function get_comments( $status = 'approve', $order = 'DESC' ) {
446
+	public function get_comments($status = 'approve', $order = 'DESC') {
447 447
 
448 448
 		$_return = array();
449 449
 
@@ -453,26 +453,26 @@  discard block
 block discarded – undo
453 453
 			'order' => $order,
454 454
 		);
455 455
 
456
-		$comments = get_comments( $args );
456
+		$comments = get_comments($args);
457 457
 
458
-		foreach ( $comments as $comment ) {
458
+		foreach ($comments as $comment) {
459 459
 
460
-			$_return[ $comment->comment_ID ] = new ClassyComment( $comment );
460
+			$_return[$comment->comment_ID] = new ClassyComment($comment);
461 461
 
462 462
 		}
463 463
 
464
-		foreach ( $_return as $key => $comment ) {
464
+		foreach ($_return as $key => $comment) {
465 465
 
466
-			if ( $comment->has_parent() ) {
466
+			if ($comment->has_parent()) {
467 467
 
468
-				$_return[ $comment->comment_parent ]->add_child( $comment );
468
+				$_return[$comment->comment_parent]->add_child($comment);
469 469
 
470
-				unset( $_return[ $key ] );
470
+				unset($_return[$key]);
471 471
 
472 472
 			}
473 473
 		}
474 474
 
475
-		return array_values( $_return );
475
+		return array_values($_return);
476 476
 
477 477
 	}
478 478
 }
Please login to merge, or discard this patch.