@@ -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( '5.6', phpversion(), '>' )) { |
|
5 | +if (!is_admin() && version_compare('5.6', phpversion(), '>')) { |
|
6 | 6 | wp_die( |
7 | - __( 'You must be using PHP 5.6.0 or greater.', 'castor' ), |
|
8 | - __( 'Unsupported PHP version', 'castor' ) |
|
7 | + __('You must be using PHP 5.6.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(); |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | public $theme; |
15 | 15 | public $utility; |
16 | 16 | |
17 | - public function __construct( Media $media, PostMeta $postmeta, Theme $theme, Utility $utility ) |
|
17 | + public function __construct(Media $media, PostMeta $postmeta, Theme $theme, Utility $utility) |
|
18 | 18 | { |
19 | 19 | $this->media = $media; |
20 | 20 | $this->postmeta = $postmeta; |
@@ -22,114 +22,114 @@ discard block |
||
22 | 22 | $this->utility = $utility; |
23 | 23 | } |
24 | 24 | |
25 | - public function blockquote( $metaKey = false, array $attributes = [] ) |
|
25 | + public function blockquote($metaKey = false, array $attributes = []) |
|
26 | 26 | { |
27 | - if( $value = $this->postmeta->get( $metaKey )) { |
|
28 | - $this->utility->printTag( 'blockquote', wp_strip_all_tags( $value ), $attributes ); |
|
27 | + if ($value = $this->postmeta->get($metaKey)) { |
|
28 | + $this->utility->printTag('blockquote', wp_strip_all_tags($value), $attributes); |
|
29 | 29 | } |
30 | 30 | } |
31 | 31 | |
32 | - public function button( $postId = 0, $title = false ) |
|
32 | + public function button($postId = 0, $title = false) |
|
33 | 33 | { |
34 | - $post = get_post( $postId ); |
|
34 | + $post = get_post($postId); |
|
35 | 35 | |
36 | - if( !$postId || !$post )return; |
|
37 | - if( !$title ) { |
|
36 | + if (!$postId || !$post)return; |
|
37 | + if (!$title) { |
|
38 | 38 | $title = $post->post_title; |
39 | 39 | } |
40 | - printf( '<a href="%s" class="button"><span>%s</span></a>', |
|
41 | - get_permalink( $post->ID ), |
|
40 | + printf('<a href="%s" class="button"><span>%s</span></a>', |
|
41 | + get_permalink($post->ID), |
|
42 | 42 | $title |
43 | 43 | ); |
44 | 44 | } |
45 | 45 | |
46 | - public function buttons( $postIds = [] ) |
|
46 | + public function buttons($postIds = []) |
|
47 | 47 | { |
48 | - foreach( (array) $postIds as $postId ) { |
|
49 | - $this->button( $postId ); |
|
48 | + foreach ((array) $postIds as $postId) { |
|
49 | + $this->button($postId); |
|
50 | 50 | } |
51 | 51 | } |
52 | 52 | |
53 | - public function content( $metaKey = false ) |
|
53 | + public function content($metaKey = false) |
|
54 | 54 | { |
55 | 55 | $content = $metaKey |
56 | - ? $this->postmeta->get( $metaKey ) |
|
56 | + ? $this->postmeta->get($metaKey) |
|
57 | 57 | : get_the_content(); |
58 | 58 | |
59 | - echo str_replace( ']]>', ']]>', apply_filters( 'the_content', $content )); |
|
59 | + echo str_replace(']]>', ']]>', apply_filters('the_content', $content)); |
|
60 | 60 | } |
61 | 61 | |
62 | - public function copyright( array $args = [] ) |
|
62 | + public function copyright(array $args = []) |
|
63 | 63 | { |
64 | - extract( shortcode_atts([ |
|
65 | - 'copyright' => sprintf( '<span>%s </span>©', __( 'Copyright', 'castor' )), |
|
66 | - 'date' => date( 'Y' ), |
|
67 | - 'name' => get_bloginfo( 'name' ), |
|
64 | + extract(shortcode_atts([ |
|
65 | + 'copyright' => sprintf('<span>%s </span>©', __('Copyright', 'castor')), |
|
66 | + 'date' => date('Y'), |
|
67 | + 'name' => get_bloginfo('name'), |
|
68 | 68 | 'separator' => '—', |
69 | - ], $args )); |
|
70 | - if( $separator ) { |
|
69 | + ], $args)); |
|
70 | + if ($separator) { |
|
71 | 71 | $separator .= ' '; |
72 | 72 | } |
73 | - printf( '%s %s %s%s', $copyright, $date, $separator, $name ); |
|
73 | + printf('%s %s %s%s', $copyright, $date, $separator, $name); |
|
74 | 74 | } |
75 | 75 | |
76 | - public function featured( $args = [] ) |
|
76 | + public function featured($args = []) |
|
77 | 77 | { |
78 | - $args = wp_parse_args( $args, [ |
|
78 | + $args = wp_parse_args($args, [ |
|
79 | 79 | 'class' => 'featured', |
80 | 80 | 'image' => get_post_thumbnail_id(), |
81 | 81 | 'player' => '', |
82 | 82 | 'video' => 'featured_video', |
83 | 83 | ]); |
84 | - $featuredHtml = $this->media->video( wp_parse_args( $args, [ |
|
84 | + $featuredHtml = $this->media->video(wp_parse_args($args, [ |
|
85 | 85 | 'url' => $args['video'], |
86 | 86 | ])); |
87 | - if( empty( $featuredHtml ) && $featuredImage = $this->media->getImage( $args['image'] )) { |
|
87 | + if (empty($featuredHtml) && $featuredImage = $this->media->getImage($args['image'])) { |
|
88 | 88 | $featuredCaption = $featuredImage->caption |
89 | - ? sprintf( '<figcaption>%s</figcaption>', $featuredImage->caption ) |
|
89 | + ? sprintf('<figcaption>%s</figcaption>', $featuredImage->caption) |
|
90 | 90 | : ''; |
91 | - $featuredHtml = sprintf( '<div class="featured-image"><img src="%s" alt="%s"></div>%s', |
|
91 | + $featuredHtml = sprintf('<div class="featured-image"><img src="%s" alt="%s"></div>%s', |
|
92 | 92 | $featuredImage->large['url'], |
93 | 93 | $featuredImage->alt, |
94 | 94 | $featuredCaption |
95 | 95 | ); |
96 | 96 | } |
97 | - if( !empty( $featuredHtml )) { |
|
98 | - printf( '<figure class="%s">%s</figure>', $args['class'], $featuredHtml ); |
|
97 | + if (!empty($featuredHtml)) { |
|
98 | + printf('<figure class="%s">%s</figure>', $args['class'], $featuredHtml); |
|
99 | 99 | } |
100 | 100 | } |
101 | 101 | |
102 | - public function field( $name, array $args = [] ) |
|
102 | + public function field($name, array $args = []) |
|
103 | 103 | { |
104 | 104 | } |
105 | 105 | |
106 | - public function form( $name, array $args = [] ) |
|
106 | + public function form($name, array $args = []) |
|
107 | 107 | { |
108 | 108 | } |
109 | 109 | |
110 | - public function gallery( array $args = [] ) |
|
110 | + public function gallery(array $args = []) |
|
111 | 111 | { |
112 | - echo $this->media->gallery( $args ); |
|
112 | + echo $this->media->gallery($args); |
|
113 | 113 | } |
114 | 114 | |
115 | - public function madeWithLove( $name ) |
|
115 | + public function madeWithLove($name) |
|
116 | 116 | { |
117 | - printf( __( 'Made with %s by %s', 'castor' ), |
|
118 | - file_get_contents( sprintf( '%simg/heart.svg', \GeminiLabs\Castor\Application::getInstance()->assets )), |
|
117 | + printf(__('Made with %s by %s', 'castor'), |
|
118 | + file_get_contents(sprintf('%simg/heart.svg', \GeminiLabs\Castor\Application::getInstance()->assets)), |
|
119 | 119 | $name |
120 | 120 | ); |
121 | 121 | } |
122 | 122 | |
123 | - public function title( $metaKey = false, array $attributes = [] ) |
|
123 | + public function title($metaKey = false, array $attributes = []) |
|
124 | 124 | { |
125 | - $tag = apply_filters( 'castor/render/title/tag', 'h2' ); |
|
125 | + $tag = apply_filters('castor/render/title/tag', 'h2'); |
|
126 | 126 | $value = $metaKey |
127 | - ? $this->postmeta->get( $metaKey ) |
|
127 | + ? $this->postmeta->get($metaKey) |
|
128 | 128 | : $this->theme->pageTitle(); |
129 | 129 | |
130 | - if( !$value )return; |
|
130 | + if (!$value)return; |
|
131 | 131 | |
132 | - $this->utility->printTag( $tag, wp_strip_all_tags( $value ), $attributes ); |
|
132 | + $this->utility->printTag($tag, wp_strip_all_tags($value), $attributes); |
|
133 | 133 | } |
134 | 134 | |
135 | 135 | /** |
@@ -137,8 +137,8 @@ discard block |
||
137 | 137 | * |
138 | 138 | * @return string|null |
139 | 139 | */ |
140 | - public function video( $args ) |
|
140 | + public function video($args) |
|
141 | 141 | { |
142 | - echo $this->media->video( $args ); |
|
142 | + echo $this->media->video($args); |
|
143 | 143 | } |
144 | 144 | } |
@@ -10,33 +10,33 @@ discard block |
||
10 | 10 | |
11 | 11 | protected $utility; |
12 | 12 | |
13 | - public function __construct( Utility $utility ) |
|
13 | + public function __construct(Utility $utility) |
|
14 | 14 | { |
15 | - $this->utility = $utility; |
|
15 | + $this->utility = $utility; |
|
16 | 16 | } |
17 | 17 | |
18 | 18 | public function capture() |
19 | 19 | { |
20 | 20 | ob_start(); |
21 | - call_user_func_array( [$this, 'printF'], func_get_args() ); |
|
21 | + call_user_func_array([$this, 'printF'], func_get_args()); |
|
22 | 22 | return ob_get_clean(); |
23 | 23 | } |
24 | 24 | |
25 | 25 | public function className() |
26 | 26 | { |
27 | - return $this->isDev() && in_array( DEV, ['css', true] ) |
|
27 | + return $this->isDev() && in_array(DEV, ['css', true]) |
|
28 | 28 | ? 'dev' |
29 | 29 | : ''; |
30 | 30 | } |
31 | 31 | |
32 | 32 | public function debug() |
33 | 33 | { |
34 | - call_user_func_array( [$this, 'printF'], func_get_args() ); |
|
34 | + call_user_func_array([$this, 'printF'], func_get_args()); |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | public function isDev() |
38 | 38 | { |
39 | - return defined( 'DEV' ) && !!DEV && WP_ENV == 'development'; |
|
39 | + return defined('DEV') && !!DEV && WP_ENV == 'development'; |
|
40 | 40 | } |
41 | 41 | |
42 | 42 | public function isProduction() |
@@ -44,27 +44,27 @@ discard block |
||
44 | 44 | return WP_ENV == 'production'; |
45 | 45 | } |
46 | 46 | |
47 | - public function printFiltersFor( $hook = '' ) |
|
47 | + public function printFiltersFor($hook = '') |
|
48 | 48 | { |
49 | 49 | global $wp_filter; |
50 | - if( empty( $hook ) || !isset( $wp_filter[$hook] ))return; |
|
51 | - $this->printF( $wp_filter[ $hook ] ); |
|
50 | + if (empty($hook) || !isset($wp_filter[$hook]))return; |
|
51 | + $this->printF($wp_filter[$hook]); |
|
52 | 52 | } |
53 | 53 | |
54 | 54 | public function printTemplatePaths() |
55 | 55 | { |
56 | - if( $this->isDev() && ( DEV == 'templates' || DEV === true )) { |
|
57 | - $templates = array_map( function( $key, $value ) { |
|
58 | - return sprintf( '[%s] => %s', $key, $value ); |
|
59 | - }, array_keys( $this->templatePaths ), $this->templatePaths ); |
|
60 | - $this->printF( implode( "\n", $templates )); |
|
56 | + if ($this->isDev() && (DEV == 'templates' || DEV === true)) { |
|
57 | + $templates = array_map(function($key, $value) { |
|
58 | + return sprintf('[%s] => %s', $key, $value); |
|
59 | + }, array_keys($this->templatePaths), $this->templatePaths); |
|
60 | + $this->printF(implode("\n", $templates)); |
|
61 | 61 | } |
62 | 62 | } |
63 | 63 | |
64 | - public function storeTemplatePath( $template ) |
|
64 | + public function storeTemplatePath($template) |
|
65 | 65 | { |
66 | - if( is_string( $template )) { |
|
67 | - $this->templatePaths[] = $this->utility->trimLeft( $template, trailingslashit( WP_CONTENT_DIR )); |
|
66 | + if (is_string($template)) { |
|
67 | + $this->templatePaths[] = $this->utility->trimLeft($template, trailingslashit(WP_CONTENT_DIR)); |
|
68 | 68 | } |
69 | 69 | } |
70 | 70 | |
@@ -72,15 +72,15 @@ discard block |
||
72 | 72 | { |
73 | 73 | $args = func_num_args(); |
74 | 74 | |
75 | - if( $args == 1 ) { |
|
76 | - printf( '<div class="print__r"><pre>%s</pre></div>', |
|
77 | - htmlspecialchars( print_r( func_get_arg(0), true ), ENT_QUOTES, 'UTF-8' ) |
|
75 | + if ($args == 1) { |
|
76 | + printf('<div class="print__r"><pre>%s</pre></div>', |
|
77 | + htmlspecialchars(print_r(func_get_arg(0), true), ENT_QUOTES, 'UTF-8') |
|
78 | 78 | ); |
79 | 79 | } |
80 | - else if( $args > 1 ) { |
|
80 | + else if ($args > 1) { |
|
81 | 81 | echo '<div class="print__r_group">'; |
82 | - foreach( func_get_args() as $value ) { |
|
83 | - $this->printF( $value ); |
|
82 | + foreach (func_get_args() as $value) { |
|
83 | + $this->printF($value); |
|
84 | 84 | } |
85 | 85 | echo '</div>'; |
86 | 86 | } |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | protected $image; |
22 | 22 | protected $video; |
23 | 23 | |
24 | - public function __construct( Gallery $gallery, Image $image, Video $video ) |
|
24 | + public function __construct(Gallery $gallery, Image $image, Video $video) |
|
25 | 25 | { |
26 | 26 | $this->gallery = $gallery; |
27 | 27 | $this->image = $image; |
@@ -33,17 +33,17 @@ discard block |
||
33 | 33 | * @return string|void |
34 | 34 | * @throws BadMethodCallException |
35 | 35 | */ |
36 | - public function __call( $name, array $args ) |
|
36 | + public function __call($name, array $args) |
|
37 | 37 | { |
38 | - $mediaType = $this->validateMethod( $name ); |
|
39 | - $args = $this->validateArgs( $args, $mediaType ); |
|
38 | + $mediaType = $this->validateMethod($name); |
|
39 | + $args = $this->validateArgs($args, $mediaType); |
|
40 | 40 | |
41 | - if( str_replace( $mediaType, '', strtolower( $name ))) { |
|
42 | - return $this->$mediaType->get( $args[0] )->$mediaType; |
|
41 | + if (str_replace($mediaType, '', strtolower($name))) { |
|
42 | + return $this->$mediaType->get($args[0])->$mediaType; |
|
43 | 43 | } |
44 | - return !empty( $args[1] ) |
|
45 | - ? $this->$mediaType->get( $args[0] )->render( $args[1] ) |
|
46 | - : $this->$mediaType->get( $args[0] )->render(); |
|
44 | + return !empty($args[1]) |
|
45 | + ? $this->$mediaType->get($args[0])->render($args[1]) |
|
46 | + : $this->$mediaType->get($args[0])->render(); |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | /** |
@@ -52,10 +52,10 @@ discard block |
||
52 | 52 | * @return mixed |
53 | 53 | * @throws BadMethodCallException |
54 | 54 | */ |
55 | - public function get( $name, $args = [] ) |
|
55 | + public function get($name, $args = []) |
|
56 | 56 | { |
57 | - $mediaType = $this->validateMethod( $name ); |
|
58 | - return $this->$mediaType->get( $args )->$mediaType; |
|
57 | + $mediaType = $this->validateMethod($name); |
|
58 | + return $this->$mediaType->get($args)->$mediaType; |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | /** |
@@ -63,15 +63,15 @@ discard block |
||
63 | 63 | * @return array |
64 | 64 | * @throws BadMethodCallException |
65 | 65 | */ |
66 | - protected function validateArgs( array $args, $name ) |
|
66 | + protected function validateArgs(array $args, $name) |
|
67 | 67 | { |
68 | - if( !count( $args ) && $name == 'image' ) { |
|
68 | + if (!count($args) && $name == 'image') { |
|
69 | 69 | $args[] = get_post_thumbnail_id(); |
70 | 70 | } |
71 | - if( count( $args )) { |
|
71 | + if (count($args)) { |
|
72 | 72 | return $args; |
73 | 73 | } |
74 | - throw new BadMethodCallException( sprintf( 'Missing arguments for: %s', $name )); |
|
74 | + throw new BadMethodCallException(sprintf('Missing arguments for: %s', $name)); |
|
75 | 75 | } |
76 | 76 | |
77 | 77 | /** |
@@ -79,13 +79,13 @@ discard block |
||
79 | 79 | * @return string|false |
80 | 80 | * @throws BadMethodCallException |
81 | 81 | */ |
82 | - protected function validateMethod( $name ) |
|
82 | + protected function validateMethod($name) |
|
83 | 83 | { |
84 | - foreach( [$name, strtolower( substr( $name, 3 ))] as $method ) { |
|
85 | - if( property_exists( $this, $method ) && is_object( $this->$method )) { |
|
84 | + foreach ([$name, strtolower(substr($name, 3))] as $method) { |
|
85 | + if (property_exists($this, $method) && is_object($this->$method)) { |
|
86 | 86 | return $method; |
87 | 87 | } |
88 | 88 | } |
89 | - throw new BadMethodCallException( sprintf( 'Not a valid method: %s', $name )); |
|
89 | + throw new BadMethodCallException(sprintf('Not a valid method: %s', $name)); |
|
90 | 90 | } |
91 | 91 | } |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | { |
9 | 9 | public $postmeta; |
10 | 10 | |
11 | - public function __construct( PostMeta $postmeta ) |
|
11 | + public function __construct(PostMeta $postmeta) |
|
12 | 12 | { |
13 | 13 | $this->postmeta = $postmeta; |
14 | 14 | } |
@@ -18,9 +18,9 @@ discard block |
||
18 | 18 | * |
19 | 19 | * @return string |
20 | 20 | */ |
21 | - public function assetPath( $asset ) |
|
21 | + public function assetPath($asset) |
|
22 | 22 | { |
23 | - return $this->paths( 'dir.stylesheet' ) . 'assets/' . $asset; |
|
23 | + return $this->paths('dir.stylesheet') . 'assets/' . $asset; |
|
24 | 24 | } |
25 | 25 | |
26 | 26 | /** |
@@ -28,9 +28,9 @@ discard block |
||
28 | 28 | * |
29 | 29 | * @return string |
30 | 30 | */ |
31 | - public function assetUri( $asset ) |
|
31 | + public function assetUri($asset) |
|
32 | 32 | { |
33 | - return $this->paths( 'uri.stylesheet' ) . 'assets/' . $asset; |
|
33 | + return $this->paths('uri.stylesheet') . 'assets/' . $asset; |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | /** |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | */ |
39 | 39 | public function copyright() |
40 | 40 | { |
41 | - return __( 'Copyright', 'castor' ) . ' © ' . date( 'Y' ) . ', ' . get_bloginfo( 'name' ); |
|
41 | + return __('Copyright', 'castor') . ' © ' . date('Y') . ', ' . get_bloginfo('name'); |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | /** |
@@ -52,9 +52,9 @@ discard block |
||
52 | 52 | is_single(), |
53 | 53 | ]; |
54 | 54 | |
55 | - $display = in_array( true, $conditions ); |
|
55 | + $display = in_array(true, $conditions); |
|
56 | 56 | |
57 | - return apply_filters( 'castor/display/sidebar', $display ); |
|
57 | + return apply_filters('castor/display/sidebar', $display); |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | /** |
@@ -62,9 +62,9 @@ discard block |
||
62 | 62 | * |
63 | 63 | * @return string |
64 | 64 | */ |
65 | - public function imagePath( $asset ) |
|
65 | + public function imagePath($asset) |
|
66 | 66 | { |
67 | - return $this->paths( 'dir.stylesheet' ) . 'assets/img/' . $asset; |
|
67 | + return $this->paths('dir.stylesheet') . 'assets/img/' . $asset; |
|
68 | 68 | } |
69 | 69 | |
70 | 70 | /** |
@@ -72,16 +72,16 @@ discard block |
||
72 | 72 | * |
73 | 73 | * @return string |
74 | 74 | */ |
75 | - public function imageUri( $asset ) |
|
75 | + public function imageUri($asset) |
|
76 | 76 | { |
77 | - return $this->paths( 'uri.stylesheet' ) . 'assets/img/' . $asset; |
|
77 | + return $this->paths('uri.stylesheet') . 'assets/img/' . $asset; |
|
78 | 78 | } |
79 | 79 | |
80 | 80 | public function pageTitle() |
81 | 81 | { |
82 | - foreach( ['is_404', 'is_archive', 'is_home', 'is_page', 'is_search'] as $bool ) { |
|
83 | - if( !$bool() )continue; |
|
84 | - $method = sprintf( 'get%sTitle', ucfirst( str_replace( 'is_', '', $bool ))); |
|
82 | + foreach (['is_404', 'is_archive', 'is_home', 'is_page', 'is_search'] as $bool) { |
|
83 | + if (!$bool())continue; |
|
84 | + $method = sprintf('get%sTitle', ucfirst(str_replace('is_', '', $bool))); |
|
85 | 85 | return $this->$method(); |
86 | 86 | } |
87 | 87 | |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | * |
94 | 94 | * @return array|string |
95 | 95 | */ |
96 | - public function paths( $path = null ) |
|
96 | + public function paths($path = null) |
|
97 | 97 | { |
98 | 98 | $paths = [ |
99 | 99 | 'dir.stylesheet' => get_stylesheet_directory(), |
@@ -103,12 +103,12 @@ discard block |
||
103 | 103 | 'uri.template' => get_template_directory_uri(), |
104 | 104 | ]; |
105 | 105 | |
106 | - if( is_null( $path )) { |
|
106 | + if (is_null($path)) { |
|
107 | 107 | return $paths; |
108 | 108 | } |
109 | 109 | |
110 | - return array_key_exists( $path, $paths ) |
|
111 | - ? trailingslashit( $paths[$path] ) |
|
110 | + return array_key_exists($path, $paths) |
|
111 | + ? trailingslashit($paths[$path]) |
|
112 | 112 | : ''; |
113 | 113 | } |
114 | 114 | |
@@ -117,16 +117,16 @@ discard block |
||
117 | 117 | * |
118 | 118 | * @return string|null |
119 | 119 | */ |
120 | - public function svg( $path = null ) |
|
120 | + public function svg($path = null) |
|
121 | 121 | { |
122 | - if( file_exists( $this->imagePath( $path ))) { |
|
123 | - return file_get_contents( $this->imageUri( $path )); |
|
122 | + if (file_exists($this->imagePath($path))) { |
|
123 | + return file_get_contents($this->imageUri($path)); |
|
124 | 124 | } |
125 | 125 | } |
126 | 126 | |
127 | 127 | protected function get404Title() |
128 | 128 | { |
129 | - return __( 'Not Found', 'castor' ); |
|
129 | + return __('Not Found', 'castor'); |
|
130 | 130 | } |
131 | 131 | |
132 | 132 | protected function getArchiveTitle() |
@@ -136,20 +136,20 @@ discard block |
||
136 | 136 | |
137 | 137 | protected function getHomeTitle() |
138 | 138 | { |
139 | - return ( $home = get_option( 'page_for_posts', true )) |
|
140 | - ? get_the_title( $home ) |
|
141 | - : __( 'Latest Posts', 'castor' ); |
|
139 | + return ($home = get_option('page_for_posts', true)) |
|
140 | + ? get_the_title($home) |
|
141 | + : __('Latest Posts', 'castor'); |
|
142 | 142 | } |
143 | 143 | |
144 | 144 | protected function getPageTitle() |
145 | 145 | { |
146 | - return ($title = $this->postmeta->get( 'title' )) |
|
146 | + return ($title = $this->postmeta->get('title')) |
|
147 | 147 | ? $title |
148 | 148 | : get_the_title(); |
149 | 149 | } |
150 | 150 | |
151 | 151 | protected function getSearchTitle() |
152 | 152 | { |
153 | - return sprintf( __( 'Search Results for %s', 'castor' ), get_search_query() ); |
|
153 | + return sprintf(__('Search Results for %s', 'castor'), get_search_query()); |
|
154 | 154 | } |
155 | 155 | } |
@@ -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 | } |