diff --git a/easyblog/components/com_easyblog/helpers/simpleschema.php b/easyblog/components/com_easyblog/helpers/simpleschema.php index 665014c..6c5fd82 100644 --- a/easyblog/components/com_easyblog/helpers/simpleschema.php +++ b/easyblog/components/com_easyblog/helpers/simpleschema.php @@ -1,9 +1,20 @@ created = $created->toMySQL(); - $blog->text = $row->intro . $row->content; + + if( $config->get( 'main_rss_content' ) == 'introtext' ) + { + $blog->text = ( !empty( $row->intro ) ) ? $row->intro : $row->content; + } + else + { + $blog->text = $row->intro . $row->content; - $config->set('max_video_width', 320); - $config->set('max_video_width', 180); - $blog->text = EasyBlogHelper::getHelper( 'Videos' )->processVideos( $blog->text ); + } + $blog->text = EasyBlogHelper::getHelper( 'Videos' )->strip( $blog->text ); $blog->text = EasyBlogGoogleAdsense::stripAdsenseCode( $blog->text ); $category = EasyBlogHelper::getTable( 'Category', 'Table' ); @@ -64,12 +81,8 @@ public function mapPost($row, $strip_tags='', $text_length=0, $skip=array()) { $item->category->categoryid = $category->id; $item->category->title = $category->title; - - $item->url = JURI::root() . trim(EasyBlogRouter::_('index.php?option=com_easyblog&view=entry&id=' . $blog->id ), '/'); - - // Tags - $modelPT = EasyBlogHelper::getModel( 'PostTag' ); - $item->tags = $modelPT->getBlogTags($blog->id); + + $item->url = JURI::root() . trim('index.php?option=com_easyblog&view=entry&id=' . $blog->id, '/'); foreach ($skip as $v) { unset($item->$v); diff --git a/easyblog/easyblog.php b/easyblog/easyblog.php index fb3201c..69630a3 100644 --- a/easyblog/easyblog.php +++ b/easyblog/easyblog.php @@ -15,25 +15,50 @@ class plgAPIEasyblog extends ApiPlugin public function __construct(&$subject, $config = array()) { parent::__construct($subject, $config = array()); + + /*load language file for plugin frontend*/ + $lang = JFactory::getLanguage(); + $lang->load('plg_api_easyblog', JPATH_ADMINISTRATOR,'',true); $easyblog = JPATH_ROOT . '/administrator/components/com_easyblog/easyblog.php'; - if (!JFile::exists($easyblog) || !JComponentHelper::isEnabled('com_easysocial', true)) { + if (!JFile::exists($easyblog) || !JComponentHelper::isEnabled('com_easyblog', true)) { ApiError::raiseError(404, 'Easyblog not installed'); return; } - + + //load helper file + require_once JPATH_SITE.'/plugins/api/easyblog/helper/simpleschema.php'; // Load Easyblog language & bootstrap files $language = JFactory::getLanguage(); $language->load('com_easyblog'); - require_once( JPATH_ROOT . '/components/com_easyblog/constants.php' ); - require_once( EBLOG_HELPERS . '/helper.php' ); + + $xml = JFactory::getXML(JPATH_ADMINISTRATOR .'/components/com_easyblog/easyblog.xml'); + $version = (string)$xml->version; + + if($version<5) + { + require_once( JPATH_ROOT . '/components/com_easyblog/constants.php' ); + require_once( JPATH_ROOT . '/components/com_easyblog/helpers/helper.php' ); + ApiResource::addIncludePath(dirname(__FILE__).'/easyblog4'); + } + else + { + ApiResource::addIncludePath(dirname(__FILE__).'/easyblog5'); + require_once JPATH_ADMINISTRATOR.'/components/com_easyblog/includes/easyblog.php'; + require_once JPATH_ADMINISTRATOR.'/components/com_easyblog/includes/constants.php' ; + //require_once JPATH_ADMINISTRATOR.'/components/com_easyblog/includes/gettable/gettable.php' ; + require_once( JPATH_ADMINISTRATOR.'/components/com_easyblog/includes'. '/date/date.php' ); + require_once( JPATH_ADMINISTRATOR.'/components/com_easyblog/includes'. '/string/string.php' ); + require_once( JPATH_ADMINISTRATOR.'/components/com_easyblog/includes'. '/adsense/adsense.php' ); + } // Set resources & access - ApiResource::addIncludePath(dirname(__FILE__).'/easyblog'); $this->setResourceAccess('latest', 'public', 'get'); $this->setResourceAccess('category', 'public', 'get'); $this->setResourceAccess('blog', 'public', 'get'); + $this->setResourceAccess('blog', 'public', 'post'); $this->setResourceAccess('comments', 'public', 'get'); + $this->setResourceAccess('easyblog_users', 'public', 'get'); $config = EasyBlogHelper::getConfig(); if ($config->get('main_allowguestcomment')) { diff --git a/easyblog/easyblog.xml b/easyblog/easyblog.xml index d93d4be..317c0fb 100644 --- a/easyblog/easyblog.xml +++ b/easyblog/easyblog.xml @@ -1,19 +1,40 @@ Api - Easyblog - 1.6 + 1.8.4 10/11/2014 Techjoomla extensions@techjoomla.com www.techjoomla.com Techjoomla. All rights reserved. http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL - Easyblog APIs - script.php + PLG_API_EASYBLOG_DESCRIPTION easyblog.php - easyblog + easyblog4 + easyblog5 + helper components libraries + + + en-GB/en-GB.plg_api_easyblog.ini + en-GB/en-GB.plg_api_easyblog.sys.ini + + + + +
+ +
+
+
diff --git a/easyblog/easyblog4/blog.php b/easyblog/easyblog4/blog.php new file mode 100644 index 0000000..093fc9e --- /dev/null +++ b/easyblog/easyblog4/blog.php @@ -0,0 +1,146 @@ + + * @link http://www.techjoomla.com +*/ + +defined('_JEXEC') or die( 'Restricted access' ); + +jimport('joomla.user.user'); +jimport( 'simpleschema.easyblog.category' ); +jimport( 'simpleschema.easyblog.person' ); +jimport( 'simpleschema.easyblog.blog.post' ); + +require_once( EBLOG_HELPERS . '/date.php' ); +require_once( EBLOG_HELPERS . '/string.php' ); +require_once( EBLOG_CLASSES . '/adsense.php' ); + +//for image upload +require_once( EBLOG_CLASSES . '/mediamanager.php' ); +require_once( EBLOG_HELPERS . '/image.php' ); +require_once( EBLOG_CLASSES . '/easysimpleimage.php' ); +require_once( EBLOG_CLASSES . '/mediamanager/local.php' ); +require_once( EBLOG_CLASSES . '/mediamanager/types/image.php' ); + +class EasyblogApiResourceBlog extends ApiResource +{ + + public function __construct( &$ubject, $config = array()) { + parent::__construct( $ubject, $config = array() ); + } + public function delete() + { + $this->plugin->setResponse($this->delete_blog()); + } + public function post() + { + $input = JFactory::getApplication()->input; + $blog = EasyBlogHelper::getTable( 'Blog', 'Table' ); + $post = $input->post->getArray(array()); + $log_user = $this->plugin->get('user')->id; + $createTag = array(); + $res = new stdClass; + + //code for upload + $blog->bind($post,true); + + $blog->permalink = str_replace('+','-',$blog->title); + //for publish unpublish blog. + $blog->published = $post['published']; + //create tags for blog + $createTag = $post['tags']; + + //$blog->write_content = 1; + //$blog->write_content_hidden = 1; + + $blog->created_by = $log_user; + + $blog->created = date("Y-m-d h:i:s"); + $blog->publish_up = date("Y-m-d h:i:s"); + + //$blog->created = EasyBlogHelper::getDate(); + //get date from app + //$blog->publish_up = EasyBlogHelper::getDate(); + + $blog->created_by = $this->plugin->getUser()->id; + + if (!$blog->store()) { + $this->plugin->setResponse( $this->getErrorResponse(404, $blog->getError()) ); + return; + } + //create tags for blog called the function + $blog->processTags( $createTag, 1 ); + $blog->processTrackbacks(); + //$item = EasyBlogHelper::getHelper( 'SimpleSchema' )->mapPost($blog, '