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

Side by Side 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.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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('/<script\b[^<>]*>[^<>]+<\\/script>/s', '', $header);
20 $header = preg_replace('/<title>.*?<\\/title>/s', '', $header); 19 $header = preg_replace('/<title>.*?<\\/title>/s', '', $header);
21 20
22 $footer = preg_replace('/.*<footer\b/s', '<footer', $data); 21 $footer = preg_replace('/.*<footer\b/s', '<footer', $data);
23 $footer = preg_replace('/<section id="anwiki-admin">.*?<\\/section>/s', '', $f ooter);
24 22
25 $anwiki_data = array($header, $footer); 23 $template_data = array($header, $footer);
26 } 24 }
27 25
28 function abp_header($attrs, $contents) 26 function abp_header($attrs, $contents)
29 { 27 {
30 global $anwiki_data; 28 global $template_data;
31 if (!$anwiki_data) 29 if (!$template_data)
32 read_anwiki_data(); 30 read_template_data();
33 31
34 $header = preg_replace('/<\\/head>/s', parse($contents) . '</head>', $anwiki_d ata[0]); 32 $header = preg_replace('/<\\/head>/s', parse($contents) . '</head>', $template _data[0]);
35 global $anwiki_file;
36 global $prefs;
37 return $header; 33 return $header;
38 } 34 }
39 35
40 function abp_footer() 36 function abp_footer()
41 { 37 {
42 global $anwiki_data; 38 global $template_data;
43 if (!$anwiki_data) 39 if (!$template_data)
44 read_anwiki_data(); 40 read_template_data();
45 41
46 return $anwiki_data[1]; 42 return $template_data[1];
47 } 43 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld