本文整理汇总了PHP中CUrlHelper类的典型用法代码示例。如果您正苦于以下问题:PHP CUrlHelper类的具体用法?PHP CUrlHelper怎么用?PHP CUrlHelper使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CUrlHelper类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: friends
public function friends($data = null)
{
$mainframe = JFactory::getApplication();
$jinput = $mainframe->input;
$document = JFactory::getDocument();
$id = JRequest::getCmd('userid', 0);
$sorted = $jinput->get->get('sort', 'latest', 'STRING');
//JRequest::getVar( 'sort' , 'latest' , 'GET' );
$filter = JRequest::getWord('filter', 'all', 'GET');
$isMine = $id == $my->id && $my->id != 0;
$my = CFactory::getUser();
$id = $id == 0 ? $my->id : $id;
$user = CFactory::getUser($id);
$friends = CFactory::getModel('friends');
$blockModel = CFactory::getModel('block');
$document->setLink(CRoute::_('index.php?option=com_community'));
$rows = $friends->getFriends($id, $sorted, true, $filter);
// Hide submenu if we are viewing other's friends
if ($isMine) {
$document->setTitle(JText::_('COM_COMMUNITY_FRIENDS_MY_FRIENDS'));
} else {
$document->setTitle(JText::sprintf('COM_COMMUNITY_FRIENDS_ALL_FRIENDS', $user->getDisplayName()));
}
$sortItems = array('latest' => JText::_('COM_COMMUNITY_SORT_RECENT_FRIENDS'), 'online' => JText::_('COM_COMMUNITY_ONLINE'));
$resultRows = array();
// @todo: preload all friends
foreach ($rows as $row) {
$user = CFactory::getUser($row->id);
$obj = clone $row;
$obj->friendsCount = $user->getFriendCount();
$obj->profileLink = CUrlHelper::userLink($row->id);
$obj->isFriend = true;
$obj->isBlocked = $blockModel->getBlockStatus($user->id, $my->id);
$resultRows[] = $obj;
}
unset($rows);
foreach ($resultRows as $row) {
if (!$row->isBlocked) {
// load individual item creator class
$item = new JFeedItem();
$item->title = strip_tags($row->name);
$item->link = CRoute::_('index.php?option=com_community&view=profile&userid=' . $row->id);
$item->description = '<img src="' . JURI::base() . $row->_thumb . '" alt="" /> ' . $row->_status;
$item->date = $row->lastvisitDate;
$item->category = '';
//$row->category;
$item->description = CString::str_ireplace('_QQQ_', '"', $item->description);
// Make sure url is absolute
$item->description = CString::str_ireplace('href="/', 'href="' . JURI::base(), $item->description);
// loads item info into rss array
$document->addItem($item);
}
}
}
示例2: getLargeAvatar
/**
* Get large avatar use for cropping
* @return string
*/
public function getLargeAvatar()
{
$config = CFactory::getConfig();
$largeAvatar = $config->getString('imagefolder') . '/avatar/profile-' . JFile::getName($this->avatar);
if (JFile::exists(JPATH_ROOT . '/' . $largeAvatar)) {
return CUrlHelper::avatarURI($largeAvatar) . '?' . md5(time());
/* adding random param to prevent browser caching */
} else {
return $this->getAvatar();
}
}
示例3: getAvatar
public function getAvatar()
{
// Get the avatar path. Some maintance/cleaning work: We no longer store
// the default avatar in db. If the default avatar is found, we reset it
// to empty. In next release, we'll rewrite this portion accordingly.
// We allow the default avatar to be template specific.
if ($this->avatar == 'components/com_community/assets/user.png') {
$this->avatar = '';
$this->store();
}
CFactory::load('helpers', 'url');
$avatar = CUrlHelper::avatarURI($this->avatar, 'user.png');
return $avatar;
}
示例4: getAvatar
public function getAvatar()
{
// Get the avatar path. Some maintance/cleaning work: We no longer store
// the default avatar in db. If the default avatar is found, we reset it
// to empty. In next release, we'll rewrite this portion accordingly.
// We allow the default avatar to be template specific.
$profileModel = CFactory::getModel('Profile');
$gender = $profileModel->getGender($this->userid);
if (empty($gender)) {
$gender = 'Male';
}
if ($this->avatar == 'components/com_community/assets/user-' . JText::_($gender) . '.png') {
$this->avatar = '';
$this->store();
}
$avatar = CUrlHelper::avatarURI($this->avatar, 'user-' . JText::_($gender) . '.png');
return $avatar;
}
示例5: foreach
<h3 class="app-box-header"><?php
echo JText::sprintf('COM_COMMUNITY_EVENTS_CONFIRMED_GUESTS');
?>
</h3>
<?php
if ($eventMembersCount > 0) {
?>
<div class="app-box-content">
<ul class="cThumbsList cResetList clearfix">
<?php
if ($eventMembers) {
foreach ($eventMembers as $member) {
?>
<li>
<a href="<?php
echo CUrlHelper::userLink($member->id);
?>
">
<img class="cAvatar jomNameTips" src="<?php
echo $member->getThumbAvatar();
?>
" title="<?php
echo CTooltip::cAvatarTooltip($member);
?>
" alt="" />
</a>
</li>
<?php
}
}
?>
示例6:
?>
<div>
<?php
if ($bulletins) {
for ($i = 0; $i < count($bulletins); $i++) {
$row =& $bulletins[$i];
?>
<div class="joms-stream__container joms-stream--discussion">
<div class="joms-stream__header <?php
echo CUserHelper::onlineIndicator($row->creator);
?>
">
<div class="joms-avatar--stream">
<a href="<?php
echo CUrlHelper::userLink($row->creator->id);
?>
">
<img data-author="<?php
echo $row->creator->id;
?>
"
src="<?php
echo $row->creator->getThumbAvatar();
?>
"
alt="<?php
echo $row->creator->getDisplayName();
?>
"/>
</a>
示例7:
<div class="joms-avatar">
<img src="<?php
echo $row->user->getThumbAvatar();
?>
" alt="<?php
echo $row->user->getDisplayName();
?>
" >
</div>
</div>
<div class="joms-popover__content joms-js--frequest-msg-<?php
echo $row->connection_id;
?>
">
<h5><a href="<?php
echo CUrlHelper::userLink($row->user->id);
?>
"><?php
echo $row->user->getDisplayName();
?>
</a></h5>
<?php
echo $row->msg;
?>
</div>
<div class="joms-popover__actions joms-js--frequest-btn-<?php
echo $row->connection_id;
?>
">
<button class="joms-button--neutral joms-button--small" onclick="joms.api.friendReject('<?php
echo $row->connection_id;
示例8: formatComment
/**
* Return formatted comment given the wall item
*/
public static function formatComment($wall)
{
$config = CFactory::getConfig();
$my = CFactory::getUser();
$actModel = CFactory::getModel('activities');
$like = new CLike();
$likeCount = $like->getLikeCount('comment', $wall->id);
$isLiked = $like->userLiked('comment', $wall->id, $my->id);
$user = CFactory::getUser($wall->post_by);
// Censor if the user is banned
if ($user->block) {
$wall->comment = $origComment = JText::_('COM_COMMUNITY_CENSORED');
} else {
// strip out the comment data
$CComment = new CComment();
$wall->comment = $CComment->stripCommentData($wall->comment);
// Need to perform basic formatting here
// 1. support nl to br,
// 2. auto-link text
$CTemplate = new CTemplate();
$wall->comment = $origComment = $CTemplate->escape($wall->comment);
$wall->comment = CStringHelper::autoLink($wall->comment);
}
$commentsHTML = '';
$commentsHTML .= '<div class="cComment wall-coc-item" id="wall-' . $wall->id . '"><a href="' . CUrlHelper::userLink($user->id) . '"><img src="' . $user->getThumbAvatar() . '" alt="" class="wall-coc-avatar" /></a>';
$date = new JDate($wall->date);
$commentsHTML .= '<a class="wall-coc-author" href="' . CUrlHelper::userLink($user->id) . '">' . $user->getDisplayName() . '</a> ';
$commentsHTML .= $wall->comment;
$commentsHTML .= '<span class="wall-coc-time">' . CTimeHelper::timeLapse($date);
$cid = isset($wall->contentid) ? $wall->contentid : null;
$activity = $actModel->getActivity($cid);
$ownPost = $my->id == $wall->post_by;
$allowRemove = $my->authorise('community.delete', 'walls', $wall);
$canEdit = $config->get('wallediting') && $my->id == $wall->post_by || COwnerHelper::isCommunityAdmin();
// only poster can edit
if ($allowRemove) {
$commentsHTML .= ' <span class="wall-coc-remove-link">• <a href="#removeComment">' . JText::_('COM_COMMUNITY_WALL_REMOVE') . '</a></span>';
}
$commentsHTML .= '</span>';
$commentsHTML .= '</div>';
$editHTML = '';
if ($config->get('wallediting') && $ownPost || COwnerHelper::isCommunityAdmin()) {
$editHTML .= '<a href="javascript:" class="joms-button--edit">';
$editHTML .= '<svg viewBox="0 0 16 16" class="joms-icon"><use xlink:href="' . CRoute::getURI() . '#joms-icon-pencil"></use></svg>';
$editHTML .= '<span>' . JText::_('COM_COMMUNITY_EDIT') . '</span>';
$editHTML .= '</a>';
}
$removeHTML = '';
if ($allowRemove) {
$removeHTML .= '<a href="javascript:" class="joms-button--remove">';
$removeHTML .= '<svg viewBox="0 0 16 16" class="joms-icon"><use xlink:href="' . CRoute::getURI() . '#joms-icon-remove"></use></svg>';
$removeHTML .= '<span>' . JText::_('COM_COMMUNITY_WALL_REMOVE') . '</span>';
$removeHTML .= '</a>';
}
$removeTagHTML = '';
if (CActivitiesHelper::hasTag($my->id, $wall->comment)) {
$removeTagHTML = '<span><a data-action="remove-tag" data-id="' . $wall->id . '" href="javascript:">' . JText::_('COM_COMMUNITY_WALL_REMOVE_TAG') . '</a></span>';
}
/* user deleted */
if ($user->guest == 1) {
$userLink = '<span class="cStream-Author">' . $user->getDisplayName() . '</span> ';
} else {
$userLink = '<a class="cStream-Avatar cStream-Author cFloat-L" href="' . CUrlHelper::userLink($user->id) . '"> <img class="cAvatar" src="' . $user->getThumbAvatar() . '"> </a> ';
}
$params = $wall->params;
$paramsHTML = '';
$image = (array) $params->get('image');
$photoThumbnail = false;
if ($params->get('attached_photo_id') > 0) {
$photo = JTable::getInstance('Photo', 'CTable');
$photo->load($params->get('attached_photo_id'));
$photoThumbnail = $photo->getThumbURI();
$paramsHTML .= '<div style="padding: 5px 0"><img class="joms-stream-thumb" src="' . $photoThumbnail . '" /></div>';
} else {
if ($params->get('title')) {
$video = self::detectVideo($params->get('url'));
if (is_object($video)) {
$paramsHTML .= '<div class="joms-media--video joms-js--video"';
$paramsHTML .= ' data-type="' . $video->type . '"';
$paramsHTML .= ' data-id="' . $video->id . '"';
$paramsHTML .= ' data-path="' . ($video->type === 'file' ? JURI::root(true) . '/' : '') . $video->path . '"';
$paramsHTML .= ' style="margin-top:10px;">';
$paramsHTML .= '<div class="joms-media__thumbnail">';
$paramsHTML .= '<img src="' . $video->getThumbnail() . '">';
$paramsHTML .= '<a href="javascript:" class="mejs-overlay mejs-layer mejs-overlay-play joms-js--video-play joms-js--video-play-' . $wall->id . '">';
$paramsHTML .= '<div class="mejs-overlay-button"></div>';
$paramsHTML .= '</a>';
$paramsHTML .= '</div>';
$paramsHTML .= '<div class="joms-media__body">';
$paramsHTML .= '<h4 class="joms-media__title">' . JHTML::_('string.truncate', $video->title, 50, true, false) . '</h4>';
$paramsHTML .= '<p class="joms-media__desc">' . JHTML::_('string.truncate', $video->description, $config->getInt('streamcontentlength'), true, false) . '</p>';
$paramsHTML .= '</div>';
$paramsHTML .= '</div>';
} else {
$paramsHTML .= '<div class="joms-gap"></div>';
$paramsHTML .= '<div class="joms-media--album joms-relative joms-js--comment-preview">';
if ($user->id == $my->id || COwnerHelper::isCommunityAdmin()) {
//.........这里部分代码省略.........
示例9: stdClass
// Setup group table
$group = $this->group;
// Setup Discussion Table
$discussion = JTable::getInstance('Discussion', 'CTable');
$discussion->load($act->cid);
$discussionLink = CRoute::_('index.php?option=com_community&view=groups&task=viewdiscussion&groupid=' . $group->id . '&topicid=' . $discussion->id);
if ($user->block) {
$discussion->title = $discussion->message = JText::_('COM_COMMUNITY_CENSORED');
}
// Load params
$action = $act->params->get('action');
$actors = $act->params->get('actors');
$this->set('actors', $actors);
$stream = new stdClass();
$stream->actor = $user;
$stream->target = null;
$stream->datetime = $createdTime;
$stream->headline = '<a href="' . CUrlHelper::userLink($user->id) . '">' . $user->getDisplayName() . '</a> ' . JTEXT::_('COM_COMMUNITY_GROUPS_NEW_GROUP_DISCUSSION') . '<span class="joms-stream__time"><small>' . $stream->datetime . '</small></span>';
$stream->message = "";
$stream->group = $group;
$stream->groupid = $group->id;
$stream->attachments = array();
$stream->link = $discussionLink;
$stream->title = $discussion->title;
$stream->access = $act->access;
$attachment = new stdClass();
$attachment->type = 'create_discussion';
$attachment->message = $this->escape(JHTML::_('string.truncate', $discussion->message, $config->getInt('streamcontentlength'), true, false));
$stream->attachments[] = $attachment;
$this->set('stream', $stream);
$this->load('activities.stream');
示例10: JRegistry
$bulletin->load($act->cid);
// get created date time
$date = JFactory::getDate($act->created);
if ($config->get('activitydateformat') == "lapse") {
$createdTime = CTimeHelper::timeLapse($date);
} else {
$createdTime = $date->format($config->get('profileDateFormat'));
}
// Load params
$param = new JRegistry($this->act->params);
$action = $param->get('action');
$actors = $param->get('actors');
$this->set('actors', $actors);
$stream = new stdClass();
$stream->actor = $user;
$stream->target = null;
$stream->datetime = $createdTime;
$stream->headline = '<a class="joms-stream-author" href="' . CUrlHelper::userLink($user->id) . '">' . $user->getDisplayName() . '</a> ' . JTEXT::_('COM_COMMUNITY_GROUPS_NEW_GROUP_NEWS') . '<p class="joms-share-meta date">' . $stream->datetime . '</p>';
$stream->message = "";
$stream->group = $group;
$stream->groupid = $group->id;
$stream->attachments = array();
$stream->title = $bulletin->title;
$stream->link = CRoute::_('index.php?option=com_community&view=groups&task=viewbulletin&groupid=' . $group->id . '&bulletinid=' . $bulletin->id);
$stream->access = $act->access;
$attachment = new stdClass();
$attachment->type = 'create_announcement';
$attachment->message = $this->escape(JHTML::_('string.truncate', $bulletin->message, $config->getInt('streamcontentlength'), true, false));
$stream->attachments[] = $attachment;
$this->set('stream', $stream);
$this->load('activities.stream');
示例11:
if ($my->id == $user1->id) {
$you = $user1;
$other = $user2;
}
if ($my->id == $user2->id) {
$you = $user2;
$other = $user1;
}
?>
<div class="joms-stream__body no-head">
<p>
<svg viewBox="0 0 16 16" class="joms-icon">
<use xlink:href="<?php
echo CRoute::getURI();
?>
#joms-icon-user"></use>
</svg>
<?php
if (!is_null($you)) {
// @todo: use sprintf with language code
echo JText::sprintf('COM_COMMUNITY_STREAM_MY_FRIENDS', $other->getDisplayName(), CUrlHelper::userLink($other->id));
?>
<?php
} else {
// @todo: use sprintf with language code
echo JText::sprintf('COM_COMMUNITY_STREAM_OTHER_FRIENDS', $user1->getDisplayName(), $user2->getDisplayName(), CUrlHelper::userLink($user1->id), CUrlHelper::userLink($user2->id));
}
?>
</p>
</div>
示例12: _streamShowLikes
/**
* Display the full list of people who likes this stream item
*
* @param <type> $objResponse
* @param <type> $actid
* @param <type> $like_type
* @param <type> $like_id
*/
private function _streamShowLikes($objResponse, $actid, $like_type, $like_id, $target = '')
{
$my = CFactory::getUser();
$like = new CLike();
$likes = $like->getWhoLikes($like_type, $like_id);
$canUnlike = false;
$likeHTML = '';
$likeUsers = array();
foreach ($likes as $user) {
$likeUsers[] = '<a href="' . CUrlHelper::userLink($user->id) . '">' . $user->getDisplayName() . '</a>';
if ($my->id == $user->id) {
$canUnlike = true;
}
}
if (count($likeUsers) != 0) {
if ($target === 'popup') {
$tmpl = new CTemplate();
$tmpl->set('users', $likes);
$likeHTML = $tmpl->fetch('ajax.stream.showothers');
} else {
$likeHTML .= implode(", ", $likeUsers);
$likeHTML = CStringHelper::isPlural(count($likeUsers)) ? JText::sprintf('COM_COMMUNITY_LIKE_THIS_MANY_LIST', $likeHTML) : JText::sprintf('COM_COMMUNITY_LIKE_THIS_LIST', $likeHTML);
}
}
return $likeHTML;
}
示例13: array
<!--NEWS FEED AVATAR-->
<!--NEWS FEED CONTENT-->
<div class="newsfeed-content">
<div class="newsfeed-content-top">
<?php
// Put user header link if necessary
if ($apptype == 'group' && $act->eventid) {
// For group event, show the arrow indicator (using <span class="com_icons com_icons12 com_icons-inline com_icons-rarr">»</span>)
echo '<div class="newsfeed-content-actor"><a href="' . CUrlHelper::userLink($act->actor) . '">' . $actor->getDisplayName() . '</a> <span class="com_icons com_icons12 com_icons-inline com_icons-rarr">»</span> <a href="' . CUrlHelper::eventLink($act->eventid) . '">' . $act->appTitle . '</a></div>';
} else {
?>
<div class="newsfeed-content-actor">
<strong><a class="actor-link" href="<?php
echo CUrlHelper::userLink($act->actor);
?>
"><?php
echo $actor->getDisplayName();
?>
</a></strong>
</div>
<?php
}
// Order of replacement
$order = array("\r\n", "\n", "\r");
$replace = '<br/>';
// Processes \r\n's first so they aren't converted twice.
$messageDisplay = str_replace($order, $replace, $act->title);
echo $messageDisplay;
?>
示例14: elseif
if ($video->groupid) {
$group = JTable::getInstance('Group', 'CTable');
$group->load($video->groupid);
echo JText::sprintf('COM_COMMUNITY_VIDEOS_FROM_GROUP', '<a href="' . CUrlHelper::groupLink($group->id) . '">' . $group->name . '</a>');
} elseif ($video->eventid) {
$event = JTable::getInstance('Event', 'CTable');
$event->load($video->eventid);
echo JText::sprintf('COM_COMMUNITY_VIDEOS_FROM_EVENT', '<a href="' . CUrlHelper::eventLink($event->id) . '">' . $event->title . '</a>');
} elseif ($params->get('activity_id')) {
$targetUser = CFactory::getUser($params->get('target_id'));
?>
▶ <?php
echo CLinkGeneratorHelper::getUserURL($targetUser->id, $targetUser->getDisplayName());
?>
<a href="<?php
echo CUrlHelper::streamURI($params->get('activity_id'), $targetUser->id);
?>
"><?php
echo JText::_('COM_COMMUNITY_SINGULAR_STREAM');
?>
</a>
<?php
}
?>
</small>
</li>
<?php
}
//end foreach
?>
示例15:
<div class="clr"></div>
<div class="group-discussion-author small">
<?php
if (isset($row->lastreplier) && !empty($row->lastreplier)) {
?>
<span class="groups-news-author">
<?php
echo JText::sprintf('CC DISCUSSION LAST REPLIED', '<a href="' . CUrlHelper::userLink($row->lastreplier->post_by->id) . '">' . $row->lastreplier->post_by->getDisplayName() . '</a>', JHTML::_('date', $row->lastreplier->date, JText::_('DATE_FORMAT_LC')));
?>
</span>
<?php
} else {
?>
<span class="groups-news-author">
<?php
echo JText::sprintf('CC DISCUSS STARTED BY', '<a href="' . CUrlHelper::userLink($row->user->id) . '">' . $row->user->getDisplayName() . '</a>');
?>
</span>
<?php
}
?>
</div>
</div>
<?php
}
} else {
?>
<div class="empty"><?php
echo JText::_('CC NO DISCUSSIONS');
?>
</div>