51 'stdWrapPreProcess' =>
'hook',
53 'cacheRead' =>
'hook',
55 'setContentToCurrent' =>
'boolean',
56 'setContentToCurrent.' =>
'array',
57 'addPageCacheTags' =>
'string',
58 'addPageCacheTags.' =>
'array',
59 'setCurrent' =>
'string',
60 'setCurrent.' =>
'array',
64 'field' =>
'fieldName',
66 'current' =>
'boolean',
67 'current.' =>
'array',
68 'cObject' =>
'cObject',
69 'cObject.' =>
'array',
70 'numRows.' =>
'array',
72 'filelist.' =>
'array',
73 'preUserFunc' =>
'functionName',
74 'stdWrapOverride' =>
'hook',
76 'override' =>
'string',
77 'override.' =>
'array',
78 'preIfEmptyListNum' =>
'listNum',
79 'preIfEmptyListNum.' =>
'array',
82 'ifEmpty' =>
'string',
83 'ifEmpty.' =>
'array',
84 'ifBlank' =>
'string',
85 'ifBlank.' =>
'array',
86 'listNum' =>
'listNum',
87 'listNum.' =>
'array',
91 'stdWrap' =>
'stdWrap',
92 'stdWrap.' =>
'array',
93 'stdWrapProcess' =>
'hook',
95 'required' =>
'boolean',
96 'required.' =>
'array',
98 'fieldRequired' =>
'fieldName',
99 'fieldRequired.' =>
'array',
100 'csConv' =>
'string',
101 'csConv.' =>
'array',
102 'parseFunc' =>
'objectpath',
103 'parseFunc.' =>
'array',
104 'HTMLparser' =>
'boolean',
105 'HTMLparser.' =>
'array',
107 'replacement.' =>
'array',
108 'prioriCalc' =>
'boolean',
109 'prioriCalc.' =>
'array',
112 'intval' =>
'boolean',
113 'intval.' =>
'array',
116 'round' =>
'boolean',
118 'numberFormat.' =>
'array',
119 'expandList' =>
'boolean',
120 'expandList.' =>
'array',
121 'date' =>
'dateconf',
123 'strftime' =>
'strftimeconf',
124 'strftime.' =>
'array',
129 'bytes' =>
'boolean',
131 'substring' =>
'parameters',
132 'substring.' =>
'array',
133 'removeBadHTML' =>
'boolean',
134 'removeBadHTML.' =>
'array',
135 'cropHTML' =>
'crop',
136 'cropHTML.' =>
'array',
137 'stripHtml' =>
'boolean',
138 'stripHtml.' =>
'array',
141 'rawUrlEncode' =>
'boolean',
142 'rawUrlEncode.' =>
'array',
143 'htmlSpecialChars' =>
'boolean',
144 'htmlSpecialChars.' =>
'array',
145 'encodeForJavaScriptValue' =>
'boolean',
146 'encodeForJavaScriptValue.' =>
'array',
147 'doubleBrTag' =>
'string',
148 'doubleBrTag.' =>
'array',
153 'encapsLines.' =>
'array',
154 'keywords' =>
'boolean',
155 'keywords.' =>
'array',
156 'innerWrap' =>
'wrap',
157 'innerWrap.' =>
'array',
158 'innerWrap2' =>
'wrap',
159 'innerWrap2.' =>
'array',
161 'fontTag.' =>
'array',
162 'addParams.' =>
'array',
163 'textStyle.' =>
'array',
164 'tableStyle.' =>
'array',
165 'filelink.' =>
'array',
166 'preCObject' =>
'cObject',
167 'preCObject.' =>
'array',
168 'postCObject' =>
'cObject',
169 'postCObject.' =>
'array',
170 'wrapAlign' =>
'align',
171 'wrapAlign.' =>
'array',
172 'typolink.' =>
'array',
173 'TCAselectItem.' =>
'array',
176 'spaceBefore' =>
'int',
177 'spaceBefore.' =>
'array',
178 'spaceAfter' =>
'int',
179 'spaceAfter.' =>
'array',
182 'noTrimWrap' =>
'wrap',
183 'noTrimWrap.' =>
'array',
186 'dataWrap' =>
'dataWrap',
187 'dataWrap.' =>
'array',
188 'prepend' =>
'cObject',
189 'prepend.' =>
'array',
190 'append' =>
'cObject',
191 'append.' =>
'array',
194 'orderedStdWrap' =>
'stdWrap',
195 'orderedStdWrap.' =>
'array',
196 'outerWrap' =>
'wrap',
197 'outerWrap.' =>
'array',
198 'insertData' =>
'boolean',
199 'insertData.' =>
'array',
200 'offsetWrap' =>
'space',
201 'offsetWrap.' =>
'array',
202 'postUserFunc' =>
'functionName',
203 'postUserFuncInt' =>
'functionName',
204 'prefixComment' =>
'string',
205 'prefixComment.' =>
'array',
206 'editIcons' =>
'string',
207 'editIcons.' =>
'array',
208 'editPanel' =>
'boolean',
209 'editPanel.' =>
'array',
210 'cacheStore' =>
'hook',
212 'stdWrapPostProcess' =>
'hook',
214 'debug' =>
'boolean',
216 'debugFunc' =>
'boolean',
217 'debugFunc.' =>
'array',
218 'debugData' =>
'boolean',
219 'debugData.' =>
'array' 230 'CLEARGIF' =>
'ClearGif',
231 'COBJ_ARRAY' =>
'ContentObjectArray',
232 'COA' =>
'ContentObjectArray',
233 'COA_INT' =>
'ContentObjectArrayInternal',
235 'USER_INT' =>
'UserInternal',
239 'IMG_RESOURCE' =>
'ImageResource',
240 'IMGTEXT' =>
'ImageText',
241 'CONTENT' =>
'Content',
242 'RECORDS' =>
'Records',
243 'HMENU' =>
'HierarchicalMenu',
244 'CTABLE' =>
'ContentTable',
245 'OTABLE' =>
'OffsetTable',
246 'COLUMNS' =>
'Columns',
247 'HRULER' =>
'HorizontalRuler',
248 'CASEFUNC' =>
'Case',
249 'LOAD_REGISTER' =>
'LoadRegister',
250 'RESTORE_REGISTER' =>
'RestoreRegister',
252 'SEARCHRESULT' =>
'SearchResult',
253 'TEMPLATE' =>
'Template',
254 'FLUIDTEMPLATE' =>
'FluidTemplate',
255 'MULTIMEDIA' =>
'Multimedia',
257 'SWFOBJECT' =>
'ShockwaveFlashObject',
258 'FLOWPLAYER' =>
'FlowPlayer',
259 'QTOBJECT' =>
'QuicktimeObject',
260 'SVG' =>
'ScalableVectorGraphics',
261 'EDITPANEL' =>
'EditPanel',
276 'params' =>
'-colors 128',
280 'params' =>
'-colors 64',
284 'params' =>
'-colors 32',
288 'params' =>
'-colors 16',
292 'params' =>
'-colors 8',
296 'params' =>
'-quality 100',
300 'params' =>
'-quality 90',
304 'params' =>
'-quality 80',
308 'params' =>
'-quality 70',
312 'params' =>
'-quality 60',
316 'params' =>
'-quality 50',
320 'params' =>
'-quality 40',
324 'params' =>
'-quality 30',
328 'params' =>
'-quality 20',
332 'params' =>
'-colors 256',
336 'params' =>
'-colors 128',
340 'params' =>
'-colors 64',
344 'params' =>
'-colors 32',
348 'params' =>
'-colors 16',
352 'params' =>
'-colors 8',
371 10 =>
'-colorspace GRAY',
568 if ($TYPO3_CONF_VARS[
'FE'][
'activateContentAdapter'] && is_array(
$data) && !empty(
$data) && !empty(
$table)) {
569 \TYPO3\CMS\Core\Resource\Service\FrontendContentAdapterService::modifyDBRow(
$data,
$table);
573 $this->currentRecord =
$table ?
$table .
':' . $this->data[
'uid'] :
'';
574 $this->parameters = array();
575 if (is_array($TYPO3_CONF_VARS[
'SC_OPTIONS'][
'tslib/class.tslib_content.php'][
'cObjTypeAndClass'])) {
576 foreach ($TYPO3_CONF_VARS[
'SC_OPTIONS'][
'tslib/class.tslib_content.php'][
'cObjTypeAndClass'] as $classArr) {
577 $this->cObjHookObjectsRegistry[$classArr[0]] = $classArr[1];
580 $this->stdWrapHookObjects = array();
581 if (is_array($TYPO3_CONF_VARS[
'SC_OPTIONS'][
'tslib/class.tslib_content.php'][
'stdWrap'])) {
582 foreach ($TYPO3_CONF_VARS[
'SC_OPTIONS'][
'tslib/class.tslib_content.php'][
'stdWrap'] as $classData) {
585 throw new \UnexpectedValueException($classData .
' must implement interface TYPO3\\CMS\\Frontend\\ContentObject\\ContentObjectStdWrapHookInterface', 1195043965);
587 $this->stdWrapHookObjects[] = $hookObject;
590 if (is_array($TYPO3_CONF_VARS[
'SC_OPTIONS'][
'tslib/class.tslib_content.php'][
'postInit'])) {
591 foreach ($TYPO3_CONF_VARS[
'SC_OPTIONS'][
'tslib/class.tslib_content.php'][
'postInit'] as $classData) {
594 throw new \UnexpectedValueException($classData .
' must implement interface TYPO3\\CMS\\Frontend\\ContentObject\\ContentObjectPostInitHookInterface', 1274563549);
596 $postInitializationProcessor->postProcessContentObjectInitialization($this);
617 if (!isset($this->getImgResourceHookObjects)) {
618 $this->getImgResourceHookObjects = array();
619 if (is_array(
$GLOBALS[
'TYPO3_CONF_VARS'][
'SC_OPTIONS'][
'tslib/class.tslib_content.php'][
'getImgResource'])) {
620 foreach (
$GLOBALS[
'TYPO3_CONF_VARS'][
'SC_OPTIONS'][
'tslib/class.tslib_content.php'][
'getImgResource'] as $classData) {
623 throw new \UnexpectedValueException(
'$hookObject must implement interface TYPO3\\CMS\\Frontend\\ContentObject\\ContentObjectGetImageResourceHookInterface', 1218636383);
625 $this->getImgResourceHookObjects[] = $hookObject;
643 $this->parentRecord = array(
689 public function cObjGet($setup, $addKey =
'') {
690 if (is_array($setup)) {
693 foreach ($sKeyArray as $theKey) {
694 $theValue = $setup[$theKey];
695 if ((
int)$theKey && strpos($theKey,
'.') === FALSE) {
696 $conf = $setup[$theKey .
'.'];
697 $content .= $this->cObjGetSingle($theValue, $conf, $addKey . $theKey);
714 public function cObjGetSingle($name, $conf, $TSkey =
'__') {
718 $GLOBALS[
'TSFE']->cObjectDepthCounter--;
719 if (
$GLOBALS[
'TSFE']->cObjectDepthCounter > 0) {
722 $GLOBALS[
'TT']->push($TSkey, $name);
725 if ($name[0] ===
'<') {
726 $key = trim(substr($name, 1));
729 $confOverride = is_array($conf) ? $conf : array();
730 list($name, $conf) = $cF->getVal($key,
$GLOBALS[
'TSFE']->tmpl->setup);
731 $conf = array_replace_recursive(is_array($conf) ? $conf : array(), $confOverride);
734 $content .= $this->cObjGetSingle($name, $conf, $key);
739 if (!empty($this->cObjHookObjectsRegistry[$name])) {
740 if (empty($this->cObjHookObjectsArr[$name])) {
743 $hookObj = $this->cObjHookObjectsArr[$name];
744 if (method_exists($hookObj,
'cObjGetSingleExt')) {
745 $content .= $hookObj->cObjGetSingleExt($name, $conf, $TSkey, $this);
751 if ($contentObject) {
752 $content .= $contentObject->render($conf);
755 if ($name && is_array($TYPO3_CONF_VARS[
'SC_OPTIONS'][
'tslib/class.tslib_content.php'][
'cObjTypeAndClassDefault'])) {
756 foreach ($TYPO3_CONF_VARS[
'SC_OPTIONS'][
'tslib/class.tslib_content.php'][
'cObjTypeAndClassDefault'] as $classData) {
759 throw new \UnexpectedValueException(
'$hookObject must implement interface TYPO3\\CMS\\Frontend\\ContentObject\\ContentObjectGetSingleHookInterface', 1195043731);
762 $content .= $hookObject->getSingleContentObject($name, (array) $conf, $TSkey, $this);
766 $warning = sprintf(
'Content Object "%s" does not exist', $name);
767 $GLOBALS[
'TT']->setTSlogMessage($warning, 2);
777 $GLOBALS[
'TSFE']->cObjectDepthCounter++;
788 if (!isset($this->contentObjectClassMapping[$name])) {
791 $fullyQualifiedClassName =
'TYPO3\\CMS\\Frontend\\ContentObject\\' . $this->contentObjectClassMapping[$name] .
'ContentObject';
843 if ($ext ===
'INT') {
858 public function USER($conf, $ext =
'') {
859 if ($ext ===
'INT') {
894 if ($this->userObjectType !== self::OBJECTTYPE_USER) {
895 $GLOBALS[
'TT']->setTSlogMessage(
'TYPO3\\CMS\\Frontend\\ContentObject\\ContentObjectRenderer::convertToUserIntObject() ' .
'is called in the wrong context or for the wrong object type', 2);
897 $this->doConvertToUserIntObject = TRUE;
1056 if ($name ===
'RESTORE_REGISTER') {
1071 public function FORM($conf, $formData =
'') {
1175 if ($recursive === FALSE && is_string($flexData)) {
1178 if (is_array($flexData) && isset($flexData[
'data'][
'sDEF'][
'lDEF'])) {
1179 $flexData = $flexData[
'data'][
'sDEF'][
'lDEF'];
1181 if (!is_array($flexData)) {
1184 foreach ($flexData as $key => $value) {
1185 if (!is_array($value)) {
1188 if (isset($value[
'el'])) {
1189 if (is_array($value[
'el']) && count($value[
'el']) > 0) {
1190 foreach ($value[
'el'] as $ekey => $element) {
1191 if (isset($element[
'vDEF'])) {
1192 $conf[$ekey] = $element[
'vDEF'];
1194 if (is_array($element)) {
1205 if (isset($value[
'vDEF'])) {
1206 $conf[$key] = $value[
'vDEF'];
1221 $pidList = isset($pidConf) ? trim($this->
stdWrap($pidList, $pidConf)) : trim($pidList);
1222 if ($pidList ===
'') {
1225 if (trim($pidList)) {
1230 if (is_array($listArr) && count($listArr)) {
1231 foreach ($listArr as
$uid) {
1232 $page =
$GLOBALS[
'TSFE']->sys_page->getPage($uid);
1233 if (!$page[
'is_siteroot']) {
1234 $pidList[] = $page[
'pid'];
1238 return implode(
',', $pidList);
1253 if (!
$GLOBALS[
'TSFE']->no_cache || !isset($_POST[$fieldName]) && !isset($_GET[$fieldName]) || $noValueInsert) {
1273 $info = $this->getImgResource($file, $conf[
'file.']);
1274 $GLOBALS[
'TSFE']->lastImageInfo = $info;
1275 if (!is_array($info)) {
1278 if (is_file(PATH_site . $info[
'3'])) {
1280 $source =
$GLOBALS[
'TSFE']->absRefPrefix . $source;
1285 $layoutKey = $this->
stdWrap($conf[
'layoutKey'], $conf[
'layoutKey.']);
1290 $GLOBALS[
'TSFE']->imagesOnPage[] = $source;
1293 if ($params !==
'' && $params{0} !==
' ') {
1294 $params =
' ' . $params;
1297 $imageTagValues = array(
1298 'width' => $info[0],
1299 'height' => $info[1],
1300 'src' => htmlspecialchars($source),
1301 'params' => $params,
1302 'altParams' => $altParam,
1303 'border' => $this->
getBorderAttr(
' border="' . (
int)$conf[
'border'] .
'"'),
1304 'sourceCollection' => $sourceCollection,
1305 'selfClosingTagSlash' => (!empty(
$GLOBALS[
'TSFE']->xhtmlDoctype) ?
' /' :
''),
1308 $theValue = $this->
substituteMarkerArray($imageTagTemplate, $imageTagValues,
'###|###', TRUE, TRUE);
1310 $linkWrap = isset($conf[
'linkWrap.']) ? $this->
stdWrap($conf[
'linkWrap'], $conf[
'linkWrap.']) : $conf[
'linkWrap'];
1312 $theValue = $this->
linkWrap($theValue, $linkWrap);
1313 } elseif ($conf[
'imageLinkWrap']) {
1314 $originalFile = !empty($info[
'originalFile']) ? $info[
'originalFile'] : $info[
'origFile'];
1315 $theValue = $this->
imageLinkWrap($theValue, $originalFile, $conf[
'imageLinkWrap.']);
1317 $wrap = isset($conf[
'wrap.']) ? $this->
stdWrap($conf[
'wrap'], $conf[
'wrap.']) : $conf[
'wrap'];
1319 $theValue = $this->
wrap($theValue, $conf[
'wrap']);
1347 if ($layoutKey && isset($conf[
'layout.']) && isset($conf[
'layout.'][$layoutKey .
'.'])) {
1348 $imageTagLayout = $this->
stdWrap($conf[
'layout.'][$layoutKey .
'.'][
'element'], $conf[
'layout.'][$layoutKey .
'.'][
'element.']);
1350 $imageTagLayout =
'<img src="###SRC###" width="###WIDTH###" height="###HEIGHT###" ###PARAMS### ###ALTPARAMS### ###BORDER######SELFCLOSINGTAGSLASH###>';
1352 return $imageTagLayout;
1365 $sourceCollection =
'';
1366 if ($layoutKey && $conf[
'sourceCollection.'] && ($conf[
'layout.'][$layoutKey .
'.'][
'source'] || $conf[
'layout.'][$layoutKey .
'.'][
'source.'])) {
1369 $activeSourceCollections = array();
1370 foreach ($conf[
'sourceCollection.'] as $sourceCollectionKey => $sourceCollectionConfiguration) {
1371 if (substr($sourceCollectionKey, -1) ==
'.') {
1372 if (empty($sourceCollectionConfiguration[
'if.']) || $this->
checkIf($sourceCollectionConfiguration[
'if.'])) {
1373 $activeSourceCollections[] = $sourceCollectionConfiguration;
1379 $srcLayoutOptionSplitted =
$GLOBALS[
'TSFE']->tmpl->splitConfArray($conf[
'layout.'][$layoutKey .
'.'], count($activeSourceCollections));
1382 foreach ($activeSourceCollections as $key => $sourceConfiguration) {
1383 $sourceLayout = $this->
stdWrap($srcLayoutOptionSplitted[$key][
'source'], $srcLayoutOptionSplitted[$key][
'source.']);
1385 $sourceRenderConfiguration = array (
1387 'file.' => $conf[
'file.']
1390 if (isset($sourceConfiguration[
'pixelDensity'])) {
1391 $pixelDensity = (int)$this->
stdWrap($sourceConfiguration[
'pixelDensity'], $sourceConfiguration[
'pixelDensity.']);
1395 $dimensionKeys = array(
'width',
'height',
'maxW',
'minW',
'maxH',
'minH');
1396 foreach ($dimensionKeys as $dimensionKey) {
1397 $dimension = $this->
stdWrap($sourceConfiguration[$dimensionKey], $sourceConfiguration[$dimensionKey .
'.']);
1399 $dimension = $this->
stdWrap($conf[
'file.'][$dimensionKey], $conf[
'file.'][$dimensionKey .
'.']);
1402 if (strstr($dimension,
'c') !== FALSE && ($dimensionKey ===
'width' || $dimensionKey ===
'height')) {
1403 $dimensionParts = explode(
'c', $dimension, 2);
1404 $dimension = (int)($dimensionParts[0] * $pixelDensity) .
'c';
1405 if ($dimensionParts[1]) {
1406 $dimension .= $dimensionParts[1];
1409 $dimension = (int)($dimension * $pixelDensity);
1411 $sourceRenderConfiguration[
'file.'][$dimensionKey] = $dimension;
1413 unset($sourceRenderConfiguration[
'file.'][$dimensionKey .
'.']);
1416 $sourceInfo = $this->getImgResource($sourceRenderConfiguration[
'file'], $sourceRenderConfiguration[
'file.']);
1418 $sourceConfiguration[
'width'] = $sourceInfo[0];
1419 $sourceConfiguration[
'height'] = $sourceInfo[1];
1421 if (parse_url($sourceInfo[3], PHP_URL_HOST) === NULL) {
1422 $urlPrefix =
$GLOBALS[
'TSFE']->absRefPrefix;
1424 $sourceConfiguration[
'src'] = htmlspecialchars($urlPrefix . $sourceInfo[3]);
1425 $sourceConfiguration[
'selfClosingTagSlash'] = (!empty(
$GLOBALS[
'TSFE']->xhtmlDoctype) ?
' /' :
'');
1427 $oneSourceCollection = $this->
substituteMarkerArray($sourceLayout, $sourceConfiguration,
'###|###', TRUE, TRUE);
1429 if (is_array(
$GLOBALS[
'TYPO3_CONF_VARS'][
'SC_OPTIONS'][
'tslib/class.tslib_content.php'][
'getImageSourceCollection'])) {
1430 foreach (
$GLOBALS[
'TYPO3_CONF_VARS'][
'SC_OPTIONS'][
'tslib/class.tslib_content.php'][
'getImageSourceCollection'] as $classData) {
1433 throw new \UnexpectedValueException(
1434 '$hookObject must implement interface TYPO3\\CMS\\Frontend\\ContentObject\\ContentObjectOneSourceCollectionHookInterface',
1438 $oneSourceCollection = $hookObject->getOneSourceCollection((array) $sourceRenderConfiguration, (array) $sourceConfiguration, $oneSourceCollection, $this);
1442 $sourceCollection .= $oneSourceCollection;
1446 return $sourceCollection;
1463 $enable = isset($conf[
'enable.']) ? $this->
stdWrap($conf[
'enable'], $conf[
'enable.']) : $conf[
'enable'];
1465 $content = $this->typolink($string, $conf[
'typolink.']);
1466 if (isset($conf[
'file.'])) {
1467 $imageFile = $this->
stdWrap($imageFile, $conf[
'file.']);
1470 if ($imageFile instanceof \
TYPO3\CMS\Core\Resource\File) {
1472 } elseif ($imageFile instanceof \
TYPO3\CMS\Core\Resource\FileReference) {
1473 $file = $imageFile->getOriginalFile();
1483 if ($content == $string) {
1484 $parameterNames = array(
'width',
'height',
'effects',
'bodyTag',
'title',
'wrap');
1486 $sample = isset($conf[
'sample.']) ? $this->
stdWrap($conf[
'sample'], $conf[
'sample.']) : $conf[
'sample'];
1490 foreach ($parameterNames as $parameterName) {
1491 if (isset($conf[$parameterName .
'.'])) {
1492 $conf[$parameterName] = $this->
stdWrap($conf[$parameterName], $conf[$parameterName .
'.']);
1494 if (isset($conf[$parameterName]) && $conf[$parameterName]) {
1495 $parameters[$parameterName] = $conf[$parameterName];
1498 $parametersEncoded = base64_encode(serialize(
$parameters));
1500 $params =
'&md5=' . $hmac;
1501 foreach (str_split($parametersEncoded, 64) as $index => $chunk) {
1502 $params .=
'¶meters' . rawurlencode(
'[') . $index . rawurlencode(
']') .
'=' . rawurlencode($chunk);
1504 $url =
$GLOBALS[
'TSFE']->absRefPrefix .
'index.php?eID=tx_cms_showpic&file=' . $file->getUid() . $params;
1505 $directImageLink = isset($conf[
'directImageLink.']) ? $this->
stdWrap($conf[
'directImageLink'], $conf[
'directImageLink.']) : $conf[
'directImageLink'];
1506 if ($directImageLink) {
1507 $imgResourceConf = array(
1508 'file' => $imageFile,
1519 $target = isset($conf[
'target.']) ? $this->
stdWrap($conf[
'target'], $conf[
'target.']) : $conf[
'target'];
1521 $target =
' target="' . htmlspecialchars($target) .
'"';
1523 $target =
' target="thePicture"';
1528 $conf[
'JSwindow'] = isset($conf[
'JSwindow.']) ? $this->
stdWrap($conf[
'JSwindow'], $conf[
'JSwindow.']) : $conf[
'JSwindow'];
1529 if ($conf[
'JSwindow']) {
1530 if ($conf[
'JSwindow.'][
'altUrl'] || $conf[
'JSwindow.'][
'altUrl.']) {
1531 $altUrl = isset($conf[
'JSwindow.'][
'altUrl.']) ? $this->
stdWrap($conf[
'JSwindow.'][
'altUrl'], $conf[
'JSwindow.'][
'altUrl.']) : $conf[
'JSwindow.'][
'altUrl'];
1533 $url = $altUrl . ($conf[
'JSwindow.'][
'altUrl_noDefaultParams'] ?
'' :
'?file=' . rawurlencode($imageFile) . $params);
1537 $processedFile = $file->process(
'Image.CropScaleMask', $conf);
1538 $JSwindowExpand = isset($conf[
'JSwindow.'][
'expand.']) ? $this->
stdWrap($conf[
'JSwindow.'][
'expand'], $conf[
'JSwindow.'][
'expand.']) : $conf[
'JSwindow.'][
'expand'];
1540 $newWindow = isset($conf[
'JSwindow.'][
'newWindow.']) ? $this->
stdWrap($conf[
'JSwindow.'][
'newWindow'], $conf[
'JSwindow.'][
'newWindow.']) : $conf[
'JSwindow.'][
'newWindow'];
1541 $a1 =
'<a href="' . htmlspecialchars($url) .
'" onclick="' . htmlspecialchars((
'openPic(\'' .
$GLOBALS[
'TSFE']->baseUrlWrap($url) .
'\',\
'' . ($newWindow ? md5($url) :
'thePicture') .
'\',\
'width=' . ($processedFile->getProperty(
'width') + $offset[0]) .
',height=' . ($processedFile->getProperty(
'height') + $offset[1]) .
',status=0,menubar=0\'); return false;')) .
'"' . $target .
$GLOBALS[
'TSFE']->ATagParams .
'>';
1543 $GLOBALS[
'TSFE']->setJS(
'openPic');
1545 $conf[
'linkParams.'][
'parameter'] = $url;
1546 $string = $this->typoLink($string, $conf[
'linkParams.']);
1548 if (isset($conf[
'stdWrap.'])) {
1549 $string = $this->
stdWrap($string, $conf[
'stdWrap.']);
1551 $content = $a1 . $string . $a2;
1567 $incFile =
$GLOBALS[
'TSFE']->tmpl->getFileName($fName);
1568 if ($incFile && file_exists($incFile)) {
1571 $imgFile = $incFile;
1572 $imgInfo = @getImageSize($imgFile);
1573 return '<img src="' . htmlspecialchars(
$GLOBALS[
'TSFE']->absRefPrefix . $imgFile) .
'" width="' . $imgInfo[0] .
'" height="' . $imgInfo[1] .
'"' . $this->
getBorderAttr(
' border="0"') .
' ' . $addParams .
' />';
1574 } elseif (filesize($incFile) < 1024 * 1024) {
1575 return $GLOBALS[
'TSFE']->tmpl->fileContent($incFile);
1591 $tstamp = (int)$tstamp;
1592 if ($tstamp > (
int)
$GLOBALS[
'TSFE']->register[
'SYS_LASTCHANGED']) {
1593 $GLOBALS[
'TSFE']->register[
'SYS_LASTCHANGED'] = $tstamp;
1608 $wrapArr = explode(
'|', $wrap);
1609 if (preg_match(
'/\\{([0-9]*)\\}/', $wrapArr[0], $reg)) {
1610 if (
$uid =
$GLOBALS[
'TSFE']->tmpl->rootLine[$reg[1]][
'uid']) {
1611 $wrapArr[0] = str_replace($reg[0],
$uid, $wrapArr[0]);
1614 return trim($wrapArr[0]) . $content . trim($wrapArr[1]);
1628 $altText = isset($conf[
'altText.']) ? trim($this->
stdWrap($conf[
'altText'], $conf[
'altText.'])) : trim($conf[
'altText']);
1629 $titleText = isset($conf[
'titleText.']) ? trim($this->
stdWrap($conf[
'titleText'], $conf[
'titleText.'])) : trim($conf[
'titleText']);
1630 if (isset($conf[
'longdescURL.']) &&
$GLOBALS[
'TSFE']->config[
'config'][
'doctype'] !=
'html5') {
1631 $longDesc = $this->
typoLink_URL($conf[
'longdescURL.']);
1633 $longDesc = trim($conf[
'longdescURL']);
1635 $longDescUrl = strip_tags($longDescUrl);
1637 $altParam =
' alt="' . htmlspecialchars($altText) .
'"';
1639 $emptyTitleHandling =
'useAlt';
1640 $emptyTitleHandling = isset($conf[
'emptyTitleHandling.']) ? $this->
stdWrap($conf[
'emptyTitleHandling'], $conf[
'emptyTitleHandling.']) : $conf[
'emptyTitleHandling'];
1642 if ($titleText || $emptyTitleHandling ==
'keepEmpty') {
1643 $altParam .=
' title="' . htmlspecialchars($titleText) .
'"';
1644 } elseif (!$titleText && $emptyTitleHandling ==
'useAlt') {
1645 $altParam .=
' title="' . htmlspecialchars($altText) .
'"';
1648 if ($longDesc && !empty($longDescUrl)) {
1649 $altParam .=
' longdesc="' . htmlspecialchars($longDescUrl) .
'"';
1664 $name = preg_replace(
'/\\[|\\]\\[?/',
':', trim($name));
1666 return preg_replace(
'#[^:a-zA-Z0-9]#',
'', $name);
1681 if ($conf[
'ATagParams.']) {
1682 $aTagParams =
' ' . $this->
stdWrap($conf[
'ATagParams'], $conf[
'ATagParams.']);
1683 } elseif ($conf[
'ATagParams']) {
1684 $aTagParams =
' ' . $conf[
'ATagParams'];
1687 $aTagParams =
' ' . trim((
$GLOBALS[
'TSFE']->ATagParams . $aTagParams));
1690 if (isset(
$GLOBALS[
'TYPO3_CONF_VARS'][
'SC_OPTIONS'][
'tslib/class.tslib_content.php'][
'getATagParamsPostProc']) && is_array(
$GLOBALS[
'TYPO3_CONF_VARS'][
'SC_OPTIONS'][
'tslib/class.tslib_content.php'][
'getATagParamsPostProc'])) {
1693 'aTagParams' => &$aTagParams
1695 foreach (
$GLOBALS[
'TYPO3_CONF_VARS'][
'SC_OPTIONS'][
'tslib/class.tslib_content.php'][
'getATagParamsPostProc'] as $objRef) {
1697 $aTagParams = $processor->process($_params, $this);
1701 $aTagParams = trim($aTagParams);
1702 if (!empty($aTagParams)) {
1703 $aTagParams =
' ' . $aTagParams;
1720 if (
$GLOBALS[
'TYPO3_CONF_VARS'][
'SC_OPTIONS'][
'tslib/class.tslib_content.php'][
'extLinkATagParamsHandler']) {
1722 if (method_exists($extLinkATagParamsHandler,
'main')) {
1723 $out .= trim($extLinkATagParamsHandler->main($URL, $TYPE, $this));
1726 return trim($out) ?
' ' . trim($out) :
'';
1753 return \TYPO3\CMS\Core\Html\HtmlParser::getSubpart($content, $marker);
1769 return \TYPO3\CMS\Core\Html\HtmlParser::substituteSubpart($content, $marker, $subpartContent, $recursive);
1780 return \TYPO3\CMS\Core\Html\HtmlParser::substituteSubpartArray($content, $subpartsContent);
1794 return \TYPO3\CMS\Core\Html\HtmlParser::substituteMarker($content, $marker, $markContent);
1829 public function substituteMarkerArrayCached($content, array $markContentArray = NULL, array $subpartContentArray = NULL, array $wrappedSubpartContentArray = NULL) {
1830 $GLOBALS[
'TT']->push(
'substituteMarkerArrayCached');
1832 if (is_null($markContentArray)) {
1834 $markContentArray = array();
1836 if (is_null($subpartContentArray)) {
1838 $subpartContentArray = array();
1840 if (is_null($wrappedSubpartContentArray)) {
1842 $wrappedSubpartContentArray = array();
1845 $sPkeys = array_keys($subpartContentArray);
1846 $wPkeys = array_keys($wrappedSubpartContentArray);
1847 $keysToReplace = array_merge(array_keys($markContentArray), $sPkeys, $wPkeys);
1848 if (empty($keysToReplace)) {
1852 asort($keysToReplace);
1853 $storeKey = md5(
'substituteMarkerArrayCached_storeKey:' . serialize(array(
1857 if ($this->substMarkerCache[$storeKey]) {
1858 $storeArr = $this->substMarkerCache[$storeKey];
1859 $GLOBALS[
'TT']->setTSlogMessage(
'Cached', 0);
1861 $storeArrDat =
$GLOBALS[
'TSFE']->sys_page->getHash($storeKey);
1862 if (is_array($storeArrDat)) {
1863 $storeArr = $storeArrDat;
1865 $this->substMarkerCache[$storeKey] = $storeArr;
1866 $GLOBALS[
'TT']->setTSlogMessage(
'Cached from DB', 0);
1869 foreach ($sPkeys as $sPK) {
1873 foreach ($wPkeys as $wPK) {
1880 $storeArr = array();
1881 $result = preg_match_all(
'/###([^#](?:[^#]*+|#{1,2}[^#])+)###/', $content, $markersInContent);
1882 if (
$result !== FALSE && !empty($markersInContent[1])) {
1883 $keysToReplaceFlipped = array_flip($keysToReplace);
1884 $regexKeys = array();
1885 $wrappedKeys = array();
1887 foreach ($markersInContent[1] as $key) {
1888 if (isset($keysToReplaceFlipped[
'###' . $key .
'###'])) {
1889 $regexKeys[] = preg_quote($key,
'/');
1890 $wrappedKeys[] =
'###' . $key .
'###';
1893 $regex =
'/###(?:' . implode(
'|', $regexKeys) .
')###/';
1894 $storeArr[
'c'] = preg_split($regex, $content);
1895 $storeArr[
'k'] = $wrappedKeys;
1897 $this->substMarkerCache[$storeKey] = $storeArr;
1899 $GLOBALS[
'TSFE']->sys_page->storeHash($storeKey, $storeArr,
'substMarkArrayCached');
1901 $GLOBALS[
'TT']->setTSlogMessage(
'Parsing', 0);
1904 if (!empty($storeArr[
'k']) && is_array($storeArr[
'k'])) {
1907 $valueArr = array_merge($markContentArray, $subpartContentArray, $wrappedSubpartContentArray);
1908 $wSCA_reg = array();
1911 foreach ($storeArr[
'k'] as $n => $keyN) {
1913 $content .= $storeArr[
'c'][$n];
1914 if (!is_array($valueArr[$keyN])) {
1916 $content .= $valueArr[$keyN];
1918 if (!isset($wSCA_reg[$keyN])) {
1919 $wSCA_reg[$keyN] = 0;
1922 $content .= $valueArr[$keyN][$wSCA_reg[$keyN] % 2];
1927 $content .= $storeArr[
'c'][count($storeArr[
'k'])];
1952 public function substituteMarkerArray($content, array $markContentArray, $wrap =
'', $uppercase = FALSE, $deleteUnused = FALSE) {
1953 return \TYPO3\CMS\Core\Html\HtmlParser::substituteMarkerArray($content, $markContentArray, $wrap, $uppercase, $deleteUnused);
1965 if (is_array($tree)) {
1966 foreach ($tree as $key => $value) {
1986 return \TYPO3\CMS\Core\Html\HtmlParser::substituteMarkerAndSubpartArrayRecursive($content, $markersAndSubparts, $wrap, $uppercase, $deleteUnused);
2001 public function fillInMarkerArray(array $markContentArray, array $row, $fieldList =
'', $nl2br = TRUE, $prefix =
'FIELD_', $HSC = FALSE) {
2004 foreach ($fArr as $field) {
2005 $markContentArray[
'###' . $prefix . $field .
'###'] = $nl2br ? nl2br($row[$field], !empty(
$GLOBALS[
'TSFE']->xhtmlDoctype)) : $row[$field];
2008 if (is_array($row)) {
2009 foreach ($row as $field => $value) {
2012 $value = htmlspecialchars($value);
2014 $markContentArray[
'###' . $prefix . $field .
'###'] = $nl2br ? nl2br($value, !empty(
$GLOBALS[
'TSFE']->xhtmlDoctype)) : $value;
2019 return $markContentArray;
2028 $this->currentFile = $fileObject;
2056 public function stdWrap($content =
'', $conf = array()) {
2059 if ($this->stdWrapHookObjects) {
2060 $conf[
'stdWrapPreProcess'] = 1;
2061 $conf[
'stdWrapOverride'] = 1;
2062 $conf[
'stdWrapProcess'] = 1;
2063 $conf[
'stdWrapPostProcess'] = 1;
2066 if (!is_array($conf) || !$conf) {
2071 if (is_array($conf[
'cache.'])) {
2072 $conf[
'cache.'][
'key'] = $this->
stdWrap($conf[
'cache.'][
'key'], $conf[
'cache.'][
'key.']);
2073 $conf[
'cache.'][
'tags'] = $this->
stdWrap($conf[
'cache.'][
'tags'], $conf[
'cache.'][
'tags.']);
2074 $conf[
'cache.'][
'lifetime'] = $this->
stdWrap($conf[
'cache.'][
'lifetime'], $conf[
'cache.'][
'lifetime.']);
2075 $conf[
'cacheRead'] = 1;
2076 $conf[
'cacheStore'] = 1;
2080 $sortedConf = array_intersect_key($this->stdWrapOrder, $conf);
2082 $stdWrapDisabledFunctionTypes =
'cObject,functionName,stdWrap';
2084 $isExecuted = array();
2087 $this->stdWrapRecursionLevel++;
2090 foreach ($sortedConf as $stdWrapName => $functionType) {
2092 if (!$isExecuted[$stdWrapName] && !$this->stopRendering[$this->stdWrapRecursionLevel]) {
2093 $functionName = rtrim($stdWrapName,
'.');
2094 $functionProperties = $functionName .
'.';
2099 if (count($conf[$functionProperties]) && !
GeneralUtility::inList($stdWrapDisabledFunctionTypes, $functionType)) {
2100 if (array_intersect_key($this->stdWrapOrder, $conf[$functionProperties])) {
2101 $conf[$functionName] = $this->
stdWrap($conf[$functionName], $conf[$functionProperties]);
2105 if ((isset($conf[$functionName]) || $conf[$functionProperties]) && ($functionType !==
'boolean' || $conf[$functionName])) {
2107 $singleConf = array(
2108 $functionName => $conf[$functionName],
2109 $functionProperties => $conf[$functionProperties]
2112 if ($functionName ===
'spaceBefore' || $functionName ===
'spaceAfter') {
2113 $singleConf[
'space.'] = $conf[
'space.'];
2116 if ($functionType ===
'hook') {
2117 $singleConf = $conf;
2120 $isExecuted[$functionName] = TRUE;
2121 $isExecuted[$functionProperties] = TRUE;
2123 $functionName =
'stdWrap_' . $functionName;
2124 $content = $this->{$functionName}($content, $singleConf);
2125 } elseif ($functionType ==
'boolean' && !$conf[$functionName]) {
2126 $isExecuted[$functionName] = TRUE;
2127 $isExecuted[$functionProperties] = TRUE;
2131 unset($this->stopRendering[$this->stdWrapRecursionLevel]);
2132 $this->stdWrapRecursionLevel--;
2146 if (isset($config[$key])) {
2147 if (!isset($config[$key .
'.'])) {
2148 return $config[$key];
2150 } elseif (isset($config[$key .
'.'])) {
2153 return $defaultValue;
2155 $stdWrapped = $this->
stdWrap($config[$key], $config[$key .
'.']);
2156 return $stdWrapped ?: $defaultValue;
2169 foreach ($this->stdWrapHookObjects as $hookObject) {
2170 $content = $hookObject->stdWrapPreProcess($content, $conf, $this);
2182 public function stdWrap_cacheRead($content =
'', $conf = array()) {
2183 if (!empty($conf[
'cache.'][
'key'])) {
2186 if ($cacheFrontend && $cacheFrontend->has($conf[
'cache.'][
'key'])) {
2187 $content = $cacheFrontend->get($conf[
'cache.'][
'key']);
2202 $tags = isset($conf[
'addPageCacheTags.'])
2203 ? $this->
stdWrap($conf[
'addPageCacheTags'], $conf[
'addPageCacheTags.'])
2204 : $conf[
'addPageCacheTags'];
2205 if (!empty($tags)) {
2207 $GLOBALS[
'TSFE']->addCacheTags($cacheTags);
2247 if (isset($conf[
'lang.']) &&
$GLOBALS[
'TSFE']->config[
'config'][
'language'] && isset($conf[
'lang.'][
$GLOBALS[
'TSFE']->config[
'config'][
'language']])) {
2248 $content = $conf[
'lang.'][
$GLOBALS[
'TSFE']->config[
'config'][
'language']];
2262 $content = $this->
getData($conf[
'data'], is_array($this->alternativeData) ? $this->alternativeData : $this->data);
2264 $this->alternativeData =
'';
2303 return $this->cObjGetSingle($conf[
'cObject'], $conf[
'cObject.'],
'/stdWrap/.cObject');
2316 return $this->
numRows($conf[
'numRows.']);
2328 return $this->
filelist($conf[
'filelist']);
2340 return $this->
callUserFunction($conf[
'preUserFunc'], $conf[
'preUserFunc.'], $content);
2353 foreach ($this->stdWrapHookObjects as $hookObject) {
2354 $content = $hookObject->stdWrapOverride($content, $conf, $this);
2368 if (trim($conf[
'override'])) {
2369 $content = $conf[
'override'];
2384 return $this->
listNum($content, $conf[
'preIfEmptyListNum'], $conf[
'preIfEmptyListNum.'][
'splitChar']);
2396 return $content !== NULL ? $content : $conf[
'ifNull'];
2409 if (!trim($content)) {
2410 $content = $conf[
'ifEmpty'];
2425 if (!strlen(trim($content))) {
2426 $content = $conf[
'ifBlank'];
2442 return $this->
listNum($content, $conf[
'listNum'], $conf[
'listNum.'][
'splitChar']);
2454 return trim($content);
2471 $padType = STR_PAD_RIGHT;
2472 if (!empty($conf[
'strPad.'][
'length'])) {
2473 $length = isset($conf[
'strPad.'][
'length.']) ? $this->
stdWrap($conf[
'strPad.'][
'length'], $conf[
'strPad.'][
'length.']) : $conf[
'strPad.'][
'length'];
2474 $length = (int)$length;
2476 if (isset($conf[
'strPad.'][
'padWith']) && strlen($conf[
'strPad.'][
'padWith']) > 0) {
2477 $padWith = isset($conf[
'strPad.'][
'padWith.']) ? $this->
stdWrap($conf[
'strPad.'][
'padWith'], $conf[
'strPad.'][
'padWith.']) : $conf[
'strPad.'][
'padWith'];
2479 if (!empty($conf[
'strPad.'][
'type'])) {
2480 $type = isset($conf[
'strPad.'][
'type.']) ? $this->
stdWrap($conf[
'strPad.'][
'type'], $conf[
'strPad.'][
'type.']) : $conf[
'strPad.'][
'type'];
2481 if (strtolower($type) ===
'left') {
2482 $padType = STR_PAD_LEFT;
2483 } elseif (strtolower($type) ===
'both') {
2484 $padType = STR_PAD_BOTH;
2487 $content = str_pad($content, $length, $padWith, $padType);
2503 return $this->
stdWrap($content, $conf[
'stdWrap.']);
2516 foreach ($this->stdWrapHookObjects as $hookObject) {
2517 $content = $hookObject->stdWrapProcess($content, $conf, $this);
2532 if ((
string) $content ===
'') {
2549 if (empty($conf[
'if.']) || $this->
checkIf($conf[
'if.'])) {
2566 if (!trim($this->data[$conf[
'fieldRequired']])) {
2582 return $GLOBALS[
'TSFE']->csConv($content, $conf[
'csConv']);
2595 return $this->
parseFunc($content, $conf[
'parseFunc.'], $conf[
'parseFunc']);
2608 if (is_array($conf[
'HTMLparser.'])) {
2624 return $this->
splitObj($content, $conf[
'split.']);
2636 return $this->
replacement($content, $conf[
'replacement.']);
2650 if ($conf[
'prioriCalc'] ==
'intval') {
2651 $content = (int)$content;
2665 return chr((
int)$conf[
'char']);
2677 return (
int)$content;
2689 $algorithm = isset($conf[
'hash.']) ? $this->
stdWrap($conf[
'hash'], $conf[
'hash.']) : $conf[
'hash'];
2690 if (function_exists(
'hash') && in_array($algorithm, hash_algos())) {
2691 $content = hash($algorithm, $content);
2708 return $this->
round($content, $conf[
'round.']);
2720 return $this->
numberFormat($content, $conf[
'numberFormat.']);
2746 $content = $content ==
'' ?
$GLOBALS[
'EXEC_TIME'] : (int)$content;
2747 $content = $conf[
'date.'][
'GMT'] ? gmdate($conf[
'date'], $content) : date($conf[
'date'], $content);
2762 $content = $content ==
'' ?
$GLOBALS[
'EXEC_TIME'] : (int)$content;
2763 $content = $conf[
'strftime.'][
'GMT'] ? gmstrftime($conf[
'strftime'], $content) : strftime($conf[
'strftime'], $content);
2764 $tmp_charset = $conf[
'strftime.'][
'charset'] ? $conf[
'strftime.'][
'charset'] :
$GLOBALS[
'TSFE']->localeCharset;
2766 $content =
$GLOBALS[
'TSFE']->csConv($content, $tmp_charset);
2780 return $this->
calcAge(
$GLOBALS[
'EXEC_TIME'] - $content, $conf[
'age']);
2817 return $this->
substring($content, $conf[
'substring']);
2829 return $this->
removeBadHTML($content, $conf[
'removeBadHTML.']);
2841 return $this->
cropHTML($content, $conf[
'cropHTML']);
2853 return strip_tags($content);
2865 return $this->
crop($content, $conf[
'crop']);
2877 return rawurlencode($content);
2890 if (!empty($conf[
'htmlSpecialChars.'][
'preserveEntities'])) {
2891 $content = htmlspecialchars($content, ENT_COMPAT,
'UTF-8', FALSE);
2893 $content = htmlspecialchars($content);
2920 return preg_replace(
'/ 2924 /', $conf[
'doubleBrTag'], $content);
2937 return nl2br($content, !empty(
$GLOBALS[
'TSFE']->xhtmlDoctype));
2949 return str_replace(LF, $conf[
'brTag'], $content);
2987 return $this->
wrap($content, $conf[
'innerWrap']);
3000 return $this->
wrap($content, $conf[
'innerWrap2']);
3014 return $this->
wrap($content, $conf[
'fontTag']);
3026 return $this->
addParams($content, $conf[
'addParams.']);
3039 return $this->
textStyle($content, $conf[
'textStyle.']);
3052 return $this->
tableStyle($content, $conf[
'tableStyle.']);
3065 return $this->
filelink($content, $conf[
'filelink.']);
3077 return $this->cObjGetSingle($conf[
'preCObject'], $conf[
'preCObject.'],
'/stdWrap/.preCObject') . $content;
3089 return $content . $this->cObjGetSingle($conf[
'postCObject'], $conf[
'postCObject.'],
'/stdWrap/.postCObject');
3102 $wrapAlign = trim($conf[
'wrapAlign']);
3104 $content = $this->
wrap($content,
'<div style="text-align:' . htmlspecialchars($wrapAlign) .
';">|</div>');
3120 return $this->typolink($content, $conf[
'typolink.']);
3132 if (is_array($conf[
'TCAselectItem.'])) {
3133 $content = $this->
TCAlookup($content, $conf[
'TCAselectItem.']);
3148 return $this->
wrapSpace($content, trim($conf[
'spaceBefore']) .
'|', $conf[
'space.']);
3161 return $this->
wrapSpace($content,
'|' . trim($conf[
'spaceAfter']), $conf[
'space.']);
3175 return $this->
wrapSpace($content, trim($conf[
'space']), $conf[
'space.']);
3191 return $this->
wrap($content, $conf[
'wrap'], $conf[
'wrap.'][
'splitChar'] ? $conf[
'wrap.'][
'splitChar'] :
'|');
3204 $splitChar = isset($conf[
'noTrimWrap.'][
'splitChar.'])
3205 ? $this->
stdWrap($conf[
'noTrimWrap.'][
'splitChar'], $conf[
'noTrimWrap.'][
'splitChar.'])
3206 : $conf[
'noTrimWrap.'][
'splitChar'];
3207 if ($splitChar === NULL || $splitChar ===
'') {
3212 $conf[
'noTrimWrap'],
3228 return $this->
wrap($content, $conf[
'wrap2'], $conf[
'wrap2.'][
'splitChar'] ? $conf[
'wrap2.'][
'splitChar'] :
'|');
3241 return $this->
dataWrap($content, $conf[
'dataWrap']);
3253 return $this->cObjGetSingle($conf[
'prepend'], $conf[
'prepend.'],
'/stdWrap/.prepend') . $content;
3265 return $content . $this->cObjGetSingle($conf[
'append'], $conf[
'append.'],
'/stdWrap/.append');
3278 return $this->
wrap($content, $conf[
'wrap3'], $conf[
'wrap3.'][
'splitChar'] ? $conf[
'wrap3.'][
'splitChar'] :
'|');
3291 foreach ($sortedKeysArray as $key) {
3292 $content = $this->
stdWrap($content, $conf[
'orderedStdWrap.'][$key .
'.']);
3306 return $this->
wrap($content, $conf[
'outerWrap']);
3332 if ($conf[
'offsetWrap.'][
'tableParams'] || $conf[
'offsetWrap.'][
'tableParams.']) {
3333 $controlTable->tableParams = isset($conf[
'offsetWrap.'][
'tableParams.']) ? $this->
stdWrap($conf[
'offsetWrap.'][
'tableParams'], $conf[
'offsetWrap.'][
'tableParams.']) : $conf[
'offsetWrap.'][
'tableParams'];
3335 if ($conf[
'offsetWrap.'][
'tdParams'] || $conf[
'offsetWrap.'][
'tdParams.']) {
3336 $controlTable->tdParams =
' ' . (isset($conf[
'offsetWrap.'][
'tdParams.']) ? $this->
stdWrap($conf[
'offsetWrap.'][
'tdParams'], $conf[
'offsetWrap.'][
'tdParams.']) : $conf[
'offsetWrap.'][
'tdParams']);
3338 $content = $controlTable->start($content, $conf[
'offsetWrap']);
3339 if ($conf[
'offsetWrap.'][
'stdWrap.']) {
3340 $content = $this->
stdWrap($content, $conf[
'offsetWrap.'][
'stdWrap.']);
3354 return $this->
callUserFunction($conf[
'postUserFunc'], $conf[
'postUserFunc.'], $content);
3367 $substKey =
'INT_SCRIPT.' .
$GLOBALS[
'TSFE']->uniqueHash();
3368 $GLOBALS[
'TSFE']->config[
'INTincScript'][$substKey] = array(
3369 'content' => $content,
3370 'postUserFunc' => $conf[
'postUserFuncInt'],
3371 'conf' => $conf[
'postUserFuncInt.'],
3372 'type' =>
'POSTUSERFUNC',
3373 'cObj' => serialize($this)
3375 $content =
'<!--' . $substKey .
'-->';
3388 if (!
$GLOBALS[
'TSFE']->config[
'config'][
'disablePrefixComment'] && !empty($conf[
'prefixComment'])) {
3389 $content = $this->
prefixComment($conf[
'prefixComment'], array(), $content);
3403 if (
$GLOBALS[
'TSFE']->beUserLogin && $conf[
'editIcons']) {
3404 if (!is_array($conf[
'editIcons.'])) {
3405 $conf[
'editIcons.'] = array();
3407 $content = $this->
editIcons($content, $conf[
'editIcons'], $conf[
'editIcons.']);
3421 if (
$GLOBALS[
'TSFE']->beUserLogin) {
3422 $content = $this->
editPanel($content, $conf[
'editPanel.']);
3434 public function stdWrap_cacheStore($content =
'', $conf = array()) {
3435 if (!empty($conf[
'cache.'][
'key'])) {
3438 if ($cacheFrontend) {
3440 if (strtolower($conf[
'cache.'][
'lifetime']) ==
'unlimited') {
3443 } elseif (strtolower($conf[
'cache.'][
'lifetime']) ==
'default') {
3446 } elseif ((
int)$conf[
'cache.'][
'lifetime'] > 0) {
3448 $lifetime = (int)$conf[
'cache.'][
'lifetime'];
3453 if (is_array(
$GLOBALS[
'TYPO3_CONF_VARS'][
'SC_OPTIONS'][
'tslib/class.tslib_content.php'][
'stdWrap_cacheStore'])) {
3454 foreach (
$GLOBALS[
'TYPO3_CONF_VARS'][
'SC_OPTIONS'][
'tslib/class.tslib_content.php'][
'stdWrap_cacheStore'] as $_funcRef) {
3456 'key' => $conf[
'cache.'][
'key'],
3457 'content' => $content,
3458 'lifetime' => $lifetime,
3464 $cacheFrontend->set($conf[
'cache.'][
'key'], $content, $tags, $lifetime);
3480 foreach ($this->stdWrapHookObjects as $hookObject) {
3481 $content = $hookObject->stdWrapPostProcess($content, $conf, $this);
3495 return '<pre>' . htmlspecialchars($content) .
'</pre>';
3507 debug($conf[
'debugFunc'] == 2 ? array(
3522 debug($this->data,
'$cObj->data:');
3523 if (is_array($this->alternativeData)) {
3524 debug($this->alternativeData,
'$this->alternativeData');
3541 $conf[
'select.'][
'selectFields'] =
'count(*)';
3542 $res = $this->
exec_getQuery($conf[
'table'], $conf[
'select.']);
3543 if ($error =
$GLOBALS[
'TYPO3_DB']->sql_error()) {
3544 $GLOBALS[
'TT']->setTSlogMessage($error, 3);
3546 $row =
$GLOBALS[
'TYPO3_DB']->sql_fetch_row($res);
3549 $GLOBALS[
'TYPO3_DB']->sql_free_result($res);
3562 public function listNum($content, $listNum, $char) {
3563 $char = $char ?:
',';
3567 $temp = explode($char, $content);
3568 $last =
'' . (count($temp) - 1);
3570 if ($listNum ===
'rand') {
3571 $listNum = rand(0, count($temp) - 1);
3573 $index = $this->
calc(str_ireplace(
'last', $last, $listNum));
3574 return $temp[$index];
3587 if (!is_array($conf)) {
3590 if (isset($conf[
'directReturn'])) {
3591 return $conf[
'directReturn'] ? 1 : 0;
3594 if (isset($conf[
'isNull.'])) {
3595 $isNull = $this->
stdWrap(
'', $conf[
'isNull.']);
3596 if ($isNull !== NULL) {
3600 if (isset($conf[
'isTrue']) || isset($conf[
'isTrue.'])) {
3601 $isTrue = isset($conf[
'isTrue.']) ? trim($this->
stdWrap($conf[
'isTrue'], $conf[
'isTrue.'])) : trim($conf[
'isTrue']);
3606 if (isset($conf[
'isFalse']) || isset($conf[
'isFalse.'])) {
3607 $isFalse = isset($conf[
'isFalse.']) ? trim($this->
stdWrap($conf[
'isFalse'], $conf[
'isFalse.'])) : trim($conf[
'isFalse']);
3612 if (isset($conf[
'isPositive']) || isset($conf[
'isPositive.'])) {
3613 $number = isset($conf[
'isPositive.']) ? $this->
calc($this->
stdWrap($conf[
'isPositive'], $conf[
'isPositive.'])) : $this->
calc($conf[
'isPositive']);
3619 $value = isset($conf[
'value.']) ? trim($this->
stdWrap($conf[
'value'], $conf[
'value.'])) : trim($conf[
'value']);
3620 if (isset($conf[
'isGreaterThan']) || isset($conf[
'isGreaterThan.'])) {
3621 $number = isset($conf[
'isGreaterThan.']) ? trim($this->
stdWrap($conf[
'isGreaterThan'], $conf[
'isGreaterThan.'])) : trim($conf[
'isGreaterThan']);
3622 if ($number <= $value) {
3626 if (isset($conf[
'isLessThan']) || isset($conf[
'isLessThan.'])) {
3627 $number = isset($conf[
'isLessThan.']) ? trim($this->
stdWrap($conf[
'isLessThan'], $conf[
'isLessThan.'])) : trim($conf[
'isLessThan']);
3628 if ($number >= $value) {
3632 if (isset($conf[
'equals']) || isset($conf[
'equals.'])) {
3633 $number = isset($conf[
'equals.']) ? trim($this->
stdWrap($conf[
'equals'], $conf[
'equals.'])) : trim($conf[
'equals']);
3634 if ($number != $value) {
3638 if (isset($conf[
'isInList']) || isset($conf[
'isInList.'])) {
3639 $number = isset($conf[
'isInList.']) ? trim($this->
stdWrap($conf[
'isInList'], $conf[
'isInList.'])) : trim($conf[
'isInList']);
3645 if ($conf[
'negate']) {
3646 $flag = $flag ? 0 : 1;
3664 $data_arr = explode(
'|',
$data);
3667 if (
$GLOBALS[
'TSFE']->lockFilePath) {
3676 'sorting' => array()
3679 $sorting = trim($data_arr[2]);
3682 $tempArray = array();
3683 if (is_object($d)) {
3685 while ($entry = $d->read()) {
3686 if ($entry !=
'.' && $entry !=
'..') {
3688 $wholePath = $path .
'/' . $entry;
3689 if (file_exists($wholePath) && filetype($wholePath) ==
'file') {
3692 $items[
'files'][] = $info[
'file'];
3695 $items[
'sorting'][] = strtolower($info[
'file']);
3698 $items[
'sorting'][] = filesize($wholePath);
3701 $items[
'sorting'][] = $info[
'fileext'];
3704 $items[
'sorting'][] = filectime($wholePath);
3707 $items[
'sorting'][] = filemtime($wholePath);
3710 $items[
'sorting'][] = $count;
3720 if (count($items[
'sorting'])) {
3721 if (strtolower(trim($data_arr[3])) !=
'r') {
3722 asort($items[
'sorting']);
3724 arsort($items[
'sorting']);
3727 if (count($items[
'files'])) {
3729 reset($items[
'sorting']);
3730 $fullPath = trim($data_arr[4]);
3731 $list_arr = array();
3732 foreach ($items[
'sorting'] as $key => $v) {
3733 $list_arr[] = $fullPath ? $path .
'/' . $items[
'files'][$key] : $items[
'files'][$key];
3735 return implode(
',', $list_arr);
3754 $theDir = preg_replace(
'/[\\/\\. ]*$/',
'', $theDir);
3774 $htmlParserCfg = $htmlParser->HTMLparserConfig($conf);
3775 return $htmlParser->HTMLcleaner($theValue, $htmlParserCfg[0], $htmlParserCfg[1], $htmlParserCfg[2], $htmlParserCfg[3]);
3804 $totalLen = strlen($str);
3807 $len = strcspn(substr($str, $pointer),
'{');
3808 $newVal .= substr($str, $pointer, $len);
3811 $len = strcspn(substr($str, $pointer),
'}') + 1;
3812 $newVal .= $this->
getData(substr($str, $pointer + 1, $len - 2), $this->data);
3816 }
while ($pointer < $totalLen);
3835 $parts = explode(
'|', $str);
3836 $indent = (int)$parts[0];
3837 $comment = htmlspecialchars($this->
insertData($parts[1]));
3839 . str_pad(
'', $indent, TAB) .
'<!-- ' . $comment .
' [begin] -->' . LF
3840 . str_pad(
'', ($indent + 1), TAB) . $content . LF
3841 . str_pad(
'', $indent, TAB) .
'<!-- ' . $comment .
' [end] -->' . LF
3842 . str_pad(
'', ($indent + 1), TAB);
3859 return $GLOBALS[
'TSFE']->csConvObj->substr(
$GLOBALS[
'TSFE']->renderCharset, $content, $options[0], $options[1]);
3861 return $GLOBALS[
'TSFE']->csConvObj->substr(
$GLOBALS[
'TSFE']->renderCharset, $content, $options[0]);
3875 public function crop($content, $options) {
3876 $options = explode(
'|', $options);
3877 $chars = (int)$options[0];
3878 $afterstring = trim($options[1]);
3879 $crop2space = trim($options[2]);
3881 if (
$GLOBALS[
'TSFE']->csConvObj->strlen(
$GLOBALS[
'TSFE']->renderCharset, $content) > abs($chars)) {
3882 $truncatePosition = FALSE;
3884 $content =
$GLOBALS[
'TSFE']->csConvObj->substr(
$GLOBALS[
'TSFE']->renderCharset, $content, $chars);
3886 $truncatePosition = strpos($content,
' ');
3888 $content = $truncatePosition ? $afterstring . substr($content, $truncatePosition) : $afterstring . $content;
3890 $content =
$GLOBALS[
'TSFE']->csConvObj->substr(
$GLOBALS[
'TSFE']->renderCharset, $content, 0, $chars);
3892 $truncatePosition = strrpos($content,
' ');
3894 $content = $truncatePosition ? substr($content, 0, $truncatePosition) . $afterstring : $content . $afterstring;
3916 $options = explode(
'|', $options);
3917 $chars = (int)$options[0];
3918 $absChars = abs($chars);
3919 $replacementForEllipsis = trim($options[1]);
3920 $crop2space = trim($options[2]) ===
'1' ? TRUE : FALSE;
3922 $tags =
'a|abbr|address|area|article|aside|audio|b|bdi|bdo|blockquote|body|br|button|caption|cite|code|col|colgroup|data|datalist|dd|del|dfn|div|dl|dt|em|embed|fieldset|figcaption|figure|font|footer|form|h1|h2|h3|h4|h5|h6|header|hr|i|iframe|img|input|ins|kbd|keygen|label|legend|li|link|main|map|mark|meter|nav|object|ol|optgroup|option|output|p|param|pre|progress|q|rb|rp|rt|rtc|ruby|s|samp|section|select|small|source|span|strong|sub|sup|table|tbody|td|textarea|tfoot|th|thead|time|tr|track|u|ul|ut|var|video|wbr';
3926 <!--.*?--> # a comment 3928 <canvas[^>]*>.*?</canvas> # a canvas tag 3930 <script[^>]*>.*?</script> # a script tag 3932 <noscript[^>]*>.*?</noscript> # a noscript tag 3934 <template[^>]*>.*?</template> # a template tag 3937 </?(?:' . $tags .
')+ # opening tag (\'<tag\') or closing tag (\'</tag\') 3941 \\s+\\w[\\w-]* # EITHER spaces, followed by attribute names 3945 ".*?" # attribute values in double-quotes 3947 \'.*?\' # attribute values in single-quotes 3949 [^\'">\\s]+ # plain attribute values 3953 | # OR a single dash (for TYPO3 link tag) 3961 /?> # closing the tag with \'>\' or \'/>\' 3963 $splittedContent = preg_split(
'%' . $tagsRegEx .
'%xs', $content, -1, PREG_SPLIT_DELIM_CAPTURE);
3966 $splittedContent = array_reverse($splittedContent);
3971 $croppedOffset = NULL;
3972 $countSplittedContent = count($splittedContent);
3973 for ($offset = 0; $offset < $countSplittedContent; $offset++) {
3974 if ($offset % 2 === 0) {
3975 $tempContent =
$GLOBALS[
'TSFE']->csConvObj->utf8_encode($splittedContent[$offset],
$GLOBALS[
'TSFE']->renderCharset);
3976 $thisStrLen =
$GLOBALS[
'TSFE']->csConvObj->strlen(
'utf-8', html_entity_decode($tempContent, ENT_COMPAT,
'UTF-8'));
3977 if ($strLen + $thisStrLen > $absChars) {
3978 $croppedOffset = $offset;
3979 $cropPosition = $absChars - $strLen;
3981 $patternMatchEntityAsSingleChar =
'(&[^&\\s;]{2,8};|.)';
3982 $cropRegEx = $chars < 0 ?
'#' . $patternMatchEntityAsSingleChar .
'{0,' . ($cropPosition + 1) .
'}$#uis' :
'#^' . $patternMatchEntityAsSingleChar .
'{0,' . ($cropPosition + 1) .
'}#uis';
3983 if (preg_match($cropRegEx, $tempContent, $croppedMatch)) {
3984 $tempContentPlusOneCharacter = $croppedMatch[0];
3986 $tempContentPlusOneCharacter = FALSE;
3988 $cropRegEx = $chars < 0 ?
'#' . $patternMatchEntityAsSingleChar .
'{0,' . $cropPosition .
'}$#uis' :
'#^' . $patternMatchEntityAsSingleChar .
'{0,' . $cropPosition .
'}#uis';
3989 if (preg_match($cropRegEx, $tempContent, $croppedMatch)) {
3990 $tempContent = $croppedMatch[0];
3991 if ($crop2space && $tempContentPlusOneCharacter !== FALSE) {
3992 $cropRegEx = $chars < 0 ?
'#(?<=\\s)' . $patternMatchEntityAsSingleChar .
'{0,' . $cropPosition .
'}$#uis' :
'#^' . $patternMatchEntityAsSingleChar .
'{0,' . $cropPosition .
'}(?=\\s)#uis';
3993 if (preg_match($cropRegEx, $tempContentPlusOneCharacter, $croppedMatch)) {
3994 $tempContent = $croppedMatch[0];
3998 $splittedContent[$offset] =
$GLOBALS[
'TSFE']->csConvObj->utf8_decode($tempContent,
$GLOBALS[
'TSFE']->renderCharset);
4001 $strLen += $thisStrLen;
4006 $closingTags = array();
4007 if ($croppedOffset !== NULL) {
4009 $openingTagRegEx =
'#^<(\\w+)(?:\\s|>)#';
4010 $closingTagRegEx =
'#^</(\\w+)(?:\\s|>)#';
4011 for ($offset = $croppedOffset - 1; $offset >= 0; $offset = $offset - 2) {
4012 if (substr($splittedContent[$offset], -2) ===
'/>') {
4016 preg_match($chars < 0 ? $closingTagRegEx : $openingTagRegEx, $splittedContent[$offset], $matches);
4017 $tagName = isset($matches[1]) ? $matches[1] : NULL;
4018 if ($tagName !== NULL) {
4020 $seekingTagName =
'';
4021 $countSplittedContent = count($splittedContent);
4022 for ($seekingOffset = $offset + 2; $seekingOffset < $countSplittedContent; $seekingOffset = $seekingOffset + 2) {
4023 preg_match($chars < 0 ? $openingTagRegEx : $closingTagRegEx, $splittedContent[$seekingOffset], $matches);
4024 $seekingTagName = isset($matches[1]) ? $matches[1] : NULL;
4025 if ($tagName === $seekingTagName) {
4028 if ($seekingOffset > $croppedOffset) {
4029 $closingTags[] = $splittedContent[$seekingOffset];
4037 array_splice($splittedContent, $croppedOffset + 1);
4039 $splittedContent = array_merge($splittedContent, array(
4040 $croppedOffset !== NULL ? $replacementForEllipsis :
'' 4044 $splittedContent = array_reverse($splittedContent);
4046 return implode(
'', $splittedContent);
4063 $text = preg_replace(array(
4064 '\'<script[^>]*?>.*?</script[^>]*?>\
'si',
4065 '\'<applet[^>]*?>.*?</applet[^>]*?>\
'si',
4066 '\'<
object[^>]*?>.*?</
object[^>]*?>\
'si',
4067 '\'<iframe[^>]*?>.*?</iframe[^>]*?>\
'si',
4068 '\'<frameset[^>]*?>.*?</frameset[^>]*?>\
'si',
4069 '\'<style[^>]*?>.*?</style[^>]*?>\
'si',
4070 '\'<marquee[^>]*?>.*?</marquee[^>]*?>\
'si',
4071 '\'<script[^>]*?>\
'si',
4072 '\'<meta[^>]*?>\
'si',
4073 '\'<base[^>]*?>\
'si',
4074 '\'<applet[^>]*?>\
'si',
4075 '\'<
object[^>]*?>\
'si',
4076 '\'<link[^>]*?>\
'si',
4077 '\'<iframe[^>]*?>\
'si',
4078 '\'<frame[^>]*?>\
'si',
4079 '\'<frameset[^>]*?>\
'si',
4080 '\'<input[^>]*?>\
'si',
4081 '\'<form[^>]*?>\
'si',
4082 '\'<embed[^>]*?>\
'si',
4083 '\'background-image:url\
'si',
4084 '\'<\\w+.*?(onabort|onbeforeunload|onblur|onchange|onclick|ondblclick|ondragdrop|onerror|onfilterchange|onfocus|onhelp|onkeydown|onkeypress|onkeyup|onload|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|onmove|onreadystatechange|onreset|onresize|onscroll|onselect|onselectstart|onsubmit|onunload).*?>\
'si' 4086 $text = preg_replace(
'/<a[^>]*href[[:space:]]*=[[:space:]]*["\']?[[:space:]]*javascript[^>]*/i',
'', $text);
4102 $conf[
'face.'][1] =
'Times New Roman';
4103 $conf[
'face.'][2] =
'Verdana,Arial,Helvetica,Sans serif';
4104 $conf[
'face.'][3] =
'Arial,Helvetica,Sans serif';
4105 $conf[
'size.'][1] = 1;
4106 $conf[
'size.'][2] = 2;
4107 $conf[
'size.'][3] = 3;
4108 $conf[
'size.'][4] = 4;
4109 $conf[
'size.'][5] = 5;
4110 $conf[
'size.'][10] =
'+1';
4111 $conf[
'size.'][11] =
'-1';
4112 $conf[
'color.'][240] =
'black';
4113 $conf[
'color.'][241] =
'white';
4114 $conf[
'color.'][242] =
'#333333';
4115 $conf[
'color.'][243] =
'gray';
4116 $conf[
'color.'][244] =
'silver';
4117 $conf[
'color.'][245] =
'red';
4118 $conf[
'color.'][246] =
'navy';
4119 $conf[
'color.'][247] =
'yellow';
4120 $conf[
'color.'][248] =
'green';
4121 $conf[
'color.'][249] =
'olive';
4122 $conf[
'color.'][250] =
'maroon';
4123 $face = $this->data[$conf[
'face.'][
'field']];
4124 $size = $this->data[$conf[
'size.'][
'field']];
4125 $color = $this->data[$conf[
'color.'][
'field']];
4126 $align = $this->data[$conf[
'align.'][
'field']];
4127 $properties = $this->data[$conf[
'properties.'][
'field']];
4129 $properties = isset($conf[
'properties.'][
'default.']) ? $this->
stdWrap($conf[
'properties.'][
'default'], $conf[
'properties.'][
'default.']) : $conf[
'properties.'][
'default'];
4132 if ($properties & 8) {
4135 if ($properties & 1) {
4136 $theValue =
'<strong>' . $theValue .
'</strong>';
4138 if ($properties & 2) {
4139 $theValue =
'<i>' . $theValue .
'</i>';
4141 if ($properties & 4) {
4142 $theValue =
'<u>' . $theValue .
'</u>';
4145 $theFace = $conf[
'face.'][$face];
4147 $theFace = isset($conf[
'face.'][
'default.']) ? $this->
stdWrap($conf[
'face.'][
'default'], $conf[
'face.'][
'default.']) : $conf[
'face.'][
'default'];
4149 $theSize = $conf[
'size.'][$size];
4151 $theSize = isset($conf[
'size.'][
'default.']) ? $this->
stdWrap($conf[
'size.'][
'default'], $conf[
'size.'][
'default.']) : $conf[
'size.'][
'default'];
4153 $theColor = $conf[
'color.'][$color];
4155 $theColor = isset($conf[
'color.'][
'default.']) ? $this->
stdWrap($conf[
'color.'][
'default'], $conf[
'color.'][
'default.']) : $conf[
'color.'][
'default.'];
4157 if ($conf[
'altWrap']) {
4158 $theValue = $this->
wrap($theValue, $conf[
'altWrap']);
4159 } elseif ($theFace || $theSize || $theColor) {
4160 $theValue =
'<font' . ($theFace ?
' face="' . htmlspecialchars($theFace) .
'"' :
'') . ($theSize ?
' size="' . (
int)$theSize .
'"' :
'') . ($theColor ?
' color="' . htmlspecialchars($theColor) .
'"' :
'') .
'>' . $theValue .
'</font>';
4164 $theValue = $this->
wrap($theValue,
'<div style="text-align:' . htmlspecialchars(
$align) .
';">|</div>');
4181 $conf[
'color.'][240] =
'black';
4182 $conf[
'color.'][241] =
'white';
4183 $conf[
'color.'][242] =
'#333333';
4184 $conf[
'color.'][243] =
'gray';
4185 $conf[
'color.'][244] =
'silver';
4186 $align = isset($conf[
'align.']) ? $this->
stdWrap($conf[
'align'], $conf[
'align.']) : $conf[
'align'];
4187 $border = isset($conf[
'border.']) ? (int)$this->
stdWrap($conf[
'border'], $conf[
'border.']) : (int)$conf[
'border'];
4188 $cellspacing = isset($conf[
'cellspacing.']) ? (int)$this->
stdWrap($conf[
'cellspacing'], $conf[
'cellspacing.']) : (int)$conf[
'cellspacing'];
4189 $cellpadding = isset($conf[
'cellpadding.']) ? (int)$this->
stdWrap($conf[
'cellpadding'], $conf[
'cellpadding.']) : (int)$conf[
'cellpadding'];
4190 $color = $this->data[$conf[
'color.'][
'field']];
4191 $theColor = $conf[
'color.'][$color] ? $conf[
'color.'][$color] : $conf[
'color.'][
'default'];
4193 $tableTagArray = array(
4196 $tableTagArray[] =
'border="' . (int)$border .
'"';
4197 $tableTagArray[] =
'cellspacing="' . (int)$cellspacing .
'"';
4198 $tableTagArray[] =
'cellpadding="' . (int)$cellpadding .
'"';
4200 $tableTagArray[] =
'align="' . htmlspecialchars(
$align) .
'"';
4203 $tableTagArray[] =
'bgcolor="' . htmlspecialchars($theColor) .
'"';
4205 if ($conf[
'params']) {
4206 $tableTagArray[] = $conf[
'params'];
4208 $tableWrap = implode(
' ', $tableTagArray) .
'> | </table>';
4209 $theValue = $this->
wrap($theValue, $tableWrap);
4225 $lowerCaseAttributes = TRUE;
4226 if (!is_array($conf)) {
4230 $parts = explode(
'<', $content);
4231 if ((
int)$conf[
'_offset']) {
4232 $key = (int)$conf[
'_offset'] < 0 ? count($parts) + (int)$conf[
'_offset'] : (
int)$conf[
'_offset'];
4234 $subparts = explode(
'>', $parts[$key]);
4235 if (trim($subparts[0])) {
4238 list($tagName) = explode(
' ', $subparts[0], 2);
4240 foreach ($conf as $pkey => $val) {
4241 if (substr($pkey, -1) !==
'.' && $pkey[0] !==
'_') {
4242 $tmpVal = isset($conf[$pkey .
'.']) ? $this->
stdWrap($conf[$pkey], $conf[$pkey .
'.']) : (string)$val;
4243 if ($lowerCaseAttributes) {
4244 $pkey = strtolower($pkey);
4246 if ($tmpVal !==
'') {
4247 $attribs[$pkey] = $tmpVal;
4253 $parts[$key] = implode(
'>', $subparts);
4254 $content = implode(
'<', $parts);
4271 $conf[
'path'] = isset($conf[
'path.']) ? $this->
stdWrap($conf[
'path'], $conf[
'path.']) : $conf[
'path'];
4272 $theFile = trim($conf[
'path']) . $theValue;
4273 if (@is_file($theFile)) {
4274 $theFileEnc = str_replace(
'%2F',
'/', rawurlencode($theFile));
4275 $title = $conf[
'title'];
4276 if (isset($conf[
'title.'])) {
4277 $title = $this->
stdWrap($title, $conf[
'title.']);
4279 $target = $conf[
'target'];
4280 if (isset($conf[
'target.'])) {
4281 $target = $this->
stdWrap($target, $conf[
'target.']);
4284 if ($conf[
'jumpurl.'][
'secure']) {
4285 $alternativeJumpUrlParameter = isset($conf[
'jumpurl.'][
'parameter.']) ? $this->
stdWrap($conf[
'jumpurl.'][
'parameter'], $conf[
'jumpurl.'][
'parameter.']) : $conf[
'jumpurl.'][
'parameter'];
4286 $typoLinkConf = array(
4287 'parameter' => $alternativeJumpUrlParameter ? $alternativeJumpUrlParameter :
$GLOBALS[
'TSFE']->
id .
',' .
$GLOBALS[
'TSFE']->type,
4288 'fileTarget' => $target,
4291 'additionalParams' =>
'&jumpurl=' . rawurlencode($theFileEnc) . $this->
locDataJU($theFileEnc, $conf[
'jumpurl.'][
'secure.']) .
$GLOBALS[
'TSFE']->getMethodUrlIdToken
4294 $typoLinkConf = array(
4295 'parameter' => $theFileEnc,
4296 'fileTarget' => $target,
4303 $globalJumpUrlEnabled =
$GLOBALS[
'TSFE']->config[
'config'][
'jumpurl_enable'];
4304 if ($globalJumpUrlEnabled && isset($conf[
'jumpurl']) && $conf[
'jumpurl'] == 0) {
4305 $GLOBALS[
'TSFE']->config[
'config'][
'jumpurl_enable'] = 0;
4306 } elseif (!$globalJumpUrlEnabled && $conf[
'jumpurl']) {
4307 $GLOBALS[
'TSFE']->config[
'config'][
'jumpurl_enable'] = 1;
4309 $theLinkWrap = $this->typoLink(
'|', $typoLinkConf);
4311 $GLOBALS[
'TSFE']->config[
'config'][
'jumpurl_enable'] = $globalJumpUrlEnabled;
4312 $theSize = filesize($theFile);
4314 if ($conf[
'icon']) {
4315 $conf[
'icon.'][
'path'] = isset($conf[
'icon.'][
'path.']) ? $this->
stdWrap($conf[
'icon.'][
'path'], $conf[
'icon.'][
'path.']) : $conf[
'icon.'][
'path'];
4316 $iconP = !empty($conf[
'icon.'][
'path']) ? $conf[
'icon.'][
'path'] : TYPO3_mainDir .
'/gfx/fileicons/';
4317 $conf[
'icon.'][
'ext'] = isset($conf[
'icon.'][
'ext.']) ? $this->
stdWrap($conf[
'icon.'][
'ext'], $conf[
'icon.'][
'ext.']) : $conf[
'icon.'][
'ext'];
4318 $iconExt = !empty($conf[
'icon.'][
'ext']) ?
'.' . $conf[
'icon.'][
'ext'] :
'.gif';
4319 $icon = @is_file(($iconP . $fI[
'fileext'] . $iconExt)) ? $iconP . $fI[
'fileext'] . $iconExt : $iconP .
'default' . $iconExt;
4321 $IEList = isset($conf[
'icon_image_ext_list.']) ? $this->
stdWrap($conf[
'icon_image_ext_list'], $conf[
'icon_image_ext_list.']) : $conf[
'icon_image_ext_list'];
4322 $image_ext_list = str_replace(
' ',
'', strtolower($IEList));
4324 if ($conf[
'iconCObject']) {
4325 $icon = $this->cObjGetSingle($conf[
'iconCObject'], $conf[
'iconCObject.'],
'iconCObject');
4327 if (
$GLOBALS[
'TYPO3_CONF_VARS'][
'GFX'][
'thumbnails']) {
4329 if ($conf[
'icon_thumbSize'] || $conf[
'icon_thumbSize.']) {
4330 $thumbSize =
'&size=' . (isset($conf[
'icon_thumbSize.']) ? $this->
stdWrap($conf[
'icon_thumbSize'], $conf[
'icon_thumbSize.']) : $conf[
'icon_thumbSize']);
4332 $check = basename($theFile) .
':' . filemtime($theFile) .
':' .
$GLOBALS[
'TYPO3_CONF_VARS'][
'SYS'][
'encryptionKey'];
4333 $md5sum =
'&md5sum=' . md5($check);
4334 $icon =
'typo3/thumbs.php?file=' . rawurlencode((
'../' . $theFile)) . $thumbSize . $md5sum;
4336 $icon = TYPO3_mainDir .
'gfx/fileicons/notfound_thumb.gif';
4338 $icon =
'<img src="' . htmlspecialchars((
$GLOBALS[
'TSFE']->absRefPrefix . $icon)) .
'"' . $this->
getBorderAttr(
' border="0"') . $this->
getAltParam($conf) .
' />';
4341 $conf[
'icon.'][
'widthAttribute'] = isset($conf[
'icon.'][
'widthAttribute.']) ? $this->
stdWrap($conf[
'icon.'][
'widthAttribute'], $conf[
'icon.'][
'widthAttribute.']) : $conf[
'icon.'][
'widthAttribute'];
4342 $iconWidth = !empty($conf[
'icon.'][
'widthAttribute']) ? $conf[
'icon.'][
'widthAttribute'] : 18;
4343 $conf[
'icon.'][
'heightAttribute'] = isset($conf[
'icon.'][
'heightAttribute.']) ? $this->
stdWrap($conf[
'icon.'][
'heightAttribute'], $conf[
'icon.'][
'heightAttribute.']) : $conf[
'icon.'][
'heightAttribute'];
4344 $iconHeight = !empty($conf[
'icon.'][
'heightAttribute']) ? $conf[
'icon.'][
'heightAttribute'] : 16;
4345 $icon =
'<img src="' . htmlspecialchars((
$GLOBALS[
'TSFE']->absRefPrefix . $icon)) .
'" width="' . $iconWidth .
'" height="' . $iconHeight .
'"' . $this->
getBorderAttr(
' border="0"') . $this->
getAltParam($conf) .
' />';
4347 if ($conf[
'icon_link'] && !$conf[
'combinedLink']) {
4348 $icon = $this->
wrap($icon, $theLinkWrap);
4350 $icon = isset($conf[
'icon.']) ? $this->
stdWrap($icon, $conf[
'icon.']) : $icon;
4352 if ($conf[
'size']) {
4353 $size = isset($conf[
'size.']) ? $this->
stdWrap($theSize, $conf[
'size.']) : $theSize;
4356 if ($conf[
'removePrependedNumbers']) {
4357 $theValue = preg_replace(
'/_[0-9][0-9](\\.[[:alnum:]]*)$/',
'\\1', $theValue);
4359 if (isset($conf[
'labelStdWrap.'])) {
4360 $theValue = $this->
stdWrap($theValue, $conf[
'labelStdWrap.']);
4363 $wrap = isset($conf[
'wrap.']) ? $this->
stdWrap($conf[
'wrap'], $conf[
'wrap.']) : $conf[
'wrap'];
4364 if ($conf[
'combinedLink']) {
4365 $theValue = $icon . $theValue;
4366 if ($conf[
'ATagBeforeWrap']) {
4367 $theValue = $this->
wrap($this->
wrap($theValue, $wrap), $theLinkWrap);
4369 $theValue = $this->
wrap($this->
wrap($theValue, $theLinkWrap), $wrap);
4371 $file = isset($conf[
'file.']) ? $this->
stdWrap($theValue, $conf[
'file.']) : $theValue;
4373 $output = $file . $size;
4375 if ($conf[
'ATagBeforeWrap']) {
4376 $theValue = $this->
wrap($this->
wrap($theValue, $wrap), $theLinkWrap);
4378 $theValue = $this->
wrap($this->
wrap($theValue, $theLinkWrap), $wrap);
4380 $file = isset($conf[
'file.']) ? $this->
stdWrap($theValue, $conf[
'file.']) : $theValue;
4382 $output = $icon . $file . $size;
4384 if (isset($conf[
'stdWrap.'])) {
4385 $output = $this->
stdWrap($output, $conf[
'stdWrap.']);
4403 $fI = pathinfo($jumpUrl);
4405 $mimetypeValue =
'';
4406 if ($fI[
'extension']) {
4408 foreach ($mimeTypes as $v) {
4409 $parts = explode(
'=', $v, 2);
4410 if (strtolower($fI[
'extension']) == strtolower(trim($parts[0]))) {
4411 $mimetypeValue = trim($parts[1]);
4412 $mimetype =
'&mimeType=' . rawurlencode($mimetypeValue);
4418 $rec =
'&locationData=' . rawurlencode($locationData);
4425 return '&juSecure=1' . $mimetype . $rec . $juHash;
4439 foreach ($parts as $part) {
4442 if ((
string) (
int)$theVal === (
string) $theVal) {
4443 $theVal = (int)$theVal;
4455 $value /= (int)$theVal;
4476 $temp = explode($delim, $string);
4477 foreach ($temp as $key => $val) {
4478 $temp[$key] = (int)$this->
calc($val);
4496 $conf[
'token'] = isset($conf[
'token.']) ? $this->
stdWrap($conf[
'token'], $conf[
'token.']) : $conf[
'token'];
4497 if ($conf[
'token'] ===
'') {
4500 $conf[
'max'] = isset($conf[
'max.']) ? (int)$this->
stdWrap($conf[
'max'], $conf[
'max.']) : (int)$conf[
'max'];
4501 $conf[
'min'] = isset($conf[
'min.']) ? (int)$this->
stdWrap($conf[
'min'], $conf[
'min.']) : (int)$conf[
'min'];
4502 $valArr = explode($conf[
'token'], $value);
4504 $key = isset($conf[
'returnKey.']) ? (int)$this->
stdWrap($conf[
'returnKey'], $conf[
'returnKey.']) : (int)$conf[
'returnKey'];
4505 $content = isset($valArr[$key]) ? $valArr[$key] :
'';
4508 $splitCount = count($valArr);
4509 $max = isset($conf[
'max.']) ? $this->
stdWrap($conf[
'max'], $conf[
'max.']) : $conf[
'max'];
4510 if ($max && $splitCount > $max) {
4513 $min = isset($conf[
'min.']) ? $this->
stdWrap($conf[
'min'], $conf[
'min.']) : $conf[
'min'];
4514 if ($min && $splitCount < $min) {
4517 $wrap = isset($conf[
'wrap.']) ? $this->
stdWrap($conf[
'wrap'], $conf[
'wrap.']) : $conf[
'wrap'];
4518 $cObjNum = isset($conf[
'cObjNum.']) ? $this->
stdWrap($conf[
'cObjNum'], $conf[
'cObjNum.']) : $conf[
'cObjNum'];
4519 if ($wrap || $cObjNum) {
4520 $splitArr = array();
4521 $splitArr[
'wrap'] = $wrap;
4522 $splitArr[
'cObjNum'] = $cObjNum;
4523 $splitArr =
$GLOBALS[
'TSFE']->tmpl->splitConfArray($splitArr, $splitCount);
4526 for ($a = 0; $a < $splitCount; $a++) {
4527 $GLOBALS[
'TSFE']->register[
'SPLIT_COUNT'] = $a;
4528 $value =
'' . $valArr[$a];
4530 if ($splitArr[$a][
'cObjNum']) {
4531 $objName = (int)$splitArr[$a][
'cObjNum'];
4532 $value = isset($conf[$objName .
'.']) ? $this->
stdWrap($this->
cObjGet($conf[$objName .
'.'], $objName .
'.'), $conf[$objName .
'.']) : $this->
cObjGet($conf[$objName .
'.'], $objName .
'.');
4534 $wrap = isset($splitArr[$a][
'wrap.']) ? $this->
stdWrap($splitArr[$a][
'wrap'], $splitArr[$a][
'wrap.']) : $splitArr[$a][
'wrap'];
4536 $value = $this->
wrap($value, $wrap);
4553 ksort($configuration, SORT_NUMERIC);
4554 foreach ($configuration as $index => $action) {
4571 if ((isset($configuration[
'search']) || isset($configuration[
'search.'])) && (isset($configuration[
'replace']) || isset($configuration[
'replace.']))) {
4573 $search = isset($configuration[
'search.']) ? $this->
stdWrap($configuration[
'search'], $configuration[
'search.']) : $configuration[
'search'];
4574 $replace = isset($configuration[
'replace.']) ? $this->
stdWrap($configuration[
'replace'], $configuration[
'replace.']) : $configuration[
'replace'];
4576 if (isset($configuration[
'useRegExp']) || $configuration[
'useRegExp.']) {
4577 $useRegularExpression = isset($configuration[
'useRegExp.']) ? $this->
stdWrap($configuration[
'useRegExp'], $configuration[
'useRegExp.']) : $configuration[
'useRegExp'];
4580 if (isset($configuration[
'useOptionSplitReplace']) || isset($configuration[
'useOptionSplitReplace.'])) {
4581 $useOptionSplitReplace = isset($configuration[
'useOptionSplitReplace.']) ? $this->
stdWrap($configuration[
'useOptionSplitReplace'], $configuration[
'useOptionSplitReplace.']) : $configuration[
'useOptionSplitReplace'];
4585 if (isset($useRegularExpression)) {
4587 $separator = $search[0];
4588 $startModifiers = strrpos($search, $separator);
4589 if ($separator !== FALSE && $startModifiers > 0) {
4590 $modifiers = substr($search, $startModifiers + 1);
4592 $modifiers = str_replace(
'e',
'', $modifiers);
4593 $search = substr($search, 0, ($startModifiers + 1)) . $modifiers;
4595 if (empty($useOptionSplitReplace)) {
4596 $content = preg_replace($search, $replace, $content);
4599 $splitCount = preg_match_all($search, $content, $matches);
4600 $replaceArray =
$GLOBALS[
'TSFE']->tmpl->splitConfArray(array($replace), $splitCount);
4603 $replaceCallback =
function($match) use ($replaceArray, $search, &$replaceCount) {
4605 return preg_replace($search, $replaceArray[$replaceCount - 1][0], $match[0]);
4607 $content = preg_replace_callback($search, $replaceCallback, $content);
4610 if (empty($useOptionSplitReplace)) {
4611 $content = str_replace($search, $replace, $content);
4614 $searchPreg =
'#' . preg_quote($search,
'#') .
'#';
4617 $splitCount = preg_match_all($searchPreg, $content, $matches);
4618 $replaceArray =
$GLOBALS[
'TSFE']->tmpl->splitConfArray(array($replace), $splitCount);
4621 $replaceCallback =
function($match) use ($replaceArray, $search, &$replaceCount) {
4623 return $replaceArray[$replaceCount - 1][0];
4625 $content = preg_replace_callback($searchPreg, $replaceCallback, $content);
4640 protected function round($content, array $conf = array()) {
4641 $decimals = isset($conf[
'decimals.']) ? $this->
stdWrap($conf[
'decimals'], $conf[
'decimals.']) : $conf[
'decimals'];
4642 $type = isset($conf[
'roundType.']) ? $this->
stdWrap($conf[
'roundType'], $conf[
'roundType.']) : $conf[
'roundType'];
4643 $floatVal = floatval($content);
4646 $content = ceil($floatVal);
4649 $content = floor($floatVal);
4654 $content =
round($floatVal, (
int)$decimals);
4669 $decimals = isset($conf[
'decimals.']) ? $this->
stdWrap($conf[
'decimals'], $conf[
'decimals.']) : $conf[
'decimals'];
4670 $dec_point = isset($conf[
'dec_point.']) ? $this->
stdWrap($conf[
'dec_point'], $conf[
'dec_point.']) : $conf[
'dec_point'];
4671 $thousands_sep = isset($conf[
'thousands_sep.']) ? $this->
stdWrap($conf[
'thousands_sep'], $conf[
'thousands_sep.']) : $conf[
'thousands_sep'];
4672 return number_format(floatval($content), $decimals, $dec_point, $thousands_sep);
4700 'parseFunc' => $ref,
4701 'parseFunc.' => $conf
4703 $temp_conf = $this->
mergeTSRef($temp_conf,
'parseFunc');
4704 $conf = $temp_conf[
'parseFunc.'];
4707 if ((
string)$conf[
'externalBlocks'] !==
'') {
4710 $parts = $htmlParser->splitIntoBlock($tags, $theValue);
4711 foreach ($parts as $k => $v) {
4714 $tagName = strtolower($htmlParser->getFirstTagName($v));
4715 $cfg = $conf[
'externalBlocks.'][$tagName .
'.'];
4716 if ($cfg[
'stripNLprev'] || $cfg[
'stripNL']) {
4717 $parts[$k - 1] = preg_replace(
'/' . CR .
'?' . LF .
'[ ]*$/',
'', $parts[$k - 1]);
4719 if ($cfg[
'stripNLnext'] || $cfg[
'stripNL']) {
4720 $parts[$k + 1] = preg_replace(
'/^[ ]*' . CR .
'?' . LF .
'/',
'', $parts[$k + 1]);
4724 foreach ($parts as $k => $v) {
4726 $tag = $htmlParser->getFirstTag($v);
4727 $tagName = strtolower($htmlParser->getFirstTagName($v));
4728 $cfg = $conf[
'externalBlocks.'][$tagName .
'.'];
4729 if ($cfg[
'callRecursive']) {
4730 $parts[$k] = $this->
parseFunc($htmlParser->removeFirstAndLastTag($v), $conf);
4731 if (!$cfg[
'callRecursive.'][
'dontWrapSelf']) {
4732 if ($cfg[
'callRecursive.'][
'alternativeWrap']) {
4733 $parts[$k] = $this->
wrap($parts[$k], $cfg[
'callRecursive.'][
'alternativeWrap']);
4735 if (is_array($cfg[
'callRecursive.'][
'tagStdWrap.'])) {
4736 $tag = $this->
stdWrap($tag, $cfg[
'callRecursive.'][
'tagStdWrap.']);
4738 $parts[$k] = $tag . $parts[$k] .
'</' . $tagName .
'>';
4741 } elseif ($cfg[
'HTMLtableCells']) {
4742 $rowParts = $htmlParser->splitIntoBlock(
'tr', $parts[$k]);
4743 foreach ($rowParts as $kk => $vv) {
4745 $colParts = $htmlParser->splitIntoBlock(
'td,th', $vv);
4747 foreach ($colParts as $kkk => $vvv) {
4750 $tag = $htmlParser->getFirstTag($vvv);
4751 $tagName = strtolower($htmlParser->getFirstTagName($vvv));
4752 $colParts[$kkk] = $htmlParser->removeFirstAndLastTag($vvv);
4753 if ($cfg[
'HTMLtableCells.'][$cc .
'.'][
'callRecursive'] || !isset($cfg[
'HTMLtableCells.'][($cc .
'.')][
'callRecursive']) && $cfg[
'HTMLtableCells.'][
'default.'][
'callRecursive']) {
4754 if ($cfg[
'HTMLtableCells.'][
'addChr10BetweenParagraphs']) {
4755 $colParts[$kkk] = str_replace(
'</p><p>',
'</p>' . LF .
'<p>', $colParts[$kkk]);
4757 $colParts[$kkk] = $this->
parseFunc($colParts[$kkk], $conf);
4759 $tagStdWrap = is_array($cfg[
'HTMLtableCells.'][$cc .
'.'][
'tagStdWrap.']) ? $cfg[
'HTMLtableCells.'][$cc .
'.'][
'tagStdWrap.'] : $cfg[
'HTMLtableCells.'][
'default.'][
'tagStdWrap.'];
4760 if (is_array($tagStdWrap)) {
4761 $tag = $this->
stdWrap($tag, $tagStdWrap);
4763 $stdWrap = is_array($cfg[
'HTMLtableCells.'][$cc .
'.'][
'stdWrap.']) ? $cfg[
'HTMLtableCells.'][$cc .
'.'][
'stdWrap.'] : $cfg[
'HTMLtableCells.'][
'default.'][
'stdWrap.'];
4764 if (is_array($stdWrap)) {
4765 $colParts[$kkk] = $this->
stdWrap($colParts[$kkk], $stdWrap);
4767 $colParts[$kkk] = $tag . $colParts[$kkk] .
'</' . $tagName .
'>';
4770 $rowParts[$kk] = implode(
'', $colParts);
4773 $parts[$k] = implode(
'', $rowParts);
4775 if (is_array($cfg[
'stdWrap.'])) {
4776 $parts[$k] = $this->
stdWrap($parts[$k], $cfg[
'stdWrap.']);
4779 $parts[$k] = $this->
_parseFunc($parts[$k], $conf);
4782 return implode(
'', $parts);
4799 if (!empty($conf[
'if.']) && !$this->
checkIf($conf[
'if.'])) {
4809 $contentAccum = array();
4811 $allowTags = strtolower(str_replace(
' ',
'', $conf[
'allowTags']));
4812 $denyTags = strtolower(str_replace(
' ',
'', $conf[
'denyTags']));
4813 $totalLen = strlen($theValue);
4816 if (!is_array($currentTag)) {
4822 $len = strcspn(substr($theValue, $pointer + $len_p),
'<');
4824 $endChar = ord(strtolower(substr($theValue, $pointer + $len_p, 1)));
4826 }
while ($c > 0 && $endChar && ($endChar < 97 || $endChar > 122) && $endChar != 47);
4830 $tempContent = strtolower(substr($theValue, $pointer));
4831 $len = strpos($tempContent,
'</' . $currentTag[0]);
4832 if (is_string($len) && !$len) {
4833 $len = strlen($tempContent);
4838 $data = substr($theValue, $pointer, $len);
4842 $data = preg_replace(
'/^[ ]*' . CR .
'?' . LF .
'/',
'',
$data);
4845 if (!is_array($currentTag)) {
4847 $tmpConstants =
$GLOBALS[
'TSFE']->tmpl->setup[
'constants.'];
4848 if ($conf[
'constants'] && is_array($tmpConstants)) {
4849 foreach ($tmpConstants as $key => $val) {
4850 if (is_string($val)) {
4851 $data = str_replace(
'###' . $key .
'###', $val,
$data);
4856 if (is_array($conf[
'short.'])) {
4857 $shortWords = $conf[
'short.'];
4858 krsort($shortWords);
4859 foreach ($shortWords as $key => $val) {
4860 if (is_string($val)) {
4866 if (is_array($conf[
'plainTextStdWrap.'])) {
4870 if ($conf[
'userFunc']) {
4874 if ($conf[
'makelinks']) {
4879 if (
$GLOBALS[
'TSFE']->no_cache && $conf[
'sword'] && is_array(
$GLOBALS[
'TSFE']->sWordList) &&
$GLOBALS[
'TSFE']->sWordRegEx) {
4882 $pregSplitMode =
'i';
4883 if (isset(
$GLOBALS[
'TSFE']->config[
'config'][
'sword_noMixedCase']) && !empty(
$GLOBALS[
'TSFE']->config[
'config'][
'sword_noMixedCase'])) {
4884 $pregSplitMode =
'';
4886 $pieces = preg_split(
'/' .
$GLOBALS[
'TSFE']->sWordRegEx .
'/' . $pregSplitMode,
$data, 2);
4887 $newstring .= $pieces[0];
4888 $match_len = strlen(
$data) - (strlen($pieces[0]) + strlen($pieces[1]));
4889 if (strstr($pieces[0],
'<') || strstr($pieces[0],
'>')) {
4894 $inTag = strrpos($pieces[0],
'<') > strrpos($pieces[0],
'>');
4897 $match = substr(
$data, strlen($pieces[0]), $match_len);
4898 if (trim($match) && strlen($match) > 1 && !$inTag) {
4899 $match = $this->
wrap($match, $conf[
'sword']);
4902 $newstring .= $match;
4904 }
while ($pieces[1]);
4908 $contentAccum[$contentAccumP] .=
$data;
4913 $len = strcspn(substr($theValue, $pointer),
'>') + 1;
4914 $data = substr($theValue, $pointer, $len);
4916 $tagContent = substr(
$data, 1, -2);
4918 $tagContent = substr(
$data, 1, -1);
4920 $tag = explode(
' ', trim($tagContent), 2);
4921 $tag[0] = strtolower($tag[0]);
4922 if ($tag[0][0] ===
'/') {
4923 $tag[0] = substr($tag[0], 1);
4926 if ($conf[
'tags.'][$tag[0]]) {
4930 if (!$currentTag && !$tag[
'out']) {
4936 if (preg_match(
'/^(area|base|br|col|hr|img|input|meta|param)$/i', $tag[0])) {
4941 if ($currentTag[0] == $tag[0] && $tag[
'out']) {
4942 $theName = $conf[
'tags.'][$tag[0]];
4943 $theConf = $conf[
'tags.'][$tag[0] .
'.'];
4945 $stripNL = $theConf[
'stripNL'] ? 1 : 0;
4947 $breakOut = $theConf[
'breakoutTypoTagContent'] ? 1 : 0;
4948 $this->parameters = array();
4949 if ($currentTag[1]) {
4951 if (is_array($params)) {
4952 foreach ($params as $option => $val) {
4953 $this->parameters[strtolower($option)] = $val;
4957 $this->parameters[
'allParams'] = trim($currentTag[1]);
4961 $contentAccum[$contentAccumP - 1] = preg_replace(
'/' . CR .
'?' . LF .
'[ ]*$/',
'', $contentAccum[$contentAccumP - 1]);
4962 $contentAccum[$contentAccumP] = preg_replace(
'/^[ ]*' . CR .
'?' . LF .
'/',
'', $contentAccum[$contentAccumP]);
4963 $contentAccum[$contentAccumP] = preg_replace(
'/' . CR .
'?' . LF .
'[ ]*$/',
'', $contentAccum[$contentAccumP]);
4966 $newInput = $this->cObjGetSingle($theName, $theConf,
'/parseFunc/.tags.' . $tag[0]);
4968 $contentAccum[$contentAccumP] = $newInput;
4972 $contentAccum[$contentAccumP - 2] .= $contentAccum[($contentAccumP - 1)] . $contentAccum[$contentAccumP];
4973 unset($contentAccum[$contentAccumP]);
4974 unset($contentAccum[$contentAccumP - 1]);
4975 $contentAccumP -= 2;
4982 $contentAccum[$contentAccumP] .=
$data;
4988 $contentAccum[$contentAccumP] .=
$data;
4990 $contentAccum[$contentAccumP] .= HTMLSpecialChars(
$data);
4996 }
while ($pointer < $totalLen);
4998 reset($contentAccum);
4999 $contentAccumCount = count($contentAccum);
5000 for ($a = 0; $a < $contentAccumCount; $a++) {
5003 if (is_array($conf[
'nonTypoTagStdWrap.'])) {
5004 $contentAccum[$a] = $this->
stdWrap($contentAccum[$a], $conf[
'nonTypoTagStdWrap.']);
5007 if ($conf[
'nonTypoTagUserFunc']) {
5008 $contentAccum[$a] = $this->
callUserFunction($conf[
'nonTypoTagUserFunc'], $conf[
'nonTypoTagUserFunc.'], $contentAccum[$a]);
5012 return implode(
'', $contentAccum);
5025 $lParts = explode(LF, $theValue);
5027 $nonWrappedTag = $conf[
'nonWrappedTag'];
5028 $defaultAlign = isset($conf[
'defaultAlign.']) ? trim($this->
stdWrap($conf[
'defaultAlign'], $conf[
'defaultAlign.'])) : trim($conf[
'defaultAlign']);
5029 if ((
string)$theValue ===
'') {
5032 foreach ($lParts as $k => $l) {
5038 if ($l[0] ===
'<' && substr($l, -1) ===
'>') {
5039 $fwParts = explode(
'>', substr($l, 1), 2);
5040 list($tagName, $tagParams) = explode(
' ', $fwParts[0], 2);
5042 if (substr($tagName, -1) ==
'/') {
5043 $tagName = substr($tagName, 0, -1);
5045 if (substr($fwParts[0], -1) ==
'/') {
5053 $str_content = $backParts[0];
5054 $sameBeginEnd = substr(strtolower($backParts[1]), 1, strlen($tagName)) == strtolower($tagName);
5057 if ($sameBeginEnd && in_array(strtolower($tagName), $encapTags)) {
5058 $uTagName = strtoupper($tagName);
5059 $uTagName = strtoupper($conf[
'remapTag.'][$uTagName] ? $conf[
'remapTag.'][$uTagName] : $uTagName);
5061 $uTagName = strtoupper($nonWrappedTag);
5064 $str_content = $lParts[$k];
5069 if (is_array($conf[
'innerStdWrap_all.'])) {
5070 $str_content = $this->
stdWrap($str_content, $conf[
'innerStdWrap_all.']);
5074 if (is_array($conf[
'addAttributes.'][$uTagName .
'.'])) {
5075 foreach ($conf[
'addAttributes.'][$uTagName .
'.'] as $kk => $vv) {
5076 if (!is_array($vv)) {
5077 if ((
string) $conf[
'addAttributes.'][($uTagName .
'.')][($kk .
'.')][
'setOnly'] ==
'blank') {
5078 if ((
string)$attrib[$kk] ===
'') {
5081 } elseif ((
string) $conf[
'addAttributes.'][($uTagName .
'.')][($kk .
'.')][
'setOnly'] ==
'exists') {
5082 if (!isset($attrib[$kk])) {
5092 if (is_array($conf[
'encapsLinesStdWrap.'][$uTagName .
'.'])) {
5093 $str_content = $this->
stdWrap($str_content, $conf[
'encapsLinesStdWrap.'][$uTagName .
'.']);
5096 if (!$attrib[
'align'] && $defaultAlign) {
5097 $attrib[
'align'] = $defaultAlign;
5100 if ($conf[
'removeWrapping'] && !($emptyTag && $conf[
'removeWrapping.'][
'keepSingleTag'])) {
5101 $str_content = $str_content;
5104 $str_content =
'<' . strtolower($uTagName) . (trim($params) ?
' ' . trim($params) :
'') .
' />';
5106 $str_content =
'<' . strtolower($uTagName) . (trim($params) ?
' ' . trim($params) :
'') .
'>' . $str_content .
'</' . strtolower($uTagName) .
'>';
5110 if ($nWrapped && $conf[
'wrapNonWrappedLines']) {
5111 $str_content = $this->
wrap($str_content, $conf[
'wrapNonWrappedLines']);
5113 $lParts[$k] = $str_content;
5115 return implode(LF, $lParts);
5131 $schemes = array(
'http://',
'https://');
5132 foreach ($schemes as $scheme) {
5133 $textpieces = explode($scheme,
$data);
5134 $pieces = count($textpieces);
5135 $textstr = $textpieces[0];
5136 $initP =
'?id=' .
$GLOBALS[
'TSFE']->id .
'&type=' .
$GLOBALS[
'TSFE']->type;
5137 for ($i = 1; $i < $pieces; $i++) {
5138 $len = strcspn($textpieces[$i], chr(32) . TAB . CRLF);
5139 if (trim(substr($textstr, -1)) ==
'' && $len) {
5140 $lastChar = substr($textpieces[$i], $len - 1, 1);
5141 if (!preg_match(
'/[A-Za-z0-9\\/#_-]/', $lastChar)) {
5145 $parts[0] = substr($textpieces[$i], 0, $len);
5146 $parts[1] = substr($textpieces[$i], $len);
5147 $keep = $conf[
'keep'];
5148 $linkParts = parse_url($scheme . $parts[0]);
5150 if (strstr($keep,
'scheme')) {
5153 $linktxt .= $linkParts[
'host'];
5154 if (strstr($keep,
'path')) {
5155 $linktxt .= $linkParts[
'path'];
5157 if (strstr($keep,
'query') && $linkParts[
'query']) {
5158 $linktxt .=
'?' . $linkParts[
'query'];
5159 } elseif ($linkParts[
'path'] ==
'/') {
5160 $linktxt = substr($linktxt, 0, -1);
5163 if (isset($conf[
'extTarget'])) {
5164 if (isset($conf[
'extTarget.'])) {
5165 $target = $this->
stdWrap($conf[
'extTarget'], $conf[
'extTarget.']);
5167 $target = $conf[
'extTarget'];
5170 $target =
$GLOBALS[
'TSFE']->extTarget;
5172 if (
$GLOBALS[
'TSFE']->config[
'config'][
'jumpurl_enable']) {
5173 $jumpurl =
'http://' . $parts[0];
5175 $res =
'<a' .
' href="' . htmlspecialchars((
$GLOBALS[
'TSFE']->absRefPrefix .
$GLOBALS[
'TSFE']->config[
'mainScript'] . $initP .
'&jumpurl=' . rawurlencode($jumpurl))) .
'&juHash=' . $juHash .
$GLOBALS[
'TSFE']->getMethodUrlIdToken .
'"' . ($target ?
' target="' . htmlspecialchars($target) .
'"' :
'') . $aTagParams . $this->
extLinkATagParams((
'http://' . $parts[0]),
'url') .
'>';
5177 $res =
'<a' .
' href="' . $scheme . htmlspecialchars($parts[0]) .
'"' . ($target ?
' target="' . htmlspecialchars($target) .
'"' :
'') . $aTagParams . $this->
extLinkATagParams((
'http://' . $parts[0]),
'url') .
'>';
5179 $wrap = isset($conf[
'wrap.']) ? $this->
stdWrap($conf[
'wrap'], $conf[
'wrap.']) : $conf[
'wrap'];
5180 if ($conf[
'ATagBeforeWrap']) {
5181 $res = $res . $this->
wrap($linktxt, $wrap) .
'</a>';
5183 $res = $this->
wrap($res . $linktxt .
'</a>', $wrap);
5185 $textstr .= $res . $parts[1];
5187 $textstr .= $scheme . $textpieces[$i];
5208 $textpieces = explode(
'mailto:',
$data);
5209 $pieces = count($textpieces);
5210 $textstr = $textpieces[0];
5211 $initP =
'?id=' .
$GLOBALS[
'TSFE']->id .
'&type=' .
$GLOBALS[
'TSFE']->type;
5212 for ($i = 1; $i < $pieces; $i++) {
5213 $len = strcspn($textpieces[$i], chr(32) . TAB . CRLF);
5214 if (trim(substr($textstr, -1)) ==
'' && $len) {
5215 $lastChar = substr($textpieces[$i], $len - 1, 1);
5216 if (!preg_match(
'/[A-Za-z0-9]/', $lastChar)) {
5219 $parts[0] = substr($textpieces[$i], 0, $len);
5220 $parts[1] = substr($textpieces[$i], $len);
5221 $linktxt = preg_replace(
'/\\?.*/',
'', $parts[0]);
5222 list($mailToUrl, $linktxt) = $this->
getMailTo($parts[0], $linktxt, $initP);
5223 $mailToUrl =
$GLOBALS[
'TSFE']->spamProtectEmailAddresses ===
'ascii' ? $mailToUrl : htmlspecialchars($mailToUrl);
5224 $res =
'<a href="' . $mailToUrl .
'"' . $aTagParams .
'>';
5225 $wrap = isset($conf[
'wrap.']) ? $this->
stdWrap($conf[
'wrap'], $conf[
'wrap.']) : $conf[
'wrap'];
5226 if ($conf[
'ATagBeforeWrap']) {
5227 $res = $res . $this->
wrap($linktxt, $wrap) .
'</a>';
5229 $res = $this->
wrap($res . $linktxt .
'</a>', $wrap);
5231 $textstr .= $res . $parts[1];
5233 $textstr .=
'mailto:' . $textpieces[$i];
5263 public function getImgResource($file, $fileArray) {
5264 if (empty($file) && empty($fileArray)) {
5267 if (!is_array($fileArray)) {
5268 $fileArray = (array) $fileArray;
5270 $imageResource = NULL;
5271 if ($file ===
'GIFBUILDER') {
5274 $gifCreator->init();
5276 if (
$GLOBALS[
'TYPO3_CONF_VARS'][
'GFX'][
'gdlib']) {
5277 $gifCreator->start($fileArray, $this->data);
5278 $theImage = $gifCreator->gifBuild();
5280 $imageResource = $gifCreator->getImageDimensions($theImage);
5281 $imageResource[
'origFile'] = $theImage;
5283 if ($file instanceof \
TYPO3\CMS\Core\Resource\File) {
5284 $fileObject = $file;
5285 } elseif ($file instanceof \
TYPO3\CMS\Core\Resource\FileReference) {
5286 $fileObject = $file->getOriginalFile();
5289 if ($fileArray[
'import.']) {
5290 $importedFile = trim($this->
stdWrap(
'', $fileArray[
'import.']));
5291 if (!empty($importedFile)) {
5292 $file = $importedFile;
5297 if (!empty($fileArray[
'treatIdAsReference'])) {
5298 $fileObject = $this->
getResourceFactory()->getFileReferenceObject($file)->getOriginalFile();
5302 } elseif (preg_match(
'/^(0|[1-9][0-9]*):/', $file)) {
5305 if (isset($importedFile) && !empty($importedFile) && !empty($fileArray[
'import'])) {
5306 $file = $fileArray[
'import'] . $file;
5315 $logger->warning(
'The image "' . $file .
'" could not be found and won\'t be included in frontend output');
5319 if ($fileObject instanceof \
TYPO3\CMS\Core\Resource\File) {
5320 $processingConfiguration = array();
5321 $processingConfiguration[
'width'] = isset($fileArray[
'width.']) ? $this->
stdWrap($fileArray[
'width'], $fileArray[
'width.']) : $fileArray[
'width'];
5322 $processingConfiguration[
'height'] = isset($fileArray[
'height.']) ? $this->
stdWrap($fileArray[
'height'], $fileArray[
'height.']) : $fileArray[
'height'];
5323 $processingConfiguration[
'fileExtension'] = isset($fileArray[
'ext.']) ? $this->
stdWrap($fileArray[
'ext'], $fileArray[
'ext.']) : $fileArray[
'ext'];
5324 $processingConfiguration[
'maxWidth'] = isset($fileArray[
'maxW.']) ? (int)$this->
stdWrap($fileArray[
'maxW'], $fileArray[
'maxW.']) : (int)$fileArray[
'maxW'];
5325 $processingConfiguration[
'maxHeight'] = isset($fileArray[
'maxH.']) ? (int)$this->
stdWrap($fileArray[
'maxH'], $fileArray[
'maxH.']) : (int)$fileArray[
'maxH'];
5326 $processingConfiguration[
'minWidth'] = isset($fileArray[
'minW.']) ? (int)$this->
stdWrap($fileArray[
'minW'], $fileArray[
'minW.']) : (int)$fileArray[
'minW'];
5327 $processingConfiguration[
'minHeight'] = isset($fileArray[
'minH.']) ? (int)$this->
stdWrap($fileArray[
'minH'], $fileArray[
'minH.']) : (int)$fileArray[
'minH'];
5328 $processingConfiguration[
'noScale'] = isset($fileArray[
'noScale.']) ? $this->
stdWrap($fileArray[
'noScale'], $fileArray[
'noScale.']) : $fileArray[
'noScale'];
5329 $processingConfiguration[
'additionalParameters'] = isset($fileArray[
'params.']) ? $this->
stdWrap($fileArray[
'params'], $fileArray[
'params.']) : $fileArray[
'params'];
5330 $processingConfiguration[
'frame'] = isset($fileArray[
'frame.']) ? (int)$this->
stdWrap($fileArray[
'frame'], $fileArray[
'frame.']) : (int)$fileArray[
'frame'];
5333 if (isset($fileArray[
'stripProfile'])) {
5334 $processingConfiguration[
'stripProfile'] = $fileArray[
'stripProfile'];
5338 $maskArray = $fileArray[
'm.'];
5341 if (is_array($maskArray)) {
5342 $mask = $this->getImgResource($maskArray[
'mask'], $maskArray[
'mask.']);
5343 $bgImg = $this->getImgResource($maskArray[
'bgImg'], $maskArray[
'bgImg.']);
5344 $bottomImg = $this->getImgResource($maskArray[
'bottomImg'], $maskArray[
'bottomImg.']);
5345 $bottomImg_mask = $this->getImgResource($maskArray[
'bottomImg_mask'], $maskArray[
'bottomImg_mask.']);
5347 $processingConfiguration[
'maskImages'][
'maskImage'] = $mask[
'processedFile'];
5348 $processingConfiguration[
'maskImages'][
'backgroundImage'] = $bgImg[
'processedFile'];
5349 $processingConfiguration[
'maskImages'][
'maskBottomImage'] = $bottomImg[
'processedFile'];
5350 $processingConfiguration[
'maskImages'][
'maskBottomImageMask'] = $bottomImg_mask[
'processedFile'];
5352 if (
$GLOBALS[
'TSFE']->config[
'config'][
'meaningfulTempFilePrefix']) {
5353 $processingConfiguration[
'useTargetFileNameAsPrefix'] = 1;
5355 $processedFileObject = $fileObject->process(\
TYPO3\CMS\Core\Resource\ProcessedFile::CONTEXT_IMAGECROPSCALEMASK, $processingConfiguration);
5356 $hash = $processedFileObject->calculateChecksum();
5358 if ($processedFileObject->isProcessed() && !isset(
$GLOBALS[
'TSFE']->tmpl->fileCache[$hash])) {
5359 $GLOBALS[
'TSFE']->tmpl->fileCache[$hash] = array(
5360 0 => $processedFileObject->getProperty(
'width'),
5361 1 => $processedFileObject->getProperty(
'height'),
5362 2 => $processedFileObject->getExtension(),
5363 3 => $processedFileObject->getPublicUrl(),
5364 'origFile' => $fileObject->getPublicUrl(),
5365 'origFile_mtime' => $fileObject->getModificationTime(),
5368 'originalFile' => $fileObject,
5369 'processedFile' => $processedFileObject,
5370 'fileCacheHash' => $hash
5373 $imageResource =
$GLOBALS[
'TSFE']->tmpl->fileCache[$hash];
5379 if (!isset($imageResource)) {
5380 $theImage =
$GLOBALS[
'TSFE']->tmpl->getFileName($file);
5384 $gifCreator->init();
5385 $info = $gifCreator->imageMagickConvert($theImage,
'WEB');
5386 $info[
'origFile'] = $theImage;
5388 $info[
'origFile_mtime'] = @filemtime($theImage);
5389 $imageResource = $info;
5393 if (isset($imageResource)) {
5396 $imageResource = $hookObject->getImgResourcePostProcess($file, (array) $fileArray, $imageResource, $this);
5399 return $imageResource;
5415 if (!strstr($field,
'//')) {
5416 return $this->data[trim($field)];
5419 foreach ($sections as $k) {
5420 if ((
string)$this->data[$k] !==
'') {
5421 return $this->data[$k];
5436 public function getData($string, $fieldArray = NULL) {
5437 if (!is_array($fieldArray)) {
5438 $fieldArray =
$GLOBALS[
'TSFE']->page;
5441 $sections = explode(
'//', $string);
5442 while (!$retVal and list($secKey, $secVal) = each($sections)) {
5443 $parts = explode(
':', $secVal, 2);
5444 $type = strtolower(trim($parts[0]));
5445 $typesWithOutParameters = array(
'level',
'date',
'current');
5446 $key = trim($parts[1]);
5447 if (($key !=
'') || in_array($type, $typesWithOutParameters)) {
5453 $retVal = $this->
getGlobal($key, $getPostArray);
5456 $retVal = $this->
getGlobal(
'TSFE|' . $key);
5459 $retVal = getenv($key);
5465 $retVal = $fieldArray[$key];
5468 $retVal = $this->getFileDataKey($key);
5471 $retVal = $this->parameters[$key];
5474 $retVal =
$GLOBALS[
'TSFE']->register[$key];
5480 $retVal = count(
$GLOBALS[
'TSFE']->tmpl->rootLine) - 1;
5484 $numericKey = $this->
getKey($keyParts[0],
$GLOBALS[
'TSFE']->tmpl->rootLine);
5485 $retVal = $this->
rootLineValue($numericKey,
'title', strtolower($keyParts[1]) ===
'slide');
5489 $numericKey = $this->
getKey($keyParts[0],
$GLOBALS[
'TSFE']->tmpl->rootLine);
5490 $retVal = $this->
rootLineValue($numericKey,
'media', strtolower($keyParts[1]) ===
'slide');
5493 $numericKey = $this->
getKey($key,
$GLOBALS[
'TSFE']->tmpl->rootLine);
5498 $numericKey = $this->
getKey($keyParts[0],
$GLOBALS[
'TSFE']->tmpl->rootLine);
5499 $retVal = $this->
rootLineValue($numericKey, $keyParts[1], strtolower($keyParts[2]) ===
'slide');
5501 case 'fullrootline':
5503 $fullKey = (int)$keyParts[0] - count(
$GLOBALS[
'TSFE']->tmpl->rootLine) + count(
$GLOBALS[
'TSFE']->rootLine);
5504 if ($fullKey >= 0) {
5505 $retVal = $this->
rootLineValue($fullKey, $keyParts[1], stristr($keyParts[2],
'slide'),
$GLOBALS[
'TSFE']->rootLine);
5512 $retVal = date($key,
$GLOBALS[
'EXEC_TIME']);
5515 $retVal =
$GLOBALS[
'TSFE']->page[$key];
5522 $db_rec =
$GLOBALS[
'TSFE']->sys_page->getRawRecord($selectParts[0], $selectParts[1]);
5523 if (is_array($db_rec) && $selectParts[2]) {
5524 $retVal = $db_rec[$selectParts[2]];
5528 $retVal =
$GLOBALS[
'TSFE']->sL(
'LLL:' . $key);
5531 $retVal =
$GLOBALS[
'TSFE']->tmpl->getFileName($key);
5535 case 'parentRecordNumber':
5545 case 'fullRootLine':
5561 if (is_array(
$GLOBALS[
'TYPO3_CONF_VARS'][
'SC_OPTIONS'][
'tslib/class.tslib_content.php'][
'getData'])) {
5562 foreach (
$GLOBALS[
'TYPO3_CONF_VARS'][
'SC_OPTIONS'][
'tslib/class.tslib_content.php'][
'getData'] as $classData) {
5565 throw new \UnexpectedValueException(
'$hookObject must implement interface TYPO3\\CMS\\Frontend\\ContentObject\\ContentObjectGetDataHookInterface', 1195044480);
5567 $retVal = $hookObject->getDataExtension($string, $fieldArray, $secVal, $retVal, $this);
5583 protected function getFileDataKey($key) {
5584 $parts = explode(
':', $key);
5585 $fileUidOrCurrentKeyword = $parts[0];
5586 $requestedFileInformationKey = $parts[1];
5588 if ($fileUidOrCurrentKeyword ===
'current') {
5593 $fileObject = $fileFactory->getFileObject($fileUidOrCurrentKeyword);
5600 $logger->warning(
'The file "' . $fileUidOrCurrentKeyword .
'" could not be found and won\'t be included in frontend output');
5604 if ($fileObject instanceof \
TYPO3\CMS\Core\Resource\FileInterface) {
5606 switch ($requestedFileInformationKey) {
5608 return $fileObject->getName();
5611 return $fileObject->getUid();
5614 if ($fileObject instanceof \
TYPO3\CMS\Core\Resource\FileReference) {
5615 return $fileObject->getOriginalFile()->getUid();
5621 return $fileObject->getSize();
5624 return $fileObject->getSha1();
5627 return $fileObject->getExtension();
5630 return $fileObject->getMimeType();
5633 return $fileObject->getContents();
5636 return $fileObject->getPublicUrl();
5639 return $fileObject->getForLocalProcessing(FALSE);
5643 return $fileObject->getProperty($requestedFileInformationKey);
5647 return 'Error: no file object';
5663 public function rootLineValue($key, $field, $slideBack = 0, $altRootLine =
'') {
5664 $rootLine = is_array($altRootLine) ? $altRootLine :
$GLOBALS[
'TSFE']->tmpl->rootLine;
5666 return $rootLine[$key][$field];
5668 for ($a = $key; $a >= 0; $a--) {
5669 $val = $rootLine[$a][$field];
5688 $keys = explode(
'|', $keyString);
5689 $numberOfLevels = count($keys);
5690 $rootKey = trim($keys[0]);
5691 $value = isset($source) ? $source[$rootKey] :
$GLOBALS[$rootKey];
5692 for ($i = 1; $i < $numberOfLevels && isset($value); $i++) {
5693 $currentKey = trim($keys[$i]);
5694 if (is_object($value)) {
5695 $value = $value->{$currentKey};
5696 } elseif (is_array($value)) {
5697 $value = $value[$currentKey];
5703 if (!is_scalar($value)) {
5722 if (is_array($arr)) {
5724 $key = count($arr) + $key;
5745 $field = $conf[
'field'];
5746 $delimiter = $conf[
'delimiter'] ? $conf[
'delimiter'] :
' ,';
5747 if (is_array(
$GLOBALS[
'TCA'][
$table]) && is_array(
$GLOBALS[
'TCA'][$table][
'columns'][$field]) && is_array(
$GLOBALS[
'TCA'][$table][
'columns'][$field][
'config'][
'items'])) {
5750 foreach ($values as $value) {
5752 foreach (
$GLOBALS[
'TCA'][$table][
'columns'][$field][
'config'][
'items'] as $item) {
5754 if ((
string)$item[1] === trim($value)) {
5755 $output[] =
$GLOBALS[
'TSFE']->sL($item[0]);
5759 $returnValue = implode($delimiter, $output);
5761 $returnValue = $inputValue;
5763 return $returnValue;
5786 public function typoLink($linktxt, $conf) {
5788 $finalTagParts = array();
5790 $link_param = isset($conf[
'parameter.']) ? trim($this->
stdWrap($conf[
'parameter'], $conf[
'parameter.'])) : trim($conf[
'parameter']);
5791 $sectionMark = isset($conf[
'section.']) ? trim($this->
stdWrap($conf[
'section'], $conf[
'section.'])) : trim($conf[
'section']);
5793 $initP =
'?id=' .
$GLOBALS[
'TSFE']->id .
'&type=' .
$GLOBALS[
'TSFE']->type;
5794 $this->lastTypoLinkUrl =
'';
5795 $this->lastTypoLinkTarget =
'';
5797 $enableLinksAcrossDomains =
$GLOBALS[
'TSFE']->config[
'config'][
'typolinkEnableLinksAcrossDomains'];
5800 list($linkHandlerKeyword, $linkHandlerValue) = explode(
':', trim($link_paramA[0]), 2);
5801 if (
$GLOBALS[
'TYPO3_CONF_VARS'][
'SC_OPTIONS'][
'tslib/class.tslib_content.php'][
'typolinkLinkHandler'][$linkHandlerKeyword] && (
string)$linkHandlerValue !==
'') {
5802 $linkHandlerObj =
GeneralUtility::getUserObj(
$GLOBALS[
'TYPO3_CONF_VARS'][
'SC_OPTIONS'][
'tslib/class.tslib_content.php'][
'typolinkLinkHandler'][$linkHandlerKeyword]);
5803 if (method_exists($linkHandlerObj,
'main')) {
5804 return $linkHandlerObj->main($linktxt, $conf, $linkHandlerKeyword, $linkHandlerValue, $link_param, $this);
5810 $fileOrFolderObject = $this->
getResourceFactory()->retrieveFileOrFolderObject($linkHandlerValue);
5812 if ($fileOrFolderObject instanceof \
TYPO3\CMS\Core\Resource\ResourceInterface) {
5813 $link_paramA[0] = $fileOrFolderObject->getPublicUrl();
5815 $link_paramA[0] = NULL;
5817 }
catch (\RuntimeException $e) {
5819 $link_paramA[0] = NULL;
5820 }
catch (\
TYPO3\CMS\Core\Resource\
Exception\ResourceDoesNotExistException $e) {
5825 } elseif (in_array(strtolower(trim($linkHandlerKeyword)), array(
'javascript',
'data'), TRUE)) {
5829 $link_param = trim($link_paramA[0]);
5831 $linkClass = trim($link_paramA[2]);
5832 if ($linkClass ==
'-') {
5837 $forceTarget = trim($link_paramA[1]);
5838 if ($forceTarget ==
'-') {
5843 $forceTitle = trim($link_paramA[3]);
5844 if ($forceTitle ==
'-') {
5848 if (isset($link_paramA[4]) && strlen(trim($link_paramA[4])) > 0) {
5849 $forceParams = trim($link_paramA[4]);
5851 $conf[
'additionalParams'] .= $forceParams[0] ==
'&' ? $forceParams :
'&' . $forceParams;
5854 $JSwindowParts = array();
5855 $JSwindowParams =
'';
5857 if ($forceTarget && preg_match(
'/^([0-9]+)x([0-9]+)(:(.*)|.*)$/', $forceTarget, $JSwindowParts)) {
5860 $JSwindow_paramsArr = array();
5861 foreach ($JSwindow_tempParamsArr as $JSv) {
5862 list($JSp, $JSv) = explode(
'=', $JSv);
5863 $JSwindow_paramsArr[$JSp] = $JSp .
'=' . $JSv;
5866 $JSwindow_paramsArr[
'width'] =
'width=' . $JSwindowParts[1];
5867 $JSwindow_paramsArr[
'height'] =
'height=' . $JSwindowParts[2];
5869 $JSwindowParams = implode(
',', $JSwindow_paramsArr);
5874 if (
$GLOBALS[
'TSFE']->dtdAllowsFrames) {
5875 $target = isset($conf[
'target']) ? $conf[
'target'] :
$GLOBALS[
'TSFE']->intTarget;
5877 $target = isset($conf[
'target']) ? $conf[
'target'] :
'';
5879 if ($conf[
'target.']) {
5880 $target = $this->
stdWrap($target, $conf[
'target.']);
5883 $title = $conf[
'title'];
5884 if ($conf[
'title.']) {
5885 $title = $this->
stdWrap($title, $conf[
'title.']);
5888 $pU = parse_url($link_param);
5891 if (strstr($link_param,
'@') && (!$pU[
'scheme'] || $pU[
'scheme'] ==
'mailto')) {
5892 $link_param = preg_replace(
'/^mailto:/i',
'', $link_param);
5893 list($this->lastTypoLinkUrl, $linktxt) = $this->
getMailTo($link_param, $linktxt, $initP);
5895 $finalTagParts[
'TYPE'] =
'mailto';
5898 $fileChar = (int)strpos($link_param,
'/');
5899 $urlChar = (int)strpos($link_param,
'.');
5903 list($rootFileDat) = explode(
'?', rawurldecode($link_param));
5904 $containsSlash = strstr($rootFileDat,
'/');
5905 $rFD_fI = pathinfo($rootFileDat);
5906 if (trim($rootFileDat) && !$containsSlash && (@is_file((PATH_site . $rootFileDat)) ||
GeneralUtility::inList(
'php,html,htm', strtolower($rFD_fI[
'extension'])))) {
5908 } elseif ($containsSlash) {
5913 if ($pU[
'scheme'] || $isLocalFile != 1 && $urlChar && (!$containsSlash || $urlChar < $fileChar)) {
5915 if (
$GLOBALS[
'TSFE']->dtdAllowsFrames) {
5916 $target = isset($conf[
'extTarget']) ? $conf[
'extTarget'] :
$GLOBALS[
'TSFE']->extTarget;
5918 $target = isset($conf[
'extTarget']) ? $conf[
'extTarget'] :
'';
5920 if ($conf[
'extTarget.']) {
5921 $target = $this->
stdWrap($target, $conf[
'extTarget.']);
5924 $target = $forceTarget;
5926 if ($linktxt ==
'') {
5927 $linktxt = $this->
parseFunc($link_param, array(
'makelinks' => 0),
'< lib.parseFunc');
5929 if (!$pU[
'scheme']) {
5930 $scheme =
'http://';
5934 if (
$GLOBALS[
'TSFE']->config[
'config'][
'jumpurl_enable']) {
5935 $url =
$GLOBALS[
'TSFE']->absRefPrefix .
$GLOBALS[
'TSFE']->config[
'mainScript'] . $initP;
5936 $jumpurl = $scheme . $link_param;
5938 $this->lastTypoLinkUrl = $url .
'&jumpurl=' . rawurlencode($jumpurl) .
'&juHash='. $juHash .
$GLOBALS[
'TSFE']->getMethodUrlIdToken;
5940 $this->lastTypoLinkUrl = $scheme . $link_param;
5942 $this->lastTypoLinkTarget = $target;
5944 $finalTagParts[
'targetParams'] = $target ?
' target="' . htmlspecialchars($target) .
'"' :
'';
5945 $finalTagParts[
'TYPE'] =
'url';
5946 $finalTagParts[
'aTagParams'] .= $this->
extLinkATagParams($finalTagParts[
'url'], $finalTagParts[
'TYPE']);
5947 } elseif ($containsSlash || $isLocalFile) {
5949 $splitLinkParam = explode(
'?', $link_param);
5950 if (file_exists(rawurldecode($splitLinkParam[0])) || $isLocalFile) {
5951 if ($linktxt ==
'') {
5952 $linktxt = $this->
parseFunc(rawurldecode($link_param), array(
'makelinks' => 0),
'< lib.parseFunc');
5954 if (
$GLOBALS[
'TSFE']->config[
'config'][
'jumpurl_enable'] || $conf[
'jumpurl']) {
5955 $theFileEnc = str_replace(
'%2F',
'/', rawurlencode(rawurldecode($link_param)));
5956 $url =
$GLOBALS[
'TSFE']->absRefPrefix .
$GLOBALS[
'TSFE']->config[
'mainScript'] . $initP .
'&jumpurl=' . rawurlencode($link_param);
5957 if ($conf[
'jumpurl.'][
'secure']) {
5958 $url .= $this->
locDataJU($theFileEnc, $conf[
'jumpurl.'][
'secure.']);
5962 $this->lastTypoLinkUrl = $url .
$GLOBALS[
'TSFE']->getMethodUrlIdToken;
5964 $this->lastTypoLinkUrl =
$GLOBALS[
'TSFE']->absRefPrefix . $link_param;
5966 $this->lastTypoLinkUrl = $this->
forceAbsoluteUrl($this->lastTypoLinkUrl, $conf);
5967 $target = isset($conf[
'fileTarget']) ? $conf[
'fileTarget'] :
$GLOBALS[
'TSFE']->fileTarget;
5968 if ($conf[
'fileTarget.']) {
5969 $target = $this->
stdWrap($target, $conf[
'fileTarget.']);
5972 $target = $forceTarget;
5974 $this->lastTypoLinkTarget = $target;
5976 $finalTagParts[
'targetParams'] = $target ?
' target="' . htmlspecialchars($target) .
'"' :
'';
5977 $finalTagParts[
'TYPE'] =
'file';
5978 $finalTagParts[
'aTagParams'] .= $this->
extLinkATagParams($finalTagParts[
'url'], $finalTagParts[
'TYPE']);
5980 $GLOBALS[
'TT']->setTSlogMessage(
'typolink(): File \'' . $splitLinkParam[0] .
'\' did not exist, so \
'' . $linktxt .
'\' was not linked.
', 1); 5984 // Integer or alias (alias is without slashes or periods or commas, that is 5985 // 'nospace,alphanum_x,lower,unique
' according to definition in $GLOBALS['TCA
']!) 5986 if ($conf['no_cache.
']) { 5987 $conf['no_cache
'] = $this->stdWrap($conf['no_cache
'], $conf['no_cache.
']); 5989 // Splitting the parameter by ',
' and if the array counts more than 1 element it's a
id/type/parameters triplet
5991 $link_param = $pairParts[0];
5992 $link_params_parts = explode(
'#', $link_param);
5994 $link_param = trim($link_params_parts[0]);
5996 if ($link_param ===
'') {
5997 $link_param =
$GLOBALS[
'TSFE']->id;
5999 if ($link_params_parts[1] && !$sectionMark) {
6000 $sectionMark = trim($link_params_parts[1]);
6003 if (count($pairParts) > 1) {
6005 $theTypeP = isset($pairParts[1]) ? $pairParts[1] : 0;
6006 $conf[
'additionalParams'] .= isset($pairParts[2]) ? $pairParts[2] :
'';
6010 $link_param =
$GLOBALS[
'TSFE']->sys_page->getPageIdFromAlias($link_param);
6013 if (strlen($conf[
'linkAccessRestrictedPages'])) {
6014 $disableGroupAccessCheck = $conf[
'linkAccessRestrictedPages'] ? TRUE : FALSE;
6016 $disableGroupAccessCheck =
$GLOBALS[
'TSFE']->config[
'config'][
'typolinkLinkAccessRestrictedPages'] ? TRUE : FALSE;
6019 $page =
$GLOBALS[
'TSFE']->sys_page->getPage($link_param, $disableGroupAccessCheck);
6022 $MPvarAcc = array();
6023 if (!
$GLOBALS[
'TSFE']->config[
'config'][
'MP_disableTypolinkClosestMPvalue']) {
6026 $MPvarAcc[
'closest'] = $temp_MP;
6030 $mount_info =
$GLOBALS[
'TSFE']->sys_page->getMountPointInfo($page[
'uid'], $page);
6031 if (is_array($mount_info) && $mount_info[
'overlay']) {
6032 $page =
$GLOBALS[
'TSFE']->sys_page->getPage($mount_info[
'mount_pid'], $disableGroupAccessCheck);
6033 if (!count($page)) {
6034 $GLOBALS[
'TT']->setTSlogMessage(
'typolink(): Mount point \'' . $mount_info[
'mount_pid'] .
'\' was not available, so \
'' . $linktxt .
'\' was not linked.
', 1); 6037 $MPvarAcc['re-map
'] = $mount_info['MPvar
']; 6039 // Setting title if blank value to link: 6040 if ($linktxt == '') { 6041 $linktxt = $this->parseFunc($page['title
'], array('makelinks
' => 0), '< lib.parseFunc
'); 6044 $addQueryParams = $conf['addQueryString
'] ? $this->getQueryArguments($conf['addQueryString.
']) : ''; 6045 $addQueryParams .= isset($conf['additionalParams.
']) ? trim($this->stdWrap($conf['additionalParams
'], $conf['additionalParams.
'])) : trim($conf['additionalParams
']); 6046 if ($addQueryParams === '&
' || $addQueryParams[0] !== '&
') { 6047 $addQueryParams = ''; 6050 $currentDomain = $this->getEnvironmentVariable('HTTP_HOST
'); 6051 // Mount pages are always local and never link to another domain 6052 if (count($MPvarAcc)) { 6054 $addQueryParams .= '&MP=
' . rawurlencode(implode(',
', $MPvarAcc)); 6055 } elseif (strpos($addQueryParams, '&MP=
') === FALSE && $GLOBALS['TSFE
']->config['config
']['typolinkCheckRootline
']) { 6056 // We do not come here if additionalParams had '&MP=
'. This happens when typoLink is called from 6057 // menu. Mount points always work in the content of the current domain and we must not change 6058 // domain if MP variables exist. 6059 // If we link across domains and page is free type shortcut, we must resolve the shortcut first! 6060 // If we do not do it, TYPO3 will fail to (1) link proper page in RealURL/CoolURI because 6061 // they return relative links and (2) show proper page if no RealURL/CoolURI exists when link is clicked 6062 if ($enableLinksAcrossDomains && $page['doktype
'] == \TYPO3\CMS\Frontend\Page\PageRepository::DOKTYPE_SHORTCUT && $page['shortcut_mode
'] == \TYPO3\CMS\Frontend\Page\PageRepository::SHORTCUT_MODE_NONE) { 6063 // Save in case of broken destination or endless loop 6065 // Same as in RealURL, seems enough 6067 while ($maxLoopCount && is_array($page) && $page['doktype
'] == \TYPO3\CMS\Frontend\Page\PageRepository::DOKTYPE_SHORTCUT && $page['shortcut_mode
'] == \TYPO3\CMS\Frontend\Page\PageRepository::SHORTCUT_MODE_NONE) { 6068 $page = $GLOBALS['TSFE
']->sys_page->getPage($page['shortcut
'], $disableGroupAccessCheck); 6071 if (count($page) == 0 || $maxLoopCount == 0) { 6072 // We revert if shortcut is broken or maximum number of loops is exceeded (indicates endless loop) 6077 $targetDomain = $GLOBALS['TSFE
']->getDomainNameForPid($page['uid
']); 6078 // Do not prepend the domain if it is the current hostname 6079 if (!$targetDomain || $GLOBALS['TSFE
']->domainNameMatchesCurrentRequest($targetDomain)) { 6083 if ($conf['useCacheHash
']) { 6084 $params = $GLOBALS['TSFE
']->linkVars . $addQueryParams . '&
id=
' . $page['uid
']; 6085 if (trim($params, '&
') != '') { 6087 $cacheHash = GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\Page\\CacheHashCalculator
'); 6088 $cHash = $cacheHash->generateForParameters($params); 6089 $addQueryParams .= $cHash ? '&cHash=
' . $cHash : ''; 6093 $absoluteUrlScheme = 'http
'; 6094 // URL shall be absolute: 6099 } elseif ($page['url_scheme
'] > 0) { 6100 $absoluteUrlScheme = (int)$page['url_scheme
'] === \TYPO3\CMS\Core\Utility\HttpUtility::SCHEME_HTTP ? 'http
' : 'https
'; 6101 } elseif ($this->getEnvironmentVariable('TYPO3_SSL
')) { 6102 $absoluteUrlScheme = 'https
'; 6104 // If no domain records are defined, use current domain: 6105 $currentUrlScheme = parse_url($this->getEnvironmentVariable('TYPO3_REQUEST_URL
'), PHP_URL_SCHEME); 6106 if ($targetDomain === '' && ($conf['forceAbsoluteUrl'] || $absoluteUrlScheme !== $currentUrlScheme)) { 6107 $targetDomain = $currentDomain; 6109 // If go for an absolute link, add site path if it's not taken care about by absRefPrefix
6110 if (!
$GLOBALS[
'TSFE']->config[
'config'][
'absRefPrefix'] && $targetDomain == $currentDomain) {
6115 if (strlen($targetDomain) && $targetDomain !== $currentDomain && !$enableLinksAcrossDomains) {
6116 $target = isset($conf[
'extTarget']) ? $conf[
'extTarget'] :
$GLOBALS[
'TSFE']->extTarget;
6117 if ($conf[
'extTarget.']) {
6118 $target = $this->
stdWrap($target, $conf[
'extTarget.']);
6121 $target = $forceTarget;
6123 $LD[
'target'] = $target;
6125 if (!preg_match(
'/^[a-z0-9.\\-]*$/i', $targetDomain)) {
6128 $this->lastTypoLinkUrl = $this->
URLqMark(($absoluteUrlScheme .
'://' . $targetDomain .
'/index.php?id=' . $page[
'uid']), $addQueryParams) . $sectionMark;
6132 $target = $forceTarget;
6134 $LD =
$GLOBALS[
'TSFE']->tmpl->linkData($page, $target, $conf[
'no_cache'],
'',
'', $addQueryParams, $theTypeP, $targetDomain);
6135 if (strlen($targetDomain)) {
6137 if ($enableLinksAcrossDomains && $targetDomain !== $currentDomain) {
6142 $prefixLength = strlen(
$GLOBALS[
'TSFE']->config[
'config'][
'absRefPrefix']);
6143 if (substr($LD[
'totalURL'], 0, $prefixLength) ==
$GLOBALS[
'TSFE']->config[
'config'][
'absRefPrefix']) {
6144 $LD[
'totalURL'] = substr($LD[
'totalURL'], $prefixLength);
6147 $urlParts = parse_url($LD[
'totalURL']);
6148 if ($urlParts[
'host'] ==
'') {
6149 $LD[
'totalURL'] = $absoluteUrlScheme .
'://' . $targetDomain . ($LD[
'totalURL'][0] ==
'/' ?
'' :
'/') . $LD[
'totalURL'];
6152 $this->lastTypoLinkUrl = $this->
URLqMark($LD[
'totalURL'],
'') . $sectionMark;
6154 $this->lastTypoLinkTarget = $LD[
'target'];
6155 $targetPart = $LD[
'target'] ?
' target="' . htmlspecialchars($LD[
'target']) .
'"' :
'';
6157 if ($sectionMark && !
$GLOBALS[
'TSFE']->config[
'config'][
'baseURL'] && $page[
'uid'] ==
$GLOBALS[
'TSFE']->
id && !trim($addQueryParams) && !($conf[
'addQueryString'] && $conf[
'addQueryString.'])) {
6158 list(, $URLparams) = explode(
'?', $this->lastTypoLinkUrl);
6159 list($URLparams) = explode(
'#', $URLparams);
6160 parse_str($URLparams . $LD[
'orig_type'], $URLparamsArray);
6162 if ((
int)$URLparamsArray[
'type'] ==
$GLOBALS[
'TSFE']->type) {
6163 unset($URLparamsArray[
'id']);
6164 unset($URLparamsArray[
'type']);
6166 if (!count($URLparamsArray)) {
6167 $this->lastTypoLinkUrl = $sectionMark;
6172 if (empty($conf[
'linkAccessRestrictedPages']) &&
$GLOBALS[
'TSFE']->config[
'config'][
'typolinkLinkAccessRestrictedPages'] &&
$GLOBALS[
'TSFE']->config[
'config'][
'typolinkLinkAccessRestrictedPages'] !==
'NONE' && !
$GLOBALS[
'TSFE']->checkPageGroupAccess($page)) {
6173 $thePage =
$GLOBALS[
'TSFE']->sys_page->getPage(
$GLOBALS[
'TSFE']->config[
'config'][
'typolinkLinkAccessRestrictedPages']);
6174 $addParams = str_replace(
6180 rawurlencode($this->lastTypoLinkUrl),
6183 $GLOBALS[
'TSFE']->config[
'config'][
'typolinkLinkAccessRestrictedPages_addParams']
6185 $this->lastTypoLinkUrl = $this->
getTypoLink_URL($thePage[
'uid'] . ($theTypeP ?
',' . $theTypeP :
''), $addParams, $target);
6186 $this->lastTypoLinkUrl = $this->
forceAbsoluteUrl($this->lastTypoLinkUrl, $conf);
6192 $finalTagParts[
'targetParams'] = $targetPart;
6193 $finalTagParts[
'TYPE'] =
'page';
6195 $GLOBALS[
'TT']->setTSlogMessage(
'typolink(): Page id \'' . $link_param .
'\' was not found, so \
'' . $linktxt .
'\' was not linked.
', 1); 6200 $this->lastTypoLinkLD = $LD; 6202 $title = $forceTitle; 6204 if ($JSwindowParams) { 6205 // Create TARGET-attribute only if the right doctype is used 6206 if (!GeneralUtility::inList('xhtml_strict,xhtml_11,xhtml_2
', $GLOBALS['TSFE
']->xhtmlDoctype)) { 6207 $target = ' target=
"FEopenLink"'; 6211 $onClick = 'vHWin=window.open(
' . GeneralUtility::quoteJSvalue($GLOBALS['TSFE
']->baseUrlWrap($finalTagParts['url
']), TRUE) . ',\
'FEopenLink\',' .
GeneralUtility::quoteJSvalue($JSwindowParams) .
');vHWin.focus();return false;';
6212 $res =
'<a href="' . htmlspecialchars($finalTagParts[
'url']) .
'"' . $target .
' onclick="' . htmlspecialchars($onClick) .
'"' . ($title ?
' title="' . htmlspecialchars($title) .
'"' :
'') . ($linkClass ?
' class="' . htmlspecialchars($linkClass) .
'"' :
'') . $finalTagParts[
'aTagParams'] .
'>';
6214 if (
$GLOBALS[
'TSFE']->spamProtectEmailAddresses ===
'ascii' && $finalTagParts[
'TYPE'] ===
'mailto') {
6215 $res =
'<a href="' . $finalTagParts[
'url'] .
'"' . ($title ?
' title="' . htmlspecialchars($title) .
'"' :
'') . $finalTagParts[
'targetParams'] . ($linkClass ?
' class="' . htmlspecialchars($linkClass) .
'"' :
'') . $finalTagParts[
'aTagParams'] .
'>';
6217 $res =
'<a href="' . htmlspecialchars($finalTagParts[
'url']) .
'"' . ($title ?
' title="' . $title .
'"' :
'') . $finalTagParts[
'targetParams'] . ($linkClass ?
' class="' . htmlspecialchars($linkClass) .
'"' :
'') . $finalTagParts[
'aTagParams'] .
'>';
6221 if ($conf[
'userFunc']) {
6222 $finalTagParts[
'TAG'] = $res;
6223 $res = $this->
callUserFunction($conf[
'userFunc'], $conf[
'userFunc.'], $finalTagParts);
6226 if (isset(
$GLOBALS[
'TYPO3_CONF_VARS'][
'SC_OPTIONS'][
'tslib/class.tslib_content.php'][
'typoLink_PostProc']) && is_array(
$GLOBALS[
'TYPO3_CONF_VARS'][
'SC_OPTIONS'][
'tslib/class.tslib_content.php'][
'typoLink_PostProc'])) {
6229 'linktxt' => &$linktxt,
6230 'finalTag' => &$res,
6231 'finalTagParts' => &$finalTagParts
6233 foreach (
$GLOBALS[
'TYPO3_CONF_VARS'][
'SC_OPTIONS'][
'tslib/class.tslib_content.php'][
'typoLink_PostProc'] as $_funcRef) {
6238 if ($conf[
'returnLast']) {
6239 switch ($conf[
'returnLast']) {
6248 $wrap = isset($conf[
'wrap.']) ? $this->
stdWrap($conf[
'wrap'], $conf[
'wrap.']) : $conf[
'wrap'];
6249 if ($conf[
'ATagBeforeWrap']) {
6250 return $res . $this->
wrap($linktxt, $wrap) .
'</a>';
6252 return $this->
wrap($res . $linktxt .
'</a>', $wrap);
6267 if (!empty($url) && isset($configuration[
'forceAbsoluteUrl']) && $configuration[
'forceAbsoluteUrl']) {
6268 if (preg_match(
'#^(?:([a-z]+)(://)([^/]*)/?)?(.*)$#', $url, $matches)) {
6270 'scheme' => $matches[1],
6271 'delimiter' =>
'://',
6272 'host' => $matches[3],
6273 'path' => $matches[4]
6275 $isUrlModified = FALSE;
6277 if (empty($urlParts[
'host'])) {
6278 $urlParts[
'scheme'] =
'http';
6280 $urlParts[
'path'] =
'/' . ltrim($urlParts[
'path'],
'/');
6284 if (
$GLOBALS[
'TSFE']->absRefPrefix ===
'') {
6287 $isUrlModified = TRUE;
6290 $forceAbsoluteUrl = &$configuration[
'forceAbsoluteUrl.'][
'scheme'];
6291 if (!empty($forceAbsoluteUrl) && $urlParts[
'scheme'] !== $forceAbsoluteUrl) {
6292 $urlParts[
'scheme'] = $forceAbsoluteUrl;
6293 $isUrlModified = TRUE;
6296 if ($isUrlModified) {
6297 $url = implode(
'', $urlParts);
6313 $this->typolink(
'|', $conf);
6331 public function getTypoLink($label, $params, $urlParameters = array(), $target =
'') {
6333 $conf[
'parameter'] = $params;
6335 $conf[
'target'] = $target;
6336 $conf[
'extTarget'] = $target;
6337 $conf[
'fileTarget'] = $target;
6339 if (is_array($urlParameters)) {
6340 if (count($urlParameters)) {
6344 $conf[
'additionalParams'] .= $urlParameters;
6346 $out = $this->typolink($label, $conf);
6360 if ($addQueryString) {
6361 $conf[
'addQueryString'] =
'1';
6363 $conf[
'addQueryString.'] = array(
6365 'exclude' =>
'id,type,cHash' . ($linkVars ?
',' . $linkVars :
'')
6384 $this->
getTypoLink(
'', $params, $urlParameters, $target);
6397 $k = md5(microtime());
6398 return explode($k, $this->typolink($k, $conf));
6426 if (
$GLOBALS[
'TYPO3_CONF_VARS'][
'FE'][
'enable_mount_pids'] &&
$GLOBALS[
'TSFE']->MP) {
6428 if ((
int)
$GLOBALS[
'TSFE']->
id === (
int)$pageId) {
6433 $tCR_rootline =
$GLOBALS[
'TSFE']->sys_page->getRootLine($pageId,
'', TRUE);
6434 $inverseTmplRootline = array_reverse(
$GLOBALS[
'TSFE']->tmpl->rootLine);
6435 $rl_mpArray = array();
6436 $startMPaccu = FALSE;
6438 foreach ($tCR_rootline as $tCR_data) {
6439 foreach ($inverseTmplRootline as $rlKey => $invTmplRLRec) {
6441 if ($invTmplRLRec[
'_MOUNT_OL'] && $tCR_data[
'uid'] == $invTmplRLRec[
'uid']) {
6442 $startMPaccu = TRUE;
6445 if ($startMPaccu && $invTmplRLRec[
'_MP_PARAM']) {
6446 $rl_mpArray[] = $invTmplRLRec[
'_MP_PARAM'];
6451 if ($tCR_data[
'pid'] == $invTmplRLRec[
'pid'] && count($inverseTmplRootline) != $rlKey + 1) {
6452 $startMPaccu = TRUE;
6460 if (count($rl_mpArray)) {
6461 $MP = implode(
',', array_reverse($rl_mpArray));
6465 return !$raw ? ($MP ?
'&MP=' . rawurlencode($MP) :
'') : $MP;
6479 public function getMailTo($mailAddress, $linktxt, $initP =
'?') {
6480 if ((
string)$linktxt ===
'') {
6481 $linktxt = htmlspecialchars($mailAddress);
6483 $mailToUrl =
'mailto:' . $mailAddress;
6484 if (!
$GLOBALS[
'TSFE']->config[
'config'][
'jumpurl_enable'] ||
$GLOBALS[
'TSFE']->config[
'config'][
'jumpurl_mailto_disable']) {
6485 if (
$GLOBALS[
'TSFE']->spamProtectEmailAddresses) {
6486 if (
$GLOBALS[
'TSFE']->spamProtectEmailAddresses ===
'ascii') {
6487 $mailToUrl =
$GLOBALS[
'TSFE']->encryptEmail($mailToUrl);
6489 $mailToUrl =
'javascript:linkTo_UnCryptMailto(\'' .
$GLOBALS[
'TSFE']->encryptEmail($mailToUrl) .
'\');
'; 6491 if ($GLOBALS['TSFE
']->config['config
']['spamProtectEmailAddresses_atSubst
']) { 6492 $atLabel = trim($GLOBALS['TSFE
']->config['config
']['spamProtectEmailAddresses_atSubst
']); 6494 $spamProtectedMailAddress = str_replace('@
', $atLabel ? $atLabel : '(at)
', htmlspecialchars($mailAddress)); 6495 if ($GLOBALS['TSFE
']->config['config
']['spamProtectEmailAddresses_lastDotSubst
']) { 6496 $lastDotLabel = trim($GLOBALS['TSFE
']->config['config
']['spamProtectEmailAddresses_lastDotSubst
']); 6497 $lastDotLabel = $lastDotLabel ? $lastDotLabel : '(dot)
'; 6498 $spamProtectedMailAddress = preg_replace('/\\.([^\\.]+)$/
', $lastDotLabel . '$1
', $spamProtectedMailAddress); 6500 $linktxt = str_ireplace($mailAddress, $spamProtectedMailAddress, $linktxt); 6503 $juHash = GeneralUtility::hmac($mailToUrl, 'jumpurl
'); 6504 $mailToUrl = $GLOBALS['TSFE
']->absRefPrefix . $GLOBALS['TSFE
']->config['mainScript
'] . $initP . '&jumpurl=
' . rawurlencode($mailToUrl) . '&juHash=
' . $juHash . $GLOBALS['TSFE
']->getMethodUrlIdToken; 6521 public function getQueryArguments($conf, $overruleQueryArguments = array(), $forceOverruleArguments = FALSE) { 6522 switch ((string) $conf['method
']) { 6524 $currentQueryArray = GeneralUtility::_GET(); 6527 $currentQueryArray = GeneralUtility::_POST(); 6530 $currentQueryArray = GeneralUtility::_GET(); 6531 \TYPO3\CMS\Core\Utility\ArrayUtility::mergeRecursiveWithOverrule($currentQueryArray, GeneralUtility::_POST()); 6534 $currentQueryArray = GeneralUtility::_POST(); 6535 \TYPO3\CMS\Core\Utility\ArrayUtility::mergeRecursiveWithOverrule($currentQueryArray, GeneralUtility::_GET()); 6538 $currentQueryArray = GeneralUtility::explodeUrl2Array($this->getEnvironmentVariable('QUERY_STRING
'), TRUE); 6540 if ($conf['exclude
']) { 6541 $exclude = str_replace(',
', '&
', $conf['exclude
']); 6542 $exclude = GeneralUtility::explodeUrl2Array($exclude, TRUE); 6545 $newQueryArray = GeneralUtility::arrayDiffAssocRecursive($currentQueryArray, $exclude); 6547 $newQueryArray = $currentQueryArray; 6549 if ($forceOverruleArguments) { 6550 \TYPO3\CMS\Core\Utility\ArrayUtility::mergeRecursiveWithOverrule($newQueryArray, $overruleQueryArguments); 6552 \TYPO3\CMS\Core\Utility\ArrayUtility::mergeRecursiveWithOverrule($newQueryArray, $overruleQueryArguments, FALSE); 6554 return GeneralUtility::implodeArrayForUrl('', $newQueryArray, '', FALSE, TRUE); 6557 /*********************************************** 6559 * Miscellaneous functions, stand alone 6561 ***********************************************/ 6574 public function wrap($content, $wrap, $char = '|
') { 6576 $wrapArr = explode($char, $wrap); 6577 return trim($wrapArr[0]) . $content . trim($wrapArr[1]); 6594 public function noTrimWrap($content, $wrap, $char = '|
') { 6596 $wrapArr = explode($char, $wrap); 6597 return $wrapArr[1] . $content . $wrapArr[2]; 6612 public function wrapSpace($content, $wrap, array $conf = NULL) { 6614 $wrapArray = explode('|
', $wrap); 6615 $wrapBefore = (int)$wrapArray[0]; 6616 $wrapAfter = (int)$wrapArray[1]; 6617 $useDivTag = isset($conf['useDiv
']) && $conf['useDiv
']; 6620 $content = '<div
class=
"content-spacer spacer-before" style=
"height:' . $wrapBefore . 'px;"></div>
' . $content; 6622 $content = '<img src=
"' . $GLOBALS['TSFE']->absRefPrefix . 'clear.gif" width=
"1" height=
"' . $wrapBefore . '"' . $this->getBorderAttr(' border=
"0"') . ' class=
"spacer-gif" alt=
"" title=
"" /><br />
' . $content; 6627 $content .= '<div
class=
"content-spacer spacer-after" style=
"height:' . $wrapAfter . 'px;"></div>
'; 6629 $content .= '<img src=
"' . $GLOBALS['TSFE']->absRefPrefix . 'clear.gif" width=
"1" height=
"' . $wrapAfter . '"' . $this->getBorderAttr(' border=
"0"') . ' class=
"spacer-gif" alt=
"" title=
"" /><br />
'; 6647 public function callUserFunction($funcName, $conf, $content) { 6649 $parts = explode('->
', $funcName); 6650 if (count($parts) == 2) { 6652 // Check whether class is available and try to reload includeLibs if possible: 6653 if ($this->isClassAvailable($parts[0], $conf)) { 6654 $classObj = GeneralUtility::makeInstance($parts[0]); 6655 if (is_object($classObj) && method_exists($classObj, $parts[1])) { 6656 $classObj->cObj = $this; 6657 $content = call_user_func_array(array( 6665 $GLOBALS['TT
']->setTSlogMessage('Method
"' . $parts[1] . '" did not exist in
class "' . $parts[0] . '"', 3); 6668 $GLOBALS['TT
']->setTSlogMessage('Class
"' . $parts[0] . '" did not exist
', 3); 6672 if (function_exists($funcName)) { 6673 $content = call_user_func($funcName, $content, $conf); 6675 $GLOBALS['TT
']->setTSlogMessage('Function
"' . $funcName . '" did not exist
', 3); 6689 public function processParams($params) { 6690 $paramArr = array(); 6691 $lines = GeneralUtility::trimExplode(LF, $params, TRUE); 6692 foreach ($lines as $val) { 6693 $pair = explode('=
', $val, 2); 6694 $pair[0] = trim($pair[0]); 6695 if (!GeneralUtility::inList('#,/
', $pair[0][0])) { 6696 $paramArr[$pair[0]] = trim($pair[1]); 6709 public function keywords($content) { 6710 $listArr = preg_split('/[,;
' . LF . ']/
', $content); 6711 foreach ($listArr as $k => $v) { 6712 $listArr[$k] = trim($v); 6714 return implode(',
', $listArr); 6726 public function caseshift($theValue, $case) { 6727 $case = strtolower($case); 6730 $theValue = $GLOBALS['TSFE
']->csConvObj->conv_case($GLOBALS['TSFE
']->renderCharset, $theValue, 'toUpper
'); 6733 $theValue = $GLOBALS['TSFE
']->csConvObj->conv_case($GLOBALS['TSFE
']->renderCharset, $theValue, 'toLower
'); 6736 $theValue = ucwords($theValue); 6739 $theValue = $GLOBALS['TSFE
']->csConvObj->convCaseFirst($GLOBALS['TSFE
']->renderCharset, $theValue, 'toUpper
'); 6742 $theValue = $GLOBALS['TSFE
']->csConvObj->convCaseFirst($GLOBALS['TSFE
']->renderCharset, $theValue, 'toLower
'); 6757 public function HTMLcaseshift($theValue, $case) { 6761 $totalLen = strlen($theValue); 6764 $len = strcspn(substr($theValue, $pointer), '<
'); 6765 $newVal .= $this->caseshift(substr($theValue, $pointer, $len), $case); 6768 $len = strcspn(substr($theValue, $pointer), '>
') + 1; 6769 $newVal .= substr($theValue, $pointer, $len); 6773 } while ($pointer < $totalLen); 6785 public function calcAge($seconds, $labels) { 6786 if (\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($labels)) { 6787 $labels = ' min| hrs| days| yrs| min| hour| day| year
'; 6789 $labels = str_replace('"', '', $labels); 6791 $labelArr = explode('|', $labels); 6792 if (count($labelArr) == 4) { 6793 $labelArr = array_merge($labelArr, $labelArr); 6795 $absSeconds = abs($seconds); 6796 $sign = $seconds > 0 ? 1 : -1; 6797 if ($absSeconds < 3600) { 6798 $val = round($absSeconds / 60); 6799 $seconds = $sign * $val . ($val == 1 ? $labelArr[4] : $labelArr[0]); 6800 } elseif ($absSeconds < 24 * 3600) { 6801 $val = round($absSeconds / 3600); 6802 $seconds = $sign * $val . ($val == 1 ? $labelArr[5] : $labelArr[1]); 6803 } elseif ($absSeconds < 365 * 24 * 3600) { 6804 $val = round($absSeconds / (24 * 3600)); 6805 $seconds = $sign * $val . ($val == 1 ? $labelArr[6] : $labelArr[2]); 6807 $val = round($absSeconds / (365 * 24 * 3600)); 6808 $seconds = $sign * $val . ($val == 1 ? $labelArr[7] : $labelArr[3]); 6824 public function sendNotifyEmail($message, $recipients, $cc, $senderAddress, $senderName = '', $replyTo = '') { 6827 $mail = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Mail\\MailMessage'); 6828 $senderName = trim($senderName); 6829 $senderAddress = trim($senderAddress); 6830 if ($senderName !== '' && $senderAddress !== '') { 6831 $sender = array($senderAddress => $senderName); 6832 } elseif ($senderAddress !== '') { 6833 $sender = array($senderAddress); 6835 $sender = \TYPO3\CMS\Core\Utility\MailUtility::getSystemFrom(); 6837 $mail->setFrom($sender); 6838 $parsedReplyTo = \TYPO3\CMS\Core\Utility\MailUtility::parseAddresses($replyTo); 6839 if (count($parsedReplyTo) > 0) { 6840 $mail->setReplyTo($parsedReplyTo); 6842 $message = trim($message); 6843 if ($message !== '') { 6844 // First line is subject 6845 $messageParts = explode(LF, $message, 2); 6846 $subject = trim($messageParts[0]); 6847 $plainMessage = trim($messageParts[1]); 6848 $parsedRecipients = \TYPO3\CMS\Core\Utility\MailUtility::parseAddresses($recipients); 6849 if (count($parsedRecipients) > 0) { 6850 $mail->setTo($parsedRecipients) 6851 ->setSubject($subject) 6852 ->setBody($plainMessage); 6855 $parsedCc = \TYPO3\CMS\Core\Utility\MailUtility::parseAddresses($cc); 6856 if (count($parsedCc) > 0) { 6858 $mail = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Mail\\MailMessage'); 6859 if (count($parsedReplyTo) > 0) { 6860 $mail->setReplyTo($parsedReplyTo); 6862 $mail->setFrom($sender) 6864 ->setSubject($subject) 6865 ->setBody($plainMessage); 6881 public function URLqMark($url, $params) { 6882 if ($params && !strstr($url, '?')) { 6883 return $url . '?' . $params; 6885 return $url . $params; 6898 public function clearTSProperties($TSArr, $propList) { 6899 $list = explode(',', $propList); 6900 foreach ($list as $prop) { 6901 $prop = trim($prop); 6902 unset($TSArr[$prop]); 6903 unset($TSArr[$prop . '.']); 6918 public function mergeTSRef($confArr, $prop) { 6919 if ($confArr[$prop][0] === '<') { 6920 $key = trim(substr($confArr[$prop], 1)); 6921 $cF = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\TypoScript\\Parser\\TypoScriptParser'); 6922 // $name and $conf is loaded with the referenced values. 6923 $old_conf = $confArr[$prop . '.']; 6924 list($name, $conf) = $cF->getVal($key, $GLOBALS['TSFE']->tmpl->setup); 6925 if (is_array($old_conf) && count($old_conf)) { 6926 $conf = is_array($conf) ? array_replace_recursive($conf, $old_conf) : $old_conf; 6928 $confArr[$prop . '.'] = $conf; 6943 public function joinTSarrays($conf, $old_conf) { 6944 GeneralUtility::logDeprecatedFunction(); 6945 return array_replace_recursive($conf, $old_conf); 6958 public function gifBuilderTextBox($gifbuilderConf, $conf, $text) { 6959 $chars = (int)$conf['chars'] ?: 20; 6960 $lineDist = (int)$conf['lineDist'] ?: 20; 6961 $Valign = strtolower(trim($conf['Valign'])); 6962 $tmplObjNumber = (int)$conf['tmplObjNumber']; 6963 $maxLines = (int)$conf['maxLines']; 6964 if ($tmplObjNumber && $gifbuilderConf[$tmplObjNumber] == 'TEXT') { 6965 $textArr = $this->linebreaks($text, $chars, $maxLines); 6966 $angle = (int)$gifbuilderConf[$tmplObjNumber . '.']['angle']; 6967 foreach ($textArr as $c => $textChunk) { 6968 $index = $tmplObjNumber + 1 + $c * 2; 6970 $gifbuilderConf = $this->clearTSProperties($gifbuilderConf, $index); 6971 $rad_angle = 2 * pi() / 360 * $angle; 6972 $x_d = sin($rad_angle) * $lineDist; 6973 $y_d = cos($rad_angle) * $lineDist; 6976 if ($Valign == 'center') { 6977 $diff_x_d = $x_d * count($textArr); 6978 $diff_x_d = $diff_x_d / 2; 6979 $diff_y_d = $y_d * count($textArr); 6980 $diff_y_d = $diff_y_d / 2; 6982 $x_d = round($x_d * $c - $diff_x_d); 6983 $y_d = round($y_d * $c - $diff_y_d); 6984 $gifbuilderConf[$index] = 'WORKAREA'; 6985 $gifbuilderConf[$index . '.']['set'] = $x_d . ',' . $y_d; 6988 $gifbuilderConf = $this->clearTSProperties($gifbuilderConf, $index); 6989 $gifbuilderConf[$index] = 'TEXT'; 6990 $gifbuilderConf[$index . '.'] = $this->clearTSProperties($gifbuilderConf[$tmplObjNumber . '.'], 'text'); 6991 $gifbuilderConf[$index . '.']['text'] = $textChunk; 6993 $gifbuilderConf = $this->clearTSProperties($gifbuilderConf, $tmplObjNumber); 6995 return $gifbuilderConf; 7009 public function linebreaks($string, $chars, $maxLines = 0) { 7010 $lines = explode(LF, $string); 7013 foreach ($lines as $paragraph) { 7014 $words = explode(' ', $paragraph); 7015 foreach ($words as $word) { 7016 if (strlen($lineArr[$c] . $word) > $chars) { 7019 if (!$maxLines || $c < $maxLines) { 7020 $lineArr[$c] .= $word . ' '; 7041 public function getUpdateJS($dataArray, $formName, $arrPrefix, $fieldList) { 7043 $updateValues = GeneralUtility::trimExplode(',', $fieldList); 7044 foreach ($updateValues as $fKey) { 7045 $value = $dataArray[$fKey]; 7046 if (is_array($value)) { 7047 foreach ($value as $Nvalue) { 7049 updateForm(\'' . $formName . '\',\'' . $arrPrefix . '[' . $fKey . '][]\',' . GeneralUtility::quoteJSvalue($Nvalue, TRUE) . ');'; 7053 updateForm(\'' . $formName . '\',\'' . $arrPrefix . '[' . $fKey . ']\',' . GeneralUtility::quoteJSvalue($value, TRUE) . ');'; 7056 $JSPart = '<script type="text/javascript
"> 7057 /*<![CDATA[*/ ' . $JSPart . ' 7061 $GLOBALS['TSFE']->additionalHeaderData['JSincludeFormupdate'] = '<script type="text/javascript
" src="' . GeneralUtility::createVersionNumberedFilename(($GLOBALS['TSFE
']->absRefPrefix . 'typo3/js/jsfunc.updateform.js
')) . '"></script>'; 7071 public function includeLibs(array $config) { 7072 $librariesIncluded = FALSE; 7073 if (isset($config['includeLibs']) && $config['includeLibs']) { 7074 $libraries = GeneralUtility::trimExplode(',', $config['includeLibs'], TRUE); 7075 $GLOBALS['TSFE']->includeLibraries($libraries); 7076 $librariesIncluded = TRUE; 7078 return $librariesIncluded; 7100 protected function isClassAvailable($className, array $config = NULL) { 7101 if (class_exists($className)) { 7103 } elseif ($config) { 7104 $pluginConfiguration = &$GLOBALS['TSFE']->tmpl->setup['plugin.'][$className . '.']; 7105 if (isset($pluginConfiguration['includeLibs']) && $pluginConfiguration['includeLibs']) { 7106 $config['includeLibs'] = $pluginConfiguration['includeLibs']; 7107 return $this->includeLibs($config); 7113 /*********************************************** 7115 * Database functions, making of queries 7117 ***********************************************/ 7129 public function DBgetDelete($table, $uid, $doExec = FALSE) { 7132 if ($GLOBALS['TCA'][$table]['ctrl']['delete']) { 7133 $updateFields = array(); 7134 $updateFields[$GLOBALS['TCA'][$table]['ctrl']['delete']] = 1; 7135 if ($GLOBALS['TCA'][$table]['ctrl']['tstamp']) { 7136 $updateFields[$GLOBALS['TCA'][$table]['ctrl']['tstamp']] = $GLOBALS['EXEC_TIME']; 7140 return $GLOBALS['TYPO3_DB']->exec_UPDATEquery($table, 'uid=' . $uid, $updateFields); 7142 return $GLOBALS['TYPO3_DB']->UPDATEquery($table, 'uid=' . $uid, $updateFields); 7146 return $GLOBALS['TYPO3_DB']->exec_DELETEquery($table, 'uid=' . $uid); 7148 return $GLOBALS['TYPO3_DB']->DELETEquery($table, 'uid=' . $uid); 7169 public function DBgetUpdate($table, $uid, $dataArr, $fieldList, $doExec = FALSE) { 7170 // uid can never be set 7171 unset($dataArr['uid']); 7174 $fieldList = implode(',', GeneralUtility::trimExplode(',', $fieldList, TRUE)); 7175 $updateFields = array(); 7176 foreach ($dataArr as $f => $v) { 7177 if (GeneralUtility::inList($fieldList, $f)) { 7178 $updateFields[$f] = $v; 7181 if ($GLOBALS['TCA'][$table]['ctrl']['tstamp']) { 7182 $updateFields[$GLOBALS['TCA'][$table]['ctrl']['tstamp']] = $GLOBALS['EXEC_TIME']; 7184 if (count($updateFields)) { 7186 return $GLOBALS['TYPO3_DB']->exec_UPDATEquery($table, 'uid=' . $uid, $updateFields); 7188 return $GLOBALS['TYPO3_DB']->UPDATEquery($table, 'uid=' . $uid, $updateFields); 7209 public function DBgetInsert($table, $pid, $dataArr, $fieldList, $doExec = FALSE) { 7211 if ($GLOBALS['TCA'][$table]['ctrl']['tstamp']) { 7212 $field = $GLOBALS['TCA'][$table]['ctrl']['tstamp']; 7213 $dataArr[$field] = $GLOBALS['EXEC_TIME']; 7214 $extraList .= ',' . $field; 7216 if ($GLOBALS['TCA'][$table]['ctrl']['crdate']) { 7217 $field = $GLOBALS['TCA'][$table]['ctrl']['crdate']; 7218 $dataArr[$field] = $GLOBALS['EXEC_TIME']; 7219 $extraList .= ',' . $field; 7221 if ($GLOBALS['TCA'][$table]['ctrl']['cruser_id']) { 7222 $field = $GLOBALS['TCA'][$table]['ctrl']['cruser_id']; 7223 $dataArr[$field] = 0; 7224 $extraList .= ',' . $field; 7226 if ($GLOBALS['TCA'][$table]['ctrl']['fe_cruser_id']) { 7227 $field = $GLOBALS['TCA'][$table]['ctrl']['fe_cruser_id']; 7228 $dataArr[$field] = (int)$GLOBALS['TSFE']->fe_user->user['uid']; 7229 $extraList .= ',' . $field; 7231 if ($GLOBALS['TCA'][$table]['ctrl']['fe_crgroup_id']) { 7232 $field = $GLOBALS['TCA'][$table]['ctrl']['fe_crgroup_id']; 7233 list($dataArr[$field]) = explode(',', $GLOBALS['TSFE']->fe_user->user['usergroup']); 7234 $dataArr[$field] = (int)$dataArr[$field]; 7235 $extraList .= ',' . $field; 7237 // Uid can never be set 7238 unset($dataArr['uid']); 7240 $dataArr['pid'] = $pid; 7242 // Set pid < 0 and the dataarr-pid will be used! 7243 $fieldList = implode(',', GeneralUtility::trimExplode(',', $fieldList . ',' . $extraList, TRUE)); 7244 $insertFields = array(); 7245 foreach ($dataArr as $f => $v) { 7246 if (GeneralUtility::inList($fieldList, $f)) { 7247 $insertFields[$f] = $v; 7251 return $GLOBALS['TYPO3_DB']->exec_INSERTquery($table, $insertFields); 7253 return $GLOBALS['TYPO3_DB']->INSERTquery($table, $insertFields); 7269 public function DBmayFEUserEdit($table, $row, $feUserRow, $allowedGroups = '', $feEditSelf = 0) { 7270 $groupList = $allowedGroups ? implode(',', array_intersect(GeneralUtility::trimExplode(',', $feUserRow['usergroup'], TRUE), GeneralUtility::trimExplode(',', $allowedGroups, TRUE))) : $feUserRow['usergroup']; 7272 // Points to the field that allows further editing from frontend if not set. If set the record is locked. 7273 if (!$GLOBALS['TCA'][$table]['ctrl']['fe_admin_lock'] || !$row[$GLOBALS['TCA'][$table]['ctrl']['fe_admin_lock']]) { 7274 // Points to the field (integer) that holds the fe_users-id of the creator fe_user 7275 if ($GLOBALS['TCA'][$table]['ctrl']['fe_cruser_id']) { 7276 $rowFEUser = (int)$row[$GLOBALS['TCA'][$table]['ctrl']['fe_cruser_id']]; 7277 if ($rowFEUser && $rowFEUser == $feUserRow['uid']) { 7281 // If $feEditSelf is set, fe_users may always edit them selves... 7282 if ($feEditSelf && $table == 'fe_users' && (int)$feUserRow['uid'] === (int)$row['uid']) { 7285 // Points to the field (integer) that holds the fe_group-id of the creator fe_user's first group 7286 if ($GLOBALS['TCA'][$table]['ctrl']['fe_crgroup_id']) { 7287 $rowFEUser = (int)$row[$GLOBALS['TCA'][$table]['ctrl']['fe_crgroup_id']]; 7289 if (GeneralUtility::inList($groupList, $rowFEUser)) { 7311 public function DBmayFEUserEditSelect($table, $feUserRow, $allowedGroups = '', $feEditSelf = 0) { 7312 // Returns where-definition that selects user-editable records. 7313 $groupList = $allowedGroups ? implode(',', array_intersect(GeneralUtility::trimExplode(',', $feUserRow['usergroup'], TRUE), GeneralUtility::trimExplode(',', $allowedGroups, TRUE))) : $feUserRow['usergroup']; 7315 // Points to the field (integer) that holds the fe_users-id of the creator fe_user 7316 if ($GLOBALS['TCA'][$table]['ctrl']['fe_cruser_id']) { 7317 $OR_arr[] = $GLOBALS['TCA'][$table]['ctrl']['fe_cruser_id'] . '=' . $feUserRow['uid']; 7319 // Points to the field (integer) that holds the fe_group-id of the creator fe_user's first group 7320 if ($GLOBALS['TCA'][$table]['ctrl']['fe_crgroup_id']) { 7321 $values = GeneralUtility::intExplode(',', $groupList); 7322 foreach ($values as $theGroupUid) { 7324 $OR_arr[] = $GLOBALS['TCA'][$table]['ctrl']['fe_crgroup_id'] . '=' . $theGroupUid; 7328 // If $feEditSelf is set, fe_users may always edit them selves... 7329 if ($feEditSelf && $table == 'fe_users') { 7330 $OR_arr[] = 'uid=' . (int)$feUserRow['uid']; 7332 $whereDef = ' AND 1=0'; 7333 if (count($OR_arr)) { 7334 $whereDef = ' AND (' . implode(' OR ', $OR_arr) . ')'; 7335 if ($GLOBALS['TCA'][$table]['ctrl']['fe_admin_lock']) { 7336 $whereDef .= ' AND ' . $GLOBALS['TCA'][$table]['ctrl']['fe_admin_lock'] . '=0'; 7357 public function enableFields($table, $show_hidden = FALSE, array $ignore_array = array()) { 7358 $show_hidden = $show_hidden ?: ($table === 'pages' ? $GLOBALS['TSFE']->showHiddenPage : $GLOBALS['TSFE']->showHiddenRecords); 7359 return $GLOBALS['TSFE']->sys_page->enableFields($table, $show_hidden, $ignore_array); 7388 public function getTreeList($id, $depth, $begin = 0, $dontCheckEnableFields = FALSE, $addSelectFields = '', $moreWhereClauses = '', array $prevId_array = array(), $recursionLevel = 0) { 7395 $allFields = 'uid,hidden,starttime,endtime,fe_group,extendToSubpages,doktype,php_tree_stop,mount_pid,mount_pid_ol,t3ver_state' . $addSelectFields; 7396 $depth = (int)$depth; 7397 $begin = (int)$begin; 7402 // First level, check id (second level, this is done BEFORE the recursive call) 7403 if (!$recursionLevel) { 7404 // Check tree list cache 7405 // First, create the hash for this request - not sure yet whether we need all these parameters though 7406 $parameters = array( 7410 $dontCheckEnableFields, 7414 $GLOBALS['TSFE']->gr_list 7416 $requestHash = md5(serialize($parameters)); 7417 $cacheEntry = $GLOBALS['TYPO3_DB']->exec_SELECTgetSingleRow( 7420 'md5hash = \'' . $requestHash . '\' AND ( expires > ' . $GLOBALS['EXEC_TIME'] . ' OR expires = 0 )' 7422 if (is_array($cacheEntry)) { 7424 return $cacheEntry['treelist']; 7426 // If Id less than zero it means we should add the real id to list: 7428 $addId = ($id = abs($id)); 7430 // Check start page: 7431 if ($GLOBALS['TSFE']->sys_page->getRawRecord('pages', $id, 'uid')) { 7432 // Find mount point if any: 7433 $mount_info = $GLOBALS['TSFE']->sys_page->getMountPointInfo($id); 7434 if (is_array($mount_info)) { 7435 $id = $mount_info['mount_pid']; 7436 // In Overlay mode, use the mounted page uid as added ID!: 7437 if ($addId && $mount_info['overlay']) { 7442 // Return blank if the start page was NOT found at all! 7446 // Add this ID to the array of IDs 7448 $prevId_array[] = $id; 7452 $rows = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows( 7455 'pid = ' . (int)$id . ' AND deleted = 0 ' . $moreWhereClauses, 7459 if (is_array($rows)) { 7460 foreach ($rows as $row) { 7461 $versionState = VersionState::cast($row['t3ver_state']); 7462 $GLOBALS['TSFE']->sys_page->versionOL('pages', $row); 7463 if ($row['doktype'] == \TYPO3\CMS\Frontend\Page\PageRepository::DOKTYPE_RECYCLER 7464 || $row['doktype'] == \TYPO3\CMS\Frontend\Page\PageRepository::DOKTYPE_BE_USER_SECTION 7465 || $versionState->indicatesPlaceholder() 7467 // Doing this after the overlay to make sure changes 7468 // in the overlay are respected. 7469 // However, we do not process pages below of and 7470 // including of type recycler and BE user section 7473 // Find mount point if any: 7474 $next_id = $row['uid']; 7475 $mount_info = $GLOBALS['TSFE']->sys_page->getMountPointInfo($next_id, $row); 7477 if (is_array($mount_info) && $mount_info['overlay']) { 7478 $next_id = $mount_info['mount_pid']; 7479 $row = $GLOBALS['TYPO3_DB']->exec_SELECTgetSingleRow( 7482 'uid = ' . (int)$next_id . ' AND deleted = 0 ' . $moreWhereClauses, 7486 $GLOBALS['TSFE']->sys_page->versionOL('pages', $row); 7487 if ($row['doktype'] == \TYPO3\CMS\Frontend\Page\PageRepository::DOKTYPE_RECYCLER 7488 || $row['doktype'] == \TYPO3\CMS\Frontend\Page\PageRepository::DOKTYPE_BE_USER_SECTION 7489 || $versionState->indicatesPlaceholder() 7491 // Doing this after the overlay to make sure 7492 // changes in the overlay are respected. 7498 if ($dontCheckEnableFields || $GLOBALS['TSFE']->checkPagerecordForIncludeSection($row)) { 7501 if ($dontCheckEnableFields || $GLOBALS['TSFE']->checkEnableFields($row)) { 7502 $theList[] = $next_id; 7506 if ($depth > 1 && !$row['php_tree_stop']) { 7508 if (is_array($mount_info) && !$mount_info['overlay']) { 7509 $next_id = $mount_info['mount_pid']; 7511 // Call recursively, if the id is not in prevID_array: 7512 if (!in_array($next_id, $prevId_array)) { 7513 $theList = array_merge( 7514 GeneralUtility::intExplode( 7516 $this->getTreeList($next_id, $depth - 1, $begin - 1, 7517 $dontCheckEnableFields, $addSelectFields, $moreWhereClauses, 7518 $prevId_array, $recursionLevel + 1), 7529 // If first run, check if the ID should be returned: 7530 if (!$recursionLevel) { 7535 $theList[] = $addId; 7538 $GLOBALS['TYPO3_DB']->exec_INSERTquery('cache_treelist', array( 7539 'md5hash' => $requestHash, 7541 'treelist' => implode(',', $theList), 7542 'tstamp' => $GLOBALS['EXEC_TIME'] 7546 return implode(',', $theList); 7564 public function exec_mm_query($select, $local_table, $mm_table, $foreign_table, $whereClause = '', $groupBy = '', $orderBy = '', $limit = '') { 7565 return $GLOBALS['TYPO3_DB']->exec_SELECTquery($select, $local_table . ',' . $mm_table . ($foreign_table ? ',' . $foreign_table : ''), $local_table . '.uid=' . $mm_table . '.uid_local' . ($foreign_table ? ' AND ' . $foreign_table . '.uid=' . $mm_table . '.uid_foreign' : '') . $whereClause, $groupBy, $orderBy, $limit); 7584 public function exec_mm_query_uidList($select, $local_table_uidlist, $mm_table, $foreign_table = '', $whereClause = '', $groupBy = '', $orderBy = '', $limit = '') { 7585 return $GLOBALS['TYPO3_DB']->exec_SELECTquery($select, $mm_table . ($foreign_table ? ',' . $foreign_table : ''), $mm_table . '.uid_local IN (' . $local_table_uidlist . ')' . ($foreign_table ? ' AND ' . $foreign_table . '.uid=' . $mm_table . '.uid_foreign' : '') . $whereClause, $groupBy, $orderBy, $limit); 7598 public function searchWhere($sw, $searchFieldList, $searchTable = '') { 7600 $prefixTableName = $searchTable ? $searchTable . '.' : ''; 7603 $searchFields = explode(',', $searchFieldList); 7604 $kw = preg_split('/[ ,]/', $sw); 7605 foreach ($kw as $val) { 7608 if (strlen($val) >= 2) { 7609 $val = $TYPO3_DB->escapeStrForLike($TYPO3_DB->quoteStr($val, $searchTable), $searchTable); 7610 foreach ($searchFields as $field) { 7611 $where_p[] = $prefixTableName . $field . ' LIKE \'%' . $val . '%\''; 7614 if (count($where_p)) { 7615 $where .= ' AND (' . implode(' OR ', $where_p) . ')'; 7632 public function exec_getQuery($table, $conf) { 7633 $queryParts = $this->getQuery($table, $conf, TRUE); 7634 return $GLOBALS['TYPO3_DB']->exec_SELECT_queryArray($queryParts); 7649 public function getQuery($table, $conf, $returnQueryArray = FALSE) { 7650 // Resolve stdWrap in these properties first 7651 $properties = array( 7666 foreach ($properties as $property) { 7667 $conf[$property] = isset($conf[$property . '.']) ? trim($this->stdWrap($conf[$property], $conf[$property . '.'])) : trim($conf[$property]); 7668 if ($conf[$property] === '') { 7669 unset($conf[$property]); 7671 if (isset($conf[$property . '.'])) { 7672 // stdWrapping already done, so remove the sub-array 7673 unset($conf[$property . '.']); 7676 // Handle PDO-style named parameter markers first 7677 $queryMarkers = $this->getQueryMarkers($table, $conf); 7678 // Replace the markers in the non-stdWrap properties 7679 foreach ($queryMarkers as $marker => $markerValue) { 7680 $properties = array( 7692 foreach ($properties as $property) { 7693 if ($conf[$property]) { 7694 $conf[$property] = str_replace('###' . $marker . '###', $markerValue, $conf[$property]); 7698 // Construct WHERE clause: 7699 // Handle recursive function for the pidInList 7700 if (isset($conf['recursive'])) { 7701 $conf['recursive'] = (int)$conf['recursive']; 7702 if ($conf['recursive'] > 0) { 7703 $pidList = GeneralUtility::trimExplode(',', $conf['pidInList'], TRUE); 7704 array_walk($pidList, function (&$storagePid) { 7705 if ($storagePid === 'this') { 7706 $storagePid = $GLOBALS['TSFE']->id; 7708 if ($storagePid > 0) { 7709 $storagePid = -$storagePid; 7712 $expandedPidList = array(); 7713 foreach ($pidList as $value) { 7714 // Implementation of getTreeList allows to pass the id negative to include 7715 // it into the result otherwise only childpages are returned 7716 $expandedPidList = array_merge( 7717 GeneralUtility::intExplode(',', $this->getTreeList($value, $conf['recursive'])), 7721 $conf['pidInList'] = implode(',', $expandedPidList); 7724 if ((string)$conf['pidInList'] === '') { 7725 $conf['pidInList'] = 'this'; 7727 $queryParts = $this->getWhere($table, $conf, TRUE); 7729 if ($conf['selectFields']) { 7730 $queryParts['SELECT'] = $this->sanitizeSelectPart($conf['selectFields'], $table); 7732 $queryParts['SELECT'] = '*'; 7735 if ($conf['max'] || $conf['begin']) { 7737 // Finding the total number of records, if used: 7738 if (strstr(strtolower($conf['begin'] . $conf['max']), 'total')) { 7739 $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('count(*)', $table, $queryParts['WHERE'], $queryParts['GROUPBY']); 7740 if ($error = $GLOBALS['TYPO3_DB']->sql_error()) { 7741 $GLOBALS['TT']->setTSlogMessage($error); 7743 $row = $GLOBALS['TYPO3_DB']->sql_fetch_row($res); 7744 $conf['max'] = str_ireplace('total', $row[0], $conf['max']); 7745 $conf['begin'] = str_ireplace('total', $row[0], $conf['begin']); 7747 $GLOBALS['TYPO3_DB']->sql_free_result($res); 7750 $conf['begin'] = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange(ceil($this->calc($conf['begin'])), 0); 7751 $conf['max'] = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange(ceil($this->calc($conf['max'])), 0); 7752 if ($conf['begin'] && !$conf['max']) { 7753 $conf['max'] = 100000; 7755 if ($conf['begin'] && $conf['max']) { 7756 $queryParts['LIMIT'] = $conf['begin'] . ',' . $conf['max']; 7757 } elseif (!$conf['begin'] && $conf['max']) { 7758 $queryParts['LIMIT'] = $conf['max']; 7763 // Setting up tablejoins: 7765 if ($conf['join']) { 7766 $joinPart = 'JOIN ' . $conf['join']; 7767 } elseif ($conf['leftjoin']) { 7768 $joinPart = 'LEFT OUTER JOIN ' . $conf['leftjoin']; 7769 } elseif ($conf['rightjoin']) { 7770 $joinPart = 'RIGHT OUTER JOIN ' . $conf['rightjoin']; 7772 // Compile and return query: 7773 $queryParts['FROM'] = trim($table . ' ' . $joinPart); 7774 // Replace the markers in the queryParts to handle stdWrap 7775 // enabled properties 7776 foreach ($queryMarkers as $marker => $markerValue) { 7777 foreach ($queryParts as $queryPartKey => &$queryPartValue) { 7778 $queryPartValue = str_replace('###' . $marker . '###', $markerValue, $queryPartValue); 7780 unset($queryPartValue); 7782 $query = $GLOBALS['TYPO3_DB']->SELECTquery($queryParts['SELECT'], $queryParts['FROM'], $queryParts['WHERE'], $queryParts['GROUPBY'], $queryParts['ORDERBY'], $queryParts['LIMIT']); 7783 return $returnQueryArray ? $queryParts : $query; 7798 public function getWhere($table, $conf, $returnQueryArray = FALSE) { 7802 $enableFieldsIgnore = array(); 7803 $queryParts = array( 7811 $considerMovePlaceholders = ( 7812 $GLOBALS['TSFE']->sys_page->versioningPreview && $table !== 'pages' 7813 && !empty($GLOBALS['TCA'][$table]['ctrl']['versioningWS']) 7814 && (int)$GLOBALS['TCA'][$table]['ctrl']['versioningWS'] >= 2 7816 if (trim($conf['uidInList'])) { 7817 $listArr = GeneralUtility::intExplode(',', str_replace('this', $GLOBALS['TSFE']->contentPid, $conf['uidInList'])); 7818 if (count($listArr) === 1) { 7819 $comparison = '=' . (int)$listArr[0]; 7821 $comparison = ' IN (' . implode(',', $GLOBALS['TYPO3_DB']->cleanIntArray($listArr)) . ')'; 7823 // If move placeholder shall be considered, select via t3ver_move_id 7824 if ($considerMovePlaceholders) { 7825 $movePlaceholderComparison = $table . '.t3ver_state=' . VersionState::cast(VersionState::MOVE_PLACEHOLDER) . ' AND ' . $table . '.t3ver_move_id' . $comparison; 7826 $query .= ' AND (' . $table . '.uid' . $comparison . ' OR ' . $movePlaceholderComparison .')'; 7828 $query .= ' AND ' . $table . '.uid' . $comparison; 7832 // Static_* tables are allowed to be fetched from root page 7833 if (substr($table, 0, 7) == 'static_') { 7836 if (trim($conf['pidInList'])) { 7837 $listArr = GeneralUtility::intExplode(',', str_replace('this', $GLOBALS['TSFE']->contentPid, $conf['pidInList'])); 7838 // Removes all pages which are not visible for the user! 7839 $listArr = $this->checkPidArray($listArr); 7840 if (GeneralUtility::inList($conf['pidInList'], 'root')) { 7843 if (GeneralUtility::inList($conf['pidInList'], '-1')) { 7845 $enableFieldsIgnore['pid'] = TRUE; 7847 if (count($listArr)) { 7848 $query .= ' AND ' . $table . '.pid IN (' . implode(',', array_map('intval', $listArr)) . ')'; 7851 // If not uid and not pid then uid is set to 0 - which results in nothing!! 7855 // If not uid and not pid then uid is set to 0 - which results in nothing!! 7856 if (!$pid_uid_flag) { 7857 $query .= ' AND ' . $table . '.uid=0'; 7859 $where = isset($conf['where.']) ? trim($this->stdWrap($conf['where'], $conf['where.'])) : trim($conf['where']); 7861 $query .= ' AND ' . $where; 7863 if ($conf['languageField']) { 7864 // The sys_language record UID of the content of the page 7865 $sys_language_content = (int)$GLOBALS['TSFE']->sys_language_content; 7867 if ($GLOBALS['TSFE']->sys_language_contentOL 7868 && isset($GLOBALS['TCA'][$table]) 7869 && !empty($GLOBALS['TCA'][$table]['ctrl']['languageField']) 7870 && !empty($GLOBALS['TCA'][$table]['ctrl']['transOrigPointerField']) 7872 // Sys language content is set to zero/-1 - and it is expected that whatever routine processes the output will 7873 // OVERLAY the records with localized versions! 7874 $languageQuery = $conf['languageField'] . ' IN (0,-1)'; 7875 // Use this option to include records that don't have a default translation 7876 // (originalpointerfield is 0 and the language field contains the requested language) 7877 if (!empty($conf['includeRecordsWithoutDefaultTranslation'])) { 7878 $languageQuery .= ' OR (' . $GLOBALS['TCA'][$table]['ctrl']['transOrigPointerField'] . ' = 0 AND ' . 7879 $conf['languageField'] . ' = ' . $sys_language_content . ')'; 7882 $languageQuery = $conf['languageField'] . ' = ' . $sys_language_content; 7884 $query .= ' AND (' . $languageQuery . ')'; 7886 $andWhere = isset($conf['andWhere.']) ? trim($this->stdWrap($conf['andWhere'], $conf['andWhere.'])) : trim($conf['andWhere']); 7888 $query .= ' AND ' . $andWhere; 7891 if ($table == 'pages') { 7892 $query .= ' ' . $GLOBALS['TSFE']->sys_page->where_hid_del . $GLOBALS['TSFE']->sys_page->where_groupAccess; 7894 $query .= $this->enableFields($table, FALSE, $enableFieldsIgnore); 7898 // Stripping of " AND
"... 7899 $queryParts['WHERE'] = trim(substr($query, 4)); 7900 $query = 'WHERE ' . $queryParts['WHERE']; 7903 if (trim($conf['groupBy'])) { 7904 $queryParts['GROUPBY'] = isset($conf['groupBy.']) ? trim($this->stdWrap($conf['groupBy'], $conf['groupBy.'])) : trim($conf['groupBy']); 7907 if (trim($conf['orderBy'])) { 7908 $queryParts['ORDERBY'] = isset($conf['orderBy.']) ? trim($this->stdWrap($conf['orderBy'], $conf['orderBy.'])) : trim($conf['orderBy']); 7909 $query .= ' ORDER BY ' . $queryParts['ORDERBY']; 7912 return $returnQueryArray ? $queryParts : $query; 7927 protected function sanitizeSelectPart($selectPart, $table) { 7928 // Pattern matching parts 7929 $matchStart = '/(^\\s*|,\\s*|' . $table . '\\.)'; 7930 $matchEnd = '(\\s*,|\\s*$)/'; 7931 $necessaryFields = array('uid', 'pid'); 7932 $wsFields = array('t3ver_state'); 7933 if (isset($GLOBALS['TCA'][$table]) && !preg_match(($matchStart . '\\*' . $matchEnd), $selectPart) && !preg_match('/(count|max|min|avg|sum)\\([^\\)]+\\)/i', $selectPart)) { 7934 foreach ($necessaryFields as $field) { 7935 $match = $matchStart . $field . $matchEnd; 7936 if (!preg_match($match, $selectPart)) { 7937 $selectPart .= ', ' . $table . '.' . $field . ' as ' . $field; 7940 if ($GLOBALS['TCA'][$table]['ctrl']['versioningWS']) { 7941 foreach ($wsFields as $field) { 7942 $match = $matchStart . $field . $matchEnd; 7943 if (!preg_match($match, $selectPart)) { 7944 $selectPart .= ', ' . $table . '.' . $field . ' as ' . $field; 7961 public function checkPidArray($listArr) { 7963 if (is_array($listArr) && count($listArr)) { 7964 $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('uid', 'pages', 'uid IN (' . implode(',', $listArr) . ')' . $this->enableFields('pages') . ' AND doktype NOT IN (' . $this->checkPid_badDoktypeList . ')'); 7965 if ($error = $GLOBALS['TYPO3_DB']->sql_error()) { 7966 $GLOBALS['TT']->setTSlogMessage($error . ': ' . $GLOBALS['TYPO3_DB']->debug_lastBuiltQuery, 3); 7968 while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) { 7969 $outArr[] = $row['uid']; 7972 $GLOBALS['TYPO3_DB']->sql_free_result($res); 7986 public function checkPid($uid) { 7988 if (!isset($this->checkPid_cache[$uid])) { 7989 $count = $GLOBALS['TYPO3_DB']->exec_SELECTcountRows('uid', 'pages', 'uid=' . $uid . $this->enableFields('pages') . ' AND doktype NOT IN (' . $this->checkPid_badDoktypeList . ')'); 7990 $this->checkPid_cache[$uid] = (bool) $count; 7992 return $this->checkPid_cache[$uid]; 8006 public function getQueryMarkers($table, $conf) { 8007 // Parse markers and prepare their values 8008 $markerValues = array(); 8009 if (is_array($conf['markers.'])) { 8010 foreach ($conf['markers.'] as $dottedMarker => $dummy) { 8011 $marker = rtrim($dottedMarker, '.'); 8012 if ($dottedMarker == $marker . '.') { 8014 $tempValue = isset($conf['markers.'][$dottedMarker]) ? $this->stdWrap($conf['markers.'][$dottedMarker]['value'], $conf['markers.'][$dottedMarker]) : $conf['markers.'][$dottedMarker]['value']; 8015 // Quote/escape if needed 8016 if (is_numeric($tempValue)) { 8017 if ((int)$tempValue == $tempValue) { 8019 $markerValues[$marker] = (int)$tempValue; 8022 $markerValues[$marker] = floatval($tempValue); 8024 } elseif (is_null($tempValue)) { 8025 // It represents NULL 8026 $markerValues[$marker] = 'NULL'; 8027 } elseif ($conf['markers.'][$dottedMarker]['commaSeparatedList'] == 1) { 8028 // See if it is really a comma separated list of values 8029 $explodeValues = GeneralUtility::trimExplode(',', $tempValue); 8030 if (count($explodeValues) > 1) { 8031 // Handle each element of list separately 8032 $tempArray = array(); 8033 foreach ($explodeValues as $listValue) { 8034 if (is_numeric($listValue)) { 8035 if ((int)$listValue == $listValue) { 8036 $tempArray[] = (int)$listValue; 8038 $tempArray[] = floatval($listValue); 8041 // If quoted, remove quotes before 8043 if (preg_match('/^\'([^\']*)\'$/', $listValue, $matches)) { 8044 $listValue = $matches[1]; 8045 } elseif (preg_match('/^\\"([^\\
"]*)\\"$/
', $listValue, $matches)) { 8046 $listValue = $matches[1]; 8048 $tempArray[] = $GLOBALS['TYPO3_DB
']->fullQuoteStr($listValue, $table); 8051 $markerValues[$marker] = implode(',
', $tempArray); 8053 // Handle remaining values as string 8054 $markerValues[$marker] = $GLOBALS['TYPO3_DB
']->fullQuoteStr($tempValue, $table); 8057 // Handle remaining values as string 8058 $markerValues[$marker] = $GLOBALS['TYPO3_DB
']->fullQuoteStr($tempValue, $table); 8063 return $markerValues; 8066 /*********************************************** 8068 * Frontend editing functions 8070 ***********************************************/ 8083 public function editPanel($content, $conf, $currentRecord = '', $dataArr = array()) { 8084 if ($GLOBALS['TSFE
']->beUserLogin && $GLOBALS['BE_USER
']->frontendEdit instanceof \TYPO3\CMS\Core\FrontendEditing\FrontendEditingController) { 8085 if (!$currentRecord) { 8086 $currentRecord = $this->currentRecord; 8088 if (!count($dataArr)) { 8089 $dataArr = $this->data; 8091 // Delegate rendering of the edit panel to the frontend edit 8092 $content = $GLOBALS['BE_USER
']->frontendEdit->displayEditPanel($content, $conf, $currentRecord, $dataArr); 8110 public function editIcons($content, $params, array $conf = array(), $currentRecord = '', $dataArr = array(), $addUrlParamStr = '') { 8111 if ($GLOBALS['TSFE
']->beUserLogin && $GLOBALS['BE_USER
']->frontendEdit instanceof \TYPO3\CMS\Core\FrontendEditing\FrontendEditingController) { 8112 if (!$currentRecord) { 8113 $currentRecord = $this->currentRecord; 8115 if (!count($dataArr)) { 8116 $dataArr = $this->data; 8118 // Delegate rendering of the edit panel to frontend edit class. 8119 $content = $GLOBALS['BE_USER
']->frontendEdit->displayEditIcons($content, $params, $conf, $currentRecord, $dataArr, $addUrlParamStr); 8134 public function isDisabled($table, $row) { 8135 if ($GLOBALS['TCA
'][$table]['ctrl
']['enablecolumns
']['disabled
'] && $row[$GLOBALS['TCA
'][$table]['ctrl
']['enablecolumns
']['disabled
']] || $GLOBALS['TCA
'][$table]['ctrl
']['enablecolumns
']['fe_group
'] && $GLOBALS['TSFE
']->simUserGroup && $row[$GLOBALS['TCA
'][$table]['ctrl
']['enablecolumns
']['fe_group
']] == $GLOBALS['TSFE
']->simUserGroup || $GLOBALS['TCA
'][$table]['ctrl
']['enablecolumns
']['starttime
'] && $row[$GLOBALS['TCA
'][$table]['ctrl
']['enablecolumns
']['starttime
']] > $GLOBALS['EXEC_TIME
'] || $GLOBALS['TCA
'][$table]['ctrl
']['enablecolumns
']['endtime
'] && $row[$GLOBALS['TCA
'][$table]['ctrl
']['enablecolumns
']['endtime
']] && $row[$GLOBALS['TCA
'][$table]['ctrl
']['enablecolumns
']['endtime
']] < $GLOBALS['EXEC_TIME
']) { 8145 protected function getResourceFactory() { 8146 return \TYPO3\CMS\Core\Resource\ResourceFactory::getInstance(); 8156 protected function getEnvironmentVariable($key) { 8157 return GeneralUtility::getIndpEnv($key); stdWrap_char($content='', $conf=array())
rootLineValue($key, $field, $slideBack=0, $altRootLine='')
stdWrap_typolink($content='', $conf=array())
getTypoLink_URL($params, $urlParameters=array(), $target='')
getClosestMPvalueForPage($pageId, $raw=FALSE)
stdWrap_spaceAfter($content='', $conf=array())
static idnaEncode($value)
encaps_lineSplit($theValue, $conf)
stdWrap_offsetWrap($content='', $conf=array())
editIcons($content, $params, array $conf=array(), $currentRecord='', $dataArr=array(), $addUrlParamStr='')
stdWrap_debugData($content='', $conf=array())
stdWrap_preCObject($content='', $conf=array())
stdWrap_HTMLparser($content='', $conf=array())
stdWrap_space($content='', $conf=array())
stdWrap_stdWrapPostProcess($content='', $conf=array())
static implodeAttributes(array $arr, $xhtmlSafe=FALSE, $dontOmitBlankAttribs=FALSE)
getImageSourceCollection($layoutKey, $conf, $file)
static mergeRecursiveWithOverrule(array &$original, array $overrule, $addKeys=TRUE, $includeEmptyValues=TRUE, $enableUnsetFeature=TRUE)
stdWrap_textStyle($content='', $conf=array())
static uniqueList($in_list, $secondParameter=NULL)
stdWrap_lang($content='', $conf=array())
$TYPO3_CONF_VARS['SYS']['contentTable']
numberFormat($content, $conf)
getData($string, $fieldArray=NULL)
editPanel($content, $conf, $currentRecord='', $dataArr=array())
getBorderAttr($borderAttr)
stdWrap_prefixComment($content='', $conf=array())
static explodeUrl2Array($string, $multidim=FALSE)
getMailTo($mailAddress, $linktxt, $initP='?')
substituteMarkerArray($content, array $markContentArray, $wrap='', $uppercase=FALSE, $deleteUnused=FALSE)
getGlobal($keyString, $source=NULL)
FORM($conf, $formData='')
stdWrap_filelink($content='', $conf=array())
stdWrap_setContentToCurrent($content='', $conf=array())
stdWrap_strftime($content='', $conf=array())
mergeTSRef($confArr, $prop)
stdWrap_csConv($content='', $conf=array())
exec_getQuery($table, $conf)
$contentObjectClassMapping
static png_to_gif_by_imagemagick($theFile)
stdWrap_expandList($content='', $conf=array())
stdWrap_wrapAlign($content='', $conf=array())
stdWrap_TCAselectItem($content='', $conf=array())
stdWrap_removeBadHTML($content='', $conf=array())
removeBadHTML($text, $conf)
static isFirstPartOfStr($str, $partStr)
textStyle($theValue, $conf)
static validPathStr($theFile)
stdWrap_split($content='', $conf=array())
stdWrap_intval($content='', $conf=array())
static quoteJSvalue($value)
stdWrap_round($content='', $conf=array())
static intExplode($delimiter, $string, $removeEmptyValues=FALSE, $limit=0)
TCAlookup($inputValue, $conf)
addParams($content, $conf)
stdWrap_postUserFuncInt($content='', $conf=array())
stdWrap_htmlSpecialChars($content='', $conf=array())
static canBeInterpretedAsInteger($var)
stdWrap_data($content='', $conf=array())
stdWrap_keywords($content='', $conf=array())
mailto_makelinks($data, $conf)
stdWrap_stdWrapPreProcess($content='', $conf=array())
stdWrap_wrap3($content='', $conf=array())
static getUserObj($classRef, $checkPrefix='', $silent=FALSE)
stdWrap_addPageCacheTags($content='', $conf=array())
stdWrapValue($key, array $config, $defaultValue='')
http_makelinks($data, $conf)
getGetImgResourceHookObjects()
stdWrap_stdWrap($content='', $conf=array())
stdWrap_substring($content='', $conf=array())
stdWrap_ifEmpty($content='', $conf=array())
stdWrap_current($content='', $conf=array())
stdWrap_br($content='', $conf=array())
prefixComment($str, $conf, $content)
static hmac($input, $additionalSecret='')
getSlidePids($pidList, $pidConf)
calcIntExplode($delim, $string)
stdWrap_dataWrap($content='', $conf=array())
getAltParam($conf, $longDesc=TRUE)
substituteMarkerInObject(&$tree, array $markContentArray)
wrap($content, $wrap, $char='|')
stdWrap_if($content='', $conf=array())
stdWrap_preUserFunc($content='', $conf=array())
stdWrap_field($content='', $conf=array())
tableStyle($theValue, $conf)
stdWrap_case($content='', $conf=array())
static makeInstance($className)
stdWrap_trim($content='', $conf=array())
substring($content, $options)
replacementSingle($content, array $configuration)
stdWrap_append($content='', $conf=array())
stdWrap_stdWrapProcess($content='', $conf=array())
stdWrap_spaceBefore($content='', $conf=array())
stdWrap_postUserFunc($content='', $conf=array())
static trimExplode($delim, $string, $removeEmptyValues=FALSE, $limit=0)
stdWrap_age($content='', $conf=array())
locDataJU($jumpUrl, $conf)
static calculateWithParentheses($string)
FLUIDTEMPLATE(array $conf)
stdWrap_cObject($content='', $conf=array())
extLinkATagParams($URL, $TYPE)
stdWrap_listNum($content='', $conf=array())
stdWrap_crop($content='', $conf=array())
stdWrap_parseFunc($content='', $conf=array())
static callUserFunction($funcName, &$params, &$ref, $checkPrefix='', $errorMode=0)
stdWrap_fieldRequired($content='', $conf=array())
stdWrap_hash($content='', array $conf=array())
stdWrap_doubleBrTag($content='', $conf=array())
stdWrap_replacement($content='', $conf=array())
stdWrap_outerWrap($content='', $conf=array())
stdWrap_innerWrap2($content='', $conf=array())
currentPageUrl($urlParameters=array(), $id=0)
COBJ_ARRAY($conf, $ext='')
static unQuoteFilenames($parameters, $unQuote=FALSE)
stdWrap_ifNull($content='', $conf=array())
const OBJECTTYPE_USER_INT
static split_fileref($fileNameWithPath)
stdWrap_prioriCalc($content='', $conf=array())
getFieldDefaultValue($noValueInsert, $fieldName, $defaultVal)
round($content, array $conf=array())
static get_tag_attributes($tag)
stdWrap_prepend($content='', $conf=array())
imageLinkWrap($string, $imageFile, $conf)
stdWrap_addParams($content='', $conf=array())
stdWrap_wrap($content='', $conf=array())
noTrimWrap($content, $wrap, $char='|')
stdWrap($content='', $conf=array())
filelink($theValue, $conf)
stdWrap_date($content='', $conf=array())
stdWrap_ifBlank($content='', $conf=array())
substituteSubpartArray($content, array $subpartsContent)
substituteMarkerArrayCached($content, array $markContentArray=NULL, array $subpartContentArray=NULL, array $wrappedSubpartContentArray=NULL)
if($list_of_literals) if(!empty($literals)) if(!empty($literals)) $result
Analyse literals to prepend the N char to them if their contents aren't numeric.
HTMLparser_TSbridge($theValue, $conf)
getATagParams($conf, $addGlobal=1)
stdWrap_wrap2($content='', $conf=array())
stdWrap_strPad($content='', $conf=array())
forceAbsoluteUrl($url, array $configuration)
stdWrap_numberFormat($content='', $conf=array())
linkWrap($content, $wrap)
calcAge($seconds, $labels)
stdWrap_stdWrapOverride($content='', $conf=array())
stdWrap_bytes($content='', $conf=array())
_parseFunc($theValue, $conf)
static rawUrlEncodeFP($str)
static viewArray($array_in)
readFlexformIntoConf($flexData, &$conf, $recursive=FALSE)
stdWrap_editPanel($content='', $conf=array())
substituteMarker($content, $marker, $markContent)
static splitCalc($string, $operators)
stdWrap_postCObject($content='', $conf=array())
parseFunc($theValue, $conf, $ref='')
stdWrap_filelist($content='', $conf=array())
setParent($data, $currentRecord)
stdWrap_debugFunc($content='', $conf=array())
listNum($content, $listNum, $char)
stdWrap_debug($content='', $conf=array())
wrapSpace($content, $wrap, array $conf=NULL)
getUrlToCurrentLocation($addQueryString=TRUE)
callUserFunction($funcName, $conf, $content)
static implodeArrayForUrl($name, array $theArray, $str='', $skipBlank=FALSE, $rawurlencodeParamName=FALSE)
static formatSize($sizeInBytes, $labels='')
debug($variable='', $name=' *variable *', $line=' *line *', $file=' *file *', $recursiveDepth=3, $debugLevel=E_DEBUG)
stdWrap_required($content='', $conf=array())
stdWrap_innerWrap($content='', $conf=array())
substituteMarkerAndSubpartArrayRecursive($content, array $markersAndSubparts, $wrap='', $uppercase=FALSE, $deleteUnused=FALSE)
stdWrap_tableStyle($content='', $conf=array())
stdWrap_encapsLines($content='', $conf=array())
HTMLcaseshift($theValue, $case)
fileResource($fName, $addParams='alt="" title=""')
stdWrap_override($content='', $conf=array())
$doConvertToUserIntObject
stdWrap_editIcons($content='', $conf=array())
getImageTagTemplate($layoutKey, $conf)
fillInMarkerArray(array $markContentArray, array $row, $fieldList='', $nl2br=TRUE, $prefix='FIELD_', $HSC=FALSE)
if(isset($ajaxID)) if(in_array( $ajaxID, $noUserAjaxIDs))
Re-apply pairs of single-quotes to the text.
dataWrap($content, $wrap)
if(!defined('TYPO3_MODE')) $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_userauth.php']['logoff_pre_processing'][]
static isLastPartOfString($haystack, $needle)
static revExplode($delimiter, $string, $count=0)
setUserObjectType($userObjectType)
static inList($list, $item)
static xml2array($string, $NSprefix='', $reportDocTag=FALSE)
stdWrap_noTrimWrap($content='', $conf=array())
stdWrap_encodeForJavaScriptValue($content='', $conf=array())
LOAD_REGISTER($conf, $name)
stdWrap_orderedStdWrap($content='', $conf=array())
$getImgResourceHookObjects
stdWrap_cropHTML($content='', $conf=array())
getSubpart($content, $marker)
stdWrap_stripHtml($content='', $conf=array())
getTypoLink($label, $params, $urlParameters=array(), $target='')
cropHTML($content, $options)
setCurrentFile($fileObject)
stdWrap_preIfEmptyListNum($content='', $conf=array())
replacement($content, array $configuration)
stdWrap_setCurrent($content='', $conf=array())
stdWrap_numRows($content='', $conf=array())
stdWrap_rawUrlEncode($content='', $conf=array())
stdWrap_insertData($content='', $conf=array())
static resolveBackPath($pathStr)
stdWrap_brTag($content='', $conf=array())
cObjGet($setup, $addKey='')
stdWrap_fontTag($content='', $conf=array())
getEnvironmentVariable($key)
static sortedKeyList($setupArr, $acceptOnlyProperties=FALSE)
substituteSubpart($content, $marker, $subpartContent, $recursive=1)