Ejemplo n.º 1
0
 /**
  * skinTemplateOutputPageBeforeExec hook
  * 
  * Cooks the skin template Seizam-Style!
  * 
  * @param SkinSkinzam $skin
  * @param SkinzamTemplate $tpl
  */
 public static function skinTemplateOutputPageBeforeExec(&$skin, &$tpl)
 {
     $background['url'] = false;
     $navigation['content'] = false;
     $title = $skin->getRelevantTitle();
     $ns = $title->getNamespace();
     if (WpPage::isInWikiplaceNamespaces($ns)) {
         $explosion = WpWikiplace::explodeWikipageKey($title->getText(), $ns);
         $wikiplaceKey = $explosion[0];
         // Wikiplace Background?g|png|gif)$/i';
         $background['url'] = self::getBackgroundUrlForWikiPlace($wikiplaceKey);
         // Wikiplace Navigation Menu
         $navigationKey = $wikiplaceKey . '/' . WPNAVIGATIONKEY;
         /** @todo i18n */
         $navigationTitle = Title::newFromText($navigationKey, NS_WIKIPLACE);
         $navigationPage = WikiPage::factory($navigationTitle);
         $navigationText = $navigationPage->getText();
         if ($navigationText) {
             $navigationArticle = Article::newFromTitle($navigationTitle, $skin->getContext());
             $navigation['content'] = $navigationArticle->getOutputFromWikitext($navigationText)->getText();
         }
     } else {
         $background['url'] = self::getBackgroundUrlForOther($title);
     }
     $tpl->set('wp_background', $background);
     $tpl->set('wp_navigation', $navigation);
     return true;
 }
Ejemplo n.º 2
0
 function formatPageTitle($value)
 {
     $title = Title::makeTitle($this->mCurrentRow->page_namespace, $value);
     $ns = $title->getNamespace();
     $explosion = WpWikiplace::explodeWikipageKey($title->getText(), $ns);
     $excount = count($explosion);
     $text = '';
     // Page is in NS_MAIN
     if ($ns == NS_MAIN || $ns == NS_WIKIPLACE) {
         if ($ns == NS_WIKIPLACE) {
             $text .= '<span class="wpp-ns">' . $title->getNsText() . ':</span>';
         }
         // Homepage
         if ($excount == 1) {
             if ($ns == NS_MAIN) {
                 $text .= '<span class="wpp-hp">' . $explosion[0] . '</span>';
             } else {
                 $text .= '<span class="wpp-sp">' . $explosion[0] . '</span>';
             }
             // Subpage
         } else {
             // Language variant
             if (strlen($explosion[$excount - 1]) == 2) {
                 $lang = $explosion[$excount - 1];
                 array_pop($explosion);
             }
             // Extracting wikiplace base
             $text .= '<span class="wpp-sp-hp">' . $explosion[0] . '</span>';
             array_shift($explosion);
             // Reconstructing Page title
             $text .= '<span class="wpp-sp">';
             foreach ($explosion as $atom) {
                 $text .= '/' . $atom;
             }
             $text .= '</span>';
             // Appending Lang variant
             if (isset($lang)) {
                 $text .= '<span class="wpp-sp-lg">/' . $lang . '</span>';
             }
         }
         // Page is NS_FILE
     } else {
         if ($title->getNamespace() == NS_FILE) {
             $text .= '<span class="wpp-ns">' . $title->getNsText() . ':</span>';
             // @TODO: Extract file extension and lang variant for prettyfying
             //
             // Extracting wikiplace base
             $text .= '<span class="wpp-sp-hp">' . $explosion[0] . '</span>';
             array_shift($explosion);
             // Reconstructing Page title
             $text .= '<span class="wpp-sp">';
             foreach ($explosion as $atom) {
                 $text .= '.' . $atom;
             }
             $text .= '</span>';
         } else {
             $text .= '<span class="wpp-ns">' . $title->getNsText() . ':</span>';
             $text .= '<span class="wpp-sp">' . $title->getText() . '</span>';
         }
     }
     return Linker::linkKnown($title, $text, array(), array('redirect' => 'no'));
 }
Ejemplo n.º 3
0
 /**
  *
  * @param int $namespace
  * @param string $db_key
  * @return boolean 
  */
 public static function isAdmin($namespace, $db_key)
 {
     if (!($namespace == NS_FILE) && !($namespace == NS_FILE_TALK)) {
         return false;
     }
     $exploded = WpWikiplace::explodeWikipageKey($db_key, $namespace);
     return $exploded[0] == WP_ADMIN_FILE_PREFIX;
 }