diff --git a/flextype/Content.php b/flextype/Content.php index a2090081..6d36f164 100755 --- a/flextype/Content.php +++ b/flextype/Content.php @@ -73,14 +73,11 @@ class Content // Event: The page is not processed and not sent to the display. Event::dispatch('onPageBeforeRender'); - // Create Markdown Parser object - Content::$markdown = new Markdown(); + // Init Markdown + Content::initMarkdown(); - // Create Shortcode Parser object - Content::$shortcode = new ShortcodeFacade(); - - // Register default shortcodes - Content::registerDefaultShortcodes(); + // Init Shortcodes + Content::initShortcodes(); // Set current requested page data to $page array Content::$page = Content::getPage(Http::getUriString()); @@ -323,6 +320,17 @@ class Content } } + /** + * Returns $markdown object + * + * @access public + * @return object + */ + public static function markdown() : Markdown + { + return Content::$markdown; + } + /** * Returns $shortcode object * @@ -461,6 +469,39 @@ class Content }); } + /** + * Init Markdown + * + * @access protected + * @return void + */ + protected static function initMarkdown() : void + { + // Create Markdown Parser object + Content::$markdown = new Markdown(); + + // Event: Markdown initialized + Event::dispatch('onMarkdownInitialized'); + } + + /** + * Init Shortcodes + * + * @access protected + * @return void + */ + protected static function initShortcodes() : void + { + // Create Shortcode Parser object + Content::$shortcode = new ShortcodeFacade(); + + // Register default shortcodes + Content::registerDefaultShortcodes(); + + // Event: Shortcodes initialized and now we can add our custom shortcodes + Event::dispatch('onShortcodesInitialized'); + } + /** * Display current page *