本文整理汇总了PHP中KunenaFactory::getProfile方法的典型用法代码示例。如果您正苦于以下问题:PHP KunenaFactory::getProfile方法的具体用法?PHP KunenaFactory::getProfile怎么用?PHP KunenaFactory::getProfile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KunenaFactory
的用法示例。
在下文中一共展示了KunenaFactory::getProfile方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: onKunenaPrepare
public function onKunenaPrepare($context, &$item, &$params, $page = 0) {
if ($context == 'kunena.user') {
$triggerParams = array ('userid' => $item->userid, 'userinfo' => &$item );
$integration = KunenaFactory::getProfile();
if ( $integration instanceof KunenaProfileComprofiler) KunenaProfileComprofiler::trigger ( 'profileIntegration', $triggerParams );
}
}
示例2: display
public function display($cachable = false, $urlparams = false)
{
// Redirect profile to integrated component if profile integration is turned on
$redirect = 1;
$active = $this->app->getMenu()->getActive();
if (!empty($active)) {
$params = $active->params;
$redirect = $params->get('integration', 1);
}
if ($redirect && JRequest::getCmd('format', 'html') == 'html') {
$profileIntegration = KunenaFactory::getProfile();
$layout = JRequest::getCmd('layout', 'default');
if ($profileIntegration instanceof KunenaProfileKunena) {
// Continue
} elseif ($layout == 'default') {
$url = $this->me->getUrl(false);
} elseif ($layout == 'list') {
$url = $profileIntegration->getUserListURL('', false);
}
if (!empty($url)) {
$this->setRedirect($url);
return;
}
}
$layout = JRequest::getCmd('layout', 'default');
if ($layout == 'list') {
if (KunenaFactory::getConfig()->userlist_allowed && JFactory::getUser()->guest) {
$this->redirectBack();
}
}
parent::display();
}
示例3: _getUserListLink
protected function _getUserListLink($action, $name, $title = null, $rel = 'nofollow')
{
$profile = KunenaFactory::getProfile();
$link = $profile->getUserListURL($action, true);
return "<a href=\"{$link}\" title=\"{$title}\" rel=\"{$rel}\">{$name}</a>";
}
示例4: before
/**
* Load user profile.
*
* @return void
*
* @throws KunenaExceptionAuthorise
*/
protected function before()
{
parent::before();
// If profile integration is disabled, this view doesn't exist.
$integration = KunenaFactory::getProfile();
if (get_class($integration) == 'KunenaProfileNone')
{
throw new KunenaExceptionAuthorise(JText::_('COM_KUNENA_PROFILE_DISABLED'), 404);
}
$userid = $this->input->getInt('userid');
require_once KPATH_SITE . '/models/user.php';
$this->model = new KunenaModelUser(array(), $this->input);
$this->model->initialize($this->getOptions(), $this->getOptions()->get('embedded', false));
$this->state = $this->model->getState();
$this->me = KunenaUserHelper::getMyself();
$this->user = JFactory::getUser($userid);
$this->profile = KunenaUserHelper::get($userid);
$this->profile->tryAuthorise('read');
// Update profile hits.
if (!$this->profile->exists() || !$this->profile->isMyself())
{
$this->profile->uhits++;
$this->profile->save();
}
$this->headerText = JText::sprintf('COM_KUNENA_VIEW_USER_DEFAULT', $this->profile->getName());
}
示例5: display
public function display($cachable = false, $urlparams = false)
{
// Redirect profile to integrated component if profile integration is turned on
$redirect = 1;
$active = $this->app->getMenu()->getActive();
if (!empty($active)) {
if (version_compare(JVERSION, '1.6', '>')) {
// Joomla 1.6+
$params = $active->params;
} else {
// Joomla 1.5
$params = new JParameter($active->params);
}
$redirect = $params->get('integration', 1);
}
if ($redirect && JRequest::getCmd('format') == 'html') {
$profileIntegration = KunenaFactory::getProfile();
if ($profileIntegration instanceof KunenaProfileKunena) {
// Continue
} elseif (JRequest::getCmd('layout', 'default') == 'default') {
$url = $this->me->getUrl(false);
} elseif (JRequest::getCmd('layout') == 'list') {
$url = $profileIntegration->getUserListURL('', false);
}
if (!empty($url)) {
$this->setRedirect($url);
return;
}
}
parent::display();
}
示例6: before
/**
* Prepare statistics box display.
*
* @return boolean
*/
protected function before()
{
parent::before();
$this->config = KunenaConfig::getInstance();
if (!$this->config->get('showstats') || !$this->config->statslink_allowed && !KunenaUserHelper::get()->exists()) {
throw new KunenaExceptionAuthorise(JText::_('COM_KUNENA_NO_ACCESS'), '404');
}
$statistics = KunenaForumStatistics::getInstance();
$statistics->loadGeneral();
$this->setProperties($statistics);
$this->latestMemberLink = KunenaFactory::getUser(intval($this->lastUserId))->getLink();
$this->statisticsUrl = KunenaFactory::getProfile()->getStatisticsURL();
return true;
}
示例7: before
/**
* Prepare user for editing.
*
* @return void
*
* @throws KunenaExceptionAuthorise
*/
protected function before()
{
parent::before();
// If profile integration is disabled, this view doesn't exist.
$integration = KunenaFactory::getProfile();
if (get_class($integration) == 'KunenaProfileNone') {
throw new KunenaExceptionAuthorise(JText::_('COM_KUNENA_PROFILE_DISABLED'), 404);
}
$userid = $this->input->getInt('userid');
$this->user = JFactory::getUser($userid);
$this->profile = KunenaUserHelper::get($userid);
$this->profile->tryAuthorise('edit');
$this->headerText = JText::sprintf('COM_KUNENA_VIEW_USER_DEFAULT', $this->profile->getName());
}
示例8: before
/**
* Prepare general statistics display.
*
* @return void
*
* @throws KunenaExceptionAuthorise
*/
protected function before()
{
parent::before();
$this->config = KunenaConfig::getInstance();
if (!$this->config->get('showstats')) {
throw new KunenaExceptionAuthorise(JText::_('COM_KUNENA_NO_ACCESS'), '404');
}
if (!$this->config->statslink_allowed && JFactory::getUser()->guest) {
throw new KunenaExceptionAuthorise(JText::_('COM_KUNENA_NO_ACCESS'), '401');
}
$statistics = KunenaForumStatistics::getInstance();
$statistics->loadAll();
$this->setProperties($statistics);
$this->latestMemberLink = KunenaFactory::getUser((int) $this->lastUserId)->getLink();
$this->userlistUrl = KunenaFactory::getProfile()->getUserListUrl();
}
示例9: before
/**
* Prepare Who is online display.
*
* @return void
*
* @throws KunenaExceptionAuthorise
*/
protected function before()
{
parent::before();
$this->config = KunenaConfig::getInstance();
if (!$this->config->get('showwhoisonline')) {
throw new KunenaExceptionAuthorise(JText::_('COM_KUNENA_NO_ACCESS'), '404');
}
$me = KunenaUserHelper::getMyself();
$moderator = intval($me->isModerator()) + intval($me->isAdmin());
$users = KunenaUserHelper::getOnlineUsers();
KunenaUserHelper::loadUsers(array_keys($users));
$onlineusers = KunenaUserHelper::getOnlineCount();
$who = '<strong>' . $onlineusers['user'] . ' </strong>';
if ($onlineusers['user'] == 1) {
$who .= JText::_('COM_KUNENA_WHO_ONLINE_MEMBER') . ' ';
} else {
$who .= JText::_('COM_KUNENA_WHO_ONLINE_MEMBERS') . ' ';
}
$who .= JText::_('COM_KUNENA_WHO_AND');
$who .= '<strong> ' . $onlineusers['guest'] . ' </strong>';
if ($onlineusers['guest'] == 1) {
$who .= JText::_('COM_KUNENA_WHO_ONLINE_GUEST') . ' ';
} else {
$who .= JText::_('COM_KUNENA_WHO_ONLINE_GUESTS') . ' ';
}
$who .= JText::_('COM_KUNENA_WHO_ONLINE_NOW');
$this->membersOnline = $who;
$this->onlineList = array();
$this->hiddenList = array();
foreach ($users as $userid => $usertime) {
$user = KunenaUserHelper::get($userid);
if (!$user->showOnline) {
if ($moderator) {
$this->hiddenList[$user->getName()] = $user;
}
} else {
$this->onlineList[$user->getName()] = $user;
}
}
ksort($this->onlineList);
ksort($this->hiddenList);
$profile = KunenaFactory::getProfile();
$this->usersUrl = $profile->getUserListURL();
}
示例10: display
public function display() {
// Redirect profile to integrated component if profile integration is turned on
$redirect = 1;
$active = JFactory::getApplication ()->getMenu ()->getActive ();
if (!empty($active)) {
$params = new JParameter($active->params);
$redirect = $params->get('integration');
}
if ($redirect) {
$profileIntegration = KunenaFactory::getProfile();
if (!($profileIntegration instanceof KunenaProfileKunena)) {
$url = CKunenaLink::GetProfileURL(KunenaFactory::getUser()->userid, false);
if ($url) {
$this->setRedirect($url);
return;
}
}
}
parent::display();
}
示例11: getLink
/**
* Get the profile URL of the current logged-in user
*/
protected function getLink()
{
$user = JFactory::getUser();
$link = $this->params->get('link', false);
if (!$link || $user->guest) {
return;
}
switch ($link) {
case 'com_kunena':
require_once JPATH_ADMINISTRATOR . '/components/com_kunena/libraries/factory.php';
return KunenaFactory::getProfile()->getProfileURL($user->id);
case 'com_community':
return JRoute::_('index.php?option=com_community&view=profile&userid=' . $user->id);
case 'com_comprofiler':
include_once JPATH_ADMINISTRATOR . '/components/com_comprofiler/plugin.foundation.php';
cbimport('cb.database');
return $GLOBALS['_CB_framework']->userProfileUrl($user->id);
}
}
示例12: getMessageProfileBox
function getMessageProfileBox()
{
static $profiles = array();
$key = $this->profile->userid . '.' . $this->profile->username;
if (!isset($profiles[$key])) {
// Run events
$params = new JRegistry();
// Modify profile values by integration
$params->set('ksource', 'kunena');
$params->set('kunena_view', 'topic');
$params->set('kunena_layout', $this->state->get('layout'));
JPluginHelper::importPlugin('kunena');
$dispatcher = JDispatcher::getInstance();
$dispatcher->trigger('onKunenaPrepare', array('kunena.user', &$this->profile, &$params, 0));
//karma points and buttons
$this->userkarma_title = $this->userkarma_minus = $this->userkarma_plus = '';
if ($this->config->showkarma && $this->profile->userid) {
$this->userkarma_title = JText::_('COM_KUNENA_KARMA') . ": " . $this->profile->karma;
if ($this->me->userid && $this->me->userid != $this->profile->userid) {
$this->userkarma_minus = ' ' . JHtml::_('kunenaforum.link', 'index.php?option=com_kunena&view=user&task=karmadown&userid=' . $this->profile->userid . '&' . JSession::getFormToken() . '=1', '<span class="kkarma-minus" alt="Karma-" border="0" title="' . JText::_('COM_KUNENA_KARMA_SMITE') . '"> </span>');
$this->userkarma_plus = ' ' . JHtml::_('kunenaforum.link', 'index.php?option=com_kunena&view=user&task=karmaup&userid=' . $this->profile->userid . '&' . JSession::getFormToken() . '=1', '<span class="kkarma-plus" alt="Karma+" border="0" title="' . JText::_('COM_KUNENA_KARMA_APPLAUD') . '"> </span>');
}
}
if ($this->me->exists() && $this->message->userid == $this->me->userid) {
$usertype = 'me';
} else {
$usertype = $this->profile->getType($this->category->id, true);
}
// TODO: add context (options) to caching
$cache = JFactory::getCache('com_kunena', 'output');
$cachekey = "profile.{$this->getTemplateMD5()}.{$this->profile->userid}.{$usertype}";
$cachegroup = 'com_kunena.messages';
// FIXME: enable caching after fixing the issues
$contents = false;
//$cache->get($cachekey, $cachegroup);
if (!$contents) {
$this->userkarma = "{$this->userkarma_title} {$this->userkarma_minus} {$this->userkarma_plus}";
// Use kunena profile
if ($this->config->showuserstats) {
$this->userrankimage = $this->profile->getRank($this->topic->category_id, 'image');
$this->userranktitle = $this->profile->getRank($this->topic->category_id, 'title');
$this->userposts = $this->profile->posts;
$activityIntegration = KunenaFactory::getActivityIntegration();
$this->userthankyou = $this->profile->thankyou;
$this->userpoints = $activityIntegration->getUserPoints($this->profile->userid);
$this->usermedals = $activityIntegration->getUserMedals($this->profile->userid);
} else {
$this->userrankimage = null;
$this->userranktitle = null;
$this->userposts = null;
$this->userthankyou = null;
$this->userpoints = null;
$this->usermedals = null;
}
$this->personalText = KunenaHtmlParser::parseText($this->profile->personalText);
$contents = trim(KunenaFactory::getProfile()->showProfile($this, $params));
if (!$contents) {
$contents = (string) $this->loadTemplateFile('profile');
}
$contents .= implode(' ', $dispatcher->trigger('onKunenaDisplay', array('topic.profile', $this, $params)));
// FIXME: enable caching after fixing the issues (also external profile stuff affects this)
//if ($this->cache) $cache->store($contents, $cachekey, $cachegroup);
}
$profiles[$key] = $contents;
}
return $profiles[$key];
}
示例13: displayCommon
/**
* @param null $tpl
*
* @throws Exception
*/
protected function displayCommon($tpl = null)
{
$userid = JFactory::getApplication()->input->getInt('userid');
$this->_db = JFactory::getDBO();
$this->do = JFactory::getApplication()->input->getWord('layout');
if (!$userid) {
$this->user = JFactory::getUser();
} else {
$this->user = JFactory::getUser($userid);
}
if ($this->user->id == 0 || $this->me->userid == 0 && !$this->config->pubprofile) {
$this->app->enqueueMessage(JText::_('COM_KUNENA_PROFILEPAGE_NOT_ALLOWED_FOR_GUESTS'), 'notice');
return;
}
$integration = KunenaFactory::getProfile();
$activityIntegration = KunenaFactory::getActivityIntegration();
$template = KunenaFactory::getTemplate();
$this->params = $template->params;
if (get_class($integration) == 'KunenaProfileNone') {
$this->app->enqueueMessage(JText::_('COM_KUNENA_PROFILE_DISABLED'), 'notice');
return;
}
$this->allow = true;
$this->profile = KunenaFactory::getUser($this->user->id);
if (!$this->profile->exists()) {
$this->profile->save();
}
if ($this->profile->userid == $this->me->userid) {
if ($this->do != 'edit') {
$this->editlink = $this->profile->getLink(JText::_('COM_KUNENA_EDIT') . ' »', JText::_('COM_KUNENA_EDIT') . ' »', 'nofollow', 'edit', '');
} else {
$this->editlink = $this->profile->getLink(JText::_('COM_KUNENA_BACK') . ' »', JText::_('COM_KUNENA_BACK') . ' »', 'nofollow', '', '');
}
}
$this->name = $this->user->username;
if ($this->config->showuserstats) {
$this->rank_image = $this->profile->getRank(0, 'image');
$this->rank_title = $this->profile->getRank(0, 'title');
$this->posts = $this->profile->posts;
$this->thankyou = $this->profile->thankyou;
$this->userpoints = $activityIntegration->getUserPoints($this->profile->userid);
$this->usermedals = $activityIntegration->getUserMedals($this->profile->userid);
}
if ($this->config->userlist_joindate || $this->me->isModerator()) {
$this->registerdate = $this->user->registerDate;
}
if ($this->config->userlist_lastvisitdate || $this->me->isModerator()) {
$this->lastvisitdate = $this->user->lastvisitDate;
}
if (!isset($this->lastvisitdate) || $this->lastvisitdate == "0000-00-00 00:00:00") {
$this->lastvisitdate = null;
}
$this->avatarlink = $this->profile->getAvatarImage('kavatar', 'profile');
$this->personalText = $this->profile->personalText;
$this->signature = $this->profile->signature;
$this->signatureHtml = KunenaHtmlParser::parseBBCode($this->signature, null, $this->config->maxsig);
$this->localtime = KunenaDate::getInstance('now', $this->user->getParam('timezone', $this->app->get('offset', null)));
try {
$offset = new DateTimeZone($this->user->getParam('timezone', $this->app->get('offset', null)));
} catch (Exception $e) {
$offset = null;
}
$this->localtime->setTimezone($offset);
$this->moderator = KunenaAccess::getInstance()->getModeratorStatus($this->profile);
$this->admin = $this->profile->isAdmin();
switch ($this->profile->gender) {
case 1:
$this->genderclass = 'male';
$this->gender = JText::_('COM_KUNENA_MYPROFILE_GENDER_MALE');
break;
case 2:
$this->genderclass = 'female';
$this->gender = JText::_('COM_KUNENA_MYPROFILE_GENDER_FEMALE');
break;
default:
$this->genderclass = 'unknown';
$this->gender = JText::_('COM_KUNENA_MYPROFILE_GENDER_UNKNOWN');
}
if ($this->profile->location) {
$this->locationlink = '<a href="http://maps.google.com?q=' . $this->escape($this->profile->location) . '" target="_blank">' . $this->escape($this->profile->location) . '</a>';
} else {
$this->locationlink = JText::_('COM_KUNENA_LOCATION_UNKNOWN');
}
$this->online = $this->profile->isOnline();
$this->showUnusedSocial = true;
if (!preg_match("~^(?:f|ht)tps?://~i", $this->profile->websiteurl)) {
$this->websiteurl = 'http://' . $this->profile->websiteurl;
} else {
$this->websiteurl = $this->profile->websiteurl;
}
$avatar = KunenaFactory::getAvatarIntegration();
$this->editavatar = $avatar instanceof KunenaAvatarKunena ? true : false;
$this->banInfo = KunenaUserBan::getInstanceByUserid($userid, true);
$this->canBan = $this->banInfo->canBan();
if ($this->config->showbannedreason) {
//.........这里部分代码省略.........
示例14: loadTopProfiles
public function loadTopProfiles($limit=0) {
$limit = $limit ? $limit : $this->_config->popusercount;
if (count($this->topProfiles) < $limit) {
$this->topProfiles = KunenaFactory::getProfile()->getTopHits($limit);
$top = reset($this->topProfiles);
if (empty($top->count)) {
$this->topProfiles = array();
return;
}
foreach ($this->topProfiles as $item) {
$item->link = CKunenaLink::GetProfileLink($item->id);
$item->percent = round(100 * $item->count / $top->count);
}
$top->title = JText::_('COM_KUNENA_STAT_TOP') .' '. $limit .' '. JText::_('COM_KUNENA_STAT_POPULAR') .' '. JText::_('COM_KUNENA_STAT_POPULAR_USER_GSG');
$top->titleName = JText::_('COM_KUNENA_USRL_USERNAME');
$top->titleCount = JText::_('COM_KUNENA_USRL_HITS');
}
return array_slice($this->topProfiles, 0, $limit);
}
示例15: __construct
function __construct($userid, $do = '')
{
$this->_app = JFactory::getApplication();
$this->my = JFactory::getUser();
$this->do = $do;
if ($this->do == 'login') {
return $this->login();
} elseif ($this->do == 'logout') {
return $this->logout();
}
kimport('html.parser');
require_once KPATH_SITE . '/lib/kunena.timeformat.class.php';
$this->_db = JFactory::getDBO();
$this->config = KunenaFactory::getConfig();
if (!$userid) {
$this->user = $this->my;
} else {
$this->user = JFactory::getUser($userid);
}
if ($this->user->id == 0 || $this->my->id == 0 && !$this->config->pubprofile) {
$this->allow = false;
$this->header = JText::_('COM_KUNENA_LOGIN_NOTIFICATION');
$this->body = JText::_('COM_KUNENA_PROFILEPAGE_NOT_ALLOWED_FOR_GUESTS') . ' ' . JText::_('COM_KUNENA_NO_ACCESS');
CKunenaTools::loadTemplate('/login.php');
return;
}
$integration = KunenaFactory::getProfile();
$activityIntegration = KunenaFactory::getActivityIntegration();
$template = KunenaFactory::getTemplate();
$this->params = $template->params;
if (get_class($integration) == 'KunenaProfileNone') {
$this->allow = false;
$this->header = JText::_('COM_KUNENA_PROFILE_DISABLED');
$this->body = JText::_('COM_KUNENA_PROFILE_DISABLED') . ' ' . JText::_('COM_KUNENA_NO_ACCESS');
CKunenaTools::loadTemplate('/login.php');
return;
}
$this->allow = true;
$this->profile = KunenaFactory::getUser($this->user->id);
if (!$this->profile->exists()) {
$this->profile->save();
}
if ($this->profile->userid == $this->my->id) {
if ($this->do != 'edit') {
$this->editlink = CKunenaLink::GetMyProfileLink($this->profile->userid, JText::_('COM_KUNENA_EDIT'), 'nofollow', 'edit');
} else {
$this->editlink = CKunenaLink::GetMyProfileLink($this->profile->userid, JText::_('COM_KUNENA_BACK'), 'nofollow');
}
}
$this->name = $this->user->username;
if ($this->config->userlist_name) {
$this->name = $this->user->name . ' (' . $this->name . ')';
}
if ($this->config->showuserstats) {
if ($this->config->userlist_usertype) {
$this->usertype = $this->user->usertype;
}
$this->rank_image = $this->profile->getRank(0, 'image');
$this->rank_title = $this->profile->getRank(0, 'title');
$this->posts = $this->profile->posts;
$this->userpoints = $activityIntegration->getUserPoints($this->profile->userid);
$this->usermedals = $activityIntegration->getUserMedals($this->profile->userid);
}
if ($this->config->userlist_joindate || CKunenaTools::isModerator($this->my->id)) {
$this->registerdate = $this->user->registerDate;
}
if ($this->config->userlist_lastvisitdate || CKunenaTools::isModerator($this->my->id)) {
$this->lastvisitdate = $this->user->lastvisitDate;
}
$this->avatarlink = $this->profile->getAvatarLink('kavatar', 'profile');
$this->personalText = $this->profile->personalText;
$this->signature = $this->profile->signature;
$this->timezone = $this->user->getParam('timezone', $this->_app->getCfg('offset', 0));
$this->moderator = CKunenaTools::isModerator($this->profile->userid);
$this->admin = CKunenaTools::isAdmin($this->profile->userid);
switch ($this->profile->gender) {
case 1:
$this->genderclass = 'male';
$this->gender = JText::_('COM_KUNENA_MYPROFILE_GENDER_MALE');
break;
case 2:
$this->genderclass = 'female';
$this->gender = JText::_('COM_KUNENA_MYPROFILE_GENDER_FEMALE');
break;
default:
$this->genderclass = 'unknown';
$this->gender = JText::_('COM_KUNENA_MYPROFILE_GENDER_UNKNOWN');
}
if ($this->profile->location) {
$this->locationlink = '<a href="http://maps.google.com?q=' . kunena_htmlspecialchars($this->profile->location) . '" target="_blank">' . kunena_htmlspecialchars($this->profile->location) . '</a>';
} else {
$this->locationlink = JText::_('COM_KUNENA_LOCATION_UNKNOWN');
}
$this->online = $this->profile->isOnline();
$this->showUnusedSocial = true;
$avatar = KunenaFactory::getAvatarIntegration();
$this->editavatar = is_a($avatar, 'KunenaAvatarKunena') ? true : false;
kimport('userban');
$this->banInfo = KunenaUserBan::getInstanceByUserid($userid, true);
$this->canBan = $this->banInfo->canBan();
//.........这里部分代码省略.........