当前位置: 首页>>代码示例>>PHP>>正文


PHP CRoute类代码示例

本文整理汇总了PHP中CRoute的典型用法代码示例。如果您正苦于以下问题:PHP CRoute类的具体用法?PHP CRoute怎么用?PHP CRoute使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了CRoute类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: display

 function display($data = null)
 {
     $mainframe = JFactory::getApplication();
     $config = CFactory::getConfig();
     $document =& JFactory::getDocument();
     $document->setTitle(JText::sprintf('CC FRONTPAGE TITLE', $config->get('sitename')));
     $document->setLink(CRoute::_('index.php?option=com_community'));
     $my = CFactory::getUser();
     CFactory::load('libraries', 'activities');
     CFactory::load('helpers', 'string');
     $act = new CActivityStream();
     $rows = $act->getFEED('', '', null, $mainframe->getCfg('feed_limit'));
     if ($config->get('showactivitystream') == COMMUNITY_SHOW || $config->get('showactivitystream') == COMMUNITY_MEMBERS_ONLY && $my->id != 0) {
         foreach ($rows->data as $row) {
             if ($row->type != 'title') {
                 // load individual item creator class
                 $item = new JFeedItem();
                 // cannot escape the title. it's already formated. we should
                 // escape it during CActivityStream::add
                 //$item->title 		= CStringHelper::escape($row->title);
                 $item->title = $row->title;
                 $item->link = CRoute::_('index.php?option=com_community&view=profile&userid=' . $row->actor);
                 $item->description = "<img src=\"{$row->favicon}\" alt=\"\"/>&nbsp;" . $row->title;
                 $item->date = $row->createdDate;
                 $item->category = '';
                 //$row->category;
                 // Make sure url is absolute
                 $item->description = JString::str_ireplace('href="/', 'href="' . JURI::base(), $item->description);
                 // loads item info into rss array
                 $document->addItem($item);
             }
         }
     }
 }
开发者ID:bizanto,项目名称:Hooked,代码行数:34,代码来源:view.feed.php

示例2: getProfileLink

 public function getProfileLink($user_id, &$object, &$attribs = array())
 {
     $user = CFactory::getUser($user_id);
     //parameters
     $params = $this->params;
     if (!$user || $params->get('view_individual_link', '1') == 0) {
         return true;
     }
     JHTML::_('behavior.tooltip');
     $name = $user->getDisplayName();
     $url = CRoute::_('index.php?option=com_community&view=profile&userid=' . $user_id);
     switch ($params->get('view_individual_link', '1')) {
         case 2:
             $avatar = $user->getThumbAvatar();
             $text = '<img class="hasTip" src="' . $avatar . '" title="' . $name . '"/>';
             break;
         case 1:
         default:
             $text = JText::_('PLG_TRACKS_JOMSOCIAL_VIEW_USER_PROFILE');
             break;
     }
     $attribs = array_merge($attribs, array('alt' => $user->get('username')));
     $object->text = JHTML::link($url, $text, $attribs);
     return true;
 }
开发者ID:julienV,项目名称:Joomla-Tracks,代码行数:25,代码来源:jomsocial.php

示例3: getRegistrationURL

 public function getRegistrationURL()
 {
     $usersConfig = JComponentHelper::getParams('com_users');
     if ($usersConfig->get('allowUserRegistration')) {
         return CRoute::_('index.php?option=com_community&view=register');
     }
 }
开发者ID:laiello,项目名称:senluonirvana,代码行数:7,代码来源:login.php

示例4: injectTags

 /**
  * Inject data from paramter to content tags ({}) .
  *
  * @param	$content	Original content with content tags.
  * @param	$params	Text contain all values need to be replaced.
  * @param	$html	Auto detect url tag and insert inline.
  * @return	$text	The content after replacing.
  **/
 public static function injectTags($content, $paramsTxt, $html = false)
 {
     $params = new CParameter($paramsTxt);
     preg_match_all("/{(.*?)}/", $content, $matches, PREG_SET_ORDER);
     if (!empty($matches)) {
         foreach ($matches as $val) {
             $replaceWith = JString::trim($params->get($val[1], null));
             if (!is_null($replaceWith)) {
                 //if the replacement start with 'index.php', we can CRoute it
                 if (JString::strpos($replaceWith, 'index.php') === 0) {
                     $replaceWith = CRoute::getExternalURL($replaceWith);
                 }
                 if ($html) {
                     $replaceUrl = $params->get($val[1] . '_url', null);
                     if (!is_null($replaceUrl)) {
                         if ($val[1] == 'stream') {
                             $replaceUrl .= '#activity-stream-container';
                         }
                         //if the replacement start with 'index.php', we can CRoute it
                         if (JString::strpos($replaceUrl, 'index.php') === 0) {
                             $replaceUrl = CRoute::getExternalURL($replaceUrl);
                         }
                         $replaceWith = '<a href="' . $replaceUrl . '">' . $replaceWith . '</a>';
                     }
                 }
                 $content = CString::str_ireplace($val[0], $replaceWith, $content);
             }
         }
     }
     return $content;
 }
开发者ID:joshjim27,项目名称:jobsglobal,代码行数:39,代码来源:content.php

示例5: getInboxLink

 public function getInboxLink($text)
 {
     if (!$text) {
         $text = JText::_('COM_KUNENA_PMS_INBOX');
     }
     return CKunenaLink::GetHrefLink(CRoute::_('index.php?option=com_community&view=inbox'), $text, '', 'follow');
 }
开发者ID:redigy,项目名称:Kunena-1.6,代码行数:7,代码来源:private.php

示例6: send

 /**
  * Do a batch send
  */
 function send($total = 100)
 {
     $mailqModel = CFactory::getModel('mailq');
     $userModel = CFactory::getModel('user');
     $mails = $mailqModel->get($total);
     $jconfig = JFactory::getConfig();
     $mailer = JFactory::getMailer();
     $config = CFactory::getConfig();
     $senderEmail = $jconfig->getValue('mailfrom');
     $senderName = $jconfig->getValue('fromname');
     if (empty($mails)) {
         return;
     }
     CFactory::load('helpers', 'string');
     foreach ($mails as $row) {
         // @rule: only send emails that is valid.
         // @rule: make sure recipient is not blocked!
         $userid = $userModel->getUserFromEmail($row->recipient);
         $user = CFactory::getUser($userid);
         if (!$user->isBlocked() && !JString::stristr($row->recipient, 'foo.bar')) {
             $mailer->setSender(array($senderEmail, $senderName));
             $mailer->addRecipient($row->recipient);
             $mailer->setSubject($row->subject);
             $tmpl = new CTemplate();
             $raw = isset($row->params) ? $row->params : '';
             $params = new JParameter($row->params);
             $base = $config->get('htmlemail') ? 'email.html' : 'email.text';
             if ($config->get('htmlemail')) {
                 $row->body = JString::str_ireplace(array("\r\n", "\r", "\n"), '<br />', $row->body);
                 $mailer->IsHTML(true);
             } else {
                 //@rule: Some content might contain 'html' tags. Strip them out since this mail should never contain html tags.
                 $row->body = CStringHelper::escape(strip_tags($row->body));
             }
             $tmpl->set('content', $row->body);
             $tmpl->set('template', rtrim(JURI::root(), '/') . '/components/com_community/templates/' . $config->get('template'));
             $tmpl->set('sitename', $config->get('sitename'));
             $row->body = $tmpl->fetch($base);
             // Replace any occurences of custom variables within the braces scoe { }
             if (!empty($row->body)) {
                 preg_match_all("/{(.*?)}/", $row->body, $matches, PREG_SET_ORDER);
                 foreach ($matches as $val) {
                     $replaceWith = $params->get($val[1], null);
                     //if the replacement start with 'index.php', we can CRoute it
                     if (strpos($replaceWith, 'index.php') === 0) {
                         $replaceWith = CRoute::getExternalURL($replaceWith);
                     }
                     if (!is_null($replaceWith)) {
                         $row->body = JString::str_ireplace($val[0], $replaceWith, $row->body);
                     }
                 }
             }
             unset($tmpl);
             $mailer->setBody($row->body);
             $mailer->send();
         }
         $mailqModel->markSent($row->id);
         $mailer->ClearAllRecipients();
     }
 }
开发者ID:bizanto,项目名称:Hooked,代码行数:63,代码来源:mailq.php

示例7: getProfileURL

	public function getProfileURL($userid, $task='', $xhtml = true) {
		// Make sure that user profile exist.
		if (!$userid || CFactory::getUser($userid) === null) {
			return false;
		}
		return CRoute::_('index.php?option=com_community&view=profile&userid=' . (int) $userid, $xhtml);
	}
开发者ID:BillVGN,项目名称:PortalPRP,代码行数:7,代码来源:profile.php

示例8: _getMutualFriendsHTML

 public static function _getMutualFriendsHTML($userid = null)
 {
     $my = CFactory::getUser();
     if ($my->id == $userid) {
         return;
     }
     $friendsModel = CFactory::getModel('Friends');
     $friends = $friendsModel->getFriends($userid, 'latest', false, 'mutual');
     $html = "<ul class='joms-list--friend single-column'>";
     if (sizeof($friends)) {
         foreach ($friends as $friend) {
             $html .= "<li class='joms-list__item'>";
             $html .= "<div class='joms-list__avatar'>";
             $html .= '<div class="joms-avatar ' . CUserHelper::onlineIndicator($friend) . '"><a href="' . CRoute::_('index.php?option=com_community&view=profile&userid=' . $friend->id) . '">';
             $html .= '<img src="' . $friend->getThumbAvatar() . '" data-author="' . $friend->id . '" />';
             $html .= "</a></div></div>";
             $html .= "<div class='joms-list__body'>";
             $html .= CFriendsHelper::getUserCog($friend->id, null, null, true);
             $html .= CFriendsHelper::getUserFriendDropdown($friend->id);
             $html .= '<a href="' . CRoute::_('index.php?option=com_community&view=profile&userid=' . $friend->id) . '">';
             $html .= '<h4 class="joms-text--username">' . $friend->getDisplayName() . '</h4></a>';
             $html .= '<span class="joms-text--title">' . JText::sprintf('COM_COMMUNITY_TOTAL_MUTUAL_FRIENDS', CFriendsHelper::getTotalMutualFriends($friend->id)) . '</span>';
             $html .= "</div></li>";
         }
         $html .= "</ul>";
     } else {
         $html .= JText::_('COM_COMMUNITY_NO_MUTUAL_FRIENDS');
     }
     return $html;
 }
开发者ID:joshjim27,项目名称:jobsglobal,代码行数:30,代码来源:mutualfriends.php

示例9: getMembersData

 function getMembersData(&$params)
 {
     $model = CFactory::getModel('user');
     $db = JFactory::getDBO();
     $limit = $params->get('count', '5');
     $query = 'SELECT ' . $db->quoteName('userid') . ' FROM ' . $db->quoteName('#__community_users') . ' AS a ' . ' INNER JOIN ' . $db->quoteName('#__users') . ' AS b ON a.' . $db->quoteName('userid') . '=b.' . $db->quoteName('id') . ' WHERE ' . $db->quoteName('thumb') . '!=' . $db->Quote('components/com_community/assets/default_thumb.jpg') . ' ' . ' AND ' . $db->quoteName('block') . '=' . $db->Quote(0) . ' ' . ' ORDER BY ' . $db->quoteName('points') . ' DESC ' . ' LIMIT ' . $limit;
     $db->setQuery($query);
     $row = $db->loadObjectList();
     if ($db->getErrorNum()) {
         JError::raiseError(500, $db->stderr());
     }
     $_members = array();
     if (!empty($row)) {
         foreach ($row as $data) {
             $user = CFactory::getUser($data->userid);
             $_obj = new stdClass();
             $_obj->id = $data->userid;
             $_obj->name = $user->getDisplayName();
             $_obj->avatar = $user->getThumbAvatar();
             $CUserPoints = new CUserPoints();
             $_obj->karma = $CUserPoints->getPointsImage($user);
             $_obj->userpoints = $user->_points;
             $_obj->link = CRoute::_('index.php?option=com_community&view=profile&userid=' . $data->userid);
             $_members[] = $_obj;
         }
     }
     return $_members;
 }
开发者ID:Jougito,项目名称:DynWeb,代码行数:28,代码来源:helper.php

示例10: onPromoteData

 function onPromoteData($id)
 {
     $db = JFactory::getDBO();
     $Itemid = JRequest::getInt('Itemid');
     $jschk = $this->_chkextension();
     if (!empty($jschk)) {
         $query = "SELECT cf.id FROM #__community_fields as cf\n\t\t\t\t\t\t\t\tLEFT JOIN #__community_fields_values AS cfv ON cfv.field_id=cf.id\n\t\t\t\t\t\t\t\t\tWHERE cf.name like '%About me%' AND cfv.user_id=" . $id;
         $db->setQuery($query);
         $fieldid = $db->loadresult();
         $query = "SELECT u.name AS title, cu.avatar AS image, cfv.value AS bodytext\n\t\t\t\t\t\t\t\t\tFROM #__users AS u\n\t\t\t\t\t\t\t\t\tLEFT JOIN #__community_users AS cu ON u.id=cu.userid\n\t\t\t\t\t\t\t\t\tLEFT JOIN #__community_fields_values AS cfv ON cu.userid=cfv.user_id\n\t\t\t\t\t\t\t\t\tLEFT JOIN #__community_fields AS cf ON cfv.field_id=cf.id\n\t\t\t\t\t\t\t\t\tWHERE cu.userid =" . $id;
         if ($fieldid) {
             $query .= " AND cfv.field_id=" . $fieldid;
         }
         $db->setQuery($query);
         $previewdata = $db->loadObjectlist();
         if (!$fieldid) {
             $previewdata[0]->bodytext = '';
         }
         // Include Jomsocial core
         $jspath = JPATH_ROOT . DS . 'components' . DS . 'com_community';
         include_once $jspath . DS . 'libraries' . DS . 'core.php';
         $previewdata[0]->url = JUri::root() . substr(CRoute::_('index.php?option=com_community&view=profile&userid=' . $id), strlen(JUri::base(true)) + 1);
         if ($previewdata[0]->image == '') {
             $previewdata[0]->image = 'components/com_community/assets/user-Male.png';
         }
         return $previewdata;
     } else {
         return '';
     }
 }
开发者ID:politik86,项目名称:test2,代码行数:30,代码来源:plug_promote_jsprofile.php

示例11: getProfileURL

	public function getProfileURL($userid, $task='', $xhtml = true)
	{
		if ($userid == 0) return false;
		// Get CUser object
		$user = CFactory::getUser($userid);
		if($user === null) return false;
		return CRoute::_('index.php?option=com_community&view=profile&userid='.$userid, $xhtml);
	}
开发者ID:rich20,项目名称:Kunena,代码行数:8,代码来源:profile.php

示例12: eventLink

 /**
  * Create a link to a event page
  * 
  * @param	id		integer		ther user id
  * @param	route   bool		do we want to wrap it with Jroute func ?
  */
 public static function eventLink($id, $route = true)
 {
     $url = 'index.php?option=com_community&view=events&task=viewevent&eventid=' . $id;
     if ($route) {
         $url = CRoute::_($url);
     }
     return $url;
 }
开发者ID:bizanto,项目名称:Hooked,代码行数:14,代码来源:url.php

示例13: getLink

 /**
  * Retrieves the profile link
  *
  * @since	5.0
  * @access	public
  * @param	string
  * @return	
  */
 public function getLink()
 {
     if (!EB::jomsocial()->exists()) {
         return parent::getLink();
     }
     $link = CRoute::_('index.php?option=com_community&view=profile&userid=' . $this->profile->id);
     return $link;
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:16,代码来源:client.php

示例14: profile

 /**
  * Displays the viewing profile page.
  * 	 	
  * @access	public
  * @param	array  An associative array to display the fields
  */
 public function profile(&$data)
 {
     $mainframe = JFactory::getApplication();
     $friendsModel = CFactory::getModel('friends');
     $showfriends = JRequest::getVar('showfriends', false);
     $userid = JRequest::getVar('userid', '');
     $user = CFactory::getUser($userid);
     $linkUrl = CRoute::_('index.php?option=com_community&view=profile&userid=' . $user->id);
     $document = JFactory::getDocument();
     $document->setTitle(JText::sprintf('COM_COMMUNITY_USERS_FEED_TITLE', $user->getDisplayName()));
     $document->setDescription(JText::sprintf('COM_COMMUNITY_USERS_FEED_DESCRIPTION', $user->getDisplayName(), $user->lastvisitDate));
     $document->setLink($linkUrl);
     include_once JPATH_COMPONENT . '/libraries/activities.php';
     $act = new CActivityStream();
     $friendIds = $friendsModel->getFriendIds($user->id);
     $friendIds = $showfriends ? $friendIds : null;
     $rows = $act->getFEED($user->id, $friendIds, null, $mainframe->getCfg('feed_limit'));
     // add the avatar image
     $rssImage = new JFeedImage();
     $rssImage->url = $user->getThumbAvatar();
     $rssImage->link = $linkUrl;
     $rssImage->width = 64;
     $rssImage->height = 64;
     $document->image = $rssImage;
     //CFactory::load( 'helpers' , 'string' );
     //CFactory::load( 'helpers' , 'time' );
     foreach ($rows->data as $row) {
         if ($row->type != 'title') {
             // Get activities link
             $pattern = '/<a href=\\"(.*?)\\"/';
             preg_match_all($pattern, $row->title, $matches);
             // Use activity owner link when activity link is not available
             if (!empty($matches[1][1])) {
                 $linkUrl = $matches[1][1];
             } else {
                 if (!empty($matches[1][0])) {
                     $linkUrl = $matches[1][0];
                 }
             }
             // load individual item creator class
             $item = new JFeedItem();
             $item->title = $row->title;
             $item->link = $linkUrl;
             $item->description = "<img src=\"{$row->favicon}\" alt=\"\" />&nbsp;" . $row->title;
             $item->date = CTimeHelper::getDate($row->createdDateRaw)->toRFC822();
             $item->category = '';
             //$row->category;
             $item->description = CString::str_ireplace('_QQQ_', '"', $item->description);
             // Make sure url is absolute
             $pattern = '/href="(.*?)index.php/';
             $replace = 'href="' . JURI::base() . 'index.php';
             $string = $item->description;
             $item->description = preg_replace($pattern, $replace, $string);
             // loads item info into rss array
             $document->addItem($item);
         }
     }
 }
开发者ID:Jougito,项目名称:DynWeb,代码行数:64,代码来源:view.feed.php

示例15: getUserProfileUrl

 function getUserProfileUrl($integration_option, $userid)
 {
     //$cominvitexHelper=new cominvitexHelper();
     //$invitex_settings=$cominvitexHelper->getconfigData();
     //$params=JComponentHelper::getParams('com_jlike');
     //$integration_option=$invitex_settings['reg_direct'];
     //$integration_option='JomSocial'
     $link = '';
     if ($integration_option == 'Joomla') {
         //$itemid=jgiveFrontendHelper::getItemId('option=com_users');
         $link = '';
     } else {
         if ($integration_option == 'Community Builder') {
             $cbpath = JPATH_ROOT . DS . 'components' . DS . 'com_community';
             if ($cbpath) {
                 //$itemid=$cominvitexHelper->getItemId('option=com_comprofiler');
                 $link = JUri::root() . substr(JRoute::_('index.php?option=com_comprofiler&task=userprofile&user=' . $userid . '&Itemid=' . $itemid), strlen(JUri::base(true)) + 1);
             }
         } else {
             if ($integration_option == 'JomSocial') {
                 $jspath = JPATH_ROOT . DS . 'components' . DS . 'com_community';
                 if ($jspath) {
                     $link = '';
                     if (file_exists($jspath)) {
                         include_once $jspath . DS . 'libraries' . DS . 'core.php';
                         $link = JUri::root() . substr(CRoute::_('index.php?option=com_community&view=profile&userid=' . $userid), strlen(JUri::base(true)) + 1);
                     }
                 }
             } else {
                 if ($integration_option == 'Jomwall') {
                     $awdpath = JPATH_ROOT . DS . 'components' . DS . 'com_awdwall';
                     if ($awdpath) {
                         if (!class_exists('AwdwallHelperUser')) {
                             require_once JPATH_SITE . DS . 'components' . DS . 'com_awdwall' . DS . 'helpers' . DS . 'user.php';
                         }
                         $awduser = new AwdwallHelperUser();
                         $Itemid = $awduser->getComItemId();
                         $link = JRoute::_('index.php?option=com_awdwall&view=awdwall&layout=mywall&wuid=' . $userid . '&Itemid=' . $Itemid);
                     }
                 } else {
                     if ($integration_option == 'EasySocial') {
                         $espath = JPATH_ROOT . DS . 'components' . DS . 'com_easysocial';
                         if ($espath) {
                             $link = '';
                             if (file_exists($espath)) {
                                 require_once JPATH_ADMINISTRATOR . '/components/com_easysocial/includes/foundry.php';
                                 $user = Foundry::user($userid);
                                 $link = JRoute::_($user->getPermalink());
                             }
                         }
                     }
                 }
             }
         }
     }
     return $link;
 }
开发者ID:BetterBetterBetter,项目名称:B3App,代码行数:57,代码来源:profiledata.php


注:本文中的CRoute类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。