本文整理汇总了PHP中relative_date函数的典型用法代码示例。如果您正苦于以下问题:PHP relative_date函数的具体用法?PHP relative_date怎么用?PHP relative_date使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了relative_date函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getCareerBuilderJobHTML
function getCareerBuilderJobHTML($xmlJobEntries)
{
$html = "";
foreach ($xmlJobEntries as $jobEntry) {
$html .= getJobListingHTML($jobEntry->JobDetailsURL, $jobEntry->DID, '1', $jobEntry->JobTitle, $jobEntry->Company, $jobEntry->DescriptionTeaser, relative_date(strtotime($jobEntry->PostedDate)), $jobEntry->City, $jobEntry->State);
}
return $html;
}
示例2: format_notification
/** @file */
function format_notification($item)
{
$ret = '';
require_once 'include/conversation.php';
// Call localize_item with the "brief" flag to get a one line status for activities.
// This should set $item['localized'] to indicate we have a brief summary.
localize_item($item);
if ($item_localize) {
$itemem_text = $item['localize'];
} else {
$itemem_text = $item['item_thread_top'] ? t('created a new post') : sprintf(t('commented on %s\'s post'), $item['owner']['xchan_name']);
}
// convert this logic into a json array just like the system notifications
return array('notify_link' => $item['llink'], 'name' => $item['author']['xchan_name'], 'url' => $item['author']['xchan_url'], 'photo' => $item['author']['xchan_photo_s'], 'when' => relative_date($item['created']), 'class' => intval($item['item_unseen']) ? 'notify-unseen' : 'notify-seen', 'message' => strip_tags(bbcode($itemem_text)));
}
示例3: notify_content
function notify_content(&$a)
{
if (!local_user()) {
return login();
}
$notif_tpl = get_markup_template('notifications.tpl');
$not_tpl = get_markup_template('notify.tpl');
require_once 'include/bbcode.php';
$r = q("SELECT * from notify where uid = %d and seen = 0 order by date desc", intval(local_user()));
if (count($r) > 0) {
foreach ($r as $it) {
$notif_content .= replace_macros($not_tpl, array('$item_link' => $a->get_baseurl(true) . '/notify/view/' . $it['id'], '$item_image' => $it['photo'], '$item_text' => strip_tags(bbcode($it['msg'])), '$item_when' => relative_date($it['date'])));
}
} else {
$notif_content .= t('No more system notifications.');
}
$o .= replace_macros($notif_tpl, array('$notif_header' => t('System Notifications'), '$tabs' => '', '$notif_content' => $notif_content));
return $o;
}
示例4: notifications_content
function notifications_content(&$a)
{
if (!local_channel()) {
notice(t('Permission denied.') . EOL);
return;
}
nav_set_selected('notifications');
$o = '';
$notif_tpl = get_markup_template('notifications.tpl');
$not_tpl = get_markup_template('notify.tpl');
require_once 'include/bbcode.php';
$r = q("SELECT * from notify where uid = %d and seen = 0 order by date desc", intval(local_channel()));
if (count($r) > 0) {
$notifications_available = 1;
foreach ($r as $it) {
$notif_content .= replace_macros($not_tpl, array('$item_link' => z_root() . '/notify/view/' . $it['id'], '$item_image' => $it['photo'], '$item_text' => strip_tags(bbcode($it['msg'])), '$item_when' => relative_date($it['date'])));
}
} else {
$notif_content .= t('No more system notifications.');
}
$o .= replace_macros($notif_tpl, array('$notif_header' => t('System Notifications'), '$notif_link_mark_seen' => t('Mark all system notifications seen'), '$notif_content' => $notif_content, '$notifications_available' => $notifications_available));
return $o;
}
示例5: get_template_data
//.........这里部分代码省略.........
* Maybe we should establish a way to be notified about conversation changes
*/
$this->check_wall_to_wall();
if ($this->is_toplevel()) {
// FIXME check this permission
if ($conv->get_profile_owner() == local_channel() && !array_key_exists('real_uid', $item)) {
// FIXME we don't need all this stuff, some can be done in the template
$star = array('do' => t("Add Star"), 'undo' => t("Remove Star"), 'toggle' => t("Toggle Star Status"), 'classdo' => intval($item['item_starred']) ? "hidden" : "", 'classundo' => intval($item['item_starred']) ? "" : "hidden", 'isstarred' => intval($item['item_starred']) ? "starred icon-star" : "unstarred icon-star-empty", 'starred' => t('starred'));
}
} else {
$indent = 'comment';
}
$verified = intval($item['item_verified']) ? t('Message signature validated') : '';
$forged = $item['sig'] && !intval($item['item_verified']) ? t('Message signature incorrect') : '';
$unverified = '';
// (($this->is_wall_to_wall() && (! intval($item['item_verified']))) ? t('Message cannot be verified') : '');
// FIXME - check this permission
if ($conv->get_profile_owner() == local_channel()) {
$tagger = array('tagit' => t("Add Tag"), 'classtagger' => "");
}
$has_bookmarks = false;
if (is_array($item['term'])) {
foreach ($item['term'] as $t) {
if ($t['type'] == TERM_BOOKMARK) {
$has_bookmarks = true;
}
}
}
$has_event = false;
if ($item['obj_type'] === ACTIVITY_OBJ_EVENT && $conv->get_profile_owner() == local_channel()) {
$has_event = true;
}
if ($this->is_commentable()) {
$like = array(t("I like this (toggle)"), t("like"));
$dislike = array(t("I don't like this (toggle)"), t("dislike"));
}
if ($shareable) {
$share = array(t('Share This'), t('share'));
}
$dreport = '';
$keep_reports = intval(get_config('system', 'expire_delivery_reports'));
if ($keep_reports === 0) {
$keep_reports = 30;
}
if (!get_config('system', 'disable_dreport') && strcmp(datetime_convert('UTC', 'UTC', $item['created']), datetime_convert('UTC', 'UTC', "now - {$keep_reports} days")) > 0) {
$dreport = t('Delivery Report');
}
if (strcmp(datetime_convert('UTC', 'UTC', $item['created']), datetime_convert('UTC', 'UTC', 'now - 12 hours')) > 0) {
$indent .= ' shiny';
}
localize_item($item);
$body = prepare_body($item, true);
// $viewthread (below) is only valid in list mode. If this is a channel page, build the thread viewing link
// since we can't depend on llink or plink pointing to the right local location.
$owner_address = substr($item['owner']['xchan_addr'], 0, strpos($item['owner']['xchan_addr'], '@'));
$viewthread = $item['llink'];
if ($conv->get_mode() === 'channel') {
$viewthread = z_root() . '/channel/' . $owner_address . '?f=&mid=' . $item['mid'];
}
$comment_count_txt = sprintf(tt('%d comment', '%d comments', $total_children), $total_children);
$list_unseen_txt = $unseen_comments ? sprintf('%d unseen', $unseen_comments) : '';
$children = $this->get_children();
$has_tags = $body['tags'] || $body['categories'] || $body['mentions'] || $body['attachments'] || $body['folders'] ? true : false;
$tmp_item = array('template' => $this->get_template(), 'mode' => $mode, 'type' => implode("", array_slice(explode("/", $item['verb']), -1)), 'body' => $body['html'], 'tags' => $body['tags'], 'categories' => $body['categories'], 'mentions' => $body['mentions'], 'attachments' => $body['attachments'], 'folders' => $body['folders'], 'text' => strip_tags($body['html']), 'id' => $this->get_id(), 'mid' => $item['mid'], 'isevent' => $isevent, 'attend' => $attend, 'consensus' => $consensus, 'conlabels' => $conlabels, 'canvote' => $canvote, 'linktitle' => sprintf(t('View %s\'s profile - %s'), $profile_name, $item['author']['xchan_addr']), 'olinktitle' => sprintf(t('View %s\'s profile - %s'), $this->get_owner_name(), $item['owner']['xchan_addr']), 'llink' => $item['llink'], 'viewthread' => $viewthread, 'to' => t('to'), 'via' => t('via'), 'wall' => t('Wall-to-Wall'), 'vwall' => t('via Wall-To-Wall:'), 'profile_url' => $profile_link, 'item_photo_menu' => item_photo_menu($item), 'dreport' => $dreport, 'name' => $profile_name, 'thumb' => $profile_avatar, 'osparkle' => $osparkle, 'sparkle' => $sparkle, 'title' => $item['title'], 'title_tosource' => get_pconfig($conv->get_profile_owner(), 'system', 'title_tosource'), 'ago' => relative_date($item['created']), 'app' => $item['app'], 'str_app' => sprintf(t('from %s'), $item['app']), 'isotime' => datetime_convert('UTC', date_default_timezone_get(), $item['created'], 'c'), 'localtime' => datetime_convert('UTC', date_default_timezone_get(), $item['created'], 'r'), 'editedtime' => $item['edited'] != $item['created'] ? sprintf(t('last edited: %s'), datetime_convert('UTC', date_default_timezone_get(), $item['edited'], 'r')) : '', 'expiretime' => $item['expires'] !== NULL_DATE ? sprintf(t('Expires: %s'), datetime_convert('UTC', date_default_timezone_get(), $item['expires'], 'r')) : '', 'lock' => $lock, 'verified' => $verified, 'unverified' => $unverified, 'forged' => $forged, 'location' => $location, 'indent' => $indent, 'owner_url' => $this->get_owner_url(), 'owner_photo' => $this->get_owner_photo(), 'owner_name' => $this->get_owner_name(), 'photo' => $body['photo'], 'event' => $body['event'], 'has_tags' => $has_tags, 'like' => $like, 'dislike' => feature_enabled($conv->get_profile_owner(), 'dislike') ? $dislike : '', 'share' => $share, 'rawmid' => $item['mid'], 'plink' => get_plink($item), 'edpost' => $edpost, 'star' => feature_enabled($conv->get_profile_owner(), 'star_posts') ? $star : '', 'tagger' => feature_enabled($conv->get_profile_owner(), 'commtag') ? $tagger : '', 'filer' => feature_enabled($conv->get_profile_owner(), 'filing') ? $filer : '', 'bookmark' => $conv->get_profile_owner() == local_channel() && local_channel() && $has_bookmarks ? t('Save Bookmarks') : '', 'addtocal' => $has_event ? t('Add to Calendar') : '', 'drop' => $drop, 'multidrop' => feature_enabled($conv->get_profile_owner(), 'multi_delete') ? $multidrop : '', 'unseen_comments' => $unseen_comments, 'comment_count' => $total_children, 'comment_count_txt' => $comment_count_txt, 'list_unseen_txt' => $list_unseen_txt, 'markseen' => t('Mark all seen'), 'responses' => $responses, 'like_count' => $like_count, 'like_list' => $like_list, 'like_list_part' => $like_list_part, 'like_button_label' => $like_button_label, 'like_modal_title' => t('Likes', 'noun'), 'dislike_modal_title' => t('Dislikes', 'noun'), 'dislike_count' => feature_enabled($conv->get_profile_owner(), 'dislike') ? $dislike_count : '', 'dislike_list' => feature_enabled($conv->get_profile_owner(), 'dislike') ? $dislike_list : '', 'dislike_list_part' => feature_enabled($conv->get_profile_owner(), 'dislike') ? $dislike_list_part : '', 'dislike_button_label' => feature_enabled($conv->get_profile_owner(), 'dislike') ? $dislike_button_label : '', 'modal_dismiss' => t('Close'), 'showlike' => $showlike, 'showdislike' => $showdislike, 'comment' => $this->get_comment_box($indent), 'previewing' => $conv->is_preview() ? ' preview ' : '', 'wait' => t('Please wait'), 'thread_level' => $thread_level);
$arr = array('item' => $item, 'output' => $tmp_item);
call_hooks('display_item', $arr);
$result = $arr['output'];
$result['children'] = array();
$nb_children = count($children);
$visible_comments = get_config('system', 'expanded_comments');
if ($visible_comments === false) {
$visible_comments = 3;
}
if ($this->get_display_mode() === 'normal' && $nb_children > 0) {
foreach ($children as $child) {
$result['children'][] = $child->get_template_data($conv_responses, $thread_level + 1);
}
// Collapse
if ($nb_children > $visible_comments || $thread_level > 1) {
$result['children'][0]['comment_firstcollapsed'] = true;
$result['children'][0]['num_comments'] = $comment_count_txt;
$result['children'][0]['hide_text'] = t('[+] show all');
if ($thread_level > 1) {
$result['children'][$nb_children - 1]['comment_lastcollapsed'] = true;
} else {
$result['children'][$nb_children - ($visible_comments + 1)]['comment_lastcollapsed'] = true;
}
}
}
$result['private'] = $item['item_private'];
$result['toplevel'] = $this->is_toplevel() ? 'toplevel_item' : '';
if ($this->is_threaded()) {
$result['flatten'] = false;
$result['threaded'] = true;
} else {
$result['flatten'] = true;
$result['threaded'] = false;
}
return $result;
}
示例6: conversation
//.........这里部分代码省略.........
}
$normalised = normalise_link(strlen($item['author-link']) ? $item['author-link'] : $item['url']);
if ($normalised != 'mailbox' && x($a->contacts[$normalised])) {
$profile_avatar = $a->contacts[$normalised]['thumb'];
} else {
$profile_avatar = strlen($item['author-avatar']) ? $a->get_cached_avatar_image($item['author-avatar']) : $item['thumb'];
}
$locate = array('location' => $item['location'], 'coord' => $item['coord'], 'html' => '');
call_hooks('render_location', $locate);
$location = strlen($locate['html']) ? $locate['html'] : render_location_google($locate);
localize_item($item);
if ($mode === 'network-new') {
$dropping = true;
} else {
$dropping = false;
}
$drop = array('dropping' => $dropping, 'pagedrop' => $page_dropping, 'select' => t('Select'), 'delete' => t('Delete'));
$star = false;
$isstarred = "unstarred";
$lock = false;
$likebuttons = false;
$shareable = false;
$body = prepare_body($item, true, $preview);
list($categories, $folders) = get_cats_and_terms($item);
if ($a->theme['template_engine'] === 'internal') {
$profile_name_e = template_escape($profile_name);
$item['title_e'] = template_escape($item['title']);
$body_e = template_escape($body);
$tags_e = template_escape($tags);
$hashtags_e = template_escape($hashtags);
$mentions_e = template_escape($mentions);
$location_e = template_escape($location);
$owner_name_e = template_escape($owner_name);
} else {
$profile_name_e = $profile_name;
$item['title_e'] = $item['title'];
$body_e = $body;
$tags_e = $tags;
$hashtags_e = $hashtags;
$mentions_e = $mentions;
$location_e = $location;
$owner_name_e = $owner_name;
}
$tmp_item = array('template' => $tpl, 'id' => $preview ? 'P0' : $item['item_id'], 'network' => $item['item_network'], 'linktitle' => sprintf(t('View %s\'s profile @ %s'), $profile_name, strlen($item['author-link']) ? $item['author-link'] : $item['url']), 'profile_url' => $profile_link, 'item_photo_menu' => item_photo_menu($item), 'name' => $profile_name_e, 'sparkle' => $sparkle, 'lock' => $lock, 'thumb' => proxy_url($profile_avatar), 'title' => $item['title_e'], 'body' => $body_e, 'tags' => $tags_e, 'hashtags' => $hashtags_e, 'mentions' => $mentions_e, 'txt_cats' => t('Categories:'), 'txt_folders' => t('Filed under:'), 'has_cats' => count($categories) ? 'true' : '', 'has_folders' => count($folders) ? 'true' : '', 'categories' => $categories, 'folders' => $folders, 'text' => strip_tags($body_e), 'localtime' => datetime_convert('UTC', date_default_timezone_get(), $item['created'], 'r'), 'ago' => $item['app'] ? sprintf(t('%s from %s'), relative_date($item['created']), $item['app']) : relative_date($item['created']), 'location' => $location_e, 'indent' => '', 'owner_name' => $owner_name_e, 'owner_url' => $owner_url, 'owner_photo' => proxy_url($owner_photo), 'plink' => get_plink($item), 'edpost' => false, 'isstarred' => $isstarred, 'star' => $star, 'drop' => $drop, 'vote' => $likebuttons, 'like' => '', 'dislike' => '', 'comment' => '', 'conv' => $preview ? '' : array('href' => $a->get_baseurl($ssl_state) . '/display/' . $item['guid'], 'title' => t('View in context')), 'previewing' => $previewing, 'wait' => t('Please wait'), 'thread_level' => 1);
$arr = array('item' => $item, 'output' => $tmp_item);
call_hooks('display_item', $arr);
$threads[$threadsid]['id'] = $item['item_id'];
$threads[$threadsid]['network'] = $item['item_network'];
$threads[$threadsid]['items'] = array($arr['output']);
}
} else {
// Normal View
$page_template = get_markup_template("threaded_conversation.tpl");
require_once 'object/Conversation.php';
require_once 'object/Item.php';
$conv = new Conversation($mode, $preview);
// get all the topmost parents
// this shouldn't be needed, as we should have only them in our array
// But for now, this array respects the old style, just in case
$threads = array();
foreach ($items as $item) {
if ($arr_blocked) {
$blocked = false;
foreach ($arr_blocked as $b) {
if ($b && link_compare($item['author-link'], $b)) {
$blocked = true;
break;
}
}
if ($blocked) {
continue;
}
}
// Can we put this after the visibility check?
like_puller($a, $item, $alike, 'like');
like_puller($a, $item, $dlike, 'dislike');
// Only add what is visible
if ($item['network'] === NETWORK_MAIL && local_user() != $item['uid']) {
continue;
}
if (!visible_activity($item)) {
continue;
}
call_hooks('display_item', $arr);
$item['pagedrop'] = $page_dropping;
if ($item['id'] == $item['parent']) {
$item_object = new Item($item);
$conv->add_thread($item_object);
}
}
$threads = $conv->get_template_data($alike, $dlike);
if (!$threads) {
logger('[ERROR] conversation : Failed to get template data.', LOGGER_DEBUG);
$threads = array();
}
}
}
$o = replace_macros($page_template, array('$baseurl' => $a->get_baseurl($ssl_state), '$return_path' => $a->query_string, '$live_update' => $live_update_div, '$remove' => t('remove'), '$mode' => $mode, '$user' => $a->user, '$threads' => $threads, '$dropping' => $page_dropping && feature_enabled(local_user(), 'multi_delete') ? t('Delete Selected Items') : False));
return $o;
}
示例7: advanced_profile
function advanced_profile(&$a)
{
require_once 'include/text.php';
if (!perm_is_allowed($a->profile['profile_uid'], get_observer_hash(), 'view_profile')) {
return '';
}
$o = '';
$o .= '<h2>' . t('Profile') . '</h2>';
if ($a->profile['name']) {
$tpl = get_markup_template('profile_advanced.tpl');
$profile = array();
$profile['fullname'] = array(t('Full Name:'), $a->profile['name']);
if ($a->profile['gender']) {
$profile['gender'] = array(t('Gender:'), $a->profile['gender']);
}
$ob_hash = get_observer_hash();
if ($ob_hash && perm_is_allowed($a->profile['profile_uid'], $ob_hash, 'post_like')) {
$profile['canlike'] = true;
$profile['likethis'] = t('Like this channel');
$profile['profile_guid'] = $a->profile['profile_guid'];
}
$likers = q("select liker, xchan.* from likes left join xchan on liker = xchan_hash where channel_id = %d and target_type = '%s' and verb = '%s'", intval($a->profile['profile_uid']), dbesc(ACTIVITY_OBJ_PROFILE), dbesc(ACTIVITY_LIKE));
$profile['likers'] = array();
$profile['like_count'] = count($likers);
$profile['like_button_label'] = tt('Like', 'Likes', $profile['like_count'], 'noun');
if ($likers) {
foreach ($likers as $l) {
$profile['likers'][] = array('name' => $l['xchan_name'], 'url' => zid($l['xchan_url']));
}
}
if ($a->profile['dob'] && $a->profile['dob'] != '0000-00-00') {
$val = '';
if (substr($a->profile['dob'], 5, 2) === '00' || substr($a->profile['dob'], 8, 2) === '00') {
$val = substr($a->profile['dob'], 0, 4);
}
$year_bd_format = t('j F, Y');
$short_bd_format = t('j F');
if (!$val) {
$val = intval($a->profile['dob']) ? day_translate(datetime_convert('UTC', 'UTC', $a->profile['dob'] . ' 00:00 +00:00', $year_bd_format)) : day_translate(datetime_convert('UTC', 'UTC', '2001-' . substr($a->profile['dob'], 5) . ' 00:00 +00:00', $short_bd_format));
}
$profile['birthday'] = array(t('Birthday:'), $val);
}
if ($age = age($a->profile['dob'], $a->profile['timezone'], '')) {
$profile['age'] = array(t('Age:'), $age);
}
if ($a->profile['marital']) {
$profile['marital'] = array(t('Status:'), $a->profile['marital']);
}
if ($a->profile['with']) {
$profile['marital']['with'] = bbcode($a->profile['with']);
}
if (strlen($a->profile['howlong']) && $a->profile['howlong'] !== NULL_DATE) {
$profile['howlong'] = relative_date($a->profile['howlong'], t('for %1$d %2$s'));
}
if ($a->profile['sexual']) {
$profile['sexual'] = array(t('Sexual Preference:'), $a->profile['sexual']);
}
if ($a->profile['homepage']) {
$profile['homepage'] = array(t('Homepage:'), linkify($a->profile['homepage']));
}
if ($a->profile['hometown']) {
$profile['hometown'] = array(t('Hometown:'), linkify($a->profile['hometown']));
}
if ($a->profile['keywords']) {
$profile['keywords'] = array(t('Tags:'), $a->profile['keywords']);
}
if ($a->profile['politic']) {
$profile['politic'] = array(t('Political Views:'), $a->profile['politic']);
}
if ($a->profile['religion']) {
$profile['religion'] = array(t('Religion:'), $a->profile['religion']);
}
if ($txt = prepare_text($a->profile['about'])) {
$profile['about'] = array(t('About:'), $txt);
}
if ($txt = prepare_text($a->profile['interest'])) {
$profile['interest'] = array(t('Hobbies/Interests:'), $txt);
}
if ($txt = prepare_text($a->profile['likes'])) {
$profile['likes'] = array(t('Likes:'), $txt);
}
if ($txt = prepare_text($a->profile['dislikes'])) {
$profile['dislikes'] = array(t('Dislikes:'), $txt);
}
if ($txt = prepare_text($a->profile['contact'])) {
$profile['contact'] = array(t('Contact information and Social Networks:'), $txt);
}
if ($txt = prepare_text($a->profile['channels'])) {
$profile['channels'] = array(t('My other channels:'), $txt);
}
if ($txt = prepare_text($a->profile['music'])) {
$profile['music'] = array(t('Musical interests:'), $txt);
}
if ($txt = prepare_text($a->profile['book'])) {
$profile['book'] = array(t('Books, literature:'), $txt);
}
if ($txt = prepare_text($a->profile['tv'])) {
$profile['tv'] = array(t('Television:'), $txt);
}
if ($txt = prepare_text($a->profile['film'])) {
//.........这里部分代码省略.........
示例8: conversation
//.........这里部分代码省略.........
if ($sp) {
$sparkle = ' sparkle';
} else {
$profile_link = zid($profile_link);
}
$normalised = normalise_link(strlen($item['author-link']) ? $item['author-link'] : $item['url']);
$profile_name = $item['author']['xchan_name'];
$profile_link = $item['author']['xchan_url'];
$profile_avatar = $item['author']['xchan_photo_m'];
$location = format_location($item);
localize_item($item);
if ($mode === 'network-new') {
$dropping = true;
} else {
$dropping = false;
}
$drop = array('pagedropping' => $page_dropping, 'dropping' => $dropping, 'select' => t('Select'), 'delete' => t('Delete'));
$star = false;
$isstarred = "unstarred icon-star-empty";
$lock = $item['item_private'] || strlen($item['allow_cid']) || strlen($item['allow_gid']) || strlen($item['deny_cid']) || strlen($item['deny_gid']) ? t('Private Message') : false;
$likebuttons = false;
$shareable = false;
$verified = $item['item_flags'] & ITEM_VERIFIED ? t('Message signature validated') : '';
$forged = $item['sig'] && !($item['item_flags'] & ITEM_VERIFIED) ? t('Message signature incorrect') : '';
$unverified = '';
$tags = array();
$terms = get_terms_oftype($item['term'], array(TERM_HASHTAG, TERM_MENTION, TERM_UNKNOWN));
if (count($terms)) {
foreach ($terms as $tag) {
$tags[] = format_term_for_display($tag);
}
}
$body = prepare_body($item, true);
$tmp_item = array('template' => $tpl, 'toplevel' => 'toplevel_item', 'mode' => $mode, 'id' => $preview ? 'P0' : $item['item_id'], 'linktitle' => sprintf(t('View %s\'s profile @ %s'), $profile_name, $profile_url), 'profile_url' => $profile_link, 'item_photo_menu' => item_photo_menu($item), 'name' => $profile_name, 'sparkle' => $sparkle, 'lock' => $lock, 'thumb' => $profile_avatar, 'title' => $item['title'], 'body' => $body, 'tags' => $tags, 'hashtags' => $hashtags, 'mentions' => $mentions, 'verified' => $verified, 'unverified' => $unverified, 'forged' => $forged, 'txt_cats' => t('Categories:'), 'txt_folders' => t('Filed under:'), 'has_cats' => count($categories) ? 'true' : '', 'has_folders' => count($folders) ? 'true' : '', 'categories' => $categories, 'folders' => $folders, 'text' => strip_tags($body), 'ago' => relative_date($item['created']), 'app' => $item['app'], 'str_app' => sprintf(t(' from %s'), $item['app']), 'isotime' => datetime_convert('UTC', date_default_timezone_get(), $item['created'], 'c'), 'localtime' => datetime_convert('UTC', date_default_timezone_get(), $item['created'], 'r'), 'editedtime' => $item['edited'] != $item['created'] ? sprintf(t('last edited: %s'), datetime_convert('UTC', date_default_timezone_get(), $item['edited'], 'r')) : '', 'expiretime' => $item['expires'] !== NULL_DATE ? sprintf(t('Expires: %s'), datetime_convert('UTC', date_default_timezone_get(), $item['expires'], 'r')) : '', 'location' => $location, 'indent' => '', 'owner_name' => $owner_name, 'owner_url' => $owner_url, 'owner_photo' => $owner_photo, 'plink' => get_plink($item, false), 'edpost' => false, 'isstarred' => $isstarred, 'star' => $star, 'drop' => $drop, 'vote' => $likebuttons, 'like' => '', 'dislike' => '', 'comment' => '', 'conv' => $preview ? '' : array('href' => z_root() . '/display/' . $item['mid'], 'title' => t('View in context')), 'previewing' => $previewing, 'wait' => t('Please wait'), 'thread_level' => 1);
$arr = array('item' => $item, 'output' => $tmp_item);
call_hooks('display_item', $arr);
// $threads[$threadsid]['id'] = $item['item_id'];
$threads[] = $arr['output'];
}
} else {
// Normal View
// logger('conv: items: ' . print_r($items,true));
require_once 'include/ConversationObject.php';
require_once 'include/ItemObject.php';
$conv = new Conversation($mode, $preview, $prepared_item);
// In the display mode we don't have a profile owner.
if ($mode === 'display' && $items) {
$conv->set_profile_owner($items[0]['uid']);
}
// get all the topmost parents
// this shouldn't be needed, as we should have only them in our array
// But for now, this array respects the old style, just in case
$threads = array();
foreach ($items as $item) {
// Check for any blocked authors
if ($arr_blocked) {
$blocked = false;
foreach ($arr_blocked as $b) {
if ($b && $item['author_xchan'] == $b) {
$blocked = true;
break;
}
}
if ($blocked) {
continue;
}
示例9: bb_ShareAttributes
function bb_ShareAttributes($share, $simplehtml)
{
$attributes = $share[2];
$author = "";
preg_match("/author='(.*?)'/ism", $attributes, $matches);
if ($matches[1] != "") {
$author = html_entity_decode($matches[1], ENT_QUOTES, 'UTF-8');
}
preg_match('/author="(.*?)"/ism', $attributes, $matches);
if ($matches[1] != "") {
$author = $matches[1];
}
$profile = "";
preg_match("/profile='(.*?)'/ism", $attributes, $matches);
if ($matches[1] != "") {
$profile = $matches[1];
}
preg_match('/profile="(.*?)"/ism', $attributes, $matches);
if ($matches[1] != "") {
$profile = $matches[1];
}
$avatar = "";
preg_match("/avatar='(.*?)'/ism", $attributes, $matches);
if ($matches[1] != "") {
$avatar = $matches[1];
}
preg_match('/avatar="(.*?)"/ism', $attributes, $matches);
if ($matches[1] != "") {
$avatar = $matches[1];
}
$link = "";
preg_match("/link='(.*?)'/ism", $attributes, $matches);
if ($matches[1] != "") {
$link = $matches[1];
}
preg_match('/link="(.*?)"/ism', $attributes, $matches);
if ($matches[1] != "") {
$link = $matches[1];
}
$posted = "";
$itemcache = get_itemcachepath();
// relative dates only make sense when they aren't cached
if ($itemcache == "") {
preg_match("/posted='(.*?)'/ism", $attributes, $matches);
if ($matches[1] != "") {
$posted = $matches[1];
}
preg_match('/posted="(.*?)"/ism', $attributes, $matches);
if ($matches[1] != "") {
$posted = $matches[1];
}
$reldate = $posted ? " " . relative_date($posted) : '';
}
$userid = GetProfileUsername($profile, $author, false);
$userid_compact = GetProfileUsername($profile, $author, true);
$preshare = trim($share[1]);
if ($preshare != "") {
$preshare .= "<br /><br />";
}
switch ($simplehtml) {
case 1:
$text = $preshare . html_entity_decode("♲ ", ENT_QUOTES, 'UTF-8') . ' <a href="' . $profile . '">' . $userid . "</a>: <br />»" . $share[3] . "«";
break;
case 2:
$text = $preshare . html_entity_decode("♲ ", ENT_QUOTES, 'UTF-8') . ' ' . $userid_compact . ": <br />" . $share[3];
break;
case 3:
// Diaspora
$headline .= '<b>' . html_entity_decode("♲ ", ENT_QUOTES, 'UTF-8') . $userid . ':</b><br />';
$text = trim($share[1]);
if ($text != "") {
$text .= "<hr />";
}
if (substr(normalise_link($link), 0, 19) != "http://twitter.com/") {
$text .= $headline . '<blockquote>' . trim($share[3]) . "</blockquote><br />";
if ($link != "") {
$text .= '<br /><a href="' . $link . '">[l]</a>';
}
} else {
$text .= '<br /><a href="' . $link . '">' . $link . '</a>';
}
break;
case 4:
$headline = '<div class="shared_header">';
$headline .= '<span><b>' . html_entity_decode("♲ ", ENT_QUOTES, 'UTF-8');
$headline .= sprintf(t('<a href="%1$s" target="_blank">%2$s</a> %3$s'), $link, $userid, $posted);
$headline .= ":</b></span></div>";
$text = trim($share[1]);
if ($text != "") {
$text .= "<hr />";
}
$text .= $headline . '<blockquote class="shared_content">' . trim($share[3]) . "</blockquote><br />";
break;
case 5:
$text = $preshare . html_entity_decode("♲ ", ENT_QUOTES, 'UTF-8') . ' ' . $userid_compact . ": <br />" . $share[3];
break;
case 6:
// app.net
$text = $preshare . ">> @" . $userid_compact . ": <br />" . $share[3];
break;
//.........这里部分代码省略.........
示例10: _setup_users
function _setup_users($e)
{
$a = get_app();
$adminlist = explode(",", str_replace(" ", "", $a->config['admin_email']));
$accounts = array(t('Normal Account'), t('Soapbox Account'), t('Community/Celebrity Account'), t('Automatic Friend Account'));
$e['page-flags'] = $accounts[$e['page-flags']];
$e['register_date'] = relative_date($e['register_date']);
$e['login_date'] = relative_date($e['login_date']);
$e['lastitem_date'] = relative_date($e['lastitem_date']);
//$e['is_admin'] = ($e['email'] === $a->config['admin_email']);
$e['is_admin'] = in_array($e['email'], $adminlist);
$e['deleted'] = $e['account_removed'] ? relative_date($e['account_expires_on']) : False;
return $e;
}
示例11: ping_init
//.........这里部分代码省略.........
}
}
}
}
function xmlize($href, $name, $url, $photo, $date, $seen, $message)
{
require_once "mod/proxy.php";
$photo = proxy_url($photo);
$data = array('href' => &$href, 'name' => &$name, 'url' => &$url, 'photo' => &$photo, 'date' => &$date, 'seen' => &$seen, 'messsage' => &$message);
call_hooks('ping_xmlize', $data);
$notsxml = '<note href="%s" name="%s" url="%s" photo="%s" date="%s" seen="%s" >%s</note>';
return sprintf($notsxml, xmlify($href), xmlify($name), xmlify($url), xmlify($photo), xmlify($date), xmlify($seen), xmlify($message));
}
echo "<intro>{$intro}</intro>\n\t\t\t\t<mail>{$mail}</mail>\n\t\t\t\t<net>{$network}</net>\n\t\t\t\t<home>{$home}</home>\r\n";
if ($register != 0) {
echo "<register>{$register}</register>";
}
echo "<all-events>{$all_events}</all-events>\n\t\t\t<all-events-today>{$all_events_today}</all-events-today>\n\t\t\t<events>{$events}</events>\n\t\t\t<events-today>{$events_today}</events-today>\n\t\t\t<birthdays>{$birthdays}</birthdays>\n\t\t\t<birthdays-today>{$birthdays_today}</birthdays-today>\r\n";
$tot = $mail + $intro + $register + count($comments) + count($likes) + count($dislikes) + count($friends) + count($posts) + count($tags);
require_once 'include/bbcode.php';
if ($firehose) {
echo ' <notif count="' . $tot . '">';
} else {
if (count($z) && !$sysnotify) {
foreach ($z as $zz) {
if ($zz['seen'] == 0) {
$sysnotify++;
}
}
}
echo ' <notif count="' . $sysnotify . '">';
if (count($z)) {
foreach ($z as $zz) {
echo xmlize($a->get_baseurl() . '/notify/view/' . $zz['id'], $zz['name'], $zz['url'], $zz['photo'], relative_date($zz['date']), $zz['seen'] ? 'notify-seen' : 'notify-unseen', ($zz['seen'] ? '' : '→ ') . strip_tags(bbcode($zz['msg'])));
}
}
}
if ($firehose) {
if ($intro > 0) {
foreach ($intros as $i) {
echo xmlize($a->get_baseurl() . '/notifications/intros/' . $i['id'], $i['name'], $i['url'], $i['photo'], relative_date($i['datetime']), 'notify-unseen', t("{0} wants to be your friend"));
}
}
if ($mail > 0) {
foreach ($mails as $i) {
echo xmlize($a->get_baseurl() . '/message/' . $i['id'], $i['from-name'], $i['from-url'], $i['from-photo'], relative_date($i['created']), 'notify-unseen', t("{0} sent you a message"));
}
}
if ($register > 0) {
foreach ($regs as $i) {
echo xmlize($a->get_baseurl() . '/admin/users/', $i['name'], $i['url'], $i['micro'], relative_date($i['created']), 'notify-unseen', t("{0} requested registration"));
}
}
if (count($comments)) {
foreach ($comments as $i) {
echo xmlize($a->get_baseurl() . '/display/' . $a->user['nickname'] . "/" . $i['parent'], $i['author-name'], $i['author-link'], $i['author-avatar'], relative_date($i['created']), 'notify-unseen', sprintf(t("{0} commented %s's post"), $i['pname']));
}
}
if (count($likes)) {
foreach ($likes as $i) {
echo xmlize($a->get_baseurl() . '/display/' . $a->user['nickname'] . "/" . $i['parent'], $i['author-name'], $i['author-link'], $i['author-avatar'], relative_date($i['created']), 'notify-unseen', sprintf(t("{0} liked %s's post"), $i['pname']));
}
}
if (count($dislikes)) {
foreach ($dislikes as $i) {
echo xmlize($a->get_baseurl() . '/display/' . $a->user['nickname'] . "/" . $i['parent'], $i['author-name'], $i['author-link'], $i['author-avatar'], relative_date($i['created']), 'notify-unseen', sprintf(t("{0} disliked %s's post"), $i['pname']));
示例12: getPhotoLegacy
/**
* Get photo info and sizes
* @since Version 3.5
* @param int $photo_id
* @return array
*/
public function getPhotoLegacy($photo_id = false)
{
if (!$photo_id) {
throw new Exception("Cannot fetch photo info and sizes - no photo ID given");
return false;
}
$mckey = "railpage:railcam.photo.id=" . $photo_id;
#deleteMemcacheObject($mckey);
if ($return = getMemcacheObject($mckey)) {
$return['photo']['time_relative'] = relative_date($return['photo']['dateuploaded']);
return $return;
} else {
$use_rezzza = false;
if ($use_rezzza) {
$metadata = new Metadata(RP_FLICKR_API_KEY, RP_FLICKR_API_SECRET);
$metadata->setOauthAccess($this->flickr_oauth_token, $this->flickr_oauth_secret);
$factory = new ApiFactory($metadata, new GuzzleAdapter());
$photo_info = $factory->call('flickr.photos.getInfo', array('photo_id' => $photo_id));
if ($photo_info) {
$photo_sizes = $factory->call('flickr.photos.getSizes', array('photo_id' => $photo_id));
}
/**
* do stuff!
*/
if ($photo_info && $photo_sizes) {
$return = array();
/**
* Photo info
*/
foreach ($photo_info->photo->attributes() as $a => $b) {
$return['photo'][$a] = $b->__toString();
}
foreach ($photo_info->photo->children() as $element) {
foreach ($element->attributes() as $a => $b) {
$return['photo'][$element->getName()][$a] = $b->__toString();
}
foreach ($element->children() as $child) {
foreach ($child->attributes() as $a => $b) {
$return['photo'][$element->getName()][$child->getName()][$a] = $b->__toString();
}
foreach ($child->children() as $blah) {
$return['photo'][$element->getName()][$child->getName()][$blah->getName()][$a] = $b->__toString();
foreach ($blah->attributes() as $a => $b) {
$return['photo'][$element->getName()][$child->getName()][$blah->getName()][$a] = $b->__toString();
}
}
}
}
/**
* Photo sizes
*/
$i = 0;
foreach ($photo_sizes->sizes->size as $key => $element) {
foreach ($element->attributes() as $a => $b) {
$return['photo']['sizes'][$i][$a] = $b->__toString();
}
$i++;
}
}
return $return;
}
$f = new flickr_railpage(RP_FLICKR_API_KEY);
$f->oauth_token = $this->flickr_oauth_token;
$f->oauth_secret = $this->flickr_oauth_secret;
$f->cache = false;
$return = array();
if ($return = $f->photos_getInfo($photo_id)) {
$return['photo']['sizes'] = $f->photos_getSizes($photo_id);
$return['photo']['time_relative'] = relative_date($return['photo']['dateuploaded']);
setMemcacheObject($mckey, $return, strtotime("+2 hours"));
}
return $return;
}
}
示例13: bb_ShareAttributes
function bb_ShareAttributes($match)
{
$attributes = $match[1];
$author = "";
preg_match("/author='(.*?)'/ism", $attributes, $matches);
if ($matches[1] != "") {
$author = html_entity_decode($matches[1], ENT_QUOTES, 'UTF-8');
}
preg_match('/author="(.*?)"/ism', $attributes, $matches);
if ($matches[1] != "") {
$author = $matches[1];
}
$link = "";
preg_match("/link='(.*?)'/ism", $attributes, $matches);
if ($matches[1] != "") {
$link = $matches[1];
}
preg_match('/link="(.*?)"/ism', $attributes, $matches);
if ($matches[1] != "") {
$link = $matches[1];
}
$avatar = "";
preg_match("/avatar='(.*?)'/ism", $attributes, $matches);
if ($matches[1] != "") {
$avatar = $matches[1];
}
preg_match('/avatar="(.*?)"/ism', $attributes, $matches);
if ($matches[1] != "") {
$avatar = $matches[1];
}
$profile = "";
preg_match("/profile='(.*?)'/ism", $attributes, $matches);
if ($matches[1] != "") {
$profile = $matches[1];
}
preg_match('/profile="(.*?)"/ism', $attributes, $matches);
if ($matches[1] != "") {
$profile = $matches[1];
}
$posted = "";
preg_match("/posted='(.*?)'/ism", $attributes, $matches);
if ($matches[1] != "") {
$posted = $matches[1];
}
preg_match('/posted="(.*?)"/ism', $attributes, $matches);
if ($matches[1] != "") {
$posted = $matches[1];
}
$reldate = $posted ? " " . relative_date($posted) : '';
$headline = '<div class="shared_header">';
if ($avatar != "") {
$headline .= '<img src="' . $avatar . '" height="32" width="32" >';
}
$headline .= sprintf(t('<span><a href="%s" target="external-link">%s</a> wrote the following <a href="%s" target="external-link">post</a>' . $reldate . ':</span>'), $profile, $author, $link);
$headline .= "</div>";
$text = $headline . '<blockquote class="shared_content">' . trim($match[2]) . "</blockquote>";
return $text;
}
示例14: admin_page_users
/**
* @param App $a
* @return string
*/
function admin_page_users(&$a)
{
if ($a->argc > 2) {
$uid = $a->argv[3];
$user = q("SELECT username, blocked FROM `user` WHERE `uid`=%d", intval($uid));
if (count($user) == 0) {
notice('User not found' . EOL);
goaway($a->get_baseurl(true) . '/admin/users');
return '';
// NOTREACHED
}
switch ($a->argv[2]) {
case "delete":
check_form_security_token_redirectOnErr('/admin/users', 'admin_users', 't');
// delete user
require_once "include/Contact.php";
user_remove($uid);
notice(sprintf(t("User '%s' deleted"), $user[0]['username']) . EOL);
break;
case "block":
check_form_security_token_redirectOnErr('/admin/users', 'admin_users', 't');
q("UPDATE `user` SET `blocked`=%d WHERE `uid`=%s", intval(1 - $user[0]['blocked']), intval($uid));
notice(sprintf($user[0]['blocked'] ? t("User '%s' unblocked") : t("User '%s' blocked"), $user[0]['username']) . EOL);
break;
}
goaway($a->get_baseurl(true) . '/admin/users');
return '';
// NOTREACHED
}
/* get pending */
$pending = q("SELECT `register`.*, `contact`.`name`, `user`.`email`\n\t\t\t\t FROM `register`\n\t\t\t\t LEFT JOIN `contact` ON `register`.`uid` = `contact`.`uid`\n\t\t\t\t LEFT JOIN `user` ON `register`.`uid` = `user`.`uid`;");
/* get users */
$total = q("SELECT count(*) as total FROM `user` where 1");
if (count($total)) {
$a->set_pager_total($total[0]['total']);
$a->set_pager_itemspage(100);
}
$users = q("SELECT `user` . * , `contact`.`name` , `contact`.`url` , `contact`.`micro`, `lastitem`.`lastitem_date`, `user`.`account_expired`\n\t\t\t\tFROM\n\t\t\t\t\t(SELECT MAX(`item`.`changed`) as `lastitem_date`, `item`.`uid`\n\t\t\t\t\tFROM `item`\n\t\t\t\t\tWHERE `item`.`type` = 'wall'\n\t\t\t\t\tGROUP BY `item`.`uid`) AS `lastitem`\n\t\t\t\t\t\t RIGHT OUTER JOIN `user` ON `user`.`uid` = `lastitem`.`uid`,\n\t\t\t\t\t `contact`\n\t\t\t\tWHERE\n\t\t\t\t\t `user`.`uid` = `contact`.`uid`\n\t\t\t\t\t\tAND `user`.`verified` =1\n\t\t\t\t\tAND `contact`.`self` =1\n\t\t\t\tORDER BY `contact`.`name` LIMIT %d, %d\n\t\t\t\t", intval($a->pager['start']), intval($a->pager['itemspage']));
$adminlist = explode(",", str_replace(" ", "", $a->config['admin_email']));
$_setup_users = function ($e) use($adminlist) {
$accounts = array(t('Normal Account'), t('Soapbox Account'), t('Community/Celebrity Account'), t('Automatic Friend Account'));
$e['page-flags'] = $accounts[$e['page-flags']];
$e['register_date'] = relative_date($e['register_date']);
$e['login_date'] = relative_date($e['login_date']);
$e['lastitem_date'] = relative_date($e['lastitem_date']);
//$e['is_admin'] = ($e['email'] === $a->config['admin_email']);
$e['is_admin'] = in_array($e['email'], $adminlist);
$e['is_deletable'] = intval($e['uid']) != local_user();
$e['deleted'] = $e['account_removed'] ? relative_date($e['account_expires_on']) : False;
return $e;
};
$users = array_map($_setup_users, $users);
// Get rid of dashes in key names, Smarty3 can't handle them
// and extracting deleted users
$tmp_users = array();
$deleted = array();
while (count($users)) {
$new_user = array();
foreach (array_pop($users) as $k => $v) {
$k = str_replace('-', '_', $k);
$new_user[$k] = $v;
}
if ($new_user['deleted']) {
array_push($deleted, $new_user);
} else {
array_push($tmp_users, $new_user);
}
}
//Reversing the two array, and moving $tmp_users to $users
array_reverse($deleted);
while (count($tmp_users)) {
array_push($users, array_pop($tmp_users));
}
$t = get_markup_template("admin_users.tpl");
$o = replace_macros($t, array('$title' => t('Administration'), '$page' => t('Users'), '$submit' => t('Add User'), '$select_all' => t('select all'), '$h_pending' => t('User registrations waiting for confirm'), '$h_deleted' => t('User waiting for permanent deletion'), '$th_pending' => array(t('Request date'), t('Name'), t('Email')), '$no_pending' => t('No registrations.'), '$approve' => t('Approve'), '$deny' => t('Deny'), '$delete' => t('Delete'), '$block' => t('Block'), '$unblock' => t('Unblock'), '$siteadmin' => t('Site admin'), '$accountexpired' => t('Account expired'), '$h_users' => t('Users'), '$h_newuser' => t('New User'), '$th_deleted' => array(t('Name'), t('Email'), t('Register date'), t('Last login'), t('Last item'), t('Deleted since')), '$th_users' => array(t('Name'), t('Email'), t('Register date'), t('Last login'), t('Last item'), t('Account')), '$confirm_delete_multi' => t('Selected users will be deleted!\\n\\nEverything these users had posted on this site will be permanently deleted!\\n\\nAre you sure?'), '$confirm_delete' => t('The user {0} will be deleted!\\n\\nEverything this user has posted on this site will be permanently deleted!\\n\\nAre you sure?'), '$form_security_token' => get_form_security_token("admin_users"), '$baseurl' => $a->get_baseurl(true), '$pending' => $pending, 'deleted' => $deleted, '$users' => $users, '$newusername' => array('new_user_name', t("Name"), '', t("Name of the new user.")), '$newusernickname' => array('new_user_nickname', t("Nickname"), '', t("Nickname of the new user.")), '$newuseremail' => array('new_user_email', t("Email"), '', t("Email address of the new user."), '', '', 'email')));
$o .= paginate($a);
return $o;
}
示例15: count
// this combines all the edits into a single object for each post
// also formats the edits a bit
$count = count($posts);
for ($i = 0; $i < $count; $i++) {
$posts[$i]->postcount = get_string('postsvariable', 'interaction.forum', $posts[$i]->postcount);
$posts[$i]->canedit = $posts[$i]->parent && ($moderator || user_can_edit_post($posts[$i]->poster, $posts[$i]->ctime));
$posts[$i]->ctime = relative_date(get_string('strftimerecentfullrelative', 'interaction.forum'), get_string('strftimerecentfull'), $posts[$i]->ctime);
$postedits = array();
if ($posts[$i]->editor) {
$postedits[] = array('editor' => $posts[$i]->editor, 'edittime' => relative_date(get_string('strftimerecentfullrelative', 'interaction.forum'), get_string('strftimerecentfull'), $posts[$i]->edittime), 'moderator' => $posts[$i]->editormoderator);
}
$temp = $i;
while (isset($posts[$i + 1]) && $posts[$i + 1]->id == $posts[$temp]->id) {
// while the next object is the same post
$i++;
$postedits[] = array('editor' => $posts[$i]->editor, 'edittime' => relative_date(get_string('strftimerecentfullrelative', 'interaction.forum'), get_string('strftimerecentfull'), $posts[$i]->edittime), 'moderator' => $posts[$i]->editormoderator);
unset($posts[$i]);
}
$posts[$temp]->edit = $postedits;
}
// builds the first post (with index 0) which has as children all the posts in the topic
$posts = buildpost(0, '', $posts);
$smarty = smarty();
$smarty->assign('breadcrumbs', $breadcrumbs);
$smarty->assign('heading', $topic->groupname);
$smarty->assign('subheading', TITLE);
$smarty->assign('topic', $topic);
$smarty->assign('membership', $membership);
$smarty->assign('moderator', $moderator);
$smarty->assign('posts', $posts);
$smarty->display('interaction:forum:topic.tpl');