Comment out the JEventDispatcher
This commit is contained in:
parent
3c4645f097
commit
d58d2f9ff8
@ -1,91 +1,91 @@
|
|||||||
<?php
|
<?php
|
||||||
/*----------------------------------------------------------------------------------| www.vdm.io |----/
|
/*----------------------------------------------------------------------------------| www.vdm.io |----/
|
||||||
Vast Development Method
|
Vast Development Method
|
||||||
/-------------------------------------------------------------------------------------------------------/
|
/-------------------------------------------------------------------------------------------------------/
|
||||||
|
|
||||||
@version 2.0.3
|
@version 2.0.3
|
||||||
@build 8th February, 2021
|
@build 8th February, 2021
|
||||||
@created 18th October, 2016
|
@created 18th October, 2016
|
||||||
@package Demo
|
@package Demo
|
||||||
@subpackage looking.php
|
@subpackage looking.php
|
||||||
@author Llewellyn van der Merwe <https://www.vdm.io/>
|
@author Llewellyn van der Merwe <https://www.vdm.io/>
|
||||||
@copyright Copyright (C) 2015. All Rights Reserved
|
@copyright Copyright (C) 2015. All Rights Reserved
|
||||||
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
|
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
|
||||||
____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____
|
____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____
|
||||||
(_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _)
|
(_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _)
|
||||||
.-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )(
|
.-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )(
|
||||||
\____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__)
|
\____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__)
|
||||||
|
|
||||||
/------------------------------------------------------------------------------------------------------*/
|
/------------------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
// No direct access to this file
|
// No direct access to this file
|
||||||
defined('_JEXEC') or die('Restricted access');
|
defined('_JEXEC') or die('Restricted access');
|
||||||
|
|
||||||
use Joomla\Utilities\ArrayHelper;
|
use Joomla\Utilities\ArrayHelper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Demo Looking Model
|
* Demo Looking Model
|
||||||
*/
|
*/
|
||||||
class DemoModelLooking extends JModelItem
|
class DemoModelLooking extends JModelItem
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Model context string.
|
* Model context string.
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
protected $_context = 'com_demo.looking';
|
protected $_context = 'com_demo.looking';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Model user data.
|
* Model user data.
|
||||||
*
|
*
|
||||||
* @var strings
|
* @var strings
|
||||||
*/
|
*/
|
||||||
protected $user;
|
protected $user;
|
||||||
protected $userId;
|
protected $userId;
|
||||||
protected $guest;
|
protected $guest;
|
||||||
protected $groups;
|
protected $groups;
|
||||||
protected $levels;
|
protected $levels;
|
||||||
protected $app;
|
protected $app;
|
||||||
protected $input;
|
protected $input;
|
||||||
protected $uikitComp;
|
protected $uikitComp;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var object item
|
* @var object item
|
||||||
*/
|
*/
|
||||||
protected $item;
|
protected $item;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method to auto-populate the model state.
|
* Method to auto-populate the model state.
|
||||||
*
|
*
|
||||||
* Note. Calling getState in this method will result in recursion.
|
* Note. Calling getState in this method will result in recursion.
|
||||||
*
|
*
|
||||||
* @since 1.6
|
* @since 1.6
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
protected function populateState()
|
protected function populateState()
|
||||||
{
|
{
|
||||||
$this->app = JFactory::getApplication();
|
$this->app = JFactory::getApplication();
|
||||||
$this->input = $this->app->input;
|
$this->input = $this->app->input;
|
||||||
// Get the itme main id
|
// Get the itme main id
|
||||||
$id = $this->input->getInt('id', null);
|
$id = $this->input->getInt('id', null);
|
||||||
$this->setState('looking.id', $id);
|
$this->setState('looking.id', $id);
|
||||||
|
|
||||||
// Load the parameters.
|
// Load the parameters.
|
||||||
$params = $this->app->getParams();
|
$params = $this->app->getParams();
|
||||||
$this->setState('params', $params);
|
$this->setState('params', $params);
|
||||||
parent::populateState();
|
parent::populateState();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method to get article data.
|
* Method to get article data.
|
||||||
*
|
*
|
||||||
* @param integer $pk The id of the article.
|
* @param integer $pk The id of the article.
|
||||||
*
|
*
|
||||||
* @return mixed Menu item data object on success, false on failure.
|
* @return mixed Menu item data object on success, false on failure.
|
||||||
*/
|
*/
|
||||||
public function getItem($pk = null)
|
public function getItem($pk = null)
|
||||||
{
|
{
|
||||||
$this->user = JFactory::getUser();
|
$this->user = JFactory::getUser();
|
||||||
// check if this user has permission to access item
|
// check if this user has permission to access item
|
||||||
if (!$this->user->authorise('site.looking.access', 'com_demo'))
|
if (!$this->user->authorise('site.looking.access', 'com_demo'))
|
||||||
@ -95,24 +95,24 @@ class DemoModelLooking extends JModelItem
|
|||||||
// redirect away to the default view if no access allowed.
|
// redirect away to the default view if no access allowed.
|
||||||
$app->redirect(JRoute::_('index.php?option=com_demo&view=looks'));
|
$app->redirect(JRoute::_('index.php?option=com_demo&view=looks'));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$this->userId = $this->user->get('id');
|
$this->userId = $this->user->get('id');
|
||||||
$this->guest = $this->user->get('guest');
|
$this->guest = $this->user->get('guest');
|
||||||
$this->groups = $this->user->get('groups');
|
$this->groups = $this->user->get('groups');
|
||||||
$this->authorisedGroups = $this->user->getAuthorisedGroups();
|
$this->authorisedGroups = $this->user->getAuthorisedGroups();
|
||||||
$this->levels = $this->user->getAuthorisedViewLevels();
|
$this->levels = $this->user->getAuthorisedViewLevels();
|
||||||
$this->initSet = true;
|
$this->initSet = true;
|
||||||
|
|
||||||
$pk = (!empty($pk)) ? $pk : (int) $this->getState('looking.id');
|
$pk = (!empty($pk)) ? $pk : (int) $this->getState('looking.id');
|
||||||
|
|
||||||
if ($this->_item === null)
|
if ($this->_item === null)
|
||||||
{
|
{
|
||||||
$this->_item = array();
|
$this->_item = array();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isset($this->_item[$pk]))
|
if (!isset($this->_item[$pk]))
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// Get a db connection.
|
// Get a db connection.
|
||||||
$db = JFactory::getDbo();
|
$db = JFactory::getDbo();
|
||||||
@ -141,8 +141,8 @@ class DemoModelLooking extends JModelItem
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// Load the JEvent Dispatcher
|
// Load the JEvent Dispatcher
|
||||||
JPluginHelper::importPlugin('content');
|
// JPluginHelper::importPlugin('content');
|
||||||
$this->_dispatcher = JEventDispatcher::getInstance();
|
// $this->_dispatcher = JEventDispatcher::getInstance();
|
||||||
// Check if item has params, or pass whole item.
|
// Check if item has params, or pass whole item.
|
||||||
$params = (isset($data->params) && DemoHelper::checkJson($data->params)) ? json_decode($data->params) : $data;
|
$params = (isset($data->params) && DemoHelper::checkJson($data->params)) ? json_decode($data->params) : $data;
|
||||||
// Make sure the content prepare plugins fire on description
|
// Make sure the content prepare plugins fire on description
|
||||||
@ -154,24 +154,24 @@ class DemoModelLooking extends JModelItem
|
|||||||
$this->uikitComp = DemoHelper::getUikitComp($data->description,$this->uikitComp);
|
$this->uikitComp = DemoHelper::getUikitComp($data->description,$this->uikitComp);
|
||||||
|
|
||||||
// set data object to item.
|
// set data object to item.
|
||||||
$this->_item[$pk] = $data;
|
$this->_item[$pk] = $data;
|
||||||
}
|
}
|
||||||
catch (Exception $e)
|
catch (Exception $e)
|
||||||
{
|
{
|
||||||
if ($e->getCode() == 404)
|
if ($e->getCode() == 404)
|
||||||
{
|
{
|
||||||
// Need to go thru the error handler to allow Redirect to work.
|
// Need to go thru the error handler to allow Redirect to work.
|
||||||
JError::raiseWarning(404, $e->getMessage());
|
JError::raiseWarning(404, $e->getMessage());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$this->setError($e);
|
$this->setError($e);
|
||||||
$this->_item[$pk] = false;
|
$this->_item[$pk] = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->_item[$pk];
|
return $this->_item[$pk];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -187,5 +187,5 @@ class DemoModelLooking extends JModelItem
|
|||||||
return $this->uikitComp;
|
return $this->uikitComp;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user