Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: plugin.php

Issue 29355234: Issue 4293 - Make Textpattern use our current website content as template (Closed)
Patch Set: Don't remove hamburger menu Created Sept. 28, 2016, 1:29 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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];
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld