Skip to content

Commit fc365a1

Browse files
committed
Resolve use for CommonMark class
1 parent 14b7987 commit fc365a1

1 file changed

Lines changed: 17 additions & 9 deletions

File tree

include/inc_front/front.func.inc.php

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,6 @@
1818

1919
//specific functions for the frontend
2020

21-
use League\CommonMark\Environment\Environment;
22-
use League\CommonMark\Extension\CommonMark\CommonMarkCoreExtension;
23-
use League\CommonMark\Extension\GithubFlavoredMarkdownExtension;
24-
use League\CommonMark\MarkdownConverter;
25-
2621
function spacer($width=1, $height=1) {
2722
//creates a placeholder image (transparent gif)
2823
return '<span style="display:inline-block;width:'.intval($width).'px;height:'.intval($height).'px" class="'.$GLOBALS['template_default']['classes']['spaceholder'].'"></span>';
@@ -4567,10 +4562,10 @@ function get_attr_data_gallery($group='', $prefix=' ', $suffix='') {
45674562
function init_markdown() {
45684563

45694564
if(!isset($GLOBALS['phpwcms']['commonmark_class'])) {
4570-
$environment = new Environment();
4571-
$environment->addExtension(new CommonMarkCoreExtension());
4572-
$environment->addExtension(new GithubFlavoredMarkdownExtension());
4573-
$GLOBALS['phpwcms']['commonmark_class'] = new MarkdownConverter($environment);
4565+
$environment = new \League\CommonMark\Environment\Environment();
4566+
$environment->addExtension(new \League\CommonMark\Extension\CommonMark\CommonMarkCoreExtension());
4567+
$environment->addExtension(new \League\CommonMark\Extension\GithubFlavoredMarkdownExtension());
4568+
$GLOBALS['phpwcms']['commonmark_class'] = new \League\CommonMark\MarkdownConverter($environment);
45744569
}
45754570

45764571
}
@@ -4599,3 +4594,16 @@ function parse_markdown(string $text) {
45994594
init_markdown();
46004595
return $GLOBALS['phpwcms']['commonmark_class']->convert($text);
46014596
}
4597+
4598+
/**
4599+
* Parse content with Textile
4600+
*
4601+
* @param string $text
4602+
*/
4603+
function parse_textile(string $text) {
4604+
if ($text === '') {
4605+
return '';
4606+
}
4607+
init_textile();
4608+
return $GLOBALS['phpwcms']['textile_class']->textileThis($text);
4609+
}

0 commit comments

Comments
 (0)