本文整理汇总了PHP中wfMsgReplaceArgs函数的典型用法代码示例。如果您正苦于以下问题:PHP wfMsgReplaceArgs函数的具体用法?PHP wfMsgReplaceArgs怎么用?PHP wfMsgReplaceArgs使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wfMsgReplaceArgs函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: handleAutoEdit
/**
* Handles autoedit Ajax call from #autoedit parser function and from save
* and continue button.
*
* @param String $optionsString the options/data string
* @param String $prefillFromExisting String set to 'true' to retain existing form values (unset by save and continue)
* @return String
*/
static function handleAutoEdit( $optionsString = null, $prefillFromExisting = 'true' ) {
global $wgParser;
$handler = new self( null, 'sfautoedit' );
$handler->isApiQuery( false );
$options = $handler->setOptionsString( $optionsString );
// get oktext (or use default)
if ( array_key_exists( 'ok text', $options ) ) {
$oktext = $options['ok text'];
} else {
$oktext = wfMsg( 'sf_autoedit_success' );
}
// get errortext (or use default)
if ( array_key_exists( 'error text', $options ) ) {
$errortext = $options['error text'];
} else {
$errortext = '$1';
}
// process data
// result will be true or an error message
$result = $handler->storeSemanticData( $prefillFromExisting === 'true' );
// wrap result in ok/error message
if ( $result === true ) {
$options = $handler->getOptions();
$result = wfMsgReplaceArgs( $oktext, array( $options['target'], $options['form'] ) );
} else {
$result->setResponseCode( '400 Bad Request' );
$result = wfMsgReplaceArgs( $errortext, array( $result ) );
}
// initialize parser
$title = Title::newFromText( 'DummyTitle' );
if ( !StubObject::isRealObject( $wgParser ) ) {
$wgParser->_unstub();
}
$parseroptions = $wgParser->getOptions();
if ( $parseroptions == null ) {
$parseroptions = new ParserOptions();
$wgParser->Options( $parseroptions );
}
$parseroptions->enableLimitReport( false );
$result = new AjaxResponse( $wgParser->parse( $result, $title, $parseroptions )->getText() );
$result->setContentType( 'text/html' );
return $result;
}
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:68,代码来源:SF_AutoeditAPI.php
示例2: getMessage
function getMessage($messageCode)
{
$messageParameters = func_get_args();
array_shift($messageParameters);
$message = \wfMsgGetKey($messageCode, true, $this->languageCode);
$message = \wfMsgReplaceArgs($message, $messageParameters);
return $message;
}
开发者ID:mediawiki-extensions,项目名称:mediawiki-page-attachment,代码行数:8,代码来源:LocalizationHelper.php
示例3: msg
/**
* Get a message from i18n
*
* @param $key String: message name
* @param $fallback String: default message if the message cache can't be
* called by the exception
* The function also has other parameters that are arguments for the message
* @return String message with arguments replaced
*/
function msg($key, $fallback)
{
$args = array_slice(func_get_args(), 2);
if ($this->useMessageCache()) {
return wfMsgNoTrans($key, $args);
} else {
return wfMsgReplaceArgs($fallback, $args);
}
}
开发者ID:yusufchang,项目名称:app,代码行数:18,代码来源:Exception.php
示例4: intFunction
static function intFunction($parser, $part1 = '')
{
if (strval($part1) !== '') {
$args = array_slice(func_get_args(), 2);
$message = wfMsgGetKey($part1, true, false, false);
$message = wfMsgReplaceArgs($message, $args);
$message = $parser->replaceVariables($message);
// like $wgMessageCache->transform()
return $message;
} else {
return array('found' => false);
}
}
开发者ID:josephdye,项目名称:wikireader,代码行数:13,代码来源:CoreParserFunctions.php
示例5: plural
public static function plural($data, $params, $parser)
{
list($from, $to) = self::getRange(@$params['n']);
$args = explode('|', $data);
$lang = self::languageObject($params);
$format = isset($params['format']) ? $params['format'] : '%s';
$format = str_replace('\\n', "\n", $format);
$s = '';
for ($i = $from; $i <= $to; $i++) {
$t = $lang->convertPlural($i, $args);
$fmtn = $lang->formatNum($i);
$s .= str_replace(array('%d', '%s'), array($i, wfMsgReplaceArgs($t, array($fmtn))), $format);
}
return $s;
}
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:15,代码来源:I18nTags_body.php
示例6: run
/**
* Run the job
* @return boolean success
*/
function run()
{
global $wgUser, $wgCommandLineMode;
$oldUser = $wgUser;
$wgUser = User::newFromId($this->params['user']);
unset($this->params['user']);
$this->params['form'] = $this->title->getText();
$handler = new SFAutoeditAPI(null, 'sfautoedit');
$handler->isApiQuery(false);
$handler->setOptions($this->params);
$result = $handler->storeSemanticData(false);
// wrap result in ok/error message
if ($result === true) {
$options = $handler->getOptions();
$result = wfMsg('sf_autoedit_success', $options['target'], $options['form']);
} else {
$result = wfMsgReplaceArgs('$1', array($result));
}
$this->params = array('result' => $result, 'user' => $wgUser->getName());
wfDebugLog('sps', 'Page Creation Job: ' . $result);
$wgUser = $oldUser;
}
开发者ID:schwarer2006,项目名称:wikia,代码行数:26,代码来源:SPSPageCreationJob.php
示例7: parseMsg
/**
* Return the error message related to a certain array
* @param array $error Element of a getUserPermissionsErrors()-style array
* @return array('code' => code, 'info' => info)
*/
public function parseMsg($error)
{
$error = (array) $error;
// It seems strings sometimes make their way in here
$key = array_shift($error);
// Check whether the error array was nested
// array( array( <code>, <params> ), array( <another_code>, <params> ) )
if (is_array($key)) {
$error = $key;
$key = array_shift($error);
}
if ($key instanceof IApiMessage) {
return array('code' => $key->getApiCode(), 'info' => $key->inLanguage('en')->useDatabase(false)->text(), 'data' => $key->getApiData());
}
if (isset(self::$messageMap[$key])) {
return array('code' => wfMsgReplaceArgs(self::$messageMap[$key]['code'], $error), 'info' => wfMsgReplaceArgs(self::$messageMap[$key]['info'], $error));
}
// If the key isn't present, throw an "unknown error"
return $this->parseMsg(array('unknownerror', $key));
}
开发者ID:xiebinyi,项目名称:mediawiki,代码行数:25,代码来源:ApiBase.php
示例8: msgExt
/**
* Returns message in the requested format after parsing wikitext to html
* This is meant to be equivalent to wfMsgExt() with parse, parsemag and
* escape as available options but using the DPL local parser instead of
* the global one (bugfix).
*/
function msgExt($key, $options)
{
$args = func_get_args();
array_shift($args);
array_shift($args);
if (!is_array($options)) {
$options = array($options);
}
$string = wfMsgNoTrans($key);
$string = wfMsgReplaceArgs($string, $args);
if (in_array('parse', $options)) {
$this->mParserOptions->setInterfaceMessage(true);
$string = $this->mParser->recursiveTagParse($string);
$this->mParserOptions->setInterfaceMessage(false);
// $string = $parserOutput->getText();
} elseif (in_array('parsemag', $options)) {
$parser = new Parser();
$parserOptions = new ParserOptions();
$parserOptions->setInterfaceMessage(true);
$parser->startExternalParse($this->mParserTitle, $parserOptions, OT_MSG);
$string = $parser->transformMsg($string, $parserOptions);
}
if (in_array('escape', $options)) {
$string = htmlspecialchars($string);
}
return $string;
}
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:33,代码来源:DPL.php
示例9: msg
/**
* @param string $key
* @param string $fallback Unescaped alternative error text in case the
* message cache cannot be used. Can contain parameters as in regular
* messages, that should be passed as additional parameters.
* @return string Unprocessed plain error text with parameters replaced
*/
function msg($key, $fallback)
{
$args = array_slice(func_get_args(), 2);
if ($this->useMessageCache()) {
return wfMessage($key, $args)->useDatabase(false)->text();
} else {
return wfMsgReplaceArgs($fallback, $args);
}
}
开发者ID:D66Ha,项目名称:mediawiki,代码行数:16,代码来源:DatabaseError.php
示例10: wfMsgExt
/**
* Returns message in the requested format
* @param string $key Key of the message
* @param array $options Processing rules:
* <i>parse<i>: parses wikitext to html
* <i>parseinline<i>: parses wikitext to html and removes the surrounding p's added by parser or tidy
* <i>escape<i>: filters message trough htmlspecialchars
* <i>replaceafter<i>: parameters are substituted after parsing or escaping
*/
function wfMsgExt($key, $options)
{
global $wgOut, $wgMsgParserOptions, $wgParser;
$args = func_get_args();
array_shift($args);
array_shift($args);
if (!is_array($options)) {
$options = array($options);
}
$string = wfMsgGetKey($key, true, false, false);
if (!in_array('replaceafter', $options)) {
$string = wfMsgReplaceArgs($string, $args);
}
if (in_array('parse', $options)) {
$string = $wgOut->parse($string, true, true);
} elseif (in_array('parseinline', $options)) {
$string = $wgOut->parse($string, true, true);
$m = array();
if (preg_match("~^<p>(.*)\n?</p>\$~", $string, $m)) {
$string = $m[1];
}
} elseif (in_array('parsemag', $options)) {
global $wgTitle;
$parser = new Parser();
$parserOptions = new ParserOptions();
$parserOptions->setInterfaceMessage(true);
$parser->startExternalParse($wgTitle, $parserOptions, OT_MSG);
$string = $parser->transformMsg($string, $parserOptions);
}
if (in_array('escape', $options)) {
$string = htmlspecialchars($string);
}
if (in_array('replaceafter', $options)) {
$string = wfMsgReplaceArgs($string, $args);
}
return $string;
}
开发者ID:puring0815,项目名称:OpenKore,代码行数:46,代码来源:GlobalFunctions.php
示例11: msgExt
/**
* Returns message in the requested format after parsing wikitext to html
* This is meant to be equivalent to wfMsgExt() with parse, parsemag and escape as available options but using the DPL local parser instead of the global one (bugfix).
*/
function msgExt($key, $options)
{
$args = func_get_args();
array_shift($args);
array_shift($args);
if (!is_array($options)) {
$options = array($options);
}
$string = wfMsgNoTrans($key);
$string = wfMsgReplaceArgs($string, $args);
$this->mParserOptions->setInterfaceMessage(true);
$string = $this->mParser->recursiveTagParse($string);
$this->mParserOptions->setInterfaceMessage(false);
if (in_array('escape', $options)) {
$string = htmlspecialchars($string);
}
return $string;
}
开发者ID:Tjorriemorrie,项目名称:app,代码行数:22,代码来源:DPL.php
示例12: execute
public function execute()
{
$params = $this->extractRequestParams();
global $wgLang;
$oldLang = null;
if (!is_null($params['lang'])) {
$oldLang = $wgLang;
// Keep $wgLang for restore later
$wgLang = Language::factory($params['lang']);
}
$prop = array_flip((array) $params['prop']);
// Determine which messages should we print
if (in_array('*', $params['messages'])) {
$message_names = array_keys(Language::getMessagesFor('en'));
sort($message_names);
$messages_target = $message_names;
} else {
$messages_target = $params['messages'];
}
// Filter messages
if (isset($params['filter'])) {
$messages_filtered = array();
foreach ($messages_target as $message) {
// !== is used because filter can be at the beginning of the string
if (strpos($message, $params['filter']) !== false) {
$messages_filtered[] = $message;
}
}
$messages_target = $messages_filtered;
}
// Get all requested messages and print the result
$skip = !is_null($params['from']);
$useto = !is_null($params['to']);
$result = $this->getResult();
foreach ($messages_target as $message) {
// Skip all messages up to $params['from']
if ($skip && $message === $params['from']) {
$skip = false;
}
if ($useto && $message > $params['to']) {
break;
}
if (!$skip) {
$a = array('name' => $message);
$args = null;
if (isset($params['args']) && count($params['args']) != 0) {
$args = $params['args'];
}
// Check if the parser is enabled:
if ($params['enableparser']) {
$msg = wfMsgExt($message, array('parsemag'), $args);
} elseif ($args) {
$msgString = wfMsgGetKey($message, true, false, false);
$msg = wfMsgReplaceArgs($msgString, $args);
} else {
$msg = wfMsgGetKey($message, true, false, false);
}
if (wfEmptyMsg($message, $msg)) {
$a['missing'] = '';
} else {
ApiResult::setContent($a, $msg);
if (isset($prop['default'])) {
$default = wfMsgGetKey($message, false, false, false);
if ($default !== $msg) {
if (wfEmptyMsg($message, $default)) {
$a['defaultmissing'] = '';
} else {
$a['default'] = $default;
}
}
}
}
$fit = $result->addValue(array('query', $this->getModuleName()), null, $a);
if (!$fit) {
$this->setContinueEnumParameter('from', $message);
break;
}
}
}
$result->setIndexedTagName_internal(array('query', $this->getModuleName()), 'message');
if (!is_null($oldLang)) {
$wgLang = $oldLang;
// Restore $oldLang
}
}
开发者ID:GodelDesign,项目名称:Godel,代码行数:85,代码来源:ApiQueryAllmessages.php
示例13: reallyMakeHelpMsg
/**
* @return mixed|string
*/
public function reallyMakeHelpMsg()
{
$this->setHelp();
// Use parent to make default message for the main module
$msg = parent::makeHelpMsg();
$astriks = str_repeat('*** ', 14);
$msg .= "\n\n{$astriks} Modules {$astriks}\n\n";
foreach (array_keys($this->mModules) as $moduleName) {
$module = new $this->mModules[$moduleName]($this, $moduleName);
$msg .= self::makeHelpMsgHeader($module, 'action');
$msg2 = $module->makeHelpMsg();
if ($msg2 !== false) {
$msg .= $msg2;
}
$msg .= "\n";
}
$msg .= "\n{$astriks} Permissions {$astriks}\n\n";
foreach (self::$mRights as $right => $rightMsg) {
$groups = User::getGroupsWithPermission($right);
$msg .= "* " . $right . " *\n " . wfMsgReplaceArgs($rightMsg['msg'], $rightMsg['params']) . "\nGranted to:\n " . str_replace('*', 'all', implode(', ', $groups)) . "\n\n";
}
$msg .= "\n{$astriks} Formats {$astriks}\n\n";
foreach (array_keys($this->mFormats) as $formatName) {
$module = $this->createPrinterByName($formatName);
$msg .= self::makeHelpMsgHeader($module, 'format');
$msg2 = $module->makeHelpMsg();
if ($msg2 !== false) {
$msg .= $msg2;
}
$msg .= "\n";
}
$msg .= "\n*** Credits: ***\n " . implode("\n ", $this->getCredits()) . "\n";
return $msg;
}
开发者ID:eFFemeer,项目名称:seizamcore,代码行数:37,代码来源:ApiMain.php
示例14: parserFunction_ev
/**
* Embeds video of the chosen service
* @param Parser $parser Instance of running Parser.
* @param String $service Which online service has the video.
* @param String $id Identifier of the chosen service
* @param String $width Width of video (optional)
* @param String $desc description to show (optional)
* @param String $align alignment of the video (optional)
* @return String Encoded representation of input params (to be processed later)
*/
public static function parserFunction_ev($parser, $service = null, $id = null, $width = null, $align = null, $desc = null)
{
global $wgScriptPath;
// Initialize things once
if (!self::$initialized) {
self::VerifyWidthMinAndMax();
self::$initialized = true;
}
// Get the name of the host
if ($service === null || $id === null) {
return self::errMissingParams($service, $id);
}
$service = trim($service);
$id = trim($id);
$desc = $parser->recursiveTagParse($desc);
$entry = self::getServiceEntry($service);
if (!$entry) {
return self::errBadService($service);
}
if (!self::sanitizeWidth($entry, $width)) {
return self::errBadWidth($width);
}
$height = self::getHeight($entry, $width);
$hasalign = $align !== null || $align == 'auto';
if ($hasalign) {
$align = trim($align);
if (!self::validateAlignment($align)) {
return self::errBadAlignment($align);
}
$desc = self::getDescriptionMarkup($desc);
}
// If the service has an ID pattern specified, verify the id number
if (!self::verifyID($entry, $id)) {
return self::errBadID($service, $id);
}
$url = null;
// If service is Yandex -> use own parser
if ($service == 'yandex' || $service == 'yandexvideo') {
$url = self::getYandex($id);
$url = htmlspecialchars_decode($url);
}
// if the service has it's own custom extern declaration, use that instead
if (array_key_exists('extern', $entry) && ($clause = $entry['extern']) != NULL) {
if ($service == 'screen9') {
$clause = self::parseScreen9Id($id, $width, $height);
if ($clause == null) {
return self::errBadScreen9Id();
}
} else {
$clause = wfMsgReplaceArgs($clause, array($wgScriptPath, $id, $width, $height, $url));
}
if ($hasalign) {
$clause = self::generateAlignExternClause($clause, $align, $desc, $width, $height);
}
return array($clause, 'noparse' => true, 'isHTML' => true);
}
// Build URL and output embedded flash object
$url = wfMsgReplaceArgs($entry['url'], array($id, $width, $height));
$clause = "";
// If service is RuTube -> use own parser
if ($service == 'rutube') {
$url = self::getRuTube($id);
}
if ($hasalign) {
$clause = self::generateAlignClause($url, $width, $height, $align, $desc);
} else {
$clause = self::generateNormalClause($url, $width, $height);
}
return array($clause, 'noparse' => true, 'isHTML' => true);
}
开发者ID:Whiteknight,项目名称:mediawiki-embedvideo,代码行数:80,代码来源:EmbedVideo.hooks.php
示例15: parseMsg
/**
* Return the error message related to a certain array
* @param $error array Element of a getUserPermissionsErrors()-style array
* @return array('code' => code, 'info' => info)
*/
public function parseMsg($error)
{
$key = array_shift($error);
if (isset(self::$messageMap[$key])) {
return array('code' => wfMsgReplaceArgs(self::$messageMap[$key]['code'], $error), 'info' => wfMsgReplaceArgs(self::$messageMap[$key]['info'], $error));
}
// If the key isn't present, throw an "unknown error"
return $this->parseMsg(array('unknownerror', $key));
}
开发者ID:rocLv,项目名称:conference,代码行数:14,代码来源:ApiBase.php
示例16: wfMsgReal
/**
* Really get a message
* @return $key String: key to get.
* @return $args
* @return $useDB Boolean
* @return String: the requested message.
*/
function wfMsgReal($key, $args, $useDB = true, $forContent = false, $transform = true)
{
$fname = 'wfMsgReal';
$message = wfMsgGetKey($key, $useDB, $forContent, $transform);
$message = wfMsgReplaceArgs($message, $args);
return $message;
}
开发者ID:schwarer2006,项目名称:wikia,代码行数:14,代码来源:GlobalFunctions.php
示例17: formatRow
/**
* Callback function to output a block
*/
function formatRow($block)
{
global $wgUser, $wgLang;
wfProfileIn(__METHOD__);
static $sk = null, $msg = null;
if (is_null($sk)) {
$sk = $wgUser->getSkin();
}
if (is_null($msg)) {
$msg = array();
$keys = array('infiniteblock', 'expiringblock', 'contribslink', 'unblocklink', 'anononlyblock', 'createaccountblock');
foreach ($keys as $key) {
$msg[$key] = wfMsgHtml($key);
}
$msg['blocklistline'] = wfMsg('blocklistline');
$msg['contribslink'] = wfMsg('contribslink');
}
# Prepare links to the blocker's user and talk pages
$blocker_name = $block->getByName();
$blocker = $sk->MakeLinkObj(Title::makeTitle(NS_USER, $blocker_name), $blocker_name);
$blocker .= ' (' . $sk->makeLinkObj(Title::makeTitle(NS_USER_TALK, $blocker_name), $wgLang->getNsText(NS_TALK)) . ')';
# Prepare links to the block target's user and contribs. pages (as applicable, don't do it for autoblocks)
if ($block->mAuto) {
$target = $block->getRedactedName();
# Hide the IP addresses of auto-blocks; privacy
} else {
$target = $sk->makeLinkObj(Title::makeTitle(NS_USER, $block->mAddress), $block->mAddress);
$target .= ' (' . $sk->makeKnownLinkObj(Title::makeTitle(NS_SPECIAL, 'Contributions'), $msg['contribslink'], 'target=' . urlencode($block->mAddress)) . ')';
}
$formattedTime = $wgLang->timeanddate($block->mTimestamp, true);
$properties = array();
if ($block->mExpiry === "" || $block->mExpiry === Block::infinity()) {
$properties[] = $msg['infiniteblock'];
} else {
$properties[] = wfMsgReplaceArgs($msg['expiringblock'], array($wgLang->timeanddate($block->mExpiry, true)));
}
if ($block->mAnonOnly) {
$properties[] = $msg['anononlyblock'];
}
if ($block->mCreateAccount) {
$properties[] = $msg['createaccountblock'];
}
$properties = implode(', ', $properties);
$line = wfMsgReplaceArgs($msg['blocklistline'], array($formattedTime, $blocker, $target, $properties));
$s = "<li>{$line}";
if ($wgUser->isAllowed('block')) {
$titleObj = Title::makeTitle(NS_SPECIAL, "Ipblocklist");
$s .= ' (' . $sk->makeKnownLinkObj($titleObj, $msg['unblocklink'], 'action=unblock&id=' . urlencode($block->mId)) . ')';
}
$s .= $sk->commentBlock($block->mReason);
$s .= "</li>\n";
wfProfileOut(__METHOD__);
return $s;
}
开发者ID:puring0815,项目名称:OpenKore,代码行数:57,代码来源:SpecialIpblocklist.php
示例18: doRollback
private static function doRollback()
{
global $wgRequest, $wgOut, $wgContLang;
$wgOut->setArticleBodyOnly(true);
$response = "";
$aid = intVal($wgRequest->getVal('aid'));
$oldid = intVal($wgRequest->getVal('old'));
$from = $wgRequest->getVal('from');
$from = preg_replace('/[_-]/', ' ', $from);
$t = Title::newFromId($aid);
if ($t && $t->exists()) {
$r = Revision::newFromId($oldid);
if ($r) {
if ($from == '') {
// no public user name
$summary = wfMessage('rcp-revertpage-nouser');
} else {
$summary = wfMessage('rcp-revertpage');
}
// Allow the custom summary to use the same args as the default message
$args = array($r->getUserText(), $from, $oldid);
if ($summary instanceof Message) {
$summary = $summary->params($args)->inContentLanguage()->text();
} else {
$summary = wfMsgReplaceArgs($summary, $args);
}
// Trim spaces on user supplied text
$summary = trim($summary);
// Truncate for whole multibyte characters.
$summary = $wgContLang->truncate($summary, 255);
$a = new Article($t);
$newRev = Revision::newFromTitle($t);
$old = Linker::revUserTools(Revision::newFromId($oldid));
$new = Linker::revUserTools($newRev);
$revision = 'r' . htmlspecialchars($wgContLang->formatNum($oldid, true));
$revlink = Linker::link($t, $revision, array(), array('oldid' => $oldid, 'diff' => 'prev'));
$response = WfMessage('rcp-rollback-success')->rawParams($new, $old, $revlink);
$status = $a->doEditContent($r->getContent(), $summary);
if (!$status->isOK()) {
$response = $status->getErrorsArray();
}
// raise error, when the edit is an edit without a new version
if (empty($status->value['revision'])) {
$resultDetails = array('current' => $current);
$query = array('oldid' => $oldid, 'diff' => 'prev');
$response = WfMessage('rcp-alreadyrolled')->params(array(htmlspecialchars($t->getPrefixedText()), htmlspecialchars($from), htmlspecialchars($newRev->getUserText())))->inContentLanguage()->parse();
}
}
}
$wgOut->addHtml($response);
}
开发者ID:biribogos,项目名称:wikihow-src,代码行数:51,代码来源:RCPatrol.body.php
示例19: addRow
/**
* Callback function to output a block
*/
function addRow($block, $tag)
{
global $wgOut, $wgUser, $wgLang;
if ($this->ip != '') {
if ($block->mAuto) {
if (stristr($block->mId, $this->ip) == false) {
return;
}
} else {
if (stristr($block->mAddress, $this->ip) == false) {
return;
}
}
}
// Loading blocks is fast; displaying them is slow.
// Quick hack for paging.
$this->counter++;
if ($this->counter <= $this->offset) {
return;
}
if ($this->counter - $this->offset > $this->limit) {
return;
}
$fname = 'IPUnblockForm-addRow';
wfProfileIn($fname);
static $sk = null, $msg = null;
if (is_null($sk)) {
$sk = $wgUser->getSkin();
}
if (is_null($msg)) {
$msg = array();
foreach (array('infiniteblock', 'expiringblock', 'contribslink', 'unblocklink') as $key) {
$msg[$key] = wfMsgHtml($key);
}
$msg['blocklistline'] = wfMsg('blocklistline');
$msg['contribslink'] = wfMsg('contribslink');
}
# Prepare links to the blocker's user and talk pages
$blocker_name = $block->getByName();
$blocker = $sk->MakeLinkObj(Title::makeTitle(NS_USER, $blocker_name), $blocker_name);
$blocker .= ' (' . $sk->makeLinkObj(Title::makeTitle(NS_USER_TALK, $blocker_name), $wgLang->getNsText(NS_TALK)) . ')';
# Prepare links to the block target's user and contribs. pages (as applicable, don't do it for autoblocks)
if ($block->mAuto) {
$target = '#' . $block->mId;
# Hide the IP addresses of auto-blocks; privacy
} else {
$target = $sk->makeLinkObj(Title::makeTitle(NS_USER, $block->mAddress), $block->mAddress);
$target .= ' (' . $sk->makeKnownLinkObj(Title::makeTitle(NS_SPECIAL, 'Contributions'), $msg['contribslink'], 'target=' . urlencode($block->mAddress)) . ')';
}
# Prep the address for the unblock link, masking autoblocks as before
$addr = $block->mAuto ? '#' . $block->mId : $block->mAddress;
$formattedTime = $wgLang->timeanddate($block->mTimestamp, true);
if ($block->mExpiry === "") {
$formattedExpiry = $msg['infiniteblock'];
} else {
$formattedExpiry = wfMsgReplaceArgs($msg['expiringblock'], array($wgLang->timeanddate($block->mExpiry, true)));
}
$line = wfMsgReplaceArgs($msg['blocklistline'], array($formattedTime, $blocker, $target, $formattedExpiry));
$wgOut->addHTML("<li>{$line}");
if ($wgUser->isAllowed('block')) {
$titleObj = Title::makeTitle(NS_SPECIAL, "Ipblocklist");
$wgOut->addHTML(' (' . $sk->makeKnownLinkObj($titleObj, $msg['unblocklink'], 'action=unblock&ip=' . urlencode($addr)) . ')');
}
$wgOut->addHTML($sk->commentBlock($block->mReason));
$wgOut->addHTML("</li>\n");
wfProfileOut($fname);
}
开发者ID:k-hasan-19,项目名称:wiki,代码行数:70,代码来源:SpecialIpblocklist.php
示例20: msg
/**
* @param string $key
* @param string $fallback Unescaped alternative error text in case the
* message cache cannot be used. Can contain parameters as in regular
* messages, that should be passed as additional parameters.
* @return string Unprocessed plain error text with parameters replaced
*/
function msg($key, $fallback)
{
global $wgLang;
$args = array_slice(func_get_args(), 2);
if ($this->useMessageCache()) {
$message = $wgLang->getMessage($key);
} else {
$message = $fallback;
}
return wfMsgReplaceArgs($message, $args);
}
开发者ID:Tarendai,项目名称:spring-website,代码行数:18,代码来源:DatabaseError.php
注:本文中的wfMsgReplaceArgs函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论