diff --git a/library/Zend/View/Helper/HeadMeta.php b/library/Zend/View/Helper/HeadMeta.php index ed0e1f4f99a..f433a17e6a4 100644 --- a/library/Zend/View/Helper/HeadMeta.php +++ b/library/Zend/View/Helper/HeadMeta.php @@ -3,8 +3,9 @@ * Zend Framework (http://framework.zend.com/) * * @link http://github.com/zendframework/zf2 for the canonical source repository - * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License + * @package Zend_View */ namespace Zend\View\Helper; @@ -17,6 +18,8 @@ * Zend_Layout_View_Helper_HeadMeta * * @see http://www.w3.org/TR/xhtml1/dtds.html + * @package Zend_View + * @subpackage Helper */ class HeadMeta extends Placeholder\Container\AbstractStandalone { @@ -24,7 +27,7 @@ class HeadMeta extends Placeholder\Container\AbstractStandalone * Types of attributes * @var array */ - protected $typeKeys = array('name', 'http-equiv', 'charset', 'property'); + protected $typeKeys = array('name', 'http-equiv', 'charset', 'property', 'itemprop'); protected $requiredKeys = array('content'); protected $modifierKeys = array('lang', 'scheme'); @@ -91,6 +94,8 @@ protected function normalizeType($type) return 'http-equiv'; case 'Property': return 'property'; + case 'Itemprop': + return 'itemprop'; default: throw new Exception\DomainException(sprintf( 'Invalid type "%s" passed to normalizeType', @@ -123,7 +128,7 @@ protected function normalizeType($type) */ public function __call($method, $args) { - if (preg_match('/^(?Pset|(pre|ap)pend|offsetSet)(?PName|HttpEquiv|Property)$/', $method, $matches)) { + if (preg_match('/^(?Pset|(pre|ap)pend|offsetSet)(?PName|HttpEquiv|Property|Itemprop)$/', $method, $matches)) { $action = $matches['action']; $type = $this->normalizeType($matches['type']); $argc = count($args); @@ -182,7 +187,7 @@ public function setCharset($charset) * Determine if item is valid * * @param mixed $item - * @return bool + * @return boolean */ protected function isValid($item) { @@ -198,6 +203,13 @@ protected function isValid($item) || (! $this->view->plugin('doctype')->isHtml5() && $item->type !== 'charset'))) { return false; } + + // is only supported with doctype html + if (! $this->view->plugin('doctype')->isHtml5() + && $item->type === 'itemprop'){ + + return false; + } // is only supported with doctype RDFa if (!$this->view->plugin('doctype')->isRdfa() diff --git a/tests/ZendTest/View/Helper/HeadMetaTest.php b/tests/ZendTest/View/Helper/HeadMetaTest.php index ecbdd2337d8..18f3357b127 100644 --- a/tests/ZendTest/View/Helper/HeadMetaTest.php +++ b/tests/ZendTest/View/Helper/HeadMetaTest.php @@ -3,7 +3,7 @@ * Zend Framework (http://framework.zend.com/) * * @link http://github.com/zendframework/zf2 for the canonical source repository - * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @package Zend_View */