本文整理汇总了PHP中wfMessage函数的典型用法代码示例。如果您正苦于以下问题:PHP wfMessage函数的具体用法?PHP wfMessage怎么用?PHP wfMessage使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wfMessage函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
function execute($query)
{
global $wgOut;
wfProfileIn('SpecialURIResolver::execute (SMW)');
if (is_null($query) || trim($query) === '') {
if (stristr($_SERVER['HTTP_ACCEPT'], 'RDF')) {
$wgOut->redirect(SpecialPage::getTitleFor('ExportRDF')->getFullURL(array('stats' => '1')), '303');
} else {
$this->setHeaders();
$wgOut->addHTML('<p>' . wfMessage('smw_uri_doc', 'http://www.w3.org/2001/tag/issues.html#httpRange-14')->parse() . '</p>');
}
} else {
$query = SMWExporter::decodeURI($query);
$query = str_replace('_', '%20', $query);
$query = urldecode($query);
$title = Title::newFromText($query);
// In case the title doesn't exists throw an error page
if ($title === null) {
$wgOut->showErrorPage('badtitle', 'badtitletext');
} else {
$wgOut->redirect(stristr($_SERVER['HTTP_ACCEPT'], 'RDF') ? SpecialPage::getTitleFor('ExportRDF', $title->getPrefixedText())->getFullURL(array('xmlmime' => 'rdf')) : $title->getFullURL(), '303');
}
}
wfProfileOut('SpecialURIResolver::execute (SMW)');
}
示例2: doTagRow
function doTagRow($tag, $hitcount)
{
static $sk = null, $doneTags = array();
if (!$sk) {
$sk = $this->getSkin();
}
if (in_array($tag, $doneTags)) {
return '';
}
global $wgLang;
$newRow = '';
$newRow .= Xml::tags('td', null, Xml::element('tt', null, $tag));
$disp = ChangeTags::tagDescription($tag);
$disp .= ' (' . $sk->link(Title::makeTitle(NS_MEDIAWIKI, "Tag-{$tag}"), wfMsgHtml('tags-edit')) . ')';
$newRow .= Xml::tags('td', null, $disp);
$msg = wfMessage("tag-{$tag}-description");
$desc = !$msg->exists() ? '' : $msg->parse();
$desc .= ' (' . $sk->link(Title::makeTitle(NS_MEDIAWIKI, "Tag-{$tag}-description"), wfMsgHtml('tags-edit')) . ')';
$newRow .= Xml::tags('td', null, $desc);
$hitcount = wfMsgExt('tags-hitcount', array('parsemag'), $wgLang->formatNum($hitcount));
$hitcount = $sk->link(SpecialPage::getTitleFor('Recentchanges'), $hitcount, array(), array('tagfilter' => $tag));
$newRow .= Xml::tags('td', null, $hitcount);
$doneTags[] = $tag;
return Xml::tags('tr', null, $newRow) . "\n";
}
示例3: testErrorFormatterBC
/**
* @covers ApiErrorFormatter_BackCompat
*/
public function testErrorFormatterBC()
{
$mainpagePlain = wfMessage('mainpage')->useDatabase(false)->plain();
$parensPlain = wfMessage('parentheses', 'foobar')->useDatabase(false)->plain();
$result = new ApiResult(8388608);
$formatter = new ApiErrorFormatter_BackCompat($result);
$formatter->addWarning('string', 'mainpage');
$formatter->addError('err', 'mainpage');
$this->assertSame(array('error' => array('code' => 'mainpage', 'info' => $mainpagePlain), 'warnings' => array('string' => array('warnings' => $mainpagePlain, ApiResult::META_CONTENT => 'warnings')), ApiResult::META_TYPE => 'assoc'), $result->getResultData(), 'Simple test');
$result->reset();
$formatter->addWarning('foo', 'mainpage');
$formatter->addWarning('foo', 'mainpage');
$formatter->addWarning('foo', array('parentheses', 'foobar'));
$msg1 = wfMessage('mainpage');
$formatter->addWarning('message', $msg1);
$msg2 = new ApiMessage('mainpage', 'overriddenCode', array('overriddenData' => true));
$formatter->addWarning('messageWithData', $msg2);
$formatter->addError('errWithData', $msg2);
$this->assertSame(array('error' => array('code' => 'overriddenCode', 'info' => $mainpagePlain, 'overriddenData' => true), 'warnings' => array('messageWithData' => array('warnings' => $mainpagePlain, ApiResult::META_CONTENT => 'warnings'), 'message' => array('warnings' => $mainpagePlain, ApiResult::META_CONTENT => 'warnings'), 'foo' => array('warnings' => "{$mainpagePlain}\n{$parensPlain}", ApiResult::META_CONTENT => 'warnings')), ApiResult::META_TYPE => 'assoc'), $result->getResultData(), 'Complex test');
$result->reset();
$status = Status::newGood();
$status->warning('mainpage');
$status->warning('parentheses', 'foobar');
$status->warning($msg1);
$status->warning($msg2);
$status->error('mainpage');
$status->error('parentheses', 'foobar');
$formatter->addMessagesFromStatus('status', $status);
$this->assertSame(array('error' => array('code' => 'parentheses', 'info' => $parensPlain), 'warnings' => array('status' => array('warnings' => "{$mainpagePlain}\n{$parensPlain}", ApiResult::META_CONTENT => 'warnings')), ApiResult::META_TYPE => 'assoc'), $result->getResultData(), 'Status test');
$I = ApiResult::META_INDEXED_TAG_NAME;
$this->assertSame(array(array('type' => 'error', 'message' => 'mainpage', 'params' => array($I => 'param')), array('type' => 'error', 'message' => 'parentheses', 'params' => array('foobar', $I => 'param')), $I => 'error'), $formatter->arrayFromStatus($status, 'error'), 'arrayFromStatus test for error');
$this->assertSame(array(array('type' => 'warning', 'message' => 'mainpage', 'params' => array($I => 'param')), array('type' => 'warning', 'message' => 'parentheses', 'params' => array('foobar', $I => 'param')), array('message' => 'mainpage', 'params' => array($I => 'param'), 'type' => 'warning'), array('message' => 'mainpage', 'params' => array($I => 'param'), 'type' => 'warning'), $I => 'warning'), $formatter->arrayFromStatus($status, 'warning'), 'arrayFromStatus test for warning');
}
示例4: execute
public function execute($params = false)
{
$sEditLinkText = wfMessage('bs-widget-edit')->text();
$oTitle = Title::makeTitle(NS_USER, RequestContext::getMain()->getUser()->getName() . '/Widgetbar');
$sEditLink = Linker::link($oTitle, Html::rawElement('span', array(), $sEditLinkText), array('id' => 'bs-widgetbar-edit', 'class' => 'icon-pencil clearfix'), array('action' => 'edit', 'preload' => ''));
$aOut = array();
$aOut[] = '<div id="bs-widget-container" >';
$aOut[] = ' <div class="icon-plus" id="bs-widget-tab" title="' . wfMessage('bs-widget-container-tooltip')->text() . '" tabindex="100">[+/-]</div>';
$aOut[] = ' <div id="bs-flyout">';
$aOut[] = ' <h4 id="bs-flyout-heading">' . wfMessage('bs-widget-flyout-heading')->text() . '</h4>';
$aOut[] = ' <div id="bs-flyout-content">';
$aOut[] = ' <div id="bs-flyout-content-widgets">';
$aOut[] = ' <h4 id="bs-flyout-content-widgets-header">' . wfMessage("bs-widget-flyout-heading")->plain() . $sEditLink . '</h4>';
foreach ($this->_mWidgets as $oWidgetView) {
if ($oWidgetView instanceof ViewWidget) {
$aOut[] = $oWidgetView->execute();
} else {
wfDebug(__METHOD__ . ': Invalid widget.');
}
}
$aOut[] = ' </div>';
$aOut[] = ' </div>';
$aOut[] = ' </div>';
$aOut[] = '</div>';
return implode("\n", $aOut);
}
示例5: formatLogEntry
static function formatLogEntry($type, $action, $title, $sk, $parameters)
{
$msg = "lqt-log-action-{$action}";
switch ($action) {
case 'merge':
if ($parameters[0]) {
$msg = 'lqt-log-action-merge-across';
} else {
$msg = 'lqt-log-action-merge-down';
}
break;
case 'move':
$smt = new SpecialMoveThread();
$rightsCheck = $smt->checkUserRights($parameters[1] instanceof Title ? $parameters[1] : Title::newFromText($parameters[1]), $parameters[0] instanceof Title ? $parameters[0] : Title::newFromText($parameters[0]));
if ($rightsCheck === true) {
$parameters[] = Message::rawParam(Linker::link(SpecialPage::getTitleFor('MoveThread', $title), wfMessage('revertmove')->text(), array(), array('dest' => $parameters[0])));
} else {
$parameters[] = '';
}
break;
default:
// Give grep a chance to find the usages:
// lqt-log-action-move, lqt-log-action-split, lqt-log-action-subjectedit,
// lqt-log-action-resort, lqt-log-action-signatureedit
$msg = "lqt-log-action-{$action}";
break;
}
array_unshift($parameters, $title->getPrefixedText());
$html = wfMessage($msg, $parameters);
if ($sk === null) {
return StringUtils::delimiterReplace('<', '>', '', $html->inContentLanguage()->parse());
}
return $html->parse();
}
示例6: wfRelationshipRequestResponse
function wfRelationshipRequestResponse($response, $requestId)
{
global $wgUser;
$out = '';
$rel = new UserRelationship($wgUser->getName());
if ($rel->verifyRelationshipRequest($requestId) == true) {
$request = $rel->getRequest($requestId);
$user_name_from = $request[0]['user_name_from'];
$user_id_from = User::idFromName($user_name_from);
$rel_type = strtolower($request[0]['type']);
$response = isset($_POST['response']) ? $_POST['response'] : $response;
$rel->updateRelationshipRequestStatus($requestId, intval($response));
$avatar = new wAvatar($user_id_from, 'l');
$avatar_img = $avatar->getAvatarURL();
if ($response == 1) {
$rel->addRelationship($requestId);
$out .= "<div class=\"relationship-action red-text\">\n\t\t\t\t{$avatar_img}" . wfMessage("ur-requests-added-message-{$rel_type}", $user_name_from)->escaped() . '<div class="cleared"></div>
</div>';
} else {
$out .= "<div class=\"relationship-action red-text\">\n\t\t\t\t{$avatar_img}" . wfMessage("ur-requests-reject-message-{$rel_type}", $user_name_from)->escaped() . '<div class="cleared"></div>
</div>';
}
$rel->deleteRequest($requestId);
}
return $out;
}
示例7: efAddResourceSpecialPage
function efAddResourceSpecialPage($template, $links)
{
global $wgTitle, $wgRequest, $wgUser, $wgAddResourceTab;
// return if we are not on the right special page
if (!$wgTitle->isSpecial('AddResource')) {
return true;
}
// parse subpage-part. We cannot use $wgTitle->getSubpage() because the
// special namespaces doesn't have real subpages
$prefixedText = $wgTitle->getPrefixedText();
if (strpos($prefixedText, '/') === FALSE) {
return true;
// no page given
}
$parts = explode('/', $prefixedText);
$pageName = $parts[count($parts) - 1];
$title = Title::newFromText($pageName)->getSubjectPage();
$talkTitle = $title->getTalkPage();
// Get AddResource URL:
$resourceCount = getResourceCount($title);
$resourcesUrl = getResourcesUrl($title);
$resourcesText = getResourceTabText($resourceCount);
$resourcesClass = $resourceCount > 0 ? 'is_resources' : 'new is_resources';
$head = array($title->getNamespaceKey('') => array('class' => $title->exists() ? null : 'new', 'text' => $title->getText(), 'href' => $title->getLocalUrl()), 'resources' => array('class' => $resourcesClass, 'text' => $resourcesText, 'href' => $resourcesUrl));
$tail = array($title->getNamespaceKey('') . '_talk' => array('class' => $talkTitle->exists() ? null : 'new', 'text' => wfMessage('Talk')->text(), 'href' => $talkTitle->getLocalUrl()));
$resourceCount = getResourceCount($title);
$links['namespaces'] = array_merge($head, $links['namespaces'], $tail);
$links['namespaces']['special']['text'] = '+';
return true;
}
示例8: getTypeProperties
protected function getTypeProperties($typeLabel)
{
global $wgRequest, $smwgTypePagingLimit;
if ($smwgTypePagingLimit <= 0) {
return '';
}
// not too useful, but we comply to this request
$from = $wgRequest->getVal('from');
$until = $wgRequest->getVal('until');
$typeValue = SMWDataValueFactory::newTypeIDValue('__typ', $typeLabel);
if (!$typeValue->isValid()) {
return $this->msg('smw-special-types-no-such-type')->escaped();
}
$store = smwfGetStore();
$options = SMWPageLister::getRequestOptions($smwgTypePagingLimit, $from, $until);
$diWikiPages = $store->getPropertySubjects(new SMWDIProperty('_TYPE'), $typeValue->getDataItem(), $options);
if (!$options->ascending) {
$diWikiPages = array_reverse($diWikiPages);
}
$result = '';
if (count($diWikiPages) > 0) {
$pageLister = new SMWPageLister($diWikiPages, null, $smwgTypePagingLimit, $from, $until);
$title = $this->getTitleFor('Types', $typeLabel);
$title->setFragment('#SMWResults');
// Make navigation point to the result list.
$navigation = $pageLister->getNavigationLinks($title);
$resultNumber = min($smwgTypePagingLimit, count($diWikiPages));
$typeName = $typeValue->getLongWikiText();
$result .= "<a name=\"SMWResults\"></a><div id=\"mw-pages\">\n" . '<h2>' . wfMessage('smw_type_header', $typeName)->text() . "</h2>\n<p>" . wfMsgExt('smw_typearticlecount', array('parsemag'), $resultNumber) . "</p>\n" . $navigation . $pageLister->formatList() . $navigation . "\n</div>";
}
return $result;
}
示例9: logFeedback
public function logFeedback($params, $itemId)
{
$title = SpecialPage::getTitleFor('FeedbackDashboard', $itemId);
$reason = wfMessage('moodbar-log-reason')->params($params['type'], $params['comment'])->text();
$log = new LogPage('moodbar');
$log->addEntry('feedback', $title, $reason);
}
示例10: renderMessageHtml
/**
* Render message box with system messages, e.g. errors or already logged-in notices
*
* @param string $action The type of action the page is used for ('login' or 'signup')
* @param bool $register Whether the user can register an account
*/
protected function renderMessageHtml($action, $register = false)
{
$msgBox = '';
// placeholder for displaying any login-related system messages (eg errors)
$message = $this->data['message'];
$messageType = $this->data['messagetype'];
// FIXME: Migrate this to a server-side Mustache template
// If there is a system message (error, warning, or success) display that
if ($message && $messageType) {
$msgBox .= Html::openElement('div', array('class' => $messageType . 'box'));
$msgBox .= $message;
$msgBox .= Html::closeElement('div');
// Render already logged-in notice
} elseif ($this->data['loggedin']) {
$msg = $register ? 'mobile-frontend-userlogin-loggedin-register' : 'userlogin-loggedin';
$msgBox .= Html::openElement('div', array('class' => 'warningbox'));
$msgBox .= wfMessage($msg)->params($this->data['loggedinuser'])->parse();
$msgBox .= Html::closeElement('div');
// Show default welcome message
} else {
// The warningbox class is used more for informational purposes than actual warnings.
$msgBox .= Html::openElement('div', array('class' => 'warningbox'));
$headerMsg = wfMessage('mobile-frontend-generic-login')->parse();
$msgBox .= Html::element('strong', array(), $headerMsg);
$msgBox .= Html::element('br');
$msgBox .= wfMessage("mobile-frontend-generic-{$action}-action")->plain();
$msgBox .= Html::closeElement('div');
$msgBox .= $this->getLogoHtml();
}
echo $msgBox;
}
开发者ID:GoProjectOwner,项目名称:mediawiki-extensions-MobileFrontend,代码行数:37,代码来源:UserLoginAndCreateTemplate.php
示例11: getResultText
/**
* @see SMWResultPrinter::getResultText
*
* @param SMWQueryResult $result
* @param $outputMode
*
* @return string
*/
protected function getResultText(SMWQueryResult $result, $outputMode)
{
// Data processing
// It is advisable to separate data processing from output logic
$data = $this->getResultData($result, $outputMode);
// Check if the data processing returned any results otherwise just bailout
if ($data === array()) {
// Add an error message to return method
return $result->addErrors(array(wfMessage('srf-no-results')->inContentLanguage()->text()));
} else {
// Add options if needed to format the output
// $outputMode can be specified as
// SMW_OUTPUT_HTML
// SMW_OUTPUT_FILE
// SMW_OUTPUT_WIKI
// For implementing template support this options has to be set but if you
// manipulate data via jQuery/JavaScript it is less likely that you need
// this option since templates will influence how wiki text is parsed
// but will have no influence in how a HTML representation is altered
// $this->hasTemplates = true;
$options = array('mode' => $outputMode);
// Return formatted results
return $this->getFormatOutput($data, $options);
}
}
示例12: requireLoginAnonProvider
public function requireLoginAnonProvider()
{
$lang = 'en';
$expected1 = wfMessage('exception-nologin-text')->inLanguage($lang)->text();
$expected2 = wfMessage('about')->inLanguage($lang)->text();
return array(array($expected1, null, null), array($expected2, 'about', null), array($expected2, 'about', 'about'));
}
示例13: execute
function execute($category)
{
global $wgUser, $wgRequest, $wgOut, $wgPageSchemasHandlerClasses;
if (!$wgUser->isAllowed('generatepages')) {
$wgOut->permissionRequired('generatepages');
return;
}
$this->setHeaders();
$param = $wgRequest->getText('param');
if (!empty($param) && !empty($category)) {
// Generate the pages!
$this->generatePages($param, $wgRequest->getArray('page'));
$text = Html::element('p', null, wfMessage('ps-generatepages-success')->parse());
$wgOut->addHTML($text);
return true;
}
if ($category == "") {
// No category listed.
// TODO - show an error message.
return true;
}
// Standard "generate pages" form, with category name set.
// Check for a valid category, with a page schema defined.
$pageSchemaObj = new PSSchema($category);
if (!$pageSchemaObj->isPSDefined()) {
$text = Html::element('p', null, wfMessage('ps-generatepages-noschema')->parse());
$wgOut->addHTML($text);
return true;
}
$text = Html::element('p', null, wfMessage('ps-generatepages-desc')->parse()) . "\n";
$text .= '<form method="post">';
$text .= Html::input('param', $category, 'hidden') . "\n";
$text .= '<div id="ps_check_all_check_none">
<input type="button" id="ps_check_all" value="' . wfMessage('powersearch-toggleall')->parse() . '" />
<input type="button" id="ps_check_none" value="' . wfMessage('powersearch-togglenone')->parse() . '" />
</div><br/>';
$wgOut->addModules('ext.pageschemas.generatepages');
// This hook will set an array of strings, with each value
// as a title of a page to be created.
$pageList = array();
foreach ($wgPageSchemasHandlerClasses as $psHandlerClass) {
$pagesFromHandler = call_user_func(array($psHandlerClass, "getPagesToGenerate"), $pageSchemaObj);
foreach ($pagesFromHandler as $page) {
$pageList[] = $page;
}
}
foreach ($pageList as $page) {
if (!$page instanceof Title) {
continue;
}
$pageName = PageSchemas::titleString($page);
$text .= Html::input('page[]', $pageName, 'checkbox', array('checked' => true));
$text .= "\n" . Linker::link($page) . "<br />\n";
}
$text .= "<br />\n";
$text .= Html::input(null, wfMessage('generatepages')->parse(), 'submit');
$text .= "\n</form>";
$wgOut->addHTML($text);
return true;
}
示例14: getFormatOutput
/**
* Prepare data output
*
* @since 1.8
*
* @param array $data label => value
*/
protected function getFormatOutput(array $data)
{
static $statNr = 0;
$chartID = 'jqplot-' . $this->params['charttype'] . '-' . ++$statNr;
$this->isHTML = true;
// Prepare data objects
if (in_array($this->params['charttype'], array('bar', 'line'))) {
// Parse bar relevant data
$dataObject = $this->prepareBarData($data);
} elseif (in_array($this->params['charttype'], array('pie', 'donut'))) {
//Parse pie/donut relevant data
$dataObject = $this->preparePieData($data);
} else {
// Return with an error
return Html::rawElement('span', array('class' => "error"), wfMessage('srf-error-missing-layout')->inContentLanguage()->text());
}
// Encode data objects
$requireHeadItem = array($chartID => FormatJson::encode($dataObject));
SMWOutputs::requireHeadItem($chartID, Skin::makeVariablesScript($requireHeadItem));
// Processing placeholder
$processing = SRFUtils::htmlProcessingElement($this->isHTML);
// Ensure right conversion
$width = strstr($this->params['width'], "%") ? $this->params['width'] : $this->params['width'] . 'px';
// Chart/graph placeholder
$chart = Html::rawElement('div', array('id' => $chartID, 'class' => 'container', 'style' => "display:none; width: {$width}; height: {$this->params['height']}px;"), null);
// Beautify class selector
$class = $this->params['charttype'] ? '-' . $this->params['charttype'] : '';
$class = $this->params['class'] ? $class . ' ' . $this->params['class'] : $class . ' jqplot-common';
// Chart/graph wrappper
return Html::rawElement('div', array('class' => 'srf-jqplot' . $class), $processing . $chart);
}
示例15: deserialize
/**
* @since 2.3
*
* @param string $value
*
* @return Description
* @throws InvalidArgumentException
*/
public function deserialize($value)
{
if (!is_string($value)) {
throw new InvalidArgumentException('value needs to be a string');
}
if ($value === '') {
$this->addError(wfMessage('smw_novalues')->text());
return new ThingDescription();
}
$subdescriptions = array();
$values = $this->dataValue->getValuesFromString($value);
$valueIndex = 0;
// index in value array
$propertyIndex = 0;
// index in property list
foreach ($this->dataValue->getPropertyDataItems() as $diProperty) {
// stop if there are no values left
if (!is_array($values) || !array_key_exists($valueIndex, $values)) {
break;
}
$description = $this->getDescriptionForProperty($diProperty, $values, $valueIndex, $propertyIndex);
if ($description !== null) {
$subdescriptions[] = $description;
}
++$propertyIndex;
}
if ($subdescriptions === array()) {
$this->addError(wfMessage('smw_novalues')->text());
}
return $this->getDescriptionFor($subdescriptions);
}