1 | <?php |
||
14 | class SEO_Metadata_SiteTree_DataExtension extends DataExtension |
||
|
|||
15 | { |
||
16 | |||
17 | /* Overload Model |
||
18 | ------------------------------------------------------------------------------*/ |
||
19 | |||
20 | /** |
||
21 | * Database attributes. |
||
22 | * |
||
23 | * @var array $db |
||
24 | */ |
||
25 | private static $db = array( |
||
26 | 'MetaTitle' => 'Varchar(128)', |
||
27 | 'MetaDescription' => 'Text', // redundant, but included for backwards-compatibility |
||
28 | 'ExtraMeta' => 'HTMLText', // redundant, but included for backwards-compatibility |
||
29 | ); |
||
30 | |||
31 | |||
32 | /* Overload Methods |
||
33 | ------------------------------------------------------------------------------*/ |
||
34 | |||
35 | // @todo @inheritdoc ?? or does it happen automagically as promised? |
||
36 | public function updateCMSFields(FieldList $fields) |
||
87 | |||
88 | /** |
||
89 | * Main function to format & output metadata as an HTML string. |
||
90 | * |
||
91 | * Use the `updateMetadata($config, $owner, $metadata)` update hook when extending `DataExtension`s. |
||
92 | * |
||
93 | * @return string |
||
94 | */ |
||
95 | public function Metadata() |
||
145 | |||
146 | |||
147 | /* Helper Methods |
||
148 | ------------------------------------------------------------------------------*/ |
||
149 | |||
150 | /** |
||
151 | * Returns a given string as a HTML comment. |
||
152 | * |
||
153 | * @var string $comment |
||
154 | * |
||
155 | * @return string |
||
156 | */ |
||
157 | public function MarkupComment($comment) |
||
161 | |||
162 | /** |
||
163 | * Returns markup for a HTML meta element. |
||
164 | * |
||
165 | * @var string $name |
||
166 | * @var string $content |
||
167 | * @var bool $encode |
||
168 | * |
||
169 | * @return string |
||
170 | */ |
||
171 | public function MarkupMeta($name, $content, $encode = false) |
||
175 | |||
176 | /** |
||
177 | * Returns markup for a HTML link element. |
||
178 | * |
||
179 | * @param string $rel |
||
180 | * @param string $href |
||
181 | * @param string $type |
||
182 | * @param string $sizes |
||
183 | * |
||
184 | * @return string |
||
185 | */ |
||
186 | public function MarkupLink($rel, $href, $type = '', $sizes = '') |
||
203 | |||
204 | |||
205 | /* Meta Methods |
||
206 | ------------------------------------------------------------------------------*/ |
||
207 | |||
208 | /** |
||
209 | * Generates HTML title based on configuration settings. |
||
210 | * |
||
211 | * @return string|null |
||
212 | */ |
||
213 | public function GenerateTitle() |
||
217 | |||
218 | /** |
||
219 | * Returns description from the page `MetaDescription`, or the first paragraph of the `Content` attribute. |
||
220 | * |
||
221 | * @return string|null |
||
222 | */ |
||
223 | public function GenerateDescription() |
||
231 | |||
232 | /** |
||
233 | * Generates description from the first paragraph of the `Content` attribute. |
||
234 | * |
||
235 | * @return bool|string |
||
236 | */ |
||
237 | public function GenerateDescriptionFromContent() |
||
257 | |||
258 | /** |
||
259 | * Returns a plain or HTML-encoded string according to the current charset & encoding settings. |
||
260 | * |
||
261 | * @param string $content |
||
262 | * @param bool $encode |
||
263 | * |
||
264 | * @return string |
||
265 | */ |
||
266 | public function encodeContent($content, $encode = true) { |
||
273 | |||
274 | } |
||
275 |
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.