diff --git a/bl-kernel/admin/views/settings.php b/bl-kernel/admin/views/settings.php index 780b5df2..ec554ff4 100644 --- a/bl-kernel/admin/views/settings.php +++ b/bl-kernel/admin/views/settings.php @@ -179,6 +179,17 @@ 'placeholder'=>'https://' )); + echo Bootstrap::formTitle(array('title'=>$L->g('Page content'))); + + echo Bootstrap::formSelect(array( + 'name'=>'markdownParser', + 'label'=>$L->g('Markdown parser'), + 'options'=>array('true'=>$L->g('Enabled'), 'false'=>$L->g('Disabled')), + 'selected'=>($site->markdownParser()?'true':'false'), + 'class'=>'', + 'tip'=>$L->g('Enable the markdown parser for the content of the page.') + )); + echo Bootstrap::formTitle(array('title'=>$L->g('URL Filters'))); echo Bootstrap::formInputText(array( diff --git a/bl-kernel/boot/init.php b/bl-kernel/boot/init.php index 2bd1604c..249146d3 100644 --- a/bl-kernel/boot/init.php +++ b/bl-kernel/boot/init.php @@ -208,6 +208,9 @@ define('IMAGE_RESTRICT', $site->imageRestrict()); // TRUE to convert relatives images to absoultes, FALSE No changes apply define('IMAGE_RELATIVE_TO_ABSOLUTE', $site->imageRelativeToAbsolute()); +// TRUE if the markdown parser is enabled +define('MARKDOWN_PARSER', $site->markdownParser()); + // --- PHP paths with dependency --- // This paths are absolutes for the OS define('THEME_DIR', PATH_ROOT.'bl-themes'.DS.$site->theme().DS); diff --git a/bl-kernel/pagex.class.php b/bl-kernel/pagex.class.php index 252eb785..2353f8d7 100644 --- a/bl-kernel/pagex.class.php +++ b/bl-kernel/pagex.class.php @@ -76,8 +76,10 @@ class Page { $content = $this->contentRaw(); // Parse Markdown - $parsedown = new Parsedown(); - $content = $parsedown->text($content); + if (MARKDOWN_PARSER) { + $parsedown = new Parsedown(); + $content = $parsedown->text($content); + } // Parse img src relative to absolute (with domain) if (IMAGE_RELATIVE_TO_ABSOLUTE) { diff --git a/bl-kernel/site.class.php b/bl-kernel/site.class.php index 5e965cf7..f5958ecc 100644 --- a/bl-kernel/site.class.php +++ b/bl-kernel/site.class.php @@ -40,10 +40,11 @@ class Site extends dbJSON { 'titleFormatTag'=> '{{tag-name}} | {{site-title}}', 'imageRestrict'=> true, 'imageRelativeToAbsolute'=> false, - 'thumbnailWidth' => 400, // px - 'thumbnailHeight' => 400, // px - 'thumbnailQuality' => 100, - 'logo'=> '' + 'thumbnailWidth'=> 400, // px + 'thumbnailHeight'=> 400, // px + 'thumbnailQuality'=> 100, + 'logo'=> '', + 'markdownParser'=> true ); function __construct() @@ -68,8 +69,9 @@ class Site extends dbJSON { // Check values on args or set default values foreach ($this->dbFields as $field=>$value) { if (isset($args[$field])) { - // Sanitize if will be stored on database $finalValue = Sanitize::html($args[$field]); + if ($finalValue==='false') { $finalValue = false; } + elseif ($finalValue==='true') { $finalValue = true; } settype($finalValue, gettype($value)); $this->db[$field] = $finalValue; } @@ -138,6 +140,11 @@ class Site extends dbJSON { return $this->getField('extremeFriendly'); } + public function markdownParser() + { + return $this->getField('markdownParser'); + } + public function twitter() { return $this->getField('twitter'); @@ -168,12 +175,6 @@ class Site extends dbJSON { return $this->getField('gitlab'); } - // DEPRECATED since v3.5 - public function googlePlus() - { - return $this->getField('googlePlus'); - } - public function linkedin() { return $this->getField('linkedin');