예제 #1
0
	/**
	 * Shortcut to get the Title object from the page
	 * @return Title
	 */
	final public function getTitle() {
		return $this->page->getTitle();
	}
 /**
  * Handler for CategoryPageView hook
  * Add JavaScript to the page if there are images in the category
  * @param CategoryPage $catPage
  * @return bool
  */
 public static function getModulesForCategory(&$catPage)
 {
     $title = $catPage->getTitle();
     $cat = Category::newFromTitle($title);
     if ($cat->getFileCount() > 0) {
         $out = $catPage->getContext()->getOutput();
         return self::getModules($out);
     }
     return true;
 }
예제 #3
0
         foreach ($cf->members as $f) {
             echo "  " . $f->getTitle() . " : " . $f->namespace . PHP_EOL;
             if (count($f->members) > 0) {
                 //fwrite($fFeatures, "\\fcwiki{" .getTexCommandName($f->getTitle()) . "}" . PHP_EOL);
                 foreach ($f->members as $fm) {
                     echo "  " . $fm->getTitle() . " : " . $f->namespace . PHP_EOL;
                     fwrite($fFeatures, "\\fwiki{" . getTexCommandName($fm->getTitle()) . "}" . PHP_EOL);
                 }
             } else {
                 fwrite($fFeatures, "\\fwiki{" . getTexCommandName($f->getTitle()) . "}" . PHP_EOL);
             }
         }
     }
     fclose($fFeatures);
     $fCategories = fopen($texFolder . "categories.tex", "w+");
     fwrite($fCategories, "\\cwiki{" . getTexCommandName($baseCat->getTitle()) . "}" . PHP_EOL);
     foreach ($baseCat->getFullCategoryTree() as $c) {
         if ($c->namespace == "Category") {
             fwrite($fCategories, "\\cwiki{" . getTexCommandName($c->getTitle()) . "}" . PHP_EOL);
         }
     }
     fclose($fCategories);
     $fPages = fopen($texFolder . "pages.tex", "w+");
     foreach ($allPages as $p) {
         if (strstr($p->getFullTitle(), ":") == FALSE) {
             fwrite($fPages, "\\pwiki{" . getTexCommandName($p->getTitle()) . "}" . PHP_EOL);
         }
     }
     fclose($fPages);
     //formatTex();
 } else {
예제 #4
0
 /**
  * @param CategoryPage $categoryPage
  * @return bool
  */
 public function onCategoryPageView(CategoryPage &$categoryPage)
 {
     $this->wf->profileIn(__METHOD__);
     if ($this->app->checkSkin('wikiamobile')) {
         //lets do some local caching
         $out = $this->wg->Out;
         $title = $categoryPage->getTitle();
         $text = $title->getText();
         //converting categoryArticle to Article to avoid circular reference in CategoryPage::view
         F::build('Article', array($title))->view();
         //add scripts that belongs only to category pages
         $scripts = F::build('AssetsManager', array(), 'getInstance')->getURL(array('wikiamobile_categorypage_js'));
         //this is going to be additional call but at least it won't be loaded on every page
         foreach ($scripts as $s) {
             $out->addScript('<script src="' . $s . '"></script>');
         }
         //set proper titles for a page
         $out->setPageTitle($text . ' <span id=catTtl>' . $this->wf->MsgForContent('wikiamobile-categories-tagline') . '</span>');
         $out->setHTMLTitle($text);
         //render lists: exhibition and alphabetical
         $params = array('categoryPage' => $categoryPage);
         $out->addHTML($this->app->renderView('WikiaMobileCategoryService', 'categoryExhibition', $params));
         $out->addHTML($this->app->renderView('WikiaMobileCategoryService', 'alphabeticalList', $params));
         $this->wf->profileOut(__METHOD__);
         return false;
     }
     $this->wf->profileOut(__METHOD__);
     return true;
 }