@@ -8,7 +8,7 @@ discard block |
||
| 8 | 8 | { |
| 9 | 9 | public $postmeta; |
| 10 | 10 | |
| 11 | - public function __construct( PostMeta $postmeta ) |
|
| 11 | + public function __construct(PostMeta $postmeta) |
|
| 12 | 12 | { |
| 13 | 13 | $this->postmeta = $postmeta; |
| 14 | 14 | } |
@@ -18,9 +18,9 @@ discard block |
||
| 18 | 18 | * |
| 19 | 19 | * @return string |
| 20 | 20 | */ |
| 21 | - public function assetPath( $asset ) |
|
| 21 | + public function assetPath($asset) |
|
| 22 | 22 | { |
| 23 | - return $this->paths( 'dir.stylesheet' ) . 'assets/' . $asset; |
|
| 23 | + return $this->paths('dir.stylesheet') . 'assets/' . $asset; |
|
| 24 | 24 | } |
| 25 | 25 | |
| 26 | 26 | /** |
@@ -28,9 +28,9 @@ discard block |
||
| 28 | 28 | * |
| 29 | 29 | * @return string |
| 30 | 30 | */ |
| 31 | - public function assetUri( $asset ) |
|
| 31 | + public function assetUri($asset) |
|
| 32 | 32 | { |
| 33 | - return $this->paths( 'uri.stylesheet' ) . 'assets/' . $asset; |
|
| 33 | + return $this->paths('uri.stylesheet') . 'assets/' . $asset; |
|
| 34 | 34 | } |
| 35 | 35 | |
| 36 | 36 | /** |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | */ |
| 39 | 39 | public function copyright() |
| 40 | 40 | { |
| 41 | - return __( 'Copyright', 'castor' ) . ' © ' . date( 'Y' ) . ', ' . get_bloginfo( 'name' ); |
|
| 41 | + return __('Copyright', 'castor') . ' © ' . date('Y') . ', ' . get_bloginfo('name'); |
|
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | /** |
@@ -52,9 +52,9 @@ discard block |
||
| 52 | 52 | is_single(), |
| 53 | 53 | ]; |
| 54 | 54 | |
| 55 | - $display = in_array( true, $conditions ); |
|
| 55 | + $display = in_array(true, $conditions); |
|
| 56 | 56 | |
| 57 | - return apply_filters( 'castor/display/sidebar', $display ); |
|
| 57 | + return apply_filters('castor/display/sidebar', $display); |
|
| 58 | 58 | } |
| 59 | 59 | |
| 60 | 60 | /** |
@@ -62,9 +62,9 @@ discard block |
||
| 62 | 62 | * |
| 63 | 63 | * @return string |
| 64 | 64 | */ |
| 65 | - public function imagePath( $asset ) |
|
| 65 | + public function imagePath($asset) |
|
| 66 | 66 | { |
| 67 | - return $this->paths( 'dir.stylesheet' ) . 'assets/img/' . $asset; |
|
| 67 | + return $this->paths('dir.stylesheet') . 'assets/img/' . $asset; |
|
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | /** |
@@ -72,16 +72,16 @@ discard block |
||
| 72 | 72 | * |
| 73 | 73 | * @return string |
| 74 | 74 | */ |
| 75 | - public function imageUri( $asset ) |
|
| 75 | + public function imageUri($asset) |
|
| 76 | 76 | { |
| 77 | - return $this->paths( 'uri.stylesheet' ) . 'assets/img/' . $asset; |
|
| 77 | + return $this->paths('uri.stylesheet') . 'assets/img/' . $asset; |
|
| 78 | 78 | } |
| 79 | 79 | |
| 80 | 80 | public function pageTitle() |
| 81 | 81 | { |
| 82 | - foreach( ['is_404', 'is_archive', 'is_home', 'is_page', 'is_search'] as $bool ) { |
|
| 83 | - if( !$bool() )continue; |
|
| 84 | - $method = sprintf( 'get%sTitle', ucfirst( str_replace( 'is_', '', $bool ))); |
|
| 82 | + foreach (['is_404', 'is_archive', 'is_home', 'is_page', 'is_search'] as $bool) { |
|
| 83 | + if (!$bool())continue; |
|
| 84 | + $method = sprintf('get%sTitle', ucfirst(str_replace('is_', '', $bool))); |
|
| 85 | 85 | return $this->$method(); |
| 86 | 86 | } |
| 87 | 87 | |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | * |
| 94 | 94 | * @return array|string |
| 95 | 95 | */ |
| 96 | - public function paths( $path = null ) |
|
| 96 | + public function paths($path = null) |
|
| 97 | 97 | { |
| 98 | 98 | $paths = [ |
| 99 | 99 | 'dir.stylesheet' => get_stylesheet_directory(), |
@@ -103,12 +103,12 @@ discard block |
||
| 103 | 103 | 'uri.template' => get_template_directory_uri(), |
| 104 | 104 | ]; |
| 105 | 105 | |
| 106 | - if( is_null( $path )) { |
|
| 106 | + if (is_null($path)) { |
|
| 107 | 107 | return $paths; |
| 108 | 108 | } |
| 109 | 109 | |
| 110 | - return array_key_exists( $path, $paths ) |
|
| 111 | - ? trailingslashit( $paths[$path] ) |
|
| 110 | + return array_key_exists($path, $paths) |
|
| 111 | + ? trailingslashit($paths[$path]) |
|
| 112 | 112 | : ''; |
| 113 | 113 | } |
| 114 | 114 | |
@@ -117,16 +117,16 @@ discard block |
||
| 117 | 117 | * |
| 118 | 118 | * @return string|null |
| 119 | 119 | */ |
| 120 | - public function svg( $path = null ) |
|
| 120 | + public function svg($path = null) |
|
| 121 | 121 | { |
| 122 | - if( $svg = file_get_contents( $this->imageUri( $path ))) { |
|
| 122 | + if ($svg = file_get_contents($this->imageUri($path))) { |
|
| 123 | 123 | return $svg; |
| 124 | 124 | } |
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | protected function get404Title() |
| 128 | 128 | { |
| 129 | - return __( 'Not Found', 'castor' ); |
|
| 129 | + return __('Not Found', 'castor'); |
|
| 130 | 130 | } |
| 131 | 131 | |
| 132 | 132 | protected function getArchiveTitle() |
@@ -136,20 +136,20 @@ discard block |
||
| 136 | 136 | |
| 137 | 137 | protected function getHomeTitle() |
| 138 | 138 | { |
| 139 | - return ( $home = get_option( 'page_for_posts', true )) |
|
| 140 | - ? get_the_title( $home ) |
|
| 141 | - : __( 'Latest Posts', 'castor' ); |
|
| 139 | + return ($home = get_option('page_for_posts', true)) |
|
| 140 | + ? get_the_title($home) |
|
| 141 | + : __('Latest Posts', 'castor'); |
|
| 142 | 142 | } |
| 143 | 143 | |
| 144 | 144 | protected function getPageTitle() |
| 145 | 145 | { |
| 146 | - return ($title = $this->postmeta->get( 'title' )) |
|
| 146 | + return ($title = $this->postmeta->get('title')) |
|
| 147 | 147 | ? $title |
| 148 | 148 | : get_the_title(); |
| 149 | 149 | } |
| 150 | 150 | |
| 151 | 151 | protected function getSearchTitle() |
| 152 | 152 | { |
| 153 | - return sprintf( __( 'Search Results for %s', 'castor' ), get_search_query() ); |
|
| 153 | + return sprintf(__('Search Results for %s', 'castor'), get_search_query()); |
|
| 154 | 154 | } |
| 155 | 155 | } |