PageRenderTime 44ms CodeModel.GetById 11ms RepoModel.GetById 0ms app.codeStats 0ms

/typo3/sysext/cms/tslib/media/scripts/plaintextLib.inc

https://bitbucket.org/linxpinx/mercurial
PHP | 673 lines | 320 code | 73 blank | 280 comment | 45 complexity | 3235e1775ea33a20c369fc4e358c46d9 MD5 | raw file
Possible License(s): BSD-3-Clause, GPL-2.0, Unlicense, LGPL-2.1, Apache-2.0
  1. <?php
  2. /***************************************************************
  3. * Copyright notice
  4. *
  5. * (c) 1999-2009 Kasper Skaarhoj (kasperYYYY@typo3.com)
  6. * All rights reserved
  7. *
  8. * This script is part of the TYPO3 project. The TYPO3 project is
  9. * free software; you can redistribute it and/or modify
  10. * it under the terms of the GNU General Public License as published by
  11. * the Free Software Foundation; either version 2 of the License, or
  12. * (at your option) any later version.
  13. *
  14. * The GNU General Public License can be found at
  15. * http://www.gnu.org/copyleft/gpl.html.
  16. * A copy is found in the textfile GPL.txt and important notices to the license
  17. * from the author is found in LICENSE.txt distributed with these scripts.
  18. *
  19. *
  20. * This script is distributed in the hope that it will be useful,
  21. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  22. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  23. * GNU General Public License for more details.
  24. *
  25. * This copyright notice MUST APPEAR in all copies of the script!
  26. ***************************************************************/
  27. /**
  28. * Generating plain text content of content elements for Direct Mails
  29. *
  30. * $Id: plaintextLib.inc 7601 2010-05-13 17:12:58Z baschny $
  31. * Revised for TYPO3 3.6 June/2003 by Kasper Skaarhoj
  32. *
  33. * @author Kasper Skaarhoj <kasperYYYY@typo3.com>
  34. */
  35. /**
  36. * [CLASS/FUNCTION INDEX of SCRIPT]
  37. *
  38. *
  39. *
  40. * 123: class user_plaintext
  41. * 137: function main_plaintext($content,$conf)
  42. * 209: function getMenuSitemap()
  43. * 220: function getShortcut()
  44. * 231: function getHTML($str=array())
  45. * 241: function getHeader()
  46. * 251: function getImages()
  47. * 262: function parseBody($str)
  48. * 284: function renderUploads($str,$upload_path='uploads/media/')
  49. * 302: function renderHeader($str,$type=0)
  50. * 353: function pad($lines,$preLineChar,$len)
  51. * 369: function breakContent($str)
  52. * 385: function breakBulletlist($str)
  53. * 416: function breakTable($str)
  54. * 472: function addDiv($messure,$content,$divChar,$joinChar,$cols)
  55. * 488: function traverseTable($tableLines)
  56. * 515: function renderImages($str,$links,$caption,$upload_path='uploads/pics/')
  57. * 554: function getLink($ll)
  58. * 571: function breakLines($str,$implChar="\n",$charWidth=0)
  59. * 583: function getString($str)
  60. * 595: function userProcess($mConfKey,$passVar)
  61. * 613: function atag_to_http($content,$conf)
  62. * 632: function typolist($content,$conf)
  63. * 647: function typohead($content,$conf)
  64. * 666: function typocode($content,$conf)
  65. *
  66. * TOTAL FUNCTIONS: 24
  67. * (This index is automatically created/updated by the extension "extdeveval")
  68. *
  69. */
  70. /**
  71. * Alternative rendering of content elements for Plain Text emails. That means text-only output. No HTML at all. Used by the Direct Mail extension.
  72. * Normally the plain text output should appear with type=99.
  73. * To use this library you can include the static template "plugin.alt.plaintext"
  74. *
  75. * ## Insert DMailer Boundaries for all elements.
  76. * config.insertDmailerBoundaries = 1
  77. * includeLibs.plaintextLib = media/scripts/plaintextLib.inc
  78. *
  79. * ## Set up page/type number:
  80. * alt_plaintext >
  81. * alt_plaintext = PAGE
  82. * alt_plaintext.typeNum=99
  83. * alt_plaintext.config.disableAllHeaderCode = 1
  84. * alt_plaintext.10 = TEMPLATE
  85. * alt_plaintext.10 {
  86. * template = FILE
  87. * template.file = {$plugin.alt.plaintext.file.template}
  88. * marks.CONTENT < styles.content.get
  89. * marks.CONTENT.renderObj = < lib.alt_plaintext.renderObj
  90. * marks.DATE = TEXT
  91. * marks.DATE.data = date:U
  92. * marks.DATE.strftime = %e. %B %Y
  93. * }
  94. *
  95. * (And then also "lib.alt_plaintext.renderObj" is configured extensively - basically with the TypoScript options passed to this class. See the static template "plugin.alt.plaintext")
  96. *
  97. * @author Kasper Skaarhoj <kasperYYYY@typo3.com>
  98. * @package TYPO3
  99. * @subpackage tslib
  100. * @link http://typo3.org/doc.0.html?&tx_extrepmgm_pi1[extUid]=270&tx_extrepmgm_pi1[tocEl]=398&cHash=e3024de334
  101. */
  102. class user_plaintext {
  103. var $cObj;
  104. var $conf=array();
  105. var $charWidth=76;
  106. /**
  107. * Main function, called from TypoScript
  108. * A content object that renders "tt_content" records. See the comment to this class for TypoScript example of how to trigger it.
  109. * This detects the CType of the current content element and renders it accordingly. Only wellknown types are rendered.
  110. *
  111. * @param string Empty, ignore.
  112. * @param array TypoScript properties for this content object/function call
  113. * @return string Plain text content
  114. */
  115. function main_plaintext($content,$conf) {
  116. $this->conf = $conf;
  117. $this->siteUrl=$conf['siteUrl'];
  118. $lines = array();
  119. $CType= (string)$this->cObj->data['CType'];
  120. switch($CType) {
  121. case 'header':
  122. $lines[]=$this->getHeader();
  123. if ($this->cObj->data['subheader']) {
  124. $lines[]=$this->breakContent(strip_tags($this->cObj->data['subheader']));
  125. }
  126. break;
  127. case 'text':
  128. case 'textpic':
  129. $lines[]=$this->getHeader();
  130. if ($CType=='textpic' && !($this->cObj->data['imageorient']&24)) {
  131. $lines[]=$this->getImages();
  132. $lines[]='';
  133. }
  134. $lines[]=$this->breakContent(strip_tags($this->parseBody($this->cObj->data['bodytext'])));
  135. if ($CType=='textpic' && ($this->cObj->data['imageorient']&24)) {
  136. $lines[]='';
  137. $lines[]=$this->getImages();
  138. }
  139. break;
  140. case 'image':
  141. $lines[]=$this->getHeader();
  142. $lines[]=$this->getImages();
  143. break;
  144. case 'uploads':
  145. $lines[]=$this->getHeader();
  146. $lines[]=$this->renderUploads($this->cObj->data['media']);
  147. break;
  148. case 'menu':
  149. $lines[]=$this->getHeader();
  150. $lines[]=$this->getMenuSitemap();
  151. break;
  152. case 'shortcut':
  153. $lines[]=$this->getShortcut();
  154. break;
  155. case 'bullets':
  156. $lines[]=$this->getHeader();
  157. $lines[]=$this->breakBulletlist(strip_tags($this->parseBody($this->cObj->data['bodytext'])));
  158. break;
  159. case 'table':
  160. $lines[]=$this->getHeader();
  161. $lines[]=$this->breakTable(strip_tags($this->parseBody($this->cObj->data['bodytext'])));
  162. break;
  163. case 'html':
  164. $lines[]=$this->getHTML();
  165. break;
  166. default:
  167. $defaultOutput = $this->getString($this->conf['defaultOutput']);
  168. if ($defaultOutput) {
  169. $lines[]=str_replace('###CType###',$CType,$defaultOutput);
  170. }
  171. break;
  172. }
  173. $lines[]=''; // First break.
  174. $content = implode(chr(10),$lines);
  175. // User processing:
  176. $content=$this->userProcess('userProc',$content);
  177. return $content;
  178. }
  179. /**
  180. * Creates a menu/sitemap
  181. *
  182. * @return string Content
  183. */
  184. function getMenuSitemap() {
  185. $str = $this->cObj->cObjGetSingle($this->conf['menu'],$this->conf['menu.']);
  186. $str = $this->breakBulletlist(trim(strip_tags(preg_replace('/<br[ \/]*>/i',chr(10),$this->parseBody($str)))));
  187. return $str;
  188. }
  189. /**
  190. * Creates a shortcut ("Insert Records")
  191. *
  192. * @return string Content
  193. */
  194. function getShortcut() {
  195. $str = $this->cObj->cObjGetSingle($this->conf['shortcut'],$this->conf['shortcut.']);
  196. return $str;
  197. }
  198. /**
  199. * Creates an HTML element (stripping tags of course)
  200. *
  201. * @param string HTML content to process. If not passed along, the bodytext field is used.
  202. * @return string Content
  203. */
  204. function getHTML($str=array()) {
  205. return $this->breakContent(strip_tags(preg_replace('/<br[ \/]*>/i',chr(10),$this->parseBody(is_string($str)?$str:$this->cObj->data['bodytext']))));
  206. }
  207. /**
  208. * Creates a header (used for most elements)
  209. *
  210. * @return string Content
  211. * @see renderHeader()
  212. */
  213. function getHeader() {
  214. // links...
  215. return $this->renderHeader($this->cObj->data['header'],$this->cObj->data['header_layout']);
  216. }
  217. /**
  218. * Get images found in the "image" field of "tt_content"
  219. *
  220. * @return string Content
  221. */
  222. function getImages() {
  223. $images = $this->renderImages($this->cObj->data['image'],!$this->cObj->data['image_zoom']?$this->cObj->data['image_link']:'',$this->cObj->data['imagecaption']);
  224. return $images;
  225. }
  226. /**
  227. * Parsing the bodytext field content, removing typical entities and <br /> tags.
  228. *
  229. * @param string Field content from "bodytext"
  230. * @return string Processed content
  231. */
  232. function parseBody($str) {
  233. // First, regular parsing:
  234. $str = preg_replace('/<br[ \/]*>/i',' ',$str);
  235. $str = $this->cObj->stdWrap($str,$this->conf['bodytext.']['stdWrap.']);
  236. // Then all a-tags:
  237. $aConf = array();
  238. $aConf['parseFunc.']['tags.']['a']='USER';
  239. $aConf['parseFunc.']['tags.']['a.']['userFunc']='user_plaintext->atag_to_http';
  240. $aConf['parseFunc.']['tags.']['a.']['siteUrl'] = $this->siteUrl;
  241. $str = $this->cObj->stdWrap($str,$aConf);
  242. $str = str_replace('&nbsp;',' ',t3lib_div::htmlspecialchars_decode($str));
  243. return $str;
  244. }
  245. /**
  246. * Creates a list of links to uploaded files.
  247. *
  248. * @param string List of uploaded filenames from "uploads/media/" (or $upload_path)
  249. * @param string Alternative path value
  250. * @return string Content
  251. */
  252. function renderUploads($str,$upload_path='uploads/media/') {
  253. $files = explode(',',$str);
  254. $lines=array();
  255. if ($this->conf['uploads.']['header']) {$lines[]=$this->getString($this->conf['uploads.']['header']);}
  256. foreach ($files as $k => $file) {
  257. $lines[]=$this->siteUrl.$upload_path.$file;
  258. }
  259. return implode(chr(10),$lines);
  260. }
  261. /**
  262. * Renders a content element header, observing the layout type giving different header formattings
  263. *
  264. * @param string The header string
  265. * @param integer The layout type of the header (in the content element)
  266. * @return string Content
  267. */
  268. function renderHeader($str,$type=0) {
  269. if ($str) {
  270. $hConf = $this->conf['header.'];
  271. $defaultType = t3lib_div::intInRange($hConf['defaultType'],1,5);
  272. $type=t3lib_div::intInRange($type,0,6);
  273. if (!$type) $type=$defaultType;
  274. if ($type!=6) { // not hidden
  275. $tConf = $hConf[$type.'.'];
  276. $lines=array();
  277. $blanks = t3lib_div::intInRange($tConf['preBlanks'],0,1000);
  278. if ($blanks) {
  279. $lines[]=str_pad('', $blanks-1, chr(10));
  280. }
  281. $lines=$this->pad($lines,$tConf['preLineChar'],$tConf['preLineLen']);
  282. $blanks = t3lib_div::intInRange($tConf['preLineBlanks'],0,1000);
  283. if ($blanks) {$lines[]=str_pad('', $blanks-1, chr(10));}
  284. if ($this->cObj->data['date']) {
  285. $lines[] = $this->getString($hConf['datePrefix']).date($hConf['date']?$hConf['date']:$GLOBALS['TYPO3_CONF_VARS']['SYS']['ddmmyy'],$this->cObj->data['date']);
  286. }
  287. $prefix='';
  288. $str=$this->getString($tConf['prefix']).$str;
  289. if ($tConf['autonumber']) $str=$this->cObj->parentRecordNumber.$str;
  290. if ($this->cObj->data['header_position']=='right') {$prefix=str_pad(' ',($this->charWidth-strlen($str)));}
  291. if ($this->cObj->data['header_position']=='center') {$prefix=str_pad(' ',floor(($this->charWidth-strlen($str))/2));}
  292. $lines[]=$this->cObj->stdWrap($prefix.$str,$tConf['stdWrap.']);
  293. if ($this->cObj->data['header_link']) {$lines[] = $this->getString($hConf['linkPrefix']).$this->getLink($this->cObj->data['header_link']);}
  294. $blanks = t3lib_div::intInRange($tConf['postLineBlanks'],0,1000);
  295. if ($blanks) {$lines[]=str_pad('', $blanks-1, chr(10));}
  296. $lines=$this->pad($lines,$tConf['postLineChar'],$tConf['postLineLen']);
  297. $blanks = t3lib_div::intInRange($tConf['postBlanks'],0,1000);
  298. if ($blanks) {$lines[]=str_pad('', $blanks-1, chr(10));}
  299. return implode(chr(10),$lines);
  300. }
  301. }
  302. }
  303. /**
  304. * Function used to repeat a char pattern in head lines (like if you want "********" above/below a header)
  305. *
  306. * @param array Array of existing lines to which the new char-pattern should be added
  307. * @param string The character pattern to repeat. Default is "-"
  308. * @param integer The length of the line. $preLineChar will be repeated to fill in this length.
  309. * @return array The input array with a new line added.
  310. * @see renderHeader()
  311. */
  312. function pad($lines,$preLineChar,$len) {
  313. $strPad = t3lib_div::intInRange($len,0,1000);
  314. $strPadChar = $preLineChar?$preLineChar:'-';
  315. if ($strPad) {
  316. $lines[]=str_pad('', $strPad, $strPadChar);
  317. }
  318. return $lines;
  319. }
  320. /**
  321. * Function used to wrap the bodytext field content (or image caption) into lines of a max length of
  322. *
  323. * @param string The content to break
  324. * @return string Processed value.
  325. * @see main_plaintext(), breakLines()
  326. */
  327. function breakContent($str) {
  328. $cParts = explode(chr(10),$str);
  329. $lines=array();
  330. foreach ($cParts as $substrs) {
  331. $lines[]=$this->breakLines($substrs);
  332. }
  333. return implode(chr(10),$lines);
  334. }
  335. /**
  336. * Breaks content lines into a bullet list
  337. *
  338. * @param string Content string to make into a bullet list
  339. * @return string Processed value
  340. */
  341. function breakBulletlist($str) {
  342. $type = $this->cObj->data['layout'];
  343. $type=t3lib_div::intInRange($type,0,3);
  344. $tConf = $this->conf['bulletlist.'][$type.'.'];
  345. $cParts = explode(chr(10),$str);
  346. $lines=array();
  347. $c=0;
  348. foreach ($cParts as $substrs) {
  349. $c++;
  350. $bullet = $tConf['bullet'] ? $this->getString($tConf['bullet']) : ' - ';
  351. $bLen=strlen($bullet);
  352. $bullet = substr(str_replace('#',$c,$bullet),0,$bLen);
  353. $secondRow = substr($tConf['secondRow']?$this->getString($tConf['secondRow']):str_pad('',strlen($bullet),' '),0,$bLen);
  354. $lines[]=$bullet.$this->breakLines($substrs,chr(10).$secondRow,$this->charWidth-$bLen);
  355. $blanks = t3lib_div::intInRange($tConf['blanks'],0,1000);
  356. if ($blanks) {$lines[]=str_pad('', $blanks-1, chr(10));}
  357. }
  358. return implode(chr(10),$lines);
  359. }
  360. /**
  361. * Formatting a table in plain text (based on the paradigm of lines being content rows and cells separated by "|")
  362. *
  363. * @param string Content string
  364. * @return string Processed value
  365. */
  366. function breakTable($str) {
  367. $cParts = explode(chr(10),$str);
  368. $lines=array();
  369. $cols = intval($this->conf['cols']) ? intval($this->conf['cols']) : 0 ;
  370. $c=0;
  371. foreach ($cParts as $substrs) {
  372. $c++;
  373. if (trim($substrs)) {
  374. $lineParts=explode('|',$substrs);
  375. if (!$cols) $cols=count($lineParts);
  376. for ($a=0;$a<$cols;$a++) {
  377. $jdu = explode(chr(10),$this->breakLines($lineParts[$a],chr(10),ceil($this->charWidth/$cols)));
  378. $lines[$c][$a]=$jdu;
  379. }
  380. }
  381. }
  382. $messure = $this->traverseTable($lines);
  383. $divChar='-';
  384. $joinChar='+';
  385. $colChar='|';
  386. // Make table:
  387. $outLines = array();
  388. $outLines[]=$this->addDiv($messure,'',$divChar,$joinChar,$cols);
  389. foreach ($lines as $k => $v) {
  390. $top = intval($messure[1][$k]);
  391. for ($aa=0;$aa<$top;$aa++) {
  392. $tempArr=array();
  393. for ($bb=0;$bb<$cols;$bb++) {
  394. $tempArr[$bb]=str_pad($v[$bb][$aa],$messure[0][$bb],' ');
  395. }
  396. $outLines[]=$colChar.implode($colChar,$tempArr).$colChar;
  397. }
  398. $outLines[]=$this->addDiv($messure,'',$divChar,$joinChar,$cols);
  399. }
  400. return implode(chr(10),$outLines);
  401. }
  402. /**
  403. * Subfunction for breakTable(): Adds a divider line between table rows.
  404. *
  405. * @param array Some information about sizes
  406. * @param string Empty string.
  407. * @param string Character to use for the divider line, typically "-"
  408. * @param string Join character, typically "+"
  409. * @param integer Number of table columns
  410. * @return string Divider line for the table
  411. * @access private
  412. * @see breakTable()
  413. */
  414. function addDiv($messure,$content,$divChar,$joinChar,$cols) {
  415. $tempArr=array();
  416. for ($a=0;$a<$cols;$a++) {
  417. $tempArr[$a]=str_pad($content,$messure[0][$a],$divChar);
  418. }
  419. return $joinChar.implode($joinChar,$tempArr).$joinChar;
  420. }
  421. /**
  422. * Traverses the table lines/cells and creates arrays with statistics for line numbers and lengths
  423. *
  424. * @param array Array with [table rows] [table cells] [lines in cell]
  425. * @return array Statistics (max lines/lengths)
  426. * @access private
  427. * @see breakTable()
  428. */
  429. function traverseTable($tableLines) {
  430. $maxLen=array();
  431. $maxLines=array();
  432. foreach ($tableLines as $k => $v) {
  433. foreach ($v as $kk => $vv) {
  434. foreach ($vv as $lk => $lv) {
  435. if (strlen($lv)>intval($maxLen[$kk])) $maxLen[$kk]=strlen($lv);
  436. }
  437. if (count($vv)>intval($maxLines[$k])) $maxLines[$k]=count($vv);
  438. }
  439. }
  440. return array($maxLen,$maxLines);
  441. }
  442. /**
  443. * Render block of images - which means creating lines with links to the images.
  444. *
  445. * @param string List of image filenames (from "image" field in tt_content records)
  446. * @param string Link value from the "image_link" field in tt_content records
  447. * @param string Caption text
  448. * @param string Alternative relative path for the files listed in $str
  449. * @return string Content
  450. * @see getImages()
  451. */
  452. function renderImages($str,$links,$caption,$upload_path='uploads/pics/') {
  453. $images = explode(',',$str);
  454. $linksArr = explode(',',$links);
  455. $lines=array();
  456. if ($this->conf['images.']['header']) {$lines[]=$this->getString($this->conf['images.']['header']);}
  457. foreach ($images as $k => $file) {
  458. $lines[]=$this->siteUrl.$upload_path.$file;
  459. if ($links && count($linksArr)>1) {
  460. if (isset($linksArr[$k])) {
  461. $ll=$linksArr[$k];
  462. } else {
  463. $ll=$linksArr[0];
  464. }
  465. $theLink = $this->getLink($ll);
  466. if ($theLink) {$lines[]=$this->getString($this->conf['images.']['linkPrefix']).$theLink;}
  467. }
  468. }
  469. if ($links && count($linksArr)==1) {
  470. $theLink = $this->getLink($links);
  471. if ($theLink) {$lines[]=$this->getString($this->conf['images.']['linkPrefix']).$theLink;}
  472. }
  473. if ($caption) {
  474. $lines[]='';
  475. $cHeader = trim($this->getString($this->conf['images.']['captionHeader']));
  476. if ($cHeader) $lines[]=$cHeader;
  477. $lines[]=$this->breakContent($caption);
  478. }
  479. return implode(chr(10),$lines);
  480. }
  481. /**
  482. * Returns a typolink URL based on input.
  483. *
  484. * @param string Parameter to typolink
  485. * @return string The URL returned from $this->cObj->getTypoLink_URL(); - possibly it prefixed with the URL of the site if not present already
  486. */
  487. function getLink($ll) {
  488. $theLink=$this->cObj->getTypoLink_URL($ll);
  489. if (substr($theLink,0,4)!='http') {
  490. $theLink=$this->siteUrl.$theLink;
  491. }
  492. return $theLink;
  493. }
  494. /**
  495. * Breaking lines into fixed length lines, using t3lib_div::breakLinesForEmail()
  496. *
  497. * @param string The string to break
  498. * @param string Line break character
  499. * @param integer Length of lines, default is $this->charWidth
  500. * @return string Processed string
  501. * @see t3lib_div::breakLinesForEmail()
  502. */
  503. function breakLines($str,$implChar="\n",$charWidth=0) {
  504. return t3lib_div::breakLinesForEmail($str,$implChar,$charWidth?$charWidth:$this->charWidth);
  505. }
  506. /**
  507. * Explodes a string with "|" and if the second part is found it will return this, otherwise the first part.
  508. * Used for many TypoScript properties used in this class since they need preceeding whitespace to be preserved.
  509. *
  510. * @param string Input string
  511. * @return string Output string
  512. * @access private
  513. */
  514. function getString($str) {
  515. $parts = explode('|',$str);
  516. return strcmp($parts[1],'')?$parts[1]:$parts[0];
  517. }
  518. /**
  519. * Calls a user function for processing of data
  520. *
  521. * @param string TypoScript property name, pointing to the definition of the user function to call (from the TypoScript array internally in this class). This array is passed to the user function. Notice that "parentObj" property is a reference to this class ($this)
  522. * @param mixed Variable to process
  523. * @return mixed The processed $passVar as returned by the function call
  524. */
  525. function userProcess($mConfKey,$passVar) {
  526. if ($this->conf[$mConfKey]) {
  527. $funcConf = $this->conf[$mConfKey.'.'];
  528. $funcConf['parentObj'] = $this;
  529. $passVar = $GLOBALS['TSFE']->cObj->callUserFunction($this->conf[$mConfKey], $funcConf, $passVar);
  530. }
  531. return $passVar;
  532. }
  533. /**
  534. * Function used by TypoScript "parseFunc" to process links in the bodytext.
  535. * Extracts the link and shows it in plain text in a parathesis next to the link text. If link was relative the site URL was prepended.
  536. *
  537. * @param string Empty, ignore.
  538. * @param array TypoScript parameters
  539. * @return string Processed output.
  540. * @see parseBody()
  541. */
  542. function atag_to_http($content,$conf) {
  543. $this->conf = $conf;
  544. $this->siteUrl=$conf['siteUrl'];
  545. $theLink = trim($this->cObj->parameters['href']);
  546. if (strtolower(substr($theLink,0,7))=='mailto:') {
  547. $theLink=substr($theLink,7);
  548. } elseif (substr($theLink,0,4)!='http') {
  549. $theLink=$this->siteUrl.$theLink;
  550. }
  551. return $this->cObj->getCurrentVal().' (Link: '.$theLink.' )';
  552. }
  553. /**
  554. * User function (called from TypoScript) for generating a bullet list (used in parsefunc)
  555. *
  556. * @param string Empty, ignore.
  557. * @param array TypoScript parameters
  558. * @return string Processed output.
  559. */
  560. function typolist($content,$conf) {
  561. $this->conf = $this->cObj->mergeTSRef($conf,'bulletlist');
  562. $this->siteUrl=$conf['siteUrl'];
  563. $str = trim($this->cObj->getCurrentVal());
  564. $this->cObj->data['layout'] = $this->cObj->parameters['type'];
  565. return $this->breakBulletlist($str);
  566. }
  567. /**
  568. * User function (called from TypoScript) for generating a typo header tag (used in parsefunc)
  569. *
  570. * @param string Empty, ignore.
  571. * @param array TypoScript parameters
  572. * @return string Processed output.
  573. */
  574. function typohead($content,$conf) {
  575. $this->conf = $this->cObj->mergeTSRef($conf,'header');
  576. $this->siteUrl=$conf['siteUrl'];
  577. $str = trim($this->cObj->getCurrentVal());
  578. $this->cObj->data['header_layout'] = $this->cObj->parameters['type'];
  579. $this->cObj->data['header_position'] = $this->cObj->parameters['align'];
  580. $this->cObj->data['header']=$str;
  581. return $this->getHeader();
  582. }
  583. /**
  584. * User function (called from TypoScript) for generating a code listing (used in parsefunc)
  585. *
  586. * @param string Empty, ignore.
  587. * @param array TypoScript parameters
  588. * @return string Processed output.
  589. */
  590. function typocode($content,$conf) {
  591. // Nothing is really done here...
  592. $this->conf = $conf;
  593. $this->siteUrl=$conf['siteUrl'];
  594. return $this->cObj->getCurrentVal();
  595. }
  596. }
  597. if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['media/scripts/plaintextLib.inc']) {
  598. include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['media/scripts/plaintextLib.inc']);
  599. }
  600. ?>