| @@ -12,24 +12,24 @@ discard block | ||
| 12 | 12 |  { | 
| 13 | 13 | public function afterSetupTheme() | 
| 14 | 14 |  	{ | 
| 15 | - add_editor_style( Theme::assetUri( 'css/editor.css' )); | |
| 16 | - add_theme_support( 'customize-selective-refresh-widgets' ); | |
| 17 | - add_theme_support( 'html5', ['caption', 'comment-form', 'comment-list', 'gallery', 'search-form'] ); | |
| 18 | - add_theme_support( 'post-thumbnails' ); | |
| 19 | - add_theme_support( 'soil-clean-up' ); | |
| 20 | - add_theme_support( 'soil-jquery-cdn' ); | |
| 21 | - add_theme_support( 'soil-nav-walker' ); | |
| 22 | - add_theme_support( 'soil-nice-search' ); | |
| 23 | - add_theme_support( 'soil-relative-urls' ); | |
| 24 | - add_theme_support( 'title-tag' ); | |
| 25 | - load_theme_textdomain( 'castor', Theme::paths( 'dir.template' ) . '/languages' ); | |
| 15 | +		add_editor_style(Theme::assetUri('css/editor.css')); | |
| 16 | +		add_theme_support('customize-selective-refresh-widgets'); | |
| 17 | +		add_theme_support('html5', ['caption', 'comment-form', 'comment-list', 'gallery', 'search-form']); | |
| 18 | +		add_theme_support('post-thumbnails'); | |
| 19 | +		add_theme_support('soil-clean-up'); | |
| 20 | +		add_theme_support('soil-jquery-cdn'); | |
| 21 | +		add_theme_support('soil-nav-walker'); | |
| 22 | +		add_theme_support('soil-nice-search'); | |
| 23 | +		add_theme_support('soil-relative-urls'); | |
| 24 | +		add_theme_support('title-tag'); | |
| 25 | +		load_theme_textdomain('castor', Theme::paths('dir.template') . '/languages'); | |
| 26 | 26 | |
| 27 | - $menus = apply_filters( 'castor/register/nav_menus', [ | |
| 28 | - 'main_menu' => __( 'Main Menu', 'castor' ), | |
| 27 | +		$menus = apply_filters('castor/register/nav_menus', [ | |
| 28 | +			'main_menu' => __('Main Menu', 'castor'), | |
| 29 | 29 | ]); | 
| 30 | 30 | |
| 31 | -		foreach( $menus as $location => $description ) { | |
| 32 | - register_nav_menu( $location, $description ); | |
| 31 | +		foreach ($menus as $location => $description) { | |
| 32 | + register_nav_menu($location, $description); | |
| 33 | 33 | } | 
| 34 | 34 | } | 
| 35 | 35 | |
| @@ -37,11 +37,11 @@ discard block | ||
| 37 | 37 | * @return string | 
| 38 | 38 | * @filter template_include | 
| 39 | 39 | */ | 
| 40 | - public function filterTemplate( $template ) | |
| 40 | + public function filterTemplate($template) | |
| 41 | 41 |  	{ | 
| 42 | -		if( is_string( $template )) { | |
| 43 | - $template = Template::setLayout( $template ); | |
| 44 | - Development::storeTemplatePath( $template ); | |
| 42 | +		if (is_string($template)) { | |
| 43 | + $template = Template::setLayout($template); | |
| 44 | + Development::storeTemplatePath($template); | |
| 45 | 45 | } | 
| 46 | 46 | return $template; | 
| 47 | 47 | } | 
| @@ -50,54 +50,54 @@ discard block | ||
| 50 | 50 | * @return array | 
| 51 | 51 |  	 * @filter {$type}_template_hierarchy | 
| 52 | 52 | */ | 
| 53 | - public function filterTemplateHierarchy( array $templates ) | |
| 53 | + public function filterTemplateHierarchy(array $templates) | |
| 54 | 54 |  	{ | 
| 55 | -		return array_map( function( $template ) { | |
| 56 | - return Utility::startWith( 'templates/', $template ); | |
| 57 | - }, $templates ); | |
| 55 | +		return array_map(function($template) { | |
| 56 | +			return Utility::startWith('templates/', $template); | |
| 57 | + }, $templates); | |
| 58 | 58 | } | 
| 59 | 59 | |
| 60 | 60 | public function registerAssets() | 
| 61 | 61 |  	{ | 
| 62 | - wp_enqueue_style( 'castor/main.css', Theme::assetUri( 'css/main.css' ), [], null ); | |
| 63 | - wp_enqueue_script( 'castor/main.js', Theme::assetUri( 'js/main.js' ), [], null, true ); | |
| 62 | +		wp_enqueue_style('castor/main.css', Theme::assetUri('css/main.css'), [], null); | |
| 63 | +		wp_enqueue_script('castor/main.js', Theme::assetUri('js/main.js'), [], null, true); | |
| 64 | 64 | } | 
| 65 | 65 | |
| 66 | - public function registerCustomizer( WP_Customize_Manager $manager ) | |
| 66 | + public function registerCustomizer(WP_Customize_Manager $manager) | |
| 67 | 67 |  	{ | 
| 68 | - $manager->get_setting( 'blogname' )->transport = 'postMessage'; | |
| 69 | - $manager->selective_refresh->add_partial( 'blogname', [ | |
| 68 | +		$manager->get_setting('blogname')->transport = 'postMessage'; | |
| 69 | +		$manager->selective_refresh->add_partial('blogname', [ | |
| 70 | 70 | 'selector' => '.brand', | 
| 71 | 71 |  			'render_callback' => function() { | 
| 72 | - bloginfo( 'name' ); | |
| 72 | +				bloginfo('name'); | |
| 73 | 73 | }, | 
| 74 | 74 | ]); | 
| 75 | 75 | } | 
| 76 | 76 | |
| 77 | 77 | public function registerCustomizerAssets() | 
| 78 | 78 |  	{ | 
| 79 | - wp_enqueue_script( 'castor/customizer.js', Theme::assetUri( 'js/customizer.js' ), ['customize-preview'], null, true ); | |
| 79 | +		wp_enqueue_script('castor/customizer.js', Theme::assetUri('js/customizer.js'), ['customize-preview'], null, true); | |
| 80 | 80 | } | 
| 81 | 81 | |
| 82 | 82 | public function registerSidebars() | 
| 83 | 83 |  	{ | 
| 84 | - $defaults = apply_filters( 'castor/register/sidebars/defaults', [ | |
| 84 | +		$defaults = apply_filters('castor/register/sidebars/defaults', [ | |
| 85 | 85 | 'before_widget' => '<div class="widget %1$s %2$s">', | 
| 86 | 86 | 'after_widget' => '</div>', | 
| 87 | 87 | 'before_title' => '<h4>', | 
| 88 | 88 | 'after_title' => '</h4>', | 
| 89 | 89 | ]); | 
| 90 | 90 | |
| 91 | - $sidebars = apply_filters( 'castor/register/sidebars', [ | |
| 92 | - 'sidebar-primary' => __( 'Primary Sidebar', 'castor' ), | |
| 93 | - 'sidebar-footer' => __( 'Footer Sidebar', 'castor' ), | |
| 91 | +		$sidebars = apply_filters('castor/register/sidebars', [ | |
| 92 | +			'sidebar-primary' => __('Primary Sidebar', 'castor'), | |
| 93 | +			'sidebar-footer'  => __('Footer Sidebar', 'castor'), | |
| 94 | 94 | ]); | 
| 95 | 95 | |
| 96 | -		foreach( $sidebars as $id => $name ) { | |
| 96 | +		foreach ($sidebars as $id => $name) { | |
| 97 | 97 | register_sidebar([ | 
| 98 | 98 | 'id' => $id, | 
| 99 | 99 | 'name' => $name, | 
| 100 | - ] + $defaults ); | |
| 100 | + ] + $defaults); | |
| 101 | 101 | } | 
| 102 | 102 | } | 
| 103 | 103 | } | 
| @@ -8,7 +8,7 @@ discard block | ||
| 8 | 8 |  { | 
| 9 | 9 | public $postmeta; | 
| 10 | 10 | |
| 11 | - public function __construct( PostMeta $postmeta ) | |
| 11 | + public function __construct(PostMeta $postmeta) | |
| 12 | 12 |  	{ | 
| 13 | 13 | $this->postmeta = $postmeta; | 
| 14 | 14 | } | 
| @@ -18,9 +18,9 @@ discard block | ||
| 18 | 18 | * | 
| 19 | 19 | * @return string | 
| 20 | 20 | */ | 
| 21 | - public function assetPath( $asset ) | |
| 21 | + public function assetPath($asset) | |
| 22 | 22 |  	{ | 
| 23 | - return $this->paths( 'dir.stylesheet' ) . 'assets/' . $asset; | |
| 23 | +		return $this->paths('dir.stylesheet') . 'assets/' . $asset; | |
| 24 | 24 | } | 
| 25 | 25 | |
| 26 | 26 | /** | 
| @@ -28,9 +28,9 @@ discard block | ||
| 28 | 28 | * | 
| 29 | 29 | * @return string | 
| 30 | 30 | */ | 
| 31 | - public function assetUri( $asset ) | |
| 31 | + public function assetUri($asset) | |
| 32 | 32 |  	{ | 
| 33 | - return $this->paths( 'uri.stylesheet' ) . 'assets/' . $asset; | |
| 33 | +		return $this->paths('uri.stylesheet') . 'assets/' . $asset; | |
| 34 | 34 | } | 
| 35 | 35 | |
| 36 | 36 | /** | 
| @@ -44,9 +44,9 @@ discard block | ||
| 44 | 44 | is_single(), | 
| 45 | 45 | ]; | 
| 46 | 46 | |
| 47 | - $display = in_array( true, $conditions ); | |
| 47 | + $display = in_array(true, $conditions); | |
| 48 | 48 | |
| 49 | - return apply_filters( 'castor/display/sidebar', $display ); | |
| 49 | +		return apply_filters('castor/display/sidebar', $display); | |
| 50 | 50 | } | 
| 51 | 51 | |
| 52 | 52 | /** | 
| @@ -54,9 +54,9 @@ discard block | ||
| 54 | 54 | * | 
| 55 | 55 | * @return string | 
| 56 | 56 | */ | 
| 57 | - public function imagePath( $asset ) | |
| 57 | + public function imagePath($asset) | |
| 58 | 58 |  	{ | 
| 59 | - return $this->paths( 'dir.stylesheet' ) . 'assets/img/' . $asset; | |
| 59 | +		return $this->paths('dir.stylesheet') . 'assets/img/' . $asset; | |
| 60 | 60 | } | 
| 61 | 61 | |
| 62 | 62 | /** | 
| @@ -64,16 +64,16 @@ discard block | ||
| 64 | 64 | * | 
| 65 | 65 | * @return string | 
| 66 | 66 | */ | 
| 67 | - public function imageUri( $asset ) | |
| 67 | + public function imageUri($asset) | |
| 68 | 68 |  	{ | 
| 69 | - return $this->paths( 'uri.stylesheet' ) . 'assets/img/' . $asset; | |
| 69 | +		return $this->paths('uri.stylesheet') . 'assets/img/' . $asset; | |
| 70 | 70 | } | 
| 71 | 71 | |
| 72 | 72 | public function pageTitle() | 
| 73 | 73 |  	{ | 
| 74 | -		foreach( ['is_404', 'is_archive', 'is_home', 'is_page', 'is_search'] as $bool ) { | |
| 75 | - if( !$bool() )continue; | |
| 76 | - $method = sprintf( 'get%sTitle', ucfirst( str_replace( 'is_', '', $bool ))); | |
| 74 | +		foreach (['is_404', 'is_archive', 'is_home', 'is_page', 'is_search'] as $bool) { | |
| 75 | + if (!$bool())continue; | |
| 76 | +			$method = sprintf('get%sTitle', ucfirst(str_replace('is_', '', $bool))); | |
| 77 | 77 | return $this->$method(); | 
| 78 | 78 | } | 
| 79 | 79 | |
| @@ -85,7 +85,7 @@ discard block | ||
| 85 | 85 | * | 
| 86 | 86 | * @return array|string | 
| 87 | 87 | */ | 
| 88 | - public function paths( $path = null ) | |
| 88 | + public function paths($path = null) | |
| 89 | 89 |  	{ | 
| 90 | 90 | $paths = [ | 
| 91 | 91 | 'dir.stylesheet' => get_stylesheet_directory(), | 
| @@ -95,18 +95,18 @@ discard block | ||
| 95 | 95 | 'uri.template' => get_template_directory_uri(), | 
| 96 | 96 | ]; | 
| 97 | 97 | |
| 98 | -		if( is_null( $path )) { | |
| 98 | +		if (is_null($path)) { | |
| 99 | 99 | return $paths; | 
| 100 | 100 | } | 
| 101 | 101 | |
| 102 | - return array_key_exists( $path, $paths ) | |
| 103 | - ? trailingslashit( $paths[$path] ) | |
| 102 | + return array_key_exists($path, $paths) | |
| 103 | + ? trailingslashit($paths[$path]) | |
| 104 | 104 | : ''; | 
| 105 | 105 | } | 
| 106 | 106 | |
| 107 | 107 | protected function get404Title() | 
| 108 | 108 |  	{ | 
| 109 | - return __( 'Not Found', 'castor' ); | |
| 109 | +		return __('Not Found', 'castor'); | |
| 110 | 110 | } | 
| 111 | 111 | |
| 112 | 112 | protected function getArchiveTitle() | 
| @@ -116,20 +116,20 @@ discard block | ||
| 116 | 116 | |
| 117 | 117 | protected function getHomeTitle() | 
| 118 | 118 |  	{ | 
| 119 | - return ( $home = get_option( 'page_for_posts', true )) | |
| 120 | - ? get_the_title( $home ) | |
| 121 | - : __( 'Latest Posts', 'castor' ); | |
| 119 | +		return ($home = get_option('page_for_posts', true)) | |
| 120 | + ? get_the_title($home) | |
| 121 | +			: __('Latest Posts', 'castor'); | |
| 122 | 122 | } | 
| 123 | 123 | |
| 124 | 124 | protected function getPageTitle() | 
| 125 | 125 |  	{ | 
| 126 | - return $title = $this->postmeta->get( 'title' ) | |
| 126 | +		return $title = $this->postmeta->get('title') | |
| 127 | 127 | ? $title | 
| 128 | 128 | : get_the_title(); | 
| 129 | 129 | } | 
| 130 | 130 | |
| 131 | 131 | protected function getSearchTitle() | 
| 132 | 132 |  	{ | 
| 133 | - return sprintf( __( 'Search Results for %s', 'castor' ), get_search_query() ); | |
| 133 | +		return sprintf(__('Search Results for %s', 'castor'), get_search_query()); | |
| 134 | 134 | } | 
| 135 | 135 | } | 
| @@ -72,7 +72,9 @@ | ||
| 72 | 72 | public function pageTitle() | 
| 73 | 73 |  	{ | 
| 74 | 74 |  		foreach( ['is_404', 'is_archive', 'is_home', 'is_page', 'is_search'] as $bool ) { | 
| 75 | - if( !$bool() )continue; | |
| 75 | +			if( !$bool() ) { | |
| 76 | + continue; | |
| 77 | + } | |
| 76 | 78 | $method = sprintf( 'get%sTitle', ucfirst( str_replace( 'is_', '', $bool ))); | 
| 77 | 79 | return $this->$method(); | 
| 78 | 80 | } | 
| @@ -4,7 +4,7 @@ discard block | ||
| 4 | 4 | |
| 5 | 5 | class PostMeta | 
| 6 | 6 |  { | 
| 7 | - public function get( $value, array $args = [] ) | |
| 7 | + public function get($value, array $args = []) | |
| 8 | 8 |  	{ | 
| 9 | 9 | $defaults = [ | 
| 10 | 10 | 'ID' => get_the_ID(), | 
| @@ -13,15 +13,15 @@ discard block | ||
| 13 | 13 | 'prefix' => 'pollux_', | 
| 14 | 14 | ]; | 
| 15 | 15 | |
| 16 | - $args = shortcode_atts( $defaults, $args ); | |
| 16 | + $args = shortcode_atts($defaults, $args); | |
| 17 | 17 | |
| 18 | -		if( $value[0] == '_' && !empty( $args['prefix'] )) { | |
| 19 | - $args['prefix'] = sprintf( '_%s', rtrim( $args['prefix'], '_' )); | |
| 18 | +		if ($value[0] == '_' && !empty($args['prefix'])) { | |
| 19 | +			$args['prefix'] = sprintf('_%s', rtrim($args['prefix'], '_')); | |
| 20 | 20 | } | 
| 21 | 21 | |
| 22 | - $metaValue = get_post_meta( $args['ID'], $args['prefix'] . $value, $args['single'] ); | |
| 22 | + $metaValue = get_post_meta($args['ID'], $args['prefix'] . $value, $args['single']); | |
| 23 | 23 | |
| 24 | - return empty( $metaValue ) | |
| 24 | + return empty($metaValue) | |
| 25 | 25 | ? $args['fallback'] | 
| 26 | 26 | : $metaValue; | 
| 27 | 27 | } | 
| @@ -12,7 +12,7 @@ discard block | ||
| 12 | 12 | public $postmeta; | 
| 13 | 13 | public $theme; | 
| 14 | 14 | |
| 15 | - public function __construct( PostMeta $postmeta, Theme $theme ) | |
| 15 | + public function __construct(PostMeta $postmeta, Theme $theme) | |
| 16 | 16 |  	{ | 
| 17 | 17 | $this->postmeta = $postmeta; | 
| 18 | 18 | $this->theme = $theme; | 
| @@ -21,51 +21,51 @@ discard block | ||
| 21 | 21 | /** | 
| 22 | 22 | * @return string | 
| 23 | 23 | */ | 
| 24 | - public function gallery( array $args = [] ) | |
| 24 | + public function gallery(array $args = []) | |
| 25 | 25 |  	{ | 
| 26 | - $gallery = $this->getGallery( $args ); | |
| 26 | + $gallery = $this->getGallery($args); | |
| 27 | 27 | |
| 28 | - return $this->renderGallery( $gallery ) . $this->renderGalleryPagination( $gallery ); | |
| 28 | + return $this->renderGallery($gallery) . $this->renderGalleryPagination($gallery); | |
| 29 | 29 | } | 
| 30 | 30 | |
| 31 | 31 | /** | 
| 32 | 32 | * @return WP_Query | 
| 33 | 33 | */ | 
| 34 | - public function getGallery( array $args ) | |
| 34 | + public function getGallery(array $args) | |
| 35 | 35 |  	{ | 
| 36 | - $args = $this->normalizeArgs( $args ); | |
| 36 | + $args = $this->normalizeArgs($args); | |
| 37 | 37 | |
| 38 | 38 | return new WP_Query([ | 
| 39 | 39 | 'orderby' => 'post__in', | 
| 40 | 40 | 'paged' => $this->getPaged(), | 
| 41 | - 'post__in' => $this->getMediaIds( $args ), | |
| 41 | + 'post__in' => $this->getMediaIds($args), | |
| 42 | 42 | 'post_mime_type' => 'image', | 
| 43 | 43 | 'post_type' => 'attachment', | 
| 44 | 44 | 'post_status' => 'inherit', | 
| 45 | - 'posts_per_page' => $this->getImagesPerPage( $args ), | |
| 45 | + 'posts_per_page' => $this->getImagesPerPage($args), | |
| 46 | 46 | ]); | 
| 47 | 47 | } | 
| 48 | 48 | |
| 49 | 49 | /** | 
| 50 | 50 | * @return string | 
| 51 | 51 | */ | 
| 52 | - public function renderGallery( WP_Query $gallery ) | |
| 52 | + public function renderGallery(WP_Query $gallery) | |
| 53 | 53 |  	{ | 
| 54 | -		$images = array_reduce( $gallery->posts, function( $images, $attachment ) { | |
| 55 | - return $images . $this->renderGalleryImage( $attachment ); | |
| 54 | +		$images = array_reduce($gallery->posts, function($images, $attachment) { | |
| 55 | + return $images . $this->renderGalleryImage($attachment); | |
| 56 | 56 | }); | 
| 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 renderGalleryImage( WP_Post $attachment ) | |
| 64 | + public function renderGalleryImage(WP_Post $attachment) | |
| 65 | 65 |  	{ | 
| 66 | - $image = $this->getImageSrc( $attachment->ID ); | |
| 66 | + $image = $this->getImageSrc($attachment->ID); | |
| 67 | 67 | |
| 68 | - if( !$image )return; | |
| 68 | + if (!$image)return; | |
| 69 | 69 | |
| 70 | 70 | return sprintf( | 
| 71 | 71 | '<figure data-w="%s" data-h="%s" itemprop="associatedMedia" itemscope itemtype="http://schema.org/ImageObject">' . | 
| @@ -82,7 +82,7 @@ discard block | ||
| 82 | 82 | $image->medium['url'], | 
| 83 | 83 | $image->medium['width'], | 
| 84 | 84 | $image->medium['height'], | 
| 85 | - $this->theme->imageUri( 'blank.gif' ), | |
| 85 | +			$this->theme->imageUri('blank.gif'), | |
| 86 | 86 | $image->thumbnail['url'], | 
| 87 | 87 | $image->alt, | 
| 88 | 88 | $image->caption, | 
| @@ -93,14 +93,14 @@ discard block | ||
| 93 | 93 | /** | 
| 94 | 94 | * @return string | 
| 95 | 95 | */ | 
| 96 | - public function renderGalleryPagination( WP_Query $query ) | |
| 96 | + public function renderGalleryPagination(WP_Query $query) | |
| 97 | 97 |  	{ | 
| 98 | 98 | return paginate_links([ | 
| 99 | - 'before_page_number' => '<span class="screen-reader-text">' . __( 'Page', 'castor' ) . ' </span>', | |
| 99 | +			'before_page_number' => '<span class="screen-reader-text">' . __('Page', 'castor') . ' </span>', | |
| 100 | 100 | 'current' => $query->query['paged'], | 
| 101 | 101 | 'mid_size' => 1, | 
| 102 | - 'next_text' => __( 'Next', 'castor' ), | |
| 103 | - 'prev_text' => __( 'Previous', 'castor' ), | |
| 102 | +			'next_text'          => __('Next', 'castor'), | |
| 103 | +			'prev_text'          => __('Previous', 'castor'), | |
| 104 | 104 | 'total' => $query->max_num_pages, | 
| 105 | 105 | ]); | 
| 106 | 106 | } | 
| @@ -108,11 +108,11 @@ discard block | ||
| 108 | 108 | /** | 
| 109 | 109 | * @return mixed | 
| 110 | 110 | */ | 
| 111 | - protected function getImagesPerPage( array $args ) | |
| 111 | + protected function getImagesPerPage(array $args) | |
| 112 | 112 |  	{ | 
| 113 | - $args = $this->normalizeArgs( $args ); | |
| 113 | + $args = $this->normalizeArgs($args); | |
| 114 | 114 | |
| 115 | - return $this->postmeta->get( $args['per_page'], [ | |
| 115 | + return $this->postmeta->get($args['per_page'], [ | |
| 116 | 116 | 'fallback' => -1, | 
| 117 | 117 | ]); | 
| 118 | 118 | } | 
| @@ -122,20 +122,20 @@ discard block | ||
| 122 | 122 | * | 
| 123 | 123 | * @return null|object | 
| 124 | 124 | */ | 
| 125 | - protected function getImageSrc( $id ) | |
| 125 | + protected function getImageSrc($id) | |
| 126 | 126 |  	{ | 
| 127 | - $thumbnail = wp_get_attachment_image_src( $id, 'thumbnail' ); | |
| 127 | + $thumbnail = wp_get_attachment_image_src($id, 'thumbnail'); | |
| 128 | 128 | |
| 129 | - if( !$thumbnail )return; | |
| 129 | + if (!$thumbnail)return; | |
| 130 | 130 | |
| 131 | - $medium = $this->normalizeImageSrc( wp_get_attachment_image_src( $id, 'medium' ), $thumbnail ); | |
| 132 | - $large = $this->normalizeImageSrc( wp_get_attachment_image_src( $id, 'large' ), $medium ); | |
| 131 | + $medium = $this->normalizeImageSrc(wp_get_attachment_image_src($id, 'medium'), $thumbnail); | |
| 132 | + $large = $this->normalizeImageSrc(wp_get_attachment_image_src($id, 'large'), $medium); | |
| 133 | 133 | |
| 134 | 134 | return (object) [ | 
| 135 | - 'alt' => trim( strip_tags( get_post_meta( $id, '_wp_attachment_image_alt', true ))), | |
| 136 | - 'caption' => wp_get_attachment_caption( $id ), | |
| 137 | - 'copyright' => trim( strip_tags( get_post_meta( $id, '_copyright', true ))), | |
| 138 | - 'thumbnail' => $this->normalizeImageSrc( $thumbnail ), | |
| 135 | + 'alt' => trim(strip_tags(get_post_meta($id, '_wp_attachment_image_alt', true))), | |
| 136 | + 'caption' => wp_get_attachment_caption($id), | |
| 137 | + 'copyright' => trim(strip_tags(get_post_meta($id, '_copyright', true))), | |
| 138 | + 'thumbnail' => $this->normalizeImageSrc($thumbnail), | |
| 139 | 139 | 'medium' => $medium, | 
| 140 | 140 | 'large' => $large, | 
| 141 | 141 | ]; | 
| @@ -144,12 +144,12 @@ discard block | ||
| 144 | 144 | /** | 
| 145 | 145 | * @return array | 
| 146 | 146 | */ | 
| 147 | - protected function getMediaIds( array $args ) | |
| 147 | + protected function getMediaIds(array $args) | |
| 148 | 148 |  	{ | 
| 149 | - $args = $this->normalizeArgs( $args ); | |
| 149 | + $args = $this->normalizeArgs($args); | |
| 150 | 150 | |
| 151 | - return wp_parse_id_list( $this->postmeta->get( $args['media'], [ | |
| 152 | - 'ID' => $this->postmeta->get( $args['gallery'] ), | |
| 151 | + return wp_parse_id_list($this->postmeta->get($args['media'], [ | |
| 152 | + 'ID' => $this->postmeta->get($args['gallery']), | |
| 153 | 153 | 'single' => false, | 
| 154 | 154 | ])); | 
| 155 | 155 | } | 
| @@ -159,19 +159,19 @@ discard block | ||
| 159 | 159 | */ | 
| 160 | 160 | protected function getPaged() | 
| 161 | 161 |  	{ | 
| 162 | - return intval( get_query_var(( is_front_page() ? 'page' : 'paged' ))) ?: 1; | |
| 162 | + return intval(get_query_var((is_front_page() ? 'page' : 'paged'))) ?: 1; | |
| 163 | 163 | } | 
| 164 | 164 | |
| 165 | 165 | /** | 
| 166 | 166 | * @return array | 
| 167 | 167 | */ | 
| 168 | - protected function normalizeArgs( array $args = [] ) | |
| 168 | + protected function normalizeArgs(array $args = []) | |
| 169 | 169 |  	{ | 
| 170 | 170 | return shortcode_atts([ | 
| 171 | 171 | 'gallery' => 'gallery', | 
| 172 | 172 | 'media' => 'media', | 
| 173 | 173 | 'per_page' => 'per_page', | 
| 174 | - ], $args ); | |
| 174 | + ], $args); | |
| 175 | 175 | } | 
| 176 | 176 | |
| 177 | 177 | /** | 
| @@ -179,9 +179,9 @@ discard block | ||
| 179 | 179 | * | 
| 180 | 180 | * @return array | 
| 181 | 181 | */ | 
| 182 | - protected function normalizeImageSrc( array $image, $fallback = false ) | |
| 182 | + protected function normalizeImageSrc(array $image, $fallback = false) | |
| 183 | 183 |  	{ | 
| 184 | -		if( is_array( $fallback ) && count( array_diff( $image, $fallback )) < 2 ) { | |
| 184 | +		if (is_array($fallback) && count(array_diff($image, $fallback)) < 2) { | |
| 185 | 185 | $image = $fallback; | 
| 186 | 186 | } | 
| 187 | 187 | return [ | 
| @@ -65,7 +65,9 @@ discard block | ||
| 65 | 65 |  	{ | 
| 66 | 66 | $image = $this->getImageSrc( $attachment->ID ); | 
| 67 | 67 | |
| 68 | - if( !$image )return; | |
| 68 | +		if( !$image ) { | |
| 69 | + return; | |
| 70 | + } | |
| 69 | 71 | |
| 70 | 72 | return sprintf( | 
| 71 | 73 | '<figure data-w="%s" data-h="%s" itemprop="associatedMedia" itemscope itemtype="http://schema.org/ImageObject">' . | 
| @@ -126,7 +128,9 @@ discard block | ||
| 126 | 128 |  	{ | 
| 127 | 129 | $thumbnail = wp_get_attachment_image_src( $id, 'thumbnail' ); | 
| 128 | 130 | |
| 129 | - if( !$thumbnail )return; | |
| 131 | +		if( !$thumbnail ) { | |
| 132 | + return; | |
| 133 | + } | |
| 130 | 134 | |
| 131 | 135 | $medium = $this->normalizeImageSrc( wp_get_attachment_image_src( $id, 'medium' ), $thumbnail ); | 
| 132 | 136 | $large = $this->normalizeImageSrc( wp_get_attachment_image_src( $id, 'large' ), $medium ); | 
| @@ -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 | } |