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


PHP EasyBlogRouter::isSh404Enabled方法代码示例

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


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

示例1: store

 public function store()
 {
     // @task: Load language file from the front end.
     JFactory::getLanguage()->load('com_easyblog', JPATH_ROOT);
     $this->clear($this->draft_id);
     // @rule: Send notification to the author of the post.
     $draft = EasyBlogHelper::getTable('Draft');
     $draft->load($this->draft_id);
     $author = EasyBlogHelper::getTable('Profile');
     $author->load($draft->created_by);
     $data['blogTitle'] = $draft->title;
     $data['blogAuthor'] = $author->getName();
     $data['blogAuthorAvatar'] = $author->getAvatar();
     $data['blogEditLink'] = EasyBlogRouter::getRoutedURL('index.php?option=com_easyblog&view=dashboard&layout=write&draft_id=' . $draft->id, false, true);
     $data['blogAuthorEmail'] = $author->user->email;
     $data['rejectMessage'] = $this->message;
     // If blog post is being posted from the back end and SH404 is installed, we should just use the raw urls.
     $sh404exists = EasyBlogRouter::isSh404Enabled();
     if (JFactory::getApplication()->isAdmin() && $sh404exists) {
         $data['blogEditLink'] = JURI::root() . 'index.php?option=com_easyblog&view=dashboard&layout=write&draft_id=' . $draft->id;
     }
     $emailTitle = JText::_('COM_EASYBLOG_EMAIL_TITLE_NEW_BLOG_REJECTED');
     $obj = new StdClass();
     $obj->unsubscribe = false;
     $obj->email = $author->user->email;
     $emails = array($obj);
     $notification = EasyBlogHelper::getHelper('Notification');
     $notification->send($emails, $emailTitle, 'email.blog.rejected', $data);
     return parent::store();
 }
开发者ID:alexinteam,项目名称:joomla3,代码行数:30,代码来源:postreject.php

示例2: sendApprovalEmail

 public function sendApprovalEmail($approvalType)
 {
     $user = EasyBlogHelper::getTable('Profile');
     $user->load($this->user_id);
     $team = EasyBlogHelper::getTable('TeamBlog');
     $team->load($this->team_id);
     $template = $approvalType ? 'email.teamblog.approved' : 'email.teamblog.rejected';
     $obj = new stdClass();
     $obj->unsubscribe = false;
     $obj->email = $user->user->email;
     $emails = array($obj->email => $obj);
     $data = array('teamName' => $team->title, 'teamDescription' => $team->getDescription(), 'teamAvatar' => $team->getAvatar(), 'teamLink' => EasyBlogRouter::getRoutedURL('index.php?option=com_easyblog&view=teamblog&layout=listings&id=' . $this->team_id, false, true));
     // If blog post is being posted from the back end and SH404 is installed, we should just use the raw urls.
     $sh404exists = EasyBlogRouter::isSh404Enabled();
     if (JFactory::getApplication()->isAdmin() && $sh404exists) {
         $data['teamLink'] = JURI::root() . 'index.php?option=com_easyblog&view=teamblog&layout=listings&id=' . $team->id;
     }
     $notification = EasyBlogHelper::getHelper('Notification');
     $notification->send($emails, JText::_('COM_EASYBLOG_TEAMBLOG_JOIN_REQUEST'), $template, $data);
 }
开发者ID:alexinteam,项目名称:joomla3,代码行数:20,代码来源:teamblogrequest.php

示例3: notify

 public function notify(EasyBlogTableBlog $blog)
 {
     $config = EasyBlogHelper::getConfig();
     // Send notification to site admins when a new blog post is reported
     $data = array();
     $data['blogTitle'] = $blog->title;
     $data['blogLink'] = EasyBlogRouter::getRoutedURL('index.php?option=com_easyblog&view=entry&id=' . $blog->id, false, true);
     // @rule: Send email notifications out to subscribers.
     $author = EasyBlogHelper::getTable('Profile');
     $author->load($this->created_by);
     $data['reporterAvatar'] = $author->getAvatar();
     $data['reporterName'] = $author->getName();
     $data['reporterLink'] = $author->getProfileLink();
     $data['reason'] = $this->reason;
     $date = EasyBlogDateHelper::dateWithOffSet($this->created);
     $data['reportDate'] = EasyBlogDateHelper::toFormat($date, '%A, %B %e, %Y');
     // If blog post is being posted from the back end and SH404 is installed, we should just use the raw urls.
     $sh404exists = EasyBlogRouter::isSh404Enabled();
     if (JFactory::getApplication()->isAdmin() && $sh404exists) {
         $data['blogLink'] = JURI::root() . 'index.php?option=com_easyblog&view=entry&id=' . $blog->id;
     }
     $emailBlogTitle = JString::substr($blog->title, 0, $config->get('main_mailtitle_length'));
     $emailTitle = JText::sprintf('COM_EASYBLOG_EMAIL_TITLE_NEW_REPORT', $emailBlogTitle) . ' ...';
     $notification = EasyBlogHelper::getHelper('Notification');
     $emails = array();
     // @rule: Fetch custom emails defined at the back end.
     if ($config->get('notification_blogadmin')) {
         if ($config->get('custom_email_as_admin')) {
             $notification->getCustomEmails($emails);
         } else {
             $notification->getAdminEmails($emails);
         }
     }
     if (!empty($emails)) {
         $notification->send($emails, $emailTitle, 'email.blog.report', $data);
     }
 }
开发者ID:alexinteam,项目名称:joomla3,代码行数:37,代码来源:report.php

示例4: processMessage

 /**
  * Process message
  **/
 function processMessage($MsgTemplate, $blog)
 {
     $config = EasyBlogHelper::getConfig();
     $message = empty($MsgTemplate) ? $config->get('main_twitter_message') : $MsgTemplate;
     $search = array();
     $replace = array();
     //replace title
     if (preg_match_all("/.*?(\\{title\\})/is", $message, $matches)) {
         $search[] = '{title}';
         $replace[] = $blog->title;
     }
     //replace title
     if (preg_match_all("/.*?(\\{introtext\\})/is", $message, $matches)) {
         $introtext = empty($blog->intro) ? '' : strip_tags($blog->intro);
         $search[] = '{introtext}';
         $replace[] = $introtext;
     }
     //replace category
     if (preg_match_all("/.*?(\\{category\\})/is", $message, $matches)) {
         $category = EasyBlogHelper::getTable('Category', 'Table');
         $category->load($blog->category_id);
         $search[] = '{category}';
         $replace[] = $category->title;
     }
     $message = JString::str_ireplace($search, $replace, $message);
     //replace link
     if (preg_match_all("/.*?(\\{link\\})/is", $message, $matches)) {
         // @task: Twitter now has auto shorten URL so the link will have a max of 20 chars which leaves us to a balance of 120 chars.
         $linkLength = 20;
         $link = EasyBlogRouter::getRoutedURL('index.php?option=com_easyblog&view=entry&id=' . $blog->id, false, true);
         // If blog post is being posted from the back end and SH404 is installed, we should just use the raw urls.
         $mainframe = JFactory::getApplication();
         $sh404exists = EasyBlogRouter::isSh404Enabled();
         if ($mainframe->isAdmin() && $sh404exists) {
             $link = rtrim(JURI::root(), '/') . '/index.php?option=com_easyblog&view=entry&id=' . $blog->id;
         }
         if ($config->get('main_twitter_shorten_url')) {
             $shortenerLogin = $config->get('main_twitter_urlshortener_login');
             $shortenerApiKey = $config->get('main_twitter_urlshortener_apikey');
             if (!empty($shortenerLogin) && !empty($shortenerApiKey)) {
                 require_once EBLOG_HELPERS . DIRECTORY_SEPARATOR . 'urlshortener.php';
                 $urlshortener = new EasyBlogURLShortenerHelper();
                 $result = $urlshortener->get_short_url($shortenerLogin, $shortenerApiKey, $link, 'bitly');
                 if (!empty($result)) {
                     $link = $result;
                     $linkLength = strlen($link);
                 }
             }
         }
         // @task: Get the remaining length that we can use.
         $remainingLength = 140 - 3 - $linkLength;
         //split the message
         $tempMsg = explode('{link}', $message);
         for ($i = 0; $i < count($tempMsg); $i++) {
             $temp =& $tempMsg[$i];
             $tempLength = strlen($temp);
             if ($tempLength > $remainingLength) {
                 if ($remainingLength <= 0) {
                     $temp = JString::substr($temp, 0, 0);
                 } else {
                     if ($remainingLength < 6) {
                         $temp = JString::substr($temp, 0, $remainingLength);
                     } else {
                         $temp = JString::substr($temp, 0, $remainingLength - 3);
                         $temp .= '.. ';
                     }
                     $remainingLength = 0;
                 }
             } else {
                 $remainingLength -= $tempLength;
             }
         }
         $message = implode($link, $tempMsg);
     } else {
         $message = JString::substr($message, 0, 136) . '...';
     }
     // since we know now twitter has it own shortener, we no longer
     // need to substr as the above algorithm already taken care the
     // lenght of the message ( excluded link length )
     // so we just need to pass the processed message together with the full url link.
     return $message;
     // return JString::substr($message, 0, 140);
 }
开发者ID:Tommar,项目名称:vino2,代码行数:86,代码来源:helper.php

示例5: addJomSocialActivityBlog

 public static function addJomSocialActivityBlog($blog, $isNew, $isFeed = false)
 {
     $jsCoreFile = JPATH_ROOT . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_community' . DIRECTORY_SEPARATOR . 'libraries' . DIRECTORY_SEPARATOR . 'core.php';
     $config = EasyBlogHelper::getConfig();
     $lang = JFactory::getLanguage();
     $lang->load('com_easyblog', JPATH_ROOT);
     // We do not want to add activities if new blog activity is disabled.
     if ($isFeed) {
         if ($isNew && !$config->get('integrations_jomsocial_rss_import_activity')) {
             return false;
         }
     } else {
         if ($isNew && !$config->get('integrations_jomsocial_blog_new_activity')) {
             return false;
         }
     }
     // We do not want to add activities if update blog activity is disabled.
     if (!$isNew && !$config->get('integrations_jomsocial_blog_update_activity')) {
         return false;
     }
     if (JFile::exists($jsCoreFile)) {
         require_once $jsCoreFile;
         $blogCommand = $isNew ? 'easyblog.blog.add' : 'easyblog.blog.update';
         $blogTitle = htmlspecialchars($blog->title);
         $maxTitleLength = $config->get('jomsocial_blog_title_length', 80);
         if (JString::strlen($blogTitle) > $maxTitleLength) {
             $blogTitle = JString::substr($blog->title, 0, $maxTitleLength) . '...';
         }
         $category = EasyBlogHelper::getTable('Category', 'Table');
         $category->load($blog->category_id);
         $easyBlogItemid = '';
         $mainframe = JFactory::getApplication();
         $blogLink = EasyBlogRouter::getRoutedURL('index.php?option=com_easyblog&view=entry&id=' . $blog->id . $easyBlogItemid, false, true);
         $categoryLink = EasyBlogRouter::getRoutedURL('index.php?option=com_easyblog&view=categories&layout=listings&id=' . $category->id . $easyBlogItemid, false, true);
         // If blog post is being posted from the back end and SH404 is installed, we should just use the raw urls.
         $sh404exists = EasyBlogRouter::isSh404Enabled();
         if ($mainframe->isAdmin() && $sh404exists) {
             $easyBlogItemid = EasyBlogRouter::getItemId('latest');
             $easyBlogItemid = '&Itemid=' . $easyBlogItemid;
             $blogLink = rtrim(JURI::root(), '/') . '/index.php?option=com_easyblog&view=entry&id=' . $blog->id . $easyBlogItemid;
             $categoryLink = rtrim(JURI::root(), '/') . '/index.php?option=com_easyblog&view=categories&layout=listings&id=' . $category->id . $easyBlogItemid;
         }
         $blogContent = '';
         if ($config->get('integrations_jomsocial_submit_content')) {
             $requireVerification = false;
             if ($config->get('main_password_protect', true) && !empty($blog->blogpassword)) {
                 $row->title = JText::sprintf('COM_EASYBLOG_PASSWORD_PROTECTED_BLOG_TITLE', $blog->title);
                 $requireVerification = true;
             }
             $blogContent = '';
             if ($requireVerification && !EasyBlogHelper::verifyBlogPassword($blog->blogpassword, $blog->id)) {
                 $theme = new CodeThemes();
                 $theme->set('id', $blog->id);
                 $theme->set('return', base64_encode($blogLink));
                 $blogContent = $theme->fetch('blog.protected.php');
             } else {
                 $blogContent = $blog->intro . $blog->content;
                 // Get blog's image and use it as the cover photo.
                 $image = '';
                 if ($blog->getImage()) {
                     $imageSource = $blog->getImage()->getSource('frontpage');
                     if ($imageSource) {
                         $image = '<a href="' . $blogLink . '"><img src="' . $imageSource . '" style="margin: 0 5px 5px 0;float: left; height: auto; width: 120px !important;"/></a>';
                     }
                 } else {
                     // Try to find for an image in the content.
                     $pattern = '#<img[^>]*>#i';
                     preg_match($pattern, $blogContent, $matches);
                     if ($matches) {
                         $matches[0] = JString::str_ireplace('img ', 'img style="margin: 0 5px 5px 0;float: left; height: auto; width: 120px !important;"', $matches[0]);
                         $image = '<a href="' . $blogLink . '">' . $matches[0] . '</a>';
                     }
                 }
                 // Strip unwanted data.
                 $blogContent = EasyBlogHelper::getHelper('Videos')->strip($blogContent);
                 $blogContent = EasyBlogGoogleAdsense::stripAdsenseCode($blogContent);
                 $blogContent = JString::substr($blogContent, 0, $config->get('integrations_jomsocial_blogs_length', 250)) . ' ...';
                 // Remove all html tags from the content as we want to chop it down.
                 $blogContent = strip_tags($blogContent);
                 if (!empty($image)) {
                     $blogContent = $image . $blogContent . '<div style="clear: both;"></div>';
                 }
                 $blogContent .= '<div style="text-align: right;"><a href="' . $blogLink . '">' . JText::_('COM_EASYBLOG_CONTINUE_READING') . '</a></div>';
             }
         }
         $title = $isNew ? JText::sprintf('COM_EASYBLOG_JS_ACTIVITY_BLOG_ADDED_NON_CATEGORY', $blogLink, $blogTitle) : JText::sprintf('COM_EASYBLOG_JS_ACTIVITY_BLOG_UPDATED_NON_CATEGORY', $blogLink, $blogTitle);
         if ($config->get('integrations_jomsocial_show_category')) {
             $title = $isNew ? JText::sprintf('COM_EASYBLOG_JS_ACTIVITY_BLOG_ADDED', $blogLink, $blogTitle, $categoryLink, JText::_($category->title)) : JText::sprintf('COM_EASYBLOG_JS_ACTIVITY_BLOG_UPDATED', $blogLink, $blogTitle, $categoryLink, JText::_($category->title));
         }
         $obj = new stdClass();
         $obj->access = $blog->private;
         $obj->title = $title;
         $obj->content = $blogContent;
         $obj->cmd = $blogCommand;
         if ($config->get('integrations_jomsocial_activity_likes')) {
             $obj->like_id = $blog->id;
             $obj->like_type = 'com_easyblog';
             if (!$isNew) {
                 $obj->comment_type = 'com_easyblog.update';
             }
//.........这里部分代码省略.........
开发者ID:Tommar,项目名称:vino2,代码行数:101,代码来源:helper.php

示例6: share

 /**
  * Shares a new content on Facebook
  **/
 public function share($blog, $message = '', $oauth, $useSystem = false)
 {
     $config = EasyBlogHelper::getConfig();
     $source = $config->get('integrations_facebook_source');
     $content = isset($blog->{$source}) && !empty($blog->{$source}) ? $blog->{$source} : $blog->intro . $blog->content;
     $content = EasyBlogHelper::getHelper('Videos')->strip($content);
     $image = '';
     // @rule: Ensure that only public posts are allowed
     if ($blog->private != 0) {
         return false;
     }
     // @rule: Try to get the blog image.
     if ($blog->getImage()) {
         $image = $blog->getImage()->getSource('frontpage');
     }
     if (empty($image)) {
         // @rule: Match images from blog post
         $pattern = '/<\\s*img [^\\>]*src\\s*=\\s*[\\""\']?([^\\""\'\\s>]*)/i';
         preg_match($pattern, $content, $matches);
         $image = '';
         if ($matches) {
             $image = isset($matches[1]) ? $matches[1] : '';
             if (JString::stristr($matches[1], 'https://') === false && JString::stristr($matches[1], 'http://') === false && !empty($image)) {
                 $image = rtrim(JURI::root(), '/') . '/' . ltrim($image, '/');
             }
         }
     }
     $maxContentLen = $config->get('integrations_facebook_blogs_length');
     $text = strip_tags($content);
     if (!empty($maxContentLen)) {
         $text = JString::strlen($text) > $maxContentLen ? JString::substr($text, 0, $maxContentLen) . '...' : $text;
     }
     $url = EasyBlogRouter::getRoutedURL('index.php?option=com_easyblog&view=entry&id=' . $blog->id, false, true);
     // If blog post is being posted from the back end and SH404 is installed, we should just use the raw urls.
     $sh404exists = EasyBlogRouter::isSh404Enabled();
     $mainframe = JFactory::getApplication();
     if ($mainframe->isAdmin() && $sh404exists) {
         $url = rtrim(JURI::root(), '/') . '/index.php?option=com_easyblog&view=entry&id=' . $blog->id;
     }
     preg_match('/expires=(.*)/i', $this->_access_token, $expires);
     if (isset($expires[1])) {
         $this->_access_token = str_ireplace('&expires=' . $expires[1], '', $this->_access_token);
     }
     // Remove adsense codes
     require_once EBLOG_CLASSES . DIRECTORY_SEPARATOR . 'adsense.php';
     $text = EasyBlogGoogleAdsense::stripAdsenseCode($text);
     $jConfig = EasyBlogHelper::getJConfig();
     $params = array('link' => $url, 'name' => $blog->title, 'description' => $text, 'message' => $blog->title, 'access_token' => $this->_access_token);
     if (empty($image)) {
         $params['picture'] = rtrim(JURI::root(), '/') . '/components/com_easyblog/assets/images/default_facebook.png';
         $params['source'] = rtrim(JURI::root(), '/') . '/components/com_easyblog/assets/images/default_facebook.png';
     } else {
         $params['picture'] = $image;
         $params['source'] = $image;
     }
     // @rule: For system messages, we need to see if there's any pages associated.
     if ($oauth->system && $useSystem) {
         if ($config->get('integrations_facebook_impersonate_page') || $config->get('integrations_facebook_impersonate_group')) {
             if ($config->get('integrations_facebook_impersonate_page')) {
                 $pages = JString::trim($config->get('integrations_facebook_page_id'));
                 $pages = explode(',', $pages);
                 $total = count($pages);
                 // @rule: Test if there are any pages at all the user can access
                 $accounts = parent::api('/me/accounts', array('access_token' => $this->_access_token));
                 if (is_array($accounts) && isset($accounts['data'])) {
                     for ($i = 0; $i < $total; $i++) {
                         foreach ($accounts['data'] as $page) {
                             if ($page['id'] == $pages[$i]) {
                                 $params['access_token'] = $page['access_token'];
                                 $query = parent::api('/' . $page['id'] . '/feed', 'post', $params);
                             }
                         }
                     }
                 }
             }
             if ($config->get('integrations_facebook_impersonate_group')) {
                 $groupsId = JString::trim($config->get('integrations_facebook_group_id'));
                 $groupsId = explode(',', $groupsId);
                 $total = count($groupsId);
                 // @rule: Test if there are any groups at all the user can access
                 $accounts = parent::api('/me/groups', 'GET', array('access_token' => $this->_access_token));
                 $params['access_token'] = $this->_access_token;
                 if (is_array($accounts) && isset($accounts['data'])) {
                     for ($i = 0; $i < $total; $i++) {
                         foreach ($accounts['data'] as $group) {
                             if ($group['id'] == $groupsId[$i]) {
                                 $query = parent::api('/' . $group['id'] . '/feed', 'post', $params);
                             }
                         }
                     }
                 }
             }
         } else {
             // @rule: If this is just a normal posting, just post it on their page.
             $query = parent::api('/me/feed', 'post', $params);
         }
     } else {
//.........这里部分代码省略.........
开发者ID:Tommar,项目名称:vino2,代码行数:101,代码来源:helper.php

示例7: getExternalBlogLink

 public function getExternalBlogLink($url)
 {
     // If blog post is being posted from the back end and SH404 is installed, we should just use the raw urls.
     $sh404exists = EasyBlogRouter::isSh404Enabled();
     $link = EasyBlogRouter::getRoutedURL($url, false, true);
     if (JFactory::getApplication()->isAdmin() && $sh404exists) {
         $link = rtrim(JURI::root(), '/') . $url;
     }
     return $link;
 }
开发者ID:alexinteam,项目名称:joomla3,代码行数:10,代码来源:blogs.php

示例8: store

 public function store($updateNulls = false)
 {
     $state = parent::store();
     // @rule: Process notifications for admins when the blog post is pending approvals
     if ($this->pending_approval) {
         $user = EasyBlogHelper::getTable('Profile');
         $user->load($this->created_by);
         $date = EasyBlogDateHelper::dateWithOffSet($this->created);
         $data = array('blogTitle' => $this->title, 'blogAuthor' => $user->getName(), 'blogAuthorLink' => EasyBlogRouter::getRoutedURL('index.php?option=com_easyblog&view=blogger&layout=listings&id=' . $user->id, false, true), 'blogIntro' => $this->intro, 'blogContent' => $this->content, 'blogAuthorAvatar' => $user->getAvatar(), 'blogDate' => EasyBlogDateHelper::toFormat($date, '%A, %B %e, %Y'), 'reviewLink' => EasyBlogRouter::getRoutedURL('index.php?option=com_easyblog&view=dashboard&layout=pending&draft_id=' . $this->id, false, true));
         // If blog post is being posted from the back end and SH404 is installed, we should just use the raw urls.
         $sh404exists = EasyBlogRouter::isSh404Enabled();
         if (JFactory::getApplication()->isAdmin() && $sh404exists) {
             $data['blogAuthorLink'] = JURI::root() . 'index.php?option=com_easyblog&view=blogger&layout=listings&id=' . $user->id;
             $data['reviewLink'] = JURI::root() . 'index.php?option=com_easyblog&view=dashboard&layout=pending&draft_id' . $this->id;
         }
         $emailTitle = JText::_('COM_EASYBLOG_EMAIL_TITLE_NEW_BLOG_PENDING_REVIEW');
         $emails = array();
         $notification = EasyBlogHelper::getHelper('Notification');
         $config = EasyBlogHelper::getConfig();
         // @rule: if custom_email_as_admin is enabled, use custom email as admin email
         if ($config->get('custom_email_as_admin')) {
             // @rule: Send to custom email addresses
             $notification->getCustomEmails($emails);
         } else {
             // @rule: Send to administrator's on the site.
             $notification->getAdminEmails($emails);
         }
         $notification->send($emails, $emailTitle, 'email.blog.review', $data);
     }
     return $state;
 }
开发者ID:alexinteam,项目名称:joomla3,代码行数:31,代码来源:draft.php

示例9: sendNotificationsJomsocial

 private function sendNotificationsJomsocial($blog, $isNew, $uid, $source, $author)
 {
     JFactory::getLanguage()->load('com_easyblog', JPATH_ROOT);
     $config = EasyBlogHelper::getConfig();
     // @rule: Send email notifications out to subscribers.
     $author = EasyBlogHelper::getTable('Profile');
     $author->load($blog->created_by);
     $data['blogTitle'] = $blog->title;
     $data['blogAuthor'] = $author->getName();
     $data['blogAuthorAvatar'] = $author->getAvatar();
     $data['blogAuthorLink'] = EasyBlogRouter::getRoutedURL('index.php?option=com_easyblog&view=blogger&layout=listings&id=' . $author->id, false, true);
     $data['blogAuthorEmail'] = $author->user->email;
     $data['blogIntro'] = $blog->intro;
     $data['blogContent'] = $blog->content;
     $data['blogLink'] = EasyBlogRouter::getRoutedURL('index.php?option=com_easyblog&view=entry&id=' . $blog->id, false, true);
     $date = EasyBlogDateHelper::dateWithOffSet($blog->created);
     $data['blogDate'] = EasyBlogDateHelper::toFormat($date, '%A, %B %e, %Y');
     // If blog post is being posted from the back end and SH404 is installed, we should just use the raw urls.
     $sh404exists = EasyBlogRouter::isSh404Enabled();
     if (JFactory::getApplication()->isAdmin() && $sh404exists) {
         $data['blogLink'] = JURI::root() . 'index.php?option=com_easyblog&view=entry&id=' . $blog->id;
         $data['blogAuthorLink'] = JURI::root() . 'index.php?option=com_easyblog&view=blogger&layout=listings&id=' . $author->id;
     }
     if (is_array($uid)) {
         $uid = $uid[0];
     }
     JTable::addIncludePath(JPATH_ROOT . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_community' . DIRECTORY_SEPARATOR . 'tables');
     $event = JTable::getInstance('Event', 'CTable');
     $event->load($uid);
     $members = $event->getMembers(1, 99999);
     $emails = array();
     $jsCoreFile = JPATH_ROOT . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_community' . DIRECTORY_SEPARATOR . 'libraries' . DIRECTORY_SEPARATOR . 'core.php';
     foreach ($members as $member) {
         $user = CFactory::getUser($member->id);
         // Do not send email to the author.
         if ($author->user->email != $user->email) {
             $obj = new stdClass();
             $obj->email = $user->email;
             $emails[] = $obj;
         }
     }
     $notification = EasyBlogHelper::getHelper('Notification');
     $emailBlogTitle = JString::substr($blog->title, 0, $config->get('main_mailtitle_length'));
     $emailTitle = JText::sprintf('COM_EASYBLOG_EMAIL_TITLE_NEW_BLOG_ADDED_WITH_TITLE', $emailBlogTitle) . ' ...';
     $notification->send($emails, $emailTitle, 'email.blog.new', $data);
 }
开发者ID:Tommar,项目名称:vino2,代码行数:46,代码来源:event.php

示例10: deleteBlog

 /**
  * Delete a blog entry from the site given the id's.
  **/
 public function deleteBlog()
 {
     // Check for request forgeries
     JRequest::checkToken() or jexit('Invalid Token');
     $mainframe = JFactory::getApplication();
     $config = EasyBlogHelper::getConfig();
     $acl = EasyBlogACLHelper::getRuleSet();
     $my = JFactory::getUser();
     $message = '';
     $type = '';
     $ids = JRequest::getVar('blogId', '');
     $ids = explode(',', $ids);
     $redirect = JRequest::getVar('redirect', '');
     $redirect = empty($redirect) ? 'index.php?option=com_easyblog' : base64_decode($redirect);
     $sh404exists = EasyBlogRouter::isSh404Enabled();
     if (empty($ids)) {
         EasyBlogHelper::setMessageQueue(JText::_('COM_EASYBLOG_DASHBOARD_DELETE_NO_ID_ERROR'), 'error');
         $mainframe->redirect($redirect);
         $mainframe->close();
     }
     if ((empty($acl->rules->delete_entry) || $my->id == 0) && !EasyBlogHelper::isSiteAdmin() && empty($acl->rules->moderate_entry)) {
         EasyBlogHelper::setMessageQueue(JText::_('COM_EASYBLOG_NO_PERMISSION_TO_DELETE_BLOG'), 'error');
         $mainframe->redirect($redirect);
         $mainframe->close();
     }
     foreach ($ids as $id) {
         $blog = EasyBlogHelper::getTable('Blog', 'Table');
         $blog->load($id);
         if ($blog->created_by != $my->id && !EasyBlogHelper::isSiteAdmin() && empty($acl->rules->moderate_entry)) {
             EasyBlogHelper::setMessageQueue(JText::_('COM_EASYBLOG_NOT_ALLOWED'), 'error');
             $mainframe->redirect($redirect);
             $mainframe->close();
         }
         if (!$blog->delete()) {
             EasyBlogHelper::setMessageQueue(JText::_('COM_EASYBLOG_DASHBOARD_DELETE_ERROR'), 'error');
             $mainframe->redirect($redirect);
             $mainframe->close();
         }
     }
     EasyBlogHelper::setMessageQueue(JText::_('COM_EASYBLOG_DASHBOARD_DELETE_SUCCESS', 'success'));
     $mainframe->redirect($redirect);
     $mainframe->close();
 }
开发者ID:Tommar,项目名称:vino2,代码行数:46,代码来源:dashboard.php

示例11: sendNotificationsJomsocial

 private function sendNotificationsJomsocial($blog, $isNew, $key, $source, $author)
 {
     JFactory::getLanguage()->load('com_easyblog', JPATH_ROOT);
     // @rule: Send email notifications out to subscribers.
     $author = EB::user($blog->created_by);
     $data['blogTitle'] = $blog->title;
     $data['blogAuthor'] = $author->getName();
     $data['blogAuthorAvatar'] = $author->getAvatar();
     $data['blogAuthorLink'] = EasyBlogRouter::getRoutedURL('index.php?option=com_easyblog&view=blogger&layout=listings&id=' . $author->id, false, true);
     $data['blogAuthorEmail'] = $author->user->email;
     $data['blogIntro'] = $blog->intro;
     $data['blogContent'] = $blog->content;
     $data['blogLink'] = EasyBlogRouter::getRoutedURL('index.php?option=com_easyblog&view=entry&id=' . $blog->id, false, true);
     $date = EasyBlogDateHelper::dateWithOffSet($blog->created);
     $data['blogDate'] = EasyBlogDateHelper::toFormat($date, JText::_('DATE_FORMAT_LC1'));
     // If blog post is being posted from the back end and SH404 is installed, we should just use the raw urls.
     $sh404exists = EasyBlogRouter::isSh404Enabled();
     if (JFactory::getApplication()->isAdmin() && $sh404exists) {
         $data['blogLink'] = JURI::root() . 'index.php?option=com_easyblog&view=entry&id=' . $blog->id;
         $data['blogAuthorLink'] = JURI::root() . 'index.php?option=com_easyblog&view=blogger&layout=listings&id=' . $author->id;
     }
     // Get group members emails
     if (!class_exists('CommunityModelGroups')) {
         jimport('joomla.application.component.model');
         JLoader::import('groups', JPATH_ROOT . DIRECTORY_SEPARATOR . 'com_community' . DIRECTORY_SEPARATOR . 'models');
     }
     $model = JModelLegacy::getInstance('Groups', 'CommunityModel');
     if (is_array($key)) {
         $key = $key[0];
     }
     if (!method_exists($model, 'getAllMember')) {
         // Snippet taken from getAllMember
         $db = EasyBlogHelper::db();
         $query = 'SELECT a.' . $db->nameQuote('memberid') . ' AS id, a.' . $db->nameQuote('approved') . ' , b.' . $db->nameQuote('name') . ' as name , a.' . $db->nameQuote('permissions') . ' as permission FROM ' . $db->nameQuote('#__community_groups_members') . ' AS a ' . ' INNER JOIN ' . $db->nameQuote('#__users') . ' AS b ' . ' WHERE b.' . $db->nameQuote('id') . '=a.' . $db->nameQuote('memberid') . ' AND a.' . $db->nameQuote('groupid') . '=' . $db->Quote($key) . ' AND b.' . $db->nameQuote('block') . '=' . $db->Quote('0') . ' ' . ' AND a.' . $db->nameQuote('permissions') . ' !=' . $db->quote(-1);
         $db->setQuery($query);
         $members = $db->loadObjectList();
     } else {
         $members = $model->getAllMember($key);
     }
     $emails = array();
     $jsCoreFile = JPATH_ROOT . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_community' . DIRECTORY_SEPARATOR . 'libraries' . DIRECTORY_SEPARATOR . 'core.php';
     foreach ($members as $member) {
         $user = CFactory::getUser($member->id);
         $userParam = $user->getParams();
         $enabled = $userParam->get('etype_groups_sendmail', 0);
         if (!$enabled) {
             continue;
         }
         if ($author->user->email != $user->email) {
             $obj = new stdClass();
             $obj->email = $user->email;
             $emails[] = $obj;
         }
     }
     $config = EasyBlogHelper::getConfig();
     $notification = EasyBlogHelper::getHelper('Notification');
     $emailBlogTitle = JString::substr($blog->title, 0, $config->get('main_mailtitle_length'));
     $emailTitle = JText::sprintf('COM_EASYBLOG_EMAIL_TITLE_NEW_BLOG_ADDED_WITH_TITLE', $emailBlogTitle) . ' ...';
     $notification->send($emails, $emailTitle, 'email.blog.new', $data);
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:60,代码来源:groups.php


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