本文整理汇总了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;
}