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 '';
 }
    /**
     * 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;
    }
 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;
 }
Beispiel #4
0
 /**
  * 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;
 }
Beispiel #5
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;
 }
Beispiel #6
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;
 }
    /**
     * 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;
        }
    }
 /**
  * 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);
 }
Beispiel #9
0
 /**
  * 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;
 }
 /**
  * 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));
         }
     }
 }
 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;
 }
Beispiel #12
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;
 }
 /**
  * [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;
 }
 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();
             }
         }
     }
 }
 /**
  * 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;
 }
 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;
     }
 }
 /**
  * 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###');
 }
 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;
 }
 /**
  * Returns a subpart from the input content stream.
  * A subpart is a part of the input stream which is encapsulated in a
  * string matching the input string, $marker. If this string is found
  * inside of HTML comment tags the start/end points of the content block
  * returned will be that right outside that comment block.
  * Example: The contennt string is
  * "Hello <!--###sub1### begin--> World. How are <!--###sub1### end--> you?"
  * If $marker is "###sub1###" then the content returned is
  * " World. How are ". The input content string could just as well have
  * been "Hello ###sub1### World. How are ###sub1### you?" and the result
  * would be the same
  * Wrapper for t3lib_parsehtml::getSubpart which behaves identical
  *
  * @param	string		The content stream, typically HTML template content.
  * @param	string		The marker string, typically on the form "###[the marker string]###"
  * @return	string		The subpart found, if found.
  * @see substituteSubpart(), t3lib_parsehtml::getSubpart()
  */
 public function getSubpart($content, $marker)
 {
     return t3lib_parsehtml::getSubpart($content, $marker);
 }
 /**
  * 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;
 }