1 | <?php |
||
12 | class SEO_Icons_SiteTree_DataExtension extends DataExtension |
||
|
|||
13 | { |
||
14 | |||
15 | |||
16 | /* Overload Variable |
||
17 | ------------------------------------------------------------------------------*/ |
||
18 | |||
19 | // none |
||
20 | |||
21 | |||
22 | /* Overload Methods |
||
23 | ------------------------------------------------------------------------------*/ |
||
24 | |||
25 | // CMS Fields |
||
26 | // public function updateCMSFields(FieldList $fields) {} |
||
27 | |||
28 | |||
29 | /* Template Methods |
||
30 | ------------------------------------------------------------------------------*/ |
||
31 | |||
32 | /** |
||
33 | * Updates metadata with icons. |
||
34 | * |
||
35 | * @param SiteConfig $config |
||
36 | * @param SiteTree $owner |
||
37 | * @param $metadata |
||
38 | * |
||
39 | * @return void |
||
40 | */ |
||
41 | public function updateMetadata(SiteConfig $config, SiteTree $owner, &$metadata) |
||
80 | |||
81 | /** |
||
82 | * Generates markup for the iOS pinicon |
||
83 | * |
||
84 | * @param SiteConfig $config |
||
85 | * @param SiteTree $owner |
||
86 | * @param string $metadata |
||
87 | * @param Image $IOSPinicon |
||
88 | * |
||
89 | * @return void |
||
90 | */ |
||
91 | protected function GenerateIOSPinicon(SiteConfig $config, SiteTree $owner, &$metadata, Image $IOSPinicon) { |
||
92 | |||
93 | // header |
||
94 | $metadata .= $this->owner->MarkupComment('iOS Pinned Icon'); |
||
95 | |||
96 | //// iOS Pinicon Title |
||
97 | if ($config->fetchPiniconTitle()) { |
||
98 | $metadata .= $owner->MarkupMeta('apple-mobile-web-app-title', $config->fetchPiniconTitle()); |
||
99 | } |
||
100 | |||
101 | //// iOS Pinned Icon |
||
102 | |||
103 | // For non-Retina (@1× display) iPhone, iPod Touch, and Android 2.1+ devices |
||
104 | $metadata .= $owner->MarkupLink('apple-touch-icon', $IOSPinicon->Fill(57, 57)->getAbsoluteURL(), 'image/png'); // 57×57 |
||
105 | |||
106 | // @todo: What is this for ?? |
||
107 | $metadata .= $owner->MarkupLink('apple-touch-icon', $IOSPinicon->Fill(60, 60)->getAbsoluteURL(), 'image/png', '60x60'); |
||
108 | |||
109 | // For the iPad mini and the first- and second-generation iPad (@1× display) on iOS ≤ 6 |
||
110 | $metadata .= $owner->MarkupLink('apple-touch-icon', $IOSPinicon->Fill(72, 72)->getAbsoluteURL(), 'image/png', '72x72'); |
||
111 | |||
112 | // For the iPad mini and the first- and second-generation iPad (@1× display) on iOS ≥ 7 |
||
113 | $metadata .= $owner->MarkupLink('apple-touch-icon', $IOSPinicon->Fill(76, 76)->getAbsoluteURL(), 'image/png', '76x76'); |
||
114 | |||
115 | // For iPhone with @2× display running iOS ≤ 6 |
||
116 | $metadata .= $owner->MarkupLink('apple-touch-icon', $IOSPinicon->Fill(114, 114)->getAbsoluteURL(), 'image/png', '114x114'); |
||
117 | |||
118 | // For iPhone with @2× display running iOS ≥ 7 |
||
119 | $metadata .= $owner->MarkupLink('apple-touch-icon', $IOSPinicon->Fill(120, 120)->getAbsoluteURL(), 'image/png', '120x120'); |
||
120 | |||
121 | // For iPad with @2× display running iOS ≤ 6 |
||
122 | $metadata .= $owner->MarkupLink('apple-touch-icon', $IOSPinicon->Fill(144, 144)->getAbsoluteURL(), 'image/png', '144x144'); |
||
123 | |||
124 | // For iPad with @2× display running iOS ≥ 7 |
||
125 | $metadata .= $owner->MarkupLink('apple-touch-icon', $IOSPinicon->Fill(152, 152)->getAbsoluteURL(), 'image/png', '152x152'); |
||
126 | |||
127 | // For iPhone 6 Plus with @3× display |
||
128 | $metadata .= $owner->MarkupLink('apple-touch-icon', $IOSPinicon->Fill(180, 180)->getAbsoluteURL(), 'image/png', '180x180'); |
||
129 | |||
130 | } |
||
131 | |||
132 | /** |
||
133 | * Generates markup for the HTML5 favicon |
||
134 | * |
||
135 | * @param SiteTree $owner |
||
136 | * @param string $metadata |
||
137 | * @param Image $HTML5Favicon |
||
138 | * |
||
139 | * @return void |
||
140 | */ |
||
141 | protected function GenerateHTML5Favicon(SiteTree $owner, &$metadata, Image $HTML5Favicon) { |
||
142 | |||
143 | // header |
||
144 | $metadata .= $owner->MarkupComment('HTML5 Favicon'); |
||
145 | |||
146 | // // Android Chrome 32 |
||
147 | // @todo: Is the Android Chrome 32 196x196 px icon fully redundant ?? |
||
148 | // $metadata .= $owner->MarkupLink('icon', $HTML5Favicon->Fill(196,196)->getAbsoluteURL(), 'image/png', '196x196'); |
||
149 | |||
150 | // Android Chrome 37+ / HTML5 spec |
||
151 | $metadata .= $owner->MarkupLink('icon', $HTML5Favicon->Fill(192, 192)->getAbsoluteURL(), 'image/png', '192x192'); |
||
152 | |||
153 | // Android Chrome 37+ / HTML5 spec |
||
154 | $metadata .= $owner->MarkupLink('icon', $HTML5Favicon->Fill(128, 128)->getAbsoluteURL(), 'image/png', '128x128'); |
||
155 | |||
156 | // For Google TV |
||
157 | $metadata .= $owner->MarkupLink('icon', $HTML5Favicon->Fill(96, 96)->getAbsoluteURL(), 'image/png', '96x96'); |
||
158 | |||
159 | // For Safari on Mac OS |
||
160 | $metadata .= $owner->MarkupLink('icon', $HTML5Favicon->Fill(32, 32)->getAbsoluteURL(), 'image/png', '32x32'); |
||
161 | |||
162 | // The classic favicon, displayed in the tabs |
||
163 | $metadata .= $owner->MarkupLink('icon', $HTML5Favicon->Fill(16, 16)->getAbsoluteURL(), 'image/png', '16x16'); |
||
164 | |||
165 | } |
||
166 | |||
167 | /** |
||
168 | * Generates markup for the Android pinicon |
||
169 | * |
||
170 | * @param SiteConfig $config |
||
171 | * @param SiteTree $owner |
||
172 | * @param $metadata |
||
173 | * |
||
174 | * @return void |
||
175 | */ |
||
176 | protected function GenerateAndroidPinicon(SiteConfig $config, SiteTree $owner, &$metadata) { |
||
190 | |||
191 | /** |
||
192 | * Generates markup for the Windows pinicon |
||
193 | * |
||
194 | * @param SiteConfig $config |
||
195 | * @param SiteTree $owner |
||
196 | * @param $metadata |
||
197 | * @param Image $WindowsPinicon |
||
198 | * |
||
199 | * @return void |
||
200 | */ |
||
201 | protected function GenerateWindowsPinicon(SiteConfig $config, SiteTree $owner, &$metadata, Image $WindowsPinicon) { |
||
233 | |||
234 | } |
||
235 |
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.