@@ -11,29 +11,29 @@ discard block |
||
11 | 11 | public function __construct() |
12 | 12 | { |
13 | 13 | Facade::clearResolvedInstances(); |
14 | - Facade::setFacadeApplication( $this ); |
|
14 | + Facade::setFacadeApplication($this); |
|
15 | 15 | $this->registerAliases(); |
16 | 16 | } |
17 | 17 | |
18 | 18 | public function init() |
19 | 19 | { |
20 | - $controller = $this->make( 'Controller' ); |
|
20 | + $controller = $this->make('Controller'); |
|
21 | 21 | |
22 | 22 | // Action hooks |
23 | - add_action( 'after_setup_theme', [$controller, 'afterSetupTheme'], 20 ); |
|
24 | - add_action( 'login_head', [$controller, 'login'] ); |
|
25 | - add_action( 'wp_enqueue_scripts', [$controller, 'registerAssets'] ); |
|
26 | - add_action( 'customize_register', [$controller, 'registerCustomizer'] ); |
|
27 | - add_action( 'customize_preview_init', [$controller, 'registerCustomizerAssets'] ); |
|
28 | - add_action( 'widgets_init', [$controller, 'registerSidebars'] ); |
|
23 | + add_action('after_setup_theme', [$controller, 'afterSetupTheme'], 20); |
|
24 | + add_action('login_head', [$controller, 'login']); |
|
25 | + add_action('wp_enqueue_scripts', [$controller, 'registerAssets']); |
|
26 | + add_action('customize_register', [$controller, 'registerCustomizer']); |
|
27 | + add_action('customize_preview_init', [$controller, 'registerCustomizerAssets']); |
|
28 | + add_action('widgets_init', [$controller, 'registerSidebars']); |
|
29 | 29 | |
30 | 30 | // Filter hooks |
31 | - add_filter( 'template_include', [$controller, 'filterTemplate'] ); |
|
32 | - add_filter( 'login_headertitle', [$controller, 'filterLoginTitle'] ); |
|
33 | - add_filter( 'login_headerurl', [$controller, 'filterLoginUrl'] ); |
|
31 | + add_filter('template_include', [$controller, 'filterTemplate']); |
|
32 | + add_filter('login_headertitle', [$controller, 'filterLoginTitle']); |
|
33 | + add_filter('login_headerurl', [$controller, 'filterLoginUrl']); |
|
34 | 34 | |
35 | - foreach( $this->getTemplateTypes() as $type ) { |
|
36 | - add_filter( "{$type}_template_hierarchy", [$controller, 'filterTemplateHierarchy'] ); |
|
35 | + foreach ($this->getTemplateTypes() as $type) { |
|
36 | + add_filter("{$type}_template_hierarchy", [$controller, 'filterTemplateHierarchy']); |
|
37 | 37 | } |
38 | 38 | } |
39 | 39 | |
@@ -51,9 +51,9 @@ discard block |
||
51 | 51 | 'Utility' => Facades\Utility::class, |
52 | 52 | ]; |
53 | 53 | |
54 | - $aliases = apply_filters( 'castor/register/aliases', $aliases ); |
|
54 | + $aliases = apply_filters('castor/register/aliases', $aliases); |
|
55 | 55 | |
56 | - AliasLoader::getInstance( $aliases )->register(); |
|
56 | + AliasLoader::getInstance($aliases)->register(); |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | /** |
@@ -9,25 +9,25 @@ discard block |
||
9 | 9 | public function capture() |
10 | 10 | { |
11 | 11 | ob_start(); |
12 | - call_user_func_array( [$this, 'print'], func_get_args() ); |
|
12 | + call_user_func_array([$this, 'print'], func_get_args()); |
|
13 | 13 | return ob_get_clean(); |
14 | 14 | } |
15 | 15 | |
16 | 16 | public function className() |
17 | 17 | { |
18 | - return $this->isDev() && in_array( DEV, ['css', true] ) |
|
18 | + return $this->isDev() && in_array(DEV, ['css', true]) |
|
19 | 19 | ? 'dev' |
20 | 20 | : ''; |
21 | 21 | } |
22 | 22 | |
23 | 23 | public function debug() |
24 | 24 | { |
25 | - call_user_func_array( [$this, 'print'], func_get_args() ); |
|
25 | + call_user_func_array([$this, 'print'], func_get_args()); |
|
26 | 26 | } |
27 | 27 | |
28 | 28 | public function isDev() |
29 | 29 | { |
30 | - return defined( 'DEV' ) && !!DEV && WP_ENV == 'development'; |
|
30 | + return defined('DEV') && !!DEV && WP_ENV == 'development'; |
|
31 | 31 | } |
32 | 32 | |
33 | 33 | public function isProduction() |
@@ -39,44 +39,44 @@ discard block |
||
39 | 39 | { |
40 | 40 | $args = func_num_args(); |
41 | 41 | |
42 | - if( $args == 1 ) { |
|
43 | - printf( '<div class="print__r"><pre>%s</pre></div>', |
|
44 | - htmlspecialchars( print_r( func_get_arg(0), true ), ENT_QUOTES, 'UTF-8' ) |
|
42 | + if ($args == 1) { |
|
43 | + printf('<div class="print__r"><pre>%s</pre></div>', |
|
44 | + htmlspecialchars(print_r(func_get_arg(0), true), ENT_QUOTES, 'UTF-8') |
|
45 | 45 | ); |
46 | 46 | } |
47 | - else if( $args > 1 ) { |
|
47 | + else if ($args > 1) { |
|
48 | 48 | echo '<div class="print__r_group">'; |
49 | - foreach( func_get_args() as $value ) { |
|
50 | - $this->print( $value ); |
|
49 | + foreach (func_get_args() as $value) { |
|
50 | + $this->print($value); |
|
51 | 51 | } |
52 | 52 | echo '</div>'; |
53 | 53 | } |
54 | 54 | } |
55 | 55 | |
56 | - public function printFiltersFor( $hook = '' ) |
|
56 | + public function printFiltersFor($hook = '') |
|
57 | 57 | { |
58 | 58 | global $wp_filter; |
59 | - if( empty( $hook ) || !isset( $wp_filter[$hook] ))return; |
|
60 | - $this->print( $wp_filter[ $hook ] ); |
|
59 | + if (empty($hook) || !isset($wp_filter[$hook]))return; |
|
60 | + $this->print($wp_filter[$hook]); |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | public function printTemplatePaths() |
64 | 64 | { |
65 | - if( $this->isDev() && ( DEV == 'templates' || DEV === true )) { |
|
66 | - $templates = array_keys( array_flip( $this->templatePaths )); |
|
67 | - $templates = array_map( function( $key, $value ) { |
|
68 | - return sprintf( '[%s] => %s', $key, $value ); |
|
69 | - }, array_keys( $templates ), $templates ); |
|
65 | + if ($this->isDev() && (DEV == 'templates' || DEV === true)) { |
|
66 | + $templates = array_keys(array_flip($this->templatePaths)); |
|
67 | + $templates = array_map(function($key, $value) { |
|
68 | + return sprintf('[%s] => %s', $key, $value); |
|
69 | + }, array_keys($templates), $templates); |
|
70 | 70 | |
71 | - $this->print( implode( "\n", $templates )); |
|
71 | + $this->print(implode("\n", $templates)); |
|
72 | 72 | } |
73 | 73 | } |
74 | 74 | |
75 | - public function storeTemplatePath( $template ) |
|
75 | + public function storeTemplatePath($template) |
|
76 | 76 | { |
77 | - if( is_string( $template )) { |
|
78 | - $themeName = basename( strstr( $template, '/templates/', true )); |
|
79 | - $this->templatePaths[] = $themeName . strstr( $template, '/templates/' ); |
|
77 | + if (is_string($template)) { |
|
78 | + $themeName = basename(strstr($template, '/templates/', true)); |
|
79 | + $this->templatePaths[] = $themeName . strstr($template, '/templates/'); |
|
80 | 80 | } |
81 | 81 | } |
82 | 82 | } |
@@ -43,8 +43,7 @@ discard block |
||
43 | 43 | printf( '<div class="print__r"><pre>%s</pre></div>', |
44 | 44 | htmlspecialchars( print_r( func_get_arg(0), true ), ENT_QUOTES, 'UTF-8' ) |
45 | 45 | ); |
46 | - } |
|
47 | - else if( $args > 1 ) { |
|
46 | + } else if( $args > 1 ) { |
|
48 | 47 | echo '<div class="print__r_group">'; |
49 | 48 | foreach( func_get_args() as $value ) { |
50 | 49 | $this->print( $value ); |
@@ -56,7 +55,9 @@ discard block |
||
56 | 55 | public function printFiltersFor( $hook = '' ) |
57 | 56 | { |
58 | 57 | global $wp_filter; |
59 | - if( empty( $hook ) || !isset( $wp_filter[$hook] ))return; |
|
58 | + if( empty( $hook ) || !isset( $wp_filter[$hook] )) { |
|
59 | + return; |
|
60 | + } |
|
60 | 61 | $this->print( $wp_filter[ $hook ] ); |
61 | 62 | } |
62 | 63 |
@@ -6,13 +6,13 @@ |
||
6 | 6 | |
7 | 7 | class Render extends Facade |
8 | 8 | { |
9 | - /** |
|
10 | - * Get the fully qualified class name of the component. |
|
11 | - * |
|
12 | - * @return string |
|
13 | - */ |
|
14 | - protected static function getFacadeAccessor() |
|
15 | - { |
|
16 | - return \GeminiLabs\Castor\Helpers\Render::class; |
|
17 | - } |
|
9 | + /** |
|
10 | + * Get the fully qualified class name of the component. |
|
11 | + * |
|
12 | + * @return string |
|
13 | + */ |
|
14 | + protected static function getFacadeAccessor() |
|
15 | + { |
|
16 | + return \GeminiLabs\Castor\Helpers\Render::class; |
|
17 | + } |
|
18 | 18 | } |
@@ -33,7 +33,9 @@ discard block |
||
33 | 33 | { |
34 | 34 | $post = get_post( $postId ); |
35 | 35 | |
36 | - if( !$postId || !$post )return; |
|
36 | + if( !$postId || !$post ) { |
|
37 | + return; |
|
38 | + } |
|
37 | 39 | if( !$title ) { |
38 | 40 | $title = $post->post_title; |
39 | 41 | } |
@@ -71,7 +73,9 @@ discard block |
||
71 | 73 | ? $this->postmeta->get( $metaKey ) |
72 | 74 | : $this->theme->pageTitle(); |
73 | 75 | |
74 | - if( !$value )return; |
|
76 | + if( !$value ) { |
|
77 | + return; |
|
78 | + } |
|
75 | 79 | |
76 | 80 | $this->utility->printTag( $tag, wp_strip_all_tags( $value ), $attributes ); |
77 | 81 | } |
@@ -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,88 +22,88 @@ 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 featured( $args = [] ) |
|
62 | + public function featured($args = []) |
|
63 | 63 | { |
64 | - $args = wp_parse_args( $args, [ |
|
64 | + $args = wp_parse_args($args, [ |
|
65 | 65 | 'class' => 'featured', |
66 | 66 | 'image' => get_post_thumbnail_id(), |
67 | 67 | 'video' => 'featured_video', |
68 | 68 | ]); |
69 | - $featuredHtml = $this->media->video( wp_parse_args( $args, [ |
|
69 | + $featuredHtml = $this->media->video(wp_parse_args($args, [ |
|
70 | 70 | 'url' => $args['video'], |
71 | 71 | ])); |
72 | - if( empty( $featuredHtml ) && $featuredImage = $this->media->getImage( $args['image'] )) { |
|
73 | - $featuredHtml = sprintf( '<div class="featured-image"><img src="%s" alt="%s"></div><figcaption>%s</figcaption>', |
|
72 | + if (empty($featuredHtml) && $featuredImage = $this->media->getImage($args['image'])) { |
|
73 | + $featuredHtml = sprintf('<div class="featured-image"><img src="%s" alt="%s"></div><figcaption>%s</figcaption>', |
|
74 | 74 | $featuredImage->large['url'], |
75 | 75 | $featuredImage->alt, |
76 | 76 | $featuredImage->caption |
77 | 77 | ); |
78 | 78 | } |
79 | - if( !empty( $featuredHtml )) { |
|
80 | - printf( '<figure class="%s">%s</figure>', $args['class'], $featuredHtml ); |
|
79 | + if (!empty($featuredHtml)) { |
|
80 | + printf('<figure class="%s">%s</figure>', $args['class'], $featuredHtml); |
|
81 | 81 | } |
82 | 82 | } |
83 | 83 | |
84 | - public function field( $name, array $args = [] ) |
|
84 | + public function field($name, array $args = []) |
|
85 | 85 | { |
86 | 86 | } |
87 | 87 | |
88 | - public function form( $name, array $args = [] ) |
|
88 | + public function form($name, array $args = []) |
|
89 | 89 | { |
90 | 90 | } |
91 | 91 | |
92 | - public function gallery( array $args = [] ) |
|
92 | + public function gallery(array $args = []) |
|
93 | 93 | { |
94 | - echo $this->media->gallery( $args ); |
|
94 | + echo $this->media->gallery($args); |
|
95 | 95 | } |
96 | 96 | |
97 | - public function title( $metaKey = false, array $attributes = [] ) |
|
97 | + public function title($metaKey = false, array $attributes = []) |
|
98 | 98 | { |
99 | - $tag = apply_filters( 'castor/render/title/tag', 'h2' ); |
|
99 | + $tag = apply_filters('castor/render/title/tag', 'h2'); |
|
100 | 100 | $value = $metaKey |
101 | - ? $this->postmeta->get( $metaKey ) |
|
101 | + ? $this->postmeta->get($metaKey) |
|
102 | 102 | : $this->theme->pageTitle(); |
103 | 103 | |
104 | - if( !$value )return; |
|
104 | + if (!$value)return; |
|
105 | 105 | |
106 | - $this->utility->printTag( $tag, wp_strip_all_tags( $value ), $attributes ); |
|
106 | + $this->utility->printTag($tag, wp_strip_all_tags($value), $attributes); |
|
107 | 107 | } |
108 | 108 | |
109 | 109 | /** |
@@ -111,8 +111,8 @@ discard block |
||
111 | 111 | * |
112 | 112 | * @return string|null |
113 | 113 | */ |
114 | - public function video( $args ) |
|
114 | + public function video($args) |
|
115 | 115 | { |
116 | - echo $this->media->video( $args ); |
|
116 | + echo $this->media->video($args); |
|
117 | 117 | } |
118 | 118 | } |
@@ -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( version_compare( '5.6.0', phpversion(), '>=' )) { |
|
5 | +if (version_compare('5.6.0', 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( version_compare( '4.7.0', $wp_version, '>=' )) { |
|
12 | +if (version_compare('4.7.0', $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(); |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | protected $theme; |
20 | 20 | protected $utility; |
21 | 21 | |
22 | - public function __construct( Image $image, PostMeta $postmeta, Theme $theme, Utility $utility ) |
|
22 | + public function __construct(Image $image, PostMeta $postmeta, Theme $theme, Utility $utility) |
|
23 | 23 | { |
24 | 24 | $this->image = $image; |
25 | 25 | $this->postmeta = $postmeta; |
@@ -30,9 +30,9 @@ discard block |
||
30 | 30 | /** |
31 | 31 | * @return WP_Query |
32 | 32 | */ |
33 | - public function get( array $args = [] ) |
|
33 | + public function get(array $args = []) |
|
34 | 34 | { |
35 | - $this->normalizeArgs( $args ); |
|
35 | + $this->normalizeArgs($args); |
|
36 | 36 | |
37 | 37 | $this->gallery = new WP_Query([ |
38 | 38 | 'orderby' => 'post__in', |
@@ -52,20 +52,20 @@ discard block |
||
52 | 52 | */ |
53 | 53 | public function render() |
54 | 54 | { |
55 | - $images = array_reduce( $this->gallery->posts, function( $images, $attachment ) { |
|
56 | - return $images . $this->renderImage( $attachment ); |
|
55 | + $images = array_reduce($this->gallery->posts, function($images, $attachment) { |
|
56 | + return $images . $this->renderImage($attachment); |
|
57 | 57 | }); |
58 | - return sprintf( '<div class="gallery-images" itemscope itemtype="http://schema.org/ImageGallery">%s</div>', $images ); |
|
58 | + return sprintf('<div class="gallery-images" itemscope itemtype="http://schema.org/ImageGallery">%s</div>', $images); |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | /** |
62 | 62 | * @return null|string |
63 | 63 | */ |
64 | - public function renderImage( WP_Post $attachment ) |
|
64 | + public function renderImage(WP_Post $attachment) |
|
65 | 65 | { |
66 | - $image = $this->image->get( $attachment->ID )->image; |
|
66 | + $image = $this->image->get($attachment->ID)->image; |
|
67 | 67 | |
68 | - if( !$image )return; |
|
68 | + if (!$image)return; |
|
69 | 69 | return sprintf( |
70 | 70 | '<figure class="gallery-image" data-w="%s" data-h="%s" data-ps=\'%s\' itemprop="associatedMedia" itemscope itemtype="http://schema.org/ImageObject">' . |
71 | 71 | '%s<figcaption itemprop="caption description">' . |
@@ -74,8 +74,8 @@ discard block |
||
74 | 74 | '</figure>', |
75 | 75 | $image->thumbnail['width'], |
76 | 76 | $image->thumbnail['height'], |
77 | - $this->getPhotoswipeData( $image ), |
|
78 | - $this->renderImageTag( $image ), |
|
77 | + $this->getPhotoswipeData($image), |
|
78 | + $this->renderImageTag($image), |
|
79 | 79 | $image->caption, |
80 | 80 | $image->copyright |
81 | 81 | ); |
@@ -86,13 +86,13 @@ discard block |
||
86 | 86 | */ |
87 | 87 | public function renderPagination() |
88 | 88 | { |
89 | - if( !$this->args['pagination'] )return; |
|
89 | + if (!$this->args['pagination'])return; |
|
90 | 90 | return paginate_links([ |
91 | - 'before_page_number' => '<span class="screen-reader-text">' . __( 'Page', 'castor' ) . ' </span>', |
|
91 | + 'before_page_number' => '<span class="screen-reader-text">' . __('Page', 'castor') . ' </span>', |
|
92 | 92 | 'current' => $this->gallery->query['paged'], |
93 | 93 | 'mid_size' => 1, |
94 | - 'next_text' => __( 'Next', 'castor' ), |
|
95 | - 'prev_text' => __( 'Previous', 'castor' ), |
|
94 | + 'next_text' => __('Next', 'castor'), |
|
95 | + 'prev_text' => __('Previous', 'castor'), |
|
96 | 96 | 'total' => $this->gallery->max_num_pages, |
97 | 97 | ]); |
98 | 98 | } |
@@ -103,14 +103,14 @@ discard block |
||
103 | 103 | * |
104 | 104 | * @return bool |
105 | 105 | */ |
106 | - protected function getBoolValue( $key, $value = null ) |
|
106 | + protected function getBoolValue($key, $value = null) |
|
107 | 107 | { |
108 | - $bool = $this->getValue( $key, $value ); |
|
108 | + $bool = $this->getValue($key, $value); |
|
109 | 109 | |
110 | - if( is_null( filter_var( $bool, FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE ))) { |
|
111 | - $bool = $this->postmeta->get( $bool ); |
|
110 | + if (is_null(filter_var($bool, FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE))) { |
|
111 | + $bool = $this->postmeta->get($bool); |
|
112 | 112 | } |
113 | - return wp_validate_boolean( $bool ); |
|
113 | + return wp_validate_boolean($bool); |
|
114 | 114 | } |
115 | 115 | |
116 | 116 | /** |
@@ -118,15 +118,15 @@ discard block |
||
118 | 118 | * |
119 | 119 | * @return int |
120 | 120 | */ |
121 | - protected function getGalleryArg( $value = null ) |
|
121 | + protected function getGalleryArg($value = null) |
|
122 | 122 | { |
123 | - $gallery = $this->getValue( 'gallery', $value ); |
|
123 | + $gallery = $this->getValue('gallery', $value); |
|
124 | 124 | |
125 | - if( !is_numeric( $gallery ) && is_string( $gallery )) { |
|
126 | - $gallery = intval( $this->postmeta->get( $gallery )); |
|
125 | + if (!is_numeric($gallery) && is_string($gallery)) { |
|
126 | + $gallery = intval($this->postmeta->get($gallery)); |
|
127 | 127 | } |
128 | - return !is_null( get_post( $gallery )) |
|
129 | - ? intval( $gallery ) |
|
128 | + return !is_null(get_post($gallery)) |
|
129 | + ? intval($gallery) |
|
130 | 130 | : 0; |
131 | 131 | } |
132 | 132 | |
@@ -135,14 +135,14 @@ discard block |
||
135 | 135 | * |
136 | 136 | * @return int |
137 | 137 | */ |
138 | - protected function getImagesPerPageArg( $value = null ) |
|
138 | + protected function getImagesPerPageArg($value = null) |
|
139 | 139 | { |
140 | - $perPage = $this->getValue( 'images_per_page', $value ); |
|
140 | + $perPage = $this->getValue('images_per_page', $value); |
|
141 | 141 | |
142 | - if( !is_numeric( $perPage ) && is_string( $perPage )) { |
|
143 | - $perPage = $this->postmeta->get( $perPage ); |
|
142 | + if (!is_numeric($perPage) && is_string($perPage)) { |
|
143 | + $perPage = $this->postmeta->get($perPage); |
|
144 | 144 | } |
145 | - return !!intval( $perPage ) |
|
145 | + return !!intval($perPage) |
|
146 | 146 | ? $perPage |
147 | 147 | : -1; |
148 | 148 | } |
@@ -152,9 +152,9 @@ discard block |
||
152 | 152 | * |
153 | 153 | * @return bool |
154 | 154 | */ |
155 | - protected function getLazyloadArg( $value = null ) |
|
155 | + protected function getLazyloadArg($value = null) |
|
156 | 156 | { |
157 | - return $this->getBoolValue( 'lazyload', $value ); |
|
157 | + return $this->getBoolValue('lazyload', $value); |
|
158 | 158 | } |
159 | 159 | |
160 | 160 | /** |
@@ -162,18 +162,18 @@ discard block |
||
162 | 162 | * |
163 | 163 | * @return array |
164 | 164 | */ |
165 | - protected function getMediaArg( $value = null ) |
|
165 | + protected function getMediaArg($value = null) |
|
166 | 166 | { |
167 | - $media = $this->getValue( 'media', $value ); |
|
167 | + $media = $this->getValue('media', $value); |
|
168 | 168 | |
169 | - if( is_string( $media )) { |
|
170 | - $media = $this->postmeta->get( $media, [ |
|
169 | + if (is_string($media)) { |
|
170 | + $media = $this->postmeta->get($media, [ |
|
171 | 171 | 'ID' => $this->getGalleryArg(), |
172 | 172 | 'single' => false, |
173 | 173 | ]); |
174 | 174 | } |
175 | - return is_array( $media ) |
|
176 | - ? wp_parse_id_list( $media ) |
|
175 | + return is_array($media) |
|
176 | + ? wp_parse_id_list($media) |
|
177 | 177 | : []; |
178 | 178 | } |
179 | 179 | |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | */ |
183 | 183 | protected function getPaged() |
184 | 184 | { |
185 | - return intval( get_query_var(( is_front_page() ? 'page' : 'paged' ))) ?: 1; |
|
185 | + return intval(get_query_var((is_front_page() ? 'page' : 'paged'))) ?: 1; |
|
186 | 186 | } |
187 | 187 | |
188 | 188 | /** |
@@ -190,9 +190,9 @@ discard block |
||
190 | 190 | * |
191 | 191 | * @return bool |
192 | 192 | */ |
193 | - protected function getPaginationArg( $value = null ) |
|
193 | + protected function getPaginationArg($value = null) |
|
194 | 194 | { |
195 | - return $this->getBoolValue( 'pagination', $value ); |
|
195 | + return $this->getBoolValue('pagination', $value); |
|
196 | 196 | } |
197 | 197 | |
198 | 198 | /** |
@@ -200,17 +200,17 @@ discard block |
||
200 | 200 | * |
201 | 201 | * @return bool |
202 | 202 | */ |
203 | - protected function getPermalinksArg( $value = null ) |
|
203 | + protected function getPermalinksArg($value = null) |
|
204 | 204 | { |
205 | - return $this->getBoolValue( 'permalinks', $value ); |
|
205 | + return $this->getBoolValue('permalinks', $value); |
|
206 | 206 | } |
207 | 207 | |
208 | 208 | /** |
209 | 209 | * @return string |
210 | 210 | */ |
211 | - protected function getPhotoswipeData( $image ) |
|
211 | + protected function getPhotoswipeData($image) |
|
212 | 212 | { |
213 | - return sprintf( '{"l":{"src":"%s","w":%d,"h":%d},"m":{"src":"%s","w":%d,"h":%d}}', |
|
213 | + return sprintf('{"l":{"src":"%s","w":%d,"h":%d},"m":{"src":"%s","w":%d,"h":%d}}', |
|
214 | 214 | $image->large['url'], |
215 | 215 | $image->large['width'], |
216 | 216 | $image->large['height'], |
@@ -226,9 +226,9 @@ discard block |
||
226 | 226 | * |
227 | 227 | * @return mixed |
228 | 228 | */ |
229 | - protected function getValue( $key, $value = null ) |
|
229 | + protected function getValue($key, $value = null) |
|
230 | 230 | { |
231 | - if( is_null( $value ) && isset( $this->args[$key] )) { |
|
231 | + if (is_null($value) && isset($this->args[$key])) { |
|
232 | 232 | $value = $this->args[$key]; |
233 | 233 | } |
234 | 234 | return $value; |
@@ -237,23 +237,23 @@ discard block |
||
237 | 237 | /** |
238 | 238 | * @return array |
239 | 239 | */ |
240 | - protected function normalizeArgs( array $args = [] ) |
|
240 | + protected function normalizeArgs(array $args = []) |
|
241 | 241 | { |
242 | 242 | $defaults = [ |
243 | - 'gallery', // (string) meta_key | (int) post_id |
|
244 | - 'lazyload', // (string) meta_key | (bool) |
|
245 | - 'media', // (string) meta_key | (array) post_ids |
|
246 | - 'pagination', // (string) meta_key | (bool) |
|
243 | + 'gallery', // (string) meta_key | (int) post_id |
|
244 | + 'lazyload', // (string) meta_key | (bool) |
|
245 | + 'media', // (string) meta_key | (array) post_ids |
|
246 | + 'pagination', // (string) meta_key | (bool) |
|
247 | 247 | 'images_per_page', // (string) meta_key | (int) number |
248 | - 'permalinks', // (string) meta_key | (bool) |
|
248 | + 'permalinks', // (string) meta_key | (bool) |
|
249 | 249 | ]; |
250 | 250 | |
251 | - $this->args = shortcode_atts( array_combine( $defaults, $defaults ), $args ); |
|
251 | + $this->args = shortcode_atts(array_combine($defaults, $defaults), $args); |
|
252 | 252 | |
253 | - array_walk( $this->args, function( &$value, $key ) { |
|
254 | - $method = $this->utility->buildMethodName( $key . '_arg' ); |
|
255 | - if( method_exists( $this, $method )) { |
|
256 | - $value = call_user_func([ $this, $method ], $value ); |
|
253 | + array_walk($this->args, function(&$value, $key) { |
|
254 | + $method = $this->utility->buildMethodName($key . '_arg'); |
|
255 | + if (method_exists($this, $method)) { |
|
256 | + $value = call_user_func([$this, $method], $value); |
|
257 | 257 | } |
258 | 258 | }); |
259 | 259 | |
@@ -265,20 +265,20 @@ discard block |
||
265 | 265 | * |
266 | 266 | * @return null|string |
267 | 267 | */ |
268 | - protected function renderImageTag( $image ) |
|
268 | + protected function renderImageTag($image) |
|
269 | 269 | { |
270 | 270 | $imgSrc = $this->getLazyloadArg() |
271 | - ? $this->theme->imageUri( 'blank.gif' ) |
|
271 | + ? $this->theme->imageUri('blank.gif') |
|
272 | 272 | : $image->thumbnail['url']; |
273 | 273 | |
274 | - $imgTag = sprintf( '<img src="%s" data-src="%s" itemprop="thumbnail" alt="%s"/>', |
|
274 | + $imgTag = sprintf('<img src="%s" data-src="%s" itemprop="thumbnail" alt="%s"/>', |
|
275 | 275 | $imgSrc, |
276 | 276 | $image->thumbnail['url'], |
277 | 277 | $image->alt |
278 | 278 | ); |
279 | 279 | |
280 | 280 | return $this->getPermalinksArg() |
281 | - ? sprintf( '<a href="%s" itemprop="contentUrl">%s</a>', $image->permalink, $imgTag ) |
|
281 | + ? sprintf('<a href="%s" itemprop="contentUrl">%s</a>', $image->permalink, $imgTag) |
|
282 | 282 | : $imgTag; |
283 | 283 | } |
284 | 284 | } |
@@ -65,7 +65,9 @@ discard block |
||
65 | 65 | { |
66 | 66 | $image = $this->image->get( $attachment->ID )->image; |
67 | 67 | |
68 | - if( !$image )return; |
|
68 | + if( !$image ) { |
|
69 | + return; |
|
70 | + } |
|
69 | 71 | return sprintf( |
70 | 72 | '<figure class="gallery-image" data-w="%s" data-h="%s" data-ps=\'%s\' itemprop="associatedMedia" itemscope itemtype="http://schema.org/ImageObject">' . |
71 | 73 | '%s<figcaption itemprop="caption description">' . |
@@ -86,7 +88,9 @@ discard block |
||
86 | 88 | */ |
87 | 89 | public function renderPagination() |
88 | 90 | { |
89 | - if( !$this->args['pagination'] )return; |
|
91 | + if( !$this->args['pagination'] ) { |
|
92 | + return; |
|
93 | + } |
|
90 | 94 | return paginate_links([ |
91 | 95 | 'before_page_number' => '<span class="screen-reader-text">' . __( 'Page', 'castor' ) . ' </span>', |
92 | 96 | 'current' => $this->gallery->query['paged'], |
@@ -16,24 +16,24 @@ discard block |
||
16 | 16 | */ |
17 | 17 | public function afterSetupTheme() |
18 | 18 | { |
19 | - add_editor_style( Theme::assetUri( 'css/editor.css' )); |
|
20 | - add_theme_support( 'customize-selective-refresh-widgets' ); |
|
21 | - add_theme_support( 'html5', ['caption', 'comment-form', 'comment-list', 'gallery', 'search-form'] ); |
|
22 | - add_theme_support( 'post-thumbnails' ); |
|
23 | - add_theme_support( 'soil-clean-up' ); |
|
24 | - add_theme_support( 'soil-jquery-cdn' ); |
|
25 | - add_theme_support( 'soil-nav-walker' ); |
|
26 | - add_theme_support( 'soil-nice-search' ); |
|
27 | - add_theme_support( 'soil-relative-urls' ); |
|
28 | - add_theme_support( 'title-tag' ); |
|
29 | - load_theme_textdomain( 'castor', Theme::paths( 'dir.template' ) . '/languages' ); |
|
30 | - |
|
31 | - $menus = apply_filters( 'castor/register/nav_menus', [ |
|
32 | - 'main_menu' => __( 'Main Menu', 'castor' ), |
|
19 | + add_editor_style(Theme::assetUri('css/editor.css')); |
|
20 | + add_theme_support('customize-selective-refresh-widgets'); |
|
21 | + add_theme_support('html5', ['caption', 'comment-form', 'comment-list', 'gallery', 'search-form']); |
|
22 | + add_theme_support('post-thumbnails'); |
|
23 | + add_theme_support('soil-clean-up'); |
|
24 | + add_theme_support('soil-jquery-cdn'); |
|
25 | + add_theme_support('soil-nav-walker'); |
|
26 | + add_theme_support('soil-nice-search'); |
|
27 | + add_theme_support('soil-relative-urls'); |
|
28 | + add_theme_support('title-tag'); |
|
29 | + load_theme_textdomain('castor', Theme::paths('dir.template') . '/languages'); |
|
30 | + |
|
31 | + $menus = apply_filters('castor/register/nav_menus', [ |
|
32 | + 'main_menu' => __('Main Menu', 'castor'), |
|
33 | 33 | ]); |
34 | 34 | |
35 | - foreach( $menus as $location => $description ) { |
|
36 | - register_nav_menu( $location, $description ); |
|
35 | + foreach ($menus as $location => $description) { |
|
36 | + register_nav_menu($location, $description); |
|
37 | 37 | } |
38 | 38 | } |
39 | 39 | |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | */ |
44 | 44 | public function filterLoginTitle() |
45 | 45 | { |
46 | - return get_bloginfo( 'name' ); |
|
46 | + return get_bloginfo('name'); |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | /** |
@@ -52,18 +52,18 @@ discard block |
||
52 | 52 | */ |
53 | 53 | public function filterLoginUrl() |
54 | 54 | { |
55 | - return get_bloginfo( 'url' ); |
|
55 | + return get_bloginfo('url'); |
|
56 | 56 | } |
57 | 57 | |
58 | 58 | /** |
59 | 59 | * @return string |
60 | 60 | * @filter template_include |
61 | 61 | */ |
62 | - public function filterTemplate( $template ) |
|
62 | + public function filterTemplate($template) |
|
63 | 63 | { |
64 | - if( is_string( $template )) { |
|
65 | - $template = Template::setLayout( $template ); |
|
66 | - Development::storeTemplatePath( $template ); |
|
64 | + if (is_string($template)) { |
|
65 | + $template = Template::setLayout($template); |
|
66 | + Development::storeTemplatePath($template); |
|
67 | 67 | } |
68 | 68 | return $template; |
69 | 69 | } |
@@ -72,11 +72,11 @@ discard block |
||
72 | 72 | * @return array |
73 | 73 | * @filter {$type}_template_hierarchy |
74 | 74 | */ |
75 | - public function filterTemplateHierarchy( array $templates ) |
|
75 | + public function filterTemplateHierarchy(array $templates) |
|
76 | 76 | { |
77 | - return array_map( function( $template ) { |
|
78 | - return Utility::startWith( 'templates/', $template ); |
|
79 | - }, $templates ); |
|
77 | + return array_map(function($template) { |
|
78 | + return Utility::startWith('templates/', $template); |
|
79 | + }, $templates); |
|
80 | 80 | } |
81 | 81 | |
82 | 82 | /** |
@@ -85,8 +85,8 @@ discard block |
||
85 | 85 | */ |
86 | 86 | public function login() |
87 | 87 | { |
88 | - if( file_exists( Theme::assetPath( 'css/login.css' ))) { |
|
89 | - printf( '<link rel="stylesheet" href="%s">', Theme::assetUri( 'css/login.css' )); |
|
88 | + if (file_exists(Theme::assetPath('css/login.css'))) { |
|
89 | + printf('<link rel="stylesheet" href="%s">', Theme::assetUri('css/login.css')); |
|
90 | 90 | } |
91 | 91 | } |
92 | 92 | |
@@ -96,14 +96,14 @@ discard block |
||
96 | 96 | */ |
97 | 97 | public function registerAssets() |
98 | 98 | { |
99 | - wp_enqueue_style( 'castor/main.css', |
|
100 | - Theme::assetUri( 'css/main.css' ), |
|
101 | - apply_filters( 'castor/enqueue/css/deps', [] ), |
|
99 | + wp_enqueue_style('castor/main.css', |
|
100 | + Theme::assetUri('css/main.css'), |
|
101 | + apply_filters('castor/enqueue/css/deps', []), |
|
102 | 102 | null |
103 | 103 | ); |
104 | - wp_enqueue_script( 'castor/main.js', |
|
105 | - Theme::assetUri( 'js/main.js' ), |
|
106 | - apply_filters( 'castor/enqueue/js/deps', [] ), |
|
104 | + wp_enqueue_script('castor/main.js', |
|
105 | + Theme::assetUri('js/main.js'), |
|
106 | + apply_filters('castor/enqueue/js/deps', []), |
|
107 | 107 | null, |
108 | 108 | true |
109 | 109 | ); |
@@ -113,13 +113,13 @@ discard block |
||
113 | 113 | * @return void |
114 | 114 | * @action customize_register |
115 | 115 | */ |
116 | - public function registerCustomizer( WP_Customize_Manager $manager ) |
|
116 | + public function registerCustomizer(WP_Customize_Manager $manager) |
|
117 | 117 | { |
118 | - $manager->get_setting( 'blogname' )->transport = 'postMessage'; |
|
119 | - $manager->selective_refresh->add_partial( 'blogname', [ |
|
118 | + $manager->get_setting('blogname')->transport = 'postMessage'; |
|
119 | + $manager->selective_refresh->add_partial('blogname', [ |
|
120 | 120 | 'selector' => '.brand', |
121 | 121 | 'render_callback' => function() { |
122 | - bloginfo( 'name' ); |
|
122 | + bloginfo('name'); |
|
123 | 123 | }, |
124 | 124 | ]); |
125 | 125 | } |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | */ |
131 | 131 | public function registerCustomizerAssets() |
132 | 132 | { |
133 | - wp_enqueue_script( 'castor/customizer.js', Theme::assetUri( 'js/customizer.js' ), ['customize-preview'], null, true ); |
|
133 | + wp_enqueue_script('castor/customizer.js', Theme::assetUri('js/customizer.js'), ['customize-preview'], null, true); |
|
134 | 134 | } |
135 | 135 | |
136 | 136 | /** |
@@ -139,23 +139,23 @@ discard block |
||
139 | 139 | */ |
140 | 140 | public function registerSidebars() |
141 | 141 | { |
142 | - $defaults = apply_filters( 'castor/register/sidebars/defaults', [ |
|
142 | + $defaults = apply_filters('castor/register/sidebars/defaults', [ |
|
143 | 143 | 'before_widget' => '<div class="widget %1$s %2$s">', |
144 | 144 | 'after_widget' => '</div>', |
145 | 145 | 'before_title' => '<h4>', |
146 | 146 | 'after_title' => '</h4>', |
147 | 147 | ]); |
148 | 148 | |
149 | - $sidebars = apply_filters( 'castor/register/sidebars', [ |
|
150 | - 'sidebar-primary' => __( 'Primary Sidebar', 'castor' ), |
|
151 | - 'sidebar-footer' => __( 'Footer Sidebar', 'castor' ), |
|
149 | + $sidebars = apply_filters('castor/register/sidebars', [ |
|
150 | + 'sidebar-primary' => __('Primary Sidebar', 'castor'), |
|
151 | + 'sidebar-footer' => __('Footer Sidebar', 'castor'), |
|
152 | 152 | ]); |
153 | 153 | |
154 | - foreach( $sidebars as $id => $name ) { |
|
154 | + foreach ($sidebars as $id => $name) { |
|
155 | 155 | register_sidebar([ |
156 | 156 | 'id' => $id, |
157 | 157 | 'name' => $name, |
158 | - ] + $defaults ); |
|
158 | + ] + $defaults); |
|
159 | 159 | } |
160 | 160 | } |
161 | 161 | } |
@@ -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; |
@@ -34,19 +34,19 @@ discard block |
||
34 | 34 | * @return string|void |
35 | 35 | * @throws BadMethodCallException |
36 | 36 | */ |
37 | - public function __call( $name, array $args ) |
|
37 | + public function __call($name, array $args) |
|
38 | 38 | { |
39 | - $mediaType = $this->validateMethod( $name ); |
|
39 | + $mediaType = $this->validateMethod($name); |
|
40 | 40 | |
41 | - if( !count( $args )) { |
|
42 | - throw new BadMethodCallException( sprintf( 'Missing arguments for: %s', $name )); |
|
41 | + if (!count($args)) { |
|
42 | + throw new BadMethodCallException(sprintf('Missing arguments for: %s', $name)); |
|
43 | 43 | } |
44 | - if( str_replace( $mediaType, '', strtolower( $name ))) { |
|
45 | - return $this->$mediaType->get( $args[0] )->$mediaType; |
|
44 | + if (str_replace($mediaType, '', strtolower($name))) { |
|
45 | + return $this->$mediaType->get($args[0])->$mediaType; |
|
46 | 46 | } |
47 | - return !empty( $args[1] ) |
|
48 | - ? $this->$mediaType->get( $args[0] )->render( $args[1] ) |
|
49 | - : $this->$mediaType->get( $args[0] )->render(); |
|
47 | + return !empty($args[1]) |
|
48 | + ? $this->$mediaType->get($args[0])->render($args[1]) |
|
49 | + : $this->$mediaType->get($args[0])->render(); |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | /** |
@@ -56,10 +56,10 @@ discard block |
||
56 | 56 | * @return mixed |
57 | 57 | * @throws BadMethodCallException |
58 | 58 | */ |
59 | - public function get( $name, $args = [] ) |
|
59 | + public function get($name, $args = []) |
|
60 | 60 | { |
61 | - $mediaType = $this->validateMethod( $name ); |
|
62 | - return $this->$mediaType->get( $args )->$mediaType; |
|
61 | + $mediaType = $this->validateMethod($name); |
|
62 | + return $this->$mediaType->get($args)->$mediaType; |
|
63 | 63 | } |
64 | 64 | |
65 | 65 | /** |
@@ -68,13 +68,13 @@ discard block |
||
68 | 68 | * @return string|false |
69 | 69 | * @throws BadMethodCallException |
70 | 70 | */ |
71 | - protected function validateMethod( $name ) |
|
71 | + protected function validateMethod($name) |
|
72 | 72 | { |
73 | - foreach( [$name, strtolower( substr( $name, 3 ))] as $method ) { |
|
74 | - if( property_exists( $this, $method ) && is_object( $this->$method )) { |
|
73 | + foreach ([$name, strtolower(substr($name, 3))] as $method) { |
|
74 | + if (property_exists($this, $method) && is_object($this->$method)) { |
|
75 | 75 | return $method; |
76 | 76 | } |
77 | 77 | } |
78 | - throw new BadMethodCallException( sprintf( 'Not a valid method: %s', $name )); |
|
78 | + throw new BadMethodCallException(sprintf('Not a valid method: %s', $name)); |
|
79 | 79 | } |
80 | 80 | } |
@@ -6,7 +6,9 @@ |
||
6 | 6 | { |
7 | 7 | public function get( $metaKey, array $args = [] ) |
8 | 8 | { |
9 | - if( empty( $metaKey ))return; |
|
9 | + if( empty( $metaKey )) { |
|
10 | + return; |
|
11 | + } |
|
10 | 12 | |
11 | 13 | $args = $this->normalize( $args ); |
12 | 14 | $metaKey = $this->buildMetaKey( $metaKey, $args['prefix'] ); |
@@ -4,34 +4,34 @@ |
||
4 | 4 | |
5 | 5 | class PostMeta |
6 | 6 | { |
7 | - public function get( $metaKey, array $args = [] ) |
|
7 | + public function get($metaKey, array $args = []) |
|
8 | 8 | { |
9 | - if( empty( $metaKey ))return; |
|
9 | + if (empty($metaKey))return; |
|
10 | 10 | |
11 | - $args = $this->normalize( $args ); |
|
12 | - $metaKey = $this->buildMetaKey( $metaKey, $args['prefix'] ); |
|
13 | - $metaValue = get_post_meta( $args['ID'], $metaKey, $args['single'] ); |
|
11 | + $args = $this->normalize($args); |
|
12 | + $metaKey = $this->buildMetaKey($metaKey, $args['prefix']); |
|
13 | + $metaValue = get_post_meta($args['ID'], $metaKey, $args['single']); |
|
14 | 14 | |
15 | - return empty( $metaValue ) |
|
15 | + return empty($metaValue) |
|
16 | 16 | ? $args['fallback'] |
17 | 17 | : $metaValue; |
18 | 18 | } |
19 | 19 | |
20 | - protected function buildMetaKey( $metaKey, $prefix ) |
|
20 | + protected function buildMetaKey($metaKey, $prefix) |
|
21 | 21 | { |
22 | - return ( substr( $metaKey, 0, 1 ) == '_' && !empty( $prefix )) |
|
23 | - ? sprintf( '_%s%s', rtrim( $prefix, '_' ), $metaKey ) |
|
22 | + return (substr($metaKey, 0, 1) == '_' && !empty($prefix)) |
|
23 | + ? sprintf('_%s%s', rtrim($prefix, '_'), $metaKey) |
|
24 | 24 | : $prefix . $metaKey; |
25 | 25 | } |
26 | 26 | |
27 | - protected function normalize( array $args ) |
|
27 | + protected function normalize(array $args) |
|
28 | 28 | { |
29 | 29 | $defaults = [ |
30 | 30 | 'ID' => get_the_ID(), |
31 | 31 | 'fallback' => '', |
32 | 32 | 'single' => true, |
33 | - 'prefix' => apply_filters( 'castor/postmeta/prefix', 'pollux_' ), |
|
33 | + 'prefix' => apply_filters('castor/postmeta/prefix', 'pollux_'), |
|
34 | 34 | ]; |
35 | - return shortcode_atts( $defaults, $args ); |
|
35 | + return shortcode_atts($defaults, $args); |
|
36 | 36 | } |
37 | 37 | } |