本文整理汇总了PHP中date_i18n函数的典型用法代码示例。如果您正苦于以下问题:PHP date_i18n函数的具体用法?PHP date_i18n怎么用?PHP date_i18n使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了date_i18n函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: trigger
/**
* trigger function.
*/
function trigger($booking_id)
{
if ($booking_id) {
$this->object = get_wc_booking($booking_id);
if ($this->object->has_status('in-cart')) {
return;
}
$this->find[] = '{product_title}';
$this->replace[] = $this->object->get_product()->get_title();
if ($this->object->get_order()) {
$this->find[] = '{order_date}';
$this->replace[] = date_i18n(wc_date_format(), strtotime($this->object->get_order()->order_date));
$this->find[] = '{order_number}';
$this->replace[] = $this->object->get_order()->get_order_number();
} else {
$this->find[] = '{order_date}';
$this->replace[] = date_i18n(wc_date_format(), strtotime($this->object->booking_date));
$this->find[] = '{order_number}';
$this->replace[] = __('N/A', 'woocommerce-bookings');
}
if (!$this->is_enabled() || !$this->get_recipient()) {
return;
}
$this->send($this->get_recipient(), $this->get_subject(), $this->get_content(), $this->get_headers(), $this->get_attachments());
}
}
示例2: column_default
function column_default($item, $column_name)
{
global $mspdb;
switch ($column_name) {
case 'shortcode':
return sprintf('[masterslider id="%s"]', $item['ID']);
case 'date_modified':
$orig_time = isset($item['date_modified']) ? strtotime($item['date_modified']) : '';
$time = date_i18n('Y/m/d @ g:i:s A', $orig_time);
$human = human_time_diff($orig_time);
return sprintf('<abbr title="%s">%s</abbr>', $time, $human . __(' ago', 'master-slider'));
case 'date_created':
$orig_time = isset($item['date_created']) ? strtotime($item['date_created']) : '';
$date = date_i18n('Y/m/d', $orig_time);
$time = date_i18n('Y/m/d @ g:i:s A', $orig_time);
return sprintf('<abbr title="%s">%s</abbr>', $time, $date);
case 'slides_num':
global $mspdb;
return $mspdb->get_slider_field_val($item['ID'], 'slides_num');
case 'ID':
case 'title':
return $item[$column_name];
default:
return;
//return print_r( $item, true ) ; //Show the whole array for troubleshooting purposes
}
}
示例3: mk_header_toolbar_date
function mk_header_toolbar_date()
{
global $mk_options;
if ($mk_options['enable_header_date'] == 'true') {
echo '<span class="mk-header-date"><i class="mk-moon-clock"></i>' . date_i18n("F j, Y") . '</span>';
}
}
示例4: coupon_columns_content
/**
* Coupon list table column values
*
* @param string $column_name
* @param int $post_ID
* @return void
*/
function coupon_columns_content($column_name, $post_ID)
{
switch ($column_name) {
case 'coupon_type':
$price = get_post_meta($post_ID, '_type', true);
if ($price == 'amount') {
_e('Fixed Price', 'wpuf');
} else {
_e('Percentage', 'wpuf');
}
break;
case 'amount':
$type = get_post_meta($post_ID, '_type', true);
$currency = $type != 'percent' ? wpuf_get_option('currency_symbol', 'wpuf_payment') : '';
$symbol = $type == 'percent' ? '%' : '';
echo $currency . get_post_meta($post_ID, '_amount', true) . $symbol;
break;
case 'usage_limit':
$usage_limit = get_post_meta($post_ID, '_usage_limit', true);
if (intval($usage_limit) == 0) {
$usage_limit = __('∞', 'wpuf');
}
$use = intval(get_post_meta($post_ID, '_coupon_used', true));
echo $use . '/' . $usage_limit;
break;
case 'expire_date':
$start_date = get_post_meta($post_ID, '_start_date', true);
$end_date = get_post_meta($post_ID, '_end_date', true);
$start_date = !empty($start_date) ? date_i18n('M j, Y', strtotime($start_date)) : '';
$end_date = !empty($end_date) ? date_i18n('M j, Y', strtotime($end_date)) : '';
echo $start_date . ' to ' . $end_date;
break;
}
}
示例5: please_rate_si
public static function please_rate_si($footer_text)
{
if (self::is_si_admin()) {
$footer_text = sprintf(self::__('Please support the future of <strong>Sprout Invoices</strong> by rating the free version <a href="%1$s" target="_blank">★★★★★</a> on <a href="%1$s" target="_blank">WordPress.org</a>. Have an awesome %2$s!'), 'http://wordpress.org/support/view/plugin-reviews/sprout-invoices?filter=5', date_i18n('l'));
}
return $footer_text;
}
示例6: saveImport
/**
* Save the Import
*/
private function saveImport()
{
$title = __('Import on ', 'wpsimplelocator') . date_i18n('Y-m-d H:m:s', time());
$importpost = array('post_title' => $title, 'post_status' => 'publish', 'post_type' => 'wpslimport');
$post_id = wp_insert_post($importpost);
add_post_meta($post_id, 'wpsl_import_data', $this->transient);
}
示例7: get_month
/**
* Return the month to show in the widget
*
* @return string
* @since 3.0
* @author Jessica Yazbek
**/
public function get_month()
{
if (defined('DOING_AJAX') && DOING_AJAX) {
return isset($_POST["eventDate"]) ? $_POST["eventDate"] : date_i18n(TribeDateUtils::DBDATEFORMAT);
}
return date_i18n(TribeDateUtils::DBDATEFORMAT);
}
示例8: get_export_button
/**
* Output an export link
*/
public function get_export_button()
{
$current_range = !empty($_GET['range']) ? $_GET['range'] : '7day';
?>
<a
href="#"
download="report-<?php
echo $current_range;
?>
-<?php
echo date_i18n('Y-m-d', current_time('timestamp'));
?>
.csv"
class="export_csv"
data-export="chart"
data-xaxes="<?php
_e('Date', 'woocommerce');
?>
"
data-exclude_series="2"
data-groupby="<?php
echo $this->chart_groupby;
?>
"
>
<?php
_e('Export CSV', 'woocommerce');
?>
</a>
<?php
}
示例9: icl_populate_translations_pickup_box
function icl_populate_translations_pickup_box()
{
if (!wpml_is_action_authenticated('icl_populate_translations_pickup_box')) {
die('Wrong Nonce');
}
global $ICL_Pro_Translation, $sitepress;
$last_picked_up = $sitepress->get_setting('last_picked_up');
$translation_offset = strtotime(current_time('mysql')) - @intval($last_picked_up) - 5 * 60;
if (WP_DEBUG == false && $translation_offset < 0) {
$time_left = floor(abs($translation_offset) / 60);
if ($time_left == 0) {
$time_left = abs($translation_offset);
$wait_text = '<p><i>' . sprintf(__('You can check again in %s seconds.', 'sitepress'), '<span id="icl_sec_tic">' . $time_left . '</span>') . '</i></p>';
} else {
$wait_text = sprintf(__('You can check again in %s minutes.', 'sitepress'), '<span id="icl_sec_tic">' . $time_left . '</span>') . '</i></p>';
}
$result = array('wait_text' => $wait_text);
} else {
/** @var WPML_Pro_Translation $ICL_Pro_Translation */
$job_in_progress = $ICL_Pro_Translation->get_total_jobs_in_progress();
$button_text = __('Get completed translations', 'sitepress');
if ($job_in_progress == 1) {
$jobs_in_progress_text = __('1 job has been sent to the translation service.', 'sitepress');
} else {
$jobs_in_progress_text = sprintf(__('%d jobs have been sent to the translation service.', 'sitepress'), $job_in_progress);
}
$last_picked_up = $sitepress->get_setting('last_picked_up');
$last_time_picked_up = !empty($last_picked_up) ? date_i18n('Y, F jS @g:i a', $last_picked_up) : __('never', 'sitepress');
$last_pickup_text = sprintf(__('Last time translations were picked up: %s', 'sitepress'), $last_time_picked_up);
$result = array('jobs_in_progress_text' => $jobs_in_progress_text, 'button_text' => $button_text, 'last_pickup_text' => $last_pickup_text);
}
wp_send_json_success($result);
}
示例10: trigger
/**
* trigger function.
*
* @access public
* @return void
*
* @param unknown $order_id
*/
function trigger($order_id)
{
global $woocommerce;
if ($order_id) {
$this->object = new WC_Order($order_id);
$this->find[] = '{order_date}';
$this->replace[] = date_i18n(woocommerce_date_format(), strtotime($this->object->order_date));
$this->find[] = '{order_number}';
$this->replace[] = $this->object->get_order_number();
}
if (!$this->is_enabled()) {
return;
}
$vendors = $this->get_vendors($this->object);
if (empty($vendors)) {
return;
}
add_filter('woocommerce_order_get_items', array($this, 'check_items'), 10, 2);
add_filter('woocommerce_get_order_item_totals', array($this, 'check_order_totals'), 10, 2);
foreach ($vendors as $user_id => $user_email) {
$this->current_vendor = $user_id;
$this->send($user_email, $this->get_subject(), $this->get_content(), $this->get_headers(), $this->get_attachments());
}
remove_filter('woocommerce_get_order_item_totals', array($this, 'check_order_totals'), 10, 2);
remove_filter('woocommerce_order_get_items', array($this, 'check_items'), 10, 2);
}
示例11: cpt_updated_messages
/**
* Customize post type updated messages.
* @param $messages
* @return mixed
*/
function cpt_updated_messages($messages)
{
global $post, $post_ID;
$view = get_permalink($post_ID);
$messages[$this->slug] = array(0 => '', 1 => sprintf(__('%s updated. <a href="%s">View %s</a>.', 'themify'), $this->name, esc_url($view), $this->name), 2 => __('Custom field updated.', 'themify'), 3 => __('Custom field deleted.', 'themify'), 4 => sprintf(__('%s updated.', 'themify'), $this->name), 5 => isset($_GET['revision']) ? sprintf(__('%s restored to revision from %s', 'themify'), $this->name, wp_post_revision_title((int) $_GET['revision'], false)) : false, 6 => sprintf(__('%s published.', 'themify'), $this->name), 7 => sprintf(__('%s saved.', 'themify'), $this->name), 8 => sprintf(__('%s submitted.', 'themify'), $this->name), 9 => sprintf(__('%s scheduled for: <strong>%s</strong>.', 'themify'), $this->name, date_i18n(__('M j, Y @ G:i', 'themify'), strtotime($post->post_date))), 10 => sprintf(__('%s draft updated.', 'themify'), $this->name));
return $messages;
}
示例12: audiotheme_discography_post_updated_messages
/**
* Discography update messages.
*
* @since 1.0.0
* @see /wp-admin/edit-form-advanced.php
*
* @param array $messages The array of existing post update messages.
* @return array
*/
function audiotheme_discography_post_updated_messages($messages)
{
global $post;
$messages['audiotheme_record'] = array(0 => '', 1 => sprintf(__('Record updated. <a href="%s">View Record</a>', 'audiotheme'), esc_url(get_permalink($post->ID))), 2 => __('Custom field updated.', 'audiotheme'), 3 => __('Custom field deleted.', 'audiotheme'), 4 => __('Record updated.', 'audiotheme'), 5 => isset($_GET['revision']) ? sprintf(__('Record restored to revision from %s', 'audiotheme'), wp_post_revision_title((int) $_GET['revision'], false)) : false, 6 => sprintf(__('Record published. <a href="%s">View Record</a>', 'audiotheme'), esc_url(get_permalink($post->ID))), 7 => __('Record saved.', 'audiotheme'), 8 => sprintf(__('Record submitted. <a target="_blank" href="%s">Preview Record</a>', 'audiotheme'), esc_url(add_query_arg('preview', 'true', get_permalink($post->ID)))), 9 => sprintf(__('Record scheduled for: <strong>%1$s</strong>. <a target="_blank" href="%2$s">Preview Record</a>', 'audiotheme'), date_i18n(__('M j, Y @ G:i', 'audiotheme'), strtotime($post->post_date)), esc_url(get_permalink($post->ID))), 10 => sprintf(__('Record draft updated. <a target="_blank" href="%s">Preview Record</a>', 'audiotheme'), esc_url(add_query_arg('preview', 'true', get_permalink($post->ID)))));
$messages['audiotheme_track'] = array(0 => '', 1 => sprintf(__('Track updated. <a href="%s">View Track</a>', 'audiotheme'), esc_url(get_permalink($post->ID))), 2 => __('Custom field updated.', 'audiotheme'), 3 => __('Custom field deleted.', 'audiotheme'), 4 => __('Track updated.', 'audiotheme'), 5 => isset($_GET['revision']) ? sprintf(__('Track restored to revision from %s', 'audiotheme'), wp_post_revision_title((int) $_GET['revision'], false)) : false, 6 => sprintf(__('Track published. <a href="%s">View Track</a>', 'audiotheme'), esc_url(get_permalink($post->ID))), 7 => __('Track saved.', 'audiotheme'), 8 => sprintf(__('Track submitted. <a target="_blank" href="%s">Preview Track</a>', 'audiotheme'), esc_url(add_query_arg('preview', 'true', get_permalink($post->ID)))), 9 => sprintf(__('Track scheduled for: <strong>%1$s</strong>. <a target="_blank" href="%2$s">Preview Track</a>', 'audiotheme'), date_i18n(__('M j, Y @ G:i', 'audiotheme'), strtotime($post->post_date)), esc_url(get_permalink($post->ID))), 10 => sprintf(__('Track draft updated. <a target="_blank" href="%s">Preview Track</a>', 'audiotheme'), esc_url(add_query_arg('preview', 'true', get_permalink($post->ID)))));
return $messages;
}
示例13: index
/**
*
*/
public function index()
{
global $wpdb;
$schedule = new Bbpp_ThankMeLater_Schedule();
// get the total number of messages which are sent
$total_num_sent = $schedule->findNum(1);
$total_num_opened = $wpdb->get_var("SELECT COUNT(*) FROM `{$wpdb->prefix}bbpp_thankmelater_opens`");
$total_num_scheduled = $schedule->findNum(0);
$day_stats = array("data" => array(), "labels" => array());
$ind = 0;
$day_start = mktime(0, 0, 0, date("m"), date("d") - 30, date("Y"));
$day_start_last = mktime(0, 0, 0, date("m"), date("d"), date("Y"));
while ($day_start <= $day_start_last) {
$day_start_gmt = gmdate("Y-m-d H:i:s", $day_start);
$day_end_gmt = gmdate("Y-m-d H:i:s", $day_start + 86400 - 1);
$day_stats["data"][] = array($ind, $schedule->findSentBetween($day_start_gmt, $day_end_gmt));
$day_stats["labels"][] = array($ind, date_i18n("d", $day_start, false));
$day_start += 86400;
$ind++;
}
$open_stats = array("data" => array(), "labels" => array());
$ind = 0;
$day_start = mktime(0, 0, 0, date("m"), date("d") - 30, date("Y"));
$day_start_last = mktime(0, 0, 0, date("m"), date("d"), date("Y"));
while ($day_start <= $day_start_last) {
$day_start_gmt = gmdate("Y-m-d H:i:s", $day_start);
$day_end_gmt = gmdate("Y-m-d H:i:s", $day_start + 86400 - 1);
$open_stats["data"][] = array($ind, (int) $wpdb->get_var($wpdb->prepare("\r\n\t\t\t\tSELECT COUNT(*) FROM `{$wpdb->prefix}bbpp_thankmelater_opens`\r\n\t\t\t\tWHERE `date_gmt` >= %s\r\n\t\t\t\tAND `date_gmt` <= %s\r\n\t\t\t", $day_start_gmt, $day_end_gmt)));
$open_stats["labels"][] = array($ind, date_i18n("d", $day_start, false));
$day_start += 86400;
$ind++;
}
require_once BBPP_THANKMELATER_PLUGIN_PATH . "admin/statistics/index.php";
}
示例14: format_date_time_gmt
public static function format_date_time_gmt($timestamp)
{
if (empty($timestamp)) {
return 0;
}
return date_i18n("Y-m-d H:i:s", $timestamp, true);
}
示例15: cpt_savedsearch_messages
function cpt_savedsearch_messages($messages)
{
//http://codex.wordpress.org/Function_Reference/register_post_type
global $post, $post_ID;
$messages['savedsearch'] = array(0 => '', 1 => sprintf(__('Saved search Post updated.', 'your_text_domain'), esc_url(get_permalink($post_ID))), 2 => __('Saved searche updated.', 'your_text_domain'), 3 => __('Saved search deleted.', 'your_text_domain'), 4 => __('Saved search Post updated.', 'your_text_domain'), 5 => isset($_GET['revision']) ? sprintf(__('Saved search Post restored to revision from %s', 'your_text_domain'), wp_post_revision_title((int) $_GET['revision'], false)) : false, 6 => sprintf(__('Saved search Post published. <a href="%s">View Saved search Post</a>', 'your_text_domain'), esc_url(get_permalink($post_ID))), 7 => __('Saved search Post saved.', 'your_text_domain'), 8 => sprintf(__('Saved search Post submitted. <a target="_blank" href="%s">Preview Saved search Post</a>', 'your_text_domain'), esc_url(add_query_arg('preview', 'true', get_permalink($post_ID)))), 9 => sprintf(__('Saved search Post scheduled for: <strong>%1$s</strong>. <a target="_blank" href="%2$s">Preview Saved search Post</a>', 'your_text_domain'), date_i18n(__('M j, Y @ G:i', 'tn_'), strtotime($post->post_date)), esc_url(get_permalink($post_ID))), 10 => sprintf(__('Saved search Post draft updated. <a target="_blank" href="%s">Preview Saved search Post</a>', 'your_text_domain'), esc_url(add_query_arg('preview', 'true', get_permalink($post_ID)))));
return $messages;
}