/** * Handle ajax request to get article infomation */ function getArticle() { // Check login & permission $user = JFactory::getUser(); if (!$user->id) { $this->result['message'] = JText::_('MOD_BTBGSLIDESHOW_ERROR_NOT_LOGIN'); $this->result['success'] = false; return json_encode($this->result); } else { if (JRequest::getString('article_id')) { $id = JRequest::getString('article_id'); require_once JPATH_ROOT . '/modules/mod_bt_backgroundslideshow/helpers/helper.php'; $helper = new BTBgSlideShowHelper(); if (JRequest::getString('k2') && JRequest::getString('k2') == 1) { $article = $helper->getK2ArticleInfo($id); $desc = $helper->truncate_string($article[0], 300); require_once JPATH_ROOT . '/components/com_k2/helpers/route.php'; $this->result['success'] = true; $this->result['link'] = K2HelperRoute::getItemRoute($id, $article[1]); $this->result['desc'] = strip_tags($desc, '<a><i><b><u><strong>'); } else { require_once JPATH_SITE . '/components/com_content/helpers/route.php'; $article = $helper->getArticleInfo($id); $desc = $helper->truncate_string($article[0], 300); $articleSlug = $id . ':' . $article[1]; $catSlug = $article[2] . ':' . $article[3]; $this->result['success'] = true; $this->result['link'] = ContentHelperRoute::getArticleRoute($articleSlug, $catSlug); $this->result['desc'] = strip_tags($desc, '<a><i><b><u><strong>'); } return json_encode($this->result); } else { $result['message'] = JText::_('Have some errors.'); $result['success'] = false; return json_encode($this->result); } } }