Exemplo n.º 1
0
 public function componentSettings()
 {
     $articles = array();
     $categories = array();
     $_path_handle = opendir(THEBUGGENIE_MODULES_PATH . 'publish' . DS . 'fixtures' . DS);
     while ($article_name = readdir($_path_handle)) {
         if (mb_strpos($article_name, '.') === false) {
             if (mb_strpos($article_name, '%3A') !== false) {
                 $article_elements = explode('%3A', $article_name);
                 $category = array_shift($article_elements);
                 $categories[mb_strtolower($category)] = $category;
             } else {
                 $category = '';
             }
             $articles[$article_name] = array('exists' => TBGWikiArticle::doesArticleExist(urldecode($article_name)), 'category' => mb_strtolower($category));
         }
     }
     ksort($articles, SORT_STRING);
     $this->articles = $articles;
     $this->categories = $categories;
 }
Exemplo n.º 2
0
 protected function _parse_insert_template($matches)
 {
     switch ($matches[1]) {
         case 'CURRENTMONTH':
             return date('m');
         case 'CURRENTMONTHNAMEGEN':
         case 'CURRENTMONTHNAME':
             return date('F');
         case 'CURRENTDAY':
             return date('d');
         case 'CURRENTDAYNAME':
             return date('l');
         case 'CURRENTYEAR':
             return date('Y');
         case 'CURRENTTIME':
             return date('H:i');
         case 'NUMBEROFARTICLES':
             return 0;
         case 'PAGENAME':
             return TBGContext::getResponse()->getPage();
         case 'NAMESPACE':
             return 'None';
         case 'TOC':
             return isset($this->options['included']) ? '' : '{{TOC}}';
         case 'SITENAME':
         case 'SITETAGLINE':
             return TBGSettings::getTBGname();
         default:
             $details = explode('|', $matches[1]);
             $template_name = array_shift($details);
             if (substr($template_name, 0, 1) == ':') {
                 $template_name = substr($template_name, 1);
             }
             $template_name = TBGWikiArticle::doesArticleExist($template_name) ? $template_name : 'Template:' . $template_name;
             $template_article = TBGArticlesTable::getTable()->getArticleByName($template_name);
             $parameters = array();
             if (count($details)) {
                 foreach ($details as $parameter) {
                     $param = explode('=', $parameter);
                     if (count($param) == 2) {
                         $parameters[$param[0]] = $param[1];
                     } else {
                         $parameters[] = $parameter;
                     }
                 }
             }
             if ($template_article instanceof TBGWikiArticle) {
                 return tbg_parse_text($template_article->getContent(), false, null, array('included' => true, 'parameters' => $parameters));
             } else {
                 return $matches[0];
             }
     }
 }