function _initPlaceHolders(&$options) { if (!empty($options['docType'])) { $helper = new Zend_View_Helper_Doctype(); $helper->doctype($options['docType']); } if (!empty($options['css'])) { $helper = new Zend_View_Helper_HeadLink(); if (is_array($options['css'])) { foreach ($options['css'] as $css) { $helper->appendStylesheet($css); } } else { $helper->appendStylesheet($options['css']); } } if (!empty($options['headMeta'])) { $meta = $options['headMeta']; $helper = new Zend_View_Helper_HeadMeta(); if (!empty($meta['http-equiv'])) { $equiv = $meta['http-equiv']; foreach ($equiv as $key => $value) { $helper->appendHttpEquiv($key, $value); } } } }
/** * Create the meta tag with the specified value and definitions atributes * * @param string $metaValue * @param array $metaDef * @return stdCalss With the meta tag */ public function createMetaTag($metaValue, array $metaDef) { if (!isset($metaDef['content'])) { $metaDef['content'] = null; } if (!isset($metaDef['modifiers'])) { $metaDef['modifiers'] = array(); } return $this->_headMeta->createData($metaDef['type'], $metaValue, $metaDef['content'], $metaDef['modifiers']); }
public function prependtName($keyValue, $content, $modifiers = array()) { if (!$this->_locked) { parent::prependName($keyValue, $content, $modifiers); } return $this; }
/** * @group ZF-11835 */ public function testConditional() { $html = $this->helper->appendHttpEquiv('foo', 'bar', array('conditional' => 'lt IE 7'))->toString(); $this->assertRegExp("|^<!--\[if lt IE 7\]>|", $html); $this->assertRegExp("|<!\[endif\]-->$|", $html); }
/** * @param null $indent * @return string */ public function toString($indent = null) { $metaString = parent::toString($indent); // add raw items $separator = $this->_escape($this->getSeparator()) . $indent; $metaString .= $separator . implode($separator, $this->rawItems); return $metaString; }
public function testStringRepresentationReflectsDoctype() { $this->view->doctype('HTML4_STRICT'); $this->helper->headMeta('some content', 'foo'); $test = $this->helper->toString(); $this->assertNotContains('/>', $test); $this->assertContains('some content', $test); $this->assertContains('foo', $test); }
/** * @issue ZF-5435 */ public function testContainerMaintainsCorrectOrderOfItems() { $this->helper->offsetSetName(1, 'keywords', 'foo'); $this->helper->offsetSetName(10, 'description', 'foo'); $this->helper->offsetSetHttpEquiv(20, 'pragma', 'baz'); $this->helper->offsetSetHttpEquiv(5, 'Cache-control', 'baz'); $test = $this->helper->toString(); $expected = '<meta name="keywords" content="foo" />' . PHP_EOL . '<meta http-equiv="Cache-control" content="baz" />' . PHP_EOL . '<meta name="description" content="foo" />' . PHP_EOL . '<meta http-equiv="pragma" content="baz" />'; $this->assertEquals($expected, $test); }
public function testIndentationIsHonored() { $this->helper->setIndent(4); $this->helper->appendName('keywords', 'foo bar'); $this->helper->appendName('seo', 'baz bat'); $string = $this->helper->toString(); $scripts = substr_count($string, ' <meta name='); $this->assertEquals(2, $scripts); }
/** * @group ZF-11910 */ public function testStandaloneInstantiationWithoutViewDoesNotCauseFatalError() { $expected = '<meta name="foo" content="bar" />'; $helper = new Zend_View_Helper_HeadMeta(); $result = (string) $helper->headMeta()->appendName('foo', 'bar'); $this->assertEquals($expected, $result); }
/** * @group GH-515 */ public function testConditionalNoIEWidthSpace() { $html = $this->helper->appendHttpEquiv('foo', 'bar', array('conditional' => '! IE'))->toString(); $this->assertContains('<!--[if ! IE]><!--><', $html); $this->assertContains('<!--<![endif]-->', $html); }
/* * Let's fire 'er up! */ Zend_Session::start(); $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. */