/**
  * Strategy pattern: Initialize the configuration.
  *
  * Change the title web page according the configuration pararmeters
  *
  * See {@link \Zend_View}
  * See {@link \Zend_View_Helper_HeadTitle}
  *
  * @param \Zend_Controller_Request_Abstract $request
  */
 public function init(\Zend_Controller_Request_Abstract $request)
 {
     $this->_headTitle = $this->_getView()->headTitle($this->_options['title'], $this->_type);
     $this->_headTitle->setSeparator($this->_separator);
     if ($this->_translate) {
         $this->_headTitle->enableTranslation();
     } else {
         $this->_headTitle->disableTranslation();
     }
 }
 public function getHeadTitle()
 {
     if ($this->_headTitle === null) {
         parent::init();
         $options = $this->getOptions();
         $this->_headTitle = $this->_getView()->headTitle($options['title'], $this->_type);
         $this->_headTitle->setSeparator($this->_separator);
         if ($this->_translate) {
             $this->_headTitle->enableTranslation();
         } else {
             $this->_headTitle->disableTranslation();
         }
     }
     return $this->_headTitle;
 }
예제 #3
0
 public function testCanPrependTitlesUsingDefaultAttachOrder()
 {
     $this->helper->setDefaultAttachOrder('PREPEND');
     $placeholder = $this->helper->direct('Foo');
     $placeholder = $this->helper->direct('Bar');
     $this->assertContains('BarFoo', $placeholder->toString());
 }
예제 #4
0
 public function testIndentationIsHonored()
 {
     $this->helper->setIndent(4);
     $this->helper->headTitle('foo');
     $string = $this->helper->toString();
     $this->assertContains('    <title>', $string);
 }
예제 #5
0
 public function testZF2918()
 {
     $this->helper->headTitle('Some Title');
     $this->helper->setPrefix('Prefix: ');
     $this->helper->setPostfix(' :Postfix');
     $this->assertEquals('<title>Prefix: Some Title :Postfix</title>', $this->helper->toString());
 }
예제 #6
0
 public function prepend($title)
 {
     if (!$this->_locked) {
         parent::prepend($title);
     }
     return $this;
 }
예제 #7
0
 public function setView(Zend_View_Interface $view)
 {
     static $first = true;
     parent::setView($view);
     if ($first && null !== ($defaultTitle = Centurion_Config_Manager::get('resources.layout.configs.headTitle.default'))) {
         $this->set($defaultTitle);
     }
     $first = false;
 }
예제 #8
0
 /**
  *  @group ZF-10284
  */
 public function testReturnTypeDefaultAttachOrder()
 {
     $this->assertTrue($this->helper->setDefaultAttachOrder('PREPEND') instanceof Helper\HeadTitle);
     $this->assertEquals('PREPEND', $this->helper->getDefaultAttachOrder());
 }
예제 #9
0
 /**
  * @see ZF-8036
  */
 public function testHeadTitleZero()
 {
     $this->helper->direct('0');
     $this->assertEquals('<title>0</title>', $this->helper->toString());
 }
예제 #10
0
$currentUser = new Zend_Session_Namespace('currentUser');
/*
 * Pull global site settings
 */
$config = new Zend_Config_Ini(CONFIG_PATH . '/settings.ini', 'production');
Zend_Registry::set('config', $config);
/*
 * Set view helpers
 */
$doctypeHelper = new Zend_View_Helper_Doctype();
$doctypeHelper->doctype('XHTML1_TRANSITIONAL');
$metaHelper = new Zend_View_Helper_HeadMeta();
$metaHelper->appendHttpEquiv('Content-Type', 'text/html; charset=UTF-8');
$metaHelper->appendHttpEquiv('pragma', 'no-cache');
$metaHelper->appendHttpEquiv('Cache-Control', 'no-cache');
$titleHelper = new Zend_View_Helper_HeadTitle();
$titleHelper->setSeparator(' - ');
$titleHelper->headTitle($config->defaults->title);
/*
 * Set up translators.
 */
$language = $currentUser->language == null ? $config->defaults->language : $currentUser->language;
$translate = new Zend_Translate('csv', LANGUAGE_PATH . '/' . $language . '.csv', $language);
Zend_Registry::set('Zend_Translate', $translate);
/*
 * Set the skin. If the skin doesn't exist then set the default skin.
 */
$skin = $currentUser->skin == null ? $config->defaults->skin : $currentUser->skin;
try {
    require_once APPLICATION_PATH . '/models/Skin.php';
    $skinTest = new Model_Skin($skin);