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


PHP CRoute::emailLink方法代码示例

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


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

示例1: parseTaggedUserNotification

 /**
  * @param $message
  * @param $actor
  * @param $object
  * @param array $info
  * @return bool
  */
 static function parseTaggedUserNotification($message, $actor, $object = null, $info = array())
 {
     $pattern = '/@\\[\\[(\\d+):([a-z]+):([^\\]]+)\\]\\]/';
     preg_match_all($pattern, $message, $matches);
     if (isset($matches[1]) && count($matches[1]) > 0) {
         //lets count total recipients and blast notifications
         $taggedIds = array();
         foreach ($matches[1] as $uid) {
             $taggedIds[] = CFactory::getUser($uid)->get('id') != 0 ? $uid : null;
         }
         if ($info['type'] == 'discussion-comment') {
             //link to lead the user to the discussion
             $url = CRoute::emailLink('index.php?option=com_community&view=groups&task=viewdiscussion&groupid=' . $info['group_id'] . '&topicid=' . $info['discussion_id'] . '#activity-stream-container');
             $params = new CParameter();
             $params->set('url', $url);
             $params->set('content', $message);
             $params->set('discussion', '<a href="' . $url . '">' . JText::_('COM_COMMUNITY_DISCUSSION') . '</a>');
             $emailSubject = JText::sprintf('COM_COMMUNITY_DISCUSSION_USER_TAGGED_EMAIL_SUBJECT');
             $emailContent = JText::sprintf('COM_COMMUNITY_USER_TAGGED_COMMENT_EMAIL_CONTENT', $url);
             $notificationMessage = JText::_('COM_COMMUNITY_NOTIFICATION_DISCUSSION_USER_TAGGED');
         } else {
             if ($info['type'] == 'album-comment') {
                 //link to lead the user to the album
                 $url = CRoute::emailLink('index.php?option=com_community&view=photos&task=album&userid=' . $info['album_creator_id'] . '&albumid=' . $info['album_id'] . '#activity-stream-container');
                 $params = new CParameter();
                 $params->set('url', $url);
                 $params->set('content', $message);
                 $params->set('album', '<a href="' . $url . '">' . JText::_('COM_COMMUNITY_SINGULAR_ALBUM') . '</a>');
                 $emailSubject = JText::sprintf('COM_COMMUNITY_ALBUM_USER_TAGGED_EMAIL_SUBJECT');
                 $emailContent = JText::sprintf('COM_COMMUNITY_USER_TAGGED_COMMENT_EMAIL_CONTENT', $url);
                 $notificationMessage = JText::_('COM_COMMUNITY_NOTIFICATION_ALBUM_USER_TAGGED');
             } else {
                 if ($info['type'] == 'video-comment') {
                     //link to lead the user to the video
                     $url = CRoute::emailLink('index.php?option=com_community&view=videos&task=video&userid=' . $actor->id . '&videoid=' . $info['video_id'] . '#activity-stream-container');
                     $params = new CParameter();
                     $params->set('url', $url);
                     $params->set('content', $message);
                     $params->set('video', '<a href="' . $url . '">' . JText::_('COM_COMMUNITY_SINGULAR_PHOTO') . '</a>');
                     $emailSubject = JText::sprintf('COM_COMMUNITY_VIDEO_USER_TAGGED_EMAIL_SUBJECT');
                     $emailContent = JText::sprintf('COM_COMMUNITY_USER_TAGGED_COMMENT_EMAIL_CONTENT', $url);
                     $notificationMessage = JText::_('COM_COMMUNITY_NOTIFICATION_VIDEO_USER_TAGGED');
                 } else {
                     if ($info['type'] == 'image-comment') {
                         //link to lead the user to the picture
                         $url = CRoute::emailLink('index.php?option=com_community&view=photos&task=photo&userid=' . $actor->id . '&albumid=' . $info['album_id'] . '&photoid=' . $info['image_id'] . '#activity-stream-container');
                         $params = new CParameter();
                         $params->set('url', $url);
                         $params->set('content', $message);
                         $params->set('photo', '<a href="' . $url . '">' . JText::_('COM_COMMUNITY_SINGULAR_PHOTO') . '</a>');
                         $emailSubject = JText::sprintf('COM_COMMUNITY_PHOTO_USER_TAGGED_EMAIL_SUBJECT');
                         $emailContent = JText::sprintf('COM_COMMUNITY_USER_TAGGED_COMMENT_EMAIL_CONTENT', $url);
                         $notificationMessage = JText::_('COM_COMMUNITY_NOTIFICATION_PHOTO_USER_TAGGED');
                     } else {
                         if ($info['type'] == 'post-comment' && $object != null) {
                             //default notification, and object is activity
                             //set parameter to be replaced in the template
                             $url = CRoute::emailLink('index.php?option=com_community&view=profile&userid=' . $object->actor . '&actid=' . $object->id . '#activity-stream-container');
                             $params = new CParameter();
                             $params->set('url', $url);
                             $params->set('content', $message);
                             $params->set('post', '<a href="' . $url . '">' . JText::_('COM_COMMUNITY_SINGULAR_POST') . '</a>');
                             $emailSubject = JText::sprintf('COM_COMMUNITY_PROFILE_USER_TAGGED_EMAIL_SUBJECT');
                             $emailContent = JText::sprintf('COM_COMMUNITY_PROFILE_USER_TAGGED_COMMENT_EMAIL_CONTENT', $url);
                             $notificationMessage = JText::_('COM_COMMUNITY_NOTIFICATION_USER_TAGGED');
                         } else {
                             return false;
                         }
                     }
                 }
             }
         }
         //add to notifications
         CNotificationLibrary::add('users_tagged', $actor->id, $taggedIds, $emailSubject, $emailContent, '', $params, true, '', $notificationMessage);
         return true;
     }
     return false;
 }
开发者ID:joshjim27,项目名称:jobsglobal,代码行数:85,代码来源:user.php

示例2: savecomment

    function savecomment($response, $id, $value)
    {
        require_once JPATH_PLUGINS . DS . 'community' . DS . 'activitycomment' . DS . 'helper.php';
        JPlugin::loadLanguage('plg_activitycomment', JPATH_ADMINISTRATOR);
        $my =& CFactory::getUser();
        if ($my->id == 0) {
            return 'invalid';
        }
        if (empty($value)) {
            $response->addScriptCall(ActivityComments::getjs() . '("#activity-' . $id . '-comment-errors").html("' . JText::_('COMMENT CANNOT BE EMPTY') . '").css("color","red");');
            return $response->sendResponse();
        }
        $my =& CFactory::getUser();
        require_once JPATH_ROOT . DS . 'components' . DS . 'com_community' . DS . 'models' . DS . 'wall.php';
        $wall =& JTable::getInstance('Wall', 'CTable');
        CFactory::load('helpers', 'linkgenerator');
        $params = ActivityComments::getParams();
        $value = strip_tags($value);
        $value = cGenerateURILinks($value, true, $params->get('shareurltarget'));
        // Get current date
        $date =& JFactory::getDate();
        $now = $date->toMySQL();
        $wall->type = 'activity';
        $wall->contentid = $id;
        $wall->post_by = $my->id;
        $wall->comment = $value;
        $wall->date = $now;
        $wall->published = 1;
        $wall->ip = $_SERVER['REMOTE_ADDR'];
        $wall->store();
        $params = ActivityComments::getParams();
        $sendEmail = $params->get('notifycomment', 0);
        $db =& JFactory::getDBO();
        if ($sendEmail == 1) {
            $query = 'select actor from #__community_activities where id=' . $db->Quote($id);
            $db->setQuery($query);
            $actorId = $db->loadResult();
            if ($actorId != $my->id) {
                $actor =& CFactory::getUser($actorId);
                CFactory::load('libraries', 'notification');
                $notification = new CNotificationLibrary();
                $current = CRoute::emailLink(ActivityComments::getCurrent(), false) . '#profile-newsfeed-item' . $id;
                $notification->add('profile.activity.comment', $my->id, $actorId, JText::sprintf('SOMEONE COMMENTED MAIL SUBJECT', $my->getDisplayName()), JText::sprintf('SOMEONE COMMENTED MAIL CONTENT', $actor->getDisplayName(), $my->getDisplayName(), $current));
            }
        }
        // send emails to subscribers
        $a = 'select * from #__activity_subscribe where ' . '`activity_id`=' . $db->Quote($id) . ' ' . 'and `type`=' . $db->Quote('profile');
        $db->setQuery($a);
        $subscribers = $db->loadObjectList();
        if ($subscribers) {
            $emails = array();
            foreach ($subscribers as $subscriber) {
                $emails[] = $subscriber->user_id;
            }
            CFactory::load('libraries', 'notification');
            $notification = new CNotificationLibrary();
            $current = CRoute::emailLink(ActivityComments::getCurrent(), false) . '#profile-newsfeed-item' . $id;
            $notification->add('profile.activity.comment', $my->id, $emails, JText::sprintf('SUBSCRIBE SOMEONE COMMENTED MAIL SUBJECT', $my->getDisplayName()), JText::sprintf('SUBSCRIBE SOMEONE COMMENTED MAIL CONTENT', $my->getDisplayName(), $current));
        }
        $joomla = JFactory::getConfig();
        $offset = $my->getParam('timezone', $joomla->getValue('offset'));
        $config = CFactory::getConfig();
        $date->setOffset($offset + $config->get('daylightsavingoffset'));
        ob_start();
        ?>
		<div class="wallcmt small" id="activity-comment-item-<?php 
        echo $wall->id;
        ?>
">
			<a href="<?php 
        echo CRoute::_('index.php?option=com_community&view=profile&userid=' . $my->id);
        ?>
"><img class="wall-coc-avatar" src="<?php 
        echo $my->getThumbAvatar();
        ?>
"/></a>
			<a href="<?php 
        echo CRoute::_('index.php?option=com_community&view=profile&userid=' . $my->id);
        ?>
" class="wall-coc-author"><?php 
        echo $my->getDisplayName();
        ?>
</a> <?php 
        echo JText::_('POST ON');
        ?>
			<span class="wall-coc-date"><?php 
        echo $date->toFormat(JText::_('DATE_FORMAT_LC2'));
        ?>
</span>
					<?php 
        if (ActivityComments::isSiteAdmin()) {
            ?>
					 | <span class="coc-remove"><a href="javascript:void(0);" onclick="jax.call('community','plugins,activitycomment,removecomment','<?php 
            echo $wall->id;
            ?>
');"><?php 
            echo JText::_('REMOVE COMMENT');
            ?>
</a></span>
					<?php 
//.........这里部分代码省略.........
开发者ID:bizanto,项目名称:Hooked,代码行数:101,代码来源:activitycomment.php

示例3: getUserURL

 /**
  * Automatically hyperlink a user's link
  *
  * @param    $userId        User's id.
  * @param    $userName    Username of user.
  *
  * return    $urlLink    HTML codes that hyperlink to users profile.
  **/
 public static function getUserURL($userId, $userName, $email = false)
 {
     if ($email) {
         $url = CRoute::emailLink('index.php?option=com_community&view=profile&userid=' . $userId, true);
     } else {
         $url = CRoute::_('index.php?option=com_community&view=profile&userid=' . $userId);
     }
     $urlLink = '<a href="' . $url . '" rel="nofollow">' . $userName . '</a>';
     return $urlLink;
 }
开发者ID:joshjim27,项目名称:jobsglobal,代码行数:18,代码来源:linkgenerator.php

示例4: replaceAliasURL

 /**
  * Automatically link username in the provided message when message contains @username
  * @param $message
  * @param bool $email
  * @param bool $usernameOnly only pass username without hyperlink
  * @return mixed $message A modified copy of the message with the proper hyperlinks or username.
  */
 public static function replaceAliasURL($message, $email = false, $usernameOnly = false)
 {
     $pattern = '/@\\[\\[(\\d+):([a-z]+):([^\\]]+)\\]\\]/';
     preg_match_all($pattern, $message, $matches);
     if (isset($matches[1]) && count($matches[1]) > 0) {
         foreach ($matches[1] as $key => $uid) {
             $id = CFactory::getUser($uid)->get('id');
             $username = $matches[3][$key];
             if ($id != 0) {
                 if ($email) {
                     $profileLink = CRoute::emailLink('index.php?option=com_community&view=profile&userid=' . $id, true);
                     $message = CString::str_ireplace('@' . $username, $profileLink, $message);
                 } elseif ($usernameOnly) {
                     $message = CString::str_ireplace($matches[0][$key], $username, $message);
                 } else {
                     $message = CString::str_ireplace($matches[0][$key], CLinkGeneratorHelper::getUserURL($id, $username), $message);
                 }
             }
         }
     }
     return $message;
 }
开发者ID:Jougito,项目名称:DynWeb,代码行数:29,代码来源:user.php


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