本文整理汇总了PHP中DiscussHelper::getExternalLink方法的典型用法代码示例。如果您正苦于以下问题:PHP DiscussHelper::getExternalLink方法的具体用法?PHP DiscussHelper::getExternalLink怎么用?PHP DiscussHelper::getExternalLink使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DiscussHelper
的用法示例。
在下文中一共展示了DiscussHelper::getExternalLink方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: replyNotifyUsers
public function replyNotifyUsers($reply, $user, $senderName)
{
//send notification to all comment's subscribers that want to receive notification immediately
$notify = DiscussHelper::getNotification();
$emailData = array();
$config = DiscussHelper::getConfig();
$parent = DiscussHelper::getTable('Post');
$parent->load($reply->parent_id);
if ($reply->get('user_type') == DISCUSS_POSTER_GUEST) {
$emailData['postAuthor'] = $senderName;
$emailData['commentAuthor'] = $senderName;
$emailData['replyAuthorAvatar'] = '';
} else {
$profile = DiscussHelper::getTable('Profile');
$profile->load($user->id);
$emailData['replyAuthor'] = $profile->getName();
$emailData['commentAuthor'] = $profile->getName();
$emailData['replyAuthorAvatar'] = $profile->getAvatar();
}
$emailContent = $reply->content;
if ($reply->content_type != 'html') {
// the content is bbcode. we need to parse it.
$emailContent = EasyDiscussParser::bbcode($emailContent);
$emailContent = EasyDiscussParser::removeBrTag($emailContent);
}
// If reply is html type we need to strip off html codes.
if ($reply->content_type == 'html') {
$emailContent = strip_tags($emailContent);
}
$emailContent = $parent->trimEmail($emailContent);
$emailData['postTitle'] = $parent->title;
$emailData['comment'] = $reply->content;
$emailData['postLink'] = DiscussRouter::getRoutedURL('index.php?option=com_easydiscuss&view=post&id=' . $parent->id, false, true);
$emailData['replyContent'] = $reply->content;
$attachments = $reply->getAttachments();
$emailData['attachments'] = $attachments;
$excludeEmails = array();
$subscriberEmails = array();
if (($config->get('main_sitesubscription') || $config->get('main_postsubscription')) && $config->get('notify_subscriber') && $reply->published == DISCUSS_ID_PUBLISHED) {
$emailData['emailTemplate'] = 'email.subscription.reply.new.php';
$emailData['emailSubject'] = JText::sprintf('COM_EASYDISCUSS_NEW_REPLY_ADDED', $parent->id, $parent->title);
$emailData['post_id'] = $parent->id;
$emailData['cat_id'] = $parent->category_id;
//$subcribersEmails = DiscussHelper::getHelper( 'Mailer' )->notifyThreadSubscribers( $emailData );
//$excludeEmails = array_merge( $excludeEmails, $subcribersEmails);
// Notify all subscriber about new replies
DiscussHelper::getHelper('Mailer')->notifySubscribers($emailData, $excludeEmails);
}
//notify post owner.
$postOwnerId = $parent->user_id;
$postOwner = JFactory::getUser($postOwnerId);
$ownerEmail = $postOwner->email;
if ($parent->user_type != 'member') {
$ownerEmail = $parent->poster_email;
}
if ($config->get('notify_owner') && $reply->published == DISCUSS_ID_PUBLISHED && $postOwnerId != $user->id && !in_array($ownerEmail, $subscriberEmails) && !empty($ownerEmail)) {
$emailData['owner_email'] = $ownerEmail;
$emailData['emailSubject'] = JText::sprintf('COM_EASYDISCUSS_NEW_REPLY_ADDED', $parent->id, $parent->title);
$emailData['emailTemplate'] = 'email.post.reply.new.php';
DiscussHelper::getHelper('Mailer')->notifyThreadOwner($emailData);
$excludeEmails[] = $ownerEmail;
}
// Notify Participants
if ($config->get('notify_participants') && $table->published == DISCUSS_ID_PUBLISHED) {
$emailData['emailSubject'] = JText::sprintf('COM_EASYDISCUSS_NEW_REPLY_ADDED', $parent->id, $parent->title);
$emailData['emailTemplate'] = 'email.post.reply.new.php';
DiscussHelper::getHelper('Mailer')->notifyThreadParticipants($emailData, $excludeEmails);
}
//if reply under moderation, send owner a notification.
if ($reply->published == DISCUSS_ID_PENDING) {
// Generate hashkeys to map this current request
$hashkey = DiscussHelper::getTable('Hashkeys');
$hashkey->uid = $reply->id;
$hashkey->type = DISCUSS_REPLY_TYPE;
$hashkey->store();
$approveURL = DiscussHelper::getExternalLink('index.php?option=com_easydiscuss&controller=posts&task=approvePost&key=' . $hashkey->key);
$rejectURL = DiscussHelper::getExternalLink('index.php?option=com_easydiscuss&controller=posts&task=rejectPost&key=' . $hashkey->key);
$emailData['moderation'] = '<div style="display:inline-block;width:100%;padding:20px;border-top:1px solid #ccc;padding:20px 0 10px;margin-top:20px;line-height:19px;color:#555;font-family:\'Lucida Grande\',Tahoma,Arial;font-size:12px;text-align:left">';
$emailData['moderation'] .= '<a href="' . $approveURL . '" style="display:inline-block;padding:5px 15px;background:#fc0;border:1px solid #caa200;border-bottom-color:#977900;color:#534200;text-shadow:0 1px 0 #ffe684;font-weight:bold;box-shadow:inset 0 1px 0 #ffe064;-moz-box-shadow:inset 0 1px 0 #ffe064;-webkit-box-shadow:inset 0 1px 0 #ffe064;border-radius:2px;moz-border-radius:2px;-webkit-border-radius:2px;text-decoration:none!important">' . JText::_('COM_EASYDISCUSS_EMAIL_APPROVE_REPLY') . '</a>';
$emailData['moderation'] .= ' ' . JText::_('COM_EASYDISCUSS_OR') . ' <a href="' . $rejectURL . '" style="color:#477fda">' . JText::_('COM_EASYDISCUSS_REJECT') . '</a>';
$emailData['moderation'] .= '</div>';
$emailData['emailSubject'] = JText::sprintf('COM_EASYDISCUSS_NEW_REPLY_MODERATE', $parent->title);
$emailData['emailTemplate'] = 'email.post.reply.moderation.php';
DiscussHelper::getHelper('Mailer')->notifyAdministrators($emailData, array(), $config->get('notify_admin'), $config->get('notify_moderator'));
} elseif ($table->published == DISCUSS_ID_PUBLISHED) {
$emailData['emailTemplate'] = 'email.post.reply.new.php';
$emailData['emailSubject'] = JText::sprintf('COM_EASYDISCUSS_NEW_REPLY_ADDED', $parent->id, $parent->title);
$emailData['post_id'] = $parent->id;
DiscussHelper::getHelper('Mailer')->notifyAdministrators($emailData, array(), $config->get('notify_admin_onreply'), $config->get('notify_moderator_onreply'));
}
}
示例2: ajaxSubmitReply
//.........这里部分代码省略.........
$subcribersEmails = DiscussHelper::getHelper('Mailer')->notifyThreadSubscribers($emailData, array($posterEmail, $my->email));
$excludeEmails[] = $posterEmail;
$excludeEmails = array_merge($excludeEmails, $subcribersEmails);
$excludeEmails = array_unique($excludeEmails);
}
//notify post owner.
$postOwnerId = $parent->user_id;
$postOwner = JFactory::getUser($postOwnerId);
$ownerEmail = $postOwner->email;
if ($parent->user_type != 'member') {
$ownerEmail = $parent->poster_email;
}
// Notify Owner
// if reply under moderation, send owner a notification.
if ($config->get('notify_owner') && $table->published == DISCUSS_ID_PUBLISHED && $postOwnerId != $replier->id && !in_array($ownerEmail, $excludeEmails) && !empty($ownerEmail)) {
$emailData['owner_email'] = $ownerEmail;
$emailData['emailSubject'] = JText::sprintf('COM_EASYDISCUSS_NEW_REPLY_ADDED', $parent->id, $parent->title);
$emailData['emailTemplate'] = 'email.post.reply.new.php';
DiscussHelper::getHelper('Mailer')->notifyThreadOwner($emailData);
// Notify Participants
$excludeEmails[] = $ownerEmail;
$excludeEmails = array_unique($excludeEmails);
}
if ($config->get('notify_participants') && $table->published == DISCUSS_ID_PUBLISHED) {
$emailData['emailSubject'] = JText::sprintf('COM_EASYDISCUSS_NEW_REPLY_ADDED', $parent->id, $parent->title);
$emailData['emailTemplate'] = 'email.post.reply.new.php';
DiscussHelper::getHelper('Mailer')->notifyThreadParticipants($emailData, $excludeEmails);
}
if ($table->published == DISCUSS_ID_PENDING) {
// Notify admins.
// Generate hashkeys to map this current request
$hashkey = DiscussHelper::getTable('Hashkeys');
$hashkey->uid = $table->id;
$hashkey->type = DISCUSS_REPLY_TYPE;
$hashkey->store();
require_once DISCUSS_HELPERS . '/router.php';
$approveURL = DiscussHelper::getExternalLink('index.php?option=com_easydiscuss&controller=posts&task=approvePost&key=' . $hashkey->key);
$rejectURL = DiscussHelper::getExternalLink('index.php?option=com_easydiscuss&controller=posts&task=rejectPost&key=' . $hashkey->key);
$emailData['moderation'] = '<div style="display:inline-block;width:100%;padding:20px;border-top:1px solid #ccc;padding:20px 0 10px;margin-top:20px;line-height:19px;color:#555;font-family:\'Lucida Grande\',Tahoma,Arial;font-size:12px;text-align:left">';
$emailData['moderation'] .= '<a href="' . $approveURL . '" style="display:inline-block;padding:5px 15px;background:#fc0;border:1px solid #caa200;border-bottom-color:#977900;color:#534200;text-shadow:0 1px 0 #ffe684;font-weight:bold;box-shadow:inset 0 1px 0 #ffe064;-moz-box-shadow:inset 0 1px 0 #ffe064;-webkit-box-shadow:inset 0 1px 0 #ffe064;border-radius:2px;moz-border-radius:2px;-webkit-border-radius:2px;text-decoration:none!important">' . JText::_('COM_EASYDISCUSS_EMAIL_APPROVE_REPLY') . '</a>';
$emailData['moderation'] .= ' ' . JText::_('COM_EASYDISCUSS_OR') . ' <a href="' . $rejectURL . '" style="color:#477fda">' . JText::_('COM_EASYDISCUSS_REJECT') . '</a>';
$emailData['moderation'] .= '</div>';
$emailData['emailSubject'] = JText::sprintf('COM_EASYDISCUSS_NEW_REPLY_MODERATE', $parent->title);
$emailData['emailTemplate'] = 'email.post.reply.moderation.php';
DiscussHelper::getHelper('Mailer')->notifyAdministrators($emailData, array(), $config->get('notify_admin'), $config->get('notify_moderator'));
} elseif ($table->published == DISCUSS_ID_PUBLISHED && !$question->private) {
$emailData['emailTemplate'] = 'email.post.reply.new.php';
$emailData['emailSubject'] = JText::sprintf('COM_EASYDISCUSS_NEW_REPLY_ADDED', $parent->id, $parent->title);
$emailData['post_id'] = $parent->id;
DiscussHelper::getHelper('Mailer')->notifyAdministrators($emailData, $excludeEmails, $config->get('notify_admin_onreply'), $config->get('notify_moderator_onreply'));
}
// @rule: Jomsocial activity integrations
if ($table->published == DISCUSS_ID_PUBLISHED && !$question->private) {
DiscussHelper::getHelper('jomsocial')->addActivityReply($table);
DiscussHelper::getHelper('easysocial')->replyDiscussionStream($table);
}
$autoSubscribed = false;
if ($config->get('main_autopostsubscription') && $config->get('main_postsubscription') && $table->user_type != 'twitter') {
//automatically subscribe this user into this post.
$subscription_info = array();
$subscription_info['type'] = 'post';
$subscription_info['userid'] = !empty($table->user_id) ? $table->user_id : '0';
$subscription_info['email'] = !empty($table->user_id) ? $my->email : $table->poster_email;
$subscription_info['cid'] = $parent->id;
$subscription_info['member'] = !empty($table->user_id) ? '1' : '0';
$subscription_info['name'] = !empty($table->user_id) ? $my->name : $table->poster_name;
$subscription_info['interval'] = 'instant';
$model = $this->getModel('Subscribe');
$sid = '';
if ($subscription_info['userid'] == 0) {
$sid = $model->isPostSubscribedEmail($subscription_info);
if (empty($sid)) {
if ($model->addSubscription($subscription_info)) {
$autoSubscribed = true;
}
}
} else {
$sid = $model->isPostSubscribedUser($subscription_info);
if (empty($sid['id'])) {
//add new subscription.
if ($model->addSubscription($subscription_info)) {
$autoSubscribed = true;
}
}
}
}
// Append result
$output = array();
$output['message'] = $autoSubscribed ? JText::_('COM_EASYDISCUSS_SUCCESS_REPLY_POSTED_AND_SUBSCRIBED') : JText::_('COM_EASYDISCUSS_SUCCESS_REPLY_POSTED');
$output['type'] = 'success';
$output['html'] = $html;
// Perhaps the viewer is unable to view the replies.
if (!$questionCategory->canViewReplies()) {
$output['message'] = JText::_('COM_EASYDISCUSS_REPLY_SUCCESS_BUT_UNABLE_TO_VIEW_REPLIES');
}
if ($enableRecaptcha && !empty($publicKey) && $recaptcha) {
$output['type'] = 'success.captcha';
}
echo $this->_outputJson($output);
}
示例3: submit
//.........这里部分代码省略.........
$profile = DiscussHelper::getTable('Profile');
$profile->load($my->id);
// For use within the emails.
$emailData = array();
$emailData['postTitle'] = $post->title;
$emailData['postAuthor'] = $profile->id ? $profile->getName() : $post->poster_name;
$emailData['postAuthorAvatar'] = $profile->getAvatar();
$emailData['postLink'] = DiscussRouter::getRoutedURL('index.php?option=com_easydiscuss&view=post&id=' . $post->id, false, true);
$emailContent = $post->content;
if ($post->content_type != 'html') {
// the content is bbcode. we need to parse it.
$emailContent = EasyDiscussParser::bbcode($emailContent);
$emailContent = EasyDiscussParser::removeBrTag($emailContent);
}
// If post is html type we need to strip off html codes.
if ($post->content_type == 'html') {
$emailContent = strip_tags($post->content);
}
$emailContent = $post->trimEmail($emailContent);
$attachments = $post->getAttachments();
$emailData['attachments'] = $attachments;
$emailData['postContent'] = $emailContent;
$emailData['post_id'] = $post->id;
$emailData['cat_id'] = $post->category_id;
$emailData['emailTemplate'] = 'email.subscription.site.new.php';
$emailData['emailSubject'] = JText::sprintf('COM_EASYDISCUSS_NEW_QUESTION_ASKED', $post->id, $post->title);
if ($isModerate) {
// Generate hashkeys to map this current request
$hashkey = DiscussHelper::getTable('HashKeys');
$hashkey->uid = $post->id;
$hashkey->type = DISCUSS_QUESTION_TYPE;
$hashkey->store();
require_once DISCUSS_HELPERS . '/router.php';
$approveURL = DiscussHelper::getExternalLink('index.php?option=com_easydiscuss&controller=posts&task=approvePost&key=' . $hashkey->key);
$rejectURL = DiscussHelper::getExternalLink('index.php?option=com_easydiscuss&controller=posts&task=rejectPost&key=' . $hashkey->key);
$emailData['moderation'] = '<div style="display:inline-block;width:100%;padding:20px;border-top:1px solid #ccc;padding:20px 0 10px;margin-top:20px;line-height:19px;color:#555;font-family:\'Lucida Grande\',Tahoma,Arial;font-size:12px;text-align:left">';
$emailData['moderation'] .= '<a href="' . $approveURL . '" style="display:inline-block;padding:5px 15px;background:#fc0;border:1px solid #caa200;border-bottom-color:#977900;color:#534200;text-shadow:0 1px 0 #ffe684;font-weight:bold;box-shadow:inset 0 1px 0 #ffe064;-moz-box-shadow:inset 0 1px 0 #ffe064;-webkit-box-shadow:inset 0 1px 0 #ffe064;border-radius:2px;moz-border-radius:2px;-webkit-border-radius:2px;text-decoration:none!important">' . JText::_('COM_EASYDISCUSS_EMAIL_APPROVE_POST') . '</a>';
$emailData['moderation'] .= ' ' . JText::_('COM_EASYDISCUSS_OR') . ' <a href="' . $rejectURL . '" style="color:#477fda">' . JText::_('COM_EASYDISCUSS_REJECT') . '</a>';
$emailData['moderation'] .= '</div>';
$emailData['emailTemplate'] = 'email.subscription.site.moderate.php';
$emailData['emailSubject'] = JText::sprintf('COM_EASYDISCUSS_NEW_QUESTION_MODERATE', $post->id, $post->title);
} else {
// If this is a private post, do not notify anyone
if (!$post->private && $category->canPublicAccess()) {
// Notify site subscribers
if ($config->get('main_sitesubscription') && ($isNew || $prevPostStatus == DISCUSS_ID_PENDING) && $post->published == DISCUSS_ID_PUBLISHED && !$config->get('notify_all')) {
DiscussHelper::getHelper('Mailer')->notifySubscribers($emailData, array($my->email));
}
// Notify category subscribers
if ($config->get('main_ed_categorysubscription') && ($isNew || $prevPostStatus == DISCUSS_ID_PENDING) && $post->published == DISCUSS_ID_PUBLISHED && !$config->get('notify_all')) {
DiscussHelper::getHelper('Mailer')->notifySubscribers($emailData, array($my->email));
}
// Notify EVERYBODY
if ($config->get('notify_all') && !$isModerate) {
DiscussHelper::getHelper('Mailer')->notifyAllMembers($emailData, array($my->email));
}
}
}
// Notify admins and category moderators
if ($isNew || $prevPostStatus == DISCUSS_ID_PENDING) {
DiscussHelper::getHelper('Mailer')->notifyAdministrators($emailData, array($my->email), $config->get('notify_admin'), $config->get('notify_moderator'));
}
// @rule: Jomsocial activity integrations & points & ranking
if (($isNew || $prevPostStatus == DISCUSS_ID_PENDING) && $post->published == DISCUSS_ID_PUBLISHED && !$post->private) {
DiscussHelper::getHelper('jomsocial')->addActivityQuestion($post);
DiscussHelper::getHelper('easysocial')->createDiscussionStream($post);