dokuwiki-source-plugin – Diff between revs 3 and 4
?pathlinks?
Rev 3 | Rev 4 | |||
---|---|---|---|---|
Line 20... | Line 20... | |||
20 | * - php.ini setting, allow_url_fopen |
20 | * - php.ini setting, allow_url_fopen |
|
21 | * - php.ini setting, open_basedir |
21 | * - php.ini setting, open_basedir |
|
22 | * - this plugin's location, allow & deny settings. |
22 | * - this plugin's location, allow & deny settings. |
|
23 | * |
23 | * |
|
24 | * @license GPL 2 (http://www.gnu.org/licenses/gpl.html) |
24 | * @license GPL 2 (http://www.gnu.org/licenses/gpl.html) |
|
25 | * @author Wizardry and Steamworks office@grimore.org |
- | ||
26 | * original: Christopher Smith <chris@jalakai.co.uk> |
25 | * @author Christopher Smith <chris@jalakai.co.uk> |
|
27 | */ |
26 | */ |
|
28 | if(!defined('DOKU_INC')) die(); // no Dokuwiki, no go |
27 | if(!defined('DOKU_INC')) die(); // no Dokuwiki, no go |
|
Line 29... | Line 28... | |||
29 | |
28 | |
|
30 | if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/'); |
29 | if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/'); |
|
Line 83... | Line 82... | |||
83 | |
82 | |
|
84 | // ['|"]?<filename>[\1] [#<line#>-<line#>] <lang> | <title> |
83 | // ['|"]?<filename>[\1] [#<line#>-<line#>] <lang> | <title> |
|
Line 85... | Line 84... | |||
85 | list($attr, $title) = preg_split('/\|/u', $match, 2); //split out title |
84 | list($attr, $title) = preg_split('/\|/u', $match, 2); //split out title |
|
86 | |
85 | |
|
87 | $attr = trim($attr); |
86 | $attr = trim($attr); |
|
Line 88... | Line 87... | |||
88 | $pattern = ($attr{0} == '"' || $attr{0} == "'") ? $attr{0} : '\s'; |
87 | $pattern = ($attr[0] == '"' || $attr[0] == "'") ? $attr[0] : '\s'; |
|
89 | list($file, $prop) = preg_split("/$pattern/u", $attr, 3, PREG_SPLIT_NO_EMPTY); |
88 | list($file, $prop) = preg_split("/$pattern/u", $attr, 3, PREG_SPLIT_NO_EMPTY); |
|
90 | |
89 | |
|
Line 130... | Line 129... | |||
130 | if ($ok && ($source = $this->_getSource($file,$start,$end))) { |
129 | if ($ok && ($source = $this->_getSource($file,$start,$end))) { |
|
Line 131... | Line 130... | |||
131 | |
130 | |
|
132 | $title = ($title) ? "<span>".hsc($title)."</span>" |
131 | $title = ($title) ? "<span>".hsc($title)."</span>" |
|
Line 133... | Line 132... | |||
133 | : $this->_makeTitle($file, $start, $end); |
132 | : $this->_makeTitle($file, $start, $end); |
|
134 | |
133 | |
|
135 | $renderer->doc .= "<div class='source'><p class='title'>$title</p>"; |
134 | $renderer->doc .= "<div class='source'><p>$title</p>"; |
|
136 | $renderer->code($source, $lang); |
135 | $renderer->code($source, $lang); |
|
137 | $renderer->doc .= "</div>"; |
136 | $renderer->doc .= "</div>"; |
|
138 | } else { |
137 | } else { |
|
Line 221... | Line 220... | |||
221 | |
220 | |
|
222 | function _parseRules($rules) { |
221 | function _parseRules($rules) { |
|
223 | $rules = explode("\n",$rules); |
222 | $rules = explode("\n",$rules); |
|
224 | foreach ($rules as $rule) { |
223 | foreach ($rules as $rule) { |
|
225 | $rule = trim($rule); |
224 | $rule = trim($rule); |
|
Line 226... | Line 225... | |||
226 | if (!$rule || $rule{0} == ';') continue; |
225 | if (!$rule || $rule[0] == ';') continue; |
|
227 | |
226 | |
|
Line 228... | Line 227... | |||
228 | $match = array(); |
227 | $match = array(); |