@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | * Checks if template exists |
| 112 | 112 | * |
| 113 | 113 | * @param string $type template/scope |
| 114 | - * @param string $template in blade path format, ex: layout/header |
|
| 114 | + * @param string|false $file |
|
| 115 | 115 | * @return boolean true/false |
| 116 | 116 | */ |
| 117 | 117 | public static function file_exists($type = 'template', $file) { |
@@ -129,8 +129,9 @@ discard block |
||
| 129 | 129 | * Returns template name for render, based on type of request |
| 130 | 130 | * |
| 131 | 131 | * @param string $type template/scope |
| 132 | - * @param string $type |
|
| 133 | - * @return array |
|
| 132 | + * @param string $type |
|
| 133 | + * @param string $page |
|
| 134 | + * @return string|false |
|
| 134 | 135 | */ |
| 135 | 136 | public static function get_available_file($type = 'template', $page) { |
| 136 | 137 | |
@@ -377,7 +378,7 @@ discard block |
||
| 377 | 378 | /** |
| 378 | 379 | * Returns classy template name or boolean if this is not classy template |
| 379 | 380 | * |
| 380 | - * @return mixed |
|
| 381 | + * @return string|false |
|
| 381 | 382 | */ |
| 382 | 383 | public static function get_classy_template() { |
| 383 | 384 | |
@@ -21,39 +21,39 @@ discard block |
||
| 21 | 21 | */ |
| 22 | 22 | protected static function check_request() { |
| 23 | 23 | |
| 24 | - if ( is_404()) : return '404'; |
|
| 24 | + if (is_404()) : return '404'; |
|
| 25 | 25 | |
| 26 | - elseif ( is_search() ) : return 'search'; |
|
| 26 | + elseif (is_search()) : return 'search'; |
|
| 27 | 27 | |
| 28 | - elseif ( is_front_page() ) : return 'front-page'; |
|
| 28 | + elseif (is_front_page()) : return 'front-page'; |
|
| 29 | 29 | |
| 30 | - elseif ( is_home() ) : return 'home'; |
|
| 30 | + elseif (is_home()) : return 'home'; |
|
| 31 | 31 | |
| 32 | - elseif ( is_post_type_archive() ) : return 'post_type_archive'; |
|
| 32 | + elseif (is_post_type_archive()) : return 'post_type_archive'; |
|
| 33 | 33 | |
| 34 | - elseif ( is_tax() ) : return 'taxonomy'; |
|
| 34 | + elseif (is_tax()) : return 'taxonomy'; |
|
| 35 | 35 | |
| 36 | - elseif ( is_attachment() ) : return 'attachment'; |
|
| 36 | + elseif (is_attachment()) : return 'attachment'; |
|
| 37 | 37 | |
| 38 | - elseif ( is_single() ) : return 'single'; |
|
| 38 | + elseif (is_single()) : return 'single'; |
|
| 39 | 39 | |
| 40 | - elseif ( self::is_classy_template() ) : return 'classy-template'; |
|
| 40 | + elseif (self::is_classy_template()) : return 'classy-template'; |
|
| 41 | 41 | |
| 42 | - elseif ( is_page() ) : return 'page'; |
|
| 42 | + elseif (is_page()) : return 'page'; |
|
| 43 | 43 | |
| 44 | - elseif ( is_singular() ) : return 'singular'; |
|
| 44 | + elseif (is_singular()) : return 'singular'; |
|
| 45 | 45 | |
| 46 | - elseif ( is_category() ) : return 'category'; |
|
| 46 | + elseif (is_category()) : return 'category'; |
|
| 47 | 47 | |
| 48 | - elseif ( is_tag() ) : return 'tag'; |
|
| 48 | + elseif (is_tag()) : return 'tag'; |
|
| 49 | 49 | |
| 50 | - elseif ( is_author() ) : return 'author'; |
|
| 50 | + elseif (is_author()) : return 'author'; |
|
| 51 | 51 | |
| 52 | - elseif ( is_date() ) : return 'date'; |
|
| 52 | + elseif (is_date()) : return 'date'; |
|
| 53 | 53 | |
| 54 | - elseif ( is_archive() ) : return 'archive'; |
|
| 54 | + elseif (is_archive()) : return 'archive'; |
|
| 55 | 55 | |
| 56 | - elseif ( is_paged() ) : return 'paged'; |
|
| 56 | + elseif (is_paged()) : return 'paged'; |
|
| 57 | 57 | |
| 58 | 58 | else : |
| 59 | 59 | |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | */ |
| 71 | 71 | public static function get_current_request() { |
| 72 | 72 | |
| 73 | - if ( null === self::$current_request ) { |
|
| 73 | + if (null === self::$current_request) { |
|
| 74 | 74 | |
| 75 | 75 | self::$current_request = self::check_request(); |
| 76 | 76 | |
@@ -94,13 +94,13 @@ discard block |
||
| 94 | 94 | |
| 95 | 95 | $folder = ClassyTemplate::$folder; |
| 96 | 96 | |
| 97 | - return THEME_PATH . $folder . '/' . $template . '.blade.php'; |
|
| 97 | + return THEME_PATH.$folder.'/'.$template.'.blade.php'; |
|
| 98 | 98 | |
| 99 | 99 | } elseif ($type == 'scope') { |
| 100 | 100 | |
| 101 | 101 | $folder = ClassyScope::$folder; |
| 102 | 102 | |
| 103 | - return THEME_PATH . $folder . '/' . $template . '.php'; |
|
| 103 | + return THEME_PATH.$folder.'/'.$template.'.php'; |
|
| 104 | 104 | |
| 105 | 105 | } |
| 106 | 106 | |
@@ -138,7 +138,7 @@ discard block |
||
| 138 | 138 | |
| 139 | 139 | foreach ($templates as $template) { |
| 140 | 140 | |
| 141 | - if ( self::file_exists($type, $template) ): |
|
| 141 | + if (self::file_exists($type, $template)): |
|
| 142 | 142 | |
| 143 | 143 | return $template; |
| 144 | 144 | |
@@ -163,38 +163,38 @@ discard block |
||
| 163 | 163 | |
| 164 | 164 | // Home |
| 165 | 165 | |
| 166 | - if ( $type == 'home' ) : |
|
| 166 | + if ($type == 'home') : |
|
| 167 | 167 | |
| 168 | 168 | $templates[] = 'home'; |
| 169 | 169 | |
| 170 | 170 | // Single |
| 171 | 171 | |
| 172 | - elseif ( $type == 'single' ) : |
|
| 172 | + elseif ($type == 'single') : |
|
| 173 | 173 | |
| 174 | 174 | $post_type = get_post_type(); |
| 175 | 175 | |
| 176 | - $templates[] = $post_type . '.single'; |
|
| 176 | + $templates[] = $post_type.'.single'; |
|
| 177 | 177 | |
| 178 | 178 | $templates[] = 'single'; |
| 179 | 179 | |
| 180 | 180 | // Post type |
| 181 | 181 | |
| 182 | - elseif ( $type == 'post_type_archive' ) : |
|
| 182 | + elseif ($type == 'post_type_archive') : |
|
| 183 | 183 | |
| 184 | 184 | $post_type = get_post_type(); |
| 185 | 185 | |
| 186 | - $templates[] = $post_type . '.archive'; |
|
| 186 | + $templates[] = $post_type.'.archive'; |
|
| 187 | 187 | |
| 188 | 188 | $templates[] = 'archive'; |
| 189 | 189 | |
| 190 | 190 | |
| 191 | 191 | // Taxonomy |
| 192 | 192 | |
| 193 | - elseif ( $type == 'taxonomy' ): |
|
| 193 | + elseif ($type == 'taxonomy'): |
|
| 194 | 194 | |
| 195 | 195 | $term = get_queried_object(); |
| 196 | 196 | |
| 197 | - if ( ! empty( $term->slug ) ) { |
|
| 197 | + if (!empty($term->slug)) { |
|
| 198 | 198 | |
| 199 | 199 | $taxonomy = $term->taxonomy; |
| 200 | 200 | |
@@ -209,11 +209,11 @@ discard block |
||
| 209 | 209 | |
| 210 | 210 | // Category |
| 211 | 211 | |
| 212 | - elseif ( $type == 'category' ): |
|
| 212 | + elseif ($type == 'category'): |
|
| 213 | 213 | |
| 214 | 214 | $category = get_queried_object(); |
| 215 | 215 | |
| 216 | - if ( ! empty( $category->slug ) ) { |
|
| 216 | + if (!empty($category->slug)) { |
|
| 217 | 217 | $templates[] = "category.{$category->slug}"; |
| 218 | 218 | $templates[] = "category.{$category->term_id}"; |
| 219 | 219 | } |
@@ -225,23 +225,23 @@ discard block |
||
| 225 | 225 | |
| 226 | 226 | // Attachment |
| 227 | 227 | |
| 228 | - elseif ( $type == 'attachment' ): |
|
| 228 | + elseif ($type == 'attachment'): |
|
| 229 | 229 | |
| 230 | 230 | $attachment = get_queried_object(); |
| 231 | 231 | |
| 232 | - if ( $attachment ) { |
|
| 232 | + if ($attachment) { |
|
| 233 | 233 | |
| 234 | - if ( false !== strpos( $attachment->post_mime_type, '/' ) ) { |
|
| 234 | + if (false !== strpos($attachment->post_mime_type, '/')) { |
|
| 235 | 235 | |
| 236 | - list( $type, $subtype ) = explode( '/', $attachment->post_mime_type ); |
|
| 236 | + list($type, $subtype) = explode('/', $attachment->post_mime_type); |
|
| 237 | 237 | |
| 238 | 238 | } else { |
| 239 | 239 | |
| 240 | - list( $type, $subtype ) = array( $attachment->post_mime_type, '' ); |
|
| 240 | + list($type, $subtype) = array($attachment->post_mime_type, ''); |
|
| 241 | 241 | |
| 242 | 242 | } |
| 243 | 243 | |
| 244 | - if ( ! empty( $subtype ) ) { |
|
| 244 | + if (!empty($subtype)) { |
|
| 245 | 245 | $templates[] = "attachment.{$type}.{$subtype}"; |
| 246 | 246 | $templates[] = "attachment.{$subtype}"; |
| 247 | 247 | |
@@ -261,11 +261,11 @@ discard block |
||
| 261 | 261 | |
| 262 | 262 | // Tag |
| 263 | 263 | |
| 264 | - elseif ( $type == 'tag' ): |
|
| 264 | + elseif ($type == 'tag'): |
|
| 265 | 265 | |
| 266 | 266 | $tag = get_queried_object(); |
| 267 | 267 | |
| 268 | - if ( ! empty( $tag->slug ) ) { |
|
| 268 | + if (!empty($tag->slug)) { |
|
| 269 | 269 | $templates[] = "post.tag.{$tag->slug}"; |
| 270 | 270 | $templates[] = "post.tag.{$tag->term_id}"; |
| 271 | 271 | |
@@ -279,11 +279,11 @@ discard block |
||
| 279 | 279 | |
| 280 | 280 | // Author |
| 281 | 281 | |
| 282 | - elseif ( $type == 'author' ): |
|
| 282 | + elseif ($type == 'author'): |
|
| 283 | 283 | |
| 284 | 284 | $author = get_queried_object(); |
| 285 | 285 | |
| 286 | - if ( $author instanceof WP_User ) { |
|
| 286 | + if ($author instanceof WP_User) { |
|
| 287 | 287 | $templates[] = "post.author.{$author->user_nicename}"; |
| 288 | 288 | $templates[] = "post.author.{$author->ID}"; |
| 289 | 289 | |
@@ -298,7 +298,7 @@ discard block |
||
| 298 | 298 | |
| 299 | 299 | // Front Page |
| 300 | 300 | |
| 301 | - elseif ( $type == 'front-page' ): |
|
| 301 | + elseif ($type == 'front-page'): |
|
| 302 | 302 | |
| 303 | 303 | $templates[] = 'front-page.front-page'; |
| 304 | 304 | $templates[] = 'front-page'; |
@@ -310,18 +310,18 @@ discard block |
||
| 310 | 310 | |
| 311 | 311 | // Page |
| 312 | 312 | |
| 313 | - elseif ( $type == 'classy-template' ): |
|
| 313 | + elseif ($type == 'classy-template'): |
|
| 314 | 314 | |
| 315 | 315 | $template = self::get_classy_template(); |
| 316 | 316 | |
| 317 | 317 | $templates[] = $template; |
| 318 | 318 | |
| 319 | - $templates[] = 'page.' . $template; |
|
| 319 | + $templates[] = 'page.'.$template; |
|
| 320 | 320 | |
| 321 | - $templates[] = 'template.' . $template; |
|
| 321 | + $templates[] = 'template.'.$template; |
|
| 322 | 322 | |
| 323 | 323 | |
| 324 | - elseif ( $type == 'page' ): |
|
| 324 | + elseif ($type == 'page'): |
|
| 325 | 325 | |
| 326 | 326 | $id = get_queried_object_id(); |
| 327 | 327 | |
@@ -329,18 +329,18 @@ discard block |
||
| 329 | 329 | |
| 330 | 330 | $pagename = get_query_var('pagename'); |
| 331 | 331 | |
| 332 | - if ( ! $pagename && $id ) { |
|
| 332 | + if (!$pagename && $id) { |
|
| 333 | 333 | // If a static page is set as the front page, $pagename will not be set. Retrieve it from the queried object |
| 334 | 334 | $post = get_queried_object(); |
| 335 | - if ( $post ) |
|
| 335 | + if ($post) |
|
| 336 | 336 | $pagename = $post->post_name; |
| 337 | 337 | } |
| 338 | 338 | |
| 339 | - if ( $template && $template != 'index' ) |
|
| 339 | + if ($template && $template != 'index') |
|
| 340 | 340 | $templates[] = $template; |
| 341 | - if ( $pagename ) |
|
| 341 | + if ($pagename) |
|
| 342 | 342 | $templates[] = "page.$pagename"; |
| 343 | - if ( $id ) |
|
| 343 | + if ($id) |
|
| 344 | 344 | $templates[] = "page.$id"; |
| 345 | 345 | |
| 346 | 346 | $templates[] = 'page.page'; |
@@ -385,7 +385,7 @@ discard block |
||
| 385 | 385 | |
| 386 | 386 | preg_match('/classy\-(.*)/', $template_slug, $matches); |
| 387 | 387 | |
| 388 | - if ( $matches && isset($matches[1]) ) return $matches[1]; |
|
| 388 | + if ($matches && isset($matches[1])) return $matches[1]; |
|
| 389 | 389 | |
| 390 | 390 | return false; |
| 391 | 391 | |
@@ -55,9 +55,11 @@ discard block |
||
| 55 | 55 | |
| 56 | 56 | elseif ( is_paged() ) : return 'paged'; |
| 57 | 57 | |
| 58 | - else : |
|
| 58 | + else { |
|
| 59 | + : |
|
| 59 | 60 | |
| 60 | 61 | return 'index'; |
| 62 | + } |
|
| 61 | 63 | |
| 62 | 64 | endif; |
| 63 | 65 | |
@@ -96,7 +98,8 @@ discard block |
||
| 96 | 98 | |
| 97 | 99 | return THEME_PATH . $folder . '/' . $template . '.blade.php'; |
| 98 | 100 | |
| 99 | - } elseif ($type == 'scope') { |
|
| 101 | + } |
|
| 102 | + elseif ($type == 'scope') { |
|
| 100 | 103 | |
| 101 | 104 | $folder = ClassyScope::$folder; |
| 102 | 105 | |
@@ -235,7 +238,8 @@ discard block |
||
| 235 | 238 | |
| 236 | 239 | list( $type, $subtype ) = explode( '/', $attachment->post_mime_type ); |
| 237 | 240 | |
| 238 | - } else { |
|
| 241 | + } |
|
| 242 | + else { |
|
| 239 | 243 | |
| 240 | 244 | list( $type, $subtype ) = array( $attachment->post_mime_type, '' ); |
| 241 | 245 | |
@@ -332,16 +336,20 @@ discard block |
||
| 332 | 336 | if ( ! $pagename && $id ) { |
| 333 | 337 | // If a static page is set as the front page, $pagename will not be set. Retrieve it from the queried object |
| 334 | 338 | $post = get_queried_object(); |
| 335 | - if ( $post ) |
|
| 336 | - $pagename = $post->post_name; |
|
| 339 | + if ( $post ) { |
|
| 340 | + $pagename = $post->post_name; |
|
| 341 | + } |
|
| 337 | 342 | } |
| 338 | 343 | |
| 339 | - if ( $template && $template != 'index' ) |
|
| 340 | - $templates[] = $template; |
|
| 341 | - if ( $pagename ) |
|
| 342 | - $templates[] = "page.$pagename"; |
|
| 343 | - if ( $id ) |
|
| 344 | - $templates[] = "page.$id"; |
|
| 344 | + if ( $template && $template != 'index' ) { |
|
| 345 | + $templates[] = $template; |
|
| 346 | + } |
|
| 347 | + if ( $pagename ) { |
|
| 348 | + $templates[] = "page.$pagename"; |
|
| 349 | + } |
|
| 350 | + if ( $id ) { |
|
| 351 | + $templates[] = "page.$id"; |
|
| 352 | + } |
|
| 345 | 353 | |
| 346 | 354 | $templates[] = 'page.page'; |
| 347 | 355 | |
@@ -350,9 +358,11 @@ discard block |
||
| 350 | 358 | |
| 351 | 359 | // Default |
| 352 | 360 | |
| 353 | - else: |
|
| 361 | + else { |
|
| 362 | + : |
|
| 354 | 363 | |
| 355 | 364 | $templates[] = $type; |
| 365 | + } |
|
| 356 | 366 | |
| 357 | 367 | endif; |
| 358 | 368 | |
@@ -385,7 +395,9 @@ discard block |
||
| 385 | 395 | |
| 386 | 396 | preg_match('/classy\-(.*)/', $template_slug, $matches); |
| 387 | 397 | |
| 388 | - if ( $matches && isset($matches[1]) ) return $matches[1]; |
|
| 398 | + if ( $matches && isset($matches[1]) ) { |
|
| 399 | + return $matches[1]; |
|
| 400 | + } |
|
| 389 | 401 | |
| 390 | 402 | return false; |
| 391 | 403 | |
@@ -43,6 +43,7 @@ |
||
| 43 | 43 | /** |
| 44 | 44 | * Extends Scope with scope that is defined in theme_name/scope folder |
| 45 | 45 | * |
| 46 | + * @param string|false $template_name |
|
| 46 | 47 | * @return array |
| 47 | 48 | */ |
| 48 | 49 | public static function extend_scope($scope, $template_name) { |
@@ -9,13 +9,13 @@ discard block |
||
| 9 | 9 | |
| 10 | 10 | public function __construct() { |
| 11 | 11 | |
| 12 | - add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_styles' ) ); |
|
| 12 | + add_action('wp_enqueue_scripts', array($this, 'enqueue_styles')); |
|
| 13 | 13 | |
| 14 | - add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ) ); |
|
| 14 | + add_action('wp_enqueue_scripts', array($this, 'enqueue_scripts')); |
|
| 15 | 15 | |
| 16 | - add_action( 'wp_print_scripts', array($this, 'init_js_vars') ); |
|
| 16 | + add_action('wp_print_scripts', array($this, 'init_js_vars')); |
|
| 17 | 17 | |
| 18 | - add_action( 'after_setup_theme', array($this, 'setup_theme') ); |
|
| 18 | + add_action('after_setup_theme', array($this, 'setup_theme')); |
|
| 19 | 19 | |
| 20 | 20 | } |
| 21 | 21 | |
@@ -24,7 +24,7 @@ discard block |
||
| 24 | 24 | */ |
| 25 | 25 | public function enqueue_styles() { |
| 26 | 26 | |
| 27 | - wp_register_style( 'general_css', THEME_DIR . 'assets/css/general.css', array(), THEME_VERSION, 'all' ); |
|
| 27 | + wp_register_style('general_css', THEME_DIR.'assets/css/general.css', array(), THEME_VERSION, 'all'); |
|
| 28 | 28 | |
| 29 | 29 | // wp_enqueue_style( 'general_css' ); |
| 30 | 30 | |
@@ -35,13 +35,13 @@ discard block |
||
| 35 | 35 | */ |
| 36 | 36 | public function enqueue_scripts() { |
| 37 | 37 | |
| 38 | - if ( Classy::get_config_var('environment') == 'production' ) { |
|
| 38 | + if (Classy::get_config_var('environment') == 'production') { |
|
| 39 | 39 | |
| 40 | - wp_register_script( 'theme_scripts', THEME_DIR . 'assets/js/min/production.js', array( 'jquery' ), THEME_VERSION, true ); |
|
| 40 | + wp_register_script('theme_scripts', THEME_DIR.'assets/js/min/production.js', array('jquery'), THEME_VERSION, true); |
|
| 41 | 41 | |
| 42 | 42 | } else { |
| 43 | 43 | |
| 44 | - wp_register_script( 'theme_scripts', THEME_DIR . 'assets/js/scripts.js', array( 'jquery' ), THEME_VERSION, true ); |
|
| 44 | + wp_register_script('theme_scripts', THEME_DIR.'assets/js/scripts.js', array('jquery'), THEME_VERSION, true); |
|
| 45 | 45 | |
| 46 | 46 | } |
| 47 | 47 | |
@@ -247,58 +247,58 @@ |
||
| 247 | 247 | |
| 248 | 248 | $textdomain = Classy::textdomain(); |
| 249 | 249 | |
| 250 | - $archives_title = ''; |
|
| 250 | + $archives_title = ''; |
|
| 251 | 251 | |
| 252 | - if ( is_category() ) { |
|
| 252 | + if ( is_category() ) { |
|
| 253 | 253 | |
| 254 | - $archives_title = single_cat_title( '', false ); |
|
| 254 | + $archives_title = single_cat_title( '', false ); |
|
| 255 | 255 | |
| 256 | - } else if ( is_tag() ) { |
|
| 256 | + } else if ( is_tag() ) { |
|
| 257 | 257 | |
| 258 | - $archives_title = 'Tag: ' . single_tag_title( '', false ); |
|
| 258 | + $archives_title = 'Tag: ' . single_tag_title( '', false ); |
|
| 259 | 259 | |
| 260 | - } else if ( is_author() ) { |
|
| 260 | + } else if ( is_author() ) { |
|
| 261 | 261 | |
| 262 | - if ( have_posts() ) { |
|
| 262 | + if ( have_posts() ) { |
|
| 263 | 263 | |
| 264 | - the_post(); |
|
| 265 | - $archives_title = 'Author: ' . get_the_author(); |
|
| 264 | + the_post(); |
|
| 265 | + $archives_title = 'Author: ' . get_the_author(); |
|
| 266 | 266 | |
| 267 | - } |
|
| 267 | + } |
|
| 268 | 268 | |
| 269 | - rewind_posts(); |
|
| 269 | + rewind_posts(); |
|
| 270 | 270 | |
| 271 | - } else if ( is_search() ) { |
|
| 271 | + } else if ( is_search() ) { |
|
| 272 | 272 | |
| 273 | - $archives_title = sprintf( __( 'Search Results for: %s', $textdomain ), '<span>' . get_search_query() . '</span>' ); |
|
| 273 | + $archives_title = sprintf( __( 'Search Results for: %s', $textdomain ), '<span>' . get_search_query() . '</span>' ); |
|
| 274 | 274 | |
| 275 | - } else if ( is_archive() ) { |
|
| 275 | + } else if ( is_archive() ) { |
|
| 276 | 276 | |
| 277 | - if ( is_day() ) { |
|
| 277 | + if ( is_day() ) { |
|
| 278 | 278 | |
| 279 | - $archives_title = get_the_date(); |
|
| 279 | + $archives_title = get_the_date(); |
|
| 280 | 280 | |
| 281 | - } elseif ( is_month() ) { |
|
| 281 | + } elseif ( is_month() ) { |
|
| 282 | 282 | |
| 283 | - $archives_title = get_the_date( _x( 'F Y', 'monthly archives date format', $textdomain )); |
|
| 283 | + $archives_title = get_the_date( _x( 'F Y', 'monthly archives date format', $textdomain )); |
|
| 284 | 284 | |
| 285 | - } elseif ( is_year() ) { |
|
| 285 | + } elseif ( is_year() ) { |
|
| 286 | 286 | |
| 287 | - $archives_title = get_the_date( _x( 'Y', 'yearly archives date format', $textdomain )); |
|
| 287 | + $archives_title = get_the_date( _x( 'Y', 'yearly archives date format', $textdomain )); |
|
| 288 | 288 | |
| 289 | - } else { |
|
| 289 | + } else { |
|
| 290 | 290 | |
| 291 | - $archives_title = 'Archives'; |
|
| 291 | + $archives_title = 'Archives'; |
|
| 292 | 292 | |
| 293 | - } |
|
| 293 | + } |
|
| 294 | 294 | |
| 295 | - } else { |
|
| 295 | + } else { |
|
| 296 | 296 | |
| 297 | - $archives_title = 'Archives'; |
|
| 297 | + $archives_title = 'Archives'; |
|
| 298 | 298 | |
| 299 | - } |
|
| 299 | + } |
|
| 300 | 300 | |
| 301 | - return $archives_title; |
|
| 301 | + return $archives_title; |
|
| 302 | 302 | |
| 303 | 303 | } |
| 304 | 304 | |
@@ -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 | - $args['current'] = (int)$args['current']; |
|
| 143 | - $args['end_size'] = 0 < (int)$args['end_size'] ? (int)$args['end_size'] : 1; // Out of bounds? Make it the default. |
|
| 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; |
|
| 142 | + $args['current'] = (int) $args['current']; |
|
| 143 | + $args['end_size'] = 0 < (int) $args['end_size'] ? (int) $args['end_size'] : 1; // Out of bounds? Make it the default. |
|
| 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; |
|
| 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 | 181 | $link = str_replace(' ', '+', $link); |
| 182 | - $link = untrailingslashit( $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 | } |
@@ -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 | |
@@ -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 | |
@@ -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 | // Template Loader |
| 119 | - require_once THEME_FRAMEWORK_PATH . 'classy/classy-template.php'; |
|
| 119 | + require_once THEME_FRAMEWORK_PATH.'classy/classy-template.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 | |
@@ -220,8 +220,8 @@ discard block |
||
| 220 | 220 | */ |
| 221 | 221 | public static function render($template = null, $data = null) { |
| 222 | 222 | |
| 223 | - $views = THEME_PATH . ClassyTemplate::$folder; |
|
| 224 | - $cache = WP_CONTENT_DIR . '/templatecache'; |
|
| 223 | + $views = THEME_PATH.ClassyTemplate::$folder; |
|
| 224 | + $cache = WP_CONTENT_DIR.'/templatecache'; |
|
| 225 | 225 | $common_scope = ClassyScope::get_common_scope(); |
| 226 | 226 | |
| 227 | 227 | if ($template !== null && is_string($template)) { |
@@ -285,7 +285,7 @@ discard block |
||
| 285 | 285 | |
| 286 | 286 | $_return[] = new ClassyPost($post_id); |
| 287 | 287 | |
| 288 | - } elseif($return_type == 'object') { |
|
| 288 | + } elseif ($return_type == 'object') { |
|
| 289 | 289 | |
| 290 | 290 | $_return[] = get_post($post_id); |
| 291 | 291 | |
@@ -313,7 +313,7 @@ discard block |
||
| 313 | 313 | |
| 314 | 314 | $posts = self::get_posts($args, $return_type); |
| 315 | 315 | |
| 316 | - if ( $post = reset($posts ) ) { |
|
| 316 | + if ($post = reset($posts)) { |
|
| 317 | 317 | return $post; |
| 318 | 318 | } |
| 319 | 319 | |
@@ -323,58 +323,58 @@ discard block |
||
| 323 | 323 | * @param array $prefs |
| 324 | 324 | * @return array mixed |
| 325 | 325 | */ |
| 326 | - public static function get_pagination( $prefs = array() ) { |
|
| 326 | + public static function get_pagination($prefs = array()) { |
|
| 327 | 327 | |
| 328 | 328 | global $wp_query; |
| 329 | 329 | global $paged; |
| 330 | 330 | global $wp_rewrite; |
| 331 | 331 | |
| 332 | 332 | $args = array(); |
| 333 | - $args['total'] = ceil( $wp_query->found_posts / $wp_query->query_vars['posts_per_page'] ); |
|
| 333 | + $args['total'] = ceil($wp_query->found_posts / $wp_query->query_vars['posts_per_page']); |
|
| 334 | 334 | |
| 335 | - if ( $wp_rewrite->using_permalinks() ) { |
|
| 335 | + if ($wp_rewrite->using_permalinks()) { |
|
| 336 | 336 | |
| 337 | - $url = explode( '?', get_pagenum_link( 0 ) ); |
|
| 337 | + $url = explode('?', get_pagenum_link(0)); |
|
| 338 | 338 | |
| 339 | - if ( isset( $url[1] ) ) { |
|
| 340 | - parse_str( $url[1], $query ); |
|
| 339 | + if (isset($url[1])) { |
|
| 340 | + parse_str($url[1], $query); |
|
| 341 | 341 | $args['add_args'] = $query; |
| 342 | 342 | } |
| 343 | 343 | |
| 344 | 344 | $args['format'] = 'page/%#%'; |
| 345 | - $args['base'] = trailingslashit( $url[0] ).'%_%'; |
|
| 345 | + $args['base'] = trailingslashit($url[0]).'%_%'; |
|
| 346 | 346 | |
| 347 | 347 | } else { |
| 348 | 348 | $big = 999999999; |
| 349 | - $args['base'] = str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ); |
|
| 349 | + $args['base'] = str_replace($big, '%#%', esc_url(get_pagenum_link($big))); |
|
| 350 | 350 | } |
| 351 | 351 | |
| 352 | 352 | $args['type'] = 'array'; |
| 353 | - $args['current'] = max( 1, get_query_var( 'paged' ) ); |
|
| 354 | - $args['mid_size'] = max( 9 - $args['current'], 3 ); |
|
| 353 | + $args['current'] = max(1, get_query_var('paged')); |
|
| 354 | + $args['mid_size'] = max(9 - $args['current'], 3); |
|
| 355 | 355 | $args['prev_next'] = false; |
| 356 | 356 | |
| 357 | - if ( is_int( $prefs ) ) { |
|
| 357 | + if (is_int($prefs)) { |
|
| 358 | 358 | $args['mid_size'] = $prefs - 2; |
| 359 | 359 | } else { |
| 360 | - $args = array_merge( $args, $prefs ); |
|
| 360 | + $args = array_merge($args, $prefs); |
|
| 361 | 361 | } |
| 362 | 362 | |
| 363 | 363 | $data = array(); |
| 364 | - $data['pages'] = ClassyHelper::paginate_links( $args ); |
|
| 365 | - $next = get_next_posts_page_link( $args['total'] ); |
|
| 364 | + $data['pages'] = ClassyHelper::paginate_links($args); |
|
| 365 | + $next = get_next_posts_page_link($args['total']); |
|
| 366 | 366 | |
| 367 | - if ( $next ) { |
|
| 368 | - $data['next'] = array( 'link' => untrailingslashit( $next ), 'class' => 'page-numbers next' ); |
|
| 367 | + if ($next) { |
|
| 368 | + $data['next'] = array('link' => untrailingslashit($next), 'class' => 'page-numbers next'); |
|
| 369 | 369 | } |
| 370 | 370 | |
| 371 | - $prev = previous_posts( false ); |
|
| 371 | + $prev = previous_posts(false); |
|
| 372 | 372 | |
| 373 | - if ( $prev ) { |
|
| 374 | - $data['prev'] = array( 'link' => untrailingslashit( $prev ), 'class' => 'page-numbers prev' ); |
|
| 373 | + if ($prev) { |
|
| 374 | + $data['prev'] = array('link' => untrailingslashit($prev), 'class' => 'page-numbers prev'); |
|
| 375 | 375 | } |
| 376 | 376 | |
| 377 | - if ( $paged < 2 ) { |
|
| 377 | + if ($paged < 2) { |
|
| 378 | 378 | $data['prev'] = null; |
| 379 | 379 | } |
| 380 | 380 | |
@@ -190,7 +190,9 @@ discard block |
||
| 190 | 190 | |
| 191 | 191 | $vars = ClassyConfig::get_vars(); |
| 192 | 192 | |
| 193 | - if (isset($vars[$name])) return $vars[$name]; |
|
| 193 | + if (isset($vars[$name])) { |
|
| 194 | + return $vars[$name]; |
|
| 195 | + } |
|
| 194 | 196 | |
| 195 | 197 | return false; |
| 196 | 198 | |
@@ -230,13 +232,15 @@ discard block |
||
| 230 | 232 | |
| 231 | 233 | $scope = array_merge($common_scope, $data); |
| 232 | 234 | |
| 233 | - } else { |
|
| 235 | + } |
|
| 236 | + else { |
|
| 234 | 237 | |
| 235 | 238 | $scope = $common_scope; |
| 236 | 239 | |
| 237 | 240 | } |
| 238 | 241 | |
| 239 | - } else { |
|
| 242 | + } |
|
| 243 | + else { |
|
| 240 | 244 | |
| 241 | 245 | $template = ClassyTemplate::get_template(); |
| 242 | 246 | |
@@ -285,11 +289,13 @@ discard block |
||
| 285 | 289 | |
| 286 | 290 | $_return[] = new ClassyPost($post_id); |
| 287 | 291 | |
| 288 | - } elseif($return_type == 'object') { |
|
| 292 | + } |
|
| 293 | + elseif($return_type == 'object') { |
|
| 289 | 294 | |
| 290 | 295 | $_return[] = get_post($post_id); |
| 291 | 296 | |
| 292 | - } else { |
|
| 297 | + } |
|
| 298 | + else { |
|
| 293 | 299 | |
| 294 | 300 | $_return[] = $post_id; |
| 295 | 301 | |
@@ -344,7 +350,8 @@ discard block |
||
| 344 | 350 | $args['format'] = 'page/%#%'; |
| 345 | 351 | $args['base'] = trailingslashit( $url[0] ).'%_%'; |
| 346 | 352 | |
| 347 | - } else { |
|
| 353 | + } |
|
| 354 | + else { |
|
| 348 | 355 | $big = 999999999; |
| 349 | 356 | $args['base'] = str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ); |
| 350 | 357 | } |
@@ -356,7 +363,8 @@ discard block |
||
| 356 | 363 | |
| 357 | 364 | if ( is_int( $prefs ) ) { |
| 358 | 365 | $args['mid_size'] = $prefs - 2; |
| 359 | - } else { |
|
| 366 | + } |
|
| 367 | + else { |
|
| 360 | 368 | $args = array_merge( $args, $prefs ); |
| 361 | 369 | } |
| 362 | 370 | |
@@ -54,7 +54,7 @@ |
||
| 54 | 54 | |
| 55 | 55 | $templates = array(); |
| 56 | 56 | |
| 57 | - $files = (array) glob( THEME_PATH . '/' . self::$folder . '/*/*.blade.php' ); |
|
| 57 | + $files = (array) glob( THEME_PATH . '/' . self::$folder . '/*/*.blade.php' ); |
|
| 58 | 58 | |
| 59 | 59 | foreach ( $files as $filename ) { |
| 60 | 60 | |
@@ -54,19 +54,19 @@ |
||
| 54 | 54 | |
| 55 | 55 | $templates = array(); |
| 56 | 56 | |
| 57 | - $files = (array) glob( THEME_PATH . '/' . self::$folder . '/*/*.blade.php' ); |
|
| 57 | + $files = (array) glob(THEME_PATH.'/'.self::$folder.'/*/*.blade.php'); |
|
| 58 | 58 | |
| 59 | - foreach ( $files as $filename ) { |
|
| 59 | + foreach ($files as $filename) { |
|
| 60 | 60 | |
| 61 | - if ( !empty($filename) ) { |
|
| 61 | + if (!empty($filename)) { |
|
| 62 | 62 | |
| 63 | - if ( ! preg_match( '/\{\{\-\-\s*Template Name:(.*)\s*\-\-\}\}/mi', file_get_contents( $filename ), $header ) ) continue; |
|
| 63 | + if (!preg_match('/\{\{\-\-\s*Template Name:(.*)\s*\-\-\}\}/mi', file_get_contents($filename), $header)) continue; |
|
| 64 | 64 | |
| 65 | 65 | $template_name = trim($header[1]); |
| 66 | 66 | |
| 67 | 67 | preg_match('/\/([^\/]*)\.blade.php$/is', $filename, $filename_match); |
| 68 | 68 | |
| 69 | - $template_file = 'classy-' . $filename_match[1]; |
|
| 69 | + $template_file = 'classy-'.$filename_match[1]; |
|
| 70 | 70 | |
| 71 | 71 | $templates[$template_file] = $template_name; |
| 72 | 72 | |
@@ -60,7 +60,9 @@ |
||
| 60 | 60 | |
| 61 | 61 | if ( !empty($filename) ) { |
| 62 | 62 | |
| 63 | - if ( ! preg_match( '/\{\{\-\-\s*Template Name:(.*)\s*\-\-\}\}/mi', file_get_contents( $filename ), $header ) ) continue; |
|
| 63 | + if ( ! preg_match( '/\{\{\-\-\s*Template Name:(.*)\s*\-\-\}\}/mi', file_get_contents( $filename ), $header ) ) { |
|
| 64 | + continue; |
|
| 65 | + } |
|
| 64 | 66 | |
| 65 | 67 | $template_name = trim($header[1]); |
| 66 | 68 | |