public function forTemplate()
 {
     if ($this->processShortcodes) {
         return ShortcodeParser::get_active()->parse($this->value);
     } else {
         return $this->value;
     }
 }
 public function parse()
 {
     $parsedown = new RestrictedMarkdownParser();
     $html = $parsedown->parse(ShortcodeParser::get_active()->parse($this->content));
     $config = HTMLPurifier_Config::createDefault();
     $purifier = new HTMLPurifier($config);
     $html = $purifier->purify($html);
     return $html;
 }
 function preview(SS_HTTPRequest $request)
 {
     $strValue = $request->requestVar('markdown');
     if ($strValue) {
         $shortCodeParser = ShortcodeParser::get_active();
         $strValue = $shortCodeParser->parse($strValue);
         $parseDown = new Parsedown();
         $strValue = $parseDown->text($strValue);
     }
     return $strValue;
 }
 /**
  * @return string
  * parse contents of the markdown field to tempates
  */
 function ParseMarkdown($bCache = true, $strValue = '')
 {
     if ($bCache && $this->parsedContent) {
         return $this->parsedContent;
     }
     $shortCodeParser = ShortcodeParser::get_active();
     $strParsed = $shortCodeParser->parse(!empty($strValue) ? $strValue : $this->value);
     $parseDown = new Parsedown();
     $strParsed = $parseDown->text($strParsed);
     if ($bCache) {
         $this->parsedContent = $strParsed;
     }
     return $strParsed;
 }
 function ParseMarkDown()
 {
     $parser = new Parsedown();
     $value = $this->value;
     $this->extend('onBeforeParseMarkDown', $value);
     $value = $parser->text($value);
     set_error_handler(array($this, 'onError'));
     try {
         $value = ShortcodeParser::get_active()->parse($value);
     } catch (Exception $e) {
     }
     restore_error_handler();
     $this->extend('onAfterParseMarkDown', $value);
     return $value;
 }
 public function forTemplate()
 {
     return ShortcodeParser::get_active()->parse($this->value);
 }
 public function tearDown()
 {
     ShortcodeParser::get_active()->unregister('test_shortcode');
     parent::tearDown();
 }
 /**
  * Get the localized value for a given field.
  * @param string $fieldName the name of the field without any locale extension. Eg. "Title"
  * @param boolean $strict if false, this will fallback to the master version of the field!
  * @param boolean $parseShortCodes whether or not the value should be parsed with the shortcode parser
  * @return string|DBField
  */
 public function getLocalizedValue($fieldName, $strict = true, $parseShortCodes = false)
 {
     $localizedField = $this->getLocalizedFieldName($fieldName);
     // ensure that $strict is a boolean value
     $strict = filter_var($strict, FILTER_VALIDATE_BOOLEAN);
     /** @var DBField $value */
     $value = $this->owner->dbObject($localizedField);
     if (!$strict && !$value->exists()) {
         $value = $this->owner->dbObject($fieldName);
     }
     return $parseShortCodes && $value ? ShortcodeParser::get_active()->parse($value->getValue()) : $value;
 }
<?php

define('PACKAGISTSHORTCODE_BASE', basename(dirname(__FILE__)));
//Enable the parser
ShortcodeParser::get_active()->register('packagist', array('PackagistShortCode', 'parse'));
 public function ShortcodeOutput()
 {
     if ($this->linkmode == 'Shortcode' && ($sc = $this->getShortcode())) {
         return ShortcodeParser::get_active()->parse($sc);
     }
     return null;
 }
 /**
  * Get the localized value for a given field.
  * @param string $fieldName the name of the field without any locale extension. Eg. "Title"
  * @param boolean $strict if false, this will fallback to the master version of the field!
  * @param boolean $parseShortCodes whether or not the value should be parsed with the shortcode parser
  */
 public function getLocalizedValue($fieldName, $strict = true, $parseShortCodes = false)
 {
     $localizedField = $this->getLocalizedFieldName($fieldName);
     $value = $this->owner->dbObject($localizedField);
     if (!$strict && $value == '') {
         $value = $this->owner->dbObject($fieldName);
     }
     return $parseShortCodes && $value ? ShortcodeParser::get_active()->parse($value->getValue()) : $value;
 }
 function forTemplate()
 {
     $parser = new Parsedown();
     $value = ShortcodeParser::get_active()->parse($this->value);
     return $parser->text($value);
 }
<?php

define('GITHUBSHORTCODE_BASE', basename(dirname(__FILE__)));
//Enable the parser
ShortcodeParser::get_active()->register('github', array('GitHubShortCode', 'parse'));
<?php

define('CB_BUILD_DATE', '@@BUILD_DATE@@');
define('CB_VERSION', '@@VERSION@@');
define('CB_DIR', basename(dirname(__FILE__)));
//Add the include path for the thirdparty folder (fixes zend api's)
set_include_path(get_include_path() . PATH_SEPARATOR . dirname(__FILE__) . '/thirdparty/');
//CMS Menu
CMSMenu::remove_menu_item('CodeBankAddSnippet');
CMSMenu::remove_menu_item('CodeBankEditSnippet');
CMSMenu::remove_menu_item('CodeBankSettings');
CMSMenu::remove_menu_item('CodeBankIPAgreement');
//Inject Menu Styles
LeftAndMain::require_css(CB_DIR . '/css/CodeBankMenu.css');
//Register Short Code
ShortcodeParser::get_active()->register('snippet', array('CodeBankShortCode', 'parse'));
 /**
  * Overrides the ContentControllerSearchExtension and adds snippets to results.
  *
  * @param array $data
  * @param SearchForm $form
  * @param SS_HTTPRequest $request
  * @return HTMLText
  */
 function results($data, $form, $request)
 {
     $result = null;
     $results = $form->getResults();
     $query = $form->getSearchQuery();
     // Add context summaries based on the queries.
     foreach ($results as $result) {
         $contextualTitle = new Text();
         $contextualTitle->setValue($result->MenuTitle ? $result->MenuTitle : $result->Title);
         $result->ContextualTitle = $contextualTitle->ContextSummary(300, $query);
         if (!$result->Content && $result->ClassName == 'File') {
             // Fake some content for the files.
             $result->ContextualContent = "A file named \"{$result->Name}\" ({$result->Size}).";
         } else {
             // /(.?)\[embed(.*?)\](.+?)\[\/\s*embed\s*\](.?)/gi
             $valueField = $result->obj('Content');
             $valueField->setValue(ShortcodeParser::get_active()->parse($valueField->getValue()));
             $result->ContextualContent = $valueField->ContextSummary(300, $query);
         }
     }
     $rssLink = HTTP::setGetVar('rss', '1');
     // Render the result.
     $context = array('Results' => $results, 'Query' => $query, 'Title' => _t('SearchForm.SearchResults', 'Search Results'), 'RSSLink' => $rssLink);
     // Choose the delivery method - rss or html.
     if (!$this->owner->request->getVar('rss')) {
         // Add RSS feed to normal search.
         RSSFeed::linkToFeed($rssLink, "Search results for query \"{$query}\".");
         $result = $this->owner->customise($context)->renderWith(array('Page_results', 'Page'));
     } else {
         // De-paginate and reorder. Sort-by-relevancy doesn't make sense in RSS context.
         $fullList = $results->getList()->sort('LastEdited', 'DESC');
         // Get some descriptive strings
         $siteName = SiteConfig::current_site_config()->Title;
         $siteTagline = SiteConfig::current_site_config()->Tagline;
         if ($siteName) {
             $title = "{$siteName} search results for query \"{$query}\".";
         } else {
             $title = "Search results for query \"{$query}\".";
         }
         // Generate the feed content.
         $rss = new RSSFeed($fullList, $this->owner->request->getURL(), $title, $siteTagline, "Title", "ContextualContent", null);
         $rss->setTemplate('Page_results_rss');
         $result = $rss->outputToBrowser();
     }
     return $result;
 }
 static function link_url($value)
 {
     return ShortcodeParser::get_active()->parse($value);
 }