本文整理汇总了PHP中dformat函数的典型用法代码示例。如果您正苦于以下问题:PHP dformat函数的具体用法?PHP dformat怎么用?PHP dformat使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了dformat函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: white_pageinfo
function white_pageinfo($ret = false)
{
global $conf;
global $lang;
global $INFO;
global $ID;
// return if we are not allowed to view the page
if (!auth_quickaclcheck($ID)) {
return false;
}
$date = dformat($INFO['lastmod']);
// print it
if ($INFO['exists']) {
$out = '';
$out .= $lang['lastmod'];
$out .= ' ';
$out .= $date;
if ($ret) {
return $out;
} else {
echo $out;
return true;
}
}
return false;
}
示例2: run
/**
* Build a nice email from the submitted data and send it
*/
function run($data, $thanks, $argv)
{
global $ID;
// get recipient address(es)
$to = join(',', $argv);
$sub = sprintf($this->getLang('mailsubject'), $ID);
$txt = sprintf($this->getLang('mailintro') . "\n\n\n", dformat());
foreach ($data as $opt) {
$value = $opt->getParam('value');
$label = $opt->getParam('label');
switch ($opt->getFieldType()) {
case 'fieldset':
$txt .= "\n====== " . hsc($label) . " ======\n\n";
break;
default:
if ($value === null || $label === null) {
break;
}
$txt .= $label . "\n";
$txt .= "\t\t{$value}\n";
}
}
global $conf;
if (!mail_send($to, $sub, $txt, $conf['mailfrom'])) {
throw new Exception($this->getLang('e_mail'));
}
return $thanks;
}
示例3: mkpostid
/**
* Return a page id based on the given format and title.
*
* @param $format string the format of the id to generate
* @param $title string the title of the page to create
* @return string a page id
*/
public static function mkpostid($format, $title)
{
global $conf;
$replace = array('%{title}' => str_replace(':', $conf['sepchar'], $title), '%{user}' => $_SERVER['REMOTE_USER']);
$out = $format;
$out = str_replace(array_keys($replace), array_values($replace), $out);
$out = dformat(null, $out);
return cleanID($out);
}
示例4: run
/**
* Build a nice email from the submitted data and send it
*
* @param helper_plugin_bureaucracy_field[] $fields
* @param string $thanks
* @param array $argv
* @return string thanks message
* @throws Exception mailing failed
*/
public function run($fields, $thanks, $argv)
{
global $ID;
global $conf;
$mail = new Mailer();
$this->prepareNamespacetemplateReplacements();
$this->prepareDateTimereplacements();
$this->prepareLanguagePlaceholder();
$this->prepareNoincludeReplacement();
$this->prepareFieldReplacements($fields);
//set default subject
$this->subject = sprintf($this->getLang('mailsubject'), $ID);
//build html&text table, collect replyto and subject
list($table_html, $table_text) = $this->processFieldsBuildTable($fields, $mail);
//Body
if ($this->mailtemplate) {
//show template
$this->patterns['__tablehtml__'] = '/@TABLEHTML@/';
$this->patterns['__tabletext__'] = '/@TABLETEXT@/';
$this->values['__tablehtml__'] = $table_html;
$this->values['__tabletext__'] = $table_text;
list($this->_mail_html, $this->_mail_text) = $this->getContent();
} else {
//show simpel listing
$this->_mail_html .= sprintf($this->getLang('mailintro') . "<br><br>", dformat());
$this->_mail_html .= $table_html;
$this->_mail_text .= sprintf($this->getLang('mailintro') . "\n\n", dformat());
$this->_mail_text .= $table_text;
}
$mail->setBody($this->_mail_text, null, null, $this->_mail_html);
// Reply-to
if (!empty($this->replyto)) {
$replyto = $mail->cleanAddress($this->replyto);
$mail->setHeader('Reply-To', $replyto, false);
}
// To
$to = $this->replace(implode(',', $argv));
// get recipient address(es)
$to = $mail->cleanAddress($to);
$mail->to($to);
// From
if (empty($this->from)) {
$this->from = $conf['mailfrom'];
}
$this->from = $this->replace($this->from);
$mail->from($this->from);
// Subject
$this->subject = $this->replace($this->subject);
$mail->subject($this->subject);
if (!$mail->send()) {
throw new Exception($this->getLang('e_mail'));
}
return $thanks;
}
示例5: toolbar_signature
/**
* prepares the signature string as configured in the config
*
* @author Andreas Gohr <andi@splitbrain.org>
*/
function toolbar_signature()
{
global $conf;
global $INFO;
$sig = $conf['signature'];
$sig = strftime($sig);
$sig = str_replace('@USER@', $_SERVER['REMOTE_USER'], $sig);
$sig = str_replace('@NAME@', $INFO['userinfo']['name'], $sig);
$sig = str_replace('@MAIL@', $INFO['userinfo']['mail'], $sig);
$sig = str_replace('@DATE@', dformat(), $sig);
$sig = str_replace('\\\\n', '\\n', addslashes($sig));
return $sig;
}
示例6: send_change_mail
/**
* send an email to inform about a changed page
*
* @param $event
* @param $param
* @return bool false if the receiver is invalid or there was an error passing the mail to the MTA
*/
function send_change_mail(&$event, $param)
{
global $ID;
global $ACT;
global $INFO;
global $conf;
$data = pageinfo();
if ($ACT != 'save') {
return true;
}
// IO_WIKIPAGE_WRITE is always called twice when saving a page. This makes sure to only send the mail once.
if (!$event->data[3]) {
return true;
}
// Does the publish plugin apply to this page?
if (!$this->hlp->isActive($ID)) {
return true;
}
//are we supposed to send change-mails at all?
if ($this->getConf('apr_mail_receiver') === '') {
return true;
}
// get mail receiver
$receiver = $this->getConf('apr_mail_receiver');
$validator = new EmailAddressValidator();
$validator->allowLocalAddresses = true;
if (!$validator->check_email_address($receiver)) {
dbglog(sprintf($this->getLang('mail_invalid'), htmlspecialchars($receiver)));
return false;
}
// get mail sender
$ReplyTo = $data['userinfo']['mail'];
if ($ReplyTo == $receiver) {
return true;
}
if ($INFO['isadmin'] == '1') {
return true;
}
// get mail subject
$timestamp = dformat($data['lastmod'], $conf['dformat']);
$subject = $this->getLang('apr_mail_subject') . ': ' . $ID . ' - ' . $timestamp;
$body = $this->create_mail_body('change');
$mail = new Mailer();
$mail->to($receiver);
$mail->subject($subject);
$mail->setBody($body);
$mail->setHeader("Reply-To", $ReplyTo);
$returnStatus = $mail->send();
return $returnStatus;
}
示例7: toolbar_signature
/**
* prepares the signature string as configured in the config
*
* @author Andreas Gohr <andi@splitbrain.org>
*/
function toolbar_signature()
{
global $conf;
global $INFO;
/** @var Input $INPUT */
global $INPUT;
$sig = $conf['signature'];
$sig = dformat(null, $sig);
$sig = str_replace('@USER@', $INPUT->server->str('REMOTE_USER'), $sig);
$sig = str_replace('@NAME@', $INFO['userinfo']['name'], $sig);
$sig = str_replace('@MAIL@', $INFO['userinfo']['mail'], $sig);
$sig = str_replace('@DATE@', dformat(), $sig);
$sig = str_replace('\\\\n', '\\n', addslashes($sig));
return $sig;
}
示例8: run
/**
* Build a nice email from the submitted data and send it
*/
function run($fields, $thanks, $argv)
{
global $ID;
$this->prepareLanguagePlaceholder();
// get recipient address(es)
$to = join(',', $argv);
$replyto = array();
$headers = null;
$subject = sprintf($this->getLang('mailsubject'), $ID);
$txt = sprintf($this->getLang('mailintro') . "\n\n\n", dformat());
foreach ($fields as $opt) {
/** @var syntax_plugin_bureaucracy_field $opt */
$value = $opt->getParam('value');
$label = $opt->getParam('label');
switch ($opt->getFieldType()) {
case 'fieldset':
$txt .= "\n====== " . hsc($label) . " ======\n\n";
break;
case 'subject':
$subject = $label;
break;
case 'email':
if (!is_null($opt->getParam('replyto'))) {
$replyto[] = $value;
}
/** fall through */
/** fall through */
default:
if ($value === null || $label === null) {
break;
}
$txt .= $label . "\n";
$txt .= "\t\t{$value}\n";
}
$this->prepareFieldReplacements($label, $value);
}
$subject = $this->replaceDefault($subject);
if (!empty($replyto)) {
$headers = mail_encode_address(join(',', $replyto), 'Reply-To');
}
global $conf;
if (!mail_send($to, $subject, $txt, $conf['mailfrom'], '', '', $headers)) {
throw new Exception($this->getLang('e_mail'));
}
return $thanks;
}
示例9: bootstrap3_pageinfo
/**
* Print some info about the current page
*
* @author Andreas Gohr <andi@splitbrain.org>
* @author Giuseppe Di Terlizzi <giuseppe.diterlizzi@gmail.com>
*
* @param bool $ret return content instead of printing it
* @return bool|string
*/
function bootstrap3_pageinfo($ret = false)
{
global $conf;
global $lang;
global $INFO;
global $ID;
// return if we are not allowed to view the page
if (!auth_quickaclcheck($ID)) {
return false;
}
// prepare date and path
$fn = $INFO['filepath'];
if (!$conf['fullpath']) {
if ($INFO['rev']) {
$fn = str_replace(fullpath($conf['olddir']) . '/', '', $fn);
} else {
$fn = str_replace(fullpath($conf['datadir']) . '/', '', $fn);
}
}
$date_format = bootstrap3_conf('pageInfoDateFormat');
$page_info = bootstrap3_conf('pageInfo');
$fn = utf8_decodeFN($fn);
$date = $date_format == 'dformat' ? dformat($INFO['lastmod']) : datetime_h($INFO['lastmod']);
// print it
if ($INFO['exists']) {
$fn_full = $fn;
if (!in_array('extension', $page_info)) {
$fn = str_replace(array('.txt.gz', '.txt'), '', $fn);
}
$out = '<ul class="list-inline">';
if (in_array('filename', $page_info)) {
$out .= sprintf('<li><i class="fa fa-fw fa-file-text-o text-muted"></i> <span title="%s">%s</span></li>', $fn_full, $fn);
}
if (in_array('date', $page_info)) {
$out .= sprintf('<li><i class="fa fa-fw fa-calendar text-muted"></i> %s <span title="%s">%s</span></li>', $lang['lastmod'], dformat($INFO['lastmod']), $date);
}
if (in_array('editor', $page_info)) {
if (isset($INFO['editor'])) {
$user = editorinfo($INFO['editor']);
if (bootstrap3_conf('useGravatar')) {
global $auth;
$user_data = $auth->getUserData($INFO['editor']);
$HTTP = new DokuHTTPClient();
$gravatar_img = get_gravatar($user_data['mail'], 16);
$gravatar_check = $HTTP->get($gravatar_img . '&d=404');
if ($gravatar_check) {
$user_img = sprintf('<img src="%s" alt="" width="16" class="img-rounded" /> ', $gravatar_img);
$user = str_replace(array('iw_user', 'interwiki'), '', $user);
$user = $user_img . $user;
}
}
$out .= sprintf('<li class="text-muted">%s %s</li>', $lang['by'], $user);
} else {
$out .= sprintf('<li>(%s)</li>', $lang['external_edit']);
}
}
if ($INFO['locked'] && in_array('locked', $page_info)) {
$out .= sprintf('<li><i class="fa fa-fw fa-lock text-muted"></i> %s %s</li>', $lang['lockedby'], editorinfo($INFO['locked']));
}
$out .= '</ul>';
if ($ret) {
return $out;
} else {
echo $out;
return true;
}
}
return false;
}
示例10: prepareTokenReplacements
/**
* Prepare default token replacement strings
*
* Populates the '$replacements' property.
* Should be called by the class constructor
*/
protected function prepareTokenReplacements()
{
global $INFO;
global $conf;
/* @var Input $INPUT */
global $INPUT;
global $lang;
$ip = clientIP();
$cip = gethostsbyaddrs($ip);
$this->replacements['text'] = array('DATE' => dformat(), 'BROWSER' => $INPUT->server->str('HTTP_USER_AGENT'), 'IPADDRESS' => $ip, 'HOSTNAME' => $cip, 'TITLE' => $conf['title'], 'DOKUWIKIURL' => DOKU_URL, 'USER' => $INPUT->server->str('REMOTE_USER'), 'NAME' => $INFO['userinfo']['name'], 'MAIL' => $INFO['userinfo']['mail']);
$signature = str_replace('@DOKUWIKIURL@', $this->replacements['text']['DOKUWIKIURL'], $lang['email_signature_text']);
$this->replacements['text']['EMAILSIGNATURE'] = "\n-- \n" . $signature . "\n";
$this->replacements['html'] = array('DATE' => '<i>' . hsc(dformat()) . '</i>', 'BROWSER' => hsc($INPUT->server->str('HTTP_USER_AGENT')), 'IPADDRESS' => '<code>' . hsc($ip) . '</code>', 'HOSTNAME' => '<code>' . hsc($cip) . '</code>', 'TITLE' => hsc($conf['title']), 'DOKUWIKIURL' => '<a href="' . DOKU_URL . '">' . DOKU_URL . '</a>', 'USER' => hsc($INPUT->server->str('REMOTE_USER')), 'NAME' => hsc($INFO['userinfo']['name']), 'MAIL' => '<a href="mailto:"' . hsc($INFO['userinfo']['mail']) . '">' . hsc($INFO['userinfo']['mail']) . '</a>');
$signature = $lang['email_signature_text'];
if (!empty($lang['email_signature_html'])) {
$signature = $lang['email_signature_html'];
}
$signature = str_replace(array('@DOKUWIKIURL@', "\n"), array($this->replacements['html']['DOKUWIKIURL'], '<br />'), $signature);
$this->replacements['html']['EMAILSIGNATURE'] = $signature;
}
示例11: dayheader
/**
* Render the day header
*
* @param Doku_Renderer $R
* @param int $date
*/
protected function dayheader(&$R, $date)
{
if ($R->getFormat() == 'xhtml') {
/* @var Doku_Renderer_xhtml $R */
$R->doc .= '<h3 class="changes">';
$R->cdata(dformat($date, $this->getConf('dayheaderfmt')));
$R->doc .= '</h3>';
} else {
$R->header(dformat($date, $this->getConf('dayheaderfmt')), 3, 0);
}
}
示例12: _tpl_pageinfo
function _tpl_pageinfo()
{
global $conf;
global $lang;
global $INFO;
global $ID;
// return if we are not allowed to view the page
if (!auth_quickaclcheck($ID)) {
return;
}
// prepare date and path
$date = dformat($INFO['lastmod']);
// echo it
if ($INFO['exists']) {
echo $lang['lastmod'], ': ', $date;
if ($_SERVER['REMOTE_USER']) {
if ($INFO['editor']) {
echo ' ', $lang['by'], ' ', $INFO['editor'];
} else {
echo ' (', $lang['external_edit'], ')';
}
if ($INFO['locked']) {
echo ' · ', $lang['lockedby'], ': ', $INFO['locked'];
}
}
return true;
}
return false;
}
示例13: tpl_pagelink
?>
</p>
<p>← <?php
echo $lang['img_backto'];
?>
<?php
tpl_pagelink($ID);
?>
</p>
<dl class="img_tags">
<?php
$t = tpl_img_getTag('Date.EarliestTime');
if ($t) {
print '<dt>' . $lang['img_date'] . ':</dt><dd>' . dformat($t) . '</dd>';
}
$t = tpl_img_getTag('File.Name');
if ($t) {
print '<dt>' . $lang['img_fname'] . ':</dt><dd>' . hsc($t) . '</dd>';
}
$t = tpl_img_getTag(array('Iptc.Byline', 'Exif.TIFFArtist', 'Exif.Artist', 'Iptc.Credit'));
if ($t) {
print '<dt>' . $lang['img_artist'] . ':</dt><dd>' . hsc($t) . '</dd>';
}
$t = tpl_img_getTag(array('Iptc.CopyrightNotice', 'Exif.TIFFCopyright', 'Exif.Copyright'));
if ($t) {
print '<dt>' . $lang['img_copyr'] . ':</dt><dd>' . hsc($t) . '</dd>';
}
$t = tpl_img_getTag('File.Format');
if ($t) {
示例14: _dateCell
/**
* Date - creation or last modification date if not set otherwise
*/
function _dateCell() {
global $conf;
if($this->column['date'] == 2) {
$this->page['date'] = $this->_getMeta(array('date', 'modified'));
} elseif(!$this->page['date'] && $this->page['exists']) {
$this->page['date'] = $this->_getMeta(array('date', 'created'));
}
if ((!$this->page['date']) || (!$this->page['exists'])) {
return $this->_printCell('date', '');
} else {
return $this->_printCell('date', dformat($this->page['date'], $conf['dformat']));
}
}
示例15: ajax_lock
/**
* Refresh a page lock and save draft
*
* Andreas Gohr <andi@splitbrain.org>
*/
function ajax_lock()
{
global $conf;
global $lang;
global $ID;
global $INFO;
global $INPUT;
$ID = cleanID($INPUT->post->str('id'));
if (empty($ID)) {
return;
}
$INFO = pageinfo();
if (!$INFO['writable']) {
echo 'Permission denied';
return;
}
if (!checklock($ID)) {
lock($ID);
echo 1;
}
if ($conf['usedraft'] && $INPUT->post->str('wikitext')) {
$client = $_SERVER['REMOTE_USER'];
if (!$client) {
$client = clientIP(true);
}
$draft = array('id' => $ID, 'prefix' => substr($INPUT->post->str('prefix'), 0, -1), 'text' => $INPUT->post->str('wikitext'), 'suffix' => $INPUT->post->str('suffix'), 'date' => $INPUT->post->int('date'), 'client' => $client);
$cname = getCacheName($draft['client'] . $ID, '.draft');
if (io_saveFile($cname, serialize($draft))) {
echo $lang['draftdate'] . ' ' . dformat();
}
}
}