コード例 #1
0
 /**
  * Prints an array of posts.
  * This function prints an array of posts that are to be listed in the RSS
  * feed.
  * @param  array  $posts A numeric array of all posts that shall be listed in the
  *                RSS
  * @return string The RSS feed as XML string
  */
 function printPosts($posts)
 {
     $template = $this->cObj->fileResource($this->conf['template.']['rss']);
     $template = $this->cObj->getSubpart($template, '###RSS_FEED###');
     $rowTemplate = $this->cObj->getSubpart($template, '###RSS_POST_ITEM###');
     // Include hooks
     if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['mm_forum']['forum']['rss_posts'])) {
         foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['mm_forum']['forum']['rss_posts'] as $_classRef) {
             $_procObj =& GeneralUtility::getUserObj($_classRef);
             $marker = $_procObj->rss_posts($posts, $this);
         }
     }
     // TODO: FIXME undefined variables $mode, $param
     $marker = array('###RSS_ENCODING###' => $GLOBALS['TSFE']->renderCharset, '###RSS_TITLE###' => '<![CDATA[' . $this->getFeedTitle($mode, $param) . ']]>', '###RSS_DESCRIPTION###' => $this->getFeedDescription(), '###RSS_URL###' => $this->pObj->escapeURL($this->getFeedURL()), '###RSS_GENERATOR###' => 'mm_forum powered by TYPO3', '###RSS_LASTBUILT###' => date('r'), '###RSS_LANGUAGE###' => $this->pObj->LLkey == 'default' ? 'en' : $this->pObj->LLkey);
     // Include hooks
     if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['mm_forum']['forum']['rss_globalMarkers'])) {
         foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['mm_forum']['forum']['rss_globalMarkers'] as $_classRef) {
             $_procObj =& GeneralUtility::getUserObj($_classRef);
             $marker = $_procObj->rss_globalMarkers($marker, $posts, $this);
         }
     }
     $template = $this->cObj->substituteMarkerArray($template, $marker);
     $rowContent = '';
     foreach ($posts as $post) {
         $rowMarker = array('###RSS_TOPIC_NAME###' => $this->pObj->escape($post['topic_title']), '###RSS_POST_LINK###' => $this->getPostLink($post['post_uid']), '###RSS_POST_DATE###' => date('r', $post['post_time']), '###RSS_POST_TEXT_SHORT###' => $this->getPostTextShort($post['post_text']), '###RSS_POST_TEXT###' => $this->getPostTextComplete($post['post_text']), '###RSS_FORUM_NAME###' => $this->pObj->escape($post['forum_name']), '###RSS_POST_AUTHOR###' => $this->pObj->escape($post[$this->conf['userNameField'] ? $this->conf['userNameField'] : 'username']));
         $rowContent .= $this->cObj->substituteMarkerArray($rowTemplate, $rowMarker);
         // Include hooks
         if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['mm_forum']['forum']['rss_itemMarkers'])) {
             foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['mm_forum']['forum']['rss_itemMarkers'] as $_classRef) {
                 $_procObj =& GeneralUtility::getUserObj($_classRef);
                 $rowMarker = $_procObj->rss_itemMarkers($marker, $post, $this);
             }
         }
     }
     $template = $this->cObj->substituteSubpart($template, '###RSS_POST_ITEM###', $rowContent);
     return $template;
 }