本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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();
}
示例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;
}
示例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;
}