本文整理汇总了PHP中MWTimestamp::getLocalInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP MWTimestamp::getLocalInstance方法的具体用法?PHP MWTimestamp::getLocalInstance怎么用?PHP MWTimestamp::getLocalInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MWTimestamp
的用法示例。
在下文中一共展示了MWTimestamp::getLocalInstance方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getFormFields
protected function getFormFields()
{
global $wgContLang;
$timestamp = $this->oldFile->getTimestamp();
$user = $this->getUser();
$lang = $this->getLanguage();
$userDate = $lang->userDate($timestamp, $user);
$userTime = $lang->userTime($timestamp, $user);
$siteTs = MWTimestamp::getLocalInstance($timestamp);
$ts = $siteTs->format('YmdHis');
$siteDate = $wgContLang->date($ts, false, false);
$siteTime = $wgContLang->time($ts, false, false);
$tzMsg = $siteTs->getTimezoneMessage()->inContentLanguage()->text();
return ['intro' => ['type' => 'info', 'vertical-label' => true, 'raw' => true, 'default' => $this->msg('filerevert-intro', $this->getTitle()->getText(), $userDate, $userTime, wfExpandUrl($this->page->getFile()->getArchiveUrl($this->getRequest()->getText('oldimage')), PROTO_CURRENT))->parseAsBlock()], 'comment' => ['type' => 'text', 'label-message' => 'filerevert-comment', 'default' => $this->msg('filerevert-defaultcomment', $siteDate, $siteTime, $tzMsg)->inContentLanguage()->text()]];
}
示例2: getTimezoneOptions
/**
* @param $context IContextSource
* @return array
*/
static function getTimezoneOptions( IContextSource $context ) {
$opt = array();
global $wgLocalTZoffset;
$timestamp = MWTimestamp::getLocalInstance();
// Check that $wgLocalTZoffset is the same as the local time zone offset
if ( $wgLocalTZoffset == $timestamp->format( 'Z' ) / 60 ) {
$server_tz_msg = $context->msg( 'timezoneuseserverdefault', $timestamp->getTimezone()->getName() )->text();
} else {
$tzstring = sprintf( '%+03d:%02d', floor( $wgLocalTZoffset / 60 ), abs( $wgLocalTZoffset ) % 60 );
$server_tz_msg = $context->msg( 'timezoneuseserverdefault', $tzstring )->text();
}
$opt[$server_tz_msg] = "System|$wgLocalTZoffset";
$opt[$context->msg( 'timezoneuseoffset' )->text()] = 'other';
$opt[$context->msg( 'guesstimezone' )->text()] = 'guess';
if ( function_exists( 'timezone_identifiers_list' ) ) {
# Read timezone list
$tzs = timezone_identifiers_list();
sort( $tzs );
$tzRegions = array();
$tzRegions['Africa'] = $context->msg( 'timezoneregion-africa' )->text();
$tzRegions['America'] = $context->msg( 'timezoneregion-america' )->text();
$tzRegions['Antarctica'] = $context->msg( 'timezoneregion-antarctica' )->text();
$tzRegions['Arctic'] = $context->msg( 'timezoneregion-arctic' )->text();
$tzRegions['Asia'] = $context->msg( 'timezoneregion-asia' )->text();
$tzRegions['Atlantic'] = $context->msg( 'timezoneregion-atlantic' )->text();
$tzRegions['Australia'] = $context->msg( 'timezoneregion-australia' )->text();
$tzRegions['Europe'] = $context->msg( 'timezoneregion-europe' )->text();
$tzRegions['Indian'] = $context->msg( 'timezoneregion-indian' )->text();
$tzRegions['Pacific'] = $context->msg( 'timezoneregion-pacific' )->text();
asort( $tzRegions );
$prefill = array_fill_keys( array_values( $tzRegions ), array() );
$opt = array_merge( $opt, $prefill );
$now = date_create( 'now' );
foreach ( $tzs as $tz ) {
$z = explode( '/', $tz, 2 );
# timezone_identifiers_list() returns a number of
# backwards-compatibility entries. This filters them out of the
# list presented to the user.
if ( count( $z ) != 2 || !array_key_exists( $z[0], $tzRegions ) ) {
continue;
}
# Localize region
$z[0] = $tzRegions[$z[0]];
$minDiff = floor( timezone_offset_get( timezone_open( $tz ), $now ) / 60 );
$display = str_replace( '_', ' ', $z[0] . '/' . $z[1] );
$value = "ZoneInfo|$minDiff|$tz";
$opt[$z[0]][$display] = $value;
}
}
return $opt;
}
示例3: revisiontimestamp
/**
* Get the timestamp from the last revision of a specified page.
* @param Parser $parser
* @param string $title Title to get the timestamp from
* @return string
* @since 1.23
*/
public static function revisiontimestamp($parser, $title = null)
{
$t = Title::newFromText($title);
if (is_null($t)) {
return '';
}
// fetch revision from cache/database and return the value
$rev = self::getCachedRevisionObject($parser, $t);
return $rev ? MWTimestamp::getLocalInstance($rev->getTimestamp())->format('YmdHis') : '';
}
示例4: pstPass2
/**
* Pre-save transform helper function
*
* @param $text string
* @param $user User
*
* @return string
*/
private function pstPass2($text, $user)
{
global $wgContLang;
# Note: This is the timestamp saved as hardcoded wikitext to
# the database, we use $wgContLang here in order to give
# everyone the same signature and use the default one rather
# than the one selected in each user's preferences.
# (see also bug 12815)
$ts = $this->mOptions->getTimestamp();
$timestamp = MWTimestamp::getLocalInstance($ts);
$ts = $timestamp->format('YmdHis');
$tzMsg = $timestamp->format('T');
# might vary on DST changeover!
# Allow translation of timezones through wiki. format() can return
# whatever crap the system uses, localised or not, so we cannot
# ship premade translations.
$key = 'timezone-' . strtolower(trim($tzMsg));
$msg = wfMessage($key)->inContentLanguage();
if ($msg->exists()) {
$tzMsg = $msg->text();
}
$d = $wgContLang->timeanddate($ts, false, false) . " ({$tzMsg})";
# Variable replacement
# Because mOutputType is OT_WIKI, this will only process {{subst:xxx}} type tags
$text = $this->replaceVariables($text);
# This works almost by chance, as the replaceVariables are done before the getUserSig(),
# which may corrupt this parser instance via its wfMessage()->text() call-
# Signatures
$sigText = $this->getUserSig($user);
$text = strtr($text, array('~~~~~' => $d, '~~~~' => "{$sigText} {$d}", '~~~' => $sigText));
# Context links ("pipe tricks"): [[|name]] and [[name (context)|]]
$tc = '[' . Title::legalChars() . ']';
$nc = '[ _0-9A-Za-z\\x80-\\xff-]';
# Namespaces can use non-ascii!
$p1 = "/\\[\\[(:?{$nc}+:|:|)({$tc}+?)( ?\\({$tc}+\\))\\|]]/";
# [[ns:page (context)|]]
$p4 = "/\\[\\[(:?{$nc}+:|:|)({$tc}+?)( ?({$tc}+))\\|]]/";
# [[ns:page(context)|]] (double-width brackets, added in r40257)
$p3 = "/\\[\\[(:?{$nc}+:|:|)({$tc}+?)( ?\\({$tc}+\\)|)((?:, |,){$tc}+|)\\|]]/";
# [[ns:page (context), context|]] (using either single or double-width comma)
$p2 = "/\\[\\[\\|({$tc}+)]]/";
# [[|page]] (reverse pipe trick: add context from page title)
# try $p1 first, to turn "[[A, B (C)|]]" into "[[A, B (C)|A, B]]"
$text = preg_replace($p1, '[[\\1\\2\\3|\\2]]', $text);
$text = preg_replace($p4, '[[\\1\\2\\3|\\2]]', $text);
$text = preg_replace($p3, '[[\\1\\2\\3\\4|\\2]]', $text);
$t = $this->mTitle->getText();
$m = array();
if (preg_match("/^({$nc}+:|){$tc}+?( \\({$tc}+\\))\$/", $t, $m)) {
$text = preg_replace($p2, "[[{$m['1']}\\1{$m['2']}|\\1]]", $text);
} elseif (preg_match("/^({$nc}+:|){$tc}+?(, {$tc}+|)\$/", $t, $m) && "{$m['1']}{$m['2']}" != '') {
$text = preg_replace($p2, "[[{$m['1']}\\1{$m['2']}|\\1]]", $text);
} else {
# if there's no context, don't bother duplicating the title
$text = preg_replace($p2, '[[\\1]]', $text);
}
# Trim trailing whitespace
$text = rtrim($text);
return $text;
}
示例5: onView
/**
* Print the history page for an article.
*/
function onView()
{
$out = $this->getOutput();
$request = $this->getRequest();
/**
* Allow client caching.
*/
if ($out->checkLastModified($this->page->getTouched())) {
return;
// Client cache fresh and headers sent, nothing more to do.
}
wfProfileIn(__METHOD__);
$this->preCacheMessages();
$config = $this->context->getConfig();
# Fill in the file cache if not set already
$useFileCache = $config->get('UseFileCache');
if ($useFileCache && HTMLFileCache::useFileCache($this->getContext())) {
$cache = HTMLFileCache::newFromTitle($this->getTitle(), 'history');
if (!$cache->isCacheGood()) {
ob_start(array(&$cache, 'saveToFileCache'));
}
}
// Setup page variables.
$out->setFeedAppendQuery('action=history');
$out->addModules('mediawiki.action.history');
if ($config->get('UseMediaWikiUIEverywhere')) {
$out = $this->getOutput();
$out->addModuleStyles(array('mediawiki.ui.input', 'mediawiki.ui.checkbox'));
}
// Handle atom/RSS feeds.
$feedType = $request->getVal('feed');
if ($feedType) {
$this->feed($feedType);
wfProfileOut(__METHOD__);
return;
}
// Fail nicely if article doesn't exist.
if (!$this->page->exists()) {
$out->addWikiMsg('nohistory');
# show deletion/move log if there is an entry
LogEventsList::showLogExtract($out, array('delete', 'move'), $this->getTitle(), '', array('lim' => 10, 'conds' => array("log_action != 'revision'"), 'showIfEmpty' => false, 'msgKey' => array('moveddeleted-notice')));
wfProfileOut(__METHOD__);
return;
}
/**
* Add date selector to quickly get to a certain time
*/
$year = $request->getInt('year');
$month = $request->getInt('month');
$tagFilter = $request->getVal('tagfilter');
$tagSelector = ChangeTags::buildTagFilterSelector($tagFilter);
/**
* Option to show only revisions that have been (partially) hidden via RevisionDelete
*/
if ($request->getBool('deleted')) {
$conds = array('rev_deleted != 0');
} else {
$conds = array();
}
if ($this->getUser()->isAllowed('deletedhistory')) {
$checkDeleted = Xml::checkLabel($this->msg('history-show-deleted')->text(), 'deleted', 'mw-show-deleted-only', $request->getBool('deleted')) . "\n";
} else {
$checkDeleted = '';
}
// Add the general form
$action = htmlspecialchars(wfScript());
$out->addHTML("<form action=\"{$action}\" method=\"get\" id=\"mw-history-searchform\">" . Xml::fieldset($this->msg('history-fieldset-title')->text(), false, array('id' => 'mw-history-search')) . Html::hidden('title', $this->getTitle()->getPrefixedDBkey()) . "\n" . Html::hidden('action', 'history') . "\n" . Xml::dateMenu($year == null ? MWTimestamp::getLocalInstance()->format('Y') : $year, $month) . ' ' . ($tagSelector ? implode(' ', $tagSelector) . ' ' : '') . $checkDeleted . Xml::submitButton($this->msg('allpagessubmit')->text()) . "\n" . '</fieldset></form>');
wfRunHooks('PageHistoryBeforeList', array(&$this->page, $this->getContext()));
// Create and output the list.
$pager = new HistoryPager($this, $year, $month, $tagFilter, $conds);
$out->addHTML($pager->getNavigationBar() . $pager->getBody() . $pager->getNavigationBar());
$out->preventClickjacking($pager->getPreventClickjacking());
wfProfileOut(__METHOD__);
}
示例6: doQuery
protected function doQuery($sql)
{
wfDebug("SQL: [{$sql}]\n");
if (!StringUtils::isUtf8($sql)) {
throw new MWException("SQL encoding is invalid\n{$sql}");
}
// handle some oracle specifics
// remove AS column/table/subquery namings
if (!$this->getFlag(DBO_DDLMODE)) {
$sql = preg_replace('/ as /i', ' ', $sql);
}
// Oracle has issues with UNION clause if the statement includes LOB fields
// So we do a UNION ALL and then filter the results array with array_unique
$union_unique = preg_match('/\\/\\* UNION_UNIQUE \\*\\/ /', $sql) != 0;
// EXPLAIN syntax in Oracle is EXPLAIN PLAN FOR and it return nothing
// you have to select data from plan table after explain
$explain_id = MWTimestamp::getLocalInstance()->format('dmYHis');
$sql = preg_replace('/^EXPLAIN /', 'EXPLAIN PLAN SET STATEMENT_ID = \'' . $explain_id . '\' FOR', $sql, 1, $explain_count);
MediaWiki\suppressWarnings();
$this->mLastResult = $stmt = oci_parse($this->mConn, $sql);
if ($stmt === false) {
$e = oci_error($this->mConn);
$this->reportQueryError($e['message'], $e['code'], $sql, __METHOD__);
return false;
}
if (!oci_execute($stmt, $this->execFlags())) {
$e = oci_error($stmt);
if (!$this->ignoreDupValOnIndex || $e['code'] != '1') {
$this->reportQueryError($e['message'], $e['code'], $sql, __METHOD__);
return false;
}
}
MediaWiki\restoreWarnings();
if ($explain_count > 0) {
return $this->doQuery('SELECT id, cardinality "ROWS" FROM plan_table ' . 'WHERE statement_id = \'' . $explain_id . '\'');
} elseif (oci_statement_type($stmt) == 'SELECT') {
return new ORAResult($this, $stmt, $union_unique);
} else {
$this->mAffectedRows = oci_num_rows($stmt);
return true;
}
}
示例7: getCopyrightAndAuthorList
/**
* Get the "MediaWiki is copyright 2001-20xx by lots of cool guys" text
*
* @return String
*/
public static function getCopyrightAndAuthorList()
{
global $wgLang;
if (defined('MEDIAWIKI_INSTALL')) {
$othersLink = '[//www.mediawiki.org/wiki/Special:Version/Credits ' . wfMessage('version-poweredby-others')->text() . ']';
} else {
$othersLink = '[[Special:Version/Credits|' . wfMessage('version-poweredby-others')->text() . ']]';
}
$translatorsLink = '[//translatewiki.net/wiki/Translating:MediaWiki/Credits ' . wfMessage('version-poweredby-translators')->text() . ']';
$authorList = array('Magnus Manske', 'Brion Vibber', 'Lee Daniel Crocker', 'Tim Starling', 'Erik Möller', 'Gabriel Wicke', 'Ævar Arnfjörð Bjarmason', 'Niklas Laxström', 'Domas Mituzas', 'Rob Church', 'Yuri Astrakhan', 'Aryeh Gregor', 'Aaron Schulz', 'Andrew Garrett', 'Raimond Spekking', 'Alexandre Emsenhuber', 'Siebrand Mazeland', 'Chad Horohoe', 'Roan Kattouw', 'Trevor Parscal', 'Bryan Tong Minh', 'Sam Reed', 'Victor Vasiliev', 'Rotem Liss', 'Platonides', 'Antoine Musso', 'Timo Tijhof', 'Daniel Kinzler', 'Jeroen De Dauw', $othersLink, $translatorsLink);
return wfMessage('version-poweredby-credits', MWTimestamp::getLocalInstance()->format('Y'), $wgLang->listToText($authorList))->text();
}
示例8: send
/**
* This function will perform a direct (authenticated) login to
* a SMTP Server to use for mail relaying if 'wgSMTP' specifies an
* array of parameters. It requires PEAR:Mail to do that.
* Otherwise it just uses the standard PHP 'mail' function.
*
* @param MailAddress|MailAddress[] $to Recipient's email (or an array of them)
* @param MailAddress $from Sender's email
* @param string $subject Email's subject.
* @param string $body Email's text or Array of two strings to be the text and html bodies
* @param MailAddress $replyto Optional reply-to email (default: null).
* @param string $contentType Optional custom Content-Type (default: text/plain; charset=UTF-8)
* @throws MWException
* @throws Exception
* @return Status
*/
public static function send($to, $from, $subject, $body, $replyto = null, $contentType = 'text/plain; charset=UTF-8')
{
global $wgSMTP, $wgEnotifMaxRecips, $wgAdditionalMailParams, $wgAllowHTMLEmail;
$mime = null;
if (!is_array($to)) {
$to = array($to);
}
// mail body must have some content
$minBodyLen = 10;
// arbitrary but longer than Array or Object to detect casting error
// body must either be a string or an array with text and body
if (!(!is_array($body) && strlen($body) >= $minBodyLen) && !(is_array($body) && isset($body['text']) && isset($body['html']) && strlen($body['text']) >= $minBodyLen && strlen($body['html']) >= $minBodyLen)) {
// if it is neither we have a problem
return Status::newFatal('user-mail-no-body');
}
if (!$wgAllowHTMLEmail && is_array($body)) {
// HTML not wanted. Dump it.
$body = $body['text'];
}
wfDebug(__METHOD__ . ': sending mail to ' . implode(', ', $to) . "\n");
# Make sure we have at least one address
$has_address = false;
foreach ($to as $u) {
if ($u->address) {
$has_address = true;
break;
}
}
if (!$has_address) {
return Status::newFatal('user-mail-no-addy');
}
# Forge email headers
# -------------------
#
# WARNING
#
# DO NOT add To: or Subject: headers at this step. They need to be
# handled differently depending upon the mailer we are going to use.
#
# To:
# PHP mail() first argument is the mail receiver. The argument is
# used as a recipient destination and as a To header.
#
# PEAR mailer has a recipient argument which is only used to
# send the mail. If no To header is given, PEAR will set it to
# to 'undisclosed-recipients:'.
#
# NOTE: To: is for presentation, the actual recipient is specified
# by the mailer using the Rcpt-To: header.
#
# Subject:
# PHP mail() second argument to pass the subject, passing a Subject
# as an additional header will result in a duplicate header.
#
# PEAR mailer should be passed a Subject header.
#
# -- hashar 20120218
$headers['From'] = $from->toString();
$returnPath = $from->address;
$extraParams = $wgAdditionalMailParams;
// Hook to generate custom VERP address for 'Return-Path'
Hooks::run('UserMailerChangeReturnPath', array($to, &$returnPath));
# Add the envelope sender address using the -f command line option when PHP mail() is used.
# Will default to the $from->address when the UserMailerChangeReturnPath hook fails and the
# generated VERP address when the hook runs effectively.
$extraParams .= ' -f ' . $returnPath;
$headers['Return-Path'] = $returnPath;
if ($replyto) {
$headers['Reply-To'] = $replyto->toString();
}
$headers['Date'] = MWTimestamp::getLocalInstance()->format('r');
$headers['Message-ID'] = self::makeMsgId();
$headers['X-Mailer'] = 'MediaWiki mailer';
# Line endings need to be different on Unix and Windows due to
# the bug described at http://trac.wordpress.org/ticket/2603
if (wfIsWindows()) {
$endl = "\r\n";
} else {
$endl = "\n";
}
if (is_array($body)) {
// we are sending a multipart message
wfDebug("Assembling multipart mime email\n");
if (!stream_resolve_include_path('Mail/mime.php')) {
//.........这里部分代码省略.........
示例9: getTimezoneOptions
/**
* @param IContextSource $context
* @return array
*/
static function getTimezoneOptions(IContextSource $context)
{
$opt = array();
$localTZoffset = $context->getConfig()->get('LocalTZoffset');
$timeZoneList = self::getTimeZoneList($context->getLanguage());
$timestamp = MWTimestamp::getLocalInstance();
// Check that the LocalTZoffset is the same as the local time zone offset
if ($localTZoffset == $timestamp->format('Z') / 60) {
$timezoneName = $timestamp->getTimezone()->getName();
// Localize timezone
if (isset($timeZoneList[$timezoneName])) {
$timezoneName = $timeZoneList[$timezoneName]['name'];
}
$server_tz_msg = $context->msg('timezoneuseserverdefault', $timezoneName)->text();
} else {
$tzstring = sprintf('%+03d:%02d', floor($localTZoffset / 60), abs($localTZoffset) % 60);
$server_tz_msg = $context->msg('timezoneuseserverdefault', $tzstring)->text();
}
$opt[$server_tz_msg] = "System|{$localTZoffset}";
$opt[$context->msg('timezoneuseoffset')->text()] = 'other';
$opt[$context->msg('guesstimezone')->text()] = 'guess';
foreach ($timeZoneList as $timeZoneInfo) {
$region = $timeZoneInfo['region'];
if (!isset($opt[$region])) {
$opt[$region] = array();
}
$opt[$region][$timeZoneInfo['name']] = $timeZoneInfo['timecorrection'];
}
return $opt;
}
示例10: sendInternal
/**
* Helper function fo UserMailer::send() which does the actual sending. It expects a $to
* list which the UserMailerSplitTo hook would not split further.
* @param MailAddress[] $to Array of recipients' email addresses
* @param MailAddress $from Sender's email
* @param string $subject Email's subject.
* @param string $body Email's text or Array of two strings to be the text and html bodies
* @param array $options:
* 'replyTo' MailAddress
* 'contentType' string default 'text/plain; charset=UTF-8'
* 'headers' array Extra headers to set
*
* @throws MWException
* @throws Exception
* @return Status
*/
protected static function sendInternal(array $to, MailAddress $from, $subject, $body, $options = array())
{
global $wgSMTP, $wgEnotifMaxRecips, $wgAdditionalMailParams;
$mime = null;
$replyto = isset($options['replyTo']) ? $options['replyTo'] : null;
$contentType = isset($options['contentType']) ? $options['contentType'] : 'text/plain; charset=UTF-8';
$headers = isset($options['headers']) ? $options['headers'] : array();
// Allow transformation of content, such as encrypting/signing
$error = false;
if (!Hooks::run('UserMailerTransformContent', array($to, $from, &$body, &$error))) {
if ($error) {
return Status::newFatal('php-mail-error', $error);
} else {
return Status::newFatal('php-mail-error-unknown');
}
}
/**
* Forge email headers
* -------------------
*
* WARNING
*
* DO NOT add To: or Subject: headers at this step. They need to be
* handled differently depending upon the mailer we are going to use.
*
* To:
* PHP mail() first argument is the mail receiver. The argument is
* used as a recipient destination and as a To header.
*
* PEAR mailer has a recipient argument which is only used to
* send the mail. If no To header is given, PEAR will set it to
* to 'undisclosed-recipients:'.
*
* NOTE: To: is for presentation, the actual recipient is specified
* by the mailer using the Rcpt-To: header.
*
* Subject:
* PHP mail() second argument to pass the subject, passing a Subject
* as an additional header will result in a duplicate header.
*
* PEAR mailer should be passed a Subject header.
*
* -- hashar 20120218
*/
$headers['From'] = $from->toString();
$returnPath = $from->address;
$extraParams = $wgAdditionalMailParams;
// Hook to generate custom VERP address for 'Return-Path'
Hooks::run('UserMailerChangeReturnPath', array($to, &$returnPath));
// Add the envelope sender address using the -f command line option when PHP mail() is used.
// Will default to the $from->address when the UserMailerChangeReturnPath hook fails and the
// generated VERP address when the hook runs effectively.
$extraParams .= ' -f ' . $returnPath;
$headers['Return-Path'] = $returnPath;
if ($replyto) {
$headers['Reply-To'] = $replyto->toString();
}
$headers['Date'] = MWTimestamp::getLocalInstance()->format('r');
$headers['Message-ID'] = self::makeMsgId();
$headers['X-Mailer'] = 'MediaWiki mailer';
$headers['List-Unsubscribe'] = '<' . SpecialPage::getTitleFor('Preferences')->getFullURL('', false, PROTO_CANONICAL) . '>';
// Line endings need to be different on Unix and Windows due to
// the bug described at http://trac.wordpress.org/ticket/2603
if (wfIsWindows()) {
$endl = "\r\n";
} else {
$endl = "\n";
}
if (is_array($body)) {
// we are sending a multipart message
wfDebug("Assembling multipart mime email\n");
if (!stream_resolve_include_path('Mail/mime.php')) {
wfDebug("PEAR Mail_Mime package is not installed. Falling back to text email.\n");
// remove the html body for text email fall back
$body = $body['text'];
} else {
// Check if pear/mail_mime is already loaded (via composer)
if (!class_exists('Mail_mime')) {
require_once 'Mail/mime.php';
}
if (wfIsWindows()) {
$body['text'] = str_replace("\n", "\r\n", $body['text']);
$body['html'] = str_replace("\n", "\r\n", $body['html']);
}
//.........这里部分代码省略.........
示例11: getSignature
public function getSignature($user, $timestamp)
{
global $wgContLang, $wgParser;
// Force unstub
StubObject::unstub($wgParser);
$timestamp = MWTimestamp::getLocalInstance($timestamp);
$ts = $timestamp->format('YmdHis');
$tzMsg = $timestamp->format('T');
# might vary on DST changeover!
# Allow translation of timezones through wiki. format() can return
# whatever crap the system uses, localised or not, so we cannot
# ship premade translations.
$key = 'timezone-' . strtolower(trim($tzMsg));
$msg = wfMessage($key)->inContentLanguage();
if ($msg->exists()) {
$tzMsg = $msg->text();
}
$d = $wgContLang->timeanddate($ts, false, false) . " ({$tzMsg})";
if ($user) {
return $wgParser->getUserSig($user, false, false) . ' ' . $d;
} else {
return "[Unknown user] {$d}";
}
}