本文整理匯總了PHP中Skin::setContext方法的典型用法代碼示例。如果您正苦於以下問題:PHP Skin::setContext方法的具體用法?PHP Skin::setContext怎麽用?PHP Skin::setContext使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Skin
的用法示例。
在下文中一共展示了Skin::setContext方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: getSkin
/**
* 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;
}
示例2: getSkin
/**
* 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;
}
示例3: setSkin
/**
* Set the Skin object
*
* @param Skin $s
*/
public function setSkin(Skin $s)
{
$this->skin = clone $s;
$this->skin->setContext($this);
}
示例4: getSkin
/**
* 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;
}