Enable or disable Markdown parser for #980
This commit is contained in:
parent
185ae09393
commit
3ab8c4c0a6
|
@ -179,6 +179,17 @@
|
||||||
'placeholder'=>'https://'
|
'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::formTitle(array('title'=>$L->g('URL Filters')));
|
||||||
|
|
||||||
echo Bootstrap::formInputText(array(
|
echo Bootstrap::formInputText(array(
|
||||||
|
|
|
@ -208,6 +208,9 @@ define('IMAGE_RESTRICT', $site->imageRestrict());
|
||||||
// TRUE to convert relatives images to absoultes, FALSE No changes apply
|
// TRUE to convert relatives images to absoultes, FALSE No changes apply
|
||||||
define('IMAGE_RELATIVE_TO_ABSOLUTE', $site->imageRelativeToAbsolute());
|
define('IMAGE_RELATIVE_TO_ABSOLUTE', $site->imageRelativeToAbsolute());
|
||||||
|
|
||||||
|
// TRUE if the markdown parser is enabled
|
||||||
|
define('MARKDOWN_PARSER', $site->markdownParser());
|
||||||
|
|
||||||
// --- PHP paths with dependency ---
|
// --- PHP paths with dependency ---
|
||||||
// This paths are absolutes for the OS
|
// This paths are absolutes for the OS
|
||||||
define('THEME_DIR', PATH_ROOT.'bl-themes'.DS.$site->theme().DS);
|
define('THEME_DIR', PATH_ROOT.'bl-themes'.DS.$site->theme().DS);
|
||||||
|
|
|
@ -76,8 +76,10 @@ class Page {
|
||||||
$content = $this->contentRaw();
|
$content = $this->contentRaw();
|
||||||
|
|
||||||
// Parse Markdown
|
// Parse Markdown
|
||||||
|
if (MARKDOWN_PARSER) {
|
||||||
$parsedown = new Parsedown();
|
$parsedown = new Parsedown();
|
||||||
$content = $parsedown->text($content);
|
$content = $parsedown->text($content);
|
||||||
|
}
|
||||||
|
|
||||||
// Parse img src relative to absolute (with domain)
|
// Parse img src relative to absolute (with domain)
|
||||||
if (IMAGE_RELATIVE_TO_ABSOLUTE) {
|
if (IMAGE_RELATIVE_TO_ABSOLUTE) {
|
||||||
|
|
|
@ -43,7 +43,8 @@ class Site extends dbJSON {
|
||||||
'thumbnailWidth'=> 400, // px
|
'thumbnailWidth'=> 400, // px
|
||||||
'thumbnailHeight'=> 400, // px
|
'thumbnailHeight'=> 400, // px
|
||||||
'thumbnailQuality'=> 100,
|
'thumbnailQuality'=> 100,
|
||||||
'logo'=> ''
|
'logo'=> '',
|
||||||
|
'markdownParser'=> true
|
||||||
);
|
);
|
||||||
|
|
||||||
function __construct()
|
function __construct()
|
||||||
|
@ -68,8 +69,9 @@ class Site extends dbJSON {
|
||||||
// Check values on args or set default values
|
// Check values on args or set default values
|
||||||
foreach ($this->dbFields as $field=>$value) {
|
foreach ($this->dbFields as $field=>$value) {
|
||||||
if (isset($args[$field])) {
|
if (isset($args[$field])) {
|
||||||
// Sanitize if will be stored on database
|
|
||||||
$finalValue = Sanitize::html($args[$field]);
|
$finalValue = Sanitize::html($args[$field]);
|
||||||
|
if ($finalValue==='false') { $finalValue = false; }
|
||||||
|
elseif ($finalValue==='true') { $finalValue = true; }
|
||||||
settype($finalValue, gettype($value));
|
settype($finalValue, gettype($value));
|
||||||
$this->db[$field] = $finalValue;
|
$this->db[$field] = $finalValue;
|
||||||
}
|
}
|
||||||
|
@ -138,6 +140,11 @@ class Site extends dbJSON {
|
||||||
return $this->getField('extremeFriendly');
|
return $this->getField('extremeFriendly');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function markdownParser()
|
||||||
|
{
|
||||||
|
return $this->getField('markdownParser');
|
||||||
|
}
|
||||||
|
|
||||||
public function twitter()
|
public function twitter()
|
||||||
{
|
{
|
||||||
return $this->getField('twitter');
|
return $this->getField('twitter');
|
||||||
|
@ -168,12 +175,6 @@ class Site extends dbJSON {
|
||||||
return $this->getField('gitlab');
|
return $this->getField('gitlab');
|
||||||
}
|
}
|
||||||
|
|
||||||
// DEPRECATED since v3.5
|
|
||||||
public function googlePlus()
|
|
||||||
{
|
|
||||||
return $this->getField('googlePlus');
|
|
||||||
}
|
|
||||||
|
|
||||||
public function linkedin()
|
public function linkedin()
|
||||||
{
|
{
|
||||||
return $this->getField('linkedin');
|
return $this->getField('linkedin');
|
||||||
|
|
Loading…
Reference in New Issue