@@ -6,13 +6,13 @@ |
||
| 6 | 6 | |
| 7 | 7 | class PostMeta 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\PostMeta::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\PostMeta::class; |
|
| 17 | + } |
|
| 18 | 18 | } |
@@ -6,13 +6,13 @@ |
||
| 6 | 6 | |
| 7 | 7 | class Media 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\Media::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\Media::class; |
|
| 17 | + } |
|
| 18 | 18 | } |
@@ -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 | /** |
@@ -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,21 +96,21 @@ discard block |
||
| 96 | 96 | */ |
| 97 | 97 | public function registerAssets() |
| 98 | 98 | { |
| 99 | - wp_enqueue_style( 'castor/main.css', Theme::assetUri( 'css/main.css' ), [], null ); |
|
| 100 | - wp_enqueue_script( 'castor/main.js', Theme::assetUri( 'js/main.js' ), [], null, true ); |
|
| 99 | + wp_enqueue_style('castor/main.css', Theme::assetUri('css/main.css'), [], null); |
|
| 100 | + wp_enqueue_script('castor/main.js', Theme::assetUri('js/main.js'), [], null, true); |
|
| 101 | 101 | } |
| 102 | 102 | |
| 103 | 103 | /** |
| 104 | 104 | * @return void |
| 105 | 105 | * @action customize_register |
| 106 | 106 | */ |
| 107 | - public function registerCustomizer( WP_Customize_Manager $manager ) |
|
| 107 | + public function registerCustomizer(WP_Customize_Manager $manager) |
|
| 108 | 108 | { |
| 109 | - $manager->get_setting( 'blogname' )->transport = 'postMessage'; |
|
| 110 | - $manager->selective_refresh->add_partial( 'blogname', [ |
|
| 109 | + $manager->get_setting('blogname')->transport = 'postMessage'; |
|
| 110 | + $manager->selective_refresh->add_partial('blogname', [ |
|
| 111 | 111 | 'selector' => '.brand', |
| 112 | 112 | 'render_callback' => function() { |
| 113 | - bloginfo( 'name' ); |
|
| 113 | + bloginfo('name'); |
|
| 114 | 114 | }, |
| 115 | 115 | ]); |
| 116 | 116 | } |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | */ |
| 122 | 122 | public function registerCustomizerAssets() |
| 123 | 123 | { |
| 124 | - wp_enqueue_script( 'castor/customizer.js', Theme::assetUri( 'js/customizer.js' ), ['customize-preview'], null, true ); |
|
| 124 | + wp_enqueue_script('castor/customizer.js', Theme::assetUri('js/customizer.js'), ['customize-preview'], null, true); |
|
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | /** |
@@ -130,23 +130,23 @@ discard block |
||
| 130 | 130 | */ |
| 131 | 131 | public function registerSidebars() |
| 132 | 132 | { |
| 133 | - $defaults = apply_filters( 'castor/register/sidebars/defaults', [ |
|
| 133 | + $defaults = apply_filters('castor/register/sidebars/defaults', [ |
|
| 134 | 134 | 'before_widget' => '<div class="widget %1$s %2$s">', |
| 135 | 135 | 'after_widget' => '</div>', |
| 136 | 136 | 'before_title' => '<h4>', |
| 137 | 137 | 'after_title' => '</h4>', |
| 138 | 138 | ]); |
| 139 | 139 | |
| 140 | - $sidebars = apply_filters( 'castor/register/sidebars', [ |
|
| 141 | - 'sidebar-primary' => __( 'Primary Sidebar', 'castor' ), |
|
| 142 | - 'sidebar-footer' => __( 'Footer Sidebar', 'castor' ), |
|
| 140 | + $sidebars = apply_filters('castor/register/sidebars', [ |
|
| 141 | + 'sidebar-primary' => __('Primary Sidebar', 'castor'), |
|
| 142 | + 'sidebar-footer' => __('Footer Sidebar', 'castor'), |
|
| 143 | 143 | ]); |
| 144 | 144 | |
| 145 | - foreach( $sidebars as $id => $name ) { |
|
| 145 | + foreach ($sidebars as $id => $name) { |
|
| 146 | 146 | register_sidebar([ |
| 147 | 147 | 'id' => $id, |
| 148 | 148 | 'name' => $name, |
| 149 | - ] + $defaults ); |
|
| 149 | + ] + $defaults); |
|
| 150 | 150 | } |
| 151 | 151 | } |
| 152 | 152 | } |
@@ -1,24 +1,24 @@ |
||
| 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 | |
@@ -17,6 +17,7 @@ discard block |
||
| 17 | 17 | } |
| 18 | 18 | |
| 19 | 19 | /** |
| 20 | + * @param string $tag |
|
| 20 | 21 | * @return string |
| 21 | 22 | */ |
| 22 | 23 | public function buildAttributesFor( $tag, array $atts = [] ) |
@@ -81,7 +82,7 @@ discard block |
||
| 81 | 82 | * @param string $needle |
| 82 | 83 | * @param string $haystack |
| 83 | 84 | * |
| 84 | - * @return string |
|
| 85 | + * @return boolean |
|
| 85 | 86 | */ |
| 86 | 87 | public function endsWith( $needle, $haystack ) |
| 87 | 88 | { |
@@ -93,7 +94,6 @@ discard block |
||
| 93 | 94 | |
| 94 | 95 | /** |
| 95 | 96 | * @param string $tag |
| 96 | - * @param string $content |
|
| 97 | 97 | * |
| 98 | 98 | * @return void |
| 99 | 99 | */ |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | * @param string $needle |
| 127 | 127 | * @param string $haystack |
| 128 | 128 | * |
| 129 | - * @return string |
|
| 129 | + * @return boolean |
|
| 130 | 130 | */ |
| 131 | 131 | public function startsWith( $needle, $haystack ) |
| 132 | 132 | { |
@@ -7,22 +7,22 @@ discard block |
||
| 7 | 7 | /** |
| 8 | 8 | * @return string |
| 9 | 9 | */ |
| 10 | - public function buildAttributes( array $atts = [] ) |
|
| 10 | + public function buildAttributes(array $atts = []) |
|
| 11 | 11 | { |
| 12 | 12 | $attributes = []; |
| 13 | - foreach( $atts as $key => $value ) { |
|
| 14 | - $attributes[] = sprintf( '%s="%s"', $key, $value ); |
|
| 13 | + foreach ($atts as $key => $value) { |
|
| 14 | + $attributes[] = sprintf('%s="%s"', $key, $value); |
|
| 15 | 15 | } |
| 16 | - return implode( ' ', $attributes ); |
|
| 16 | + return implode(' ', $attributes); |
|
| 17 | 17 | } |
| 18 | 18 | |
| 19 | 19 | /** |
| 20 | 20 | * @return string |
| 21 | 21 | */ |
| 22 | - public function buildAttributesFor( $tag, array $atts = [] ) |
|
| 22 | + public function buildAttributesFor($tag, array $atts = []) |
|
| 23 | 23 | { |
| 24 | 24 | return $this->buildAttributes( |
| 25 | - wp_parse_args( $atts, apply_filters( "castor/render/$tag/attributes", [] )) |
|
| 25 | + wp_parse_args($atts, apply_filters("castor/render/$tag/attributes", [])) |
|
| 26 | 26 | ); |
| 27 | 27 | } |
| 28 | 28 | |
@@ -32,13 +32,13 @@ discard block |
||
| 32 | 32 | * |
| 33 | 33 | * @return string |
| 34 | 34 | */ |
| 35 | - public function buildClassName( $name, $path = '' ) |
|
| 35 | + public function buildClassName($name, $path = '') |
|
| 36 | 36 | { |
| 37 | - $className = array_map( 'ucfirst', array_map( 'strtolower', preg_split( '/[-_]/', $name ))); |
|
| 38 | - $className = implode( '', $className ); |
|
| 37 | + $className = array_map('ucfirst', array_map('strtolower', preg_split('/[-_]/', $name))); |
|
| 38 | + $className = implode('', $className); |
|
| 39 | 39 | |
| 40 | - return !empty( $path ) |
|
| 41 | - ? str_replace( '\\\\', '\\', sprintf( '%s\%s', $path, $className )) |
|
| 40 | + return !empty($path) |
|
| 41 | + ? str_replace('\\\\', '\\', sprintf('%s\%s', $path, $className)) |
|
| 42 | 42 | : $className; |
| 43 | 43 | } |
| 44 | 44 | |
@@ -48,9 +48,9 @@ discard block |
||
| 48 | 48 | * |
| 49 | 49 | * @return string |
| 50 | 50 | */ |
| 51 | - public function buildMethodName( $name, $prefix = 'get' ) |
|
| 51 | + public function buildMethodName($name, $prefix = 'get') |
|
| 52 | 52 | { |
| 53 | - return lcfirst( $this->buildClassName( $prefix . '-' . $name )); |
|
| 53 | + return lcfirst($this->buildClassName($prefix . '-' . $name)); |
|
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | /** |
@@ -58,9 +58,9 @@ discard block |
||
| 58 | 58 | * |
| 59 | 59 | * @return string |
| 60 | 60 | */ |
| 61 | - public function cleanString( $string ) |
|
| 61 | + public function cleanString($string) |
|
| 62 | 62 | { |
| 63 | - return trim( strip_tags( $string )); |
|
| 63 | + return trim(strip_tags($string)); |
|
| 64 | 64 | } |
| 65 | 65 | |
| 66 | 66 | /** |
@@ -70,9 +70,9 @@ discard block |
||
| 70 | 70 | * |
| 71 | 71 | * @return string |
| 72 | 72 | */ |
| 73 | - public function endWith( $suffix, $string, $unique = true ) |
|
| 73 | + public function endWith($suffix, $string, $unique = true) |
|
| 74 | 74 | { |
| 75 | - return $unique && $this->endsWith( $suffix, $string ) |
|
| 75 | + return $unique && $this->endsWith($suffix, $string) |
|
| 76 | 76 | ? $string |
| 77 | 77 | : $string . $suffix; |
| 78 | 78 | } |
@@ -83,11 +83,11 @@ discard block |
||
| 83 | 83 | * |
| 84 | 84 | * @return string |
| 85 | 85 | */ |
| 86 | - public function endsWith( $needle, $haystack ) |
|
| 86 | + public function endsWith($needle, $haystack) |
|
| 87 | 87 | { |
| 88 | - $length = strlen( $needle ); |
|
| 88 | + $length = strlen($needle); |
|
| 89 | 89 | return $length != 0 |
| 90 | - ? substr( $haystack, -$length ) === $needle |
|
| 90 | + ? substr($haystack, -$length) === $needle |
|
| 91 | 91 | : true; |
| 92 | 92 | } |
| 93 | 93 | |
@@ -97,12 +97,12 @@ discard block |
||
| 97 | 97 | * |
| 98 | 98 | * @return void |
| 99 | 99 | */ |
| 100 | - public function printTag( $tag, $value, array $attributes = [] ) |
|
| 100 | + public function printTag($tag, $value, array $attributes = []) |
|
| 101 | 101 | { |
| 102 | - $attributes = $this->buildAttributesFor( $tag, $attributes ); |
|
| 102 | + $attributes = $this->buildAttributesFor($tag, $attributes); |
|
| 103 | 103 | |
| 104 | - printf( '<%s>%s</%s>', |
|
| 105 | - rtrim( sprintf( '%s %s', $tag, $attributes )), |
|
| 104 | + printf('<%s>%s</%s>', |
|
| 105 | + rtrim(sprintf('%s %s', $tag, $attributes)), |
|
| 106 | 106 | $value, |
| 107 | 107 | $tag |
| 108 | 108 | ); |
@@ -115,9 +115,9 @@ discard block |
||
| 115 | 115 | * |
| 116 | 116 | * @return string |
| 117 | 117 | */ |
| 118 | - public function startWith( $prefix, $string, $unique = true ) |
|
| 118 | + public function startWith($prefix, $string, $unique = true) |
|
| 119 | 119 | { |
| 120 | - return $unique && $this->startsWith( $prefix, $string ) |
|
| 120 | + return $unique && $this->startsWith($prefix, $string) |
|
| 121 | 121 | ? $string |
| 122 | 122 | : $prefix . $string; |
| 123 | 123 | } |
@@ -128,9 +128,9 @@ discard block |
||
| 128 | 128 | * |
| 129 | 129 | * @return string |
| 130 | 130 | */ |
| 131 | - public function startsWith( $needle, $haystack ) |
|
| 131 | + public function startsWith($needle, $haystack) |
|
| 132 | 132 | { |
| 133 | - return substr( $haystack, 0, strlen( $needle )) === $needle; |
|
| 133 | + return substr($haystack, 0, strlen($needle)) === $needle; |
|
| 134 | 134 | } |
| 135 | 135 | |
| 136 | 136 | /** |
@@ -140,11 +140,11 @@ discard block |
||
| 140 | 140 | * |
| 141 | 141 | * @return string |
| 142 | 142 | */ |
| 143 | - public function trimLeft( $string, $needle, $caseSensitive = true ) |
|
| 143 | + public function trimLeft($string, $needle, $caseSensitive = true) |
|
| 144 | 144 | { |
| 145 | 145 | $strPos = $caseSensitive ? "strpos" : "stripos"; |
| 146 | - if( $strPos( $string, $needle ) === 0 ) { |
|
| 147 | - $string = substr( $string, strlen( $needle )); |
|
| 146 | + if ($strPos($string, $needle) === 0) { |
|
| 147 | + $string = substr($string, strlen($needle)); |
|
| 148 | 148 | } |
| 149 | 149 | return $string; |
| 150 | 150 | } |
@@ -156,11 +156,11 @@ discard block |
||
| 156 | 156 | * |
| 157 | 157 | * @return string |
| 158 | 158 | */ |
| 159 | - public function trimRight( $string, $needle, $caseSensitive = true ) |
|
| 159 | + public function trimRight($string, $needle, $caseSensitive = true) |
|
| 160 | 160 | { |
| 161 | 161 | $strPos = $caseSensitive ? "strpos" : "stripos"; |
| 162 | - if( $strPos( $string, $needle, strlen( $string ) - strlen( $needle )) !== false ) { |
|
| 163 | - $string = substr( $string, 0, -strlen( $needle )); |
|
| 162 | + if ($strPos($string, $needle, strlen($string) - strlen($needle)) !== false) { |
|
| 163 | + $string = substr($string, 0, -strlen($needle)); |
|
| 164 | 164 | } |
| 165 | 165 | return $string; |
| 166 | 166 | } |
@@ -8,7 +8,7 @@ discard block |
||
| 8 | 8 | { |
| 9 | 9 | public $utility; |
| 10 | 10 | |
| 11 | - public function __construct( Utility $utility ) |
|
| 11 | + public function __construct(Utility $utility) |
|
| 12 | 12 | { |
| 13 | 13 | $this->utility = $utility; |
| 14 | 14 | } |
@@ -18,23 +18,23 @@ discard block |
||
| 18 | 18 | * |
| 19 | 19 | * @return null|object |
| 20 | 20 | */ |
| 21 | - public function get( $attachmentId ) |
|
| 21 | + public function get($attachmentId) |
|
| 22 | 22 | { |
| 23 | - $thumbnail = wp_get_attachment_image_src( $attachmentId, 'thumbnail' ); |
|
| 23 | + $thumbnail = wp_get_attachment_image_src($attachmentId, 'thumbnail'); |
|
| 24 | 24 | |
| 25 | - if( !$thumbnail )return; |
|
| 25 | + if (!$thumbnail)return; |
|
| 26 | 26 | |
| 27 | - $medium = $this->normalizeSrc( wp_get_attachment_image_src( $attachmentId, 'medium' ), $thumbnail ); |
|
| 28 | - $large = $this->normalizeSrc( wp_get_attachment_image_src( $attachmentId, 'large' ), $medium ); |
|
| 27 | + $medium = $this->normalizeSrc(wp_get_attachment_image_src($attachmentId, 'medium'), $thumbnail); |
|
| 28 | + $large = $this->normalizeSrc(wp_get_attachment_image_src($attachmentId, 'large'), $medium); |
|
| 29 | 29 | |
| 30 | 30 | return (object) [ |
| 31 | - 'alt' => $this->utility->cleanString( get_post_meta( $attachmentId, '_wp_attachment_image_alt', true )), |
|
| 32 | - 'caption' => wp_get_attachment_caption( $attachmentId ), |
|
| 33 | - 'copyright' => $this->utility->cleanString( get_post_meta( $attachmentId, '_copyright', true )), |
|
| 31 | + 'alt' => $this->utility->cleanString(get_post_meta($attachmentId, '_wp_attachment_image_alt', true)), |
|
| 32 | + 'caption' => wp_get_attachment_caption($attachmentId), |
|
| 33 | + 'copyright' => $this->utility->cleanString(get_post_meta($attachmentId, '_copyright', true)), |
|
| 34 | 34 | 'large' => $large, |
| 35 | 35 | 'medium' => $medium, |
| 36 | - 'permalink' => get_attachment_link( $attachmentId ), |
|
| 37 | - 'thumbnail' => $this->normalizeSrc( $thumbnail ), |
|
| 36 | + 'permalink' => get_attachment_link($attachmentId), |
|
| 37 | + 'thumbnail' => $this->normalizeSrc($thumbnail), |
|
| 38 | 38 | ]; |
| 39 | 39 | } |
| 40 | 40 | |
@@ -43,9 +43,9 @@ discard block |
||
| 43 | 43 | * |
| 44 | 44 | * @return array |
| 45 | 45 | */ |
| 46 | - protected function normalizeSrc( array $image, $fallback = false ) |
|
| 46 | + protected function normalizeSrc(array $image, $fallback = false) |
|
| 47 | 47 | { |
| 48 | - if( is_array( $fallback ) && count( array_diff( $image, $fallback )) < 2 ) { |
|
| 48 | + if (is_array($fallback) && count(array_diff($image, $fallback)) < 2) { |
|
| 49 | 49 | $image = $fallback; |
| 50 | 50 | } |
| 51 | 51 | return [ |
@@ -22,7 +22,9 @@ |
||
| 22 | 22 | { |
| 23 | 23 | $thumbnail = wp_get_attachment_image_src( $attachmentId, 'thumbnail' ); |
| 24 | 24 | |
| 25 | - if( !$thumbnail )return; |
|
| 25 | + if( !$thumbnail ) { |
|
| 26 | + return; |
|
| 27 | + } |
|
| 26 | 28 | |
| 27 | 29 | $medium = $this->normalizeSrc( wp_get_attachment_image_src( $attachmentId, 'medium' ), $thumbnail ); |
| 28 | 30 | $large = $this->normalizeSrc( wp_get_attachment_image_src( $attachmentId, 'large' ), $medium ); |
@@ -18,7 +18,7 @@ discard block |
||
| 18 | 18 | |
| 19 | 19 | protected $args; |
| 20 | 20 | |
| 21 | - public function __construct( Image $image, PostMeta $postmeta, Theme $theme, Utility $utility ) |
|
| 21 | + public function __construct(Image $image, PostMeta $postmeta, Theme $theme, Utility $utility) |
|
| 22 | 22 | { |
| 23 | 23 | $this->image = $image; |
| 24 | 24 | $this->postmeta = $postmeta; |
@@ -29,9 +29,9 @@ discard block |
||
| 29 | 29 | /** |
| 30 | 30 | * @return WP_Query |
| 31 | 31 | */ |
| 32 | - public function query( array $args = [] ) |
|
| 32 | + public function query(array $args = []) |
|
| 33 | 33 | { |
| 34 | - $this->normalizeArgs( $args ); |
|
| 34 | + $this->normalizeArgs($args); |
|
| 35 | 35 | |
| 36 | 36 | return new WP_Query([ |
| 37 | 37 | 'orderby' => 'post__in', |
@@ -47,21 +47,21 @@ discard block |
||
| 47 | 47 | /** |
| 48 | 48 | * @return string |
| 49 | 49 | */ |
| 50 | - public function render( WP_Query $gallery ) |
|
| 50 | + public function render(WP_Query $gallery) |
|
| 51 | 51 | { |
| 52 | - $images = array_reduce( $gallery->posts, function( $images, $attachment ) { |
|
| 53 | - return $images . $this->renderImage( $attachment ); |
|
| 52 | + $images = array_reduce($gallery->posts, function($images, $attachment) { |
|
| 53 | + return $images . $this->renderImage($attachment); |
|
| 54 | 54 | }); |
| 55 | - return sprintf( '<div class="gallery-images" itemscope itemtype="http://schema.org/ImageGallery">%s</div>', $images ); |
|
| 55 | + return sprintf('<div class="gallery-images" itemscope itemtype="http://schema.org/ImageGallery">%s</div>', $images); |
|
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | /** |
| 59 | 59 | * @return null|string |
| 60 | 60 | */ |
| 61 | - public function renderImage( WP_Post $attachment ) |
|
| 61 | + public function renderImage(WP_Post $attachment) |
|
| 62 | 62 | { |
| 63 | - $image = $this->image->get( $attachment->ID ); |
|
| 64 | - if( !$image )return; |
|
| 63 | + $image = $this->image->get($attachment->ID); |
|
| 64 | + if (!$image)return; |
|
| 65 | 65 | return sprintf( |
| 66 | 66 | '<figure class="gallery-image" data-w="%s" data-h="%s" data-ps=\'%s\' itemprop="associatedMedia" itemscope itemtype="http://schema.org/ImageObject">' . |
| 67 | 67 | '%s<figcaption itemprop="caption description">' . |
@@ -70,8 +70,8 @@ discard block |
||
| 70 | 70 | '</figure>', |
| 71 | 71 | $image->thumbnail['width'], |
| 72 | 72 | $image->thumbnail['height'], |
| 73 | - $this->getPhotoswipeData( $image ), |
|
| 74 | - $this->renderImageTag( $image ), |
|
| 73 | + $this->getPhotoswipeData($image), |
|
| 74 | + $this->renderImageTag($image), |
|
| 75 | 75 | $image->caption, |
| 76 | 76 | $image->copyright |
| 77 | 77 | ); |
@@ -80,15 +80,15 @@ discard block |
||
| 80 | 80 | /** |
| 81 | 81 | * @return null|string |
| 82 | 82 | */ |
| 83 | - public function renderPagination( WP_Query $query ) |
|
| 83 | + public function renderPagination(WP_Query $query) |
|
| 84 | 84 | { |
| 85 | - if( !$this->args['pagination'] )return; |
|
| 85 | + if (!$this->args['pagination'])return; |
|
| 86 | 86 | return paginate_links([ |
| 87 | - 'before_page_number' => '<span class="screen-reader-text">' . __( 'Page', 'castor' ) . ' </span>', |
|
| 87 | + 'before_page_number' => '<span class="screen-reader-text">' . __('Page', 'castor') . ' </span>', |
|
| 88 | 88 | 'current' => $query->query['paged'], |
| 89 | 89 | 'mid_size' => 1, |
| 90 | - 'next_text' => __( 'Next', 'castor' ), |
|
| 91 | - 'prev_text' => __( 'Previous', 'castor' ), |
|
| 90 | + 'next_text' => __('Next', 'castor'), |
|
| 91 | + 'prev_text' => __('Previous', 'castor'), |
|
| 92 | 92 | 'total' => $query->max_num_pages, |
| 93 | 93 | ]); |
| 94 | 94 | } |
@@ -99,14 +99,14 @@ discard block |
||
| 99 | 99 | * |
| 100 | 100 | * @return bool |
| 101 | 101 | */ |
| 102 | - protected function getBoolValue( $key, $value = null ) |
|
| 102 | + protected function getBoolValue($key, $value = null) |
|
| 103 | 103 | { |
| 104 | - $bool = $this->getValue( $key, $value ); |
|
| 104 | + $bool = $this->getValue($key, $value); |
|
| 105 | 105 | |
| 106 | - if( is_string( $bool ) && !in_array( $bool, ['true', 'false'] )) { |
|
| 107 | - $bool = wp_validate_boolean( $this->postmeta->get( $bool )); |
|
| 106 | + if (is_string($bool) && !in_array($bool, ['true', 'false'])) { |
|
| 107 | + $bool = wp_validate_boolean($this->postmeta->get($bool)); |
|
| 108 | 108 | } |
| 109 | - return is_bool( $bool ) |
|
| 109 | + return is_bool($bool) |
|
| 110 | 110 | ? $bool |
| 111 | 111 | : false; |
| 112 | 112 | } |
@@ -116,15 +116,15 @@ discard block |
||
| 116 | 116 | * |
| 117 | 117 | * @return int |
| 118 | 118 | */ |
| 119 | - protected function getGalleryArg( $value = null ) |
|
| 119 | + protected function getGalleryArg($value = null) |
|
| 120 | 120 | { |
| 121 | - $gallery = $this->getValue( 'gallery', $value ); |
|
| 121 | + $gallery = $this->getValue('gallery', $value); |
|
| 122 | 122 | |
| 123 | - if( !is_numeric( $gallery ) && is_string( $gallery )) { |
|
| 124 | - $gallery = intval( $this->postmeta->get( $gallery )); |
|
| 123 | + if (!is_numeric($gallery) && is_string($gallery)) { |
|
| 124 | + $gallery = intval($this->postmeta->get($gallery)); |
|
| 125 | 125 | } |
| 126 | - return !is_null( get_post( $gallery )) |
|
| 127 | - ? intval( $gallery ) |
|
| 126 | + return !is_null(get_post($gallery)) |
|
| 127 | + ? intval($gallery) |
|
| 128 | 128 | : 0; |
| 129 | 129 | } |
| 130 | 130 | |
@@ -133,14 +133,14 @@ discard block |
||
| 133 | 133 | * |
| 134 | 134 | * @return int |
| 135 | 135 | */ |
| 136 | - protected function getImagesPerPageArg( $value = null ) |
|
| 136 | + protected function getImagesPerPageArg($value = null) |
|
| 137 | 137 | { |
| 138 | - $perPage = $this->getValue( 'images_per_page', $value ); |
|
| 138 | + $perPage = $this->getValue('images_per_page', $value); |
|
| 139 | 139 | |
| 140 | - if( !is_numeric( $perPage ) && is_string( $perPage )) { |
|
| 141 | - $perPage = $this->postmeta->get( $perPage ); |
|
| 140 | + if (!is_numeric($perPage) && is_string($perPage)) { |
|
| 141 | + $perPage = $this->postmeta->get($perPage); |
|
| 142 | 142 | } |
| 143 | - return is_numeric( $perPage ) && !!$perPage |
|
| 143 | + return is_numeric($perPage) && !!$perPage |
|
| 144 | 144 | ? $perPage |
| 145 | 145 | : -1; |
| 146 | 146 | } |
@@ -150,9 +150,9 @@ discard block |
||
| 150 | 150 | * |
| 151 | 151 | * @return bool |
| 152 | 152 | */ |
| 153 | - protected function getLazyloadArg( $value = null ) |
|
| 153 | + protected function getLazyloadArg($value = null) |
|
| 154 | 154 | { |
| 155 | - return $this->getBoolValue( 'lazyload', $value ); |
|
| 155 | + return $this->getBoolValue('lazyload', $value); |
|
| 156 | 156 | } |
| 157 | 157 | |
| 158 | 158 | /** |
@@ -160,18 +160,18 @@ discard block |
||
| 160 | 160 | * |
| 161 | 161 | * @return array |
| 162 | 162 | */ |
| 163 | - protected function getMediaArg( $value = null ) |
|
| 163 | + protected function getMediaArg($value = null) |
|
| 164 | 164 | { |
| 165 | - $media = $this->getValue( 'media', $value ); |
|
| 165 | + $media = $this->getValue('media', $value); |
|
| 166 | 166 | |
| 167 | - if( is_string( $media )) { |
|
| 168 | - $media = $this->postmeta->get( $media, [ |
|
| 167 | + if (is_string($media)) { |
|
| 168 | + $media = $this->postmeta->get($media, [ |
|
| 169 | 169 | 'ID' => $this->getGalleryArg(), |
| 170 | 170 | 'single' => false, |
| 171 | 171 | ]); |
| 172 | 172 | } |
| 173 | - return is_array( $media ) |
|
| 174 | - ? wp_parse_id_list( $media ) |
|
| 173 | + return is_array($media) |
|
| 174 | + ? wp_parse_id_list($media) |
|
| 175 | 175 | : []; |
| 176 | 176 | } |
| 177 | 177 | |
@@ -180,7 +180,7 @@ discard block |
||
| 180 | 180 | */ |
| 181 | 181 | protected function getPaged() |
| 182 | 182 | { |
| 183 | - return intval( get_query_var(( is_front_page() ? 'page' : 'paged' ))) ?: 1; |
|
| 183 | + return intval(get_query_var((is_front_page() ? 'page' : 'paged'))) ?: 1; |
|
| 184 | 184 | } |
| 185 | 185 | |
| 186 | 186 | /** |
@@ -188,9 +188,9 @@ discard block |
||
| 188 | 188 | * |
| 189 | 189 | * @return bool |
| 190 | 190 | */ |
| 191 | - protected function getPaginationArg( $value = null ) |
|
| 191 | + protected function getPaginationArg($value = null) |
|
| 192 | 192 | { |
| 193 | - return $this->getBoolValue( 'pagination', $value ); |
|
| 193 | + return $this->getBoolValue('pagination', $value); |
|
| 194 | 194 | } |
| 195 | 195 | |
| 196 | 196 | /** |
@@ -198,17 +198,17 @@ discard block |
||
| 198 | 198 | * |
| 199 | 199 | * @return bool |
| 200 | 200 | */ |
| 201 | - protected function getPermalinksArg( $value = null ) |
|
| 201 | + protected function getPermalinksArg($value = null) |
|
| 202 | 202 | { |
| 203 | - return $this->getBoolValue( 'permalinks', $value ); |
|
| 203 | + return $this->getBoolValue('permalinks', $value); |
|
| 204 | 204 | } |
| 205 | 205 | |
| 206 | 206 | /** |
| 207 | 207 | * @return string |
| 208 | 208 | */ |
| 209 | - protected function getPhotoswipeData( $image ) |
|
| 209 | + protected function getPhotoswipeData($image) |
|
| 210 | 210 | { |
| 211 | - return sprintf( '{"l":{"src":"%s","w":%d,"h":%d},"m":{"src":"%s","w":%d,"h":%d}}', |
|
| 211 | + return sprintf('{"l":{"src":"%s","w":%d,"h":%d},"m":{"src":"%s","w":%d,"h":%d}}', |
|
| 212 | 212 | $image->large['url'], |
| 213 | 213 | $image->large['width'], |
| 214 | 214 | $image->large['height'], |
@@ -224,9 +224,9 @@ discard block |
||
| 224 | 224 | * |
| 225 | 225 | * @return mixed |
| 226 | 226 | */ |
| 227 | - protected function getValue( $key, $value = null ) |
|
| 227 | + protected function getValue($key, $value = null) |
|
| 228 | 228 | { |
| 229 | - if( is_null( $value ) && isset( $this->args[$key] )) { |
|
| 229 | + if (is_null($value) && isset($this->args[$key])) { |
|
| 230 | 230 | $value = $this->args[$key]; |
| 231 | 231 | } |
| 232 | 232 | return $value; |
@@ -235,23 +235,23 @@ discard block |
||
| 235 | 235 | /** |
| 236 | 236 | * @return array |
| 237 | 237 | */ |
| 238 | - protected function normalizeArgs( array $args = [] ) |
|
| 238 | + protected function normalizeArgs(array $args = []) |
|
| 239 | 239 | { |
| 240 | 240 | $defaults = [ |
| 241 | - 'gallery', // (string) meta_key | (int) post_id |
|
| 242 | - 'lazyload', // (string) meta_key | (bool) |
|
| 243 | - 'media', // (string) meta_key | (array) post_ids |
|
| 244 | - 'pagination', // (string) meta_key | (bool) |
|
| 241 | + 'gallery', // (string) meta_key | (int) post_id |
|
| 242 | + 'lazyload', // (string) meta_key | (bool) |
|
| 243 | + 'media', // (string) meta_key | (array) post_ids |
|
| 244 | + 'pagination', // (string) meta_key | (bool) |
|
| 245 | 245 | 'images_per_page', // (string) meta_key | (int) number |
| 246 | - 'permalinks', // (string) meta_key | (bool) |
|
| 246 | + 'permalinks', // (string) meta_key | (bool) |
|
| 247 | 247 | ]; |
| 248 | 248 | |
| 249 | - $this->args = shortcode_atts( array_combine( $defaults, $defaults ), $args ); |
|
| 249 | + $this->args = shortcode_atts(array_combine($defaults, $defaults), $args); |
|
| 250 | 250 | |
| 251 | - array_walk( $this->args, function( &$value, $key ) { |
|
| 252 | - $method = $this->utility->buildMethodName( $key . '_arg' ); |
|
| 253 | - if( method_exists( $this, $method )) { |
|
| 254 | - $value = call_user_func([ $this, $method ], $value ); |
|
| 251 | + array_walk($this->args, function(&$value, $key) { |
|
| 252 | + $method = $this->utility->buildMethodName($key . '_arg'); |
|
| 253 | + if (method_exists($this, $method)) { |
|
| 254 | + $value = call_user_func([$this, $method], $value); |
|
| 255 | 255 | } |
| 256 | 256 | }); |
| 257 | 257 | |
@@ -263,20 +263,20 @@ discard block |
||
| 263 | 263 | * |
| 264 | 264 | * @return null|string |
| 265 | 265 | */ |
| 266 | - protected function renderImageTag( $image ) |
|
| 266 | + protected function renderImageTag($image) |
|
| 267 | 267 | { |
| 268 | 268 | $imgSrc = $this->getLazyloadArg() |
| 269 | - ? $this->theme->imageUri( 'blank.gif' ) |
|
| 269 | + ? $this->theme->imageUri('blank.gif') |
|
| 270 | 270 | : $image->thumbnail['url']; |
| 271 | 271 | |
| 272 | - $imgTag = sprintf( '<img src="%s" data-src="%s" itemprop="thumbnail" alt="%s"/>', |
|
| 272 | + $imgTag = sprintf('<img src="%s" data-src="%s" itemprop="thumbnail" alt="%s"/>', |
|
| 273 | 273 | $imgSrc, |
| 274 | 274 | $image->thumbnail['url'], |
| 275 | 275 | $image->alt |
| 276 | 276 | ); |
| 277 | 277 | |
| 278 | 278 | return $this->getPermalinksArg() |
| 279 | - ? sprintf( '<a href="%s" itemprop="contentUrl">%s</a>', $image->permalink, $imgTag ) |
|
| 279 | + ? sprintf('<a href="%s" itemprop="contentUrl">%s</a>', $image->permalink, $imgTag) |
|
| 280 | 280 | : $imgTag; |
| 281 | 281 | } |
| 282 | 282 | } |
@@ -61,7 +61,9 @@ discard block |
||
| 61 | 61 | public function renderImage( WP_Post $attachment ) |
| 62 | 62 | { |
| 63 | 63 | $image = $this->image->get( $attachment->ID ); |
| 64 | - if( !$image )return; |
|
| 64 | + if( !$image ) { |
|
| 65 | + return; |
|
| 66 | + } |
|
| 65 | 67 | return sprintf( |
| 66 | 68 | '<figure class="gallery-image" data-w="%s" data-h="%s" data-ps=\'%s\' itemprop="associatedMedia" itemscope itemtype="http://schema.org/ImageObject">' . |
| 67 | 69 | '%s<figcaption itemprop="caption description">' . |
@@ -82,7 +84,9 @@ discard block |
||
| 82 | 84 | */ |
| 83 | 85 | public function renderPagination( WP_Query $query ) |
| 84 | 86 | { |
| 85 | - if( !$this->args['pagination'] )return; |
|
| 87 | + if( !$this->args['pagination'] ) { |
|
| 88 | + return; |
|
| 89 | + } |
|
| 86 | 90 | return paginate_links([ |
| 87 | 91 | 'before_page_number' => '<span class="screen-reader-text">' . __( 'Page', 'castor' ) . ' </span>', |
| 88 | 92 | 'current' => $query->query['paged'], |
@@ -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,67 +22,67 @@ 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 | 27 | $tag = 'blockquote'; |
| 28 | - $value = $this->postmeta->get( $metaKey ); |
|
| 28 | + $value = $this->postmeta->get($metaKey); |
|
| 29 | 29 | |
| 30 | - if( !$value )return; |
|
| 30 | + if (!$value)return; |
|
| 31 | 31 | |
| 32 | - $this->utility->printTag( $tag, wp_strip_all_tags( $value ), $attributes ); |
|
| 32 | + $this->utility->printTag($tag, wp_strip_all_tags($value), $attributes); |
|
| 33 | 33 | } |
| 34 | 34 | |
| 35 | - public function button( $postId = 0, $title = false ) |
|
| 35 | + public function button($postId = 0, $title = false) |
|
| 36 | 36 | { |
| 37 | - $post = get_post( $postId ); |
|
| 37 | + $post = get_post($postId); |
|
| 38 | 38 | |
| 39 | - if( !$post )return; |
|
| 40 | - if( !$title ) { |
|
| 39 | + if (!$post)return; |
|
| 40 | + if (!$title) { |
|
| 41 | 41 | $title = $post->post_title; |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | - printf( '<a href="%s" class="button"><span>%s</span></a>', |
|
| 45 | - get_permalink( $post->ID ), |
|
| 44 | + printf('<a href="%s" class="button"><span>%s</span></a>', |
|
| 45 | + get_permalink($post->ID), |
|
| 46 | 46 | $title |
| 47 | 47 | ); |
| 48 | 48 | } |
| 49 | 49 | |
| 50 | - public function buttons( array $postIds = [] ) |
|
| 50 | + public function buttons(array $postIds = []) |
|
| 51 | 51 | { |
| 52 | - foreach( $postIds as $postId ) { |
|
| 53 | - $this->button( $postId ); |
|
| 52 | + foreach ($postIds as $postId) { |
|
| 53 | + $this->button($postId); |
|
| 54 | 54 | } |
| 55 | 55 | } |
| 56 | 56 | |
| 57 | - public function content( $metaKey = false ) |
|
| 57 | + public function content($metaKey = false) |
|
| 58 | 58 | { |
| 59 | 59 | $content = $metaKey |
| 60 | - ? $this->postmeta->get( $metaKey ) |
|
| 60 | + ? $this->postmeta->get($metaKey) |
|
| 61 | 61 | : get_the_content(); |
| 62 | 62 | |
| 63 | - $content = apply_filters( 'the_content', $content ); |
|
| 63 | + $content = apply_filters('the_content', $content); |
|
| 64 | 64 | |
| 65 | - print str_replace( ']]>', ']]>', $content ); |
|
| 65 | + print str_replace(']]>', ']]>', $content); |
|
| 66 | 66 | } |
| 67 | 67 | |
| 68 | - public function gallery( array $args = [] ) |
|
| 68 | + public function gallery(array $args = []) |
|
| 69 | 69 | { |
| 70 | - print $this->media->gallery( $args ); |
|
| 70 | + print $this->media->gallery($args); |
|
| 71 | 71 | } |
| 72 | 72 | |
| 73 | - public function title( $metaKey = false, array $attributes = [] ) |
|
| 73 | + public function title($metaKey = false, array $attributes = []) |
|
| 74 | 74 | { |
| 75 | - $tag = apply_filters( 'castor/render/title/tag', 'h2' ); |
|
| 75 | + $tag = apply_filters('castor/render/title/tag', 'h2'); |
|
| 76 | 76 | $value = $metaKey |
| 77 | - ? $this->postmeta->get( $metaKey ) |
|
| 77 | + ? $this->postmeta->get($metaKey) |
|
| 78 | 78 | : $this->theme->pageTitle(); |
| 79 | 79 | |
| 80 | - if( !$value )return; |
|
| 80 | + if (!$value)return; |
|
| 81 | 81 | |
| 82 | - $this->utility->printTag( $tag, wp_strip_all_tags( $value ), $attributes ); |
|
| 82 | + $this->utility->printTag($tag, wp_strip_all_tags($value), $attributes); |
|
| 83 | 83 | } |
| 84 | 84 | |
| 85 | - public function video( $metaKey = 'video', $screenshotMetaKey = false ) |
|
| 85 | + public function video($metaKey = 'video', $screenshotMetaKey = false) |
|
| 86 | 86 | { |
| 87 | 87 | } |
| 88 | 88 | } |
@@ -27,7 +27,9 @@ discard block |
||
| 27 | 27 | $tag = 'blockquote'; |
| 28 | 28 | $value = $this->postmeta->get( $metaKey ); |
| 29 | 29 | |
| 30 | - if( !$value )return; |
|
| 30 | + if( !$value ) { |
|
| 31 | + return; |
|
| 32 | + } |
|
| 31 | 33 | |
| 32 | 34 | $this->utility->printTag( $tag, wp_strip_all_tags( $value ), $attributes ); |
| 33 | 35 | } |
@@ -36,7 +38,9 @@ discard block |
||
| 36 | 38 | { |
| 37 | 39 | $post = get_post( $postId ); |
| 38 | 40 | |
| 39 | - if( !$post )return; |
|
| 41 | + if( !$post ) { |
|
| 42 | + return; |
|
| 43 | + } |
|
| 40 | 44 | if( !$title ) { |
| 41 | 45 | $title = $post->post_title; |
| 42 | 46 | } |
@@ -77,7 +81,9 @@ discard block |
||
| 77 | 81 | ? $this->postmeta->get( $metaKey ) |
| 78 | 82 | : $this->theme->pageTitle(); |
| 79 | 83 | |
| 80 | - if( !$value )return; |
|
| 84 | + if( !$value ) { |
|
| 85 | + return; |
|
| 86 | + } |
|
| 81 | 87 | |
| 82 | 88 | $this->utility->printTag( $tag, wp_strip_all_tags( $value ), $attributes ); |
| 83 | 89 | } |