Exemple #1
0
 /**
  * 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) {
         $this->getDefaultLoremIpsum();
     }
     if (strlen($lipsum) < 255 && !preg_match('/[^a-z0-9_\\./]/i', $lipsum)) {
         // argument is most likely a file reference.
         $sourceFile = t3lib_div::getFileAbsFileName($lipsum);
         if (file_exists($sourceFile) === TRUE) {
             $lipsum = file_get_contents($sourceFile);
         } else {
             t3lib_div::sysLog('Vhs LipsumViewHelper was asked to load Lorem Ipsum from a file which does not exist. ' . 'The file was: ' . $sourceFile, 'Vhs');
             $lipsum = $this->getDefaultLoremIpsum();
         }
     }
     $lipsum = preg_replace('/[\\r\\n]{1,}/i', "\n", $lipsum);
     $paragraphs = explode("\n", $lipsum);
     $paragraphs = array_slice($paragraphs, 0, intval($settings['paragraphs']));
     foreach ($paragraphs as $index => $paragraph) {
         $length = $settings['wordsPerParagraph'] + rand(0 - intval($settings['skew']), intval($settings['skew']));
         $words = explode(' ', $paragraph);
         $paragraphs[$index] = implode(' ', array_slice($words, 0, $length));
     }
     $lipsum = implode("\n", $paragraphs);
     if ((bool) $settings['html'] === TRUE) {
         $lipsum = $this->contentObject->parseFunc($lipsum, array(), '< ' . $settings['parseFuncTSPath']);
     }
     return $lipsum;
 }
 /**
  * @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();
     $content = $this->contentObject->parseFunc($value, array(), '< ' . $parseFuncTSPath);
     if (TYPO3_MODE === 'BE') {
         $this->resetFrontendEnvironment();
     }
     return $content;
 }
 /**
  * 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		The input text string to process
  * @return	string		The processed string
  * @see tslib_cObj::parseFunc()
  */
 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 $parseFuncTSPath path to TypoScript parseFunc setup.
  * @return the parsed string.
  * @author Bastian Waidelich <*****@*****.**>
  * @author Niels Pardon <*****@*****.**>
  */
 public function render($parseFuncTSPath = 'lib.parseFunc_RTE')
 {
     $value = $this->renderChildren();
     return $this->contentObject->parseFunc($value, array(), '< ' . $parseFuncTSPath);
 }