本文整理汇总了PHP中wfMsgForContentNoTrans函数的典型用法代码示例。如果您正苦于以下问题:PHP wfMsgForContentNoTrans函数的具体用法?PHP wfMsgForContentNoTrans怎么用?PHP wfMsgForContentNoTrans使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wfMsgForContentNoTrans函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
}
开发者ID:schwarer2006,项目名称:wikia,代码行数:33,代码来源:SpecialProofreadPages.php
示例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;
}
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:28,代码来源:GroupPortal.php
示例3: wfCreatePageLoadPreformattedContent
function wfCreatePageLoadPreformattedContent($editpage)
{
global $wgRequest;
if ($wgRequest->getCheck('useFormat')) {
$editpage->textbox1 = wfMsgForContentNoTrans('newpagelayout');
}
return true;
}
开发者ID:schwarer2006,项目名称:wikia,代码行数:8,代码来源:CreatePage.php
示例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;
}
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:10,代码来源:MetaKeywords.php
示例5: getValidProjects
function getValidProjects() {
global $wgOut;
$validProjects = wfMsgForContentNoTrans( 'todoTasksValidProjects' );
if ( $validProjects == '' ) {
$wgOut->addWikiText( wfMsg( 'tasklistnoprojects' ) );
return;
}
return $validProjects;
}
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:10,代码来源:TodoTasks_body.php
示例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());
}
开发者ID:ui-libraries,项目名称:TIRW,代码行数:12,代码来源:SpecialCite_body.php
示例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;
}
开发者ID:eFFemeer,项目名称:seizamcore,代码行数:64,代码来源:ImageFunctions.php
示例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;
}
开发者ID:Tjorriemorrie,项目名称:app,代码行数:52,代码来源:Templates.php
示例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;
}
开发者ID:BackupTheBerlios,项目名称:shoutwiki-svn,代码行数:48,代码来源:Gadgets.php
示例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";
开发者ID:ErdemA,项目名称:wikihow,代码行数:67,代码来源:SpecialRecentchanges.php
示例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';
}
}
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:56,代码来源:SpecialContact.php
示例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;
}
开发者ID:josephdye,项目名称:wikireader,代码行数:46,代码来源:GlobalFunctions.php
示例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;
}
开发者ID:negabaro,项目名称:alfresco,代码行数:44,代码来源:GlobalFunctions.php
示例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;
//.........这里部分代码省略.........
开发者ID:schwarer2006,项目名称:wikia,代码行数:101,代码来源:HAWelcome.php
示例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" );
}
}
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:39,代码来源:MessageWebImporter.php
示例16: statelessFetchTemplate
/**
* Static function to get a template
* Can be overridden via ParserOptions::setTemplateCallback().
*/
static function statelessFetchTemplate($title, $parser = false)
{
$text = $skip = false;
$finalTitle = $title;
$deps = array();
// Loop to fetch the article, with up to 1 redirect
for ($i = 0; $i < 2 && is_object($title); $i++) {
# Give extensions a chance to select the revision instead
$id = false;
// Assume current
wfRunHooks('BeforeParserFetchTemplateAndtitle', array($parser, &$title, &$skip, &$id));
if ($skip) {
$text = false;
$deps[] = array('title' => $title, 'page_id' => $title->getArticleID(), 'rev_id' => null);
break;
}
$rev = $id ? Revision::newFromId($id) : Revision::newFromTitle($title);
$rev_id = $rev ? $rev->getId() : 0;
// If there is no current revision, there is no page
if ($id === false && !$rev) {
$linkCache = LinkCache::singleton();
$linkCache->addBadLinkObj($title);
}
$deps[] = array('title' => $title, 'page_id' => $title->getArticleID(), 'rev_id' => $rev_id);
if ($rev) {
$text = $rev->getText();
} elseif ($title->getNamespace() == NS_MEDIAWIKI) {
global $wgContLang;
$message = $wgContLang->lcfirst($title->getText());
$text = wfMsgForContentNoTrans($message);
if (wfEmptyMsg($message, $text)) {
$text = false;
break;
}
} else {
break;
}
if ($text === false) {
break;
}
// Redirect?
$finalTitle = $title;
$title = Title::newFromRedirect($text);
}
return array('text' => $text, 'finalTitle' => $finalTitle, 'deps' => $deps);
}
开发者ID:josephdye,项目名称:wikireader,代码行数:50,代码来源:Parser.php
示例17: wfMsgWeirdKey
/**
* This function provides the message source for messages to be edited which are *not* stored in the database.
* @param $key String:
*/
function wfMsgWeirdKey($key)
{
$subsource = str_replace(' ', '_', $key);
$source = wfMsgForContentNoTrans($subsource);
if (wfEmptyMsg($subsource, $source)) {
# Try again with first char lower case
$subsource = strtolower(substr($subsource, 0, 1)) . substr($subsource, 1);
$source = wfMsgForContentNoTrans($subsource);
}
if (wfEmptyMsg($subsource, $source)) {
# Didn't work either, return blank text
$source = "";
}
return $source;
}
开发者ID:puring0815,项目名称:OpenKore,代码行数:19,代码来源:GlobalFunctions.php
示例18: getArticleText
function getArticleText()
{
$found = false;
$text = '';
if ($this->mTitle) {
// If it's a MediaWiki message we can just hit the message cache
if ($this->mTitle->getNamespace() == NS_MEDIAWIKI) {
$key = $this->mTitle->getDBkey();
$text = wfMsgForContentNoTrans($key);
# If the message doesn't exist, return a blank
if ($text == '<' . $key . '>') {
$text = '';
}
$found = true;
} else {
// Get it from the DB
$rev = Revision::newFromTitle($this->mTitle, $this->mOldId);
if ($rev) {
$lastmod = wfTimestamp(TS_RFC2822, $rev->getTimestamp());
header("Last-modified: {$lastmod}");
$text = $rev->getText();
$found = true;
}
}
}
# Bad title or page does not exist
if (!$found && $this->mContentType == 'text/x-wiki') {
# Don't return a 404 response for CSS or JavaScript;
# 404s aren't generally cached and it would create
# extra hits when user CSS/JS are on and the user doesn't
# have the pages.
header("HTTP/1.0 404 Not Found");
}
return $this->parseArticleText($text);
}
开发者ID:k-hasan-19,项目名称:wiki,代码行数:35,代码来源:RawPage.php
示例19: createCardPage
private function createCardPage($gatherer)
{
$title = Title::newFromText($this->name);
$info = array();
$i = 0;
foreach ($gatherer->sets as $set => $stuff) {
$image = wfStripIllegalFilenameChars(str_replace(':', '', $this->name)) . ' ' . $gatherer->rels[$set]['abbr'] . '.jpg';
if (isset($gatherer->borders[$set]) && $gatherer->borders[$set]) {
$border = $gatherer->rels[$set]['border'];
$info['image' . ++$i] = "{{Border|[[Image:{$image}]]|{$border}}}";
} else {
$info['image' . ++$i] = "[[Image:{$image}]]";
}
foreach ($stuff as $rarity => $meh) {
switch ($rarity) {
case 'R':
$rarity = 'Rare';
break;
case 'U':
$rarity = 'Uncommon';
break;
case 'C':
$rarity = 'Common';
break;
case 'S':
if ($set == 'Time Spiral "Timeshifted"') {
$rarity = 'Timeshifted';
$set = 'Time Spiral';
} else {
$rarity = 'Special';
}
break;
case 'M':
$rarity = 'Mythic Rare';
break;
case 'L':
$rarity = 'Land';
break;
}
$set = wfStripIllegalFilenameChars(str_replace(':', '', $set));
$info['p/r' . $i] = "{{Rarity|{$set}|{$rarity}}}";
}
}
for ($i = 1; $i <= 15; $i++) {
if (!isset($info['image' . $i])) {
$info['image' . $i] = '';
}
if (!isset($info['p/r' . $i])) {
$info['p/r' . $i] = '';
}
}
$article = new WikiPage($title);
$article->doEdit(wfMsgForContentNoTrans('gatherer-cardpage', array($gatherer->info['name'], $gatherer->info['type'], $gatherer->info['cost'], $gatherer->info['cmc'], $gatherer->info['rules'], $gatherer->info['flavor'], $gatherer->info['p/t'], $gatherer->info['planeswalker'], $info['image1'], $info['p/r1'], $info['image2'], $info['p/r2'], $info['image3'], $info['p/r3'], $info['image4'], $info['p/r4'], $info['image5'], $info['p/r5'], $info['image6'], $info['p/r6'], $info['image7'], $info['p/r7'], $info['image8'], $info['p/r8'], $info['image9'], $info['p/r9'], $info['image10'], $info['p/r10'], $info['image11'], $info['p/r11'], $info['image12'], $info['p/r12'], $info['image13'], $info['p/r13'], $info['image14'], $info['p/r14'], $info['image15'], $info['p/r15'])), wfMsg('gatherer-cardpage-com'));
}
开发者ID:Tjorriemorrie,项目名称:app,代码行数:54,代码来源:Gatherer_body.php
示例20: addToSidebarPlain
/**
* Add content from plain text
* @since 1.17
* @param &$bar array
* @param $text string
*/
function addToSidebarPlain(&$bar, $text)
{
$lines = explode("\n", $text);
$wikiBar = array();
# We need to handle the wikitext on a different variable, to avoid trying to do an array operation on text, which would be a fatal error.
$heading = '';
foreach ($lines as $line) {
if (strpos($line, '*') !== 0) {
continue;
}
if (strpos($line, '**') !== 0) {
$heading = trim($line, '* ');
if (!array_key_exists($heading, $bar)) {
$bar[$heading] = array();
}
} else {
$line = trim($line, '* ');
if (strpos($line, '|') !== false) {
// sanity check
$line = array_map('trim', explode('|', $line, 2));
$link = wfMsgForContent($line[0]);
if ($link == '-') {
continue;
}
$text = wfMsgExt($line[1], 'parsemag');
if (wfEmptyMsg($line[1], $text)) {
$text = $line[1];
}
if (wfEmptyMsg($line[0], $link)) {
$link = $line[0];
}
if (preg_match('/^(?:' . wfUrlProtocols() . ')/', $link)) {
$href = $link;
} else {
$title = Title::newFromText($link);
if ($title) {
$title = $title->fixSpecialName();
$href = $title->getLocalURL();
} else {
$href = 'INVALID-TITLE';
}
}
$bar[$heading][] = array('text' => $text, 'href' => $href, 'id' => 'n-' . strtr($line[1], ' ', '-'), 'active' => false);
} else {
if (substr($line, 0, 2) == '{{' && substr($line, -2) == '}}') {
global $wgParser, $wgTitle;
$line = substr($line, 2, strlen($line) - 4);
$options = new ParserOptions();
$options->setEditSection(false);
$options->setInterfaceMessage(true);
$wikiBar[$heading] = $wgParser->parse(wfMsgForContentNoTrans($line), $wgTitle, $options)->getText();
} else {
continue;
}
}
}
}
if (count($wikiBar)
|
请发表评论