/** * Processes conditions: finds and evaluates them in HTML code. * * @param string HTML */ protected function processConditions($content) { // find conditions $conditions = $this->findConditions($content); // evaluate conditions foreach ($conditions as $condition) { if ($this->isVariableMarker($condition['comparand1']) || $this->isVariableMarker($condition['comparand2'])) { // unresolved marker => skip, will be resolved later continue; } $conditionResult = $this->evaluateCondition($condition['comparand1'], $condition['comparand2'], $condition['operator']); if ($conditionResult) { // if condition evaluates to TRUE, simply replace it with // the original content to have the surrounding markers removed $content = t3lib_parsehtml::substituteSubpart($content, $condition['marker'], $condition['content']); } else { // if condition evaluates to FALSE, remove the content from the template $content = t3lib_parsehtml::substituteSubpart($content, $condition['marker'], ''); } } return $content; }
/** * Substitute subpart in input template stream. * This function substitutes a subpart in $content with the content of * $subpartContent. * Wrapper for t3lib_parsehtml::substituteSubpart which behaves identical * * @param string The content stream, typically HTML template content. * @param string The marker string, typically on the form "###[the marker string]###" * @param mixed The content to insert instead of the subpart found. If a string, then just plain substitution happens (includes removing the HTML comments of the subpart if found). If $subpartContent happens to be an array, it's [0] and [1] elements are wrapped around the EXISTING content of the subpart (fetched by getSubpart()) thereby not removing the original content. * @param boolean If $recursive is set, the function calls itself with the content set to the remaining part of the content after the second marker. This means that proceding subparts are ALSO substituted! * @return string The processed HTML content string. * @see getSubpart(), t3lib_parsehtml::substituteSubpart() */ public function substituteSubpart($content, $marker, $subpartContent, $recursive = 1) { return t3lib_parsehtml::substituteSubpart($content, $marker, $subpartContent, $recursive); }
/** * 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; }
/** * 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; }
/** * 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; } }
/** * 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; }
function &_renderList() { if ($this->aDatasource) { // if this ticker has a datasource that must be used to generate his content if ($this->aDatasource["numrows"] == 0) { $sRowsHtml = ""; } else { $sTemplate = $this->_getTemplate(); $aAltRows = $this->_getRowsSubpart($sTemplate); $iNbAlt = count($aAltRows); $aRows = $this->aDatasource["results"]; foreach ($aRows as $i => $aRow) { $aCurRow = $this->_refineRow($aRow); $sRowHtml = $this->oForm->_parseTemplateCode($aAltRows[$i % $iNbAlt], $aCurRow); $sRowHtml = '<div class="ameosformidable-rdtticker-item">' . $sRowHtml . '</div>'; $aRowsHtml[] = $sRowHtml; } $sRowsHtml = implode("", $aRowsHtml); } $sHtml = t3lib_parsehtml::substituteSubpart($sTemplate, "###ROWS###", $sRowsHtml, FALSE, FALSE); $sHtml .= $this->sSeparatorHtml; } elseif ($this->_navConf("/html") !== FALSE) { // if this ticker has a html as content $sHtml = tx_ameosformidable::isRunneable($this->aElement["html"]) ? $this->callRunneable($this->aElement["html"]) : $this->_navConf("/html"); $sHtml = $this->oForm->_substLLLInHtml($sHtml) . $this->sSeparatorHtml; } else { $this->oForm->mayday("RENDERLET TICKER <b>" . $this->_getName() . "</b> requires /datasource or /html to be properly set. Please check your XML configuration"); } return $sHtml; }
/** * Build and send warning email when new broken links were found. * * @param string $pageSections: Content of page section * @param string $modTS: TSconfig array * @return bool TRUE if mail was sent, FALSE if or not */ protected function reportEmail($pageSections, $modTS) { $content = t3lib_parsehtml::substituteSubpart($this->templateMail, '###PAGE_SECTION###', $pageSections); /** @var array $markerArray */ $markerArray = array(); /** @var array $validEmailList */ $validEmailList = array(); /** @var boolean $sendEmail */ $sendEmail = TRUE; $markerArray['totalBrokenLink'] = $this->totalBrokenLink; $markerArray['totalBrokenLink_old'] = $this->oldTotalBrokenLink; $content = t3lib_parsehtml::substituteMarkerArray($content, $markerArray, '###|###', TRUE, TRUE); /** @var t3lib_mail_Message $mail */ $mail = t3lib_div::makeInstance('t3lib_mail_Message'); if (empty($modTS['mail.']['fromemail'])) { $modTS['mail.']['fromemail'] = t3lib_utility_Mail::getSystemFromAddress(); } if (empty($modTS['mail.']['fromname'])) { $modTS['mail.']['fromname'] = t3lib_utility_Mail::getSystemFromName(); } if (t3lib_div::validEmail($modTS['mail.']['fromemail'])) { $mail->setFrom(array($modTS['mail.']['fromemail'] => $modTS['mail.']['fromname'])); } else { throw new Exception($GLOBALS['LANG']->sL('LLL:EXT:linkvalidator/locallang.xml:tasks.error.invalidFromEmail'), '1295476760'); } if (t3lib_div::validEmail($modTS['mail.']['replytoemail'])) { $mail->setReplyTo(array($modTS['mail.']['replytoemail'] => $modTS['mail.']['replytoname'])); } if (!empty($modTS['mail.']['subject'])) { $mail->setSubject($modTS['mail.']['subject']); } else { throw new Exception($GLOBALS['LANG']->sL('LLL:EXT:linkvalidator/locallang.xml:tasks.error.noSubject'), '1295476808'); } if (!empty($this->email)) { $emailList = t3lib_div::trimExplode(',', $this->email); foreach ($emailList as $emailAdd) { if (!t3lib_div::validEmail($emailAdd)) { throw new Exception($GLOBALS['LANG']->sL('LLL:EXT:linkvalidator/locallang.xml:tasks.error.invalidToEmail'), '1295476821'); } else { $validEmailList[] = $emailAdd; } } } if (is_array($validEmailList) && !empty($validEmailList)) { $mail->setTo($this->email); } else { $sendEmail = FALSE; } if ($sendEmail) { $mail->setBody($content, 'text/html'); $mail->send(); } return $sendEmail; }
/** * 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; }
function _renderSearchform_displayFields(&$aHtmlBag) { $aTemplate = $this->getFieldsTemplate(); $aAltRows = array(); $aRowsHtml = array(); $sRowsPart = t3lib_parsehtml::getSubpart($aTemplate["html"], "###ROWS###"); if ($aTemplate["default"] === TRUE) { $sAltList = "###ROW1###, ###ROW2###"; } elseif (($sAltRows = $this->_navConf("/fields/template/alternaterows")) !== FALSE && $this->oForm->isRunneable($sAltRows)) { $sAltList = $this->callRunneable($sAltRows); } elseif (($sAltList = $this->_navConf("/fields/template/alternaterows")) === FALSE) { $this->oForm->mayday("RENDERLET ADVSEARCHFORM <b>" . $this->_getName() . "</b> \n\t\t\t\trequires /template/alternaterows to be properly set. Please check your XML configuration"); } $aAltList = t3lib_div::trimExplode(",", $sAltList); if (sizeof($aAltList) > 0) { reset($aAltList); while (list(, $sAltSubpart) = each($aAltList)) { $aAltRows[] = t3lib_parsehtml::getSubpart($sRowsPart, $sAltSubpart); } $iNbAlt = sizeOf($aAltRows); } $iRowNum = 0; foreach ($this->aSearchRows as $iKey => $aRow) { $sRowTemplate = $aAltRows[$iRowNum % $iNbAlt]; foreach ($aRow['childs'] as $sKey => $aRowValue) { if (strpos($sKey, 'searchrow_') !== FALSE) { $aRow['childs']['childrows'] .= $this->_renderRow($aRowValue, $sRowTemplate); } } $sRowContent = $this->oForm->_parseTemplateCode($sRowTemplate, $aRow['childs']); $sRowContent = $aRow['box.']['begin'] . $sRowContent . $aRow['box.']['end']; $aHtmlBag['fields.'][$iKey] = $sRowContent; $iRowNum++; } $aHtmlBag["fields"] = t3lib_parsehtml::substituteSubpart($aTemplate["html"], "###ROWS###", implode("", $aHtmlBag['fields.']), FALSE, FALSE); }
/** * [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 &__buildDefaultTemplate($sCssPrefix = ".ameosformidable-rdtlister-defaultwrap") { $aRes = array("default" => TRUE, "html" => "", "styles" => "", "cssfile" => "", "pager" => ""); $aHtml = array("TOP" => array(), "DATA" => array("ROW1" => array(), "ROW2" => array())); $sPath = $this->sExtPath . "res/html/default-template.html"; $sSubpart = "###LIST###"; $aRes["html"] = t3lib_parsehtml::getSubpart(t3lib_div::getUrl($sPath), $sSubpart); /* including default styles in external CSS */ $aRes["styles"] = $this->oForm->_parseThrustedTemplateCode(t3lib_parsehtml::getSubpart(t3lib_div::getUrl($sPath), "###STYLES###"), array("PREFIX" => $sCssPrefix, "EXTPATH" => "/" . $this->sExtRelPath), array(), FALSE); /*END of CSS */ $sTopColumn = t3lib_parsehtml::getSubpart($aRes["html"], "###TOPCOLUMN###"); $sDataColumn1 = t3lib_parsehtml::getSubpart($aRes["html"], "###DATACOLUMN1###"); $sDataColumn2 = t3lib_parsehtml::getSubpart($aRes["html"], "###DATACOLUMN2###"); reset($this->aOColumns); $bSelectall = $this->isEditableLister() ? TRUE : FALSE; while (list($sColName, ) = each($this->aOColumns)) { if ($this->defaultTrue("/columns/listheaders") === TRUE) { // building sorting header for this column if (($sHeader = $this->getListHeader($sColName)) === FALSE) { $sHeader = "{" . $sColName . ".label}"; } if ($bSelectall) { $sColcontent = '{SELECTALL}'; $bSelectall = !$bSelectall; } else { $sColcontent = "<!-- ###SORT_" . $sColName . "### begin-->" . $sHeader . "<!-- ###SORT_" . $sColName . "### end-->"; } $aHtml["TOP"][] = $this->oForm->_parseThrustedTemplateCode($sTopColumn, array("COLNAME" => $sColName, "COLCONTENT" => $sColcontent), array(), FALSE); } // building data cells for this column $aTemp = array("COLNAME" => $sColName, "COLCONTENT" => "{" . $sColName . "}"); $aHtml["DATA"]["ROW1"][] = $this->oForm->_parseThrustedTemplateCode($sDataColumn1, $aTemp, array(), FALSE); $aHtml["DATA"]["ROW2"][] = $this->oForm->_parseThrustedTemplateCode($sDataColumn2, $aTemp, array(), FALSE); /* $aHtml["DATA"]["ROWACT"][] = $this->oForm->_parseThrustedTemplateCode( $sDataColumnAct, $aTemp, array(), FALSE ); */ } $aRes["html"] = t3lib_parsehtml::substituteSubpart($aRes["html"], "###STYLES###", "", FALSE, FALSE); $aRes["html"] = t3lib_parsehtml::substituteSubpart($aRes["html"], "###DATACOLUMN1###", implode("", $aHtml["DATA"]["ROW1"]), FALSE, FALSE); $aRes["html"] = t3lib_parsehtml::substituteSubpart($aRes["html"], "###DATACOLUMN2###", implode("", $aHtml["DATA"]["ROW2"]), FALSE, FALSE); $aRes["html"] = t3lib_parsehtml::substituteSubpart($aRes["html"], "###TOPCOLUMN###", implode("", $aHtml["TOP"]), FALSE, FALSE); $aRes["html"] = $this->oForm->_parseThrustedTemplateCode($aRes["html"], array("NBCOLS" => sizeOf($this->aOColumns)), array(), FALSE); /* RETRIEVING pager */ $aRes["pager"] = $this->__getDefaultPager(); return $aRes; }
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); } }
/** * 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); }
/** * 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 : ' '); // 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; }