diff --git a/library/Unl/Application.php b/library/Unl/Application.php new file mode 100644 index 0000000000000000000000000000000000000000..758bbd68dd99f2f25d141ef3a6d957d98ed8ae16 --- /dev/null +++ b/library/Unl/Application.php @@ -0,0 +1,50 @@ +<?php + +/** + * Currently a helper class for accessing the Zend_Application instance. + * @author tsteiner + */ +class Unl_Application +{ + /** + * Attempts to return the current application's configuration. + * If we're not running as a Zend_Application an empty array is returned. + * + * @return array + */ + static public function getOptions() + { + $application = self::getInstance(); + if (!$application) { + return array(); + } + + return $application->getOptions(); + } + + /** + * Attempts to return the current Zend_Application instance. + * If we're not running as a Zend_Application, NULL is returned. + * + * @return Zend_Application + */ + static public function getInstance() + { + if (!class_exists('Zend_Controller_Front')) { + return NULL; + } + + $bootstrap = Zend_Controller_Front::getInstance()->getParam('bootstrap'); + if (!$bootstrap instanceof Zend_Application_Bootstrap_BootstrapAbstract) { + return NULL; + } + + $application = $bootstrap->getApplication(); + + if (!$application instanceof Zend_Application) { + return NULL; + } + + return $application; + } +} diff --git a/library/Unl/View/Helper/WdnTemplate.php b/library/Unl/View/Helper/WdnTemplate.php index 6f6fb3b4522da5df4ffad253b2a42e1796a242d2..05c25bd2a2929e4729bc08bc3236923e639e165a 100644 --- a/library/Unl/View/Helper/WdnTemplate.php +++ b/library/Unl/View/Helper/WdnTemplate.php @@ -57,6 +57,12 @@ class Unl_View_Helper_WdnTemplate extends Zend_View_Helper_Abstract require_once 'UNL/Templates.php'; Unl_Templates::$options['version'] = UNL_Templates::VERSION3; + + $config = Unl_Application::getOptions(); + if (isset($config['unl']['templates']['options']) && is_array($config['unl']['templates']['options'])) { + UNL_Templates::$options = array_merge(UNL_Templates::$options, $config['unl']['templates']['options']); + } + $template = UNL_Templates::factory($layout->template, array('sharedcodepath' => 'sharedcode')); $template->titlegraphic = '<h1>' . $layout->siteTitle . '</h1>';