本文整理汇总了PHP中wfMsgForContent函数的典型用法代码示例。如果您正苦于以下问题:PHP wfMsgForContent函数的具体用法?PHP wfMsgForContent怎么用?PHP wfMsgForContent使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wfMsgForContent函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getResultText
protected function getResultText(SMWQueryResult $res, $outputmode)
{
global $wgSitename;
$result = '';
if ($outputmode == SMW_OUTPUT_FILE) {
// make file
if ($this->m_title == '') {
$this->m_title = $wgSitename;
}
$items = array();
while ($row = $res->getNext()) {
$items[] = $this->getItemForResultRow($row)->text();
}
$result = implode('', $items);
} else {
// just make link to export
if ($this->getSearchLabel($outputmode)) {
$label = $this->getSearchLabel($outputmode);
} else {
$label = wfMsgForContent('srf_bibtex_link');
}
$link = $res->getQueryLink($label);
$link->setParameter('bibtex', 'format');
if ($this->getSearchLabel(SMW_OUTPUT_WIKI) != '') {
$link->setParameter($this->getSearchLabel(SMW_OUTPUT_WIKI), 'searchlabel');
}
$result .= $link->getText($outputmode, $this->mLinker);
$this->isHTML = $outputmode == SMW_OUTPUT_HTML;
// yes, our code can be viewed as HTML if requested, no more parsing needed
}
return $result;
}
示例2: efFastCatSelector
function efFastCatSelector(&$categories)
{
global $wgTitle, $wgArticle;
// BugId:26491
if (empty($wgTitle) || empty($wgArticle)) {
return true;
}
$artname = $wgTitle->getText();
$artid = $wgArticle->getID();
$spice = sha1("Kroko-katMeNot-" . $artid . "-" . $artname . "-NotMekat-Schnapp");
$catUrl = Title::newFromText('FastCat', NS_SPECIAL)->getFullURL();
$ret = "<form action=\"{$catUrl}\" method='post'>\n<p><b>" . wfMsg('fastcat-box-title') . "</b><br>\n<small>" . wfMsg('fastcat-box-intro') . "</small>\n</p>\n<input type='hidden' name='id' value='{$artid}'>\n<input type='hidden' name='spice' value='{$spice}'>\n<input type='hidden' name='artname' value='{$artname}'>\n<p style=\"text-indent:-1em;margin-left:1em\">";
$kat = explode("\n", wfMsgForContent('fastcat-categories-list'));
foreach ($kat as $k) {
if (strpos($k, '* ') === 0) {
$k = trim($k, '* ');
$ret .= "</p><p style=\"text-indent:-1em;margin-left:1em\">\n";
$ret .= "<button style=\"font-size:smaller;\" name=\"cat\" value=\"{$k}\"><b>{$k}</b></button>\n";
} else {
$k = trim($k, '* ');
$ret .= "<button style=\"font-size:smaller;\" name=\"cat\" value=\"{$k}\">{$k}</button>\n";
}
}
$ret .= <<<EORET
\t\t</p>
\t\t</form>
EORET;
$categories = $ret;
return true;
}
示例3: __construct
/**
* Constructor
*
* @param $params array
*/
public function __construct($params)
{
parent::__construct($params);
$this->msg = empty($params['licenses']) ? wfMsgForContent('licenses') : $params['licenses'];
$this->selected = null;
$this->makeLicenses();
}
示例4: disambiguation_templates
/**
* Return a clause with the list of disambiguation templates.
* This function was copied verbatim from specials/SpecialDisambiguations.php
*/
function disambiguation_templates( $dbr ) {
$dMsgText = wfMsgForContent('disambiguationspage');
$linkBatch = new LinkBatch;
# If the text can be treated as a title, use it verbatim.
# Otherwise, pull the titles from the links table
$dp = Title::newFromText($dMsgText);
if( $dp ) {
if($dp->getNamespace() != NS_TEMPLATE) {
# FIXME we assume the disambiguation message is a template but
# the page can potentially be from another namespace :/
wfDebug("Mediawiki:disambiguationspage message does not refer to a template!\n");
}
$linkBatch->addObj( $dp );
} else {
# Get all the templates linked from the Mediawiki:Disambiguationspage
$disPageObj = Title::makeTitleSafe( NS_MEDIAWIKI, 'disambiguationspage' );
$res = $dbr->select(
array('pagelinks', 'page'),
'pl_title',
array('page_id = pl_from', 'pl_namespace' => NS_TEMPLATE,
'page_namespace' => $disPageObj->getNamespace(), 'page_title' => $disPageObj->getDBkey()),
__METHOD__ );
foreach ( $res as $row ) {
$linkBatch->addObj( Title::makeTitle( NS_TEMPLATE, $row->pl_title ));
}
}
return $linkBatch->constructSet( 'tl', $dbr );
}
示例5: parseUserValue
protected function parseUserValue($value)
{
global $wgContLang;
if ($this->m_caption === false) {
$this->m_caption = $value;
}
$valueParts = explode(':', $value, 2);
if (count($valueParts) > 1) {
$namespace = smwfNormalTitleText($valueParts[0]);
$value = $valueParts[1];
$typeNamespace = $wgContLang->getNsText(SMW_NS_TYPE);
if ($namespace != $typeNamespace) {
$this->addError(wfMsgForContent('smw_wrong_namespace', $typeNamespace));
}
}
$this->m_givenLabel = smwfNormalTitleText($value);
$this->m_typeId = SMWDataValueFactory::findTypeID($this->m_givenLabel);
if ($this->m_typeId === '') {
$this->addError(wfMsgForContent('smw_unknowntype', $this->m_givenLabel));
$this->m_realLabel = $this->m_givenLabel;
} else {
$this->m_realLabel = SMWDataValueFactory::findTypeLabel($this->m_typeId);
}
$this->m_isAlias = $this->m_realLabel === $this->m_givenLabel ? false : true;
try {
$this->m_dataitem = self::getTypeUriFromTypeId($this->m_typeId);
} catch (SMWDataItemException $e) {
$this->m_dataitem = self::getTypeUriFromTypeId('notype');
$this->addError(wfMsgForContent('smw_parseerror'));
}
}
示例6: run
/**
* Run a pageSchemasCreatePage job
* @return boolean success
*/
function run() {
wfProfileIn( __METHOD__ );
if ( is_null( $this->title ) ) {
$this->error = "pageSchemasCreatePage: Invalid title";
wfProfileOut( __METHOD__ );
return false;
}
$article = new Article( $this->title );
if ( !$article ) {
$this->error = 'pageSchemasCreatePage: Article not found "' . $this->title->getPrefixedDBkey() . '"';
wfProfileOut( __METHOD__ );
return false;
}
$page_text = $this->params['page_text'];
// change global $wgUser variable to the one
// specified by the job only for the extent of this
// replacement
global $wgUser;
$actual_user = $wgUser;
$wgUser = User::newFromId( $this->params['user_id'] );
$edit_summary = wfMsgForContent( 'ps-generatepages-editsummary' );
$article->doEdit( $page_text, $edit_summary );
$wgUser = $actual_user;
wfProfileOut( __METHOD__ );
return true;
}
示例7: getQueryInfo
function getQueryInfo()
{
$dbr = wfGetDB(DB_SLAVE);
$dMsgText = wfMsgForContent('disambiguationspage');
$linkBatch = new LinkBatch();
# If the text can be treated as a title, use it verbatim.
# Otherwise, pull the titles from the links table
$dp = Title::newFromText($dMsgText);
if ($dp) {
if ($dp->getNamespace() != NS_TEMPLATE) {
# @todo FIXME: We assume the disambiguation message is a template but
# the page can potentially be from another namespace :/
wfDebug("Mediawiki:disambiguationspage message does not refer to a template!\n");
}
$linkBatch->addObj($dp);
} else {
# Get all the templates linked from the Mediawiki:Disambiguationspage
$disPageObj = Title::makeTitleSafe(NS_MEDIAWIKI, 'disambiguationspage');
$res = $dbr->select(array('pagelinks', 'page'), 'pl_title', array('page_id = pl_from', 'pl_namespace' => NS_TEMPLATE, 'page_namespace' => $disPageObj->getNamespace(), 'page_title' => $disPageObj->getDBkey()), __METHOD__);
foreach ($res as $row) {
$linkBatch->addObj(Title::makeTitle(NS_TEMPLATE, $row->pl_title));
}
}
$set = $linkBatch->constructSet('tl', $dbr);
if ($set === false) {
# We must always return a valid SQL query, but this way
# the DB will always quickly return an empty result
$set = 'FALSE';
wfDebug("Mediawiki:disambiguationspage message does not link to any templates!\n");
}
// @todo FIXME: What are pagelinks and p2 doing here?
return array('tables' => array('templatelinks', 'p1' => 'page', 'pagelinks', 'p2' => 'page'), 'fields' => array('p1.page_namespace AS namespace', 'p1.page_title AS title', 'pl_from AS value'), 'conds' => array($set, 'p1.page_id = tl_from', 'pl_namespace = p1.page_namespace', 'pl_title = p1.page_title', 'p2.page_id = pl_from', 'p2.page_namespace' => MWNamespace::getContentNamespaces()));
}
示例8: formatRow
/**
* Callback function to output a restriction
*/
function formatRow($row)
{
global $wgUser, $wgLang, $wgContLang;
wfProfileIn(__METHOD__);
static $skin = null;
if (is_null($skin)) {
$skin = $wgUser->getSkin();
}
$title = Title::makeTitleSafe($row->page_namespace, $row->page_title);
$link = $skin->makeLinkObj($title);
$description_items = array();
$protType = wfMsgHtml('restriction-level-' . $row->pr_level);
$description_items[] = $protType;
if ($row->pr_cascade) {
$description_items[] = wfMsg('protect-summary-cascade');
}
$expiry_description = '';
$stxt = '';
if ($row->pr_expiry != 'infinity' && strlen($row->pr_expiry)) {
$expiry = Block::decodeExpiry($row->pr_expiry);
$expiry_description = wfMsgForContent('protect-expiring', $wgLang->timeanddate($expiry));
$description_items[] = $expiry_description;
}
if (!is_null($size = $row->page_len)) {
if ($size == 0) {
$stxt = ' <small>' . wfMsgHtml('historyempty') . '</small>';
} else {
$stxt = ' <small>' . wfMsgHtml('historysize', $wgLang->formatNum($size)) . '</small>';
}
$stxt = $wgContLang->getDirMark() . $stxt;
}
wfProfileOut(__METHOD__);
return '<li>' . wfSpecialList($link . $stxt, implode($description_items, ', ')) . "</li>\n";
}
示例9: __construct
function __construct()
{
global $wgRequest, $wgTitle;
parent::__construct('CreateFromTemplate', '', true);
$bits = explode('/', $wgTitle->getDBkey(), 2);
if (!empty($bits[1])) {
$this->mType = $bits[1];
} else {
$this->mType = $wgRequest->getText('type');
}
// setup list of fields for recipe form
$key = "recipes-template-{$this->mType}-fields";
$fieldsRaw = wfMsgForContent($key);
// if ( wfMsgEmpty( $key, $fieldsRaw ) ) {
// return null;
// }
$this->mFields = array();
$parent = '';
$fieldsRaw = explode("\n", $fieldsRaw);
foreach ($fieldsRaw as $row) {
if (strpos($row, '* ') === 0) {
$row = trim($row, '* ');
$this->mFields[$row] = array();
$parent = $row;
} elseif (strpos($row, '** ') === 0) {
$row = trim($row, '** ');
$row = explode('|', $row);
$row[1] = $row[1] === 'true' ? true : $row[1];
$row[1] = $row[1] === 'false' ? false : $row[1];
$this->mFields[$parent][$row[0]] = $row[1];
}
// other cases are ignored
}
}
示例10: formatRow
public function formatRow($row)
{
$title = Title::newFromRow($row);
# Link to page
$link = Linker::link($title);
# Link to page configuration
$config = Linker::linkKnown(SpecialPage::getTitleFor('Stabilization'), wfMsgHtml('configuredpages-config'), array(), 'page=' . $title->getPrefixedUrl());
# Show which version is the default (stable or draft)
if (intval($row->fpc_override)) {
$default = wfMsgHtml('configuredpages-def-stable');
} else {
$default = wfMsgHtml('configuredpages-def-draft');
}
# Autoreview/review restriction level
$restr = '';
if ($row->fpc_level != '') {
$restr = 'autoreview=' . htmlspecialchars($row->fpc_level);
$restr = "[{$restr}]";
}
# When these configuration settings expire
if ($row->fpc_expiry != 'infinity' && strlen($row->fpc_expiry)) {
$expiry_description = " (" . wfMsgForContent('protect-expiring', $this->getLang()->timeanddate($row->fpc_expiry), $this->getLang()->date($row->fpc_expiry), $this->getLang()->time($row->fpc_expiry)) . ")";
} else {
$expiry_description = "";
}
return "<li>{$link} ({$config}) <b>[{$default}]</b> " . "{$restr}<i>{$expiry_description}</i></li>";
}
示例11: execute
public function execute()
{
global $wgRequest, $wgWikiLoveLogging, $wgParser;
$params = $this->extractRequestParams();
$title = Title::newFromText($params['title']);
if (is_null($title)) {
$this->dieUsageMsg(array('invaliduser', $params['title']));
}
$talk = WikiLoveHooks::getUserTalkPage($title);
if (is_null($talk)) {
$this->dieUsageMsg(array('invaliduser', $params['title']));
}
if ($wgWikiLoveLogging) {
$this->saveInDb($talk, $params['subject'], $params['message'], $params['type'], isset($params['email']) ? 1 : 0);
}
// not using section => 'new' here, as we like to give our own edit summary
$api = new ApiMain(new DerivativeRequest($wgRequest, array('action' => 'edit', 'title' => $talk->getFullText(), 'appendtext' => ($talk->exists() ? "\n\n" : '') . wfMsgForContent('newsectionheaderdefaultlevel', $params['subject']) . "\n\n" . $params['text'], 'token' => $params['token'], 'summary' => wfMsgForContent('wikilove-summary', $wgParser->stripSectionName($params['subject'])), 'notminor' => true), false), true);
$api->execute();
if (isset($params['email'])) {
$this->emailUser($talk, $params['subject'], $params['email'], $params['token']);
}
$this->getResult()->addValue('redirect', 'pageName', $talk->getPrefixedDBkey());
$this->getResult()->addValue('redirect', 'fragment', Title::escapeFragmentForURL($params['subject']));
// note that we cannot use Title::makeTitle here as it doesn't sanitize the fragment
}
示例12: execute
function execute($par)
{
global $wgUser, $wgRequest;
if (!$this->userCanExecute($wgUser)) {
$this->displayRestrictionError();
return;
}
$this->setHeaders();
$this->outputHeader();
$target = $wgRequest->getText('target', $par);
// Normalise name
if ($target !== '') {
$user = User::newFromName($target);
if ($user) {
$target = $user->getName();
}
}
$reason = $wgRequest->getText('wpReason', wfMsgForContent('nuke-defaultreason', $target));
$posted = $wgRequest->wasPosted() && $wgUser->matchEditToken($wgRequest->getVal('wpEditToken'));
if ($posted) {
$pages = $wgRequest->getArray('pages');
if ($pages) {
return $this->doDelete($pages, $reason);
}
}
if ($target != '') {
$this->listForm($target, $reason);
} else {
$this->promptForm();
}
}
示例13: parserFunction
public static function parserFunction($parser, $vid = null, $img = null)
{
global $wgTitle, $wgContLang;
wfLoadExtensionMessages('WHVid');
if ($vid === null || $img === null) {
return '<div class="errorbox">' . wfMsg('missing-params') . '</div>';
}
$vid = htmlspecialchars($vid);
$divId = "whvid-" . md5($vid . mt_rand(1, 1000));
$vidUrl = self::getVidUrl($vid);
$imgTitle = Title::newFromURL($img, NS_IMAGE);
$imgUrl = null;
if ($imgTitle) {
$imgFile = RepoGroup::singleton()->findFile($imgTitle);
$smallImgUrl = '';
$largeImgUrl = '';
if ($imgFile) {
$width = 550;
$height = 309;
$thumb = $imgFile->getThumbnail($width, $height);
$largeImgUrl = wfGetPad($thumb->getUrl());
$width = 240;
//$height = 135;
$thumb = $imgFile->getThumbnail($width);
$smallImgUrl = wfGetPad($thumb->getUrl());
}
}
return $parser->insertStripItem(wfMsgForContent('embed-html', $divId, $vidUrl, $largeImgUrl, $smallImgUrl));
}
示例14: execute
public function execute()
{
$prop = null;
extract($this->extractRequestParams());
foreach ($prop as $p) {
switch ($p) {
case 'general':
global $wgSitename, $wgVersion, $wgCapitalLinks;
$data = array();
$mainPage = Title::newFromText(wfMsgForContent('mainpage'));
$data['mainpage'] = $mainPage->getText();
$data['base'] = $mainPage->getFullUrl();
$data['sitename'] = $wgSitename;
$data['generator'] = "MediaWiki {$wgVersion}";
$data['case'] = $wgCapitalLinks ? 'first-letter' : 'case-sensitive';
// 'case-insensitive' option is reserved for future
$this->getResult()->addValue('query', $p, $data);
break;
case 'namespaces':
global $wgContLang;
$data = array();
foreach ($wgContLang->getFormattedNamespaces() as $ns => $title) {
$data[$ns] = array('id' => $ns);
ApiResult::setContent($data[$ns], $title);
}
ApiResult::setIndexedTagName($data, 'ns');
$this->getResult()->addValue('query', $p, $data);
break;
default:
ApiBase::dieDebug(__METHOD__, "Unknown prop={$p}");
}
}
}
示例15: UW_CatBoxAtTop_Rejig
function UW_CatBoxAtTop_Rejig ( &$out, &$text ) {
global $wgVersion;
// no categories = no box
if ( !$out->mCategoryLinks )
return true;
/* add a category box to the top of the output,
* to be dropped into the top right via CSS */
$catbox = "<div id=\"catbox\"><div>\n";
$catbox .= "<h5>" . wfMsgForContent( 'catboxattop-categories' ) . "</h5><ul>\n";
$catlinks = array();
if ( array_key_exists( 'normal', $out->mCategoryLinks ) ) {
$catlinks = $out->mCategoryLinks['normal'];
} else {
$catlinks = $out->mCategoryLinks;
}
foreach ( $catlinks as $cat )
$catbox .= "<li>$cat</li>\n";
$catbox .= "</ul></div></div>\n";
$text = $catbox . $text;
return true;
}