本文整理汇总了PHP中datetime_h函数的典型用法代码示例。如果您正苦于以下问题:PHP datetime_h函数的具体用法?PHP datetime_h怎么用?PHP datetime_h使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了datetime_h函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: dformat
/**
* Wraps around strftime but provides support for fuzzy dates
*
* The format default to $conf['dformat']. It is passed to
* strftime - %f can be used to get the value from datetime_h()
*
* @see datetime_h
* @author Andreas Gohr <gohr@cosmocode.de>
*/
function dformat($dt = null, $format = '')
{
global $conf;
if (is_null($dt)) {
$dt = time();
}
$dt = (int) $dt;
if (!$format) {
$format = $conf['dformat'];
}
$format = str_replace('%f', datetime_h($dt), $format);
return strftime($format, $dt);
}
示例2: html
/**
* Output HTML form
*/
function html()
{
global $INPUT;
if (!$INPUT->has('data')) {
echo $this->locale_xhtml('intro');
//If there was an error the last time we tried to autosubmit, warn the user
if ($this->helper->isAutoSubmitEnabled()) {
if (file_exists($this->helper->autosubmitErrorFile)) {
echo $this->getLang('autosubmitError');
echo io_readFile($this->helper->autosubmitErrorFile);
}
}
flush();
echo $this->buildForm('server');
//Print the last time the data was sent
$lastSent = $this->helper->lastSentTime();
if ($lastSent !== 0) {
echo $this->getLang('lastSent') . ' ' . datetime_h($lastSent);
}
} else {
//If we just submitted the form
if ($this->sentStatus === '') {
//If we successfully sent the data
echo $this->locale_xhtml('submitted');
} else {
//If we failed to submit the data, try directly with the browser
echo $this->getLang('submissionFailed') . $this->sentStatus . '<br />';
echo $this->getLang('submitDirectly');
echo $this->buildForm('browser', $INPUT->str('data'));
}
}
}
示例3: 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;
}