From b491f76974fc983687e02c8c392c58bc84c87b5d Mon Sep 17 00:00:00 2001 From: QWp6t Date: Tue, 29 Dec 2015 17:41:21 -0800 Subject: [PATCH] All function braces need to be on new line --- functions.php | 6 +++--- phpcs.xml | 15 ++++++++++++--- src/helpers.php | 15 ++++++++++----- src/lib/Sage/Asset.php | 9 ++++++--- 4 files changed, 31 insertions(+), 14 deletions(-) diff --git a/functions.php b/functions.php index 730c84af28..f8eecbb53d 100644 --- a/functions.php +++ b/functions.php @@ -16,11 +16,11 @@ * themes/sage/index.php also contains some self-correcting code, just in case the template option gets reset */ add_filter('stylesheet', function ($stylesheet) { - return dirname($stylesheet); + return dirname($stylesheet); }); add_action('after_switch_theme', function () { - $stylesheet = get_option('stylesheet'); - basename($stylesheet) == 'templates' || update_option('stylesheet', $stylesheet . '/templates'); + $stylesheet = get_option('stylesheet'); + basename($stylesheet) == 'templates' || update_option('stylesheet', $stylesheet . '/templates'); }); /** diff --git a/phpcs.xml b/phpcs.xml index d23b8193ad..4b4b390097 100644 --- a/phpcs.xml +++ b/phpcs.xml @@ -15,9 +15,18 @@ - - - + + + + + + + templates + + + + + templates diff --git a/src/helpers.php b/src/helpers.php index 5b21de4cf9..d4dd53fed5 100644 --- a/src/helpers.php +++ b/src/helpers.php @@ -12,7 +12,8 @@ * @throws \Exception * @SuppressWarnings(PHPMD.StaticAccess) This is a helper function, so we can suppress this warning */ -function template_wrap(WrapperInterface $wrapper, $slug = 'base') { +function template_wrap(WrapperInterface $wrapper, $slug = 'base') +{ WrapperCollection::add($wrapper, $slug); return $wrapper->getWrapper(); } @@ -21,7 +22,8 @@ function template_wrap(WrapperInterface $wrapper, $slug = 'base') { * @param string $slug * @return string */ -function template_unwrap($slug = 'base') { +function template_unwrap($slug = 'base') +{ return WrapperCollection::get($slug)->getTemplate(); } @@ -29,7 +31,8 @@ function template_unwrap($slug = 'base') { * @param $filename * @return string */ -function asset_path($filename) { +function asset_path($filename) +{ static $manifest; isset($manifest) || $manifest = new JsonManifest(get_template_directory() . '/' . Asset::$dist . '/assets.json'); return (string) new Asset($filename, $manifest); @@ -39,7 +42,8 @@ function asset_path($filename) { * Determine whether to show the sidebar * @return bool */ -function display_sidebar() { +function display_sidebar() +{ static $display; isset($display) || $display = apply_filters('sage/display_sidebar', true); return $display; @@ -49,7 +53,8 @@ function display_sidebar() { * Page titles * @return string */ -function title() { +function title() +{ if (is_home()) { if ($home = get_option('page_for_posts', true)) { return get_the_title($home); diff --git a/src/lib/Sage/Asset.php b/src/lib/Sage/Asset.php index 8fe70d718c..143fd7ea44 100644 --- a/src/lib/Sage/Asset.php +++ b/src/lib/Sage/Asset.php @@ -18,17 +18,20 @@ class Asset protected $dir; - public function __construct($file, ManifestInterface $manifest = null) { + public function __construct($file, ManifestInterface $manifest = null) + { $this->manifest = $manifest; $this->asset = basename($file); $this->dir = dirname($file) != '.' ? dirname($file) : ''; } - public function __toString() { + public function __toString() + { return $this->getUri(); } - public function getUri() { + public function getUri() + { $file = ($this->manifest ? $this->manifest->get($this->asset) : $this->asset); return get_template_directory_uri() . self::$dist . '/' . $this->dir . '/' . $file; }