本文整理汇总了PHP中locale_datefmt函数的典型用法代码示例。如果您正苦于以下问题:PHP locale_datefmt函数的具体用法?PHP locale_datefmt怎么用?PHP locale_datefmt使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了locale_datefmt函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: foreach
}
// Initialize GeoIP plugin
$geoip_Plugin =& $Plugins->get_by_code('evo_GeoIP');
foreach ($login_attempts as $attempt) {
$attempt = explode('|', $attempt);
$attempt_ip = $attempt[1];
$plugin_country_by_IP = '';
if (!empty($geoip_Plugin) && ($Country =& $geoip_Plugin->get_country_by_IP($attempt_ip))) {
// Get country by IP if plugin is enabled
$plugin_country_by_IP = ' (' . $Country->get_name() . ')';
}
if ($attempt_ip != $current_ip) {
// Get DNS by IP if current IP is different from attempt IP
$attempt_ip .= ' ' . gethostbyaddr($attempt_ip);
}
$Messages->add(sprintf(T_('Someone tried to log in to your account with a wrong password on %s from %s%s'), date(locale_datefmt() . ' ' . locale_timefmt(), $attempt[0]), $attempt_ip, $plugin_country_by_IP), 'error');
}
// Clear the attempts list
$UserSettings->delete('login_attempts', $current_User->ID);
$UserSettings->dbupdate();
}
} elseif (empty($login_error)) {
// if the login_error wasn't set yet, add the default one:
// This will cause the login screen to "popup" (again)
$login_error = T_('Wrong login/password.');
if (isset($login_attempts)) {
// Save new login attempt into DB
if (count($login_attempts) == 9) {
// Unset first attempt to clear a space for new attempt
unset($login_attempts[0]);
}
示例2: die
die('Please, do not access this page directly.');
}
global $blog, $admin_url, $UserSettings;
global $datestartinput, $datestart, $datestopinput, $datestop, $email;
if (param_date('datestartinput', T_('Invalid date'), false, NULL) !== NULL) {
// We have a user provided localized date:
memorize_param('datestart', 'string', NULL, trim(form_date($datestartinput)));
memorize_param('datestartinput', 'string', NULL, empty($datestartinput) ? NULL : date(locale_datefmt(), strtotime($datestartinput)));
} else {
// We may have an automated param transmission date:
param('datestart', 'string', '', true);
}
if (param_date('datestopinput', T_('Invalid date'), false, NULL) !== NULL) {
// We have a user provided localized date:
memorize_param('datestop', 'string', NULL, trim(form_date($datestopinput)));
memorize_param('datestopinput', 'string', NULL, empty($datestopinput) ? NULL : date(locale_datefmt(), strtotime($datestopinput)));
} else {
// We may have an automated param transmission date:
param('datestop', 'string', '', true);
}
param('email', 'string', '', true);
// Create result set:
$SQL = new SQL();
$SQL->SELECT('SQL_NO_CACHE emlog_ID, emlog_timestamp, emlog_user_ID, emlog_to, emlog_result, emlog_subject');
$SQL->FROM('T_email__log');
$count_SQL = new SQL();
$count_SQL->SELECT('SQL_NO_CACHE COUNT(emlog_ID)');
$count_SQL->FROM('T_email__log');
if (!empty($datestart)) {
// Filter by start date
$SQL->WHERE_and('emlog_timestamp >= ' . $DB->quote($datestart . ' 00:00:00'));
示例3: get_mod_date
/**
* Get last mod date (datetime) of Item
*
* @param string date/time format: leave empty to use locale default date format
* @param boolean true if you want GMT
*/
function get_mod_date($format = '', $useGM = false)
{
if (empty($format)) {
return mysql2date(locale_datefmt(), $this->datemodified, $useGM);
}
return mysql2date($format, $this->datemodified, $useGM);
}
示例4: mysql2localedatetime_spans
function mysql2localedatetime_spans($mysqlstring, $datefmt = NULL, $timefmt = NULL)
{
if (is_null($datefmt)) {
$datefmt = locale_datefmt();
}
if (is_null($timefmt)) {
$timefmt = locale_timefmt();
}
return '<span class="date">' . mysql2date($datefmt, $mysqlstring) . '</span> <span class="time">' . mysql2date($timefmt, $mysqlstring) . '</span>';
}
示例5: date
/**
* Template function: display date (datetime) of comment
*
* @param string date/time format: leave empty to use locale default date format
* @param boolean true if you want GMT
*/
function date($format = '', $useGM = false)
{
if (empty($format)) {
echo mysql2date(locale_datefmt(), $this->date, $useGM);
} else {
echo mysql2date($format, $this->date, $useGM);
}
}
示例6: debug_die
default:
debug_die('unhandled action 1:' . htmlspecialchars($action));
}
$AdminUI->breadcrumbpath_init();
$AdminUI->breadcrumbpath_add(T_('Contents'), '?ctrl=items&blog=$blog$&tab=full&filter=restore');
/**
* Perform action:
*/
switch ($action) {
case 'nil':
// Do nothing
break;
case 'new':
case 'new_mass':
// $set_issue_date = 'now';
$item_issue_date = date_i18n(locale_datefmt(), $localtimenow);
$item_issue_time = date('H:i:s', $localtimenow);
// pre_dump( $item_issue_date, $item_issue_time );
// pre_dump( $item_issue_date, $item_issue_time );
case 'new_switchtab':
// this gets set as action by JS, when we switch tabs
// New post form (can be a bookmarklet form if mode == bookmarklet )
// We don't check the following earlier, because we want the blog switching buttons to be available:
if (!blog_has_cats($blog)) {
break;
}
load_class('items/model/_item.class.php', 'Item');
$edited_Item = new Item();
$edited_Item->set('main_cat_ID', $Blog->get_default_cat_ID());
// We use the request variables to fill the edit form, because we need to be able to pass those values
// from tab to tab via javascript when the editor wants to switch views...
示例7: array
/*
* Chart
*/
if (count($res_hits)) {
$last_date = 0;
$chart['chart_data'][0] = array();
$chart['chart_data'][1] = array();
$count = 0;
foreach ($res_hits as $row_stats) {
$this_date = mktime(0, 0, 0, $row_stats['month'], $row_stats['day'], $row_stats['year']);
if ($last_date != $this_date) {
// We just hit a new day, let's display the previous one:
$last_date = $this_date;
// that'll be the next one
$count++;
array_unshift($chart['chart_data'][0], date(locale_datefmt(), $last_date));
array_unshift($chart['chart_data'][1], 0);
}
$chart['chart_data'][1][0] = $row_stats['hits'];
}
array_unshift($chart['chart_data'][0], '');
array_unshift($chart['chart_data'][1], 'XML (RSS/Atom) hits');
// Translations need to be UTF-8
// Include common chart properties:
require dirname(__FILE__) . '/inc/_bar_chart.inc.php';
$chart['series_color'] = array($agent_type_color['rss']);
echo '<div class="center">';
load_funcs('_ext/_swfcharts.php');
DrawChart($chart);
echo '</div>';
}
示例8: SkinTag
//.........这里部分代码省略.........
$params['link_type'] = 'canonic';
}
if (!isset($params['context_isolation'])) {
$params['context_isolation'] = 'm,w,p,title,unit,dstart';
}
// Add form fields?:
if (!isset($params['form'])) {
$params['form'] = false;
}
// Number of archive entries to display:
if (!isset($params['limit'])) {
$params['limit'] = 12;
}
// More link text:
if (!isset($params['more_link'])) {
$params['more_link'] = T_('More...');
}
// This is what will enclose the list:
if (!isset($params['list_start'])) {
$params['list_start'] = '<ul>';
}
if (!isset($params['list_end'])) {
$params['list_end'] = "</ul>\n";
}
// This is what will separate the archive links:
if (!isset($params['line_start'])) {
$params['line_start'] = '<li>';
}
if (!isset($params['line_end'])) {
$params['line_end'] = "</li>\n";
}
// Daily archive date format?
if (!isset($params['day_date_format']) || $params['day_date_format'] == '') {
$dateformat = locale_datefmt();
$params['day_date_format'] = $dateformat;
}
$ArchiveList =& new ArchiveList($params['mode'], $params['limit'], $params['sort_order'], $params['link_type'] == 'context', $this->dbtable, $this->dbprefix, $this->dbIDname);
echo $params['block_start'];
if (!empty($params['title'])) {
// We want to display a title for the widget block:
echo $params['block_title_start'];
echo $params['title'];
echo $params['block_title_end'];
}
echo $params['list_start'];
while ($ArchiveList->get_item($arc_year, $arc_month, $arc_dayofmonth, $arc_w, $arc_count, $post_ID, $post_title)) {
echo $params['line_start'];
switch ($params['mode']) {
case 'monthly':
// --------------------------------- MONTHLY ARCHIVES -------------------------------------
$arc_m = $arc_year . zeroise($arc_month, 2);
if ($params['form']) {
// We want a radio button:
echo '<input type="radio" name="m" value="' . $arc_m . '" class="checkbox"';
if ($m == $arc_m) {
echo ' checked="checked"';
}
echo ' /> ';
}
$text = T_($month[zeroise($arc_month, 2)]) . ' ' . $arc_year;
if ($params['link_type'] == 'context') {
// We want to preserve current browsing context:
echo '<a rel="nofollow" href="' . regenerate_url($params['context_isolation'], 'm=' . $arc_m) . '">' . $text . '</a>';
} else {
// We want to link to the absolute canonical URL for this archive:
echo $Blog->gen_archive_link($text, T_('View monthly archive'), $arc_year, $arc_month);
示例9: param_check_date
/**
* Check if param is an ISO date.
*
* NOTE: for tokens like e.g. "D" (abbr. weekday), T_() gets used and it uses the current locale!
*
* @param string param name
* @param string error message
* @param boolean Is a non-empty date required?
* @param string date format (php format)
* @return boolean|string false if not OK, ISO date if OK
*/
function param_check_date($var, $err_msg, $required = false, $date_format = NULL)
{
if (empty($GLOBALS[$var])) {
// empty is OK if not required:
if ($required) {
param_error($var, $err_msg);
return false;
}
return '';
}
if (empty($date_format)) {
// Use locale date format:
$date_format = locale_datefmt();
}
// Convert PHP date format to regexp pattern:
$date_regexp = '~' . preg_replace_callback('~(\\\\)?(\\w)~', create_function('$m', '
if( $m[1] == "\\\\" ) return $m[2]; // escaped
switch( $m[2] )
{
case "d": return "([0-3]\\d)"; // day, 01-31
case "j": return "([1-3]?\\d)"; // day, 1-31
case "l": return "(".str_replace("~", "\\~", implode("|", array_map("trim", array_map("T_", $GLOBALS["weekday"])))).")";
case "D": return "(".str_replace("~", "\\~", implode("|", array_map("trim", array_map("T_", $GLOBALS["weekday_abbrev"])))).")";
case "e": // b2evo extension!
return "(".str_replace("~", "\\~", implode("|", array_map("trim", array_map("T_", $GLOBALS["weekday_letter"])))).")";
case "S": return "(st|nd|rd|th)"; // english suffix for day
case "m": return "([0-1]\\d)"; // month, 01-12
case "n": return "(1?\\d)"; // month, 1-12
case "F": return "(".str_replace("~", "\\~", implode("|", array_map("trim", array_map("T_", $GLOBALS["month"])))).")"; // A full textual representation of a month, such as January or March
case "M": return "(".str_replace("~", "\\~", implode("|", array_map("trim", array_map("T_", $GLOBALS["month_abbrev"])))).")";
case "y": return "(\\d\\d)"; // year, 00-99
case "Y": return "(\\d{4})"; // year, XXXX
default:
return $m[0];
}'), $date_format) . '~i';
// case-insensitive?
// Allow additional spaces, e.g. "03 May 2007" when format is "d F Y":
$date_regexp = preg_replace('~ +~', '\\s+', $date_regexp);
// echo $date_format.'...'.$date_regexp;
// Check that the numbers match the date pattern:
if (preg_match($date_regexp, $GLOBALS[$var], $numbers)) {
// Date does match pattern:
//pre_dump( $numbers );
// Get all date pattern parts. We should get 3 parts!:
preg_match_all('/(?<!\\\\)[A-Za-z]/', $date_format, $parts);
// "(?<!\\\\)" means that the letter is not escaped with "\"
//pre_dump( $parts );
foreach ($parts[0] as $position => $part) {
switch ($part) {
case 'd':
case 'j':
$day = $numbers[$position + 1];
break;
case 'm':
case 'n':
$month = $numbers[$position + 1];
break;
case 'F':
// full month name
$month = array_search(strtolower($numbers[$position + 1]), array_map('strtolower', array_map('trim', array_map('T_', $GLOBALS['month']))));
break;
case 'M':
$month = array_search(strtolower($numbers[$position + 1]), array_map('strtolower', array_map('trim', array_map('T_', $GLOBALS['month_abbrev']))));
break;
case 'y':
case 'Y':
$year = $numbers[$position + 1];
if ($year < 50) {
$year = 2000 + $year;
} elseif ($year < 100) {
$year = 1900 + $year;
}
break;
}
}
if (checkdate($month, $day, $year)) {
// all clean! :)
// We convert the value to ISO:
$iso_date = substr('0' . $year, -4) . '-' . substr('0' . $month, -2) . '-' . substr('0' . $day, -2);
return $iso_date;
}
}
// Date did not pass all tests:
param_error($var, $err_msg);
return false;
}
示例10: author
/**
* Create author cell for message list table
*
* @param integer user ID
* @param string login
* @param string first name
* @param string last name
* @param integer avatar ID
* @param string datetime
*/
function author($user_ID, $datetime)
{
$author = get_user_avatar_styled($user_ID, array('size' => 'crop-top-80x80'));
return $author . '<div class="note black">' . mysql2date(locale_datefmt() . '<\\b\\r />' . str_replace(':s', '', locale_timefmt()), $datetime) . '</div>';
}
示例11: mktime
}
$hits['session']++;
$hits_total['session']++;
}
if ($last_date != 0) {
// We had a day pending:
$this_date = mktime(0, 0, 0, $row_stats['month'], $row_stats['day'], $row_stats['year']);
$link_text = $admin_url . '?ctrl=stats&tab=hits&datestartinput=' . urlencode(date(locale_datefmt(), $last_date)) . '&datestopinput=' . urlencode(date(locale_datefmt(), $last_date)) . '&blog=' . $blog . '&agent_type=browser';
$link_text_total_day = $admin_url . '?ctrl=stats&tab=hits&datestartinput=' . urlencode(date(locale_datefmt(), $last_date)) . '&datestopinput=' . urlencode(date(locale_datefmt(), $last_date)) . '&blog=' . $blog . '&agent_type=browser';
?>
<tr class="<?php
echo $count % 2 == 1 ? 'odd' : 'even';
?>
">
<td class="firstcol right"><?php
echo date('D ' . locale_datefmt(), $this_date);
if ($current_User->check_perm('stats', 'edit')) {
echo action_icon(T_('Prune hits for this date!'), 'delete', url_add_param($admin_url, 'ctrl=stats&action=prune&date=' . $last_date . '&show=summary&blog=' . $blog . '&' . url_crumb('stats')));
}
?>
</td>
<td class="right"><?php
echo $hits['session'];
?>
</td>
<td class="right"><a href="<?php
echo $link_text . '&referer_type=search';
?>
"><?php
echo $hits['search'];
?>
示例12: param
// Required!
Hitlist::change_type($hit_ID, $new_hit_type);
$Messages->add(sprintf(T_('Changed hit #%d type to: %s.'), $hit_ID, $new_hit_type), 'success');
break;
case 'prune':
// PRUNE hits for a certain date
// Check that this action request is not a CSRF hacked request:
$Session->assert_received_crumb('stats');
// Check permission:
$current_User->check_perm('stats', 'edit', true);
param('date', 'integer', true);
// Required!
if ($r = Hitlist::prune($date)) {
$Messages->add(sprintf(T_('Deleted %d hits for %s.'), $r, date(locale_datefmt(), $date)), 'success');
} else {
$Messages->add(sprintf(T_('No hits deleted for %s.'), date(locale_datefmt(), $date)), 'note');
}
// Redirect so that a reload doesn't write to the DB twice:
header_redirect('?ctrl=stats', 303);
// Will EXIT
// We have EXITed already at this point!!
break;
case 'reset_counters':
$current_User->check_perm('stats', 'edit', true);
$sql = 'UPDATE T_track__keyphrase
SET keyp_count_refered_searches = 0,
keyp_count_internal_searches = 0';
$DB->query($sql, ' Reset keyphrases counters');
break;
}
}
示例13: get_last_touched_date
/**
* Get last touched date (datetime) of Chapter
*
* @param string date/time format: leave empty to use locale default date format
* @param boolean true if you want GMT
*/
function get_last_touched_date($format = '', $useGM = false)
{
if (empty($format)) {
return mysql2date(locale_datefmt(), $this->last_touched_ts, $useGM);
}
return mysql2date($format, $this->last_touched_ts, $useGM);
}
示例14: T_
}
echo '</div>';
}
$facilitate_exploits = '<p>' . T_('When enabled, this feature is known to facilitate hacking exploits in any PHP application.') . "</p>\n<p>" . T_('b2evolution includes additional measures in order not to be affected by this.
However, for maximum security, we still recommend disabling this PHP feature.') . "</p>\n";
$change_ini = '<p>' . T_('If possible, change this setting to <code>%s</code> in your php.ini or ask your hosting provider about it.') . '</p>';
echo '<h2>' . T_('About this system') . '</h2>';
$block_item_Widget =& new Widget('block_item');
/**
* b2evolution
*/
$block_item_Widget->title = 'b2evolution';
$block_item_Widget->disp_template_replaced('block_start');
// Version:
$app_timestamp = mysql2timestamp($app_date);
init_system_check('b2evolution version', $app_version . ' released on ' . date_i18n(locale_datefmt(), $app_timestamp));
$app_age = ($localtimenow - $app_timestamp) / 3600 / 24 / 30;
// approx age in months
if ($app_age > 12) {
disp_system_check('error', sprintf(T_('This version is old. You should check for newer releases on <a %s>b2evolution.net</a>.'), ' href="http://b2evolution.net/downloads/"'));
} elseif ($app_age > 6) {
disp_system_check('warning', sprintf(T_('This version is aging. You may want to check for newer releases on <a %s>b2evolution.net</a>.'), ' href="http://b2evolution.net/downloads/"'));
} else {
disp_system_check('ok');
}
// Media folder writable?
list($mediadir_status, $mediadir_msg) = system_check_media_dir();
$mediadir_long = '';
if ($mediadir_status == 'error') {
$mediadir_long = '<p>' . T_('You will not be able to upload files/images and b2evolution will not be able to generate thumbnails.') . "</p>\n" . '<p>' . T_('Your host requires that you set special file permissions on your media directory.') . get_manual_link('media_file_permission_errors') . "</p>\n";
}
示例15: date
/**
* Template function: display date (datetime) of comment
*
* @param string date/time format: leave empty to use locale default date format
* @param boolean true if you want GMT
*/
function date($format = '', $useGM = false)
{
if (empty($format)) {
// Get the current locale's default date format
$format = locale_datefmt();
}
echo mysql2date($format, $this->date, $useGM);
}