mirror of
https://github.com/joomla-extensions/weblinks.git
synced 2025-01-27 14:28:30 +00:00
Move to new dispatcher concept
This commit is contained in:
parent
5f348f81b9
commit
828325e86c
11
.travis.yml
11
.travis.yml
@ -10,14 +10,9 @@ env:
|
||||
matrix:
|
||||
fast_finish: true
|
||||
include:
|
||||
- php: 5.6
|
||||
- php: 7.0
|
||||
env: RUN_PHPCS="yes"
|
||||
sudo: true
|
||||
addons:
|
||||
firefox: 'latest-esr'
|
||||
- php: 7.1
|
||||
- php: 7.2
|
||||
sudo: true
|
||||
env: RUN_PHPCS="yes"
|
||||
- php: 7.3
|
||||
|
||||
before_script:
|
||||
@ -50,5 +45,5 @@ script:
|
||||
# System tests (Codeception)
|
||||
- mv tests/acceptance.suite.dist.yml tests/acceptance.suite.yml
|
||||
- vendor/bin/robo run:tests --use-htaccess
|
||||
# Run phpcs on PHP 7.0 against weblinks source
|
||||
# Run phpcs on flagged php versions against weblinks source
|
||||
- if [[ $RUN_PHPCS == "yes" ]]; then vendor/bin/phpcs --report=full --extensions=php -p --standard=tests/joomla/build/phpcs/Joomla ./src; fi
|
||||
|
@ -4,14 +4,13 @@
|
||||
"license" : "GPL-2.0+",
|
||||
"config": {
|
||||
"platform": {
|
||||
"php": "5.6.0"
|
||||
"php": "7.2.0"
|
||||
}
|
||||
},
|
||||
"require" : {
|
||||
"php": ">=5.4"
|
||||
"php": ">=7.2"
|
||||
},
|
||||
"require-dev": {
|
||||
"php": ">=5.6",
|
||||
"codeception/codeception": "^3",
|
||||
"phpunit/phpunit": "^5.7.27",
|
||||
"joomla-projects/joomla-browser": "v3.9.0",
|
||||
|
@ -0,0 +1,57 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_contact
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2019 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
namespace Joomla\Component\Weblinks\Administrator\Extension;
|
||||
|
||||
defined('JPATH_PLATFORM') or die;
|
||||
|
||||
use Joomla\CMS\Association\AssociationServiceInterface;
|
||||
use Joomla\CMS\Association\AssociationServiceTrait;
|
||||
use Joomla\CMS\Categories\CategoryServiceInterface;
|
||||
use Joomla\CMS\Categories\CategoryServiceTrait;
|
||||
use Joomla\CMS\Extension\MVCComponent;
|
||||
|
||||
/**
|
||||
* Component class for com_contact
|
||||
*
|
||||
* @since 4.0.0
|
||||
*/
|
||||
class WeblinksComponent extends MVCComponent implements CategoryServiceInterface, AssociationServiceInterface
|
||||
{
|
||||
use CategoryServiceTrait;
|
||||
use AssociationServiceTrait;
|
||||
|
||||
/**
|
||||
* Returns the table for the count items functions for the given section.
|
||||
*
|
||||
* @param string $section The section
|
||||
*
|
||||
* @return string|null
|
||||
*
|
||||
* @since 4.0.0
|
||||
*/
|
||||
protected function getTableNameForSection(string $section = null)
|
||||
{
|
||||
return ($section === 'category' ? 'categories' : 'weblinks');
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the state column for the count items functions for the given section.
|
||||
*
|
||||
* @param string $section The section
|
||||
*
|
||||
* @return string|null
|
||||
*
|
||||
* @since 4.0.0
|
||||
*/
|
||||
protected function getStateColumnForSection(string $section = null)
|
||||
{
|
||||
return 'published';
|
||||
}
|
||||
}
|
@ -1,29 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage Weblinks
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2017 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
use Joomla\CMS\Dispatcher\Dispatcher;
|
||||
|
||||
/**
|
||||
* Dispatcher class for com_weblinks
|
||||
*
|
||||
* @since __DEPLOY_VERSION__
|
||||
*/
|
||||
class WeblinksDispatcher extends Dispatcher
|
||||
{
|
||||
/**
|
||||
* The extension namespace
|
||||
*
|
||||
* @var string
|
||||
*
|
||||
* @since __DEPLOY_VERSION__
|
||||
*/
|
||||
protected $namespace = 'Joomla\\Component\\Weblinks';
|
||||
}
|
@ -0,0 +1,55 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Administrator
|
||||
* @subpackage com_weblinks
|
||||
*
|
||||
* @copyright Copyright (C) 2005 - 2019 Open Source Matters, Inc. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
use Joomla\CMS\Categories\CategoryFactoryInterface;
|
||||
use Joomla\CMS\Dispatcher\ComponentDispatcherFactoryInterface;
|
||||
use Joomla\CMS\Extension\ComponentInterface;
|
||||
use Joomla\CMS\Extension\Service\Provider\CategoryFactory;
|
||||
use Joomla\CMS\Extension\Service\Provider\ComponentDispatcherFactory;
|
||||
use Joomla\CMS\Extension\Service\Provider\MVCFactory;
|
||||
use Joomla\CMS\MVC\Factory\MVCFactoryInterface;
|
||||
use Joomla\Component\Weblinks\Administrator\Extension\WeblinksComponent;
|
||||
use Joomla\DI\Container;
|
||||
use Joomla\DI\ServiceProviderInterface;
|
||||
|
||||
/**
|
||||
* The banners service provider.
|
||||
*
|
||||
* @since 4.0.0
|
||||
*/
|
||||
return new class implements ServiceProviderInterface
|
||||
{
|
||||
/**
|
||||
* Registers the service provider with a DI container.
|
||||
*
|
||||
* @param Container $container The DI container.
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 4.0.0
|
||||
*/
|
||||
public function register(Container $container)
|
||||
{
|
||||
$container->registerServiceProvider(new CategoryFactory('\\Joomla\\Component\\Weblinks'));
|
||||
$container->registerServiceProvider(new MVCFactory('\\Joomla\\Component\\Weblinks'));
|
||||
$container->registerServiceProvider(new ComponentDispatcherFactory('\\Joomla\\Component\\Weblinks'));
|
||||
$container->set(
|
||||
ComponentInterface::class,
|
||||
function (Container $container)
|
||||
{
|
||||
$component = new WeblinksComponent($container->get(ComponentDispatcherFactoryInterface::class));
|
||||
$component->setMVCFactory($container->get(MVCFactoryInterface::class));
|
||||
$component->setCategoryFactory($container->get(CategoryFactoryInterface::class));
|
||||
|
||||
return $component;
|
||||
}
|
||||
);
|
||||
}
|
||||
};
|
@ -10,6 +10,7 @@
|
||||
<version>##VERSION##</version>
|
||||
<description>COM_WEBLINKS_XML_DESCRIPTION</description>
|
||||
<scriptfile>script.php</scriptfile>
|
||||
<namespace>Joomla\Component\Weblinks</namespace>
|
||||
|
||||
<install>
|
||||
<sql>
|
||||
|
Loading…
x
Reference in New Issue
Block a user