1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Charcoal\Cms; |
4
|
|
|
|
5
|
|
|
use \Charcoal\Translation\TranslationString; |
6
|
|
|
|
7
|
|
|
/** |
8
|
|
|
* |
9
|
|
|
*/ |
10
|
|
|
trait MetatagTrait |
11
|
|
|
{ |
12
|
|
|
/** |
13
|
|
|
* @var TranslationString $metaTitle |
14
|
|
|
*/ |
15
|
|
|
private $metaTitle; |
16
|
|
|
/** |
17
|
|
|
* @var TranslationString $metaDescription |
18
|
|
|
*/ |
19
|
|
|
private $metaDescription; |
20
|
|
|
/** |
21
|
|
|
* @var TranslationString $metaImage |
22
|
|
|
*/ |
23
|
|
|
private $metaImage; |
24
|
|
|
/** |
25
|
|
|
* @var TranslationString $metaAuthor |
26
|
|
|
*/ |
27
|
|
|
private $metaAuthor; |
28
|
|
|
|
29
|
|
|
/** |
30
|
|
|
* @var string $facebookAppId |
31
|
|
|
*/ |
32
|
|
|
private $facebookAppId; |
33
|
|
|
|
34
|
|
|
/** |
35
|
|
|
* @var TranslationString $opengraphTitle |
36
|
|
|
*/ |
37
|
|
|
private $opengraphTitle; |
38
|
|
|
|
39
|
|
|
/** |
40
|
|
|
* @var TranslationString $siteName |
41
|
|
|
*/ |
42
|
|
|
private $opengraphSiteName; |
43
|
|
|
private $opengraphDescription; |
44
|
|
|
private $opengraphType; |
45
|
|
|
private $opengraphImage; |
46
|
|
|
private $opengraphAuthor; |
47
|
|
|
private $opengraphPublisher; |
48
|
|
|
|
49
|
|
|
|
50
|
|
|
/** |
51
|
|
|
* @return string |
52
|
|
|
*/ |
53
|
|
|
abstract public function canonicalUrl(); |
54
|
|
|
|
55
|
|
|
/** |
56
|
|
|
* @param mixed $title |
57
|
|
|
* @return MetatagInterface Chainable |
58
|
|
|
*/ |
59
|
|
|
public function setMetaTitle($title) |
60
|
|
|
{ |
61
|
|
|
$this->metaTitle = new TranslationString($title); |
62
|
|
|
return $this; |
63
|
|
|
} |
64
|
|
|
|
65
|
|
|
/** |
66
|
|
|
* @return TranslationString |
67
|
|
|
*/ |
68
|
|
|
public function metaTitle() |
69
|
|
|
{ |
70
|
|
|
return $this->metaTitle(); |
71
|
|
|
} |
72
|
|
|
|
73
|
|
|
/** |
74
|
|
|
* @param mixed $description |
75
|
|
|
* @return MetatagInterface Chainable |
76
|
|
|
*/ |
77
|
|
|
public function setMetaDescription($description) |
78
|
|
|
{ |
79
|
|
|
$this->metaDescription = new TranslationString($description); |
80
|
|
|
return $this; |
81
|
|
|
} |
82
|
|
|
|
83
|
|
|
/** |
84
|
|
|
* @return TranslationString |
85
|
|
|
*/ |
86
|
|
|
public function metaDescription() |
87
|
|
|
{ |
88
|
|
|
return $this->metaDescription(); |
89
|
|
|
} |
90
|
|
|
|
91
|
|
|
/** |
92
|
|
|
* @param mixed $image |
93
|
|
|
* @return MetatagInterface Chainable |
94
|
|
|
*/ |
95
|
|
|
public function setMetaImage($image) |
96
|
|
|
{ |
97
|
|
|
$this->metaImage = new TranslationString($image); |
98
|
|
|
return $this; |
99
|
|
|
} |
100
|
|
|
|
101
|
|
|
/** |
102
|
|
|
* @return TranslationString |
103
|
|
|
*/ |
104
|
|
|
public function metaImage() |
105
|
|
|
{ |
106
|
|
|
return $this->metaImage(); |
107
|
|
|
} |
108
|
|
|
|
109
|
|
|
/** |
110
|
|
|
* @param mixed $author |
111
|
|
|
* @return MetatagInterface Chainable |
112
|
|
|
*/ |
113
|
|
|
public function setMetaAuthor($author) |
114
|
|
|
{ |
115
|
|
|
$this->metaAuthor = new TranslationString($author); |
116
|
|
|
return $this; |
117
|
|
|
} |
118
|
|
|
|
119
|
|
|
/** |
120
|
|
|
* @return TranslationString |
121
|
|
|
*/ |
122
|
|
|
public function metaAuthor() |
123
|
|
|
{ |
124
|
|
|
return $this->metaAuthor(); |
125
|
|
|
} |
126
|
|
|
|
127
|
|
|
/** |
128
|
|
|
* @return string |
129
|
|
|
*/ |
130
|
|
|
public function metaTags() |
131
|
|
|
{ |
132
|
|
|
$tags = ''; |
133
|
|
|
return $tags; |
134
|
|
|
} |
135
|
|
|
|
136
|
|
|
/** |
137
|
|
|
* @param string $appId The facebook App ID (numeric string) |
138
|
|
|
* @return MetatagInterface Chainable |
139
|
|
|
*/ |
140
|
|
|
public function setFacebookAppId($appId) |
141
|
|
|
{ |
142
|
|
|
$this->facebookAppId = $appId; |
143
|
|
|
return $this; |
144
|
|
|
} |
145
|
|
|
|
146
|
|
|
/** |
147
|
|
|
* @return string |
148
|
|
|
*/ |
149
|
|
|
public function facebookAppId() |
150
|
|
|
{ |
151
|
|
|
return $this->facebookAppId; |
152
|
|
|
} |
153
|
|
|
|
154
|
|
|
/** |
155
|
|
|
* @param mixed $title |
156
|
|
|
* @return MetatagInterface Chainable |
157
|
|
|
*/ |
158
|
|
|
public function setOpengraphTitle($title) |
159
|
|
|
{ |
160
|
|
|
$this->opengraphTitle = new TranslationString($title); |
161
|
|
|
return $this; |
162
|
|
|
} |
163
|
|
|
|
164
|
|
|
/** |
165
|
|
|
* @return TranslationString |
166
|
|
|
*/ |
167
|
|
|
public function opengraphTitle() |
168
|
|
|
{ |
169
|
|
|
return $this->opengraphTitle; |
170
|
|
|
} |
171
|
|
|
|
172
|
|
|
/** |
173
|
|
|
* @param mixed $siteName |
174
|
|
|
* @return MetatagInterface Chainable |
175
|
|
|
*/ |
176
|
|
|
public function setOpengraphSiteName($siteName) |
177
|
|
|
{ |
178
|
|
|
$this->opengraphSiteName = new TranslationString($siteName); |
179
|
|
|
return $this; |
180
|
|
|
} |
181
|
|
|
|
182
|
|
|
/** |
183
|
|
|
* @return TranslationString |
184
|
|
|
*/ |
185
|
|
|
public function opengraphSiteName() |
186
|
|
|
{ |
187
|
|
|
return $this->opengraphSiteName; |
188
|
|
|
} |
189
|
|
|
|
190
|
|
|
/** |
191
|
|
|
* @param mixed $description |
192
|
|
|
* @return MetatagInterface Chainable |
193
|
|
|
*/ |
194
|
|
|
public function setOpengraphDescription($description) |
195
|
|
|
{ |
196
|
|
|
$this->opengraphDescription = new TranslationString($description); |
197
|
|
|
} |
198
|
|
|
|
199
|
|
|
/** |
200
|
|
|
* @return TranslationString |
201
|
|
|
*/ |
202
|
|
|
public function opengraphDescription() |
203
|
|
|
{ |
204
|
|
|
return $this->opengraphDescription; |
205
|
|
|
} |
206
|
|
|
|
207
|
|
|
public function setOpengraphType($type) |
208
|
|
|
{ |
209
|
|
|
$this->opengraphType = $type; |
210
|
|
|
return $this; |
211
|
|
|
} |
212
|
|
|
|
213
|
|
|
public function opengraphType() |
214
|
|
|
{ |
215
|
|
|
return $this->opengraphType; |
216
|
|
|
} |
217
|
|
|
|
218
|
|
|
public function setOpengraphImage($image) |
219
|
|
|
{ |
220
|
|
|
$this->opengraphImage = $image; |
221
|
|
|
return $this; |
222
|
|
|
} |
223
|
|
|
|
224
|
|
|
public function opengraphImage() |
225
|
|
|
{ |
226
|
|
|
return $this->opengraphImage; |
227
|
|
|
} |
228
|
|
|
|
229
|
|
|
public function setOpengraphAuthor($author) |
230
|
|
|
{ |
231
|
|
|
$this->opengraphAuthor = $author; |
232
|
|
|
return $this; |
233
|
|
|
} |
234
|
|
|
|
235
|
|
|
public function opengraphAuthor() |
236
|
|
|
{ |
237
|
|
|
return $this->opengraphAuthor; |
238
|
|
|
} |
239
|
|
|
|
240
|
|
|
public function setOpengraphPulisher($publisher) |
241
|
|
|
{ |
242
|
|
|
$this->opengraphPublisher = $publisher; |
243
|
|
|
return $this; |
244
|
|
|
} |
245
|
|
|
|
246
|
|
|
public function opengraphPublisher() |
247
|
|
|
{ |
248
|
|
|
return $this->opengraphPublisher; |
249
|
|
|
} |
250
|
|
|
|
251
|
|
|
/** |
252
|
|
|
* @return string |
253
|
|
|
*/ |
254
|
|
|
public function opengraphTags() |
255
|
|
|
{ |
256
|
|
|
return ''; |
257
|
|
|
} |
258
|
|
|
} |
259
|
|
|
|