OLD | NEW |
1 <?php | 1 <?php |
2 | 2 |
3 class AnwTemplateOverride_global extends AnwTemplateDefault_global | 3 class AnwTemplateOverride_global extends AnwTemplateDefault_global |
4 { | 4 { |
5 function globalHtml($sHtmlLang, $sHtmlDir, $sTitle, $sHead, $sBody) | 5 function globalHtml($sHtmlLang, $sHtmlDir, $sTitle, $sHead, $sBody) |
6 { | 6 { |
7 $HTML = <<<EOF | 7 $HTML = <<<EOF |
8 <!DOCTYPE html> | 8 <!DOCTYPE html> |
9 <html lang="{$this->xQuote($sHtmlLang)}" dir="{$this->xQuote($sHtmlDir)}" itemsc
ope="itemscope" itemtype="http://schema.org/WebPage"> | 9 <html lang="{$this->xQuote($sHtmlLang)}" dir="{$this->xQuote($sHtmlDir)}" itemsc
ope="itemscope" itemtype="http://schema.org/WebPage"> |
10 <head> | 10 <head> |
11 <title>{$this->xText($sTitle)}</title> | 11 <title>{$this->xText($sTitle)}</title> |
12 $sHead | 12 $sHead |
13 </head> | 13 </head> |
14 | 14 |
15 <body> | 15 <body> |
16 $sBody | 16 $sBody |
17 </body> | 17 </body> |
18 </html> | 18 </html> |
19 EOF; | 19 EOF; |
20 | 20 |
21 return $this->moveMetaTagsToHead($HTML); | 21 return $this->moveMetaTagsToHead($HTML); |
22 } | 22 } |
23 | 23 |
24 private function moveMetaTagsToHead($HTML) | 24 private function moveMetaTagsToHead($HTML) |
25 { | 25 { |
26 do | 26 do |
27 { | 27 { |
28 $newHTML = preg_replace('/(<\/head>.*<body\b.*)(<meta\b[^>]*\/>\s*)/is', '
$2$1', $HTML, 1, $count); | 28 $newHTML = preg_replace('/(<head\b[^>]*>)(([^<]*<meta)*([^<]*<(?!meta))+[^
<]*)(<meta\b[^>]*>\s*)/is', '$1$5$2', $HTML, 1, $count); |
29 if ($newHTML) | 29 if ($newHTML) |
30 $HTML = $newHTML; | 30 $HTML = $newHTML; |
31 } while ($count); | 31 } while ($count); |
32 return $HTML; | 32 return $HTML; |
33 } | 33 } |
34 | 34 |
35 function globalHead($sHeadContent, $sHeadCss, $sHeadJs) | 35 function globalHead($sHeadContent, $sHeadCss, $sHeadJs) |
36 { | 36 { |
37 $sHeadContent = $this->removeAnwikiStyles($sHeadContent); | 37 $sHeadContent = $this->removeAnwikiStyles($sHeadContent); |
38 | 38 |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 // This will fail when the database is not configured correctly or when | 169 // This will fail when the database is not configured correctly or when |
170 // the page doesn't exist yet. That's the case during the | 170 // the page doesn't exist yet. That's the case during the |
171 // initial installation. | 171 // initial installation. |
172 } | 172 } |
173 | 173 |
174 return ""; | 174 return ""; |
175 } | 175 } |
176 } | 176 } |
177 | 177 |
178 ?> | 178 ?> |
OLD | NEW |