/** * 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; }
/** * 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; }
/** * 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; }
/** * @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(); }
/** * @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; }
/** * @param string $parseFuncTSPath path to TypoScript parseFunc setup. * @return the parsed string. * @author Bastian Waidelich <*****@*****.**> * @author Niels Pardon <*****@*****.**> */ 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; }