Example #1
0
 /**
  * Renders audio player for the blog
  *
  * @since	5.0
  * @access	public
  * @param	string
  * @return	
  */
 public function renderAudioPlayer($uri, $options = array())
 {
     // Merge the options with the default options
     $options = array_replace_recursive(self::$defaultAudioOptions, $options);
     // Generate a random uid
     $uniqid = uniqid();
     $uid = 'audio-' . EBMM::getHash($uri . $uniqid);
     // Url to the audio
     $url = $this->normalizeURI($uri);
     // Get the track if there is no track provided
     if (!$options['track']) {
         $options['track'] = basename($url);
     }
     // Set a default artist if artist isn't set
     if (!$options['artist']) {
         $options['artist'] = JText::_('COM_EASYBLOG_BLOCKS_AUDIO_ARTIST');
     }
     $template = EB::template();
     $template->set('uid', $uid);
     $template->set('showTrack', $options['showTrack']);
     $template->set('showDownload', $options['showDownload']);
     $template->set('showArtist', $options['showArtist']);
     $template->set('autoplay', $options['autoplay']);
     $template->set('loop', $options['loop']);
     $template->set('artist', $options['artist']);
     $template->set('track', $options['track']);
     $template->set('url', $url);
     $output = $template->output('site/blogs/blocks/audio');
     return $output;
 }
Example #2
0
 private function jomsocialForm($external, $groupId = '0', $blogSource = '', $isPending = 0)
 {
     $my = JFactory::getUser();
     $file = JPATH_ROOT . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_community' . DIRECTORY_SEPARATOR . 'libraries' . DIRECTORY_SEPARATOR . 'core.php';
     //extra checking incase somewhere still passing empty blogSource.
     $blogSource = empty($blogSource) ? 'group' : $blogSource;
     if (!JFile::exists($file)) {
         return false;
     }
     require_once $file;
     $model = CFactory::getModel('groups');
     if (EasyBlogHelper::isSiteAdmin() && $isPending) {
         $rows = $model->getAllGroups();
     } else {
         $rows = $model->getGroups($my->id, null, false);
     }
     $groups = array();
     JTable::addIncludePath(JPATH_ROOT . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_community' . DIRECTORY_SEPARATOR . 'tables');
     foreach ($rows as $row) {
         $group = JTable::getInstance('Group', 'CTable');
         $group->load($row->id);
         $data = new stdClass();
         $data->id = $group->id;
         $data->title = $group->name;
         $data->avatar = $group->getAvatar();
         $groups[] = $data;
     }
     $theme = EB::template();
     $theme->set('blogSource', $blogSource);
     $theme->set('external', $external);
     $theme->set('groups', $groups);
     $theme->set('groupId', $groupId);
     return $theme->output('site/jomsocial/groups');
 }
Example #3
0
 public function map(&$file, $index, &$contents)
 {
     // Store the file to a temporary location
     $file['tmp_name'] = $this->tmp . '/' . md5($file['name']);
     JFile::write($file['tmp_name'], $file['data']);
     // Load up media manager now
     $mm = EB::mediamanager();
     $result = $mm->upload($file, 'user:'******'name'];
     $url = $this->absoluteUrl . '/' . $file['name'];
     // Get the properties from media manager result
     if (is_object($result) && property_exists($result, 'title')) {
         $title = $result->title;
         $url = $result->url;
     }
     // Once the attachment is already uploaded, we want to delete the temporary file now
     JFile::delete($file['tmp_name']);
     // Check if a file id is provided in the email
     if (isset($file['id']) && !empty($file['id'])) {
         $fileId = $file['id'];
         $fileId = str_replace('<', '', $fileId);
         $fileId = str_replace('>', '', $fileId);
         $patterns = array('/<div><img[^>]*src="[A-Za-z0-9:^>]*' . $fileId . '"[^>]*\\/><\\/div>/si', '/<img[^>]*src="[A-Za-z0-9:^>]*' . $fileId . '"[^>]*\\/>/si');
         $replace = array('', '');
         $contents = preg_replace($patterns, $replace, $contents);
     }
     // Now we need to insert the pdf links into the content
     $template = EB::template();
     $template->set('title', $title);
     $template->set('url', $url);
     $output = $template->output('site/mailpublishing/template.pdf');
     $contents .= $output;
 }
Example #4
0
 public function getAjaxTemplate()
 {
     $files = JRequest::getVar('names', '');
     if (empty($files)) {
         return false;
     }
     // Ensure the integrity of each items submitted to be an array.
     if (!is_array($files)) {
         $files = array($files);
     }
     $result = array();
     $template = EB::template();
     foreach ($files as $file) {
         $dashboard = explode('/', $file);
         if ($dashboard[0] == "dashboard") {
             $out = $template->output('site/dashboard/' . $dashboard[1] . '.ejs');
         } elseif ($dashboard[0] == "media") {
             $out = $template->output('site/media/' . $dashboard[1] . '.ejs');
         } else {
             $out = $template->output('site/' . $file . '.ejs');
         }
         $obj = new stdClass();
         $obj->name = $file;
         $obj->content = $out;
         $result[] = $obj;
     }
     header('Content-type: text/x-json; UTF-8');
     $json = new Services_JSON();
     echo $json->encode($result);
     exit;
 }
Example #5
0
 /**
  * Outputs the html code for Facebook button
  *
  * @since	4.0
  * @access	public
  * @param	string
  * @return
  */
 public function html()
 {
     // If this is a frontpage, ensure that show in frontpage is enabled
     if ($this->frontpage && !$this->config->get('main_facebook_like_frontpage', $this->config->get('social_show_frontpage'))) {
         return;
     }
     // Get the button size
     $size = $this->getButtonSize();
     // Get standard properties
     $locale = $this->getLocale();
     $width = $this->config->get('main_facebook_like_width');
     $verb = $this->config->get('main_facebook_like_verb');
     $fbTheme = $this->config->get('main_facebook_like_theme');
     $send = $this->config->get('main_facebook_like_send');
     // Get the permalink to the blog post.
     $url = $this->post->getExternalPermalink();
     // Determines if we should track with analytics
     $tracking = $this->config->get('main_facebook_analytics');
     // Generate a placeholder
     $placeholder = $this->getPlaceholderId();
     $theme = EB::template();
     $theme->set('size', $size);
     $theme->set('placeholder', $placeholder);
     $theme->set('url', $url);
     $theme->set('locale', $locale);
     $theme->set('verb', $verb);
     $theme->set('fbTheme', $fbTheme);
     $theme->set('send', $send);
     $theme->set('tracking', $tracking);
     $output = $theme->output('site/socialbuttons/facebook');
     return $output;
 }
Example #6
0
 /**
  * Outputs the html code for Twitter button
  *
  * @since	4.0
  * @access	public
  * @param	string
  * @return
  */
 public function html()
 {
     // If this is a frontpage, ensure that show in frontpage is enabled
     if ($this->frontpage && !$this->config->get('main_twitter_button_frontpage', $this->config->get('social_show_frontpage'))) {
         return;
     }
     // Get the button size
     $size = $this->getButtonSize();
     // Get the via text
     $via = $this->config->get('main_twitter_button_via_screen_name', '');
     if ($via) {
         $via = JString::substr($via, 1);
     }
     // Get the absolute url to this blog post
     $url = $this->getUrl();
     // Ge the formatted title to this blog post
     $title = $this->getTitle();
     // Twitter's sharing shouldn't have urlencoded values
     $title = urldecode($title);
     // Remove unwanted character inside url to avoid incorrect url sharing
     $title = str_replace('"', '', $title);
     // Determines if we should track with analytics
     $tracking = $this->config->get('main_twitter_analytics');
     $placeholder = $this->getPlaceholderId();
     $theme = EB::template();
     $theme->set('tracking', $tracking);
     $theme->set('size', $size);
     $theme->set('via', $via);
     $theme->set('placeholder', $placeholder);
     $theme->set('url', $url);
     $theme->set('title', $title);
     $output = $theme->output('site/socialbuttons/twitter');
     return $output;
 }
Example #7
0
 /**
  * Outputs the html code for Twitter button
  *
  * @since	4.0
  * @access	public
  * @param	string
  * @return
  */
 public function html()
 {
     if (!$this->isEnabled()) {
         return;
     }
     $this->addScript();
     // Get the pinterest button style from the configuration
     $size = $this->getButtonSize();
     $url = EBR::getRoutedURL('index.php?option=com_easyblog&view=entry&id=' . $this->post->id, false, true);
     // Combine the introtext and the content
     $content = $this->post->intro . $this->post->content;
     // Get the media
     $media = $this->getMedia();
     $contentLength = 350;
     $text = $this->post->intro . $this->post->content;
     $text = nl2br($text);
     $text = strip_tags($text);
     $text = trim(preg_replace('/\\s+/', ' ', $text));
     $text = JString::strlen($text) > $contentLength ? JString::substr($text, 0, $contentLength) . '...' : $text;
     $title = $this->post->title;
     // Urlencode all the necessary properties.
     $url = urlencode($url);
     $text = urlencode($text);
     $media = urlencode($media);
     $placeholder = $this->getPlaceholderId();
     $theme = EB::template();
     $theme->set('size', $size);
     $theme->set('placeholder', $placeholder);
     $theme->set('url', $url);
     $theme->set('title', $title);
     $theme->set('media', $media);
     $theme->set('text', $text);
     $output = $theme->output('site/socialbuttons/pinterest');
     return $output;
 }
Example #8
0
 public function data()
 {
     $theme = EB::template();
     $content = $theme->output('site/composer/blocks/handlers/text/html');
     $data = (object) array('content' => $content);
     return $data;
 }
Example #9
0
 /**
  * Outputs the html code for Twitter button
  *
  * @since	4.0
  * @access	public
  * @param	string
  * @return
  */
 public function html()
 {
     // If this is a frontpage, ensure that show in frontpage is enabled
     if (!$this->isEnabled()) {
         return;
     }
     // The default button size
     $size = $this->getButtonSize();
     $placeholder = $this->getPlaceholderId();
     // Add the script
     $this->addScript();
     // Get the absolute url to this blog post
     $url = $this->getUrl();
     // Ge the formatted title to this blog post
     $title = $this->getTitle();
     // Get the desc
     $desc = $this->getDescription();
     // Get the blog image
     $image = $this->getImage();
     $theme = EB::template();
     $apiKey = $this->config->get('main_vk_api');
     $theme->set('apiKey', $apiKey);
     $theme->set('url', $url);
     $theme->set('title', $title);
     $theme->set('desc', $desc);
     $theme->set('image', $image);
     $theme->set('size', $size);
     $theme->set('placeholder', $placeholder);
     $output = $theme->output('site/socialbuttons/vk');
     return $output;
 }
Example #10
0
 /**
  * Displays a list of voters
  *
  * @since	4.0
  * @access	public
  * @param	string
  * @return
  */
 public function voters()
 {
     // Get the composite keys
     $uid = $this->input->get('uid', 0, 'int');
     $type = $this->input->get('type', '', 'cmd');
     // Get maximum number of voters to show up in the dialog.
     $limit = EB::config()->get('main_ratings_display_raters_max');
     // Get the ratings
     $model = EB::model('Ratings');
     $votes = $model->getRatingUsers($uid, $type, $limit);
     // Determines the total number of guest votes
     $totalGuests = 0;
     // Format the votes
     if ($votes) {
         foreach ($votes as &$vote) {
             $vote->user = false;
             if ($vote->created_by) {
                 $user = EB::user($vote->created_by);
                 $vote->user = $user;
             } else {
                 $totalGuests += 1;
             }
         }
     }
     $theme = EB::template();
     $theme->set('totalGuests', $totalGuests);
     $theme->set('votes', $votes);
     $output = $theme->output('site/ratings/dialog.voters');
     return $this->ajax->resolve($output);
 }
Example #11
0
 /**
  * Displays the pagination links at the bottom of the page.
  *
  * @since	5.0
  * @access	public
  * @param	string
  * @return	
  */
 public function toHTML($view = 'index', $replace = false)
 {
     // Retrieve the pagination data.
     $data = $this->getData();
     // If there's no pagination at all, skip this
     if (count($data->pages) == $this->get('pages.total') && $this->get('pages.total') == 1 || $this->get('pages.total') == 0) {
         return false;
     }
     $queries = '';
     if (!empty($data) && $replace) {
         $currentPageLink = 'index.php?option=com_easyblog&view=' . $view . $queries;
         foreach ($data->pages as $page) {
             if (!empty($page->link)) {
                 $limitstart = !empty($page->base) ? '&limitstart=' . $page->base : '';
                 $page->link = EBR::_($currentPageLink . $limitstart);
             }
         }
         if (!empty($data->next->link)) {
             $limitstart = !empty($data->next->base) ? '&limitstart=' . $data->next->base : '';
             $data->next->link = EBR::_($currentPageLink . $limitstart);
         }
         if (!empyt($data->previous->link)) {
             $limitstart = !empty($data->previous->base) ? '&limitstart=' . $data->previous->base : '';
             $data->previous->link = EBR::_($currentPageLink . $limitstart);
         }
     }
     $template = EB::template();
     $template->set('data', $data);
     return $template->output('site/blogs/pagination/default');
 }
Example #12
0
 /**
  * Renders the maps for a blog post
  *
  * @since	4.0
  * @access	public
  * @param	string
  * @return
  */
 public function html(EasyBlogPost &$post)
 {
     static $loaded = false;
     if (!$post->hasLocation()) {
         return;
     }
     $language = $this->config->get('main_locations_blog_language');
     if (!$loaded) {
         $this->doc->addScript('https://maps.googleapis.com/maps/api/js?sensor=true&language=' . $language);
     }
     // Get the map configuration
     $static = $this->config->get('main_locations_static_maps');
     $type = $this->config->get('main_locations_map_type');
     $maxZoom = $this->config->get('main_locations_max_zoom_level');
     $minZoom = $this->config->get('main_locations_min_zoom_level');
     $defaultZoom = $this->config->get('main_locations_default_zoom_level', '17');
     // Generate a unique id
     $uid = uniqid();
     $template = EB::template();
     $template->set('uid', $uid);
     $template->set('defaultZoom', $defaultZoom);
     $template->set('minZoom', $minZoom);
     $template->set('maxZoom', $maxZoom);
     $template->set('defaultZoom', $defaultZoom);
     $template->set('type', $type);
     $template->set('language', $language);
     $template->set('post', $post);
     $namespace = 'site/maps/static';
     if (!$this->config->get('main_locations_static_maps')) {
         $namespace = 'site/maps/interactive';
     }
     $output = $template->output($namespace);
     return $output;
 }
Example #13
0
 /**
  * New method to retrieve ratings form
  *
  * @since	5.0
  * @access	public
  * @param	string
  * @return
  */
 public function html(EasyBlogPost $post, $elementId, $text = '', $disabled = false)
 {
     // If ratings has been disabled, do not proceed here.
     if (!$this->config->get('main_ratings')) {
         return false;
     }
     // Generate the hash for the current user
     $hash = !$this->my->guest ? '' : JFactory::getSession()->getId();
     // Determines if the current user has already voted
     $voted = $post->hasVoted($this->my->id);
     $locked = false;
     if ($voted || ($this->my->guest && !$this->config->get('main_ratings_guests') || $disabled)) {
         $locked = true;
     }
     // Get the rating value for the post
     $value = $post->getRatings();
     // Only display ratings on entry view
     $entry = $this->input->get('view', '', 'cmd') == 'entry' ? true : false;
     $template = EB::template();
     $template->set('entry', $entry);
     $template->set('voted', $voted);
     $template->set('elementId', $elementId);
     $template->set('rating', $value->ratings);
     $template->set('total', $value->total);
     $template->set('locked', $locked);
     $template->set('text', $text);
     $template->set('uid', $post->id);
     $template->set('type', EASYBLOG_RATINGS_ENTRY);
     return $template->output('site/ratings/form');
 }
Example #14
0
 public function display($tmpl = null)
 {
     JPluginHelper::importPlugin('easyblog');
     $dispatcher = JDispatcher::getInstance();
     $mainframe = JFactory::getApplication();
     $document = JFactory::getDocument();
     $config = EasyBlogHelper::getConfig();
     //for trigger
     $params = $mainframe->getParams('com_easyblog');
     $joomlaVersion = EasyBlogHelper::getJoomlaVersion();
     $blogId = $this->input->get('id', 0, 'int');
     if (empty($blogId)) {
         return JError::raiseError(404, JText::_('COM_EASYBLOG_BLOG_NOT_FOUND'));
     }
     $my = JFactory::getUser();
     $blog = EB::table('Blog');
     $blog->load($blogId);
     $post = EB::post($blogId);
     // Check if blog is password protected.
     $protected = $this->isProtected($post);
     if ($protected !== false) {
         return;
     }
     // If the blog post is already deleted, we shouldn't let it to be accessible at all.
     if ($post->isTrashed()) {
         return JError::raiseError(404, JText::_('COM_EASYBLOG_ENTRY_BLOG_NOT_FOUND'));
     }
     // Check if the blog post is trashed
     if (!$post->isPublished() && $this->my->id != $post->created_by && !EB::isSiteAdmin()) {
         return JError::raiseError(404, JText::_('COM_EASYBLOG_ENTRY_BLOG_NOT_FOUND'));
     }
     // Check for team's privacy
     $allowed = $this->checkTeamPrivacy($post);
     if ($allowed === false) {
         return JError::raiseError(404, JText::_('COM_EASYBLOG_TEAMBLOG_MEMBERS_ONLY'));
     }
     // Check if the blog post is accessible.
     $accessible = $post->isAccessible();
     if (!$accessible->allowed) {
         echo $accessible->error;
         return;
     }
     // Format the post
     $post = EB::formatter('entry', $post);
     $tags = $post->getTags();
     $theme = EB::template();
     $theme->set('post', $post);
     $theme->set('tags', $tags);
     $blogHtml = $theme->output('site/blogs/entry/pdf');
     $pageTitle = EasyBlogHelper::getPageTitle($config->get('main_title'));
     $document->setTitle($post->title . $pageTitle);
     $document->setName($post->getPermalink());
     // Fix phoca pdf plugin.
     if (method_exists($document, 'setArticleText')) {
         $document->setArticleText($blogHtml);
     }
     echo $blogHtml;
     return;
 }
Example #15
0
 /**
  * Retrieves a view file
  *
  * @since	5.0
  * @access	public
  * @param	string
  * @return	
  */
 public function getFoundryView($name = '', $type = '', $prefix = '', $config = array())
 {
     $file = $name;
     $parts = explode('/', $file);
     $template = EB::template();
     $output = $template->output($file, array(), 'ejs');
     return $output;
 }
Example #16
0
 public function html(EasyBlogPost &$blog)
 {
     $siteId = $this->config->get('comment_livefyre_siteid');
     $template = EB::template();
     $template->set('siteId', $siteId);
     $template->set('blog', $blog);
     $output = $template->output('site/comments/livefyre');
     return $output;
 }
Example #17
0
 public static function getHTML()
 {
     $captcha = EB::table('Captcha');
     $captcha->created = EB::date()->toMySQL();
     $captcha->store();
     $theme = EB::template();
     $theme->set('id', $captcha->id);
     return $theme->output('site/comments/captcha');
 }
Example #18
0
 /**
  * Dialog for delete confirmation
  *
  * @since	4.0
  * @access	public
  * @param	string
  * @return
  */
 public function confirmDelete()
 {
     // Get the report id
     $id = $this->input->get('id', 0, 'int');
     $template = EB::template();
     $template->set('id', $id);
     $output = $template->output('admin/reports/dialog.delete');
     $this->ajax->resolve($output);
 }
Example #19
0
 /**
  * Displays the category selection form
  *
  * @since	5.0
  * @access	public
  * @param	string
  * @return	
  */
 protected function getInput()
 {
     $theme = EB::template();
     $theme->set('id', $this->id);
     $theme->set('name', $this->name);
     $theme->set('value', $this->value);
     $output = $theme->output('admin/elements/month');
     return $output;
 }
Example #20
0
 public function html(EasyBlogPost &$blog)
 {
     if (!$this->exists()) {
         return false;
     }
     $template = EB::template();
     $template->set('blog', $blog);
     $output = $template->output('site/comments/jcomments');
     return $output;
 }
Example #21
0
 /**
  * Renders the sharethis social sharing widget
  *
  * @since	4.0
  * @access	public
  * @param	string
  * @return
  */
 public function sharethis()
 {
     $code = $this->config->get('social_sharethis_publishers');
     if (empty($code)) {
         return;
     }
     $theme = EB::template();
     $theme->set('code', $code);
     return $theme->output('site/blogs/tools/sharethis');
 }
Example #22
0
 /**
  * Retrieves the html codes for the player
  *
  * @since	4.0
  * @access	public
  * @param	string
  * @return
  */
 public function getPlayer($file)
 {
     $theme = EB::template();
     // Generate a unique id for the player
     $uid = uniqid();
     $theme->set('file', $file);
     $theme->set('uid', $uid);
     $output = $theme->output('site/audio/player');
     return $output;
 }
Example #23
0
 /**
  * Renders the output of the followers link
  *
  * @since	5.0
  * @access	public
  * @param	string
  * @return	
  */
 public function html(EasyBlogTableProfile $profile)
 {
     // Initialize the scripts
     EB::easysocial()->init();
     $user = FD::user($profile->id);
     $theme = EB::template();
     $theme->set('user', $user);
     $html = $theme->output('site/easysocial/followers');
     return $html;
 }
Example #24
0
 /**
  * Displays the post selection form
  *
  * @since	5.0
  * @access	public
  * @param	string
  * @return	
  */
 protected function getInput()
 {
     $theme = EB::template();
     $theme->set('id', $this->id);
     $theme->set('name', $this->name);
     $theme->set('value', $this->value);
     $theme->set('title', $this->title);
     $theme->set('default', $this->default);
     $output = $theme->output('admin/elements/pagination');
     return $output;
 }
Example #25
0
 /**
  * Renders the html output for achievements
  *
  * @since	1.4
  * @access	public
  * @param	string
  * @return	
  */
 public function html(EasyBlogTableProfile $profile)
 {
     // Ensure that EasySocial is initialized
     EB::easysocial()->init();
     $user = FD::user($profile->id);
     $achievements = $user->getBadges();
     $theme = EB::template();
     $theme->set('achievements', $achievements);
     $html = $theme->output('site/easysocial/achievements');
     return $html;
 }
Example #26
0
 public static function lists($items = array(), $name = 'listitem', $selected = 'all', $initial = '', $initialValue = 'all')
 {
     $theme = EB::template();
     $theme->set('initialValue', $initialValue);
     $theme->set('initial', $initial);
     $theme->set('name', $name);
     $theme->set('items', $items);
     $theme->set('selected', $selected);
     $contents = $theme->output('admin/html/filter.lists');
     return $contents;
 }
Example #27
0
 public function html(EasyBlogPost &$blog)
 {
     $code = $this->config->get('comment_intensedebate_code');
     if (empty($code)) {
         return;
     }
     $template = EB::template();
     $template->set('code', $code);
     $template->set('blog', $blog);
     $output = $template->output('site/comments/intensedebate');
     return $output;
 }
Example #28
0
 /**
  * Allows admin to create a new manual subscriber on the site
  *
  * @since	4.0
  * @access	public
  * @param	string
  * @return	
  */
 public function form()
 {
     // Check for access
     $this->checkAccess('easyblog.manage.subscription');
     $ajax = EB::ajax();
     // Get the type
     $type = $this->input->get('type', '', 'word');
     $theme = EB::template();
     $theme->set('type', $type);
     $output = $theme->output('admin/subscriptions/dialog.form');
     return $ajax->resolve($output);
 }
Example #29
0
 /**
  * Truncates a string at a centrain length and add a more link
  *
  * @since   5.0
  * @access  public
  * @param   string
  * @return  
  */
 public static function truncater($text, $max = 250)
 {
     $theme = EB::template();
     $length = JString::strlen($text);
     $uid = uniqid();
     $theme->set('uid', $uid);
     $theme->set('length', $length);
     $theme->set('text', $text);
     $theme->set('max', $max);
     $output = $theme->output('admin/html/string.truncater');
     return $output;
 }
Example #30
0
 public function html(EasyBlogPost &$blog)
 {
     $widgetId = $this->config->get('comment_hypercomments_widgetid');
     if (!$widgetId) {
         return;
     }
     $template = EB::template();
     $template->set('widgetId', $widgetId);
     $template->set('blog', $blog);
     $output = $template->output('site/comments/hypercomments');
     return $output;
 }