当前位置: 首页>>代码示例>>PHP>>正文


PHP ShortcodeParser::get_active方法代码示例

本文整理汇总了PHP中ShortcodeParser::get_active方法的典型用法代码示例。如果您正苦于以下问题:PHP ShortcodeParser::get_active方法的具体用法?PHP ShortcodeParser::get_active怎么用?PHP ShortcodeParser::get_active使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ShortcodeParser的用法示例。


在下文中一共展示了ShortcodeParser::get_active方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: forTemplate

 public function forTemplate()
 {
     if ($this->processShortcodes) {
         return ShortcodeParser::get_active()->parse($this->value);
     } else {
         return $this->value;
     }
 }
开发者ID:jakedaleweb,项目名称:AtomCodeChallenge,代码行数:8,代码来源:HTMLVarchar.php

示例2: parse

 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;
 }
开发者ID:helpfulrobot,项目名称:silverstripe-microblog,代码行数:9,代码来源:RestrictedMarkdown.php

示例3: preview

 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;
 }
开发者ID:helpfulrobot,项目名称:silverstripers-silverstripe-markdown,代码行数:11,代码来源:MarkdownEditorField.php

示例4: ParseMarkdown

 /**
  * @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;
 }
开发者ID:helpfulrobot,项目名称:silverstripers-silverstripe-markdown,代码行数:18,代码来源:MarkdownField.php

示例5: ParseMarkDown

 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;
 }
开发者ID:helpfulrobot,项目名称:undefinedoffset-silverstripe-markdown,代码行数:15,代码来源:MarkdownText.php

示例6: forTemplate

 public function forTemplate()
 {
     return ShortcodeParser::get_active()->parse($this->value);
 }
开发者ID:comperio,项目名称:silverstripe-framework,代码行数:4,代码来源:HTMLText.php

示例7: tearDown

 public function tearDown()
 {
     ShortcodeParser::get_active()->unregister('test_shortcode');
     parent::tearDown();
 }
开发者ID:jakedaleweb,项目名称:AtomCodeChallenge,代码行数:5,代码来源:XMLDataFormatterTest.php

示例8: getLocalizedValue

 /**
  * 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;
 }
开发者ID:bummzack,项目名称:translatable-dataobject,代码行数:19,代码来源:TranslatableDataObject.php

示例9: define

<?php

define('PACKAGISTSHORTCODE_BASE', basename(dirname(__FILE__)));
//Enable the parser
ShortcodeParser::get_active()->register('packagist', array('PackagistShortCode', 'parse'));
开发者ID:helpfulrobot,项目名称:webbuilders-group-silverstripe-packagistshortcode,代码行数:5,代码来源:_config.php

示例10: ShortcodeOutput

 public function ShortcodeOutput()
 {
     if ($this->linkmode == 'Shortcode' && ($sc = $this->getShortcode())) {
         return ShortcodeParser::get_active()->parse($sc);
     }
     return null;
 }
开发者ID:micschk,项目名称:silverstripe-namedlinkfield,代码行数:7,代码来源:NamedLinkField.php

示例11: getLocalizedValue

 /**
  * 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;
 }
开发者ID:helpfulrobot,项目名称:bummzack-translatable-dataobject,代码行数:15,代码来源:TranslatableDataObject.php

示例12: forTemplate

 function forTemplate()
 {
     $parser = new Parsedown();
     $value = ShortcodeParser::get_active()->parse($this->value);
     return $parser->text($value);
 }
开发者ID:helpfulrobot,项目名称:undefinedoffset-silverstripe-markdown,代码行数:6,代码来源:MarkdownVarchar.php

示例13: define

<?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'));
开发者ID:helpfulrobot,项目名称:undefinedoffset-silverstripe-codebank,代码行数:16,代码来源:_config.php

示例14: results

 /**
  * 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;
 }
开发者ID:helpfulrobot,项目名称:gdmedia-silverstripe-gdm-extensions,代码行数:54,代码来源:SSGuru_ContentController.php

示例15: link_url

 static function link_url($value)
 {
     return ShortcodeParser::get_active()->parse($value);
 }
开发者ID:nathancox,项目名称:silverstripe-linkfield,代码行数:4,代码来源:LinkField.php


注:本文中的ShortcodeParser::get_active方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。