Various small improvements
This commit is contained in:
parent
bdafcb5b96
commit
646aa355e5
@ -1559,8 +1559,11 @@ class Pico
|
|||||||
public function getParsedown()
|
public function getParsedown()
|
||||||
{
|
{
|
||||||
if ($this->parsedown === null) {
|
if ($this->parsedown === null) {
|
||||||
$className = $this->config['content_config']['extra'] ? '\ParsedownExtra' : '\Parsedown';
|
if ($this->config['content_config']['extra']) {
|
||||||
$this->parsedown = new $className();
|
$this->parsedown = new \ParsedownExtra();
|
||||||
|
} else {
|
||||||
|
$this->parsedown = new \Parsedown();
|
||||||
|
}
|
||||||
|
|
||||||
$this->parsedown->setBreaksEnabled((bool) $this->config['content_config']['breaks']);
|
$this->parsedown->setBreaksEnabled((bool) $this->config['content_config']['breaks']);
|
||||||
$this->parsedown->setMarkupEscaped((bool) $this->config['content_config']['escape']);
|
$this->parsedown->setMarkupEscaped((bool) $this->config['content_config']['escape']);
|
||||||
|
@ -14,6 +14,7 @@ namespace picocms\Pico;
|
|||||||
|
|
||||||
use Twig\Error\RuntimeError as TwigRuntimeError;
|
use Twig\Error\RuntimeError as TwigRuntimeError;
|
||||||
use Twig\Extension\AbstractExtension as AbstractTwigExtension;
|
use Twig\Extension\AbstractExtension as AbstractTwigExtension;
|
||||||
|
use Twig\Extension\ExtensionInterface as TwigExtensionInterface;
|
||||||
use Twig\TwigFilter;
|
use Twig\TwigFilter;
|
||||||
use Twig\TwigFunction;
|
use Twig\TwigFunction;
|
||||||
|
|
||||||
@ -60,7 +61,7 @@ class TwigExtension extends AbstractTwigExtension
|
|||||||
/**
|
/**
|
||||||
* Returns the name of the extension
|
* Returns the name of the extension
|
||||||
*
|
*
|
||||||
* @see Twig_ExtensionInterface::getName()
|
* @see TwigExtensionInterface::getName()
|
||||||
*
|
*
|
||||||
* @return string the extension name
|
* @return string the extension name
|
||||||
*/
|
*/
|
||||||
@ -72,7 +73,7 @@ class TwigExtension extends AbstractTwigExtension
|
|||||||
/**
|
/**
|
||||||
* Returns a list of Pico-specific Twig filters
|
* Returns a list of Pico-specific Twig filters
|
||||||
*
|
*
|
||||||
* @see Twig_ExtensionInterface::getFilters()
|
* @see TwigExtensionInterface::getFilters()
|
||||||
*
|
*
|
||||||
* @return TwigFilter[] array of Pico's Twig filters
|
* @return TwigFilter[] array of Pico's Twig filters
|
||||||
*/
|
*/
|
||||||
@ -94,7 +95,7 @@ class TwigExtension extends AbstractTwigExtension
|
|||||||
/**
|
/**
|
||||||
* Returns a list of Pico-specific Twig functions
|
* Returns a list of Pico-specific Twig functions
|
||||||
*
|
*
|
||||||
* @see Twig_ExtensionInterface::getFunctions()
|
* @see TwigExtensionInterface::getFunctions()
|
||||||
*
|
*
|
||||||
* @return TwigFunction[] array of Pico's Twig functions
|
* @return TwigFunction[] array of Pico's Twig functions
|
||||||
*/
|
*/
|
||||||
@ -406,7 +407,7 @@ class TwigExtension extends AbstractTwigExtension
|
|||||||
* returns Pico's full pages array.
|
* returns Pico's full pages array.
|
||||||
*
|
*
|
||||||
* If `$depth` is negative after taking `$offset` into consideration, the
|
* If `$depth` is negative after taking `$offset` into consideration, the
|
||||||
* function will throw a {@see Twig_Error_Runtime} exception, since this
|
* function will throw a {@see TwigRuntimeError} exception, since this
|
||||||
* would simply make no sense and is likely an error. Passing a negative
|
* would simply make no sense and is likely an error. Passing a negative
|
||||||
* `$depthOffset` is equivalent to passing `$depthOffset = 0`.
|
* `$depthOffset` is equivalent to passing `$depthOffset = 0`.
|
||||||
*
|
*
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
|
|
||||||
use picocms\Pico\AbstractPlugin;
|
use picocms\Pico\AbstractPlugin;
|
||||||
use picocms\Pico\Pico;
|
use picocms\Pico\Pico;
|
||||||
|
use Twig\Environment as TwigEnvironment;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pico dummy plugin - a template for plugins
|
* Pico dummy plugin - a template for plugins
|
||||||
@ -31,7 +32,7 @@ class DummyPlugin extends AbstractPlugin
|
|||||||
*
|
*
|
||||||
* @var int
|
* @var int
|
||||||
*/
|
*/
|
||||||
const API_VERSION = 3;
|
public const API_VERSION = 3;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This plugin is disabled by default
|
* This plugin is disabled by default
|
||||||
@ -39,8 +40,8 @@ class DummyPlugin extends AbstractPlugin
|
|||||||
* Usually you should remove this class property (or set it to NULL) to
|
* Usually you should remove this class property (or set it to NULL) to
|
||||||
* leave the decision whether this plugin should be enabled or disabled by
|
* leave the decision whether this plugin should be enabled or disabled by
|
||||||
* default up to Pico. If all the plugin's dependenies are fulfilled (see
|
* default up to Pico. If all the plugin's dependenies are fulfilled (see
|
||||||
* {@see DummyPlugin::$dependsOn}), Pico enables the plugin by default.
|
* {@see self::$dependsOn}), Pico enables the plugin by default. Otherwise
|
||||||
* Otherwise the plugin is silently disabled.
|
* the plugin is silently disabled.
|
||||||
*
|
*
|
||||||
* If this plugin should never be disabled *silently* (e.g. when dealing
|
* If this plugin should never be disabled *silently* (e.g. when dealing
|
||||||
* with security-relevant stuff like access control, or similar), set this
|
* with security-relevant stuff like access control, or similar), set this
|
||||||
@ -498,9 +499,9 @@ class DummyPlugin extends AbstractPlugin
|
|||||||
*
|
*
|
||||||
* @see Pico::getTwig()
|
* @see Pico::getTwig()
|
||||||
*
|
*
|
||||||
* @param Twig_Environment &$twig Twig instance
|
* @param TwigEnvironment &$twig Twig instance
|
||||||
*/
|
*/
|
||||||
public function onTwigRegistered(Twig_Environment &$twig)
|
public function onTwigRegistered(TwigEnvironment &$twig)
|
||||||
{
|
{
|
||||||
// your code
|
// your code
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user