@@ -18,18 +18,18 @@ discard block |
||
18 | 18 | * |
19 | 19 | * @return string |
20 | 20 | */ |
21 | - public function get( $slug, $name = '' ) |
|
21 | + public function get($slug, $name = '') |
|
22 | 22 | { |
23 | - $template = Utility::startWith( 'templates/', $slug ); |
|
23 | + $template = Utility::startWith('templates/', $slug); |
|
24 | 24 | $templates = ["{$template}.php"]; |
25 | - if( !empty( $name )) { |
|
26 | - $fileName = basename( $template ); |
|
27 | - $filePath = Utility::trimRight( $template, $fileName ); |
|
28 | - array_unshift( $templates, sprintf( '%s/%s.php', $filePath . $name, $fileName )); |
|
25 | + if (!empty($name)) { |
|
26 | + $fileName = basename($template); |
|
27 | + $filePath = Utility::trimRight($template, $fileName); |
|
28 | + array_unshift($templates, sprintf('%s/%s.php', $filePath . $name, $fileName)); |
|
29 | 29 | } |
30 | - $templates = array_unique( apply_filters( "castor/templates/{$slug}", $templates, $name )); |
|
31 | - $template = locate_template( $templates ); |
|
32 | - return empty( $template ) && file_exists( "{$slug}.php" ) |
|
30 | + $templates = array_unique(apply_filters("castor/templates/{$slug}", $templates, $name)); |
|
31 | + $template = locate_template($templates); |
|
32 | + return empty($template) && file_exists("{$slug}.php") |
|
33 | 33 | ? "{$slug}.php" |
34 | 34 | : $template; |
35 | 35 | } |
@@ -40,11 +40,11 @@ discard block |
||
40 | 40 | * |
41 | 41 | * @return void |
42 | 42 | */ |
43 | - public function load( $slug, $name = '' ) |
|
43 | + public function load($slug, $name = '') |
|
44 | 44 | { |
45 | - if( !empty(( $template = $this->get( $slug, $name )))) { |
|
46 | - Development::storeTemplatePath( $template ); |
|
47 | - load_template( $template, false ); |
|
45 | + if (!empty(($template = $this->get($slug, $name)))) { |
|
46 | + Development::storeTemplatePath($template); |
|
47 | + load_template($template, false); |
|
48 | 48 | } |
49 | 49 | } |
50 | 50 | |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | */ |
54 | 54 | public function main() |
55 | 55 | { |
56 | - $this->load( $this->template ); |
|
56 | + $this->load($this->template); |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | /** |
@@ -61,9 +61,9 @@ discard block |
||
61 | 61 | * |
62 | 62 | * @return string|void |
63 | 63 | */ |
64 | - public function setLayout( $template ) |
|
64 | + public function setLayout($template) |
|
65 | 65 | { |
66 | - $this->template = Utility::trimRight( $template, '.php' ); |
|
67 | - return $this->get( apply_filters( 'castor/templates/layout', 'layouts/default' )); |
|
66 | + $this->template = Utility::trimRight($template, '.php'); |
|
67 | + return $this->get(apply_filters('castor/templates/layout', 'layouts/default')); |
|
68 | 68 | } |
69 | 69 | } |
@@ -1,27 +1,27 @@ |
||
1 | -<?php defined( 'WPINC' ) || die; |
|
1 | +<?php defined('WPINC') || die; |
|
2 | 2 | |
3 | 3 | global $wp_version; |
4 | 4 | |
5 | -if( !is_admin() && version_compare( '7.0', phpversion(), '>' )) { |
|
5 | +if (!is_admin() && version_compare('7.0', phpversion(), '>')) { |
|
6 | 6 | wp_die( |
7 | - __( 'You must be using PHP 7.0.0 or greater.', 'castor' ), |
|
8 | - __( 'Unsupported PHP version', 'castor' ) |
|
7 | + __('You must be using PHP 7.0.0 or greater.', 'castor'), |
|
8 | + __('Unsupported PHP version', 'castor') |
|
9 | 9 | ); |
10 | 10 | } |
11 | 11 | |
12 | -if( !is_admin() && version_compare( '4.7', $wp_version, '>' )) { |
|
12 | +if (!is_admin() && version_compare('4.7', $wp_version, '>')) { |
|
13 | 13 | wp_die( |
14 | - __( 'You must be using WordPress 4.7.0 or greater.', 'castor' ), |
|
15 | - __( 'Unsupported WordPress version', 'castor' ) |
|
14 | + __('You must be using WordPress 4.7.0 or greater.', 'castor'), |
|
15 | + __('Unsupported WordPress version', 'castor') |
|
16 | 16 | ); |
17 | 17 | } |
18 | 18 | |
19 | -if( is_customize_preview() && filter_input( INPUT_GET, 'theme' )) { |
|
19 | +if (is_customize_preview() && filter_input(INPUT_GET, 'theme')) { |
|
20 | 20 | wp_die( |
21 | - __( 'Theme must be activated prior to using the customizer.', 'castor' ) |
|
21 | + __('Theme must be activated prior to using the customizer.', 'castor') |
|
22 | 22 | ); |
23 | 23 | } |
24 | 24 | |
25 | -require_once( ABSPATH . '/' . WPINC . '/class-oembed.php' ); |
|
25 | +require_once(ABSPATH . '/' . WPINC . '/class-oembed.php'); |
|
26 | 26 | |
27 | 27 | \GeminiLabs\Castor\Application::getInstance()->init(); |