OLD | NEW |
1 $anwiki_data = FALSE; | 1 $template_data = NULL; |
2 | 2 |
3 function get_anwiki_template_path() | 3 function get_site_template_path() |
4 { | 4 { |
5 global $prefs; | 5 global $prefs; |
6 return $prefs['tempdir'].DS.'anwiki_template'; | 6 return $prefs['tempdir'].DS.'site_template'; |
7 } | 7 } |
8 | 8 |
9 function read_anwiki_data() | 9 function read_template_data() |
10 { | 10 { |
11 global $anwiki_data; | 11 global $template_data; |
12 | 12 |
13 $data = file_get_contents(get_anwiki_template_path()); | 13 $data = file_get_contents(get_site_template_path()); |
14 | 14 |
15 $header = preg_replace('/<\\/header>.*/s', '</header>', $data); | 15 $header = preg_replace('/<\\/header>.*/s', '</header>', $data); |
| 16 $header = preg_replace('/<link\b[^>]*\brel="canonical"[^>]*>/s', '', $header); |
16 $header = preg_replace('/<ul id="language-selector">.*?<\\/ul>/s', '', $header
); | 17 $header = preg_replace('/<ul id="language-selector">.*?<\\/ul>/s', '', $header
); |
17 $header = preg_replace('/<li id="language">.*?<\\/li>/s', '', $header); | 18 $header = preg_replace('/<li id="language">.*?<\\/li>/s', '', $header); |
18 $header = preg_replace('/ (itemscope|itemtype)="[^"]*"/', '', $header); | 19 $header = preg_replace('/<a\b[^>]*\bid="hamburger".*?<\\/a>/s', '', $header); |
19 $header = preg_replace('/<script\b[^<>]*>[^<>]+<\\/script>/s', '', $header); | |
20 $header = preg_replace('/<title>.*?<\\/title>/s', '', $header); | 20 $header = preg_replace('/<title>.*?<\\/title>/s', '', $header); |
21 | 21 |
22 $footer = preg_replace('/.*<footer\b/s', '<footer', $data); | 22 $footer = preg_replace('/.*<footer\b/s', '<footer', $data); |
23 $footer = preg_replace('/<section id="anwiki-admin">.*?<\\/section>/s', '', $f
ooter); | |
24 | 23 |
25 $anwiki_data = array($header, $footer); | 24 $template_data = array($header, $footer); |
26 } | 25 } |
27 | 26 |
28 function abp_header($attrs, $contents) | 27 function abp_header($attrs, $contents) |
29 { | 28 { |
30 global $anwiki_data; | 29 global $template_data; |
31 if (!$anwiki_data) | 30 if (!$template_data) |
32 read_anwiki_data(); | 31 read_template_data(); |
33 | 32 |
34 $header = preg_replace('/<\\/head>/s', parse($contents) . '</head>', $anwiki_d
ata[0]); | 33 $header = preg_replace('/<\\/head>/s', parse($contents) . '</head>', $template
_data[0]); |
35 global $anwiki_file; | |
36 global $prefs; | |
37 return $header; | 34 return $header; |
38 } | 35 } |
39 | 36 |
40 function abp_footer() | 37 function abp_footer() |
41 { | 38 { |
42 global $anwiki_data; | 39 global $template_data; |
43 if (!$anwiki_data) | 40 if (!$template_data) |
44 read_anwiki_data(); | 41 read_template_data(); |
45 | 42 |
46 return $anwiki_data[1]; | 43 return $template_data[1]; |
47 } | 44 } |
OLD | NEW |