Completed
Push — master ( b6312d...4ed0d2 )
by Andrew
02:43
created
app/classy/classy-comment.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -62,7 +62,7 @@
 block discarded – undo
62 62
 	/**
63 63
 	 * Returns ClassyUser object of comment author
64 64
 	 * 
65
-	 * @return object ClassyUser
65
+	 * @return ClassyUser ClassyUser
66 66
 	 */
67 67
 	public function author() {
68 68
 		
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -110,9 +110,9 @@  discard block
 block discarded – undo
110 110
 	 * @param  string $date_format
111 111
 	 * @return string
112 112
 	 */
113
-	public function date( $date_format = '' ) {
113
+	public function date($date_format = '') {
114 114
 		$df = $date_format ? $date_format : get_option('date_format');
115
-		$the_date = (string)mysql2date($df, $this->comment_date);
115
+		$the_date = (string) mysql2date($df, $this->comment_date);
116 116
 
117 117
 		return apply_filters('get_comment_date ', $the_date, $df);
118 118
 	}
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
 	 */
170 170
 	protected function get_avatar_email() {
171 171
 
172
-		$id = (int)$this->user_id;
172
+		$id = (int) $this->user_id;
173 173
 		$user = get_userdata($id);
174 174
 
175 175
 		if ($user) {
@@ -194,7 +194,7 @@  discard block
 block discarded – undo
194 194
 	protected function get_default_avatar($default, $email, $size, $host) {
195 195
 		
196 196
 		if (substr($default, 0, 1) == '/') {
197
-			$default = home_url() . $default;
197
+			$default = home_url().$default;
198 198
 		}
199 199
 
200 200
 		if (empty($default)) {
@@ -207,16 +207,16 @@  discard block
 block discarded – undo
207 207
 		}
208 208
 
209 209
 		if ('mystery' == $default) {
210
-			$default = $host . '/avatar/ad516503a11cd5ca435acc9bb6523536?s=' . $size;
210
+			$default = $host.'/avatar/ad516503a11cd5ca435acc9bb6523536?s='.$size;
211 211
 			// ad516503a11cd5ca435acc9bb6523536 == md5('[email protected]')
212 212
 		} else if ('blank' == $default) {
213 213
 			$default = $email ? 'blank' : includes_url('images/blank.gif');
214 214
 		} else if (!empty($email) && 'gravatar_default' == $default) {
215 215
 			$default = '';
216 216
 		} else if ('gravatar_default' == $default) {
217
-			$default = $host . '/avatar/?s=' . $size;
217
+			$default = $host.'/avatar/?s='.$size;
218 218
 		} else if (empty($email) && !strstr($default, 'http://')) {
219
-			$default = $host . '/avatar/?d=' . $default . '&s=' . $size;
219
+			$default = $host.'/avatar/?d='.$default.'&s='.$size;
220 220
 		}
221 221
 
222 222
 		return $default;
@@ -256,11 +256,11 @@  discard block
 block discarded – undo
256 256
 	 */
257 257
 	protected function get_avatar_url($default, $host, $email_hash, $size) {
258 258
 		
259
-		$_return = $host . '/avatar/' . $email_hash . '?s=' . $size . '&d=' . urlencode($default);
259
+		$_return = $host.'/avatar/'.$email_hash.'?s='.$size.'&d='.urlencode($default);
260 260
 		$rating = get_option('avatar_rating');
261 261
 		
262 262
 		if (!empty($rating)) {
263
-			$_return .= '&r=' . $rating;
263
+			$_return .= '&r='.$rating;
264 264
 		}
265 265
 		
266 266
 		return str_replace('&', '&', esc_url($_return));
@@ -293,7 +293,7 @@  discard block
 block discarded – undo
293 293
 
294 294
 		if (is_array($this->children)) {
295 295
 		
296
-			foreach( $this->children as $child ) {
296
+			foreach ($this->children as $child) {
297 297
 				$child->level = $this->level + 1;
298 298
 				$child->update_child_levels();
299 299
 			}
Please login to merge, or discard this patch.
Braces   +23 added lines, -11 removed lines patch added patch discarded remove patch
@@ -70,7 +70,8 @@  discard block
 block discarded – undo
70 70
 			
71 71
 			return new ClassyUser($this->user_id);
72 72
 		
73
-		} else {
73
+		}
74
+		else {
74 75
 
75 76
 			$author = new ClassyUser(0);
76 77
 			
@@ -139,7 +140,9 @@  discard block
 block discarded – undo
139 140
 			return false;
140 141
 		}
141 142
 		
142
-		if (!is_numeric($size)) $size = '92';
143
+		if (!is_numeric($size)) {
144
+			$size = '92';
145
+		}
143 146
 
144 147
 
145 148
 		$email = $this->get_avatar_email();
@@ -154,7 +157,8 @@  discard block
 block discarded – undo
154 157
 
155 158
 		if (!empty($email)) {
156 159
 			$avatar = $this->get_avatar_url($default, $host, $email_hash, $size);
157
-		} else {
160
+		}
161
+		else {
158 162
 			$avatar = $default;
159 163
 		}
160 164
 
@@ -174,7 +178,8 @@  discard block
 block discarded – undo
174 178
 
175 179
 		if ($user) {
176 180
 			$email = $user->user_email;
177
-		} else {
181
+		}
182
+		else {
178 183
 			$email = $this->comment_author_email;
179 184
 		}
180 185
 		
@@ -201,7 +206,8 @@  discard block
 block discarded – undo
201 206
 			$avatar_default = get_option('avatar_default');
202 207
 			if (empty($avatar_default)) {
203 208
 				$default = 'mystery';
204
-			} else {
209
+			}
210
+			else {
205 211
 				$default = $avatar_default;
206 212
 			}
207 213
 		}
@@ -209,13 +215,17 @@  discard block
 block discarded – undo
209 215
 		if ('mystery' == $default) {
210 216
 			$default = $host . '/avatar/ad516503a11cd5ca435acc9bb6523536?s=' . $size;
211 217
 			// ad516503a11cd5ca435acc9bb6523536 == md5('[email protected]')
212
-		} else if ('blank' == $default) {
218
+		}
219
+		else if ('blank' == $default) {
213 220
 			$default = $email ? 'blank' : includes_url('images/blank.gif');
214
-		} else if (!empty($email) && 'gravatar_default' == $default) {
221
+		}
222
+		else if (!empty($email) && 'gravatar_default' == $default) {
215 223
 			$default = '';
216
-		} else if ('gravatar_default' == $default) {
224
+		}
225
+		else if ('gravatar_default' == $default) {
217 226
 			$default = $host . '/avatar/?s=' . $size;
218
-		} else if (empty($email) && !strstr($default, 'http://')) {
227
+		}
228
+		else if (empty($email) && !strstr($default, 'http://')) {
219 229
 			$default = $host . '/avatar/?d=' . $default . '&s=' . $size;
220 230
 		}
221 231
 
@@ -233,10 +243,12 @@  discard block
 block discarded – undo
233 243
 		
234 244
 		if (is_ssl()) {
235 245
 			$host = 'https://secure.gravatar.com';
236
-		} else {
246
+		}
247
+		else {
237 248
 			if (!empty($email_hash)) {
238 249
 				$host = sprintf("http://%d.gravatar.com", (hexdec($email_hash[0]) % 2));
239
-			} else {
250
+			}
251
+			else {
240 252
 				$host = 'http://0.gravatar.com';
241 253
 			}
242 254
 		}
Please login to merge, or discard this patch.
app/classy/classy-menu-item.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -124,8 +124,8 @@  discard block
 block discarded – undo
124 124
 	 */
125 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
 
@@ -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
 
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
 
159 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.
app/classy/classy-hierarchy.php 3 patches
Doc Comments   +5 added lines, -4 removed lines patch added patch discarded remove patch
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
 	 * Checks if view exists
112 112
 	 * 
113 113
 	 * @param  string $type view/scope
114
-	 * @param  string $view in blade path format, ex: layout/header
114
+	 * @param string|false $file
115 115
 	 * @return boolean true/false
116 116
 	 */
117 117
 	public static function file_exists($type = 'view', $file) {
@@ -129,8 +129,9 @@  discard block
 block discarded – undo
129 129
 	 * Returns view name for render, based on type of request
130 130
 	 *
131 131
 	 * @param  string $type view/scope
132
-	 * @param  string $type 
133
-	 * @return array 
132
+	 * @param  string $type
133
+	 * @param string $page 
134
+	 * @return string|false 
134 135
 	 */
135 136
 	public static function get_available_file($type = 'view', $page) {
136 137
 
@@ -378,7 +379,7 @@  discard block
 block discarded – undo
378 379
 	/**
379 380
 	 * Returns classy template name or boolean if this is not classy template
380 381
 	 * 
381
-	 * @return mixed
382
+	 * @return string|false
382 383
 	 */
383 384
 	public static function get_classy_template() {
384 385
 
Please login to merge, or discard this patch.
Spacing   +52 added lines, -52 removed lines patch added patch discarded remove patch
@@ -21,39 +21,39 @@  discard block
 block discarded – undo
21 21
 	 */
22 22
 	protected static function check_request() {
23 23
 
24
-		if ( is_404()) : return '404';
24
+		if (is_404()) : return '404';
25 25
 
26
-		elseif ( is_search() ) : return 'search';
26
+		elseif (is_search()) : return 'search';
27 27
 
28
-		elseif ( is_front_page() ) : return 'front-page';
28
+		elseif (is_front_page()) : return 'front-page';
29 29
 
30
-		elseif ( is_home() ) : return 'home';
30
+		elseif (is_home()) : return 'home';
31 31
 
32
-		elseif ( is_post_type_archive() ) : return 'post_type_archive';
32
+		elseif (is_post_type_archive()) : return 'post_type_archive';
33 33
 
34
-		elseif ( is_tax() ) : return 'taxonomy';
34
+		elseif (is_tax()) : return 'taxonomy';
35 35
 
36
-		elseif ( is_attachment() ) : return 'attachment';
36
+		elseif (is_attachment()) : return 'attachment';
37 37
 
38
-		elseif ( is_single() ) : return 'single';
38
+		elseif (is_single()) : return 'single';
39 39
 
40
-		elseif ( self::is_classy_template() ) : return 'classy-template';
40
+		elseif (self::is_classy_template()) : return 'classy-template';
41 41
 
42
-		elseif ( is_page() ) : return 'page';
42
+		elseif (is_page()) : return 'page';
43 43
 
44
-		elseif ( is_singular() ) : return 'singular';
44
+		elseif (is_singular()) : return 'singular';
45 45
 
46
-		elseif ( is_category() ) : return 'category';
46
+		elseif (is_category()) : return 'category';
47 47
 
48
-		elseif ( is_tag() ) : return 'tag';
48
+		elseif (is_tag()) : return 'tag';
49 49
 
50
-		elseif ( is_author() ) : return 'author';
50
+		elseif (is_author()) : return 'author';
51 51
 
52
-		elseif ( is_date() ) : return 'date';
52
+		elseif (is_date()) : return 'date';
53 53
 
54
-		elseif ( is_archive() ) : return 'archive';
54
+		elseif (is_archive()) : return 'archive';
55 55
 
56
-		elseif ( is_paged() ) : return 'paged';
56
+		elseif (is_paged()) : return 'paged';
57 57
 
58 58
 		else :
59 59
 		
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
 	 */
71 71
 	public static function get_current_request() {
72 72
 
73
-		if ( null === self::$current_request ) {
73
+		if (null === self::$current_request) {
74 74
 
75 75
 			self::$current_request = self::check_request();
76 76
 
@@ -94,13 +94,13 @@  discard block
 block discarded – undo
94 94
 
95 95
 			$folder = ClassyView::$folder;
96 96
 
97
-			return THEME_PATH . $folder . '/' . $view . '.blade.php';			
97
+			return THEME_PATH.$folder.'/'.$view.'.blade.php';			
98 98
 		
99 99
 		} elseif ($type == 'scope') {
100 100
 
101 101
 			$folder = ClassyScope::$folder;
102 102
 
103
-			return THEME_PATH . $folder . '/' . $view . '.php';			
103
+			return THEME_PATH.$folder.'/'.$view.'.php';			
104 104
 
105 105
 		}
106 106
 
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
 
139 139
 		foreach ($views as $view) {
140 140
 
141
-			if ( self::file_exists($type, $view) ):
141
+			if (self::file_exists($type, $view)):
142 142
 
143 143
 				return $view;
144 144
 
@@ -163,38 +163,38 @@  discard block
 block discarded – undo
163 163
 
164 164
 		// Home
165 165
 
166
-		if ( $type == 'home' ) :
166
+		if ($type == 'home') :
167 167
 
168 168
 			$views[] = 'home';
169 169
 
170 170
 		// Single
171 171
 
172
-		elseif ( $type == 'single' ) :
172
+		elseif ($type == 'single') :
173 173
 
174 174
 			$post_type = get_post_type();
175 175
 
176
-			$views[] = $post_type . '.single';
176
+			$views[] = $post_type.'.single';
177 177
 
178 178
 			$views[] = 'single';
179 179
 
180 180
 		// Post type
181 181
 
182
-		elseif ( $type == 'post_type_archive' ) :
182
+		elseif ($type == 'post_type_archive') :
183 183
 
184 184
 			$post_type = get_post_type();
185 185
 
186
-			$views[] = $post_type . '.archive';
186
+			$views[] = $post_type.'.archive';
187 187
 
188 188
 			$views[] = 'archive';
189 189
 
190 190
 
191 191
 		// Taxonomy
192 192
 
193
-		elseif ( $type == 'taxonomy' ):
193
+		elseif ($type == 'taxonomy'):
194 194
 
195 195
 			$term = get_queried_object();
196 196
 
197
-			if ( ! empty( $term->slug ) ) {
197
+			if (!empty($term->slug)) {
198 198
 				
199 199
 				$taxonomy = $term->taxonomy;
200 200
 
@@ -209,11 +209,11 @@  discard block
 block discarded – undo
209 209
 
210 210
 		// Category
211 211
 
212
-		elseif ( $type == 'category' ):
212
+		elseif ($type == 'category'):
213 213
 
214 214
 			$category = get_queried_object();
215 215
 
216
-			if ( ! empty( $category->slug ) ) {
216
+			if (!empty($category->slug)) {
217 217
 				$views[] = "category.{$category->slug}";
218 218
 				$views[] = "category.{$category->term_id}";
219 219
 			}
@@ -225,23 +225,23 @@  discard block
 block discarded – undo
225 225
 
226 226
 		// Attachment
227 227
 
228
-		elseif ( $type == 'attachment' ):
228
+		elseif ($type == 'attachment'):
229 229
 
230 230
 			$attachment = get_queried_object();
231 231
 
232
-			if ( $attachment ) {
232
+			if ($attachment) {
233 233
 
234
-				if ( false !== strpos( $attachment->post_mime_type, '/' ) ) {
234
+				if (false !== strpos($attachment->post_mime_type, '/')) {
235 235
 				
236
-					list( $type, $subtype ) = explode( '/', $attachment->post_mime_type );
236
+					list($type, $subtype) = explode('/', $attachment->post_mime_type);
237 237
 				
238 238
 				} else {
239 239
 				
240
-					list( $type, $subtype ) = array( $attachment->post_mime_type, '' );
240
+					list($type, $subtype) = array($attachment->post_mime_type, '');
241 241
 				
242 242
 				}
243 243
 
244
-				if ( ! empty( $subtype ) ) {
244
+				if (!empty($subtype)) {
245 245
 					$views[] = "attachment.{$type}.{$subtype}";
246 246
 					$views[] = "attachment.{$subtype}";
247 247
 
@@ -261,11 +261,11 @@  discard block
 block discarded – undo
261 261
 
262 262
 		// Tag
263 263
 
264
-		elseif ( $type == 'tag' ):
264
+		elseif ($type == 'tag'):
265 265
 
266 266
 			$tag = get_queried_object();
267 267
 
268
-			if ( ! empty( $tag->slug ) ) {
268
+			if (!empty($tag->slug)) {
269 269
 				$views[] = "post.tag.{$tag->slug}";
270 270
 				$views[] = "post.tag.{$tag->term_id}";
271 271
 
@@ -279,11 +279,11 @@  discard block
 block discarded – undo
279 279
 
280 280
 		// Author
281 281
 
282
-		elseif ( $type == 'author' ):
282
+		elseif ($type == 'author'):
283 283
 
284 284
 			$author = get_queried_object();
285 285
 
286
-			if ( $author instanceof WP_User ) {
286
+			if ($author instanceof WP_User) {
287 287
 				$views[] = "post.author.{$author->user_nicename}";
288 288
 				$views[] = "post.author.{$author->ID}";
289 289
 
@@ -298,7 +298,7 @@  discard block
 block discarded – undo
298 298
 
299 299
 		// Front Page
300 300
 
301
-		elseif ( $type == 'front-page' ):
301
+		elseif ($type == 'front-page'):
302 302
 
303 303
 			$views[] = 'front-page.front-page';
304 304
 			$views[] = 'front-page';
@@ -310,38 +310,38 @@  discard block
 block discarded – undo
310 310
 
311 311
 		// Page
312 312
 
313
-		elseif ( $type == 'classy-template' ):
313
+		elseif ($type == 'classy-template'):
314 314
 
315 315
 			$template = self::get_classy_template();
316 316
 
317 317
 			$views[] = $template;
318 318
 
319
-			$views[] = 'page.' . $template;
319
+			$views[] = 'page.'.$template;
320 320
 
321
-			$views[] = 'template.' . $template;
321
+			$views[] = 'template.'.$template;
322 322
 
323 323
 
324
-		elseif ( $type == 'page' ):
324
+		elseif ($type == 'page'):
325 325
 
326 326
 			$id = get_queried_object_id();
327 327
 
328 328
 			$pagename = get_query_var('pagename');
329 329
 
330
-			if ( ! $pagename && $id ) {
330
+			if (!$pagename && $id) {
331 331
 				// If a static page is set as the front page, $pagename will not be set. Retrieve it from the queried object
332 332
 				$post = get_queried_object();
333 333
 				
334
-				if ( $post ) {
334
+				if ($post) {
335 335
 					$pagename = $post->post_name;
336 336
 				}
337 337
 			}
338 338
 
339
-			if ( $pagename ) {
340
-				$views[] = 'page.' . $pagename;
339
+			if ($pagename) {
340
+				$views[] = 'page.'.$pagename;
341 341
 			}
342 342
 			
343
-			if ( $id ) {
344
-				$views[] = 'page.' . $id;
343
+			if ($id) {
344
+				$views[] = 'page.'.$id;
345 345
 			}
346 346
 
347 347
 			$views[] = 'page.page';
@@ -386,7 +386,7 @@  discard block
 block discarded – undo
386 386
 
387 387
 		preg_match('/classy\-(.*)/', $template_slug, $matches);
388 388
 
389
-		if ( $matches && isset($matches[1]) ) return $matches[1];
389
+		if ($matches && isset($matches[1])) return $matches[1];
390 390
 
391 391
 		return false;
392 392
 
Please login to merge, or discard this patch.
Braces   +13 added lines, -5 removed lines patch added patch discarded remove patch
@@ -55,9 +55,11 @@  discard block
 block discarded – undo
55 55
 
56 56
 		elseif ( is_paged() ) : return 'paged';
57 57
 
58
-		else :
58
+		else {
59
+			:
59 60
 		
60 61
 			return 'index';
62
+		}
61 63
 
62 64
 		endif;
63 65
 
@@ -96,7 +98,8 @@  discard block
 block discarded – undo
96 98
 
97 99
 			return THEME_PATH . $folder . '/' . $view . '.blade.php';			
98 100
 		
99
-		} elseif ($type == 'scope') {
101
+		}
102
+		elseif ($type == 'scope') {
100 103
 
101 104
 			$folder = ClassyScope::$folder;
102 105
 
@@ -235,7 +238,8 @@  discard block
 block discarded – undo
235 238
 				
236 239
 					list( $type, $subtype ) = explode( '/', $attachment->post_mime_type );
237 240
 				
238
-				} else {
241
+				}
242
+				else {
239 243
 				
240 244
 					list( $type, $subtype ) = array( $attachment->post_mime_type, '' );
241 245
 				
@@ -351,9 +355,11 @@  discard block
 block discarded – undo
351 355
 
352 356
 		// Default
353 357
 
354
-		else:
358
+		else {
359
+			:
355 360
 
356 361
 			$views[] = $type;
362
+		}
357 363
 
358 364
 		endif;
359 365
 
@@ -386,7 +392,9 @@  discard block
 block discarded – undo
386 392
 
387 393
 		preg_match('/classy\-(.*)/', $template_slug, $matches);
388 394
 
389
-		if ( $matches && isset($matches[1]) ) return $matches[1];
395
+		if ( $matches && isset($matches[1]) ) {
396
+			return $matches[1];
397
+		}
390 398
 
391 399
 		return false;
392 400
 
Please login to merge, or discard this patch.
app/classy/classy-view.php 2 patches
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -60,7 +60,9 @@
 block discarded – undo
60 60
 			
61 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 ) ) {
64
+					continue;
65
+				}
64 66
 
65 67
 				$template_name = trim($header[1]);
66 68
 
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -54,19 +54,19 @@
 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 65
 				$template_name = trim($header[1]);
66 66
 
67 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 71
 				$templates[$template_file] = $template_name;
72 72
 				
Please login to merge, or discard this patch.