Enable or disable Markdown parser for #980
This commit is contained in:
parent
185ae09393
commit
3ab8c4c0a6
@ -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(
|
||||
|
@ -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);
|
||||
|
@ -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) {
|
||||
|
@ -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');
|
||||
|
Loading…
Reference in New Issue
Block a user