/**
* Vector - Branch of MonoBook which has many usability improvements and
* somewhat cleaner code.
- *
+ *
* @todo document
* @file
* @ingroup Skins
*/
public function initPage( OutputPage $out ) {
global $wgStylePath, $wgJsMimeType, $wgStyleVersion;
-
+
parent::initPage( $out );
-
+
// Append skin-specific styles
$out->addStyle( 'vector/main-rtl.css', 'screen', '', 'rtl' );
$out->addStyle( 'vector/main-ltr.css', 'screen', '', 'ltr' );
'actions' => array(),
'variants' => array()
);
-
+
// Detects parameters
$action = $wgRequest->getVal( 'action', 'view' );
$section = $wgRequest->getVal( 'section' );
// Generates XML IDs from namespace names
$subjectId = $this->mTitle->getNamespaceKey( '' );
-
+
if ( $subjectId == 'main' ) {
$talkId = 'talk';
} else {
$talkId = "{$subjectId}_talk";
}
$currentId = $isTalk ? $talkId : $subjectId;
-
+
// Adds namespace links
$links['namespaces'][$subjectId] = $this->tabAction(
$subjectPage, 'vector-namespace-' . $subjectId, !$isTalk, '', true
$talkPage, 'vector-namespace-talk', $isTalk, '', true
);
$links['namespaces'][$talkId]['context'] = 'talk';
-
+
// Adds view view link
if ( $this->mTitle->exists() ) {
$links['views']['view'] = $this->tabAction(
'vector-view-view', ( $action == 'view' ), '', true
);
}
-
+
wfProfileIn( __METHOD__ . '-edit' );
-
+
// Checks if user can...
if (
// edit the current page
}
}
wfProfileOut( __METHOD__ . '-live' );
-
+
/**
* The following actions use messages which, if made particular to
* the Vector skin, would break the Ajax code which makes this
);
}
}
-
+
// This is instead of SkinTemplateTabs - which uses a flat array
wfRunHooks( 'SkinTemplateNavigation', array( &$this, &$links ) );
-
+
// If it's not content, it's got to be a special page
} else {
$links['namespaces']['special'] = array(
* @ingroup Skins
*/
class VectorTemplate extends QuickTemplate {
-
+
/* Members */
-
+
/**
* @var Cached skin object
*/
var $skin;
-
+
/* Functions */
-
+
/**
* Outputs the entire contents of the XHTML page
*/
public function execute() {
- global $wgRequest, $wgOut, $wgContLang;
-
+ global $wgRequest, $wgOut, $wgContLang, $wgDevelopmentWarnings;
+
$this->skin = $this->data['skin'];
$action = $wgRequest->getText( 'action' );
-
+
// Suppress warnings to prevent notices about missing indexes in
// $this->data (is this really the best way to handle this?)
- wfSuppressWarnings();
-
+ $wgDevelopmentWarnings && wfSuppressWarnings();
+
// Build additional attributes for navigation urls
$nav = $this->skin->buildNavigationUrls();
foreach ( $nav as $section => $links ) {
$this->data['variant_urls'] = $nav['variants'];
// Build additional attributes for personal_urls
foreach ( $this->data['personal_urls'] as $key => $item) {
- $this->data['personal_urls'][$key]['attributes'] =
+ $this->data['personal_urls'][$key]['attributes'] =
' id="' . Sanitizer::escapeId( "pt-$key" ) . '"';
if ( $item['active'] ) {
$this->data['personal_urls'][$key]['attributes'] .=
$this->data['personal_urls'][$key]['key'] =
$this->skin->tooltipAndAccesskey('pt-'.$key);
}
-
+
// Generate additional footer links
$footerlinks = array(
'info' => array(
</html>
<?php
// We're done with abusing arrays now...
- wfRestoreWarnings();
+ $wgDevelopmentWarnings && wfRestoreWarnings();
}
-
+
/**
* Render a series of portals
*/
echo "\n<!-- /{$name} -->\n";
}
}
-
+
/**
* Render one or more navigations elements by name, automatically reveresed
* when UI is in RTL mode
*/
private function renderNavigation( $elements ) {
global $wgContLang, $wgVectorUseSimpleSearch, $wgStylePath;
-
+
// If only one element was given, wrap it in an array, allowing more
// flexible arguments
if ( !is_array( $elements ) ) {
break;
}
echo "\n<!-- /{$name} -->\n";
- }
+ }
}
}