本文整理汇总了PHP中WikiError::toString方法的典型用法代码示例。如果您正苦于以下问题:PHP WikiError::toString方法的具体用法?PHP WikiError::toString怎么用?PHP WikiError::toString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WikiError
的用法示例。
在下文中一共展示了WikiError::toString方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: processUpload
function processUpload()
{
global $wgUser, $wgOut, $wgFileExtensions;
$details = null;
$value = null;
$value = $this->internalProcessUpload($details);
switch ($value) {
case self::SUCCESS:
// don't... do... REDIRECT
return;
case self::BEFORE_PROCESSING:
return false;
case self::LARGE_FILE_SERVER:
return wfMsg('largefileserver');
case self::EMPTY_FILE:
return wfMsg('emptyfile');
case self::MIN_LENGTH_PARTNAME:
return wfMsg('minlength1');
return;
case self::ILLEGAL_FILENAME:
$filtered = $details['filtered'];
return wfMsg('illegalfilename', $filtered);
case self::PROTECTED_PAGE:
return wfMsg('protectedpage');
case self::OVERWRITE_EXISTING_FILE:
$errorText = $details['overwrite'];
$overwrite = new WikiError($wgOut->parse($errorText));
return $overwrite->toString();
case self::FILETYPE_MISSING:
return wfMsg('filetype-missing');
case self::FILETYPE_BADTYPE:
$finalExt = $details['finalExt'];
return wfMsg('filetype-badtype');
case self::VERIFICATION_ERROR:
$veri = $details['veri'];
return $veri->toString();
case self::UPLOAD_VERIFICATION_ERROR:
$error = $details['error'];
return $error;
case self::UPLOAD_WARNING:
$warning = $details['warning'];
return $warning;
}
throw new MWException(__METHOD__ . ": Unknown value `{$value}`");
}
示例2: processUpload
//.........这里部分代码省略.........
$duration = $granulepos / $page['rate'];
}
}
fclose($f);
}
$dbr =& wfGetDB(DB_WRITE);
$text = '' . $wgScriptPath . '/images/' . $this->mLocalFile->getUrlRel();
if ($duration === null) {
$duration = 0;
}
if ($dbr->insert($mvMediaFilesTable, array('path' => $text, 'duration' => $duration, 'file_desc_msg' => $file_desc_msg), __METHOD__)) {
$result = $dbr->query("SELECT LAST_INSERT_ID() AS id");
$row = $dbr->fetchObject($result);
$id = $row->id;
if ($dbr->insert($mvStreamFilesTable, array('file_id' => $id, 'stream_id' => $stream_id), __METHOD__)) {
$stream_name = MV_Stream::getStreamNameFromId($stream_id);
$title = Title::newFromText($stream_name, MV_NS_STREAM);
$wgOut->redirect($title->getLocalURL("action=edit"));
} else {
$html .= 'Inserting file path into DB failed, Please notify the Administrator immediately';
}
} else {
$html .= 'Inserting file path into DB failed, Please notify the Administrator immediately';
}
/*
if ($dbr->insert($mvStreamFilesTable, array('stream_id'=>$stream_id))) {
$result = $dbr->query("SELECT LAST_INSERT_ID()");
$row = $dbr->fetchObject($result);
if ($duration===null)$duration=0;
if ($dbr->insert($mvMediaFilesTable, array('id'=>$row->id,'path'=>$text,'duration'=>$duration))) {
//$html .='<input type="button" name="Close" value="Close" Onclick="window.opener.document.getElementById(\'path\').value=\''.$wgScriptPath.'/images/'.$this->mLocalFile->getUrlRel().'\'; window.opener.document.getElementById(\'duration\').value='.floor($duration).'; window.close()"></input>' ;
$stream_name = MV_Stream::getStreamNameFromId($stream_id);
$title = Title::newFromText( $stream_name, MV_NS_STREAM );
$wgOut->redirect($title->getLocalURL("action=edit"));
}
else {
$html .= 'Inserting file path into DB failed, Please notify the Administrator immediately';
}
} else {
$html .= 'Inserting file path into DB failed, Please notify the Administrator immediately';
}
*/
$wgOut->addHTML($html);
break;
case self::BEFORE_PROCESSING:
break;
case self::LARGE_FILE_SERVER:
$this->mainUploadForm(wfMsgHtml('largefileserver'));
break;
case self::EMPTY_FILE:
$this->mainUploadForm(wfMsgHtml('emptyfile'));
break;
case self::MIN_LENGHT_PARTNAME:
$this->mainUploadForm(wfMsgHtml('minlength1'));
break;
case self::ILLEGAL_FILENAME:
$filtered = $details['filtered'];
$this->uploadError(wfMsgWikiHtml('illegalfilename', htmlspecialchars($filtered)));
break;
case self::PROTECTED_PAGE:
$this->uploadError(wfMsgWikiHtml('protectedpage'));
break;
case self::OVERWRITE_EXISTING_FILE:
$errorText = $details['overwrite'];
$overwrite = new WikiError($wgOut->parse($errorText));
$this->uploadError($overwrite->toString());
break;
case self::FILETYPE_MISSING:
$this->uploadError(wfMsgExt('filetype-missing', array('parseinline')));
break;
case self::FILETYPE_BADTYPE:
$finalExt = $details['finalExt'];
$this->uploadError(wfMsgExt('filetype-banned-type', array('parseinline'), htmlspecialchars($finalExt), implode(wfMsgExt('comma-separator', array('escapenoentities')), $wgFileExtensions)));
break;
case self::VERIFICATION_ERROR:
$veri = $details['veri'];
$this->uploadError($veri->toString());
break;
case self::UPLOAD_VERIFICATION_ERROR:
$error = $details['error'];
$this->uploadError($error);
break;
case self::UPLOAD_WARNING:
$warning = $details['warning'];
$this->uploadWarning($warning);
break;
case self::INTERNAL_ERROR:
$internal = $details['internal'];
$this->showError($internal);
break;
case 99:
$this->mainUploadForm('Type ' . $file_desc_msg . ' already exists');
break;
default:
throw new MWException(__METHOD__ . ": Unknown value `{$value}`");
}
}
示例3: processUpload
/**
* Do the upload
* Checks are made in SpecialUpload::execute()
*
* @access private
*/
function processUpload()
{
global $wgUser, $wgOut, $wgFileExtensions;
$details = null;
$value = null;
$value = $this->internalProcessUpload($details);
switch ($value) {
case self::SUCCESS:
$wgOut->redirect($this->mLocalFile->getTitle()->getFullURL());
break;
case self::BEFORE_PROCESSING:
break;
case self::LARGE_FILE_SERVER:
$this->mainUploadForm(wfMsgHtml('largefileserver'));
break;
case self::EMPTY_FILE:
$this->mainUploadForm(wfMsgHtml('emptyfile'));
break;
case self::MIN_LENGHT_PARTNAME:
$this->mainUploadForm(wfMsgHtml('minlength1'));
break;
case self::ILLEGAL_FILENAME:
$filtered = $details['filtered'];
$this->uploadError(wfMsgWikiHtml('illegalfilename', htmlspecialchars($filtered)));
break;
case self::PROTECTED_PAGE:
$this->uploadError(wfMsgWikiHtml('protectedpage'));
break;
case self::OVERWRITE_EXISTING_FILE:
$errorText = $details['overwrite'];
$overwrite = new WikiError($wgOut->parse($errorText));
$this->uploadError($overwrite->toString());
break;
case self::FILETYPE_MISSING:
$this->uploadError(wfMsgExt('filetype-missing', array('parseinline')));
break;
case self::FILETYPE_BADTYPE:
$finalExt = $details['finalExt'];
$this->uploadError(wfMsgExt('filetype-banned-type', array('parseinline'), htmlspecialchars($finalExt), implode(wfMsgExt('comma-separator', array('escapenoentities')), $wgFileExtensions)));
break;
case self::VERIFICATION_ERROR:
$veri = $details['veri'];
$this->uploadError($veri->toString());
break;
case self::UPLOAD_VERIFICATION_ERROR:
$error = $details['error'];
$this->uploadError($error);
break;
case self::UPLOAD_WARNING:
$warning = $details['warning'];
$this->uploadWarning($warning);
break;
case self::INTERNAL_ERROR:
$internal = $details['internal'];
$this->showError($internal);
break;
default:
throw new MWException(__METHOD__ . ": Unknown value `{$value}`");
}
}