/**
  * Substitutes a marker string in the input content
  * (by a simple str_replace())
  *
  * @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 marker string found.
  * @return	string		The processed HTML content string.
  * @see substituteSubpart()
  */
 public function substituteMarker($content, $marker, $markContent)
 {
     return t3lib_parsehtml::substituteMarker($content, $marker, $markContent);
 }
 /**
  * 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;
 }
Beispiel #3
0
 /**
  * Renders single marker view helpers.
  *
  * @param	Tx_Solr_ViewHelper	$viewHelper View helper instance to execute.
  * @param	string	$helperKey The view helper marker key.
  * @param	string	$content Markup that contains the unsubstituted view helper marker.
  * @return	string	Markup with the view helper replaced by the content it returned.
  */
 protected function renderMarkerViewHelper(Tx_Solr_ViewHelper $viewHelper, $helperKey, $content)
 {
     $viewHelperArgumentLists = $this->getViewHelperArgumentLists($helperKey, $content);
     foreach ($viewHelperArgumentLists as $viewHelperArgumentList) {
         $viewHelperArguments = explode('|', $viewHelperArgumentList);
         // TODO check whether one of the parameters is a Helper
         // itself, if so resolve it before handing it off to the
         // actual helper, this way the order in which viewhelpers
         // get added to the template do not matter anymore
         // may use findViewHelpers()
         // checking whether any of the helper arguments should be
         // replaced by a variable available to the template
         foreach ($viewHelperArguments as $i => $helperArgument) {
             $lowercaseHelperArgument = strtolower($helperArgument);
             if (array_key_exists($lowercaseHelperArgument, $this->variables)) {
                 $viewHelperArguments[$i] = $this->variables[$lowercaseHelperArgument];
             }
         }
         $viewHelperContent = $viewHelper->execute($viewHelperArguments);
         $content = t3lib_parsehtml::substituteMarker($content, '###' . $helperKey . ':' . $viewHelperArgumentList . '###', $viewHelperContent);
     }
     return $content;
 }
Beispiel #4
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 #5
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;
 }
 /**
  * Prepares the list of database drivers for step 2.
  *
  * @param string $template
  * @return string
  */
 protected function prepareDatabaseDrivers($template)
 {
     $subParts = array('abstractionLayer' => t3lib_parsehtml::getSubpart($template, '###ABSTRACTION_LAYER###'), 'vendor' => t3lib_parsehtml::getSubpart($template, '###VENDOR###'));
     // Create the drop-down list of available drivers
     $dropdown = '';
     foreach ($this->availableDrivers as $abstractionLayer => $drivers) {
         $options = array();
         foreach ($drivers as $driver => $label) {
             $markers = array('driver' => $driver, 'labelvendor' => $label, 'onclick' => 'document.location=\'index.php?TYPO3_INSTALL[type]=config&mode=123&step=2&driver=' . $driver . '\';', 'selected' => '');
             if ($driver === $this->driver) {
                 $markers['selected'] .= ' selected="selected"';
             }
             $options[] = t3lib_parsehtml::substituteMarkerArray($subParts['vendor'], $markers, '###|###', 1);
         }
         $subPart = t3lib_parsehtml::substituteSubpart($subParts['abstractionLayer'], '###VENDOR###', implode("\n", $options));
         $dropdown .= t3lib_parsehtml::substituteMarker($subPart, '###LABELABSTRACTIONLAYER###', $abstractionLayer);
     }
     $form = t3lib_parsehtml::substituteSubpart($template, '###ABSTRACTION_LAYER###', $dropdown);
     $form = t3lib_parsehtml::substituteMarker($form, '###LABELDRIVER###', 'Driver');
     return $form;
 }
 /**
  * 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));
         }
     }
 }
Beispiel #8
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;
 }