Файловый менеджер - Редактировать - /var/www/html/plugins.zip
Ðазад
PK ! ���� � fields/sql/sql.xmlnu �[��� <?xml version="1.0" encoding="UTF-8"?> <extension type="plugin" group="fields" method="upgrade"> <name>plg_fields_sql</name> <author>Joomla! Project</author> <creationDate>2016-03</creationDate> <copyright>(C) 2016 Open Source Matters, Inc.</copyright> <license>GNU General Public License version 2 or later; see LICENSE.txt</license> <authorEmail>admin@joomla.org</authorEmail> <authorUrl>www.joomla.org</authorUrl> <version>3.7.0</version> <description>PLG_FIELDS_SQL_XML_DESCRIPTION</description> <namespace path="src">Joomla\Plugin\Fields\SQL</namespace> <files> <folder>params</folder> <folder plugin="sql">services</folder> <folder>src</folder> <folder>tmpl</folder> </files> <languages> <language tag="en-GB">language/en-GB/plg_fields_sql.ini</language> <language tag="en-GB">language/en-GB/plg_fields_sql.sys.ini</language> </languages> <config> <fields name="params"> <fieldset name="basic"> <field name="query" type="textarea" label="PLG_FIELDS_SQL_PARAMS_QUERY_LABEL" description="PLG_FIELDS_SQL_PARAMS_QUERY_DESC" rows="10" filter="raw" required="true" /> <field name="header" type="text" label="PLG_FIELDS_SQL_PARAMS_HEADER_LABEL" description="PLG_FIELDS_SQL_PARAMS_HEADER_DESC" filter="string" /> <field name="multiple" type="radio" layout="joomla.form.field.radio.switcher" default="0" label="PLG_FIELDS_SQL_PARAMS_MULTIPLE_LABEL" filter="integer" > <option value="0">JNO</option> <option value="1">JYES</option> </field> <field name="form_layout" type="list" label="JLIB_FORM_FIELD_PARAM_LAYOUT_LABEL" class="form-select" default="joomla.form.field.list" > <option value="joomla.form.field.list">JLIB_FORM_FIELD_PARAM_LAYOUT_BASIC_SELECT</option> <option value="joomla.form.field.list-fancy-select">JLIB_FORM_FIELD_PARAM_LAYOUT_FANCY_SELECT</option> </field> </fieldset> </fields> </config> </extension> PK ! b|9V V fields/sql/src/Extension/SQL.phpnu �[��� <?php /** * @package Joomla.Plugin * @subpackage Fields.sql * * @copyright (C) 2017 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ namespace Joomla\Plugin\Fields\SQL\Extension; use Joomla\CMS\Access\Access; use Joomla\CMS\Event\Model\BeforeSaveEvent; use Joomla\CMS\Form\Form; use Joomla\Component\Fields\Administrator\Plugin\FieldsListPlugin; use Joomla\Event\SubscriberInterface; // phpcs:disable PSR1.Files.SideEffects \defined('_JEXEC') or die; // phpcs:enable PSR1.Files.SideEffects /** * Fields SQL Plugin * * @since 3.7.0 */ final class SQL extends FieldsListPlugin implements SubscriberInterface { /** * Returns an array of events this subscriber will listen to. * * @return array * * @since 5.3.0 */ public static function getSubscribedEvents(): array { return array_merge(parent::getSubscribedEvents(), [ 'onContentBeforeSave' => 'contentBeforeSave', ]); } /** * Transforms the field into a DOM XML element and appends it as a child on the given parent. * * @param \stdClass $field The field. * @param \DOMElement $parent The field node parent. * @param Form $form The form. * * @return ?\DOMElement * * @since 3.7.0 */ public function onCustomFieldsPrepareDom($field, \DOMElement $parent, Form $form) { $fieldNode = parent::onCustomFieldsPrepareDom($field, $parent, $form); if (!$fieldNode) { return $fieldNode; } $fieldNode->setAttribute('value_field', 'text'); $fieldNode->setAttribute('key_field', 'value'); return $fieldNode; } /** * The save event. * * @param BeforeSaveEvent $event The event instance. * * @return void * * @since 3.7.0 */ public function contentBeforeSave(BeforeSaveEvent $event): void { $context = $event->getContext(); $item = $event->getItem(); // Only work on new SQL fields if ($context != 'com_fields.field' || !isset($item->type) || $item->type != 'sql') { return; } // If we are not a super admin, don't let the user create or update a SQL field if (!Access::getAssetRules(1)->allow('core.admin', $this->getApplication()->getIdentity()->getAuthorisedGroups())) { $item->setError($this->getApplication()->getLanguage()->_('PLG_FIELDS_SQL_CREATE_NOT_POSSIBLE')); $event->addResult(false); } } } PK ! ��� fields/sql/services/provider.phpnu �[��� <?php /** * @package Joomla.Plugin * @subpackage Fields.sql * * @copyright (C) 2023 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\Plugin\Fields\SQL\Extension\SQL; return new class () implements ServiceProviderInterface { /** * Registers the service provider with a DI container. * * @param Container $container The DI container. * * @return void * * @since 4.3.0 */ public function register(Container $container) { $container->set( PluginInterface::class, function (Container $container) { $plugin = new SQL( (array) PluginHelper::getPlugin('fields', 'sql') ); $plugin->setApplication(Factory::getApplication()); return $plugin; } ); } }; PK ! �qF�. . fields/sql/params/sql.xmlnu �[��� <?xml version="1.0" encoding="UTF-8"?> <form> <fields name="fieldparams"> <fieldset name="fieldparams"> <field name="query" type="textarea" label="PLG_FIELDS_SQL_PARAMS_QUERY_LABEL" description="PLG_FIELDS_SQL_PARAMS_QUERY_DESC" filter="raw" rows="10" required="true" /> <field name="header" type="text" label="PLG_FIELDS_SQL_PARAMS_HEADER_LABEL" description="PLG_FIELDS_SQL_PARAMS_HEADER_DESC" filter="string" /> <field name="multiple" type="list" label="PLG_FIELDS_SQL_PARAMS_MULTIPLE_LABEL" filter="integer" validate="options" > <option value="">COM_FIELDS_FIELD_USE_GLOBAL</option> <option value="1">JYES</option> <option value="0">JNO</option> </field> </fieldset> </fields> <fields name="params"> <fieldset name="basic"> <fieldset name="formoptions"> <field name="form_layout" type="list" label="JLIB_FORM_FIELD_PARAM_LAYOUT_LABEL" class="form-select" > <option value="">COM_FIELDS_FIELD_USE_GLOBAL</option> <option value="joomla.form.field.list">JLIB_FORM_FIELD_PARAM_LAYOUT_BASIC_SELECT</option> <option value="joomla.form.field.list-fancy-select">JLIB_FORM_FIELD_PARAM_LAYOUT_FANCY_SELECT</option> </field> </fieldset> </fieldset> </fields> </form> PK ! '� �^ ^ fields/sql/tmpl/sql.phpnu �[��� <?php /** * @package Joomla.Plugin * @subpackage Fields.Sql * * @copyright (C) 2017 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\Factory; use Joomla\Database\ParameterType; $value = $field->value; if ($value == '') { return; } $db = Factory::getDbo(); $value = (array) $value; $query = $db->getQuery(true); $sql = $fieldParams->get('query', ''); $bindNames = $query->bindArray($value, ParameterType::STRING); // Run the query with a having condition because it supports aliases $query->setQuery($sql . ' HAVING ' . $db->quoteName('value') . ' IN (' . implode(',', $bindNames) . ')'); try { $db->setQuery($query); $items = $db->loadObjectList(); } catch (Exception $e) { // If the query failed, we fetch all elements $db->setQuery($sql); $items = $db->loadObjectList(); } $texts = []; foreach ($items as $item) { if (in_array($item->value, $value)) { $texts[] = $item->text; } } echo htmlentities(implode(', ', $texts)); PK ! ���v� � &