Exemple #1
0
 /**
  * @deprecated since 1.16 Use link()
  *
  * Make a red link to the edit page of a given title.
  *
  * @param $title Title object of the target page
  * @param $text  String: Link text
  * @param $query String: Optional query part
  * @param $trail String: Optional trail. Alphabetic characters at the start of this string will
  *                      be included in the link text. Other characters will be appended after
  *                      the end of the link.
  * @param $prefix String: Optional prefix
  */
 static function makeBrokenLinkObj($title, $text = '', $query = '', $trail = '', $prefix = '')
 {
     wfDeprecated(__METHOD__, '1.16');
     wfProfileIn(__METHOD__);
     list($inside, $trail) = self::splitTrail($trail);
     if ($text === '') {
         $text = self::linkText($title);
     }
     # wikia change begin
     global $wgWikiaEnableSharedHelpExt;
     if ($wgWikiaEnableSharedHelpExt && NS_HELP == $title->getNamespace() && SharedHelpArticleExists($title)) {
         wfProfileOut(__METHOD__);
         return self::link($title, "{$prefix}{$text}{$inside}", array(), wfCgiToArray($query), 'known') . $trail;
     }
     $attribs = array();
     global $wgWikiaUseNoFollow, $wgWikiaEnableAutoPageCreateExt;
     $condition = !empty($wgWikiaUseNoFollow) && (empty($wgWikiaEnableAutoPageCreateExt) && !empty($wgWikiaUseNoFollowForContent) || !$title->isContentPage());
     if ($condition) {
         $attribs['rel'] = 'nofollow';
     }
     # wikia change end
     $ret = self::link($title, "{$prefix}{$text}{$inside}", $attribs, wfCgiToArray($query), 'broken') . $trail;
     wfProfileOut(__METHOD__);
     return $ret;
 }
Exemple #2
0
function SharedHelpLinkBegin($skin, $target, &$text, &$customAttribs, &$query, &$options, &$ret)
{
    global $wgTitle;
    // First do simple checks before going to more expensive ones
    if ($target->getNamespace() == NS_HELP && isset($wgTitle) && !$wgTitle->isSpecial('Wantedpages')) {
        if (SharedHelpArticleExists($target)) {
            // The link is known
            $options[] = 'known';
            // ...and not broken
            $key = array_search('broken', $options);
            if ($key !== false) {
                unset($options[$key]);
            }
        }
    }
    return true;
}
 /**
  * @param $article Article
  *
  * @return bool
  */
 public static function onBeforeDisplayNoArticleText($article)
 {
     wfProfileIn(__METHOD__);
     if (F::app()->checkSkin('wikiamobile')) {
         $title = $article->getTitle();
         $ns = $title->getNamespace();
         if ($ns == NS_USER) {
             //if user exists and it is not subpage display masthead
             //otherwise show 404 page
             $user = User::newFromName($title->getBaseText());
             if ($user instanceof User && $user->getId() > 0 && !$title->isSubpage()) {
                 wfProfileOut(__METHOD__);
                 return true;
             }
         } else {
             if ($ns == NS_CATEGORY) {
                 //if it is a category that has some pages display it as well
                 $category = Category::newFromTitle($title);
                 if ($category instanceof Category && $category->getPageCount() + $category->getSubcatCount() + $category->getFileCount() > 0) {
                     wfProfileOut(__METHOD__);
                     return true;
                 }
                 //Do not show error on non-blank help pages (including shared help)
             } else {
                 if ($ns == NS_HELP && ($title->isKnown() || is_callable('SharedHelpArticleExists') && SharedHelpArticleExists($title))) {
                     wfProfileOut(__METHOD__);
                     return true;
                 }
             }
         }
         WikiaMobileErrorService::$displayErrorPage = true;
     }
     wfProfileOut(__METHOD__);
     return true;
 }