TYPO3 CMS  TYPO3_6-2
TemplateContentObject.php
Go to the documentation of this file.
1 <?php
3 
23 
31  public function render($conf = array()) {
32  $subparts = array();
33  $marks = array();
34  $wraps = array();
35  $markerWrap = isset($conf['markerWrap.']) ? $this->cObj->stdWrap($conf['markerWrap'], $conf['markerWrap.']) : $conf['markerWrap'];
36  if (!$markerWrap) {
37  $markerWrap = '### | ###';
38  }
39  list($PRE, $POST) = explode('|', $markerWrap);
40  $POST = trim($POST);
41  $PRE = trim($PRE);
42  // Getting the content
43  $content = $this->cObj->cObjGetSingle($conf['template'], $conf['template.'], 'template');
44  $workOnSubpart = isset($conf['workOnSubpart.']) ? $this->cObj->stdWrap($conf['workOnSubpart'], $conf['workOnSubpart.']) : $conf['workOnSubpart'];
45  if ($workOnSubpart) {
46  $content = $this->cObj->getSubpart($content, $PRE . $workOnSubpart . $POST);
47  }
48  // Fixing all relative paths found:
49  if ($conf['relPathPrefix']) {
50  $htmlParser = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Html\\HtmlParser');
51  $content = $htmlParser->prefixResourcePath($conf['relPathPrefix'], $content, $conf['relPathPrefix.']);
52  }
53  if ($content) {
54  $nonCachedSubst = isset($conf['nonCachedSubst.']) ? $this->cObj->stdWrap($conf['nonCachedSubst'], $conf['nonCachedSubst.']) : $conf['nonCachedSubst'];
55  // NON-CACHED:
56  if ($nonCachedSubst) {
57  // Getting marks
58  if (is_array($conf['marks.'])) {
59  foreach ($conf['marks.'] as $theKey => $theValue) {
60  if (!strstr($theKey, '.')) {
61  $content = str_replace($PRE . $theKey . $POST, $this->cObj->cObjGetSingle($theValue, $conf['marks.'][$theKey . '.'], 'marks.' . $theKey), $content);
62  }
63  }
64  }
65  // Getting subparts.
66  if (is_array($conf['subparts.'])) {
67  foreach ($conf['subparts.'] as $theKey => $theValue) {
68  if (!strstr($theKey, '.')) {
69  $subpart = $this->cObj->getSubpart($content, $PRE . $theKey . $POST);
70  if ($subpart) {
71  $this->cObj->setCurrentVal($subpart);
72  $content = $this->cObj->substituteSubpart($content, $PRE . $theKey . $POST, $this->cObj->cObjGetSingle($theValue, $conf['subparts.'][$theKey . '.'], 'subparts.' . $theKey), TRUE);
73  }
74  }
75  }
76  }
77  // Getting subpart wraps
78  if (is_array($conf['wraps.'])) {
79  foreach ($conf['wraps.'] as $theKey => $theValue) {
80  if (!strstr($theKey, '.')) {
81  $subpart = $this->cObj->getSubpart($content, $PRE . $theKey . $POST);
82  if ($subpart) {
83  $this->cObj->setCurrentVal($subpart);
84  $content = $this->cObj->substituteSubpart($content, $PRE . $theKey . $POST, explode('|', $this->cObj->cObjGetSingle($theValue, $conf['wraps.'][$theKey . '.'], 'wraps.' . $theKey)), TRUE);
85  }
86  }
87  }
88  }
89  } else {
90  // CACHED
91  // Getting subparts.
92  if (is_array($conf['subparts.'])) {
93  foreach ($conf['subparts.'] as $theKey => $theValue) {
94  if (!strstr($theKey, '.')) {
95  $subpart = $this->cObj->getSubpart($content, $PRE . $theKey . $POST);
96  if ($subpart) {
97  $GLOBALS['TSFE']->register['SUBPART_' . $theKey] = $subpart;
98  $subparts[$theKey]['name'] = $theValue;
99  $subparts[$theKey]['conf'] = $conf['subparts.'][$theKey . '.'];
100  }
101  }
102  }
103  }
104  // Getting marks
105  if (is_array($conf['marks.'])) {
106  foreach ($conf['marks.'] as $theKey => $theValue) {
107  if (!strstr($theKey, '.')) {
108  $marks[$theKey]['name'] = $theValue;
109  $marks[$theKey]['conf'] = $conf['marks.'][$theKey . '.'];
110  }
111  }
112  }
113  // Getting subpart wraps
114  if (is_array($conf['wraps.'])) {
115  foreach ($conf['wraps.'] as $theKey => $theValue) {
116  if (!strstr($theKey, '.')) {
117  $wraps[$theKey]['name'] = $theValue;
118  $wraps[$theKey]['conf'] = $conf['wraps.'][$theKey . '.'];
119  }
120  }
121  }
122  // Getting subparts
123  $subpartArray = array();
124  foreach ($subparts as $theKey => $theValue) {
125  // Set current with the content of the subpart...
126  $this->cObj->data[$this->cObj->currentValKey] = $GLOBALS['TSFE']->register['SUBPART_' . $theKey];
127  // Get subpart cObject and substitute it!
128  $subpartArray[$PRE . $theKey . $POST] = $this->cObj->cObjGetSingle($theValue['name'], $theValue['conf'], 'subparts.' . $theKey);
129  }
130  // Reset current to empty
131  $this->cObj->data[$this->cObj->currentValKey] = '';
132  // Getting marks
133  $markerArray = array();
134  foreach ($marks as $theKey => $theValue) {
135  $markerArray[$PRE . $theKey . $POST] = $this->cObj->cObjGetSingle($theValue['name'], $theValue['conf'], 'marks.' . $theKey);
136  }
137  // Getting wraps
138  $subpartWraps = array();
139  foreach ($wraps as $theKey => $theValue) {
140  $subpartWraps[$PRE . $theKey . $POST] = explode('|', $this->cObj->cObjGetSingle($theValue['name'], $theValue['conf'], 'wraps.' . $theKey));
141  }
142  // Substitution
143  $substMarksSeparately = isset($conf['substMarksSeparately.']) ? $this->cObj->stdWrap($conf['substMarksSeparately'], $conf['substMarksSeparately.']) : $conf['substMarksSeparately'];
144  if ($substMarksSeparately) {
145  $content = $this->cObj->substituteMarkerArrayCached($content, array(), $subpartArray, $subpartWraps);
146  $content = $this->cObj->substituteMarkerArray($content, $markerArray);
147  } else {
148  $content = $this->cObj->substituteMarkerArrayCached($content, $markerArray, $subpartArray, $subpartWraps);
149  }
150  }
151  }
152  if (isset($conf['stdWrap.'])) {
153  $content = $this->cObj->stdWrap($content, $conf['stdWrap.']);
154  }
155  return $content;
156  }
157 
158 }
if(!defined('TYPO3_MODE')) $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_userauth.php']['logoff_pre_processing'][]