public static function getGuestCount() { $id = JRequest::getVar('id'); $view = JRequest::getVar('view'); $db = EB::db(); $query = ''; if ($view == 'entry') { $query = 'select cont(1) from `#__easyblog_subscriptions` as a'; $query .= ' where ('; // entry $query .= ' (a.`uid` = ' . $db->Quote($id) . ' AND a.`utype` = ' . $db->Quote(EBLOG_SUBSCRIPTION_ENTRY) . ') OR'; // category $query .= ' (a.`uid` IN (select pc.`category_id` from `#__easyblog_post_category` as pc where pc.`post_id` = ' . $db->Quote($id) . ' ) AND a.`utype` = ' . $db->Quote(EBLOG_SUBSCRIPTION_CATEGORY) . ') OR'; // teamblog $query .= ' (a.`uid` IN (select pc.`source_id` from `#__easyblog_post` as p where p.`id` = ' . $db->Quote($id) . ' and p.`source_type` = ' . $db->Quote(EASYBLOG_POST_SOURCE_TEAM) . ' ) AND a.`utype` = ' . $db->Quote(EBLOG_SUBSCRIPTION_TEAMBLOG) . ')'; $query .= ')'; $query .= ' AND a.`user_id` = ' . $db->Quote('0'); } else { if ($view == 'categories' && $id) { $query = 'select count(1) from `#__easyblog_subscriptions` as a'; $query .= ' where a.`uid` = ' . $db->Quote($id); $query .= ' and a.`utype` = ' . $db->Quote(EBLOG_SUBSCRIPTION_CATEGORY); $query .= ' AND a.`user_id` = ' . $db->Quote('0'); } else { if ($view == 'teamblog') { $query = 'select count(1) from `#__easyblog_subscriptions` as a'; $query .= ' where a.`uid` = ' . $db->Quote($id); $query .= ' and a.`utype` = ' . $db->Quote(EBLOG_SUBSCRIPTION_TEAMBLOG); $query .= ' AND a.`user_id` = ' . $db->Quote('0'); } } } $db->setQuery($query); return (int) $db->loadResult(); }
public function display($tmpl = null) { // Checks if rss is enabled if (!$this->config->get('main_rss')) { return; } // Get the archives model $model = EB::model('Archive'); // Get a list of posts $posts = $model->getPosts(); // Format the posts $posts = EB::formatter('list', $posts); // Set the link for this feed $this->doc->link = EBR::_('index.php?option=com_easyblog&view=archive'); $this->doc->setTitle(JText::_('COM_EASYBLOG_ARCHIVED_POSTS')); $this->doc->setDescription(JText::_('COM_EASYBLOG_ARCHIVED_POSTS_DESC')); if (!$posts) { return; } foreach ($posts as $post) { $image = ''; if ($post->getImage('medium', true, true)) { $image = '<img src=' . $post->getImage('medium', true, true) . '" alt="' . $post->title . '" />'; } $item = new JFeedItem(); $item->title = $post->title; $item->link = $post->getPermalink(); $item->description = $image . $post->getIntro(); $item->date = $post->getCreationDate()->format(); $item->category = $post->getPrimaryCategory()->getTitle(); $item->author = $post->author->getName(); $item->authorEmail = $this->getRssEmail($post->author); $this->doc->addItem($item); } }
public function __construct($id, $type) { parent::__construct($id, $type); $team = EB::table('TeamBlog'); $team->load($id); $this->team = $team; }
public function html(EasyBlogPost &$blog) { // Determines if the comment plugin is enabled $enabled = JPluginHelper::isEnabled('content', 'easydiscuss'); if (!$enabled) { return; } // Determines if EasyDiscuss exists if (!EB::easydiscuss()->exists()) { return; } $articleParams = new stdClass(); $this->app = JFactory::getApplication(); $result = $this->app->triggerEvent('onDisplayComments', array(&$blog, &$articleParams)); if (isset($result[0]) || isset($result[1])) { // There could be komento running on the site if (isset($result[1]) && $result[1]) { $output = $result[1]; } else { $output = $result[0]; } return $output; } return; }
/** * Translates text * * @since 4.0 * @access public * @param string The language string to translate * @return string */ public function getLanguage($constant) { // Load languages on the site EB::loadLanguages(); $string = JText::_(strtoupper($constant)); return $string; }
public function main() { $state = true; $db = EB::db(); // lets check if there is any default category assigned or not. $query = "select a.`id` from `#__easyblog_category` as a where a.`published` = 1 and a.`default` = 1"; $db->setQuery($query); $result = $db->loadResult(); if (!$result) { $query = "select a.`id`, count(b.`id`) as `cnt` from `#__easyblog_category` as a"; $query .= " left join `#__easyblog_post_category` as b on a.`id` = b.`category_id`"; $query .= " where a.`published` = 1"; $query .= " group by a.`id`"; $query .= " order by cnt desc"; $query .= " limit 1"; $db->setQuery($query); $id = $db->loadResult(); // now we make sure no other categories which previously marked as default but its unpublished. $update = "update `#__easyblog_category` set `default` = 0"; $db->setQuery($update); // now let update this category as default category $update = "update `#__easyblog_category` set `default` = 1 where `id` = " . $db->Quote($id); $db->setQuery($update); $state = $db->query(); } return $state; }
/** * Synchronizes database tables * * @since 4.0 * @access public * @param string * @return */ public function execute() { // Load foundry $this->engine(); // Get this installation version $version = $this->getInstalledVersion(); // Get previous version installed $previous = $this->getPreviousVersion('dbversion'); $affected = ''; if ($previous !== false) { // lets run the db scripts sync if needed. $db = EB::db(); $affected = $db->sync($previous); } // Update the version in the database to the latest now $config = EB::table('Configs'); $config->load(array('name' => 'dbversion')); $config->name = 'dbversion'; $config->params = $version; // Save the configuration $config->store($config->name); // If the previous version is empty, we can skip this altogether as we know this is a fresh installation if (!empty($affected)) { $this->setInfo(JText::sprintf('COM_EASYBLOG_INSTALLATION_MAINTENANCE_DB_SYNCED', $version)); } else { $this->setInfo(JText::sprintf('COM_EASYBLOG_INSTALLATION_MAINTENANCE_DB_NOTHING_TO_SYNC', $version)); } return $this->output(); }
/** * 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; }
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; }
/** * Invoke the crawling. * * @since 1.0 * @access public * @author Mark Lee <*****@*****.**> */ public function crawl($url) { $tmp = str_ireplace(array('http://', 'https://'), '', $url); if (!EB::string()->isValidDomain($tmp)) { return false; } // Ensure that urls always contains a protocol if (stristr($url, 'http://') === false && stristr($url, 'https://') === false) { $url = 'http://' . $url; } // Load up the connector first. $connector = EB::connector(); $connector->addUrl($url); $connector->execute(); // Get the result and parse them. $info = parse_url($url); $this->contents = $connector->getResult($url); // Replace any href="// with href="scheme://" $this->contents = str_ireplace('src="//', 'src="' . $info['scheme'] . '://', $this->contents); // Get the final url, if there's any redirection. $originalUrl = $url; $url = $connector->getFinalUrl($url); $this->parse($originalUrl, $url); return $this; }
/** * Given a specific URL, try to crawl the site * * @since 4.0 * @access public * @param string * @return */ public function crawl() { // Get a list of urls to crawl $urls = $this->input->get('url', array(), 'array'); if (!is_array($urls)) { $urls = array($urls); } // Result placeholder $result = array(); if (!$urls || empty($urls)) { return $this->ajax->reject(); } // Get the crawler library $crawler = EB::crawler(); foreach ($urls as $url) { // Ensures that the domain is valid if (!EB::string()->isValidDomain($url)) { return $this->ajax->reject(JText::_('COM_EASYBLOG_COMPOSER_BLOCKS_LINKS_EMPTY')); } // Crawl the url $state = $crawler->crawl($url); // Get the data from the crawled site $data = $crawler->getData(); $result[$url] = $data; } return $this->ajax->resolve($result); }
/** * Runs mailbox testing * * @since 4.0 * @access public * @param string * @return */ public function testMailbox() { $server = $this->input->get('server', '', 'default'); $port = $this->input->get('port', '', 'default'); $service = $this->input->get('service', '', 'default'); $ssl = $this->input->get('ssl', true, 'bool'); $mailbox = $this->input->get('mailbox', 'INBOX', 'default'); $user = $this->input->get('user', '', 'default'); $pass = $this->input->get('pass', '', 'default'); // Ensure that all properties are set if (empty($server)) { return $this->ajax->reject(JText::_('Please enter the server address for your mail server.')); } if (empty($port)) { return $this->ajax->reject(JText::_('Please enter the server port for your mail server.')); } if (empty($user)) { return $this->ajax->reject(JText::_('Please enter your mailbox username.')); } if (empty($pass)) { return $this->ajax->reject(JText::_('Please enter your mailbox password.')); } $mailbox = EB::mailbox(); $result = $mailbox->test($server, $port, $service, $ssl, $mailbox, $user, $pass); return $this->ajax->resolve($result); }
/** * 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; }
public function data() { $theme = EB::template(); $content = $theme->output('site/composer/blocks/handlers/text/html'); $data = (object) array('content' => $content); return $data; }
public function reject() { // Check for request forgeries EB::checkToken(); // Ensure that user is logged in EB::requireLogin(); // Get any return url $return = EB::_('index.php?option=com_easyblog&view=dashboard&layout=moderate'); if ($this->getReturnURL()) { $return = $this->getReturnURL(); } // Check if the user is privileged enough if (!$this->acl->get('add_entry') && !$this->acl->get('manage_pending')) { return JError::raiseError(500, JText::_('COM_EASYBLOG_NO_PERMISSION_TO_MODERATE_BLOG')); } // Get a list of ids $ids = $this->input->get('ids', array(), 'array'); $message = $this->input->get('message', '', 'default'); foreach ($ids as $id) { $id = (int) $id; $post = EB::post($id); $post->reject($message); } $message = JText::_('COM_EASYBLOG_BLOGS_BLOG_SAVE_REJECTED'); $this->info->set($message, 'success'); return $this->app->redirect($return); }
/** * 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'); }
public function __construct($message, $type = EASYBLOG_MSG_ERROR, $silent = false, $customErrorCode = null) { // EASYBLOG_MSG_ERROR if (is_string($type)) { $code = isset(self::$codeMap[$type]) ? self::$codeMap[$type] : null; $this->type = $type; // array(400, EASYBLOG_MSG_ERROR) } else { if (is_array($type)) { $code = $type[0]; $this->type = $code[1]; } } // We're riding the third param. Blame strict standards. if (is_bool($silent)) { $previous = null; } else { $silent = false; $previous = $silent; } $this->customErrorCode = $customErrorCode; // Load front end language EB::loadLanguages(JPATH_ADMINISTRATOR); EB::loadLanguages(JPATH_ROOT); // Translate message so a user can pass in the language string directly. $message = JText::_($message); // Construct exception so we can retrieve the rest of the properties parent::__construct($message, $code, $previous); // Add to our global list of exceptions self::$exceptions[] = $this; }
/** * Generates the captcha image * * @since 4.0 * @access public * @param string * @return */ public function generate() { $id = $this->input->get('id', '', 'int'); // Load up the captcha object $captcha = EB::table('Captcha'); // Clear outdated keys $captcha->clear(); // load the captcha records. $captcha->load($id); if (!$captcha->id) { return false; } // @task: Generate a very random integer and take only 5 chars max. $hash = JString::substr(md5(rand(0, 9999)), 0, 5); $captcha->response = $hash; $captcha->store(); // Captcha width and height $width = 100; $height = 20; $image = ImageCreate($width, $height); $white = ImageColorAllocate($image, 255, 255, 255); $black = ImageColorAllocate($image, 0, 0, 0); $gray = ImageColorAllocate($image, 204, 204, 204); ImageFill($image, 0, 0, $white); ImageString($image, 5, 30, 3, $hash, $black); ImageRectangle($image, 0, 0, $width - 1, $height - 1, $gray); imageline($image, 0, $height / 2, $width, $height / 2, $gray); imageline($image, $width / 2, 0, $width / 2, $height, $gray); header('Content-type: image/jpeg'); ImageJpeg($image); ImageDestroy($image); exit; }
/** * Toggles the publishing state of a block * * @since 4.0 * @access public * @param string * @return */ public function togglePublish() { // Check for request forgeries EB::checkToken(); // Default redirection url $redirect = 'index.php?option=com_easyblog&view=blocks'; // Get the items to be published / unpublished $ids = $this->input->get('cid', array(), 'array'); if (!$ids) { $this->info->set('COM_EASYBLOG_BLOCKS_INVALID_ID_PROVIDED', 'error'); return $this->app->redirect($redirect); } // Get the current task $task = $this->getTask(); foreach ($ids as $id) { $block = EB::table('Block'); $block->load((int) $id); $block->{$task}(); } $message = 'COM_EASYBLOG_BLOCKS_PUBLISHED_SUCCESSFULLY'; if ($task == 'unpublish') { $message = 'COM_EASYBLOG_BLOCKS_UNPUBLISHED_SUCCESSFULLY'; } $this->info->set(JText::_($message)); return $this->app->redirect($redirect); }
public function form($tpl = null) { $cids = $this->input->get('cid', array(), 'var'); $scripts = EB::model('Maintenance')->getItemByKeys($cids); $this->set('scripts', $scripts); parent::display('maintenance/form'); }
/** * Displays a list of reports * * @since 4.0 * @access public * @param string * @return */ public function display($tpl = null) { // Test for user access if on 1.6 and above $this->checkAccess('easyblog.manage.report'); $this->setHeading('COM_EASYBLOG_TITLE_REPORTS', '', 'fa-exclamation-triangle'); $order = $this->app->getUserStateFromRequest('com_easyblog.reports.filter_order', 'filter_order', 'a.created', 'cmd'); $orderDirection = $this->app->getUserStateFromRequest('com_easyblog.reports.filter_order_Dir', 'filter_order_Dir', 'asc', 'word'); // Get reports $model = EB::model('Reports'); $result = $model->getData(); $pagination = $model->getPagination(); $reports = array(); if ($result) { foreach ($result as $row) { $report = EB::table('Report'); $report->bind($row); $blog = EB::table('Blog'); $blog->load($report->obj_id); $report->blog = $blog; $reports[] = $report; } } $this->set('pagination', $pagination); $this->set('reports', $reports); $this->set('order', $order); $this->set('orderDirection', $orderDirection); parent::display('reports/default'); }
/** * Displays the blocks listings * * @since 4.0 * @access public * @param string * @return */ public function display($tpl = null) { // Check for access $this->checkAccess('easyblog.manage.blocks'); $layout = $this->getLayout(); if (method_exists($this, $layout)) { return $this->{$layout}(); } // Get the filters $search = $this->input->get('search', '', 'word'); $filterGroup = $this->input->get('filter_group', '', 'word'); $filterState = $this->input->get('filter_state', 'all', 'default'); $filterState = $filterState == 'all' ? 'all' : (int) $filterState; $options = array('filter_state' => $filterState, 'search' => $search, 'filter_group' => $filterGroup); // Set the heading $this->setHeading('COM_EASYBLOG_TITLE_BLOCKS', '', 'fa-cubes'); $model = EB::model('Blocks'); $blocks = $model->getBlocks($options); $groups = $model->getGroups(); $pagination = $model->getPagination($options); $this->set('filterState', $filterState); $this->set('filterGroup', $filterGroup); $this->set('groups', $groups); $this->set('pagination', $pagination); $this->set('blocks', $blocks); $this->set('search', $search); parent::display('blocks/default'); }
protected function getOptions() { if (version_compare($this->version, '5.0', 'ge')) { require_once JPATH_ADMINISTRATOR . '/components/com_easyblog/includes/easyblog.php'; $catModel = EB::getModel('Categories'); } else { require_once JPATH_ROOT . '/components/com_easyblog/constants.php'; require_once EBLOG_HELPERS . '/helper.php'; $catModel = EasyBlogHelper::getModel('Categories'); } $parentCat = $catModel->getParentCategories('', 'all', true); if (!empty($parentCat)) { for ($i = 0; $i < count($parentCat); $i++) { $parent = $parentCat[$i]; //reset $parent->childs = null; $this->buildNestedCategories($parent, false, true); } foreach ($parentCat as $category) { $this->options[] = JHtml::_('select.option', $category->id, JText::_($category->title)); $this->accessNestedCategories($category, '0'); } } return $this->options; }
public function execute() { $post = $this->items; // Get the blogger object $post->author = $post->getAuthor(); // Determines if the post is featured $post->isFeatured = $post->isFeatured(); // determines if this is a teamblog post $post->team_id = $post->source_type == EASYBLOG_POST_SOURCE_TEAM ? $post->source_id : '0'; // Format microblog postings if ($post->posttype) { $this->formatMicroblog($post); } else { $post->posttype = 'standard'; } // We want to format all the content first before the theme displays the content $post->text = $post->getContent('entry'); // Get the total comments $post->totalComments = EB::comment()->getCommentCount($post); // Get custom fields for this blog post $post->fields = $post->getCustomFields(); // Assign the category object into the blog $post->categories = $post->getCategories(); $post->category = $post->getPrimaryCategory(); // Get the post assets $post->assets = $post->getAssets(); // Retrieve list of tags $post->tags = $post->getTags(); return $post; }
/** * Default display method for featured listings * * @since 4.0 * @access public * @param string * @return */ public function display($tmpl = null) { // Set the meta tags for this page EB::setMeta(META_ID_FEATURED, META_TYPE_VIEW); // Add the RSS headers on the page EB::feeds()->addHeaders('index.php?option=com_easyblog&view=featured'); // Add breadcrumbs on the site menu. $this->setPathway('COM_EASYBLOG_FEATURED_BREADCRUMB'); // Get the model $model = EB::model('Featured'); // Get a list of featured posts $posts = $model->getPosts(); // Get the pagination $pagination = $model->getPagination(); // Format the posts $posts = EB::formatter('list', $posts); // Set the page title $title = EB::getPageTitle(JText::_('COM_EASYBLOG_FEATURED_PAGE_TITLE')); $this->setPageTitle($title, $pagination, $this->config->get('main_pagetitle_autoappend')); // Get the current url $return = EBR::_('index.php?option=com_easyblog', false); $this->set('return', $return); $this->set('posts', $posts); $this->set('pagination', $pagination); parent::display('blogs/featured/default'); }
/** * 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; }
/** * Auto post to social network sites * * @since 5.0 * @access public * @param string * @return */ public function shareSystem(EasyBlogPost &$post, $force = false) { // Determines if the primary category of this post requires auto posting or not $category = $post->getPrimaryCategory(); if (!$category->autopost) { return; } // Get a list of system oauth clients. $model = EB::model('Oauth'); $clients = $model->getSystemClients(); foreach ($clients as $client) { // If this is a new post, ensure that it respects the settings before auto posting if ($post->isNew() && !$this->config->get('integrations_' . $client->type . '_centralized_auto_post') && !$force) { continue; } // If the post is updated, ensure that it respects the settings before auto posting if (!$post->isNew() && !$this->config->get('integrations_' . $client->type . '_centralized_send_updates') && !$force) { continue; } $table = EB::table('OAuth'); $table->bind($client); // Push the item now $table->push($post); } }
public function getPermalink() { if (!EB::easysocial()->exists()) { return; } return $this->group->getPermalink(); }
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; }
public function __construct() { $this->config = EB::config(); $this->doc = JFactory::getDocument(); // If environment is set to production, change to static. $environment = $this->config->get('easyblog_environment'); if ($environment == 'production') { $environment = 'static'; } $this->namespace = 'EASYBLOG'; $this->shortName = 'eb'; $this->environment = $environment; $this->mode = $this->config->get('easyblog_mode'); $this->version = (string) EB::getLocalVersion(); $this->baseUrl = EB::getBaseUrl(); $this->token = EB::getToken(); $this->inline = $this->config->get('inline_configuration'); $this->enableCdn = $this->config->get('enable_cdn'); $this->ajaxUrl = JURI::base() . '?option=com_easyblog'; // If we should use http://site.com/index.php for the ajax calls, we need to append it here if ($this->config->get('ajax_use_index')) { $this->ajaxUrl = JURI::base() . 'index.php?option=com_easyblog'; } parent::__construct(); }