Completed
Push — master ( bc6754...ed64c2 )
by
unknown
07:19
created
app/classes/classy.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -259,7 +259,7 @@
 block discarded – undo
259 259
 	 *
260 260
 	 * @param array $prefs Args for paginate_links.
261 261
 	 *
262
-	 * @return array mixed
262
+	 * @return \stdClass mixed
263 263
 	 */
264 264
 	public static function get_pagination( $prefs = array() ) {
265 265
 
Please login to merge, or discard this patch.
Spacing   +55 added lines, -55 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
 	 */
33 33
 	public static function get_instance() {
34 34
 
35
-		if ( null === self::$single_instance ) {
35
+		if (null === self::$single_instance) {
36 36
 
37 37
 			self::$single_instance = new self();
38 38
 
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
 
59 59
 		$this->init_config();
60 60
 
61
-		add_filter( 'theme_page_templates', array( $this, 'filter_templates' ) );
61
+		add_filter('theme_page_templates', array($this, 'filter_templates'));
62 62
 	}
63 63
 
64 64
 	/**
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 	 * Load template functions.
73 73
 	 */
74 74
 	private function load_template_function() {
75
-		require_once( CLASSY_THEME_PATH . 'app/functions/template-functions.php' );
75
+		require_once(CLASSY_THEME_PATH.'app/functions/template-functions.php');
76 76
 	}
77 77
 
78 78
 	/**
@@ -85,13 +85,13 @@  discard block
 block discarded – undo
85 85
 
86 86
 		$theme = wp_get_theme();
87 87
 
88
-		define( 'CLASSY_THEME', $theme->template );
89
-		define( 'CLASSY_THEME_NAME', $theme->get( 'Name' ) );
90
-		define( 'CLASSY_THEME_PATH', get_template_directory() . '/' );
91
-		define( 'CLASSY_THEME_DIR', get_template_directory_uri() . '/' );
92
-		define( 'CLASSY_THEME_VERSION', $theme->get( 'Version' ) );
93
-		define( 'CLASSY_THEME_FRAMEWORK_PATH', CLASSY_THEME_PATH . 'app/' );
94
-		define( 'CLASSY_THEME_FRAMEWORK_DIR', CLASSY_THEME_DIR . 'app/' );
88
+		define('CLASSY_THEME', $theme->template);
89
+		define('CLASSY_THEME_NAME', $theme->get('Name'));
90
+		define('CLASSY_THEME_PATH', get_template_directory().'/');
91
+		define('CLASSY_THEME_DIR', get_template_directory_uri().'/');
92
+		define('CLASSY_THEME_VERSION', $theme->get('Version'));
93
+		define('CLASSY_THEME_FRAMEWORK_PATH', CLASSY_THEME_PATH.'app/');
94
+		define('CLASSY_THEME_FRAMEWORK_DIR', CLASSY_THEME_DIR.'app/');
95 95
 
96 96
 	}
97 97
 
@@ -109,11 +109,11 @@  discard block
 block discarded – undo
109 109
 	 *
110 110
 	 * @return array
111 111
 	 */
112
-	public function filter_templates( $page_templates = array() ) {
112
+	public function filter_templates($page_templates = array()) {
113 113
 
114 114
 		$custom_templates = View::get_page_templates_list();
115 115
 
116
-		return array_merge( $page_templates, $custom_templates );
116
+		return array_merge($page_templates, $custom_templates);
117 117
 
118 118
 	}
119 119
 
@@ -124,11 +124,11 @@  discard block
 block discarded – undo
124 124
 	 *
125 125
 	 * @return mixed|bool Return false if variable not found.
126 126
 	 */
127
-	public static function get_config_var( $name ) {
127
+	public static function get_config_var($name) {
128 128
 
129 129
 		$vars = Config::get_vars();
130 130
 
131
-		return ( isset( $vars[ $name ] ) ) ? $vars[ $name ] : false;
131
+		return (isset($vars[$name])) ? $vars[$name] : false;
132 132
 
133 133
 	}
134 134
 
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
 	 */
140 140
 	public static function textdomain() {
141 141
 
142
-		$textdomain = Classy::get_config_var( 'textdomain' );
142
+		$textdomain = Classy::get_config_var('textdomain');
143 143
 
144 144
 		return $textdomain ? $textdomain : CLASSY_THEME;
145 145
 
@@ -154,17 +154,17 @@  discard block
 block discarded – undo
154 154
 	 * @param  array|null  $data Additional params.
155 155
 	 * @return void
156 156
 	 */
157
-	public static function render( $view = null, $data = null ) {
157
+	public static function render($view = null, $data = null) {
158 158
 
159
-		$views = CLASSY_THEME_PATH . View::$folder;
160
-		$cache = WP_CONTENT_DIR . '/viewcache';
159
+		$views = CLASSY_THEME_PATH.View::$folder;
160
+		$cache = WP_CONTENT_DIR.'/viewcache';
161 161
 		$common_scope = Scope::get_common_scope();
162 162
 
163
-		if ( null !== $view && is_string( $view ) ) {
163
+		if (null !== $view && is_string($view)) {
164 164
 
165
-			if ( $data && is_array( $data ) ) {
165
+			if ($data && is_array($data)) {
166 166
 
167
-				$scope = array_merge( $common_scope, $data );
167
+				$scope = array_merge($common_scope, $data);
168 168
 
169 169
 			} else {
170 170
 
@@ -179,9 +179,9 @@  discard block
 block discarded – undo
179 179
 
180 180
 		}
181 181
 
182
-		$renderer = new BladeRenderer( $views, array( 'cache_path' => $cache ) );
182
+		$renderer = new BladeRenderer($views, array('cache_path' => $cache));
183 183
 
184
-		echo $renderer->render( $view, $scope ); // XSS: xss ok.
184
+		echo $renderer->render($view, $scope); // XSS: xss ok.
185 185
 
186 186
 	}
187 187
 
@@ -206,27 +206,27 @@  discard block
 block discarded – undo
206 206
 	 *
207 207
 	 * @return array
208 208
 	 */
209
-	public static function get_posts( $args = false, $return = '\Classy\Models\Post' ) {
209
+	public static function get_posts($args = false, $return = '\Classy\Models\Post') {
210 210
 
211 211
 		$_return = array();
212 212
 
213
-		$query = Query_Helper::find_query( $args );
213
+		$query = Query_Helper::find_query($args);
214 214
 
215
-		if ( isset( $query->posts ) ) {
215
+		if (isset($query->posts)) {
216 216
 
217
-			foreach ( $query->posts as $post ) {
217
+			foreach ($query->posts as $post) {
218 218
 
219
-				if ( 'id' === $return ) {
219
+				if ('id' === $return) {
220 220
 
221 221
 					$_return[] = $post->id;
222 222
 
223
-				} elseif ( 'object' === $return ) {
223
+				} elseif ('object' === $return) {
224 224
 
225 225
 					$_return[] = $post;
226 226
 
227
-				} elseif ( class_exists( $return ) ) {
227
+				} elseif (class_exists($return)) {
228 228
 
229
-					$_return[] = new $return( $post );
229
+					$_return[] = new $return($post);
230 230
 
231 231
 				}
232 232
 			}
@@ -244,11 +244,11 @@  discard block
 block discarded – undo
244 244
 	 *
245 245
 	 * @return mixed
246 246
 	 */
247
-	public static function get_post( $args = false, $return_type = '\Classy\Models\Post' ) {
247
+	public static function get_post($args = false, $return_type = '\Classy\Models\Post') {
248 248
 
249
-		$posts = self::get_posts( $args, $return_type );
249
+		$posts = self::get_posts($args, $return_type);
250 250
 
251
-		if ( $post = reset( $posts ) ) {
251
+		if ($post = reset($posts)) {
252 252
 			return $post;
253 253
 		}
254 254
 
@@ -261,62 +261,62 @@  discard block
 block discarded – undo
261 261
 	 *
262 262
 	 * @return array mixed
263 263
 	 */
264
-	public static function get_pagination( $prefs = array() ) {
264
+	public static function get_pagination($prefs = array()) {
265 265
 
266 266
 		global $wp_query;
267 267
 		global $paged;
268 268
 		global $wp_rewrite;
269 269
 
270 270
 		$args = array();
271
-		$args['total'] = ceil( $wp_query->found_posts / $wp_query->query_vars['posts_per_page'] );
271
+		$args['total'] = ceil($wp_query->found_posts / $wp_query->query_vars['posts_per_page']);
272 272
 
273
-		if ( $wp_rewrite->using_permalinks() ) {
273
+		if ($wp_rewrite->using_permalinks()) {
274 274
 
275
-			$url = explode( '?', get_pagenum_link( 0 ) );
275
+			$url = explode('?', get_pagenum_link(0));
276 276
 
277
-			if ( isset( $url[1] ) ) {
278
-				parse_str( $url[1], $query );
277
+			if (isset($url[1])) {
278
+				parse_str($url[1], $query);
279 279
 				$args['add_args'] = $query;
280 280
 			}
281 281
 
282 282
 			$args['format'] = 'page/%#%';
283
-			$args['base'] = trailingslashit( $url[0] ).'%_%';
283
+			$args['base'] = trailingslashit($url[0]).'%_%';
284 284
 
285 285
 		} else {
286 286
 			$big = 999999999;
287
-			$args['base'] = str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) );
287
+			$args['base'] = str_replace($big, '%#%', esc_url(get_pagenum_link($big)));
288 288
 		}
289 289
 
290 290
 		$args['type'] = 'array';
291
-		$args['current'] = max( 1, get_query_var( 'paged' ) );
292
-		$args['mid_size'] = max( 9 - $args['current'], 3 );
291
+		$args['current'] = max(1, get_query_var('paged'));
292
+		$args['mid_size'] = max(9 - $args['current'], 3);
293 293
 		$args['prev_next'] = false;
294 294
 
295
-		if ( is_int( $prefs ) ) {
295
+		if (is_int($prefs)) {
296 296
 			$args['mid_size'] = $prefs - 2;
297 297
 		} else {
298
-			$args = array_merge( $args, $prefs );
298
+			$args = array_merge($args, $prefs);
299 299
 		}
300 300
 
301 301
 		$data = array();
302
-		$data['pages'] = Helper::paginate_links( $args );
303
-		$next = get_next_posts_page_link( $args['total'] );
302
+		$data['pages'] = Helper::paginate_links($args);
303
+		$next = get_next_posts_page_link($args['total']);
304 304
 
305
-		if ( $next ) {
306
-			$data['next'] = array( 'link' => untrailingslashit( $next ), 'class' => 'page-numbers next' );
305
+		if ($next) {
306
+			$data['next'] = array('link' => untrailingslashit($next), 'class' => 'page-numbers next');
307 307
 		}
308 308
 
309
-		$prev = previous_posts( false );
309
+		$prev = previous_posts(false);
310 310
 
311
-		if ( $prev ) {
312
-			$data['prev'] = array( 'link' => untrailingslashit( $prev ), 'class' => 'page-numbers prev' );
311
+		if ($prev) {
312
+			$data['prev'] = array('link' => untrailingslashit($prev), 'class' => 'page-numbers prev');
313 313
 		}
314 314
 
315
-		if ( $paged < 2 ) {
315
+		if ($paged < 2) {
316 316
 			$data['prev'] = null;
317 317
 		}
318 318
 
319
-		return Helper::array_to_object( $data );
319
+		return Helper::array_to_object($data);
320 320
 
321 321
 	}
322 322
 }
Please login to merge, or discard this patch.
app/classes/comment.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -94,7 +94,7 @@
 block discarded – undo
94 94
 	/**
95 95
 	 * Returns User object of comment author
96 96
 	 *
97
-	 * @return object User
97
+	 * @return Models\User User
98 98
 	 */
99 99
 	public function author() {
100 100
 
Please login to merge, or discard this patch.
Spacing   +52 added lines, -52 removed lines patch added patch discarded remove patch
@@ -81,11 +81,11 @@  discard block
 block discarded – undo
81 81
 	 *
82 82
 	 * @param \WP_Comment $item
83 83
 	 */
84
-	public function __construct( $item ) {
84
+	public function __construct($item) {
85 85
 
86
-		if ( is_a( $item, '\WP_Comment' ) ) {
86
+		if (is_a($item, '\WP_Comment')) {
87 87
 
88
-			$this->import( $item );
88
+			$this->import($item);
89 89
 
90 90
 		}
91 91
 
@@ -98,15 +98,15 @@  discard block
 block discarded – undo
98 98
 	 */
99 99
 	public function author() {
100 100
 
101
-		if ( $this->user_id ) {
101
+		if ($this->user_id) {
102 102
 
103
-			return new Models\User( $this->user_id );
103
+			return new Models\User($this->user_id);
104 104
 
105 105
 		} else {
106 106
 
107
-			$author = new Models\User( 0 );
107
+			$author = new Models\User(0);
108 108
 
109
-			if ( isset( $this->comment_author ) && $this->comment_author ) {
109
+			if (isset($this->comment_author) && $this->comment_author) {
110 110
 
111 111
 				$author->name = $this->comment_author;
112 112
 
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
 	 * @return string
124 124
 	 */
125 125
 	public function content() {
126
-		return apply_filters( 'get_comment_text ', $this->comment_content );
126
+		return apply_filters('get_comment_text ', $this->comment_content);
127 127
 	}
128 128
 
129 129
 	/**
@@ -141,11 +141,11 @@  discard block
 block discarded – undo
141 141
 	 * @param  string $date_format
142 142
 	 * @return string
143 143
 	 */
144
-	public function date( $date_format = '' ) {
145
-		$df = $date_format ? $date_format : get_option( 'date_format' );
146
-		$the_date = (string) mysql2date( $df, $this->comment_date );
144
+	public function date($date_format = '') {
145
+		$df = $date_format ? $date_format : get_option('date_format');
146
+		$the_date = (string) mysql2date($df, $this->comment_date);
147 147
 
148
-		return apply_filters( 'get_comment_date ', $the_date, $df );
148
+		return apply_filters('get_comment_date ', $the_date, $df);
149 149
 	}
150 150
 
151 151
 	/**
@@ -164,26 +164,26 @@  discard block
 block discarded – undo
164 164
 	 * @param  string $default
165 165
 	 * @return string
166 166
 	 */
167
-	public function avatar( $size = 92, $default = '' ) {
167
+	public function avatar($size = 92, $default = '') {
168 168
 
169
-		if ( ! get_option( 'show_avatars' ) ) {
169
+		if (!get_option('show_avatars')) {
170 170
 			return false;
171 171
 		}
172 172
 
173
-		if ( ! is_numeric( $size ) ) { $size = '92'; }
173
+		if (!is_numeric($size)) { $size = '92'; }
174 174
 
175 175
 		$email = $this->get_avatar_email();
176 176
 		$email_hash = '';
177 177
 
178
-		if ( ! empty( $email ) ) {
179
-			$email_hash = md5( strtolower( trim( $email ) ) );
178
+		if (!empty($email)) {
179
+			$email_hash = md5(strtolower(trim($email)));
180 180
 		}
181 181
 
182
-		$host = $this->get_avatar_host( $email_hash );
183
-		$default = $this->get_default_avatar( $default, $email, $size, $host );
182
+		$host = $this->get_avatar_host($email_hash);
183
+		$default = $this->get_default_avatar($default, $email, $size, $host);
184 184
 
185
-		if ( ! empty( $email ) ) {
186
-			$avatar = $this->get_avatar_url( $default, $host, $email_hash, $size );
185
+		if (!empty($email)) {
186
+			$avatar = $this->get_avatar_url($default, $host, $email_hash, $size);
187 187
 		} else {
188 188
 			$avatar = $default;
189 189
 		}
@@ -200,9 +200,9 @@  discard block
 block discarded – undo
200 200
 	protected function get_avatar_email() {
201 201
 
202 202
 		$id = (int) $this->user_id;
203
-		$user = get_userdata( $id );
203
+		$user = get_userdata($id);
204 204
 
205
-		if ( $user ) {
205
+		if ($user) {
206 206
 			$email = $user->user_email;
207 207
 		} else {
208 208
 			$email = $this->comment_author_email;
@@ -221,32 +221,32 @@  discard block
 block discarded – undo
221 221
 	 * @param  string $host
222 222
 	 * @return string
223 223
 	 */
224
-	protected function get_default_avatar( $default, $email, $size, $host ) {
224
+	protected function get_default_avatar($default, $email, $size, $host) {
225 225
 
226
-		if ( '/' === substr( $default, 0, 1 ) ) {
227
-			$default = home_url() . $default;
226
+		if ('/' === substr($default, 0, 1)) {
227
+			$default = home_url().$default;
228 228
 		}
229 229
 
230
-		if ( empty( $default ) ) {
231
-			$avatar_default = get_option( 'avatar_default' );
232
-			if ( empty( $avatar_default ) ) {
230
+		if (empty($default)) {
231
+			$avatar_default = get_option('avatar_default');
232
+			if (empty($avatar_default)) {
233 233
 				$default = 'mystery';
234 234
 			} else {
235 235
 				$default = $avatar_default;
236 236
 			}
237 237
 		}
238 238
 
239
-		if ( 'mystery' === $default ) {
240
-			$default = $host . '/avatar/ad516503a11cd5ca435acc9bb6523536?s=' . $size;
239
+		if ('mystery' === $default) {
240
+			$default = $host.'/avatar/ad516503a11cd5ca435acc9bb6523536?s='.$size;
241 241
 			// ad516503a11cd5ca435acc9bb6523536 == md5('[email protected]')
242
-		} else if ( 'blank' === $default ) {
243
-			$default = $email ? 'blank' : includes_url( 'images/blank.gif' );
244
-		} else if ( ! empty( $email ) && 'gravatar_default' === $default ) {
242
+		} else if ('blank' === $default) {
243
+			$default = $email ? 'blank' : includes_url('images/blank.gif');
244
+		} else if (!empty($email) && 'gravatar_default' === $default) {
245 245
 			$default = '';
246
-		} else if ( 'gravatar_default' === $default ) {
247
-			$default = $host . '/avatar/?s=' . $size;
248
-		} else if ( empty( $email ) && ! strstr( $default, 'http://' ) ) {
249
-			$default = $host . '/avatar/?d=' . $default . '&amp;s=' . $size;
246
+		} else if ('gravatar_default' === $default) {
247
+			$default = $host.'/avatar/?s='.$size;
248
+		} else if (empty($email) && !strstr($default, 'http://')) {
249
+			$default = $host.'/avatar/?d='.$default.'&amp;s='.$size;
250 250
 		}
251 251
 
252 252
 		return $default;
@@ -259,13 +259,13 @@  discard block
 block discarded – undo
259 259
 	 * @param  string $email_hash
260 260
 	 * @return string
261 261
 	 */
262
-	protected function get_avatar_host( $email_hash ) {
262
+	protected function get_avatar_host($email_hash) {
263 263
 
264
-		if ( is_ssl() ) {
264
+		if (is_ssl()) {
265 265
 			$host = 'https://secure.gravatar.com';
266 266
 		} else {
267
-			if ( ! empty( $email_hash ) ) {
268
-				$host = sprintf( 'http://%d.gravatar.com', (hexdec( $email_hash[0] ) % 2) );
267
+			if (!empty($email_hash)) {
268
+				$host = sprintf('http://%d.gravatar.com', (hexdec($email_hash[0]) % 2));
269 269
 			} else {
270 270
 				$host = 'http://0.gravatar.com';
271 271
 			}
@@ -284,16 +284,16 @@  discard block
 block discarded – undo
284 284
 	 * @param  int $size
285 285
 	 * @return string
286 286
 	 */
287
-	protected function get_avatar_url( $default, $host, $email_hash, $size ) {
287
+	protected function get_avatar_url($default, $host, $email_hash, $size) {
288 288
 
289
-		$_return = $host . '/avatar/' . $email_hash . '?s=' . $size . '&amp;d=' . urlencode( $default );
290
-		$rating = get_option( 'avatar_rating' );
289
+		$_return = $host.'/avatar/'.$email_hash.'?s='.$size.'&amp;d='.urlencode($default);
290
+		$rating = get_option('avatar_rating');
291 291
 
292
-		if ( ! empty( $rating ) ) {
293
-			$_return .= '&amp;r=' . $rating;
292
+		if (!empty($rating)) {
293
+			$_return .= '&amp;r='.$rating;
294 294
 		}
295 295
 
296
-		return str_replace( '&#038;', '&amp;', esc_url( $_return ) );
296
+		return str_replace('&#038;', '&amp;', esc_url($_return));
297 297
 
298 298
 	}
299 299
 
@@ -302,12 +302,12 @@  discard block
 block discarded – undo
302 302
 	 *
303 303
 	 * @param Comment $comment
304 304
 	 */
305
-	public function add_child( $comment ) {
305
+	public function add_child($comment) {
306 306
 
307 307
 		$this->children[] = $comment;
308 308
 		$item->level = $this->level + 1;
309 309
 
310
-		if ( $item->children ) {
310
+		if ($item->children) {
311 311
 			$this->update_child_levels();
312 312
 		}
313 313
 
@@ -321,9 +321,9 @@  discard block
 block discarded – undo
321 321
 	 */
322 322
 	protected function update_child_levels() {
323 323
 
324
-		if ( is_array( $this->children ) ) {
324
+		if (is_array($this->children)) {
325 325
 
326
-			foreach ( $this->children as $child ) {
326
+			foreach ($this->children as $child) {
327 327
 				$child->level = $this->level + 1;
328 328
 				$child->update_child_levels();
329 329
 			}
Please login to merge, or discard this patch.
app/classes/helper.php 1 patch
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
 	 *
14 14
 	 * @param string  $text
15 15
 	 * @param int     $num_words
16
-	 * @param string|null|false  $more text to appear in "Read more...". Null to use default, false to hide
16
+	 * @param boolean  $more text to appear in "Read more...". Null to use default, false to hide
17 17
 	 * @param string  $allowed_tags
18 18
 	 * @return string
19 19
 	 */
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
 	 * Converts array to object recursively
223 223
 	 *
224 224
 	 * @param  array $array
225
-	 * @return object
225
+	 * @return \stdClass
226 226
 	 */
227 227
 	public static function array_to_object( $array ) {
228 228
 		$obj = new \stdClass;
Please login to merge, or discard this patch.
functions.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -2,5 +2,5 @@
 block discarded – undo
2 2
 /**
3 3
  * Init our WordPress Theme.
4 4
  */
5
-require_once( __DIR__ . '/vendor/autoload.php' );
5
+require_once(__DIR__.'/vendor/autoload.php');
6 6
 \Classy\Classy::get_instance();
Please login to merge, or discard this patch.
header.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -2,4 +2,4 @@
 block discarded – undo
2 2
 /**
3 3
  * Theme header.
4 4
  */
5
-get_theme_framework()::render( 'layout.header' );
5
+get_theme_framework()::render('layout.header');
Please login to merge, or discard this patch.
footer.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -2,4 +2,4 @@
 block discarded – undo
2 2
 /**
3 3
  * Theme footer.
4 4
  */
5
-get_theme_framework()::render( 'layout.footer' );
5
+get_theme_framework()::render('layout.footer');
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 \Classy\Models\Post( $post );
5
+$classypost = new \Classy\Models\Post($post);
6 6
 
7
-Classy\Classy::render( 'layout.comments', array( 'post' => $classypost ) );
7
+Classy\Classy::render('layout.comments', array('post' => $classypost));
Please login to merge, or discard this patch.
app/classes/models/post.php 2 patches
Spacing   +75 added lines, -75 removed lines patch added patch discarded remove patch
@@ -93,12 +93,12 @@  discard block
 block discarded – undo
93 93
 	 *
94 94
 	 * @param object|int $post WP_Post or WP_Post.ID.
95 95
 	 */
96
-	public function __construct( $post = null ) {
97
-		if ( is_integer( $post ) ) {
96
+	public function __construct($post = null) {
97
+		if (is_integer($post)) {
98 98
 			$this->ID = $post;
99 99
 			$this->init();
100
-		} elseif ( is_a( $post, '\WP_Post' ) ) {
101
-			$this->import( $post );
100
+		} elseif (is_a($post, '\WP_Post')) {
101
+			$this->import($post);
102 102
 		}
103 103
 	}
104 104
 
@@ -108,8 +108,8 @@  discard block
 block discarded – undo
108 108
 	protected function init() {
109 109
 		$post = $this->get_object();
110 110
 
111
-		if ( is_a( $post, '\WP_Post' ) ) {
112
-			$this->import( $post );
111
+		if (is_a($post, '\WP_Post')) {
112
+			$this->import($post);
113 113
 		}
114 114
 	}
115 115
 
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
 	 * @return \WP_Post
120 120
 	 */
121 121
 	public function get_object() {
122
-		$object = get_post( $this->ID );
122
+		$object = get_post($this->ID);
123 123
 
124 124
 		return $object;
125 125
 	}
@@ -130,10 +130,10 @@  discard block
 block discarded – undo
130 130
 	 * @return boolean
131 131
 	 */
132 132
 	public function can_edit() {
133
-		if ( ! function_exists( 'current_user_can' ) ) {
133
+		if (!function_exists('current_user_can')) {
134 134
 			return false;
135 135
 		}
136
-		if ( current_user_can( 'edit_post', $this->ID ) ) {
136
+		if (current_user_can('edit_post', $this->ID)) {
137 137
 			return true;
138 138
 		}
139 139
 
@@ -146,8 +146,8 @@  discard block
 block discarded – undo
146 146
 	 * @return string
147 147
 	 */
148 148
 	public function get_edit_url() {
149
-		if ( $this->can_edit() ) {
150
-			return get_edit_post_link( $this->ID );
149
+		if ($this->can_edit()) {
150
+			return get_edit_post_link($this->ID);
151 151
 		}
152 152
 
153 153
 		return '';
@@ -170,9 +170,9 @@  discard block
 block discarded – undo
170 170
 			'fields' => 'ids',
171 171
 		);
172 172
 
173
-		$images = get_children( $attrs );
173
+		$images = get_children($attrs);
174 174
 
175
-		if ( ! count( $images ) ) {
175
+		if (!count($images)) {
176 176
 			return false;
177 177
 		}
178 178
 
@@ -189,11 +189,11 @@  discard block
 block discarded – undo
189 189
 
190 190
 		$images = $this->get_attached_images();
191 191
 
192
-		if ( $images ) {
192
+		if ($images) {
193 193
 
194
-			foreach ( $images as $image_id ) {
194
+			foreach ($images as $image_id) {
195 195
 
196
-				$_return[] = new Image( $image_id );
196
+				$_return[] = new Image($image_id);
197 197
 
198 198
 			}
199 199
 		}
@@ -219,13 +219,13 @@  discard block
 block discarded – undo
219 219
 			'fields' => 'ids',
220 220
 		);
221 221
 
222
-		$images = get_children( $attrs );
222
+		$images = get_children($attrs);
223 223
 
224
-		if ( ! count( $images ) ) {
224
+		if (!count($images)) {
225 225
 			return false;
226 226
 		}
227 227
 
228
-		$images = array_values( $images );
228
+		$images = array_values($images);
229 229
 
230 230
 		return $images[0];
231 231
 	}
@@ -239,8 +239,8 @@  discard block
 block discarded – undo
239 239
 
240 240
 		$image_id = $this->get_first_attached_image_id();
241 241
 
242
-		if ( $image_id ) {
243
-			return new Image( $image_id );
242
+		if ($image_id) {
243
+			return new Image($image_id);
244 244
 		}
245 245
 
246 246
 		return new Image();
@@ -252,12 +252,12 @@  discard block
 block discarded – undo
252 252
 	 * @return Image
253 253
 	 */
254 254
 	public function thumbnail() {
255
-		if ( function_exists( 'get_post_thumbnail_id' ) ) {
256
-			$image_id = get_post_thumbnail_id( $this->ID );
255
+		if (function_exists('get_post_thumbnail_id')) {
256
+			$image_id = get_post_thumbnail_id($this->ID);
257 257
 
258
-			if ( $image_id ) {
258
+			if ($image_id) {
259 259
 
260
-				return new Image( $image_id );
260
+				return new Image($image_id);
261 261
 
262 262
 			}
263 263
 		}
@@ -271,7 +271,7 @@  discard block
 block discarded – undo
271 271
 	 * @return string
272 272
 	 */
273 273
 	public function get_title() {
274
-		return apply_filters( 'the_title', $this->post_title, $this->ID );
274
+		return apply_filters('the_title', $this->post_title, $this->ID);
275 275
 	}
276 276
 
277 277
 	/**
@@ -290,24 +290,24 @@  discard block
 block discarded – undo
290 290
 	 *
291 291
 	 * @return string        Post content
292 292
 	 */
293
-	public function get_content( $page = 0 ) {
294
-		if ( 0 === absint( $page ) && $this->post_content ) {
293
+	public function get_content($page = 0) {
294
+		if (0 === absint($page) && $this->post_content) {
295 295
 			return $this->post_content;
296 296
 		}
297 297
 
298 298
 		$content = $this->post_content;
299 299
 
300
-		if ( $page ) {
301
-			$contents = explode( '<!--nextpage-->', $content );
300
+		if ($page) {
301
+			$contents = explode('<!--nextpage-->', $content);
302 302
 
303 303
 			$page--;
304 304
 
305
-			if ( count( $contents ) > $page ) {
306
-				$content = $contents[ $page ];
305
+			if (count($contents) > $page) {
306
+				$content = $contents[$page];
307 307
 			}
308 308
 		}
309 309
 
310
-		$content = apply_filters( 'the_content', ($content) );
310
+		$content = apply_filters('the_content', ($content));
311 311
 
312 312
 		return $content;
313 313
 	}
@@ -327,7 +327,7 @@  discard block
 block discarded – undo
327 327
 	 * @return object
328 328
 	 */
329 329
 	public function get_post_type() {
330
-		return get_post_type_object( $this->post_type );
330
+		return get_post_type_object($this->post_type);
331 331
 	}
332 332
 
333 333
 	/**
@@ -336,11 +336,11 @@  discard block
 block discarded – undo
336 336
 	 * @return string
337 337
 	 */
338 338
 	public function get_permalink() {
339
-		if ( isset( $this->permalink ) ) {
339
+		if (isset($this->permalink)) {
340 340
 			return $this->permalink;
341 341
 		}
342 342
 
343
-		$this->permalink = get_permalink( $this->ID );
343
+		$this->permalink = get_permalink($this->ID);
344 344
 
345 345
 		return $this->permalink;
346 346
 	}
@@ -366,84 +366,84 @@  discard block
 block discarded – undo
366 366
 	 *
367 367
 	 * @return string            Post preview.
368 368
 	 */
369
-	public function get_preview( $len = 50, $force = false, $readmore = 'Read More', $strip = true ) {
369
+	public function get_preview($len = 50, $force = false, $readmore = 'Read More', $strip = true) {
370 370
 		$text = '';
371 371
 		$trimmed = false;
372 372
 
373
-		if ( isset( $this->post_excerpt ) && strlen( $this->post_excerpt ) ) {
373
+		if (isset($this->post_excerpt) && strlen($this->post_excerpt)) {
374 374
 
375
-			if ( $force ) {
376
-				$text = Helper::trim_words( $this->post_excerpt, $len, false );
375
+			if ($force) {
376
+				$text = Helper::trim_words($this->post_excerpt, $len, false);
377 377
 				$trimmed = true;
378 378
 			} else {
379 379
 				$text = $this->post_excerpt;
380 380
 			}
381 381
 		}
382 382
 
383
-		if ( ! strlen( $text ) && preg_match( '/<!--\s?more(.*?)?-->/', $this->post_content, $readmore_matches ) ) {
383
+		if (!strlen($text) && preg_match('/<!--\s?more(.*?)?-->/', $this->post_content, $readmore_matches)) {
384 384
 
385
-			$pieces = explode( $readmore_matches[0], $this->post_content );
385
+			$pieces = explode($readmore_matches[0], $this->post_content);
386 386
 			$text = $pieces[0];
387 387
 
388
-			if ( $force ) {
389
-				$text = Helper::trim_words( $text, $len, false );
388
+			if ($force) {
389
+				$text = Helper::trim_words($text, $len, false);
390 390
 				$trimmed = true;
391 391
 			}
392 392
 
393
-			$text = do_shortcode( $text );
393
+			$text = do_shortcode($text);
394 394
 
395 395
 		}
396 396
 
397
-		if ( ! strlen( $text ) ) {
397
+		if (!strlen($text)) {
398 398
 
399
-			$text = Helper::trim_words( $this->get_content(), $len, false );
399
+			$text = Helper::trim_words($this->get_content(), $len, false);
400 400
 			$trimmed = true;
401 401
 
402 402
 		}
403 403
 
404
-		if ( ! strlen( trim( $text ) ) ) {
404
+		if (!strlen(trim($text))) {
405 405
 
406
-			return trim( $text );
406
+			return trim($text);
407 407
 
408 408
 		}
409 409
 
410
-		if ( $strip ) {
410
+		if ($strip) {
411 411
 
412
-			$text = trim( strip_tags( $text ) );
412
+			$text = trim(strip_tags($text));
413 413
 
414 414
 		}
415 415
 
416
-		if ( strlen( $text ) ) {
416
+		if (strlen($text)) {
417 417
 
418
-			$text = trim( $text );
419
-			$last = $text[ strlen( $text ) - 1 ];
418
+			$text = trim($text);
419
+			$last = $text[strlen($text) - 1];
420 420
 
421
-			if ( '.' !== $last && $trimmed ) {
421
+			if ('.' !== $last && $trimmed) {
422 422
 				$text .= ' &hellip; ';
423 423
 			}
424 424
 
425
-			if ( ! $strip ) {
426
-				$last_p_tag = strrpos( $text, '</p>' );
427
-				if ( false !== $last_p_tag ) {
428
-					$text = substr( $text, 0, $last_p_tag );
425
+			if (!$strip) {
426
+				$last_p_tag = strrpos($text, '</p>');
427
+				if (false !== $last_p_tag) {
428
+					$text = substr($text, 0, $last_p_tag);
429 429
 				}
430
-				if ( '.' !== $last && $trimmed ) {
430
+				if ('.' !== $last && $trimmed) {
431 431
 					$text .= ' &hellip; ';
432 432
 				}
433 433
 			}
434 434
 
435
-			if ( $readmore && isset( $readmore_matches ) && ! empty( $readmore_matches[1] ) ) {
436
-				$text .= ' <a href="' . $this->get_permalink() . '" class="read-more">' . trim( $readmore_matches[1] ) . '</a>';
437
-			} elseif ( $readmore ) {
438
-				$text .= ' <a href="' . $this->get_permalink() . '" class="read-more">' . trim( $readmore ) . '</a>';
435
+			if ($readmore && isset($readmore_matches) && !empty($readmore_matches[1])) {
436
+				$text .= ' <a href="'.$this->get_permalink().'" class="read-more">'.trim($readmore_matches[1]).'</a>';
437
+			} elseif ($readmore) {
438
+				$text .= ' <a href="'.$this->get_permalink().'" class="read-more">'.trim($readmore).'</a>';
439 439
 			}
440 440
 
441
-			if ( ! $strip ) {
441
+			if (!$strip) {
442 442
 				$text .= '</p>';
443 443
 			}
444 444
 		}
445 445
 
446
-		return trim( $text );
446
+		return trim($text);
447 447
 	}
448 448
 
449 449
 	/**
@@ -454,7 +454,7 @@  discard block
 block discarded – undo
454 454
 	 *
455 455
 	 * @return array
456 456
 	 */
457
-	public function get_comments( $status = 'approve', $order = 'DESC' ) {
457
+	public function get_comments($status = 'approve', $order = 'DESC') {
458 458
 
459 459
 		$_return = array();
460 460
 
@@ -464,25 +464,25 @@  discard block
 block discarded – undo
464 464
 			'order' => $order,
465 465
 		);
466 466
 
467
-		$comments = get_comments( $args );
467
+		$comments = get_comments($args);
468 468
 
469
-		foreach ( $comments as $comment ) {
469
+		foreach ($comments as $comment) {
470 470
 			
471
-			$_return[ $comment->comment_ID ] = new Comment( $comment );
471
+			$_return[$comment->comment_ID] = new Comment($comment);
472 472
 
473 473
 		}
474 474
 
475
-		foreach ( $_return as $key => $comment ) {
475
+		foreach ($_return as $key => $comment) {
476 476
 
477
-			if ( $comment->has_parent() ) {
477
+			if ($comment->has_parent()) {
478 478
 
479
-				$_return[ $comment->comment_parent ]->add_child( $comment );
479
+				$_return[$comment->comment_parent]->add_child($comment);
480 480
 
481
-				unset( $_return[ $key ] );
481
+				unset($_return[$key]);
482 482
 
483 483
 			}
484 484
 		}
485 485
 
486
-		return array_values( $_return );
486
+		return array_values($_return);
487 487
 	}
488 488
 }
Please login to merge, or discard this patch.
Braces   +6 added lines, -3 removed lines patch added patch discarded remove patch
@@ -97,7 +97,8 @@  discard block
 block discarded – undo
97 97
 		if ( is_integer( $post ) ) {
98 98
 			$this->ID = $post;
99 99
 			$this->init();
100
-		} elseif ( is_a( $post, '\WP_Post' ) ) {
100
+		}
101
+		elseif ( is_a( $post, '\WP_Post' ) ) {
101 102
 			$this->import( $post );
102 103
 		}
103 104
 	}
@@ -375,7 +376,8 @@  discard block
 block discarded – undo
375 376
 			if ( $force ) {
376 377
 				$text = Helper::trim_words( $this->post_excerpt, $len, false );
377 378
 				$trimmed = true;
378
-			} else {
379
+			}
380
+			else {
379 381
 				$text = $this->post_excerpt;
380 382
 			}
381 383
 		}
@@ -434,7 +436,8 @@  discard block
 block discarded – undo
434 436
 
435 437
 			if ( $readmore && isset( $readmore_matches ) && ! empty( $readmore_matches[1] ) ) {
436 438
 				$text .= ' <a href="' . $this->get_permalink() . '" class="read-more">' . trim( $readmore_matches[1] ) . '</a>';
437
-			} elseif ( $readmore ) {
439
+			}
440
+			elseif ( $readmore ) {
438 441
 				$text .= ' <a href="' . $this->get_permalink() . '" class="read-more">' . trim( $readmore ) . '</a>';
439 442
 			}
440 443
 
Please login to merge, or discard this patch.
app/classes/view.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -29,9 +29,9 @@  discard block
 block discarded – undo
29 29
 
30 30
 		$request = Hierarchy::get_current_request();
31 31
 
32
-		$file = Hierarchy::get_available_file( 'view', $request );
32
+		$file = Hierarchy::get_available_file('view', $request);
33 33
 
34
-		$view = self::get_blade_view( $file );
34
+		$view = self::get_blade_view($file);
35 35
 
36 36
 		return $view;
37 37
 
@@ -44,9 +44,9 @@  discard block
 block discarded – undo
44 44
 	 *
45 45
 	 * @return string
46 46
 	 */
47
-	public static function get_blade_view( $view ) {
47
+	public static function get_blade_view($view) {
48 48
 
49
-		return str_replace( '/', '.', $view );
49
+		return str_replace('/', '.', $view);
50 50
 
51 51
 	}
52 52
 
@@ -59,21 +59,21 @@  discard block
 block discarded – undo
59 59
 
60 60
 		$templates = array();
61 61
 
62
-		$files = (array) glob( CLASSY_THEME_PATH . '/' . self::$folder . '/*/*.blade.php' );
62
+		$files = (array) glob(CLASSY_THEME_PATH.'/'.self::$folder.'/*/*.blade.php');
63 63
 
64
-		foreach ( $files as $filename ) {
64
+		foreach ($files as $filename) {
65 65
 
66
-			if ( ! empty( $filename ) ) {
66
+			if (!empty($filename)) {
67 67
 
68
-				if ( ! preg_match( '/\{\{\-\-\s*Template Name:(.*)\s*\-\-\}\}/mi', file_get_contents( $filename ), $header ) ) { continue; }
68
+				if (!preg_match('/\{\{\-\-\s*Template Name:(.*)\s*\-\-\}\}/mi', file_get_contents($filename), $header)) { continue; }
69 69
 
70
-				$template_name = trim( $header[1] );
70
+				$template_name = trim($header[1]);
71 71
 
72
-				preg_match( '/\/([^\/]*)\.blade.php$/is', $filename, $filename_match );
72
+				preg_match('/\/([^\/]*)\.blade.php$/is', $filename, $filename_match);
73 73
 
74
-				$template_file = 'classy-' . $filename_match[1];
74
+				$template_file = 'classy-'.$filename_match[1];
75 75
 
76
-				$templates[ $template_file ] = $template_name;
76
+				$templates[$template_file] = $template_name;
77 77
 
78 78
 			}
79 79
 		}
Please login to merge, or discard this patch.