示例#1
0
 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);
             }
         }
     }
 }
示例#2
0
 public function appendStylesheet($item)
 {
     if (!preg_match('/^http/i', $item)) {
         $item .= '?v=' . $this->_appversion;
     }
     parent::appendStylesheet($item);
 }
示例#3
0
    public function testIndentationIsHonored()
    {
        $this->helper->setIndent(4);
        $this->helper->appendStylesheet('/css/screen.css');
        $this->helper->appendStylesheet('/css/rules.css');
        $string = $this->helper->toString();

        $scripts = substr_count($string, '    <link ');
        $this->assertEquals(2, $scripts);
    }
示例#4
0
 public function testSetStylesheetWithMediaAsArray()
 {
     $this->helper->appendStylesheet('/bar/baz', array('screen', 'print'));
     $test = $this->helper->toString();
     $this->assertContains(' media="screen,print"', $test);
 }
示例#5
0
 /**
  * @group ZF-11811
  */
 public function testHeadLinkAllowsOverrideOfRelAttribute()
 {
     $this->helper->appendStylesheet('/css/auth.less', 'all', null, array('rel' => 'stylesheet/less'));
     $this->assertEquals(1, substr_count($this->helper->toString(), "rel=\""));
     $this->assertContains('rel="stylesheet/less"', $this->helper->toString());
 }
示例#6
0
 /**
  * @issue ZF-10345
  */
 public function testIdAttributeIsSupported()
 {
     $this->helper->appendStylesheet(array('href' => '/bar/baz', 'id' => 'foo'));
     $this->assertContains('id="foo"', $this->helper->toString());
 }
示例#7
0
 public function testDoesNotAllowDuplicateStylesheets()
 {
     $this->helper->appendStylesheet('foo');
     $this->helper->appendStylesheet('foo');
     $this->assertEquals(1, count($this->helper), var_export($this->helper->getContainer()->getArrayCopy(), 1));
 }
示例#8
0
 /**
  * test for ZF-2889
  */
 public function testBooleanStylesheet()
 {
     $this->helper->appendStylesheet(array('href' => '/bar/baz', 'conditionalStylesheet' => false));
     $test = $this->helper->toString();
     $this->assertNotContains('[if false]', $test);
 }