From 22e25ed7ff4a36bc6c8f706b3f3d62c0473c6bd4 Mon Sep 17 00:00:00 2001 From: Demian Katz <demian.katz@villanova.edu> Date: Fri, 4 Jan 2013 13:36:52 -0500 Subject: [PATCH] Renamed \VuFind\Theme\Tools to \VuFind\Theme\ThemeInfo. --- module/VuFind/config/module.config.php | 4 ++-- .../VuFind/src/VuFind/Controller/CoverController.php | 2 +- module/VuFind/src/VuFind/Cover/Loader.php | 12 ++++++------ module/VuFind/src/VuFind/Theme/Initializer.php | 7 +++---- .../VuFind/src/VuFind/Theme/Root/Helper/HeadLink.php | 8 ++++---- .../src/VuFind/Theme/Root/Helper/HeadScript.php | 8 ++++---- .../src/VuFind/Theme/Root/Helper/ImageLink.php | 8 ++++---- .../src/VuFind/Theme/{Tools.php => ThemeInfo.php} | 6 +++--- 8 files changed, 27 insertions(+), 28 deletions(-) rename module/VuFind/src/VuFind/Theme/{Tools.php => ThemeInfo.php} (96%) diff --git a/module/VuFind/config/module.config.php b/module/VuFind/config/module.config.php index 221011fa212..60c3c7cb84a 100644 --- a/module/VuFind/config/module.config.php +++ b/module/VuFind/config/module.config.php @@ -480,8 +480,8 @@ $config = array( $sm->get('VuFind\Http')->createClient() ); }, - 'VuFindTheme\Tools' => function ($sm) { - return new \VuFind\Theme\Tools( + 'VuFindTheme\ThemeInfo' => function ($sm) { + return new \VuFind\Theme\ThemeInfo( realpath(__DIR__ . '/../../../themes'), 'blueprint' ); } diff --git a/module/VuFind/src/VuFind/Controller/CoverController.php b/module/VuFind/src/VuFind/Controller/CoverController.php index be9ff970d68..60508d259ac 100644 --- a/module/VuFind/src/VuFind/Controller/CoverController.php +++ b/module/VuFind/src/VuFind/Controller/CoverController.php @@ -52,7 +52,7 @@ class CoverController extends AbstractBase if (!$this->loader) { $this->loader = new Loader( ConfigReader::getConfig(), - $this->getServiceLocator()->get('VuFindTheme\Tools'), + $this->getServiceLocator()->get('VuFindTheme\ThemeInfo'), $this->getServiceLocator()->get('VuFind\Http')->createClient(), $this->getServiceLocator()->get('VuFind\CacheManager')->getCacheDir() ); diff --git a/module/VuFind/src/VuFind/Cover/Loader.php b/module/VuFind/src/VuFind/Cover/Loader.php index 54602746257..74fed7a3283 100644 --- a/module/VuFind/src/VuFind/Cover/Loader.php +++ b/module/VuFind/src/VuFind/Cover/Loader.php @@ -121,20 +121,20 @@ class Loader implements \Zend\Log\LoggerAwareInterface /** * Theme tools * - * @var \VuFind\Theme\Tools + * @var \VuFind\Theme\ThemeInfo */ protected $themeTools; /** * Constructor * - * @param \Zend\Config\Config $config VuFind configuration - * @param \VuFind\Theme\Tools $theme VuFind theme tools - * @param \Zend\Http\Client $client HTTP client - * @param string $baseDir Directory to store downloaded images + * @param \Zend\Config\Config $config VuFind configuration + * @param \VuFind\Theme\ThemeInfo $theme VuFind theme tools + * @param \Zend\Http\Client $client HTTP client + * @param string $baseDir Directory to store downloaded images * (set to system temp dir if not otherwise specified) */ - public function __construct($config, \VuFind\Theme\Tools $theme, + public function __construct($config, \VuFind\Theme\ThemeInfo $theme, \Zend\Http\Client $client, $baseDir = null ) { $this->config = $config; diff --git a/module/VuFind/src/VuFind/Theme/Initializer.php b/module/VuFind/src/VuFind/Theme/Initializer.php index 032f485508a..9688b240dae 100644 --- a/module/VuFind/src/VuFind/Theme/Initializer.php +++ b/module/VuFind/src/VuFind/Theme/Initializer.php @@ -67,7 +67,7 @@ class Initializer /** * Theme tools object * - * @var \VuFind\Theme\Tools + * @var \VuFind\Theme\ThemeInfo */ protected $tools; @@ -99,8 +99,7 @@ class Initializer $this->serviceManager = $this->event->getApplication()->getServiceManager(); // Get base directory from tools object: - $this->tools = $this->serviceManager->get('VuFindTheme\Tools'); - $this->baseDir = $this->tools->getBaseDir(); + $this->tools = $this->serviceManager->get('VuFindTheme\ThemeInfo'); } /** @@ -319,7 +318,7 @@ class Initializer } // Add template path: - $templatePathStack[] = $this->baseDir . "/$key/templates"; + $templatePathStack[] = $this->tools->getBaseDir() . "/$key/templates"; // Add CSS and JS dependencies: if (isset($currentThemeInfo['css'])) { diff --git a/module/VuFind/src/VuFind/Theme/Root/Helper/HeadLink.php b/module/VuFind/src/VuFind/Theme/Root/Helper/HeadLink.php index 1296432d861..5beeac2f1df 100644 --- a/module/VuFind/src/VuFind/Theme/Root/Helper/HeadLink.php +++ b/module/VuFind/src/VuFind/Theme/Root/Helper/HeadLink.php @@ -76,11 +76,11 @@ class HeadLink extends \Zend\View\Helper\HeadLink /** * Get the theme tools. * - * @return \VuFind\Theme\Tools + * @return \VuFind\Theme\ThemeInfo */ - public function getThemeTools() + public function getThemeInfo() { - return $this->getServiceLocator()->get('VuFindTheme\Tools'); + return $this->getServiceLocator()->get('VuFindTheme\ThemeInfo'); } /** @@ -94,7 +94,7 @@ class HeadLink extends \Zend\View\Helper\HeadLink { // Normalize href to account for themes, then call the parent class: $relPath = 'css/' . $item->href; - $currentTheme = $this->getThemeTools()->findContainingTheme($relPath); + $currentTheme = $this->getThemeInfo()->findContainingTheme($relPath); if (!empty($currentTheme)) { $urlHelper = $this->getView()->plugin('url'); diff --git a/module/VuFind/src/VuFind/Theme/Root/Helper/HeadScript.php b/module/VuFind/src/VuFind/Theme/Root/Helper/HeadScript.php index 6be44c7999c..ba7994c6468 100644 --- a/module/VuFind/src/VuFind/Theme/Root/Helper/HeadScript.php +++ b/module/VuFind/src/VuFind/Theme/Root/Helper/HeadScript.php @@ -76,11 +76,11 @@ class HeadScript extends \Zend\View\Helper\HeadScript /** * Get the theme tools. * - * @return \VuFind\Theme\Tools + * @return \VuFind\Theme\ThemeInfo */ - public function getThemeTools() + public function getThemeInfo() { - return $this->getServiceLocator()->get('VuFindTheme\Tools'); + return $this->getServiceLocator()->get('VuFindTheme\ThemeInfo'); } /** @@ -98,7 +98,7 @@ class HeadScript extends \Zend\View\Helper\HeadScript // Normalize href to account for themes: if (!empty($item->attributes['src'])) { $relPath = 'js/' . $item->attributes['src']; - $currentTheme = $this->getThemeTools()->findContainingTheme($relPath); + $currentTheme = $this->getThemeInfo()->findContainingTheme($relPath); if (!empty($currentTheme)) { $urlHelper = $this->getView()->plugin('url'); diff --git a/module/VuFind/src/VuFind/Theme/Root/Helper/ImageLink.php b/module/VuFind/src/VuFind/Theme/Root/Helper/ImageLink.php index 395b1639b25..1c05d7fa6d2 100644 --- a/module/VuFind/src/VuFind/Theme/Root/Helper/ImageLink.php +++ b/module/VuFind/src/VuFind/Theme/Root/Helper/ImageLink.php @@ -42,11 +42,11 @@ class ImageLink extends AbstractServiceLocator /** * Get the theme tools. * - * @return \VuFind\Theme\Tools + * @return \VuFind\Theme\ThemeInfo */ - public function getThemeTools() + public function getThemeInfo() { - return $this->getServiceLocator()->get('VuFindTheme\Tools'); + return $this->getServiceLocator()->get('VuFindTheme\ThemeInfo'); } /** @@ -60,7 +60,7 @@ class ImageLink extends AbstractServiceLocator { // Normalize href to account for themes: $relPath = 'images/' . $image; - $currentTheme = $this->getThemeTools()->findContainingTheme($relPath); + $currentTheme = $this->getThemeInfo()->findContainingTheme($relPath); if (is_null($currentTheme)) { return null; diff --git a/module/VuFind/src/VuFind/Theme/Tools.php b/module/VuFind/src/VuFind/Theme/ThemeInfo.php similarity index 96% rename from module/VuFind/src/VuFind/Theme/Tools.php rename to module/VuFind/src/VuFind/Theme/ThemeInfo.php index f63592b8299..aff13d6fb81 100644 --- a/module/VuFind/src/VuFind/Theme/Tools.php +++ b/module/VuFind/src/VuFind/Theme/ThemeInfo.php @@ -1,6 +1,6 @@ <?php /** - * VuFind Theme Support Methods + * Class to represent currently-selected theme and related information. * * PHP version 5 * @@ -28,7 +28,7 @@ namespace VuFind\Theme; /** - * VuFind Theme Support Methods + * Class to represent currently-selected theme and related information. * * @category VuFind2 * @package Theme @@ -36,7 +36,7 @@ namespace VuFind\Theme; * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License * @link http://vufind.org Main Site */ -class Tools +class ThemeInfo { /** * Base directory for theme files -- GitLab