本文整理汇总了PHP中wfEmptyMsg函数的典型用法代码示例。如果您正苦于以下问题:PHP wfEmptyMsg函数的具体用法?PHP wfEmptyMsg怎么用?PHP wfEmptyMsg使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wfEmptyMsg函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例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;
}
示例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;
}
示例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 );
}
示例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");
}
示例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;
}
示例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;
}
示例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;
}
示例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";
}
示例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;
}
示例11: tagDescription
static function tagDescription($tag)
{
$msg = wfMsgExt("tag-{$tag}", 'parseinline');
if (wfEmptyMsg("tag-{$tag}", $msg)) {
return htmlspecialchars($tag);
}
return $msg;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}