📄 class.tslib_content.php
字号:
<?php/**************************************************************** Copyright notice** (c) 1999-2007 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 2785 2007-11-30 12:08:01Z 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] * * * * 257: class tslib_cObj * 351: function start($data,$table='') * 366: function setParent($data,$currentRecord) * * SECTION: CONTENT_OBJ: * 391: function getCurrentVal() * 402: function setCurrentVal($value) * 415: function cObjGet($setup,$addKey='') * 439: function cObjGetSingle($name,$conf,$TSkey='__') * * SECTION: Functions rendering content objects (cObjects) * 585: function HTML($conf) * 596: function TEXT($conf) * 607: function CLEARGIF($conf) * 626: function COBJ_ARRAY($conf,$ext='') * 662: function USER($conf,$ext='') * 689: function FILE($conf) * 705: function IMAGE($conf) * 724: function IMG_RESOURCE($conf) * 736: function IMGTEXT($conf) * 1145: function CONTENT($conf) * 1231: function RECORDS($conf) * 1311: function HMENU($conf) * 1343: function CTABLE ($conf) * 1381: function OTABLE ($conf) * 1396: function COLUMNS ($conf) * 1475: function HRULER ($conf) * 1500: function CASEFUNC ($conf) * 1525: function LOAD_REGISTER($conf,$name) * 1565: function FORM($conf,$formData='') * 2062: function SEARCHRESULT($conf) * 2228: function PHP_SCRIPT($conf,$ext='') * 2271: function TEMPLATE($conf) * 2422: function MULTIMEDIA($conf) * * SECTION: Various helper functions for content objects: * 2509: function getSlidePids($pidList, $pidConf) * 2582: function getFieldDefaultValue($noValueInsert, $fieldName, $defaultVal) * 2600: function cImage($file,$conf) * 2628: function getBorderAttr($borderAttr) * 2644: function imageLinkWrap($string,$imageFile,$conf) * 2724: function fileResource($fName, $addParams='alt="" title=""') * 2747: function lastChanged($tstamp) * 2764: function linkWrap($content,$wrap) * 2782: function getAltParam($conf) * 2817: function cleanFormName($name) * 2833: function getATagParams($conf, $addGlobal=1) * * SECTION: HTML template processing functions * 2880: function getSubpart($content, $marker) * 2896: function substituteSubpart($content,$marker,$subpartContent,$recursive=1) * 2909: function substituteMarker($content,$marker,$markContent) * 2929: function substituteMarkerArrayCached($content,$markContentArray=array(),$subpartContentArray=array(),$wrappedSubpartContentArray=array()) * 3027: function substituteMarkerArray($content,$markContentArray,$wrap='',$uppercase=0) * 3048: function substituteMarkerInObject(&$tree, $markContentArray) * 3071: function fillInMarkerArray($markContentArray, $row, $fieldList='', $nl2br=TRUE, $prefix='FIELD_', $HSC=FALSE) * * SECTION: "stdWrap" + sub functions * 3134: function stdWrap($content,$conf) * 3308: function numRows($conf) * 3329: function listNum($content,$listNum,$char) * 3349: function checkIf($conf) * 3412: function filelist($data) * 3494: function clean_directory($theDir) * 3512: function HTMLparser_TSbridge($theValue, $conf) * 3526: function dataWrap($content,$wrap) * 3539: function insertData($str) * 3569: function prefixComment($str,$conf,$content) * 3593: function substring($content,$options) * 3611: function crop($content,$options) * 3643: function removeBadHTML($text, $conf) * 3687: function textStyle($theValue, $conf) * 3754: function tableStyle($theValue, $conf) * 3795: function addParams($content,$conf) * 3838: function filelink($theValue, $conf) * 3908: function locDataJU($jumpUrl,$conf) * 3939: function calc($val) * 3968: function calcIntExplode($delim, $string) * 3988: function splitObj($value, $conf) * 4050: function parseFunc($theValue, $conf, $ref='') * 4160: function _parseFunc ($theValue, $conf) * 4362: function encaps_lineSplit($theValue, $conf) * 4445: function http_makelinks($data,$conf) * 4512: function mailto_makelinks($data,$conf) * 4555: function getImgResource($file,$fileArray) * * SECTION: Data retrieval etc. * 4747: function getFieldVal($field) * 4767: function getData($string,$fieldArray) * 4897: function rootLineValue($key,$field,$slideBack=0,$altRootLine='') * 4919: function getGlobal($var, $source=NULL) * 4955: function getKey($key,$arr) * 4978: function TCAlookup($inputValue,$conf) * * SECTION: Link functions (typolink) * 5038: function typoLink($linktxt, $conf) * 5335: function typoLink_URL($conf) * 5353: function getTypoLink($label,$params,$urlParameters=array(),$target='') * 5380: function getTypoLink_URL($params,$urlParameters=array(),$target='') * 5392: function typolinkWrap($conf) * 5405: function currentPageUrl($urlParameters=array(),$id=0) * 5418: function getClosestMPvalueForPage($pageId, $raw=FALSE) * 5468: function getMailTo($mailAddress,$linktxt,$initP='?') * 5506: function getQueryArguments($conf,$overruleQueryArgs=array(),$forceArgs=FALSE) * * SECTION: Miscellaneous functions, stand alone * 5591: function wrap($content,$wrap,$char='|') * 5607: function noTrimWrap($content,$wrap) * 5621: function wrapSpace($content, $wrap) * 5647: function callUserFunction($funcName,$conf,$content) * 5688: function processParams($params) * 5706: function keywords($content) * 5723: function caseshift($theValue, $case) * 5748: function HTMLcaseshift($theValue, $case) * 5777: function bytes($sizeInBytes,$labels) * 5788: function calcAge($seconds,$labels) * 5820: function sendNotifyEmail($msg, $recipients, $cc, $email_from, $email_fromName='', $replyTo='') * 5847: function URLqMark($url,$params) * 5863: function checkEmail($email) * 5875: function clearTSProperties($TSArr,$propList) * 5894: function mergeTSRef($confArr,$prop) * 5917: function joinTSarrays($conf,$old_conf) * 5940: function gifBuilderTextBox($gifbuilderConf, $conf, $text) * 5996: function linebreaks($string,$chars,$maxLines=0) * 6027: function getUpdateJS($dataArray, $formName, $arrPrefix, $fieldList) * * SECTION: Database functions, making of queries * 6096: function DBgetDelete($table, $uid, $doExec=FALSE) * 6128: function DBgetUpdate($table, $uid, $dataArr, $fieldList, $doExec=FALSE) * 6170: function DBgetInsert($table, $pid, $dataArr, $fieldList, $doExec=FALSE) * 6207: function DBmayFEUserEdit($table,$row, $feUserRow, $allowedGroups='',$feEditSelf=0) * 6247: function DBmayFEUserEditSelect($table,$feUserRow,$allowedGroups='',$feEditSelf=0) * 6287: function enableFields($table,$show_hidden=0) * 6311: function getTreeList($id,$depth,$begin=0,$dontCheckEnableFields=FALSE,$addSelectFields='',$moreWhereClauses='', $prevId_array=array(), $recursionLevel=0) * 6417: function whereSelectFromList($field,$value) * 6435: function exec_mm_query($select,$local_table,$mm_table,$foreign_table,$whereClause='',$groupBy='',$orderBy='',$limit='') * 6462: function exec_mm_query_uidList($select,$local_table_uidlist,$mm_table,$foreign_table='',$whereClause='',$groupBy='',$orderBy='',$limit='') * 6483: function searchWhere($sw,$searchFieldList,$searchTable='') * 6519: function exec_getQuery($table, $conf) * 6537: function getQuery($table, $conf, $returnQueryArray=FALSE) * 6616: function getWhere($table,$conf, $returnQueryArray=FALSE) * 6711: function checkPidArray($listArr) * 6734: function checkPid($uid) * * SECTION: Frontend editing functions * 6790: function editPanel($content, $conf, $currentRecord='', $dataArr=array()) * 6965: function editIcons($content,$params, $conf=array(), $currentRecord='', $dataArr=array(),$addUrlParamStr='') * 7033: function editPanelLinkWrap($string,$formName,$cmd,$currentRecord='',$confirm='',$nPid='') * 7075: function editPanelLinkWrap_doWrap($string,$url,$currentRecord) * 7103: function editPanelPreviewBorder($table,$row,$content,$thick,$conf=array()) * 7125: function isDisabled($table,$row) * * * 7156: class tslib_frameset * 7166: function make($setup) * 7203: function frameParams($setup, $typeNum) * 7246: function framesetParams($setup) * * * 7279: class tslib_tableOffset * 7291: function start($content,$offset) * * * 7369: class tslib_controlTable * 7404: function start($offset,$cMargins) * * TOTAL FUNCTIONS: 136 * (This index is automatically created/updated by the extension "extdeveval") * */ // Includes this class since it is used for parsing HTMLrequire_once(PATH_t3lib."class.t3lib_parsehtml.php"); // 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()
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -