/**
  * Get the Skin object
  *
  * @return Skin
  */
 public function getSkin()
 {
     if ($this->skin === null) {
         wfProfileIn(__METHOD__ . '-createskin');
         $skin = null;
         wfRunHooks('RequestContextCreateSkin', array($this, &$skin));
         // If the hook worked try to set a skin from it
         if ($skin instanceof Skin) {
             $this->skin = $skin;
         } elseif (is_string($skin)) {
             $this->skin = Skin::newFromKey($skin);
         }
         // If this is still null (the hook didn't run or didn't work)
         // then go through the normal processing to load a skin
         if ($this->skin === null) {
             global $wgHiddenPrefs;
             if (!in_array('skin', $wgHiddenPrefs)) {
                 # get the user skin
                 $userSkin = $this->getUser()->getOption('skin');
                 $userSkin = $this->getRequest()->getVal('useskin', $userSkin);
             } else {
                 # if we're not allowing users to override, then use the default
                 global $wgDefaultSkin;
                 $userSkin = $wgDefaultSkin;
             }
             $this->skin = Skin::newFromKey($userSkin);
         }
         // After all that set a context on whatever skin got created
         $this->skin->setContext($this);
         wfProfileOut(__METHOD__ . '-createskin');
     }
     return $this->skin;
 }
Exemple #2
0
 /**
  * Get the Skin object
  *
  * @return Skin
  */
 public function getSkin()
 {
     if ($this->skin === null) {
         wfProfileIn(__METHOD__ . '-createskin');
         $skin = null;
         wfRunHooks('RequestContextCreateSkin', array($this, &$skin));
         $factory = SkinFactory::getDefaultInstance();
         // If the hook worked try to set a skin from it
         if ($skin instanceof Skin) {
             $this->skin = $skin;
         } elseif (is_string($skin)) {
             // Normalize the key, just in case the hook did something weird.
             $normalized = Skin::normalizeKey($skin);
             $this->skin = $factory->makeSkin($normalized);
         }
         // If this is still null (the hook didn't run or didn't work)
         // then go through the normal processing to load a skin
         if ($this->skin === null) {
             if (!in_array('skin', $this->getConfig()->get('HiddenPrefs'))) {
                 # get the user skin
                 $userSkin = $this->getUser()->getOption('skin');
                 $userSkin = $this->getRequest()->getVal('useskin', $userSkin);
             } else {
                 # if we're not allowing users to override, then use the default
                 $userSkin = $this->getConfig()->get('DefaultSkin');
             }
             // Normalize the key in case the user is passing gibberish
             // or has old preferences (bug 69566).
             $normalized = Skin::normalizeKey($userSkin);
             // Skin::normalizeKey will also validate it, so
             // this won't throw an exception
             $this->skin = $factory->makeSkin($normalized);
         }
         // After all that set a context on whatever skin got created
         $this->skin->setContext($this);
         wfProfileOut(__METHOD__ . '-createskin');
     }
     return $this->skin;
 }
 /**
  * Set the Skin object
  *
  * @param Skin $s
  */
 public function setSkin(Skin $s)
 {
     $this->skin = clone $s;
     $this->skin->setContext($this);
 }
 /**
  * Get the Skin object
  *
  * @return Skin
  */
 public function getSkin()
 {
     if ($this->skin === null) {
         wfProfileIn(__METHOD__ . '-createskin');
         global $wgHiddenPrefs;
         if (!in_array('skin', $wgHiddenPrefs)) {
             # get the user skin
             $userSkin = $this->getUser()->getOption('skin');
             $userSkin = $this->getRequest()->getVal('useskin', $userSkin);
         } else {
             # if we're not allowing users to override, then use the default
             global $wgDefaultSkin;
             $userSkin = $wgDefaultSkin;
         }
         $this->skin = Skin::newFromKey($userSkin);
         $this->skin->setContext($this);
         wfProfileOut(__METHOD__ . '-createskin');
     }
     return $this->skin;
 }