本文整理汇总了PHP中wfScript函数的典型用法代码示例。如果您正苦于以下问题:PHP wfScript函数的具体用法?PHP wfScript怎么用?PHP wfScript使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wfScript函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: execute
public function execute()
{
global $wgUser, $wgArticleFeedbackRatingTypes, $wgArticleFeedbackSMaxage, $wgArticleFeedbackNamespaces;
$params = $this->extractRequestParams();
// Anon token check
if ($wgUser->isAnon()) {
if (!isset($params['anontoken'])) {
$this->dieUsageMsg(array('missingparam', 'anontoken'));
} elseif (strlen($params['anontoken']) != 32) {
$this->dieUsage('The anontoken is not 32 characters', 'invalidtoken');
}
$token = $params['anontoken'];
} else {
$token = '';
}
// Load check, is this page ArticleFeedback-enabled ?
// Keep in sync with ext.articleFeedback.startup.js
$title = Title::newFromID($params['pageid']);
if (is_null($title) || !in_array($title->getNamespace(), $wgArticleFeedbackNamespaces) || $title->isRedirect()) {
// ...then error out
$this->dieUsage('ArticleFeedback is not enabled on this page', 'invalidpage');
}
$dbw = wfGetDB(DB_MASTER);
// Query the latest ratings by this user for this page,
// possibly for an older revision
// Select from the master to prevent replag-induced bugs
$res = $dbw->select('article_feedback', array('aa_rating_id', 'aa_rating_value', 'aa_revision'), array('aa_user_text' => $wgUser->getName(), 'aa_page_id' => $params['pageid'], 'aa_rating_id' => array_keys($wgArticleFeedbackRatingTypes), 'aa_user_anon_token' => $token), __METHOD__, array('ORDER BY' => 'aa_revision DESC', 'LIMIT' => count($wgArticleFeedbackRatingTypes)));
$lastRatings = array();
foreach ($res as $row) {
$lastRatings[$row->aa_rating_id]['value'] = $row->aa_rating_value;
$lastRatings[$row->aa_rating_id]['revision'] = $row->aa_revision;
}
$pageId = $params['pageid'];
$revisionId = $params['revid'];
foreach ($wgArticleFeedbackRatingTypes as $ratingID => $unused) {
$lastPageRating = false;
$lastRevRating = false;
if (isset($lastRatings[$ratingID])) {
$lastPageRating = intval($lastRatings[$ratingID]['value']);
if (intval($lastRatings[$ratingID]['revision']) == $revisionId) {
$lastRevRating = $lastPageRating;
}
}
$thisRating = false;
if (isset($params["r{$ratingID}"])) {
$thisRating = intval($params["r{$ratingID}"]);
}
$this->insertRevisionRating($pageId, $revisionId, $ratingID, $thisRating - $lastRevRating, $thisRating, $lastRevRating);
$this->insertPageRating($pageId, $ratingID, $thisRating - $lastPageRating, $thisRating, $lastPageRating);
$this->insertUserRatings($pageId, $revisionId, $wgUser, $token, $ratingID, $thisRating, $params['bucket']);
}
$this->insertProperties($revisionId, $wgUser, $token, $params);
$squidUpdate = new SquidUpdate(array(wfAppendQuery(wfScript('api'), array('action' => 'query', 'format' => 'json', 'list' => 'articlefeedback', 'afpageid' => $pageId, 'afanontoken' => '', 'afuserrating' => 0, 'maxage' => 0, 'smaxage' => $wgArticleFeedbackSMaxage))));
$squidUpdate->doUpdate();
wfRunHooks('ArticleFeedbackChangeRating', array($params));
$r = array('result' => 'Success');
$this->getResult()->addValue(null, $this->getModuleName(), $r);
}
开发者ID:schwarer2006,项目名称:wikia,代码行数:58,代码来源:ApiArticleFeedback.php
示例2: performUploadInit
public function performUploadInit($comment, $pageText, $watch, $user)
{
$check = $this->mUpload->validateNameAndOverwrite();
if ($check !== true) {
$this->getVerificationError($check);
}
$session = $this->mUpload->setupChunkSession($comment, $pageText, $watch);
return array('uploadUrl' => wfExpandUrl(wfScript('api')) . "?" . wfArrayToCGI(array('action' => 'firefoggupload', 'token' => $user->editToken(), 'format' => 'json', 'chunksession' => $session, 'filename' => $this->mUpload->getDesiredName())));
}
开发者ID:schwarer2006,项目名称:wikia,代码行数:9,代码来源:ApiFirefoggChunkedUpload.php
示例3: getPreloadedText
/**
@brief Fetch the edit form and return the text in #wpTextbox1.
@param title The page to be opened for editing.
*/
public function getPreloadedText($title)
{
$url = wfAppendQuery(wfScript('index'), array('title' => $title, 'action' => 'edit'));
$this->loadFromURL($url);
$elem = $this->getElementById('wpTextbox1');
if (!$elem) {
return null;
}
return trim($elem->textContent);
}
开发者ID:ATCARES,项目名称:mediawiki-moderation,代码行数:14,代码来源:ModerationTestsuiteHTML.php
示例4: setUp
protected function setUp()
{
global $wgServer;
parent::setUp();
self::$apiUrl = $wgServer . wfScript('api');
ApiQueryInfo::resetTokenCache();
// tokens are invalid because we cleared the session
self::$users = array('sysop' => new TestUser('Apitestsysop', 'Api Test Sysop', '[email protected]', array('sysop')), 'uploader' => new TestUser('Apitestuser', 'Api Test User', '[email protected]', array()));
$this->setMwGlobals(array('wgAuth' => new StubObject('wgAuth', 'AuthPlugin'), 'wgRequest' => new FauxRequest(array()), 'wgUser' => self::$users['sysop']->user));
$this->apiContext = new ApiTestContext();
}
开发者ID:lourinaldi,项目名称:mediawiki,代码行数:11,代码来源:ApiTestCase.php
示例5: setUp
protected function setUp()
{
global $wgServer, $wgDisableAuthManager;
parent::setUp();
self::$apiUrl = $wgServer . wfScript('api');
ApiQueryInfo::resetTokenCache();
// tokens are invalid because we cleared the session
self::$users = ['sysop' => static::getTestSysop(), 'uploader' => static::getTestUser()];
$this->setMwGlobals(['wgAuth' => $wgDisableAuthManager ? new AuthPlugin() : new MediaWiki\Auth\AuthManagerAuthPlugin(), 'wgRequest' => new FauxRequest([]), 'wgUser' => self::$users['sysop']->user]);
$this->apiContext = new ApiTestContext();
}
开发者ID:claudinec,项目名称:galan-wiki,代码行数:11,代码来源:ApiTestCase.php
示例6: setUp
function setUp()
{
global $wgContLang, $wgAuth, $wgMemc, $wgRequest, $wgUser, $wgServer;
parent::setUp();
self::$apiUrl = $wgServer . wfScript('api');
$wgMemc = new EmptyBagOStuff();
$wgContLang = Language::factory('en');
$wgAuth = new StubObject('wgAuth', 'AuthPlugin');
$wgRequest = new FauxRequest(array());
self::$users = array('sysop' => new ApiTestUser('Apitestsysop', 'Api Test Sysop', '[email protected]', array('sysop')), 'uploader' => new ApiTestUser('Apitestuser', 'Api Test User', '[email protected]', array()));
$wgUser = self::$users['sysop']->user;
}
开发者ID:eFFemeer,项目名称:seizamcore,代码行数:12,代码来源:ApiTestCase.php
示例7: execute
function execute($par)
{
$mime = $par ? $par : $this->getRequest()->getText('mime');
$mime = trim($mime);
$this->setHeaders();
$this->outputHeader();
$this->getOutput()->addHTML(Xml::openElement('form', array('id' => 'specialmimesearch', 'method' => 'get', 'action' => wfScript())) . Xml::openElement('fieldset') . Html::hidden('title', $this->getPageTitle()->getPrefixedText()) . Xml::element('legend', null, $this->msg('mimesearch')->text()) . Xml::inputLabel($this->msg('mimetype')->text(), 'mime', 'mime', 20, $mime) . ' ' . Xml::submitButton($this->msg('ilsubmit')->text()) . Xml::closeElement('fieldset') . Xml::closeElement('form'));
list($this->major, $this->minor) = File::splitMime($mime);
if ($this->major == '' || $this->minor == '' || $this->minor == 'unknown' || !self::isValidType($this->major)) {
return;
}
parent::execute($par);
}
开发者ID:Habatchii,项目名称:wikibase-for-mediawiki,代码行数:13,代码来源:SpecialMIMEsearch.php
示例8: performUploadInit
public function performUploadInit($comment, $pageText, $watchlist, $user) {
// Verify the initial upload request
$this->verifyUploadInit();
$session = $this->mUpload->setupChunkSession( $comment, $pageText, $watchlist );
return array('uploadUrl' =>
wfExpandUrl( wfScript( 'api' ) ) . "?" .
wfArrayToCGI( array(
'action' => 'resumableupload',
'token' => $user->editToken(),
'format' => 'json',
'chunksession' => $session,
'filename' => $this->mUpload->getDesiredName(),
) ) );
}
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:15,代码来源:ApiResumableUpload.php
示例9: setUp
protected function setUp()
{
global $wgContLang, $wgAuth, $wgMemc, $wgRequest, $wgUser, $wgServer;
parent::setUp();
self::$apiUrl = $wgServer . wfScript('api');
$wgMemc = new EmptyBagOStuff();
$wgContLang = Language::factory('en');
$wgAuth = new StubObject('wgAuth', 'AuthPlugin');
$wgRequest = new FauxRequest(array());
ApiQueryInfo::resetTokenCache();
// tokens are invalid because we cleared the session
self::$users = array('sysop' => new TestUser('Apitestsysop', 'Api Test Sysop', '[email protected]', array('sysop')), 'uploader' => new TestUser('Apitestuser', 'Api Test User', '[email protected]', array()));
$wgUser = self::$users['sysop']->user;
$this->apiContext = new ApiTestContext();
}
开发者ID:nischayn22,项目名称:mediawiki-core,代码行数:15,代码来源:ApiTestCase.php
示例10: __construct
/**
* Registers core modules and runs registration hooks.
*/
public function __construct()
{
global $IP, $wgResourceModules, $wgResourceLoaderSources, $wgLoadScript, $wgEnableJavaScriptTest;
wfProfileIn(__METHOD__);
// Add 'local' source first
$this->addSource('local', array('loadScript' => $wgLoadScript, 'apiScript' => wfScript('api')));
// Add other sources
$this->addSource($wgResourceLoaderSources);
// Register modules shared between mwEmbed and mediaWiki:
$this->register(include "{$IP}/resources/MwEmbedSharedResources.php");
// Register extension modules
wfRunHooks('ResourceLoaderRegisterModules', array(&$this));
$this->register($wgResourceModules);
if ($wgEnableJavaScriptTest === true) {
$this->registerTestModules();
}
wfProfileOut(__METHOD__);
}
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:21,代码来源:MwEmbedResourceLoader.php
示例11: initPrinter
/**
* Initialize the printer function and prepares the output headers, etc.
* This method must be the first outputing method during execution.
* A help screen's header is printed for the HTML-based output
*/
function initPrinter($isError)
{
$isHtml = $this->getIsHtml();
$mime = $isHtml ? 'text/html' : $this->getMimeType();
$script = wfScript('api');
// Some printers (ex. Feed) do their own header settings,
// in which case $mime will be set to null
if (is_null($mime)) {
return;
}
// skip any initialization
header("Content-Type: {$mime}; charset=utf-8");
if ($isHtml) {
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>MediaWiki API</title>
</head>
<body>
<?php
if (!$isError) {
?>
<br/>
<small>
You are looking at the HTML representation of the <?php
echo $this->mFormat;
?>
format.<br/>
HTML is good for debugging, but probably is not suitable for your application.<br/>
See <a href='http://www.mediawiki.org/wiki/API'>complete documentation</a>, or
<a href='<?php
echo $script;
?>
'>API help</a> for more information.
</small>
<?php
}
?>
<pre>
<?php
}
}
开发者ID:mediawiki-extensions,项目名称:bizzwiki,代码行数:48,代码来源:ApiFormatBase.php
示例12: execute
public function execute($par)
{
$redirect = $this->getRedirect($par);
$query = $this->getRedirectQuery();
// Redirect to a page title with possible query parameters
if ($redirect instanceof Title) {
$url = $redirect->getFullURL($query);
$this->getOutput()->redirect($url);
return $redirect;
} elseif ($redirect === true) {
// Redirect to index.php with query parameters
$url = wfAppendQuery(wfScript('index'), $query);
$this->getOutput()->redirect($url);
return $redirect;
} else {
$class = get_class($this);
throw new MWException("RedirectSpecialPage {$class} doesn't redirect!");
}
}
开发者ID:Habatchii,项目名称:wikibase-for-mediawiki,代码行数:19,代码来源:RedirectSpecialPage.php
示例13: execute
/**
* Main execution point
*
* @param string $subpage
*/
public function execute($subpage)
{
// Backwards-compatibility: redirect to new feed URLs
$feedFormat = $this->getRequest()->getVal('feed');
if (!$this->including() && $feedFormat) {
$query = $this->getFeedQuery();
$query['feedformat'] = $feedFormat === 'atom' ? 'atom' : 'rss';
$this->getOutput()->redirect(wfAppendQuery(wfScript('api'), $query));
return;
}
// 10 seconds server-side caching max
$this->getOutput()->setSquidMaxage(10);
// Check if the client has a cached version
$lastmod = $this->checkLastModified();
if ($lastmod === false) {
return;
}
parent::execute($subpage);
}
开发者ID:Tarendai,项目名称:spring-website,代码行数:24,代码来源:SpecialRecentchanges.php
示例14: factory
/**
* Get a webservice handler.
*
* @see $wgTranslateTranslationServices
* @param string $name Name of the service.
* @param array $config
* @return TranslationWebService|null
*/
public static function factory($name, $config)
{
$handlers = array('microsoft' => 'MicrosoftWebService', 'apertium' => 'ApertiumWebService', 'yandex' => 'YandexWebService', 'remote-ttmserver' => 'RemoteTTMServerWebService', 'cxserver' => 'CxserverWebService', 'youdao' => 'YoudaoWebService');
if (!isset($config['timeout'])) {
$config['timeout'] = 3;
}
// Alter local ttmserver instance to appear as remote
// to take advantage of the query aggregator. But only
// if they are public.
if (isset($config['class']) && $config['class'] === 'ElasticSearchTTMServer' && isset($config['public']) && $config['public'] === true) {
$config['type'] = 'remote-ttmserver';
$config['service'] = $name;
$config['url'] = wfExpandURl(wfScript('api'), PROTO_CANONICAL);
}
if (isset($handlers[$config['type']])) {
$class = $handlers[$config['type']];
return new $class($name, $config);
}
return null;
}
开发者ID:HuijiWiki,项目名称:mediawiki-extensions-Translate,代码行数:28,代码来源:TranslationWebService.php
示例15: wfSpecialFavoritelist
function wfSpecialFavoritelist($par)
{
global $wgUser, $wgOut, $wgLang, $wgRequest;
global $wgRCShowFavoritingUsers, $wgEnotifFavoritelist, $wgShowUpdatedMarker;
// Add feed links
$flToken = $wgUser->getOption('favoritelisttoken');
if (!$flToken) {
$flToken = sha1(mt_rand() . microtime(true));
$wgUser->setOption('favoritelisttoken', $flToken);
$wgUser->saveSettings();
}
global $wgServer, $wgScriptPath, $wgFeedClasses;
$apiParams = array('action' => 'feedfavoritelist', 'allrev' => 'allrev', 'flowner' => $wgUser->getName(), 'fltoken' => $flToken);
$feedTemplate = wfScript('api') . '?';
foreach ($wgFeedClasses as $format => $class) {
$theseParams = $apiParams + array('feedformat' => $format);
$url = $feedTemplate . wfArrayToCGI($theseParams);
$wgOut->addFeedLink($format, $url);
}
$skin = $wgUser->getSkin();
$specialTitle = SpecialPage::getTitleFor('Favoritelist');
$wgOut->setRobotPolicy('noindex,nofollow');
# Anons don't get a favoritelist
if ($wgUser->isAnon()) {
$wgOut->setPageTitle(wfMsg('favoritenologin'));
$llink = $skin->linkKnown(SpecialPage::getTitleFor('Userlogin'), wfMsgHtml('loginreqlink'), array(), array('returnto' => $specialTitle->getPrefixedText()));
$wgOut->addHTML(wfMsgWikiHtml('favoritelistanontext', $llink));
return;
}
$wgOut->setPageTitle(wfMsg('favoritelist'));
$sub = wfMsgExt('favoritelistfor', 'parseinline', $wgUser->getName());
$sub .= '<br />' . FavoritelistEditor::buildTools($wgUser->getSkin());
$wgOut->setSubtitle($sub);
if (($mode = FavoritelistEditor::getMode($wgRequest, $par)) !== false) {
$editor = new FavoritelistEditor();
$editor->execute($wgUser, $wgOut, $wgRequest, $mode);
return;
}
$this->viewFavList($wgUser, $wgOut, $wgRequest, $mode);
}
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:40,代码来源:SpecialFavoritelist.php
示例16: execute
public function execute($par)
{
if (empty($par)) {
$par = 'main';
}
// These come from transclusions
$request = $this->getRequest();
$options = ['action' => 'help', 'nolead' => true, 'submodules' => $request->getCheck('submodules'), 'recursivesubmodules' => $request->getCheck('recursivesubmodules'), 'title' => $request->getVal('title', $this->getPageTitle('$1')->getPrefixedText())];
// These are for linking from wikitext, since url parameters are a pain
// to do.
while (true) {
if (substr($par, 0, 4) === 'sub/') {
$par = substr($par, 4);
$options['submodules'] = 1;
continue;
}
if (substr($par, 0, 5) === 'rsub/') {
$par = substr($par, 5);
$options['recursivesubmodules'] = 1;
continue;
}
$moduleName = $par;
break;
}
if (!$this->including()) {
unset($options['nolead'], $options['title']);
$options['modules'] = $moduleName;
$link = wfAppendQuery(wfExpandUrl(wfScript('api'), PROTO_CURRENT), $options);
$this->getOutput()->redirect($link);
return;
}
$main = new ApiMain($this->getContext(), false);
try {
$module = $main->getModuleFromPath($moduleName);
} catch (UsageException $ex) {
$this->getOutput()->addHTML(Html::rawElement('span', ['class' => 'error'], $this->msg('apihelp-no-such-module', $moduleName)->inContentLanguage()->parse()));
return;
}
ApiHelp::getHelp($this->getContext(), $module, $options);
}
开发者ID:claudinec,项目名称:galan-wiki,代码行数:40,代码来源:SpecialApiHelp.php
示例17: getHTML
public function getHTML()
{
$searchField = htmlspecialchars($this->data['searchField']);
$mainPageUrl = $this->data['mainPageUrl'];
$randomPageUrl = $this->data['randomPageUrl'];
$homeButton = $this->data['messages']['mobile-frontend-home-button'];
$randomButton = $this->data['messages']['mobile-frontend-random-button'];
$scriptUrl = wfScript();
$searchBoxDisplayNone = $this->data['hideSearchBox'] ? ' style="display: none;" ' : '';
$logoDisplayNone = $this->data['hideLogo'] ? ' style="display: none;" ' : '';
$openSearchResults = '<div id="results"></div>';
$languageSelection = $this->data['buildLanguageSelection'] . '<br/>';
$languageSelectionText = '<b>' . $this->data['messages']['mobile-frontend-language'] . ':</b><br/>';
$languageSelectionDiv = '<div id="languageselectionsection">' . $languageSelectionText . $languageSelection . '</div>';
$logoOnClick = $this->data['device']['supports_javascript'] ? 'onclick="javascript:logoClick();"' : '';
$searchWebkitHtml = <<<HTML
\t\t\t{$openSearchResults}
\t\t<div id='header'>
\t\t\t<div id='searchbox' {$logoDisplayNone}>
\t\t\t<img width="35" height="22" alt='Logo' id='logo' src='{$this->data['wgMobileFrontendLogo']}' {$logoOnClick} {$logoDisplayNone} />
\t\t\t<form action='{$scriptUrl}' class='search_bar' method='get' {$searchBoxDisplayNone}>
\t\t\t <input type="hidden" value="Special:Search" name="title" />
\t\t\t\t<div id="sq" class="divclearable">
\t\t\t\t\t<input type="text" name="search" id="search" size="22" value="{$searchField}" autocorrect="off" autocomplete="off" autocapitalize="off" maxlength="1024" />
\t\t\t\t\t<div class="clearlink" id="clearsearch"></div>
\t\t\t\t</div>
\t\t\t <button id='goButton' type='submit'></button>
\t\t\t</form>
\t\t\t</div>
\t\t\t<div class='nav' id='nav' {$logoDisplayNone}>
\t\t\t{$languageSelectionDiv}
\t\t\t<button onclick="javascript:location.href='{$mainPageUrl}';" type="submit" id="homeButton">{$homeButton}</button>
\t\t\t<button onclick="javascript:location.href='{$randomPageUrl}';" type="submit" id="randomButton">{$randomButton}</button>
\t\t </div>
\t\t</div>
HTML;
return $searchWebkitHtml;
}
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:38,代码来源:SearchTemplate.php
示例18: getConfigSettings
/**
* @param ResourceLoaderContext $context
* @return array
*/
protected function getConfigSettings($context)
{
$hash = $context->getHash();
if (isset($this->configVars[$hash])) {
return $this->configVars[$hash];
}
global $wgContLang;
$conf = $this->getConfig();
// We can't use Title::newMainPage() if 'mainpage' is in
// $wgForceUIMsgAsContentMsg because that will try to use the session
// user's language and we have no session user. This does the
// equivalent but falling back to our ResourceLoaderContext language
// instead.
$mainPage = Title::newFromText($context->msg('mainpage')->inContentLanguage()->text());
if (!$mainPage) {
$mainPage = Title::newFromText('Main Page');
}
/**
* 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 = [];
foreach (MWNamespace::getCanonicalNamespaces() as $index => $name) {
$namespaceIds[$wgContLang->lc($name)] = $index;
if (!MWNamespace::isCapitalized($index)) {
$caseSensitiveNamespaces[] = $index;
}
}
$illegalFileChars = $conf->get('IllegalFileChars');
// Build list of variables
$vars = ['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()), 'wgIllegalFileChars' => Title::convertByteClassToUnicodeClass($illegalFileChars), 'wgResourceLoaderStorageVersion' => $conf->get('ResourceLoaderStorageVersion'), 'wgResourceLoaderStorageEnabled' => $conf->get('ResourceLoaderStorageEnabled'), 'wgResourceLoaderLegacyModules' => self::getLegacyModules(), 'wgForeignUploadTargets' => $conf->get('ForeignUploadTargets'), 'wgEnableUploads' => $conf->get('EnableUploads')];
Hooks::run('ResourceLoaderGetConfigVars', [&$vars]);
$this->configVars[$hash] = $vars;
return $this->configVars[$hash];
}
开发者ID:paladox,项目名称:mediawiki,代码行数:41,代码来源:ResourceLoaderStartUpModule.php
示例19: getHeadLinksArray
/**
* @return array Array in format "link name or number => 'link html'".
*/
public function getHeadLinksArray()
{
global $wgVersion;
$tags = array();
$config = $this->getConfig();
$canonicalUrl = $this->mCanonicalUrl;
$tags['meta-generator'] = Html::element('meta', array('name' => 'generator', 'content' => "MediaWiki {$wgVersion}"));
if ($config->get('ReferrerPolicy') !== false) {
$tags['meta-referrer'] = Html::element('meta', array('name' => 'referrer', 'content' => $config->get('ReferrerPolicy')));
}
$p = "{$this->mIndexPolicy},{$this->mFollowPolicy}";
if ($p !== 'index,follow') {
// http://www.robotstxt.org/wc/meta-user.html
// Only show if it's different from the default robots policy
$tags['meta-robots'] = Html::element('meta', array('name' => 'robots', 'content' => $p));
}
foreach ($this->mMetatags as $tag) {
if (0 == strcasecmp('http:', substr($tag[0], 0, 5))) {
$a = 'http-equiv';
$tag[0] = substr($tag[0], 5);
} else {
$a = 'name';
}
$tagName = "meta-{$tag[0]}";
if (isset($tags[$tagName])) {
$tagName .= $tag[1];
}
$tags[$tagName] = Html::element('meta', array($a => $tag[0], 'content' => $tag[1]));
}
foreach ($this->mLinktags as $tag) {
$tags[] = Html::element('link', $tag);
}
# Universal edit button
if ($config->get('UniversalEditButton') && $this->isArticleRelated()) {
$user = $this->getUser();
if ($this->getTitle()->quickUserCan('edit', $user) && ($this->getTitle()->exists() || $this->getTitle()->quickUserCan('create', $user))) {
// Original UniversalEditButton
$msg = $this->msg('edit')->text();
$tags['universal-edit-button'] = Html::element('link', array('rel' => 'alternate', 'type' => 'application/x-wiki', 'title' => $msg, 'href' => $this->getTitle()->getEditURL()));
// Alternate edit link
$tags['alternative-edit'] = Html::element('link', array('rel' => 'edit', 'title' => $msg, 'href' => $this->getTitle()->getEditURL()));
}
}
# Generally the order of the favicon and apple-touch-icon links
# should not matter, but Konqueror (3.5.9 at least) incorrectly
# uses whichever one appears later in the HTML source. Make sure
# apple-touch-icon is specified first to avoid this.
if ($config->get('AppleTouchIcon') !== false) {
$tags['apple-touch-icon'] = Html::element('link', array('rel' => 'apple-touch-icon', 'href' => $config->get('AppleTouchIcon')));
}
if ($config->get('Favicon') !== false) {
$tags['favicon'] = Html::element('link', array('rel' => 'shortcut icon', 'href' => $config->get('Favicon')));
}
# OpenSearch description link
$tags['opensearch'] = Html::element('link', array('rel' => 'search', 'type' => 'application/opensearchdescription+xml', 'href' => wfScript('opensearch_desc'), 'title' => $this->msg('opensearch-desc')->inContentLanguage()->text()));
if ($config->get('EnableAPI')) {
# Real Simple Discovery link, provides auto-discovery information
# for the MediaWiki API (and potentially additional custom API
# support such as WordPress or Twitter-compatible APIs for a
# blogging extension, etc)
$tags['rsd'] = Html::element('link', array('rel' => 'EditURI', 'type' => 'application/rsd+xml', 'href' => wfExpandUrl(wfAppendQuery(wfScript('api'), array('action' => 'rsd')), PROTO_RELATIVE)));
}
# Language variants
if (!$config->get('DisableLangConversion')) {
$lang = $this->getTitle()->getPageLanguage();
if ($lang->hasVariants()) {
$variants = $lang->getVariants();
foreach ($variants as $_v) {
$tags["variant-{$_v}"] = Html::element('link', array('rel' => 'alternate', 'hreflang' => wfBCP47($_v), 'href' => $this->getTitle()->getLocalURL(array('variant' => $_v))));
}
}
# x-default link per https://support.google.com/webmasters/answer/189077?hl=en
$tags["variant-x-default"] = Html::element('link', array('rel' => 'alternate', 'hreflang' => 'x-default', 'href' => $this->getTitle()->getLocalURL()));
}
# Copyright
if ($this->copyrightUrl !== null) {
$copyright = $this->copyrightUrl;
} else {
$copyright = '';
if ($config->get('RightsPage')) {
$copy = Title::newFromText($config->get('RightsPage'));
if ($copy) {
$copyright = $copy->getLocalURL();
}
}
if (!$copyright && $config->get('RightsUrl')) {
$copyright = $config->get('RightsUrl');
}
}
if ($copyright) {
$tags['copyright'] = Html::element('link', array('rel' => 'copyright', 'href' => $copyright));
}
# Feeds
if ($config->get('Feed')) {
foreach ($this->getSyndicationLinks() as $format => $link) {
# Use the page name for the title. In principle, this could
# lead to issues with having the same name for different feeds
//.........这里部分代码省略.........
开发者ID:GoProjectOwner,项目名称:mediawiki,代码行数:101,代码来源:OutputPage.php
示例20: getHelpInternal
//.........这里部分代码省略.........
case 'text':
// Displaying a type message here would be useless.
$type = null;
break;
}
}
// Add type. Messages for grep: api-help-param-type-limit
// api-help-param-type-integer api-help-param-type-boolean
// api-help-param-type-timestamp api-help-param-type-user
// api-help-param-type-password
if (is_string($type)) {
$msg = $context->msg("api-help-param-type-{$type}");
if (!$msg->isDisabled()) {
$info[] = $msg->params($multi ? 2 : 1)->parse();
}
}
if ($multi) {
$extra = array();
if ($hintPipeSeparated) {
$extra[] = $context->msg('api-help-param-multi-separate')->parse();
}
if ($count > ApiBase::LIMIT_SML1) {
$extra[] = $context->msg('api-help-param-multi-max')->numParams(ApiBase::LIMIT_SML1, ApiBase::LIMIT_SML2)->parse();
}
if ($extra) {
$info[] = join(' ', $extra);
}
}
}
// Add default
$default = isset($settings[ApiBase::PARAM_DFLT]) ? $settings[ApiBase::PARAM_DFLT] : null;
if ($default === '') {
$info[] = $context->msg('api-help-param-default-empty')->parse();
} elseif ($default !== null && $default !== false) {
$info[] = $context->msg('api-help-param-default')->params(wfEscapeWikiText($default))->parse();
}
if (!array_filter($description)) {
$description = array(self::wrap($context->msg('api-help-param-no-description'), 'apihelp-empty'));
}
// Add "deprecated" flag
if (!empty($settings[ApiBase::PARAM_DEPRECATED])) {
$help['parameters'] .= Html::openElement('dd', array('class' => 'info'));
$help['parameters'] .= self::wrap($context->msg('api-help-param-deprecated'), 'apihelp-deprecated', 'strong');
$help['parameters'] .= Html::closeElement('dd');
}
if ($description) {
$description = join('', $description);
$description = preg_replace('!\\s*</([oud]l)>\\s*<\\1>\\s*!', "\n", $description);
$help['parameters'] .= Html::rawElement('dd', array('class' => 'description'), $description);
}
foreach ($info as $i) {
$help['parameters'] .= Html::rawElement('dd', array('class' => 'info'), $i);
}
}
if ($dynamicParams !== null) {
$dynamicParams = ApiBase::makeMessage($dynamicParams, $context, array($module->getModulePrefix(), $module->getModuleName(), $module->getModulePath()));
$help['parameters'] .= Html::element('dt', null, '*');
$help['parameters'] .= Html::rawElement('dd', array('class' => 'description'), $dynamicParams->parse());
}
$help['parameters'] .= Html::closeElement('dl');
$help['parameters'] .= Html::closeElement('div');
}
$examples = $module->getExamplesMessages();
if ($examples) {
$help['examples'] .= Html::openElement('div', array('class' => 'apihelp-block apihelp-examples'));
$msg = $context->msg('api-help-examples');
if (!$msg->isDisabled()) {
$help['examples'] .= self::wrap($msg->numParams(count($examples)), 'apihelp-block-head', 'div');
}
$help['examples'] .= Html::openElement('dl');
foreach ($examples as $qs => $msg) {
$msg = ApiBase::makeMessage($msg, $context, array($module->getModulePrefix(), $module->getModuleName(), $module->getModulePath()));
$link = wfAppendQuery(wfScript('api'), $qs);
$help['examples'] .= Html::rawElement('dt', null, $msg->parse());
$help['examples'] .= Html::rawElement('dd', null, Html::element('a', array('href' => $link), "api.php?{$qs}"));
}
$help['examples'] .= Html::closeElement('dl');
$help['examples'] .= Html::closeElement('div');
}
$subtocnumber = $tocnumber;
$subtocnumber[$level + 1] = 0;
$suboptions = array('submodules' => $options['recursivesubmodules'], 'headerlevel' => $level + 1, 'tocnumber' => &$subtocnumber, 'noheader' => false) + $options;
if ($options['submodules'] && $module->getModuleManager()) {
$manager = $module->getModuleManager();
$submodules = array();
foreach ($groups as $group) {
$names = $manager->getNames($group);
sort($names);
foreach ($names as $name) {
$submodules[] = $manager->getModule($name);
}
}
$help['submodules'] .= self::getHelpInternal($context, $submodules, $suboptions, $haveModules);
}
$module->modifyHelp($help, $suboptions, $haveModules);
Hooks::run('APIHelpModifyOutput', array($module, &$help, $suboptions, &$haveModules));
$out .= join("\n", $help);
}
return $out;
}
开发者ID:paladox,项目名称:2,代码行数:101,代码来源:ApiHelp.php
注:本文中的wfScript函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论