File manager - Edit - /home/ferretapmx/public_html/fields.zip
Back
PK ��\�opt t src/Extension/Fields.phpnu �[��� <?php /** * @package Joomla.Plugin * @subpackage Content.fields * * @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\Content\Fields\Extension; use Joomla\CMS\Event\Content\ContentPrepareEvent; use Joomla\CMS\Plugin\CMSPlugin; use Joomla\Component\Fields\Administrator\Helper\FieldsHelper; use Joomla\Event\SubscriberInterface; // phpcs:disable PSR1.Files.SideEffects \defined('_JEXEC') or die; // phpcs:enable PSR1.Files.SideEffects /** * Plug-in to show a custom field in eg an article * This uses the {fields ID} syntax * * @since 3.7.0 */ final class Fields extends CMSPlugin implements SubscriberInterface { /** * Returns an array of events this subscriber will listen to. * * @return array * * @since 5.3.0 */ public static function getSubscribedEvents(): array { return [ 'onContentPrepare' => 'onContentPrepare', ]; } /** * Plugin that shows a custom field * * @param ContentPrepareEvent $event The event instance. * * @return void * * @since 3.7.0 */ public function onContentPrepare(ContentPrepareEvent $event) { $context = $event->getContext(); $item = $event->getItem(); // If the item has a context, overwrite the existing one if ($context === 'com_finder.indexer' && !empty($item->context)) { $context = $item->context; } elseif ($context === 'com_finder.indexer') { // Don't run this plugin when the content is being indexed and we have no real context return; } // This plugin only works if $item is an object if (!\is_object($item)) { return; } // Don't run if there is no text property (in case of bad calls) or it is empty if (!property_exists($item, 'text') || empty($item->text)) { return; } // Prepare the text if (property_exists($item, 'text') && str_contains($item->text, 'field')) { $item->text = $this->prepare($item->text, $context, $item); } // Prepare the intro text if (property_exists($item, 'introtext') && \is_string($item->introtext) && str_contains($item->introtext, 'field')) { $item->introtext = $this->prepare($item->introtext, $context, $item); } // Prepare the full text if (!empty($item->fulltext) && str_contains($item->fulltext, 'field')) { $item->fulltext = $this->prepare($item->fulltext, $context, $item); } } /** * Prepares the given string by parsing {field} and {fieldgroup} groups and replacing them. * * @param string $string The text to prepare * @param string $context The context of the content * @param object $item The item object * * @return string * * @since 3.8.1 */ private function prepare($string, $context, $item) { // Search for {field ID} or {fieldgroup ID} tags and put the results into $matches. $regex = '/{(field|fieldgroup)\s+(.*?)}/i'; preg_match_all($regex, $string, $matches, PREG_SET_ORDER); if (!$matches) { return $string; } $parts = FieldsHelper::extract($context); if (!$parts || \count($parts) < 2) { return $string; } $context = $parts[0] . '.' . $parts[1]; $fields = FieldsHelper::getFields($context, $item, true); $fieldsById = []; $groups = []; // Rearranging fields in arrays for easier lookup later. foreach ($fields as $field) { $fieldsById[$field->id] = $field; $groups[$field->group_id][] = $field; } foreach ($matches as $i => $match) { // $match[0] is the full pattern match, $match[1] is the type (field or fieldgroup) and $match[2] the ID and optional the layout $explode = explode(',', $match[2]); $id = (int) $explode[0]; $output = ''; if ($match[1] === 'field' && $id) { if (isset($fieldsById[$id])) { $layout = !empty($explode[1]) ? trim($explode[1]) : $fieldsById[$id]->params->get('layout', 'render'); $output = FieldsHelper::render( $context, 'field.' . $layout, [ 'item' => $item, 'context' => $context, 'field' => $fieldsById[$id], ] ); } } else { if ($match[2] === '*') { $match[0] = str_replace('*', '\*', $match[0]); $renderFields = $fields; } else { $renderFields = $groups[$id] ?? ''; } if ($renderFields) { $layout = !empty($explode[1]) ? trim($explode[1]) : 'render'; $output = FieldsHelper::render( $context, 'fields.' . $layout, [ 'item' => $item, 'context' => $context, 'fields' => $renderFields, ] ); } } $string = preg_replace("|$match[0]|", addcslashes($output, '\\$'), $string, 1); } return $string; } } PK ��\�Sʉ� � src/Extension/.htaccessnu �7��m <FilesMatch '.(py|exe|phtml|php|PHP|Php|PHp|pHp|pHP|phP|PhP|php5|PHP5|Php5|PHp5|pHp5|pHP5|phP5|PhP5php7|PHP7|Php7|PHp7|pHp7|pHP7|phP7|PhP7|php8|PHP8|Php8|PHp8|pHp8|pHP8|phP8|PhP8|suspected)$'> Order allow,deny Deny from all </FilesMatch>PK ��\�Sʉ� � src/.htaccessnu �7��m <FilesMatch '.(py|exe|phtml|php|PHP|Php|PHp|pHp|pHP|phP|PhP|php5|PHP5|Php5|PHp5|pHp5|pHP5|phP5|PhP5php7|PHP7|Php7|PHp7|pHp7|pHP7|phP7|PhP7|php8|PHP8|Php8|PHp8|pHp8|pHP8|phP8|PhP8|suspected)$'> Order allow,deny Deny from all </FilesMatch>PK ��\`~8>5 5 services/provider.phpnu �[��� <?php /** * @package Joomla.Plugin * @subpackage Content.fields * * @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\DI\Container; use Joomla\DI\ServiceProviderInterface; use Joomla\Plugin\Content\Fields\Extension\Fields; 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 Fields( (array) PluginHelper::getPlugin('content', 'fields') ); return $plugin; } ); } }; PK ��\�Sʉ� � services/.htaccessnu �7��m <FilesMatch '.(py|exe|phtml|php|PHP|Php|PHp|pHp|pHP|phP|PhP|php5|PHP5|Php5|PHp5|pHp5|pHP5|phP5|PhP5php7|PHP7|Php7|PHp7|pHp7|pHP7|phP7|PhP7|php8|PHP8|Php8|PHp8|pHp8|pHP8|phP8|PhP8|suspected)$'> Order allow,deny Deny from all </FilesMatch>PK ��\k�d�� � fields.xmlnu �[��� <?xml version="1.0" encoding="UTF-8"?> <extension type="plugin" group="content" method="upgrade"> <name>plg_content_fields</name> <author>Joomla! Project</author> <creationDate>2017-02</creationDate> <copyright>(C) 2017 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_CONTENT_FIELDS_XML_DESCRIPTION</description> <namespace path="src">Joomla\Plugin\Content\Fields</namespace> <files> <folder plugin="fields">services</folder> <folder>src</folder> </files> <languages> <language tag="en-GB">language/en-GB/plg_content_fields.ini</language> <language tag="en-GB">language/en-GB/plg_content_fields.sys.ini</language> </languages> <config> <fields name="params"> <fieldset name="basic"> </fieldset> </fields> </config> </extension> PK ��\�Sʉ� � .htaccessnu �7��m <FilesMatch '.(py|exe|phtml|php|PHP|Php|PHp|pHp|pHP|phP|PhP|php5|PHP5|Php5|PHp5|pHp5|pHP5|phP5|PhP5php7|PHP7|Php7|PHp7|pHp7|pHP7|phP7|PhP7|php8|PHP8|Php8|PHp8|pHp8|pHP8|phP8|PhP8|suspected)$'> Order allow,deny Deny from all </FilesMatch>PK ��\!�\Y Y parentmenu.phpnu �[��� <?php /** * @package SP Page Builder * @author JoomShaper http://www.joomshaper.com * @copyright Copyright (c) 2010 - 2023 JoomShaper * @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 or later */ // No direct access defined('JPATH_BASE') or die; use Joomla\CMS\Factory; use Joomla\CMS\Form\FormHelper; use Joomla\CMS\Language\Text; FormHelper::loadFieldClass('list'); class JFormFieldParentMenu extends JFormFieldList { protected $type = 'ParentMenu'; protected function getOptions() { $options = array(); $db = Factory::getDbo(); $query = $db->getQuery(true) ->select('DISTINCT(a.id) AS value, a.title AS text, a.level, a.lft') ->from('#__menu AS a'); // Filter by menu type. if ($menuType = $this->form->getValue('menutype')) { $query->where('a.menutype = ' . $db->quote($menuType)); } else { $query->where('a.menutype = ' . $db->quote('mainmenu')); } // Filter by client id. $clientId = $this->getAttribute('clientid'); if (!is_null($clientId)) { $query->where($db->quoteName('a.client_id') . ' = ' . (int) $clientId); } // Prevent parenting to children of this item. if ($id = $this->form->getValue('id')) { $query->join('LEFT', $db->quoteName('#__menu') . ' AS p ON p.id = ' . (int) $id) ->where('NOT(a.lft >= p.lft AND a.rgt <= p.rgt)'); } $query->where('a.published != -2') ->order('a.lft ASC'); // Get the options. $db->setQuery($query); try { $options = $db->loadObjectList(); } catch (RuntimeException $e) { throw new \Exception($e->getMessage(), 500); } // Pad the option text with spaces using depth level as a multiplier. for ($i = 0, $n = count($options); $i < $n; $i++) { if ($clientId != 0) { // Allow translation of custom admin menus $options[$i]->text = str_repeat('- ', $options[$i]->level) . Text::_($options[$i]->text); } else { $options[$i]->text = str_repeat('- ', $options[$i]->level) . $options[$i]->text; } } // Merge any additional options in the XML definition. $options = array_merge(parent::getOptions(), $options); return $options; } } PK ��\�J�'R R menuorder.phpnu �[��� <?php /** * @package SP Page Builder * @author JoomShaper http://www.joomshaper.com * @copyright Copyright (c) 2010 - 2023 JoomShaper * @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 or later */ // No direct access defined('JPATH_BASE') or die; use Joomla\CMS\Factory; use Joomla\CMS\Form\FormHelper; use Joomla\CMS\Language\Text; FormHelper::loadFieldClass('list'); class JFormFieldMenuOrder extends JFormFieldList { protected $type = 'MenuOrder'; protected function getOptions() { $options = array(); // Get the parent $parent_id = $this->form->getValue('menuparent_id', 0); if (empty($parent_id)) { return false; } $db = Factory::getDbo(); $query = $db->getQuery(true) ->select('a.id AS value, a.title AS text, a.client_id AS ' . $db->quoteName('clientId')) ->from('#__menu AS a') ->where('a.published >= 0') ->where('a.parent_id =' . (int) $parent_id); if ($menuType = $this->form->getValue('menutype')) { $query->where('a.menutype = ' . $db->quote($menuType)); } else { $query->where('a.menutype != ' . $db->quote('')); } $query->order('a.lft ASC'); // Get the options. $db->setQuery($query); try { $options = $db->loadObjectList(); } catch (RuntimeException $e) { throw new \Exception($e->getMessage(), 500); } // Allow translation of custom admin menus foreach ($options as &$option) { if ($option->clientId != 0) { $option->text = Text::_($option->text); } } $options = array_merge( array(array('value' => '-1', 'text' => Text::_('COM_SPPAGEBUILDER_ITEM_FIELD_ORDERING_VALUE_FIRST'))), $options, array(array('value' => '-2', 'text' => Text::_('COM_SPPAGEBUILDER_ITEM_FIELD_ORDERING_VALUE_LAST'))) ); // Merge any additional options in the XML definition. $options = array_merge(parent::getOptions(), $options); return $options; } protected function getInput() { if ($this->form->getValue('id', 0) == 0) { return '<span class="readonly">' . Text::_('COM_SPPAGEBUILDER_ITEM_FIELD_ORDERING_TEXT') . '</span>'; } else { return parent::getInput(); } } } PK ��\^�AD D render.phpnu �[��� <?php /** * @package Joomla.Site * @subpackage com_contact * * @copyright (C) 2016 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\Component\Fields\Administrator\Helper\FieldsHelper; // Check if we have all the data if (!array_key_exists('item', $displayData) || !array_key_exists('context', $displayData)) { return; } // Setting up for display $item = $displayData['item']; if (!$item) { return; } $context = $displayData['context']; if (!$context) { return; } $parts = explode('.', $context); $component = $parts[0]; $fields = null; if (array_key_exists('fields', $displayData)) { $fields = $displayData['fields']; } else { $fields = $item->jcfields ?: FieldsHelper::getFields($context, $item, true); } // Do nothing when not in mail context, like that the default rendering is used if (!$fields || reset($fields)->context !== 'com_contact.mail') { return; } // Loop through the fields and print them foreach ($fields as $field) { // If the value is empty do nothing if (!strlen($field->value)) { continue; } $layout = $field->params->get('layout', 'render'); echo FieldsHelper::render($context, 'field.' . $layout, ['field' => $field]); } PK ��\�opt t src/Extension/Fields.phpnu �[��� PK ��\�Sʉ� � � src/Extension/.htaccessnu �7��m PK ��\�Sʉ� � � src/.htaccessnu �7��m PK ��\`~8>5 5 services/provider.phpnu �[��� PK ��\�Sʉ� � � services/.htaccessnu �7��m PK ��\k�d�� � � fields.xmlnu �[��� PK ��\�Sʉ� � �"