本文整理汇总了PHP中CFactory::getRequestUser方法的典型用法代码示例。如果您正苦于以下问题:PHP CFactory::getRequestUser方法的具体用法?PHP CFactory::getRequestUser怎么用?PHP CFactory::getRequestUser使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CFactory
的用法示例。
在下文中一共展示了CFactory::getRequestUser方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _getFriendsHTML
/**
* Return friends html block
*/
function _getFriendsHTML()
{
$tmpl = new CTemplate();
$friendsModel = CFactory::getModel('friends');
$my = CFactory::getUser();
$user = CFactory::getRequestUser();
$params = $user->getParams();
// site visitor
$relation = 10;
// site members
if ($my->id != 0) {
$relation = 20;
}
// friends
if (CFriendsHelper::isConnected($my->id, $user->id)) {
$relation = 30;
}
// mine
if (COwnerHelper::isMine($my->id, $user->id)) {
$relation = 40;
}
// @todo: respect privacy settings
if ($relation >= $params->get('privacyFriendsView')) {
$friends =& $friendsModel->getFriends($user->id, 'latest', false, '', PROFILE_MAX_FRIEND_LIMIT + PROFILE_MAX_FRIEND_LIMIT);
// randomize the friend count
if ($friends) {
shuffle($friends);
}
$tmpl->setRef('friends', $friends);
$tmpl->set('total', $user->getFriendCount());
$tmpl->setRef('user', $user);
return $tmpl->fetch('profile.friends');
}
}
示例2: onProfileDisplay
function onProfileDisplay()
{
if (!self::kunenaOnline()) {
return;
}
//Load Language file.
JPlugin::loadLanguage('plg_community_mykunena', JPATH_ADMINISTRATOR);
$document = JFactory::getDocument();
$document->addStyleSheet(JURI::base() . 'plugins/community/mykunena/style.css');
$items = array();
$user = CFactory::getRequestUser();
if ($user->id) {
require_once KPATH_SITE . '/funcs/latestx.php';
$obj = new CKunenaLatestX('userposts', 0);
$obj->user = JFactory::getUser($user->id);
$obj->threads_per_page = $this->params->get('count', 5);
$obj->embedded = 1;
$obj->getUserPosts();
$items = $obj->customreply;
}
$caching = $this->params->get('cache', 1);
if ($caching) {
$app = JFactory::getApplication();
$caching = $app->getCfg('caching');
}
$cache = JFactory::getCache('plgCommunityMyKunena');
$cache->setCaching($caching);
$callback = array('plgCommunityMyKunena', '_getMyKunenaHTML');
$content = $cache->call($callback, $user, $items);
return $content;
}
示例3: onProfileDisplay
/**
* Ajax function to save a new wall entry
*
* @param message A message that is submitted by the user
* @param uniqueId The unique id for this group
*
**/
function onProfileDisplay()
{
JPlugin::loadLanguage('plg_community_myvideos', JPATH_ADMINISTRATOR);
$mainframe = JFactory::getApplication();
$document = JFactory::getDocument();
$user = CFactory::getRequestUser();
$userid = $user->id;
$this->loadUserParams();
$def_limit = $this->params->get('count', 10);
$limit = JRequest::getVar('limit', $def_limit, 'REQUEST');
$limitstart = JRequest::getVar('limitstart', 0, 'REQUEST');
$row = $this->getVideos($userid, $limitstart, $limit);
$total = count($row);
if ($this->params->get('hide_empty', 0) && !$total) {
return '';
}
$caching = $this->params->get('cache', 1);
if ($caching) {
$caching = $mainframe->getCfg('caching');
}
$cache = JFactory::getCache('plgCommunityMyVideos');
$cache->setCaching($caching);
$callback = array('plgCommunityMyVideos', '_getLatestVideosHTML');
$count = $this->userparams->get('count', $def_limit);
$dbg = "<!--DEFLIMIT {$def_limit} USERPARAMLIMIT {$count}-->";
$content = $dbg . $cache->call($callback, $userid, $count, $limitstart, $row, $total);
return $content;
}
示例4: onProfileDisplay
function onProfileDisplay()
{
JPlugin::loadLanguage('plg_community_mygoogleads', JPATH_ADMINISTRATOR);
$config = CFactory::getConfig();
$config = CFactory::getConfig();
$this->loadUserParams();
$uri = JURI::base();
$user = CFactory::getRequestUser();
$document = JFactory::getDocument();
$css = $uri . 'plugins/community/mygoogleads/mygoogleads/style.css';
$document->addStyleSheet($css);
$googleCode = $this->userparams->get('googleCode');
$content = '';
if (!empty($googleCode)) {
$mainframe = JFactory::getApplication();
$caching = $this->params->get('cache', 1);
if ($caching) {
$caching = $mainframe->getCfg('caching');
}
$cache = JFactory::getCache('plgCommunityMyGoogleAds');
$cache->setCaching($caching);
$callback = array('plgCommunityMyGoogleAds', '_getGoogleAdsHTML');
$content = $cache->call($callback, $googleCode, $user->id);
} else {
// $content = "<div class=\"icon-nopost\"><img src=\"".JURI::base()."components/com_community/assets/error.gif\" alt=\"\" /></div>";
$content .= "<div class=\"content-nopost\">" . JText::_('PLG_GOOGLE_ADS_NOT_SET') . "</div>";
}
return $content;
}
示例5: onProfileDisplay
/**
* Ajax function to save a new wall entry
*
* @param message A message that is submitted by the user
* @param uniqueId The unique id for this group
*
**/
function onProfileDisplay()
{
JPlugin::loadLanguage('plg_community_mytaggedvideos', JPATH_ADMINISTRATOR);
$mainframe = JFactory::getApplication();
// Attach CSS
$document = JFactory::getDocument();
// $css = JURI::base() . 'plugins/community/myvideos/style.css';
// $document->addStyleSheet($css);
$user = CFactory::getRequestUser();
$userid = $user->id;
$this->loadUserParams();
$def_limit = $this->params->get('count', 10);
$limit = JRequest::getVar('limit', $def_limit, 'REQUEST');
$limitstart = JRequest::getVar('limitstart', 0, 'REQUEST');
$row = $this->getVideos($userid);
$total = count($row);
if ($this->params->get('hide_empty', 0) && !$total) {
return '';
}
$caching = $this->params->get('cache', 1);
if ($caching) {
$caching = $mainframe->getCfg('caching');
}
$cache = JFactory::getCache('plgCommunityMyTaggedVideos');
$cache->setCaching($caching);
$callback = array('plgCommunityMyTaggedVideos', '_getLatestVideosHTML');
$content = $cache->call($callback, $userid, $this->userparams->get('count', 5), $limitstart, $row, $total);
return $content;
}
示例6: onProfileDisplay
/**
* Ajax function to save a new wall entry
*
* @param message A message that is submitted by the user
* @param uniqueId The unique id for this group
*
* */
function onProfileDisplay()
{
//Load language file.
JPlugin::loadLanguage('plg_community_myarticles', JPATH_ADMINISTRATOR);
// Attach CSS
$document = JFactory::getDocument();
$css = JURI::base() . 'plugins/community/myarticles/myarticles/style.css';
$document->addStyleSheet($css);
if (JRequest::getVar('task', '', 'REQUEST') == 'app') {
$app = 1;
} else {
$app = 0;
}
$user = CFactory::getRequestUser();
$userid = $user->id;
$def_limit = $this->params->get('count', 10);
$limit = JRequest::getVar('limit', $def_limit, 'REQUEST');
$limitstart = JRequest::getVar('limitstart', 0, 'REQUEST');
$row = $this->getArticle($userid, $limitstart, $limit, $this->section);
$cat = $this->getCatAlias();
$total = $this->countArticle($userid, $this->section);
if ($this->params->get('hide_empty', 0) && !$total) {
return '';
}
$mainframe = JFactory::getApplication();
$caching = $this->params->get('cache', 1);
if ($caching) {
$caching = $mainframe->getCfg('caching');
}
$cache = JFactory::getCache('plgCommunityMyArticles');
$cache->setCaching($caching);
$callback = array('plgCommunityMyArticles', '_getArticleHTML');
$content = $cache->call($callback, $userid, $limit, $limitstart, $row, $app, $total, $cat, $this->params);
return $content;
}
示例7: onProfileDisplay
function onProfileDisplay()
{
$config = CFactory::getConfig();
$this->loadUserParams();
$uri = JURI::base();
//$user = CFactory::getActiveProfile();
$user = CFactory::getRequestUser();
$document = JFactory::getDocument();
$css = $uri . 'plugins/community/groups/style.css';
$document->addStyleSheet($css);
$view = $this->params->get('fabrik_view');
$id = $this->params->get('fabrik_view_id');
$rowid = $this->params->get('fabrik_row_id');
$usekey = $this->params->get('fabrik_usekey');
$layout = $this->params->get('fabrik_layout');
$additional = $this->params->get('fabrik_additional');
$element = $this->params->get('fabrik_element');
if (!empty($view) && !empty($id)) {
$cache = JFactory::getCache('plgCommunityFabrik');
$cache->setCaching($this->params->get('cache', 1));
$className = 'plgCommunityFabrik';
$callback = array($className, '_getFabrikHTML');
$content = $cache->call($callback, $view, $id, $rowid, $usekey, $layout, $element, $additional, $this->userparams, $user->id);
} else {
$content = "<div class=\"icon-nopost\"><img src='" . JURI::base() . "components/com_community/assets/error.gif' alt=\"\" /></div>";
$content .= "<div class=\"content-nopost\">" . JText::_('Fabrik view details not set.') . "</div>";
}
return $content;
}
示例8: onProfileDisplay
/**
* Ajax function to save a new wall entry
*
* @param message A message that is submitted by the user
* @param uniqueId The unique id for this group
* @return type
*/
public function onProfileDisplay()
{
$this->loadLanguage();
$this->loadUserParams();
$mainframe = JFactory::getApplication();
// Attach CSS
$document = JFactory::getDocument();
$user = CFactory::getRequestUser();
$userid = $user->id;
$def_limit = $this->userparams->get('count', $this->params->get('count', 10));
$limit = JRequest::getVar('limit', $def_limit, 'REQUEST');
$limitstart = JRequest::getVar('limitstart', 0, 'REQUEST');
$row = $this->getPhotos($userid, $limitstart, $limit);
$total = count($row);
if ($this->params->get('hide_empty', 0) && !count($row)) {
return '';
}
$caching = $this->params->get('cache', 1);
if ($caching) {
$caching = $mainframe->getCfg('caching');
}
$cache = JFactory::getCache('plgCommunityMyLatestPhotos');
$cache->setCaching($caching);
$callback = array('plgCommunityMyLatestPhotos', '_getLatestPhotoHTML');
$content = $cache->call($callback, $userid, $limit, $limitstart, $row, $total);
return $content;
}
示例9: onProfileDisplay
function onProfileDisplay()
{
JPlugin::loadLanguage('plg_community_events', JPATH_ADMINISTRATOR);
$config = CFactory::getConfig();
if (!$config->get('enableevents')) {
return JText::_('PLG_EVENTS_EVENT_DISABLED');
}
$document = JFactory::getDocument();
$mainframe = JFactory::getApplication();
$user = CFactory::getRequestUser();
$caching = $this->params->get('cache', 1);
$model = CFactory::getModel('Events');
$my = CFactory::getUser();
$this->loadUserParams();
//CFactory::load( 'helpers' , 'event' );
$event = JTable::getInstance('Event', 'CTable');
$handler = CEventHelper::getHandler($event);
$events = $model->getEvents(null, $user->id, $this->params->get('sorting', 'latest'), null, true, false, null, null, $handler->getContentTypes(), $handler->getContentId(), $this->userparams->get('count', 5));
if ($this->params->get('hide_empty', 0) && !count($events)) {
return '';
}
if ($caching) {
$caching = $mainframe->getCfg('caching');
}
$creatable = $my->canCreateEvents();
$cache = JFactory::getCache('plgCommunityEvents');
$cache->setCaching($caching);
$callback = array($this, '_getEventsHTML');
$content = $cache->call($callback, true, $events, $user, $config, $model->getEventsCount($user->id), $creatable);
return $content;
}
示例10: onProfileDisplay
function onProfileDisplay()
{
JPlugin::loadLanguage('plg_twitter', JPATH_ADMINISTRATOR);
$user = CFactory::getRequestUser();
$document =& JFactory::getDocument();
$css = JURI::base() . 'plugins/community/twitter/style.css';
$document->addStyleSheet($css);
$my = CFactory::getUser();
$oauth =& JTable::getInstance('Oauth', 'CTable');
if (!$oauth->load($user->id, 'twitter')) {
return JText::_('PLG_TWITTER NOT SET');
}
return $this->_getTwitterHTML($user->id);
}
示例11: modGetGroupsHTML
/**
* Return groups html block
* @since 2.4
*/
public function modGetGroupsHTML($userid = null)
{
$html = '';
$my = CFactory::getUser($userid);
$user = CFactory::getRequestUser();
$params = $user->getParams();
// site visitor
$relation = 10;
// site members
if ($my->id != 0) {
$relation = 20;
}
// friends
if (CFriendsHelper::isConnected($my->id, $user->id)) {
$relation = 30;
}
// mine
if (COwnerHelper::isMine($my->id, $user->id)) {
$relation = 40;
}
// Respect privacy settings
if ($relation < $params->get('privacyGroupsView')) {
return '';
}
$tmpl = new CTemplate();
$model = CFactory::getModel('groups');
$userid = JRequest::getVar('userid', $my->id);
$user = CFactory::getUser($userid);
$groups = $model->getGroups($user->id);
$total = count($groups);
// Randomize groups
if ($groups) {
shuffle($groups);
}
CFactory::load('helpers', 'url');
// Load the groups as proper CTableGroup object
foreach ($groups as &$gr) {
$groupTable = JTable::getInstance('Group', 'CTable');
$groupTable->load($gr->id);
$gr = $groupTable;
}
for ($i = 0; $i < count($groups); $i++) {
$row =& $groups[$i];
$row->avatar = $row->getThumbAvatar();
$row->link = CUrl::build('groups', 'viewgroup', array('groupid' => $row->id), true);
}
$html = $tmpl->set('user', $user)->set('total', $total)->set('groups', $groups)->fetch('profile.groups');
return $html;
}
示例12: _getquick2cartstoreHTML
function _getquick2cartstoreHTML()
{
jimport('joomla.filesystem.file');
if (JFile::exists(JPATH_SITE . '/components/com_quick2cart/quick2cart.php')) {
$lang = JFactory::getLanguage();
$lang->load('com_quick2cart', JPATH_SITE);
$path = JPATH_SITE . DS . 'components' . DS . 'com_quick2cart' . DS . 'helper.php';
if (!class_exists('comquick2cartHelper')) {
//require_once $path;
JLoader::register('comquick2cartHelper', $path);
JLoader::load('comquick2cartHelper');
}
// Load assets
comquick2cartHelper::loadQuicartAssetFiles();
$product_path = JPATH_SITE . DS . 'components' . DS . 'com_quick2cart' . DS . 'helpers' . DS . 'product.php';
if (!class_exists('productHelper')) {
//require_once $path;
JLoader::register('productHelper', $product_path);
JLoader::load('productHelper');
}
$params = $this->params;
$no_of_stores = $params->get('no_of_stores', '2');
//Get profile id
$user = CFactory::getRequestUser();
$model = new productHelper();
$target_data = $model->getUserStores($user->_userid, $no_of_stores);
if (!empty($target_data)) {
$html = "\n\t\t\t\t<div class='techjoomla-bootstrap' >\n\t\t\t\t\t<div class='row-fluid'>\n\t\t\t\t\t<ul class='thumbnails' >\n\t\t\t\t\t";
foreach ($target_data as $data) {
$path = JPATH_SITE . DS . 'components' . DS . 'com_quick2cart' . DS . 'views' . DS . 'vendor' . DS . 'tmpl' . DS . 'thumbnail.php';
//@TODO condition vise mod o/p
ob_start();
include $path;
$html .= ob_get_contents();
ob_end_clean();
}
$html .= "\n\t\t\t\t\t\t</ul>\n\t\t\t\t\t</div>\n\t\t\t\t</div>";
return $html;
}
}
}
示例13: onProfileDisplay
/**
* Ajax function to save a new wall entry
*
* @param message A message that is submitted by the user
* @param uniqueId The unique id for this group
*
**/
function onProfileDisplay()
{
JPlugin::loadLanguage('plg_community_mytaggedvideos', JPATH_ADMINISTRATOR);
$mainframe = JFactory::getApplication();
// Attach CSS
$document = JFactory::getDocument();
// $css = JURI::base() . 'plugins/community/myvideos/style.css';
// $document->addStyleSheet($css);
$user = CFactory::getRequestUser();
$userid = $user->id;
$this->loadUserParams();
$limit = $this->params->get('count', 6);
$limitstart = JRequest::getVar('limitstart', 0, 'REQUEST');
$row = $this->getVideos($userid);
$total = count($row);
//we must filter the results
$results = array();
$limitCount = 0;
foreach ($row as $result) {
if (!CPrivacy::isAccessAllowed($this->_my->id, $userid, 'custom', $result->permissions)) {
continue;
}
$results[] = $result;
if (++$limit == $limitCount) {
break;
}
}
if ($this->params->get('hide_empty', 0) && !$total) {
return '';
}
$caching = $this->params->get('cache', 1);
if ($caching) {
$caching = $mainframe->getCfg('caching');
}
$cache = JFactory::getCache('plgCommunityMyTaggedVideos');
$cache->setCaching($caching);
$callback = array('plgCommunityMyTaggedVideos', '_getLatestVideosHTML');
$content = $cache->call($callback, $userid, $this->userparams->get('count', 5), $limitstart, $results, $total);
return $content;
}
示例14: onProfileDisplay
function onProfileDisplay()
{
JPlugin::loadLanguage('plg_community_feeds', JPATH_ADMINISTRATOR);
// Attach CSS
$document = JFactory::getDocument();
$css = JURI::base() . 'plugins/community/feeds/feeds/style.css';
$document->addStyleSheet($css);
$model = CFactory::getModel('profile');
$my = CFactory::getUser();
$user = CFactory::getRequestUser();
$this->loadUserParams();
$mainframe = JFactory::getApplication();
$data = $model->getViewableProfile($user->id);
$path = $this->userparams->get('path', '');
$limit = $this->userparams->get('count', '');
$cacheable = $this->params->get('cache', 1);
$cacheable = $cacheable ? $mainframe->getCfg('caching') : $cacheable;
$cache = JFactory::getCache('community');
$cache->setCaching($cacheable);
$content = $cache->call(array($this, '_getFeedHTML'), $path, $limit, $this->getLayout());
return $content;
}
示例15: groupsMyView
/**
* Return true if can view my group
* @param type $userId
* @return boolean
*/
public static function groupsMyView($userId)
{
$config = CFactory::getConfig();
$requestUser = CFactory::getRequestUser();
if ($userId == 0 && $requestUser->_cparams->get('privacyGroupsView') > 0) {
CAccess::setError('blockUnregister');
return false;
} else {
if (!$config->get('enablegroups')) {
CAccess::setError(JText::_('COM_COMMUNITY_GROUPS_DISABLE'));
return false;
} else {
return true;
}
}
}