本文整理汇总了PHP中UploadBase::getMaxUploadSize方法的典型用法代码示例。如果您正苦于以下问题:PHP UploadBase::getMaxUploadSize方法的具体用法?PHP UploadBase::getMaxUploadSize怎么用?PHP UploadBase::getMaxUploadSize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UploadBase
的用法示例。
在下文中一共展示了UploadBase::getMaxUploadSize方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addUploadJS
/**
* Add upload JS to the OutputPage
*/
protected function addUploadJS()
{
$config = $this->getConfig();
$useAjaxDestCheck = $config->get('UseAjax') && $config->get('AjaxUploadDestCheck');
$useAjaxLicensePreview = $config->get('UseAjax') && $config->get('AjaxLicensePreview') && $config->get('EnableAPI');
$this->mMaxUploadSize['*'] = UploadBase::getMaxUploadSize();
$scriptVars = array('wgAjaxUploadDestCheck' => $useAjaxDestCheck, 'wgAjaxLicensePreview' => $useAjaxLicensePreview, 'wgUploadAutoFill' => !$this->mForReUpload && $this->mDestFile === '', 'wgUploadSourceIds' => $this->mSourceIds, 'wgCheckFileExtensions' => $config->get('CheckFileExtensions'), 'wgStrictFileExtensions' => $config->get('StrictFileExtensions'), 'wgFileExtensions' => array_values(array_unique($config->get('FileExtensions'))), 'wgCapitalizeUploads' => MWNamespace::isCapitalized(NS_FILE), 'wgMaxUploadSize' => $this->mMaxUploadSize, 'wgFileCanRotate' => SpecialUpload::rotationEnabled());
$out = $this->getOutput();
$out->addJsConfigVars($scriptVars);
$out->addModules(array('mediawiki.action.edit', 'mediawiki.special.upload'));
}
示例2: str_replace
if ($wgMetaNamespace === false) {
$wgMetaNamespace = str_replace(' ', '_', $wgSitename);
}
// Default value is 2000 or the suhosin limit if it is between 1 and 2000
if ($wgResourceLoaderMaxQueryLength === false) {
$suhosinMaxValueLength = (int) ini_get('suhosin.get.max_value_length');
if ($suhosinMaxValueLength > 0 && $suhosinMaxValueLength < 2000) {
$wgResourceLoaderMaxQueryLength = $suhosinMaxValueLength;
} else {
$wgResourceLoaderMaxQueryLength = 2000;
}
unset($suhosinMaxValueLength);
}
// Ensure the minimum chunk size is less than PHP upload limits or the maximum
// upload size.
$wgMinUploadChunkSize = min($wgMinUploadChunkSize, UploadBase::getMaxUploadSize('file'), UploadBase::getMaxPhpUploadSize(), (wfShorthandToInteger(ini_get('post_max_size') ?: ini_get('hhvm.server.max_post_size'), PHP_INT_MAX) ?: PHP_INT_MAX) - 1024);
/**
* Definitions of the NS_ constants are in Defines.php
* @private
*/
$wgCanonicalNamespaceNames = [NS_MEDIA => 'Media', NS_SPECIAL => 'Special', NS_TALK => 'Talk', NS_USER => 'User', NS_USER_TALK => 'User_talk', NS_PROJECT => 'Project', NS_PROJECT_TALK => 'Project_talk', NS_FILE => 'File', NS_FILE_TALK => 'File_talk', NS_MEDIAWIKI => 'MediaWiki', NS_MEDIAWIKI_TALK => 'MediaWiki_talk', NS_TEMPLATE => 'Template', NS_TEMPLATE_TALK => 'Template_talk', NS_HELP => 'Help', NS_HELP_TALK => 'Help_talk', NS_CATEGORY => 'Category', NS_CATEGORY_TALK => 'Category_talk'];
/// @todo UGLY UGLY
if (is_array($wgExtraNamespaces)) {
$wgCanonicalNamespaceNames = $wgCanonicalNamespaceNames + $wgExtraNamespaces;
}
// These are now the same, always
// To determine the user language, use $wgLang->getCode()
$wgContLanguageCode = $wgLanguageCode;
// Easy to forget to falsify $wgDebugToolbar for static caches.
// If file cache or CDN cache is on, just disable this (DWIMD).
if ($wgUseFileCache || $wgUseSquid) {
示例3: addUploadJS
/**
* Add upload JS to the OutputPage
*/
protected function addUploadJS()
{
global $wgUseAjax, $wgAjaxUploadDestCheck, $wgAjaxLicensePreview, $wgEnableAPI, $wgStrictFileExtensions;
$useAjaxDestCheck = $wgUseAjax && $wgAjaxUploadDestCheck;
$useAjaxLicensePreview = $wgUseAjax && $wgAjaxLicensePreview && $wgEnableAPI;
$this->mMaxUploadSize['*'] = UploadBase::getMaxUploadSize();
$scriptVars = array('wgAjaxUploadDestCheck' => $useAjaxDestCheck, 'wgAjaxLicensePreview' => $useAjaxLicensePreview, 'wgUploadAutoFill' => !$this->mForReUpload && $this->mDestFile === '', 'wgUploadSourceIds' => $this->mSourceIds, 'wgStrictFileExtensions' => $wgStrictFileExtensions, 'wgCapitalizeUploads' => MWNamespace::isCapitalized(NS_FILE), 'wgMaxUploadSize' => $this->mMaxUploadSize);
$out = $this->getOutput();
$out->addJsConfigVars($scriptVars);
$out->addModules(array('mediawiki.action.edit', 'mediawiki.legacy.upload', 'mediawiki.special.upload'));
}
示例4: getAllowedParams
public function getAllowedParams()
{
$params = array('filename' => array(ApiBase::PARAM_TYPE => 'string'), 'comment' => array(ApiBase::PARAM_DFLT => ''), 'text' => null, 'watch' => array(ApiBase::PARAM_DFLT => false, ApiBase::PARAM_DEPRECATED => true), 'watchlist' => array(ApiBase::PARAM_DFLT => 'preferences', ApiBase::PARAM_TYPE => array('watch', 'preferences', 'nochange')), 'ignorewarnings' => false, 'file' => array(ApiBase::PARAM_TYPE => 'upload'), 'url' => null, 'filekey' => null, 'sessionkey' => array(ApiBase::PARAM_DFLT => null, ApiBase::PARAM_DEPRECATED => true), 'stash' => false, 'filesize' => array(ApiBase::PARAM_TYPE => 'integer', ApiBase::PARAM_MIN => 0, ApiBase::PARAM_MAX => UploadBase::getMaxUploadSize()), 'offset' => array(ApiBase::PARAM_TYPE => 'integer', ApiBase::PARAM_MIN => 0), 'chunk' => array(ApiBase::PARAM_TYPE => 'upload'), 'async' => false, 'asyncdownload' => false, 'leavemessage' => false, 'statuskey' => null, 'checkstatus' => false);
return $params;
}
示例5: getAllowedParams
public function getAllowedParams()
{
$params = ['filename' => [ApiBase::PARAM_TYPE => 'string'], 'comment' => [ApiBase::PARAM_DFLT => ''], 'tags' => [ApiBase::PARAM_TYPE => 'tags', ApiBase::PARAM_ISMULTI => true], 'text' => [ApiBase::PARAM_TYPE => 'text'], 'watch' => [ApiBase::PARAM_DFLT => false, ApiBase::PARAM_DEPRECATED => true], 'watchlist' => [ApiBase::PARAM_DFLT => 'preferences', ApiBase::PARAM_TYPE => ['watch', 'preferences', 'nochange']], 'ignorewarnings' => false, 'file' => [ApiBase::PARAM_TYPE => 'upload'], 'url' => null, 'filekey' => null, 'sessionkey' => [ApiBase::PARAM_DEPRECATED => true], 'stash' => false, 'filesize' => [ApiBase::PARAM_TYPE => 'integer', ApiBase::PARAM_MIN => 0, ApiBase::PARAM_MAX => UploadBase::getMaxUploadSize()], 'offset' => [ApiBase::PARAM_TYPE => 'integer', ApiBase::PARAM_MIN => 0], 'chunk' => [ApiBase::PARAM_TYPE => 'upload'], 'async' => false, 'checkstatus' => false];
return $params;
}
示例6: appendGeneralInfo
//.........这里部分代码省略.........
$allowException = !empty($allowFrom);
}
if ($allowException) {
$data['externalimages'] = (array) $allowFrom;
$this->getResult()->setIndexedTagName($data['externalimages'], 'prefix');
}
if (!$wgDisableLangConversion) {
$data['langconversion'] = '';
}
if (!$wgDisableTitleConversion) {
$data['titleconversion'] = '';
}
if ($wgContLang->linkPrefixExtension()) {
$linkPrefixCharset = $wgContLang->linkPrefixCharset();
$data['linkprefixcharset'] = $linkPrefixCharset;
// For backwards compatability
$data['linkprefix'] = "/^((?>.*[^{$linkPrefixCharset}]|))(.+)\$/sDu";
} else {
$data['linkprefixcharset'] = '';
$data['linkprefix'] = '';
}
$linktrail = $wgContLang->linkTrail();
if ($linktrail) {
$data['linktrail'] = $linktrail;
} else {
$data['linktrail'] = '';
}
$git = SpecialVersion::getGitHeadSha1($GLOBALS['IP']);
if ($git) {
$data['git-hash'] = $git;
} else {
$svn = SpecialVersion::getSvnRevision($GLOBALS['IP']);
if ($svn) {
$data['rev'] = $svn;
}
}
// 'case-insensitive' option is reserved for future
$data['case'] = $GLOBALS['wgCapitalLinks'] ? 'first-letter' : 'case-sensitive';
$data['lang'] = $GLOBALS['wgLanguageCode'];
$fallbacks = array();
foreach ($wgContLang->getFallbackLanguages() as $code) {
$fallbacks[] = array('code' => $code);
}
$data['fallback'] = $fallbacks;
$this->getResult()->setIndexedTagName($data['fallback'], 'lang');
if ($wgContLang->hasVariants()) {
$variants = array();
foreach ($wgContLang->getVariants() as $code) {
$variants[] = array('code' => $code, 'name' => $wgContLang->getVariantname($code));
}
$data['variants'] = $variants;
$this->getResult()->setIndexedTagName($data['variants'], 'lang');
}
if ($wgContLang->isRTL()) {
$data['rtl'] = '';
}
$data['fallback8bitEncoding'] = $wgContLang->fallback8bitEncoding();
if (wfReadOnly()) {
$data['readonly'] = '';
$data['readonlyreason'] = wfReadOnlyReason();
}
if ($GLOBALS['wgEnableWriteAPI']) {
$data['writeapi'] = '';
}
$tz = $GLOBALS['wgLocaltimezone'];
$offset = $GLOBALS['wgLocalTZoffset'];
if (is_null($tz)) {
$tz = 'UTC';
$offset = 0;
} elseif (is_null($offset)) {
$offset = 0;
}
$data['timezone'] = $tz;
$data['timeoffset'] = intval($offset);
$data['articlepath'] = $GLOBALS['wgArticlePath'];
$data['scriptpath'] = $GLOBALS['wgScriptPath'];
$data['script'] = $GLOBALS['wgScript'];
$data['variantarticlepath'] = $GLOBALS['wgVariantArticlePath'];
$data['server'] = $GLOBALS['wgServer'];
$data['wikiid'] = wfWikiID();
$data['time'] = wfTimestamp(TS_ISO_8601, time());
if ($GLOBALS['wgMiserMode']) {
$data['misermode'] = '';
}
$data['maxuploadsize'] = UploadBase::getMaxUploadSize();
$data['thumblimits'] = $GLOBALS['wgThumbLimits'];
$this->getResult()->setIndexedTagName($data['thumblimits'], 'limit');
$data['imagelimits'] = array();
$this->getResult()->setIndexedTagName($data['imagelimits'], 'limit');
foreach ($GLOBALS['wgImageLimits'] as $k => $limit) {
$data['imagelimits'][$k] = array('width' => $limit[0], 'height' => $limit[1]);
}
if (!empty($GLOBALS['wgFavicon'])) {
// wgFavicon can either be a relative or an absolute path
// make sure we always return an absolute path
$data['favicon'] = wfExpandUrl($GLOBALS['wgFavicon'], PROTO_RELATIVE);
}
wfRunHooks('APIQuerySiteInfoGeneralInfo', array($this, &$data));
return $this->getResult()->addValue('query', $property, $data);
}
示例7: execute
public function execute()
{
// Check whether upload is enabled
if (!UploadBase::isEnabled()) {
$this->dieUsageMsg('uploaddisabled');
}
$user = $this->getUser();
// Parameter handling
$this->mParams = $this->extractRequestParams();
$request = $this->getMain()->getRequest();
// Add the uploaded file to the params array
$this->mParams['file'] = $request->getFileName('file');
$this->mParams['chunk'] = $request->getFileName('chunk');
// Copy the session key to the file key, for backward compatibility.
if (!$this->mParams['filekey'] && $this->mParams['sessionkey']) {
$this->mParams['filekey'] = $this->mParams['sessionkey'];
}
// Select an upload module
if (!$this->selectUploadModule()) {
// This is not a true upload, but a status request or similar
return;
}
if (!isset($this->mUpload)) {
$this->dieUsage('No upload module set', 'nomodule');
}
// First check permission to upload
$this->checkPermissions($user);
// Fetch the file
$status = $this->mUpload->fetchFile();
if (!$status->isGood()) {
$errors = $status->getErrorsArray();
$error = array_shift($errors[0]);
$this->dieUsage('Error fetching file from remote source', $error, 0, $errors[0]);
}
// Check if the uploaded file is sane
if ($this->mParams['chunk']) {
$maxSize = $this->mUpload->getMaxUploadSize();
if ($this->mParams['filesize'] > $maxSize) {
$this->dieUsage('The file you submitted was too large', 'file-too-large');
}
} else {
$this->verifyUpload();
}
// Check if the user has the rights to modify or overwrite the requested title
// (This check is irrelevant if stashing is already requested, since the errors
// can always be fixed by changing the title)
if (!$this->mParams['stash']) {
$permErrors = $this->mUpload->verifyTitlePermissions($user);
if ($permErrors !== true) {
$this->dieRecoverableError($permErrors[0], 'filename');
}
}
// Get the result based on the current upload context:
$result = $this->getContextResult();
if ($result['result'] === 'Success') {
$result['imageinfo'] = $this->mUpload->getImageInfo($this->getResult());
}
$this->getResult()->addValue(null, $this->getModuleName(), $result);
// Cleanup any temporary mess
$this->mUpload->cleanupTempFile();
}
示例8: appendGeneralInfo
//.........这里部分代码省略.........
$allowFrom = array('');
$allowException = true;
if (!$config->get('AllowExternalImages')) {
$data['imagewhitelistenabled'] = (bool) $config->get('EnableImageWhitelist');
$allowFrom = $config->get('AllowExternalImagesFrom');
$allowException = !empty($allowFrom);
}
if ($allowException) {
$data['externalimages'] = (array) $allowFrom;
ApiResult::setIndexedTagName($data['externalimages'], 'prefix');
}
$data['langconversion'] = !$config->get('DisableLangConversion');
$data['titleconversion'] = !$config->get('DisableTitleConversion');
if ($wgContLang->linkPrefixExtension()) {
$linkPrefixCharset = $wgContLang->linkPrefixCharset();
$data['linkprefixcharset'] = $linkPrefixCharset;
// For backwards compatibility
$data['linkprefix'] = "/^((?>.*[^{$linkPrefixCharset}]|))(.+)\$/sDu";
} else {
$data['linkprefixcharset'] = '';
$data['linkprefix'] = '';
}
$linktrail = $wgContLang->linkTrail();
$data['linktrail'] = $linktrail ?: '';
$data['legaltitlechars'] = Title::legalChars();
global $IP;
$git = SpecialVersion::getGitHeadSha1($IP);
if ($git) {
$data['git-hash'] = $git;
$data['git-branch'] = SpecialVersion::getGitCurrentBranch($GLOBALS['IP']);
} else {
$svn = SpecialVersion::getSvnRevision($IP);
if ($svn) {
$data['rev'] = $svn;
}
}
// 'case-insensitive' option is reserved for future
$data['case'] = $config->get('CapitalLinks') ? 'first-letter' : 'case-sensitive';
$data['lang'] = $config->get('LanguageCode');
$fallbacks = array();
foreach ($wgContLang->getFallbackLanguages() as $code) {
$fallbacks[] = array('code' => $code);
}
$data['fallback'] = $fallbacks;
ApiResult::setIndexedTagName($data['fallback'], 'lang');
if ($wgContLang->hasVariants()) {
$variants = array();
foreach ($wgContLang->getVariants() as $code) {
$variants[] = array('code' => $code, 'name' => $wgContLang->getVariantname($code));
}
$data['variants'] = $variants;
ApiResult::setIndexedTagName($data['variants'], 'lang');
}
$data['rtl'] = $wgContLang->isRTL();
$data['fallback8bitEncoding'] = $wgContLang->fallback8bitEncoding();
$data['readonly'] = wfReadOnly();
if ($data['readonly']) {
$data['readonlyreason'] = wfReadOnlyReason();
}
$data['writeapi'] = (bool) $config->get('EnableWriteAPI');
$tz = $config->get('Localtimezone');
$offset = $config->get('LocalTZoffset');
if (is_null($tz)) {
$tz = 'UTC';
$offset = 0;
} elseif (is_null($offset)) {
$offset = 0;
}
$data['timezone'] = $tz;
$data['timeoffset'] = intval($offset);
$data['articlepath'] = $config->get('ArticlePath');
$data['scriptpath'] = $config->get('ScriptPath');
$data['script'] = $config->get('Script');
$data['variantarticlepath'] = $config->get('VariantArticlePath');
$data[ApiResult::META_BC_BOOLS][] = 'variantarticlepath';
$data['server'] = $config->get('Server');
$data['servername'] = $config->get('ServerName');
$data['wikiid'] = wfWikiID();
$data['time'] = wfTimestamp(TS_ISO_8601, time());
$data['misermode'] = (bool) $config->get('MiserMode');
$data['maxuploadsize'] = UploadBase::getMaxUploadSize();
$data['minuploadchunksize'] = (int) $this->getConfig()->get('MinUploadChunkSize');
$data['thumblimits'] = $config->get('ThumbLimits');
ApiResult::setArrayType($data['thumblimits'], 'BCassoc');
ApiResult::setIndexedTagName($data['thumblimits'], 'limit');
$data['imagelimits'] = array();
ApiResult::setArrayType($data['imagelimits'], 'BCassoc');
ApiResult::setIndexedTagName($data['imagelimits'], 'limit');
foreach ($config->get('ImageLimits') as $k => $limit) {
$data['imagelimits'][$k] = array('width' => $limit[0], 'height' => $limit[1]);
}
$favicon = $config->get('Favicon');
if (!empty($favicon)) {
// wgFavicon can either be a relative or an absolute path
// make sure we always return an absolute path
$data['favicon'] = wfExpandUrl($favicon, PROTO_RELATIVE);
}
Hooks::run('APIQuerySiteInfoGeneralInfo', array($this, &$data));
return $this->getResult()->addValue('query', $property, $data);
}
示例9: execute
public function execute() {
global $wgEnableAsyncUploads;
// Check whether upload is enabled
if ( !UploadBase::isEnabled() ) {
$this->dieUsageMsg( 'uploaddisabled' );
}
$user = $this->getUser();
// Parameter handling
$this->mParams = $this->extractRequestParams();
$request = $this->getMain()->getRequest();
// Check if async mode is actually supported (jobs done in cli mode)
$this->mParams['async'] = ( $this->mParams['async'] && $wgEnableAsyncUploads );
// Add the uploaded file to the params array
$this->mParams['file'] = $request->getFileName( 'file' );
$this->mParams['chunk'] = $request->getFileName( 'chunk' );
// Copy the session key to the file key, for backward compatibility.
if ( !$this->mParams['filekey'] && $this->mParams['sessionkey'] ) {
$this->mParams['filekey'] = $this->mParams['sessionkey'];
}
// Select an upload module
try {
if ( !$this->selectUploadModule() ) {
return; // not a true upload, but a status request or similar
} elseif ( !isset( $this->mUpload ) ) {
$this->dieUsage( 'No upload module set', 'nomodule' );
}
} catch ( UploadStashException $e ) { // XXX: don't spam exception log
$this->dieUsage( get_class( $e ) . ": " . $e->getMessage(), 'stasherror' );
}
// First check permission to upload
$this->checkPermissions( $user );
// Fetch the file (usually a no-op)
/** @var $status Status */
$status = $this->mUpload->fetchFile();
if ( !$status->isGood() ) {
$errors = $status->getErrorsArray();
$error = array_shift( $errors[0] );
$this->dieUsage( 'Error fetching file from remote source', $error, 0, $errors[0] );
}
// Check if the uploaded file is sane
if ( $this->mParams['chunk'] ) {
$maxSize = $this->mUpload->getMaxUploadSize();
if ( $this->mParams['filesize'] > $maxSize ) {
$this->dieUsage( 'The file you submitted was too large', 'file-too-large' );
}
if ( !$this->mUpload->getTitle() ) {
$this->dieUsage( 'Invalid file title supplied', 'internal-error' );
}
} elseif ( $this->mParams['async'] && $this->mParams['filekey'] ) {
// defer verification to background process
} else {
wfDebug( __METHOD__ . 'about to verify' );
$this->verifyUpload();
}
// Check if the user has the rights to modify or overwrite the requested title
// (This check is irrelevant if stashing is already requested, since the errors
// can always be fixed by changing the title)
if ( !$this->mParams['stash'] ) {
$permErrors = $this->mUpload->verifyTitlePermissions( $user );
if ( $permErrors !== true ) {
$this->dieRecoverableError( $permErrors[0], 'filename' );
}
}
// Get the result based on the current upload context:
try {
$result = $this->getContextResult();
if ( $result['result'] === 'Success' ) {
$result['imageinfo'] = $this->mUpload->getImageInfo( $this->getResult() );
}
} catch ( UploadStashException $e ) { // XXX: don't spam exception log
$this->dieUsage( get_class( $e ) . ": " . $e->getMessage(), 'stasherror' );
}
$this->getResult()->addValue( null, $this->getModuleName(), $result );
// Cleanup any temporary mess
$this->mUpload->cleanupTempFile();
}
示例10: addUploadJS
/**
* Add upload JS to the OutputPage
*/
protected function addUploadJS() {
global $wgUseAjax, $wgAjaxUploadDestCheck, $wgAjaxLicensePreview, $wgEnableAPI, $wgStrictFileExtensions;
$useAjaxDestCheck = $wgUseAjax && $wgAjaxUploadDestCheck;
$useAjaxLicensePreview = $wgUseAjax && $wgAjaxLicensePreview && $wgEnableAPI;
$this->mMaxUploadSize['*'] = UploadBase::getMaxUploadSize();
$scriptVars = array(
'wgAjaxUploadDestCheck' => $useAjaxDestCheck,
'wgAjaxLicensePreview' => $useAjaxLicensePreview,
'wgUploadAutoFill' => !$this->mForReUpload &&
// If we received mDestFile from the request, don't autofill
// the wpDestFile textbox
$this->mDestFile === '',
'wgUploadSourceIds' => $this->mSourceIds,
'wgStrictFileExtensions' => $wgStrictFileExtensions,
'wgCapitalizeUploads' => MWNamespace::isCapitalized( NS_FILE ),
'wgMaxUploadSize' => $this->mMaxUploadSize,
);
$out = $this->getOutput();
$out->addJsConfigVars( $scriptVars );
$out->addModules( array(
'mediawiki.action.edit', // For <charinsert> support
'mediawiki.legacy.upload', // Old form stuff...
'mediawiki.special.upload', // Newer extras for thumbnail preview.
) );
}
示例11: appendGeneralInfo
protected function appendGeneralInfo($property)
{
global $wgContLang, $wgDisableLangConversion, $wgDisableTitleConversion;
$data = array();
$mainPage = Title::newMainPage();
$data['mainpage'] = $mainPage->getPrefixedText();
$data['base'] = wfExpandUrl($mainPage->getFullUrl(), PROTO_CURRENT);
$data['sitename'] = $GLOBALS['wgSitename'];
$data['generator'] = "MediaWiki {$GLOBALS['wgVersion']}";
$data['phpversion'] = phpversion();
$data['phpsapi'] = PHP_SAPI;
$data['dbtype'] = $GLOBALS['wgDBtype'];
$data['dbversion'] = $this->getDB()->getServerVersion();
if (!$wgDisableLangConversion) {
$data['langconversion'] = '';
}
if (!$wgDisableTitleConversion) {
$data['titleconversion'] = '';
}
if ($wgContLang->linkPrefixExtension()) {
$data['linkprefix'] = wfMessage('linkprefix')->inContentLanguage()->text();
} else {
$data['linkprefix'] = '';
}
$linktrail = $wgContLang->linkTrail();
if ($linktrail) {
$data['linktrail'] = $linktrail;
} else {
$data['linktrail'] = '';
}
$git = SpecialVersion::getGitHeadSha1($GLOBALS['IP']);
if ($git) {
$data['git-hash'] = $git;
} else {
$svn = SpecialVersion::getSvnRevision($GLOBALS['IP']);
if ($svn) {
$data['rev'] = $svn;
}
}
// 'case-insensitive' option is reserved for future
$data['case'] = $GLOBALS['wgCapitalLinks'] ? 'first-letter' : 'case-sensitive';
if (isset($GLOBALS['wgRightsCode'])) {
$data['rightscode'] = $GLOBALS['wgRightsCode'];
}
$data['rights'] = $GLOBALS['wgRightsText'];
$data['lang'] = $GLOBALS['wgLanguageCode'];
$fallbacks = array();
foreach ($wgContLang->getFallbackLanguages() as $code) {
$fallbacks[] = array('code' => $code);
}
$data['fallback'] = $fallbacks;
$this->getResult()->setIndexedTagName($data['fallback'], 'lang');
if ($wgContLang->hasVariants()) {
$variants = array();
foreach ($wgContLang->getVariants() as $code) {
$variants[] = array('code' => $code);
}
$data['variants'] = $variants;
$this->getResult()->setIndexedTagName($data['variants'], 'lang');
}
if ($wgContLang->isRTL()) {
$data['rtl'] = '';
}
$data['fallback8bitEncoding'] = $wgContLang->fallback8bitEncoding();
if (wfReadOnly()) {
$data['readonly'] = '';
$data['readonlyreason'] = wfReadOnlyReason();
}
if ($GLOBALS['wgEnableWriteAPI']) {
$data['writeapi'] = '';
}
$tz = $GLOBALS['wgLocaltimezone'];
$offset = $GLOBALS['wgLocalTZoffset'];
if (is_null($tz)) {
$tz = 'UTC';
$offset = 0;
} elseif (is_null($offset)) {
$offset = 0;
}
$data['timezone'] = $tz;
$data['timeoffset'] = intval($offset);
$data['articlepath'] = $GLOBALS['wgArticlePath'];
$data['scriptpath'] = $GLOBALS['wgScriptPath'];
$data['script'] = $GLOBALS['wgScript'];
$data['variantarticlepath'] = $GLOBALS['wgVariantArticlePath'];
$data['server'] = $GLOBALS['wgServer'];
$data['wikiid'] = wfWikiID();
$data['time'] = wfTimestamp(TS_ISO_8601, time());
if ($GLOBALS['wgMiserMode']) {
$data['misermode'] = '';
}
$data['maxuploadsize'] = UploadBase::getMaxUploadSize();
wfRunHooks('APIQuerySiteInfoGeneralInfo', array($this, &$data));
return $this->getResult()->addValue('query', $property, $data);
}
示例12: addUploadJS
/**
* Add upload JS to the OutputPage
*/
protected function addUploadJS()
{
$config = $this->getConfig();
$useAjaxDestCheck = $config->get('UseAjax') && $config->get('AjaxUploadDestCheck');
$useAjaxLicensePreview = $config->get('UseAjax') && $config->get('AjaxLicensePreview') && $config->get('EnableAPI');
$this->mMaxUploadSize['*'] = UploadBase::getMaxUploadSize();
$scriptVars = array('wgAjaxUploadDestCheck' => $useAjaxDestCheck, 'wgAjaxLicensePreview' => $useAjaxLicensePreview, 'wgUploadAutoFill' => !$this->mForReUpload && $this->mDestFile === '', 'wgUploadSourceIds' => $this->mSourceIds, 'wgCheckFileExtensions' => $config->get('CheckFileExtensions'), 'wgStrictFileExtensions' => $config->get('StrictFileExtensions'), 'wgCapitalizeUploads' => MWNamespace::isCapitalized(NS_FILE), 'wgMaxUploadSize' => $this->mMaxUploadSize);
$out = $this->getOutput();
$out->addJsConfigVars($scriptVars);
}