// We're on a preview of a JS subpage
// Exclude this page from the user module in case it's in there (bug 26283)
$scripts .= $this->makeResourceLoaderLink( 'user', ResourceLoaderModule::TYPE_SCRIPTS, false,
- array( 'excludepage' => $this->getTitle()->getPrefixedText() )
+ array( 'excludepage' => $this->getTitle()->getPrefixedDBkey() )
);
// Load the previewed JS
$scripts .= Html::inlineScript( "\n" . $this->getRequest()->getText( 'wpTextbox1' ) . "\n" ) . "\n";
// We're on a preview of a CSS subpage
// Exclude this page from the user module in case it's in there (bug 26283)
$otherTags .= $this->makeResourceLoaderLink( 'user', ResourceLoaderModule::TYPE_STYLES, false,
- array( 'excludepage' => $this->getTitle()->getPrefixedText() )
+ array( 'excludepage' => $this->getTitle()->getPrefixedDBkey() )
);
// Load the previewed CSS
- $otherTags .= Html::inlineStyle( $this->getRequest()->getText( 'wpTextbox1' ) );;
+ $otherTags .= Html::inlineStyle( $this->getRequest()->getText( 'wpTextbox1' ) );
} else {
// Load the user styles normally
$moduleStyles[] = 'user';
*/
protected function getPages( ResourceLoaderContext $context ) {
if ( $context->getUser() ) {
+ // Get the normalized title of the user's user page
$username = $context->getUser();
+ $userpageTitle = Title::makeTitleSafe( NS_USER, $username );
+ $userpage = $userpageTitle->getPrefixedDBkey(); // Needed so $excludepages works
+
$pages = array(
- "User:$username/common.js" => array( 'type' => 'script' ),
- "User:$username/" . $context->getSkin() . '.js' =>
+ "$userpage/common.js" => array( 'type' => 'script' ),
+ "$userpage/" . $context->getSkin() . '.js' =>
array( 'type' => 'script' ),
- "User:$username/common.css" => array( 'type' => 'style' ),
- "User:$username/" . $context->getSkin() . '.css' =>
+ "$userpage/common.css" => array( 'type' => 'style' ),
+ "$userpage/" . $context->getSkin() . '.css' =>
array( 'type' => 'style' ),
);
// parameter will be set to the name of the page we need to exclude.
$excludepage = $context->getRequest()->getVal( 'excludepage' );
if ( isset( $pages[$excludepage] ) ) {
+ // This works because $excludepage is generated with getPrefixedDBkey(),
+ // just like the keys in $pages[] above
unset( $pages[$excludepage] );
}
return $pages;