public function renderEach(tx_rnbase_util_IListProvider $provider, $viewData, $template, $markerClassname, $confId, $marker, $formatter, $markerParams = null)
 {
     $viewData = is_object($viewData) ? $viewData : new ArrayObject();
     $outerMarker = $this->getOuterMarker($marker, $template);
     // wir teilen das Template, da der erste teil direkt ausgegeben werden muss!
     list($header, $footer) = $this->getWrapForSubpart($template, $outerMarker . 'S');
     tx_mklib_mod1_export_Util::doOutPut($header);
     /* @var $listMarker tx_mklib_mod1_export_ListMarker */
     $listMarker = tx_rnbase::makeInstance('tx_mklib_mod1_export_ListMarker', $this->info->getListMarkerInfo());
     $templateList = t3lib_parsehtml::getSubpart($template, '###' . $outerMarker . 'S###');
     list($listHeader, $listFooter) = $this->getWrapForSubpart($templateList, $marker);
     $templateEntry = t3lib_parsehtml::getSubpart($templateList, '###' . $marker . '###');
     tx_mklib_mod1_export_Util::doOutPut($listHeader);
     $listMarker->addVisitors($this->callbacks);
     $ret = $listMarker->renderEach($provider, $templateEntry, $markerClassname, $confId, $marker, $formatter, $markerParams, $offset);
     tx_mklib_mod1_export_Util::doOutPut($listFooter);
     tx_mklib_mod1_export_Util::doOutPut($footer);
     return '';
 }
예제 #2
0
 function getTemplateHtml()
 {
     if ($this->sTemplateHtml === FALSE) {
         $mHtml = "";
         $sPath = $this->getTemplatePath();
         if (!empty($sPath)) {
             if (!file_exists($sPath)) {
                 $this->oForm->mayday("RENDERER TEMPLATE - Template file does not exist <b>" . $sPath . "</b>");
             }
             if (($sSubpart = $this->getTemplateSubpart()) !== FALSE) {
                 $mHtml = t3lib_parsehtml::getSubpart(t3lib_div::getUrl($sPath), $sSubpart);
                 if (trim($mHtml) == "") {
                     $this->oForm->mayday("RENDERER TEMPLATE - The given template <b>'" . $sPath . "'</b> with subpart marker " . $sSubpart . " <b>returned an empty string</b> - Check your template");
                 }
             } else {
                 $mHtml = t3lib_div::getUrl($sPath);
                 if (trim($mHtml) == "") {
                     $this->oForm->mayday("RENDERER TEMPLATE - The given template <b>'" . $sPath . "'</b> with no subpart marker <b>returned an empty string</b> - Check your template");
                 }
             }
         } elseif (($mHtml = $this->_navConf("/html")) !== FALSE) {
             if (is_array($mHtml)) {
                 if (tx_ameosformidable::isRunneable($mHtml)) {
                     $mHtml = $this->callRunneable($mHtml);
                 } else {
                     $mHtml = $mHtml["__value"];
                 }
             }
             if (trim($mHtml) == "") {
                 $this->oForm->mayday("RENDERER TEMPLATE - The given <b>/html</b> provides an empty string</b> - Check your template");
             }
         } else {
             $this->oForm->mayday("RENDERER TEMPLATE - You have to provide either <b>/template/path</b> or <b>/html</b>");
         }
         $this->sTemplateHtml = $mHtml;
     }
     return $this->sTemplateHtml;
 }
예제 #3
0
 /**
  * Compiles the extra form headers if the tceforms
  *
  * @return	string		the HTML
  */
 function extraFormHeaders()
 {
     $extraTemplate = '';
     if (is_array($this->tceforms->extraFormHeaders)) {
         $extraTemplate = t3lib_parsehtml::getSubpart($this->doc->moduleTemplate, '###DOCHEADER_EXTRAHEADER###');
         $extraTemplate = t3lib_parsehtml::substituteMarker($extraTemplate, '###EXTRAHEADER###', implode(LF, $this->tceforms->extraFormHeaders));
     }
     return $extraTemplate;
 }
 /**
  * OVERWRITE:
  * Appends the search word number as a suffix to the CSS span class.
  * 
  * Marks up the search words from $this->sWarr in the $str with a color.
  *
  * @param	string		Text in which to find and mark up search words. This text is assumed to be UTF-8 like the search words internally is.
  * @return	string		Processed content.
  */
 function markupSWpartsOfString($str)
 {
     // Init:
     $str = str_replace('&nbsp;', ' ', t3lib_parsehtml::bidir_htmlspecialchars($str, -1));
     $str = preg_replace('/\\s\\s+/', ' ', $str);
     $swForReg = array();
     // Prepare search words for regex:
     foreach ($this->sWArr as $d) {
         $swForReg[] = preg_quote($d['sword'], '/');
     }
     $regExString = '(' . implode('|', $swForReg) . ')';
     // Split and combine:
     $parts = preg_split('/' . $regExString . '/i', ' ' . $str . ' ', 20000, PREG_SPLIT_DELIM_CAPTURE);
     // debug($parts,$regExString);
     // Constants:
     $summaryMax = 300;
     $postPreLgd = 60;
     $postPreLgd_offset = 5;
     $divider = ' ... ';
     $occurencies = (count($parts) - 1) / 2;
     if ($occurencies) {
         $postPreLgd = t3lib_div::intInRange($summaryMax / $occurencies, $postPreLgd, $summaryMax / 2);
     }
     // Variable:
     $summaryLgd = 0;
     $output = array();
     // Shorten in-between strings:
     //reset
     $this->sword_number = 1;
     foreach ($parts as $k => $strP) {
         if ($k % 2 == 0) {
             // Find length of the summary part:
             $strLen = $GLOBALS['TSFE']->csConvObj->strlen('utf-8', $parts[$k]);
             $output[$k] = $parts[$k];
             // Possibly shorten string:
             if (!$k) {
                 // First entry at all (only cropped on the frontside)
                 if ($strLen > $postPreLgd) {
                     $output[$k] = $divider . ereg_replace('^[^[:space:]]+[[:space:]]', '', $GLOBALS['TSFE']->csConvObj->crop('utf-8', $parts[$k], -($postPreLgd - $postPreLgd_offset)));
                 }
             } elseif ($summaryLgd > $summaryMax || !isset($parts[$k + 1])) {
                 // In case summary length is exceed OR if there are no more entries at all:
                 if ($strLen > $postPreLgd) {
                     $output[$k] = ereg_replace('[[:space:]][^[:space:]]+$', '', $GLOBALS['TSFE']->csConvObj->crop('utf-8', $parts[$k], $postPreLgd - $postPreLgd_offset)) . $divider;
                 }
             } else {
                 // In-between search words:
                 if ($strLen > $postPreLgd * 2) {
                     $output[$k] = ereg_replace('[[:space:]][^[:space:]]+$', '', $GLOBALS['TSFE']->csConvObj->crop('utf-8', $parts[$k], $postPreLgd - $postPreLgd_offset)) . $divider . ereg_replace('^[^[:space:]]+[[:space:]]', '', $GLOBALS['TSFE']->csConvObj->crop('utf-8', $parts[$k], -($postPreLgd - $postPreLgd_offset)));
                 }
             }
             $summaryLgd += $GLOBALS['TSFE']->csConvObj->strlen('utf-8', $output[$k]);
             // Protect output:
             $output[$k] = htmlspecialchars($output[$k]);
             // If summary lgd is exceed, break the process:
             if ($summaryLgd > $summaryMax) {
                 break;
             }
         } else {
             $summaryLgd += $GLOBALS['TSFE']->csConvObj->strlen('utf-8', $strP);
             //start OVERWRITE
             $output[$k] = '<strong class="tx-psmhighlight-sword-' . $this->swords[$GLOBALS['TSFE']->csConvObj->conv_case('utf-8', $parts[$k], 'toLower')] . '">' . htmlspecialchars($parts[$k]) . '</strong>';
             //end OVERWRITE
         }
     }
     // Return result:
     return implode('', $output);
 }
 /**
  * Builds the checkboxes out of the hooks array.
  *
  * @param array $brokenLinkOverView array of broken links information
  * @return string code content
  */
 protected function getCheckOptions(array $brokenLinkOverView, $prefix = '')
 {
     $markerArray = array();
     $additionalAttr = '';
     if (!empty($prefix)) {
         $additionalAttr = ' onclick="toggleActionButton(\'' . $prefix . '\');" class="' . $prefix . '" ';
     } else {
         $additionalAttr = ' onclick="toggleActionButton(\'refresh\');" class="refresh" ';
     }
     $checkOptionsTemplate = t3lib_parsehtml::getSubpart($this->doc->moduleTemplate, '###CHECKOPTIONS_SECTION###');
     $hookSectionContent = '';
     $hookSectionTemplate = t3lib_parsehtml::getSubpart($checkOptionsTemplate, '###HOOK_SECTION###');
     $markerArray['statistics_header'] = $this->doc->sectionHeader($GLOBALS['LANG']->getLL('report.statistics.header'));
     $totalCountLabel = $GLOBALS['LANG']->getLL('overviews.nbtotal');
     $totalCountLabel = t3lib_BEfunc::wrapInHelp('linkvalidator', 'checkboxes', $totalCountLabel);
     $markerArray['total_count_label'] = $totalCountLabel;
     if (empty($brokenLinkOverView['brokenlinkCount'])) {
         $markerArray['total_count'] = '0';
     } else {
         $markerArray['total_count'] = $brokenLinkOverView['brokenlinkCount'];
     }
     $linktypes = t3lib_div::trimExplode(',', $this->modTS['linktypes'], 1);
     $hookSectionContent = '';
     if (is_array($linktypes)) {
         if (!empty($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['linkvalidator']['checkLinks']) && is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['linkvalidator']['checkLinks'])) {
             foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['linkvalidator']['checkLinks'] as $type => $value) {
                 if (in_array($type, $linktypes)) {
                     $hookSectionMarker = array();
                     if (empty($brokenLinkOverView[$type])) {
                         $hookSectionMarker['count'] = '0';
                     } else {
                         $hookSectionMarker['count'] = $brokenLinkOverView[$type];
                     }
                     $translation = $GLOBALS['LANG']->getLL('hooks.' . $type);
                     $translation = $translation ? $translation : $type;
                     $option = '<input type="checkbox" ' . $additionalAttr . '  id="' . $prefix . 'SET_' . $type . '" name="' . $prefix . 'SET[' . $type . ']" value="1"' . ($this->pObj->MOD_SETTINGS[$type] ? ' checked="checked"' : '') . '/>' . '<label for="' . $prefix . 'SET[' . $type . ']">' . htmlspecialchars($translation) . '</label>';
                     $hookSectionMarker['option'] = $option;
                     $hookSectionContent .= t3lib_parsehtml::substituteMarkerArray($hookSectionTemplate, $hookSectionMarker, '###|###', TRUE, TRUE);
                 }
             }
         }
     }
     $checkOptionsTemplate = t3lib_parsehtml::substituteSubpart($checkOptionsTemplate, '###HOOK_SECTION###', $hookSectionContent);
     return t3lib_parsehtml::substituteMarkerArray($checkOptionsTemplate, $markerArray, '###|###', TRUE, TRUE);
 }
 /**
  * Traverses the input $markContentArray array and for each key the marker
  * by the same name (possibly wrapped and in upper case) will be
  * substituted with the keys value in the array.
  *
  * This is very useful if you have a data-record to substitute in some
  * content. In particular when you use the $wrap and $uppercase values to
  * pre-process the markers. Eg. a key name like "myfield" could effectively
  * be represented by the marker "###MYFIELD###" if the wrap value
  * was "###|###" and the $uppercase boolean TRUE.
  *
  * @param	string		The content stream, typically HTML template content.
  * @param	array		The array of key/value pairs being marker/content values used in the substitution. For each element in this array the function will substitute a marker in the content stream with the content.
  * @param	string		A wrap value - [part 1] | [part 2] - for the markers before substitution
  * @param	boolean		If set, all marker string substitution is done with upper-case markers.
  * @param	boolean		If set, all unused marker are deleted.
  * @return	string		The processed output stream
  * @see substituteMarker(), substituteMarkerInObject(), TEMPLATE()
  */
 public function substituteMarkerArray($content, array $markContentArray, $wrap = '', $uppercase = FALSE, $deleteUnused = FALSE)
 {
     return t3lib_parsehtml::substituteMarkerArray($content, $markContentArray, $wrap, $uppercase, $deleteUnused);
 }
    /**
     * List media types, along with options to edit & delete
     *
     * @return	string		HTML table of all the mimetypes
     */
    function listMimeTypes()
    {
        global $LANG, $BACK_PATH, $BE_USER;
        // Load template
        $content = t3lib_parsehtml::getSubpart(t3lib_div::getURL($BACK_PATH . t3lib_extMgm::extRelPath('dam') . 'modfunc_tools_mimetypes/template.html'), '###MOD_TEMPLATE###');
        $rowTemplate[1] = t3lib_parsehtml::getSubpart($content, '###ROW_1###');
        $rowTemplate[2] = t3lib_parsehtml::getSubpart($content, '###ROW_2###');
        // Add some JS
        $this->pObj->doc->JScode .= $this->pObj->doc->wrapScriptTags('
				function deleteRecord(id)	{	//
					if (confirm(' . $LANG->JScharCode($LANG->getLL('deleteWarning')) . '))	{
						window.location.href = "' . $BACK_PATH . 'tce_db.php?cmd[tx_dam_media_types]["+id+"][delete]=1&redirect=' . rawurlencode(t3lib_div::getIndpEnv('TYPO3_REQUEST_URL')) . '&id=' . tx_dam_db::getPid() . '&vC=' . $BE_USER->veriCode() . '&prErr=1&uPT=1";
					}
					return false;
				}
		');
        // Get content
        $alternate = 1;
        $rows = '';
        $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', 'tx_dam_media_types', '', '', 'ext ASC');
        while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
            $editURL = $BACK_PATH . 'alt_doc.php?returnUrl=' . rawurlencode(t3lib_div::getIndpEnv('TYPO3_REQUEST_URL')) . '&id=' . tx_dam_db::getPid() . '&edit[tx_dam_media_types][' . $row['uid'] . ']=edit';
            //$deleteURL = $BACK_PATH . 'alt_doc.php?returnUrl=' . rawurlencode( t3lib_div::getIndpEnv('TYPO3_REQUEST_URL') ) . '&id=' . tx_dam_db::getPid() . '&edit[tx_dam_media_types][' . $row['uid'] . '][delete]=1';
            $rowMarkers['EDIT'] = '<a href="#" onclick="window.location.href=\'' . $editURL . '\'; return false;"><img' . t3lib_iconWorks::skinImg($this->pObj->doc->backPath, 'gfx/edit2.gif', 'width="11" height="12"') . ' title="Edit this type" alt="" height="16" width="16"></a>';
            $rowMarkers['DELETE'] = '<a href="#" onclick="deleteRecord(' . $row['uid'] . ')"><img' . t3lib_iconWorks::skinImg($this->pObj->doc->backPath, 'gfx/deletedok.gif', 'width="11" height="12"') . ' title="Delete this type" alt="" height="16" width="16"></a>';
            $rowMarkers['EXTENSION'] = $row['ext'];
            $rowMarkers['MIME'] = $row['mime'];
            $rowMarkers['ICON'] = '<img src="' . $BACK_PATH . tx_dam::icon_getFileType(array('file_type' => $row['ext'], 'media_type' => $row['type'])) . '" />';
            $rows .= t3lib_parsehtml::substituteMarkerArray($rowTemplate[$alternate], $rowMarkers, '###|###');
            // Cycle the alternating rows
            if ($alternate == 2) {
                $alternate = 1;
            } else {
                $alternate = 2;
            }
        }
        $content = t3lib_parsehtml::substituteSubpart($content, '###ROWS###', $rows);
        $GLOBALS['TYPO3_DB']->sql_free_result($res);
        return $content;
    }
예제 #8
0
 function renderChildsCompiled($aChildsBag)
 {
     if ($this->_navConf("/childs/template/path") !== FALSE) {
         // templating childs
         // mechanism:
         // childs can be templated if name of parent renderlet is present in template as a subpart marker
         // like for instance with renderlet:BOX name="mybox", subpart will be <!-- ###mybox### begin--> My childs here <!-- ###mybox### end-->
         $aTemplate = $this->_navConf("/childs/template");
         $sPath = $this->oForm->toServerPath($this->oForm->_navConf("/path", $aTemplate));
         if (!file_exists($sPath)) {
             $this->oForm->mayday("renderlet:" . $this->_getType() . "[name=" . $this->getName() . "] - The given template file path (<b>'" . $sPath . "'</b>) doesn't exists.");
         } elseif (is_dir($sPath)) {
             $this->oForm->mayday("renderlet:" . $this->_getType() . "[name=" . $this->getName() . "] - The given template file path (<b>'" . $sPath . "'</b>) is a directory, and should be a file.");
         } elseif (!is_readable($sPath)) {
             $this->oForm->mayday("renderlet:" . $this->_getType() . "[name=" . $this->getName() . "] - The given template file path exists but is not readable.");
         }
         if (($sSubpart = $this->oForm->_navConf("/subpart", $aTemplate)) === FALSE) {
             $sSubpart = $this->getName();
         }
         $mHtml = t3lib_parsehtml::getSubpart(t3lib_div::getUrl($sPath), $sSubpart);
         if (trim($mHtml) == "") {
             $this->oForm->mayday("renderlet:" . $this->_getType() . "[name=" . $this->getName() . "] - The given template (<b>'" . $sPath . "'</b> with subpart marquer <b>'" . $sSubpart . "'</b>) <b>returned an empty string</b> - Check your template");
         }
         return $this->oForm->_parseTemplateCode($mHtml, $aChildsBag, array(), FALSE);
     } else {
         if ($this->oForm->oRenderer->_getType() === "TEMPLATE") {
             // child-template is not defined, but maybe is it implicitely the same as current template renderer ?
             if (($sSubpartName = $this->_navConf("/childs/template/subpart")) === FALSE) {
                 $sSubpartName = $this->getName();
             }
             $sSubpartName = str_replace("#", "", $sSubpartName);
             if (($sHtml = $this->getCustomRootHtml()) === FALSE) {
                 $sHtml = $this->oForm->oRenderer->getTemplateHtml();
             }
             $sSubpart = $this->oForm->oHtml->getSubpart($sHtml, "###" . $sSubpartName . "###");
             $aTemplateErrors = array();
             $aCompiledErrors = array();
             $aDeepErrors = $this->getDeepErrorRelative();
             reset($aDeepErrors);
             while (list($sKey, ) = each($aDeepErrors)) {
                 $sTag = $this->oForm->oRenderer->wrapErrorMessage($aDeepErrors[$sKey]["message"]);
                 $aCompiledErrors[] = $sTag;
                 $aTemplateErrors[$sKey] = $aDeepErrors[$sKey]["message"];
                 $aTemplateErrors[$sKey . "."] = array("tag" => $sTag, "info" => $aDeepErrors[$sKey]["info"]);
             }
             $aChildsBag["errors"] = $aTemplateErrors;
             $aChildsBag["errors"]["__compiled"] = $this->oForm->oRenderer->compileErrorMessages($aCompiledErrors);
             if (!empty($sSubpart)) {
                 $sRes = $this->oForm->_parseTemplateCode($sSubpart, $aChildsBag, array(), FALSE);
                 return $sRes;
             }
         }
         $sCompiled = "";
         reset($aChildsBag);
         while (list($sName, $aBag) = each($aChildsBag)) {
             if ($this->shouldAutowrap()) {
                 $sCompiled .= "\n<div class='formidable-rdrstd-rdtwrap'>" . $aBag["__compiled"] . "</div>";
             } else {
                 $sCompiled .= "\n" . $aBag["__compiled"];
             }
         }
         return $sCompiled;
     }
 }
예제 #9
0
파일: index.php 프로젝트: rod86/t3sandbox
 /**
  * Gets the filled markers that are used in the HTML template.
  *
  * @return	array		The filled marker array
  */
 protected function getBodyMarkers()
 {
     $bodyMarkers = array('TITLE' => $GLOBALS['LANG']->getLL('title'));
     if ($this->modTSconfig['properties']['sideBarEnable'] && $this->sideBarObj->position == 'left') {
         $sidebarMode = 'SIDEBAR_LEFT';
     } elseif ($this->modTSconfig['properties']['sideBarEnable']) {
         $sidebarMode = 'SIDEBAR_TOP';
     } else {
         $sidebarMode = 'SIDEBAR_DISABLED';
     }
     $editareaTpl = t3lib_parsehtml::getSubpart($this->doc->moduleTemplate, $sidebarMode);
     if ($editareaTpl) {
         $editareaMarkers = array('TABROW' => $this->render_sidebar(), 'CONTENT' => $this->content);
         $editareaMarkers['FLASHMESSAGES'] = t3lib_FlashMessageQueue::renderFlashMessages();
         $editareaContent = t3lib_parsehtml::substituteMarkerArray($editareaTpl, $editareaMarkers, '###|###', true);
         $bodyMarkers['EDITAREA'] = $editareaContent;
     } else {
         $bodyMarkers['CONTENT'] = $this->content;
     }
     return $bodyMarkers;
 }
 function getTemplate($aRes, $aTemplate, $sPath)
 {
     if (is_array($aTemplate) && array_key_exists("path", $aTemplate)) {
         if ($this->oForm->isRunneable($aTemplate["path"])) {
             $aTemplate["path"] = $this->callRunneable($aTemplate["path"]);
         }
     } else {
         $this->oForm->mayday("RENDERLET ADVSEARCHFORM <b>" . $this->_getName() . "</b> - \n\t\t\t\tTemplate defined, but <b>" . $sPath . "</b> is missing. Please check your XML configuration");
     }
     if ($aTemplate["path"][0] === 'T' && substr($aTemplate["path"], 0, 3) === 'TS:') {
         if (($aTemplate["path"] = $this->oForm->getTS($aTemplate["path"], TRUE)) === AMEOSFORMIDABLE_TS_FAILED) {
             $this->oForm->mayday("The typoscript pointer <b>" . $aTemplate["path"] . "</b>\n\t\t\t\t\tevaluation has failed, as the pointed property does not exists within the current Typoscript template");
         }
     }
     if (is_array($aTemplate) && array_key_exists("subpart", $aTemplate)) {
         if ($this->oForm->isRunneable($aTemplate["subpart"])) {
             $aTemplate["subpart"] = $this->callRunneable($aTemplate["subpart"]);
         }
     } else {
         $this->oForm->mayday("RENDERLET ADVSEARCHFORM <b>" . $this->_getName() . "</b> - \n\t\t\t\tTemplate defined, but <b>" . $sPath . "</b> is missing. Please check your XML configuration");
     }
     $aTemplate["path"] = $this->oForm->toServerPath($aTemplate["path"]);
     if (file_exists($aTemplate["path"])) {
         if (is_readable($aTemplate["path"])) {
             $aRes["html"] = t3lib_parsehtml::getSubpart(t3lib_div::getUrl($aTemplate["path"]), $aTemplate["subpart"]);
             if (trim($aRes["html"]) === "") {
                 $this->oForm->mayday("RENDERLET ADVSEARCHFORM <b>" . $this->_getName() . "</b> - \n\t\t\t\t\t\tthe given SUBPART '<b>" . $aTemplate["subpart"] . "</b>' doesn't exists");
             }
         } else {
             $this->oForm->mayday("RENDERLET ADVSEARCHFORM <b>" . $this->_getName() . "</b> - \n\t\t\t\t\tthe given template file '<b>" . $aTemplate["path"] . "</b>' isn't readable. Please check permissions for this file.");
         }
     } else {
         $this->oForm->mayday("RENDERLET ADVSEARCHFORM <b>" . $this->_getName() . "</b> - \n\t\t\t\tthe given TEMPLATE FILE '<b>" . $aTemplate["path"] . "</b>' doesn't exists.");
     }
     return $aRes;
 }
예제 #11
0
 /**
  * Make login news - renders the HTML content for a list of news shown under
  * the login form. News data is added through $TYPO3_CONF_VARS
  *
  * @return	string		HTML content
  * @credits			Idea by Jan-Hendrik Heuing
  * @deprecated $GLOBALS['TYPO3_CONF_VARS']['BE']['loginNews'] is deprecated since 4.5. Use system news records instead.
  */
 function makeLoginNews()
 {
     $newsContent = '';
     $systemNews = $this->getSystemNews();
     if (count($GLOBALS['TYPO3_CONF_VARS']['BE']['loginNews'])) {
         t3lib_div::logDeprecatedFunction();
         $GLOBALS['TYPO3_CONF_VARS']['BE']['loginNews'] = array_merge($systemNews, $GLOBALS['TYPO3_CONF_VARS']['BE']['loginNews']);
     } else {
         $GLOBALS['TYPO3_CONF_VARS']['BE']['loginNews'] = $systemNews;
     }
     // Traverse news array IF there are records in it:
     if (is_array($GLOBALS['TYPO3_CONF_VARS']['BE']['loginNews']) && count($GLOBALS['TYPO3_CONF_VARS']['BE']['loginNews']) && !t3lib_div::_GP('loginRefresh')) {
         $htmlParser = t3lib_div::makeInstance('t3lib_parsehtml_proc');
         // get the main news template, and replace the subpart after looped through
         $newsContent = t3lib_parsehtml::getSubpart($GLOBALS['TBE_TEMPLATE']->moduleTemplate, '###LOGIN_NEWS###');
         $newsItemTemplate = t3lib_parsehtml::getSubpart($newsContent, '###NEWS_ITEM###');
         $newsItem = '';
         $count = 1;
         foreach ($GLOBALS['TYPO3_CONF_VARS']['BE']['loginNews'] as $newsItemData) {
             $additionalClass = '';
             if ($count == 1) {
                 $additionalClass = ' first-item';
             } elseif ($count == count($GLOBALS['TYPO3_CONF_VARS']['BE']['loginNews'])) {
                 $additionalClass = ' last-item';
             }
             $newsItemContent = $htmlParser->TS_transform_rte($htmlParser->TS_links_rte($newsItemData['content']));
             $newsItemMarker = array('###HEADER###' => htmlspecialchars($newsItemData['header']), '###DATE###' => htmlspecialchars($newsItemData['date']), '###CONTENT###' => $newsItemContent, '###CLASS###' => $additionalClass);
             $count++;
             $newsItem .= t3lib_parsehtml::substituteMarkerArray($newsItemTemplate, $newsItemMarker);
         }
         $title = $GLOBALS['TYPO3_CONF_VARS']['BE']['loginNewsTitle'] ? $GLOBALS['TYPO3_CONF_VARS']['BE']['loginNewsTitle'] : $GLOBALS['LANG']->getLL('newsheadline');
         $newsContent = t3lib_parsehtml::substituteMarker($newsContent, '###NEWS_HEADLINE###', htmlspecialchars($title));
         $newsContent = t3lib_parsehtml::substituteSubpart($newsContent, '###NEWS_ITEM###', $newsItem);
     }
     return $newsContent;
 }
 /**
  * Generates the css files
  *
  * @return void
  */
 protected function generateCSS()
 {
     $cssData = '';
     $cssIe6 = '';
     if ($this->includeTimestampInCSS) {
         $timestamp = '?' . time();
     } else {
         $timestamp = '';
     }
     $spritePathForCSS = $this->resolveSpritePath();
     $markerArray = array('###NAMESPACE###' => $this->nameSpace, '###DEFAULTWIDTH###' => $this->defaultWidth, '###DEFAULTHEIGHT###' => $this->defaultHeight, '###SPRITENAME###' => '', '###SPRITEURL###' => $spritePathForCSS ? $spritePathForCSS . '/' : '');
     $markerArray['###SPRITEURL###'] .= $this->spriteName . '.png' . $timestamp;
     foreach ($this->spriteBases as $base) {
         $markerArray['###SPRITENAME###'] = $base;
         $cssData .= t3lib_parsehtml::substituteMarkerArray($this->templateSprite, $markerArray);
     }
     if ($this->generateGIFCopy) {
         $markerArray['###SPRITEURL###'] = str_replace('.png', '.gif', $markerArray['###SPRITEURL###']);
         foreach ($this->spriteBases as $base) {
             $cssIe6 .= t3lib_parsehtml::substituteMarkerArray($this->templateSprite, $markerArray);
         }
     }
     foreach ($this->iconsData as $key => $data) {
         $temp = $data['iconNameParts'];
         array_shift($temp);
         $cssName = implode('-', $temp);
         $markerArrayIcons = array('###NAMESPACE###' => $this->nameSpace, '###ICONNAME###' => $cssName, '###LEFT###' => $data['left'], '###TOP###' => $data['top'], '###SIZE_INFO###' => '');
         if ($data['height'] != $this->defaultHeight) {
             $markerArrayIcons['###SIZE_INFO###'] .= TAB . 'height: ' . $data['height'] . 'px;' . LF;
         }
         if ($data['width'] != $this->defaultWidth) {
             $markerArrayIcons['###SIZE_INFO###'] .= TAB . 'width: ' . $data['width'] . 'px;' . LF;
         }
         $cssData .= t3lib_parsehtml::substituteMarkerArray($this->templateIcon, $markerArrayIcons);
     }
     t3lib_div::writeFile(PATH_site . $this->cssFolder . $this->spriteName . '.css', $cssData);
     if ($this->generateGIFCopy) {
         t3lib_div::writeFile(PATH_site . $this->cssFolder . $this->spriteName . '-ie6.css', $cssIe6);
     }
 }
 /**
  * [Describe function...]
  *
  * @param	[type]		$$sHtml: ...
  * @param	[type]		$aTags: ...
  * @param	[type]		$aExclude: ...
  * @param	[type]		$bClearNotUsed: ...
  * @param	[type]		$aLabels: ...
  * @return	[type]		...
  */
 function _parseTemplateCode($sHtml, $aTags, $aExclude = array(), $bClearNotUsed = TRUE, $aLabels = array(), $bThrusted = FALSE)
 {
     if (!isset($this->sPfxBegin)) {
         $this->sPfxBegin = MD5(rand());
         $this->sPfxEnd = MD5(rand());
     }
     if (!is_array($aTags)) {
         $aTags = array();
     }
     if (is_object($this)) {
         $this->pushTemplateMarkers($aTags);
     }
     if (is_object($this->_oParent) && !empty($this->_oParent->extKey)) {
         $aTags["PARENTPATH"] = $this->_getParentExtSitePath();
     }
     if (count($aExclude) > 0) {
         $sExcludePfx = md5(microtime(TRUE));
         $sExcludePfx2 = md5(microtime(TRUE) + 1);
         reset($aExclude);
         while (list(, $tag) = each($aExclude)) {
             $sHtml = str_replace("{" . $tag . "}", $sExcludePfx . $tag . $sExcludePfx, $sHtml);
             $sHtml = str_replace("{" . $tag . ".label}", $sExcludePfx2 . $tag . $sExcludePfx2, $sHtml);
         }
     }
     reset($aTags);
     while (list($sName, $mVal) = each($aTags)) {
         #debug($sName, "on remplace les subparts");
         if (($sRdtSubPart = t3lib_parsehtml::getSubpart($sHtml, "###" . $sName . "###")) !== "") {
             $sHtml = t3lib_parsehtml::substituteSubpart($sHtml, "###" . $sName . "###", $mVal["__compiled"], FALSE, FALSE);
         }
     }
     $sHtml = $this->processForEaches($sHtml);
     $sHtml = $this->processWithAs($sHtml);
     $sHtml = $this->processPerimeters($sHtml, $bClearNotUsed);
     $sHtml = $this->processMarkers($sHtml, $bClearNotUsed, $bThrusted);
     if (count($aExclude) > 0) {
         reset($aExclude);
         while (list(, $tag) = each($aExclude)) {
             $sHtml = str_replace($sExcludePfx . $tag . $sExcludePfx, "{" . $tag . "}", $sHtml);
             $sHtml = str_replace($sExcludePfx2 . $tag . $sExcludePfx2, "{" . $tag . ".label}", $sHtml);
         }
     }
     if (is_object($this)) {
         $this->pullTemplateMarkers();
     }
     if ($bClearNotUsed) {
         $sHtml = str_replace(array($this->sPfxBegin, $this->sPfxEnd), array("{", "}"), $sHtml);
         $sHtml = preg_replace("|{[^\\{\\}\n]*}|", "", $sHtml);
     }
     return $sHtml;
 }
예제 #14
0
 function _initActionsListbox()
 {
     if (($aActions = $this->_navConf("/actions")) !== FALSE && is_array($aActions)) {
         $aItems = $this->getActionsItems();
         if (!empty($aItems)) {
             $this->initActions();
             if (($sLabel = $this->_navConf("/actions/label")) === FALSE) {
                 $sLabel = '';
             }
             if (($sBlank = $this->_navConf("/actions/blank")) === FALSE) {
                 $sBlank = '';
             }
             if (($sClass = $this->_navConf("/actions/class")) === FALSE) {
                 $sClass = '';
             }
             $aConf = array('type' => 'LISTBOX', 'name' => 'actions', 'label' => $sLabel, 'class' => $sClass, 'data' => array('items' => $aItems), 'addblank' => $sBlank, 'onchange' => array('runat' => 'ajax', 'syncvalue' => 'true', 'cache' => 'false', 'exec' => "rdt('" . $this->getAbsName() . "').actionsChange()"));
             $oRdt =& $this->oForm->_makeRenderlet($aConf, $this->sXPath . 'actions/', FALSE, $this, FALSE, FALSE);
             $sAbsName = $oRdt->getAbsName();
             $sName = $oRdt->getName();
             $this->oForm->aORenderlets[$sAbsName] =& $oRdt;
             if ($this->_navConf('/actions/template/path') !== FALSE) {
                 $aTemplate = $this->_navConf('/actions/template');
                 $sPath = $this->oForm->toServerPath($this->oForm->_navConf('/path', $aTemplate));
                 if (!file_exists($sPath)) {
                     $this->oForm->mayday("renderlet:" . $this->_getType() . "[name=" . $this->getName() . "] - The given template file path (<b>'" . $sPath . "'</b>) doesn't exists.");
                 } elseif (is_dir($sPath)) {
                     $this->oForm->mayday("renderlet:" . $this->_getType() . "[name=" . $this->getName() . "] - The given template file path (<b>'" . $sPath . "'</b>) is a directory, and should be a file.");
                 } elseif (!is_readable($sPath)) {
                     $this->oForm->mayday("renderlet:" . $this->_getType() . "[name=" . $this->getName() . "] - The given template file path exists but is not readable.");
                 }
                 if (($sSubpart = $this->oForm->_navConf('/subpart', $aTemplate)) === FALSE) {
                     $sSubpart = $this->getName();
                 }
                 $mHtml = t3lib_parsehtml::getSubpart(t3lib_div::getUrl($sPath), $sSubpart);
                 if (trim($mHtml) == "") {
                     $this->oForm->mayday("renderlet:" . $this->_getType() . "[name=" . $this->getName() . "] - The given template (<b>'" . $sPath . "'</b> with subpart marquer <b>'" . $sSubpart . "'</b>) <b>returned an empty string</b> - Check your template");
                 }
                 $aMarkers = array('actions' => $oRdt->render());
                 foreach ($this->aActions as $aAction) {
                     if (array_key_exists('content', $aAction)) {
                         $sType = $this->oForm->rdt($aAction['content'])->_getType();
                         if ($sType !== 'MODALBOX' && $sType !== 'MODALBOX2') {
                             if ($this->oForm->rdt($aAction['content'])->_navConf('/childs/template/path') === FALSE) {
                                 $this->oForm->rdt($aAction['content'])->setCustomRootHtml($mHtml);
                             }
                             $aMarkers[$aAction['content']] = $this->oForm->rdt($aAction['content'])->render();
                         }
                     }
                 }
                 $this->aActionListbox = $this->oForm->_parseTemplateCode($mHtml, $aMarkers, array(), FALSE);
             } else {
                 $this->aActionListbox = $oRdt->render();
             }
         }
     }
 }
 function _renderList(&$aParts, &$aRowsHtml)
 {
     $this->_initLimitAndSort();
     $this->_initFilters();
     $this->_initDatasource();
     if ($this->aDatasource && $this->aDatasource["numrows"]) {
         // if there is some items to render
         $iNbAlt = count($this->aRowsSubpart);
         $aRows = $this->aDatasource["results"];
         foreach ($aRows as $i => $aRow) {
             $aCurRow = $this->_refineRow($aRow);
             $sRowHtml = $this->oForm->_parseTemplateCode($this->aRowsSubpart[$i % $iNbAlt], $aCurRow);
             $aRowsHtml[] = trim($sRowHtml);
         }
         $sHtml = t3lib_parsehtml::substituteSubpart(trim($this->sTemplate), "###ROWS###", "###ROWS###", FALSE, FALSE);
         $sHtml = str_replace(array("{autocomplete_search.numrows}"), array(count($aRows)), $sHtml);
         $aParts = explode("###ROWS###", $sHtml);
     }
 }
예제 #16
0
 /**
  * Make login news - renders the HTML content for a list of news shown under
  * the login form. News data is added through $TYPO3_CONF_VARS
  *
  * @return	string		HTML content
  * @credits			Idea by Jan-Hendrik Heuing
  */
 function makeLoginNews()
 {
     $newsContent = '';
     // Traverse news array IF there are records in it:
     if (is_array($GLOBALS['TYPO3_CONF_VARS']['BE']['loginNews']) && count($GLOBALS['TYPO3_CONF_VARS']['BE']['loginNews']) && !t3lib_div::_GP('loginRefresh')) {
         // get the main news template, and replace the subpart after looped through
         $newsContent = t3lib_parsehtml::getSubpart($GLOBALS['TBE_TEMPLATE']->moduleTemplate, '###LOGIN_NEWS###');
         $newsItemTemplate = t3lib_parsehtml::getSubpart($newsContent, '###NEWS_ITEM###');
         $newsItemContent = '';
         $count = 1;
         foreach ($GLOBALS['TYPO3_CONF_VARS']['BE']['loginNews'] as $newsItem) {
             $additionalClass = '';
             if ($count == 1) {
                 $additionalClass = ' first-item';
             } elseif ($count == count($GLOBALS['TYPO3_CONF_VARS']['BE']['loginNews'])) {
                 $additionalClass = ' last-item';
             }
             $newsItemMarker = array('###HEADER###' => htmlspecialchars($newsItem['header']), '###DATE###' => htmlspecialchars($newsItem['date']), '###CONTENT###' => trim($newsItem['content']), '###CLASS###' => $additionalClass);
             $count++;
             $newsItemContent .= t3lib_parsehtml::substituteMarkerArray($newsItemTemplate, $newsItemMarker);
         }
         $title = $GLOBALS['TYPO3_CONF_VARS']['BE']['loginNewsTitle'] ? $GLOBALS['TYPO3_CONF_VARS']['BE']['loginNewsTitle'] : $GLOBALS['LANG']->getLL('newsheadline');
         $newsContent = t3lib_parsehtml::substituteMarker($newsContent, '###NEWS_HEADLINE###', htmlspecialchars($title));
         $newsContent = t3lib_parsehtml::substituteSubpart($newsContent, '###NEWS_ITEM###', $newsItemContent);
     }
     return $newsContent;
 }
예제 #17
0
				</li>
				<li class="t3-install-locked-user-settings">
					Alternatively, in the Backend, go to <a href="../sysext/setup/mod/index.php">User tools &gt; User settings</a>
					and let TYPO3 create this file for you. When you\'re finished, you can also visit
					<a href="../sysext/setup/mod/index.php">User tools &gt; User settings</a> and delete the file from there.
				</li>
			</ul>
			<p>
				For security reasons, it is highly recommended that you either rename or delete the file after the operation is finished.
			</p>
			<p>
				As an additional security measure, if the file is older than one hour, TYPO3 will automatically delete it.
			</p>
		');
    // Fill the markers
    $content = t3lib_parsehtml::substituteMarkerArray($template, $markers, '###|###', 1, 1);
    // Output the warning message and exit
    header('Content-Type: text/html; charset=utf-8');
    header('Cache-Control: no-cache, must-revalidate');
    header('Pragma: no-cache');
    echo $content;
    exit;
}
// *****************************************************************************
// Defining constants necessary for the install-script to invoke the installer
// *****************************************************************************
define('TYPO3_MOD_PATH', 'install/');
$BACK_PATH = '../';
// Defining this variable and setting it non-false will invoke the install-screen called from init.php
define('TYPO3_enterInstallScript', '1');
require '../init.php';
 /**
  * Checks access to the record and adds the clear cache button
  *
  * @param array $params
  * @param template $pObj
  *
  * @return void
  */
 public function addButton($params, $pObj)
 {
     $this->params = $params;
     $this->pObj = $pObj;
     $record = array();
     $table = '';
     // For web -> page view or web -> list view
     if ($this->pObj->scriptID === 'ext/cms/layout/db_layout.php' || $this->pObj->scriptID === 'ext/recordlist/mod1/index.php') {
         $id = t3lib_div::_GP('id');
         if (is_object($GLOBALS['SOBE']) && $GLOBALS['SOBE']->current_sys_language) {
             $table = 'pages_language_overlay';
             $record = t3lib_BEfunc::getRecordsByField($table, 'pid', $id, ' AND ' . $table . '.sys_language_uid=' . intval($GLOBALS['SOBE']->current_sys_language), '', '', '1');
             if (is_array($record) && !empty($record)) {
                 $record = $record[0];
             }
         } else {
             $table = 'pages';
             $record = array('uid' => $id, 'pid' => $id);
         }
     } elseif ($this->pObj->scriptID === 'typo3/alt_doc.php') {
         // For record edit
         $editConf = t3lib_div::_GP('edit');
         if (is_array($editConf) && !empty($editConf)) {
             // Finding the current table
             reset($editConf);
             $table = key($editConf);
             // Finding the first id and get the records pid
             reset($editConf[$table]);
             $recordUid = key($editConf[$table]);
             // If table is pages we need uid (as pid) to get TSconfig
             if ($table === 'pages') {
                 $record['uid'] = $recordUid;
                 $record['pid'] = $recordUid;
             } else {
                 $record = t3lib_BEfunc::getRecord($table, $recordUid, 'uid, pid');
             }
         }
     }
     if (isset($record['pid']) && $record['pid'] > 0) {
         if ($this->isModuleAccessible($record['pid'], $table)) {
             // Process last request
             $button = $this->process($table, $record['uid']);
             // Generate button with form for list view
             if ($this->pObj->scriptID === 'ext/recordlist/mod1/index.php') {
                 $button .= $this->generateButton(TRUE);
             } else {
                 // Generate plain input button
                 $button .= $this->generateButton();
             }
             // Add button to button list and extend layout
             $this->params['buttons']['vcc'] = $button;
             $buttonWrap = t3lib_parsehtml::getSubpart($pObj->moduleTemplate, '###BUTTON_GROUP_WRAP###');
             $this->params['markers']['BUTTONLIST_LEFT'] .= t3lib_parsehtml::substituteMarker($buttonWrap, '###BUTTONS###', trim($button));
         }
     }
 }
예제 #19
0
 /**
  * Fill the button lists with the defined HTML
  *
  * @param	array		HTML for all buttons
  * @return	array		Containing HTML for both buttonlists
  */
 protected function getDocHeaderButtons($buttons)
 {
     $markers = array();
     // Fill buttons for left and right float
     $floats = array('left', 'right');
     foreach ($floats as $key) {
         // Get the template for each float
         $buttonTemplate = t3lib_parsehtml::getSubpart($this->moduleTemplate, '###BUTTON_GROUPS_' . strtoupper($key) . '###');
         // Fill the button markers in this float
         $buttonTemplate = t3lib_parsehtml::substituteMarkerArray($buttonTemplate, $buttons, '###|###', true);
         // getting the wrap for each group
         $buttonWrap = t3lib_parsehtml::getSubpart($this->moduleTemplate, '###BUTTON_GROUP_WRAP###');
         // looping through the groups (max 6) and remove the empty groups
         for ($groupNumber = 1; $groupNumber < 6; $groupNumber++) {
             $buttonMarker = '###BUTTON_GROUP' . $groupNumber . '###';
             $buttonGroup = t3lib_parsehtml::getSubpart($buttonTemplate, $buttonMarker);
             if (trim($buttonGroup)) {
                 if ($buttonWrap) {
                     $buttonGroup = t3lib_parsehtml::substituteMarker($buttonWrap, '###BUTTONS###', $buttonGroup);
                 }
                 $buttonTemplate = t3lib_parsehtml::substituteSubpart($buttonTemplate, $buttonMarker, trim($buttonGroup));
             }
         }
         // replace the marker with the template and remove all line breaks (for IE compat)
         $markers['BUTTONLIST_' . strtoupper($key)] = str_replace(LF, '', $buttonTemplate);
     }
     // Hook for manipulating docHeaderButtons
     if (isset($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/template.php']['docHeaderButtonsHook'])) {
         $params = array('buttons' => $buttons, 'markers' => &$markers, 'pObj' => &$this);
         foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/template.php']['docHeaderButtonsHook'] as $funcRef) {
             t3lib_div::callUserFunction($funcRef, $params, $this);
         }
     }
     return $markers;
 }
 /**
  * Sets the design to the backend design.
  * Backend
  *
  * @return	void
  */
 function setNewBEDesign()
 {
     $template = t3lib_div::getURL(PATH_typo3 . $this->templateFile);
     // Wrapping all table rows for a particular record being edited:
     $this->totalWrap = t3lib_parsehtml::getSubpart($template, '###TOTALWRAP###');
     // Wrapping a single field:
     $this->fieldTemplate = t3lib_parsehtml::getSubpart($template, '###FIELDTEMPLATE###');
     $this->palFieldTemplate = t3lib_parsehtml::getSubpart($template, '###PALETTE_FIELDTEMPLATE###');
     $this->palFieldTemplateHeader = t3lib_parsehtml::getSubpart($template, '###PALETTE_FIELDTEMPLATE_HEADER###');
     $this->sectionWrap = t3lib_parsehtml::getSubpart($template, '###SECTION_WRAP###');
 }
예제 #21
0
 function &_getTemplate()
 {
     if (($aTemplate = $this->_navConf("/template")) !== FALSE) {
         $sPath = t3lib_div::getFileAbsFileName($this->oForm->_navConf("/path", $aTemplate));
         if (!file_exists($sPath)) {
             $this->oForm->mayday("renderlet:" . $this->_getType() . "[name=" . $this->getName() . "] - The given template file path (<b>'" . $sPath . "'</b>) doesn't exists.");
         } elseif (is_dir($sPath)) {
             $this->oForm->mayday("renderlet:" . $this->_getType() . "[name=" . $this->getName() . "] - The given template file path (<b>'" . $sPath . "'</b>) is a directory, and should be a file.");
         } elseif (!is_readable($sPath)) {
             $this->oForm->mayday("renderlet:" . $this->_getType() . "[name=" . $this->getName() . "] - The given template file path exists but is not readable.");
         }
         if (($sSubpart = $this->oForm->_navConf("/subpart", $aTemplate)) === FALSE) {
             $sSubpart = $this->getName();
         }
         $sHtml = t3lib_parsehtml::getSubpart(t3lib_div::getUrl($sPath), $sSubpart);
         if (trim($sHtml) == "") {
             $this->oForm->mayday("renderlet:" . $this->_getType() . "[name=" . $this->getName() . "] - The given template (<b>'" . $sPath . "'</b> with subpart marquer <b>'" . $sSubpart . "'</b>) <b>returned an empty string</b> - Check your template");
         }
         return $this->oForm->_parseTemplateCode($sHtml, $aChildsBag, array(), FALSE);
     }
 }
 /**
  * Build the mail content.
  *
  * @param	int			$curPage: id of the current page
  * @param	string		$pageList: list of pages id
  * @param	array		$markerArray: array of markers
  * @param	array		$oldBrokenLink: markerarray with the number of link found
  * @return	string		Content of the mail
  */
 protected function buildMail($curPage, $pageList, $markerArray, $oldBrokenLink)
 {
     $pageSectionHTML = t3lib_parsehtml::getSubpart($this->templateMail, '###PAGE_SECTION###');
     if (is_array($markerArray)) {
         foreach ($markerArray as $markerKey => $markerValue) {
             if (empty($oldBrokenLink[$markerKey])) {
                 $oldBrokenLink[$markerKey] = 0;
             }
             if ($markerValue != $oldBrokenLink[$markerKey]) {
                 $this->dif = TRUE;
             }
             $markerArray[$markerKey . '_old'] = $oldBrokenLink[$markerKey];
         }
     }
     $markerArray['title'] = t3lib_BEfunc::getRecordTitle('pages', t3lib_BEfunc::getRecord('pages', $curPage));
     $content = '';
     if ($markerArray['brokenlinkCount'] > 0) {
         $content = t3lib_parsehtml::substituteMarkerArray($pageSectionHTML, $markerArray, '###|###', TRUE, TRUE);
     }
     return $content;
 }
예제 #23
0
파일: Template.php 프로젝트: punktDe/solr
 /**
  * Retrievs a supart from the given html template.
  *
  * @param	string	subpart marker name, can be lowercase, doesn't need the ### delimiters
  * @return	string	the html subpart
  */
 public function getSubpart($subpartName, $alternativeTemplate = '')
 {
     $template = $this->workOnSubpart;
     // set altenative template to work on
     if (!empty($alternativeTemplate)) {
         $template = $alternativeTemplate;
     }
     $subpart = t3lib_parsehtml::getSubpart($template, '###' . strtoupper($subpartName) . '###');
     return $subpart;
 }
    /**
     * Creates a specialized form to configure the database.
     *
     * @param array $markers
     * @param tx_install $instObj
     */
    protected function createDatabaseForm(array &$markers, tx_install $instObj)
    {
        $error_missingConnect = '
			<p class="typo3-message message-error">
				<strong>
					There is no connection to the database!
				</strong>
				<br />
				(Username: <em>' . TYPO3_db_username . '</em>,
				Host: <em>' . TYPO3_db_host . '</em>,
				Using Password: YES)
				<br />
				Go to Step 1 and enter a valid username and password!
			</p>
		';
        // Add header marker for main template
        $markers['header'] = 'Select database';
        // There should be a database host connection at this point
        if ($result = $GLOBALS['TYPO3_DB']->sql_pconnect(TYPO3_db_host, TYPO3_db_username, TYPO3_db_password)) {
            // Get the template file
            $templateFile = @file_get_contents(t3lib_extMgm::extPath('dbal') . $this->templateFilePath . 'install.html');
            // Get the template part from the file
            $template = t3lib_parsehtml::getSubpart($templateFile, '###TEMPLATE###');
            // Get the subpart for the database choice step
            $formSubPart = t3lib_parsehtml::getSubpart($template, '###DATABASE_FORM###');
            // Get the subpart for the database options
            $step3DatabaseOptionsSubPart = t3lib_parsehtml::getSubpart($formSubPart, '###DATABASEOPTIONS###');
            $dbArr = $instObj->getDatabaseList();
            $dbIncluded = FALSE;
            foreach ($dbArr as $dbname) {
                // Define the markers content for database options
                $step3DatabaseOptionMarkers = array('databaseValue' => htmlspecialchars($dbname), 'databaseSelected' => $dbname === TYPO3_db ? 'selected="selected"' : '', 'databaseName' => htmlspecialchars($dbname));
                // Add the option HTML to an array
                $step3DatabaseOptions[] = t3lib_parsehtml::substituteMarkerArray($step3DatabaseOptionsSubPart, $step3DatabaseOptionMarkers, '###|###', 1, 1);
                if ($dbname === TYPO3_db) {
                    $dbIncluded = TRUE;
                }
            }
            if (!$dbIncluded && TYPO3_db) {
                // // Define the markers content when no access
                $step3DatabaseOptionMarkers = array('databaseValue' => htmlspecialchars(TYPO3_db), 'databaseSelected' => 'selected="selected"', 'databaseName' => htmlspecialchars(TYPO3_db) . ' (NO ACCESS!)');
                // Add the option HTML to an array
                $step3DatabaseOptions[] = t3lib_parsehtml::substituteMarkerArray($step3DatabaseOptionsSubPart, $step3DatabaseOptionMarkers, '###|###', 1, 1);
            }
            // Substitute the subpart for the database options
            $content = t3lib_parsehtml::substituteSubpart($formSubPart, '###DATABASEOPTIONS###', implode(chr(10), $step3DatabaseOptions));
            // Define the markers content
            $step3SubPartMarkers = array('step' => $instObj->step + 1, 'action' => htmlspecialchars($instObj->action), 'llOption2' => 'Select an EMPTY existing database:', 'llRemark2' => 'Any tables used by TYPO3 will be overwritten.', 'continue' => 'Continue');
            // Add step marker for main template
            $markers['step'] = t3lib_parsehtml::substituteMarkerArray($content, $step3SubPartMarkers, '###|###', 1, 1);
        } else {
            // Add step marker for main template when no connection
            $markers['step'] = $error_missingConnect;
        }
    }
 /**
  * render the section (Header or Footer)
  *
  * @param int $part	section which should be rendered: self::PART_COMPLETE, self::PART_HEADER or self::PART_FOOTER
  * @return string	content of rendered section
  */
 public function render($part = self::PART_COMPLETE)
 {
     $jsFiles = '';
     $cssFiles = '';
     $cssInline = '';
     $jsInline = '';
     $jsFooterInline = '';
     $jsFooterLibs = '';
     $jsFooterFiles = '';
     $noJS = FALSE;
     // preRenderHook for possible manuipulation
     if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_pagerenderer.php']['render-preProcess'])) {
         $params = array('jsLibs' => &$this->jsLibs, 'jsFiles' => &$this->jsFiles, 'jsFooterFiles' => &$this->jsFooterFiles, 'cssFiles' => &$this->cssFiles, 'headerData' => &$this->headerData, 'footerData' => &$this->footerData, 'jsInline' => &$this->jsInline, 'cssInline' => &$this->cssInline);
         foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_pagerenderer.php']['render-preProcess'] as $hook) {
             t3lib_div::callUserFunction($hook, $params, $this);
         }
     }
     $jsLibs = $this->renderJsLibraries();
     if ($this->concatenateFiles) {
         // do the file concatenation
         $this->doConcatenate();
     }
     if ($this->compressCss || $this->compressJavascript) {
         // do the file compression
         $this->doCompress();
     }
     $metaTags = implode(LF, $this->metaTags);
     // remove ending slashes from static header block
     // if the page is beeing rendered as html (not xhtml)
     // and define variable $endingSlash for further use
     if ($this->getRenderXhtml()) {
         $endingSlash = ' /';
     } else {
         $this->metaCharsetTag = str_replace(' />', '>', $this->metaCharsetTag);
         $this->baseUrlTag = str_replace(' />', '>', $this->baseUrlTag);
         $this->shortcutTag = str_replace(' />', '>', $this->shortcutTag);
         $endingSlash = '';
     }
     if (count($this->cssFiles)) {
         foreach ($this->cssFiles as $file => $properties) {
             $file = t3lib_div::resolveBackPath($file);
             $file = t3lib_div::createVersionNumberedFilename($file);
             $tag = '<link rel="' . $properties['rel'] . '" type="text/css" href="' . htmlspecialchars($file) . '" media="' . $properties['media'] . '"' . ($properties['title'] ? ' title="' . $properties['title'] . '"' : '') . $endingSlash . '>';
             if ($properties['allWrap'] && strpos($properties['allWrap'], '|') !== FALSE) {
                 $tag = str_replace('|', $tag, $properties['allWrap']);
             }
             if ($properties['forceOnTop']) {
                 $cssFiles = $tag . LF . $cssFiles;
             } else {
                 $cssFiles .= LF . $tag;
             }
         }
     }
     if (count($this->cssInline)) {
         foreach ($this->cssInline as $name => $properties) {
             if ($properties['forceOnTop']) {
                 $cssInline = '/*' . htmlspecialchars($name) . '*/' . LF . $properties['code'] . LF . $cssInline;
             } else {
                 $cssInline .= '/*' . htmlspecialchars($name) . '*/' . LF . $properties['code'] . LF;
             }
         }
         $cssInline = $this->inlineCssWrap[0] . $cssInline . $this->inlineCssWrap[1];
     }
     if (count($this->jsLibs)) {
         foreach ($this->jsLibs as $name => $properties) {
             $properties['file'] = t3lib_div::resolveBackPath($properties['file']);
             $properties['file'] = t3lib_div::createVersionNumberedFilename($properties['file']);
             $tag = '<script src="' . htmlspecialchars($properties['file']) . '" type="' . $properties['type'] . '"></script>';
             if ($properties['allWrap'] && strpos($properties['allWrap'], '|') !== FALSE) {
                 $tag = str_replace('|', $tag, $properties['allWrap']);
             }
             if ($properties['forceOnTop']) {
                 if ($properties['section'] === self::PART_HEADER) {
                     $jsLibs = $tag . LF . $jsLibs;
                 } else {
                     $jsFooterLibs = $tag . LF . $jsFooterLibs;
                 }
             } else {
                 if ($properties['section'] === self::PART_HEADER) {
                     $jsLibs .= LF . $tag;
                 } else {
                     $jsFooterLibs .= LF . $tag;
                 }
             }
         }
     }
     if (count($this->jsFiles)) {
         foreach ($this->jsFiles as $file => $properties) {
             $file = t3lib_div::resolveBackPath($file);
             $file = t3lib_div::createVersionNumberedFilename($file);
             $tag = '<script src="' . htmlspecialchars($file) . '" type="' . $properties['type'] . '"></script>';
             if ($properties['allWrap'] && strpos($properties['allWrap'], '|') !== FALSE) {
                 $tag = str_replace('|', $tag, $properties['allWrap']);
             }
             if ($properties['forceOnTop']) {
                 if ($properties['section'] === self::PART_HEADER) {
                     $jsFiles = $tag . LF . $jsFiles;
                 } else {
                     $jsFooterFiles = $tag . LF . $jsFooterFiles;
                 }
             } else {
                 if ($properties['section'] === self::PART_HEADER) {
                     $jsFiles .= LF . $tag;
                 } else {
                     $jsFooterFiles .= LF . $tag;
                 }
             }
         }
     }
     if (count($this->jsInline)) {
         foreach ($this->jsInline as $name => $properties) {
             if ($properties['forceOnTop']) {
                 if ($properties['section'] === self::PART_HEADER) {
                     $jsInline = '/*' . htmlspecialchars($name) . '*/' . LF . $properties['code'] . LF . $jsInline;
                 } else {
                     $jsFooterInline = '/*' . htmlspecialchars($name) . '*/' . LF . $properties['code'] . LF . $jsFooterInline;
                 }
             } else {
                 if ($properties['section'] === self::PART_HEADER) {
                     $jsInline .= '/*' . htmlspecialchars($name) . '*/' . LF . $properties['code'] . LF;
                 } else {
                     $jsFooterInline .= '/*' . htmlspecialchars($name) . '*/' . LF . $properties['code'] . LF;
                 }
             }
         }
     }
     if ($jsInline) {
         $jsInline = $this->inlineJavascriptWrap[0] . $jsInline . $this->inlineJavascriptWrap[1];
     }
     if ($jsFooterInline) {
         $jsFooterInline = $this->inlineJavascriptWrap[0] . $jsFooterInline . $this->inlineJavascriptWrap[1];
     }
     // get template
     $templateFile = t3lib_div::getFileAbsFileName($this->templateFile, TRUE);
     $template = t3lib_div::getURL($templateFile);
     if ($this->removeEmptyLinesFromTemplate) {
         $template = strtr($template, array(LF => '', CR => ''));
     }
     if ($part != self::PART_COMPLETE) {
         $templatePart = explode('###BODY###', $template);
         $template = $templatePart[$part - 1];
     }
     if ($this->moveJsFromHeaderToFooter) {
         $jsFooterLibs = $jsLibs . LF . $jsFooterLibs;
         $jsLibs = '';
         $jsFooterFiles = $jsFiles . LF . $jsFooterFiles;
         $jsFiles = '';
         $jsFooterInline = $jsInline . LF . $jsFooterInline;
         $jsInline = '';
     }
     $markerArray = array('XMLPROLOG_DOCTYPE' => $this->xmlPrologAndDocType, 'HTMLTAG' => $this->htmlTag, 'HEADTAG' => $this->headTag, 'METACHARSET' => $this->charSet ? str_replace('|', htmlspecialchars($this->charSet), $this->metaCharsetTag) : '', 'INLINECOMMENT' => $this->inlineComments ? LF . LF . '<!-- ' . LF . implode(LF, $this->inlineComments) . '-->' . LF . LF : '', 'BASEURL' => $this->baseUrl ? str_replace('|', $this->baseUrl, $this->baseUrlTag) : '', 'SHORTCUT' => $this->favIcon ? sprintf($this->shortcutTag, htmlspecialchars($this->favIcon), $this->iconMimeType) : '', 'CSS_INCLUDE' => $cssFiles, 'CSS_INLINE' => $cssInline, 'JS_INLINE' => $jsInline, 'JS_INCLUDE' => $jsFiles, 'JS_LIBS' => $jsLibs, 'TITLE' => $this->title ? str_replace('|', htmlspecialchars($this->title), $this->titleTag) : '', 'META' => $metaTags, 'HEADERDATA' => $this->headerData ? implode(LF, $this->headerData) : '', 'FOOTERDATA' => $this->footerData ? implode(LF, $this->footerData) : '', 'JS_LIBS_FOOTER' => $jsFooterLibs, 'JS_INCLUDE_FOOTER' => $jsFooterFiles, 'JS_INLINE_FOOTER' => $jsFooterInline, 'BODY' => $this->bodyContent);
     $markerArray = array_map('trim', $markerArray);
     $this->reset();
     return trim(t3lib_parsehtml::substituteMarkerArray($template, $markerArray, '###|###'));
 }
 /**
  * Returns HTML-code, which is a visual representation of a multidimensional array
  * Returns false if $array_in is not an array
  *
  * @param mixed $incomingValue Array to view
  * @return string HTML output
  */
 function viewArray($incomingValue)
 {
     // Get the template file
     $templateFile = @file_get_contents(PATH_site . $this->templateFilePath . 'ViewArray.html');
     if (is_array($incomingValue) && !empty($incomingValue)) {
         // Get the template part from the file
         $content = t3lib_parsehtml::getSubpart($templateFile, '###TEMPLATE###');
         // Get the subpart for a single item
         $itemSubpart = t3lib_parsehtml::getSubpart($content, '###ITEM###');
         foreach ($incomingValue as $key => $value) {
             if (is_array($value)) {
                 $description = $this->viewArray($value);
             } elseif (is_object($value)) {
                 $description = get_class($value);
                 if (method_exists($value, '__toString')) {
                     $description .= ': ' . (string) $value;
                 }
             } else {
                 if (gettype($value) == 'object') {
                     $description = 'Unknown object';
                 } else {
                     $description = htmlspecialchars((string) $value);
                 }
             }
             // Define the markers content
             $itemMarkers = array('key' => htmlspecialchars((string) $key), 'description' => !empty($description) ? $description : '&nbsp;');
             // Fill the markers in the subpart
             $items[] = t3lib_parsehtml::substituteMarkerArray($itemSubpart, $itemMarkers, '###|###', TRUE, FALSE);
         }
         // Substitute the subpart for single item
         $content = t3lib_parsehtml::substituteSubpart($content, '###ITEM###', implode(chr(10), $items));
     }
     return $content;
 }