Ejemplo n.º 1
0
 /**
  * Fill the button lists with the defined HTML
  *
  * @param array $buttons 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 = HtmlParser::getSubpart($this->moduleTemplate, '###BUTTON_GROUPS_' . strtoupper($key) . '###');
         // Fill the button markers in this float
         $buttonTemplate = HtmlParser::substituteMarkerArray($buttonTemplate, $buttons, '###|###', TRUE);
         // getting the wrap for each group
         $buttonWrap = HtmlParser::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 = HtmlParser::getSubpart($buttonTemplate, $buttonMarker);
             if (trim($buttonGroup)) {
                 if ($buttonWrap) {
                     $buttonGroup = HtmlParser::substituteMarker($buttonWrap, '###BUTTONS###', $buttonGroup);
                 }
                 $buttonTemplate = HtmlParser::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) {
             GeneralUtility::callUserFunction($funcRef, $params, $this);
         }
     }
     return $markers;
 }
Ejemplo n.º 2
0
 /**
  * Substitutes a marker string in the input content
  * (by a simple str_replace())
  *
  * @param string $content The content stream, typically HTML template content.
  * @param string $marker The marker string, typically on the form "###[the marker string]###
  * @param mixed $markContent 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 HtmlParser::substituteMarker($content, $marker, $markContent);
 }
Ejemplo n.º 3
0
 /**
  * Substitutes a marker string in the input content
  * (by a simple str_replace())
  *
  * @param string $content The content stream, typically HTML template content.
  * @param string $marker The marker string, typically on the form "###[the marker string]###
  * @param mixed $markContent 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 \TYPO3\CMS\Core\Html\HtmlParser::substituteMarker($content, $marker, $markContent);
 }
Ejemplo n.º 4
0
 /**
  * Compiles the extra form headers if the tceforms
  *
  * @return string The HTML
  */
 public function extraFormHeaders()
 {
     $extraTemplate = '';
     if (is_array($this->tceforms->extraFormHeaders)) {
         $extraTemplate = HtmlParser::getSubpart($this->doc->moduleTemplate, '###DOCHEADER_EXTRAHEADER###');
         $extraTemplate = HtmlParser::substituteMarker($extraTemplate, '###EXTRAHEADER###', implode(LF, $this->tceforms->extraFormHeaders));
     }
     return $extraTemplate;
 }
Ejemplo n.º 5
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 = HtmlParser::substituteMarker($content, '###' . $helperKey . ':' . $viewHelperArgumentList . '###', $viewHelperContent);
     }
     return $content;
 }
Ejemplo n.º 6
0
 /**
  * Make login news - renders the HTML content for a list of news shown under
  * the login form. News data is added through sys_news records
  *
  * @return string HTML content
  * @credits Idea by Jan-Hendrik Heuing
  * @todo Define visibility
  */
 public function makeLoginNews()
 {
     $newsContent = '';
     $systemNews = $this->getSystemNews();
     // Traverse news array IF there are records in it:
     if (is_array($systemNews) && count($systemNews) && !GeneralUtility::_GP('loginRefresh')) {
         /** @var $htmlParser \TYPO3\CMS\Core\Html\RteHtmlParser */
         $htmlParser = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Html\\RteHtmlParser');
         $htmlParser->procOptions['dontHSC_rte'] = TRUE;
         // Get the main news template, and replace the subpart after looped through
         $newsContent = HtmlParser::getSubpart($GLOBALS['TBE_TEMPLATE']->moduleTemplate, '###LOGIN_NEWS###');
         $newsItemTemplate = HtmlParser::getSubpart($newsContent, '###NEWS_ITEM###');
         $newsItem = '';
         $count = 1;
         foreach ($systemNews as $newsItemData) {
             $additionalClass = '';
             if ($count == 1) {
                 $additionalClass = ' first-item';
             } elseif ($count == count($systemNews)) {
                 $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 .= HtmlParser::substituteMarkerArray($newsItemTemplate, $newsItemMarker);
         }
         $title = $GLOBALS['TYPO3_CONF_VARS']['BE']['loginNewsTitle'] ? $GLOBALS['TYPO3_CONF_VARS']['BE']['loginNewsTitle'] : $GLOBALS['LANG']->getLL('newsheadline');
         $newsContent = HtmlParser::substituteMarker($newsContent, '###NEWS_HEADLINE###', htmlspecialchars($title));
         $newsContent = HtmlParser::substituteSubpart($newsContent, '###NEWS_ITEM###', $newsItem);
     }
     return $newsContent;
 }
Ejemplo n.º 7
0
 /**
  * Processes helpers LINK : finds and evaluates them in HTML code.
  * Example : ###LINK:Pid|AdditionalParameters|useCache###
  * Example : ###LINK:3|param1=val1&param12=val2|1###
  * If Pid is empty = current page
  *
  * @param array  $templateMarkers
  * @param string $content
  * @param array  $viewHelperArgumentLists
  * @return string
  */
 protected function processHelpersLink($templateMarkers, $content, $viewHelperArgumentLists)
 {
     foreach ($viewHelperArgumentLists as $viewHelperArgument) {
         $explodeViewHelperArguments = explode('|', $viewHelperArgument);
         $pid = $explodeViewHelperArguments[0] ? $explodeViewHelperArguments[0] : $GLOBALS['TSFE']->id;
         $additionalParameters = $explodeViewHelperArguments[1] ? \TYPO3\CMS\Core\Utility\GeneralUtility::explodeUrl2Array($explodeViewHelperArguments[1]) : array();
         $useCache = $explodeViewHelperArguments[2] ? true : false;
         $value = $this->misc->getURL($additionalParameters, $useCache, $pid);
         $content = \TYPO3\CMS\Core\Html\HtmlParser::substituteMarker($content, '###LINK:' . $viewHelperArgument . '###', $value);
     }
     return $content;
 }