本文整理汇总了PHP中EB::user方法的典型用法代码示例。如果您正苦于以下问题:PHP EB::user方法的具体用法?PHP EB::user怎么用?PHP EB::user使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EB
的用法示例。
在下文中一共展示了EB::user方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: load
public function load($cid)
{
static $instances = array();
if (!isset($instances[$cid])) {
$this->_item = EB::post($cid);
if (!$this->_item) {
return $this->onLoadArticleError($cid);
}
$blogger = EB::user($this->_item->created_by);
$this->_item->blogger = $blogger;
$link = 'index.php?option=com_easyblog&view=entry&id=' . $this->getContentId();
// forcefully get item id if request is ajax
$format = JRequest::getString('format', 'html');
if ($format === 'ajax') {
$itemid = JRequest::getInt('pageItemId');
if (!empty($itemid)) {
$link .= '&Itemid=' . $itemid;
}
}
$link = EBR::_($link);
$this->_item->permalink = $this->prepareLink($link);
$instances[$cid] = $this->_item;
}
$this->_item = $instances[$cid];
return $this;
}
示例2: voters
/**
* Displays a list of voters
*
* @since 4.0
* @access public
* @param string
* @return
*/
public function voters()
{
// Get the composite keys
$uid = $this->input->get('uid', 0, 'int');
$type = $this->input->get('type', '', 'cmd');
// Get maximum number of voters to show up in the dialog.
$limit = EB::config()->get('main_ratings_display_raters_max');
// Get the ratings
$model = EB::model('Ratings');
$votes = $model->getRatingUsers($uid, $type, $limit);
// Determines the total number of guest votes
$totalGuests = 0;
// Format the votes
if ($votes) {
foreach ($votes as &$vote) {
$vote->user = false;
if ($vote->created_by) {
$user = EB::user($vote->created_by);
$vote->user = $user;
} else {
$totalGuests += 1;
}
}
}
$theme = EB::template();
$theme->set('totalGuests', $totalGuests);
$theme->set('votes', $votes);
$output = $theme->output('site/ratings/dialog.voters');
return $this->ajax->resolve($output);
}
示例3: getAuthor
public function getAuthor()
{
if (!isset($this->author) || is_null($this->author)) {
$this->author = EB::user($this->created_by);
}
return $this->author;
}
示例4: __construct
public function __construct()
{
$this->my = JFactory::getUser();
$this->app = JFactory::getApplication();
$this->input = EB::request();
$this->acl = EB::acl();
$this->config = EB::config();
// Set the user project
$this->user = EB::user($this->my->id);
}
示例5: display
function display($tmpl = null)
{
if (!$this->config->get('main_rss')) {
return;
}
$model = EB::model('Blog');
$data = $model->getFeaturedBlog();
$document = JFactory::getDocument();
$document->link = EBR::_('index.php?option=com_easyblog&view=featured');
$document->setTitle(JText::_('COM_EASYBLOG_FEEDS_FEATURED_TITLE'));
$document->setDescription(JText::sprintf('COM_EASYBLOG_FEEDS_FEATURED_DESC', JURI::root()));
if (empty($data)) {
return;
}
$uri = JURI::getInstance();
$scheme = $uri->toString(array('scheme'));
$scheme = str_replace('://', ':', $scheme);
foreach ($data as $row) {
$blog = EB::table('Blog');
$blog->load($row->id);
$profile = EB::user($row->created_by);
$created = EB::date($row->created);
$row->created = $created->toSql();
if ($this->config->get('main_rss_content') == 'introtext') {
$row->text = !empty($row->intro) ? $row->intro : $row->content;
//read more for feed
$row->text .= '<br /><a href=' . EBR::_('index.php?option=com_easyblog&view=entry&id=' . $row->id) . '>Read more</a>';
} else {
$row->text = $row->intro . $row->content;
}
$row->text = EB::videos()->strip($row->text);
$row->text = EB::adsense()->stripAdsenseCode($row->text);
$category = EB::table('Category');
// Get primary category
$primaryCategory = $blog->getPrimaryCategory();
$category->load($primaryCategory->id);
// Assign to feed item
$title = $this->escape($row->title);
$title = html_entity_decode($title);
// load individual item creator class
$item = new JFeedItem();
$item->title = $title;
$item->link = EBR::_('index.php?option=com_easyblog&view=entry&id=' . $row->id);
$item->description = $row->text;
// replace the image source to proper format so that feed reader can view the image correctly.
$item->description = str_replace('src="//', 'src="' . $scheme . '//', $item->description);
$item->description = str_replace('href="//', 'href="' . $scheme . '//', $item->description);
$item->date = $row->created;
$item->category = $category->getTitle();
$item->author = $profile->getName();
$item->authorEmail = $this->getRssEmail($profile);
$document->addItem($item);
}
}
示例6: getBloggerProfile
public static function getBloggerProfile($userid)
{
if (empty($userid)) {
return false;
}
$blogger = EB::user($userid);
$integrate = new EasyBlogIntegrate();
$profile = $integrate->integrate($blogger);
$profile->displayName = $blogger->getName();
return $profile;
}
示例7: getPostByBlogger
/**
* Retrieves a list of posts created by a list of specified authors.
*
* @since 5.0
* @access public
* @param string
* @return
*/
public static function getPostByBlogger(&$params, $authorId)
{
$db = EB::db();
$config = EB::config();
// Get the profile of the user.
$author = EB::user($authorId);
// Default posts to empty.
$author->posts = array();
$author->posts = modLatestBlogsHelper::getLatestPost($params, $author->id, 'blogger');
return $author;
}
示例8: _getURL
public function _getURL($user, $sizex, $sizey)
{
if (!$user->userid == 0) {
$user = KunenaFactory::getUser($user->userid);
$user = EB::user($user->userid);
$avatar = $user->getAvatar();
} else {
$avatar = JUri::root(true) . '/components/com_easyblog/assets/images/default_blogger.png';
}
return $avatar;
}
示例9: execute
public function execute()
{
if ($this->cache) {
//preload posts information
EB::cache()->insert($this->items);
}
// For featured items we wouldn't want to process comments
$comment = true;
// For featured items we want to remove featured image
$removeFeaturedImage = true;
// For featured items we do not want to load videos
$video = false;
// For featured items we do not want to process gallery
$gallery = false;
// Ensure that the content does not exceed the introtext limit for featured items
$contentLimit = $this->config->get('layout_featured_intro_limit');
$result = array();
foreach ($this->items as &$item) {
$blog = EB::post($item->id);
// Load the author's profile
$author = EB::user($blog->created_by);
// @Assign dynamic properties that must exist everytime formatBlog is called
// We can't rely on ->author because CB plugins would mess things up.
$blog->author = $author;
$blog->blogger = $author;
// Password verifications
$this->password($blog);
// Format microblog postings
if ($blog->posttype) {
$this->formatMicroblog($blog);
}
// Detect if content requires read more link
$blog->readmore = $this->hasReadmore($blog);
// // Truncate content
// $this->truncate($blog);
// EB::truncateContent($blog, $loadVideo, $frontpage, $loadGallery);
// Format the content for the featured items
if (empty($blog->intro)) {
$blog->intro = $blog->content;
}
// We wouldn't want to display html codes in the content
$blog->intro = strip_tags($blog->intro);
// Get the content length
$length = JString::strlen($blog->intro);
if ($length > $contentLimit) {
$blog->intro = JString::substr($blog->intro, 0, $contentLimit);
}
// Prepare nice date for the featured area
$blog->date = EB::date($blog->created)->format(JText::_('DATE_FORMAT_LC'));
$result[] = $blog;
}
return $result;
}
示例10: __construct
public function __construct($overrideTheme = null, $options = array())
{
parent::__construct();
// Determine if this is an admin location
if (isset($options['admin']) && $options['admin']) {
$this->admin = true;
}
// Determine the configured theme
$theme = $this->config->get('layout_theme', $overrideTheme);
// If a view is provided into the theme, the theme files could call methods from a view
if (isset($options['view']) && is_object($options['view'])) {
$this->view = $options['view'];
}
$this->theme = $theme;
$obj = new stdClass();
$obj->config = EB::config();
$obj->my = JFactory::getUser();
$obj->admin = EB::isSiteAdmin();
$obj->profile = EB::user();
// If it's development mode, allow user to invoke in the url to change theme.
$environment = $obj->config->get('easyblog_environment');
if ($environment == 'development') {
$invokeTheme = $this->input->get('theme', '', 'word');
if ($invokeTheme) {
$this->theme = $invokeTheme;
}
}
// If this is entry view, or category view, we need to respect the theme's category
$this->menu = $this->app->getMenu()->getActive();
$this->params = new JRegistry();
// If there is an active menu, try to get the menu parameters.
if ($this->menu) {
// Get the params prefix
$prefix = isset($options['paramsPrefix']) ? $options['paramsPrefix'] : '';
// Set the current parameters.
if ($prefix) {
$model = EB::model('Menu');
$this->params = $model->getCustomMenuParams($this->menu->id, $this->menu->params, $prefix);
} else {
$this->params = $this->menu->params;
}
// We will just set it here from the menu when this class first get instantiate.
// The corresponding view will have to do their own assignment if the view's templates need to access this entryParams
$this->entryParams = $this->params;
}
//is blogger mode flag
$obj->isBloggerMode = EBR::isBloggerMode();
$this->my = $obj->my;
// Assign the acl
$this->acl = EB::acl();
}
示例11: html
/**
* Displays the comment output
*
* @since 4.0
* @access public
* @param string
* @return
*/
public function html(EasyBlogPost &$blog)
{
// Load up template file
$theme = EB::template();
// Get comments
$result = $this->prepareComments($blog);
$comments = isset($result->comments) ? $result->comments : array();
$pagination = isset($result->pagination) ? $result->pagination : false;
// Retrieve the pagination for the blog entry comment view
$pagination = $pagination->getPagesLinks();
// Get user's information
$profile = EB::user($this->my->id);
// Retrieve blog posts url
$url = base64_encode($blog->getPermalink());
// Retrieve login url
$loginUrl = EB::getLoginLink($url);
// check if the user has subcribed to this thread
$subscribed = false;
if (!$this->my->guest) {
$model = EB::model('Blog');
$subscribed = $model->isBlogSubscribedUser($blog->id, $this->my->id, $this->my->email);
}
// Determines if the user can register while commenting
$registration = $this->canRegister();
$date = EB::date();
// Determines if we should show the website field
$website = false;
if ($this->config->get('comment_show_website') || $this->config->get('comment_required_website')) {
$website = true;
}
// Determines if we should show the email field
$email = false;
if ($this->config->get('comment_show_email') || $this->config->get('comment_require_email') || $registration) {
$email = true;
}
$language = JFactory::getLanguage();
$rtl = $language->isRTL();
$theme->set('rtl', $rtl);
$theme->set('email', $email);
$theme->set('website', $website);
$theme->set('date', $date);
$theme->set('user', $profile);
$theme->set('loginURL', $loginUrl);
$theme->set('blog', $blog);
$theme->set('comments', $comments);
$theme->set('pagination', $pagination);
$theme->set('registration', $registration);
$theme->set('subscribed', $subscribed);
$output = $theme->output('site/comments/default');
return $output;
}
示例12: execute
public function execute()
{
if ($this->cache) {
//preload posts information
EB::cache()->insert($this->items);
}
// For featured items we wouldn't want to process comments
$comment = true;
// For featured items we want to remove featured image
$removeFeaturedImage = true;
// For featured items we do not want to load videos
$video = false;
// For featured items we do not want to process gallery
$gallery = false;
// Ensure that the content does not exceed the introtext limit for featured items
$contentLimit = $this->config->get('layout_featured_intro_limit');
$result = array();
foreach ($this->items as &$item) {
$blog = EB::post($item->id);
// Load the author's profile
$author = EB::user($blog->created_by);
// @Assign dynamic properties that must exist everytime formatBlog is called
// We can't rely on ->author because CB plugins would mess things up.
$blog->author = $author;
$blog->blogger = $author;
// Password verifications
$this->password($blog);
// Format microblog postings
if ($blog->posttype) {
$this->formatMicroblog($blog);
}
// Get featured image
if ($blog->hasImage()) {
$blog->image = $blog->getImage($this->config->get('cover_featured_size', 'large'));
} else {
$tmp = $blog->getContentImage();
if ($tmp) {
$blog->image = $tmp;
} else {
$blog->image = '';
}
}
// Detect if content requires read more link
$blog->readmore = $this->hasReadmore($blog);
// Prepare nice date for the featured area
$blog->date = EB::date($blog->created)->format(JText::_('DATE_FORMAT_LC'));
$result[] = $blog;
}
return $result;
}
示例13: getUsers
public static function getUsers()
{
$id = JRequest::getVar('id');
$view = JRequest::getVar('view');
$db = EB::db();
$query = '';
if ($view == 'entry') {
$query = 'select disctinct a.`user_id` from `#__easyblog_subscriptions` as a';
$query .= ' inner join `#__users` as b on a.`user_id` = b.`id`';
$query .= ' where (';
// entry
$query .= ' (a.`uid` = ' . $db->Quote($id) . ' AND a.`utype` = ' . $db->Quote(EBLOG_SUBSCRIPTION_ENTRY) . ') OR';
// category
$query .= ' (a.`uid` IN (select pc.`category_id` from `#__easyblog_post_category` as pc where pc.`post_id` = ' . $db->Quote($id) . ' ) AND a.`utype` = ' . $db->Quote(EBLOG_SUBSCRIPTION_CATEGORY) . ') OR';
// teamblog
$query .= ' (a.`uid` IN (select pc.`source_id` from `#__easyblog_post` as p where p.`id` = ' . $db->Quote($id) . ' and p.`source_type` = ' . $db->Quote(EASYBLOG_POST_SOURCE_TEAM) . ' ) AND a.`utype` = ' . $db->Quote(EBLOG_SUBSCRIPTION_TEAMBLOG) . ')';
$query .= ')';
} else {
if ($view == 'categories' && $id) {
$query = 'select disctinct a.`user_id` from `#__easyblog_subscriptions` as a';
$query .= ' inner join `#__users` as b on a.`user_id` = b.`id`';
$query .= ' where a.`uid` = ' . $db->Quote($id);
$query .= ' and a.`utype` = ' . $db->Quote(EBLOG_SUBSCRIPTION_CATEGORY);
} else {
if ($view == 'teamblog') {
$query = 'select disctinct a.`user_id` from `#__easyblog_subscriptions` as a';
$query .= ' inner join `#__users` as b on a.`user_id` = b.`id`';
$query .= ' where a.`uid` = ' . $db->Quote($id);
$query .= ' and a.`utype` = ' . $db->Quote(EBLOG_SUBSCRIPTION_TEAMBLOG);
}
}
}
$db->setQuery($query);
$result = $db->loadObjectList();
if (!$result) {
return false;
}
//preload users
$ids = array();
foreach ($result as $row) {
$ids[] = $row->user_id;
}
EB::user($ids);
$subscribers = array();
foreach ($result as $row) {
$subscribers[] = EB::user($row->user_id);
}
return $subscribers;
}
示例14: getInput
protected function getInput()
{
$title = JText::_('COM_EASYBLOG_SELECT_A_USER');
if ($this->value) {
$author = EB::user((int) $this->value);
$title = $author->getName();
}
$theme = EB::template();
$theme->set('id', $this->id);
$theme->set('name', $this->name);
$theme->set('value', $this->value);
$theme->set('title', $title);
$output = $theme->output('admin/elements/authors');
return $output;
}
示例15: display
/**
* Default display method for my blog listings
*
* @since 4.0
* @access public
* @param string
* @return
*/
public function display($tmpl = null)
{
// Require user to be logged in to access this page
EB::requireLogin();
// Get the default sorting behavior
$sort = $this->input->get('sort', $this->config->get('layout_postorder'), 'cmd');
// Load up the author profile
$author = EB::user($this->my->id);
// Set meta tags for blogger
EB::setMeta($this->my->id, META_ID_BLOGGERS);
// Set the breadcrumbs
$this->setPathway(JText::_('COM_EASYBLOG_BLOGGERS_BREADCRUMB'), EB::_('index.php?option=com_easyblog&view=blogger'));
$this->setPathway($author->getName());
$menu = JFactory::getApplication()->getMenu();
$categoryInclusion = array();
if ($menu) {
$active = $menu->getActive();
$categoryInclusion = $active->params->get('inclusion');
}
$model = EB::model('Blog');
$posts = $model->getBlogsBy('blogger', $author->id, $sort, 0, EBLOG_FILTER_PUBLISHED, false, false, array(), false, false, true, array(), $categoryInclusion);
// Get the pagination
$pagination = $model->getPagination();
// Set the page title
$title = $author->getName() . ' - ' . EB::getPageTitle(JText::_('COM_EASYBLOG_MY_BLOG_PAGE_TITLE'));
$this->setPageTitle($title, $pagination, $this->config->get('main_pagetitle_autoappend'));
// Format the posts
$posts = EB::formatter('list', $posts);
// Add the RSS headers on the page
EB::feeds()->addHeaders('index.php?option=com_easyblog&view=myblog');
// Determines if the viewer already subscribed to the author
$subscribed = false;
$bloggerModel = EB::model('Blogger');
if ($bloggerModel->isBloggerSubscribedUser($author->id, $this->my->id, $this->my->email)) {
$subscribed = true;
}
// Get the current url
$return = EBR::_('index.php?option=com_easyblog', false);
$this->set('return', $return);
$this->set('subscribed', $subscribed);
$this->set('author', $author);
$this->set('posts', $posts);
$this->set('sort', $sort);
$this->set('pagination', $pagination);
parent::display('blogs/myblog/default');
}