コード例 #1
0
 public function rssFeedAction($path)
 {
     $this->setPath($path);
     $dbfile = new DocBookFile($this->getpath());
     $tpl_params = array('page' => $dbfile->getDocBookFullStack(), 'breadcrumbs' => Helper::getBreadcrumbs($this->getPath()));
     $tpl_params['title'] = Helper::buildPageTitle($this->getPath());
     if (empty($tpl_params['title'])) {
         if (!empty($tpl_params['breadcrumbs'])) {
             $tpl_params['title'] = Helper::buildPageTitle(end($tpl_params['breadcrumbs']));
         } else {
             $tpl_params['title'] = _T('Home');
         }
     }
     FrontController::getInstance()->getResponse()->setContentType('xml');
     $page = $dbfile->getDocBookStack();
     if ($dbfile->isDir()) {
         $contents = Helper::getFlatDirscans($dbfile->getDocBookScanStack(true), true);
         foreach ($contents['dirscan'] as $i => $item) {
             if ($item['type'] !== 'dir' && file_exists($item['path'])) {
                 $dbfile = new DocBookFile($item['path']);
                 $contents['dirscan'][$i]['content'] = $dbfile->viewIntroduction(4000, false);
             }
         }
     } else {
         $page['content'] = $dbfile->viewIntroduction(4000, false);
     }
     $rss_content = $this->docbook->display('', 'rss', array('page' => $page, 'contents' => $contents));
     return array('layout_empty_xml', $rss_content);
 }