Skip to content

Commit

Permalink
Merge branch '4.3-dev' into plugins/extension/finder
Browse files Browse the repository at this point in the history
  • Loading branch information
obuisard committed Nov 10, 2022
2 parents 1b619e9 + 86abd7d commit 374fe58
Show file tree
Hide file tree
Showing 14 changed files with 336 additions and 55 deletions.
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
"watch:com_media": "node build/build.js --watch-com-media",
"lint:js": "eslint --config build/.eslintrc --ignore-pattern '/media/' --ext .es6.js,.es6,.vue .",
"lint:css": "stylelint --config build/.stylelintrc.json \"administrator/components/com_media/resources/**/*.scss\" \"administrator/templates/**/*.scss\" \"build/media_source/**/*.scss\" \"templates/**/*.scss\" \"installation/template/**/*.scss\"",
"test": "karma start tests/javascript/karma.conf.js --single-run",
"install": "node build/build.js --prepare",
"update": "node build/build.js --copy-assets && node build/build.js --build-pages && node build/build.js --compile-js && node build/build.js --compile-css && node build/build.js --compile-bs && node build/build.js --com-media",
"gzip": "node build/build.js --gzip",
Expand Down
2 changes: 1 addition & 1 deletion plugins/content/confirmconsent/confirmconsent.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<description>PLG_CONTENT_CONFIRMCONSENT_XML_DESCRIPTION</description>
<namespace path="src">Joomla\Plugin\Content\ConfirmConsent</namespace>
<files>
<filename plugin="confirmconsent">confirmconsent.php</filename>
<folder plugin="confirmconsent">services</folder>
<folder>src</folder>
</files>
<languages>
Expand Down
48 changes: 48 additions & 0 deletions plugins/content/confirmconsent/services/provider.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<?php

/**
* @package Joomla.Plugin
* @subpackage Content.confirmconsent
*
* @copyright (C) 2022 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/

defined('_JEXEC') or die;

use Joomla\CMS\Extension\PluginInterface;
use Joomla\CMS\Factory;
use Joomla\CMS\Plugin\PluginHelper;
use Joomla\DI\Container;
use Joomla\DI\ServiceProviderInterface;
use Joomla\Event\DispatcherInterface;
use Joomla\Plugin\Content\ConfirmConsent\Extension\ConfirmConsent;

return new class implements ServiceProviderInterface
{
/**
* Registers the service provider with a DI container.
*
* @param Container $container The DI container.
*
* @return void
*
* @since __DEPLOY_VERSION__
*/
public function register(Container $container)
{
$container->set(
PluginInterface::class,
function (Container $container) {
$dispatcher = $container->get(DispatcherInterface::class);
$plugin = new ConfirmConsent(
$dispatcher,
(array) PluginHelper::getPlugin('content', 'confirmconsent')
);
$plugin->setApplication(Factory::getApplication());

return $plugin;
}
);
}
};
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,11 @@
*
* @copyright (C) 2018 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
* @phpcs:disable PSR1.Classes.ClassDeclaration.MissingNamespace
*/

namespace Joomla\Plugin\Content\ConfirmConsent\Extension;

use Joomla\CMS\Form\Form;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Plugin\CMSPlugin;

// phpcs:disable PSR1.Files.SideEffects
Expand All @@ -23,15 +22,8 @@
*
* @since 3.9.0
*/
class PlgContentConfirmConsent extends CMSPlugin
final class ConfirmConsent extends CMSPlugin
{
/**
* @var \Joomla\CMS\Application\SiteApplication
*
* @since 3.9.0
*/
protected $app;

/**
* Load the language file on instantiation.
*
Expand Down Expand Up @@ -65,12 +57,15 @@ class PlgContentConfirmConsent extends CMSPlugin
*/
public function onContentPrepareForm(Form $form, $data)
{
if ($this->app->isClient('administrator') || !in_array($form->getName(), $this->supportedContext)) {
if ($this->getApplication()->isClient('administrator') || !in_array($form->getName(), $this->supportedContext)) {
return true;
}

// Get the consent box Text & the selected privacyarticle
$consentboxText = (string) $this->params->get('consentbox_text', Text::_('PLG_CONTENT_CONFIRMCONSENT_FIELD_NOTE_DEFAULT'));
$consentboxText = (string) $this->params->get(
'consentbox_text',
$this->getApplication()->getLanguage()->_('PLG_CONTENT_CONFIRMCONSENT_FIELD_NOTE_DEFAULT')
);
$privacyArticle = $this->params->get('privacy_article', false);
$privacyType = $this->params->get('privacy_type', 'article');
$privacyMenuItem = $this->params->get('privacy_menu_item', false);
Expand Down
4 changes: 3 additions & 1 deletion plugins/content/contact/contact.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@
<authorUrl>www.joomla.org</authorUrl>
<version>3.2.2</version>
<description>PLG_CONTENT_CONTACT_XML_DESCRIPTION</description>
<namespace path="src">Joomla\Plugin\Content\Contact</namespace>
<files>
<filename plugin="contact">contact.php</filename>
<folder plugin="contact">services</folder>
<folder>src</folder>
</files>
<languages>
<language tag="en-GB">language/en-GB/plg_content_contact.ini</language>
Expand Down
50 changes: 50 additions & 0 deletions plugins/content/contact/services/provider.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<?php

/**
* @package Joomla.Plugin
* @subpackage Content.contact
*
* @copyright (C) 2022 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/

defined('_JEXEC') or die;

use Joomla\CMS\Extension\PluginInterface;
use Joomla\CMS\Factory;
use Joomla\CMS\Plugin\PluginHelper;
use Joomla\Database\DatabaseInterface;
use Joomla\DI\Container;
use Joomla\DI\ServiceProviderInterface;
use Joomla\Event\DispatcherInterface;
use Joomla\Plugin\Content\Contact\Extension\Contact;

return new class implements ServiceProviderInterface
{
/**
* Registers the service provider with a DI container.
*
* @param Container $container The DI container.
*
* @return void
*
* @since __DEPLOY_VERSION__
*/
public function register(Container $container)
{
$container->set(
PluginInterface::class,
function (Container $container) {
$dispatcher = $container->get(DispatcherInterface::class);
$plugin = new Contact(
$dispatcher,
(array) PluginHelper::getPlugin('content', 'contact')
);
$plugin->setApplication(Factory::getApplication());
$plugin->setDatabase($container->get(DatabaseInterface::class));

return $plugin;
}
);
}
};
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,19 @@

/**
* @package Joomla.Plugin
* @subpackage Content.Contact
* @subpackage Content.contact
*
* @copyright (C) 2014 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
* @phpcs:disable PSR1.Classes.ClassDeclaration.MissingNamespace
*/

use Joomla\CMS\Factory;
namespace Joomla\Plugin\Content\Contact\Extension;

use Joomla\CMS\Language\Multilanguage;
use Joomla\CMS\Plugin\CMSPlugin;
use Joomla\CMS\Router\Route;
use Joomla\Component\Contact\Site\Helper\RouteHelper;
use Joomla\Database\DatabaseAwareTrait;
use Joomla\Database\ParameterType;
use Joomla\Registry\Registry;

Expand All @@ -27,14 +27,9 @@
*
* @since 3.2
*/
class PlgContentContact extends CMSPlugin
final class Contact extends CMSPlugin
{
/**
* @var \Joomla\Database\DatabaseDriver
*
* @since 3.3
*/
protected $db;
use DatabaseAwareTrait;

/**
* Plugin that retrieves contact information for contact
Expand Down Expand Up @@ -98,7 +93,7 @@ public function onContentPrepare($context, &$row, $params, $page = 0)
*
* @return stdClass|null Object containing contact details or null if not found
*/
protected function getContactData($userId)
private function getContactData($userId)
{
static $contacts = array();

Expand All @@ -107,7 +102,7 @@ protected function getContactData($userId)
return $contacts[$userId];
}

$db = $this->db;
$db = $this->getDatabase();
$query = $db->getQuery(true);
$userId = (int) $userId;

Expand All @@ -134,7 +129,7 @@ protected function getContactData($userId)
if (Multilanguage::isEnabled() === true) {
$query->where(
'(' . $db->quoteName('contact.language') . ' IN ('
. implode(',', $query->bindArray([Factory::getLanguage()->getTag(), '*'], ParameterType::STRING))
. implode(',', $query->bindArray([$this->getApplication()->getLanguage()->getTag(), '*'], ParameterType::STRING))
. ') OR ' . $db->quoteName('contact.language') . ' IS NULL)'
);
}
Expand Down
4 changes: 3 additions & 1 deletion plugins/extension/joomla/joomla.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@
<authorUrl>www.joomla.org</authorUrl>
<version>3.0.0</version>
<description>PLG_EXTENSION_JOOMLA_XML_DESCRIPTION</description>
<namespace path="src">Joomla\Plugin\Extension\Joomla</namespace>
<files>
<filename plugin="joomla">joomla.php</filename>
<folder plugin="joomla">services</folder>
<folder>src</folder>
</files>
<languages>
<language tag="en-GB">language/en-GB/plg_extension_joomla.ini</language>
Expand Down
48 changes: 48 additions & 0 deletions plugins/extension/joomla/services/provider.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<?php

/**
* @package Joomla.Plugin
* @subpackage Extension.joomla
*
* @copyright (C) 2022 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/

defined('_JEXEC') or die;

use Joomla\CMS\Extension\PluginInterface;
use Joomla\CMS\Plugin\PluginHelper;
use Joomla\Database\DatabaseInterface;
use Joomla\DI\Container;
use Joomla\DI\ServiceProviderInterface;
use Joomla\Event\DispatcherInterface;
use Joomla\Plugin\Extension\Joomla\Extension\Joomla;

return new class implements ServiceProviderInterface
{
/**
* Registers the service provider with a DI container.
*
* @param Container $container The DI container.
*
* @return void
*
* @since __DEPLOY_VERSION__
*/
public function register(Container $container)
{
$container->set(
PluginInterface::class,
function (Container $container) {
$dispatcher = $container->get(DispatcherInterface::class);
$plugin = new Joomla(
$dispatcher,
(array) PluginHelper::getPlugin('extension', 'joomla')
);
$plugin->setDatabase($container->get(DatabaseInterface::class));

return $plugin;
}
);
}
};
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@

/**
* @package Joomla.Plugin
* @subpackage Extension.Joomla
* @subpackage Extension.joomla
*
* @copyright (C) 2010 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
* @phpcs:disable PSR1.Classes.ClassDeclaration.MissingNamespace
*/

namespace Joomla\Plugin\Extension\Joomla\Extension;

use Joomla\CMS\Installer\Installer;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Plugin\CMSPlugin;
use Joomla\Database\DatabaseDriver;
use Joomla\Database\DatabaseAwareTrait;
use Joomla\Database\ParameterType;

// phpcs:disable PSR1.Files.SideEffects
Expand All @@ -25,14 +25,9 @@
*
* @since 1.6
*/
class PlgExtensionJoomla extends CMSPlugin
final class Joomla extends CMSPlugin
{
/**
* @var DatabaseDriver
*
* @since 4.0.0
*/
protected $db;
use DatabaseAwareTrait;

/**
* @var integer
Expand Down Expand Up @@ -73,7 +68,7 @@ class PlgExtensionJoomla extends CMSPlugin
private function addUpdateSite($name, $type, $location, $enabled, $extraQuery = '')
{
// Look if the location is used already; doesn't matter what type you can't have two types at the same address, doesn't make sense
$db = $this->db;
$db = $this->getDatabase();
$query = $db->getQuery(true);

$query->select($db->quoteName('update_site_id'))
Expand Down Expand Up @@ -177,7 +172,7 @@ public function onExtensionAfterUninstall($installer, $eid, $removed)
// If we have a valid extension ID and the extension was successfully uninstalled wipe out any
// update sites for it
if ($eid && $removed) {
$db = $this->db;
$db = $this->getDatabase();
$query = $db->getQuery(true);
$eid = (int) $eid;

Expand Down
4 changes: 3 additions & 1 deletion plugins/extension/namespacemap/namespacemap.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@
<authorUrl>www.joomla.org</authorUrl>
<version>4.0.0</version>
<description>PLG_EXTENSION_NAMESPACEMAP_XML_DESCRIPTION</description>
<namespace path="src">Joomla\Plugin\Extension\NamespaceMap</namespace>
<files>
<filename plugin="namespacemap">namespacemap.php</filename>
<folder plugin="namespacemap">services</folder>
<folder>src</folder>
</files>
<languages>
<language tag="en-GB">language/en-GB/plg_extension_namespacemap.ini</language>
Expand Down

0 comments on commit 374fe58

Please sign in to comment.