@@ -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,20 +96,20 @@ 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 | ); |
| 110 | - wp_localize_script( 'castor/main.js', apply_filters( 'castor/enqueue/js/localize/variable', 'globals' ), |
|
| 111 | - apply_filters( 'castor/enqueue/js/localize/variables', [ |
|
| 112 | - 'ajax' => admin_url( 'admin-ajax.php' ), |
|
| 110 | + wp_localize_script('castor/main.js', apply_filters('castor/enqueue/js/localize/variable', 'globals'), |
|
| 111 | + apply_filters('castor/enqueue/js/localize/variables', [ |
|
| 112 | + 'ajax' => admin_url('admin-ajax.php'), |
|
| 113 | 113 | ]) |
| 114 | 114 | ); |
| 115 | 115 | } |
@@ -118,13 +118,13 @@ discard block |
||
| 118 | 118 | * @return void |
| 119 | 119 | * @action customize_register |
| 120 | 120 | */ |
| 121 | - public function registerCustomizer( WP_Customize_Manager $manager ) |
|
| 121 | + public function registerCustomizer(WP_Customize_Manager $manager) |
|
| 122 | 122 | { |
| 123 | - $manager->get_setting( 'blogname' )->transport = 'postMessage'; |
|
| 124 | - $manager->selective_refresh->add_partial( 'blogname', [ |
|
| 123 | + $manager->get_setting('blogname')->transport = 'postMessage'; |
|
| 124 | + $manager->selective_refresh->add_partial('blogname', [ |
|
| 125 | 125 | 'selector' => '.brand', |
| 126 | 126 | 'render_callback' => function() { |
| 127 | - bloginfo( 'name' ); |
|
| 127 | + bloginfo('name'); |
|
| 128 | 128 | }, |
| 129 | 129 | ]); |
| 130 | 130 | } |
@@ -135,7 +135,7 @@ discard block |
||
| 135 | 135 | */ |
| 136 | 136 | public function registerCustomizerAssets() |
| 137 | 137 | { |
| 138 | - wp_enqueue_script( 'castor/customizer.js', Theme::assetUri( 'js/customizer.js' ), ['customize-preview'], null, true ); |
|
| 138 | + wp_enqueue_script('castor/customizer.js', Theme::assetUri('js/customizer.js'), ['customize-preview'], null, true); |
|
| 139 | 139 | } |
| 140 | 140 | |
| 141 | 141 | /** |
@@ -144,23 +144,23 @@ discard block |
||
| 144 | 144 | */ |
| 145 | 145 | public function registerSidebars() |
| 146 | 146 | { |
| 147 | - $defaults = apply_filters( 'castor/register/sidebars/defaults', [ |
|
| 147 | + $defaults = apply_filters('castor/register/sidebars/defaults', [ |
|
| 148 | 148 | 'before_widget' => '<div class="widget %1$s %2$s">', |
| 149 | 149 | 'after_widget' => '</div>', |
| 150 | 150 | 'before_title' => '<h4>', |
| 151 | 151 | 'after_title' => '</h4>', |
| 152 | 152 | ]); |
| 153 | 153 | |
| 154 | - $sidebars = apply_filters( 'castor/register/sidebars', [ |
|
| 155 | - 'sidebar-primary' => __( 'Primary Sidebar', 'castor' ), |
|
| 156 | - 'sidebar-footer' => __( 'Footer Sidebar', 'castor' ), |
|
| 154 | + $sidebars = apply_filters('castor/register/sidebars', [ |
|
| 155 | + 'sidebar-primary' => __('Primary Sidebar', 'castor'), |
|
| 156 | + 'sidebar-footer' => __('Footer Sidebar', 'castor'), |
|
| 157 | 157 | ]); |
| 158 | 158 | |
| 159 | - foreach( $sidebars as $id => $name ) { |
|
| 159 | + foreach ($sidebars as $id => $name) { |
|
| 160 | 160 | register_sidebar([ |
| 161 | 161 | 'id' => $id, |
| 162 | 162 | 'name' => $name, |
| 163 | - ] + $defaults ); |
|
| 163 | + ] + $defaults); |
|
| 164 | 164 | } |
| 165 | 165 | } |
| 166 | 166 | } |
@@ -6,13 +6,13 @@ |
||
| 6 | 6 | |
| 7 | 7 | class SiteMeta 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\SiteMeta::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\SiteMeta::class; |
|
| 17 | + } |
|
| 18 | 18 | } |
@@ -4,38 +4,38 @@ |
||
| 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 | - if( is_string( $metaValue )) { |
|
| 16 | - $metaValue = trim( $metaValue ); |
|
| 15 | + if (is_string($metaValue)) { |
|
| 16 | + $metaValue = trim($metaValue); |
|
| 17 | 17 | } |
| 18 | 18 | |
| 19 | - return empty( $metaValue ) |
|
| 19 | + return empty($metaValue) |
|
| 20 | 20 | ? $args['fallback'] |
| 21 | 21 | : $metaValue; |
| 22 | 22 | } |
| 23 | 23 | |
| 24 | - protected function buildMetaKey( $metaKey, $prefix ) |
|
| 24 | + protected function buildMetaKey($metaKey, $prefix) |
|
| 25 | 25 | { |
| 26 | - return ( substr( $metaKey, 0, 1 ) == '_' && !empty( $prefix )) |
|
| 27 | - ? sprintf( '_%s%s', rtrim( $prefix, '_' ), $metaKey ) |
|
| 26 | + return (substr($metaKey, 0, 1) == '_' && !empty($prefix)) |
|
| 27 | + ? sprintf('_%s%s', rtrim($prefix, '_'), $metaKey) |
|
| 28 | 28 | : $prefix . $metaKey; |
| 29 | 29 | } |
| 30 | 30 | |
| 31 | - protected function normalize( array $args ) |
|
| 31 | + protected function normalize(array $args) |
|
| 32 | 32 | { |
| 33 | 33 | $defaults = [ |
| 34 | 34 | 'ID' => get_the_ID(), |
| 35 | 35 | 'fallback' => '', |
| 36 | 36 | 'single' => true, |
| 37 | - 'prefix' => apply_filters( 'castor/postmeta/prefix', 'pollux_' ), |
|
| 37 | + 'prefix' => apply_filters('castor/postmeta/prefix', 'pollux_'), |
|
| 38 | 38 | ]; |
| 39 | - return shortcode_atts( $defaults, $args ); |
|
| 39 | + return shortcode_atts($defaults, $args); |
|
| 40 | 40 | } |
| 41 | 41 | } |
@@ -11,17 +11,17 @@ discard block |
||
| 11 | 11 | * |
| 12 | 12 | * @return mixed |
| 13 | 13 | */ |
| 14 | - public function get( $group, $key = false, $fallback = '' ) |
|
| 14 | + public function get($group, $key = false, $fallback = '') |
|
| 15 | 15 | { |
| 16 | - $metaKey = sprintf( '%ssettings-%s', apply_filters( 'castor/sitemeta/prefix', 'pollux_' ), $group ); |
|
| 17 | - $options = get_option( $metaKey, false ); |
|
| 16 | + $metaKey = sprintf('%ssettings-%s', apply_filters('castor/sitemeta/prefix', 'pollux_'), $group); |
|
| 17 | + $options = get_option($metaKey, false); |
|
| 18 | 18 | |
| 19 | - if( !$options || !is_array( $options )) { |
|
| 19 | + if (!$options || !is_array($options)) { |
|
| 20 | 20 | return $fallback; |
| 21 | 21 | } |
| 22 | 22 | |
| 23 | - return is_string( $key ) |
|
| 24 | - ? $this->normalize( $options, $key, $fallback ) |
|
| 23 | + return is_string($key) |
|
| 24 | + ? $this->normalize($options, $key, $fallback) |
|
| 25 | 25 | : $options; |
| 26 | 26 | } |
| 27 | 27 | |
@@ -31,19 +31,19 @@ discard block |
||
| 31 | 31 | * |
| 32 | 32 | * @return mixed |
| 33 | 33 | */ |
| 34 | - protected function normalize( array $options, $key, $fallback ) |
|
| 34 | + protected function normalize(array $options, $key, $fallback) |
|
| 35 | 35 | { |
| 36 | - if( !array_key_exists( $key, $options )) { |
|
| 36 | + if (!array_key_exists($key, $options)) { |
|
| 37 | 37 | return $fallback; |
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | $option = $options[$key]; |
| 41 | 41 | |
| 42 | - $option = is_array( $option ) |
|
| 43 | - ? array_filter( $option ) |
|
| 44 | - : trim( $option ); |
|
| 42 | + $option = is_array($option) |
|
| 43 | + ? array_filter($option) |
|
| 44 | + : trim($option); |
|
| 45 | 45 | |
| 46 | - return empty( $option ) |
|
| 46 | + return empty($option) |
|
| 47 | 47 | ? $fallback |
| 48 | 48 | : $option; |
| 49 | 49 | } |
@@ -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,89 +22,89 @@ 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 | 'player' => '', |
| 68 | 68 | 'video' => 'featured_video', |
| 69 | 69 | ]); |
| 70 | - $featuredHtml = $this->media->video( wp_parse_args( $args, [ |
|
| 70 | + $featuredHtml = $this->media->video(wp_parse_args($args, [ |
|
| 71 | 71 | 'url' => $args['video'], |
| 72 | 72 | ])); |
| 73 | - if( empty( $featuredHtml ) && $featuredImage = $this->media->getImage( $args['image'] )) { |
|
| 74 | - $featuredHtml = sprintf( '<div class="featured-image"><img src="%s" alt="%s"></div><figcaption>%s</figcaption>', |
|
| 73 | + if (empty($featuredHtml) && $featuredImage = $this->media->getImage($args['image'])) { |
|
| 74 | + $featuredHtml = sprintf('<div class="featured-image"><img src="%s" alt="%s"></div><figcaption>%s</figcaption>', |
|
| 75 | 75 | $featuredImage->large['url'], |
| 76 | 76 | $featuredImage->alt, |
| 77 | 77 | $featuredImage->caption |
| 78 | 78 | ); |
| 79 | 79 | } |
| 80 | - if( !empty( $featuredHtml )) { |
|
| 81 | - printf( '<figure class="%s">%s</figure>', $args['class'], $featuredHtml ); |
|
| 80 | + if (!empty($featuredHtml)) { |
|
| 81 | + printf('<figure class="%s">%s</figure>', $args['class'], $featuredHtml); |
|
| 82 | 82 | } |
| 83 | 83 | } |
| 84 | 84 | |
| 85 | - public function field( $name, array $args = [] ) |
|
| 85 | + public function field($name, array $args = []) |
|
| 86 | 86 | { |
| 87 | 87 | } |
| 88 | 88 | |
| 89 | - public function form( $name, array $args = [] ) |
|
| 89 | + public function form($name, array $args = []) |
|
| 90 | 90 | { |
| 91 | 91 | } |
| 92 | 92 | |
| 93 | - public function gallery( array $args = [] ) |
|
| 93 | + public function gallery(array $args = []) |
|
| 94 | 94 | { |
| 95 | - echo $this->media->gallery( $args ); |
|
| 95 | + echo $this->media->gallery($args); |
|
| 96 | 96 | } |
| 97 | 97 | |
| 98 | - public function title( $metaKey = false, array $attributes = [] ) |
|
| 98 | + public function title($metaKey = false, array $attributes = []) |
|
| 99 | 99 | { |
| 100 | - $tag = apply_filters( 'castor/render/title/tag', 'h2' ); |
|
| 100 | + $tag = apply_filters('castor/render/title/tag', 'h2'); |
|
| 101 | 101 | $value = $metaKey |
| 102 | - ? $this->postmeta->get( $metaKey ) |
|
| 102 | + ? $this->postmeta->get($metaKey) |
|
| 103 | 103 | : $this->theme->pageTitle(); |
| 104 | 104 | |
| 105 | - if( !$value )return; |
|
| 105 | + if (!$value)return; |
|
| 106 | 106 | |
| 107 | - $this->utility->printTag( $tag, wp_strip_all_tags( $value ), $attributes ); |
|
| 107 | + $this->utility->printTag($tag, wp_strip_all_tags($value), $attributes); |
|
| 108 | 108 | } |
| 109 | 109 | |
| 110 | 110 | /** |
@@ -112,8 +112,8 @@ discard block |
||
| 112 | 112 | * |
| 113 | 113 | * @return string|null |
| 114 | 114 | */ |
| 115 | - public function video( $args ) |
|
| 115 | + public function video($args) |
|
| 116 | 116 | { |
| 117 | - echo $this->media->video( $args ); |
|
| 117 | + echo $this->media->video($args); |
|
| 118 | 118 | } |
| 119 | 119 | } |