mirror of
https://github.com/joomla-extensions/weblinks.git
synced 2024-12-27 10:22:38 +00:00
Clean up code
This commit is contained in:
parent
8d714ace8d
commit
9107b7e1de
@ -9,7 +9,6 @@
|
|||||||
|
|
||||||
defined('_JEXEC') or die;
|
defined('_JEXEC') or die;
|
||||||
|
|
||||||
use Joomla\CMS\Extension\ExtensionHelper;
|
|
||||||
use Joomla\CMS\Factory;
|
use Joomla\CMS\Factory;
|
||||||
use Joomla\CMS\Filesystem\File;
|
use Joomla\CMS\Filesystem\File;
|
||||||
use Joomla\CMS\Filesystem\Folder;
|
use Joomla\CMS\Filesystem\Folder;
|
||||||
@ -93,8 +92,8 @@ class Com_WeblinksInstallerScript
|
|||||||
public function install($parent)
|
public function install($parent)
|
||||||
{
|
{
|
||||||
// Initialize a new category
|
// Initialize a new category
|
||||||
/** @type JTableCategory $category */
|
/** @type Joomla\CMS\Table\Category $category */
|
||||||
$category = Table::getInstance('Category');
|
$category = Table::getInstance('Category', 'Joomla\\CMS\\Table\\');
|
||||||
|
|
||||||
// Check if the Uncategorised category exists before adding it
|
// Check if the Uncategorised category exists before adding it
|
||||||
if (!$category->load(array('extension' => 'com_weblinks', 'title' => 'Uncategorised')))
|
if (!$category->load(array('extension' => 'com_weblinks', 'title' => 'Uncategorised')))
|
||||||
|
@ -44,19 +44,23 @@ return new class implements ServiceProviderInterface
|
|||||||
{
|
{
|
||||||
$container->set(AssociationExtensionInterface::class, new AssociationsHelper);
|
$container->set(AssociationExtensionInterface::class, new AssociationsHelper);
|
||||||
|
|
||||||
$container->registerServiceProvider(new CategoryFactory('\\Joomla\\Component\\Weblinks'));
|
$componentNamespace = '\\Joomla\\Component\\Weblinks';
|
||||||
$container->registerServiceProvider(new MVCFactory('\\Joomla\\Component\\Weblinks'));
|
|
||||||
$container->registerServiceProvider(new ComponentDispatcherFactory('\\Joomla\\Component\\Weblinks'));
|
$container->registerServiceProvider(new CategoryFactory($componentNamespace));
|
||||||
$container->registerServiceProvider(new RouterFactory('\\Joomla\\Component\\Weblinks'));
|
$container->registerServiceProvider(new MVCFactory($componentNamespace));
|
||||||
|
$container->registerServiceProvider(new ComponentDispatcherFactory($componentNamespace));
|
||||||
|
$container->registerServiceProvider(new RouterFactory($componentNamespace));
|
||||||
|
|
||||||
$container->set(
|
$container->set(
|
||||||
ComponentInterface::class,
|
ComponentInterface::class,
|
||||||
function (Container $container) {
|
function (Container $container) {
|
||||||
$component = new WeblinksComponent($container->get(ComponentDispatcherFactoryInterface::class));
|
$component = new WeblinksComponent($container->get(ComponentDispatcherFactoryInterface::class));
|
||||||
|
|
||||||
$component->setRegistry($container->get(Registry::class));
|
$component->setRegistry($container->get(Registry::class));
|
||||||
$component->setMVCFactory($container->get(MVCFactoryInterface::class));
|
$component->setMVCFactory($container->get(MVCFactoryInterface::class));
|
||||||
$component->setCategoryFactory($container->get(CategoryFactoryInterface::class));
|
$component->setCategoryFactory($container->get(CategoryFactoryInterface::class));
|
||||||
$component->setRouterFactory($container->get(RouterFactoryInterface::class));
|
|
||||||
$component->setAssociationExtension($container->get(AssociationExtensionInterface::class));
|
$component->setAssociationExtension($container->get(AssociationExtensionInterface::class));
|
||||||
|
$component->setRouterFactory($container->get(RouterFactoryInterface::class));
|
||||||
|
|
||||||
return $component;
|
return $component;
|
||||||
}
|
}
|
||||||
|
@ -100,7 +100,7 @@ class WeblinkController extends FormController
|
|||||||
$this->checkToken();
|
$this->checkToken();
|
||||||
|
|
||||||
// Set the model
|
// Set the model
|
||||||
$model = $this->getModel('Weblink', '', array());
|
$model = $this->getModel('Weblink', 'Administrator', array());
|
||||||
|
|
||||||
// Preset the redirect
|
// Preset the redirect
|
||||||
$this->setRedirect(Route::_('index.php?option=com_weblinks&view=weblinks' . $this->getRedirectToListAppend(), false));
|
$this->setRedirect(Route::_('index.php?option=com_weblinks&view=weblinks' . $this->getRedirectToListAppend(), false));
|
||||||
|
@ -128,7 +128,7 @@ class AssociationsHelper extends AssociationExtensionHelper
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 'category':
|
case 'category':
|
||||||
$table = Table::getInstance('Category');
|
$table = Table::getInstance('Category', 'Joomla\\CMS\\Table\\');
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,6 +36,20 @@ class CategoryModel extends ListModel
|
|||||||
*/
|
*/
|
||||||
protected $_item = null;
|
protected $_item = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Category left of this one
|
||||||
|
*
|
||||||
|
* @var CategoryNode|null
|
||||||
|
*/
|
||||||
|
protected $_leftsibling = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Category right right of this one
|
||||||
|
*
|
||||||
|
* @var CategoryNode|null
|
||||||
|
*/
|
||||||
|
protected $_rightsibling = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Array of child-categories
|
* Array of child-categories
|
||||||
*
|
*
|
||||||
@ -410,7 +424,7 @@ class CategoryModel extends ListModel
|
|||||||
if ($hitcount)
|
if ($hitcount)
|
||||||
{
|
{
|
||||||
$pk = (!empty($pk)) ? $pk : (int) $this->getState('category.id');
|
$pk = (!empty($pk)) ? $pk : (int) $this->getState('category.id');
|
||||||
$table = Table::getInstance('Category', 'JTable');
|
$table = Table::getInstance('Category', 'Joomla\\CMS\\Table\\');
|
||||||
$table->load($pk);
|
$table->load($pk);
|
||||||
$table->hit($pk);
|
$table->hit($pk);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user