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


PHP relativeTime函数代码示例

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


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

示例1: timestamp

function timestamp($date, $override = TRUE)
{
    $return = "<span class='time' data-toggle='tooltip' title='" . date(DATE_FORMAT, strtotime($date)) . "'>";
    if ($override) {
        $return .= date(DATE_FORMAT, strtotime($date));
    } else {
        $return .= relativeTime($date);
    }
    $return .= "</span>";
    return $return;
}
开发者ID:Flashpoint-Artists-Initiative,项目名称:scanner,代码行数:11,代码来源:functions.php

示例2: formatTweet

function formatTweet($tweet, $dt)
{
    //strtotime()函数将任何英文文本的日期时间描述解析为unix时间戳
    if (is_string($dt)) {
        $dt = strtotime($dt);
    }
    //stripslashes()函数删除由addslashes()函数添加的反斜杠,该函数可用于清理从数据库或html表单中获取的数据,该函数返回已删除反斜杠的字符串
    $tweet = htmlspecialchars(stripslashes($tweet));
    //htmlspecialchars()函数把预定义的字符转换为html实体
    return '
	<li>
	<a href="#"><img class="avatar" src="img/avatar.jpg" width="48" height="48" alt="avatar" /></a>
	<div class="tweetTxt">
	<strong><a href="#">demo</a></strong> ' . preg_replace('/((?:http|https|ftp):\\/\\/(?:[A-Z0-9][A-Z0-9_-]*(?:\\.[A-Z0-9][A-Z0-9_-]*)+):?(\\d+)?\\/?[^\\s\\"\']+)/i', '<a href="$1" rel="nofollow" target="blank">$1</a>', $tweet) . '
	<div class="date">' . relativeTime($dt) . '</div>
	</div>
	<div class="clear"></div>
	</li>';
}
开发者ID:msuli,项目名称:TwitterTimeline,代码行数:19,代码来源:functions.php

示例3: T

        echo "<span class='label label-{$label}'>" . T("label.{$label}") . "</span> ";
    }
}
echo "</span> ";
// Output controls which apply to this conversation.
echo "<span class='controls'>";
// If we're highlighting search terms (i.e. if we did a fulltext search), then output a "show matching posts" link.
if (ET::$session->get("highlight")) {
    echo " <a href='" . URL($conversationURL . "/?search=" . urlencode($data["fulltextString"])) . "' class='showMatchingPosts'>" . T("Show matching posts") . "</a>";
}
echo "</span>";
?>
</div>
<div class='col-channel'><?php 
$channel = $data["channelInfo"][$conversation["channelId"]];
echo "<a href='" . URL(searchURL("", $channel["slug"])) . "' class='channel channel-{$conversation["channelId"]}' data-channel='{$channel["slug"]}'>{$channel["title"]}</a>";
?>
</div>
<div class='col-replies'><?php 
echo "<span>" . Ts("%s reply", "%s replies", $conversation["replies"]) . "</span>";
// Output an "unread indicator", showing the number of unread posts.
if (ET::$session->user and $conversation["unread"]) {
    echo " <a href='" . URL("conversation/markAsRead/" . $conversation["conversationId"] . "?token=" . ET::$session->token . "&return=" . urlencode(ET::$controller->selfURL)) . "' class='unreadIndicator' title='" . T("Mark as read") . "'>" . $conversation["unread"] . " new</a> ";
}
?>
</div>
<div class='col-lastPost'><?php 
echo "<span class='action'>" . avatar(array("memberId" => $conversation["lastPostMemberId"], "avatarFormat" => $conversation["lastPostMemberAvatarFormat"], "email" => $conversation["lastPostMemberEmail"]), "thumb"), " ", sprintf(T("%s posted %s"), "<span class='lastPostMember name'>" . memberLink($conversation["lastPostMemberId"], $conversation["lastPostMember"]) . "</span>", "<a href='" . URL($conversationURL . "/unread") . "' class='lastPostTime'>" . relativeTime($conversation["lastPostTime"], true) . "</a>"), "</span>";
?>
</div>
</li>
开发者ID:AlexandrST,项目名称:esoTalk,代码行数:31,代码来源:conversation.php

示例4: number_format

<?php 
echo number_format($statistics["conversationsParticipated"]);
?>
<a href='<?php 
echo URL(searchURL("#contributor:" . $member["username"]));
?>
' class='control-search'><?php 
echo T("Search");
?>
</a>
</div></li>

<li><label><?php 
echo T("First posted");
?>
</label> <div><?php 
echo ucfirst(relativeTime($statistics["firstPosted"]));
?>
</div></li>

<li><label><?php 
echo T("Joined");
?>
</label> <div><?php 
echo ucfirst(relativeTime($statistics["joinTime"]));
?>
</div></li>

</ul>

</div>
开发者ID:AlexandrST,项目名称:esoTalk,代码行数:31,代码来源:statistics.php

示例5: formatPostForTemplate

 /**
  * Format post data into an array which can be used to display the post template view (conversation/post).
  *
  * @param array $post The post data.
  * @param array $conversation The details of the conversation which the post is in.
  * @return array A formatted array which can be used in the post template view.
  */
 public function formatPostForTemplate($post, $conversation)
 {
     $canEdit = ET::postModel()->canEditPost($post, $conversation);
     $avatar = avatar($post);
     // Construct the post array for use in the post view (conversation/post).
     $formatted = array("id" => "p" . $post["postId"], "title" => memberLink($post["memberId"], $post["username"]), "avatar" => (!$post["deleteTime"] and $avatar) ? "<a href='" . URL(memberURL($post["memberId"], $post["username"])) . "'>{$avatar}</a>" : false, "class" => $post["deleteTime"] ? array("deleted") : array(), "info" => array(), "controls" => array(), "body" => !$post["deleteTime"] ? $this->displayPost($post["content"]) : false, "footer" => array(), "data" => array("id" => $post["postId"], "memberid" => $post["memberId"]));
     $date = smartTime($post["time"], true);
     // Add the date/time to the post info as a permalink.
     $formatted["info"][] = "<a href='" . URL(postURL($post["postId"])) . "' class='time' title='" . _strftime(T("date.full"), $post["time"]) . "' data-timestamp='" . $post["time"] . "'>" . (!empty($conversation["searching"]) ? T("Show in context") : $date) . "</a>";
     // If the post isn't deleted, add a lot of stuff!
     if (!$post["deleteTime"]) {
         // Add the user's online status / last action next to their name.
         if (empty($post["preferences"]["hideOnline"])) {
             $lastAction = ET::memberModel()->getLastActionInfo($post["lastActionTime"], $post["lastActionDetail"]);
             if ($lastAction[0]) {
                 $lastAction[0] = " (" . sanitizeHTML($lastAction[0]) . ")";
             }
             if ($lastAction) {
                 array_unshift($formatted["info"], "<" . (!empty($lastAction[1]) ? "a href='{$lastAction[1]}'" : "span") . " class='online' title='" . T("Online") . "{$lastAction[0]}'><i class='icon-circle'></i></" . (!empty($lastAction[1]) ? "a" : "span") . ">");
             }
         }
         // Show the user's group type.
         $formatted["info"][] = "<span class='group'>" . memberGroup($post["account"], $post["groups"]) . "</span>";
         $formatted["class"][] = "group-" . $post["account"];
         foreach ($post["groups"] as $k => $v) {
             if ($k) {
                 $formatted["class"][] = "group-" . $k;
             }
         }
         // If the post has been edited, show the time and by whom next to the controls.
         if ($post["editMemberId"]) {
             $formatted["controls"][] = "<span class='editedBy'>" . sprintf(T("Edited %s by %s"), "<span title='" . _strftime(T("date.full"), $post["editTime"]) . "' data-timestamp='" . $post["editTime"] . "'>" . relativeTime($post["editTime"], true) . "</span>", memberLink($post["editMemberId"], $post["editMemberName"])) . "</span>";
         }
         // If the user can reply, add a quote control.
         if ($conversation["canReply"]) {
             $formatted["controls"][] = "<a href='" . URL(conversationURL($conversation["conversationId"], $conversation["title"]) . "/?quote=" . $post["postId"] . "#reply") . "' title='" . T("Quote") . "' class='control-quote'><i class='icon-quote-left'></i></a>";
         }
         // If the user can edit the post, add edit/delete controls.
         if ($canEdit) {
             $formatted["controls"][] = "<a href='" . URL("conversation/editPost/" . $post["postId"]) . "' title='" . T("Edit") . "' class='control-edit'><i class='icon-edit'></i></a>";
             $formatted["controls"][] = "<a href='" . URL("conversation/deletePost/" . $post["postId"] . "?token=" . ET::$session->token) . "' title='" . T("Delete") . "' class='control-delete'><i class='icon-remove'></i></a>";
         } elseif (!$conversation["locked"] && !ET::$session->isSuspended() && $post["memberId"] == ET::$session->userId && (!$post["deleteMemberId"] || $post["deleteMemberId"] == ET::$session->userId) && C("esoTalk.conversation.editPostTimeLimit") == "reply") {
             $formatted["controls"][] = "<span title='" . sanitizeHTML(T("message.cannotEditSinceReply")) . "' class='control-edit disabled'><i class='icon-edit'></i></span>";
             $formatted["controls"][] = "<span title='" . sanitizeHTML(T("message.cannotEditSinceReply")) . "' class='control-delete disabled'><i class='icon-remove'></i></span>";
         }
     } else {
         // Add the "deleted by" information.
         if ($post["deleteMemberId"]) {
             $formatted["controls"][] = "<span>" . sprintf(T("Deleted %s by %s"), "<span title='" . _strftime(T("date.full"), $post["deleteTime"]) . "' data-timestamp='" . $post["deleteTime"] . "'>" . relativeTime($post["deleteTime"], true) . "</span>", memberLink($post["deleteMemberId"], $post["deleteMemberName"])) . "</span>";
         }
         // If the user can edit the post, add a restore control.
         if ($canEdit) {
             $formatted["controls"][] = "<a href='" . URL("conversation/restorePost/" . $post["postId"] . "?token=" . ET::$session->token) . "' title='" . T("Restore") . "' class='control-restore'><i class='icon-reply'></i></a>";
         }
     }
     $this->trigger("formatPostForTemplate", array(&$formatted, $post, $conversation));
     return $formatted;
 }
开发者ID:xiaolvmu,项目名称:Techllage,代码行数:65,代码来源:ETConversationController.class.php

示例6: checkPost

    function checkPost($post, $user)
    {
        $user = urldecode($user);
        $this->curProfile = $user;
        $this->postID = $post;
        /**
         *POST ALL POST 
         **/
        $this->dbHandle->setRquery("SELECT * FROM amistiUser WHERE uName=?", array($this->curProfile));
        $res = $this->dbHandle->getRquery();
        $this->postUser = $res[0]['fName'] . " " . $res[0]['sName'];
        // get the post details
        $this->postUserName = $res[0]['uName'];
        $this->profileID = $res[0]['userID'];
        //GET OR SET PROFILE IMAGE
        $this->dbHandle->setRquery("SELECT * FROM amistiProfilePic WHERE userID=? AND profilePicCurrent=?", array($this->profileID, 1));
        $profilePicRes = $this->dbHandle->getRquery();
        $this->postUserIcon = getImgPath($profilePicRes[0]['profileImgPath']);
        $this->dbHandle->setRquery("SELECT * FROM amistiPost  INNER JOIN amistiUser ON amistiPost.userID = amistiUser.userID\n\t                    WHERE amistiPost.postID=? ", array($this->postID));
        // GET POST
        $results = $this->dbHandle->getRquery();
        if (count($results) > 0) {
            //get post results and iterate
            for ($x = 0; $x < count($results); $x++) {
                // get user data from table user
                //POPULATE THE VARIABLES
                $this->postID = $results[$x]['postID'];
                $this->postText = $results[$x]['postText'];
                $this->postTime = $results[$x]['postTime'];
                $this->postUserID = $results[$x]['userID'];
                if ($results[$x]['postShow'] == 1) {
                    //----check if the postShow is equal 1 ie show to public
                    //get user icon
                    $uIcon = empty($this->postUserIcon) || $this->postUserIcon == "" ? "./libs/libImages/icons/Man.png" : $this->postUserIcon;
                    ?>
    
    <!-- Center Content Class -->
    
    <div class="CC" id="POST_<?php 
                    echo $this->postID;
                    ?>
" > 
      
      <!-- Edit or menu point -->
      <div class="ccPoint">...</div>
     
      <!-- Poster icon/photo -->
      <div class="ccIcon"><a href="/?user=<?php 
                    echo $this->postUserName;
                    ?>
&post=<?php 
                    echo $this->postID;
                    ?>
"> <img src="<?php 
                    echo $uIcon;
                    ?>
" alt="<?php 
                    echo $this->postUser;
                    ?>
"> </a> </div>
      
      <!-- Poster data , place and time -->
      <div class=" ccUData">
        <h2>		<a href="/?user=<?php 
                    echo $this->postUserName;
                    ?>
"> 
	  <?php 
                    echo $this->postUser;
                    ?>
 
      </a>
       </h2>
       
        <ul>
          <li> <?php 
                    echo relativeTime($this->postTime);
                    ?>
 </li>
          <li>&middot;</li>
          <li class="locationIcon"> location not set</li> <!--- POST LOCATION SETTING HERE --------- -->
        </ul>
      </div>
      
  
  <div class="ccPointMenus"><!-- POP UP MENU --->
       
      <?php 
                    if ($this->curProfile == $_SESSION['uName']) {
                        //IF THE CURRENT PROFILE VIEWER IS THE SAME AS THE OWNER
                        ?>
  
       <li>
       <div class="postHidePost" ><strong>Show/Hide</strong><br>show or hide post from public</div>
       </li>
       
       <li>
       <div class="postEditPost"><strong>Edit</strong><br>edit this post</div>
       </li>
       
//.........这里部分代码省略.........
开发者ID:Neldris,项目名称:Amisti,代码行数:101,代码来源:posts.php

示例7: smartTime

/**
 * Get a smart human-friendly string for a date.
 *
 * @param int $then UNIX timestamp of the time to work out how much time has passed since.
 * @param bool $precise Whether or not to return "x minutes/seconds", or just "a few minutes".
 * @return string A human-friendly time string.
 *
 * @package esoTalk
 */
function smartTime($then, $precise = false)
{
    // Work out how many seconds it has been since $then.
    $ago = time() - $then;
    // If the time was within the last 48 hours, show a relative time (eg. 2 hours ago.)
    if ($ago >= 0 and $ago < 48 * 60 * 60) {
        return relativeTime($then, $precise);
    } elseif ($ago < 180 * 24 * 60 * 60) {
        return strftime("%b %e", $then);
    } else {
        return strftime(($precise ? "%e " : "") . "%b %Y", $then);
    }
}
开发者ID:xiaolvmu,项目名称:Techllage,代码行数:22,代码来源:functions.general.php

示例8: relativeTime

</div>
</div>
<div class='body'>
<ul class='form stats'>
<li><label><?php 
echo $language["Last active"];
?>
</label> <div><?php 
echo relativeTime($this->member["lastSeen"]);
?>
</div></li>
<li><label><?php 
echo $language["First posted"];
?>
</label> <div><?php 
echo relativeTime($this->member["firstPosted"]);
?>
</div></li>

<li><label><?php 
echo $language["Post count"];
?>
</label> <div><?php 
echo number_format($this->member["postCount"]);
if ($this->member["postCount"] > 0) {
    ?>
 <small>(<?php 
    $postsPerDay = round(min(max(0, $this->member["postCount"] / ((time() - $this->member["firstPosted"]) / 60 / 60 / 24)), $this->member["postCount"]));
    if ($postsPerDay == 1) {
        echo $language["post per day"];
    } else {
开发者ID:bk-amahi,项目名称:esoTalk,代码行数:31,代码来源:profile.view.php

示例9: array

        $fOp->setRquery("DELETE FROM amistiApprove WHERE approveItemID=?", array($postDelPostID));
        $fOp->setRquery("DELETE FROM amistiComment WHERE commentItemID=?", array($postDelPostID));
        $json = array("op" => "OK");
        echo json_encode($json);
    }
}
//CHECK POST
if ($_GET['checkPost'] == true) {
    $fOp->setRquery("SELECT * FROM amistiPost WHERE userID=? AND postPost=?", array($_SESSION['curUserID'], 1));
    $res = $fOp->getRquery();
    if (count($res) > 0) {
        $json = array("op" => "true");
    } else {
        $json = array("op" => "false");
    }
    echo json_encode($json);
}
//NEW AUTO TIME POST
if ($_GET['timeC'] == true) {
    $timeID = $_GET['timeID'];
    $fOp->setRquery("SELECT * FROM amistiPost WHERE postID=?", array($timeID));
    $cc = $fOp->getRquery();
    $title = date('l, M d, Y @ h:ia', $cc[0]['postTime']);
    $time = relativeTime($cc[0]['postTime']);
    $json = array("nTime" => $time, "title" => $title);
    echo json_encode($json);
}
?>


开发者ID:Neldris,项目名称:Amisti,代码行数:28,代码来源:ppostImgUploadAjax.php

示例10: sideComments

function sideComments($i)
{
    $allD;
    $photoFileOP = new sysFilesOperations();
    $id = getPostID($i);
    //Get comments
    $photoFileOP->setRquery("SELECT * FROM amistiComment WHERE commentItemID=?", array($id)) or die('ERROR 2 ');
    $idRes = $photoFileOP->getRquery();
    if (count($idRes) > 0) {
        for ($x = 0; $x < count($idRes); $x++) {
            //set DIV ID
            $comID = $idRes[$x]['commentID'];
            $allD .= "<div class=\"ccShowCommentInner \" id=\"com_{$comID}\">";
            //GET USER ICON
            $photoFileOP->setRquery("SELECT * FROM amistiProfilePic WHERE userID=? AND profilePicCurrent=?", array($idRes[$x]['userID'], 1));
            $uRes = $photoFileOP->getRquery();
            $uIcon = count($uRes) == 0 ? "/libs/libImages/icons/Man.png " : str_replace("/home/richieking1978/public_html", "", $uRes[0]['profileImgPath']);
            $photoFileOP->setRquery("SELECT * FROM amistiUser WHERE userID=?", array($idRes[$x]['userID'])) or die('ERROR 3 ');
            $mainURes = $photoFileOP->getRquery();
            // set user Icon
            $fullname = $mainURes[0]['fName'] . " " . $mainURes[0]['sName'];
            $uiD = $mainURes[0]['userID'];
            $comTex = $idRes[$x]['commentText'];
            $uName = $mainURes[0]['uName'];
            $allD .= "<a href=\"/{$uName}\">\n\t\t\t\t\t\t <div class=\"ccShowCommentUIcon showUserPopUpPic\" style=\"background-image:url({$uIcon} )\"></div>\n\t\t\t\t\t\t </a>\n\t\t\t\t\t\t <div class=\"ccShowCommentTextAllCon\"> \n\t\t\t\t\t\t <div class=\"ccShowCommentText \"> \n\t\t\t\t\t\t <a href=\"/{$uName}\" class=\"showUserPopUpName\">\n\t\t\t\t\t\t {$fullname}\n\t\t\t\t\t\t </a> \n\t\t\t\t\t\t {$comTex}\n\t\t\t\t\t\t </div> ";
            if (isset($_SESSION['logIn'])) {
                $allD .= "<div class=\"ccShowCommentMenuDHR\">...</div>\n\t\t\t\t   \n\t\t\t\t\t\t <div class=\"ccCommentMenu allPhotoComMenuResize\">\n\t\t\t\t\t\t <div class=\"ccCommentMenuArrowTop\"></div>\n\t\t\t\t\t\t <div class=\"ccCommentMenuData\" >";
                if ($_SESSION['userID'] == $_SESSION['curUserID']) {
                    if ($_SESSION['userID'] == $idRes[$x]['userID']) {
                        $allD .= "<li class=\"comEdit\"> Edit...</li>\n\t\t\t\t\t\t  <li class=\"comDelete\"> Delete...</li>";
                    } else {
                        $allD .= "<li class=\"comDelete\"> Remove...</li>\n   \t\t\t\t\t\t  <li class=\"comReport\"> Report...</li>";
                    }
                } elseif ($idRes[$x]['userID'] == $_SESSION['userID']) {
                    $allD .= "<li class=\"comEdit\"> Edit...</li>\n\t\t\t\t\t\t  <li class=\"comDelete\"> Delete...</li>";
                } else {
                    $allD .= "<li class=\"comReport\"> Report...</li>";
                }
                $allD .= "</div>\n\t\t\t\t\t          <span class=\"ccCommentMenuArrowBot\"></span>\n\t\t\t\t\t\t\t  </div> ";
            }
            //set DOWN BOX FOR DATE AND APPROVE
            $time = relativeTime($idRes[$x]['commentTime']);
            $allD .= "<div  class=\"ccCommentTLLCBoxMain \">\n\t\t\t\t\t\t\t   <div class=\"ccCommentTime\"> {$time} </div>\n\t\t\t\t\t\t\t\t<div class=\"ccCommentMidDot\">&middot;</div>\n\t\t\t\t\t\t\t\t<div class=\"ccCommentApprove\">";
            $photoFileOP->setRquery("SELECT * FROM amistiApprove WHERE approveItemID=?", array($idRes[$x]['commentID'])) or die('ERROR 4 ');
            $appRes = $photoFileOP->getRquery();
            $appCountN = count($appRes) == 0 ? "" : count($appRes);
            $foundYes;
            if (isset($_SESSION['logIn'])) {
                for ($cA = 0; $cA < count($appRes); $cA++) {
                    if ($appRes[$cA]['userID'] == $_SESSION['userID']) {
                        $foundYes = true;
                    }
                }
                if ($foundYes) {
                    $allD .= "<a href=\"#\">Approve</a> " . $appCountN;
                } else {
                    $allD .= " <a href=\"#\">approve</a> " . $appCountN;
                }
                $foundYes = false;
            } else {
                $allD .= "<a href=\"#\">approve</a>" . $appCountN;
            }
            // $allD .= "</div>";
            // Close Divs
            $allD .= "</div>\n\t\t\t\t \t\t\t</div>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t   </div>";
        }
    }
    return $allD;
}
开发者ID:Neldris,项目名称:Amisti,代码行数:69,代码来源:profileSettings.php

示例11: formatPostForTemplate

 /**
  * 投稿単位(post)の出力用編集メソッド
  * Format post data into an array which can be used to display the post template view (conversation/post).
  *
  * @param array $post The post data.
  * @param array $conversation The details of the conversation which the post is in.
  * @return array A formatted array which can be used in the post template view.
  */
 protected function formatPostForTemplate($post, $conversation)
 {
     $canEdit = ET::postModel()->canEditPost($post, $conversation);
     $avatar = avatar($post);
     // Construct the post array for use in the post view (conversation/post).
     // title: SWCユーザ名を表示するように設定対応
     // purl: 追加。SNSボタンリンク用に投稿単位の絶対urlを設定
     // likeCnt: 追加。いいねボタンのカウント数設定
     // mainPostFlg: 追加。テーマのメイン投稿(最初の投稿)フラグ
     $formatted = array("id" => "p" . $post["postId"], "conversationId" => $post["conversationId"], "title" => memberLink($post["memberId"], $post["username"]), "avatar" => (!$post["deleteMemberId"] and $avatar) ? "<a href='" . URL(memberURL($post["memberId"], $post["username"])) . "'>{$avatar}</a>" : false, "class" => $post["deleteMemberId"] ? array("deleted") : array(), "info" => array(), "controls" => array(), "body" => !$post["deleteMemberId"] ? $this->displayPost($post["content"]) : false, "footer" => array(), "purl" => URL(postURL($post["postId"]), TRUE), "likeCnt" => $post["likeCnt"], "mainPostFlg" => $post["mainPostFlg"], "data" => array("id" => $post["postId"], "memberid" => $post["memberId"]));
     // いいね済みフラグ
     $formatted["liked"] = $post["likeActivityId"] ? 1 : "";
     //	$date = smartTime($post["time"], true);
     $date = SwcUtils::getStrfTime($post["time"], T("date.short"));
     // Add the date/time to the post info as a permalink.
     $formatted["info"][] = "<a href='" . URL(postURL($post["postId"])) . "' class='time' title='" . strftime(T("date.full"), $post["time"]) . "'>" . (!empty($conversation["searching"]) ? T("Show in context") : $date) . "</a>";
     // If the post isn't deleted, add a lot of stuff!
     if (!$post["deleteMemberId"]) {
         // Add the user's online status / last action next to their name.
         //		if (empty($post["preferences"]["hideOnline"])) {
         //			$lastAction = ET::memberModel()->getLastActionInfo($post["lastActionTime"], $post["lastActionDetail"]);
         //			if ($lastAction[0]) $lastAction[0] = " (".sanitizeHTML($lastAction[0]).")";
         //			if ($lastAction) array_unshift($formatted["info"], "<".(!empty($lastAction[1]) ? "a href='{$lastAction[1]}'" : "span")." class='online' title='".T("Online")."{$lastAction[0]}'><i class='icon-circle'></i></".(!empty($lastAction[1]) ? "a" : "span").">");
         //		}
         // Show the user's group type.
         //		$formatted["info"][] = "<span class='group'>".memberGroup($post["account"], $post["groups"])."</span>";
         $formatted["class"][] = "group-" . $post["account"];
         foreach ($post["groups"] as $k => $v) {
             if ($k) {
                 $formatted["class"][] = "group-" . $k;
             }
         }
         // If the post has been edited, show the time and by whom next to the controls.
         if ($post["editMemberId"]) {
             $formatted["controls"][] = "<span class='editedBy'>" . sprintf(T("Edited %s by %s"), "<span title='" . strftime(T("date.full"), $post["editTime"]) . "'>" . relativeTime($post["editTime"], true) . "</span>", name($post["editMemberName"])) . "</span>";
         }
         // If the user can reply, add a quote control.
         if ($conversation["canReply"]) {
             $formatted["controls"][] = "<a href='" . URL(conversationURL($conversation["conversationId"], $conversation["title"]) . "/?quote=" . $post["postId"] . "#reply") . "' title='" . T("Quote") . "' class='control-quote'><i class='icon-quote-left'></i></a>";
         }
         // If the user can edit the post, add edit/delete controls.
         if ($canEdit) {
             $formatted["controls"][] = "<a href='" . URL("conversation/editPost/" . $post["postId"]) . "' title='" . T("Edit") . "' class='control-edit'><i class='icon-edit'></i></a>";
             $formatted["controls"][] = "<a href='" . URL("conversation/deletePost/" . $post["postId"] . "?token=" . ET::$session->token) . "' title='" . T("Delete") . "' class='control-delete'><i class='icon-remove'></i></a>";
         }
     } else {
         // Add the "deleted by" information.
         if ($post["deleteMemberId"]) {
             $formatted["controls"][] = "<span>" . sprintf(T("Deleted %s by %s"), "<span title='" . strftime(T("date.full"), $post["deleteTime"]) . "'>" . relativeTime($post["deleteTime"], true) . "</span>", name($post["deleteMemberName"])) . "</span>";
         }
         // If the user can edit the post, add a restore control.
         if ($canEdit) {
             $formatted["controls"][] = "<a href='" . URL("conversation/restorePost/" . $post["postId"] . "?token=" . ET::$session->token) . "' title='" . T("Restore") . "' class='control-restore'><i class='icon-reply'></i></a>";
         }
     }
     $this->trigger("formatPostForTemplate", array(&$formatted, $post, $conversation));
     return $formatted;
 }
开发者ID:m-mori,项目名称:forum,代码行数:66,代码来源:ETConversationController.class.php

示例12: foreach

\t</div>\t
EOF;
    }
} else {
    foreach ($results_travelers as $k => $v) {
        $user = @getUser($v['user']);
        $user['first'] = generateUserLink($v['user']);
        $pic = getUserPicture($user['facebookid']);
        $v['from'] = "<a href='https://maps.google.com/?q={$v['from']}' target='_blank'>" . strtoupper($v['from']) . "</a>";
        $v['to'] = "<a href='https://maps.google.com/?q={$v['to']}' target='_blank'>" . strtoupper($v['to']) . "</a>";
        $v['date'] = convertDateTime($v['date'], false) . " - " . dateToRelative($v['date'], false);
        $tmp3 = empty($v['size']) ? "" : "";
        $tmp4 = empty($v['weight']) ? "" : "";
        // luggage type: <span class="glyphicon glyphicon-briefcase"></span>
        // info: <span class="glyphicon glyphicon-info-sign"></span>
        $tmp5 = "Created " . relativeTime($v['update']);
        $HTML[] = <<<EOF
\t<div class="search-element">
\t\t<div class="search-profile">
\t\t\t<img src="{$pic}">
\t\t</div>
\t\t<div class="search-description">
\t\t\t{$v['description']}
\t\t</div>
\t\t<div class="search-details">
\t\t\t<span class="glyphicon glyphicon-user"></span> {$user['first']}
\t\t\t<br>
\t\t\t<span class="glyphicon glyphicon-map-marker"></span>FROM <b>{$v['from']}</b> TO <b>{$v['to']}</b>
\t\t\t<br>
\t\t\t<span class="glyphicon glyphicon-time"></span> {$v['date']} 
\t\t\t<br>
开发者ID:oinas,项目名称:garage48_tartu2016,代码行数:31,代码来源:search.php

示例13: MongoId

        continue;
    }
    $i++;
    $travel_plans = $db->travel_plans;
    $travel = $travel_plans->findOne(array("_id" => new MongoId($v['travel'])));
    $tmp = "travel plan";
    if (isset($travel['requester'])) {
        $tmp = "product request";
    }
    $date = convertDate($travel['date']);
    if ($v['which'] == 0) {
        $pic = generateUserPicture($v['user1'], "chat-picture");
    } else {
        $pic = generateUserPicture($v['user2'], "chat-picture");
    }
    $time = relativeTime($v['update']);
    $HTML[] = <<<EOF
\t\t<div class="request-chat">
\t\t{$pic}
\t\t{$v['message']}<br>
\t\t<small>{$time} &middot; <a href="?travel_plan/view/{$v['travel']}">go to {$tmp} @ {$travel['from']} &gt; {$travel['to']} ({$date})</a></small>
\t\t</div>
EOF;
}
if ($i == 0) {
    $HTML[] = <<<EOF
\t\t<div class="request-chat">
\t\t\tNo entries found
\t\t</div>
EOF;
}
开发者ID:oinas,项目名称:garage48_tartu2016,代码行数:31,代码来源:messages.php

示例14: tz_parse_cache_feed

function tz_parse_cache_feed($usernames, $limit)
{
    $username_for_feed = str_replace(" ", "+OR+from%3A", $usernames);
    $feed = "http://search.twitter.com/search.atom?q=from%3A" . $username_for_feed . "&rpp=" . $limit;
    $usernames_for_file = str_replace(" ", "-", $usernames);
    $cache_file = dirname(__FILE__) . '/cache/' . $usernames_for_file . '-twitter-cache';
    $last = filemtime($cache_file);
    $now = time();
    $interval = 600;
    // ten minutes
    // check the cache file
    if (!$last || $now - $last > $interval) {
        // cache file doesn't exist, or is old, so refresh it
        $cache_rss = file_get_contents($feed);
        if (!$cache_rss) {
            // we didn't get anything back from twitter
            echo "<!-- ERROR: Twitter feed was blank! Using cache file. -->";
        } else {
            // we got good results from twitter
            echo "<!-- SUCCESS: Twitter feed used to update cache file -->";
            $cache_static = fopen($cache_file, 'wb');
            fwrite($cache_static, serialize($cache_rss));
            fclose($cache_static);
        }
        // read from the cache file
        $rss = @unserialize(file_get_contents($cache_file));
    } else {
        // cache file is fresh enough, so read from it
        echo "<!-- SUCCESS: Cache file was recent enough to read from -->";
        $rss = @unserialize(file_get_contents($cache_file));
    }
    // clean up and output the twitter feed
    $feed = str_replace("&amp;", "&", $rss);
    $feed = str_replace("&lt;", "<", $feed);
    $feed = str_replace("&gt;", ">", $feed);
    $clean = explode("<entry>", $feed);
    $clean = str_replace("&quot;", "'", $clean);
    $clean = str_replace("&apos;", "'", $clean);
    $amount = count($clean) - 1;
    if ($amount) {
        // are there any tweets?
        ?>
    <div id="twitter_div" class="clearfix">
          <ul id="twitter_update_list"> 
    <?php 
        for ($i = 1; $i <= $amount; $i++) {
            $entry_close = explode("</entry>", $clean[$i]);
            $clean_content_1 = explode("<content type=\"html\">", $entry_close[0]);
            $clean_content = explode("</content>", $clean_content_1[1]);
            $clean_name_2 = explode("<name>", $entry_close[0]);
            $clean_name_1 = explode("(", $clean_name_2[1]);
            $clean_name = explode(")</name>", $clean_name_1[1]);
            $clean_user = explode(" (", $clean_name_2[1]);
            $clean_lower_user = strtolower($clean_user[0]);
            $clean_uri_1 = explode("<uri>", $entry_close[0]);
            $clean_uri = explode("</uri>", $clean_uri_1[1]);
            $clean_time_1 = explode("<published>", $entry_close[0]);
            $clean_time = explode("</published>", $clean_time_1[1]);
            $unix_time = strtotime($clean_time[0]);
            $pretty_time = relativeTime($unix_time);
            ?>

                    <li><span><?php 
            echo $clean_content[0];
            ?>
</span> <small><a href="<?php 
            echo $clean_uri[0];
            ?>
"><?php 
            echo $pretty_time;
            ?>
</a></small></li>
			<?php 
        }
        ?>
    	</ul>
        
    </div>
    <?php 
    } else {
        ?>
        <div id="twitter_div" class="clearfix">
            <ul id="twitter_update_list">
                <li><span>Twitter should be here, but it's not. Get over it.</span></li>
            </ul>
        </div>
        <?php 
    }
}
开发者ID:vpatrinica,项目名称:jfdesign,代码行数:89,代码来源:widget-tweets.php

示例15: _wip_display_tweets

/**
 * Show twitter updates
 * @param $username = twitter username
 * @param $number = how much data should display
 *
 * return lists
 */
function _wip_display_tweets($username, $number)
{
    if (file_exists(ABSPATH . WPINC . '/class-simplepie.php')) {
        require_once ABSPATH . WPINC . '/class-simplepie.php';
    } else {
        return __('You are not using latest WordPress version! Please update your WordPress!', 'wip');
        break;
    }
    $upload = wp_upload_dir();
    $cachefile = $upload['basedir'] . '/' . $username . '-' . $number;
    wp_mkdir_p($cachefile);
    $cached_time = 300;
    $tweet_url = 'http://search.twitter.com/search.atom?q=from:' . $username;
    $feed = new SimplePie($tweet_url, $cachefile, $cached_time);
    $result = "";
    if ($feed && !is_wp_error($feed)) {
        $result = '
			<ul class="builder_latest_tweet">' . "\n";
        foreach ($feed->get_items(0, $number) as $item) {
            $time = strtotime($item->get_date('Y-m-d H:i:s'));
            if (abs(time() - $time) < 86400) {
                $time = human_time_diff($time) . ' ago';
            } else {
                $time = relativeTime($item->get_date('Y-m-d H:i:s'));
            }
            $t_link = $item->get_permalink();
            if (is_ssl()) {
                $t_link = preg_replace('|^http://|', 'https://', $t_link);
            }
            $_desc = $item->get_description();
            if (is_ssl()) {
                $_desc = preg_replace('/http[s]*:/', 'https:', $_desc);
            }
            $result .= '<li>' . "\n";
            $result .= '<span class="twitter-text">' . $_desc . '</span>';
            // Display date/time
            $result .= '<span class="twitter-date"><a href="' . $t_link . '" target="_blank">' . $time . '</a></span>';
            $result .= '</li>' . "\n";
        }
        $result .= '</ul>' . "\n";
    } else {
        $result = __('Twitter seems too busy, cannot connect to twitter right now! Please try again later!', 'wip');
    }
    return $result;
}
开发者ID:rajveerbeniwal,项目名称:rooms-dhkh,代码行数:52,代码来源:theme_functions.php


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