本文整理汇总了PHP中bp_format_time函数的典型用法代码示例。如果您正苦于以下问题:PHP bp_format_time函数的具体用法?PHP bp_format_time怎么用?PHP bp_format_time使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了bp_format_time函数的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: messages_ajax_send_reply
function messages_ajax_send_reply()
{
global $bp;
check_ajax_referer('messages_send_message');
$result = messages_send_message($_REQUEST['send_to'], $_REQUEST['subject'], $_REQUEST['content'], $_REQUEST['thread_id'], true, false, true);
if ($result['status']) {
?>
<div class="avatar-box">
<?php
if (function_exists('bp_core_get_avatar')) {
echo bp_core_get_avatar($result['reply']->sender_id, 1);
}
?>
<h3><?php
echo bp_core_get_userlink($result['reply']->sender_id);
?>
</h3>
<small><?php
echo bp_format_time($result['reply']->date_sent);
?>
</small>
</div>
<?php
echo stripslashes(apply_filters('bp_get_message_content', $result['reply']->message));
?>
<div class="clear"></div>
<?php
} else {
$result['message'] = '<img src="' . $bp->messages->image_base . '/warning.gif" alt="Warning" /> ' . $result['message'];
echo "-1[[split]]" . $result['message'];
}
}
示例2: xprofile_filter_format_field_value
function xprofile_filter_format_field_value( $field_value, $field_type = '' ) {
if ( !isset( $field_value ) || empty( $field_value ) )
return false;
if ( 'datebox' == $field_type )
$field_value = bp_format_time( $field_value, true );
else
$field_value = str_replace(']]>', ']]>', $field_value );
return stripslashes( $field_value );
}
示例3: display_filter
/**
* Format Date values for display.
*
* @since BuddyPress (2.1.0)
*
* @param string $field_value The date value, as saved in the database.
* Typically, this is a MySQL-formatted date string (Y-m-d H:i:s).
* @return string Date formatted by bp_format_time().
*/
public static function display_filter($field_value)
{
// If Unix timestamp
if (!is_numeric($field_value)) {
$field_value = strtotime($field_value);
}
return bp_format_time($field_value, true, false);
}
示例4: messages_view_thread
function messages_view_thread($thread_id)
{
global $bp;
$thread = new BP_Messages_Thread($thread_id, true);
if (!$thread->has_access) {
unset($_GET['mode']);
?>
<div id="message" class="error">
<p><?php
_e('There was an error when viewing that message', 'buddypress');
?>
</p>
</div>
<?php
} else {
if ($thread->messages) {
?>
<?php
$thread->mark_read();
?>
<div class="wrap">
<h2 id="message-subject"><?php
echo $thread->subject;
?>
</h2>
<table class="form-table">
<tbody>
<tr>
<td>
<img src="<?php
echo $bp->messages->image_base;
?>
/email_open.gif" alt="Message" style="vertical-align: top;" />
<?php
_e('Sent between ', 'buddypress');
?>
<?php
echo BP_Messages_Thread::get_recipient_links($thread->recipients);
?>
<?php
_e('and', 'buddypress');
?>
<?php
echo bp_core_get_userlink($bp->loggedin_user->id);
?>
.
</td>
</tr>
</tbody>
</table>
<?php
$counter = 0;
foreach ($thread->messages as $message) {
$alt = $counter % 2 == 1 ? ' alt' : '';
?>
<a name="<?php
echo 'm-' . $message->id;
?>
"></a>
<div class="message-box<?php
echo $alt;
?>
">
<div class="avatar-box">
<?php
echo apply_filters('bp_get_message_sender_avatar', bp_core_get_avatar($message->sender_id, 1));
?>
<h3><?php
echo apply_filters('bp_get_message_sender_id', bp_core_get_userlink($message->sender_id));
?>
</h3>
<small><?php
echo apply_filters('bp_get_message_date_sent', bp_format_time(strtotime($message->date_sent)));
?>
</small>
</div>
<?php
do_action('messages_custom_fields_output_before');
?>
<?php
echo apply_filters('bp_get_message_content', stripslashes($message->message));
?>
<?php
do_action('messages_custom_fields_output_after');
?>
<div class="clear"></div>
</div>
<?php
$counter++;
}
?>
<form id="send-reply" action="<?php
bp_messages_form_action();
//.........这里部分代码省略.........
示例5: xprofile_format_profile_field
/**
* Formats a profile field according to its type. [ TODO: Should really be moved to filters ]
*
* @package BuddyPress Core
* @param $field_type The type of field: datebox, selectbox, textbox etc
* @param $field_value The actual value
* @uses bp_format_time() Formats a time value based on the NXTClass date format setting
* @return $field_value The formatted value
*/
function xprofile_format_profile_field($field_type, $field_value)
{
if (!isset($field_value) || empty($field_value)) {
return false;
}
$field_value = bp_unserialize_profile_field($field_value);
if ('datebox' == $field_type) {
$field_value = bp_format_time($field_value, true);
} else {
$content = $field_value;
$field_value = str_replace(']]>', ']]>', $content);
}
return stripslashes_deep($field_value);
}
示例6: bp_get_message_notice_post_date
/**
* Get the post date of the current notice in the loop.
*
* @return string
*/
function bp_get_message_notice_post_date()
{
global $messages_template;
/**
* Filters the post date of the current notice in the loop.
*
* @since 1.0.0
*
* @param string $value Formatted post date of the current notice in the loop.
*/
return apply_filters('bp_get_message_notice_post_date', bp_format_time(strtotime($messages_template->thread->date_sent)));
}
示例7: buddydrive_get_item_date
/**
* Gets the item date
*
* @global object $buddydrive_template
* @uses bp_format_time() to format the date
* @return string the formatted date
*/
function buddydrive_get_item_date()
{
global $buddydrive_template;
$date = $buddydrive_template->query->post->post_modified_gmt;
$date = bp_format_time(strtotime($date), true, false);
return apply_filters('buddydrive_get_item_date', $date);
}
示例8: xprofile_filter_format_field_value
/**
* xprofile_filter_format_field_value()
*
* Runs stripslashes on XProfile fields. If is field_type is 'datebox'
* then the date will be formatted by bp_format_time().
*
* @since 1.0.0
*
* @param string $field_value XProfile field_value to be filtered.
* @param string $field_type XProfile field_type to be filtered.
*
* @uses bp_format_time()
*
* @return string $field_value Filtered XProfile field_value. False on failure.
*/
function xprofile_filter_format_field_value($field_value, $field_type = '')
{
if (!isset($field_value) || empty($field_value)) {
return false;
}
if ('datebox' == $field_type) {
// If Unix timestamp
if (is_numeric($field_value)) {
$field_value = bp_format_time($field_value, true, false);
} else {
$field_value = bp_format_time(strtotime($field_value), true, false);
}
} else {
$field_value = str_replace(']]>', ']]>', $field_value);
}
return stripslashes($field_value);
}
示例9: bp_get_message_notice_post_date
function bp_get_message_notice_post_date()
{
global $messages_template;
return apply_filters('bp_get_message_notice_post_date', bp_format_time(strtotime($messages_template->thread->date_sent)));
}
示例10: printf
?>
</span>
<span class="alignright"><?php
printf(__('Newer: %s', 'bp-docs'), bp_docs_history_post_revision_field('right', 'post_title'));
?>
</span>
</th>
</tr>
<?php
} elseif (!bp_docs_history_is_latest()) {
?>
<tr id="revision">
<th scope="row"></th>
<th scope="col" class="th-full">
<span class="alignleft"><?php
printf(__('You are currently viewing a revision titled "%1$s", saved on %2$s by %3$s', 'bp-docs'), bp_docs_history_post_revision_field(false, 'post_title'), bp_format_time(strtotime(bp_docs_history_post_revision_field(false, 'post_date'))), bp_core_get_userlink(bp_docs_history_post_revision_field(false, 'post_author')));
?>
</span>
</th>
</tr>
<?php
}
?>
<?php
foreach (_wp_post_revision_fields() as $field => $field_title) {
?>
<?php
if ('diff' == bp_docs_history_action()) {
?>
<tr id="revision-field-<?php
示例11: test_bp_format_time_timezone_string_no_localize
/**
* @group bp_format_time
*/
public function test_bp_format_time_timezone_string_no_localize()
{
$time = 1395169200;
$timzone_string = 'America/Chicago';
$just_date = false;
$localize_time = false;
update_option('date_format', 'F j, Y');
update_option('time_format', 'g:i a');
update_option('timezone_string', $timzone_string);
update_option('gmt_offset', '0');
$this->assertEquals('March 18, 2014 at 7:00 pm', bp_format_time($time, $just_date, $localize_time));
}
示例12: bp_docs_list_post_revisions
/**
* Display list of a Docs's revisions. Borrowed heavily from WP's wp_list_post_revisions()
*
* @package BuddyPress Docs
* @since 1.1
*
* @uses wp_get_post_revisions()
* @uses wp_post_revision_title()
* @uses get_edit_post_link()
* @uses get_the_author_meta()
*
* @param int|object $post_id Post ID or post object.
* @param string|array $args See description {@link wp_parse_args()}.
* @return null
*/
function bp_docs_list_post_revisions($post_id = 0, $args = null)
{
global $bp;
if (!($post = get_post($post_id))) {
return;
}
$defaults = array('parent' => false, 'right' => $bp->bp_docs->history->right, 'left' => $bp->bp_docs->history->left, 'format' => 'form-table', 'type' => 'all');
extract(wp_parse_args($args, $defaults), EXTR_SKIP);
switch ($type) {
case 'autosave':
if (!($autosave = wp_get_post_autosave($post->ID))) {
return;
}
$revisions = array($autosave);
break;
case 'revision':
// just revisions - remove autosave later
// just revisions - remove autosave later
case 'all':
default:
if (!($revisions = wp_get_post_revisions($post->ID))) {
return;
}
break;
}
/* translators: post revision: 1: when, 2: author name */
$titlef = _x('%1$s by %2$s', 'post revision');
if ($parent) {
array_unshift($revisions, $post);
}
$rows = $right_checked = '';
$class = false;
$can_edit_post = current_user_can('bp_docs_edit');
foreach ($revisions as $revision) {
if ('revision' === $type && wp_is_post_autosave($revision)) {
continue;
}
$base_url = trailingslashit(get_permalink() . BP_DOCS_HISTORY_SLUG);
$date = '<a href="' . add_query_arg('revision', $revision->ID) . '">' . bp_format_time(strtotime($revision->post_date), false, false) . '</a>';
$name = bp_core_get_userlink($revision->post_author);
if ('form-table' == $format) {
if ($left) {
$left_checked = $left == $revision->ID ? ' checked="checked"' : '';
} else {
$left_checked = $right_checked ? ' checked="checked"' : '';
}
// [sic] (the next one)
$right_checked = $right == $revision->ID ? ' checked="checked"' : '';
$class = $class ? '' : " class='alternate'";
if ($post->ID != $revision->ID && $can_edit_post) {
$actions = '<a class="confirm" href="' . wp_nonce_url(add_query_arg(array('revision' => $revision->ID, 'action' => 'restore'), $base_url), "restore-post_{$post->ID}|{$revision->ID}") . '">' . __('Restore', 'bp-docs') . '</a>';
} else {
$actions = '';
}
$rows .= "<tr{$class}>\n";
$rows .= "\t<th style='white-space: nowrap' scope='row'><input type='radio' name='left' value='{$revision->ID}'{$left_checked} /></th>\n";
$rows .= "\t<th style='white-space: nowrap' scope='row'><input type='radio' name='right' value='{$revision->ID}'{$right_checked} /></th>\n";
$rows .= "\t<td>{$date}</td>\n";
$rows .= "\t<td>{$name}</td>\n";
$rows .= "\t<td class='action-links'>{$actions}</td>\n";
$rows .= "</tr>\n";
} else {
$title = sprintf($titlef, $date, $name);
$rows .= "\t<li>{$title}</li>\n";
}
}
?>
<form action="" method="get">
<div class="tablenav">
<div class="alignleft">
<input type="submit" class="button-secondary" value="<?php
esc_attr_e('Compare Revisions', 'bp-docs');
?>
" />
<input type="hidden" name="action" value="diff" />
<input type="hidden" name="post_type" value="<?php
echo esc_attr($post->post_type);
?>
" />
</div>
</div>
<br class="clear" />
//.........这里部分代码省略.........
示例13: column_last_edit
/**
* Last Active column
*
* @since BuddyDrive (1.0)
* @param array $item A singular item (one full row)
* @uses bp_format_time() to format the date
*/
function column_last_edit($item = array())
{
$date = $item['post_modified_gmt'];
$date = bp_format_time(strtotime($date), true, false);
echo apply_filters('buddydrive_get_item_date', $date);
}