Make it possible to disable images

This commit is contained in:
Fredrick Brennan 2015-03-29 08:35:33 +08:00
parent 468d1e3da8
commit d264130ab9

View File

@ -75,6 +75,16 @@ class Parsedown
protected $urlsLinked = true; protected $urlsLinked = true;
function setImagesEnabled($imagesEnabled)
# Note: You should also set markupEscaped to disable images, otherwise people can still use <img> tags.
{
$this->imagesEnabled = $imagesEnabled;
return $this;
}
protected $imagesEnabled = true;
# #
# Lines # Lines
# #
@ -1136,7 +1146,7 @@ class Parsedown
protected function inlineImage($Excerpt) protected function inlineImage($Excerpt)
{ {
if ( ! isset($Excerpt['text'][1]) or $Excerpt['text'][1] !== '[') if ( ! isset($Excerpt['text'][1]) or $Excerpt['text'][1] !== '[' or ! $this->imagesEnabled )
{ {
return; return;
} }