-
Notifications
You must be signed in to change notification settings - Fork 0
/
plugin.php
31 lines (27 loc) · 906 Bytes
/
plugin.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<?php
class pluginParsedownExtraCombined extends Plugin {
private function parse($content)
{
return $GLOBALS['PARSEDOWN_TOC']->text($content);
}
public function beforeSiteLoad()
{
if (!isset($GLOBALS['PARSEDOWN_TOC']))
{
require_once($this->phpPath().'vendors/ParsedownExtra.php');
require_once($this->phpPath().'vendors/ParsedownExtended.php');
require_once($this->phpPath().'vendors/ParsedownLitFootnotes.php');
$GLOBALS['PARSEDOWN_TOC'] = new ParsedownLitFootnotes();
}
if ($GLOBALS['WHERE_AM_I']=='page') {
$content = $this->parse($GLOBALS['page']->contentRaw());
$GLOBALS['page']->setField('content', $content);
} else {
foreach ($GLOBALS['content'] as $key=>$page) {
$content = $this->parse($page->contentRaw());
$GLOBALS['content'][$key]->setField('content', $content);
}
$GLOBALS['page'] = $GLOBALS['content'][0];
}
}
}