當前位置: 首頁>>代碼示例>>PHP>>正文


PHP User::getProfilePictureUrl方法代碼示例

本文整理匯總了PHP中models\User::getProfilePictureUrl方法的典型用法代碼示例。如果您正苦於以下問題:PHP User::getProfilePictureUrl方法的具體用法?PHP User::getProfilePictureUrl怎麽用?PHP User::getProfilePictureUrl使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在models\User的用法示例。


在下文中一共展示了User::getProfilePictureUrl方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: setUpdatePostedFrom

 /**
  * 
  * @param array $updates
  * @return type
  */
 public static function setUpdatePostedFrom(&$updates)
 {
     if (!is_array($updates) || 0 === count($updates)) {
         return;
     }
     $users = [];
     foreach ($updates as &$update) {
         if (!isset($users[$update['user_id']])) {
             $users[$update['user_id']] = [];
         }
         $users[$update['user_id']][] =& $update;
     }
     $userIds = ArrayHelper::keyArray($users);
     if (0 === count($userIds)) {
         return;
     }
     $stmt = \CW::$app->db->executeQuery('SELECT id, username, profile_img_id FROM users WHERE id IN (' . ArrayHelper::getArrayToString($userIds, ',') . ')');
     $result = $stmt->fetchAll(\PDO::FETCH_ASSOC);
     foreach ($result as $user) {
         $user['imgUrl'] = \models\User::getProfilePictureUrl($user['profile_img_id'], $user['id']);
         $user['username'] = htmlspecialchars($user['username']);
         $user['profileUrl'] = \models\User::getProfileUrl($user['id']);
         foreach ($users[$user['id']] as &$update) {
             $update['from'] = $user;
         }
     }
 }
開發者ID:zivanof,項目名稱:fun_project,代碼行數:32,代碼來源:Update.php

示例2: htmlspecialchars

        echo $update['imageUrl'];
        ?>
">
        <?php 
    }
    ?>
    </div>
    <div style="background-color: #fff; border: 1px solid #ddd; border-top: 0px;">
        <div style="padding: 15px;">
    <div class="posted-from-c" style="margin: 1px;">
        <a href="<?php 
    echo \models\User::getProfileUrl($update['user_id']);
    ?>
">
            <img src="<?php 
    echo \models\User::getProfilePictureUrl($update['from']->profile_img_id, $update['from']->id);
    ?>
" class="posted-from-image" width="35" height="35">
        </a>
        <div class="posted-from-info-c">
            <a href="<?php 
    echo \models\User::getProfileUrl($update['user_id']);
    ?>
" class="link posted-from-username-link" style="font-weight: bold;"><?php 
    echo htmlspecialchars($update['from']->username);
    ?>
</a>
            <p class="posted-from-ago"><?php 
    echo $update['postedAgo'];
    ?>
</p>
開發者ID:zivanof,項目名稱:fun_project,代碼行數:31,代碼來源:view.php

示例3: getReplies

 public static function getReplies($replyTo, $last = null)
 {
     if (!is_numeric($replyTo) || !is_numeric($replyTo)) {
         return [];
     }
     $result = [];
     $result['hasMore'] = false;
     $last = is_numeric($last) ? " AND c.`posted_on` > {$last}" : '';
     $query = "SELECT c.*, u.id ownerId, u.username ownerUsername, u.profile_img_id FROM `comments` c JOIN `users` u ON c.`user_id` = u.`id` WHERE c.`reply_to` = {$replyTo} {$last} ORDER BY c.`posted_on` ASC LIMIT 7";
     $stmt = \CW::$app->db->executeQuery($query);
     $replies = $stmt->fetchAll(\PDO::FETCH_OBJ);
     $repliesCount = count($replies);
     $last = null;
     for ($i = 0; $i < $repliesCount; $i++) {
         $last = $replies[$i]->posted_on;
         $replies[$i]->postedAgo = BaseModel::getPostedAgoTime($replies[$i]->posted_on);
         $replies[$i]->content = htmlspecialchars($replies[$i]->content);
         $replies[$i]->owner = ['id' => $replies[$i]->ownerId, 'username' => htmlspecialchars($replies[$i]->ownerUsername), 'profileUrl' => \models\User::getProfileUrl($replies[$i]->ownerId), 'pictureUrl' => User::getProfilePictureUrl($replies[$i]->profile_img_id, $replies[$i]->ownerId)];
     }
     if (0 < $repliesCount) {
         $stmt = CW::$app->db->executeQuery("SELECT `reply_to` FROM `comments` WHERE `reply_to` = {$replyTo} AND `posted_on` > '" . $last . "' LIMIT 1");
         $_result = $stmt->fetchAll(\PDO::FETCH_ASSOC);
         if (0 < count($_result)) {
             $result['hasMore'] = true;
         }
     }
     $result['items'] = $replies;
     return $result;
 }
開發者ID:zivanof,項目名稱:fun_project,代碼行數:29,代碼來源:Comment.php


注:本文中的models\User::getProfilePictureUrl方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。