summaryrefslogtreecommitdiff
path: root/includes/resourceloader/ResourceLoaderUserModule.php
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@sbcglobal.net>2016-05-01 15:30:02 -0400
committerLuke Shumaker <lukeshu@sbcglobal.net>2016-05-01 15:30:02 -0400
commit1de335ad3f395ca6861085393ba366a9e3fb4a0d (patch)
treef1fdd326034e05177596851be6a7127615d81498 /includes/resourceloader/ResourceLoaderUserModule.php
parent9c75fa8ff6d4d38ef552c00fef5969fb154765e8 (diff)
parentf6d65e533c62f6deb21342d4901ece24497b433e (diff)
Merge commit 'f6d65'
# Conflicts: # skins/ArchLinux/ArchLinux.php
Diffstat (limited to 'includes/resourceloader/ResourceLoaderUserModule.php')
-rw-r--r--includes/resourceloader/ResourceLoaderUserModule.php36
1 files changed, 13 insertions, 23 deletions
diff --git a/includes/resourceloader/ResourceLoaderUserModule.php b/includes/resourceloader/ResourceLoaderUserModule.php
index 1b6d1de0..a0978445 100644
--- a/includes/resourceloader/ResourceLoaderUserModule.php
+++ b/includes/resourceloader/ResourceLoaderUserModule.php
@@ -27,47 +27,37 @@
*/
class ResourceLoaderUserModule extends ResourceLoaderWikiModule {
- /* Protected Members */
-
protected $origin = self::ORIGIN_USER_INDIVIDUAL;
- /* Protected Methods */
-
/**
+ * Get list of pages used by this module
+ *
* @param ResourceLoaderContext $context
- * @return array
+ * @return array List of pages
*/
protected function getPages( ResourceLoaderContext $context ) {
- $username = $context->getUser();
-
- if ( $username === null ) {
- return array();
- }
-
$allowUserJs = $this->getConfig()->get( 'AllowUserJs' );
$allowUserCss = $this->getConfig()->get( 'AllowUserCss' );
-
if ( !$allowUserJs && !$allowUserCss ) {
return array();
}
- // Get the normalized title of the user's user page
- $userpageTitle = Title::makeTitleSafe( NS_USER, $username );
-
- if ( !$userpageTitle instanceof Title ) {
+ $user = $context->getUserObj();
+ if ( !$user || $user->isAnon() ) {
return array();
}
- $userpage = $userpageTitle->getPrefixedDBkey(); // Needed so $excludepages works
+ // Needed so $excludepages works
+ $userPage = $user->getUserPage()->getPrefixedDBkey();
$pages = array();
if ( $allowUserJs ) {
- $pages["$userpage/common.js"] = array( 'type' => 'script' );
- $pages["$userpage/" . $context->getSkin() . '.js'] = array( 'type' => 'script' );
+ $pages["$userPage/common.js"] = array( 'type' => 'script' );
+ $pages["$userPage/" . $context->getSkin() . '.js'] = array( 'type' => 'script' );
}
if ( $allowUserCss ) {
- $pages["$userpage/common.css"] = array( 'type' => 'style' );
- $pages["$userpage/" . $context->getSkin() . '.css'] = array( 'type' => 'style' );
+ $pages["$userPage/common.css"] = array( 'type' => 'style' );
+ $pages["$userPage/" . $context->getSkin() . '.css'] = array( 'type' => 'style' );
}
// Hack for bug 26283: if we're on a preview page for a CSS/JS page,
@@ -82,9 +72,9 @@ class ResourceLoaderUserModule extends ResourceLoaderWikiModule {
return $pages;
}
- /* Methods */
-
/**
+ * Get group name
+ *
* @return string
*/
public function getGroup() {