|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* THead class file |
|
4
|
|
|
* |
|
5
|
|
|
* @author Marcus Nyeholt <[email protected]> and Qiang Xue <[email protected]> |
|
6
|
|
|
* @link https://github.com/pradosoft/prado |
|
7
|
|
|
* @copyright Copyright © 2005-2016 The PRADO Group |
|
8
|
|
|
* @license https://github.com/pradosoft/prado/blob/master/LICENSE |
|
9
|
|
|
* @package Prado\Web\UI\WebControls |
|
10
|
|
|
*/ |
|
11
|
|
|
|
|
12
|
|
|
namespace Prado\Web\UI\WebControls; |
|
13
|
|
|
|
|
14
|
|
|
/** |
|
15
|
|
|
* TMetaTag class. |
|
16
|
|
|
* |
|
17
|
|
|
* TMetaTag represents a meta tag appearing in a page head section. |
|
18
|
|
|
* You can set its {@link setID ID}, {@link setHttpEquiv HttpEquiv}, |
|
19
|
|
|
* {@link setName Name}, {@link setContent Content}, {@link setScheme Scheme}, {@link setCharset Charset} |
|
20
|
|
|
* properties, which correspond to |
|
21
|
|
|
* id, http-equiv, name, content, scheme and charset * attributes for a meta tag, respectively. |
|
22
|
|
|
* |
|
23
|
|
|
* @author Qiang Xue <[email protected]> |
|
24
|
|
|
* @package Prado\Web\UI\WebControls |
|
25
|
|
|
* @since 3.0 |
|
26
|
|
|
*/ |
|
27
|
|
|
class TMetaTag extends \Prado\TComponent |
|
28
|
|
|
{ |
|
29
|
|
|
/** |
|
30
|
|
|
* @var string id of the meta tag |
|
31
|
|
|
*/ |
|
32
|
|
|
private $_id=''; |
|
33
|
|
|
/** |
|
34
|
|
|
* @var string http-equiv attribute of the meta tag |
|
35
|
|
|
*/ |
|
36
|
|
|
private $_httpEquiv=''; |
|
37
|
|
|
/** |
|
38
|
|
|
* @var string name attribute of the meta tag |
|
39
|
|
|
*/ |
|
40
|
|
|
private $_name=''; |
|
41
|
|
|
/** |
|
42
|
|
|
* @var string content attribute of the meta tag |
|
43
|
|
|
*/ |
|
44
|
|
|
private $_content=''; |
|
45
|
|
|
/** |
|
46
|
|
|
* @var string scheme attribute of the meta tag |
|
47
|
|
|
*/ |
|
48
|
|
|
private $_scheme=''; |
|
49
|
|
|
/** |
|
50
|
|
|
* @var string charset attribute of the meta tag |
|
51
|
|
|
*/ |
|
52
|
|
|
private $_charset=''; |
|
53
|
|
|
|
|
54
|
|
|
/** |
|
55
|
|
|
* @return string id of the meta tag |
|
56
|
|
|
*/ |
|
57
|
|
|
public function getID() |
|
58
|
|
|
{ |
|
59
|
|
|
return $this->_id; |
|
60
|
|
|
} |
|
61
|
|
|
|
|
62
|
|
|
/** |
|
63
|
|
|
* @param string id of the meta tag |
|
64
|
|
|
*/ |
|
65
|
|
|
public function setID($value) |
|
66
|
|
|
{ |
|
67
|
|
|
$this->_id=$value; |
|
68
|
|
|
} |
|
69
|
|
|
|
|
70
|
|
|
/** |
|
71
|
|
|
* @return string http-equiv attribute of the meta tag |
|
72
|
|
|
*/ |
|
73
|
|
|
public function getHttpEquiv() |
|
74
|
|
|
{ |
|
75
|
|
|
return $this->_httpEquiv; |
|
76
|
|
|
} |
|
77
|
|
|
|
|
78
|
|
|
/** |
|
79
|
|
|
* @param string http-equiv attribute of the meta tag |
|
80
|
|
|
*/ |
|
81
|
|
|
public function setHttpEquiv($value) |
|
82
|
|
|
{ |
|
83
|
|
|
$this->_httpEquiv=$value; |
|
84
|
|
|
} |
|
85
|
|
|
|
|
86
|
|
|
/** |
|
87
|
|
|
* @return string name attribute of the meta tag |
|
88
|
|
|
*/ |
|
89
|
|
|
public function getName() |
|
90
|
|
|
{ |
|
91
|
|
|
return $this->_name; |
|
92
|
|
|
} |
|
93
|
|
|
|
|
94
|
|
|
/** |
|
95
|
|
|
* @param string name attribute of the meta tag |
|
96
|
|
|
*/ |
|
97
|
|
|
public function setName($value) |
|
98
|
|
|
{ |
|
99
|
|
|
$this->_name=$value; |
|
100
|
|
|
} |
|
101
|
|
|
|
|
102
|
|
|
/** |
|
103
|
|
|
* @return string content attribute of the meta tag |
|
104
|
|
|
*/ |
|
105
|
|
|
public function getContent() |
|
106
|
|
|
{ |
|
107
|
|
|
return $this->_content; |
|
108
|
|
|
} |
|
109
|
|
|
|
|
110
|
|
|
/** |
|
111
|
|
|
* @param string content attribute of the meta tag |
|
112
|
|
|
*/ |
|
113
|
|
|
public function setContent($value) |
|
114
|
|
|
{ |
|
115
|
|
|
$this->_content=$value; |
|
116
|
|
|
} |
|
117
|
|
|
|
|
118
|
|
|
/** |
|
119
|
|
|
* @return string scheme attribute of the meta tag |
|
120
|
|
|
*/ |
|
121
|
|
|
public function getScheme() |
|
122
|
|
|
{ |
|
123
|
|
|
return $this->_scheme; |
|
124
|
|
|
} |
|
125
|
|
|
|
|
126
|
|
|
/** |
|
127
|
|
|
* @param string scheme attribute of the meta tag |
|
128
|
|
|
*/ |
|
129
|
|
|
public function setScheme($value) |
|
130
|
|
|
{ |
|
131
|
|
|
$this->_scheme=$value; |
|
132
|
|
|
} |
|
133
|
|
|
|
|
134
|
|
|
/** |
|
135
|
|
|
* @return string charset attribute of the meta tag |
|
136
|
|
|
*/ |
|
137
|
|
|
public function getCharset() |
|
138
|
|
|
{ |
|
139
|
|
|
return $this->_charset; |
|
140
|
|
|
} |
|
141
|
|
|
|
|
142
|
|
|
/** |
|
143
|
|
|
* @param string charset attribute of the meta tag |
|
144
|
|
|
*/ |
|
145
|
|
|
public function setCharset($value) |
|
146
|
|
|
{ |
|
147
|
|
|
$this->_charset=$value; |
|
148
|
|
|
} |
|
149
|
|
|
|
|
150
|
|
|
/** |
|
151
|
|
|
* Renders the meta tag. |
|
152
|
|
|
* @param THtmlWriter writer for the rendering purpose |
|
153
|
|
|
*/ |
|
154
|
|
|
public function render($writer) |
|
155
|
|
|
{ |
|
156
|
|
|
if($this->_id!=='') |
|
157
|
|
|
$writer->addAttribute('id',$this->_id); |
|
158
|
|
|
if($this->_name!=='') |
|
159
|
|
|
$writer->addAttribute('name',$this->_name); |
|
160
|
|
|
if($this->_httpEquiv!=='') |
|
161
|
|
|
$writer->addAttribute('http-equiv',$this->_httpEquiv); |
|
162
|
|
|
if($this->_scheme!=='') |
|
163
|
|
|
$writer->addAttribute('scheme',$this->_scheme); |
|
164
|
|
|
if($this->_charset!=='') |
|
165
|
|
|
$writer->addAttribute('charset',$this->_charset); |
|
166
|
|
|
if ($this->_charset === '') |
|
167
|
|
|
$writer->addAttribute('content',$this->_content); |
|
168
|
|
|
$writer->renderBeginTag('meta'); |
|
169
|
|
|
$writer->renderEndTag(); |
|
170
|
|
|
} |
|
171
|
|
|
} |
|
172
|
|
|
|