30
1
mirror of https://github.com/joomla-extensions/weblinks.git synced 2024-06-04 07:20:49 +00:00

JArrayHelper => ArrayHelper (#221)

* cs and arrayhelper

* cs and arrayhelper
This commit is contained in:
zero-24 2016-06-25 23:23:16 +02:00 committed by Chris Davenport
parent 3514f29bda
commit 0af518e0f3
3 changed files with 23 additions and 22 deletions

View File

@ -9,6 +9,8 @@
defined('_JEXEC') or die; defined('_JEXEC') or die;
use Joomla\Utilities\ArrayHelper;
/** /**
* Weblink controller class. * Weblink controller class.
* *
@ -27,14 +29,13 @@ class WeblinksControllerWeblink extends JControllerForm
*/ */
protected function allowAdd($data = array()) protected function allowAdd($data = array())
{ {
$user = JFactory::getUser(); $categoryId = ArrayHelper::getValue($data, 'catid', $this->input->getInt('filter_category_id'), 'int');
$categoryId = JArrayHelper::getValue($data, 'catid', $this->input->getInt('filter_category_id'), 'int');
$allow = null; $allow = null;
if ($categoryId) if ($categoryId)
{ {
// If the category has been passed in the URL check it. // If the category has been passed in the URL check it.
$allow = $user->authorise('core.create', $this->option . '.category.' . $categoryId); $allow = JFactory::getUser()->authorise('core.create', $this->option . '.category.' . $categoryId);
} }
if ($allow !== null) if ($allow !== null)
@ -104,9 +105,9 @@ class WeblinksControllerWeblink extends JControllerForm
* @param JModelLegacy $model The data model object. * @param JModelLegacy $model The data model object.
* @param array $validData The validated data. * @param array $validData The validated data.
* *
* @return void * @return void
* *
* @since 1.6 * @since 1.6
*/ */
protected function postSaveHook(JModelLegacy $model, $validData = array()) protected function postSaveHook(JModelLegacy $model, $validData = array())
{ {

View File

@ -69,7 +69,7 @@ class WeblinksControllerWeblink extends JControllerForm
*/ */
protected function allowAdd($data = array()) protected function allowAdd($data = array())
{ {
$categoryId = ArrayHelper::getValue($data, 'catid', $this->input->getInt('id'), 'int'); $categoryId = ArrayHelper::getValue($data, 'catid', $this->input->getInt('id'), 'int');
$allow = null; $allow = null;
if ($categoryId) if ($categoryId)
@ -180,8 +180,8 @@ class WeblinksControllerWeblink extends JControllerForm
protected function getRedirectToItemAppend($recordId = null, $urlVar = null) protected function getRedirectToItemAppend($recordId = null, $urlVar = null)
{ {
$append = parent::getRedirectToItemAppend($recordId, $urlVar); $append = parent::getRedirectToItemAppend($recordId, $urlVar);
$itemId = $this->input->getInt('Itemid'); $itemId = $this->input->getInt('Itemid');
$return = $this->getReturnPage(); $return = $this->getReturnPage();
if ($itemId) if ($itemId)
{ {
@ -264,7 +264,7 @@ class WeblinksControllerWeblink extends JControllerForm
} }
// Check whether item access level allows access. // Check whether item access level allows access.
$groups = JFactory::getUser()->getAuthorisedViewLevels(); $groups = JFactory::getUser()->getAuthorisedViewLevels();
if (!in_array($link->access, $groups)) if (!in_array($link->access, $groups))
{ {

View File

@ -9,6 +9,8 @@
defined('_JEXEC') or die; defined('_JEXEC') or die;
use Joomla\Utilities\ArrayHelper;
JTable::addIncludePath(JPATH_COMPONENT_ADMINISTRATOR . '/tables'); JTable::addIncludePath(JPATH_COMPONENT_ADMINISTRATOR . '/tables');
/** /**
@ -34,11 +36,11 @@ class WeblinksModelWeblink extends JModelItem
*/ */
protected function populateState() protected function populateState()
{ {
$app = JFactory::getApplication(); $app = JFactory::getApplication();
$params = $app->getParams(); $params = $app->getParams();
// Load the object state. // Load the object state.
$id = $app->input->getInt('id'); $id = $app->input->getInt('id');
$this->setState('weblink.id', $id); $this->setState('weblink.id', $id);
// Load the parameters. // Load the parameters.
@ -79,8 +81,8 @@ class WeblinksModelWeblink extends JModelItem
} }
// Convert the JTable to a clean JObject. // Convert the JTable to a clean JObject.
$properties = $table->getProperties(1); $properties = $table->getProperties(1);
$this->_item = JArrayHelper::toObject($properties, 'JObject'); $this->_item = ArrayHelper::toObject($properties, 'JObject');
} }
elseif ($error = $table->getError()) elseif ($error = $table->getError())
{ {
@ -94,13 +96,13 @@ class WeblinksModelWeblink extends JModelItem
/** /**
* Returns a reference to the a Table object, always creating it. * Returns a reference to the a Table object, always creating it.
* *
* @param type The table type to instantiate * @param type The table type to instantiate
* @param string A prefix for the table class name. Optional. * @param string A prefix for the table class name. Optional.
* @param array Configuration array for model. Optional. * @param array Configuration array for model. Optional.
* *
* @return JTable A database object * @return JTable A database object
* *
* @since 1.6 * @since 1.6
*/ */
public function getTable($type = 'Weblink', $prefix = 'WeblinksTable', $config = array()) public function getTable($type = 'Weblink', $prefix = 'WeblinksTable', $config = array())
{ {
@ -121,8 +123,6 @@ class WeblinksModelWeblink extends JModelItem
$id = $this->getState('weblink.id'); $id = $this->getState('weblink.id');
} }
$weblink = $this->getTable('Weblink', 'WeblinksTable'); return $this->getTable('Weblink', 'WeblinksTable')->hit($id);
return $weblink->hit($id);
} }
} }