本文整理汇总了PHP中Skin::getSkinNames方法的典型用法代码示例。如果您正苦于以下问题:PHP Skin::getSkinNames方法的具体用法?PHP Skin::getSkinNames怎么用?PHP Skin::getSkinNames使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Skin
的用法示例。
在下文中一共展示了Skin::getSkinNames方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getConfig
/**
* @param ResourceLoaderContext $context
* @return array
*/
protected function getConfig($context)
{
$hash = $context->getHash();
if (isset($this->configVars[$hash])) {
return $this->configVars[$hash];
}
global $wgLoadScript, $wgScript, $wgStylePath, $wgScriptExtension, $wgArticlePath, $wgScriptPath, $wgServer, $wgContLang, $wgVariantArticlePath, $wgActionPaths, $wgVersion, $wgEnableAPI, $wgEnableWriteAPI, $wgDBname, $wgSitename, $wgFileExtensions, $wgExtensionAssetsPath, $wgCookiePrefix, $wgResourceLoaderMaxQueryLength, $wgResourceLoaderStorageEnabled, $wgResourceLoaderStorageVersion, $wgSearchType;
$mainPage = Title::newMainPage();
/**
* Namespace related preparation
* - wgNamespaceIds: Key-value pairs of all localized, canonical and aliases for namespaces.
* - wgCaseSensitiveNamespaces: Array of namespaces that are case-sensitive.
*/
$namespaceIds = $wgContLang->getNamespaceIds();
$caseSensitiveNamespaces = array();
foreach (MWNamespace::getCanonicalNamespaces() as $index => $name) {
$namespaceIds[$wgContLang->lc($name)] = $index;
if (!MWNamespace::isCapitalized($index)) {
$caseSensitiveNamespaces[] = $index;
}
}
// Build list of variables
$vars = array('wgLoadScript' => $wgLoadScript, 'debug' => $context->getDebug(), 'skin' => $context->getSkin(), 'stylepath' => $wgStylePath, 'wgUrlProtocols' => wfUrlProtocols(), 'wgArticlePath' => $wgArticlePath, 'wgScriptPath' => $wgScriptPath, 'wgScriptExtension' => $wgScriptExtension, 'wgScript' => $wgScript, 'wgSearchType' => $wgSearchType, 'wgVariantArticlePath' => $wgVariantArticlePath, 'wgActionPaths' => (object) $wgActionPaths, 'wgServer' => $wgServer, 'wgUserLanguage' => $context->getLanguage(), 'wgContentLanguage' => $wgContLang->getCode(), 'wgVersion' => $wgVersion, 'wgEnableAPI' => $wgEnableAPI, 'wgEnableWriteAPI' => $wgEnableWriteAPI, 'wgMainPageTitle' => $mainPage->getPrefixedText(), 'wgFormattedNamespaces' => $wgContLang->getFormattedNamespaces(), 'wgNamespaceIds' => $namespaceIds, 'wgContentNamespaces' => MWNamespace::getContentNamespaces(), 'wgSiteName' => $wgSitename, 'wgFileExtensions' => array_values(array_unique($wgFileExtensions)), 'wgDBname' => $wgDBname, 'wgFileCanRotate' => BitmapHandler::canRotate(), 'wgAvailableSkins' => Skin::getSkinNames(), 'wgExtensionAssetsPath' => $wgExtensionAssetsPath, 'wgCookiePrefix' => $wgCookiePrefix, 'wgResourceLoaderMaxQueryLength' => $wgResourceLoaderMaxQueryLength, 'wgCaseSensitiveNamespaces' => $caseSensitiveNamespaces, 'wgLegalTitleChars' => Title::convertByteClassToUnicodeClass(Title::legalChars()), 'wgResourceLoaderStorageVersion' => $wgResourceLoaderStorageVersion, 'wgResourceLoaderStorageEnabled' => $wgResourceLoaderStorageEnabled);
wfRunHooks('ResourceLoaderGetConfigVars', array(&$vars));
$this->configVars[$hash] = $vars;
return $this->configVars[$hash];
}
示例2: getConfig
/**
* @param $context ResourceLoaderContext
* @return array
*/
protected function getConfig($context)
{
global $wgLoadScript, $wgScript, $wgStylePath, $wgScriptExtension, $wgArticlePath, $wgScriptPath, $wgServer, $wgContLang, $wgVariantArticlePath, $wgActionPaths, $wgUseAjax, $wgVersion, $wgEnableAPI, $wgEnableWriteAPI, $wgDBname, $wgEnableMWSuggest, $wgSitename, $wgFileExtensions, $wgExtensionAssetsPath, $wgCookiePrefix, $wgResourceLoaderMaxQueryLength;
$mainPage = Title::newMainPage();
/**
* Namespace related preparation
* - wgNamespaceIds: Key-value pairs of all localized, canonical and aliases for namespaces.
* - wgCaseSensitiveNamespaces: Array of namespaces that are case-sensitive.
*/
$namespaceIds = $wgContLang->getNamespaceIds();
$caseSensitiveNamespaces = array();
foreach (MWNamespace::getCanonicalNamespaces() as $index => $name) {
$namespaceIds[$wgContLang->lc($name)] = $index;
if (!MWNamespace::isCapitalized($index)) {
$caseSensitiveNamespaces[] = $index;
}
}
// Build list of variables
$vars = array('wgLoadScript' => $wgLoadScript, 'debug' => $context->getDebug(), 'skin' => $context->getSkin(), 'stylepath' => $wgStylePath, 'wgUrlProtocols' => wfUrlProtocols(), 'wgArticlePath' => $wgArticlePath, 'wgScriptPath' => $wgScriptPath, 'wgScriptExtension' => $wgScriptExtension, 'wgScript' => $wgScript, 'wgVariantArticlePath' => $wgVariantArticlePath, 'wgActionPaths' => (object) $wgActionPaths, 'wgServer' => $wgServer, 'wgUserLanguage' => $context->getLanguage(), 'wgContentLanguage' => $wgContLang->getCode(), 'wgVersion' => $wgVersion, 'wgEnableAPI' => $wgEnableAPI, 'wgEnableWriteAPI' => $wgEnableWriteAPI, 'wgDefaultDateFormat' => $wgContLang->getDefaultDateFormat(), 'wgMonthNames' => $wgContLang->getMonthNamesArray(), 'wgMonthNamesShort' => $wgContLang->getMonthAbbreviationsArray(), 'wgMainPageTitle' => $mainPage ? $mainPage->getPrefixedText() : null, 'wgFormattedNamespaces' => $wgContLang->getFormattedNamespaces(), 'wgNamespaceIds' => $namespaceIds, 'wgSiteName' => $wgSitename, 'wgFileExtensions' => array_values($wgFileExtensions), 'wgDBname' => $wgDBname, 'wgFileCanRotate' => BitmapHandler::canRotate(), 'wgAvailableSkins' => Skin::getSkinNames(), 'wgExtensionAssetsPath' => $wgExtensionAssetsPath, 'wgCookiePrefix' => $wgCookiePrefix, 'wgResourceLoaderMaxQueryLength' => $wgResourceLoaderMaxQueryLength, 'wgCaseSensitiveNamespaces' => $caseSensitiveNamespaces, 'wgSassParams' => SassUtil::getSassSettings());
if ($wgUseAjax && $wgEnableMWSuggest) {
$vars['wgMWSuggestTemplate'] = SearchEngine::getMWSuggestTemplate();
}
wfRunHooks('ResourceLoaderGetConfigVars', array(&$vars));
return $vars;
}
示例3: __construct
/**
* @param ResourceLoader $resourceLoader
* @param WebRequest $request
*/
public function __construct(ResourceLoader $resourceLoader, WebRequest $request)
{
$this->resourceLoader = $resourceLoader;
$this->request = $request;
// Interpret request
// List of modules
$modules = $request->getVal('modules');
$this->modules = $modules ? self::expandModuleNames($modules) : array();
// Various parameters
$this->skin = $request->getVal('skin');
$this->user = $request->getVal('user');
$this->debug = $request->getFuzzyBool('debug', $resourceLoader->getConfig()->get('ResourceLoaderDebug'));
$this->only = $request->getVal('only');
$this->version = $request->getVal('version');
$this->raw = $request->getFuzzyBool('raw');
// Image requests
$this->image = $request->getVal('image');
$this->variant = $request->getVal('variant');
$this->format = $request->getVal('format');
$skinnames = Skin::getSkinNames();
// If no skin is specified, or we don't recognize the skin, use the default skin
if (!$this->skin || !isset($skinnames[$this->skin])) {
$this->skin = $resourceLoader->getConfig()->get('DefaultSkin');
}
}
示例4: getConfigSettings
/**
* @param ResourceLoaderContext $context
* @return array
*/
protected function getConfigSettings($context)
{
$hash = $context->getHash();
if (isset($this->configVars[$hash])) {
return $this->configVars[$hash];
}
global $wgContLang;
$mainPage = Title::newMainPage();
/**
* Namespace related preparation
* - wgNamespaceIds: Key-value pairs of all localized, canonical and aliases for namespaces.
* - wgCaseSensitiveNamespaces: Array of namespaces that are case-sensitive.
*/
$namespaceIds = $wgContLang->getNamespaceIds();
$caseSensitiveNamespaces = array();
foreach (MWNamespace::getCanonicalNamespaces() as $index => $name) {
$namespaceIds[$wgContLang->lc($name)] = $index;
if (!MWNamespace::isCapitalized($index)) {
$caseSensitiveNamespaces[] = $index;
}
}
$conf = $this->getConfig();
// Build list of variables
$vars = array('wgLoadScript' => wfScript('load'), 'debug' => $context->getDebug(), 'skin' => $context->getSkin(), 'stylepath' => $conf->get('StylePath'), 'wgUrlProtocols' => wfUrlProtocols(), 'wgArticlePath' => $conf->get('ArticlePath'), 'wgScriptPath' => $conf->get('ScriptPath'), 'wgScriptExtension' => '.php', 'wgScript' => wfScript(), 'wgSearchType' => $conf->get('SearchType'), 'wgVariantArticlePath' => $conf->get('VariantArticlePath'), 'wgActionPaths' => (object) $conf->get('ActionPaths'), 'wgServer' => $conf->get('Server'), 'wgServerName' => $conf->get('ServerName'), 'wgUserLanguage' => $context->getLanguage(), 'wgContentLanguage' => $wgContLang->getCode(), 'wgTranslateNumerals' => $conf->get('TranslateNumerals'), 'wgVersion' => $conf->get('Version'), 'wgEnableAPI' => $conf->get('EnableAPI'), 'wgEnableWriteAPI' => $conf->get('EnableWriteAPI'), 'wgMainPageTitle' => $mainPage->getPrefixedText(), 'wgFormattedNamespaces' => $wgContLang->getFormattedNamespaces(), 'wgNamespaceIds' => $namespaceIds, 'wgContentNamespaces' => MWNamespace::getContentNamespaces(), 'wgSiteName' => $conf->get('Sitename'), 'wgDBname' => $conf->get('DBname'), 'wgExtraSignatureNamespaces' => $conf->get('ExtraSignatureNamespaces'), 'wgAvailableSkins' => Skin::getSkinNames(), 'wgExtensionAssetsPath' => $conf->get('ExtensionAssetsPath'), 'wgCookiePrefix' => $conf->get('CookiePrefix'), 'wgCookieDomain' => $conf->get('CookieDomain'), 'wgCookiePath' => $conf->get('CookiePath'), 'wgCookieExpiration' => $conf->get('CookieExpiration'), 'wgResourceLoaderMaxQueryLength' => $conf->get('ResourceLoaderMaxQueryLength'), 'wgCaseSensitiveNamespaces' => $caseSensitiveNamespaces, 'wgLegalTitleChars' => Title::convertByteClassToUnicodeClass(Title::legalChars()), 'wgResourceLoaderStorageVersion' => $conf->get('ResourceLoaderStorageVersion'), 'wgResourceLoaderStorageEnabled' => $conf->get('ResourceLoaderStorageEnabled'), 'wgResourceLoaderLegacyModules' => self::getLegacyModules(), 'wgForeignUploadTargets' => $conf->get('ForeignUploadTargets'), 'wgEnableUploads' => $conf->get('EnableUploads'));
Hooks::run('ResourceLoaderGetConfigVars', array(&$vars));
$this->configVars[$hash] = $vars;
return $this->configVars[$hash];
}
示例5: __construct
/**
* @param $resourceLoader ResourceLoader
* @param $request WebRequest
*/
public function __construct($resourceLoader, WebRequest $request)
{
global $wgDefaultSkin, $wgResourceLoaderDebug;
$this->resourceLoader = $resourceLoader;
$this->request = $request;
// Interpret request
// List of modules
$modules = $request->getVal('modules');
$this->modules = $modules ? self::expandModuleNames($modules) : array();
// Various parameters
$this->skin = $request->getVal('skin');
$this->user = $request->getVal('user');
$this->debug = $request->getFuzzyBool('debug', $wgResourceLoaderDebug);
$this->only = $request->getVal('only');
$this->version = $request->getVal('version');
// Wikia - change begin - @author: wladek
$this->sassParams = array();
foreach ($request->getValues() as $key => $value) {
if (startsWith($key, 'sass_')) {
$this->sassParams[substr($key, strlen('sass_'))] = $value;
}
}
ksort($this->sassParams);
// Wikia - change end
$skinnames = Skin::getSkinNames();
// If no skin is specified, or we don't recognize the skin, use the default skin
if (!$this->skin || !isset($skinnames[$this->skin])) {
$this->skin = $wgDefaultSkin;
}
}
示例6: __construct
/**
* @param ResourceLoader $resourceLoader
* @param WebRequest $request
*/
public function __construct(ResourceLoader $resourceLoader, WebRequest $request)
{
$this->resourceLoader = $resourceLoader;
$this->request = $request;
$this->logger = $resourceLoader->getLogger();
// Future developers: Avoid use of getVal() in this class, which performs
// expensive UTF normalisation by default. Use getRawVal() instead.
// Values here are either one of a finite number of internal IDs,
// or previously-stored user input (e.g. titles, user names) that were passed
// to this endpoint by ResourceLoader itself from the canonical value.
// Values do not come directly from user input and need not match.
// List of modules
$modules = $request->getRawVal('modules');
$this->modules = $modules ? self::expandModuleNames($modules) : [];
// Various parameters
$this->user = $request->getRawVal('user');
$this->debug = $request->getFuzzyBool('debug', $resourceLoader->getConfig()->get('ResourceLoaderDebug'));
$this->only = $request->getRawVal('only', null);
$this->version = $request->getRawVal('version', null);
$this->raw = $request->getFuzzyBool('raw');
// Image requests
$this->image = $request->getRawVal('image');
$this->variant = $request->getRawVal('variant');
$this->format = $request->getRawVal('format');
$this->skin = $request->getRawVal('skin');
$skinnames = Skin::getSkinNames();
// If no skin is specified, or we don't recognize the skin, use the default skin
if (!$this->skin || !isset($skinnames[$this->skin])) {
$this->skin = $resourceLoader->getConfig()->get('DefaultSkin');
}
}
示例7: __construct
/**
* @param $resourceLoader ResourceLoader
* @param $request WebRequest
*/
public function __construct($resourceLoader, WebRequest $request)
{
global $wgDefaultSkin, $wgResourceLoaderDebug;
$this->resourceLoader = $resourceLoader;
$this->request = $request;
// Interpret request
// List of modules
$modules = $request->getVal('modules');
$this->modules = $modules ? self::expandModuleNames($modules) : array();
// Various parameters
$this->skin = $request->getVal('skin');
$this->user = $request->getVal('user');
$this->debug = $request->getFuzzyBool('debug', $wgResourceLoaderDebug);
$this->only = $request->getVal('only');
$this->version = $request->getVal('version');
$skinnames = Skin::getSkinNames();
// If no skin is specified, or we don't recognize the skin, use the default skin
if (!$this->skin || !isset($skinnames[$this->skin])) {
$this->skin = $wgDefaultSkin;
}
}
示例8: appendSkins
public function appendSkins($property)
{
$data = array();
$allowed = Skin::getAllowedSkins();
$default = Skin::normalizeKey('default');
foreach (Skin::getSkinNames() as $name => $displayName) {
$skin = array('code' => $name);
ApiResult::setContent($skin, $displayName);
if (!isset($allowed[$name])) {
$skin['unusable'] = '';
}
if ($name === $default) {
$skin['default'] = '';
}
$data[] = $skin;
}
$this->getResult()->setIndexedTagName($data, 'skin');
return $this->getResult()->addValue('query', $property, $data);
}
示例9: getConfig
/**
* @param $context ResourceLoaderContext
* @return array
*/
protected function getConfig( $context ) {
global $wgLoadScript, $wgScript, $wgStylePath, $wgScriptExtension,
$wgArticlePath, $wgScriptPath, $wgServer, $wgContLang,
$wgVariantArticlePath, $wgActionPaths, $wgVersion,
$wgEnableAPI, $wgEnableWriteAPI, $wgDBname,
$wgSitename, $wgFileExtensions, $wgExtensionAssetsPath,
$wgCookiePrefix, $wgResourceLoaderMaxQueryLength;
$mainPage = Title::newMainPage();
/**
* Namespace related preparation
* - wgNamespaceIds: Key-value pairs of all localized, canonical and aliases for namespaces.
* - wgCaseSensitiveNamespaces: Array of namespaces that are case-sensitive.
*/
$namespaceIds = $wgContLang->getNamespaceIds();
$caseSensitiveNamespaces = array();
foreach ( MWNamespace::getCanonicalNamespaces() as $index => $name ) {
$namespaceIds[$wgContLang->lc( $name )] = $index;
if ( !MWNamespace::isCapitalized( $index ) ) {
$caseSensitiveNamespaces[] = $index;
}
}
// Build list of variables
$vars = array(
'wgLoadScript' => $wgLoadScript,
'debug' => $context->getDebug(),
'skin' => $context->getSkin(),
'stylepath' => $wgStylePath,
'wgUrlProtocols' => wfUrlProtocols(),
'wgArticlePath' => $wgArticlePath,
'wgScriptPath' => $wgScriptPath,
'wgScriptExtension' => $wgScriptExtension,
'wgScript' => $wgScript,
'wgVariantArticlePath' => $wgVariantArticlePath,
// Force object to avoid "empty" associative array from
// becoming [] instead of {} in JS (bug 34604)
'wgActionPaths' => (object)$wgActionPaths,
'wgServer' => $wgServer,
'wgUserLanguage' => $context->getLanguage(),
'wgContentLanguage' => $wgContLang->getCode(),
'wgVersion' => $wgVersion,
'wgEnableAPI' => $wgEnableAPI,
'wgEnableWriteAPI' => $wgEnableWriteAPI,
'wgMainPageTitle' => $mainPage->getPrefixedText(),
'wgFormattedNamespaces' => $wgContLang->getFormattedNamespaces(),
'wgNamespaceIds' => $namespaceIds,
'wgSiteName' => $wgSitename,
'wgFileExtensions' => array_values( array_unique( $wgFileExtensions ) ),
'wgDBname' => $wgDBname,
// This sucks, it is only needed on Special:Upload, but I could
// not find a way to add vars only for a certain module
'wgFileCanRotate' => BitmapHandler::canRotate(),
'wgAvailableSkins' => Skin::getSkinNames(),
'wgExtensionAssetsPath' => $wgExtensionAssetsPath,
// MediaWiki sets cookies to have this prefix by default
'wgCookiePrefix' => $wgCookiePrefix,
'wgResourceLoaderMaxQueryLength' => $wgResourceLoaderMaxQueryLength,
'wgCaseSensitiveNamespaces' => $caseSensitiveNamespaces,
'wgLegalTitleChars' => Title::convertByteClassToUnicodeClass( Title::legalChars() ),
);
wfRunHooks( 'ResourceLoaderGetConfigVars', array( &$vars ) );
return $vars;
}
示例10: ucfirst
/**
* Factory method for loading a skin of a given type
* @param string $key 'monobook', 'standard', etc
* @return Skin
* @static
*/
static function &newFromKey($key)
{
global $wgStyleDirectory;
$key = Skin::normalizeKey($key);
$skinNames = Skin::getSkinNames();
$skinName = $skinNames[$key];
$className = 'Skin' . ucfirst($key);
# Grab the skin class and initialise it.
if (!class_exists($className)) {
// Preload base classes to work around APC/PHP5 bug
$deps = "{$wgStyleDirectory}/{$skinName}.deps.php";
if (file_exists($deps)) {
include_once $deps;
}
require_once "{$wgStyleDirectory}/{$skinName}.php";
# Check if we got if not failback to default skin
if (!class_exists($className)) {
# DO NOT die if the class isn't found. This breaks maintenance
# scripts and can cause a user account to be unrecoverable
# except by SQL manipulation if a previously valid skin name
# is no longer valid.
wfDebug("Skin class does not exist: {$className}\n");
$className = 'SkinMonobook';
require_once "{$wgStyleDirectory}/MonoBook.php";
}
}
$skin = new $className();
return $skin;
}
示例11: showMainForm
/**
* Displays form showing the list of installed gadgets
*/
public function showMainForm()
{
global $wgContLang;
$output = $this->getOutput();
$this->setHeaders();
$output->setPagetitle($this->msg('gadgets-title'));
$output->addWikiMsg('gadgets-pagetext');
$gadgets = GadgetRepo::singleton()->getStructuredList();
if (!$gadgets) {
return;
}
$lang = $this->getLanguage();
$langSuffix = "";
if ($lang->getCode() != $wgContLang->getCode()) {
$langSuffix = "/" . $lang->getCode();
}
$listOpen = false;
$editInterfaceMessage = $this->getUser()->isAllowed('editinterface') ? 'edit' : 'viewsource';
foreach ($gadgets as $section => $entries) {
if ($section !== false && $section !== '') {
$t = Title::makeTitleSafe(NS_MEDIAWIKI, "Gadget-section-{$section}{$langSuffix}");
$lnkTarget = $t ? Linker::link($t, $this->msg($editInterfaceMessage)->escaped(), array(), array('action' => 'edit')) : htmlspecialchars($section);
$lnk = "    [{$lnkTarget}]";
$ttext = $this->msg("gadget-section-{$section}")->parse();
if ($listOpen) {
$output->addHTML(Xml::closeElement('ul') . "\n");
$listOpen = false;
}
$output->addHTML(Html::rawElement('h2', array(), $ttext . $lnk) . "\n");
}
/**
* @var $gadget Gadget
*/
foreach ($entries as $gadget) {
$t = Title::makeTitleSafe(NS_MEDIAWIKI, "Gadget-{$gadget->getName()}{$langSuffix}");
if (!$t) {
continue;
}
$links = array();
$links[] = Linker::link($t, $this->msg($editInterfaceMessage)->escaped(), array(), array('action' => 'edit'));
$links[] = Linker::link($this->getPageTitle("export/{$gadget->getName()}"), $this->msg('gadgets-export')->escaped());
$ttext = $this->msg("gadget-{$gadget->getName()}")->parse();
if (!$listOpen) {
$listOpen = true;
$output->addHTML(Xml::openElement('ul'));
}
$lnk = '  ' . $this->msg('parentheses')->rawParams($lang->pipeList($links))->escaped();
$output->addHTML(Xml::openElement('li') . $ttext . $lnk . "<br />" . $this->msg('gadgets-uses')->escaped() . $this->msg('colon-separator')->escaped());
$lnk = array();
foreach ($gadget->getScriptsAndStyles() as $codePage) {
$t = Title::makeTitleSafe(NS_MEDIAWIKI, $codePage);
if (!$t) {
continue;
}
$lnk[] = Linker::link($t, htmlspecialchars($t->getText()));
}
$output->addHTML($lang->commaList($lnk));
if ($gadget->getLegacyScripts()) {
$output->addHTML('<br />' . Html::rawElement('span', array('class' => 'mw-gadget-legacy errorbox'), $this->msg('gadgets-legacy')->parse()));
}
$rights = array();
foreach ($gadget->getRequiredRights() as $right) {
$rights[] = '* ' . $this->msg("right-{$right}")->plain();
}
if (count($rights)) {
$output->addHTML('<br />' . $this->msg('gadgets-required-rights', implode("\n", $rights), count($rights))->parse());
}
$skins = array();
$validskins = Skin::getSkinNames();
foreach ($gadget->getRequiredSkins() as $skinid) {
if (isset($validskins[$skinid])) {
$skins[] = $this->msg("skinname-{$skinid}")->plain();
} else {
$skins[] = $skinid;
}
}
if (count($skins)) {
$output->addHTML('<br />' . $this->msg('gadgets-required-skins', $lang->commaList($skins))->numParams(count($skins))->parse());
}
if ($gadget->isOnByDefault()) {
$output->addHTML('<br />' . $this->msg('gadgets-default')->parse());
}
$output->addHTML(Xml::closeElement('li') . "\n");
}
}
if ($listOpen) {
$output->addHTML(Xml::closeElement('ul') . "\n");
}
}
示例12: mainPrefsForm
/**
* @access private
*/
function mainPrefsForm($status, $message = '')
{
global $wgUser, $wgOut, $wgLang, $wgContLang;
global $wgAllowRealName, $wgImageLimits, $wgThumbLimits;
global $wgDisableLangConversion;
global $wgEnotifWatchlist, $wgEnotifUserTalk, $wgEnotifMinorEdits;
global $wgRCShowWatchingUsers, $wgEnotifRevealEditorAddress;
global $wgEnableEmail, $wgEnableUserEmail, $wgEmailAuthentication;
global $wgContLanguageCode, $wgDefaultSkin, $wgSkipSkins, $wgAuth;
$wgOut->setPageTitle(wfMsg('preferences'));
$wgOut->setArticleRelated(false);
$wgOut->setRobotpolicy('noindex,nofollow');
if ($this->mSuccess || 'success' == $status) {
$wgOut->addWikitext('<div class="successbox"><strong>' . wfMsg('savedprefs') . '</strong></div>');
} else {
if ('error' == $status) {
$wgOut->addWikitext('<div class="errorbox"><strong>' . $message . '</strong></div>');
} else {
if ('' != $status) {
$wgOut->addWikitext($message . "\n----");
}
}
}
$qbs = $wgLang->getQuickbarSettings();
$skinNames = $wgLang->getSkinNames();
$mathopts = $wgLang->getMathNames();
$dateopts = $wgLang->getDateFormats();
$togs = $wgLang->getUserToggles();
$titleObj = Title::makeTitle(NS_SPECIAL, 'Preferences');
$action = $titleObj->escapeLocalURL();
# Pre-expire some toggles so they won't show if disabled
$this->mUsedToggles['shownumberswatching'] = true;
$this->mUsedToggles['showupdated'] = true;
$this->mUsedToggles['enotifwatchlistpages'] = true;
$this->mUsedToggles['enotifusertalkpages'] = true;
$this->mUsedToggles['enotifminoredits'] = true;
$this->mUsedToggles['enotifrevealaddr'] = true;
$this->mUsedToggles['uselivepreview'] = true;
# Enotif
# <FIXME>
$this->mUserEmail = htmlspecialchars($this->mUserEmail);
$this->mRealName = htmlspecialchars($this->mRealName);
$rawNick = $this->mNick;
$this->mNick = htmlspecialchars($this->mNick);
if (!$this->mEmailFlag) {
$emfc = 'checked="checked"';
} else {
$emfc = '';
}
if ($wgEmailAuthentication && $this->mUserEmail != '') {
if ($wgUser->getEmailAuthenticationTimestamp()) {
$emailauthenticated = wfMsg('emailauthenticated', $wgLang->timeanddate($wgUser->getEmailAuthenticationTimestamp(), true)) . '<br />';
$disableEmailPrefs = false;
} else {
$disableEmailPrefs = true;
$skin = $wgUser->getSkin();
$emailauthenticated = wfMsg('emailnotauthenticated') . '<br />' . $skin->makeKnownLinkObj(Title::makeTitle(NS_SPECIAL, 'Confirmemail'), wfMsg('emailconfirmlink'));
}
} else {
$emailauthenticated = '';
$disableEmailPrefs = false;
}
if ($this->mUserEmail == '') {
$emailauthenticated = wfMsg('noemailprefs');
}
// WERELATE removed
// $ps = $this->namespacesCheckboxes();
$enotifwatchlistpages = $wgEnotifWatchlist ? $this->getToggle('enotifwatchlistpages', false, $disableEmailPrefs) : '';
$enotifusertalkpages = $wgEnotifUserTalk ? $this->getToggle('enotifusertalkpages', false, $disableEmailPrefs) : '';
$enotifminoredits = $wgEnotifWatchlist && $wgEnotifMinorEdits ? $this->getToggle('enotifminoredits', false, $disableEmailPrefs) : '';
$enotifrevealaddr = ($wgEnotifWatchlist || $wgEnotifUserTalk) && $wgEnotifRevealEditorAddress ? $this->getToggle('enotifrevealaddr', false, $disableEmailPrefs) : '';
$prefs_help_email_enotif = $wgEnotifWatchlist || $wgEnotifUserTalk ? ' ' . wfMsg('prefs-help-email-enotif') : '';
$prefs_help_realname = '';
# </FIXME>
$wgOut->addHTML("<form action=\"{$action}\" method='post'>");
$wgOut->addHTML("<div id='preferences'>");
# User data
#
$wgOut->addHTML("<fieldset>\n<legend>" . wfMsg('prefs-personal') . "</legend>\n<table>\n");
$wgOut->addHTML($this->addRow(wfMsg('username'), $wgUser->getName()));
$wgOut->addHTML($this->addRow(wfMsg('uid'), $wgUser->getID()));
if ($wgAllowRealName) {
$wgOut->addHTML($this->addRow('<label for="wpRealName">' . wfMsg('yourrealname') . '</label>', "<input type='text' name='wpRealName' id='wpRealName' value=\"{$this->mRealName}\" size='25' />"));
}
if ($wgEnableEmail) {
$wgOut->addHTML($this->addRow('<label for="wpUserEmail">' . wfMsg('youremail') . '</label>', "<input type='text' name='wpUserEmail' id='wpUserEmail' value=\"{$this->mUserEmail}\" size='25' />"));
}
global $wgParser;
if (!empty($this->mToggles['fancysig']) && false === $wgParser->validateSig($rawNick)) {
$invalidSig = $this->addRow(' ', '<span class="error">' . wfMsgHtml('badsig') . '<span>');
} else {
$invalidSig = '';
}
$wgOut->addHTML($this->addRow('<label for="wpNick">' . wfMsg('yournick') . '</label>', "<input type='text' name='wpNick' id='wpNick' value=\"{$this->mNick}\" size='25' />") . $invalidSig . $this->addRow(' ', $this->getToggle('fancysig')));
/**
* Make sure the site language is in the list; a custom language code
* might not have a defined name...
//.........这里部分代码省略.........
示例13: isWrongCaseCssJsPage
/**
* Checks whether the user entered a skin name in uppercase,
* e.g. "User:Example/Monobook.css" instead of "monobook.css"
*
* @return bool
*/
protected function isWrongCaseCssJsPage()
{
if ($this->mTitle->isCssJsSubpage()) {
$name = $this->mTitle->getSkinFromCssJsSubpage();
$skins = array_merge(array_keys(Skin::getSkinNames()), array('common'));
return !in_array($name, $skins) && in_array(strtolower($name), $skins);
} else {
return false;
}
}
示例14: onGetPreferences
/**
* @static
* @param User $user
* @param Array $defaultPreferences
* @return bool
*/
public static function onGetPreferences($user, &$defaultPreferences)
{
global $wgEnableAnswers, $wgForceSkin, $wgAdminSkin, $wgDefaultSkin, $wgSkinPreviewPage, $wgSkipSkins, $wgSkipOldSkins, $wgEnableUserPreferencesV2Ext;
// hide default MediaWiki skin fieldset
unset($defaultPreferences['skin']);
$mSkin = $user->getGlobalPreference('skin');
// hacks for Answers
if (!empty($wgEnableAnswers)) {
$mSkin = 'answers';
}
// no skin settings at all when skin is forced
if (!empty($wgForceSkin)) {
return true;
}
if (!empty($wgAdminSkin)) {
$defaultSkinKey = $wgAdminSkin;
} else {
if (!empty($wgDefaultTheme)) {
$defaultSkinKey = $wgDefaultSkin . '-' . $wgDefaultTheme;
} else {
$defaultSkinKey = $wgDefaultSkin;
}
}
// load list of skin names
$validSkinNames = Skin::getSkinNames();
// and sort them
foreach ($validSkinNames as $skinkey => &$skinname) {
if (isset($skinNames[$skinkey])) {
$skinname = $skinNames[$skinkey];
}
}
asort($validSkinNames);
$previewtext = wfMsg('skin-preview');
if (isset($wgSkinPreviewPage) && is_string($wgSkinPreviewPage)) {
$previewLinkTemplate = Title::newFromText($wgSkinPreviewPage)->getLocalURL('useskin=');
} else {
$mptitle = Title::newMainPage();
$previewLinkTemplate = $mptitle->getLocalURL('useskin=');
}
$oldSkinNames = array();
foreach ($validSkinNames as $skinKey => $skinVal) {
if ($skinKey == 'oasis' || (in_array($skinKey, $wgSkipSkins) || in_array($skinKey, $wgSkipOldSkins)) && !($skinKey == $mSkin)) {
continue;
}
$oldSkinNames[$skinKey] = $skinVal;
}
$skins = array();
$skins[wfMsg('new-look')] = 'oasis';
// display radio buttons for rest of skin
if (count($oldSkinNames) > 0) {
foreach ($oldSkinNames as $skinKey => $skinVal) {
$previewlink = $wgEnableUserPreferencesV2Ext ? '' : ' <a target="_blank" href="' . htmlspecialchars($previewLinkTemplate . $skinKey) . '">' . $previewtext . '</a>';
$skins[$skinVal . $previewlink . ($skinKey == $defaultSkinKey ? ' (' . wfMsg('default') . ')' : '')] = $skinKey;
}
}
$defaultPreferencesTemp = array();
foreach ($defaultPreferences as $k => $v) {
$defaultPreferencesTemp[$k] = $v;
if ($k == 'oldsig') {
$defaultPreferencesTemp['skin'] = array('type' => 'radio', 'options' => $skins, 'label' => ' ', 'section' => 'personal/layout');
$defaultPreferencesTemp['showAds'] = array('type' => 'toggle', 'label-message' => 'tog-showAds', 'section' => 'personal/layout');
}
}
$defaultPreferences = $defaultPreferencesTemp;
return true;
}
示例15: showMainForm
/**
* Displays form showing the list of installed gadgets
*/
public function showMainForm()
{
global $wgOut, $wgUser, $wgLang, $wgContLang;
$skin = $wgUser->getSkin();
$this->setHeaders();
$wgOut->setPagetitle(wfMsg("gadgets-title"));
$wgOut->addWikiMsg('gadgets-pagetext');
$gadgets = Gadget::loadStructuredList();
if (!$gadgets) {
return;
}
$lang = "";
if ($wgLang->getCode() != $wgContLang->getCode()) {
$lang = "/" . $wgLang->getCode();
}
$listOpen = false;
$msgOpt = array('parseinline', 'parsemag');
$editInterfaceAllowed = $wgUser->isAllowed('editinterface');
foreach ($gadgets as $section => $entries) {
if ($section !== false && $section !== '') {
$t = Title::makeTitleSafe(NS_MEDIAWIKI, "Gadget-section-{$section}{$lang}");
if ($editInterfaceAllowed) {
$lnkTarget = $t ? $skin->link($t, wfMsgHTML('edit'), array(), array('action' => 'edit')) : htmlspecialchars($section);
$lnk = "    [{$lnkTarget}]";
} else {
$lnk = '';
}
$ttext = wfMsgExt("gadget-section-{$section}", $msgOpt);
if ($listOpen) {
$wgOut->addHTML(Xml::closeElement('ul') . "\n");
$listOpen = false;
}
$wgOut->addHTML(Html::rawElement('h2', array(), $ttext . $lnk) . "\n");
}
foreach ($entries as $gadget) {
$t = Title::makeTitleSafe(NS_MEDIAWIKI, "Gadget-{$gadget->getName()}{$lang}");
if (!$t) {
continue;
}
$links = array();
if ($editInterfaceAllowed) {
$links[] = $skin->link($t, wfMsgHTML('edit'), array(), array('action' => 'edit'));
}
$links[] = $skin->link($this->getTitle("export/{$gadget->getName()}"), wfMsgHtml('gadgets-export'));
$ttext = wfMsgExt("gadget-{$gadget->getName()}", $msgOpt);
if (!$listOpen) {
$listOpen = true;
$wgOut->addHTML(Xml::openElement('ul'));
}
$lnk = '  ' . wfMsg('parentheses', $wgLang->pipeList($links));
$wgOut->addHTML(Xml::openElement('li') . $ttext . $lnk . "<br />" . wfMsgHTML('gadgets-uses') . wfMsg('colon-separator'));
$lnk = array();
foreach ($gadget->getScriptsAndStyles() as $codePage) {
$t = Title::makeTitleSafe(NS_MEDIAWIKI, $codePage);
if (!$t) {
continue;
}
$lnk[] = $skin->link($t, htmlspecialchars($t->getText()));
}
$wgOut->addHTML($wgLang->commaList($lnk));
$rights = array();
foreach ($gadget->getRequiredRights() as $right) {
$rights[] = '* ' . wfMessage("right-{$right}")->plain();
}
if (count($rights)) {
$wgOut->addHTML('<br />' . wfMessage('gadgets-required-rights', implode("\n", $rights), count($rights))->parse());
}
$skins = array();
$validskins = Skin::getSkinNames();
foreach ($gadget->getRequiredSkins() as $skinid) {
if (isset($validskins[$skinid])) {
$skins[] = wfMessage("skinname-{$skinid}")->plain();
} else {
$skins[] = $skinid;
}
}
if (count($skins)) {
$wgOut->addHTML('<br />' . wfMessage('gadgets-required-skins', $wgLang->commaList($skins), count($skins))->parse());
}
if ($gadget->isOnByDefault()) {
$wgOut->addHTML('<br />' . wfMessage('gadgets-default')->parse());
}
$wgOut->addHTML(Xml::closeElement('li') . "\n");
}
}
if ($listOpen) {
$wgOut->addHTML(Xml::closeElement('ul') . "\n");
}
}