diff --git a/DeepSea.php b/DeepSea.php index 87af547..bc9053a 100644 --- a/DeepSea.php +++ b/DeepSea.php @@ -1,627 +1,58 @@ __FILE__, 'name' => 'Deep Sea', - 'author' => array('UltrasonicNXT', 'modified from Vector (Trevor Parscal', - 'Roan Kattouw', 'Nimish Gautam', 'Adam Miller)'), - 'descriptionmsg' => 'desc', + 'author' => array( 'UltrasonicNXT', 'modified from Vector (Trevor Parscal', + 'Roan Kattouw', 'Nimish Gautam', 'Adam Miller)' ), + 'descriptionmsg' => 'deepsea-desc', 'url' => "url", -);*/ +); -/** - * SkinTemplate class for Deep Sea skin - * @ingroup Skins - */ -class SkinDeepSea extends SkinTemplate { - - var $skinname = 'deepsea', $stylename = 'deepsea', - $template = 'DeepSeaTemplate', $useHeadElement = true; - - /** - * Initializes output page and sets up skin-specific parameters - * @param $out OutputPage object to initialize - */ - public function initPage( OutputPage $out ) { - global $wgLocalStylePath; - - parent::initPage( $out ); +// Autoload the skin class, make it a valid skin, set up i18n, set up CSS & JS +// (via ResourceLoader) +$skinID = basename( dirname( __FILE__ ) ); +$dir = dirname( __FILE__ ) . '/'; - // Append CSS which includes IE only behavior fixes for hover support - - // this is better than including this in a CSS fille since it doesn't - // wait for the CSS file to load before fetching the HTC file. - $min = $this->getRequest()->getFuzzyBool( 'debug' ) ? '' : '.min'; - $out->addHeadItem( 'csshover', - '" - ); - $out->addMeta('viewport', 'width=device-width'); - - $out->addModuleScripts( 'skins.deepsea' ); - - $path = $wgLocalStylePath; - $screen = array( - 'href' => "$path/deepsea/screen.css", - 'rel' => 'stylesheet', - 'type' => 'text/css', - 'media' => 'only screen' - ); - //$out->addLink($screen); - //$out->addLink($big); - - addTopElements($out); - } - - /** - * Load skin and user CSS files in the correct order - * fixes bug 22916 - * @param $out OutputPage object - */ - function setupSkinUserCss( OutputPage $out ){ - parent::setupSkinUserCss( $out ); - $out->addModuleStyles( 'skins.deepsea' ); - - global $wgUser; - $user = $wgUser->getName(); - $globalcss = "meta.brickimedia.org/index.php/User:$user/global.css"; - $wgResourceModules['skins.deepsea']['styles'][$globalcss] = array( 'media' => 'screen' ); - } -} +// The first instance must be strtolower()ed so that useskin=deepsea works and +// so that it does *not* force an initial capital (i.e. we do NOT want +// useskin=DeepSea) and the second instance is used to determine the name of +// *this* file. +$wgValidSkinNames[strtolower( $skinID )] = 'DeepSea'; +$wgAutoloadClasses['SkinDeepSea'] = $dir . 'DeepSea.skin.php'; +$wgAutoloadClasses['DeepSeaTemplate'] = $dir . 'DeepSea.skin.php'; +$wgExtensionMessagesFiles['SkinDeepSea'] = $dir . 'DeepSea.i18n.php'; $wgHooks['OutputPageBodyAttributes'][] = 'DeepSeaTemplate::addToBody'; -/** - * QuickTemplate class for Deep sea skin - * @ingroup Skins - */ -class DeepSeaTemplate extends BaseTemplate { - - /* Functions */ - - /** - * Outputs the entire contents of the (X)HTML page - */ - - public function execute() { - - addBottomElements($this); - - global $wgVectorUseIconWatch; - - // Build additional attributes for navigation urls - $nav = $this->data['content_navigation']; - - if ( $wgVectorUseIconWatch ) { - $mode = $this->getSkin()->getTitle()->userIsWatching() ? 'unwatch' : 'watch'; - if ( isset( $nav['actions'][$mode] ) ) { - $nav['views'][$mode] = $nav['actions'][$mode]; - $nav['views'][$mode]['class'] = rtrim( 'icon ' . $nav['views'][$mode]['class'], ' ' ); - $nav['views'][$mode]['primary'] = true; - unset( $nav['actions'][$mode] ); - } - } - - $xmlID = ''; - foreach ( $nav as $section => $links ) { - foreach ( $links as $key => $link ) { - if ( $section == 'views' && !( isset( $link['primary'] ) && $link['primary'] ) ) { - $link['class'] = rtrim( 'collapsible ' . $link['class'], ' ' ); - } - - $xmlID = isset( $link['id'] ) ? $link['id'] : 'ca-' . $xmlID; - $nav[$section][$key]['attributes'] = - ' id="' . Sanitizer::escapeId( $xmlID ) . '"'; - if ( $link['class'] ) { - $nav[$section][$key]['attributes'] .= - ' class="' . htmlspecialchars( $link['class'] ) . '"'; - unset( $nav[$section][$key]['class'] ); - } - if ( isset( $link['tooltiponly'] ) && $link['tooltiponly'] ) { - $nav[$section][$key]['key'] = - Linker::tooltip( $xmlID ); - } else { - $nav[$section][$key]['key'] = - Xml::expandAttributes( Linker::tooltipAndAccesskeyAttribs( $xmlID ) ); - } - } - } - $this->data['namespace_urls'] = $nav['namespaces']; - $this->data['view_urls'] = $nav['views']; - $this->data['action_urls'] = $nav['actions']; - $this->data['variant_urls'] = $nav['variants']; - - // Reverse horizontally rendered navigation elements - if ( $this->data['rtl'] ) { - $this->data['view_urls'] = - array_reverse( $this->data['view_urls'] ); - $this->data['namespace_urls'] = - array_reverse( $this->data['namespace_urls'] ); - $this->data['personal_urls'] = - array_reverse( $this->data['personal_urls'] ); - } - - //Get rid of studs if not wanted - $studs = true; - - // AD CODES ============================================== - //$ad: 0 = none; 1 = side; 2 = bottom; - $haveAds = true; - if($_SERVER['SERVER_NAME'] == "adams-site.x10.mx"){ - $haveAds = false; - } - global $IP; - require_once( $IP . '/extensions/MobileDetect/MobileDetect.php' ); - - if(mobiledetect()){ - $haveAds = false; - } - - if ($haveAds){ - $body = $this->data['bodycontent']; - - if (strlen($body) > 4000){ - $ad = 1; - } else { - $ad = 2; - } - } else { - $ad = 0; - } - - // Output HTML Page - $this->html( 'headelement' ); -?> -
-
- -
- > -
- -
- - - data['sitenotice'] ): ?> - -
html( 'sitenotice' ) ?>
- - - -

- html( 'title' ) ?> -

- - -
- data['isarticle'] ): ?> - -
msg( 'tagline' ) ?>
- - - -
html( 'userlangattributes' ) ?>>html( 'subtitle' ) ?>
- - data['undelete'] ): ?> - -
html( 'undelete' ) ?>
- - - data['newtalk'] ): ?> - -
html( 'newtalk' ) ?>
- - - data['showjumplinks'] ): ?> - - - - - - html('bodycontent'); ?> - - data['printfooter'] ): ?> - -
- html( 'printfooter' ); ?> -
- - - data['catlinks'] ): ?> - - html( 'catlinks' ); ?> - - - data['dataAfterContent'] ): ?> - - html( 'dataAfterContent' ); ?> - - -
- - html( 'debughtml' ); ?> - -
- -
- -
- renderNavigation( 'MEDIA' ); ?> - renderNavigation( 'PERSONAL' ); ?> -
- renderNavigation( array( 'NAMESPACES', 'VARIANTS' ) ); ?> -
-
- renderNavigation( array( 'VIEWS', 'ACTIONS', 'SEARCH' ) ); ?> -
-
- -
- - - renderPortals( $this->data['sidebar'] ); ?> -
- -
Advertisement
-
-
- - -
-
- -
-
- - - - printTrail(); ?> - - - - $content ) { - if ( $content === false ) - continue; - - echo "\n\n"; - switch( $name ) { - case 'SEARCH': - break; - case 'TOOLBOX': - $this->renderPortal( 'tb', $this->getToolbox(), 'toolbox', 'SkinTemplateToolboxEnd' ); - break; - case 'LANGUAGES': - if ( $this->data['language_urls'] ) { - $this->renderPortal( 'lang', $this->data['language_urls'], 'otherlanguages' ); - } - break; - default: - $this->renderPortal( $name, $content ); - break; - } - echo "\n\n"; - } - } - - private function renderPortal( $name, $content, $msg = null, $hook = null ) { - if ( $msg === null ) { - $msg = $name; - } - ?> -
> -
html( 'userlangattributes' ) ?>>exists() ? $msgObj->text() : $msg ); ?>
-
- - - - - -
-
-data['rtl'] ) { - $elements = array_reverse( $elements ); - } - // Render elements - foreach ( $elements as $name => $element ) { - echo "\n\n"; - switch ( $element ) { - case 'NAMESPACES': -?> -
html( 'userlangattributes' ) ?>> -
msg( 'namespaces' ) ?>
- data['namespace_urls'] as $link ): ?> -
  • >>
  • - -
    - -
    -

    - data['variant_urls'] as $link ): ?> - - - - -

    -
    msg( 'variants' ) ?>
    - -
    - -
    html('userlangattributes') ?>> -
    msg('views') ?>
    - data['view_urls'] as $link ): ?> - >>' : htmlspecialchars( $link['text'] ); - } - ?> - -
    -data; - echo hi; - case 'ACTIONS': -?> -
    -
    msg( 'actions' ) ?>
    - -
    - -
    -
    msg( 'personaltools' ) ?>
    - html( 'userlangattributes' ) ?>> -getPersonalTools() as $key => $item ) { ?> - makeListItem( $key, $item ); ?> - - - -
    - -