diff --git a/module/VuFind/config/module.config.php b/module/VuFind/config/module.config.php index 221011fa212f2d0a7d8da9ed247b347fbbdba159..60c3c7cb84a4b562acae677357985abb653cc7be 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 be9ff970d686d21bd7cbbea8cdec73f7981095de..60508d259ac92c76ad312a2a6fca9aa18b18a9eb 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 54602746257c597f1c887a09f3087c809529d467..74fed7a328388ed60f620ae50a1e5f99911632ec 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 032f485508a1630cba3c3b94a535d809116f038a..9688b240dae87dc7a62bf67d98156a2c9cd4b87a 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 1296432d8618706d1d0f5225b85df549c7ed2817..5beeac2f1dff3f2a9fd5183c7948ccc2ebdcd81a 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 6be44c7999c37ee3e5810a29a0cec823c34cd1f0..ba7994c6468c9a93f5c6f104bf4dc10b5e233961 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 395b1639b257dc3fb7ad144dbc0e3c9a2e727477..1c05d7fa6d2797ef8e9649d96f191d15528747af 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 f63592b8299f3d79cb361134bb624dff371c446f..aff13d6fb81923448a478cb21fee89b55aa7777f 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