/typo3/sysext/cms/tslib/class.tslib_content.php
PHP | 8482 lines | 5452 code | 889 blank | 2141 comment | 1421 complexity | e3ae4b6f9839aee5a8f8d74520ec6656 MD5 | raw file
Possible License(s): BSD-3-Clause, GPL-2.0, Unlicense, LGPL-2.1, Apache-2.0
Large files files are truncated, but you can click here to view the full file
- <?php
- /***************************************************************
- * Copyright notice
- *
- * (c) 1999-2010 Kasper Skaarhoj (kasperYYYY@typo3.com)
- * All rights reserved
- *
- * This script is part of the TYPO3 project. The TYPO3 project is
- * free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * The GNU General Public License can be found at
- * http://www.gnu.org/copyleft/gpl.html.
- * A copy is found in the textfile GPL.txt and important notices to the license
- * from the author is found in LICENSE.txt distributed with these scripts.
- *
- *
- * This script is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * This copyright notice MUST APPEAR in all copies of the script!
- ***************************************************************/
- /**
- * Contains classes for Content Rendering based on TypoScript Template configuration
- *
- * $Id: class.tslib_content.php 8420 2010-07-28 09:15:53Z ohader $
- * Revised for TYPO3 3.6 June/2003 by Kasper Skaarhoj
- * XHTML compliant
- *
- * class tslib_cObj : All main TypoScript features, rendering of content objects (cObjects). This class is the backbone of TypoScript Template rendering.
- * class tslib_controlTable : Makes a table CTABLE (TS cObject)
- * class tslib_tableOffset : Makes a table-offset (TS)
- * class tslib_frameset : Generates framesets (TS)
- *
- * @author Kasper Skaarhoj <kasperYYYY@typo3.com>
- */
- /**
- * [CLASS/FUNCTION INDEX of SCRIPT]
- *
- *
- *
- * 256: class tslib_cObj
- * 353: function start($data,$table='')
- * 387: function setParent($data,$currentRecord)
- *
- * SECTION: CONTENT_OBJ:
- * 412: function getCurrentVal()
- * 423: function setCurrentVal($value)
- * 436: function cObjGet($setup,$addKey='')
- * 460: function cObjGetSingle($name,$conf,$TSkey='__')
- *
- * SECTION: Functions rendering content objects (cObjects)
- * 629: function HTML($conf)
- * 640: function TEXT($conf)
- * 651: function CLEARGIF($conf)
- * 670: function COBJ_ARRAY($conf,$ext='')
- * 706: function USER($conf,$ext='')
- * 733: function FILE($conf)
- * 749: function IMAGE($conf)
- * 768: function IMG_RESOURCE($conf)
- * 780: function IMGTEXT($conf)
- * 1203: function CONTENT($conf)
- * 1290: function RECORDS($conf)
- * 1370: function HMENU($conf)
- * 1402: function CTABLE ($conf)
- * 1440: function OTABLE ($conf)
- * 1455: function COLUMNS ($conf)
- * 1534: function HRULER ($conf)
- * 1559: function CASEFUNC ($conf)
- * 1584: function LOAD_REGISTER($conf,$name)
- * 1624: function FORM($conf,$formData='')
- * 2145: function SEARCHRESULT($conf)
- * 2311: function PHP_SCRIPT($conf,$ext='')
- * 2354: function TEMPLATE($conf)
- * 2505: function MULTIMEDIA($conf)
- *
- * SECTION: Various helper functions for content objects:
- * 2592: function getSlidePids($pidList, $pidConf)
- * 2623: function getFieldDefaultValue($noValueInsert, $fieldName, $defaultVal)
- * 2641: function cImage($file,$conf)
- * 2669: function getBorderAttr($borderAttr)
- * 2685: function imageLinkWrap($string,$imageFile,$conf)
- * 2765: function fileResource($fName, $addParams='alt="" title=""')
- * 2788: function lastChanged($tstamp)
- * 2805: function linkWrap($content,$wrap)
- * 2824: function getAltParam($conf, $longDesc=true)
- * 2859: function cleanFormName($name)
- * 2875: function getATagParams($conf, $addGlobal=1)
- *
- * SECTION: HTML template processing functions
- * 2922: function getSubpart($content, $marker)
- * 2938: function substituteSubpart($content,$marker,$subpartContent,$recursive=1)
- * 2951: function substituteMarker($content,$marker,$markContent)
- * 2971: function substituteMarkerArrayCached($content,$markContentArray=array(),$subpartContentArray=array(),$wrappedSubpartContentArray=array())
- * 3069: function substituteMarkerArray($content,$markContentArray,$wrap='',$uppercase=0)
- * 3081: function substituteMarkerInObject(&$tree, $markContentArray)
- * 3104: function fillInMarkerArray($markContentArray, $row, $fieldList='', $nl2br=TRUE, $prefix='FIELD_', $HSC=FALSE)
- *
- * SECTION: "stdWrap" + sub functions
- * 3167: function stdWrap($content,$conf)
- * 3364: function numRows($conf)
- * 3388: function listNum($content,$listNum,$char)
- * 3408: function checkIf($conf)
- * 3471: function filelist($data)
- * 3553: function clean_directory($theDir)
- * 3571: function HTMLparser_TSbridge($theValue, $conf)
- * 3585: function dataWrap($content,$wrap)
- * 3598: function insertData($str)
- * 3628: function prefixComment($str,$conf,$content)
- * 3652: function substring($content,$options)
- * 3670: function crop($content,$options)
- * 3702: function removeBadHTML($text, $conf)
- * 3746: function textStyle($theValue, $conf)
- * 3813: function tableStyle($theValue, $conf)
- * 3854: function addParams($content,$conf)
- * 3895: function filelink($theValue, $conf)
- * 3966: function locDataJU($jumpUrl,$conf)
- * 3997: function calc($val)
- * 4026: function calcIntExplode($delim, $string)
- * 4046: function splitObj($value, $conf)
- * 4108: function parseFunc($theValue, $conf, $ref='')
- * 4218: function _parseFunc ($theValue, $conf)
- * 4424: function encaps_lineSplit($theValue, $conf)
- * 4507: function http_makelinks($data,$conf)
- * 4574: function mailto_makelinks($data,$conf)
- * 4617: function getImgResource($file,$fileArray)
- *
- * SECTION: Data retrieval etc.
- * 4810: function getFieldVal($field)
- * 4830: function getData($string,$fieldArray)
- * 4975: function rootLineValue($key,$field,$slideBack=0,$altRootLine='')
- * 4997: function getGlobal($var, $source=NULL)
- * 5033: function getKey($key,$arr)
- * 5056: function TCAlookup($inputValue,$conf)
- *
- * SECTION: Link functions (typolink)
- * 5116: function typoLink($linktxt, $conf)
- * 5481: function typoLink_URL($conf)
- * 5499: function getTypoLink($label,$params,$urlParameters=array(),$target='')
- * 5526: function getTypoLink_URL($params,$urlParameters=array(),$target='')
- * 5538: function typolinkWrap($conf)
- * 5551: function currentPageUrl($urlParameters=array(),$id=0)
- * 5564: function getClosestMPvalueForPage($pageId, $raw=FALSE)
- * 5619: function getMailTo($mailAddress,$linktxt,$initP='?')
- * 5658: function getQueryArguments($conf,$overruleQueryArgs=array(),$forceArgs=FALSE)
- *
- * SECTION: Miscellaneous functions, stand alone
- * 5754: function wrap($content,$wrap,$char='|')
- * 5770: function noTrimWrap($content,$wrap)
- * 5784: function wrapSpace($content, $wrap)
- * 5810: function callUserFunction($funcName,$conf,$content)
- * 5851: function processParams($params)
- * 5869: function keywords($content)
- * 5886: function caseshift($theValue, $case)
- * 5911: function HTMLcaseshift($theValue, $case)
- * 5940: function bytes($sizeInBytes,$labels)
- * 5951: function calcAge($seconds,$labels)
- * 5983: function sendNotifyEmail($msg, $recipients, $cc, $email_from, $email_fromName='', $replyTo='')
- * 6010: function URLqMark($url,$params)
- * 6026: function checkEmail($email)
- * 6038: function clearTSProperties($TSArr,$propList)
- * 6057: function mergeTSRef($confArr,$prop)
- * 6080: function joinTSarrays($conf,$old_conf)
- * 6103: function gifBuilderTextBox($gifbuilderConf, $conf, $text)
- * 6159: function linebreaks($string,$chars,$maxLines=0)
- * 6190: function getUpdateJS($dataArray, $formName, $arrPrefix, $fieldList)
- *
- * SECTION: Database functions, making of queries
- * 6260: function DBgetDelete($table, $uid, $doExec=FALSE)
- * 6292: function DBgetUpdate($table, $uid, $dataArr, $fieldList, $doExec=FALSE)
- * 6334: function DBgetInsert($table, $pid, $dataArr, $fieldList, $doExec=FALSE)
- * 6371: function DBmayFEUserEdit($table,$row, $feUserRow, $allowedGroups='',$feEditSelf=0)
- * 6411: function DBmayFEUserEditSelect($table,$feUserRow,$allowedGroups='',$feEditSelf=0)
- * 6451: function enableFields($table,$show_hidden=0)
- * 6475: function getTreeList($id,$depth,$begin=0,$dontCheckEnableFields=FALSE,$addSelectFields='',$moreWhereClauses='', $prevId_array=array(), $recursionLevel=0)
- * 6583: function whereSelectFromList($field,$value)
- * 6601: function exec_mm_query($select,$local_table,$mm_table,$foreign_table,$whereClause='',$groupBy='',$orderBy='',$limit='')
- * 6628: function exec_mm_query_uidList($select,$local_table_uidlist,$mm_table,$foreign_table='',$whereClause='',$groupBy='',$orderBy='',$limit='')
- * 6649: function searchWhere($sw,$searchFieldList,$searchTable='')
- * 6685: function exec_getQuery($table, $conf)
- * 6703: function getQuery($table, $conf, $returnQueryArray=FALSE)
- * 6783: function getWhere($table,$conf, $returnQueryArray=FALSE)
- * 6878: function checkPidArray($listArr)
- * 6902: function checkPid($uid)
- *
- * SECTION: Frontend editing functions
- * 6959: function editPanel($content, $conf, $currentRecord='', $dataArr=array())
- * 7146: function editIcons($content,$params, $conf=array(), $currentRecord='', $dataArr=array(),$addUrlParamStr='')
- * 7228: function editPanelLinkWrap($string,$formName,$cmd,$currentRecord='',$confirm='',$nPid='')
- * 7270: function editPanelLinkWrap_doWrap($string,$url,$currentRecord)
- * 7298: function editPanelPreviewBorder($table,$row,$content,$thick,$conf=array())
- * 7320: function isDisabled($table,$row)
- *
- *
- * 7351: class tslib_frameset
- * 7361: function make($setup)
- * 7398: function frameParams($setup, $typeNum)
- * 7426: function framesetParams($setup)
- *
- *
- * 7459: class tslib_tableOffset
- * 7471: function start($content,$offset)
- *
- *
- * 7549: class tslib_controlTable
- * 7584: function start($offset,$cMargins)
- *
- * TOTAL FUNCTIONS: 135
- * (This index is automatically created/updated by the extension "extdeveval")
- *
- */
- // Object TypoScript library included:
- if(t3lib_extMgm::isLoaded('obts')) {
- require_once(t3lib_extMgm::extPath('obts').'_tsobject/_tso.php');
- }
- /**
- * This class contains all main TypoScript features.
- * This includes the rendering of TypoScript content objects (cObjects).
- * Is the backbone of TypoScript Template rendering.
- *
- * There are lots of functions you can use from your include-scripts.
- * The class "tslib_cObj" is normally instantiated and referred to as "cObj".
- * When you call your own PHP-code typically through a USER or USER_INT cObject then it is this class that instantiates the object and calls the main method. Before it does so it will set (if you are using classes) a reference to itself in the internal variable "cObj" of the object. Thus you can access all functions and data from this class by $this->cObj->... from within you classes written to be USER or USER_INT content objects.
- *
- * @author Kasper Skaarhoj <kasperYYYY@typo3.com>
- * @package TYPO3
- * @subpackage tslib
- * @link http://typo3.org/doc.0.html?&tx_extrepmgm_pi1[extUid]=270&cHash=4ad9d7acb4
- */
- class tslib_cObj {
- var $align = Array ('center', 'right', 'left');
- /**
- * Holds ImageMagick parameters and extensions used for compression
- *
- * @see IMGTEXT()
- *
- * 0= Default
- * 1= Dont change! (removes all parameters for the image_object!!)
- * 1x = GIFs
- * 2x = JPGs
- */
- var $image_compression = Array(
- 10 => Array('params'=>'', 'ext'=>'gif'),
- 11 => Array('params'=>'-colors 128', 'ext'=>'gif'),
- 12 => Array('params'=>'-colors 64', 'ext'=>'gif'),
- 13 => Array('params'=>'-colors 32', 'ext'=>'gif'),
- 14 => Array('params'=>'-colors 16', 'ext'=>'gif'),
- 15 => Array('params'=>'-colors 8', 'ext'=>'gif'),
- 30 => Array('params'=>'-colors 256', 'ext'=>'png'),
- 31 => Array('params'=>'-colors 128', 'ext'=>'png'),
- 32 => Array('params'=>'-colors 64', 'ext'=>'png'),
- 33 => Array('params'=>'-colors 32', 'ext'=>'png'),
- 34 => Array('params'=>'-colors 16', 'ext'=>'png'),
- 35 => Array('params'=>'-colors 8', 'ext'=>'png'),
- 39 => Array('params'=>'', 'ext'=>'png'),
- 20 => Array('params'=>'-quality 100', 'ext'=>'jpg'),
- 21 => Array('params'=>'-quality 90', 'ext'=>'jpg'),
- 22 => Array('params'=>'-quality 80', 'ext'=>'jpg'),
- 23 => Array('params'=>'-quality 70', 'ext'=>'jpg'),
- 24 => Array('params'=>'-quality 60', 'ext'=>'jpg'),
- 25 => Array('params'=>'-quality 50', 'ext'=>'jpg'),
- 26 => Array('params'=>'-quality 40', 'ext'=>'jpg'),
- 27 => Array('params'=>'-quality 30', 'ext'=>'jpg'),
- 28 => Array('params'=>'-quality 20', 'ext'=>'jpg')
- );
- /**
- * ImageMagick parameters for image effects
- *
- * @see IMGTEXT()
- */
- var $image_effects = Array(
- 1 => '-rotate 90',
- 2 => '-rotate 270',
- 3 => '-rotate 180',
- 10 => '-colorspace GRAY',
- 11 => '-sharpen 70',
- 20 => '-normalize',
- 23 => '-contrast',
- 25 => '-gamma 1.3',
- 26 => '-gamma 0.8'
- );
- /**
- * Loaded with the current data-record.
- *
- * If the instance of this class is used to render records from the database those records are found in this array.
- * The function stdWrap has TypoScript properties that fetch field-data from this array.
- * @see init()
- */
- var $data = Array();
- protected $table = '';
- var $oldData = Array(); // Used for backup...
- var $alternativeData =''; // If this is set with an array before stdWrap, it's used instead of $this->data in the data-property in stdWrap
- var $parameters = Array(); // Used by the parseFunc function and is loaded with tag-parameters when parsing tags.
- var $currentValKey = 'currentValue_kidjls9dksoje';
- var $currentRecord = ''; // This is set to the [table]:[uid] of the record delivered in the $data-array, if the cObjects CONTENT or RECORD is in operation. Note that $GLOBALS['TSFE']->currentRecord is set to an equal value but always indicating the latest record rendered.
- var $currentRecordTotal = 0; // Set in cObj->RECORDS and cObj->CONTENT to the current number of records selected in a query.
- var $currentRecordNumber = 0; // Incremented in cObj->RECORDS and cObj->CONTENT before each record rendering.
- var $parentRecordNumber = 0; // Incremented in parent cObj->RECORDS and cObj->CONTENT before each record rendering.
- var $parentRecord = array(); // If the tslib_cObj was started from CONTENT, RECORD or SEARCHRESULT cObject's this array has two keys, 'data' and 'currentRecord' which indicates the record and data for the parent cObj.
- var $regObj; // This may be set as a reference to the calling object of eg. cObjGetSingle. Anyway, just use it as you like. It's used in productsLib.inc for example.
- // internal
- var $INT_include=0; // Is set to 1 if the instance of this cObj is executed from a PHP_SCRIPT_INT -include script (see pagegen, bottom of document)
- var $checkPid_cache = Array(); // This is used by checkPid, that checks if pages are accessible. The $checkPid_cache['page_uid'] is set true or false upon this check featuring a caching function for the next request.
- var $checkPid_badDoktypeList = '255';
- var $lastTypoLinkUrl=''; // This will be set by typoLink() to the url of the most recent link created.
- var $lastTypoLinkTarget=''; // DO. link target.
- var $lastTypoLinkLD = array();
- var $substMarkerCache=array(); // Caching substituteMarkerArrayCached function
- var $recordRegister=array(); // Array that registers rendered content elements (or any table) to make sure they are not rendered recursively!
- var $cObjHookObjectsArr = array(); // Containig hooks for userdefined cObjects
- protected $stdWrapHookObjects = array(); // Containing hook objects for stdWrap
- protected $getImgResourceHookObjects; // Containing hook objects for getImgResource
- /**
- * Set to true by doConvertToUserIntObject() if USER object wants to become USER_INT
- */
- protected $doConvertToUserIntObject = false;
- /**
- * Indicates current object type. Can hold one of OBJECTTYPE_ constants or false.
- * The value is set and reset inside USER() function. Any time outside of
- * USER() it is false.
- */
- protected $userObjectType = false;
- /**
- * Indicates that object type is USER.
- *
- * @see tslib_cObjh::$userObjectType
- */
- const OBJECTTYPE_USER_INT = 1;
- /**
- * Indicates that object type is USER.
- *
- * @see tslib_cObjh::$userObjectType
- */
- const OBJECTTYPE_USER = 2;
- /**
- * Class constructor.
- * Well, it has to be called manually since it is not a real constructor function.
- * So after making an instance of the class, call this function and pass to it a database record and the tablename from where the record is from. That will then become the "current" record loaded into memory and accessed by the .fields property found in eg. stdWrap.
- *
- * @param array $data the record data that is rendered.
- * @param string $table the table that the data record is from.
- * @return void
- */
- function start($data,$table='') {
- global $TYPO3_CONF_VARS;
- $this->data = $data;
- $this->table = $table;
- $this->currentRecord = $table ? $table.':'.$this->data['uid'] : '';
- $this->parameters = Array();
- if (is_array ($TYPO3_CONF_VARS['SC_OPTIONS']['tslib/class.tslib_content.php']['cObjTypeAndClass'])) {
- foreach ($TYPO3_CONF_VARS['SC_OPTIONS']['tslib/class.tslib_content.php']['cObjTypeAndClass'] as $classArr) {
- $this->cObjHookObjectsArr[$classArr[0]] = t3lib_div::getUserObj($classArr[1]);
- }
- }
- $this->stdWrapHookObjects = array();
- if(is_array($TYPO3_CONF_VARS['SC_OPTIONS']['tslib/class.tslib_content.php']['stdWrap'])) {
- foreach($TYPO3_CONF_VARS['SC_OPTIONS']['tslib/class.tslib_content.php']['stdWrap'] as $classData) {
- $hookObject = t3lib_div::getUserObj($classData);
- if(!($hookObject instanceof tslib_content_stdWrapHook)) {
- throw new UnexpectedValueException('$hookObject must implement interface tslib_content_stdWrapHook', 1195043965);
- }
- $this->stdWrapHookObjects[] = $hookObject;
- }
- }
- if (is_array($TYPO3_CONF_VARS['SC_OPTIONS']['tslib/class.tslib_content.php']['postInit'])) {
- foreach ($TYPO3_CONF_VARS['SC_OPTIONS']['tslib/class.tslib_content.php']['postInit'] as $classData) {
- $postInitializationProcessor = t3lib_div::getUserObj($classData);
- if(!($postInitializationProcessor instanceof tslib_content_PostInitHook)) {
- throw new UnexpectedValueException('$postInitializationProcessor must implement interface tslib_content_PostInitHook', 1274563549);
- }
- $postInitializationProcessor->postProcessContentObjectInitialization($this);
- }
- }
- }
- /**
- * Gets the 'getImgResource' hook objects.
- * The first call initializes the accordant objects.
- *
- * @return array The 'getImgResource' hook objects (if any)
- */
- protected function getGetImgResourceHookObjects() {
- if (!isset($this->getImgResourceHookObjects)) {
- $this->getImgResourceHookObjects = array();
- if(is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/class.tslib_content.php']['getImgResource'])) {
- foreach($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/class.tslib_content.php']['getImgResource'] as $classData) {
- $hookObject = t3lib_div::getUserObj($classData);
- if(!($hookObject instanceof tslib_cObj_getImgResourceHook)) {
- throw new UnexpectedValueException('$hookObject must implement interface tslib_cObj_getImgResourceHook', 1218636383);
- }
- $this->getImgResourceHookObjects[] = $hookObject;
- }
- }
- }
- return $this->getImgResourceHookObjects;
- }
- /**
- * Sets the internal variable parentRecord with information about current record.
- * If the tslib_cObj was started from CONTENT, RECORD or SEARCHRESULT cObject's this array has two keys, 'data' and 'currentRecord' which indicates the record and data for the parent cObj.
- *
- * @param array $data: The record array
- * @param string $currentRecord: This is set to the [table]:[uid] of the record delivered in the $data-array, if the cObjects CONTENT or RECORD is in operation. Note that $GLOBALS['TSFE']->currentRecord is set to an equal value but always indicating the latest record rendered.
- * @return void
- * @access private
- */
- function setParent($data,$currentRecord) {
- $this->parentRecord=array('data'=>$data, 'currentRecord'=>$currentRecord);
- }
- /***********************************************
- *
- * CONTENT_OBJ:
- *
- ***********************************************/
- /**
- * Returns the "current" value.
- * The "current" value is just an internal variable that can be used by functions to pass a single value on to another function later in the TypoScript processing.
- * It's like "load accumulator" in the good old C64 days... basically a "register" you can use as you like.
- * The TSref will tell if functions are setting this value before calling some other object so that you know if it holds any special information.
- *
- * @return mixed The "current" value
- */
- function getCurrentVal() {
- return $this->data[$this->currentValKey];
- }
- /**
- * Sets the "current" value.
- *
- * @param mixed The variable that you want to set as "current"
- * @return void
- * @see getCurrentVal()
- */
- function setCurrentVal($value) {
- $this->data[$this->currentValKey] = $value;
- }
- /**
- * Rendering of a "numerical array" of cObjects from TypoScript
- * Will call ->cObjGetSingle() for each cObject found and accumulate the output.
- *
- * @param array $setup: Array with cObjects as values.
- * @param string $addKey: A prefix for the debugging information
- * @return string Rendered output from the cObjects in the array.
- * @see cObjGetSingle()
- */
- function cObjGet($setup,$addKey='') {
- if (is_array($setup)) {
- $sKeyArray=t3lib_TStemplate::sortedKeyList($setup);
- $content ='';
- foreach($sKeyArray as $theKey) {
- $theValue=$setup[$theKey];
- if (intval($theKey) && !strstr($theKey,'.')) {
- $conf=$setup[$theKey.'.'];
- $content.=$this->cObjGetSingle($theValue,$conf,$addKey.$theKey); // Get the contentObject
- }
- }
- return $content;
- }
- }
- /**
- * Renders a content object
- *
- * @param string The content object name, eg. "TEXT" or "USER" or "IMAGE"
- * @param array The array with TypoScript properties for the content object
- * @param string A string label used for the internal debugging tracking.
- * @return string cObject output
- * @example http://typo3.org/doc.0.html?&encryptionKey=&tx_extrepmgm_pi1[extUid]=267&tx_extrepmgm_pi1[tocEl]=153&cHash=7e74f4d331
- */
- function cObjGetSingle($name,$conf,$TSkey='__') {
- global $TYPO3_CONF_VARS;
- $content='';
- // Checking that the function is not called eternally. This is done by interrupting at a depth of 100
- $GLOBALS['TSFE']->cObjectDepthCounter--;
- if ($GLOBALS['TSFE']->cObjectDepthCounter>0) {
- $name = trim($name);
- if ($GLOBALS['TT']->LR) $GLOBALS['TT']->push($TSkey, $name);
- // Checking if the COBJ is a reference to another object. (eg. name of 'blabla.blabla = < styles.something')
- if (substr($name,0,1)=='<') {
- $key = trim(substr($name,1));
- $cF = t3lib_div::makeInstance('t3lib_TSparser');
- // $name and $conf is loaded with the referenced values.
- $old_conf=$conf;
- list($name, $conf) = $cF->getVal($key,$GLOBALS['TSFE']->tmpl->setup);
- if (is_array($old_conf) && count($old_conf)) {
- $conf = $this->joinTSarrays($conf,$old_conf);
- }
- // Getting the cObject
- $GLOBALS['TT']->incStackPointer();
- $content.=$this->cObjGetSingle($name,$conf,$key);
- $GLOBALS['TT']->decStackPointer();
- } else {
- $hooked = false;
- // Application defined cObjects
- foreach ($this->cObjHookObjectsArr as $cObjName => $hookObj) {
- if (($name===$cObjName) && method_exists($hookObj, 'cObjGetSingleExt')) {
- $content.= $hookObj->cObjGetSingleExt($name, $conf, $TSkey, $this);
- $hooked = true;
- }
- }
- if (!$hooked && isset($GLOBALS['OBTS']['tso_list'][$name]) && t3lib_extMgm::isLoaded('obts')) {
- $content.= obts_dtutil::renderDatatypeContent($name, $GLOBALS['OBTS']['tso_list'][$name], $conf, $this);
- } elseif (!$hooked) {
- // Traditional Content Object branching:
- switch($name) {
- case 'COBJ_ARRAY':
- case 'COA':
- $content.=$this->COBJ_ARRAY($conf);
- break;
- case 'COA_INT':
- $content.=$this->COBJ_ARRAY($conf,'INT');
- break;
- case 'HTML':
- $content.=$this->HTML($conf);
- break;
- case 'TEXT':
- $content.=$this->TEXT($conf);
- break;
- case 'CLEARGIF':
- $content.=$this->CLEARGIF($conf);
- break;
- case 'FILE':
- $content.=$this->FILE($conf);
- break;
- case 'IMAGE':
- $content.=$this->IMAGE($conf);
- break;
- case 'IMG_RESOURCE':
- $content.=$this->IMG_RESOURCE($conf);
- break;
- case 'IMGTEXT':
- $content.=$this->IMGTEXT($conf);
- break;
- case 'CONTENT':
- $content.=$this->CONTENT($conf);
- break;
- case 'RECORDS':
- $content.=$this->RECORDS($conf);
- break;
- case 'HMENU':
- $content.=$this->HMENU($conf);
- break;
- case 'CTABLE':
- $content.=$this->CTABLE($conf);
- break;
- case 'OTABLE':
- $content.=$this->OTABLE($conf);
- break;
- case 'COLUMNS':
- $content.=$this->COLUMNS($conf);
- break;
- case 'HRULER':
- $content.=$this->HRULER($conf);
- break;
- case 'CASE':
- $content.=$this->CASEFUNC($conf);
- break;
- case 'LOAD_REGISTER':
- case 'RESTORE_REGISTER':
- $this->LOAD_REGISTER($conf,$name);
- break;
- case 'FORM':
- $content.=$this->FORM($conf);
- break;
- case 'SEARCHRESULT':
- $content.=$this->SEARCHRESULT($conf);
- break;
- case 'PHP_SCRIPT':
- $content.=$this->PHP_SCRIPT($conf);
- break;
- case 'PHP_SCRIPT_EXT':
- $content.=$this->PHP_SCRIPT($conf,'EXT');
- break;
- case 'PHP_SCRIPT_INT':
- $content.=$this->PHP_SCRIPT($conf,'INT');
- break;
- case 'USER':
- $content.=$this->USER($conf);
- break;
- case 'USER_INT':
- $content.=$this->USER($conf,'INT');
- break;
- case 'TEMPLATE':
- $content.=$this->TEMPLATE($conf);
- break;
- case 'EDITPANEL':
- if ($GLOBALS['TSFE']->beUserLogin) {$content.=$this->editPanel($content, $conf);}
- break;
- case 'MULTIMEDIA':
- $content.=$this->MULTIMEDIA($conf);
- break;
- case 'MEDIA':
- $content.=$this->MEDIA($conf);
- break;
- case 'SWFOBJECT':
- $content.=$this->SWFOBJECT($conf);
- break;
- case 'QTOBJECT':
- $content.=$this->QTOBJECT($conf);
- break;
- default:
- // call hook functions for extra processing
- if($name && is_array($TYPO3_CONF_VARS['SC_OPTIONS']['tslib/class.tslib_content.php']['cObjTypeAndClassDefault'])) {
- foreach($TYPO3_CONF_VARS['SC_OPTIONS']['tslib/class.tslib_content.php']['cObjTypeAndClassDefault'] as $classData) {
- $hookObject = t3lib_div::getUserObj($classData);
- if(!($hookObject instanceof tslib_content_cObjGetSingleHook)) {
- throw new UnexpectedValueException('$hookObject must implement interface tslib_content_cObjGetSingleHook', 1195043731);
- }
- /* @var $hookObject tslib_content_cObjGetSingleHook */
- $content .= $hookObject->getSingleContentObject($name, (array) $conf, $TSkey, $this);
- }
- }
- break;
- }
- }
- }
- if ($GLOBALS['TT']->LR) $GLOBALS['TT']->pull($content);
- }
- // Increasing on exit...
- $GLOBALS['TSFE']->cObjectDepthCounter++;
- return $content;
- }
- /********************************************
- *
- * Functions rendering content objects (cObjects)
- *
- ********************************************/
- /**
- * Rendering the cObject, HTML
- *
- * @param array Array of TypoScript properties
- * @return string Output
- * @link http://typo3.org/doc.0.html?&tx_extrepmgm_pi1[extUid]=270&tx_extrepmgm_pi1[tocEl]=349&cHash=d3fd0c70b4
- */
- function HTML($conf) {
- return $this->stdWrap($conf['value'],$conf['value.']);
- }
- /**
- * Rendering the cObject, TEXT
- *
- * @param array Array of TypoScript properties
- * @return string Output
- * @link http://typo3.org/doc.0.html?&tx_extrepmgm_pi1[extUid]=270&tx_extrepmgm_pi1[tocEl]=350&cHash=b49de28f83
- */
- function TEXT($conf) {
- return $this->stdWrap($conf['value'],$conf);
- }
- /**
- * Rendering the cObject, CLEARGIF
- *
- * @param array Array of TypoScript properties
- * @return string Output
- * @link http://typo3.org/doc.0.html?&tx_extrepmgm_pi1[extUid]=270&tx_extrepmgm_pi1[tocEl]=355&cHash=70c0f19915
- */
- function CLEARGIF($conf) {
- $w = $this->stdWrap($conf['width'],$conf['width.']);
- $h = $this->stdWrap($conf['height'],$conf['height.']);
- $w = $w ? $w : 1;
- $h = $h ? $h : 1;
- $wrap = $conf['wrap'] ? $conf['wrap'] : '|<br />';
- $theValue = $this->wrap('<img src="'.$GLOBALS['TSFE']->absRefPrefix.'clear.gif" width="'.$w.'" height="'.$h.'"'.$this->getBorderAttr(' border="0"').' alt="" title="" />', $wrap);
- return $this->stdWrap($theValue,$conf['stdWrap.']);
- }
- /**
- * Rendering the cObject, COBJ_ARRAY / COA and COBJ_ARRAY_INT
- *
- * @param array Array of TypoScript properties
- * @param string If "INT" then the cObject is a "COBJ_ARRAY_INT" (non-cached), otherwise just "COBJ_ARRAY" (cached)
- * @return string Output
- * @link http://typo3.org/doc.0.html?&tx_extrepmgm_pi1[extUid]=270&tx_extrepmgm_pi1[tocEl]=351&cHash=a09db0329c
- */
- function COBJ_ARRAY($conf,$ext='') {
- if (is_array($conf)) {
- $content = '';
- switch($ext) {
- case 'INT':
- $substKey = $ext . '_SCRIPT.' . $GLOBALS['TSFE']->uniqueHash();
- $content .= '<!--'.$substKey.'-->';
- $GLOBALS['TSFE']->config[$ext . 'incScript'][$substKey] = array (
- 'file' => $conf['includeLibs'],
- 'conf' => $conf,
- 'cObj' => serialize($this),
- 'type' => 'COA'
- );
- break;
- default:
- if ($this->checkIf($conf['if.'])) {
- $this->includeLibs($conf);
- $content = $this->cObjGet($conf);
- if ($conf['wrap']) {
- $content = $this->wrap($content, $conf['wrap']);
- }
- if ($conf['stdWrap.']) {
- $content = $this->stdWrap($content, $conf['stdWrap.']);
- }
- }
- break;
- }
- return $content;
- } else {
- $GLOBALS['TT']->setTSlogMessage('No elements in this content object array (COBJ_ARRAY, COA, COA_INT).', 2);
- }
- }
- /**
- * Rendering the cObject, USER and USER_INT
- *
- * @param array Array of TypoScript properties
- * @param string If "INT" then the cObject is a "USER_INT" (non-cached), otherwise just "USER" (cached)
- * @return string Output
- * @link http://typo3.org/documentation/document-library/references/doc_core_tsref/4.1.0/view/8/22/
- */
- function USER($conf, $ext = '') {
- $content = '';
- switch ($ext) {
- case 'INT':
- $this->userObjectType = self::OBJECTTYPE_USER_INT;
- $substKey = $ext . '_SCRIPT.' . $GLOBALS['TSFE']->uniqueHash();
- $content.='<!--' . $substKey . '-->';
- $GLOBALS['TSFE']->config[$ext . 'incScript'][$substKey] = array(
- 'file' => $conf['includeLibs'],
- 'conf' => $conf,
- 'cObj' => serialize($this),
- 'type' => 'FUNC'
- );
- break;
- default:
- if ($this->userObjectType === false) {
- // Come here only if we are not called from $TSFE->INTincScript_process()!
- $this->userObjectType = self::OBJECTTYPE_USER;
- }
- $this->includeLibs($conf);
- $tempContent = $this->callUserFunction($conf['userFunc'], $conf, '');
- if ($this->doConvertToUserIntObject) {
- $this->doConvertToUserIntObject = false;
- $content = $this->USER($conf, 'INT');
- } else {
- $content .= $tempContent;
- }
- break;
- }
- $this->userObjectType = false;
- return $content;
- }
- /**
- * Retrieves a type of object called as USER or USER_INT. Object can detect their
- * type by using this call. It returns OBJECTTYPE_USER_INT or OBJECTTYPE_USER depending on the
- * current object execution. In all other cases it will return false to indicate
- * a call out of context.
- *
- * @return mixed One of OBJECTTYPE_ class constants or false
- */
- public function getUserObjectType() {
- return $this->userObjectType;
- }
- /**
- * Requests the current USER object to be converted to USER_INT.
- *
- * @return void
- */
- public function convertToUserIntObject() {
- if ($this->userObjectType !== self::OBJECTTYPE_USER) {
- $GLOBALS['TT']->setTSlogMessage('tslib_cObj::convertToUserIntObject() ' .
- 'is called in the wrong context or for the wrong object type', 2);
- }
- else {
- $this->doConvertToUserIntObject = true;
- }
- }
- /**
- * Rendering the cObject, FILE
- *
- * @param array Array of TypoScript properties
- * @return string Output
- * @link http://typo3.org/doc.0.html?&tx_extrepmgm_pi1[extUid]=270&tx_extrepmgm_pi1[tocEl]=352&cHash=379c60f8bc
- */
- function FILE($conf) {
- $theValue = $this->fileResource($this->stdWrap($conf['file'],$conf['file.']), trim($this->getAltParam($conf, false)));
- if ($conf['linkWrap']) {
- $theValue = $this->linkWrap($theValue,$conf['linkWrap']);
- }
- return $this->wrap($theValue,$conf['wrap']);
- }
- /**
- * Rendering the cObject, IMAGE
- *
- * @param array Array of TypoScript properties
- * @return string Output
- * @link http://typo3.org/doc.0.html?&tx_extrepmgm_pi1[extUid]=270&tx_extrepmgm_pi1[tocEl]=353&cHash=440681ea56
- * @see cImage()
- */
- function IMAGE($conf) {
- $content='';
- if ($this->checkIf($conf['if.'])) {
- $theValue = $this->cImage($conf['file'],$conf);
- if ($conf['stdWrap.']) {
- $theValue = $this->stdWrap($theValue,$conf['stdWrap.']);
- }
- return $theValue;
- }
- }
- /**
- * Rendering the cObject, IMG_RESOURCE
- *
- * @param array Array of TypoScript properties
- * @return string Output
- * @link http://typo3.org/doc.0.html?&tx_extrepmgm_pi1[extUid]=270&tx_extrepmgm_pi1[tocEl]=354&cHash=46f9299706
- * @see getImgResource()
- */
- function IMG_RESOURCE($conf) {
- $GLOBALS['TSFE']->lastImgResourceInfo = $this->getImgResource($conf['file'],$conf['file.']);
- return $this->stdWrap($GLOBALS['TSFE']->lastImgResourceInfo[3],$conf['stdWrap.']);
- }
- /**
- * Rendering the cObject, IMGTEXT
- *
- * @param array Array of TypoScript properties
- * @return string Output
- * @link http://typo3.org/doc.0.html?&tx_extrepmgm_pi1[extUid]=270&tx_extrepmgm_pi1[tocEl]=363&cHash=cf2969bce1
- */
- function IMGTEXT($conf) {
- $content='';
- if (is_array($conf['text.'])) {
- $content.= $this->stdWrap($this->cObjGet($conf['text.'],'text.'),$conf['text.']); // this gets the surrounding content
- }
- $imgList=trim($this->stdWrap($conf['imgList'],$conf['imgList.'])); // gets images
- if ($imgList) {
- $imgs = t3lib_div::trimExplode(',',$imgList);
- $imgStart = intval($this->stdWrap($conf['imgStart'],$conf['imgStart.']));
- $imgCount= count($imgs)-$imgStart;
- $imgMax = intval($this->stdWrap($conf['imgMax'],$conf['imgMax.']));
- if ($imgMax) {
- $imgCount = t3lib_div::intInRange($imgCount,0,$imgMax); // reduces the number of images.
- }
- $imgPath = $this->stdWrap($conf['imgPath'],$conf['imgPath.']);
- // initialisation
- $caption='';
- $captionArray = array();
- if (!$conf['captionSplit'] && !$conf['imageTextSplit'] && is_array($conf['caption.'])) {
- $caption = $this->stdWrap($this->cObjGet($conf['caption.'], 'caption.'),$conf['caption.']); // global caption, no splitting
- }
- if ($conf['captionSplit'] && $conf['captionSplit.']['cObject']) {
- $legacyCaptionSplit = 1;
- $capSplit = $this->stdWrap($conf['captionSplit.']['token'], $conf['captionSplit.']['token.']);
- if (!$capSplit) {$capSplit=LF;}
- $captionArray = explode($capSplit, $this->cObjGetSingle($conf['captionSplit.']['cObject'], $conf['captionSplit.']['cObject.'], 'captionSplit.cObject'));
- foreach ($captionArray as $ca_key => $ca_val) {
- $captionArray[$ca_key] = $this->stdWrap(trim($captionArray[$ca_key]), $conf['captionSplit.']['stdWrap.']);
- }
- }
- $tablecode='';
- $position=$this->stdWrap($conf['textPos'],$conf['textPos.']);
- $tmppos = $position&7;
- $contentPosition = $position&24;
- $align = $this->align[$tmppos];
- $cap = ($caption)?1:0;
- $txtMarg = intval($this->stdWrap($conf['textMargin'],$conf['textMargin.']));
- if (!$conf['textMargin_outOfText'] && $contentPosition<16) {
- $txtMarg=0;
- }
- $cols = intval($this->stdWrap($conf['cols'],$conf['cols.']));
- $rows = intval($this->stdWrap($conf['rows'],$conf['rows.']));
- $colspacing = intval($this->stdWrap($conf['colSpace'],$conf['colSpace.']));
- $rowspacing = intval($this->stdWrap($conf['rowSpace'],$conf['rowSpace.']));
- $border = intval($this->stdWrap($conf['border'],$conf['border.'])) ? 1:0;
- $borderColor = $this->stdWrap($conf['borderCol'],$conf['borderCol.']);
- $borderThickness = intval($this->stdWrap($conf['borderThick'],$conf['borderThick.']));
- $borderColor=$borderColor?$borderColor:'black';
- $borderThickness=$borderThickness?$borderThickness:1;
- $caption_align = $this->stdWrap($conf['captionAlign'],$conf['captionAlign.']);
- if (!$caption_align) {
- $caption_align = $align;
- }
- // generate cols
- $colCount = ($cols > 1) ? $cols : 1;
- if ($colCount > $imgCount) {$colCount = $imgCount;}
- $rowCount = ($colCount > 1) ? ceil($imgCount / $colCount) : $imgCount;
- // generate rows
- if ($rows>1) {
- $rowCount = $rows;
- if ($rowCount > $imgCount) {$rowCount = $imgCount;}
- $colCount = ($rowCount>1) ? ceil($imgCount / $rowCount) : $imgCount;
- }
- // max Width
- $colRelations = trim($this->stdWrap($conf['colRelations'],$conf['colRelations.']));
- $maxW = intval($this->stdWrap($conf['maxW'],$conf['maxW.']));
- $maxWInText = intval($this->stdWrap($conf['maxWInText'],$conf['maxWInText.']));
- if (!$maxWInText) { // If maxWInText is not set, it's calculated to the 50 % of the max...
- $maxWInText = round($maxW/2);
- }
- if ($maxWInText && $contentPosition>=16) { // inText
- $maxW = $maxWInText;
- }
- if ($maxW && $colCount > 0) { // If there is a max width and if colCount is greater than column
- /* debug($border*$borderThickness*2);
- debug($maxW);
- debug($colspacing);
- debug(($maxW-$colspacing*($colCount-1)-$colCount*$border*$borderThickness*2));
- */
- $maxW = ceil(($maxW-$colspacing*($colCount-1)-$colCount*$border*$borderThickness*2)/$colCount);
- }
- // create the relation between rows
- $colMaxW = Array();
- if ($colRelations) {
- $rel_parts = explode(':',$colRelations);
- $rel_total = 0;
- for ($a=0;$a<$colCount;$a++) {
- $rel_parts[$a] = intval($rel_parts[$a]);
- $rel_total+= $rel_parts[$a];
- }
- if ($rel_total) {
- for ($a=0;$a<$colCount;$a++) {
- $colMaxW[$a] = round(($maxW*$colCount)/$rel_total*$rel_parts[$a]);
- }
- if (min($colMaxW)<=0 || max($rel_parts)/min($rel_parts)>10) { // The difference in size between the largest and smalles must be within a factor of ten.
- $colMaxW = Array();
- }
- }
- }
- $image_compression = intval($this->stdWrap($conf['image_compression'],$conf['image_compression.']));
- $image_effects = intval($this->stdWrap($conf['image_effects'],$conf['image_effects.']));
- $image_frames = intval($this->stdWrap($conf['image_frames.']['key'],$conf['image_frames.']['key.']));
- // fetches pictures
- $splitArr=array();
- $splitArr['imgObjNum']=$conf['imgObjNum'];
- $splitArr = $GLOBALS['TSFE']->tmpl->splitConfArray($splitArr,$imgCount);
- // EqualHeight
- $equalHeight = intval($this->stdWrap($conf['equalH'],$conf['equalH.']));
- if ($equalHeight) { // Initiate gifbuilder object in order to get dimensions AND calculate the imageWidth's
- $gifCreator = t3lib_div::makeInstance('tslib_gifbuilder');
- $gifCreator->init();
- $relations = Array();
- $relations_cols = Array();
- $totalMaxW = $maxW*$colCount;
- for($a=0;$a<$imgCount;$a++) {
- $imgKey = $a+$imgStart;
- $imgInfo = $gifCreator->getImageDimensions($imgPath.$imgs[$imgKey]);
- $relations[$a] = $imgInfo[1] / $equalHeight; // relationship between the original height and the wished height
- if ($relations[$a]) { // if relations is zero, then the addition of this value is omitted as the image is not expected to display because of some error.
- $relations_cols[floor($a/$colCount)] += $imgInfo[0]/$relations[$a]; // counts the total width of the row with the new height taken into consideration.
- }
- }
- }
- $imageRowsFinalWidths = Array(); // contains the width of every image row
- $imageRowsMaxHeights = Array();
- $imgsTag=array();
- $origImages=array();
- for($a=0;$a<$imgCount;$a++) {
- $GLOBALS['TSFE']->register['IMAGE_NUM'] = $a;
- $GLOBALS['TSFE']->register['IMAGE_NUM_CURRENT'] = $a;
- $imgKey = $a+$imgStart;
- $totalImagePath = $imgPath.$imgs[$imgKey];
- $this->data[$this->currentValKey] = $totalImagePath;
- $imgObjNum = intval($splitArr[$a]['imgObjNum']);
- $imgConf = $conf[$imgObjNum.'.'];
- if ($equalHeight) {
- $scale = 1;
- if ($totalMaxW) {
- $rowTotalMaxW = $relations_cols[floor($a/$colCount)];
- if ($rowTotalMaxW > $totalMaxW) {
- $scale = $rowTotalMaxW / $totalMaxW;
- }
- }
- // transfer info to the imageObject. Please note, that
- $imgConf['file.']['height'] = round($equalHeight/$scale);
- unset($imgConf['file.']['width']);
- unset($imgConf['file.']['maxW']);
- unset($imgConf['file.']['maxH']);
- unset($imgConf['file.']['minW']);
- unset($imgConf['file.']['minH']);
- unset($imgConf['file.']['width.']);
- unset($imgConf['file.']['maxW.']);
- unset($imgConf['file.']['maxH.']);
- unset($imgConf['file.']['minW.']);
- unset($imgConf['file.']['minH.']);
- $maxW = 0; // setting this to zero, so that it doesn't disturb
- }
- if ($maxW) {
- if (count($colMaxW)) {
- $imgConf['file.']['maxW'] = $colMaxW[($a%$colCount)];
- } else {
- $imgConf['file.']['maxW'] = $maxW;
- }
- }
- // Image Object supplied:
- if (is_array($imgConf)) {
- if ($this->image_effects[$image_effects]) {
- $imgConf['file.']['params'].= ' '.$this->image_effects[$image_effects];
- }
- if ($image_frames) {
- if (is_array($conf['image_frames.'][$image_frames.'.'])) {
- $imgConf['file.']['m.'] = $conf['image_frames.'][$image_frames.'.'];
- }
- }
- if ($image_compression && $imgConf['file']!='GIFBUILDER') {
- if ($image_compression==1) {
- $tempImport = $imgConf['file.']['import'];
- $tempImport_dot = $imgConf['file.']['import.'];
- unset($imgConf['file.']);
- $imgConf['file.']['import'] = $tempImport;
- $imgConf['file.']['import.'] = $tempImport_dot;
- } elseif (isset($this->image_compression[$image_compression])) {
- $imgConf['file.']['params'].= ' '.$this->image_compression[$image_compression]['params'];
- $imgConf['file.']['ext'] = $this->image_compression[$image_compression]['ext'];
- unset($imgConf['file.']['ext.']);
- }
- }
- // "alt", "title" and "longdesc" attributes:
- if (!strlen($imgConf['altText']) && !is_array($imgConf['altText.'])) {
- $imgConf['altText'] = $conf['altText'];
- $imgConf['altText.'] = $conf['altText.'];
- }
- if (!strlen($imgConf['titleText']) && !is_array($imgConf['titleText.'])) {
- $imgConf['titleText'] = $conf['titleText'];
- $imgConf['titleText.'] = $conf['titleText.'];
- }
- if (!strlen($imgConf['longdescURL']) && !is_array($imgConf['longdescURL.'])) {
- $imgConf['longdescURL'] = $conf['longdescURL'];
- $imgConf['longdescURL.'] = $conf['longdescURL.'];
- }
- } else {
- $imgConf = array(
- 'altText' => $conf['altText'],
- 'titleText' => $conf['titleText'],
- 'longdescURL' => $conf['longdescURL'],
- 'file' => $totalImagePath
- );
- }
- $imgsTag[$imgKey] = $this->IMAGE($imgConf);
- // Store the original filepath
- $origImages[$imgKey]=$GLOBALS['TSFE']->lastImageInfo;
- $imageRowsFinalWidths[floor($a/$colCount)] += $GLOBALS['TSFE']->lastImageInfo[0];
- if ($GLOBALS['TSFE']->lastImageInfo[1]>$imageRowsMaxHeights[floor($a/$colCount)]) {
- $imageRowsMaxHeights[floor($a/$colCount)] = $GLOBALS['TSFE']->lastImageInfo[1];
- }
- }
- // calculating the tableWidth:
- // TableWidth problems: It creates problems if the pictures are NOT as wide as the tableWidth.
- $tableWidth = max($imageRowsFinalWidths)+ $colspacing*($colCount-1) + $colCount*$border*$borderThickness*2;
- // make table for pictures
- $index=$imgStart;
- $noRows = $this->stdWrap($conf['noRows'],$conf['noRows.']);
- $noCols = $this->stdWrap($conf['noCols'],$conf['noCols.']);
- if ($noRows) {$noCols=0;} // noRows overrides noCols. They cannot exist at the same time.
- if ($equalHeight) {
- $noCols=1;
- $noRows=0;
- }
- $rowCount_temp=1;
- $colCount_temp=$colCount;
- if ($noRows) {
- $rowCount_temp = $rowCount;
- $rowCount=1;
- }
- if ($noCols) {
- $colCount=1;
- }
- // col- and rowspans calculated
- $colspan = (($colspacing) ? $colCount*2-1 : $colCount);
- $rowspan = (($rowspacing) ? $rowCount*2-1 : $rowCount) + $cap;
- // Edit icons:
- $editIconsHTML = $conf['editIcons']&&$GLOBALS['TSFE']->beUserLogin ? $this->editIcons('',$conf['editIcons'],$conf['editIcons.']) : '';
- // strech out table:
- $tablecode='';
- $flag=0;
- if ($conf['noStretchAndMarginCells']!=1) {
- $tablecode.='<tr>';
- if ($txtMarg && $align=='right') { // If right aligned, the textborder is added on the right side
- $tablecode.='<td rowspan="'.($rowspan+1).'" valign="top"><img src="'.$GLOBALS['TSFE']->absRefPrefix.'clear.gif" width="'.$txtMarg.'" height="1" alt="" title="" />'.($editIconsHTML?'<br />'.$editIconsHTML:'').'</td>';
- $editIconsHTML='';
- $flag=1;
- }
- $tablecode.='<td colspan="'.$colspan.'"><img src="'.$GLOBALS['TSFE']->absRefPrefix.'clear.gif" width="'.$tableWidth.'" height="1" alt="" /></td>';
- if ($txtMarg && $align=='left') { // If left aligned, the textborder is added on the left side
- $tablecode.='<td rowspan="'.($rowspan+1).'" valign="top"><img src="'.$GLOBALS['TSFE']->absRefPrefix.'clear.gif" width="'.$txtMarg.'" height="1" alt="" title="" />'.($editIconsHTML?'<br />'.$editIconsHTML:'').'</td>';
- $editIconsHTML='';
- $flag=1;
- }
- if ($flag) $tableWidth+=$txtMarg+1;
- // $tableWidth=0;
- $tablecode.='</tr>';
- }
- // draw table
- for ($c=0;$c<$rowCount;$c++) { // Looping through rows. If 'noRows' is set, this is '1 time', but $rowCount_temp will hold the actual number of rows!
- if ($c && $rowspacing) { // If this is NOT the first time in the loop AND if space is required, a row-spacer is added. In case of "noRows" rowspacing is done further down.
- $tablecode.='<tr><td colspan="'.$colspan.'"><img src="'.$GLOBALS['TSFE']->absRefPrefix.'clear.gif" width="1" height="'.$rowspacing.'"'.$this->getBorderAttr(' border="0"').' alt="" title="" /></td></tr>';
- }
- $tablecode.='<tr>'; // starting row
- for ($b=0; $b<$colCount_temp; $b++) { // Looping through the columns
- if ($b && $colspacing) { // If this is NOT the first iteration AND if column space is required. In case of "noCols", the space is done without a separate cell.
- if (!$noCols) {
- $tablecode.='<td><img src="'.$GLOBALS['TSFE']->absRefPrefix.'clear.gif" width="'.$colspacing.'" height="1"'.$this->getBorderAttr(' border="0"').' alt="" title="" /></td>';
- } else {
- $colSpacer='<img src="'.$GLOBALS['TSFE']->absRefPrefix.'clear.gif" width="'.($border?$colspacing-6:$colspacing).'" height="'.($imageRowsMaxHeights[$c]+($border?$borderThickness*2:0)).'"'.$this->getBorderAttr(' border="0"').' align="'.($border?'left':'top').'" alt="" title="" />';
- $colSpacer='<td valign="top">'.$colSpacer.'</td>'; // added 160301, needed for the new "noCols"-table...
- $tablecode.=$colSpacer;
- }
- }
- if (!$noCols || ($noCols && !$b)) {
- $tablecode.='<td valign="top">'; // starting the cell. If "noCols" this cell will hold all images in the row, otherwise only a single image.
- if ($noCols) {$tablecode.='<table width="'.$imageRowsFinalWidths[$c].'" border="0" cellpadding="0" cellspacing="0"><tr>';} // In case of "noCols" we must set the table-tag that surrounds the images in the row.
- }
- for ($a=0;$a<$rowCount_temp;$a++) { // Looping through the rows IF "noRows" is set. "noRows" means that the rows of images is not rendered by physical table rows but images are all in one column and spaced apart with clear-gifs. This loop is only one time if "noRows" is not set.
- $GLOBALS['TSFE']->register['IMAGE_NUM'] = $imgIndex; // register previous imgIndex
- $imgIndex = $index+$a*$colCount_temp;
- $GLOBALS['TSFE']->register['IMAGE_NUM_CURRENT'] = $imgIndex;
- if ($imgsTag[$imgIndex]) {
- if ($rowspacing && $noRows && $a) { // Puts distance between the images IF "noRows" is set and this is the first iteration of the loop
- $tablecode.= '<img src="'.$GLOBALS['TSFE']->absRefPrefix.'clear.gif" width="1" height="'.$rowspacing.'" alt="" title="" /><br />';
- }
- if ($legacyCaptionSplit) {
- $thisCaption = $captionArray[$imgIndex];
- } else if ($conf['captionSplit'] || $conf['imageTextSplit']) {
- $thisCaption = $this->stdWrap($this->cObjGet($conf['caption.'], 'caption.'), $conf['caption.']);
- }
- $imageHTML = $imgsTag[$imgIndex].'<br />';
- $Talign = (!trim($thisCaption) && !$noRows) ? ' align="left"' : ''; // this is necessary if the tablerows are supposed to space properly together! "noRows" is excluded because else the images "layer" together.
- if ($border) {$imageHTML='<table border="0" cell…
Large files files are truncated, but you can click here to view the full file