Dalībnieks:84.237.185.135/Smilšu kaste

Vikipēdijas lapa
Jump to navigation Jump to search

%2F Wikipēdija LV

Laipni lūdzam Vikipēdijā,
brīvajā enciklopēdijā, kuru arī Tu vari papildināt!
Latviešu valodā ir [[Special:Statistics|NUMBEROFARTICLES Izteiksmes kļūda: Neatpazīts vārds "numberofarticles". raksti

       <?php

/**

* Mask skin stuff.
*
* @file
* @ingroup Skins
* @author Calimonius the Estrange
* @author Jack Phoenix
* @authors Whoever wrote monobook
* @date 2013
*/

if ( !defined( 'MEDIAWIKI' ) ) { die( -1 ); }

/**

* Inherit main code from SkinTemplate, set the CSS and template filter.
* @ingroup Skins
*/

class SkinMask extends SkinTemplate { public $skinname = 'mask', $stylename = 'mask', $template = 'MaskTemplate', $useHeadElement = true;

/** * @param $out OutputPage */ function setupSkinUserCss( OutputPage $out ) { global $wgFontCSSLocation; parent::setupSkinUserCss( $out );

# Add css $out->addModuleStyles( array ( 'mediawiki.skinning.content.externallinks', 'skins.mask' ) ); } }

/**

* Main skin class
* @ingroup Skins
*/

class MaskTemplate extends BaseTemplate {

/** * Template filter callback for Mask skin. * Takes an associative array of data set from a SkinTemplate-based * class, and a wrapper for MediaWiki's localization database, and * outputs a formatted page. * * @access private */ function execute() { global $wgHostLink;

// Suppress warnings to prevent notices about missing indexes in $this->data wfSuppressWarnings();

$this->html( 'headelement' );

?>

<a id="top"></a>

<?php if ( $this->data['sitenotice'] ) { ?>

<?php $this->html( 'sitenotice' ) ?>

<?php } ?>

<?php $this->msg( 'tagline' ) ?>

<div id="contentSub"<?php $this->html( 'userlangattributes' ) ?>> <?php $this->html( 'subtitle' ) ?>

<?php if ( $this->data['undelete'] ) { ?>

<?php $this->html( 'undelete' ) ?>

<?php } if ( $this->data['newtalk'] ) { ?>

<?php $this->html( 'newtalk' ) ?>

<?php } ?>

<?php $this->msg( 'jumpto' ) ?> <a href="#nav-container"><?php $this->msg( 'jumptonavigation' ) ?></a> <?php $this->msg( 'comma-separator' ) ?> <a href="#searchInput"><?php $this->msg( 'jumptosearch' ) ?></a>

<?php $this->html( 'bodytext' ) ?> <?php if ( $this->data['catlinks'] ) { $this->html( 'catlinks' ); } ?>

<?php if ( $this->data['dataAfterContent'] ) { $this->html( 'dataAfterContent' ); } ?>

<div id="tools-bottom"<?php $this->html( 'userlangattributes' ) ?>>

<?php $this->searchBox(); ?>

<span id="page-title" lang="<?php $this->data['pageLanguage'] = $this->getSkin()->getTitle()->getPageViewLanguage()->getHtmlCode(); $this->text( 'pageLanguage' ); ?>"><?php $this->html( 'title' ) ?> : <?php $this->cactions(); ?>

<?php $this->renderPortals( $this->data['sidebar'] ); ?>

<?php $this->printTrail(); echo Html::closeElement( 'body' ); echo Html::closeElement( 'html' ); wfRestoreWarnings(); } // end of execute() method

/*************************************************************************************************/

/** * Print arbitrary block of navigation * @param $linksMessage * @param $blockId * Message parsing is limited to first 4 lines only for this skin. */ private function renderNavigation( $linksMessage, $blockId ) { $message = trim( wfMessage( $linksMessage )->text() ); $lines = array_slice( explode( "\n", $message ), 0, 4 ); $links = array(); foreach ( $lines as $line ) { # ignore empty lines if ( strlen( $line ) == 0 ) { continue; } $links[] = $this->parseItem( $line ); }

$this->customBox( $blockId, $links ); }

/** * Extract the link text and destination (href) from a MediaWiki message * and return them as an array. */ private function parseItem( $line ) { $line_temp = explode( '|', trim( $line, '* ' ), 2 ); if ( count( $line_temp ) > 1 ) { $line = $line_temp[1]; $link = wfMessage( $line_temp[0] )->inContentLanguage()->text(); } else { $line = $line_temp[0]; $link = $line_temp[0]; }

// Determine what to show as the human-readable link description if ( wfMessage( $line )->isDisabled() ) { // It's *not* the name of a MediaWiki message, so display it as-is $text = $line; } else { // Guess what -- it /is/ a MediaWiki message! $text = wfMessage( $line )->text(); }

if ( $link != null ) { if ( wfMessage( $line_temp[0] )->isDisabled() ) { $link = $line_temp[0]; } if ( preg_match( '/^(?:' . wfUrlProtocols() . ')/', $link ) ) { $href = $link; } else { $title = Title::newFromText( $link ); if ( $title ) { $title = $title->fixSpecialName(); $href = $title->getLocalURL(); } else { $href = '#'; } } }

return array( 'text' => $text, 'href' => $href ); }

/** * @param $sidebar array */ protected function renderPortals( $sidebar ) { $sidebar['SEARCH'] = false; $sidebar['TOOLBOX'] = false; $sidebar['LANGUAGES'] = false;

foreach ( $sidebar as $boxName => $content ) { if ( $content === false ) { continue; }

$this->customBox( $boxName, $content ); } }

function searchBox() { ?>

<?php }

/** * Prints the cactions bar. * Shared between Monobook and Modern and stolen for mask */ function cactions() { ?>

<?php }

/*************************************************************************************************/ /** * @param $bar string * @param $cont array|string */ function customBox( $bar, $cont ) { $portletAttribs = array( 'class' => 'generated-sidebar portlet', 'id' => Sanitizer::escapeId( "p-$bar" ), 'role' => 'navigation' ); $tooltip = Linker::titleAttrib( "p-$bar" ); if ( $tooltip !== false ) { $portletAttribs['title'] = $tooltip; } echo ' ' . Html::openElement( 'div', $portletAttribs ); $msgObj = wfMessage( $bar ); ?>

<?php echo htmlspecialchars( $msgObj->exists() ? $msgObj->text() : $bar ); ?>

<?php if ( is_array( $cont ) ) { ?>

    <?php foreach ( $cont as $key => $val ) { echo $this->makeListItem( $key, $val ); } ?>

<?php } else { # allow raw HTML block to be defined by extensions print $cont; } ?>

<?php }

/*************************************************************************************************/ /** * Get URL to the logo image, either a custom one * (Attēls:Aurora-skin-logo.png) or a "sane default" if a custom logo * doesn't exist. * * @return String: logo image URL */ function getLogoURL() { global $wgStylePath;

$s = ; // If there is a custom logo, display it; otherwise show the skin's // default logo image $logo = wfFindFile( 'Mask_skin_coin.png' ); if ( is_object( $logo ) ) { $s .= $logo->getUrl(); } else { $s .= $wgStylePath . '/Mask/resources/images/skull-coin.png'; }

return $s; } } // end of class

Navigācijas izvēlne