X-Git-Url: http://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/operations/recherche.php?a=blobdiff_plain;f=includes%2Fspecials%2FSpecialUpload.php;h=d1a9b160c90f64e597914ad5cdd344a4e701e880;hb=29719f846b8887e1190ddf85125387c079f9539b;hp=3072408d3cbbc79e2dbf62c23ffb02bcec5ebbe5;hpb=176119237607de5ed6659296b08209270b26b84a;p=lhc%2Fweb%2Fwiklou.git
diff --git a/includes/specials/SpecialUpload.php b/includes/specials/SpecialUpload.php
index 3072408d3c..d1a9b160c9 100644
--- a/includes/specials/SpecialUpload.php
+++ b/includes/specials/SpecialUpload.php
@@ -235,7 +235,7 @@ class SpecialUpload extends SpecialPage {
!$this->mTokenOk && !$this->mCancelUpload &&
( $this->mUpload && $this->mUploadClicked )
) {
- $form->addPreText( wfMsgExt( 'session_fail_preview', 'parseinline' ) );
+ $form->addPreText( $this->msg( 'session_fail_preview' )->parse() );
}
# Give a notice if the user is uploading a file that has been deleted or moved
@@ -255,16 +255,16 @@ class SpecialUpload extends SpecialPage {
# Add text to form
$form->addPreText( '
' .
- wfMsgExt( 'uploadtext', 'parse', array( $this->mDesiredDestName ) ) .
+ $this->msg( 'uploadtext', array( $this->mDesiredDestName ) )->parseAsBlock() .
'
' );
# Add upload error message
$form->addPreText( $message );
# Add footer to form
- $uploadFooter = wfMessage( 'uploadfooter' );
+ $uploadFooter = $this->msg( 'uploadfooter' );
if ( !$uploadFooter->isDisabled() ) {
$form->addPostText( '\n" );
+ . $uploadFooter->parseAsBlock() . "\n" );
}
return $form;
@@ -280,14 +280,12 @@ class SpecialUpload extends SpecialPage {
if( $title instanceof Title ) {
$count = $title->isDeleted();
if ( $count > 0 && $user->isAllowed( 'deletedhistory' ) ) {
- $link = wfMsgExt(
- $user->isAllowed( 'delete' ) ? 'thisisdeleted' : 'viewdeleted',
- array( 'parse', 'replaceafter' ),
- Linker::linkKnown(
- SpecialPage::getTitleFor( 'Undelete', $title->getPrefixedText() ),
- wfMsgExt( 'restorelink', array( 'parsemag', 'escape' ), $count )
- )
+ $restorelink = Linker::linkKnown(
+ SpecialPage::getTitleFor( 'Undelete', $title->getPrefixedText() ),
+ $this->msg( 'restorelink' )->numParams( $count )->escaped()
);
+ $link = $this->msg( $user->isAllowed( 'delete' ) ? 'thisisdeleted' : 'viewdeleted' )
+ ->rawParams( $restorelink )->parseAsBlock();
$this->getOutput()->addHTML( "{$link}
" );
}
}
@@ -306,11 +304,11 @@ class SpecialUpload extends SpecialPage {
*/
protected function showRecoverableUploadError( $message ) {
$sessionKey = $this->mUpload->stashSession();
- $message = '' . wfMsgHtml( 'uploaderror' ) . "
\n" .
+ $message = '' . $this->msg( 'uploaderror' )->escaped() . "
\n" .
'' . $message . "
\n";
$form = $this->getUploadForm( $message, $sessionKey );
- $form->setSubmitText( wfMsg( 'upload-tryagain' ) );
+ $form->setSubmitText( $this->msg( 'upload-tryagain' )->escaped() );
$this->showUploadForm( $form );
}
/**
@@ -335,7 +333,7 @@ class SpecialUpload extends SpecialPage {
$sessionKey = $this->mUpload->stashSession();
- $warningHtml = '' . wfMsgHtml( 'uploadwarning' ) . "
\n"
+ $warningHtml = '' . $this->msg( 'uploadwarning' )->escaped() . "
\n"
. '';
foreach( $warnings as $warning => $args ) {
if( $warning == 'exists' ) {
@@ -343,8 +341,8 @@ class SpecialUpload extends SpecialPage {
} elseif( $warning == 'duplicate' ) {
$msg = self::getDupeWarning( $args );
} elseif( $warning == 'duplicate-archive' ) {
- $msg = "\t- " . wfMsgExt( 'file-deleted-duplicate', 'parseinline',
- array( Title::makeTitle( NS_FILE, $args )->getPrefixedText() ) )
+ $msg = "\t
- " . $this->msg( 'file-deleted-duplicate',
+ Title::makeTitle( NS_FILE, $args )->getPrefixedText() )->parse()
. "
\n";
} else {
if ( $args === true ) {
@@ -352,17 +350,17 @@ class SpecialUpload extends SpecialPage {
} elseif ( !is_array( $args ) ) {
$args = array( $args );
}
- $msg = "\t- " . wfMsgExt( $warning, 'parseinline', $args ) . "
\n";
+ $msg = "\t- " . $this->msg( $warning, $args )->parse() . "
\n";
}
$warningHtml .= $msg;
}
$warningHtml .= "
\n";
- $warningHtml .= wfMsgExt( 'uploadwarning-text', 'parse' );
+ $warningHtml .= $this->msg( 'uploadwarning-text' )->parseAsBlock();
$form = $this->getUploadForm( $warningHtml, $sessionKey, /* $hideIgnoreWarning */ true );
- $form->setSubmitText( wfMsg( 'upload-tryagain' ) );
- $form->addButton( 'wpUploadIgnoreWarning', wfMsg( 'ignorewarning' ) );
- $form->addButton( 'wpCancelUpload', wfMsg( 'reuploaddesc' ) );
+ $form->setSubmitText( $this->msg( 'upload-tryagain' )->text() );
+ $form->addButton( 'wpUploadIgnoreWarning', $this->msg( 'ignorewarning' )->text() );
+ $form->addButton( 'wpCancelUpload', $this->msg( 'reuploaddesc' )->text() );
$this->showUploadForm( $form );
@@ -376,7 +374,7 @@ class SpecialUpload extends SpecialPage {
* @param $message string HTML string
*/
protected function showUploadError( $message ) {
- $message = '' . wfMsgHtml( 'uploadwarning' ) . "
\n" .
+ $message = '' . $this->msg( 'uploadwarning' )->escaped() . "
\n" .
'' . $message . "
\n";
$this->showUploadForm( $this->getUploadForm( $message ) );
}
@@ -414,8 +412,7 @@ class SpecialUpload extends SpecialPage {
$permErrors = $this->mUpload->verifyTitlePermissions( $this->getUser() );
if( $permErrors !== true ) {
$code = array_shift( $permErrors[0] );
- $this->showRecoverableUploadError( wfMsgExt( $code,
- 'parseinline', $permErrors[0] ) );
+ $this->showRecoverableUploadError( $this->msg( $code, $permErrors[0] )->parse() );
return;
}
@@ -469,7 +466,7 @@ class SpecialUpload extends SpecialPage {
if ( in_array( $msgName, $wgForceUIMsgAsContentMsg ) ) {
$msg[$msgName] = "{{int:$msgName}}";
} else {
- $msg[$msgName] = wfMsgForContent( $msgName );
+ $msg[$msgName] = wfMessage( $msgName )->inContentLanguage()->text();
}
}
@@ -536,33 +533,31 @@ class SpecialUpload extends SpecialPage {
/** Statuses that only require name changing **/
case UploadBase::MIN_LENGTH_PARTNAME:
- $this->showRecoverableUploadError( wfMsgHtml( 'minlength1' ) );
+ $this->showRecoverableUploadError( $this->msg( 'minlength1' )->escaped() );
break;
case UploadBase::ILLEGAL_FILENAME:
- $this->showRecoverableUploadError( wfMsgExt( 'illegalfilename',
- 'parseinline', $details['filtered'] ) );
+ $this->showRecoverableUploadError( $this->msg( 'illegalfilename',
+ $details['filtered'] )->parse() );
break;
case UploadBase::FILENAME_TOO_LONG:
- $this->showRecoverableUploadError( wfMsgHtml( 'filename-toolong' ) );
+ $this->showRecoverableUploadError( $this->msg( 'filename-toolong' )->escaped() );
break;
case UploadBase::FILETYPE_MISSING:
- $this->showRecoverableUploadError( wfMsgExt( 'filetype-missing',
- 'parseinline' ) );
+ $this->showRecoverableUploadError( $this->msg( 'filetype-missing' )->parse() );
break;
case UploadBase::WINDOWS_NONASCII_FILENAME:
- $this->showRecoverableUploadError( wfMsgExt( 'windows-nonascii-filename',
- 'parseinline' ) );
+ $this->showRecoverableUploadError( $this->msg( 'windows-nonascii-filename' )->parse() );
break;
/** Statuses that require reuploading **/
case UploadBase::EMPTY_FILE:
- $this->showUploadError( wfMsgHtml( 'emptyfile' ) );
+ $this->showUploadError( $this->msg( 'emptyfile' )->escaped() );
break;
case UploadBase::FILE_TOO_LARGE:
- $this->showUploadError( wfMsgHtml( 'largefileserver' ) );
+ $this->showUploadError( $this->msg( 'largefileserver' )->escaped() );
break;
case UploadBase::FILETYPE_BADTYPE:
- $msg = wfMessage( 'filetype-banned-type' );
+ $msg = $this->msg( 'filetype-banned-type' );
if ( isset( $details['blacklistedExt'] ) ) {
$msg->params( $this->getLanguage()->commaList( $details['blacklistedExt'] ) );
} else {
@@ -585,7 +580,7 @@ class SpecialUpload extends SpecialPage {
case UploadBase::VERIFICATION_ERROR:
unset( $details['status'] );
$code = array_shift( $details['details'] );
- $this->showUploadError( wfMsgExt( $code, 'parseinline', $details['details'] ) );
+ $this->showUploadError( $this->msg( $code, $details['details'] )->parse() );
break;
case UploadBase::HOOK_ABORTED:
if ( is_array( $details['error'] ) ) { # allow hooks to return error details in an array
@@ -596,7 +591,7 @@ class SpecialUpload extends SpecialPage {
$args = null;
}
- $this->showUploadError( wfMsgExt( $error, 'parseinline', $args ) );
+ $this->showUploadError( $this->msg( $error, $args )->parse() );
break;
default:
throw new MWException( __METHOD__ . ": Unknown value `{$details['status']}`" );
@@ -641,37 +636,37 @@ class SpecialUpload extends SpecialPage {
if( $exists['warning'] == 'exists' ) {
// Exact match
- $warning = wfMsgExt( 'fileexists', 'parseinline', $filename );
+ $warning = wfMessage( 'fileexists', $filename )->parse();
} elseif( $exists['warning'] == 'page-exists' ) {
// Page exists but file does not
- $warning = wfMsgExt( 'filepageexists', 'parseinline', $filename );
+ $warning = wfMessage( 'filepageexists', $filename )->parse();
} elseif ( $exists['warning'] == 'exists-normalized' ) {
- $warning = wfMsgExt( 'fileexists-extension', 'parseinline', $filename,
- $exists['normalizedFile']->getTitle()->getPrefixedText() );
+ $warning = wfMessage( 'fileexists-extension', $filename,
+ $exists['normalizedFile']->getTitle()->getPrefixedText() )->parse();
} elseif ( $exists['warning'] == 'thumb' ) {
// Swapped argument order compared with other messages for backwards compatibility
- $warning = wfMsgExt( 'fileexists-thumbnail-yes', 'parseinline',
- $exists['thumbFile']->getTitle()->getPrefixedText(), $filename );
+ $warning = wfMessage( 'fileexists-thumbnail-yes',
+ $exists['thumbFile']->getTitle()->getPrefixedText(), $filename )->parse();
} elseif ( $exists['warning'] == 'thumb-name' ) {
// Image w/o '180px-' does not exists, but we do not like these filenames
$name = $file->getName();
$badPart = substr( $name, 0, strpos( $name, '-' ) + 1 );
- $warning = wfMsgExt( 'file-thumbnail-no', 'parseinline', $badPart );
+ $warning = wfMessage( 'file-thumbnail-no', $badPart )->parse();
} elseif ( $exists['warning'] == 'bad-prefix' ) {
- $warning = wfMsgExt( 'filename-bad-prefix', 'parseinline', $exists['prefix'] );
+ $warning = wfMessage( 'filename-bad-prefix', $exists['prefix'] )->parse();
} elseif ( $exists['warning'] == 'was-deleted' ) {
# If the file existed before and was deleted, warn the user of this
$ltitle = SpecialPage::getTitleFor( 'Log' );
$llink = Linker::linkKnown(
$ltitle,
- wfMsgHtml( 'deletionlog' ),
+ wfMessage( 'deletionlog' )->escaped(),
array(),
array(
'type' => 'delete',
'page' => $filename
)
);
- $warning = wfMsgExt( 'filewasdeleted', array( 'parse', 'replaceafter' ), $llink );
+ $warning = wfMessage( 'filewasdeleted' )->rawParams( $llink )->parseAsBlock();
}
return $warning;
@@ -717,9 +712,8 @@ class SpecialUpload extends SpecialPage {
}
$msg .= '';
return '' .
- wfMsgExt( 'file-exists-duplicate', array( 'parse' ), count( $dupes ) ) .
- $wgOut->parse( $msg ) .
- "\n";
+ wfMessage( 'file-exists-duplicate' )->numParams( count( $dupes ) )->parse() .
+ $wgOut->parse( $msg ) . "\n";
} else {
return '';
}
@@ -775,7 +769,7 @@ class UploadForm extends HTMLForm {
parent::__construct( $descriptor, $context, 'upload' );
# Set some form properties
- $this->setSubmitText( wfMsg( 'uploadbtn' ) );
+ $this->setSubmitText( $this->msg( 'uploadbtn' )->text() );
$this->setSubmitName( 'wpUpload' );
# Used message keys: 'accesskey-upload', 'tooltip-upload'
$this->setSubmitTooltip( 'upload' );
@@ -843,10 +837,9 @@ class UploadForm extends HTMLForm {
'label-message' => 'sourcefilename',
'upload-type' => 'File',
'radio' => &$radio,
- 'help' => wfMsgExt( 'upload-maxfilesize',
- array( 'parseinline', 'escapenoentities' ),
+ 'help' => $this->msg( 'upload-maxfilesize',
$this->getContext()->getLanguage()->formatSize( $this->mMaxUploadSize['file'] )
- ) . ' ' . wfMsgHtml( 'upload_source_file' ),
+ )->parse() . ' ' . $this->msg( 'upload_source_file' )->escaped(),
'checked' => $selectedSourceType == 'file',
);
if ( $canUploadByUrl ) {
@@ -858,10 +851,9 @@ class UploadForm extends HTMLForm {
'label-message' => 'sourceurl',
'upload-type' => 'url',
'radio' => &$radio,
- 'help' => wfMsgExt( 'upload-maxfilesize',
- array( 'parseinline', 'escapenoentities' ),
+ 'help' => $this->msg( 'upload-maxfilesize',
$this->getContext()->getLanguage()->formatSize( $this->mMaxUploadSize['url'] )
- ) . ' ' . wfMsgHtml( 'upload_source_url' ),
+ )->parse() . ' ' . $this->msg( 'upload_source_url' )->escaped(),
'checked' => $selectedSourceType == 'url',
);
}
@@ -892,16 +884,16 @@ class UploadForm extends HTMLForm {
# Everything not permitted is banned
$extensionsList =
'' .
- wfMsgExt( 'upload-permitted', 'parse', $this->getContext()->getLanguage()->commaList( $wgFileExtensions ) ) .
+ $this->msg( 'upload-permitted', $this->getContext()->getLanguage()->commaList( $wgFileExtensions ) )->parseAsBlock() .
"
\n";
} else {
# We have to list both preferred and prohibited
$extensionsList =
'' .
- wfMsgExt( 'upload-preferred', 'parse', $this->getContext()->getLanguage()->commaList( $wgFileExtensions ) ) .
+ $this->msg( 'upload-preferred', $this->getContext()->getLanguage()->commaList( $wgFileExtensions ) )->parseAsBlock() .
"
\n" .
'' .
- wfMsgExt( 'upload-prohibited', 'parse', $this->getContext()->getLanguage()->commaList( $wgFileBlacklist ) ) .
+ $this->msg( 'upload-prohibited', $this->getContext()->getLanguage()->commaList( $wgFileBlacklist ) )->parseAsBlock() .
"
\n";
}
} else {