本文整理汇总了PHP中wfMsgForContentNoTrans函数的典型用法代码示例。如果您正苦于以下问题:PHP wfMsgForContentNoTrans函数的具体用法?PHP wfMsgForContentNoTrans怎么用?PHP wfMsgForContentNoTrans使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wfMsgForContentNoTrans函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
public function execute($parameters)
{
global $wgOut, $wgRequest, $wgDisableTextSearch, $wgScript;
$this->setHeaders();
list($limit, $offset) = wfCheckLimits();
$wgOut->addWikiText(wfMsgForContentNoTrans('proofreadpage_specialpage_text'));
$this->searchList = null;
$this->searchTerm = $wgRequest->getText('key');
$this->suppressSqlOffset = false;
if (!$wgDisableTextSearch) {
$self = $this->getTitle();
$wgOut->addHTML(Xml::openElement('form', array('action' => $wgScript)) . Html::hidden('title', $this->getTitle()->getPrefixedText()) . Xml::input('limit', false, $limit, array('type' => 'hidden')) . Xml::openElement('fieldset') . Xml::element('legend', null, wfMsg('proofreadpage_specialpage_legend')) . Xml::input('key', 20, $this->searchTerm) . ' ' . Xml::submitButton(wfMsg('ilsubmit')) . Xml::closeElement('fieldset') . Xml::closeElement('form'));
if ($this->searchTerm) {
$index_namespace = $this->index_namespace;
$index_ns_index = MWNamespace::getCanonicalIndex(strtolower(str_replace(' ', '_', $index_namespace)));
$searchEngine = SearchEngine::create();
$searchEngine->setLimitOffset($limit, $offset);
$searchEngine->setNamespaces(array($index_ns_index));
$searchEngine->showRedirects = false;
$textMatches = $searchEngine->searchText($this->searchTerm);
$escIndex = preg_quote($index_namespace, '/');
$this->searchList = array();
while ($result = $textMatches->next()) {
$title = $result->getTitle();
if ($title->getNamespace() == $index_ns_index) {
array_push($this->searchList, $title->getDBkey());
}
}
$this->suppressSqlOffset = true;
}
}
parent::execute($parameters);
}
示例2: efGroupPortal_MediaWikiPerformAction
function efGroupPortal_MediaWikiPerformAction($output, $article, $title, $user, $request)
{
$action = $request->getVal('action', 'view');
$redirect = $request->getVal('redirect');
if ($action === 'view' && $redirect === null) {
if ($title->equals(Title::newMainPage())) {
$groupPortals = spliti("\n", wfMsgForContentNoTrans('groupportal'));
$groups = $user->getGroups();
$targetPortal = '';
foreach ($groupPortals as $groupPortal) {
$mcount = preg_match('/^(.+)\\|(.+)$/', $groupPortal, $matches);
if ($mcount > 0) {
if (in_array($matches[1], $groups) || $matches[1] == '*' && empty($targetPortal)) {
$targetPortal = $matches[2];
}
}
}
if (!empty($targetPortal)) {
$target = Title::newFromText($targetPortal);
if (is_object($target)) {
$output->redirect($target->getLocalURL());
return false;
}
}
}
}
return true;
}
示例3: wfCreatePageLoadPreformattedContent
function wfCreatePageLoadPreformattedContent($editpage)
{
global $wgRequest;
if ($wgRequest->getCheck('useFormat')) {
$editpage->textbox1 = wfMsgForContentNoTrans('newpagelayout');
}
return true;
}
示例4: wfMetaKeywordInput
function wfMetaKeywordInput($type)
{
global $wgContLang, $wgMemc, $wgDBname;
$params = wfMsgForContentNoTrans("meta{$type}");
$opts = array(0);
if (!wfEmptyMsg("meta{$type}", $params)) {
$opts = wfMetaKeywordParse($params);
}
return $opts;
}
示例5: getValidProjects
function getValidProjects() {
global $wgOut;
$validProjects = wfMsgForContentNoTrans( 'todoTasksValidProjects' );
if ( $validProjects == '' ) {
$wgOut->addWikiText( wfMsg( 'tasklistnoprojects' ) );
return;
}
return $validProjects;
}
示例6: execute
function execute()
{
global $wgOut, $wgUser, $wgParser, $wgHooks, $wgCiteDefaultText;
$wgHooks['ParserGetVariableValueTs'][] = array($this, 'timestamp');
$msg = wfMsgForContentNoTrans('cite_text');
if ($msg == '') {
$msg = $wgCiteDefaultText;
}
$this->mArticle->fetchContent($this->mId, false);
$ret = $wgParser->parse($msg, $this->mTitle, $this->mParserOptions, false, true, $this->mArticle->getRevIdFetched());
$wgOut->addHTML($ret->getText());
}
示例7: wfIsBadImage
/**
* Determine if an image exists on the 'bad image list'.
*
* The format of MediaWiki:Bad_image_list is as follows:
* * Only list items (lines starting with "*") are considered
* * The first link on a line must be a link to a bad image
* * Any subsequent links on the same line are considered to be exceptions,
* i.e. articles where the image may occur inline.
*
* @param $name string the image name to check
* @param $contextTitle Title|bool the page on which the image occurs, if known
* @return bool
*/
function wfIsBadImage($name, $contextTitle = false)
{
static $badImages = false;
wfProfileIn(__METHOD__);
# Handle redirects
$redirectTitle = RepoGroup::singleton()->checkRedirect(Title::makeTitle(NS_FILE, $name));
if ($redirectTitle) {
$name = $redirectTitle->getDbKey();
}
# Run the extension hook
$bad = false;
if (!wfRunHooks('BadImage', array($name, &$bad))) {
wfProfileOut(__METHOD__);
return $bad;
}
if (!$badImages) {
# Build the list now
$badImages = array();
$lines = explode("\n", wfMsgForContentNoTrans('bad_image_list'));
foreach ($lines as $line) {
# List items only
if (substr($line, 0, 1) !== '*') {
continue;
}
# Find all links
$m = array();
if (!preg_match_all('/\\[\\[:?(.*?)\\]\\]/', $line, $m)) {
continue;
}
$exceptions = array();
$imageDBkey = false;
foreach ($m[1] as $i => $titleText) {
$title = Title::newFromText($titleText);
if (!is_null($title)) {
if ($i == 0) {
$imageDBkey = $title->getDBkey();
} else {
$exceptions[$title->getPrefixedDBkey()] = true;
}
}
}
if ($imageDBkey !== false) {
$badImages[$imageDBkey] = $exceptions;
}
}
}
$contextKey = $contextTitle ? $contextTitle->getPrefixedDBkey() : false;
$bad = isset($badImages[$name]) && !isset($badImages[$name][$contextKey]);
wfProfileOut(__METHOD__);
return $bad;
}
示例8: lw_templatePreload
/**
* Fills the textbox of a new page with content.
*/
function lw_templatePreload(&$textbox, Title &$title)
{
$lwVars = getLyricWikiVariables();
$titleStr = $title->getText();
// only use templates in the main namespace
$ns = $title->getNamespace();
if ($ns != NS_MAIN && $ns != NS_TALK) {
return true;
}
$tempType = "";
$pageType = "";
if (isset($_GET['template'])) {
$pageType = strtolower($_GET['template']);
}
if ($pageType == "") {
$pageType = $lwVars["pagetype"];
}
# pull template from database and replace placeholds
if ($pageType == "none") {
$textbox = "";
} else {
$extra = trim(wfMsgForContentNoTrans("lwtemp-extra-templates"));
if ($extra != "") {
$extras = explode("\n", $extra);
foreach ($extras as $item) {
if (strpos($item, "|")) {
$parts = explode("|", $item);
if (0 < preg_match("/{$parts[0]}/", $titleStr, $m)) {
$pageType = $parts[1];
}
}
}
}
$template = wfMsgForContentNoTrans("lwtemp-{$pageType}-template");
// only display a template if the template actually exists
if ($template != "<{$pageType}Template>" and $template != "<{$pageType}Template>") {
$textbox = $template;
$lwVars = getLyricWikiVariables();
$replace = array();
$with = array();
foreach ($lwVars as $key => $value) {
$replace[] = "{{" . strtoupper($key) . "}}";
$with[] = $value;
}
$textbox = str_replace($replace, $with, $textbox);
}
}
return true;
}
示例9: wfLoadGadgetsStructured
function wfLoadGadgetsStructured($forceNewText = NULL)
{
global $wgContLang;
global $wgMemc, $wgDBname;
static $gadgets = NULL;
if ($gadgets !== NULL && $forceNewText !== NULL) {
return $gadgets;
}
$key = "{$wgDBname}:gadgets-definition";
if ($forceNewText == NULL) {
//cached?
$gadgets = $wgMemc->get($key);
if ($gadgets !== NULL) {
return $gadgets;
}
$g = wfMsgForContentNoTrans("gadgets-definition");
if (wfEmptyMsg("gadgets-definition", $g)) {
$gadgets = false;
return $gadgets;
}
} else {
$g = $forceNewText;
}
$g = preg_replace('/<!--.*-->/s', '', $g);
$g = preg_split('/(\\r\\n|\\r|\\n)+/', $g);
$gadgets = array();
$section = '';
foreach ($g as $line) {
if (preg_match('/^==+ *([^*:\\s|]+?)\\s*==+\\s*$/', $line, $m)) {
$section = $m[1];
} else {
if (preg_match('/^\\*+ *([a-zA-Z](?:[-_:.\\w\\d ]*[a-zA-Z0-9])?)\\s*((\\|[^|]*)+)\\s*$/', $line, $m)) {
//NOTE: the gadget name is used as part of the name of a form field,
// and must follow the rules defined in http://www.w3.org/TR/html4/types.html#type-cdata
// Also, title-normalization applies.
$name = str_replace(' ', '_', $m[1]);
$code = preg_split('/\\s*\\|\\s*/', $m[2], -1, PREG_SPLIT_NO_EMPTY);
if ($code) {
$gadgets[$section][$name] = $code;
}
}
}
}
//cache for a while. gets purged automatically when MediaWiki:Gadgets-definition is edited
$wgMemc->set($key, $gadgets, 900);
wfDebug("wfLoadGadgetsStructured: MediaWiki:Gadgets-definition parsed, cache entry {$key} updated\n");
return $gadgets;
}
示例10: wfSpecialRecentchanges
//.........这里部分代码省略.........
$hidem .= is_null($namespace) ? '' : ' AND rc_namespace' . ($invert ? '!=' : '=') . $namespace;
//XXADDED
$order = $reverse ? " ASC" : "DESC";
$ft = $featured ? " AND page_is_featured = 1 " : "";
// This is the big thing!
$uid = $wgUser->getID();
//XXCHANGED
// Perform query
$forceclause = $dbr->useIndexClause("rc_timestamp");
$sql2 = "SELECT * FROM {$recentchanges} {$forceclause}" . ($uid ? "LEFT OUTER JOIN {$watchlist} ON wl_user={$uid} AND wl_title=rc_title AND wl_namespace=rc_namespace " : "") . " LEFT OUTER JOIN page ON page_title=rc_title AND page_namespace=rc_namespace " . "WHERE rc_timestamp >= '{$cutoff}' {$hidem} {$ft} " . "ORDER BY rc_timestamp {$order} ";
$sql2 = $dbr->limitResult($sql2, $limit, 0);
$res = $dbr->query($sql2, $fname);
// Fetch results, prepare a batch link existence check query
$rows = array();
$batch = new LinkBatch();
while ($row = $dbr->fetchObject($res)) {
$rows[] = $row;
if (!$feedFormat) {
// User page and talk links
$batch->add(NS_USER, $row->rc_user_text);
$batch->add(NS_USER_TALK, $row->rc_user_text);
}
}
$dbr->freeResult($res);
if ($feedFormat) {
rcOutputFeed($rows, $feedFormat, $limit, $hideminor, $lastmod);
} else {
# Web output...
// Run existence checks
$batch->execute();
$any = $wgRequest->getBool('categories_any', $defaults['categories_any']);
// Output header
if (!$specialPage->including()) {
$wgOut->addWikiText('<div class="minor_text">' . wfMsgForContentNoTrans("recentchangestext") . '<br /></div>');
// Dump everything here
$nondefaults = array();
wfAppendToArrayIfNotDefault('days', $days, $defaults, $nondefaults);
wfAppendToArrayIfNotDefault('limit', $limit, $defaults, $nondefaults);
wfAppendToArrayIfNotDefault('hideminor', $hideminor, $defaults, $nondefaults);
wfAppendToArrayIfNotDefault('hidebots', $hidebots, $defaults, $nondefaults);
wfAppendToArrayIfNotDefault('hideanons', $hideanons, $defaults, $nondefaults);
wfAppendToArrayIfNotDefault('hideliu', $hideliu, $defaults, $nondefaults);
wfAppendToArrayIfNotDefault('hidepatrolled', $hidepatrolled, $defaults, $nondefaults);
wfAppendToArrayIfNotDefault('hidemyself', $hidemyself, $defaults, $nondefaults);
wfAppendToArrayIfNotDefault('from', $from, $defaults, $nondefaults);
wfAppendToArrayIfNotDefault('namespace', $namespace, $defaults, $nondefaults);
wfAppendToArrayIfNotDefault('invert', $invert, $defaults, $nondefaults);
wfAppendToArrayIfNotDefault('categories_any', $any, $defaults, $nondefaults);
// Add end of the texts
$wgOut->addHTML('<div class="rcoptions">' . rcOptionsPanel($defaults, $nondefaults) . "\n");
//XXCHANGED
$wgOut->addHTML(rcNamespaceForm($namespace, $invert, $reverse, $featured, $nondefaults, $any) . '</div>' . "\n");
//XXADDED
global $wgLanguageCode;
if ($wgUser->getID() > 0 && $wgLanguageCode == 'en') {
$sk = $wgUser->getSkin();
$url = $wgRequest->getRequestURL();
if ($wgRequest->getVal('refresh', null) != null) {
$url = str_replace("&refresh=1", "", $url);
$url = str_replace("?refresh=1", "", $url);
$wgOut->addHTML("<a href='{$url}' class='button secondary'>" . wfMsg('rc_turn_refresh_off') . "</a>");
} else {
if (strpos($url, "?") !== false) {
$url .= "&refresh=1";
} else {
$url .= "?refresh=1";
示例11: __construct
/**
* @param User $target
*/
function __construct($target, $par)
{
global $wgRequest, $wgUser;
$this->wasPosted = $wgRequest->wasPosted();
$this->formType = $wgRequest->getText('formtype', $par);
# Check for type in [[Special:Contact/type]]: change pagetext and prefill form fields
if ($this->formType != '') {
$message = 'contactpage-pagetext-' . $this->formType;
$text = wfMsgExt($message, 'parse');
if (!wfEmptyMsg($message, $text)) {
$this->formularText = $text;
} else {
$this->formularText = wfMsgExt('contactpage-pagetext', 'parse');
}
$message = 'contactpage-subject-' . $this->formType;
$text = wfMsgForContentNoTrans($message);
if (!wfEmptyMsg($message, $text)) {
$this->subject = $wgRequest->getText('wpSubject', $text);
} else {
$this->subject = $wgRequest->getText('wpSubject');
}
$message = 'contactpage-text-' . $this->formType;
$text = wfMsgForContentNoTrans($message);
if (!wfEmptyMsg($message, $text)) {
$this->text = $wgRequest->getText('wpText', $text);
} else {
$this->text = $wgRequest->getText('wpText');
}
} else {
$this->formularText = wfMsgExt('contactpage-pagetext', 'parse');
$this->text = $wgRequest->getText('wpText');
$this->subject = $wgRequest->getText('wpSubject');
}
$this->target = $target;
$this->cc_me = $wgRequest->getBool('wpCCMe');
$this->includeIP = $wgRequest->getBool('wpIncludeIP');
$this->fromname = $wgRequest->getText('wpFromName');
$this->fromaddress = $wgRequest->getText('wpFromAddress');
if ($wgUser->isLoggedIn()) {
if (!$this->fromname) {
$this->fromname = $wgUser->getName();
}
if (!$this->fromaddress) {
$this->fromaddress = $wgUser->getEmail();
}
}
// prepare captcha if applicable
if ($this->useCaptcha()) {
$captcha = ConfirmEditHooks::getInstance();
$captcha->trigger = 'contactpage';
$captcha->action = 'contact';
}
}
示例12: wfGetCachedNotice
function wfGetCachedNotice($name)
{
global $wgOut, $wgRenderHashAppend, $parserMemc;
$fname = 'wfGetCachedNotice';
wfProfileIn($fname);
$needParse = false;
if ($name === 'default') {
// special case
global $wgSiteNotice;
$notice = $wgSiteNotice;
if (empty($notice)) {
wfProfileOut($fname);
return false;
}
} else {
$notice = wfMsgForContentNoTrans($name);
if (wfEmptyMsg($name, $notice) || $notice == '-') {
wfProfileOut($fname);
return false;
}
}
// Use the extra hash appender to let eg SSL variants separately cache.
$key = wfMemcKey($name . $wgRenderHashAppend);
$cachedNotice = $parserMemc->get($key);
if (is_array($cachedNotice)) {
if (md5($notice) == $cachedNotice['hash']) {
$notice = $cachedNotice['html'];
} else {
$needParse = true;
}
} else {
$needParse = true;
}
if ($needParse) {
if (is_object($wgOut)) {
$parsed = $wgOut->parse($notice);
$parserMemc->set($key, array('html' => $parsed, 'hash' => md5($notice)), 600);
$notice = $parsed;
} else {
wfDebug('wfGetCachedNotice called for ' . $name . ' with no $wgOut available' . "\n");
$notice = '';
}
}
wfProfileOut($fname);
return $notice;
}
示例13: wfGetCachedNotice
function wfGetCachedNotice($name)
{
global $wgOut, $parserMemc;
$fname = 'wfGetCachedNotice';
wfProfileIn($fname);
$needParse = false;
if ($name === 'default') {
// special case
global $wgSiteNotice;
$notice = $wgSiteNotice;
if (empty($notice)) {
wfProfileOut($fname);
return false;
}
} else {
$notice = wfMsgForContentNoTrans($name);
if (wfEmptyMsg($name, $notice) || $notice == '-') {
wfProfileOut($fname);
return false;
}
}
$cachedNotice = $parserMemc->get(wfMemcKey($name));
if (is_array($cachedNotice)) {
if (md5($notice) == $cachedNotice['hash']) {
$notice = $cachedNotice['html'];
} else {
$needParse = true;
}
} else {
$needParse = true;
}
if ($needParse) {
if (is_object($wgOut)) {
$parsed = $wgOut->parse($notice);
$parserMemc->set(wfMemcKey($name), array('html' => $parsed, 'hash' => md5($notice)), 600);
$notice = $parsed;
} else {
wfDebug('wfGetCachedNotice called for ' . $name . ' with no $wgOut available');
$notice = '';
}
}
wfProfileOut($fname);
return $notice;
}
示例14: run
/**
* main entry point
*
* @access public
*/
public function run()
{
global $wgUser, $wgTitle, $wgErrorLog;
wfProfileIn(__METHOD__);
$oldValue = $wgErrorLog;
$wgErrorLog = true;
/**
* overwrite $wgUser for ~~~~ expanding
*/
$sysop = trim(wfMsgForContent("welcome-user"));
if (!in_array($sysop, array("@disabled", "-"))) {
$tmpUser = $wgUser;
$wgUser = User::newFromName(self::WELCOMEUSER);
$flags = 0;
$bot_message = trim(wfMsgForContent("welcome-bot"));
if ($bot_message == '@bot' || $wgUser && $wgUser->isAllowed('bot')) {
$flags = EDIT_FORCE_BOT;
}
wfDebug(__METHOD__ . "-user: " . $this->mUser->getName());
if ($this->mUser && $this->mUser->getName() !== self::WELCOMEUSER) {
/**
* check again if talk page exists
*/
$talkPage = $this->mUser->getUserPage()->getTalkPage();
wfDebug(__METHOD__ . "-talk: " . $talkPage->getFullUrl());
if ($talkPage) {
$this->mSysop = $this->getLastSysop();
$gEG = $this->mSysop->getEffectiveGroups();
$isSysop = in_array('sysop', $gEG);
$isStaff = in_array('staff', $gEG);
unset($gEG);
$tmpTitle = $wgTitle;
$sysopPage = $this->mSysop->getUserPage()->getTalkPage();
$signature = $this->expandSig();
$wgTitle = $talkPage;
$welcomeMsg = false;
$talkArticle = new Article($talkPage, 0);
if (!self::isPosted($talkArticle, $this->mUser)) {
if ($this->mAnon) {
if ($this->isEnabled("message-anon")) {
if ($isStaff && !$isSysop) {
$key = $this->getMessageKey("anon-staff");
} else {
$key = $this->getMessageKey("anon");
}
$welcomeMsg = wfMsgNoTrans($key, array($this->getPrefixedText(), $sysopPage->getPrefixedText(), $signature, wfEscapeWikiText($this->mUser->getName())));
} else {
wfDebug(__METHOD__ . "-talk: message-anon disabled");
}
} else {
/**
* now create user page (if not exists of course)
*/
if ($this->isEnabled("page-user")) {
$userPage = $this->mUser->getUserPage();
if ($userPage) {
$wgTitle = $userPage;
$userArticle = new Article($userPage, 0);
wfDebug(__METHOD__ . "-userpage: " . $userPage->getFullUrl());
if (!$userArticle->exists()) {
$pageMsg = wfMsgForContentNoTrans('welcome-user-page', $this->mUser->getName());
$userArticle->doEdit($pageMsg, false, $flags);
}
} else {
wfDebug(__METHOD__ . "-page: user page already exists.");
}
} else {
wfDebug(__METHOD__ . "-page: page-user disabled");
}
if ($this->isEnabled("message-user")) {
if ($isStaff && !$isSysop) {
$key = $this->getMessageKey("user-staff");
} else {
$key = $this->getMessageKey("user");
}
$welcomeMsg = wfMsgNoTrans($key, array($this->getPrefixedText(), $sysopPage->getPrefixedText(), $signature, wfEscapeWikiText($this->mUser->getName())));
} else {
wfDebug(__METHOD__ . "-talk: message-user disabled");
}
}
if ($welcomeMsg) {
$wgTitle = $talkPage;
/** is it necessary there? **/
//we posting it on talk page even when we have message wall
//hack for notification problem
global $wgCityId, $wgServer;
$wgServer = WikiFactory::getVarValueByName('wgServer', $wgCityId);
$this->doPost($talkArticle, $flags, wfMsgForContent("welcome-message-log"), $welcomeMsg, $wgUser, $this->mUser, $this->mSysop);
}
}
$wgTitle = $tmpTitle;
}
}
$wgUser = $tmpUser;
$wgErrorLog = $oldValue;
//.........这里部分代码省略.........
示例15: doAction
/**
* Perform an action on a given group/key/code
*
* @param $action \string Options: 'import', 'conflict' or 'ignore'
* @param $group MessageGroup Group object
* @param $key \string Message key
* @param $code \string Language code
* @param $message \string contents for the $key/code combination
* @param $comment \string edit summary (default: empty) - see Article::doEdit
* @param $user User User that will make the edit (default: null - $wgUser) - see Article::doEdit
* @param $editFlags Integer bitfield: see Article::doEdit
* @return \string Action result
*/
public static function doAction( $action, $group, $key, $code, $message, $comment = '', $user = null, $editFlags = 0 ) {
global $wgTranslateDocumentationLanguageCode;
$title = self::makeTranslationTitle( $group, $key, $code );
if ( $action === 'import' || $action === 'conflict' ) {
if ( $action === 'import' ) {
$comment = wfMsgForContentNoTrans( 'translate-manage-import-summary' );
} else {
$comment = wfMsgForContentNoTrans( 'translate-manage-conflict-summary' );
$message = self::makeTextFuzzy( $message );
}
return self::doImport( $title, $message, $comment, $user, $editFlags );
} elseif ( $action === 'ignore' ) {
return array( 'translate-manage-import-ignore', $key );
} elseif ( $action === 'fuzzy' && $code !== 'en' && $code !== $wgTranslateDocumentationLanguageCode ) {
$message = self::makeTextFuzzy( $message );
return self::doImport( $title, $message, $comment, $user, $editFlags );
} elseif ( $action === 'fuzzy' && $code == 'en' ) {
return self::doFuzzy( $title, $message, $comment, $user, $editFlags );
} else {
throw new MWException( "Unhandled action $action" );
}
}