From e31e6c0eec3bb0374b8f030a2482707efda2824f Mon Sep 17 00:00:00 2001 From: Carl Schwan Date: Wed, 15 Apr 2020 21:57:06 +0200 Subject: [PATCH] Use aether-sidebar --- AetherTemplate.php | 925 +++++++++++++++++++++------------------------ 1 file changed, 441 insertions(+), 484 deletions(-) diff --git a/AetherTemplate.php b/AetherTemplate.php index ce87f47..05bea51 100644 --- a/AetherTemplate.php +++ b/AetherTemplate.php @@ -1,6 +1,4 @@ data['content_navigation']; + // Build additional attributes for navigation urls + $nav = $this->data['content_navigation']; - if ( $this->config->get( 'AetherUseIconWatch' ) ) { - $mode = $this->getSkin()->getUser()->isWatched( $this->getSkin()->getRelevantTitle() ) - ? 'unwatch' - : 'watch'; + if ( $this->config->get( 'AetherUseIconWatch' ) ) { + $mode = $this->getSkin()->getUser()->isWatched( $this->getSkin()->getRelevantTitle() ) + ? '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] ); - } - } + 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 = ''; + $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'], ' ' ); - } + 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 ) . '"'; + $xmlID = isset($link['id']) ? $link['id'] : 'ca-' . $xmlID; + $nav[$section][$key]['attributes'] = ' id="' . Sanitizer::escapeId( $xmlID ) . '"'; - if ( $link['class'] ) { - $nav[$section][$key]['attributes'] = $nav[$section][$key]['attributes'] . - ' class="' . htmlspecialchars( $link['class'] ) . '"'; - $nav[$section][$key]['class'] = ''; - } + if ($link['class']) { + $nav[$section][$key]['attributes'] = $nav[$section][$key]['attributes'] . + ' class="' . htmlspecialchars( $link['class'] ) . '"'; + $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 ) ); - } - } + 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']; + $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'] ); - } - // Output HTML Page - $this->html( 'headelement' ); - ?> + // 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'] ); + } -
- + // Output HTML Page + $this->html( 'headelement' ); +?> + +
+
+
-
- -
- - - data['sitenotice'] ): ?> - -
- html( 'sitenotice' ) ?> -
- - - - -
- - renderNavigation( array( 'VIEWS', 'ACTIONS' ) ); ?> - - - -

- html( 'title' ) ?> -

- - - -
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' ); ?> - - - - getFooterLinks() as $category => $links ): - if ( $category == 'info' ): - ?> -
-
- - html( $link ) ?> - -
- - -
- - - - - + +
+ + + data['sitenotice'] ): ?> +
+ html( 'sitenotice' ) ?> +
+ + +
html( 'userlangattributes' ) ?>>html( 'subtitle' ) ?>
+ + data['undelete'] ): ?> +
html( 'undelete' ) ?>
+ - -
+ data['newtalk'] ): ?> +
html( 'newtalk' ) ?>
+ - - + +
+ + 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"; - } + if (!isset( $portals['TOOLBOX'])) { + $portals['TOOLBOX'] = true; } + if (!isset( $portals['LANGUAGES'])) { + $portals['LANGUAGES'] = true; + } + // Render portals + foreach ($portals as $name => $content) { + if ($content === false) { + continue; + } + + 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; + } + } + } - protected function renderPortal( $name, $content, $msg = null, $hook = null ) { - if ( $msg === null ) { - $msg = $name; - } - - ?> -
  • > - exists() ? $msgObj->text() : $msg ); ?> -
  • + protected function renderPortal($name, $content, $msg = null, $hook = null) { + if ( $msg === null ) { + $msg = $name; + } + ?> + + data['rtl'] ) { + $elements = array_reverse( $elements ); } - - /** - * Render one or more navigations elements by name, automatically reveresed - * when UI is in RTL mode - * - * @param $elements array - */ - private function renderNavigation( $elements ) { - global $wgNeverlandUseSimpleSearch; - - // If only one element was given, wrap it in an array, allowing more - // flexible arguments - if ( !is_array( $elements ) ) { - $elements = array( $elements ); - // If there's a series of elements, reverse them when in RTL mode - } elseif ( $this->data['rtl'] ) { - $elements = array_reverse( $elements ); - } - // Render elements - foreach ( $elements as $name => $element ) { - echo "\n\n"; - switch ( $element ) { - case 'NAMESPACES': - if ( count( $this->data['namespace_urls'] ) > 0 ) { - foreach ( $this->data['namespace_urls'] as $link ) { - if ( stripos( $link['attributes'], 'selected' ) === false ) { ?> - - - - data['variant_urls'] ) > 0 ) { ?> -
  • - msg( 'variants' ) ?> -
  • - - data['variant_urls'] as $link ) { ?> -
  • > - > - - -
  • - -
    - data['view_urls'] ) > 0 ) { - foreach ( $this->data['view_urls'] as $link ) { ?> - '; - - if ( array_key_exists( 'text', $link ) ) { ?> - - 1 ) { - echo htmlspecialchars( $link['text'] ); - } - } - echo ''; - } - } - break; - - case 'ACTIONS': - if ( count( $this->data['action_urls'] ) > 0 ) { - ?> - - - - -
    - data['personal_urls'] ) > 0 ) { - ?> -
  • - msg( 'personaltools' ) ?> -
  • - - getPersonalTools() as $key => $item ) { ?> - makeListItem( $key, $item ); ?> - - -
    - data['search'] ) ): ?> - value="text( 'search' ) ?>" - /> - - -
    - $element ) { + switch ( $element ) { + case 'NAMESPACES': + if (count( $this->data['namespace_urls'] ) > 0) { + foreach ( $this->data['namespace_urls'] as $link ) { + if ( stripos( $link['attributes'], 'selected' ) === false ) { ?> +
  • + > + + +
  • + +
  • + +
  • + \n"; + } + break; + + case 'VARIANTS': + if ( count( $this->data['variant_urls'] ) > 0 ) { ?> + + data['view_urls'] ) > 0 ) { + foreach ( $this->data['view_urls'] as $link ) { ?> +
  • + 1) { + echo htmlspecialchars( $link['text'] ); + } else if (strlen($link['text']) > 1) { ?> + + + + +
  • + data['action_urls'] as $link) { ?> + href="" > + + + data['personal_urls'] ) > 0 ) { + ?> + + +
    + data['search'] ) ): ?> + value="text( 'search' ) ?>" + /> + + +
    +