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


PHP ContentObjectRenderer::parseFunc方法代码示例

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


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

示例1: render

 /**
  * Renders Lorem Ipsum paragraphs. If $lipsum is provided it
  * will be used as source text. If not provided as an argument
  * or as inline argument, $lipsum is fetched from TypoScript settings.
  *
  * @param string $lipsum String of paragraphs file path or EXT:myext/path/to/file
  * @return string
  */
 public function render($lipsum = null)
 {
     if (strlen($lipsum) === 0) {
         $lipsum = $this->lipsum;
     }
     if (strlen($lipsum) < 255 && !preg_match('/[^a-z0-9_\\.\\:\\/]/i', $lipsum) || 0 === strpos($lipsum, 'EXT:')) {
         // argument is most likely a file reference.
         $sourceFile = GeneralUtility::getFileAbsFileName($lipsum);
         if (file_exists($sourceFile)) {
             $lipsum = file_get_contents($sourceFile);
         } else {
             GeneralUtility::sysLog('Vhs LipsumViewHelper was asked to load Lorem Ipsum from a file which does not exist. ' . 'The file was: ' . $sourceFile, 'vhs', GeneralUtility::SYSLOG_SEVERITY_WARNING);
             $lipsum = $this->lipsum;
         }
     }
     $lipsum = preg_replace('/[\\r\\n]{1,}/i', "\n", $lipsum);
     $paragraphs = explode("\n", $lipsum);
     $paragraphs = array_slice($paragraphs, 0, intval($this->arguments['paragraphs']));
     foreach ($paragraphs as $index => $paragraph) {
         $length = $this->arguments['wordsPerParagraph'] + rand(0 - intval($this->arguments['skew']), intval($this->arguments['skew']));
         $words = explode(' ', $paragraph);
         $paragraphs[$index] = implode(' ', array_slice($words, 0, $length));
     }
     $lipsum = implode("\n", $paragraphs);
     if ($this->arguments['html']) {
         $tsParserPath = $this->arguments['parseFuncTSPath'] ? '< ' . $this->arguments['parseFuncTSPath'] : null;
         $lipsum = $this->contentObject->parseFunc($lipsum, [], $tsParserPath);
     }
     return $lipsum;
 }
开发者ID:fluidtypo3,项目名称:vhs,代码行数:38,代码来源:LipsumViewHelper.php

示例2: pi_RTEcssText

 /**
  * Will process the input string with the parseFunc function from ContentObjectRenderer based on configuration set in "lib.parseFunc_RTE" in the current TypoScript template.
  * This is useful for rendering of content in RTE fields where the transformation mode is set to "ts_css" or so.
  * Notice that this requires the use of "css_styled_content" to work right.
  *
  * @param string $str The input text string to process
  * @return string The processed string
  * @see ContentObjectRenderer::parseFunc()
  */
 public function pi_RTEcssText($str)
 {
     $parseFunc = $this->frontendController->tmpl->setup['lib.']['parseFunc_RTE.'];
     if (is_array($parseFunc)) {
         $str = $this->cObj->parseFunc($str, $parseFunc);
     }
     return $str;
 }
开发者ID:plan2net,项目名称:TYPO3.CMS,代码行数:17,代码来源:AbstractPlugin.php

示例3: pi_RTEcssText

 /**
  * Will process the input string with the parseFunc function from tslib_cObj based on configuration set in "lib.parseFunc_RTE" in the current TypoScript template.
  * This is useful for rendering of content in RTE fields where the transformation mode is set to "ts_css" or so.
  * Notice that this requires the use of "css_styled_content" to work right.
  *
  * @param string $str The input text string to process
  * @return string The processed string
  * @see tslib_cObj::parseFunc()
  * @todo Define visibility
  */
 public function pi_RTEcssText($str)
 {
     $parseFunc = $GLOBALS['TSFE']->tmpl->setup['lib.']['parseFunc_RTE.'];
     if (is_array($parseFunc)) {
         $str = $this->cObj->parseFunc($str, $parseFunc);
     }
     return $str;
 }
开发者ID:noxludo,项目名称:TYPO3v4-Core,代码行数:18,代码来源:AbstractPlugin.php

示例4: render

 /**
  * @param string $field
  * @param string $parseFuncTSPath
  * @param bool $raw
  * @return string
  */
 public function render($field, $parseFuncTSPath = 'lib.parseFunc_RTE', $raw = FALSE)
 {
     if (!$this->templateVariableContainer->exists('settings')) {
         return $this->renderChildren();
     }
     $settings = $this->templateVariableContainer->get('settings');
     if (isset($settings['pluginConfiguration']) && is_array($settings['pluginConfiguration'])) {
         $val = Arr::safePath($settings['pluginConfiguration'], $field);
         if ($val && $val !== '') {
             if ($raw) {
                 return $val;
             }
             $this->simulateFrontendEnvironment();
             $content = $this->contentObject->parseFunc($val, array(), '< ' . $parseFuncTSPath);
             $this->resetFrontendEnvironment();
             return $content;
         }
     }
     return $this->renderChildren();
 }
开发者ID:electricretina,项目名称:cicbase,代码行数:26,代码来源:FlexTextViewHelper.php

示例5: render

 /**
  * @param string $parseFuncTSPath path to TypoScript parseFunc setup.
  * @return string the parsed string.
  */
 public function render($parseFuncTSPath = 'lib.parseFunc_RTE')
 {
     if (TYPO3_MODE === 'BE') {
         $this->simulateFrontendEnvironment();
     }
     $value = $this->renderChildren();
     $content = $this->contentObject->parseFunc($value, array(), '< ' . $parseFuncTSPath);
     if (TYPO3_MODE === 'BE') {
         $this->resetFrontendEnvironment();
     }
     return $content;
 }
开发者ID:khanhdeux,项目名称:typo3test,代码行数:16,代码来源:HtmlViewHelper.php

示例6: render

 /**
  * @param string $parseFuncTSPath path to TypoScript parseFunc setup.
  * @return the parsed string.
  * @author Bastian Waidelich <bastian@typo3.org>
  * @author Niels Pardon <mail@niels-pardon.de>
  */
 public function render($parseFuncTSPath = 'lib.parseFunc_RTE')
 {
     if (TYPO3_MODE === 'BE') {
         $this->simulateFrontendEnvironment();
     }
     $value = $this->renderChildren();
     $value = $this->htmlSubstr($value, 0, 200, true, '...');
     \TYPO3\CMS\Core\Utility\DebugUtility::debug($value, 'value');
     $content = $this->contentObject->parseFunc($value, array(), '< ' . $parseFuncTSPath);
     if (TYPO3_MODE === 'BE') {
         $this->resetFrontendEnvironment();
     }
     return $content;
 }
开发者ID:electricretina,项目名称:cicbase,代码行数:20,代码来源:CropHtmlViewHelper.php


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