Exemplo n.º 1
0
 /**
  * Make a "what links here" link for a given title
  *
  * @param Title $title Title to make the link for
  * @param Skin $skin Skin to use
  * @param object $result Result row
  * @return string
  */
 private function makeWlhLink($title, $skin, $result)
 {
     global $wgLang;
     $wlh = SpecialPage::getTitleFor('Whatlinkshere');
     $label = wfMsgExt('nlinks', array('parsemag', 'escape'), $wgLang->formatNum($result->value));
     return $skin->link($wlh, $label, array(), array('target' => $title->getPrefixedText()));
 }
	/**
	 * Set a subtitle like "Manage > FreeCol (open source game) > German"
	 * based on group and language code. The language part is not shown if
	 * it is 'en', and all three possible parts of the subtitle are linked.
	 *
	 * @param $group MessageGroup
	 * @param $code \string Language code.
	 */
	protected function setSubtitle( $group, $code ) {
		global $wgLang;

		$links[] = $this->skin->link(
			$this->getTitle(),
			wfMsgHtml( 'translate-manage-subtitle' )
		);

		$links[] = $this->skin->link(
			$this->getTitle(),
			htmlspecialchars( $group->getLabel() ),
			array(),
			array( 'group' => $group->getId() )
		);

		// Do not show language part for English.
		if ( $code !== 'en' ) {
			$langname = TranslateUtils::getLanguageName( $code, false, $wgLang->getCode() );
			$links[] = $this->skin->link(
				$this->getTitle(),
				htmlspecialchars( $langname ),
				array(),
				array( 'group' => $group->getId(), 'language' => $code )
			);
		}

		$this->out->setSubtitle( implode( ' > ', $links ) );
	}
 /**
  * @param Skin $skin
  * @param Title $title
  * @param Revision $revision
  * @param Revision $undoAfterRevision
  * @return String Undo Link
  */
 public static function generateUndoLink($skin, $title, $revision, $undoAfterRevision)
 {
     if (!$revision instanceof Revision || !$undoAfterRevision instanceof Revision || !$title instanceof Title || !$skin instanceof Skin) {
         return null;
     }
     # Create undo tooltip for the first (=latest) line only
     $undoTooltip = $revision->isCurrent() ? array('title' => wfMsg('tooltip-undo')) : array();
     $undolink = $skin->link($title, wfMsgHtml('editundo'), $undoTooltip, array('action' => 'edit', 'undoafter' => $undoAfterRevision->getId(), 'undo' => $revision->getId()), array('known', 'noclasses'));
     return "<span class=\"mw-history-undo\">{$undolink}</span>";
 }
Exemplo n.º 4
0
 function authorLink($author, $extraParams = array())
 {
     $repo = $this->mRepo->getName();
     $special = SpecialPage::getTitleFor('Code', "{$repo}/author/{$author}");
     return $this->skin->link($special, htmlspecialchars($author), array(), $extraParams);
 }
Exemplo n.º 5
0
 function drawCategoryBrowser($tree, &$skin, $count = 0)
 {
     $return = '';
     $viewMode = WikihowCategoryViewer::getViewModeArray($this->getContext());
     foreach ($tree as $element => $parent) {
         /*
         if ($element == "Category:WikiHow" ||
         	$element == "Category:Featured-Articles" ||
         	$element == "Category:Honors") {
         		continue;
         }
         */
         $count++;
         $start = ' ' . self::BREADCRUMB_SEPARATOR;
         /*
         //not too many...
         if ($count > self::BREADCRUMB_LIMIT && !self::$bShortened) {
         	$return .= '<li class="bread_ellipsis"><span>'.$start.'</span> ... </li>';
         	self::$bShortened = true;
         	break;
         }
         */
         $eltitle = Title::NewFromText($element);
         if (empty($parent)) {
             # element start a new list
             $return .= "\n";
         } else {
             # grab the others elements
             $return .= $this->drawCategoryBrowser($parent, $skin, $count);
         }
         # add our current element to the list
         $return .= "<li>{$start} " . Skin::link($eltitle, $eltitle->getText(), array(), $viewMode) . "</li>";
     }
     return $return;
 }
 /**
  *
  * @param Skin $skin
  * @param File $result
  * @return string
  */
 function formatResult($skin, $result)
 {
     global $wgContLang, $wgLang;
     $nt = $result->getTitle();
     $text = $wgContLang->convert($nt->getText());
     $plink = $skin->link(Title::newFromText($nt->getPrefixedText()), $text);
     $userText = $result->getUser('text');
     $user = $skin->link(Title::makeTitle(NS_USER, $userText), $userText);
     $time = $wgLang->timeanddate($result->getTimestamp());
     return "{$plink} . . {$user} . . {$time}";
 }