From fd898db1aa9007108ae9d295153ae74fcc56084c Mon Sep 17 00:00:00 2001 From: Abu Huraira Date: Mon, 15 Jul 2019 14:24:38 +0600 Subject: [PATCH] EasyBlog latest version support added and release 1.7.0 --- assets/css/image-picker.css | 0 assets/js/image-picker.min.js | 0 fields/ezbcategories.php | 72 ++++++++- lib_xef.xml | 6 +- sources/easyblog/easyblog.php | 243 ++++++++++++++++++++----------- sources/flickr/api/LICENSE | 0 sources/flickr/api/README.md | 0 sources/flickr/api/auth.php | 0 sources/flickr/api/example.php | 0 sources/flickr/api/getToken.php | 0 sources/flickr/api/phpFlickr.php | 0 xef.php | 11 +- 12 files changed, 233 insertions(+), 99 deletions(-) mode change 100755 => 100644 assets/css/image-picker.css mode change 100755 => 100644 assets/js/image-picker.min.js mode change 100755 => 100644 sources/flickr/api/LICENSE mode change 100755 => 100644 sources/flickr/api/README.md mode change 100755 => 100644 sources/flickr/api/auth.php mode change 100755 => 100644 sources/flickr/api/example.php mode change 100755 => 100644 sources/flickr/api/getToken.php mode change 100755 => 100644 sources/flickr/api/phpFlickr.php diff --git a/assets/css/image-picker.css b/assets/css/image-picker.css old mode 100755 new mode 100644 diff --git a/assets/js/image-picker.min.js b/assets/js/image-picker.min.js old mode 100755 new mode 100644 diff --git a/fields/ezbcategories.php b/fields/ezbcategories.php index 8856cc9..da3d87b 100644 --- a/fields/ezbcategories.php +++ b/fields/ezbcategories.php @@ -21,16 +21,11 @@ // no direct access defined( '_JEXEC' ) or die('Restricted access'); +jimport('joomla.html.html'); +jimport('joomla.form.formfield'); - -if( - file_exists( JPATH_SITE . '/components/com_easyblog/easyblog.php' ) - and - file_exists( JPATH_ROOT . '/components/com_easyblog/constants.php' ) -) +if( file_exists( JPATH_ROOT . '/components/com_easyblog/constants.php' ) ) { - jimport('joomla.html.html'); - jimport('joomla.form.formfield'); class JFormFieldEZBCategories extends JFormField { @@ -88,3 +83,64 @@ protected function getInput() } } } +else +{class JFormFieldEZBCategories extends JFormField + { + + protected $type = 'EZBCategories'; + + protected function getInput() + { + $file = JPATH_ADMINISTRATOR . '/components/com_easyblog/includes/easyblog.php'; + if (!JFile::exists($file)) { + return; + } + require_once($file); + + $mainframe = JFactory::getApplication(); + $doc = JFactory::getDocument(); + + $options = array(); + $attr = ''; + $categoryList = array(); + + // Initialize some field attributes. + $attr .= $this->element['class'] ? ' class="'.(string) $this->element['class'].'"' : 'class="inputbox chzn-select"'; + + // To avoid user's confusion, readonly="true" should imply disabled="true". + if ( (string) $this->element['readonly'] == 'true' || (string) $this->element['disabled'] == 'true') { + $attr .= ' disabled="disabled"'; + } + + $attr .= $this->element['size'] ? ' size="'.(int) $this->element['size'].'"' : ''; + $attr .= $this->multiple ? ' multiple="multiple"' : ''; + + // Initialize JavaScript field attributes. + $attr .= $this->element['onchange'] ? ' onchange="'.(string) $this->element['onchange'].'"' : ''; + $attr .= 'multiple="multiple"'; + $attr .= 'style="width:280px;"'; + $attr .= 'data-placeholder="Click here to select categories"'; + + require_once( JPATH_ROOT . '/administrator/components/com_easyblog/models/categories.php' ); + $model = EB::model('Category'); + // Retrieve parent categories + $categories = $model->getCategories('latest', false, 0, '', false); + if(count($categories) > 0) + { + $optgroup = JHTML::_('select.optgroup','Select category','id','title'); + array_push($categoryList,$optgroup); + + foreach ($categories as $row) { + $opt = new stdClass(); + $opt->id = $row->id; + $opt->title = $row->title; + + array_push($categoryList,$opt); + } + } + + $html = JHTML::_('select.genericlist', $categoryList, $this->name, trim($attr), 'id', 'title', $this->value ); + return $html; + } + } +} \ No newline at end of file diff --git a/lib_xef.xml b/lib_xef.xml index 4a83876..28b33ad 100644 --- a/lib_xef.xml +++ b/lib_xef.xml @@ -5,13 +5,13 @@ ThemeXpert Extension Framework (XEF) – A rapid extension development framework for all ThemeXpert extensions. - 03/16/2014 + 15/07/2019 Parvez Akther parvez@themexpert.com http://themexpert.com/ Copyright (C) 2011 - 2011 ThemeXpert http://www.gnu.org/licenses/gpl-3.0.html GNU/GPLv3 - 1.6.0 + 1.7.0 assets @@ -26,4 +26,4 @@ utility.php - + \ No newline at end of file diff --git a/sources/easyblog/easyblog.php b/sources/easyblog/easyblog.php index beb42d4..d9fef72 100644 --- a/sources/easyblog/easyblog.php +++ b/sources/easyblog/easyblog.php @@ -7,125 +7,198 @@ // Protect from unauthorized access defined('_JEXEC') or die(); +jimport('joomla.system.file'); +jimport('joomla.system.folder'); // Require XEF helper class require_once JPATH_LIBRARIES . '/xef/xef.php'; -// Load Easyblog helper and router class -require_once JPATH_SITE . '/components/com_easyblog/helpers/helper.php'; -require_once JPATH_SITE . '/components/com_easyblog/helpers/date.php'; -require_once JPATH_SITE . '/administrator/components/com_easyblog/tables/profile.php'; - -class XEFSourceEasyblog extends XEFHelper +if( file_exists( JPATH_ROOT . '/components/com_easyblog/constants.php' ) ) { - public function getItems() + // Load Easyblog helper and router class + require_once JPATH_SITE . '/components/com_easyblog/helpers/helper.php'; + require_once JPATH_SITE . '/components/com_easyblog/helpers/date.php'; + require_once JPATH_SITE . '/administrator/components/com_easyblog/tables/profile.php'; + + class XEFSourceEasyblog extends XEFHelper { - $catid = ($this->get('ezb_catfilter')) ? $this->get('ezb_catid',NULL) : ''; - $ordering = $this->get('ezb_ordering','latest'); - $user = JFactory::getUser(); - $category = EasyBlogHelper::getTable( 'Category', 'Table' ); + public function getItems() + { + $catid = ($this->get('ezb_catfilter')) ? $this->get('ezb_catid',NULL) : ''; + $ordering = $this->get('ezb_ordering','latest'); + $user = JFactory::getUser(); + $category = EasyBlogHelper::getTable( 'Category', 'Table' ); + + $category->load($catid); + + if($category->private && $user->id == 0){ + echo JText::_('This category is set to private'); + return; + } + + if( !class_exists( 'EasyBlogModelBlog' ) ){ + jimport( 'joomla.application.component.model' ); + JLoader::import( 'blog' , EBLOG_ROOT . '/' . 'models' ); + } - $category->load($catid); + $model = EasyBlogHelper::getModel( 'Blog' ); - if($category->private && $user->id == 0){ - echo JText::_('This category is set to private'); - return; + if( $this->get( 'ezfeatured') ) + { + $items = $model->getFeaturedBlog( $catid , $this->get('count') ); + } + else + { + $items = $model->getBlogsBy('category', $catid, $ordering , $this->get('count') , EBLOG_FILTER_PUBLISHED, null, false ); + } + + $config = EasyBlogHelper::getConfig(); + + if(! empty($items)){ + for($i = 0; $i < count($items); $i++) + { + $data =& $items[$i]; + $row = EasyBlogHelper::getTable( 'Blog', 'Table' ); + $row->bind( $data ); + + //$row =& $items[$i]; + $author = EasyBlogHelper::getTable( 'Profile', 'Table' ); + + $row->author = $author->load( $row->created_by ); + $row->commentCount = EasyBlogHelper::getCommentCount($row->id); + + + $requireVerification = false; + if($config->get('main_password_protect', true) && !empty($row->blogpassword)) + { + $row->title = JText::sprintf('COM_EASYBLOG_PASSWORD_PROTECTED_BLOG_TITLE', $row->title); + $requireVerification = true; + } + + if($requireVerification && !EasyBlogHelper::verifyBlogPassword($row->blogpassword, $row->id)) + { + $theme = new CodeThemes(); + $theme->set('id', $row->id); + $theme->set('return', base64_encode(EasyBlogRouter::_('index.php?option=com_easyblog&view=entry&id='.$row->id))); + $row->introtext = $theme->fetch( 'blog.protected.php' ); + $row->content = $row->introtext; + $row->showRating = false; + $row->protect = true; + } + else + { + $row->introtext = EasyBlogHelper::getHelper( 'Videos' )->strip( $row->content ); + $row->showRating = true; + $row->protect = false; + + } + }//end foreach + } + + // XEFUtility::debug($items); + $items = $this->prepareItems($items); + + return $items; } - if( !class_exists( 'EasyBlogModelBlog' ) ){ - jimport( 'joomla.application.component.model' ); - JLoader::import( 'blog' , EBLOG_ROOT . '/' . 'models' ); + public function getLink($item) + { + return EasyBlogRouter::_('index.php?option=com_easyblog&view=entry&id=' . $item->id . $this->getMenuItemId() ); } - $model = EasyBlogHelper::getModel( 'Blog' ); + public function getCategory($item) + { + return $item->category; + } - if( $this->get( 'ezfeatured') ) + public function getCategoryLink($item) { - $items = $model->getFeaturedBlog( $catid , $this->get('count') ); + return EasyBlogRouter::_('index.php?option=com_easyblog&view=categories&layout=listings&id='.$item->category_id . $this->getMenuItemId()); } - else + + public function getImage($item) { - $items = $model->getBlogsBy('category', $catid, $ordering , $this->get('count') , EBLOG_FILTER_PUBLISHED, null, false ); + if( isset($item->image) AND ($item->image != null) ) + { + $image = json_decode($item->image); + return $image->url; + } + return ( $item->intro ) ? XEFUtility::getImage($item->intro) : XEFUtility::getImage($item->content); } - $config = EasyBlogHelper::getConfig(); + public function getDate($item) + { + $config = EasyBlogHelper::getConfig(); - if(! empty($items)){ - for($i = 0; $i < count($items); $i++) - { - $data =& $items[$i]; - $row = EasyBlogHelper::getTable( 'Blog', 'Table' ); - $row->bind( $data ); + return EasyBlogDateHelper::toFormat( JFactory::getDate( $item->created ), $config->get('layout_dateformat', '%A, %d %B %Y') ); + } + } +} +else +{ + // Load Easyblog helper and router class + require_once JPATH_ADMINISTRATOR . '/components/com_easyblog/includes/easyblog.php'; + class XEFSourceEasyblog extends XEFHelper + { + public function getItems() + { + $catid = ($this->get('ezb_catfilter')) ? $this->get('ezb_catid',NULL) : ''; + $ordering = $this->get('ezb_ordering','latest'); + $user = JFactory::getUser(); - //$row =& $items[$i]; - $author = EasyBlogHelper::getTable( 'Profile', 'Table' ); + $model = EB::model('Blog'); + $items = $model->getBlogsBy('category', $catid, $ordering, $this->get('count'), EBLOG_FILTER_PUBLISHED, null, $respectFrontpage = true, $excludeBlog = false, false, false, true, array(), array(), null, 'listlength', true, array(), array(), $excludeFeatured = $this->get( 'ezfeatured'), array(), array('paginationType' => 'none')); - $row->author = $author->load( $row->created_by ); - $row->commentCount = EasyBlogHelper::getCommentCount($row->id); + $config = EasyBlogHelper::getConfig(); - $requireVerification = false; - if($config->get('main_password_protect', true) && !empty($row->blogpassword)) + if(! empty($items)){ + for($i = 0; $i < count($items); $i++) { - $row->title = JText::sprintf('COM_EASYBLOG_PASSWORD_PROTECTED_BLOG_TITLE', $row->title); - $requireVerification = true; - } + $data =& $items[$i]; + $data->introtext = $data->intro; + + }//end foreach + } - if($requireVerification && !EasyBlogHelper::verifyBlogPassword($row->blogpassword, $row->id)) - { - $theme = new CodeThemes(); - $theme->set('id', $row->id); - $theme->set('return', base64_encode(EasyBlogRouter::_('index.php?option=com_easyblog&view=entry&id='.$row->id))); - $row->introtext = $theme->fetch( 'blog.protected.php' ); - $row->content = $row->introtext; - $row->showRating = false; - $row->protect = true; - } - else - { - $row->introtext = EasyBlogHelper::getHelper( 'Videos' )->strip( $row->content ); - $row->showRating = true; - $row->protect = false; + $items = $this->prepareItems($items); - } - }//end foreach + return $items; } -// XEFUtility::debug($items); - $items = $this->prepareItems($items); - - return $items; - } + public function getLink($item) + { + return EBR::_('index.php?option=com_easyblog&view=entry&id=' . $item->id . $this->getMenuItemId() ); + } - public function getLink($item) - { - return EasyBlogRouter::_('index.php?option=com_easyblog&view=entry&id=' . $item->id . $this->getMenuItemId() ); - } + public function getCategory($item) + { + // Load up the category table + $category = EB::table('Category'); + $category->load($item->category_id); - public function getCategory($item) - { - return $item->category; - } + return $item->category_title = $category->title; + } - public function getCategoryLink($item) - { - return EasyBlogRouter::_('index.php?option=com_easyblog&view=categories&layout=listings&id='.$item->category_id . $this->getMenuItemId()); - } + public function getCategoryLink($item) + { + return EBR::_('index.php?option=com_easyblog&view=categories&layout=listings&id='.$item->category_id . $this->getMenuItemId()); + } - public function getImage($item) - { - if( isset($item->image) AND ($item->image != null) ) + public function getImage($item) { - $image = json_decode($item->image); - return $image->url; + if( isset($item->image) AND ($item->image != null) ) + { + $image = json_decode($item->image); + return $image->url; + } + return ( $item->intro ) ? XEFUtility::getImage($item->intro) : XEFUtility::getImage($item->content); } - return ( $item->intro ) ? XEFUtility::getImage($item->intro) : XEFUtility::getImage($item->content); - } - public function getDate($item) - { - $config = EasyBlogHelper::getConfig(); + public function getDate($item) + { - return EasyBlogDateHelper::toFormat( JFactory::getDate( $item->created ), $config->get('layout_dateformat', '%A, %d %B %Y') ); + return JFactory::getDate( $item->created ); + } } -} \ No newline at end of file +} diff --git a/sources/flickr/api/LICENSE b/sources/flickr/api/LICENSE old mode 100755 new mode 100644 diff --git a/sources/flickr/api/README.md b/sources/flickr/api/README.md old mode 100755 new mode 100644 diff --git a/sources/flickr/api/auth.php b/sources/flickr/api/auth.php old mode 100755 new mode 100644 diff --git a/sources/flickr/api/example.php b/sources/flickr/api/example.php old mode 100755 new mode 100644 diff --git a/sources/flickr/api/getToken.php b/sources/flickr/api/getToken.php old mode 100755 new mode 100644 diff --git a/sources/flickr/api/phpFlickr.php b/sources/flickr/api/phpFlickr.php old mode 100755 new mode 100644 diff --git a/xef.php b/xef.php index e1da1e8..e5aa4c5 100644 --- a/xef.php +++ b/xef.php @@ -164,9 +164,14 @@ public function prepareItems($items) { $item->introtext = XEFUtility::characterLimit($item->introtext, $this->get('intro_limit',100) ); } -// else{ -// $item->introtext = $item->intro; -// } + // else{ + // $item->introtext = $item->intro; + // } + + if($this->get('prepare_content', false)) + { + $item->introtext = JHtml::_('content.prepare', $item->introtext, '', 'com_content.article'); + } }