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

Delta Between Two Patch Sets: plugin.php

Issue 29355234: Issue 4293 - Make Textpattern use our current website content as template (Closed)
Left Patch Set: Fixed nit Created Sept. 28, 2016, 10:14 a.m.
Right 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:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « no previous file | no next file » | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 $template_data = NULL; 1 $template_data = NULL;
2 2
3 function get_site_template_path() 3 function get_site_template_path()
4 { 4 {
5 global $prefs; 5 global $prefs;
6 return $prefs['tempdir'].DS.'site_template'; 6 return $prefs['tempdir'].DS.'site_template';
7 } 7 }
8 8
9 function read_template_data() 9 function read_template_data()
10 { 10 {
11 global $template_data; 11 global $template_data;
12 12
13 $data = file_get_contents(get_site_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('/<link\b[^>]*\brel="canonical"[^>]*>/s', '', $header);
17 $header = preg_replace('/<ul id="language-selector">.*?<\\/ul>/s', '', $header ); 17 $header = preg_replace('/<ul id="language-selector">.*?<\\/ul>/s', '', $header );
18 $header = preg_replace('/<li id="language">.*?<\\/li>/s', '', $header); 18 $header = preg_replace('/<li id="language">.*?<\\/li>/s', '', $header);
19 $header = preg_replace('/<a\b[^>]*\bid="hamburger".*?<\\/a>/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 22
24 $template_data = array($header, $footer); 23 $template_data = array($header, $footer);
25 } 24 }
26 25
27 function abp_header($attrs, $contents) 26 function abp_header($attrs, $contents)
28 { 27 {
29 global $template_data; 28 global $template_data;
30 if (!$template_data) 29 if (!$template_data)
31 read_template_data(); 30 read_template_data();
32 31
33 $header = preg_replace('/<\\/head>/s', parse($contents) . '</head>', $template _data[0]); 32 $header = preg_replace('/<\\/head>/s', parse($contents) . '</head>', $template _data[0]);
34 return $header; 33 return $header;
35 } 34 }
36 35
37 function abp_footer() 36 function abp_footer()
38 { 37 {
39 global $template_data; 38 global $template_data;
40 if (!$template_data) 39 if (!$template_data)
41 read_template_data(); 40 read_template_data();
42 41
43 return $template_data[1]; 42 return $template_data[1];
44 } 43 }
LEFTRIGHT
« no previous file | no next file » | Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Toggle Comments ('s')

Powered by Google App Engine
This is Rietveld