File manager - Edit - /home/opticamezl/www/newok/Field.tar
Back
FiltersField.php 0000644 00000015502 15172622255 0007643 0 ustar 00 <?php /** * @package Joomla.Administrator * @subpackage com_config * * @copyright (C) 2013 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ namespace Joomla\Component\Config\Administrator\Field; use Joomla\CMS\Factory; use Joomla\CMS\Form\FormField; use Joomla\CMS\Language\Text; use Joomla\CMS\Layout\LayoutHelper; // phpcs:disable PSR1.Files.SideEffects \defined('_JEXEC') or die; // phpcs:enable PSR1.Files.SideEffects /** * Text Filters form field. * * @since 1.6 */ class FiltersField extends FormField { /** * The form field type. * * @var string * @since 1.6 */ public $type = 'Filters'; /** * Method to get the field input markup. * * @todo: Add access check. * * @return string The field input markup. * * @since 1.6 */ protected function getInput() { // Add translation string for notification Text::script('COM_CONFIG_TEXT_FILTERS_NOTE'); // Add Javascript Factory::getDocument()->getWebAssetManager()->useScript('com_config.filters'); // Get the available user groups. $groups = $this->getUserGroups(); // Build the form control. $html = []; // Open the table. $html[] = '<table id="filter-config" class="table">'; // The table heading. $html[] = ' <thead>'; $html[] = ' <tr>'; $html[] = ' <th>'; $html[] = ' <span class="acl-action">' . Text::_('JGLOBAL_FILTER_GROUPS_LABEL') . '</span>'; $html[] = ' </th>'; $html[] = ' <th>'; $html[] = ' <span class="acl-action">' . Text::_('JGLOBAL_FILTER_TYPE_LABEL') . '</span>'; $html[] = ' </th>'; $html[] = ' <th>'; $html[] = ' <span class="acl-action">' . Text::_('JGLOBAL_FILTER_TAGS_LABEL') . '</span>'; $html[] = ' </th>'; $html[] = ' <th>'; $html[] = ' <span class="acl-action">' . Text::_('JGLOBAL_FILTER_ATTRIBUTES_LABEL') . '</span>'; $html[] = ' </th>'; $html[] = ' </tr>'; $html[] = ' </thead>'; // The table body. $html[] = ' <tbody>'; foreach ($groups as $group) { if (!isset($this->value[$group->value])) { $this->value[$group->value] = ['filter_type' => 'BL', 'filter_tags' => '', 'filter_attributes' => '']; } $group_filter = $this->value[$group->value]; $group_filter['filter_tags'] = !empty($group_filter['filter_tags']) ? $group_filter['filter_tags'] : ''; $group_filter['filter_attributes'] = !empty($group_filter['filter_attributes']) ? $group_filter['filter_attributes'] : ''; $html[] = ' <tr>'; $html[] = ' <td class="acl-groups left">'; $html[] = ' ' . LayoutHelper::render('joomla.html.treeprefix', ['level' => $group->level + 1]) . $group->text; $html[] = ' </td>'; $html[] = ' <td>'; $html[] = ' <label for="' . $this->id . $group->value . '_filter_type" class="visually-hidden">' . Text::_('JGLOBAL_FILTER_TYPE_LABEL') . '</label>'; $html[] = ' <select' . ' name="' . $this->name . '[' . $group->value . '][filter_type]"' . ' id="' . $this->id . $group->value . '_filter_type"' . ' data-parent="' . ($group->parent) . '" ' . ' data-id="' . ($group->value) . '" ' . ' class="novalidate form-select"' . '>'; $html[] = ' <option value="BL"' . ($group_filter['filter_type'] == 'BL' ? ' selected="selected"' : '') . '>' . Text::_('COM_CONFIG_FIELD_FILTERS_DEFAULT_FORBIDDEN_LIST') . '</option>'; $html[] = ' <option value="CBL"' . ($group_filter['filter_type'] == 'CBL' ? ' selected="selected"' : '') . '>' . Text::_('COM_CONFIG_FIELD_FILTERS_CUSTOM_FORBIDDEN_LIST') . '</option>'; $html[] = ' <option value="WL"' . ($group_filter['filter_type'] == 'WL' ? ' selected="selected"' : '') . '>' . Text::_('COM_CONFIG_FIELD_FILTERS_ALLOWED_LIST') . '</option>'; $html[] = ' <option value="NH"' . ($group_filter['filter_type'] == 'NH' ? ' selected="selected"' : '') . '>' . Text::_('COM_CONFIG_FIELD_FILTERS_NO_HTML') . '</option>'; $html[] = ' <option value="NONE"' . ($group_filter['filter_type'] == 'NONE' ? ' selected="selected"' : '') . '>' . Text::_('COM_CONFIG_FIELD_FILTERS_NO_FILTER') . '</option>'; $html[] = ' </select>'; $html[] = ' </td>'; $html[] = ' <td>'; $html[] = ' <label for="' . $this->id . $group->value . '_filter_tags" class="visually-hidden">' . Text::_('JGLOBAL_FILTER_TAGS_LABEL') . '</label>'; $html[] = ' <input' . ' name="' . $this->name . '[' . $group->value . '][filter_tags]"' . ' type="text"' . ' id="' . $this->id . $group->value . '_filter_tags" class="novalidate form-control"' . ' value="' . htmlspecialchars($group_filter['filter_tags'], ENT_QUOTES) . '"' . '>'; $html[] = ' </td>'; $html[] = ' <td>'; $html[] = ' <label for="' . $this->id . $group->value . '_filter_attributes"' . ' class="visually-hidden">' . Text::_('JGLOBAL_FILTER_ATTRIBUTES_LABEL') . '</label>'; $html[] = ' <input' . ' name="' . $this->name . '[' . $group->value . '][filter_attributes]"' . ' type="text"' . ' id="' . $this->id . $group->value . '_filter_attributes" class="novalidate form-control"' . ' value="' . htmlspecialchars($group_filter['filter_attributes'], ENT_QUOTES) . '"' . '>'; $html[] = ' </td>'; $html[] = ' </tr>'; } $html[] = ' </tbody>'; // Close the table. $html[] = '</table>'; return implode("\n", $html); } /** * A helper to get the list of user groups. * * @return array * * @since 1.6 */ protected function getUserGroups() { // Get a database object. $db = $this->getDatabase(); // Get the user groups from the database. $query = $db->getQuery(true); $query->select('a.id AS value, a.title AS text, COUNT(DISTINCT b.id) AS level, a.parent_id as parent'); $query->from('#__usergroups AS a'); $query->join('LEFT', '#__usergroups AS b on a.lft > b.lft AND a.rgt < b.rgt'); $query->group('a.id, a.title, a.lft'); $query->order('a.lft ASC'); $db->setQuery($query); $options = $db->loadObjectList(); return $options; } } ConfigComponentsField.php 0000644 00000004353 15172622255 0011510 0 ustar 00 <?php /** * @package Joomla.Administrator * @subpackage com_config * * @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\Component\Config\Administrator\Field; use Joomla\CMS\Factory; use Joomla\CMS\Form\Field\ListField; use Joomla\CMS\Language\Text; use Joomla\Utilities\ArrayHelper; // phpcs:disable PSR1.Files.SideEffects \defined('_JEXEC') or die; // phpcs:enable PSR1.Files.SideEffects /** * Text Filters form field. * * @since 3.7.0 */ class ConfigComponentsField extends ListField { /** * The form field type. * * @var string * @since 3.7.0 */ public $type = 'ConfigComponents'; /** * Method to get a list of options for a list input. * * @return array An array of JHtml options. * * @since 3.7.0 */ protected function getOptions() { $db = $this->getDatabase(); $query = $db->getQuery(true) ->select('name AS text, element AS value') ->from('#__extensions') ->where('enabled >= 1') ->where('type =' . $db->quote('component')); $items = $db->setQuery($query)->loadObjectList(); if ($items) { $lang = Factory::getLanguage(); foreach ($items as &$item) { // Load language $extension = $item->value; if (is_file(JPATH_ADMINISTRATOR . '/components/' . $extension . '/config.xml')) { $source = JPATH_ADMINISTRATOR . '/components/' . $extension; $lang->load("$extension.sys", JPATH_ADMINISTRATOR) || $lang->load("$extension.sys", $source); // Translate component name $item->text = Text::_($item->text); } else { $item = null; } } // Sort by component name $items = ArrayHelper::sortObjects(array_filter($items), 'text', 1, true, true); } // Merge any additional options in the XML definition. $options = array_merge(parent::getOptions(), $items); return $options; } } BranchesField.php 0000644 00000002015 15172726045 0007755 0 ustar 00 <?php /** * @package Joomla.Administrator * @subpackage com_finder * * @copyright (C) 2015 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ namespace Joomla\Component\Finder\Administrator\Field; use Joomla\CMS\Factory; use Joomla\CMS\Form\Field\ListField; use Joomla\CMS\HTML\HTMLHelper; // phpcs:disable PSR1.Files.SideEffects \defined('_JEXEC') or die; // phpcs:enable PSR1.Files.SideEffects /** * Search Branches field for the Finder package. * * @since 3.5 */ class BranchesField extends ListField { /** * The form field type. * * @var string * @since 3.5 */ protected $type = 'Branches'; /** * Method to get the field options. * * @return array The field option objects. * * @since 3.5 */ public function getOptions() { Factory::getApplication()->bootComponent('com_finder'); return HTMLHelper::_('finder.mapslist'); } } ContentmapField.php 0000644 00000007222 15172726045 0010345 0 ustar 00 <?php /** * @package Joomla.Administrator * @subpackage com_finder * * @copyright (C) 2016 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ namespace Joomla\Component\Finder\Administrator\Field; use Joomla\CMS\Factory; use Joomla\CMS\Form\Field\GroupedlistField; use Joomla\CMS\HTML\HTMLHelper; use Joomla\CMS\Language\Text; use Joomla\Component\Finder\Administrator\Helper\LanguageHelper; // phpcs:disable PSR1.Files.SideEffects \defined('JPATH_PLATFORM') or die; // phpcs:enable PSR1.Files.SideEffects /** * Supports a select grouped list of finder content map. * * @since 3.6.0 */ class ContentmapField extends GroupedlistField { /** * The form field type. * * @var string * @since 3.6.0 */ public $type = 'ContentMap'; /** * Method to get the list of content map options grouped by first level. * * @return array The field option objects as a nested array in groups. * * @since 3.6.0 */ protected function getGroups() { $groups = []; // Get the database object and a new query object. $db = $this->getDatabase(); // Main query. $query = $db->getQuery(true) ->select($db->quoteName('a.title', 'text')) ->select($db->quoteName('a.id', 'value')) ->select($db->quoteName('a.parent_id')) ->select($db->quoteName('a.level')) ->from($db->quoteName('#__finder_taxonomy', 'a')) ->where($db->quoteName('a.parent_id') . ' <> 0') ->order('a.title ASC'); $db->setQuery($query); try { $contentMap = $db->loadObjectList(); } catch (\RuntimeException $e) { return []; } // Build the grouped list array. if ($contentMap) { $parents = []; foreach ($contentMap as $item) { if (!isset($parents[$item->parent_id])) { $parents[$item->parent_id] = []; } $parents[$item->parent_id][] = $item; } foreach ($parents[1] as $branch) { $text = Text::_(LanguageHelper::branchSingular($branch->text)); $groups[$text] = $this->prepareLevel($branch->value, $parents); } } // Merge any additional groups in the XML definition. $groups = array_merge(parent::getGroups(), $groups); return $groups; } /** * Indenting and translating options for the list * * @param int $parent Parent ID to process * @param array $parents Array of arrays of items with parent IDs as keys * * @return array The indented list of entries for this branch * * @since 4.1.5 */ private function prepareLevel($parent, $parents) { $lang = Factory::getLanguage(); $entries = []; foreach ($parents[$parent] as $item) { $levelPrefix = str_repeat('- ', $item->level - 1); if (trim($item->text, '*') === 'Language') { $text = LanguageHelper::branchLanguageTitle($item->text); } else { $key = LanguageHelper::branchSingular($item->text); $text = $lang->hasKey($key) ? Text::_($key) : $item->text; } $entries[] = HTMLHelper::_('select.option', $item->value, $levelPrefix . $text); if (isset($parents[$item->value])) { $entries = array_merge($entries, $this->prepareLevel($item->value, $parents)); } } return $entries; } } ContenttypesField.php 0000644 00000004544 15172726045 0010740 0 ustar 00 <?php /** * @package Joomla.Administrator * @subpackage com_finder * * @copyright (C) 2016 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ namespace Joomla\Component\Finder\Administrator\Field; use Joomla\CMS\Factory; use Joomla\CMS\Form\Field\ListField; use Joomla\CMS\HTML\HTMLHelper; use Joomla\CMS\Language\Text; use Joomla\Component\Finder\Administrator\Helper\LanguageHelper; use Joomla\Utilities\ArrayHelper; // phpcs:disable PSR1.Files.SideEffects \defined('_JEXEC') or die; // phpcs:enable PSR1.Files.SideEffects /** * Content Types Filter field for the Finder package. * * @since 3.6.0 */ class ContenttypesField extends ListField { /** * The form field type. * * @var string * @since 3.6.0 */ protected $type = 'ContentTypes'; /** * Method to get the field options. * * @return array The field option objects. * * @since 3.6.0 */ public function getOptions() { $lang = Factory::getLanguage(); $options = []; $db = $this->getDatabase(); $query = $db->getQuery(true) ->select($db->quoteName('id', 'value')) ->select($db->quoteName('title', 'text')) ->from($db->quoteName('#__finder_types')); // Get the options. $db->setQuery($query); try { $contentTypes = $db->loadObjectList(); } catch (\RuntimeException $e) { Factory::getApplication()->enqueueMessage($e->getMessage(), 'error'); } // Translate. foreach ($contentTypes as $contentType) { $key = LanguageHelper::branchSingular($contentType->text); $contentType->translatedText = $lang->hasKey($key) ? Text::_($key) : $contentType->text; } // Order by title. $contentTypes = ArrayHelper::sortObjects($contentTypes, 'translatedText', 1, true, true); // Convert the values to options. foreach ($contentTypes as $contentType) { $options[] = HTMLHelper::_('select.option', $contentType->value, $contentType->translatedText); } // Merge any additional options in the XML definition. $options = array_merge(parent::getOptions(), $options); return $options; } } SearchfilterField.php 0000644 00000002674 15172726045 0010656 0 ustar 00 <?php /** * @package Joomla.Administrator * @subpackage com_finder * * @copyright (C) 2011 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ namespace Joomla\Component\Finder\Administrator\Field; use Joomla\CMS\Form\Field\ListField; use Joomla\CMS\HTML\HTMLHelper; use Joomla\CMS\Language\Text; // phpcs:disable PSR1.Files.SideEffects \defined('_JEXEC') or die; // phpcs:enable PSR1.Files.SideEffects /** * Search Filter field for the Finder package. * * @since 2.5 */ class SearchfilterField extends ListField { /** * The form field type. * * @var string * @since 2.5 */ protected $type = 'SearchFilter'; /** * Method to get the field options. * * @return array The field option objects. * * @since 2.5 */ public function getOptions() { // Build the query. $db = $this->getDatabase(); $query = $db->getQuery(true) ->select('f.title AS text, f.filter_id AS value') ->from($db->quoteName('#__finder_filters') . ' AS f') ->where('f.state = 1') ->order('f.title ASC'); $db->setQuery($query); $options = $db->loadObjectList(); array_unshift($options, HTMLHelper::_('select.option', '', Text::_('COM_FINDER_SELECT_SEARCH_FILTER'), 'value', 'text')); return $options; } }
| ver. 1.4 |
Github
|
.
| PHP 8.3.23 | Generation time: 0 |
proxy
|
phpinfo
|
Settings