当前位置: 首页>>代码示例>>PHP>>正文


PHP friendly_time函数代码示例

本文整理汇总了PHP中friendly_time函数的典型用法代码示例。如果您正苦于以下问题:PHP friendly_time函数的具体用法?PHP friendly_time怎么用?PHP friendly_time使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了friendly_time函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: elgg_echo

<?php

/**
 * Display latest comments on objects
 **/
if ($vars['comments']) {
    global $CONFIG;
    echo "<h3>" . elgg_echo('generic_comments:latest') . "</h3>";
    foreach ($vars['comments'] as $comment) {
        //grab the entity the comment is on
        $entity = get_entity($comment->entity_guid);
        //comment owner
        $comment_owner = get_user($comment->owner_guid);
        $friendlytime = friendly_time($comment->time_created);
        // get timestamp for comment
        //set the title
        if ($entity->title) {
            $objecttitle = $entity->title;
        } else {
            $objecttitle = elgg_echo('file:untitled');
        }
        //if the entity has been deleted, don't link to it
        if ($entity) {
            $url = $entity->getURL();
            // get url to file for comment link
            $url_display = "<a href=\"{$url}\">{$objecttitle}</a>";
        } else {
            $url_display = $objecttitle;
        }
        echo "<div class='generic_comment latest clearfloat'><span class='generic_comment_icon'>" . elgg_view("profile/icon", array('entity' => $comment_owner, 'size' => 'tiny')) . "</span>";
        echo "<div class='generic_comment_details'><span class='entity_subtext'><a href=\"{$vars['url']}pg/profile/{$comment_owner->username}\">{$comment_owner->name}</a> " . elgg_echo('on') . " <span class='entity_title'>{$url_display}</span> ({$friendlytime})</span></div>";
开发者ID:adamboardman,项目名称:Elgg,代码行数:31,代码来源:latest_comments.php

示例2: get_entities

	<?php 
//get the num of shares the user want to display
$num = $vars['entity']->num_display;
//if no number has been set, default to 4
if (!$num) {
    $num = 4;
}
//grab the users tasked items
$shares = get_entities('object', 'tasks', 0, "", $num, 0, false);
if ($shares) {
    foreach ($shares as $s) {
        //get the owner
        $owner = $s->getOwnerEntity();
        //get the time
        $friendlytime = friendly_time($s->time_created);
        //get the user icon
        $icon = elgg_view("profile/icon", array('entity' => $owner, 'size' => 'tiny'));
        //get the task title
        $info = "<p class=\"shares_title\"><a href=\"{$s->getURL()}\">{$s->title}</a></p>";
        //get the user details
        $info .= "<p class=\"shares_timestamp\"><small><a href=\"{$owner->getURL()}\">{$owner->name}</a> {$friendlytime}</small></p>";
        //get the task description
        if ($s->description) {
            $info .= "<a href=\"javascript:void(0);\" class=\"share_more_info\">" . elgg_echo('tasks:more') . "</a><br /><div class=\"share_desc\"><p>{$s->description}</p></div>";
        }
        //display
        echo "<div class=\"shares_widget_wrapper\">";
        echo "<div class=\"shares_widget_icon\">" . $icon . "</div>";
        echo "<div class=\"shares_widget_content\">" . $info . "</div>";
        echo "</div>";
开发者ID:eokyere,项目名称:elgg,代码行数:30,代码来源:view.php

示例3: friendly_time

	<div class="river_<?php 
echo $subtype;
?>
">
		<div class="river_<?php 
echo $event;
?>
">
			<p class="river_<?php 
echo $subtype;
?>
_<?php 
echo $event;
?>
">
				<?php 
echo $vars['entry'];
?>
				<span class="river_item_time">
					(<?php 
echo friendly_time($time);
?>
)
				</span>
			</p>
		</div>
	</div>

</div>
开发者ID:portokallidis,项目名称:Metamorphosis-Meducator,代码行数:29,代码来源:wrapper.php

示例4: sprintf

    $info = "<p class=\"latest_discussion_info\">" . sprintf(elgg_echo('dgroup:created'), $forum_created, $counter) . "<br /><span class=\"timestamp\">";
    if ($last_time) {
        $info .= sprintf(elgg_echo('dgroups:lastupdated'), friendly_time($last_time), " <a href=\"" . $u->getURL() . "\">" . $u->name . "</a>");
    }
    $info .= '</span></p>';
    //get the dgroup avatar
    $icon = elgg_view("profile/icon", array('entity' => $dgroup, 'size' => 'small'));
    //get the dgroup and topic title
    if ($dgroup instanceof ElggGroup) {
        $info .= "<p>" . elgg_echo('dgroup') . ": <a href=\"{$dgroup->getURL()}\">{$dgroup->name}</a></p>";
    }
    $info .= "<p>" . elgg_echo('topic') . ": <a href=\"{$vars['url']}mod/dgroups/topicposts.php?topic={$vars['entity']->guid}&dgroup_guid={$dgroup->guid}\">{$title}</a></p>";
    //get the forum description
    //$info .= $description;
} else {
    $info = "<span class=\"latest_discussion_info\"><span class=\"timestamp\">" . sprintf(elgg_echo('dgroup:created'), $forum_created, $counter) . "</span>";
    if ($last_time) {
        $info .= "<br /><span class='timestamp'>" . elgg_echo('dgroups:updated') . " " . friendly_time($last_time) . " by <a href=\"" . $u->getURL() . "\">" . $u->name . "</a></span>";
    }
    if (dgroups_can_edit_discussion($vars['entity'], page_owner_entity()->owner_guid)) {
        // display the delete link to those allowed to delete
        $info .= "<br /><span class=\"delete_discussion\">" . elgg_view("output/confirmlink", array('href' => $vars['url'] . "action/dgroups/deletetopic?topic=" . $vars['entity']->guid . "&dgroup=" . $vars['entity']->container_guid, 'text' => " ", 'confirm' => elgg_echo('deleteconfirm'))) . "</span>";
    }
    $info .= "</span>";
    //get the user avatar
    $icon = elgg_view("profile/icon", array('entity' => $topic_owner, 'size' => 'small'));
    $info .= "<p>" . elgg_echo('dgroups:started') . " " . $topic_owner->name . ": <a href=\"{$vars['url']}mod/dgroups/topicposts.php?topic={$vars['entity']->guid}&dgroup_guid={$dgroup->guid}\">{$title}</a></p>";
    $info .= "<div class='clearfloat'></div>";
}
//display
echo elgg_view_listing($icon, $info);
开发者ID:eokyere,项目名称:elgg,代码行数:31,代码来源:dgroupforumtopic.php

示例5: elgg_view

            if ($counter == 1 && $comment_count >= 4 || $counter == 0 && $comment_count == 2 || $counter == 1 && $comment_count == 3) {
                $alt = 'penultimate';
            }
        }
        //display comment
        echo "<div class='river_comment {$alt} clearfloat'>";
        echo "<span class='river_comment_owner_icon'>";
        echo elgg_view("profile/icon", array('entity' => $comment_owner, 'size' => 'tiny'));
        echo "</span>";
        //truncate comment to 150 characters
        if (strlen($gc->value) > 150) {
            $gc->value = substr($gc->value, 0, strpos($gc->value, ' ', 150)) . "...";
        }
        $contents = strip_tags($gc->value);
        echo "<div class='river_comment_contents'>";
        echo "<a href=\"{$comment_owner_url}\">" . $comment_owner->name . "</a> " . parse_urls($contents);
        echo "<span class='entity_subtext'>" . friendly_time($gc->time_created) . "</span>";
        echo "</div></div>";
        $counter++;
    }
    echo "</div>";
}
//display the comment link
if ($vars['item']->type != 'user') {
    //for now don't display the comment link on bookmarks and wire messages
    if ($vars['item']->subtype != 'thewire' && $vars['item']->subtype != 'conversations' && $vars['item']->subtype != 'bookmarks' && $vars['item']->subtype != '') {
        echo "<a class='comment_link' href=\"{$object_url}\">Comment</a>";
    }
}
?>
</div>
开发者ID:adamboardman,项目名称:Elgg,代码行数:31,代码来源:wrapper.php

示例6: foreach

     }
     //end of for each loop
 }
 //end of inbox if statement
 // get the correct display for the sentbox view
 if ($vars['page_view'] == "sent") {
     $counter = 0;
     foreach ($vars['entity'] as $message) {
         //make sure to only display the messages that have not been 'deleted' (1 = deleted)
         if ($message->hiddenTo != 1) {
             //get the correct user entity
             $user = get_entity($message->toId);
             echo "<div class=\"message_sent\" />";
             echo "<table width=\"100%\" cellspacing='0'><tr>";
             //get the icon for the user the message was sent to
             echo "<tr><td width='200px'>" . elgg_view("profile/icon", array('entity' => $user, 'size' => 'tiny')) . "<div class='msgsender'><b>" . $user->name . "</b><br /><small>" . friendly_time($message->time_created) . "</small></div></td>";
             //display the message title
             echo "<td><div class='msgsubject'>";
             echo "<input type=\"checkbox\" name=\"message_id[]\" value=\"{$message->guid}\" /> ";
             echo "<a href=\"{$message->getURL()}?type=sent\">" . $message->title . "</a></div></td>";
             //display the link to 'delete'
             echo "<td width='70px'>";
             echo "<div class='delete_msg'>" . elgg_view("output/confirmlink", array('href' => $vars['url'] . "action/messages/delete?message_id=" . $message->getGUID() . "&type=sent&submit=" . urlencode(elgg_echo('delete')), 'text' => elgg_echo('delete'), 'confirm' => elgg_echo('deleteconfirm'))) . "</div>";
             echo "</td></tr></table></div>";
         }
         //close hiddeTo if statement
         $counter++;
         if ($counter == $limit) {
             break;
         }
     }
开发者ID:ashwiniravi,项目名称:Elgg-Social-Network-Single-Sign-on-and-Web-Statistics,代码行数:31,代码来源:view.php

示例7: get_entities

<?php

/**
 * New wire post view for the activity stream
 */
$owner = $vars['entity']->guid;
$url_to_wire = $vars['url'] . "pg/thewire/" . $vars['entity']->username;
//grab the users latest from the wire
$latest_wire = get_entities("object", "thewire", $owner, "", 1, 0, false, 0, null);
if ($latest_wire) {
    foreach ($latest_wire as $lw) {
        $content = $lw->description;
        $time = "<span> (" . friendly_time($lw->time_created) . ")</span>";
    }
}
if ($latest_wire) {
    echo "<div class=\"profile_status\">";
    echo $content;
    if ($owner == $_SESSION['user']->guid) {
        echo " <a class=\"status_update\" href=\"{$url_to_wire}\">update</a>";
    }
    echo $time;
    echo "</div>";
}
开发者ID:eokyere,项目名称:elgg,代码行数:24,代码来源:profile_status.php

示例8: elgg_view

 */
?>

<div class="messageboard"><!-- start of messageboard div -->
	
    <!-- display the user icon of the user that posted the message -->
    <div class="message_sender">	        
        <?php 
echo elgg_view("profile/icon", array('entity' => get_entity($vars['annotation']->owner_guid), 'size' => 'tiny'));
?>
    </div>
    
    <!-- display the user's name who posted and the date/time -->
    <p class="message_item_timestamp">
        <?php 
echo get_entity($vars['annotation']->owner_guid)->name . " " . friendly_time($vars['annotation']->time_created);
?>
    </p>
    		
	<!-- output the actual comment -->
	<div class="message"><?php 
echo elgg_view("output/longtext", array("value" => parse_urls($vars['annotation']->value)));
?>
</div>
	<div class="message_buttons">
		    
	<?php 
// if the user looking at the comment can edit, show the delete link
if (issuperadminloggedin() || $vars['user']->guid == $vars['annotation']->owner_guid) {
    echo "<div class='delete_message'>" . elgg_view("output/confirmlink", array('href' => $vars['url'] . "action/messageboard/delete?annotation_id=" . $vars['annotation']->id, 'text' => elgg_echo('delete'), 'confirm' => elgg_echo('deleteconfirm'))) . "</div>";
}
开发者ID:portokallidis,项目名称:Metamorphosis-Meducator,代码行数:31,代码来源:messageboard_content.php

示例9: foreach

     }
     //end of for each loop
 }
 //end of inbox if statement
 // get the correct display for the sentbox view
 if ($vars['page_view'] == "sent") {
     $counter = 0;
     foreach ($vars['entity'] as $message) {
         //make sure to only display the messages that have not been 'deleted' (1 = deleted)
         if ($message->hiddenTo != 1) {
             //get the correct user entity
             $user = get_entity($message->toId);
             echo "<div class='message sent clearfloat'>";
             //get the icon for the user the message was sent to
             echo "<div class='entity_listing_icon'>" . elgg_view("profile/icon", array('entity' => $user, 'size' => 'tiny')) . "</div>";
             echo "<div class='entity_listing_info'><div class='message_sender'>" . $_SESSION['user']->name . "<p class='entity_subtext'>" . friendly_time($message->time_created) . "</p></div>";
             // display message subject
             echo "<div class='message_subject'>";
             //display the link to 'delete'
             echo "<div class='delete_button'>" . elgg_view("output/confirmlink", array('href' => $vars['url'] . "action/messages/delete?message_id=" . $message->getGUID() . "&type=sent&submit=" . urlencode(elgg_echo('delete')), 'text' => elgg_echo('delete'), 'confirm' => elgg_echo('deleteconfirm'))) . "</div>";
             echo "<p class='entity_title'><input type='checkbox' name=\"message_id[]\" value=\"{$message->guid}\" /> ";
             echo "<a href=\"{$message->getURL()}?type=sent\">" . $message->title . "</a></p>";
             echo "</div></div></div>";
             // close the message container
         }
         //close hiddeTo if statement
         $counter++;
         if ($counter == $limit) {
             break;
         }
     }
开发者ID:adamboardman,项目名称:Elgg,代码行数:31,代码来源:view.php

示例10: dirname

<?php

require_once dirname(dirname(__FILE__)) . "/engine/start.php";
require_once '../../jpgraph-3.0.7/src/jpgraph.php';
require_once '../../jpgraph-3.0.7/src/jpgraph_bar.php';
$guid = $page_owner->guid;
$myid = get_loggedin_user()->getGUID();
$message_count = get_entities_from_metadata("toId", get_loggedin_user()->getGUID(), "object", "messages", $guid, 1000);
//print_r($message_count);
$cnt = count($message_count);
//print $cnt;
$i = 0;
$day = "";
foreach ($message_count as $value) {
    //print $messages->title;
    $time_created = friendly_time($value->time_created);
    $time_created = explode(" ", $time_created);
    $day = substr($time_created[1], 7) . '-' . $time_created[2] . '-' . $time_created[3];
    if ($count_msgs[$day]) {
        $count_msgs[$day]->day = $day;
        $count_msgs[$day]->count++;
    } else {
        $count_msgs[$day]->day = $day;
        $count_msgs[$day]->count = 1;
    }
}
$days = array();
$counts = array();
foreach ($count_msgs as $rows) {
    array_push($days, $rows->day);
    array_push($counts, $rows->count);
开发者ID:ashwiniravi,项目名称:Elgg-Social-Network-Single-Sign-on-and-Web-Statistics,代码行数:31,代码来源:stats_inbox_graph.php

示例11: elgg_view

    if ($vars['entity']->canEdit()) {
        echo "<div class='delete_note'>" . elgg_view("output/confirmlink", array('href' => $vars['url'] . "action/thewire/delete?thewirepost=" . $vars['entity']->getGUID(), 'text' => elgg_echo('delete'), 'confirm' => elgg_echo('deleteconfirm'))) . "</div>";
    }
    //end of can edit if statement
    ?>
	    </div>
	    
		
		<?php 
    echo "<b>{$user_name}: </b>";
    $desc = $vars['entity']->description;
    $desc = preg_replace('/\\@([A-Za-z0-9\\_\\.\\-]*)/i', '@<a href="' . $vars['url'] . 'pg/thewire/$1">$1</a>', $desc);
    echo parse_urls($desc);
    ?>
		
		
		<div class="clearfloat"></div>
		</div>
		<div class="note_date">
		
		<?php 
    echo elgg_echo("thewire:wired") . " " . sprintf(elgg_echo("thewire:strapline"), friendly_time($vars['entity']->time_created));
    echo " via " . elgg_echo($vars['entity']->method) . ".";
    ?>
		</div>
		
		
	</div>
</div>
<?php 
}
开发者ID:ashwiniravi,项目名称:Elgg-Social-Network-Single-Sign-on-and-Web-Statistics,代码行数:31,代码来源:thewire.php

示例12: get_entity

<?php

/**
 * Elgg bookmark river entry view
 * 
 * @package ElggBookmarks
 * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
 * @author Curverider <info@elgg.com>
 * @copyright Curverider Ltd 2008-2010
 * @link http://elgg.org/
 */
$performed_by = get_entity($vars['item']->subject_guid);
// $statement->getSubject();
$object = get_entity($vars['item']->object_guid);
$url = $object->getURL();
$url = "<a href=\"{$performed_by->getURL()}\">{$performed_by->name}</a>";
$string = sprintf(elgg_echo("bookmarks:river:created"), $url) . " ";
$string .= "<a href=\"" . $object->address . "\">" . $object->title . "</a> <span class='entity_subtext'>" . friendly_time($object->time_updated) . "</span>";
echo $string;
开发者ID:adamboardman,项目名称:Elgg,代码行数:19,代码来源:create.php

示例13: get_entity

<?php

$performed_by = get_entity($vars['item']->subject_guid);
// $statement->getSubject();
$object = get_entity($vars['item']->object_guid);
$url = $object->getURL();
$string = "<a href=\"{$performed_by->getURL()}\">{$performed_by->name}:</a> ";
$desc .= $object->description;
$desc = preg_replace('/\\@([A-Za-z0-9\\_\\.\\-]*)/i', '@<a href="' . $vars['url'] . 'pg/thewire/$1">$1</a>', $desc);
$string .= parse_urls($desc);
$string .= " <span class='entity_subtext'>" . friendly_time($object->time_created) . "</span> <a href=\"{$vars['url']}mod/thewire/add.php?wire_username={$object->getOwnerEntity()->username}\" class='reply_link'>" . elgg_echo('thewire:reply') . "</a>";
?>

<?php 
echo $string;
开发者ID:adamboardman,项目名称:Elgg,代码行数:15,代码来源:create.php

示例14: isset

 * @link http://elgg.org/
 */
$full = isset($vars['full']) ? $vars['full'] : FALSE;
$blog = isset($vars['entity']) ? $vars['entity'] : FALSE;
if (!$blog) {
    return '';
}
$owner = get_entity($blog->owner_guid);
$container = get_entity($blog->container_guid);
$linked_title = "<a href=\"{$blog->getURL()}\" title=\"" . htmlentities($blog->title) . "\">{$blog->title}</a>";
$categories = elgg_view('categories/view', $vars);
$excerpt = $blog->excerpt;
$body = $blog->description;
$owner_icon = elgg_view("profile/icon", array('entity' => $owner, 'size' => 'tiny'));
$tags = elgg_view('output/tags', array('tags' => $blog->tags));
$date = friendly_time($blog->publish_date);
// The "on" status changes for comments, so best to check for !Off
if ($blog->comments_on != 'Off') {
    $comments_count = elgg_count_comments($blog);
    $comments_link = "<a href=\"{$blog->getURL()}#annotations\">" . sprintf(elgg_echo("comments"), $comments_count) . '</a>';
} else {
    $comments_link = '';
}
// links to delete or edit.
$edit = '';
if ($blog->canEdit()) {
    $edit_url = "{$vars['url']}pg/blog/{$owner->username}/edit/{$blog->getGUID()}/";
    $edit_link = "<a href=\"{$edit_url}\">" . elgg_echo('edit') . '</a>';
    $delete_url = "{$vars['url']}action/blog/delete?guid={$blog->getGUID()}";
    $delete_link = "<span class='delete_button'>" . elgg_view('output/confirmlink', array('href' => $delete_url, 'text' => elgg_echo('delete'), 'confirm' => elgg_echo('deleteconfirm'))) . "</span>";
    $status = '';
开发者ID:adamboardman,项目名称:Elgg,代码行数:31,代码来源:blog.php

示例15: elgg_view

		<div class="generic_comment_details">
    		
		    <!-- output the actual comment -->
		    <?php 
echo elgg_view("output/longtext", array("value" => $vars['annotation']->value));
?>
		    
		    <p class="generic_comment_owner">
    	        <a href="<?php 
echo $owner->getURL();
?>
"><?php 
echo $owner->name;
?>
</a> <?php 
echo friendly_time($vars['annotation']->time_created);
?>
    		</p>
		    
		    <?php 
// if the user looking at the comment can edit, show the delete link
if ($vars['annotation']->canEdit()) {
    ?>
		    <p>
		        <?php 
    echo elgg_view("output/confirmlink", array('href' => $vars['url'] . "action/comments/delete?annotation_id=" . $vars['annotation']->id, 'text' => elgg_echo('delete'), 'confirm' => elgg_echo('deleteconfirm')));
    ?>
		    </p>
		
            <?php 
}
开发者ID:portokallidis,项目名称:Metamorphosis-Meducator,代码行数:31,代码来源:generic_comment.php


注:本文中的friendly_time函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。