Sindbad~EG File Manager
<?php
/**
* @package RSDirectory!
* @copyright (c) 2013 - 2021 RSJoomla!
* @link https://www.rsjoomla.com
* @license GNU General Public License http://www.gnu.org/licenses/gpl-3.0.en.html
*/
// No direct access.
defined('_JEXEC') or die('Restricted access');
// Always load abstract class
require_once( JPATH_ROOT . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_komento' . DIRECTORY_SEPARATOR . 'komento_plugins' . DIRECTORY_SEPARATOR .'abstract.php' );
class KomentoComRSDirectory extends KomentoExtension
{
public $_item;
public $_map = array(
'id' => 'id',
'title' => 'title',
'hits' => 'hits',
'created_by' => 'user_id',
'catid' => 'category_id',
'permalink' => 'permalink_field'
);
public function __construct( $component )
{
parent::__construct( $component );
}
public function getComponentName()
{
return 'RSDirectory!';
}
public function getComponentIcon()
{
return JHtml::_('image', 'com_rsdirectory/icon-48-rsdirectory.png', 'RSDirectory!', null, true, true);
}
public function load( $cid )
{
static $instances = array();
if( !isset( $instances[$cid] ) )
{
$db = JFactory::getDbo();
$query = $db->getQuery(true)
->select($db->qn('id'))
->select($db->qn('title'))
->select($db->qn('hits'))
->select($db->qn('user_id'))
->select($db->qn('category_id'))
->from($db->qn('#__rsdirectory_entries'))
->where($db->qn('id').'='.$db->q($cid));
$db->setQuery($query);
$this->_item = $db->loadObject();
if (empty($this->_item)) {
return false;
}
$instances[$cid] = $this->_item;
}
$this->_item = $instances[$cid];
return $this;
}
public function getContentIds( $categories = '' )
{
$db = JFactory::getDbo();
$query = $db->getQuery(true)
->select($db->qn('id'))
->from($db->qn('#__rsdirectory_entries'));
if (!empty($categories)) {
if (is_array($categories)) {
$categories = implode(',', $categories);
}
$query->where($db->qn('category_id').' IN ('.$categories.')');
}
$db->setQuery($query);
return $db->loadColumn();
}
public function getCategories() {
$db = JFactory::getDbo();
$query = $db->getQuery(true)
->select($db->qn('a.id'))
->select($db->qn('a.title'))
->select($db->qn('a.level'))
->select($db->qn('a.parent_id'))
->from($db->qn('#__categories', 'a'))
->where($db->qn('a.extension').'='.$db->q('com_rsdirectory'))
->where($db->qn('a.parent_id').'>'.$db->q(0))
->order($db->qn('a.lft'));
$db->setQuery( $query );
$categories = $db->loadObjectList();
foreach( $categories as &$row )
{
$repeat = ( $row->level - 1 >= 0 ) ? $row->level - 1 : 0;
$row->treename = str_repeat( '.   ', $repeat ) . ( $row->level - 1 > 0 ? '|_ ' : '' ) . $row->title;
}
return $categories;
}
public function getContentPermalink() {
require_once JPATH_ADMINISTRATOR.'/components/com_rsdirectory/helpers/rsdirectory.php';
$link = RSDirectoryRoute::getEntryURL($this->_item->id, $this->_item->title);
$link = $this->prepareLink( $link );
return $link;
}
// to determine if is listing view
public function isListingView()
{
return JFactory::getApplication()->input->get('view') == 'entries';
}
// to determine if is entry view
public function isEntryView()
{
return JFactory::getApplication()->input->get('view') == 'entry';
}
public function onExecute( &$article, $html, $view, $options = array() )
{
// $html is the html content generated by Komento
return $html;
}
}
Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists