1 | <?php |
||
16 | class SEO_Metadata_SiteConfig_DataExtension extends DataExtension |
||
|
|||
17 | { |
||
18 | |||
19 | /* Attributes |
||
20 | ------------------------------------------------------------------------------*/ |
||
21 | |||
22 | //// statuses |
||
23 | |||
24 | /** |
||
25 | * Character set status. |
||
26 | * |
||
27 | * Boolean value governing whether the character set is output. |
||
28 | * |
||
29 | * @var bool $CharsetStatus |
||
30 | */ |
||
31 | private static $CharsetStatus = false; |
||
32 | |||
33 | /** |
||
34 | * `rel="canonical"` status. |
||
35 | * |
||
36 | * Boolean value governing whether canonical links are output. |
||
37 | * |
||
38 | * @var bool $CanonicalStatus |
||
39 | */ |
||
40 | private static $CanonicalStatus = false; |
||
41 | |||
42 | /** |
||
43 | * Title status. |
||
44 | * |
||
45 | * Boolean value governing whether the page title should be output. |
||
46 | * |
||
47 | * @var bool $TitleStatus |
||
48 | */ |
||
49 | private static $TitleStatus = false; |
||
50 | |||
51 | /** |
||
52 | * Extra metadata status. |
||
53 | * |
||
54 | * Boolean value governing whether additional (arbitrary) metadata can be added to pages. |
||
55 | * |
||
56 | * @var bool $ExtraMetaStatus |
||
57 | */ |
||
58 | private static $ExtraMetaStatus = false; |
||
59 | |||
60 | //// defaults |
||
61 | |||
62 | /** |
||
63 | * Character set. |
||
64 | * |
||
65 | * The character set to be used. Should always be `UTF-8` except for fringe configurations. |
||
66 | * |
||
67 | * @var string |
||
68 | */ |
||
69 | private static $Charset = 'UTF-8'; |
||
70 | |||
71 | /** |
||
72 | * Default title separator. |
||
73 | * |
||
74 | * The default title (primary) separator. |
||
75 | * |
||
76 | * @var string |
||
77 | */ |
||
78 | private static $TitleSeparatorDefault = '|'; |
||
79 | |||
80 | /** |
||
81 | * Default tagline separator. |
||
82 | * |
||
83 | * The default tagline (secondary) separator. |
||
84 | * |
||
85 | * @var string |
||
86 | */ |
||
87 | private static $TaglineSeparatorDefault = '-'; |
||
88 | |||
89 | |||
90 | /* Status Methods |
||
91 | ------------------------------------------------------------------------------*/ |
||
92 | |||
93 | /** |
||
94 | * Character set enabled. |
||
95 | * |
||
96 | * Gets whether the character set should be output. |
||
97 | * |
||
98 | * @return bool |
||
99 | */ |
||
100 | public function CharsetEnabled() |
||
104 | |||
105 | /** |
||
106 | * Canonical links enabled. |
||
107 | * |
||
108 | * Gets whether the canonical link should be output. |
||
109 | * |
||
110 | * @return bool |
||
111 | */ |
||
112 | public function CanonicalEnabled() |
||
116 | |||
117 | /** |
||
118 | * Title enabled. |
||
119 | * |
||
120 | * Gets whether the title should be output. |
||
121 | * |
||
122 | * @return bool |
||
123 | */ |
||
124 | public function TitleEnabled() |
||
128 | |||
129 | /** |
||
130 | * Extra metadata enabled. |
||
131 | * |
||
132 | * Gets whether additional (arbitrary) metadata should be output. |
||
133 | * |
||
134 | * @return bool |
||
135 | */ |
||
136 | public function ExtraMetaEnabled() |
||
140 | |||
141 | |||
142 | /* Config Methods |
||
143 | ------------------------------------------------------------------------------*/ |
||
144 | |||
145 | /** |
||
146 | * Character set. |
||
147 | * |
||
148 | * Gets the character set from configuration, or uses the class-defined default. |
||
149 | * |
||
150 | * @return string |
||
151 | */ |
||
152 | public function Charset() |
||
156 | |||
157 | |||
158 | /* Overload Model |
||
159 | ------------------------------------------------------------------------------*/ |
||
160 | |||
161 | /** |
||
162 | * Database fields. |
||
163 | * |
||
164 | * An associative array of database fields: `name` => `type`. |
||
165 | * |
||
166 | * @var array $db |
||
167 | */ |
||
168 | private static $db = array( |
||
169 | 'TitleOrder' => 'Enum(array("first", "last"), "first")', |
||
170 | 'Title' => 'Text', // redundant, but included for backwards-compatibility |
||
171 | 'TitleSeparator' => 'Varchar(1)', |
||
172 | 'Tagline' => 'Text', // redundant, but included for backwards-compatibility |
||
173 | 'TaglineSeparator' => 'Varchar(1)', |
||
174 | ); |
||
175 | |||
176 | |||
177 | /* Overload Methods |
||
178 | ------------------------------------------------------------------------------*/ |
||
179 | |||
180 | // @todo @inheritdoc ?? or does it happen automagically as promised? |
||
181 | public function updateCMSFields(FieldList $fields) |
||
226 | |||
227 | |||
228 | /* Custom Methods |
||
229 | ------------------------------------------------------------------------------*/ |
||
230 | |||
231 | /** |
||
232 | * Fetch title separator. |
||
233 | * |
||
234 | * Fetches the title (primary) separator, falls back to default. |
||
235 | * |
||
236 | * @return string |
||
237 | */ |
||
238 | public function FetchTitleSeparator() |
||
242 | |||
243 | /** |
||
244 | * Fetch tagline separator. |
||
245 | * |
||
246 | * Fetches the tagline (secondary) separator, falls back to default. |
||
247 | * |
||
248 | * @return string |
||
249 | */ |
||
250 | public function FetchTaglineSeparator() |
||
254 | |||
255 | /** |
||
256 | * Generates HTML title based on configuration settings. |
||
257 | * |
||
258 | * @dev Override this function for any custom title functionality. |
||
259 | * |
||
260 | * @param string $pageTitle |
||
261 | * |
||
262 | * @return string |
||
263 | */ |
||
264 | public function GenerateTitle($pageTitle = 'Title Error') |
||
307 | |||
308 | } |
||
309 |
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.