Index: plugin.php |
=================================================================== |
--- a/plugin.php |
+++ b/plugin.php |
@@ -1,47 +1,43 @@ |
-$anwiki_data = FALSE; |
+$template_data = NULL; |
-function get_anwiki_template_path() |
+function get_site_template_path() |
{ |
global $prefs; |
- return $prefs['tempdir'].DS.'anwiki_template'; |
+ return $prefs['tempdir'].DS.'site_template'; |
} |
-function read_anwiki_data() |
+function read_template_data() |
{ |
- global $anwiki_data; |
+ global $template_data; |
- $data = file_get_contents(get_anwiki_template_path()); |
+ $data = file_get_contents(get_site_template_path()); |
$header = preg_replace('/<\\/header>.*/s', '</header>', $data); |
+ $header = preg_replace('/<link\b[^>]*\brel="canonical"[^>]*>/s', '', $header); |
$header = preg_replace('/<ul id="language-selector">.*?<\\/ul>/s', '', $header); |
$header = preg_replace('/<li id="language">.*?<\\/li>/s', '', $header); |
- $header = preg_replace('/ (itemscope|itemtype)="[^"]*"/', '', $header); |
- $header = preg_replace('/<script\b[^<>]*>[^<>]+<\\/script>/s', '', $header); |
$header = preg_replace('/<title>.*?<\\/title>/s', '', $header); |
$footer = preg_replace('/.*<footer\b/s', '<footer', $data); |
- $footer = preg_replace('/<section id="anwiki-admin">.*?<\\/section>/s', '', $footer); |
- $anwiki_data = array($header, $footer); |
+ $template_data = array($header, $footer); |
} |
function abp_header($attrs, $contents) |
{ |
- global $anwiki_data; |
- if (!$anwiki_data) |
- read_anwiki_data(); |
+ global $template_data; |
+ if (!$template_data) |
+ read_template_data(); |
- $header = preg_replace('/<\\/head>/s', parse($contents) . '</head>', $anwiki_data[0]); |
- global $anwiki_file; |
- global $prefs; |
+ $header = preg_replace('/<\\/head>/s', parse($contents) . '</head>', $template_data[0]); |
return $header; |
} |
function abp_footer() |
{ |
- global $anwiki_data; |
- if (!$anwiki_data) |
- read_anwiki_data(); |
+ global $template_data; |
+ if (!$template_data) |
+ read_template_data(); |
- return $anwiki_data[1]; |
+ return $template_data[1]; |
} |