@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | * Checks if view exists |
| 111 | 111 | * |
| 112 | 112 | * @param string $type view/scope |
| 113 | - * @param string $view in blade path format, ex: layout/header |
|
| 113 | + * @param string|false $file |
|
| 114 | 114 | * @return boolean true/false |
| 115 | 115 | */ |
| 116 | 116 | public static function file_exists( $type = 'view', $file ) { |
@@ -129,7 +129,8 @@ discard block |
||
| 129 | 129 | * |
| 130 | 130 | * @param string $type view/scope |
| 131 | 131 | * @param string $type |
| 132 | - * @return array |
|
| 132 | + * @param string $page |
|
| 133 | + * @return string|false |
|
| 133 | 134 | */ |
| 134 | 135 | public static function get_available_file( $type = 'view', $page ) { |
| 135 | 136 | |
@@ -370,7 +371,7 @@ discard block |
||
| 370 | 371 | /** |
| 371 | 372 | * Returns classy template name or boolean if this is not classy template |
| 372 | 373 | * |
| 373 | - * @return mixed |
|
| 374 | + * @return string|false |
|
| 374 | 375 | */ |
| 375 | 376 | public static function get_classy_template() { |
| 376 | 377 | |
@@ -20,39 +20,39 @@ discard block |
||
| 20 | 20 | */ |
| 21 | 21 | protected static function check_request() { |
| 22 | 22 | |
| 23 | - if ( is_404() ) : return '404'; |
|
| 23 | + if (is_404()) : return '404'; |
|
| 24 | 24 | |
| 25 | - elseif ( is_search() ) : return 'search'; |
|
| 25 | + elseif (is_search()) : return 'search'; |
|
| 26 | 26 | |
| 27 | - elseif ( is_front_page() ) : return 'front-page'; |
|
| 27 | + elseif (is_front_page()) : return 'front-page'; |
|
| 28 | 28 | |
| 29 | - elseif ( is_home() ) : return 'home'; |
|
| 29 | + elseif (is_home()) : return 'home'; |
|
| 30 | 30 | |
| 31 | - elseif ( is_post_type_archive() ) : return 'post_type_archive'; |
|
| 31 | + elseif (is_post_type_archive()) : return 'post_type_archive'; |
|
| 32 | 32 | |
| 33 | - elseif ( is_tax() ) : return 'taxonomy'; |
|
| 33 | + elseif (is_tax()) : return 'taxonomy'; |
|
| 34 | 34 | |
| 35 | - elseif ( is_attachment() ) : return 'attachment'; |
|
| 35 | + elseif (is_attachment()) : return 'attachment'; |
|
| 36 | 36 | |
| 37 | - elseif ( is_single() ) : return 'single'; |
|
| 37 | + elseif (is_single()) : return 'single'; |
|
| 38 | 38 | |
| 39 | - elseif ( self::is_classy_template() ) : return 'classy-template'; |
|
| 39 | + elseif (self::is_classy_template()) : return 'classy-template'; |
|
| 40 | 40 | |
| 41 | - elseif ( is_page() ) : return 'page'; |
|
| 41 | + elseif (is_page()) : return 'page'; |
|
| 42 | 42 | |
| 43 | - elseif ( is_singular() ) : return 'singular'; |
|
| 43 | + elseif (is_singular()) : return 'singular'; |
|
| 44 | 44 | |
| 45 | - elseif ( is_category() ) : return 'category'; |
|
| 45 | + elseif (is_category()) : return 'category'; |
|
| 46 | 46 | |
| 47 | - elseif ( is_tag() ) : return 'tag'; |
|
| 47 | + elseif (is_tag()) : return 'tag'; |
|
| 48 | 48 | |
| 49 | - elseif ( is_author() ) : return 'author'; |
|
| 49 | + elseif (is_author()) : return 'author'; |
|
| 50 | 50 | |
| 51 | - elseif ( is_date() ) : return 'date'; |
|
| 51 | + elseif (is_date()) : return 'date'; |
|
| 52 | 52 | |
| 53 | - elseif ( is_archive() ) : return 'archive'; |
|
| 53 | + elseif (is_archive()) : return 'archive'; |
|
| 54 | 54 | |
| 55 | - elseif ( is_paged() ) : return 'paged'; |
|
| 55 | + elseif (is_paged()) : return 'paged'; |
|
| 56 | 56 | |
| 57 | 57 | else : |
| 58 | 58 | |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | */ |
| 70 | 70 | public static function get_current_request() { |
| 71 | 71 | |
| 72 | - if ( null === self::$current_request ) { |
|
| 72 | + if (null === self::$current_request) { |
|
| 73 | 73 | |
| 74 | 74 | self::$current_request = self::check_request(); |
| 75 | 75 | |
@@ -87,19 +87,19 @@ discard block |
||
| 87 | 87 | * @param string $view path to view ex: "post/archive" |
| 88 | 88 | * @return string full fule path |
| 89 | 89 | */ |
| 90 | - public static function get_file_path( $type = 'view', $view ) { |
|
| 90 | + public static function get_file_path($type = 'view', $view) { |
|
| 91 | 91 | |
| 92 | - if ( 'view' == $type ) { |
|
| 92 | + if ('view' == $type) { |
|
| 93 | 93 | |
| 94 | 94 | $folder = ClassyView::$folder; |
| 95 | 95 | |
| 96 | - return THEME_PATH . $folder . '/' . $view . '.blade.php'; |
|
| 96 | + return THEME_PATH.$folder.'/'.$view.'.blade.php'; |
|
| 97 | 97 | |
| 98 | - } elseif ( 'scope' == $type ) { |
|
| 98 | + } elseif ('scope' == $type) { |
|
| 99 | 99 | |
| 100 | 100 | $folder = ClassyScope::$folder; |
| 101 | 101 | |
| 102 | - return THEME_PATH . $folder . '/' . $view . '.php'; |
|
| 102 | + return THEME_PATH.$folder.'/'.$view.'.php'; |
|
| 103 | 103 | |
| 104 | 104 | } |
| 105 | 105 | |
@@ -113,13 +113,13 @@ discard block |
||
| 113 | 113 | * @param string $view in blade path format, ex: layout/header |
| 114 | 114 | * @return boolean true/false |
| 115 | 115 | */ |
| 116 | - public static function file_exists( $type = 'view', $file ) { |
|
| 116 | + public static function file_exists($type = 'view', $file) { |
|
| 117 | 117 | |
| 118 | - $file = str_replace( '.', '/', $file ); |
|
| 118 | + $file = str_replace('.', '/', $file); |
|
| 119 | 119 | |
| 120 | - $file_path = self::get_file_path( $type, $file ); |
|
| 120 | + $file_path = self::get_file_path($type, $file); |
|
| 121 | 121 | |
| 122 | - return file_exists( $file_path ); |
|
| 122 | + return file_exists($file_path); |
|
| 123 | 123 | |
| 124 | 124 | } |
| 125 | 125 | |
@@ -131,13 +131,13 @@ discard block |
||
| 131 | 131 | * @param string $type |
| 132 | 132 | * @return array |
| 133 | 133 | */ |
| 134 | - public static function get_available_file( $type = 'view', $page ) { |
|
| 134 | + public static function get_available_file($type = 'view', $page) { |
|
| 135 | 135 | |
| 136 | - $views = self::get_request_hierarchy_list( $page ); |
|
| 136 | + $views = self::get_request_hierarchy_list($page); |
|
| 137 | 137 | |
| 138 | - foreach ( $views as $view ) { |
|
| 138 | + foreach ($views as $view) { |
|
| 139 | 139 | |
| 140 | - if ( self::file_exists( $type, $view ) ) : |
|
| 140 | + if (self::file_exists($type, $view)) : |
|
| 141 | 141 | |
| 142 | 142 | return $view; |
| 143 | 143 | |
@@ -156,43 +156,43 @@ discard block |
||
| 156 | 156 | * @param string $type |
| 157 | 157 | * @return array |
| 158 | 158 | */ |
| 159 | - private static function get_request_hierarchy_list( $type ) { |
|
| 159 | + private static function get_request_hierarchy_list($type) { |
|
| 160 | 160 | |
| 161 | 161 | $views = array(); |
| 162 | 162 | |
| 163 | 163 | // Home |
| 164 | 164 | |
| 165 | - if ( 'home' == $type ) : |
|
| 165 | + if ('home' == $type) : |
|
| 166 | 166 | |
| 167 | 167 | $views[] = 'home'; |
| 168 | 168 | |
| 169 | 169 | // Single |
| 170 | 170 | |
| 171 | - elseif ( 'single' == $type ) : |
|
| 171 | + elseif ('single' == $type) : |
|
| 172 | 172 | |
| 173 | 173 | $post_type = get_post_type(); |
| 174 | 174 | |
| 175 | - $views[] = $post_type . '.single'; |
|
| 175 | + $views[] = $post_type.'.single'; |
|
| 176 | 176 | |
| 177 | 177 | $views[] = 'single'; |
| 178 | 178 | |
| 179 | 179 | // Post type |
| 180 | 180 | |
| 181 | - elseif ( 'post_type_archive' == $type ) : |
|
| 181 | + elseif ('post_type_archive' == $type) : |
|
| 182 | 182 | |
| 183 | 183 | $post_type = get_post_type(); |
| 184 | 184 | |
| 185 | - $views[] = $post_type . '.archive'; |
|
| 185 | + $views[] = $post_type.'.archive'; |
|
| 186 | 186 | |
| 187 | 187 | $views[] = 'archive'; |
| 188 | 188 | |
| 189 | 189 | // Taxonomy |
| 190 | 190 | |
| 191 | - elseif ( 'taxonomy' == $type ) : |
|
| 191 | + elseif ('taxonomy' == $type) : |
|
| 192 | 192 | |
| 193 | 193 | $term = get_queried_object(); |
| 194 | 194 | |
| 195 | - if ( ! empty( $term->slug ) ) { |
|
| 195 | + if (!empty($term->slug)) { |
|
| 196 | 196 | |
| 197 | 197 | $taxonomy = $term->taxonomy; |
| 198 | 198 | |
@@ -207,11 +207,11 @@ discard block |
||
| 207 | 207 | |
| 208 | 208 | // Category |
| 209 | 209 | |
| 210 | - elseif ( 'category' == $type ) : |
|
| 210 | + elseif ('category' == $type) : |
|
| 211 | 211 | |
| 212 | 212 | $category = get_queried_object(); |
| 213 | 213 | |
| 214 | - if ( ! empty( $category->slug ) ) { |
|
| 214 | + if (!empty($category->slug)) { |
|
| 215 | 215 | $views[] = "category.{$category->slug}"; |
| 216 | 216 | $views[] = "category.{$category->term_id}"; |
| 217 | 217 | } |
@@ -222,23 +222,23 @@ discard block |
||
| 222 | 222 | |
| 223 | 223 | // Attachment |
| 224 | 224 | |
| 225 | - elseif ( 'attachment' == $type ) : |
|
| 225 | + elseif ('attachment' == $type) : |
|
| 226 | 226 | |
| 227 | 227 | $attachment = get_queried_object(); |
| 228 | 228 | |
| 229 | - if ( $attachment ) { |
|
| 229 | + if ($attachment) { |
|
| 230 | 230 | |
| 231 | - if ( false !== strpos( $attachment->post_mime_type, '/' ) ) { |
|
| 231 | + if (false !== strpos($attachment->post_mime_type, '/')) { |
|
| 232 | 232 | |
| 233 | - list( $type, $subtype ) = explode( '/', $attachment->post_mime_type ); |
|
| 233 | + list($type, $subtype) = explode('/', $attachment->post_mime_type); |
|
| 234 | 234 | |
| 235 | 235 | } else { |
| 236 | 236 | |
| 237 | - list( $type, $subtype ) = array( $attachment->post_mime_type, '' ); |
|
| 237 | + list($type, $subtype) = array($attachment->post_mime_type, ''); |
|
| 238 | 238 | |
| 239 | 239 | } |
| 240 | 240 | |
| 241 | - if ( ! empty( $subtype ) ) { |
|
| 241 | + if (!empty($subtype)) { |
|
| 242 | 242 | $views[] = "attachment.{$type}.{$subtype}"; |
| 243 | 243 | $views[] = "attachment.{$subtype}"; |
| 244 | 244 | |
@@ -257,11 +257,11 @@ discard block |
||
| 257 | 257 | |
| 258 | 258 | // Tag |
| 259 | 259 | |
| 260 | - elseif ( 'tag' == $type ) : |
|
| 260 | + elseif ('tag' == $type) : |
|
| 261 | 261 | |
| 262 | 262 | $tag = get_queried_object(); |
| 263 | 263 | |
| 264 | - if ( ! empty( $tag->slug ) ) { |
|
| 264 | + if (!empty($tag->slug)) { |
|
| 265 | 265 | $views[] = "post.tag.{$tag->slug}"; |
| 266 | 266 | $views[] = "post.tag.{$tag->term_id}"; |
| 267 | 267 | |
@@ -274,11 +274,11 @@ discard block |
||
| 274 | 274 | |
| 275 | 275 | // Author |
| 276 | 276 | |
| 277 | - elseif ( 'author' == $type ) : |
|
| 277 | + elseif ('author' == $type) : |
|
| 278 | 278 | |
| 279 | 279 | $author = get_queried_object(); |
| 280 | 280 | |
| 281 | - if ( $author instanceof WP_User ) { |
|
| 281 | + if ($author instanceof WP_User) { |
|
| 282 | 282 | $views[] = "post.author.{$author->user_nicename}"; |
| 283 | 283 | $views[] = "post.author.{$author->ID}"; |
| 284 | 284 | |
@@ -292,7 +292,7 @@ discard block |
||
| 292 | 292 | |
| 293 | 293 | // Front Page |
| 294 | 294 | |
| 295 | - elseif ( 'front-page' == $type ) : |
|
| 295 | + elseif ('front-page' == $type) : |
|
| 296 | 296 | |
| 297 | 297 | $views[] = 'front-page.front-page'; |
| 298 | 298 | $views[] = 'front-page'; |
@@ -300,41 +300,41 @@ discard block |
||
| 300 | 300 | $views[] = 'home.home'; |
| 301 | 301 | $views[] = 'home'; |
| 302 | 302 | |
| 303 | - $views = array_merge( $views, self::get_request_hierarchy_list( 'post_type_archive' ) ); |
|
| 303 | + $views = array_merge($views, self::get_request_hierarchy_list('post_type_archive')); |
|
| 304 | 304 | |
| 305 | 305 | // Page |
| 306 | 306 | |
| 307 | - elseif ( 'classy-template' == $type ) : |
|
| 307 | + elseif ('classy-template' == $type) : |
|
| 308 | 308 | |
| 309 | 309 | $template = self::get_classy_template(); |
| 310 | 310 | |
| 311 | 311 | $views[] = $template; |
| 312 | 312 | |
| 313 | - $views[] = 'page.' . $template; |
|
| 313 | + $views[] = 'page.'.$template; |
|
| 314 | 314 | |
| 315 | - $views[] = 'template.' . $template; |
|
| 315 | + $views[] = 'template.'.$template; |
|
| 316 | 316 | |
| 317 | - elseif ( 'page' == $type ) : |
|
| 317 | + elseif ('page' == $type) : |
|
| 318 | 318 | |
| 319 | 319 | $id = get_queried_object_id(); |
| 320 | 320 | |
| 321 | - $pagename = get_query_var( 'pagename' ); |
|
| 321 | + $pagename = get_query_var('pagename'); |
|
| 322 | 322 | |
| 323 | - if ( ! $pagename && $id ) { |
|
| 323 | + if (!$pagename && $id) { |
|
| 324 | 324 | // If a static page is set as the front page, $pagename will not be set. Retrieve it from the queried object |
| 325 | 325 | $post = get_queried_object(); |
| 326 | 326 | |
| 327 | - if ( $post ) { |
|
| 327 | + if ($post) { |
|
| 328 | 328 | $pagename = $post->post_name; |
| 329 | 329 | } |
| 330 | 330 | } |
| 331 | 331 | |
| 332 | - if ( $pagename ) { |
|
| 333 | - $views[] = 'page.' . $pagename; |
|
| 332 | + if ($pagename) { |
|
| 333 | + $views[] = 'page.'.$pagename; |
|
| 334 | 334 | } |
| 335 | 335 | |
| 336 | - if ( $id ) { |
|
| 337 | - $views[] = 'page.' . $id; |
|
| 336 | + if ($id) { |
|
| 337 | + $views[] = 'page.'.$id; |
|
| 338 | 338 | } |
| 339 | 339 | |
| 340 | 340 | $views[] = 'page.page'; |
@@ -376,9 +376,9 @@ discard block |
||
| 376 | 376 | |
| 377 | 377 | $template_slug = get_page_template_slug(); |
| 378 | 378 | |
| 379 | - preg_match( '/classy\-(.*)/', $template_slug, $matches ); |
|
| 379 | + preg_match('/classy\-(.*)/', $template_slug, $matches); |
|
| 380 | 380 | |
| 381 | - if ( $matches && isset( $matches[1] ) ) { return $matches[1]; } |
|
| 381 | + if ($matches && isset($matches[1])) { return $matches[1]; } |
|
| 382 | 382 | |
| 383 | 383 | return false; |
| 384 | 384 | |
@@ -1,1 +1,1 @@ |
||
| 1 | -<?php Classy::render( 'layout.footer' ); ?> |
|
| 2 | 1 | \ No newline at end of file |
| 2 | +<?php Classy::render('layout.footer'); ?> |
|
| 3 | 3 | \ No newline at end of file |
@@ -73,12 +73,12 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 | |
@@ -138,11 +138,11 @@ discard block |
||
| 138 | 138 | * @return ClassyImage |
| 139 | 139 | */ |
| 140 | 140 | public function get_thumbnail() { |
| 141 | - if ( function_exists( 'get_post_thumbnail_id' ) ) { |
|
| 142 | - $image_id = get_post_thumbnail_id( $this->ID ); |
|
| 141 | + if (function_exists('get_post_thumbnail_id')) { |
|
| 142 | + $image_id = get_post_thumbnail_id($this->ID); |
|
| 143 | 143 | |
| 144 | - if ( $image_id ) { |
|
| 145 | - return new ClassyImage( $image_id ); |
|
| 144 | + if ($image_id) { |
|
| 145 | + return new ClassyImage($image_id); |
|
| 146 | 146 | } |
| 147 | 147 | } |
| 148 | 148 | } |
@@ -154,7 +154,7 @@ discard block |
||
| 154 | 154 | * @return string |
| 155 | 155 | */ |
| 156 | 156 | public function get_title() { |
| 157 | - return apply_filters( 'the_title', $this->post_title, $this->ID ); |
|
| 157 | + return apply_filters('the_title', $this->post_title, $this->ID); |
|
| 158 | 158 | } |
| 159 | 159 | |
| 160 | 160 | /** |
@@ -173,24 +173,24 @@ discard block |
||
| 173 | 173 | * @param integer $page Page number, in case our post has <!--nextpage--> tags |
| 174 | 174 | * @return string Post content |
| 175 | 175 | */ |
| 176 | - public function get_content( $page = 0 ) { |
|
| 177 | - if ( 0 == $page && $this->post_content ) { |
|
| 176 | + public function get_content($page = 0) { |
|
| 177 | + if (0 == $page && $this->post_content) { |
|
| 178 | 178 | return $this->post_content; |
| 179 | 179 | } |
| 180 | 180 | |
| 181 | 181 | $content = $this->post_content; |
| 182 | 182 | |
| 183 | - if ( $page ) { |
|
| 184 | - $contents = explode( '<!--nextpage-->', $content ); |
|
| 183 | + if ($page) { |
|
| 184 | + $contents = explode('<!--nextpage-->', $content); |
|
| 185 | 185 | |
| 186 | 186 | $page--; |
| 187 | 187 | |
| 188 | - if ( count( $contents ) > $page ) { |
|
| 189 | - $content = $contents[ $page ]; |
|
| 188 | + if (count($contents) > $page) { |
|
| 189 | + $content = $contents[$page]; |
|
| 190 | 190 | } |
| 191 | 191 | } |
| 192 | 192 | |
| 193 | - $content = apply_filters( 'the_content', ($content) ); |
|
| 193 | + $content = apply_filters('the_content', ($content)); |
|
| 194 | 194 | |
| 195 | 195 | return $content; |
| 196 | 196 | } |
@@ -211,7 +211,7 @@ discard block |
||
| 211 | 211 | * @return object |
| 212 | 212 | */ |
| 213 | 213 | public function get_post_type() { |
| 214 | - return get_post_type_object( $this->post_type ); |
|
| 214 | + return get_post_type_object($this->post_type); |
|
| 215 | 215 | } |
| 216 | 216 | |
| 217 | 217 | /** |
@@ -220,11 +220,11 @@ discard block |
||
| 220 | 220 | * @return string |
| 221 | 221 | */ |
| 222 | 222 | public function get_permalink() { |
| 223 | - if ( isset( $this->permalink ) ) { |
|
| 223 | + if (isset($this->permalink)) { |
|
| 224 | 224 | return $this->permalink; |
| 225 | 225 | } |
| 226 | 226 | |
| 227 | - $this->permalink = get_permalink( $this->ID ); |
|
| 227 | + $this->permalink = get_permalink($this->ID); |
|
| 228 | 228 | |
| 229 | 229 | return $this->permalink; |
| 230 | 230 | } |
@@ -250,91 +250,91 @@ discard block |
||
| 250 | 250 | * @param boolean $strip Should we strip tags? |
| 251 | 251 | * @return string Post preview |
| 252 | 252 | */ |
| 253 | - public function get_preview( $len = 50, $force = false, $readmore = 'Read More', $strip = true ) { |
|
| 253 | + public function get_preview($len = 50, $force = false, $readmore = 'Read More', $strip = true) { |
|
| 254 | 254 | $text = ''; |
| 255 | 255 | $trimmed = false; |
| 256 | 256 | |
| 257 | - if ( isset( $this->post_excerpt ) && strlen( $this->post_excerpt ) ) { |
|
| 257 | + if (isset($this->post_excerpt) && strlen($this->post_excerpt)) { |
|
| 258 | 258 | |
| 259 | - if ( $force ) { |
|
| 260 | - $text = ClassyHelper::trim_words( $this->post_excerpt, $len, false ); |
|
| 259 | + if ($force) { |
|
| 260 | + $text = ClassyHelper::trim_words($this->post_excerpt, $len, false); |
|
| 261 | 261 | $trimmed = true; |
| 262 | 262 | } else { |
| 263 | 263 | $text = $this->post_excerpt; |
| 264 | 264 | } |
| 265 | 265 | } |
| 266 | 266 | |
| 267 | - if ( ! strlen( $text ) && preg_match( '/<!--\s?more(.*?)?-->/', $this->post_content, $readmore_matches ) ) { |
|
| 267 | + if (!strlen($text) && preg_match('/<!--\s?more(.*?)?-->/', $this->post_content, $readmore_matches)) { |
|
| 268 | 268 | |
| 269 | - $pieces = explode( $readmore_matches[0], $this->post_content ); |
|
| 269 | + $pieces = explode($readmore_matches[0], $this->post_content); |
|
| 270 | 270 | $text = $pieces[0]; |
| 271 | 271 | |
| 272 | - if ( $force ) { |
|
| 273 | - $text = ClassyHelper::trim_words( $text, $len, false ); |
|
| 272 | + if ($force) { |
|
| 273 | + $text = ClassyHelper::trim_words($text, $len, false); |
|
| 274 | 274 | $trimmed = true; |
| 275 | 275 | } |
| 276 | 276 | |
| 277 | - $text = do_shortcode( $text ); |
|
| 277 | + $text = do_shortcode($text); |
|
| 278 | 278 | |
| 279 | 279 | } |
| 280 | 280 | |
| 281 | - if ( ! strlen( $text ) ) { |
|
| 281 | + if (!strlen($text)) { |
|
| 282 | 282 | |
| 283 | - $text = ClassyHelper::trim_words( $this->get_content(), $len, false ); |
|
| 283 | + $text = ClassyHelper::trim_words($this->get_content(), $len, false); |
|
| 284 | 284 | $trimmed = true; |
| 285 | 285 | |
| 286 | 286 | } |
| 287 | 287 | |
| 288 | - if ( ! strlen( trim( $text ) ) ) { |
|
| 288 | + if (!strlen(trim($text))) { |
|
| 289 | 289 | |
| 290 | - return trim( $text ); |
|
| 290 | + return trim($text); |
|
| 291 | 291 | |
| 292 | 292 | } |
| 293 | 293 | |
| 294 | - if ( $strip ) { |
|
| 294 | + if ($strip) { |
|
| 295 | 295 | |
| 296 | - $text = trim( strip_tags( $text ) ); |
|
| 296 | + $text = trim(strip_tags($text)); |
|
| 297 | 297 | |
| 298 | 298 | } |
| 299 | 299 | |
| 300 | - if ( strlen( $text ) ) { |
|
| 300 | + if (strlen($text)) { |
|
| 301 | 301 | |
| 302 | - $text = trim( $text ); |
|
| 303 | - $last = $text[ strlen( $text ) - 1 ]; |
|
| 302 | + $text = trim($text); |
|
| 303 | + $last = $text[strlen($text) - 1]; |
|
| 304 | 304 | |
| 305 | - if ( '.' != $last && $trimmed ) { |
|
| 305 | + if ('.' != $last && $trimmed) { |
|
| 306 | 306 | $text .= ' … '; |
| 307 | 307 | } |
| 308 | 308 | |
| 309 | - if ( ! $strip ) { |
|
| 310 | - $last_p_tag = strrpos( $text, '</p>' ); |
|
| 311 | - if ( false !== $last_p_tag ) { |
|
| 312 | - $text = substr( $text, 0, $last_p_tag ); |
|
| 309 | + if (!$strip) { |
|
| 310 | + $last_p_tag = strrpos($text, '</p>'); |
|
| 311 | + if (false !== $last_p_tag) { |
|
| 312 | + $text = substr($text, 0, $last_p_tag); |
|
| 313 | 313 | } |
| 314 | - if ( '.' != $last && $trimmed ) { |
|
| 314 | + if ('.' != $last && $trimmed) { |
|
| 315 | 315 | $text .= ' … '; |
| 316 | 316 | } |
| 317 | 317 | } |
| 318 | 318 | |
| 319 | - if ( $readmore && isset( $readmore_matches ) && ! empty( $readmore_matches[1] ) ) { |
|
| 320 | - $text .= ' <a href="' . $this->get_permalink() . '" class="read-more">' . trim( $readmore_matches[1] ) . '</a>'; |
|
| 321 | - } elseif ( $readmore ) { |
|
| 322 | - $text .= ' <a href="' . $this->get_permalink() . '" class="read-more">' . trim( $readmore ) . '</a>'; |
|
| 319 | + if ($readmore && isset($readmore_matches) && !empty($readmore_matches[1])) { |
|
| 320 | + $text .= ' <a href="'.$this->get_permalink().'" class="read-more">'.trim($readmore_matches[1]).'</a>'; |
|
| 321 | + } elseif ($readmore) { |
|
| 322 | + $text .= ' <a href="'.$this->get_permalink().'" class="read-more">'.trim($readmore).'</a>'; |
|
| 323 | 323 | } |
| 324 | 324 | |
| 325 | - if ( ! $strip ) { |
|
| 325 | + if (!$strip) { |
|
| 326 | 326 | $text .= '</p>'; |
| 327 | 327 | } |
| 328 | 328 | } |
| 329 | 329 | |
| 330 | - return trim( $text ); |
|
| 330 | + return trim($text); |
|
| 331 | 331 | } |
| 332 | 332 | |
| 333 | 333 | /** |
| 334 | 334 | * Returns comments array |
| 335 | 335 | * @return array |
| 336 | 336 | */ |
| 337 | - public function get_comments( $status = 'approve', $order = 'DESC' ) { |
|
| 337 | + public function get_comments($status = 'approve', $order = 'DESC') { |
|
| 338 | 338 | |
| 339 | 339 | $_return = array(); |
| 340 | 340 | |
@@ -344,26 +344,26 @@ discard block |
||
| 344 | 344 | 'order' => $order, |
| 345 | 345 | ); |
| 346 | 346 | |
| 347 | - $comments = get_comments( $args ); |
|
| 347 | + $comments = get_comments($args); |
|
| 348 | 348 | |
| 349 | - foreach ( $comments as $comment ) { |
|
| 349 | + foreach ($comments as $comment) { |
|
| 350 | 350 | |
| 351 | - $_return[ $comment->comment_ID ] = new ClassyComment( $comment ); |
|
| 351 | + $_return[$comment->comment_ID] = new ClassyComment($comment); |
|
| 352 | 352 | |
| 353 | 353 | } |
| 354 | 354 | |
| 355 | - foreach ( $_return as $key => $comment ) { |
|
| 355 | + foreach ($_return as $key => $comment) { |
|
| 356 | 356 | |
| 357 | - if ( $comment->has_parent() ) { |
|
| 357 | + if ($comment->has_parent()) { |
|
| 358 | 358 | |
| 359 | - $_return[ $comment->comment_parent ]->add_child( $comment ); |
|
| 359 | + $_return[$comment->comment_parent]->add_child($comment); |
|
| 360 | 360 | |
| 361 | - unset( $_return[ $key ] ); |
|
| 361 | + unset($_return[$key]); |
|
| 362 | 362 | |
| 363 | 363 | } |
| 364 | 364 | } |
| 365 | 365 | |
| 366 | - return array_values( $_return ); |
|
| 366 | + return array_values($_return); |
|
| 367 | 367 | |
| 368 | 368 | } |
| 369 | 369 | } |
@@ -60,13 +60,13 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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; |
@@ -13,6 +13,6 @@ |
||
| 13 | 13 | * Main constructor function. Requires image id |
| 14 | 14 | * @param int $pid |
| 15 | 15 | */ |
| 16 | - public function __construct( $pid = null ) { |
|
| 16 | + public function __construct($pid = null) { |
|
| 17 | 17 | } |
| 18 | 18 | } |
@@ -8,23 +8,23 @@ discard block |
||
| 8 | 8 | * @param array/boolean $args |
| 9 | 9 | * @return object WP_Query |
| 10 | 10 | */ |
| 11 | - public static function find_query( $args = false ) { |
|
| 11 | + public static function find_query($args = false) { |
|
| 12 | 12 | |
| 13 | 13 | $default_args = array(); |
| 14 | 14 | |
| 15 | - if ( ! $args ) { |
|
| 15 | + if (!$args) { |
|
| 16 | 16 | |
| 17 | 17 | return self::get_current_query(); |
| 18 | 18 | |
| 19 | - } elseif ( is_array( $args ) ) { |
|
| 19 | + } elseif (is_array($args)) { |
|
| 20 | 20 | |
| 21 | - $args = array_merge( $default_args, $args ); |
|
| 21 | + $args = array_merge($default_args, $args); |
|
| 22 | 22 | |
| 23 | - return new WP_Query( $args ); |
|
| 23 | + return new WP_Query($args); |
|
| 24 | 24 | |
| 25 | 25 | } else { |
| 26 | 26 | |
| 27 | - return new WP_Query( $default_args ); |
|
| 27 | + return new WP_Query($default_args); |
|
| 28 | 28 | |
| 29 | 29 | } |
| 30 | 30 | } |
@@ -38,9 +38,9 @@ discard block |
||
| 38 | 38 | |
| 39 | 39 | global $wp_query; |
| 40 | 40 | |
| 41 | - $query =& $wp_query; |
|
| 41 | + $query = & $wp_query; |
|
| 42 | 42 | |
| 43 | - $query = self::handle_maybe_custom_posts_page( $query ); |
|
| 43 | + $query = self::handle_maybe_custom_posts_page($query); |
|
| 44 | 44 | |
| 45 | 45 | return $query; |
| 46 | 46 | |
@@ -52,13 +52,13 @@ discard block |
||
| 52 | 52 | * @param object $query WP_Query |
| 53 | 53 | * @return object WP_Query |
| 54 | 54 | */ |
| 55 | - private static function handle_maybe_custom_posts_page( $query ) { |
|
| 55 | + private static function handle_maybe_custom_posts_page($query) { |
|
| 56 | 56 | |
| 57 | - if ( $custom_posts_page = get_option( 'page_for_posts' ) ) { |
|
| 57 | + if ($custom_posts_page = get_option('page_for_posts')) { |
|
| 58 | 58 | |
| 59 | - if ( isset( $query->query['p'] ) && $query->query['p'] == $custom_posts_page ) { |
|
| 59 | + if (isset($query->query['p']) && $query->query['p'] == $custom_posts_page) { |
|
| 60 | 60 | |
| 61 | - return new WP_Query( array( 'post_type' => 'post' ) ); |
|
| 61 | + return new WP_Query(array('post_type' => 'post')); |
|
| 62 | 62 | |
| 63 | 63 | } |
| 64 | 64 | } |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | */ |
| 30 | 30 | public static function get_instance() { |
| 31 | 31 | |
| 32 | - if ( null === self::$single_instance ) { |
|
| 32 | + if (null === self::$single_instance) { |
|
| 33 | 33 | |
| 34 | 34 | self::$single_instance = new self(); |
| 35 | 35 | |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | |
| 57 | 57 | $this->init_config(); |
| 58 | 58 | |
| 59 | - add_filter( 'theme_page_templates', array( $this, 'filter_templates' ), 3 ); |
|
| 59 | + add_filter('theme_page_templates', array($this, 'filter_templates'), 3); |
|
| 60 | 60 | |
| 61 | 61 | } |
| 62 | 62 | |
@@ -66,11 +66,11 @@ discard block |
||
| 66 | 66 | * @param string |
| 67 | 67 | * @param string |
| 68 | 68 | */ |
| 69 | - private function define( $name, $value ) { |
|
| 69 | + private function define($name, $value) { |
|
| 70 | 70 | |
| 71 | - if ( ! defined( $name ) ) { |
|
| 71 | + if (!defined($name)) { |
|
| 72 | 72 | |
| 73 | - define( $name, $value ); |
|
| 73 | + define($name, $value); |
|
| 74 | 74 | |
| 75 | 75 | } |
| 76 | 76 | |
@@ -86,13 +86,13 @@ discard block |
||
| 86 | 86 | |
| 87 | 87 | $theme = wp_get_theme(); |
| 88 | 88 | |
| 89 | - $this->define( 'THEME', $theme->template ); |
|
| 90 | - $this->define( 'THEME_NAME', $theme->get( 'Name' ) ); |
|
| 91 | - $this->define( 'THEME_PATH', get_template_directory() . '/' ); |
|
| 92 | - $this->define( 'THEME_DIR', get_template_directory_uri() . '/' ); |
|
| 93 | - $this->define( 'THEME_VERSION', $theme->get( 'Version' ) ); |
|
| 94 | - $this->define( 'THEME_FRAMEWORK_PATH', THEME_PATH . 'app/' ); |
|
| 95 | - $this->define( 'THEME_FRAMEWORK_DIR', THEME_DIR . 'app/' ); |
|
| 89 | + $this->define('THEME', $theme->template); |
|
| 90 | + $this->define('THEME_NAME', $theme->get('Name')); |
|
| 91 | + $this->define('THEME_PATH', get_template_directory().'/'); |
|
| 92 | + $this->define('THEME_DIR', get_template_directory_uri().'/'); |
|
| 93 | + $this->define('THEME_VERSION', $theme->get('Version')); |
|
| 94 | + $this->define('THEME_FRAMEWORK_PATH', THEME_PATH.'app/'); |
|
| 95 | + $this->define('THEME_FRAMEWORK_DIR', THEME_DIR.'app/'); |
|
| 96 | 96 | |
| 97 | 97 | } |
| 98 | 98 | |
@@ -101,40 +101,40 @@ discard block |
||
| 101 | 101 | */ |
| 102 | 102 | private function include_core_files() { |
| 103 | 103 | |
| 104 | - require_once THEME_PATH . 'vendor/autoload.php'; |
|
| 104 | + require_once THEME_PATH.'vendor/autoload.php'; |
|
| 105 | 105 | |
| 106 | 106 | // Basis Class |
| 107 | - require_once THEME_FRAMEWORK_PATH . 'classy/classy-basis.php'; |
|
| 107 | + require_once THEME_FRAMEWORK_PATH.'classy/classy-basis.php'; |
|
| 108 | 108 | |
| 109 | 109 | // Hierarchy |
| 110 | - require_once THEME_FRAMEWORK_PATH . 'classy/classy-hierarchy.php'; |
|
| 110 | + require_once THEME_FRAMEWORK_PATH.'classy/classy-hierarchy.php'; |
|
| 111 | 111 | |
| 112 | 112 | // Theme Config |
| 113 | - require_once THEME_FRAMEWORK_PATH . 'classy/classy-config.php'; |
|
| 113 | + require_once THEME_FRAMEWORK_PATH.'classy/classy-config.php'; |
|
| 114 | 114 | |
| 115 | 115 | // Scope |
| 116 | - require_once THEME_FRAMEWORK_PATH . 'classy/classy-scope.php'; |
|
| 116 | + require_once THEME_FRAMEWORK_PATH.'classy/classy-scope.php'; |
|
| 117 | 117 | |
| 118 | 118 | // View Loader |
| 119 | - require_once THEME_FRAMEWORK_PATH . 'classy/classy-view.php'; |
|
| 119 | + require_once THEME_FRAMEWORK_PATH.'classy/classy-view.php'; |
|
| 120 | 120 | |
| 121 | 121 | // Helper functions |
| 122 | - require_once THEME_FRAMEWORK_PATH . 'classy/classy-helper.php'; |
|
| 122 | + require_once THEME_FRAMEWORK_PATH.'classy/classy-helper.php'; |
|
| 123 | 123 | |
| 124 | 124 | // Query Helper |
| 125 | - require_once THEME_FRAMEWORK_PATH . 'classy/classy-query-helper.php'; |
|
| 125 | + require_once THEME_FRAMEWORK_PATH.'classy/classy-query-helper.php'; |
|
| 126 | 126 | |
| 127 | 127 | // Menu |
| 128 | - require_once THEME_FRAMEWORK_PATH . 'classy/classy-menu.php'; |
|
| 128 | + require_once THEME_FRAMEWORK_PATH.'classy/classy-menu.php'; |
|
| 129 | 129 | |
| 130 | 130 | // Menu Item |
| 131 | - require_once THEME_FRAMEWORK_PATH . 'classy/classy-menu-item.php'; |
|
| 131 | + require_once THEME_FRAMEWORK_PATH.'classy/classy-menu-item.php'; |
|
| 132 | 132 | |
| 133 | 133 | // Comment |
| 134 | - require_once THEME_FRAMEWORK_PATH . 'classy/classy-comment.php'; |
|
| 134 | + require_once THEME_FRAMEWORK_PATH.'classy/classy-comment.php'; |
|
| 135 | 135 | |
| 136 | 136 | // Appearance |
| 137 | - require_once THEME_FRAMEWORK_PATH . 'appearance.php'; |
|
| 137 | + require_once THEME_FRAMEWORK_PATH.'appearance.php'; |
|
| 138 | 138 | |
| 139 | 139 | } |
| 140 | 140 | |
@@ -143,11 +143,11 @@ discard block |
||
| 143 | 143 | */ |
| 144 | 144 | private function include_models() { |
| 145 | 145 | |
| 146 | - $files = (array) glob( THEME_FRAMEWORK_PATH . '/models/*.php' ); |
|
| 146 | + $files = (array) glob(THEME_FRAMEWORK_PATH.'/models/*.php'); |
|
| 147 | 147 | |
| 148 | - foreach ( $files as $filename ) { |
|
| 148 | + foreach ($files as $filename) { |
|
| 149 | 149 | |
| 150 | - if ( ! empty( $filename ) ) { |
|
| 150 | + if (!empty($filename)) { |
|
| 151 | 151 | |
| 152 | 152 | require_once $filename; |
| 153 | 153 | |
@@ -171,11 +171,11 @@ discard block |
||
| 171 | 171 | * @return array |
| 172 | 172 | */ |
| 173 | 173 | |
| 174 | - public function filter_templates( $page_templates = array(), $object = null, $post = null ) { |
|
| 174 | + public function filter_templates($page_templates = array(), $object = null, $post = null) { |
|
| 175 | 175 | |
| 176 | 176 | $custom_templates = ClassyView::get_page_templates_list(); |
| 177 | 177 | |
| 178 | - return array_merge( $page_templates, $custom_templates ); |
|
| 178 | + return array_merge($page_templates, $custom_templates); |
|
| 179 | 179 | |
| 180 | 180 | } |
| 181 | 181 | |
@@ -185,11 +185,11 @@ discard block |
||
| 185 | 185 | * @param string $name |
| 186 | 186 | * @return any |
| 187 | 187 | */ |
| 188 | - public static function get_config_var( $name ) { |
|
| 188 | + public static function get_config_var($name) { |
|
| 189 | 189 | |
| 190 | 190 | $vars = ClassyConfig::get_vars(); |
| 191 | 191 | |
| 192 | - if ( isset( $vars[ $name ] ) ) { return $vars[ $name ]; } |
|
| 192 | + if (isset($vars[$name])) { return $vars[$name]; } |
|
| 193 | 193 | |
| 194 | 194 | return false; |
| 195 | 195 | |
@@ -202,7 +202,7 @@ discard block |
||
| 202 | 202 | */ |
| 203 | 203 | public static function textdomain() { |
| 204 | 204 | |
| 205 | - $textdomain = Classy::get_config_var( 'textdomain' ); |
|
| 205 | + $textdomain = Classy::get_config_var('textdomain'); |
|
| 206 | 206 | |
| 207 | 207 | return $textdomain ? $textdomain : THEME; |
| 208 | 208 | |
@@ -217,17 +217,17 @@ discard block |
||
| 217 | 217 | * @param array|null $data Additional params |
| 218 | 218 | * @return void |
| 219 | 219 | */ |
| 220 | - public static function render( $view = null, $data = null ) { |
|
| 220 | + public static function render($view = null, $data = null) { |
|
| 221 | 221 | |
| 222 | - $views = THEME_PATH . ClassyView::$folder; |
|
| 223 | - $cache = WP_CONTENT_DIR . '/viewcache'; |
|
| 222 | + $views = THEME_PATH.ClassyView::$folder; |
|
| 223 | + $cache = WP_CONTENT_DIR.'/viewcache'; |
|
| 224 | 224 | $common_scope = ClassyScope::get_common_scope(); |
| 225 | 225 | |
| 226 | - if ( null !== $view && is_string( $view ) ) { |
|
| 226 | + if (null !== $view && is_string($view)) { |
|
| 227 | 227 | |
| 228 | - if ( $data && is_array( $data ) ) { |
|
| 228 | + if ($data && is_array($data)) { |
|
| 229 | 229 | |
| 230 | - $scope = array_merge( $common_scope, $data ); |
|
| 230 | + $scope = array_merge($common_scope, $data); |
|
| 231 | 231 | |
| 232 | 232 | } else { |
| 233 | 233 | |
@@ -242,9 +242,9 @@ discard block |
||
| 242 | 242 | |
| 243 | 243 | } |
| 244 | 244 | |
| 245 | - $renderer = new BladeRenderer( $views, array( 'cache_path' => $cache ) ); |
|
| 245 | + $renderer = new BladeRenderer($views, array('cache_path' => $cache)); |
|
| 246 | 246 | |
| 247 | - echo $renderer->render( $view, $scope ); |
|
| 247 | + echo $renderer->render($view, $scope); |
|
| 248 | 248 | |
| 249 | 249 | } |
| 250 | 250 | |
@@ -269,21 +269,21 @@ discard block |
||
| 269 | 269 | * @param string $return_type ClassyPost/object/id |
| 270 | 270 | * @return mixed |
| 271 | 271 | */ |
| 272 | - public static function get_posts( $args = false, $return_type = 'ClassyPost' ) { |
|
| 272 | + public static function get_posts($args = false, $return_type = 'ClassyPost') { |
|
| 273 | 273 | |
| 274 | 274 | $_return = array(); |
| 275 | 275 | |
| 276 | - $query = ClassyQueryHelper::find_query( $args ); |
|
| 276 | + $query = ClassyQueryHelper::find_query($args); |
|
| 277 | 277 | |
| 278 | - if ( isset( $query->posts ) ) { |
|
| 278 | + if (isset($query->posts)) { |
|
| 279 | 279 | |
| 280 | - foreach ( $query->posts as $post ) { |
|
| 280 | + foreach ($query->posts as $post) { |
|
| 281 | 281 | |
| 282 | - if ( 'ClassyPost' == $return_type ) { |
|
| 282 | + if ('ClassyPost' == $return_type) { |
|
| 283 | 283 | |
| 284 | - $_return[] = new ClassyPost( $post ); |
|
| 284 | + $_return[] = new ClassyPost($post); |
|
| 285 | 285 | |
| 286 | - } elseif ( 'id' == $return_type ) { |
|
| 286 | + } elseif ('id' == $return_type) { |
|
| 287 | 287 | |
| 288 | 288 | $_return[] = $post->id; |
| 289 | 289 | |
@@ -305,11 +305,11 @@ discard block |
||
| 305 | 305 | * @param string $return_type ClassyPost/object/id |
| 306 | 306 | * @return mixed |
| 307 | 307 | */ |
| 308 | - public static function get_post( $args = false, $return_type = 'ClassyPost' ) { |
|
| 308 | + public static function get_post($args = false, $return_type = 'ClassyPost') { |
|
| 309 | 309 | |
| 310 | - $posts = self::get_posts( $args, $return_type ); |
|
| 310 | + $posts = self::get_posts($args, $return_type); |
|
| 311 | 311 | |
| 312 | - if ( $post = reset( $posts ) ) { |
|
| 312 | + if ($post = reset($posts)) { |
|
| 313 | 313 | return $post; |
| 314 | 314 | } |
| 315 | 315 | |
@@ -319,62 +319,62 @@ discard block |
||
| 319 | 319 | * @param array $prefs |
| 320 | 320 | * @return array mixed |
| 321 | 321 | */ |
| 322 | - public static function get_pagination( $prefs = array() ) { |
|
| 322 | + public static function get_pagination($prefs = array()) { |
|
| 323 | 323 | |
| 324 | 324 | global $wp_query; |
| 325 | 325 | global $paged; |
| 326 | 326 | global $wp_rewrite; |
| 327 | 327 | |
| 328 | 328 | $args = array(); |
| 329 | - $args['total'] = ceil( $wp_query->found_posts / $wp_query->query_vars['posts_per_page'] ); |
|
| 329 | + $args['total'] = ceil($wp_query->found_posts / $wp_query->query_vars['posts_per_page']); |
|
| 330 | 330 | |
| 331 | - if ( $wp_rewrite->using_permalinks() ) { |
|
| 331 | + if ($wp_rewrite->using_permalinks()) { |
|
| 332 | 332 | |
| 333 | - $url = explode( '?', get_pagenum_link( 0 ) ); |
|
| 333 | + $url = explode('?', get_pagenum_link(0)); |
|
| 334 | 334 | |
| 335 | - if ( isset( $url[1] ) ) { |
|
| 336 | - parse_str( $url[1], $query ); |
|
| 335 | + if (isset($url[1])) { |
|
| 336 | + parse_str($url[1], $query); |
|
| 337 | 337 | $args['add_args'] = $query; |
| 338 | 338 | } |
| 339 | 339 | |
| 340 | 340 | $args['format'] = 'page/%#%'; |
| 341 | - $args['base'] = trailingslashit( $url[0] ).'%_%'; |
|
| 341 | + $args['base'] = trailingslashit($url[0]).'%_%'; |
|
| 342 | 342 | |
| 343 | 343 | } else { |
| 344 | 344 | $big = 999999999; |
| 345 | - $args['base'] = str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ); |
|
| 345 | + $args['base'] = str_replace($big, '%#%', esc_url(get_pagenum_link($big))); |
|
| 346 | 346 | } |
| 347 | 347 | |
| 348 | 348 | $args['type'] = 'array'; |
| 349 | - $args['current'] = max( 1, get_query_var( 'paged' ) ); |
|
| 350 | - $args['mid_size'] = max( 9 - $args['current'], 3 ); |
|
| 349 | + $args['current'] = max(1, get_query_var('paged')); |
|
| 350 | + $args['mid_size'] = max(9 - $args['current'], 3); |
|
| 351 | 351 | $args['prev_next'] = false; |
| 352 | 352 | |
| 353 | - if ( is_int( $prefs ) ) { |
|
| 353 | + if (is_int($prefs)) { |
|
| 354 | 354 | $args['mid_size'] = $prefs - 2; |
| 355 | 355 | } else { |
| 356 | - $args = array_merge( $args, $prefs ); |
|
| 356 | + $args = array_merge($args, $prefs); |
|
| 357 | 357 | } |
| 358 | 358 | |
| 359 | 359 | $data = array(); |
| 360 | - $data['pages'] = ClassyHelper::paginate_links( $args ); |
|
| 361 | - $next = get_next_posts_page_link( $args['total'] ); |
|
| 360 | + $data['pages'] = ClassyHelper::paginate_links($args); |
|
| 361 | + $next = get_next_posts_page_link($args['total']); |
|
| 362 | 362 | |
| 363 | - if ( $next ) { |
|
| 364 | - $data['next'] = array( 'link' => untrailingslashit( $next ), 'class' => 'page-numbers next' ); |
|
| 363 | + if ($next) { |
|
| 364 | + $data['next'] = array('link' => untrailingslashit($next), 'class' => 'page-numbers next'); |
|
| 365 | 365 | } |
| 366 | 366 | |
| 367 | - $prev = previous_posts( false ); |
|
| 367 | + $prev = previous_posts(false); |
|
| 368 | 368 | |
| 369 | - if ( $prev ) { |
|
| 370 | - $data['prev'] = array( 'link' => untrailingslashit( $prev ), 'class' => 'page-numbers prev' ); |
|
| 369 | + if ($prev) { |
|
| 370 | + $data['prev'] = array('link' => untrailingslashit($prev), 'class' => 'page-numbers prev'); |
|
| 371 | 371 | } |
| 372 | 372 | |
| 373 | - if ( $paged < 2 ) { |
|
| 373 | + if ($paged < 2) { |
|
| 374 | 374 | $data['prev'] = null; |
| 375 | 375 | } |
| 376 | 376 | |
| 377 | - return ClassyHelper::array_to_object( $data ); |
|
| 377 | + return ClassyHelper::array_to_object($data); |
|
| 378 | 378 | |
| 379 | 379 | } |
| 380 | 380 | } |
@@ -15,44 +15,44 @@ discard block |
||
| 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 = __( '…' ); |
|
| 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 = __('…'); |
|
| 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 |
||
| 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 ) ) { |
|
| 87 | - $html .= '</' . $openedtags[ $i ] . '>'; |
|
| 85 | + for ($i = 0; $i < $len_opened; $i++) { |
|
| 86 | + if (!in_array($openedtags[$i], $closedtags)) { |
|
| 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 | } |
@@ -101,14 +101,14 @@ discard block |
||
| 101 | 101 | * |
| 102 | 102 | * @param mixed $arg |
| 103 | 103 | */ |
| 104 | - public static function error_log( $arg ) { |
|
| 105 | - if ( ! WP_DEBUG ) { |
|
| 104 | + public static function error_log($arg) { |
|
| 105 | + if (!WP_DEBUG) { |
|
| 106 | 106 | return; |
| 107 | 107 | } |
| 108 | - if ( is_object( $arg ) || is_array( $arg ) ) { |
|
| 109 | - $arg = print_r( $arg, true ); |
|
| 108 | + if (is_object($arg) || is_array($arg)) { |
|
| 109 | + $arg = print_r($arg, true); |
|
| 110 | 110 | } |
| 111 | - return error_log( $arg ); |
|
| 111 | + return error_log($arg); |
|
| 112 | 112 | } |
| 113 | 113 | |
| 114 | 114 | /** |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | * @param string $args |
| 118 | 118 | * @return array |
| 119 | 119 | */ |
| 120 | - public static function paginate_links( $args = '' ) { |
|
| 120 | + public static function paginate_links($args = '') { |
|
| 121 | 121 | $defaults = array( |
| 122 | 122 | 'base' => '%_%', // http://example.com/all_posts.php%_% : %_% is replaced by format (below) |
| 123 | 123 | 'format' => '?page=%#%', // ?page=%#% : %#% is replaced by the page number |
@@ -125,43 +125,43 @@ discard block |
||
| 125 | 125 | 'current' => 0, |
| 126 | 126 | 'show_all' => false, |
| 127 | 127 | 'prev_next' => true, |
| 128 | - 'prev_text' => __( '« Previous' ), |
|
| 129 | - 'next_text' => __( 'Next »' ), |
|
| 128 | + 'prev_text' => __('« Previous'), |
|
| 129 | + 'next_text' => __('Next »'), |
|
| 130 | 130 | 'end_size' => 1, |
| 131 | 131 | 'mid_size' => 2, |
| 132 | 132 | 'type' => 'array', |
| 133 | 133 | 'add_args' => false, // array of query args to add |
| 134 | 134 | 'add_fragment' => '', |
| 135 | 135 | ); |
| 136 | - $args = wp_parse_args( $args, $defaults ); |
|
| 136 | + $args = wp_parse_args($args, $defaults); |
|
| 137 | 137 | // Who knows what else people pass in $args |
| 138 | - $args['total'] = intval( (int) $args['total'] ); |
|
| 139 | - if ( $args['total'] < 2 ) { |
|
| 138 | + $args['total'] = intval((int) $args['total']); |
|
| 139 | + if ($args['total'] < 2) { |
|
| 140 | 140 | return array(); |
| 141 | 141 | } |
| 142 | 142 | $args['current'] = (int) $args['current']; |
| 143 | 143 | $args['end_size'] = 0 < (int) $args['end_size'] ? (int) $args['end_size'] : 1; // Out of bounds? Make it the default. |
| 144 | 144 | $args['mid_size'] = 0 <= (int) $args['mid_size'] ? (int) $args['mid_size'] : 2; |
| 145 | - $args['add_args'] = is_array( $args['add_args'] ) ? $args['add_args'] : false; |
|
| 145 | + $args['add_args'] = is_array($args['add_args']) ? $args['add_args'] : false; |
|
| 146 | 146 | $page_links = array(); |
| 147 | 147 | $dots = false; |
| 148 | - if ( $args['prev_next'] && $args['current'] && 1 < $args['current'] ) { |
|
| 149 | - $link = str_replace( '%_%', 2 == $args['current'] ? '' : $args['format'], $args['base'] ); |
|
| 150 | - $link = str_replace( '%#%', $args['current'] - 1, $link ); |
|
| 151 | - if ( $args['add_args'] ) { |
|
| 152 | - $link = add_query_arg( $args['add_args'], $link ); |
|
| 148 | + if ($args['prev_next'] && $args['current'] && 1 < $args['current']) { |
|
| 149 | + $link = str_replace('%_%', 2 == $args['current'] ? '' : $args['format'], $args['base']); |
|
| 150 | + $link = str_replace('%#%', $args['current'] - 1, $link); |
|
| 151 | + if ($args['add_args']) { |
|
| 152 | + $link = add_query_arg($args['add_args'], $link); |
|
| 153 | 153 | } |
| 154 | 154 | $link .= $args['add_fragment']; |
| 155 | - $link = untrailingslashit( $link ); |
|
| 155 | + $link = untrailingslashit($link); |
|
| 156 | 156 | $page_links[] = array( |
| 157 | 157 | 'class' => 'prev page-numbers', |
| 158 | - 'link' => esc_url( apply_filters( 'paginate_links', $link ) ), |
|
| 158 | + 'link' => esc_url(apply_filters('paginate_links', $link)), |
|
| 159 | 159 | 'title' => $args['prev_text'], |
| 160 | 160 | ); |
| 161 | 161 | } |
| 162 | - for ( $n = 1; $n <= $args['total']; $n++ ) { |
|
| 163 | - $n_display = number_format_i18n( $n ); |
|
| 164 | - if ( $n == $args['current'] ) { |
|
| 162 | + for ($n = 1; $n <= $args['total']; $n++) { |
|
| 163 | + $n_display = number_format_i18n($n); |
|
| 164 | + if ($n == $args['current']) { |
|
| 165 | 165 | $page_links[] = array( |
| 166 | 166 | 'class' => 'page-number page-numbers current', |
| 167 | 167 | 'title' => $n_display, |
@@ -171,42 +171,42 @@ discard block |
||
| 171 | 171 | ); |
| 172 | 172 | $dots = true; |
| 173 | 173 | } else { |
| 174 | - 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'] ) ) { |
|
| 175 | - $link = str_replace( '%_%', 1 == $n ? '' : $args['format'], $args['base'] ); |
|
| 176 | - $link = str_replace( '%#%', $n, $link ); |
|
| 177 | - $link = trailingslashit( $link ) . ltrim( $args['add_fragment'], '/' ); |
|
| 178 | - if ( $args['add_args'] ) { |
|
| 179 | - $link = rtrim( add_query_arg( $args['add_args'], $link ), '/' ); |
|
| 174 | + 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'])) { |
|
| 175 | + $link = str_replace('%_%', 1 == $n ? '' : $args['format'], $args['base']); |
|
| 176 | + $link = str_replace('%#%', $n, $link); |
|
| 177 | + $link = trailingslashit($link).ltrim($args['add_fragment'], '/'); |
|
| 178 | + if ($args['add_args']) { |
|
| 179 | + $link = rtrim(add_query_arg($args['add_args'], $link), '/'); |
|
| 180 | 180 | } |
| 181 | - $link = str_replace( ' ', '+', $link ); |
|
| 182 | - $link = untrailingslashit( $link ); |
|
| 181 | + $link = str_replace(' ', '+', $link); |
|
| 182 | + $link = untrailingslashit($link); |
|
| 183 | 183 | $page_links[] = array( |
| 184 | 184 | 'class' => 'page-number page-numbers', |
| 185 | - 'link' => esc_url( apply_filters( 'paginate_links', $link ) ), |
|
| 185 | + 'link' => esc_url(apply_filters('paginate_links', $link)), |
|
| 186 | 186 | 'title' => $n_display, |
| 187 | 187 | 'name' => $n_display, |
| 188 | 188 | 'current' => $args['current'] == $n, |
| 189 | 189 | ); |
| 190 | 190 | $dots = true; |
| 191 | - } elseif ( $dots && ! $args['show_all'] ) { |
|
| 191 | + } elseif ($dots && !$args['show_all']) { |
|
| 192 | 192 | $page_links[] = array( |
| 193 | 193 | 'class' => 'dots', |
| 194 | - 'title' => __( '…' ), |
|
| 194 | + 'title' => __('…'), |
|
| 195 | 195 | ); |
| 196 | 196 | $dots = false; |
| 197 | 197 | } |
| 198 | 198 | } |
| 199 | 199 | } |
| 200 | - if ( $args['prev_next'] && $args['current'] && ( $args['current'] < $args['total'] || -1 == $args['total'] ) ) { |
|
| 201 | - $link = str_replace( '%_%', $args['format'], $args['base'] ); |
|
| 202 | - $link = str_replace( '%#%', $args['current'] + 1, $link ); |
|
| 203 | - if ( $args['add_args'] ) { |
|
| 204 | - $link = add_query_arg( $args['add_args'], $link ); |
|
| 200 | + if ($args['prev_next'] && $args['current'] && ($args['current'] < $args['total'] || -1 == $args['total'])) { |
|
| 201 | + $link = str_replace('%_%', $args['format'], $args['base']); |
|
| 202 | + $link = str_replace('%#%', $args['current'] + 1, $link); |
|
| 203 | + if ($args['add_args']) { |
|
| 204 | + $link = add_query_arg($args['add_args'], $link); |
|
| 205 | 205 | } |
| 206 | - $link = untrailingslashit( trailingslashit( $link ) . $args['add_fragment'] ); |
|
| 206 | + $link = untrailingslashit(trailingslashit($link).$args['add_fragment']); |
|
| 207 | 207 | $page_links[] = array( |
| 208 | 208 | 'class' => 'next page-numbers', |
| 209 | - 'link' => esc_url( apply_filters( 'paginate_links', $link ) ), |
|
| 209 | + 'link' => esc_url(apply_filters('paginate_links', $link)), |
|
| 210 | 210 | 'title' => $args['next_text'], |
| 211 | 211 | ); |
| 212 | 212 | } |
@@ -220,13 +220,13 @@ discard block |
||
| 220 | 220 | * @param array $array |
| 221 | 221 | * @return object |
| 222 | 222 | */ |
| 223 | - public static function array_to_object( $array ) { |
|
| 223 | + public static function array_to_object($array) { |
|
| 224 | 224 | $obj = new stdClass; |
| 225 | 225 | |
| 226 | - foreach ( $array as $k => $v ) { |
|
| 227 | - if ( strlen( $k ) ) { |
|
| 228 | - if ( is_array( $v ) ) { |
|
| 229 | - $obj->{$k} = self::array_to_object( $v ); //RECURSION |
|
| 226 | + foreach ($array as $k => $v) { |
|
| 227 | + if (strlen($k)) { |
|
| 228 | + if (is_array($v)) { |
|
| 229 | + $obj->{$k} = self::array_to_object($v); //RECURSION |
|
| 230 | 230 | } else { |
| 231 | 231 | $obj->{$k} = $v; |
| 232 | 232 | } |
@@ -249,42 +249,42 @@ discard block |
||
| 249 | 249 | |
| 250 | 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 | 264 | the_post(); |
| 265 | - $archives_title = 'Author: ' . get_the_author(); |
|
| 265 | + $archives_title = 'Author: '.get_the_author(); |
|
| 266 | 266 | |
| 267 | 267 | } |
| 268 | 268 | |
| 269 | 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 | 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 | 289 | } else { |
| 290 | 290 | |
@@ -12,23 +12,23 @@ |
||
| 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 | |