equal
deleted
inserted
replaced
13 * to license@zend.com so we can send you a copy immediately. |
13 * to license@zend.com so we can send you a copy immediately. |
14 * |
14 * |
15 * @category Zend |
15 * @category Zend |
16 * @package Zend_View |
16 * @package Zend_View |
17 * @subpackage Helper |
17 * @subpackage Helper |
18 * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) |
18 * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) |
19 * @license http://framework.zend.com/license/new-bsd New BSD License |
19 * @license http://framework.zend.com/license/new-bsd New BSD License |
20 * @version $Id: HtmlElement.php 20096 2010-01-06 02:05:09Z bkarwin $ |
20 * @version $Id: HtmlElement.php 24593 2012-01-05 20:35:02Z matthew $ |
21 */ |
21 */ |
22 |
22 |
23 /** |
23 /** |
24 * @see Zend_View_Helper_Abstract |
24 * @see Zend_View_Helper_Abstract |
25 */ |
25 */ |
27 |
27 |
28 /** |
28 /** |
29 * @category Zend |
29 * @category Zend |
30 * @package Zend_View |
30 * @package Zend_View |
31 * @subpackage Helper |
31 * @subpackage Helper |
32 * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) |
32 * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) |
33 * @license http://framework.zend.com/license/new-bsd New BSD License |
33 * @license http://framework.zend.com/license/new-bsd New BSD License |
34 */ |
34 */ |
35 abstract class Zend_View_Helper_HtmlElement extends Zend_View_Helper_Abstract |
35 abstract class Zend_View_Helper_HtmlElement extends Zend_View_Helper_Abstract |
36 { |
36 { |
37 /** |
37 /** |
74 $doctype = $this->view->doctype(); |
74 $doctype = $this->view->doctype(); |
75 return $doctype->isXhtml(); |
75 return $doctype->isXhtml(); |
76 } |
76 } |
77 |
77 |
78 /** |
78 /** |
|
79 * Is doctype strict? |
|
80 * |
|
81 * @return boolean |
|
82 */ |
|
83 protected function _isStrictDoctype() |
|
84 { |
|
85 $doctype = $this->view->doctype(); |
|
86 return $doctype->isStrict(); |
|
87 } |
|
88 |
|
89 /** |
79 * Converts an associative array to a string of tag attributes. |
90 * Converts an associative array to a string of tag attributes. |
80 * |
91 * |
81 * @access public |
92 * @access public |
82 * |
93 * |
83 * @param array $attribs From this array, each key-value pair is |
94 * @param array $attribs From this array, each key-value pair is |
96 if (!is_scalar($val)) { |
107 if (!is_scalar($val)) { |
97 // non-scalar data should be cast to JSON first |
108 // non-scalar data should be cast to JSON first |
98 require_once 'Zend/Json.php'; |
109 require_once 'Zend/Json.php'; |
99 $val = Zend_Json::encode($val); |
110 $val = Zend_Json::encode($val); |
100 } |
111 } |
101 $val = preg_replace('/"([^"]*)":/', '$1:', $val); |
112 // Escape single quotes inside event attribute values. |
|
113 // This will create html, where the attribute value has |
|
114 // single quotes around it, and escaped single quotes or |
|
115 // non-escaped double quotes inside of it |
|
116 $val = str_replace('\'', ''', $val); |
102 } else { |
117 } else { |
103 if (is_array($val)) { |
118 if (is_array($val)) { |
104 $val = implode(' ', $val); |
119 $val = implode(' ', $val); |
105 } |
120 } |
106 $val = $this->view->escape($val); |
121 $val = $this->view->escape($val); |