本文整理汇总了PHP中wfEmptyMsg函数的典型用法代码示例。如果您正苦于以下问题:PHP wfEmptyMsg函数的具体用法?PHP wfEmptyMsg怎么用?PHP wfEmptyMsg使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wfEmptyMsg函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: wfAddQuantcastTrackingCode
/**
* Add tracking JS to all pages for all users that are not members of excluded
* groups (the group listed in $wgQuantcastTrackingExcludedGroups).
*
* @param $skin Object: Skin object
* @param $text String: bottomScripts text
* @return Boolean: true
*/
function wfAddQuantcastTrackingCode( $skin, &$text ) {
global $wgUser, $wgQuantcastTrackingExcludedGroups;
$groups = $wgUser->getEffectiveGroups();
if ( !in_array( $wgQuantcastTrackingExcludedGroups, $groups ) ) {
$message = trim( wfMsgForContent( 'quantcast-tracking-number' ) );
// We have a custom tracking code, use it!
if( !wfEmptyMsg( 'quantcast-tracking-number', $message ) ) {
$trackingCode = $message;
} else { // use ShoutWiki's default code
$trackingCode = wfMsgForContent( 'shoutwiki-quantcast-tracking-number' );
}
$safeCode = htmlspecialchars( $trackingCode, ENT_QUOTES );
$text .= "\t\t" . '<!-- Start Quantcast tag -->
<script type="text/javascript">/*<![CDATA[*/
_qoptions = {
qacct: "' . $safeCode . '"
};
/*]]>*/</script>
<script type="text/javascript" src="http://edge.quantserve.com/quant.js"></script>
<noscript>
<img src="http://pixel.quantserve.com/pixel/' . $safeCode . '.gif" style="display: none;" border="0" height="1" width="1" alt="Quantcast" />
</noscript>
<!-- End Quantcast tag -->' . "\n\n";
}
return true;
}
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:36,代码来源:Quantcast.php
示例2: makePhp
/**
*
*/
function makePhp($messages)
{
global $wgLang;
$txt = "\n\n\$messages = array(\n";
foreach ($messages as $key => $m) {
if ($wgLang->getCode() != 'en' and $m['msg'] == $m['enmsg']) {
//if (strstr($m['msg'],"\n")) {
// $txt.='/* ';
// $comment=' */';
//} else {
// $txt .= '#';
// $comment = '';
//}
continue;
} elseif (wfEmptyMsg($key, $m['msg'])) {
$m['msg'] = '';
$comment = ' #empty';
} else {
$comment = '';
}
$txt .= "'{$key}' => '" . preg_replace("/(?<!\\\\)'/", "\\'", $m['msg']) . "',{$comment}\n";
}
$txt .= ');';
return $txt;
}
开发者ID:puring0815,项目名称:OpenKore,代码行数:28,代码来源:SpecialAllmessages.php
示例3: wfArticleMetaDescription
/**
* @param OutputPage $out
* @param string $text
* @return bool
*/
function wfArticleMetaDescription(&$out, &$text)
{
global $wgTitle;
wfProfileIn(__METHOD__);
$sMessage = null;
$sMainPage = wfMsgForContent('Mainpage');
if (strpos($sMainPage, ':') !== false) {
$sTitle = $wgTitle->getFullText();
} else {
$sTitle = $wgTitle->getText();
}
if (strcmp($sTitle, $sMainPage) == 0) {
// we're on Main Page, check MediaWiki:Description message
$sMessage = wfMsg("Description");
}
if ($sMessage == null || wfEmptyMsg("Description", $sMessage)) {
$DESC_LENGTH = 100;
$articleId = $wgTitle->getArticleID();
$articleService = new ArticleService($articleId);
$description = $articleService->getTextSnippet($DESC_LENGTH);
} else {
// MediaWiki:Description message found, use it
$description = $sMessage;
}
if (!empty($description)) {
$out->addMeta('description', htmlspecialchars($description));
}
wfProfileOut(__METHOD__);
return true;
}
开发者ID:schwarer2006,项目名称:wikia,代码行数:35,代码来源:ArticleMetaDescription.php
示例4: wfWhitelistPages
function wfWhitelistPages() {
global $wgWhitelistRead, $wgGroupPermissions;
$message = wfMsgForContent( 'public read whitelist' );
// If MediaWiki:Public read whitelist is empty, bail out
if ( wfEmptyMsg( 'public read whitelist', $message ) ) {
return;
}
// If anonymous users can read the wiki, then it's not a private one
// and we don't need this feature for non-private wikis
if ( $wgGroupPermissions['*']['read'] ) {
return;
}
// $wgWhitelistRead is *false* by default instead of being an empty array
if ( $wgWhitelistRead === false ) {
$wgWhitelistRead = array();
}
// Explode along newlines
$whitelistedPages = explode( "\n", trim( $message ) );
// Merge with current list
$wgWhitelistRead = array_merge( $wgWhitelistRead, $whitelistedPages );
}
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:27,代码来源:WhitelistPages.php
示例5: constructCreateForm
function constructCreateForm()
{
global $wgOut, $wgScript;
global $wgUserProperties, $wgActivityModes;
$wgOut->addHTML(Xml::openElement('form', array('action' => $this->getTitle()->getLocalURL(), 'method' => 'post')));
$wgOut->addHTML(Xml::element('h2', null, wfMsg('nss-create-account-header')) . "\n");
$wgOut->addHTML("<table border=\"1\" id=\"newuser\">\n");
$props = array_merge(array('username', 'email'), $wgUserProperties);
foreach ($props as $i) {
$msg = 'am-' . $i;
$wgOut->addHTML("\t<tr><th>" . (wfEmptyMsg($msg, wfMsg($msg)) ? $i : wfMsgHtml($msg)) . "</th><td>" . Xml::input("am-" . str_replace(' ', '_', $i), 40) . "</td></tr>\n");
}
global $wgActivityModes;
$select = new XmlSelect("am-active");
$select->setDefault('active');
$select->setAttribute('width', '100%');
foreach ($wgActivityModes as $key) {
$select->addOption($key);
}
$wgOut->addHTML("\t<tr><th>" . wfMsgHtml('am-active') . "</th><td>" . $select->getHTML() . "</td></tr>\n");
$wgOut->addHTML("</table>\n");
$wgOut->addHTML("<div id=\"newaccount-submit\">\n" . Html::Hidden('action', 'create') . Xml::checkLabel(wfMsg('nss-no-mail'), 'nss-no-mail', 'nss-no-mail') . "<br />\n" . Xml::element('input', array('type' => 'submit', 'value' => wfMsg('nss-create-account'))) . "</div>\n</form>\n");
$wgOut->addHTML(Xml::openElement('form', array('action' => $this->getTitle()->getLocalURL(), 'method' => 'post')));
$wgOut->addHTML("<div id=\"newaccount-raw\">\n" . Xml::textarea('nss-create-account-raw', '') . "\n" . Html::Hidden('action', 'create-raw') . Xml::checkLabel(wfMsg('nss-no-mail'), 'nss-no-mail', 'nss-no-mail') . "<br />\n" . Xml::element('input', array('type' => 'submit', 'value' => wfMsg('nss-create-account'))) . "</div>\n</form>\n");
}
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:25,代码来源:SpecialAccountManager.php
示例6: getSummary
public function getSummary()
{
if ($this->summary === false) {
if ($this->messageId) {
$id = $this->messageId;
if (is_array($id)) {
$id = array_shift($id);
}
if (substr($id, 0, 3) == 'mw-') {
$id = substr($id, 3);
}
if (isset(self::$messagesMap[$id])) {
$id = self::$messagesMap[$id];
}
$messageId = $id . '-notice';
$message = wfMsg($messageId);
if (!wfEmptyMsg($messageId, $message)) {
$this->summary = wfMsgExt($messageId, array('parseinline'));
}
}
if ($this->summary === false) {
$this->summary = $this->getHtmlSnippet();
}
}
return (string) $this->summary;
}
开发者ID:Tjorriemorrie,项目名称:app,代码行数:26,代码来源:EditPageNotice.class.php
示例7: wfSendUserBoardMessageOnRegistration
/**
* Send the message if the UserBoard class exists (duh!) and the welcome
* message has some content.
*
* @param $user User: the new User object being created
* @param $byEmail Boolean: true if the account was created by e-mail
* @return Boolean: true
*/
function wfSendUserBoardMessageOnRegistration($user, $byEmail)
{
if (class_exists('UserBoard') && $user instanceof User) {
$message = trim(wfMsgForContent('user-board-welcome-message'));
// If the welcome message is empty, short-circuit right away.
if (wfEmptyMsg('user-board-welcome-message', $message)) {
return true;
}
// Just quit if we're in read-only mode
if (wfReadOnly()) {
return true;
}
$dbr = wfGetDB(DB_SLAVE);
// Get all users who are in the 'sysop' group and aren't blocked from
// the database
$res = $dbr->select(array('user_groups', 'ipblocks'), array('ug_group', 'ug_user'), array('ug_group' => 'sysop', 'ipb_user' => null), __METHOD__, array(), array('ipblocks' => array('LEFT JOIN', 'ipb_user = ug_user')));
$adminUids = array();
foreach ($res as $row) {
$adminUids[] = $row->ug_user;
}
// Pick one UID from the array of admin user IDs
$random = array_rand(array_flip($adminUids), 1);
$sender = User::newFromId($random);
$senderUid = $sender->getId();
$senderName = $sender->getName();
// Send the message
$b = new UserBoard();
$b->sendBoardMessage($senderUid, $senderName, $user->getId(), $user->getName(), wfMsgForContent('user-board-welcome-message', $senderName));
}
return true;
}
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:39,代码来源:AutomaticBoardWelcome.php
示例8: efGPManagerCustomToolboxAppend
function efGPManagerCustomToolboxAppend(&$skin)
{
global $wgOut, $wgUser;
$tb = explode("\n", wfMsg('toolbox_append'));
$new = array();
foreach ($tb as &$nt) {
if (strpos($nt, '*') === 0) {
$nt = trim($nt, '*');
$parts = explode('|', $nt);
foreach ($parts as &$part) {
$part = trim($part);
}
$href = wfMsgForContent($parts[0]);
$text = wfMsgForContent($parts[1]);
$perm = array_key_exists(2, $parts) ? $parts[2] : 'read';
if (!$wgUser->isAllowed($perm)) {
continue;
}
if (wfEmptyMsg($parts[0], $href)) {
$href = $parts[0];
}
if (wfEmptyMsg($parts[1], $text)) {
$text = $parts[1];
}
$id = Sanitizer::escapeId($parts[1], 'noninitial');
$new[] = array($href, $text, $id);
}
}
foreach ($new as $t) {
echo '<li id="t-' . $t[2] . '"><a href="' . htmlspecialchars($t[0]) . '">' . $t[1] . '</a></li>';
}
return true;
}
开发者ID:schwarer2006,项目名称:wikia,代码行数:33,代码来源:CustomToolbox.php
示例9: doTagRow
function doTagRow($tag, $hitcount)
{
static $sk = null, $doneTags = array();
if (!$sk) {
global $wgUser;
$sk = $wgUser->getSkin();
}
if (in_array($tag, $doneTags)) {
return '';
}
$newRow = '';
$newRow .= Xml::tags('td', null, Xml::element('tt', null, $tag));
$disp = ChangeTags::tagDescription($tag);
$disp .= ' (' . $sk->link(Title::makeTitle(NS_MEDIAWIKI, "Tag-{$tag}"), wfMsg('tags-edit')) . ')';
$newRow .= Xml::tags('td', null, $disp);
$desc = wfMsgExt("tag-{$tag}-description", 'parseinline');
$desc = wfEmptyMsg("tag-{$tag}-description", $desc) ? '' : $desc;
$desc .= ' (' . $sk->link(Title::makeTitle(NS_MEDIAWIKI, "Tag-{$tag}-description"), wfMsg('tags-edit')) . ')';
$newRow .= Xml::tags('td', null, $desc);
$hitcount = wfMsg('tags-hitcount', $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";
}
开发者ID:ruizrube,项目名称:spdef,代码行数:25,代码来源:SpecialTags.php
示例10: getMsg
/**
* Gets a message from the NS_MEDIAWIKI namespace
*/
protected function getMsg($msgId)
{
$msgText = wfMsgExt($msgId);
if (wfEmptyMsg($msgId, $msgText)) {
return null;
}
return $msgText;
}
开发者ID:clrh,项目名称:mediawiki,代码行数:11,代码来源:OnImageUpload.php
示例11: tagDescription
static function tagDescription($tag)
{
$msg = wfMsgExt("tag-{$tag}", 'parseinline');
if (wfEmptyMsg("tag-{$tag}", $msg)) {
return htmlspecialchars($tag);
}
return $msg;
}
开发者ID:GodelDesign,项目名称:Godel,代码行数:8,代码来源:ChangeTags.php
示例12: getMessage
/**
* Show a message asking the user to enter a captcha on edit
* The result will be treated as wiki text
*
* @param $action Action being performed
* @return string
*/
function getMessage($action)
{
$name = 'recaptcha-' . $action;
$text = wfMsg($name);
# Obtain a more tailored message, if possible, otherwise, fall back to
# the default for edits
return wfEmptyMsg($name, $text) ? wfMsg('recaptcha-edit') : $text;
}
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:15,代码来源:ReCaptcha.class.php
示例13: getMessage
/**
* GETS a message from the MediaWiki namespace
*/
protected function getMessage(&$key)
{
$source = wfMsgGetKey($key, true, true, false);
if (wfEmptyMsg($key, $source)) {
return null;
}
return $source;
}
开发者ID:clrh,项目名称:mediawiki,代码行数:11,代码来源:SecureTag.php
示例14: getMsg
/**
* Gets a message from the NS_MEDIAWIKI namespace
*/
protected function getMsg($msgId)
{
$msgText = wfMsgExt($msgId, array('parseinline'));
if (wfEmptyMsg($msgId, $msgText)) {
return null;
}
return $msgText;
}
开发者ID:clrh,项目名称:mediawiki,代码行数:11,代码来源:HeaderFooter.body.php
示例15: getMessage
/**
* Show a message asking the user to enter a captcha on edit
* The result will be treated as wiki text
*
* @param string $action Action being performed
*
* @return string
*/
public function getMessage($action)
{
// Possible keys for easy grepping: captcha-edit, captcha-addurl, captcha-createaccount, captcha-create
$name = 'captcha-' . $action;
$text = wfMessage($name)->escaped();
# Obtain a more tailored message, if possible, otherwise, fall back to
# the default for edits
return wfEmptyMsg($name, $text) ? wfMessage('captcha-edit')->escaped() : $text;
}
开发者ID:Tjorriemorrie,项目名称:app,代码行数:17,代码来源:BaseCaptcha.class.php
示例16: WidgetTipsGetTips
function WidgetTipsGetTips()
{
// use content language (thx to Uberfuzzy)
$tips = wfMsgForContent('tips');
if (wfEmptyMsg('tips', $tips)) {
return false;
} else {
return $tips != '' ? explode("\n\n", trim($tips)) : false;
}
}
开发者ID:Tjorriemorrie,项目名称:app,代码行数:10,代码来源:WidgetTips.php
示例17: 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
示例18: onGetConfirmEditMessage
/**
* Get message for ConfirmEdit - FancyCaptcha (code come from FancyCaptcha::getMessage()).
*/
function onGetConfirmEditMessage($captcha, &$message)
{
if (!$captcha instanceof FancyCaptcha) {
return true;
}
$name = 'fancycaptcha-createaccount';
$text = wfMsgExt($name, array('parseinline'));
$message = wfEmptyMsg($name, $text) ? wfMsgExt('fancycaptcha-edit', array('parseinline')) : $text;
return true;
}
开发者ID:schwarer2006,项目名称:wikia,代码行数:13,代码来源:ComboAjaxLogin.php
示例19: wfSpecialStatistics
/**
* constructor
*/
function wfSpecialStatistics()
{
global $wgOut, $wgLang, $wgRequest;
$fname = 'wfSpecialStatistics';
$action = $wgRequest->getVal('action');
$dbr = wfGetDB(DB_SLAVE);
$views = SiteStats::views();
$edits = SiteStats::edits();
$good = SiteStats::articles();
$images = SiteStats::images();
$total = SiteStats::pages();
$users = SiteStats::users();
$admins = $dbr->selectField('user_groups', 'COUNT(*)', array('ug_group' => 'sysop'), $fname);
$numJobs = $dbr->estimateRowCount('job');
if ($action == 'raw') {
$wgOut->disable();
header('Pragma: nocache');
echo "total={$total};good={$good};views={$views};edits={$edits};users={$users};admins={$admins};images={$images};jobs={$numJobs}\n";
return;
} else {
$text = '==' . wfMsg('sitestats') . "==\n";
$text .= wfMsgExt('sitestatstext', array('parsemag'), $wgLang->formatNum($total), $wgLang->formatNum($good), $wgLang->formatNum($views), $wgLang->formatNum($edits), $wgLang->formatNum(sprintf('%.2f', $total ? $edits / $total : 0)), $wgLang->formatNum(sprintf('%.2f', $edits ? $views / $edits : 0)), $wgLang->formatNum($numJobs), $wgLang->formatNum($images));
$text .= "\n==" . wfMsg('userstats') . "==\n";
$text .= wfMsgExt('userstatstext', array('parsemag'), $wgLang->formatNum($users), $wgLang->formatNum($admins), '[[' . wfMsgForContent('grouppage-sysop') . ']]', $wgLang->formatNum(sprintf('%.2f', $admins / $users * 100)), User::makeGroupLinkWiki('sysop'));
$wgOut->addWikiText($text);
global $wgDisableCounters, $wgMiserMode, $wgUser, $wgLang, $wgContLang;
if (!$wgDisableCounters && !$wgMiserMode) {
$page = $dbr->tableName('page');
$sql = "SELECT page_namespace, page_title, page_counter FROM {$page} WHERE page_is_redirect = 0 AND page_counter > 0 ORDER BY page_counter DESC";
$sql = $dbr->limitResult($sql, 10, 0);
$res = $dbr->query($sql, $fname);
if ($res) {
$wgOut->addHtml('<h2>' . wfMsgHtml('statistics-mostpopular') . '</h2>');
$skin = $wgUser->getSkin();
$wgOut->addHtml('<ol>');
while ($row = $dbr->fetchObject($res)) {
// BizzWiki begin {{
if (!$wgUser->isAllowed('browse', $row->page_namespace)) {
continue;
}
// BizzWiki end }}
$link = $skin->makeKnownLinkObj(Title::makeTitleSafe($row->page_namespace, $row->page_title));
$dirmark = $wgContLang->getDirMark();
$wgOut->addHtml('<li>' . $link . $dirmark . ' [' . $wgLang->formatNum($row->page_counter) . ']</li>');
}
$wgOut->addHtml('</ol>');
$dbr->freeResult($res);
}
}
$footer = wfMsg('statistics-footer');
if (!wfEmptyMsg('statistics-footer', $footer) && $footer != '') {
$wgOut->addWikiText($footer);
}
}
}
开发者ID:mediawiki-extensions,项目名称:bizzwiki,代码行数:58,代码来源:SpecialStatistics.php
示例20: wfGlobalNotice
/**
* @param $siteNotice String: existing site notice (if any) to manipulate or
* append to
* @return Boolean: true
*/
function wfGlobalNotice(&$siteNotice)
{
global $wgLang, $wgUser;
// It is possible that there is a global notice (for example, for all
// French-speaking users) *and* a forced global notice (for everyone,
// informing them of planned server maintenance etc.)
//
// We append whatever we have to this variable and if right before
// returning this variable is non-empty, we wrap the local site-notice in
// a div with id="localSiteNotice" because users may want to hide global
// notices (or forced global notices...that'd be quite dumb though)
//
// Come to think of it...on ShoutWiki, the $siteNotice variable will never
// be empty because SendToAFriend hooks into SiteNoticeAfter hook, too, and
// appends its HTML to it.
$ourSiteNotice = '';
// "Forced" globalnotice -- a site-wide notice shown for *all* users,
// no matter what their language is
// Used only for things like server migration notices etc.
//
// So, once again I find it that MediaWiki sucks. Adding 'parse' to the
// options array adds <p> tags around the message, EVEN IF THE MESSAGE IS
// EMPTY! This causes wfEmptyMsg() to think that the message has some
// content, when in fact it doesn't.
$forcedNotice = wfMsgExt('forced-globalnotice', array('language' => 'en'));
if (!wfEmptyMsg('forced-globalnotice', $forcedNotice)) {
$ourSiteNotice .= '<div style="text-align: center;" id="forcedGlobalNotice">' . wfMsgExt('forced-globalnotice', array('parse', 'language' => 'en')) . '</div>';
}
// Global notice, depending on the user's language
// This can be used to show language-specific stuff to users with a certain
// interface language (i.e. "We need more French translators! Pouvez-vous nous aider ?")
$globalNotice = wfMsgExt('globalnotice', array('language' => $wgLang->getCode()));
if (!wfEmptyMsg('globalnotice', $globalNotice)) {
// Give the global notice its own ID and center it
$ourSiteNotice .= '<div style="text-align: center;" id="globalNotice">' . wfMsgExt('globalnotice', array('parse', 'language' => $wgLang->getCode())) . '</div>';
}
// Group-specific global notices
foreach (array('sysop', 'bureaucrat', 'bot', 'rollback') as $group) {
$messageName = 'globalnotice-' . $group;
$globalNoticeForGroup = wfMsgExt($messageName, array('language' => $wgLang->getCode()));
$isMember = in_array($group, $wgUser->getEffectiveGroups());
if (!wfEmptyMsg($messageName, $globalNoticeForGroup) && $isMember) {
// Give the global notice its own ID and center it
$ourSiteNotice .= '<div style="text-align: center;" id="globalNoticeForGroup">' . wfMsgExt($messageName, array('parse', 'language' => $wgLang->getCode())) . '</div>';
}
}
// If we have something to display, wrap the local sitenotice in a pretty
// div and copy $ourSiteNotice to $siteNotice
if (!empty($ourSiteNotice)) {
$ourSiteNotice .= '<!-- end GlobalNotice --><div id="localSiteNotice">' . $siteNotice . '</div>';
$siteNotice = $ourSiteNotice;
}
return true;
}
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:59,代码来源:GlobalNotice.php
注:本文中的wfEmptyMsg函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论