Your IP : 216.73.217.68


Current Path : /home/wuectly/www/03cbe/
Upload File :
Current File : /home/wuectly/www/03cbe/fields.tar

mediajce.xml000060400000000523152455302520007026 0ustar00<?xml version="1.0" encoding="utf-8"?>
<form>
	<fieldset name="media">
		<field name="media_src" type="mediajce" label="PLG_FIELDS_MEDIAJCE_MEDIA_FILE_LABEL" schemes="http,https,ftp,ftps,data,file" validate="url" relative="true" />
		<field name="media_text" type="text" label="PLG_FIELDS_MEDIAJCE_MEDIA_TEXT_LABEL" />
	</fieldset>
</form>mediajce.php000060400000006331152455302520007020 0ustar00<?php
/**
 * @package     JCE
 * @subpackage  Admin
 *
 * @copyright   Copyright (C) 2005 - 2020 Open Source Matters, Inc. All rights reserved.
 * @copyright   Copyright (c) 2009-2024 Ryan Demmer. All rights reserved
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */

\defined('_JEXEC') or die;

use Joomla\CMS\Form\Field\MediaField;

/**
 * Provides a modal media selector field for the JCE File Browser
 *
 * @since  2.6.17
 */
class JFormFieldMediaJce extends MediaField
{
    /**
     * The form field type.
     *
     * @var    string
     */
    protected $type = 'MediaJce';

    /**
     * Layout to render
     *
     * @var    string
     * @since  3.5
     */
    protected $layout = 'joomla.form.field.media';

    /**
     * Default mediatype
     *
     * @var    string
     * @since  2.9.39
     */
    protected $mediatype;

    /**
     * Method to attach a JForm object to the field.
     *
     * @param   SimpleXMLElement  $element  The SimpleXMLElement object representing the `<field>` tag for the form field object.
     * @param   mixed             $value    The form field value to validate.
     * @param   string            $group    The field name group control value. This acts as an array container for the field.
     *                                      For example if the field has name="foo" and the group value is set to "bar" then the
     *                                      full field name would end up being "bar[foo]".
     *
     * @return  boolean  True on success.
     *
     * @see     JFormField::setup()
     */
    public function setup(SimpleXMLElement $element, $value, $group = null)
    {
        $result = parent::setup($element, $value, $group);

        if ($result === true) {
            $this->mediatype = isset($this->element['mediatype']) ? (string) $this->element['mediatype'] : 'images';

            if (!isset($this->element['converted'])) {
                $this->element['converted'] = 0;
            }
        }

        return $result;
    }

    /**
     * Get the data that is going to be passed to the layout
     *
     * @return  array
     */
    public function getLayoutData()
    {
        require_once JPATH_ADMINISTRATOR . '/components/com_jce/helpers/browser.php';

        $config = array(
            'element' => $this->id,
            'mediatype' => strtolower($this->mediatype),
            'converted' => (int) $this->element['converted'] ? true : false,
        );

        if (isset($this->element['plugin'])) {
            $config['plugin'] = (string) $this->element['plugin'];
        }

        // Get the basic field data
        $data = parent::getLayoutData();

        $this->link = WFBrowserHelper::getMediaFieldUrl($config);

        // not a valid file browser link
        if (!$this->link) {
            return $data;
        }
        
        $options = WFBrowserHelper::getMediaFieldOptions($config);

        $extraData = array(
            'link' => $this->link,
            'class' => $this->element['class'] . ' input-medium wf-media-input wf-media-input-active',
        );

        if ($options['upload'] == 1) {
            $extraData['class'] .= ' wf-media-input-upload';
        }

        return array_merge($data, $extraData);
    }
}
fields.xml000060400000001561152455305230006537 0ustar00<?xml version="1.0" encoding="utf-8"?>
<extension version="3.7.0" type="plugin" group="content" method="upgrade">
	<name>plg_content_fields</name>
	<author>Joomla! Project</author>
	<creationDate>February 2017</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>
	<files>
		<filename plugin="fields">fields.php</filename>
	</files>
	<languages>
		<language tag="en-GB">en-GB.plg_content_fields.ini</language>
		<language tag="en-GB">en-GB.plg_content_fields.sys.ini</language>
	</languages>
	<config>
		<fields name="params">
			<fieldset name="basic">
			</fieldset>
		</fields>
	</config>
</extension>
fields.php000060400000010140152455305230006517 0ustar00<?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
 */

defined('_JEXEC') or die();

/**
 * Plug-in to show a custom field in eg an article
 * This uses the {fields ID} syntax
 *
 * @since  3.7.0
 */
class PlgContentFields extends JPlugin
{
	/**
	 * Plugin that shows a custom field
	 *
	 * @param   string  $context  The context of the content being passed to the plugin.
	 * @param   object  &$item    The item object.  Note $article->text is also available
	 * @param   object  &$params  The article params
	 * @param   int     $page     The 'page' number
	 *
	 * @return void
	 *
	 * @since  3.7.0
	 */
	public function onContentPrepare($context, &$item, &$params, $page = 0)
	{
		// 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;
		}

		// Don't run if there is no text property (in case of bad calls) or it is empty
		if (empty($item->text))
		{
			return;
		}

		// Simple performance check to determine whether bot should process further
		if (strpos($item->text, 'field') === false)
		{
			return;
		}

		// Register FieldsHelper
		JLoader::register('FieldsHelper', JPATH_ADMINISTRATOR . '/components/com_fields/helpers/fields.php');

		// Prepare the text
		if (isset($item->text))
		{
			$item->text = $this->prepare($item->text, $context, $item);
		}

		// Prepare the intro text
		if (isset($item->introtext))
		{
			$item->introtext = $this->prepare($item->introtext, $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 (count($parts) < 2)
		{
			return $string;
		}

		$context    = $parts[0] . '.' . $parts[1];
		$fields     = FieldsHelper::getFields($context, $item, true);
		$fieldsById = array();
		$groups     = array();

		// 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,
						array(
							'item'    => $item,
							'context' => $context,
							'field'   => $fieldsById[$id]
						)
					);
				}
			}
			else
			{
				if ($match[2] === '*')
				{
					$match[0]     = str_replace('*', '\*', $match[0]);
					$renderFields = $fields;
				}
				else
				{
					$renderFields = isset($groups[$id]) ? $groups[$id] : '';
				}

				if ($renderFields)
				{
					$layout = !empty($explode[1]) ? trim($explode[1]) : 'render';
					$output = FieldsHelper::render(
						$context,
						'fields.' . $layout,
						array(
							'item'    => $item,
							'context' => $context,
							'fields'  => $renderFields
						)
					);
				}
			}

			$string = preg_replace("|$match[0]|", addcslashes($output, '\\$'), $string, 1);
		}

		return $string;
	}
}
field.php000060400000003262152455357510006353 0ustar00<?php
/**
 * @package         Regular Labs Library
 * @version         21.4.10972
 * 
 * @author          Peter van Westen <info@regularlabs.com>
 * @link            http://www.regularlabs.com
 * @copyright       Copyright © 2021 Regular Labs All Rights Reserved
 * @license         http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
 */

defined('_JEXEC') or die;

use Joomla\CMS\Factory as JFactory;
use Joomla\CMS\HTML\HTMLHelper as JHtml;
use Joomla\CMS\Language\Text as JText;

if ( ! is_file(JPATH_LIBRARIES . '/regularlabs/autoload.php'))
{
	return;
}

require_once JPATH_LIBRARIES . '/regularlabs/autoload.php';

class JFormFieldRL_Field extends \RegularLabs\Library\Field
{
	public $type = 'Field';

	protected function getInput()
	{
		$options = $this->getFields();

		return $this->selectListSimple($options, $this->name, $this->value, $this->id);
	}

	function getFields()
	{
		$db    = JFactory::getDbo();
		$query = $db->getQuery(true)
			->select('DISTINCT a.id, a.name, a.type, a.title')
			->from('#__fields AS a')
			->where('a.state = 1')
			->order('a.name');

		$db->setQuery($query);

		$fields = $db->loadObjectList();

		$options = [];

		$options[] = JHtml::_('select.option', '', '- ' . JText::_('RL_SELECT_FIELD') . ' -');

		foreach ($fields as &$field)
		{
			// Skip our own subfields type. We won't have subfields in subfields.
			if ($field->type == 'subfields' || $field->type == 'repeatable')
			{
				continue;
			}

			$options[] = JHtml::_('select.option', $field->name, ($field->title . ' (' . $field->type . ')'));
		}

		if ($this->get('show_custom'))
		{
			$options[] = JHtml::_('select.option', 'custom', '- ' . JText::_('RL_CUSTOM') . ' -');
		}

		return $options;
	}
}
geo.php000060400000270140152455357510006043 0ustar00<?php
/**
 * @package         Regular Labs Library
 * @version         21.4.10972
 * 
 * @author          Peter van Westen <info@regularlabs.com>
 * @link            http://www.regularlabs.com
 * @copyright       Copyright © 2021 Regular Labs All Rights Reserved
 * @license         http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
 */

defined('_JEXEC') or die;

use Joomla\CMS\HTML\HTMLHelper as JHtml;
use Joomla\Registry\Registry;
use RegularLabs\Library\Form as RL_Form;
use RegularLabs\Library\RegEx as RL_RegEx;

if ( ! is_file(JPATH_LIBRARIES . '/regularlabs/autoload.php'))
{
	return;
}

require_once JPATH_LIBRARIES . '/regularlabs/autoload.php';

class JFormFieldRL_Geo extends \RegularLabs\Library\Field
{
	public $type = 'Geo';

	protected function getInput()
	{

		if ( ! is_array($this->value))
		{
			$this->value = explode(',', $this->value);
		}

		$size      = (int) $this->get('size');
		$multiple  = $this->get('multiple');
		$group     = $this->get('group', 'countries');
		$use_names = $this->get('use_names', false);

		return $this->selectListSimpleAjax(
			$this->type, $this->name, $this->value, $this->id,
			compact('size', 'multiple', 'group', 'use_names')
		);
	}

	function getAjaxRaw(Registry $attributes)
	{
		$name  = $attributes->get('name', $this->type);
		$id    = $attributes->get('id', strtolower($name));
		$value = $attributes->get('value', []);
		$size  = $attributes->get('size');

		$options = $this->getOptions(
			$attributes->get('group', 'countries'),
			(bool) $attributes->get('use_names', false)
		);

		return $this->selectListSimple($options, $name, $value, $id, $size, true);
	}

	function getOptions($group = 'countries', $use_names = '')
	{
		$options = [];
		foreach ($this->{$group} as $key => $val)
		{
			if ( ! $val)
			{
				$options[] = JHtml::_('select.option', '-', '&nbsp;', 'value', 'text', true);
				continue;
			}

			if ($key[0] == '-')
			{
				$options[] = JHtml::_('select.option', '-', $val, 'value', 'text', true);
				continue;
			}

			$val       = RL_Form::prepareSelectItem($val);
			$options[] = JHtml::_('select.option', $use_names ? $val : $key, $val);
		}

		return $options;
	}

	public $continents = [
		'AF' => 'Africa',
		'AS' => 'Asia',
		'EU' => 'Europe',
		'NA' => 'North America',
		'SA' => 'South America',
		'OC' => 'Oceania',
		'AN' => 'Antarctica',
	];

	public $countries = [
		'AF' => "Afghanistan",
		'AX' => "Aland Islands",
		'AL' => "Albania",
		'DZ' => "Algeria",
		'AS' => "American Samoa",
		'AD' => "Andorra",
		'AO' => "Angola",
		'AI' => "Anguilla",
		'AQ' => "Antarctica",
		'AG' => "Antigua and Barbuda",
		'AR' => "Argentina",
		'AM' => "Armenia",
		'AW' => "Aruba",
		'AU' => "Australia",
		'AT' => "Austria",
		'AZ' => "Azerbaijan",
		'BS' => "Bahamas",
		'BH' => "Bahrain",
		'BD' => "Bangladesh",
		'BB' => "Barbados",
		'BY' => "Belarus",
		'BE' => "Belgium",
		'BZ' => "Belize",
		'BJ' => "Benin",
		'BM' => "Bermuda",
		'BT' => "Bhutan",
		'BO' => "Bolivia",
		'BA' => "Bosnia and Herzegovina",
		'BW' => "Botswana",
		'BV' => "Bouvet Island",
		'BR' => "Brazil",
		'IO' => "British Indian Ocean Territory",
		'BN' => "Brunei Darussalam",
		'BG' => "Bulgaria",
		'BF' => "Burkina Faso",
		'BI' => "Burundi",
		'KH' => "Cambodia",
		'CM' => "Cameroon",
		'CA' => "Canada",
		'CV' => "Cape Verde",
		'KY' => "Cayman Islands",
		'CF' => "Central African Republic",
		'TD' => "Chad",
		'CL' => "Chile",
		'CN' => "China",
		'CX' => "Christmas Island",
		'CC' => "Cocos (Keeling) Islands",
		'CO' => "Colombia",
		'KM' => "Comoros",
		'CG' => "Congo",
		'CD' => "Congo, The Democratic Republic of the",
		'CK' => "Cook Islands",
		'CR' => "Costa Rica",
		'CI' => "Cote d'Ivoire",
		'HR' => "Croatia",
		'CU' => "Cuba",
		'CY' => "Cyprus",
		'CZ' => "Czech Republic",
		'DK' => "Denmark",
		'DJ' => "Djibouti",
		'DM' => "Dominica",
		'DO' => "Dominican Republic",
		'EC' => "Ecuador",
		'EG' => "Egypt",
		'SV' => "El Salvador",
		'GQ' => "Equatorial Guinea",
		'ER' => "Eritrea",
		'EE' => "Estonia",
		'ET' => "Ethiopia",
		'FK' => "Falkland Islands (Malvinas)",
		'FO' => "Faroe Islands",
		'FJ' => "Fiji",
		'FI' => "Finland",
		'FR' => "France",
		'GF' => "French Guiana",
		'PF' => "French Polynesia",
		'TF' => "French Southern Territories",
		'GA' => "Gabon",
		'GM' => "Gambia",
		'GE' => "Georgia",
		'DE' => "Germany",
		'GH' => "Ghana",
		'GI' => "Gibraltar",
		'GR' => "Greece",
		'GL' => "Greenland",
		'GD' => "Grenada",
		'GP' => "Guadeloupe",
		'GU' => "Guam",
		'GT' => "Guatemala",
		'GG' => "Guernsey",
		'GN' => "Guinea",
		'GW' => "Guinea-Bissau",
		'GY' => "Guyana",
		'HT' => "Haiti",
		'HM' => "Heard Island and McDonald Islands",
		'VA' => "Holy See (Vatican City State)",
		'HN' => "Honduras",
		'HK' => "Hong Kong",
		'HU' => "Hungary",
		'IS' => "Iceland",
		'IN' => "India",
		'ID' => "Indonesia",
		'IR' => "Iran, Islamic Republic of",
		'IQ' => "Iraq",
		'IE' => "Ireland",
		'IM' => "Isle of Man",
		'IL' => "Israel",
		'IT' => "Italy",
		'JM' => "Jamaica",
		'JP' => "Japan",
		'JE' => "Jersey",
		'JO' => "Jordan",
		'KZ' => "Kazakhstan",
		'KE' => "Kenya",
		'KI' => "Kiribati",
		'KP' => "Korea, Democratic People's Republic of",
		'KR' => "Korea, Republic of",
		'KW' => "Kuwait",
		'KG' => "Kyrgyzstan",
		'LA' => "Lao People's Democratic Republic",
		'LV' => "Latvia",
		'LB' => "Lebanon",
		'LS' => "Lesotho",
		'LR' => "Liberia",
		'LY' => "Libyan Arab Jamahiriya",
		'LI' => "Liechtenstein",
		'LT' => "Lithuania",
		'LU' => "Luxembourg",
		'MO' => "Macao",
		'MK' => "Macedonia",
		'MG' => "Madagascar",
		'MW' => "Malawi",
		'MY' => "Malaysia",
		'MV' => "Maldives",
		'ML' => "Mali",
		'MT' => "Malta",
		'MH' => "Marshall Islands",
		'MQ' => "Martinique",
		'MR' => "Mauritania",
		'MU' => "Mauritius",
		'YT' => "Mayotte",
		'MX' => "Mexico",
		'FM' => "Micronesia, Federated States of",
		'MD' => "Moldova, Republic of",
		'MC' => "Monaco",
		'MN' => "Mongolia",
		'ME' => "Montenegro",
		'MS' => "Montserrat",
		'MA' => "Morocco",
		'MZ' => "Mozambique",
		'MM' => "Myanmar",
		'NA' => "Namibia",
		'NR' => "Nauru",
		'NP' => "Nepal",
		'NL' => "Netherlands",
		'AN' => "Netherlands Antilles",
		'NC' => "New Caledonia",
		'NZ' => "New Zealand",
		'NI' => "Nicaragua",
		'NE' => "Niger",
		'NG' => "Nigeria",
		'NU' => "Niue",
		'NF' => "Norfolk Island",
		'MP' => "Northern Mariana Islands",
		'NO' => "Norway",
		'OM' => "Oman",
		'PK' => "Pakistan",
		'PW' => "Palau",
		'PS' => "Palestinian Territory",
		'PA' => "Panama",
		'PG' => "Papua New Guinea",
		'PY' => "Paraguay",
		'PE' => "Peru",
		'PH' => "Philippines",
		'PN' => "Pitcairn",
		'PL' => "Poland",
		'PT' => "Portugal",
		'PR' => "Puerto Rico",
		'QA' => "Qatar",
		'RE' => "Reunion",
		'RO' => "Romania",
		'RU' => "Russian Federation",
		'RW' => "Rwanda",
		'SH' => "Saint Helena",
		'KN' => "Saint Kitts and Nevis",
		'LC' => "Saint Lucia",
		'PM' => "Saint Pierre and Miquelon",
		'VC' => "Saint Vincent and the Grenadines",
		'WS' => "Samoa",
		'SM' => "San Marino",
		'ST' => "Sao Tome and Principe",
		'SA' => "Saudi Arabia",
		'SN' => "Senegal",
		'RS' => "Serbia",
		'SC' => "Seychelles",
		'SL' => "Sierra Leone",
		'SG' => "Singapore",
		'SK' => "Slovakia",
		'SI' => "Slovenia",
		'SB' => "Solomon Islands",
		'SO' => "Somalia",
		'ZA' => "South Africa",
		'GS' => "South Georgia and the South Sandwich Islands",
		'ES' => "Spain",
		'LK' => "Sri Lanka",
		'SD' => "Sudan",
		'SR' => "Suriname",
		'SJ' => "Svalbard and Jan Mayen",
		'SZ' => "Swaziland",
		'SE' => "Sweden",
		'CH' => "Switzerland",
		'SY' => "Syrian Arab Republic",
		'TW' => "Taiwan",
		'TJ' => "Tajikistan",
		'TZ' => "Tanzania, United Republic of",
		'TH' => "Thailand",
		'TL' => "Timor-Leste",
		'TG' => "Togo",
		'TK' => "Tokelau",
		'TO' => "Tonga",
		'TT' => "Trinidad and Tobago",
		'TN' => "Tunisia",
		'TR' => "Turkey",
		'TM' => "Turkmenistan",
		'TC' => "Turks and Caicos Islands",
		'TV' => "Tuvalu",
		'UG' => "Uganda",
		'UA' => "Ukraine",
		'AE' => "United Arab Emirates",
		'GB' => "United Kingdom",
		'US' => "United States",
		'UM' => "United States Minor Outlying Islands",
		'UY' => "Uruguay",
		'UZ' => "Uzbekistan",
		'VU' => "Vanuatu",
		'VE' => "Venezuela",
		'VN' => "Vietnam",
		'VG' => "Virgin Islands, British",
		'VI' => "Virgin Islands, U.S.",
		'WF' => "Wallis and Futuna",
		'EH' => "Western Sahara",
		'YE' => "Yemen",
		'ZM' => "Zambia",
		'ZW' => "Zimbabwe",
	];

	public $regions = [
		'-AU'    => "Australia",
		'AU-ACT' => "Australia: Australian Capital Territory",
		'AU-NSW' => "Australia: New South Wales",
		'AU-NT'  => "Australia: Northern Territory",
		'AU-QLD' => "Australia: Queensland",
		'AU-SA'  => "Australia: South Australia",
		'AU-TAS' => "Australia: Tasmania",
		'AU-VIC' => "Australia: Victoria",
		'AU-WA'  => "Australia: Western Australia",

		'--BE'   => "", '-BE' => "Belgium",
		'BE-VAN' => "Belgium: Antwerpen",
		'BE-WBR' => "Belgium: Brabant Wallon",
		'BE-BRU' => "Belgium: Brussels-Capital Region",
		'BE-WHT' => "Belgium: Hainaut",
		'BE-WLG' => "Belgium: Liege",
		'BE-VLI' => "Belgium: Limburg",
		'BE-WLX' => "Belgium: Luxembourg, Luxemburg",
		'BE-WNA' => "Belgium: Namur",
		'BE-VOV' => "Belgium: Oost-Vlaanderen",
		'BE-VBR' => "Belgium: Vlaams-Brabant",
		'BE-VWV' => "Belgium: West-Vlaanderen",

		'--BR'  => "", '-BR' => "Brazil",
		'BR-AC' => "Brazil: Acre",
		'BR-AL' => "Brazil: Alagoas",
		'BR-AP' => "Brazil: Amapá",
		'BR-AM' => "Brazil: Amazonas",
		'BR-BA' => "Brazil: Bahia",
		'BR-CE' => "Brazil: Ceará",
		'BR-DF' => "Brazil: Distrito Federal",
		'BR-ES' => "Brazil: Espírito Santo",
		'BR-FN' => "Brazil: Fernando de Noronha",
		'BR-GO' => "Brazil: Goiás",
		'BR-MA' => "Brazil: Maranhão",
		'BR-MT' => "Brazil: Mato Grosso",
		'BR-MS' => "Brazil: Mato Grosso do Sul",
		'BR-MG' => "Brazil: Minas Gerais",
		'BR-PR' => "Brazil: Paraná",
		'BR-PB' => "Brazil: Paraíba",
		'BR-PA' => "Brazil: Pará",
		'BR-PE' => "Brazil: Pernambuco",
		'BR-PI' => "Brazil: Piauí",
		'BR-RN' => "Brazil: Rio Grande do Norte",
		'BR-RS' => "Brazil: Rio Grande do Sul",
		'BR-RJ' => "Brazil: Rio de Janeiro",
		'BR-RO' => "Brazil: Rondônia",
		'BR-RR' => "Brazil: Roraima",
		'BR-SC' => "Brazil: Santa Catarina",
		'BR-SE' => "Brazil: Sergipe",
		'BR-SP' => "Brazil: São Paulo",
		'BR-TO' => "Brazil: Tocantins",

		'--BG'  => "", '-BG' => "Bulgaria",
		'BG-01' => "Bulgaria: Blagoevgrad",
		'BG-02' => "Bulgaria: Burgas",
		'BG-08' => "Bulgaria: Dobrich",
		'BG-07' => "Bulgaria: Gabrovo",
		'BG-26' => "Bulgaria: Haskovo",
		'BG-09' => "Bulgaria: Kardzhali",
		'BG-10' => "Bulgaria: Kyustendil",
		'BG-11' => "Bulgaria: Lovech",
		'BG-12' => "Bulgaria: Montana",
		'BG-13' => "Bulgaria: Pazardzhik",
		'BG-14' => "Bulgaria: Pernik",
		'BG-15' => "Bulgaria: Pleven",
		'BG-16' => "Bulgaria: Plovdiv",
		'BG-17' => "Bulgaria: Razgrad",
		'BG-18' => "Bulgaria: Ruse",
		'BG-27' => "Bulgaria: Shumen",
		'BG-19' => "Bulgaria: Silistra",
		'BG-20' => "Bulgaria: Sliven",
		'BG-21' => "Bulgaria: Smolyan",
		'BG-23' => "Bulgaria: Sofia",
		'BG-22' => "Bulgaria: Sofia-Grad",
		'BG-24' => "Bulgaria: Stara Zagora",
		'BG-25' => "Bulgaria: Targovishte",
		'BG-03' => "Bulgaria: Varna",
		'BG-04' => "Bulgaria: Veliko Tarnovo",
		'BG-05' => "Bulgaria: Vidin",
		'BG-06' => "Bulgaria: Vratsa",
		'BG-28' => "Bulgaria: Yambol",

		'--CA'  => "", '-CA' => "Canada",
		'CA-AB' => "Canada: Alberta",
		'CA-BC' => "Canada: British Columbia",
		'CA-MB' => "Canada: Manitoba",
		'CA-NB' => "Canada: New Brunswick",
		'CA-NL' => "Canada: Newfoundland and Labrador",
		'CA-NT' => "Canada: Northwest Territories",
		'CA-NS' => "Canada: Nova Scotia",
		'CA-NU' => "Canada: Nunavut",
		'CA-ON' => "Canada: Ontario",
		'CA-PE' => "Canada: Prince Edward Island",
		'CA-QC' => "Canada: Quebec",
		'CA-SK' => "Canada: Saskatchewan",
		'CA-YT' => "Canada: Yukon Territory",

		'--CN'  => "", '-CN' => "China",
		'CN-34' => "China: Anhui",
		'CN-92' => "China: Aomen (Macau)",
		'CN-11' => "China: Beijing",
		'CN-50' => "China: Chongqing",
		'CN-35' => "China: Fujian",
		'CN-62' => "China: Gansu",
		'CN-44' => "China: Guangdong",
		'CN-45' => "China: Guangxi",
		'CN-52' => "China: Guizhou",
		'CN-46' => "China: Hainan",
		'CN-13' => "China: Hebei",
		'CN-23' => "China: Heilongjiang",
		'CN-41' => "China: Henan",
		'CN-42' => "China: Hubei",
		'CN-43' => "China: Hunan",
		'CN-32' => "China: Jiangsu",
		'CN-36' => "China: Jiangxi",
		'CN-22' => "China: Jilin",
		'CN-21' => "China: Liaoning",
		'CN-15' => "China: Nei Mongol",
		'CN-64' => "China: Ningxia",
		'CN-63' => "China: Qinghai",
		'CN-61' => "China: Shaanxi",
		'CN-37' => "China: Shandong",
		'CN-31' => "China: Shanghai",
		'CN-14' => "China: Shanxi",
		'CN-51' => "China: Sichuan",
		'CN-71' => "China: Taiwan",
		'CN-12' => "China: Tianjin",
		'CN-91' => "China: Xianggang (Hong-Kong)",
		'CN-65' => "China: Xinjiang",
		'CN-54' => "China: Xizang",
		'CN-53' => "China: Yunnan",
		'CN-33' => "China: Zhejiang",

		'--CY'  => "", '-CY' => "Cyprus",
		'CY-04' => "Cyprus: Ammóchostos",
		'CY-06' => "Cyprus: Kerýneia",
		'CY-01' => "Cyprus: Lefkosía",
		'CY-02' => "Cyprus: Lemesós",
		'CY-03' => "Cyprus: Lárnaka",
		'CY-05' => "Cyprus: Páfos",

		'--CZ'   => "", '-CZ' => "Czech Republic",
		'CZ-201' => "Czech Republic: Benešov",
		'CZ-202' => "Czech Republic: Beroun",
		'CZ-621' => "Czech Republic: Blansko",
		'CZ-622' => "Czech Republic: Brno-město",
		'CZ-623' => "Czech Republic: Brno-venkov",
		'CZ-801' => "Czech Republic: Bruntál",
		'CZ-624' => "Czech Republic: Břeclav",
		'CZ-411' => "Czech Republic: Cheb",
		'CZ-422' => "Czech Republic: Chomutov",
		'CZ-531' => "Czech Republic: Chrudim",
		'CZ-321' => "Czech Republic: Domažlice",
		'CZ-421' => "Czech Republic: Děčín",
		'CZ-802' => "Czech Republic: Frýdek Místek",
		'CZ-611' => "Czech Republic: Havlíčkův Brod",
		'CZ-625' => "Czech Republic: Hodonín",
		'CZ-521' => "Czech Republic: Hradec Králové",
		'CZ-512' => "Czech Republic: Jablonec nad Nisou",
		'CZ-711' => "Czech Republic: Jeseník",
		'CZ-612' => "Czech Republic: Jihlava",
		'CZ-JM'  => "Czech Republic: Jihomoravský kraj",
		'CZ-JC'  => "Czech Republic: Jihočeský kraj",
		'CZ-313' => "Czech Republic: Jindřichův Hradec",
		'CZ-522' => "Czech Republic: Jičín",
		'CZ-KA'  => "Czech Republic: Karlovarský kraj",
		'CZ-412' => "Czech Republic: Karlovy Vary",
		'CZ-803' => "Czech Republic: Karviná",
		'CZ-203' => "Czech Republic: Kladno",
		'CZ-322' => "Czech Republic: Klatovy",
		'CZ-204' => "Czech Republic: Kolín",
		'CZ-721' => "Czech Republic: Kromĕříž",
		'CZ-KR'  => "Czech Republic: Královéhradecký kraj",
		'CZ-205' => "Czech Republic: Kutná Hora",
		'CZ-513' => "Czech Republic: Liberec",
		'CZ-LI'  => "Czech Republic: Liberecký kraj",
		'CZ-423' => "Czech Republic: Litoměřice",
		'CZ-424' => "Czech Republic: Louny",
		'CZ-207' => "Czech Republic: Mladá Boleslav",
		'CZ-MO'  => "Czech Republic: Moravskoslezský kraj",
		'CZ-425' => "Czech Republic: Most",
		'CZ-206' => "Czech Republic: Mělník",
		'CZ-804' => "Czech Republic: Nový Jičín",
		'CZ-208' => "Czech Republic: Nymburk",
		'CZ-523' => "Czech Republic: Náchod",
		'CZ-712' => "Czech Republic: Olomouc",
		'CZ-OL'  => "Czech Republic: Olomoucký kraj",
		'CZ-805' => "Czech Republic: Opava",
		'CZ-806' => "Czech Republic: Ostrava město",
		'CZ-532' => "Czech Republic: Pardubice",
		'CZ-PA'  => "Czech Republic: Pardubický kraj",
		'CZ-613' => "Czech Republic: Pelhřimov",
		'CZ-324' => "Czech Republic: Plzeň jih",
		'CZ-323' => "Czech Republic: Plzeň město",
		'CZ-325' => "Czech Republic: Plzeň sever",
		'CZ-PL'  => "Czech Republic: Plzeňský kraj",
		'CZ-315' => "Czech Republic: Prachatice",
		'CZ-101' => "Czech Republic: Praha 1",
		'CZ-10A' => "Czech Republic: Praha 10",
		'CZ-10B' => "Czech Republic: Praha 11",
		'CZ-10C' => "Czech Republic: Praha 12",
		'CZ-10D' => "Czech Republic: Praha 13",
		'CZ-10E' => "Czech Republic: Praha 14",
		'CZ-10F' => "Czech Republic: Praha 15",
		'CZ-102' => "Czech Republic: Praha 2",
		'CZ-103' => "Czech Republic: Praha 3",
		'CZ-104' => "Czech Republic: Praha 4",
		'CZ-105' => "Czech Republic: Praha 5",
		'CZ-106' => "Czech Republic: Praha 6",
		'CZ-107' => "Czech Republic: Praha 7",
		'CZ-108' => "Czech Republic: Praha 8",
		'CZ-109' => "Czech Republic: Praha 9",
		'CZ-209' => "Czech Republic: Praha východ",
		'CZ-20A' => "Czech Republic: Praha západ",
		'CZ-PR'  => "Czech Republic: Praha, hlavní město",
		'CZ-713' => "Czech Republic: Prostĕjov",
		'CZ-314' => "Czech Republic: Písek",
		'CZ-714' => "Czech Republic: Přerov",
		'CZ-20B' => "Czech Republic: Příbram",
		'CZ-20C' => "Czech Republic: Rakovník",
		'CZ-326' => "Czech Republic: Rokycany",
		'CZ-524' => "Czech Republic: Rychnov nad Kněžnou",
		'CZ-514' => "Czech Republic: Semily",
		'CZ-413' => "Czech Republic: Sokolov",
		'CZ-316' => "Czech Republic: Strakonice",
		'CZ-ST'  => "Czech Republic: Středočeský kraj",
		'CZ-533' => "Czech Republic: Svitavy",
		'CZ-327' => "Czech Republic: Tachov",
		'CZ-426' => "Czech Republic: Teplice",
		'CZ-525' => "Czech Republic: Trutnov",
		'CZ-317' => "Czech Republic: Tábor",
		'CZ-614' => "Czech Republic: Třebíč",
		'CZ-722' => "Czech Republic: Uherské Hradištĕ",
		'CZ-723' => "Czech Republic: Vsetín",
		'CZ-VY'  => "Czech Republic: Vysočina",
		'CZ-626' => "Czech Republic: Vyškov",
		'CZ-724' => "Czech Republic: Zlín",
		'CZ-ZL'  => "Czech Republic: Zlínský kraj",
		'CZ-627' => "Czech Republic: Znojmo",
		'CZ-US'  => "Czech Republic: Ústecký kraj",
		'CZ-427' => "Czech Republic: Ústí nad Labem",
		'CZ-534' => "Czech Republic: Ústí nad Orlicí",
		'CZ-511' => "Czech Republic: Česká Lípa",
		'CZ-311' => "Czech Republic: České Budějovice",
		'CZ-312' => "Czech Republic: Český Krumlov",
		'CZ-715' => "Czech Republic: Šumperk",
		'CZ-615' => "Czech Republic: Žd’ár nad Sázavou",

		'--DK'  => "", '-DK' => "Denmark",
		'DK-84' => "Denmark: Hovedstaden",
		'DK-82' => "Denmark: Midtjylland",
		'DK-81' => "Denmark: Nordjylland",
		'DK-85' => "Denmark: Sjælland",
		'DK-83' => "Denmark: Syddanmark",

		'--EG'   => "", '-EG' => "Egypt",
		'EG-DK'  => "Egypt: Ad Daqahlīyah",
		'EG-BA'  => "Egypt: Al Bahr al Ahmar",
		'EG-BH'  => "Egypt: Al Buhayrah",
		'EG-FYM' => "Egypt: Al Fayyūm",
		'EG-GH'  => "Egypt: Al Gharbīyah",
		'EG-ALX' => "Egypt: Al Iskandarīyah",
		'EG-IS'  => "Egypt: Al Ismā`īlīyah",
		'EG-GZ'  => "Egypt: Al Jīzah",
		'EG-MN'  => "Egypt: Al Minyā",
		'EG-MNF' => "Egypt: Al Minūfīyah",
		'EG-KB'  => "Egypt: Al Qalyūbīyah",
		'EG-C'   => "Egypt: Al Qāhirah",
		'EG-WAD' => "Egypt: Al Wādī al Jadīd",
		'EG-SUZ' => "Egypt: As Suways",
		'EG-SU'  => "Egypt: As Sādis min Uktūbar",
		'EG-SHR' => "Egypt: Ash Sharqīyah",
		'EG-ASN' => "Egypt: Aswān",
		'EG-AST' => "Egypt: Asyūt",
		'EG-BNS' => "Egypt: Banī Suwayf",
		'EG-PTS' => "Egypt: Būr Sa`īd",
		'EG-DT'  => "Egypt: Dumyāt",
		'EG-JS'  => "Egypt: Janūb Sīnā'",
		'EG-KFS' => "Egypt: Kafr ash Shaykh",
		'EG-MT'  => "Egypt: Matrūh",
		'EG-KN'  => "Egypt: Qinā",
		'EG-SIN' => "Egypt: Shamal Sīnā'",
		'EG-SHG' => "Egypt: Sūhāj",
		'EG-HU'  => "Egypt: Ḩulwān",

		'--FR'  => "", '-FR' => "France",
		'FR-01' => "France: Ain",
		'FR-02' => "France: Aisne",
		'FR-03' => "France: Allier",
		'FR-06' => "France: Alpes-Maritimes",
		'FR-04' => "France: Alpes-de-Haute-Provence",
		'FR-A'  => "France: Alsace",
		'FR-B'  => "France: Aquitaine",
		'FR-08' => "France: Ardennes",
		'FR-07' => "France: Ardèche",
		'FR-09' => "France: Ariège",
		'FR-10' => "France: Aube",
		'FR-11' => "France: Aude",
		'FR-C'  => "France: Auvergne",
		'FR-12' => "France: Aveyron",
		'FR-67' => "France: Bas-Rhin",
		'FR-P'  => "France: Basse-Normandie",
		'FR-13' => "France: Bouches-du-Rhône",
		'FR-D'  => "France: Bourgogne",
		'FR-E'  => "France: Bretagne",
		'FR-14' => "France: Calvados",
		'FR-15' => "France: Cantal",
		'FR-F'  => "France: Centre",
		'FR-G'  => "France: Champagne-Ardenne",
		'FR-16' => "France: Charente",
		'FR-17' => "France: Charente-Maritime",
		'FR-18' => "France: Cher",
		'FR-CP' => "France: Clipperton",
		'FR-19' => "France: Corrèze",
		'FR-H'  => "France: Corse",
		'FR-2A' => "France: Corse-du-Sud",
		'FR-23' => "France: Creuse",
		'FR-21' => "France: Côte-d'Or",
		'FR-22' => "France: Côtes-d'Armor",
		'FR-79' => "France: Deux-Sèvres",
		'FR-24' => "France: Dordogne",
		'FR-25' => "France: Doubs",
		'FR-26' => "France: Drôme",
		'FR-91' => "France: Essonne",
		'FR-27' => "France: Eure",
		'FR-28' => "France: Eure-et-Loir",
		'FR-29' => "France: Finistère",
		'FR-I'  => "France: Franche-Comté",
		'FR-30' => "France: Gard",
		'FR-32' => "France: Gers",
		'FR-33' => "France: Gironde",
		'FR-GP' => "France: Guadeloupe",
		'FR-GF' => "France: Guyane",
		'FR-68' => "France: Haut-Rhin",
		'FR-2B' => "France: Haute-Corse",
		'FR-31' => "France: Haute-Garonne",
		'FR-43' => "France: Haute-Loire",
		'FR-52' => "France: Haute-Marne",
		'FR-Q'  => "France: Haute-Normandie",
		'FR-74' => "France: Haute-Savoie",
		'FR-70' => "France: Haute-Saône",
		'FR-87' => "France: Haute-Vienne",
		'FR-05' => "France: Hautes-Alpes",
		'FR-65' => "France: Hautes-Pyrénées",
		'FR-92' => "France: Hauts-de-Seine",
		'FR-34' => "France: Hérault",
		'FR-35' => "France: Ille-et-Vilaine",
		'FR-36' => "France: Indre",
		'FR-37' => "France: Indre-et-Loire",
		'FR-38' => "France: Isère",
		'FR-39' => "France: Jura",
		'FR-40' => "France: Landes",
		'FR-K'  => "France: Languedoc-Roussillon",
		'FR-L'  => "France: Limousin",
		'FR-41' => "France: Loir-et-Cher",
		'FR-42' => "France: Loire",
		'FR-44' => "France: Loire-Atlantique",
		'FR-45' => "France: Loiret",
		'FR-M'  => "France: Lorraine",
		'FR-46' => "France: Lot",
		'FR-47' => "France: Lot-et-Garonne",
		'FR-48' => "France: Lozère",
		'FR-49' => "France: Maine-et-Loire",
		'FR-50' => "France: Manche",
		'FR-51' => "France: Marne",
		'FR-MQ' => "France: Martinique",
		'FR-53' => "France: Mayenne",
		'FR-YT' => "France: Mayotte",
		'FR-54' => "France: Meurthe-et-Moselle",
		'FR-55' => "France: Meuse",
		'FR-N'  => "France: Midi-Pyrénées",
		'FR-56' => "France: Morbihan",
		'FR-57' => "France: Moselle",
		'FR-58' => "France: Nièvre",
		'FR-59' => "France: Nord",
		'FR-O'  => "France: Nord - Pas-de-Calais",
		'FR-NC' => "France: Nouvelle-Calédonie",
		'FR-60' => "France: Oise",
		'FR-61' => "France: Orne",
		'FR-75' => "France: Paris",
		'FR-62' => "France: Pas-de-Calais",
		'FR-R'  => "France: Pays de la Loire",
		'FR-S'  => "France: Picardie",
		'FR-T'  => "France: Poitou-Charentes",
		'FR-PF' => "France: Polynésie française",
		'FR-U'  => "France: Provence-Alpes-Côte d'Azur",
		'FR-63' => "France: Puy-de-Dôme",
		'FR-64' => "France: Pyrénées-Atlantiques",
		'FR-66' => "France: Pyrénées-Orientales",
		'FR-69' => "France: Rhône",
		'FR-V'  => "France: Rhône-Alpes",
		'FR-RE' => "France: Réunion",
		'FR-BL' => "France: Saint-Barthélemy",
		'FR-MF' => "France: Saint-Martin",
		'FR-PM' => "France: Saint-Pierre-et-Miquelon",
		'FR-72' => "France: Sarthe",
		'FR-73' => "France: Savoie",
		'FR-71' => "France: Saône-et-Loire",
		'FR-76' => "France: Seine-Maritime",
		'FR-93' => "France: Seine-Saint-Denis",
		'FR-77' => "France: Seine-et-Marne",
		'FR-80' => "France: Somme",
		'FR-81' => "France: Tarn",
		'FR-82' => "France: Tarn-et-Garonne",
		'FR-TF' => "France: Terres australes françaises",
		'FR-90' => "France: Territoire de Belfort",
		'FR-95' => "France: Val d'Oise",
		'FR-94' => "France: Val-de-Marne",
		'FR-83' => "France: Var",
		'FR-84' => "France: Vaucluse",
		'FR-85' => "France: Vendée",
		'FR-86' => "France: Vienne",
		'FR-88' => "France: Vosges",
		'FR-WF' => "France: Wallis-et-Futuna",
		'FR-89' => "France: Yonne",
		'FR-78' => "France: Yvelines",
		'FR-J'  => "France: Île-de-France",

		'--DE'  => "", '-DE' => "Germany",
		'DE-BW' => "Germany: Baden-Württemberg",
		'DE-BY' => "Germany: Bayern",
		'DE-BE' => "Germany: Berlin",
		'DE-BB' => "Germany: Brandenburg",
		'DE-HB' => "Germany: Bremen",
		'DE-HH' => "Germany: Hamburg",
		'DE-HE' => "Germany: Hessen",
		'DE-MV' => "Germany: Mecklenburg-Vorpommern",
		'DE-NI' => "Germany: Niedersachsen",
		'DE-NW' => "Germany: Nordrhein-Westfalen",
		'DE-RP' => "Germany: Rheinland-Pfalz",
		'DE-SL' => "Germany: Saarland",
		'DE-SN' => "Germany: Sachsen",
		'DE-ST' => "Germany: Sachsen-Anhalt",
		'DE-SH' => "Germany: Schleswig-Holstein",
		'DE-TH' => "Germany: Thüringen",

		'--GR'  => "", '-GR' => "Greece",
		'GR-13' => "Greece: Achaïa",
		'GR-69' => "Greece: Agio Oros",
		'GR-01' => "Greece: Aitolia kai Akarnania",
		'GR-A'  => "Greece: Anatoliki Makedonia kai Thraki",
		'GR-11' => "Greece: Argolida",
		'GR-12' => "Greece: Arkadia",
		'GR-31' => "Greece: Arta",
		'GR-A1' => "Greece: Attiki",
		'GR-64' => "Greece: Chalkidiki",
		'GR-94' => "Greece: Chania",
		'GR-85' => "Greece: Chios",
		'GR-81' => "Greece: Dodekanisos",
		'GR-52' => "Greece: Drama",
		'GR-G'  => "Greece: Dytiki Ellada",
		'GR-C'  => "Greece: Dytiki Makedonia",
		'GR-71' => "Greece: Evros",
		'GR-05' => "Greece: Evrytania",
		'GR-04' => "Greece: Evvoias",
		'GR-63' => "Greece: Florina",
		'GR-07' => "Greece: Fokida",
		'GR-06' => "Greece: Fthiotida",
		'GR-51' => "Greece: Grevena",
		'GR-14' => "Greece: Ileia",
		'GR-53' => "Greece: Imathia",
		'GR-33' => "Greece: Ioannina",
		'GR-F'  => "Greece: Ionia Nisia",
		'GR-D'  => "Greece: Ipeiros",
		'GR-91' => "Greece: Irakleio",
		'GR-41' => "Greece: Karditsa",
		'GR-56' => "Greece: Kastoria",
		'GR-55' => "Greece: Kavala",
		'GR-23' => "Greece: Kefallonia",
		'GR-B'  => "Greece: Kentriki Makedonia",
		'GR-22' => "Greece: Kerkyra",
		'GR-57' => "Greece: Kilkis",
		'GR-15' => "Greece: Korinthia",
		'GR-58' => "Greece: Kozani",
		'GR-M'  => "Greece: Kriti",
		'GR-82' => "Greece: Kyklades",
		'GR-16' => "Greece: Lakonia",
		'GR-42' => "Greece: Larisa",
		'GR-92' => "Greece: Lasithi",
		'GR-24' => "Greece: Lefkada",
		'GR-83' => "Greece: Lesvos",
		'GR-43' => "Greece: Magnisia",
		'GR-17' => "Greece: Messinia",
		'GR-L'  => "Greece: Notio Aigaio",
		'GR-59' => "Greece: Pella",
		'GR-J'  => "Greece: Peloponnisos",
		'GR-61' => "Greece: Pieria",
		'GR-34' => "Greece: Preveza",
		'GR-93' => "Greece: Rethymno",
		'GR-73' => "Greece: Rodopi",
		'GR-84' => "Greece: Samos",
		'GR-62' => "Greece: Serres",
		'GR-H'  => "Greece: Sterea Ellada",
		'GR-32' => "Greece: Thesprotia",
		'GR-E'  => "Greece: Thessalia",
		'GR-54' => "Greece: Thessaloniki",
		'GR-44' => "Greece: Trikala",
		'GR-03' => "Greece: Voiotia",
		'GR-K'  => "Greece: Voreio Aigaio",
		'GR-72' => "Greece: Xanthi",
		'GR-21' => "Greece: Zakynthos",

		'--HU'  => "", '-HU' => "Hungary",
		'HU-BA' => "Hungary: Baranya",
		'HU-BZ' => "Hungary: Borsod-Abaúj-Zemplén",
		'HU-BU' => "Hungary: Budapest",
		'HU-BK' => "Hungary: Bács-Kiskun",
		'HU-BE' => "Hungary: Békés",
		'HU-BC' => "Hungary: Békéscsaba",
		'HU-CS' => "Hungary: Csongrád",
		'HU-DE' => "Hungary: Debrecen",
		'HU-DU' => "Hungary: Dunaújváros",
		'HU-EG' => "Hungary: Eger",
		'HU-FE' => "Hungary: Fejér",
		'HU-GY' => "Hungary: Győr",
		'HU-GS' => "Hungary: Győr-Moson-Sopron",
		'HU-HB' => "Hungary: Hajdú-Bihar",
		'HU-HE' => "Hungary: Heves",
		'HU-HV' => "Hungary: Hódmezővásárhely",
		'HU-JN' => "Hungary: Jász-Nagykun-Szolnok",
		'HU-KV' => "Hungary: Kaposvár",
		'HU-KM' => "Hungary: Kecskemét",
		'HU-KE' => "Hungary: Komárom-Esztergom",
		'HU-MI' => "Hungary: Miskolc",
		'HU-NK' => "Hungary: Nagykanizsa",
		'HU-NY' => "Hungary: Nyíregyháza",
		'HU-NO' => "Hungary: Nógrád",
		'HU-PE' => "Hungary: Pest",
		'HU-PS' => "Hungary: Pécs",
		'HU-ST' => "Hungary: Salgótarján",
		'HU-SO' => "Hungary: Somogy",
		'HU-SN' => "Hungary: Sopron",
		'HU-SZ' => "Hungary: Szabolcs-Szatmár-Bereg",
		'HU-SD' => "Hungary: Szeged",
		'HU-SS' => "Hungary: Szekszárd",
		'HU-SK' => "Hungary: Szolnok",
		'HU-SH' => "Hungary: Szombathely",
		'HU-SF' => "Hungary: Székesfehérvár",
		'HU-TB' => "Hungary: Tatabánya",
		'HU-TO' => "Hungary: Tolna",
		'HU-VA' => "Hungary: Vas",
		'HU-VM' => "Hungary: Veszprém",
		'HU-VE' => "Hungary: Veszprém (county)",
		'HU-ZA' => "Hungary: Zala",
		'HU-ZE' => "Hungary: Zalaegerszeg",
		'HU-ER' => "Hungary: Érd",

		'--IS' => "", '-IS' => "Iceland",
		'IS-7' => "Iceland: Austurland",
		'IS-1' => "Iceland: Höfuðborgarsvæðið",
		'IS-6' => "Iceland: Norðurland eystra",
		'IS-5' => "Iceland: Norðurland vestra",
		'IS-0' => "Iceland: Reykjavík",
		'IS-8' => "Iceland: Suðurland",
		'IS-2' => "Iceland: Suðurnes",
		'IS-4' => "Iceland: Vestfirðir",
		'IS-3' => "Iceland: Vesturland",

		'--IN'  => "", '-IN' => "India",
		'IN-AN' => "India: Andaman and Nicobar Islands",
		'IN-AP' => "India: Andhra Pradesh",
		'IN-AR' => "India: Arunāchal Pradesh",
		'IN-AS' => "India: Assam",
		'IN-BR' => "India: Bihār",
		'IN-CH' => "India: Chandīgarh",
		'IN-CT' => "India: Chhattīsgarh",
		'IN-DD' => "India: Damān and Diu",
		'IN-DL' => "India: Delhi",
		'IN-DN' => "India: Dādra and Nagar Haveli",
		'IN-GA' => "India: Goa",
		'IN-GJ' => "India: Gujarāt",
		'IN-HR' => "India: Haryāna",
		'IN-HP' => "India: Himāchal Pradesh",
		'IN-JK' => "India: Jammu and Kashmīr",
		'IN-JH' => "India: Jharkhand",
		'IN-KA' => "India: Karnātaka",
		'IN-KL' => "India: Kerala",
		'IN-LD' => "India: Lakshadweep",
		'IN-MP' => "India: Madhya Pradesh",
		'IN-MH' => "India: Mahārāshtra",
		'IN-MN' => "India: Manipur",
		'IN-ML' => "India: Meghālaya",
		'IN-MZ' => "India: Mizoram",
		'IN-NL' => "India: Nāgāland",
		'IN-OR' => "India: Orissa",
		'IN-PY' => "India: Pondicherry",
		'IN-PB' => "India: Punjab",
		'IN-RJ' => "India: Rājasthān",
		'IN-SK' => "India: Sikkim",
		'IN-TN' => "India: Tamil Nādu",
		'IN-TR' => "India: Tripura",
		'IN-UP' => "India: Uttar Pradesh",
		'IN-UL' => "India: Uttaranchal",
		'IN-WB' => "India: West Bengal",

		'--ID'  => "", '-ID' => "Indonesia",
		'ID-AC' => "Indonesia: Aceh",
		'ID-BA' => "Indonesia: Bali",
		'ID-BB' => "Indonesia: Bangka Belitung",
		'ID-BT' => "Indonesia: Banten",
		'ID-BE' => "Indonesia: Bengkulu",
		'ID-GO' => "Indonesia: Gorontalo",
		'ID-JK' => "Indonesia: Jakarta Raya",
		'ID-JA' => "Indonesia: Jambi",
		'ID-JW' => "Indonesia: Jawa",
		'ID-JB' => "Indonesia: Jawa Barat",
		'ID-JT' => "Indonesia: Jawa Tengah",
		'ID-JI' => "Indonesia: Jawa Timur",
		'ID-KA' => "Indonesia: Kalimantan",
		'ID-KB' => "Indonesia: Kalimantan Barat",
		'ID-KS' => "Indonesia: Kalimantan Selatan",
		'ID-KT' => "Indonesia: Kalimantan Tengah",
		'ID-KI' => "Indonesia: Kalimantan Timur",
		'ID-KR' => "Indonesia: Kepulauan Riau",
		'ID-LA' => "Indonesia: Lampung",
		'ID-MA' => "Indonesia: Maluku",
		'ID-MU' => "Indonesia: Maluku Utara",
		'ID-NU' => "Indonesia: Nusa Tenggara",
		'ID-NB' => "Indonesia: Nusa Tenggara Barat",
		'ID-NT' => "Indonesia: Nusa Tenggara Timur",
		'ID-PA' => "Indonesia: Papua",
		'ID-PB' => "Indonesia: Papua Barat",
		'ID-RI' => "Indonesia: Riau",
		'ID-SL' => "Indonesia: Sulawesi",
		'ID-SR' => "Indonesia: Sulawesi Barat",
		'ID-SN' => "Indonesia: Sulawesi Selatan",
		'ID-ST' => "Indonesia: Sulawesi Tengah",
		'ID-SG' => "Indonesia: Sulawesi Tenggara",
		'ID-SA' => "Indonesia: Sulawesi Utara",
		'ID-SM' => "Indonesia: Sumatera",
		'ID-SU' => "Indonesia: Sumatera Utara",
		'ID-SB' => "Indonesia: Sumatra Barat",
		'ID-SS' => "Indonesia: Sumatra Selatan",
		'ID-YO' => "Indonesia: Yogyakarta",

		'--IE'  => "", '-IE' => "Ireland",
		'IE-CW' => "Ireland: Carlow",
		'IE-CN' => "Ireland: Cavan",
		'IE-CE' => "Ireland: Clare",
		'IE-C'  => "Ireland: Connacht",
		'IE-C'  => "Ireland: Cork",
		'IE-DL' => "Ireland: Donegal",
		'IE-D'  => "Ireland: Dublin",
		'IE-G'  => "Ireland: Galway",
		'IE-KY' => "Ireland: Kerry",
		'IE-KE' => "Ireland: Kildare",
		'IE-KK' => "Ireland: Kilkenny",
		'IE-LS' => "Ireland: Laois",
		'IE-L'  => "Ireland: Leinster",
		'IE-LM' => "Ireland: Leitrim",
		'IE-LK' => "Ireland: Limerick",
		'IE-LD' => "Ireland: Longford",
		'IE-LH' => "Ireland: Louth",
		'IE-MO' => "Ireland: Mayo",
		'IE-MH' => "Ireland: Meath",
		'IE-MN' => "Ireland: Monaghan",
		'IE-M'  => "Ireland: Munster",
		'IE-OY' => "Ireland: Offaly",
		'IE-RN' => "Ireland: Roscommon",
		'IE-SO' => "Ireland: Sligo",
		'IE-TA' => "Ireland: Tipperary",
		'IE-U'  => "Ireland: Ulster",
		'IE-WD' => "Ireland: Waterford",
		'IE-WH' => "Ireland: Westmeath",
		'IE-WX' => "Ireland: Wexford",
		'IE-WW' => "Ireland: Wicklow",

		'--IL'  => "", '-IL' => "Israel",
		'IL-D'  => "Israel: HaDarom",
		'IL-M'  => "Israel: HaMerkaz",
		'IL-Z'  => "Israel: HaZafon",
		'IL-HA' => "Israel: Hefa",
		'IL-TA' => "Israel: Tel-Aviv",
		'IL-JM' => "Israel: Yerushalayim Al Quds",

		'--IT'  => "", '-IT' => "Italy",
		'IT-65' => "Italy: Abruzzo",
		'IT-AG' => "Italy: Agrigento",
		'IT-AL' => "Italy: Alessandria",
		'IT-AN' => "Italy: Ancona",
		'IT-AO' => "Italy: Aosta",
		'IT-AR' => "Italy: Arezzo",
		'IT-AP' => "Italy: Ascoli Piceno",
		'IT-AT' => "Italy: Asti",
		'IT-AV' => "Italy: Avellino",
		'IT-BA' => "Italy: Bari",
		'IT-BT' => "Italy: Barletta-Andria-Trani",
		'IT-77' => "Italy: Basilicata",
		'IT-BL' => "Italy: Belluno",
		'IT-BN' => "Italy: Benevento",
		'IT-BG' => "Italy: Bergamo",
		'IT-BI' => "Italy: Biella",
		'IT-BO' => "Italy: Bologna",
		'IT-BZ' => "Italy: Bolzano",
		'IT-BS' => "Italy: Brescia",
		'IT-BR' => "Italy: Brindisi",
		'IT-CA' => "Italy: Cagliari",
		'IT-78' => "Italy: Calabria",
		'IT-CL' => "Italy: Caltanissetta",
		'IT-72' => "Italy: Campania",
		'IT-CB' => "Italy: Campobasso",
		'IT-CI' => "Italy: Carbonia-Iglesias",
		'IT-CE' => "Italy: Caserta",
		'IT-CT' => "Italy: Catania",
		'IT-CZ' => "Italy: Catanzaro",
		'IT-CH' => "Italy: Chieti",
		'IT-CO' => "Italy: Como",
		'IT-CS' => "Italy: Cosenza",
		'IT-CR' => "Italy: Cremona",
		'IT-KR' => "Italy: Crotone",
		'IT-CN' => "Italy: Cuneo",
		'IT-45' => "Italy: Emilia-Romagna",
		'IT-EN' => "Italy: Enna",
		'IT-FM' => "Italy: Fermo",
		'IT-FE' => "Italy: Ferrara",
		'IT-FI' => "Italy: Firenze",
		'IT-FG' => "Italy: Foggia",
		'IT-FC' => "Italy: Forlì-Cesena",
		'IT-36' => "Italy: Friuli-Venezia Giulia",
		'IT-FR' => "Italy: Frosinone",
		'IT-GE' => "Italy: Genova",
		'IT-GO' => "Italy: Gorizia",
		'IT-GR' => "Italy: Grosseto",
		'IT-IM' => "Italy: Imperia",
		'IT-IS' => "Italy: Isernia",
		'IT-AQ' => "Italy: L'Aquila",
		'IT-SP' => "Italy: La Spezia",
		'IT-LT' => "Italy: Latina",
		'IT-62' => "Italy: Lazio",
		'IT-LE' => "Italy: Lecce",
		'IT-LC' => "Italy: Lecco",
		'IT-42' => "Italy: Liguria",
		'IT-LI' => "Italy: Livorno",
		'IT-LO' => "Italy: Lodi",
		'IT-25' => "Italy: Lombardia",
		'IT-LU' => "Italy: Lucca",
		'IT-MC' => "Italy: Macerata",
		'IT-MN' => "Italy: Mantova",
		'IT-57' => "Italy: Marche",
		'IT-MS' => "Italy: Massa-Carrara",
		'IT-MT' => "Italy: Matera",
		'IT-VS' => "Italy: Medio Campidano",
		'IT-ME' => "Italy: Messina",
		'IT-MI' => "Italy: Milano",
		'IT-MO' => "Italy: Modena",
		'IT-67' => "Italy: Molise",
		'IT-MB' => "Italy: Monza e Brianza",
		'IT-NA' => "Italy: Napoli",
		'IT-NO' => "Italy: Novara",
		'IT-NU' => "Italy: Nuoro",
		'IT-OG' => "Italy: Ogliastra",
		'IT-OT' => "Italy: Olbia-Tempio",
		'IT-OR' => "Italy: Oristano",
		'IT-PD' => "Italy: Padova",
		'IT-PA' => "Italy: Palermo",
		'IT-PR' => "Italy: Parma",
		'IT-PV' => "Italy: Pavia",
		'IT-PG' => "Italy: Perugia",
		'IT-PU' => "Italy: Pesaro e Urbino",
		'IT-PE' => "Italy: Pescara",
		'IT-PC' => "Italy: Piacenza",
		'IT-21' => "Italy: Piemonte",
		'IT-PI' => "Italy: Pisa",
		'IT-PT' => "Italy: Pistoia",
		'IT-PN' => "Italy: Pordenone",
		'IT-PZ' => "Italy: Potenza",
		'IT-PO' => "Italy: Prato",
		'IT-75' => "Italy: Puglia",
		'IT-RG' => "Italy: Ragusa",
		'IT-RA' => "Italy: Ravenna",
		'IT-RC' => "Italy: Reggio Calabria",
		'IT-RE' => "Italy: Reggio Emilia",
		'IT-RI' => "Italy: Rieti",
		'IT-RN' => "Italy: Rimini",
		'IT-RM' => "Italy: Roma",
		'IT-RO' => "Italy: Rovigo",
		'IT-SA' => "Italy: Salerno",
		'IT-88' => "Italy: Sardegna",
		'IT-SS' => "Italy: Sassari",
		'IT-SV' => "Italy: Savona",
		'IT-82' => "Italy: Sicilia",
		'IT-SI' => "Italy: Siena",
		'IT-SR' => "Italy: Siracusa",
		'IT-SO' => "Italy: Sondrio",
		'IT-TA' => "Italy: Taranto",
		'IT-TE' => "Italy: Teramo",
		'IT-TR' => "Italy: Terni",
		'IT-TO' => "Italy: Torino",
		'IT-52' => "Italy: Toscana",
		'IT-TP' => "Italy: Trapani",
		'IT-32' => "Italy: Trentino-Alto Adige",
		'IT-TN' => "Italy: Trento",
		'IT-TV' => "Italy: Treviso",
		'IT-TS' => "Italy: Trieste",
		'IT-UD' => "Italy: Udine",
		'IT-55' => "Italy: Umbria",
		'IT-23' => "Italy: Valle d'Aosta",
		'IT-VA' => "Italy: Varese",
		'IT-34' => "Italy: Veneto",
		'IT-VE' => "Italy: Venezia",
		'IT-VB' => "Italy: Verbano-Cusio-Ossola",
		'IT-VC' => "Italy: Vercelli",
		'IT-VR' => "Italy: Verona",
		'IT-VV' => "Italy: Vibo Valentia",
		'IT-VI' => "Italy: Vicenza",
		'IT-VT' => "Italy: Viterbo",

		'--JP'  => "", '-JP' => "Japan",
		'JP-23' => "Japan: Aichi",
		'JP-05' => "Japan: Akita",
		'JP-02' => "Japan: Aomori",
		'JP-12' => "Japan: Chiba",
		'JP-38' => "Japan: Ehime",
		'JP-18' => "Japan: Fukui",
		'JP-40' => "Japan: Fukuoka",
		'JP-07' => "Japan: Fukushima",
		'JP-21' => "Japan: Gifu",
		'JP-10' => "Japan: Gunma",
		'JP-34' => "Japan: Hiroshima",
		'JP-01' => "Japan: Hokkaido",
		'JP-28' => "Japan: Hyogo",
		'JP-08' => "Japan: Ibaraki",
		'JP-17' => "Japan: Ishikawa",
		'JP-03' => "Japan: Iwate",
		'JP-37' => "Japan: Kagawa",
		'JP-46' => "Japan: Kagoshima",
		'JP-14' => "Japan: Kanagawa",
		'JP-39' => "Japan: Kochi",
		'JP-43' => "Japan: Kumamoto",
		'JP-26' => "Japan: Kyoto",
		'JP-24' => "Japan: Mie",
		'JP-04' => "Japan: Miyagi",
		'JP-45' => "Japan: Miyazaki",
		'JP-20' => "Japan: Nagano",
		'JP-42' => "Japan: Nagasaki",
		'JP-29' => "Japan: Nara",
		'JP-15' => "Japan: Niigata",
		'JP-44' => "Japan: Oita",
		'JP-33' => "Japan: Okayama",
		'JP-47' => "Japan: Okinawa",
		'JP-27' => "Japan: Osaka",
		'JP-41' => "Japan: Saga",
		'JP-11' => "Japan: Saitama",
		'JP-25' => "Japan: Shiga",
		'JP-32' => "Japan: Shimane",
		'JP-22' => "Japan: Shizuoka",
		'JP-09' => "Japan: Tochigi",
		'JP-36' => "Japan: Tokushima",
		'JP-13' => "Japan: Tokyo",
		'JP-31' => "Japan: Tottori",
		'JP-16' => "Japan: Toyama",
		'JP-30' => "Japan: Wakayama",
		'JP-06' => "Japan: Yamagata",
		'JP-35' => "Japan: Yamaguchi",
		'JP-19' => "Japan: Yamanashi",

		'--MX'   => "", '-MX' => "Mexico",
		'MX-AGU' => "Mexico: Aguascalientes",
		'MX-BCN' => "Mexico: Baja California",
		'MX-BCS' => "Mexico: Baja California Sur",
		'MX-CAM' => "Mexico: Campeche",
		'MX-CHP' => "Mexico: Chiapas",
		'MX-CHH' => "Mexico: Chihuahua",
		'MX-COA' => "Mexico: Coahuila",
		'MX-COL' => "Mexico: Colima",
		'MX-DIF' => "Mexico: Distrito Federal (Mexico City)",
		'MX-DUR' => "Mexico: Durango",
		'MX-GUA' => "Mexico: Guanajuato",
		'MX-GRO' => "Mexico: Guerrero",
		'MX-HID' => "Mexico: Hidalgo",
		'MX-JAL' => "Mexico: Jalisco",
		'MX-MIC' => "Mexico: Michoacán",
		'MX-MOR' => "Mexico: Morelos",
		'MX-MEX' => "Mexico: México",
		'MX-NAY' => "Mexico: Nayarit",
		'MX-NLE' => "Mexico: Nuevo León",
		'MX-OAX' => "Mexico: Oaxaca",
		'MX-PUE' => "Mexico: Puebla",
		'MX-QUE' => "Mexico: Querétaro",
		'MX-ROO' => "Mexico: Quintana Roo",
		'MX-SLP' => "Mexico: San Luis Potosí",
		'MX-SIN' => "Mexico: Sinaloa",
		'MX-SON' => "Mexico: Sonora",
		'MX-TAB' => "Mexico: Tabasco",
		'MX-TAM' => "Mexico: Tamaulipas",
		'MX-TLA' => "Mexico: Tlaxcala",
		'MX-VER' => "Mexico: Veracruz",
		'MX-YUC' => "Mexico: Yucatán",
		'MX-ZAC' => "Mexico: Zacatecas",

		'--MA'   => "", '-MA' => "Morocco",
		'MA-AGD' => "Morocco: Agadir-Ida-Outanane",
		'MA-HAO' => "Morocco: Al Haouz",
		'MA-HOC' => "Morocco: Al Hoceïma",
		'MA-AOU' => "Morocco: Aousserd",
		'MA-ASZ' => "Morocco: Assa-Zag",
		'MA-AZI' => "Morocco: Azilal",
		'MA-BES' => "Morocco: Ben Slimane",
		'MA-BEM' => "Morocco: Beni Mellal",
		'MA-BER' => "Morocco: Berkane",
		'MA-BOD' => "Morocco: Boujdour (EH)",
		'MA-BOM' => "Morocco: Boulemane",
		'MA-CAS' => "Morocco: Casablanca [Dar el Beïda]",
		'MA-09'  => "Morocco: Chaouia-Ouardigha",
		'MA-CHE' => "Morocco: Chefchaouen",
		'MA-CHI' => "Morocco: Chichaoua",
		'MA-CHT' => "Morocco: Chtouka-Ait Baha",
		'MA-10'  => "Morocco: Doukhala-Abda",
		'MA-HAJ' => "Morocco: El Hajeb",
		'MA-JDI' => "Morocco: El Jadida",
		'MA-ERR' => "Morocco: Errachidia",
		'MA-ESM' => "Morocco: Es Smara (EH)",
		'MA-ESI' => "Morocco: Essaouira",
		'MA-FAH' => "Morocco: Fahs-Beni Makada",
		'MA-FIG' => "Morocco: Figuig",
		'MA-05'  => "Morocco: Fès-Boulemane",
		'MA-FES' => "Morocco: Fès-Dar-Dbibegh",
		'MA-02'  => "Morocco: Gharb-Chrarda-Beni Hssen",
		'MA-08'  => "Morocco: Grand Casablanca",
		'MA-GUE' => "Morocco: Guelmim",
		'MA-14'  => "Morocco: Guelmim-Es Smara",
		'MA-IFR' => "Morocco: Ifrane",
		'MA-INE' => "Morocco: Inezgane-Ait Melloul",
		'MA-JRA' => "Morocco: Jrada",
		'MA-KES' => "Morocco: Kelaat es Sraghna",
		'MA-KHE' => "Morocco: Khemisaet",
		'MA-KHN' => "Morocco: Khenifra",
		'MA-KHO' => "Morocco: Khouribga",
		'MA-KEN' => "Morocco: Kénitra",
		'MA-04'  => "Morocco: L'Oriental",
		'MA-LAR' => "Morocco: Larache",
		'MA-LAA' => "Morocco: Laâyoune (EH)",
		'MA-15'  => "Morocco: Laâyoune-Boujdour-Sakia el Hamra",
		'MA-MMD' => "Morocco: Marrakech-Medina",
		'MA-MMN' => "Morocco: Marrakech-Menara",
		'MA-11'  => "Morocco: Marrakech-Tensift-Al Haouz",
		'MA-MEK' => "Morocco: Meknès",
		'MA-06'  => "Morocco: Meknès-Tafilalet",
		'MA-MOH' => "Morocco: Mohammadia",
		'MA-MOU' => "Morocco: Moulay Yacoub",
		'MA-MED' => "Morocco: Médiouna",
		'MA-NAD' => "Morocco: Nador",
		'MA-NOU' => "Morocco: Nouaceur",
		'MA-OUA' => "Morocco: Ouarzazate",
		'MA-OUD' => "Morocco: Oued ed Dahab (EH)",
		'MA-16'  => "Morocco: Oued ed Dahab-Lagouira",
		'MA-OUJ' => "Morocco: Oujda-Angad",
		'MA-RAB' => "Morocco: Rabat",
		'MA-07'  => "Morocco: Rabat-Salé-Zemmour-Zaer",
		'MA-SAF' => "Morocco: Safi",
		'MA-SAL' => "Morocco: Salé",
		'MA-SEF' => "Morocco: Sefrou",
		'MA-SET' => "Morocco: Settat",
		'MA-SYB' => "Morocco: Sidi Youssef Ben Ali",
		'MA-SIK' => "Morocco: Sidl Kacem",
		'MA-SKH' => "Morocco: Skhirate-Témara",
		'MA-13'  => "Morocco: Sous-Massa-Draa",
		'MA-12'  => "Morocco: Tadla-Azilal",
		'MA-TNT' => "Morocco: Tan-Tan",
		'MA-TNG' => "Morocco: Tanger-Assilah",
		'MA-01'  => "Morocco: Tanger-Tétouan",
		'MA-TAO' => "Morocco: Taounate",
		'MA-TAI' => "Morocco: Taourirt",
		'MA-TAR' => "Morocco: Taroudant",
		'MA-TAT' => "Morocco: Tata",
		'MA-TAZ' => "Morocco: Taza",
		'MA-03'  => "Morocco: Taza-Al Hoceima-Taounate",
		'MA-TIZ' => "Morocco: Tiznit",
		'MA-TET' => "Morocco: Tétouan",
		'MA-ZAG' => "Morocco: Zagora",

		'--NL'  => "", '-NL' => "Netherlands",
		'NL-DR' => "Netherlands: Drenthe",
		'NL-FL' => "Netherlands: Flevoland",
		'NL-FR' => "Netherlands: Friesland",
		'NL-GE' => "Netherlands: Gelderland",
		'NL-GR' => "Netherlands: Groningen",
		'NL-LI' => "Netherlands: Limburg",
		'NL-NB' => "Netherlands: Noord-Brabant",
		'NL-NH' => "Netherlands: Noord-Holland",
		'NL-OV' => "Netherlands: Overijssel",
		'NL-UT' => "Netherlands: Utrecht",
		'NL-ZE' => "Netherlands: Zeeland",
		'NL-ZH' => "Netherlands: Zuid-Holland",

		'--NG'  => "", '-NG' => "Nigeria",
		'NG-AB' => "Nigeria: Abia",
		'NG-FC' => "Nigeria: Abuja Capital Territory",
		'NG-AD' => "Nigeria: Adamawa",
		'NG-AK' => "Nigeria: Akwa Ibom",
		'NG-AN' => "Nigeria: Anambra",
		'NG-BA' => "Nigeria: Bauchi",
		'NG-BY' => "Nigeria: Bayelsa",
		'NG-BE' => "Nigeria: Benue",
		'NG-BO' => "Nigeria: Borno",
		'NG-CR' => "Nigeria: Cross River",
		'NG-DE' => "Nigeria: Delta",
		'NG-EB' => "Nigeria: Ebonyi",
		'NG-ED' => "Nigeria: Edo",
		'NG-EK' => "Nigeria: Ekiti",
		'NG-EN' => "Nigeria: Enugu",
		'NG-GO' => "Nigeria: Gombe",
		'NG-IM' => "Nigeria: Imo",
		'NG-JI' => "Nigeria: Jigawa",
		'NG-KD' => "Nigeria: Kaduna",
		'NG-KN' => "Nigeria: Kano",
		'NG-KT' => "Nigeria: Katsina",
		'NG-KE' => "Nigeria: Kebbi",
		'NG-KO' => "Nigeria: Kogi",
		'NG-KW' => "Nigeria: Kwara",
		'NG-LA' => "Nigeria: Lagos",
		'NG-NA' => "Nigeria: Nassarawa",
		'NG-NI' => "Nigeria: Niger, Níger",
		'NG-OG' => "Nigeria: Ogun",
		'NG-ON' => "Nigeria: Ondo",
		'NG-OS' => "Nigeria: Osun",
		'NG-OY' => "Nigeria: Oyo",
		'NG-PL' => "Nigeria: Plateau",
		'NG-RI' => "Nigeria: Rivers",
		'NG-SO' => "Nigeria: Sokoto",
		'NG-TA' => "Nigeria: Taraba",
		'NG-YO' => "Nigeria: Yobe",
		'NG-ZA' => "Nigeria: Zamfara",

		'--NO'  => "", '-NO' => "Norway",
		'NO-02' => "Norway: Akershus",
		'NO-09' => "Norway: Aust-Agder",
		'NO-06' => "Norway: Buskerud",
		'NO-20' => "Norway: Finnmark",
		'NO-04' => "Norway: Hedmark",
		'NO-12' => "Norway: Hordaland",
		'NO-22' => "Norway: Jan Mayen",
		'NO-15' => "Norway: Møre og Romsdal",
		'NO-17' => "Norway: Nord-Trøndelag",
		'NO-18' => "Norway: Nordland",
		'NO-05' => "Norway: Oppland",
		'NO-03' => "Norway: Oslo",
		'NO-11' => "Norway: Rogaland",
		'NO-14' => "Norway: Sogn og Fjordane",
		'NO-21' => "Norway: Svalbard",
		'NO-16' => "Norway: Sør-Trøndelag",
		'NO-08' => "Norway: Telemark",
		'NO-19' => "Norway: Troms",
		'NO-10' => "Norway: Vest-Agder",
		'NO-07' => "Norway: Vestfold",
		'NO-01' => "Norway: Østfold",

		'--PH'   => "", '-PH' => "Philippines",
		'PH-ABR' => "Philippines: Abra",
		'PH-AGN' => "Philippines: Agusan del Norte",
		'PH-AGS' => "Philippines: Agusan del Sur",
		'PH-AKL' => "Philippines: Aklan",
		'PH-ALB' => "Philippines: Albay",
		'PH-ANT' => "Philippines: Antique",
		'PH-APA' => "Philippines: Apayao",
		'PH-AUR' => "Philippines: Aurora",
		'PH-14'  => "Philippines: Autonomous Region in Muslim Mindanao (ARMM)",
		'PH-BAS' => "Philippines: Basilan",
		'PH-BTN' => "Philippines: Batanes",
		'PH-BTG' => "Philippines: Batangas",
		'PH-BAN' => "Philippines: Batasn",
		'PH-BEN' => "Philippines: Benguet",
		'PH-05'  => "Philippines: Bicol (Region V)",
		'PH-BIL' => "Philippines: Biliran",
		'PH-BOH' => "Philippines: Bohol",
		'PH-BUK' => "Philippines: Bukidnon",
		'PH-BUL' => "Philippines: Bulacan",
		'PH-40'  => "Philippines: CALABARZON (Region IV-A)",
		'PH-CAG' => "Philippines: Cagayan",
		'PH-02'  => "Philippines: Cagayan Valley (Region II)",
		'PH-CAN' => "Philippines: Camarines Norte",
		'PH-CAS' => "Philippines: Camarines Sur",
		'PH-CAM' => "Philippines: Camiguin",
		'PH-CAP' => "Philippines: Capiz",
		'PH-13'  => "Philippines: Caraga (Region XIII)",
		'PH-CAT' => "Philippines: Catanduanes",
		'PH-CAV' => "Philippines: Cavite",
		'PH-CEB' => "Philippines: Cebu",
		'PH-03'  => "Philippines: Central Luzon (Region III)",
		'PH-07'  => "Philippines: Central Visayas (Region VII)",
		'PH-COM' => "Philippines: Compostela Valley",
		'PH-15'  => "Philippines: Cordillera Administrative Region (CAR)",
		'PH-11'  => "Philippines: Davao (Region XI)",
		'PH-DAO' => "Philippines: Davao Oriental",
		'PH-DAV' => "Philippines: Davao del Norte",
		'PH-DAS' => "Philippines: Davao del Sur",
		'PH-DIN' => "Philippines: Dinagat Islands",
		'PH-EAS' => "Philippines: Eastern Samar",
		'PH-08'  => "Philippines: Eastern Visayas (Region VIII)",
		'PH-GUI' => "Philippines: Guimaras",
		'PH-IFU' => "Philippines: Ifugao",
		'PH-01'  => "Philippines: Ilocos (Region I)",
		'PH-ILN' => "Philippines: Ilocos Norte",
		'PH-ILS' => "Philippines: Ilocos Sur",
		'PH-ILI' => "Philippines: Iloilo",
		'PH-ISA' => "Philippines: Isabela",
		'PH-KAL' => "Philippines: Kalinga-Apayso",
		'PH-LUN' => "Philippines: La Union",
		'PH-LAG' => "Philippines: Laguna",
		'PH-LAN' => "Philippines: Lanao del Norte",
		'PH-LAS' => "Philippines: Lanao del Sur",
		'PH-LEY' => "Philippines: Leyte",
		'PH-41'  => "Philippines: MIMAROPA (Region IV-B)",
		'PH-MAG' => "Philippines: Maguindanao",
		'PH-MAD' => "Philippines: Marinduque",
		'PH-MAS' => "Philippines: Masbate",
		'PH-MDC' => "Philippines: Mindoro Occidental",
		'PH-MDR' => "Philippines: Mindoro Oriental",
		'PH-MSC' => "Philippines: Misamis Occidental",
		'PH-MSR' => "Philippines: Misamis Oriental",
		'PH-MOU' => "Philippines: Mountain Province",
		'PH-00'  => "Philippines: National Capital Region",
		'PH-NEC' => "Philippines: Negroe Occidental",
		'PH-NER' => "Philippines: Negros Oriental",
		'PH-NCO' => "Philippines: North Cotabato",
		'PH-10'  => "Philippines: Northern Mindanao (Region X)",
		'PH-NSA' => "Philippines: Northern Samar",
		'PH-NUE' => "Philippines: Nueva Ecija",
		'PH-NUV' => "Philippines: Nueva Vizcaya",
		'PH-PLW' => "Philippines: Palawan",
		'PH-PAM' => "Philippines: Pampanga",
		'PH-PAN' => "Philippines: Pangasinan",
		'PH-QUE' => "Philippines: Quezon",
		'PH-QUI' => "Philippines: Quirino",
		'PH-RIZ' => "Philippines: Rizal",
		'PH-ROM' => "Philippines: Romblon",
		'PH-SAR' => "Philippines: Sarangani",
		'PH-SIG' => "Philippines: Siquijor",
		'PH-12'  => "Philippines: Soccsksargen (Region XII)",
		'PH-SOR' => "Philippines: Sorsogon",
		'PH-SCO' => "Philippines: South Cotabato",
		'PH-SLE' => "Philippines: Southern Leyte",
		'PH-SUK' => "Philippines: Sultan Kudarat",
		'PH-SLU' => "Philippines: Sulu",
		'PH-SUN' => "Philippines: Surigao del Norte",
		'PH-SUR' => "Philippines: Surigao del Sur",
		'PH-TAR' => "Philippines: Tarlac",
		'PH-TAW' => "Philippines: Tawi-Tawi",
		'PH-WSA' => "Philippines: Western Samar",
		'PH-06'  => "Philippines: Western Visayas (Region VI)",
		'PH-ZMB' => "Philippines: Zambales",
		'PH-09'  => "Philippines: Zamboanga Peninsula (Region IX)",
		'PH-ZSI' => "Philippines: Zamboanga Sibugay",
		'PH-ZAN' => "Philippines: Zamboanga del Norte",
		'PH-ZAS' => "Philippines: Zamboanga del Sur",

		'--PL'  => "", '-PL' => "Poland",
		'PL-DS' => "Poland: Dolnośląskie",
		'PL-KP' => "Poland: Kujawsko-pomorskie",
		'PL-LU' => "Poland: Lubelskie",
		'PL-LB' => "Poland: Lubuskie",
		'PL-MZ' => "Poland: Mazowieckie",
		'PL-MA' => "Poland: Małopolskie",
		'PL-OP' => "Poland: Opolskie",
		'PL-PK' => "Poland: Podkarpackie",
		'PL-PD' => "Poland: Podlaskie",
		'PL-PM' => "Poland: Pomorskie",
		'PL-WN' => "Poland: Warmińsko-mazurskie",
		'PL-WP' => "Poland: Wielkopolskie",
		'PL-ZP' => "Poland: Zachodniopomorskie",
		'PL-LD' => "Poland: Łódzkie",
		'PL-SL' => "Poland: Śląskie",
		'PL-SK' => "Poland: Świętokrzyskie",

		'--PT'  => "", '-PT' => "Portugal",
		'PT-01' => "Portugal: Aveiro",
		'PT-02' => "Portugal: Beja",
		'PT-03' => "Portugal: Braga",
		'PT-04' => "Portugal: Bragança",
		'PT-05' => "Portugal: Castelo Branco",
		'PT-06' => "Portugal: Coimbra",
		'PT-08' => "Portugal: Faro",
		'PT-09' => "Portugal: Guarda",
		'PT-10' => "Portugal: Leiria",
		'PT-11' => "Portugal: Lisboa",
		'PT-12' => "Portugal: Portalegre",
		'PT-13' => "Portugal: Porto",
		'PT-30' => "Portugal: Região Autónoma da Madeira",
		'PT-20' => "Portugal: Região Autónoma dos Açores",
		'PT-14' => "Portugal: Santarém",
		'PT-15' => "Portugal: Setúbal",
		'PT-16' => "Portugal: Viana do Castelo",
		'PT-17' => "Portugal: Vila Real",
		'PT-18' => "Portugal: Viseu",
		'PT-07' => "Portugal: Évora",

		'--RO'  => "", '-RO' => "Romania",
		'RO-AB' => "Romania: Alba",
		'RO-AR' => "Romania: Arad",
		'RO-AG' => "Romania: Argeș",
		'RO-BC' => "Romania: Bacău",
		'RO-BH' => "Romania: Bihor",
		'RO-BN' => "Romania: Bistrița-Năsăud",
		'RO-BT' => "Romania: Botoșani",
		'RO-BV' => "Romania: Brașov",
		'RO-BR' => "Romania: Brăila",
		'RO-B'  => "Romania: București",
		'RO-BZ' => "Romania: Buzău",
		'RO-CS' => "Romania: Caraș-Severin",
		'RO-CJ' => "Romania: Cluj",
		'RO-CT' => "Romania: Constanța",
		'RO-CV' => "Romania: Covasna",
		'RO-CL' => "Romania: Călărași",
		'RO-DJ' => "Romania: Dolj",
		'RO-DB' => "Romania: Dâmbovița",
		'RO-GL' => "Romania: Galați",
		'RO-GR' => "Romania: Giurgiu",
		'RO-GJ' => "Romania: Gorj",
		'RO-HR' => "Romania: Harghita",
		'RO-HD' => "Romania: Hunedoara",
		'RO-IL' => "Romania: Ialomița",
		'RO-IS' => "Romania: Iași",
		'RO-IF' => "Romania: Ilfov",
		'RO-MM' => "Romania: Maramureș",
		'RO-MH' => "Romania: Mehedinți",
		'RO-MS' => "Romania: Mureș",
		'RO-NT' => "Romania: Neamț",
		'RO-OT' => "Romania: Olt",
		'RO-PH' => "Romania: Prahova",
		'RO-SM' => "Romania: Satu Mare",
		'RO-SB' => "Romania: Sibiu",
		'RO-SV' => "Romania: Suceava",
		'RO-SJ' => "Romania: Sălaj",
		'RO-TR' => "Romania: Teleorman",
		'RO-TM' => "Romania: Timiș",
		'RO-TL' => "Romania: Tulcea",
		'RO-VS' => "Romania: Vaslui",
		'RO-VN' => "Romania: Vrancea",
		'RO-VL' => "Romania: Vâlcea",

		'--RU'   => "", '-RU' => "Russian Federation",
		'RU-AD'  => "Russian Federation: Adygeya, Respublika",
		'RU-AL'  => "Russian Federation: Altay, Respublika",
		'RU-ALT' => "Russian Federation: Altayskiy kray",
		'RU-AMU' => "Russian Federation: Amurskaya oblast'",
		'RU-ARK' => "Russian Federation: Arkhangel'skaya oblast'",
		'RU-AST' => "Russian Federation: Astrakhanskaya oblast'",
		'RU-BA'  => "Russian Federation: Bashkortostan, Respublika",
		'RU-BEL' => "Russian Federation: Belgorodskaya oblast'",
		'RU-BRY' => "Russian Federation: Bryanskaya oblast'",
		'RU-BU'  => "Russian Federation: Buryatiya, Respublika",
		'RU-CE'  => "Russian Federation: Chechenskaya Respublika",
		'RU-CHE' => "Russian Federation: Chelyabinskaya oblast'",
		'RU-CHU' => "Russian Federation: Chukotskiy avtonomnyy okrug",
		'RU-CU'  => "Russian Federation: Chuvashskaya Respublika",
		'RU-DA'  => "Russian Federation: Dagestan, Respublika",
		'RU-IRK' => "Russian Federation: Irkutiskaya oblast'",
		'RU-IVA' => "Russian Federation: Ivanovskaya oblast'",
		'RU-KB'  => "Russian Federation: Kabardino-Balkarskaya Respublika",
		'RU-KGD' => "Russian Federation: Kaliningradskaya oblast'",
		'RU-KL'  => "Russian Federation: Kalmykiya, Respublika",
		'RU-KLU' => "Russian Federation: Kaluzhskaya oblast'",
		'RU-KAM' => "Russian Federation: Kamchatskiy kray",
		'RU-KC'  => "Russian Federation: Karachayevo-Cherkesskaya Respublika",
		'RU-KR'  => "Russian Federation: Kareliya, Respublika",
		'RU-KEM' => "Russian Federation: Kemerovskaya oblast'",
		'RU-KHA' => "Russian Federation: Khabarovskiy kray",
		'RU-KK'  => "Russian Federation: Khakasiya, Respublika",
		'RU-KHM' => "Russian Federation: Khanty-Mansiysky avtonomnyy okrug-Yugra",
		'RU-KIR' => "Russian Federation: Kirovskaya oblast'",
		'RU-KO'  => "Russian Federation: Komi, Respublika",
		'RU-KOS' => "Russian Federation: Kostromskaya oblast'",
		'RU-KDA' => "Russian Federation: Krasnodarskiy kray",
		'RU-KYA' => "Russian Federation: Krasnoyarskiy kray",
		'RU-KGN' => "Russian Federation: Kurganskaya oblast'",
		'RU-KRS' => "Russian Federation: Kurskaya oblast'",
		'RU-LEN' => "Russian Federation: Leningradskaya oblast'",
		'RU-LIP' => "Russian Federation: Lipetskaya oblast'",
		'RU-MAG' => "Russian Federation: Magadanskaya oblast'",
		'RU-ME'  => "Russian Federation: Mariy El, Respublika",
		'RU-MO'  => "Russian Federation: Mordoviya, Respublika",
		'RU-MOS' => "Russian Federation: Moskovskaya oblast'",
		'RU-MOW' => "Russian Federation: Moskva",
		'RU-MUR' => "Russian Federation: Murmanskaya oblast'",
		'RU-NEN' => "Russian Federation: Nenetskiy avtonomnyy okrug",
		'RU-NIZ' => "Russian Federation: Nizhegorodskaya oblast'",
		'RU-NGR' => "Russian Federation: Novgorodskaya oblast'",
		'RU-NVS' => "Russian Federation: Novosibirskaya oblast'",
		'RU-OMS' => "Russian Federation: Omskaya oblast'",
		'RU-ORE' => "Russian Federation: Orenburgskaya oblast'",
		'RU-ORL' => "Russian Federation: Orlovskaya oblast'",
		'RU-PNZ' => "Russian Federation: Penzenskaya oblast'",
		'RU-PER' => "Russian Federation: Permskiy kray",
		'RU-PRI' => "Russian Federation: Primorskiy kray",
		'RU-PSK' => "Russian Federation: Pskovskaya oblast'",
		'RU-IN'  => "Russian Federation: Respublika Ingushetiya",
		'RU-ROS' => "Russian Federation: Rostovskaya oblast'",
		'RU-RYA' => "Russian Federation: Ryazanskaya oblast'",
		'RU-SA'  => "Russian Federation: Sakha, Respublika [Yakutiya]",
		'RU-SAK' => "Russian Federation: Sakhalinskaya oblast'",
		'RU-SAM' => "Russian Federation: Samaraskaya oblast'",
		'RU-SPE' => "Russian Federation: Sankt-Peterburg",
		'RU-SAR' => "Russian Federation: Saratovskaya oblast'",
		'RU-SE'  => "Russian Federation: Severnaya Osetiya-Alaniya, Respublika",
		'RU-SMO' => "Russian Federation: Smolenskaya oblast'",
		'RU-STA' => "Russian Federation: Stavropol'skiy kray",
		'RU-SVE' => "Russian Federation: Sverdlovskaya oblast'",
		'RU-TAM' => "Russian Federation: Tambovskaya oblast'",
		'RU-TA'  => "Russian Federation: Tatarstan, Respublika",
		'RU-TOM' => "Russian Federation: Tomskaya oblast'",
		'RU-TUL' => "Russian Federation: Tul'skaya oblast'",
		'RU-TVE' => "Russian Federation: Tverskaya oblast'",
		'RU-TYU' => "Russian Federation: Tyumenskaya oblast'",
		'RU-TY'  => "Russian Federation: Tyva, Respublika [Tuva]",
		'RU-UD'  => "Russian Federation: Udmurtskaya Respublika",
		'RU-ULY' => "Russian Federation: Ul'yanovskaya oblast'",
		'RU-VLA' => "Russian Federation: Vladimirskaya oblast'",
		'RU-VGG' => "Russian Federation: Volgogradskaya oblast'",
		'RU-VLG' => "Russian Federation: Vologodskaya oblast'",
		'RU-VOR' => "Russian Federation: Voronezhskaya oblast'",
		'RU-YAN' => "Russian Federation: Yamalo-Nenetskiy avtonomnyy okrug",
		'RU-YAR' => "Russian Federation: Yaroslavskaya oblast'",
		'RU-YEV' => "Russian Federation: Yevreyskaya avtonomnaya oblast'",
		'RU-ZAB' => "Russian Federation: Zabajkal'skij kraj",

		'--SK'  => "", '-SK' => "Slovakia",
		'SK-BC' => "Slovakia: Banskobystrický kraj",
		'SK-BL' => "Slovakia: Bratislavský kraj",
		'SK-KI' => "Slovakia: Košický kraj",
		'SK-NI' => "Slovakia: Nitriansky kraj",
		'SK-PV' => "Slovakia: Prešovský kraj",
		'SK-TC' => "Slovakia: Trenčiansky kraj",
		'SK-TA' => "Slovakia: Trnavský kraj",
		'SK-ZI' => "Slovakia: Žilinský kraj",

		'--SI'   => "", '-SI' => "Slovenia",
		'SI-001' => "Slovenia: Ajdovščina",
		'SI-195' => "Slovenia: Apače",
		'SI-002' => "Slovenia: Beltinci",
		'SI-148' => "Slovenia: Benedikt",
		'SI-149' => "Slovenia: Bistrica ob Sotli",
		'SI-003' => "Slovenia: Bled",
		'SI-150' => "Slovenia: Bloke",
		'SI-004' => "Slovenia: Bohinj",
		'SI-005' => "Slovenia: Borovnica",
		'SI-006' => "Slovenia: Bovec",
		'SI-151' => "Slovenia: Braslovče",
		'SI-007' => "Slovenia: Brda",
		'SI-008' => "Slovenia: Brezovica",
		'SI-009' => "Slovenia: Brežice",
		'SI-152' => "Slovenia: Cankova",
		'SI-011' => "Slovenia: Celje",
		'SI-012' => "Slovenia: Cerklje na Gorenjskem",
		'SI-013' => "Slovenia: Cerknica",
		'SI-014' => "Slovenia: Cerkno",
		'SI-153' => "Slovenia: Cerkvenjak",
		'SI-196' => "Slovenia: Cirkulane",
		'SI-018' => "Slovenia: Destrnik",
		'SI-019' => "Slovenia: Divača",
		'SI-154' => "Slovenia: Dobje",
		'SI-020' => "Slovenia: Dobrepolje",
		'SI-155' => "Slovenia: Dobrna",
		'SI-021' => "Slovenia: Dobrova-Polhov Gradec",
		'SI-156' => "Slovenia: Dobrovnik/Dobronak",
		'SI-022' => "Slovenia: Dol pri Ljubljani",
		'SI-157' => "Slovenia: Dolenjske Toplice",
		'SI-023' => "Slovenia: Domžale",
		'SI-024' => "Slovenia: Dornava",
		'SI-025' => "Slovenia: Dravograd",
		'SI-026' => "Slovenia: Duplek",
		'SI-027' => "Slovenia: Gorenja vas-Poljane",
		'SI-028' => "Slovenia: Gorišnica",
		'SI-207' => "Slovenia: Gorje",
		'SI-029' => "Slovenia: Gornja Radgona",
		'SI-030' => "Slovenia: Gornji Grad",
		'SI-031' => "Slovenia: Gornji Petrovci",
		'SI-158' => "Slovenia: Grad",
		'SI-032' => "Slovenia: Grosuplje",
		'SI-159' => "Slovenia: Hajdina",
		'SI-161' => "Slovenia: Hodoš/Hodos",
		'SI-162' => "Slovenia: Horjul",
		'SI-160' => "Slovenia: Hoče-Slivnica",
		'SI-034' => "Slovenia: Hrastnik",
		'SI-035' => "Slovenia: Hrpelje-Kozina",
		'SI-036' => "Slovenia: Idrija",
		'SI-037' => "Slovenia: Ig",
		'SI-038' => "Slovenia: Ilirska Bistrica",
		'SI-039' => "Slovenia: Ivančna Gorica",
		'SI-040' => "Slovenia: Izola/Isola",
		'SI-041' => "Slovenia: Jesenice",
		'SI-163' => "Slovenia: Jezersko",
		'SI-042' => "Slovenia: Juršinci",
		'SI-043' => "Slovenia: Kamnik",
		'SI-044' => "Slovenia: Kanal",
		'SI-045' => "Slovenia: Kidričevo",
		'SI-046' => "Slovenia: Kobarid",
		'SI-047' => "Slovenia: Kobilje",
		'SI-049' => "Slovenia: Komen",
		'SI-164' => "Slovenia: Komenda",
		'SI-050' => "Slovenia: Koper/Capodistria",
		'SI-197' => "Slovenia: Kosanjevica na Krki",
		'SI-165' => "Slovenia: Kostel",
		'SI-051' => "Slovenia: Kozje",
		'SI-048' => "Slovenia: Kočevje",
		'SI-052' => "Slovenia: Kranj",
		'SI-053' => "Slovenia: Kranjska Gora",
		'SI-166' => "Slovenia: Križevci",
		'SI-054' => "Slovenia: Krško",
		'SI-055' => "Slovenia: Kungota",
		'SI-056' => "Slovenia: Kuzma",
		'SI-057' => "Slovenia: Laško",
		'SI-058' => "Slovenia: Lenart",
		'SI-059' => "Slovenia: Lendava/Lendva",
		'SI-060' => "Slovenia: Litija",
		'SI-061' => "Slovenia: Ljubljana",
		'SI-062' => "Slovenia: Ljubno",
		'SI-063' => "Slovenia: Ljutomer",
		'SI-208' => "Slovenia: Log-Dragomer",
		'SI-064' => "Slovenia: Logatec",
		'SI-167' => "Slovenia: Lovrenc na Pohorju",
		'SI-065' => "Slovenia: Loška dolina",
		'SI-066' => "Slovenia: Loški Potok",
		'SI-068' => "Slovenia: Lukovica",
		'SI-067' => "Slovenia: Luče",
		'SI-069' => "Slovenia: Majšperk",
		'SI-198' => "Slovenia: Makole",
		'SI-070' => "Slovenia: Maribor",
		'SI-168' => "Slovenia: Markovci",
		'SI-071' => "Slovenia: Medvode",
		'SI-072' => "Slovenia: Mengeš",
		'SI-073' => "Slovenia: Metlika",
		'SI-074' => "Slovenia: Mežica",
		'SI-169' => "Slovenia: Miklavž na Dravskem polju",
		'SI-075' => "Slovenia: Miren-Kostanjevica",
		'SI-170' => "Slovenia: Mirna Peč",
		'SI-076' => "Slovenia: Mislinja",
		'SI-199' => "Slovenia: Mokronog-Trebelno",
		'SI-078' => "Slovenia: Moravske Toplice",
		'SI-077' => "Slovenia: Moravče",
		'SI-079' => "Slovenia: Mozirje",
		'SI-080' => "Slovenia: Murska Sobota",
		'SI-081' => "Slovenia: Muta",
		'SI-082' => "Slovenia: Naklo",
		'SI-083' => "Slovenia: Nazarje",
		'SI-084' => "Slovenia: Nova Gorica",
		'SI-085' => "Slovenia: Novo mesto",
		'SI-086' => "Slovenia: Odranci",
		'SI-171' => "Slovenia: Oplotnica",
		'SI-087' => "Slovenia: Ormož",
		'SI-088' => "Slovenia: Osilnica",
		'SI-089' => "Slovenia: Pesnica",
		'SI-090' => "Slovenia: Piran/Pirano",
		'SI-091' => "Slovenia: Pivka",
		'SI-172' => "Slovenia: Podlehnik",
		'SI-093' => "Slovenia: Podvelka",
		'SI-092' => "Slovenia: Podčetrtek",
		'SI-200' => "Slovenia: Poljčane",
		'SI-173' => "Slovenia: Polzela",
		'SI-094' => "Slovenia: Postojna",
		'SI-174' => "Slovenia: Prebold",
		'SI-095' => "Slovenia: Preddvor",
		'SI-175' => "Slovenia: Prevalje",
		'SI-096' => "Slovenia: Ptuj",
		'SI-097' => "Slovenia: Puconci",
		'SI-100' => "Slovenia: Radenci",
		'SI-099' => "Slovenia: Radeče",
		'SI-101' => "Slovenia: Radlje ob Dravi",
		'SI-102' => "Slovenia: Radovljica",
		'SI-103' => "Slovenia: Ravne na Koroškem",
		'SI-176' => "Slovenia: Razkrižje",
		'SI-098' => "Slovenia: Rače-Fram",
		'SI-201' => "Slovenia: Renče-Vogrsko",
		'SI-209' => "Slovenia: Rečica ob Savinji",
		'SI-104' => "Slovenia: Ribnica",
		'SI-177' => "Slovenia: Ribnica na Pohorju",
		'SI-107' => "Slovenia: Rogatec",
		'SI-106' => "Slovenia: Rogaška Slatina",
		'SI-105' => "Slovenia: Rogašovci",
		'SI-108' => "Slovenia: Ruše",
		'SI-178' => "Slovenia: Selnica ob Dravi",
		'SI-109' => "Slovenia: Semič",
		'SI-110' => "Slovenia: Sevnica",
		'SI-111' => "Slovenia: Sežana",
		'SI-112' => "Slovenia: Slovenj Gradec",
		'SI-113' => "Slovenia: Slovenska Bistrica",
		'SI-114' => "Slovenia: Slovenske Konjice",
		'SI-179' => "Slovenia: Sodražica",
		'SI-180' => "Slovenia: Solčava",
		'SI-202' => "Slovenia: Središče ob Dravi",
		'SI-115' => "Slovenia: Starče",
		'SI-203' => "Slovenia: Straža",
		'SI-181' => "Slovenia: Sveta Ana",
		'SI-182' => "Slovenia: Sveta Andraž v Slovenskih Goricah",
		'SI-204' => "Slovenia: Sveta Trojica v Slovenskih Goricah",
		'SI-116' => "Slovenia: Sveti Jurij",
		'SI-210' => "Slovenia: Sveti Jurij v Slovenskih Goricah",
		'SI-205' => "Slovenia: Sveti Tomaž",
		'SI-184' => "Slovenia: Tabor",
		'SI-010' => "Slovenia: Tišina",
		'SI-128' => "Slovenia: Tolmin",
		'SI-129' => "Slovenia: Trbovlje",
		'SI-130' => "Slovenia: Trebnje",
		'SI-185' => "Slovenia: Trnovska vas",
		'SI-186' => "Slovenia: Trzin",
		'SI-131' => "Slovenia: Tržič",
		'SI-132' => "Slovenia: Turnišče",
		'SI-133' => "Slovenia: Velenje",
		'SI-187' => "Slovenia: Velika Polana",
		'SI-134' => "Slovenia: Velike Lašče",
		'SI-188' => "Slovenia: Veržej",
		'SI-135' => "Slovenia: Videm",
		'SI-136' => "Slovenia: Vipava",
		'SI-137' => "Slovenia: Vitanje",
		'SI-138' => "Slovenia: Vodice",
		'SI-139' => "Slovenia: Vojnik",
		'SI-189' => "Slovenia: Vransko",
		'SI-140' => "Slovenia: Vrhnika",
		'SI-141' => "Slovenia: Vuzenica",
		'SI-142' => "Slovenia: Zagorje ob Savi",
		'SI-143' => "Slovenia: Zavrč",
		'SI-144' => "Slovenia: Zreče",
		'SI-015' => "Slovenia: Črenšovci",
		'SI-016' => "Slovenia: Črna na Koroškem",
		'SI-017' => "Slovenia: Črnomelj",
		'SI-033' => "Slovenia: Šalovci",
		'SI-183' => "Slovenia: Šempeter-Vrtojba",
		'SI-118' => "Slovenia: Šentilj",
		'SI-119' => "Slovenia: Šentjernej",
		'SI-120' => "Slovenia: Šentjur",
		'SI-211' => "Slovenia: Šentrupert",
		'SI-117' => "Slovenia: Šenčur",
		'SI-121' => "Slovenia: Škocjan",
		'SI-122' => "Slovenia: Škofja Loka",
		'SI-123' => "Slovenia: Škofljica",
		'SI-124' => "Slovenia: Šmarje pri Jelšah",
		'SI-206' => "Slovenia: Šmarjeske Topliče",
		'SI-125' => "Slovenia: Šmartno ob Paki",
		'SI-194' => "Slovenia: Šmartno pri Litiji",
		'SI-126' => "Slovenia: Šoštanj",
		'SI-127' => "Slovenia: Štore",
		'SI-190' => "Slovenia: Žalec",
		'SI-146' => "Slovenia: Železniki",
		'SI-191' => "Slovenia: Žetale",
		'SI-147' => "Slovenia: Žiri",
		'SI-192' => "Slovenia: Žirovnica",
		'SI-193' => "Slovenia: Žužemberk",

		'--ZA'  => "", '-ZA' => "South Africa",
		'ZA-EC' => "South Africa: Eastern Cape",
		'ZA-FS' => "South Africa: Free State",
		'ZA-GT' => "South Africa: Gauteng",
		'ZA-NL' => "South Africa: Kwazulu-Natal",
		'ZA-LP' => "South Africa: Limpopo",
		'ZA-MP' => "South Africa: Mpumalanga",
		'ZA-NW' => "South Africa: North-West (South Africa)",
		'ZA-NC' => "South Africa: Northern Cape",
		'ZA-WC' => "South Africa: Western Cape",

		'--ES'  => "", '-ES' => "Spain",
		'ES-C'  => "Spain: A Coruña",
		'ES-AB' => "Spain: Albacete",
		'ES-A'  => "Spain: Alicante",
		'ES-AL' => "Spain: Almería",
		'ES-AN' => "Spain: Andalucía",
		'ES-AR' => "Spain: Aragón",
		'ES-O'  => "Spain: Asturias",
		'ES-AS' => "Spain: Asturias, Principado de",
		'ES-BA' => "Spain: Badajoz",
		'ES-PM' => "Spain: Balears",
		'ES-B'  => "Spain: Barcelona",
		'ES-BU' => "Spain: Burgos",
		'ES-CN' => "Spain: Canarias",
		'ES-S'  => "Spain: Cantabria",
		'ES-CS' => "Spain: Castellón",
		'ES-CL' => "Spain: Castilla y León",
		'ES-CM' => "Spain: Castilla-La Mancha",
		'ES-CT' => "Spain: Catalunya",
		'ES-CE' => "Spain: Ceuta",
		'ES-CR' => "Spain: Ciudad Real",
		'ES-CU' => "Spain: Cuenca",
		'ES-CC' => "Spain: Cáceres",
		'ES-CA' => "Spain: Cádiz",
		'ES-CO' => "Spain: Córdoba",
		'ES-EX' => "Spain: Extremadura",
		'ES-GA' => "Spain: Galicia",
		'ES-GI' => "Spain: Girona",
		'ES-GR' => "Spain: Granada",
		'ES-GU' => "Spain: Guadalajara",
		'ES-SS' => "Spain: Guipúzcoa / Gipuzkoa",
		'ES-H'  => "Spain: Huelva",
		'ES-HU' => "Spain: Huesca",
		'ES-IB' => "Spain: Illes Balears",
		'ES-J'  => "Spain: Jaén",
		'ES-LO' => "Spain: La Rioja",
		'ES-GC' => "Spain: Las Palmas",
		'ES-LE' => "Spain: León",
		'ES-L'  => "Spain: Lleida",
		'ES-LU' => "Spain: Lugo",
		'ES-M'  => "Spain: Madrid",
		'ES-MD' => "Spain: Madrid, Comunidad de",
		'ES-ML' => "Spain: Melilla",
		'ES-MU' => "Spain: Murcia",
		'ES-MC' => "Spain: Murcia, Región de",
		'ES-MA' => "Spain: Málaga",
		'ES-NA' => "Spain: Navarra / Nafarroa",
		'ES-NC' => "Spain: Navarra, Comunidad Foral de / Nafarroako Foru Komunitatea",
		'ES-OR' => "Spain: Ourense",
		'ES-P'  => "Spain: Palencia",
		'ES-PV' => "Spain: País Vasco / Euskal Herria",
		'ES-PO' => "Spain: Pontevedra",
		'ES-SA' => "Spain: Salamanca",
		'ES-TF' => "Spain: Santa Cruz de Tenerife",
		'ES-SG' => "Spain: Segovia",
		'ES-SE' => "Spain: Sevilla",
		'ES-SO' => "Spain: Soria",
		'ES-T'  => "Spain: Tarragona",
		'ES-TE' => "Spain: Teruel",
		'ES-TO' => "Spain: Toledo",
		'ES-V'  => "Spain: Valencia / València",
		'ES-VC' => "Spain: Valenciana, Comunidad / Valenciana, Comunitat",
		'ES-VA' => "Spain: Valladolid",
		'ES-BI' => "Spain: Vizcayaa / Bizkaia",
		'ES-ZA' => "Spain: Zamora",
		'ES-Z'  => "Spain: Zaragoza",
		'ES-VI' => "Spain: Álava",
		'ES-AV' => "Spain: Ávila",

		'--SE'  => "", '-SE' => "Sweden",
		'SE-K'  => "Sweden: Blekinge län",
		'SE-W'  => "Sweden: Dalarnas län",
		'SE-I'  => "Sweden: Gotlands län",
		'SE-X'  => "Sweden: Gävleborgs län",
		'SE-N'  => "Sweden: Hallands län",
		'SE-Z'  => "Sweden: Jämtlande län",
		'SE-F'  => "Sweden: Jönköpings län",
		'SE-H'  => "Sweden: Kalmar län",
		'SE-G'  => "Sweden: Kronobergs län",
		'SE-BD' => "Sweden: Norrbottens län",
		'SE-M'  => "Sweden: Skåne län",
		'SE-AB' => "Sweden: Stockholms län",
		'SE-D'  => "Sweden: Södermanlands län",
		'SE-C'  => "Sweden: Uppsala län",
		'SE-S'  => "Sweden: Värmlands län",
		'SE-AC' => "Sweden: Västerbottens län",
		'SE-Y'  => "Sweden: Västernorrlands län",
		'SE-U'  => "Sweden: Västmanlands län",
		'SE-O'  => "Sweden: Västra Götalands län",
		'SE-T'  => "Sweden: Örebro län",
		'SE-E'  => "Sweden: Östergötlands län",

		'--CH'  => "", '-CH' => "Switzerland",
		'CH-AG' => "Switzerland: Aargau",
		'CH-AR' => "Switzerland: Appenzell Ausserrhoden",
		'CH-AI' => "Switzerland: Appenzell Innerrhoden",
		'CH-BL' => "Switzerland: Basel-Landschaft",
		'CH-BS' => "Switzerland: Basel-Stadt",
		'CH-BE' => "Switzerland: Bern",
		'CH-FR' => "Switzerland: Fribourg",
		'CH-GE' => "Switzerland: Genève",
		'CH-GL' => "Switzerland: Glarus",
		'CH-GR' => "Switzerland: Graubünden",
		'CH-JU' => "Switzerland: Jura",
		'CH-LU' => "Switzerland: Luzern",
		'CH-NE' => "Switzerland: Neuchâtel",
		'CH-NW' => "Switzerland: Nidwalden",
		'CH-OW' => "Switzerland: Obwalden",
		'CH-SG' => "Switzerland: Sankt Gallen",
		'CH-SH' => "Switzerland: Schaffhausen",
		'CH-SZ' => "Switzerland: Schwyz",
		'CH-SO' => "Switzerland: Solothurn",
		'CH-TG' => "Switzerland: Thurgau",
		'CH-TI' => "Switzerland: Ticino",
		'CH-UR' => "Switzerland: Uri",
		'CH-VS' => "Switzerland: Valais",
		'CH-VD' => "Switzerland: Vaud",
		'CH-ZG' => "Switzerland: Zug",
		'CH-ZH' => "Switzerland: Zürich",

		'--TW'   => "", '-TW' => "Taiwan",
		'TW-CHA' => "Taiwan: Changhua",
		'TW-CYI' => "Taiwan: Chiay City",
		'TW-CYQ' => "Taiwan: Chiayi",
		'TW-HSQ' => "Taiwan: Hsinchu",
		'TW-HSZ' => "Taiwan: Hsinchui City",
		'TW-HUA' => "Taiwan: Hualien",
		'TW-ILA' => "Taiwan: Ilan",
		'TW-KHQ' => "Taiwan: Kaohsiung",
		'TW-KHH' => "Taiwan: Kaohsiung City",
		'TW-KEE' => "Taiwan: Keelung City",
		'TW-MIA' => "Taiwan: Miaoli",
		'TW-NAN' => "Taiwan: Nantou",
		'TW-PEN' => "Taiwan: Penghu",
		'TW-PIF' => "Taiwan: Pingtung",
		'TW-TXQ' => "Taiwan: Taichung",
		'TW-TXG' => "Taiwan: Taichung City",
		'TW-TNQ' => "Taiwan: Tainan",
		'TW-TNN' => "Taiwan: Tainan City",
		'TW-TPQ' => "Taiwan: Taipei",
		'TW-TPE' => "Taiwan: Taipei City",
		'TW-TTT' => "Taiwan: Taitung",
		'TW-TAO' => "Taiwan: Taoyuan",
		'TW-YUN' => "Taiwan: Yunlin",

		'--TH'  => "", '-TH' => "Thailand",
		'TH-37' => "Thailand: Amnat Charoen",
		'TH-15' => "Thailand: Ang Thong",
		'TH-31' => "Thailand: Buri Ram",
		'TH-24' => "Thailand: Chachoengsao",
		'TH-18' => "Thailand: Chai Nat",
		'TH-36' => "Thailand: Chaiyaphum",
		'TH-22' => "Thailand: Chanthaburi",
		'TH-50' => "Thailand: Chiang Mai",
		'TH-57' => "Thailand: Chiang Rai",
		'TH-20' => "Thailand: Chon Buri",
		'TH-86' => "Thailand: Chumphon",
		'TH-46' => "Thailand: Kalasin",
		'TH-62' => "Thailand: Kamphaeng Phet",
		'TH-71' => "Thailand: Kanchanaburi",
		'TH-40' => "Thailand: Khon Kaen",
		'TH-81' => "Thailand: Krabi",
		'TH-10' => "Thailand: Krung Thep Maha Nakhon Bangkok",
		'TH-52' => "Thailand: Lampang",
		'TH-51' => "Thailand: Lamphun",
		'TH-42' => "Thailand: Loei",
		'TH-16' => "Thailand: Lop Buri",
		'TH-58' => "Thailand: Mae Hong Son",
		'TH-44' => "Thailand: Maha Sarakham",
		'TH-49' => "Thailand: Mukdahan",
		'TH-26' => "Thailand: Nakhon Nayok",
		'TH-73' => "Thailand: Nakhon Pathom",
		'TH-48' => "Thailand: Nakhon Phanom",
		'TH-30' => "Thailand: Nakhon Ratchasima",
		'TH-60' => "Thailand: Nakhon Sawan",
		'TH-80' => "Thailand: Nakhon Si Thammarat",
		'TH-55' => "Thailand: Nan",
		'TH-96' => "Thailand: Narathiwat",
		'TH-39' => "Thailand: Nong Bua Lam Phu",
		'TH-43' => "Thailand: Nong Khai",
		'TH-12' => "Thailand: Nonthaburi",
		'TH-13' => "Thailand: Pathum Thani",
		'TH-94' => "Thailand: Pattani",
		'TH-82' => "Thailand: Phangnga",
		'TH-93' => "Thailand: Phatthalung",
		'TH-S'  => "Thailand: Phatthaya",
		'TH-56' => "Thailand: Phayao",
		'TH-67' => "Thailand: Phetchabun",
		'TH-76' => "Thailand: Phetchaburi",
		'TH-66' => "Thailand: Phichit",
		'TH-65' => "Thailand: Phitsanulok",
		'TH-14' => "Thailand: Phra Nakhon Si Ayutthaya",
		'TH-54' => "Thailand: Phrae",
		'TH-83' => "Thailand: Phuket",
		'TH-25' => "Thailand: Prachin Buri",
		'TH-77' => "Thailand: Prachuap Khiri Khan",
		'TH-85' => "Thailand: Ranong",
		'TH-70' => "Thailand: Ratchaburi",
		'TH-21' => "Thailand: Rayong",
		'TH-45' => "Thailand: Roi Et",
		'TH-27' => "Thailand: Sa Kaeo",
		'TH-47' => "Thailand: Sakon Nakhon",
		'TH-11' => "Thailand: Samut Prakan",
		'TH-74' => "Thailand: Samut Sakhon",
		'TH-75' => "Thailand: Samut Songkhram",
		'TH-19' => "Thailand: Saraburi",
		'TH-91' => "Thailand: Satun",
		'TH-33' => "Thailand: Si Sa Ket",
		'TH-17' => "Thailand: Sing Buri",
		'TH-90' => "Thailand: Songkhla",
		'TH-64' => "Thailand: Sukhothai",
		'TH-72' => "Thailand: Suphan Buri",
		'TH-84' => "Thailand: Surat Thani",
		'TH-32' => "Thailand: Surin",
		'TH-63' => "Thailand: Tak",
		'TH-92' => "Thailand: Trang",
		'TH-23' => "Thailand: Trat",
		'TH-34' => "Thailand: Ubon Ratchathani",
		'TH-41' => "Thailand: Udon Thani",
		'TH-61' => "Thailand: Uthai Thani",
		'TH-53' => "Thailand: Uttaradit",
		'TH-95' => "Thailand: Yala",
		'TH-35' => "Thailand: Yasothon",

		'--TR'  => "", '-TR' => "Turkey",
		'TR-01' => "Turkey: Adana",
		'TR-02' => "Turkey: Adıyaman",
		'TR-03' => "Turkey: Afyon",
		'TR-68' => "Turkey: Aksaray",
		'TR-05' => "Turkey: Amasya",
		'TR-06' => "Turkey: Ankara",
		'TR-07' => "Turkey: Antalya",
		'TR-75' => "Turkey: Ardahan",
		'TR-08' => "Turkey: Artvin",
		'TR-09' => "Turkey: Aydın",
		'TR-04' => "Turkey: Ağrı",
		'TR-10' => "Turkey: Balıkesir",
		'TR-74' => "Turkey: Bartın",
		'TR-72' => "Turkey: Batman",
		'TR-69' => "Turkey: Bayburt",
		'TR-11' => "Turkey: Bilecik",
		'TR-12' => "Turkey: Bingöl",
		'TR-13' => "Turkey: Bitlis",
		'TR-14' => "Turkey: Bolu",
		'TR-15' => "Turkey: Burdur",
		'TR-16' => "Turkey: Bursa",
		'TR-20' => "Turkey: Denizli",
		'TR-21' => "Turkey: Diyarbakır",
		'TR-81' => "Turkey: Düzce",
		'TR-22' => "Turkey: Edirne",
		'TR-23' => "Turkey: Elazığ",
		'TR-24' => "Turkey: Erzincan",
		'TR-25' => "Turkey: Erzurum",
		'TR-26' => "Turkey: Eskişehir",
		'TR-27' => "Turkey: Gaziantep",
		'TR-28' => "Turkey: Giresun",
		'TR-29' => "Turkey: Gümüşhane",
		'TR-30' => "Turkey: Hakkâri",
		'TR-31' => "Turkey: Hatay",
		'TR-32' => "Turkey: Isparta",
		'TR-76' => "Turkey: Iğdır",
		'TR-46' => "Turkey: Kahramanmaraş",
		'TR-78' => "Turkey: Karabük",
		'TR-70' => "Turkey: Karaman",
		'TR-36' => "Turkey: Kars",
		'TR-37' => "Turkey: Kastamonu",
		'TR-38' => "Turkey: Kayseri",
		'TR-79' => "Turkey: Kilis",
		'TR-41' => "Turkey: Kocaeli",
		'TR-42' => "Turkey: Konya",
		'TR-43' => "Turkey: Kütahya",
		'TR-39' => "Turkey: Kırklareli",
		'TR-71' => "Turkey: Kırıkkale",
		'TR-40' => "Turkey: Kırşehir",
		'TR-44' => "Turkey: Malatya",
		'TR-45' => "Turkey: Manisa",
		'TR-47' => "Turkey: Mardin",
		'TR-48' => "Turkey: Muğla",
		'TR-49' => "Turkey: Muş",
		'TR-50' => "Turkey: Nevşehir",
		'TR-51' => "Turkey: Niğde",
		'TR-52' => "Turkey: Ordu",
		'TR-80' => "Turkey: Osmaniye",
		'TR-53' => "Turkey: Rize",
		'TR-54' => "Turkey: Sakarya",
		'TR-55' => "Turkey: Samsun",
		'TR-56' => "Turkey: Siirt",
		'TR-57' => "Turkey: Sinop",
		'TR-58' => "Turkey: Sivas",
		'TR-59' => "Turkey: Tekirdağ",
		'TR-60' => "Turkey: Tokat",
		'TR-61' => "Turkey: Trabzon",
		'TR-62' => "Turkey: Tunceli",
		'TR-64' => "Turkey: Uşak",
		'TR-65' => "Turkey: Van",
		'TR-77' => "Turkey: Yalova",
		'TR-66' => "Turkey: Yozgat",
		'TR-67' => "Turkey: Zonguldak",
		'TR-17' => "Turkey: Çanakkale",
		'TR-18' => "Turkey: Çankırı",
		'TR-19' => "Turkey: Çorum",
		'TR-34' => "Turkey: İstanbul",
		'TR-35' => "Turkey: İzmir",
		'TR-33' => "Turkey: İçel",
		'TR-63' => "Turkey: Şanlıurfa",
		'TR-73' => "Turkey: Şırnak",

		'--UA'  => "", '-UA' => "Ukraine",
		'UA-71' => "Ukraine: Cherkas'ka Oblast'",
		'UA-74' => "Ukraine: Chernihivs'ka Oblast'",
		'UA-77' => "Ukraine: Chernivets'ka Oblast'",
		'UA-12' => "Ukraine: Dnipropetrovs'ka Oblast'",
		'UA-14' => "Ukraine: Donets'ka Oblast'",
		'UA-26' => "Ukraine: Ivano-Frankivs'ka Oblast'",
		'UA-63' => "Ukraine: Kharkivs'ka Oblast'",
		'UA-65' => "Ukraine: Khersons'ka Oblast'",
		'UA-68' => "Ukraine: Khmel'nyts'ka Oblast'",
		'UA-35' => "Ukraine: Kirovohrads'ka Oblast'",
		'UA-32' => "Ukraine: Kyïvs'ka Oblast'",
		'UA-30' => "Ukraine: Kyïvs'ka mis'ka rada",
		'UA-46' => "Ukraine: L'vivs'ka Oblast'",
		'UA-09' => "Ukraine: Luhans'ka Oblast'",
		'UA-48' => "Ukraine: Mykolaïvs'ka Oblast'",
		'UA-51' => "Ukraine: Odes'ka Oblast'",
		'UA-53' => "Ukraine: Poltavs'ka Oblast'",
		'UA-43' => "Ukraine: Respublika Krym",
		'UA-56' => "Ukraine: Rivnens'ka Oblast'",
		'UA-40' => "Ukraine: Sevastopol",
		'UA-59' => "Ukraine: Sums 'ka Oblast'",
		'UA-61' => "Ukraine: Ternopil's'ka Oblast'",
		'UA-05' => "Ukraine: Vinnyts'ka Oblast'",
		'UA-07' => "Ukraine: Volyns'ka Oblast'",
		'UA-21' => "Ukraine: Zakarpats'ka Oblast'",
		'UA-23' => "Ukraine: Zaporiz'ka Oblast'",
		'UA-18' => "Ukraine: Zhytomyrs'ka Oblast'",

		'--AE'  => "", '-AE' => "United Arab Emirates",
		'AE-AJ' => "United Arab Emirates: 'Ajmān",
		'AE-AZ' => "United Arab Emirates: Abū Ȥaby [Abu Dhabi]",
		'AE-FU' => "United Arab Emirates: Al Fujayrah",
		'AE-SH' => "United Arab Emirates: Ash Shāriqah",
		'AE-DU' => "United Arab Emirates: Dubayy",
		'AE-RK' => "United Arab Emirates: Ra’s al Khaymah",
		'AE-UQ' => "United Arab Emirates: Umm al Qaywayn",

		'--GB'   => "", '-GB' => "United Kingdom",
		'GB-ABE' => "United Kingdom: Aberdeen City",
		'GB-ABD' => "United Kingdom: Aberdeenshire",
		'GB-ANS' => "United Kingdom: Angus",
		'GB-ANT' => "United Kingdom: Antrim",
		'GB-ARD' => "United Kingdom: Ards",
		'GB-AGB' => "United Kingdom: Argyll and Bute",
		'GB-ARM' => "United Kingdom: Armagh",
		'GB-BLA' => "United Kingdom: Ballymena",
		'GB-BLY' => "United Kingdom: Ballymoney",
		'GB-BNB' => "United Kingdom: Banbridge",
		'GB-BDG' => "United Kingdom: Barking and Dagenham",
		'GB-BNE' => "United Kingdom: Barnet",
		'GB-BNS' => "United Kingdom: Barnsley",
		'GB-BAS' => "United Kingdom: Bath and North East Somerset",
		'GB-BDF' => "United Kingdom: Bedford",
		'GB-BFS' => "United Kingdom: Belfast",
		'GB-BEX' => "United Kingdom: Bexley",
		'GB-BIR' => "United Kingdom: Birmingham",
		'GB-BBD' => "United Kingdom: Blackburn with Darwen",
		'GB-BPL' => "United Kingdom: Blackpool",
		'GB-BGW' => "United Kingdom: Blaenau Gwent",
		'GB-BOL' => "United Kingdom: Bolton",
		'GB-BMH' => "United Kingdom: Bournemouth",
		'GB-BRC' => "United Kingdom: Bracknell Forest",
		'GB-BRD' => "United Kingdom: Bradford",
		'GB-BEN' => "United Kingdom: Brent",
		'GB-BGE' => "United Kingdom: Bridgend (Pen-y-bont ar Ogwr)",
		'GB-BNH' => "United Kingdom: Brighton and Hove",
		'GB-BST' => "United Kingdom: Bristol, City of",
		'GB-BRY' => "United Kingdom: Bromley",
		'GB-BKM' => "United Kingdom: Buckinghamshire",
		'GB-BUR' => "United Kingdom: Bury",
		'GB-CAY' => "United Kingdom: Caerphilly (Caerffili)",
		'GB-CLD' => "United Kingdom: Calderdale",
		'GB-CAM' => "United Kingdom: Cambridgeshire",
		'GB-CMD' => "United Kingdom: Camden",
		'GB-CRF' => "United Kingdom: Cardiff (Caerdydd)",
		'GB-CMN' => "United Kingdom: Carmarthenshire (Sir Gaerfyrddin)",
		'GB-CKF' => "United Kingdom: Carrickfergus",
		'GB-CSR' => "United Kingdom: Castlereagh",
		'GB-CBF' => "United Kingdom: Central Bedfordshire",
		'GB-CGN' => "United Kingdom: Ceredigion (Sir Ceredigion)",
		'GB-CHE' => "United Kingdom: Cheshire East",
		'GB-CHW' => "United Kingdom: Cheshire West and Chester",
		'GB-CLK' => "United Kingdom: Clackmannanshire",
		'GB-CLR' => "United Kingdom: Coleraine",
		'GB-CWY' => "United Kingdom: Conwy",
		'GB-CKT' => "United Kingdom: Cookstown",
		'GB-CON' => "United Kingdom: Cornwall",
		'GB-COV' => "United Kingdom: Coventry",
		'GB-CGV' => "United Kingdom: Craigavon",
		'GB-CRY' => "United Kingdom: Croydon",
		'GB-CMA' => "United Kingdom: Cumbria",
		'GB-DAL' => "United Kingdom: Darlington",
		'GB-DEN' => "United Kingdom: Denbighshire (Sir Ddinbych)",
		'GB-DER' => "United Kingdom: Derby",
		'GB-DBY' => "United Kingdom: Derbyshire",
		'GB-DRY' => "United Kingdom: Derry",
		'GB-DEV' => "United Kingdom: Devon",
		'GB-DNC' => "United Kingdom: Doncaster",
		'GB-DOR' => "United Kingdom: Dorset",
		'GB-DOW' => "United Kingdom: Down",
		'GB-DUD' => "United Kingdom: Dudley",
		'GB-DGY' => "United Kingdom: Dumfries and Galloway",
		'GB-DND' => "United Kingdom: Dundee City",
		'GB-DGN' => "United Kingdom: Dungannon",
		'GB-DUR' => "United Kingdom: Durham",
		'GB-EAL' => "United Kingdom: Ealing",
		'GB-EAY' => "United Kingdom: East Ayrshire",
		'GB-EDU' => "United Kingdom: East Dunbartonshire",
		'GB-ELN' => "United Kingdom: East Lothian",
		'GB-ERW' => "United Kingdom: East Renfrewshire",
		'GB-ERY' => "United Kingdom: East Riding of Yorkshire",
		'GB-ESX' => "United Kingdom: East Sussex",
		'GB-EDH' => "United Kingdom: Edinburgh, City of",
		'GB-ELS' => "United Kingdom: Eilean Siar",
		'GB-ENF' => "United Kingdom: Enfield",
		'GB-ENG' => "United Kingdom: England",
		'GB-EAW' => "United Kingdom: England and Wales",
		'GB-ESS' => "United Kingdom: Essex",
		'GB-FAL' => "United Kingdom: Falkirk",
		'GB-FER' => "United Kingdom: Fermanagh",
		'GB-FIF' => "United Kingdom: Fife",
		'GB-FLN' => "United Kingdom: Flintshire (Sir y Fflint)",
		'GB-GAT' => "United Kingdom: Gateshead",
		'GB-GLG' => "United Kingdom: Glasgow City",
		'GB-GLS' => "United Kingdom: Gloucestershire",
		'GB-GBN' => "United Kingdom: Great Britain",
		'GB-GRE' => "United Kingdom: Greenwich",
		'GB-GWN' => "United Kingdom: Gwynedd",
		'GB-HCK' => "United Kingdom: Hackney",
		'GB-HAL' => "United Kingdom: Halton",
		'GB-HMF' => "United Kingdom: Hammersmith and Fulham",
		'GB-HAM' => "United Kingdom: Hampshire",
		'GB-HRY' => "United Kingdom: Haringey",
		'GB-HRW' => "United Kingdom: Harrow",
		'GB-HPL' => "United Kingdom: Hartlepool",
		'GB-HAV' => "United Kingdom: Havering",
		'GB-HEF' => "United Kingdom: Herefordshire",
		'GB-HRT' => "United Kingdom: Hertfordshire",
		'GB-HLD' => "United Kingdom: Highland",
		'GB-HIL' => "United Kingdom: Hillingdon",
		'GB-HNS' => "United Kingdom: Hounslow",
		'GB-IVC' => "United Kingdom: Inverclyde",
		'GB-AGY' => "United Kingdom: Isle of Anglesey (Sir Ynys Môn)",
		'GB-IOW' => "United Kingdom: Isle of Wight",
		'GB-ISL' => "United Kingdom: Islington",
		'GB-KEC' => "United Kingdom: Kensington and Chelsea",
		'GB-KEN' => "United Kingdom: Kent",
		'GB-KHL' => "United Kingdom: Kingston upon Hull",
		'GB-KTT' => "United Kingdom: Kingston upon Thames",
		'GB-KIR' => "United Kingdom: Kirklees",
		'GB-KWL' => "United Kingdom: Knowsley",
		'GB-LBH' => "United Kingdom: Lambeth",
		'GB-LAN' => "United Kingdom: Lancashire",
		'GB-LRN' => "United Kingdom: Larne",
		'GB-LDS' => "United Kingdom: Leeds",
		'GB-LCE' => "United Kingdom: Leicester",
		'GB-LEC' => "United Kingdom: Leicestershire",
		'GB-LEW' => "United Kingdom: Lewisham",
		'GB-LMV' => "United Kingdom: Limavady",
		'GB-LIN' => "United Kingdom: Lincolnshire",
		'GB-LSB' => "United Kingdom: Lisburn",
		'GB-LIV' => "United Kingdom: Liverpool",
		'GB-LND' => "United Kingdom: London, City of",
		'GB-LUT' => "United Kingdom: Luton",
		'GB-MFT' => "United Kingdom: Magherafelt",
		'GB-MAN' => "United Kingdom: Manchester",
		'GB-MDW' => "United Kingdom: Medway",
		'GB-MTY' => "United Kingdom: Merthyr Tydfil (Merthyr Tudful)",
		'GB-MRT' => "United Kingdom: Merton",
		'GB-MDB' => "United Kingdom: Middlesbrough",
		'GB-MLN' => "United Kingdom: Midlothian",
		'GB-MIK' => "United Kingdom: Milton Keynes",
		'GB-MON' => "United Kingdom: Monmouthshire (Sir Fynwy)",
		'GB-MRY' => "United Kingdom: Moray",
		'GB-MYL' => "United Kingdom: Moyle",
		'GB-NTL' => "United Kingdom: Neath Port Talbot (Castell-nedd Port Talbot)",
		'GB-NET' => "United Kingdom: Newcastle upon Tyne",
		'GB-NWM' => "United Kingdom: Newham",
		'GB-NWP' => "United Kingdom: Newport (Casnewydd)",
		'GB-NYM' => "United Kingdom: Newry and Mourne",
		'GB-NTA' => "United Kingdom: Newtownabbey",
		'GB-NFK' => "United Kingdom: Norfolk",
		'GB-NAY' => "United Kingdom: North Ayrshire",
		'GB-NDN' => "United Kingdom: North Down",
		'GB-NEL' => "United Kingdom: North East Lincolnshire",
		'GB-NLK' => "United Kingdom: North Lanarkshire",
		'GB-NLN' => "United Kingdom: North Lincolnshire",
		'GB-NSM' => "United Kingdom: North Somerset",
		'GB-NTY' => "United Kingdom: North Tyneside",
		'GB-NYK' => "United Kingdom: North Yorkshire",
		'GB-NTH' => "United Kingdom: Northamptonshire",
		'GB-NIR' => "United Kingdom: Northern Ireland",
		'GB-NBL' => "United Kingdom: Northumberland",
		'GB-NGM' => "United Kingdom: Nottingham",
		'GB-NTT' => "United Kingdom: Nottinghamshire",
		'GB-OLD' => "United Kingdom: Oldham",
		'GB-OMH' => "United Kingdom: Omagh",
		'GB-ORK' => "United Kingdom: Orkney Islands",
		'GB-OXF' => "United Kingdom: Oxfordshire",
		'GB-PEM' => "United Kingdom: Pembrokeshire (Sir Benfro)",
		'GB-PKN' => "United Kingdom: Perth and Kinross",
		'GB-PTE' => "United Kingdom: Peterborough",
		'GB-PLY' => "United Kingdom: Plymouth",
		'GB-POL' => "United Kingdom: Poole",
		'GB-POR' => "United Kingdom: Portsmouth",
		'GB-POW' => "United Kingdom: Powys",
		'GB-RDG' => "United Kingdom: Reading",
		'GB-RDB' => "United Kingdom: Redbridge",
		'GB-RCC' => "United Kingdom: Redcar and Cleveland",
		'GB-RFW' => "United Kingdom: Renfrewshire",
		'GB-RCT' => "United Kingdom: Rhondda, Cynon, Taff (Rhondda, Cynon, Taf)",
		'GB-RIC' => "United Kingdom: Richmond upon Thames",
		'GB-RCH' => "United Kingdom: Rochdale",
		'GB-ROT' => "United Kingdom: Rotherham",
		'GB-RUT' => "United Kingdom: Rutland",
		'GB-SLF' => "United Kingdom: Salford",
		'GB-SAW' => "United Kingdom: Sandwell",
		'GB-SCT' => "United Kingdom: Scotland",
		'GB-SCB' => "United Kingdom: Scottish Borders, The",
		'GB-SFT' => "United Kingdom: Sefton",
		'GB-SHF' => "United Kingdom: Sheffield",
		'GB-ZET' => "United Kingdom: Shetland Islands",
		'GB-SHR' => "United Kingdom: Shropshire",
		'GB-SLG' => "United Kingdom: Slough",
		'GB-SOL' => "United Kingdom: Solihull",
		'GB-SOM' => "United Kingdom: Somerset",
		'GB-SAY' => "United Kingdom: South Ayrshire",
		'GB-SGC' => "United Kingdom: South Gloucestershire",
		'GB-SLK' => "United Kingdom: South Lanarkshire",
		'GB-STY' => "United Kingdom: South Tyneside",
		'GB-STH' => "United Kingdom: Southampton",
		'GB-SOS' => "United Kingdom: Southend-on-Sea",
		'GB-SWK' => "United Kingdom: Southwark",
		'GB-SHN' => "United Kingdom: St. Helens",
		'GB-STS' => "United Kingdom: Staffordshire",
		'GB-STG' => "United Kingdom: Stirling",
		'GB-SKP' => "United Kingdom: Stockport",
		'GB-STT' => "United Kingdom: Stockton-on-Tees",
		'GB-STE' => "United Kingdom: Stoke-on-Trent",
		'GB-STB' => "United Kingdom: Strabane",
		'GB-SFK' => "United Kingdom: Suffolk",
		'GB-SND' => "United Kingdom: Sunderland",
		'GB-SRY' => "United Kingdom: Surrey",
		'GB-STN' => "United Kingdom: Sutton",
		'GB-SWA' => "United Kingdom: Swansea (Abertawe)",
		'GB-SWD' => "United Kingdom: Swindon",
		'GB-TAM' => "United Kingdom: Tameside",
		'GB-TFW' => "United Kingdom: Telford and Wrekin",
		'GB-THR' => "United Kingdom: Thurrock",
		'GB-TOB' => "United Kingdom: Torbay",
		'GB-TOF' => "United Kingdom: Torfaen (Tor-faen)",
		'GB-TWH' => "United Kingdom: Tower Hamlets",
		'GB-TRF' => "United Kingdom: Trafford",
		'GB-UKM' => "United Kingdom: United Kingdom",
		'GB-VGL' => "United Kingdom: Vale of Glamorgan, The (Bro Morgannwg)",
		'GB-WKF' => "United Kingdom: Wakefield",
		'GB-WLS' => "United Kingdom: Wales",
		'GB-WLL' => "United Kingdom: Walsall",
		'GB-WFT' => "United Kingdom: Waltham Forest",
		'GB-WND' => "United Kingdom: Wandsworth",
		'GB-WRT' => "United Kingdom: Warrington",
		'GB-WAR' => "United Kingdom: Warwickshire",
		'GB-WBK' => "United Kingdom: West Berkshire",
		'GB-WDU' => "United Kingdom: West Dunbartonshire",
		'GB-WLN' => "United Kingdom: West Lothian",
		'GB-WSX' => "United Kingdom: West Sussex",
		'GB-WSM' => "United Kingdom: Westminster",
		'GB-WGN' => "United Kingdom: Wigan",
		'GB-WNM' => "United Kingdom: Windsor and Maidenhead",
		'GB-WRL' => "United Kingdom: Wirral",
		'GB-WOK' => "United Kingdom: Wokingham",
		'GB-WLV' => "United Kingdom: Wolverhampton",
		'GB-WOR' => "United Kingdom: Worcestershire",
		'GB-WRX' => "United Kingdom: Wrexham (Wrecsam)",
		'GB-YOR' => "United Kingdom: York",

		'--US'  => "", '-US' => "United States",
		'US-AL' => "United States: Alabama",
		'US-AK' => "United States: Alaska",
		'US-AS' => "United States: American Samoa, Samoa Americana",
		'US-AZ' => "United States: Arizona",
		'US-AR' => "United States: Arkansas",
		'US-CA' => "United States: California",
		'US-CO' => "United States: Colorado",
		'US-CT' => "United States: Connecticut",
		'US-DE' => "United States: Delaware",
		'US-DC' => "United States: District of Columbia, Disricte de Columbia",
		'US-FL' => "United States: Florida",
		'US-GA' => "United States: Georgia, Geòrgia",
		'US-GU' => "United States: Guam",
		'US-HI' => "United States: Hawaii",
		'US-ID' => "United States: Idaho",
		'US-IL' => "United States: Illinois",
		'US-IN' => "United States: Indiana",
		'US-IA' => "United States: Iowa",
		'US-KS' => "United States: Kansas",
		'US-KY' => "United States: Kentucky",
		'US-LA' => "United States: Louisiana",
		'US-ME' => "United States: Maine",
		'US-MD' => "United States: Maryland",
		'US-MA' => "United States: Massachusetts",
		'US-MI' => "United States: Michigan",
		'US-MN' => "United States: Minnesota",
		'US-MS' => "United States: Mississippi",
		'US-MO' => "United States: Missouri",
		'US-MT' => "United States: Montana",
		'US-NE' => "United States: Nebraska",
		'US-NV' => "United States: Nevada",
		'US-NH' => "United States: New Hampshire",
		'US-NJ' => "United States: New Jersey",
		'US-NM' => "United States: New Mexico",
		'US-NY' => "United States: New York",
		'US-NC' => "United States: North Carolina",
		'US-ND' => "United States: North Dakota",
		'US-MP' => "United States: Northern Mariana Islands, Illes Marianes del Nord",
		'US-OH' => "United States: Ohio",
		'US-OK' => "United States: Oklahoma",
		'US-OR' => "United States: Oregon",
		'US-PA' => "United States: Pennsylvania",
		'US-PR' => "United States: Puerto Rico",
		'US-RI' => "United States: Rhode Island",
		'US-SC' => "United States: South Carolina",
		'US-SD' => "United States: South Dakota",
		'US-TN' => "United States: Tennessee",
		'US-TX' => "United States: Texas",
		'US-UM' => "United States: United States Minor Outlying Islands, Illes Perifèriques Menors dels EUA",
		'US-UT' => "United States: Utah",
		'US-VT' => "United States: Vermont",
		'US-VI' => "United States: Virgin Islands, Illes Verge",
		'US-VA' => "United States: Virginia",
		'US-WA' => "United States: Washington",
		'US-WV' => "United States: West Virginia",
		'US-WI' => "United States: Wisconsin",
		'US-WY' => "United States: Wyoming",

		'--VN'  => "", '-VN' => "Vietnam",
		'VN-44' => "Vietnam: An Giang",
		'VN-43' => "Vietnam: Bà Rịa - Vũng Tàu",
		'VN-57' => "Vietnam: Bình Dương",
		'VN-58' => "Vietnam: Bình Phước",
		'VN-40' => "Vietnam: Bình Thuận",
		'VN-31' => "Vietnam: Bình Định",
		'VN-55' => "Vietnam: Bạc Liêu",
		'VN-54' => "Vietnam: Bắc Giang",
		'VN-53' => "Vietnam: Bắc Kạn",
		'VN-56' => "Vietnam: Bắc Ninh",
		'VN-50' => "Vietnam: Bến Tre",
		'VN-04' => "Vietnam: Cao Bằng",
		'VN-59' => "Vietnam: Cà Mau",
		'VN-48' => "Vietnam: Cần Thơ",
		'VN-30' => "Vietnam: Gia Lai",
		'VN-14' => "Vietnam: Hoà Bình",
		'VN-03' => "Vietnam: Hà Giang",
		'VN-63' => "Vietnam: Hà Nam",
		'VN-64' => "Vietnam: Hà Nội, thủ đô",
		'VN-15' => "Vietnam: Hà Tây",
		'VN-23' => "Vietnam: Hà Tỉnh",
		'VN-66' => "Vietnam: Hưng Yên",
		'VN-61' => "Vietnam: Hải Duong",
		'VN-62' => "Vietnam: Hải Phòng, thành phố",
		'VN-73' => "Vietnam: Hậu Giang",
		'VN-65' => "Vietnam: Hồ Chí Minh, thành phố [Sài Gòn]",
		'VN-34' => "Vietnam: Khánh Hòa",
		'VN-47' => "Vietnam: Kiên Giang",
		'VN-28' => "Vietnam: Kon Tum",
		'VN-01' => "Vietnam: Lai Châu",
		'VN-41' => "Vietnam: Long An",
		'VN-02' => "Vietnam: Lào Cai",
		'VN-35' => "Vietnam: Lâm Đồng",
		'VN-09' => "Vietnam: Lạng Sơn",
		'VN-67' => "Vietnam: Nam Định",
		'VN-22' => "Vietnam: Nghệ An",
		'VN-18' => "Vietnam: Ninh Bình",
		'VN-36' => "Vietnam: Ninh Thuận",
		'VN-68' => "Vietnam: Phú Thọ",
		'VN-32' => "Vietnam: Phú Yên",
		'VN-24' => "Vietnam: Quảng Bình",
		'VN-27' => "Vietnam: Quảng Nam",
		'VN-29' => "Vietnam: Quảng Ngãi",
		'VN-13' => "Vietnam: Quảng Ninh",
		'VN-25' => "Vietnam: Quảng Trị",
		'VN-52' => "Vietnam: Sóc Trăng",
		'VN-05' => "Vietnam: Sơn La",
		'VN-21' => "Vietnam: Thanh Hóa",
		'VN-20' => "Vietnam: Thái Bình",
		'VN-69' => "Vietnam: Thái Nguyên",
		'VN-26' => "Vietnam: Thừa Thiên-Huế",
		'VN-46' => "Vietnam: Tiền Giang",
		'VN-51' => "Vietnam: Trà Vinh",
		'VN-07' => "Vietnam: Tuyên Quang",
		'VN-37' => "Vietnam: Tây Ninh",
		'VN-49' => "Vietnam: Vĩnh Long",
		'VN-70' => "Vietnam: Vĩnh Phúc",
		'VN-06' => "Vietnam: Yên Bái",
		'VN-71' => "Vietnam: Điện Biên",
		'VN-60' => "Vietnam: Đà Nẵng, thành phố",
		'VN-33' => "Vietnam: Đắc Lắk",
		'VN-72' => "Vietnam: Đắk Nông",
		'VN-39' => "Vietnam: Đồng Nai",
		'VN-45' => "Vietnam: Đồng Tháp",
	];

}
colorpicker.php000060400000005523152455357510007606 0ustar00<?php
/**
 * @package         Regular Labs Library
 * @version         18.3.17810
 * 
 * @author          Peter van Westen <info@regularlabs.com>
 * @link            http://www.regularlabs.com
 * @copyright       Copyright © 2018 Regular Labs All Rights Reserved
 * @license         http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
 */

defined('_JEXEC') or die;

jimport('joomla.form.formfield');

if ( ! is_file(JPATH_LIBRARIES . '/regularlabs/autoload.php'))
{
	return;
}

require_once JPATH_LIBRARIES . '/regularlabs/autoload.php';

use RegularLabs\Library\Document as RL_Document;

class JFormFieldRL_ColorPicker extends JFormField
{
	public $type = 'ColorPicker';

	protected function getInput()
	{
		if ( ! is_file(JPATH_LIBRARIES . '/regularlabs/autoload.php'))
		{
			return null;
		}

		$field = new RLFieldColorPicker;

		return $field->getInput($this->name, $this->id, $this->value, $this->element->attributes());
	}
}

class RLFieldColorPicker
{
	function getInput($name, $id, $value, $params)
	{
		$this->name   = $name;
		$this->id     = $id;
		$this->value  = $value;
		$this->params = $params;
		$action       = '';

		if ($this->get('inlist', 0) && $this->get('action'))
		{
			$this->name = $name . $id;
			$this->id   = $name . $id;
			$action     = ' onchange="' . $this->get('action') . '"';
		}

		RL_Document::script('regularlabs/colorpicker.min.js');
		RL_Document::stylesheet('regularlabs/colorpicker.min.css');

		$class = ' class="' . trim('nncolorpicker chzn-done ' . $this->get('class')) . '"';

		$color = strtolower($this->value);
		if ( ! $color || in_array($color, ['none', 'transparent']))
		{
			$color = 'none';
		}
		else if ($color[0] != '#')
		{
			$color = '#' . $color;
		}

		$colors = $this->get('colors');
		if (empty($colors))
		{
			$colors = [
				'none',
				'#049cdb',
				'#46a546',
				'#9d261d',
				'#ffc40d',
				'#f89406',
				'#c3325f',
				'#7a43b6',
				'#ffffff',
				'#999999',
				'#555555',
				'#000000',
			];
		}
		else
		{
			$colors = explode(',', $colors);
		}

		$split = (int) $this->get('split');
		if ( ! $split)
		{
			$count = count($colors);
			if ($count % 5 == 0)
			{
				$split = 5;
			}
			else if ($count % 4 == 0)
			{
				$split = 4;
			}
		}
		$split = $split ? $split : 3;

		$html   = [];
		$html[] = '<select ' . $action . ' name="' . $this->name . '" id="' . $this->id . '"'
			. $class . ' style="visibility:hidden;width:22px;height:1px">';

		foreach ($colors as $i => $c)
		{
			$html[] = '<option' . ($c == $color ? ' selected="selected"' : '') . '>' . $c . '</option>';
			if (($i + 1) % $split == 0)
			{
				$html[] = '<option>-</option>';
			}
		}
		$html[] = '</select>';

		return implode('', $html);
	}

	private function get($val, $default = '')
	{
		if ( ! isset($this->params[$val]) || (string) $this->params[$val] == '')
		{
			return $default;
		}

		return (string) $this->params[$val];
	}
}
flexicontent.php000060400000002721152455357510007771 0ustar00<?php
/**
 * @package         Regular Labs Library
 * @version         21.4.10972
 * 
 * @author          Peter van Westen <info@regularlabs.com>
 * @link            http://www.regularlabs.com
 * @copyright       Copyright © 2021 Regular Labs All Rights Reserved
 * @license         http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
 */

defined('_JEXEC') or die;

if ( ! is_file(JPATH_LIBRARIES . '/regularlabs/autoload.php'))
{
	return;
}

require_once JPATH_LIBRARIES . '/regularlabs/autoload.php';

class JFormFieldRL_FlexiContent extends \RegularLabs\Library\FieldGroup
{
	public $type          = 'FlexiContent';
	public $default_group = 'Tags';

	protected function getInput()
	{
		if ($error = $this->missingFilesOrTables(['tags', 'types']))
		{
			return $error;
		}

		return $this->getSelectList();
	}

	function getTags()
	{
		$query = $this->db->getQuery(true)
			->select('t.name as id, t.name')
			->from('#__flexicontent_tags AS t')
			->where('t.published = 1')
			->where('t.name != ' . $this->db->quote(''))
			->group('t.name')
			->order('t.name');
		$this->db->setQuery($query);
		$list = $this->db->loadObjectList();

		return $this->getOptionsByList($list);
	}

	function getTypes()
	{
		$query = $this->db->getQuery(true)
			->select('t.id, t.name')
			->from('#__flexicontent_types AS t')
			->where('t.published = 1')
			->order('t.name, t.id');
		$this->db->setQuery($query);
		$list = $this->db->loadObjectList();

		return $this->getOptionsByList($list);
	}
}
onlypro.php000060400000004337152455357510006776 0ustar00<?php
/**
 * @package         Regular Labs Library
 * @version         21.4.10972
 * 
 * @author          Peter van Westen <info@regularlabs.com>
 * @link            http://www.regularlabs.com
 * @copyright       Copyright © 2021 Regular Labs All Rights Reserved
 * @license         http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
 */

defined('_JEXEC') or die;

use RegularLabs\Library\Extension as RL_Extension;

if ( ! is_file(JPATH_LIBRARIES . '/regularlabs/autoload.php'))
{
	return;
}

require_once JPATH_LIBRARIES . '/regularlabs/autoload.php';

class JFormFieldRL_OnlyPro extends \RegularLabs\Library\Field
{
	public $type = 'OnlyPro';

	protected function getLabel()
	{
		$label   = $this->prepareText($this->get('label'));
		$tooltip = $this->prepareText($this->get('description'));

		if ( ! $label && ! $tooltip)
		{
			return '</div><div>' . $this->getText();
		}

		if ( ! $label)
		{
			return $tooltip;
		}

		if ( ! $tooltip)
		{
			return $label;
		}

		return '<label class="hasPopover" title="' . $label . '" data-content="' . htmlentities($tooltip) . '">'
			. $label
			. '</label>';
	}

	protected function getInput()
	{
		$label   = $this->prepareText($this->get('label'));
		$tooltip = $this->prepareText($this->get('description'));

		if ( ! $label && ! $tooltip)
		{
			return '';
		}

		return $this->getText();
	}

	protected function getText()
	{
		$text = JText::_('RL_ONLY_AVAILABLE_IN_PRO');
		$text = '<em>' . $text . '</em>';

		$extension = $this->getExtensionName();

		$alias = RL_Extension::getAliasByName($extension);

		if ($alias)
		{
			$text = '<a href="https://regularlabs.com/' . $extension . '/features" target="_blank">'
				. $text
				. '</a>';
		}

		$class = $this->get('class');
		$class = $class ? ' class="' . $class . '"' : '';

		return '<div' . $class . '>' . $text . '</div>';
	}

	protected function getExtensionName()
	{
		if ($extension = $this->form->getValue('element'))
		{
			return $extension;
		}

		if ($extension = JFactory::getApplication()->input->get('component'))
		{
			return str_replace('com_', '', $extension);
		}

		if ($extension = JFactory::getApplication()->input->get('folder'))
		{
			$extension = explode('.', $extension);

			return array_pop($extension);
		}

		return false;
	}
}
regions.txt000060400000453605152455357510007000 0ustar00// Region codes taken from https://documentation.snoobi.com/region-codes

'--AF' => '','-AF' => 'Afghanistan',
'AF-01' => 'Afghanistan: Badakhshan',
'AF-02' => 'Afghanistan: Badghis',
'AF-03' => 'Afghanistan: Baghlan',
'AF-30' => 'Afghanistan: Balkh',
'AF-05' => 'Afghanistan: Bamian',
'AF-06' => 'Afghanistan: Farah',
'AF-07' => 'Afghanistan: Faryab',
'AF-08' => 'Afghanistan: Ghazni',
'AF-09' => 'Afghanistan: Ghowr',
'AF-10' => 'Afghanistan: Helmand',
'AF-11' => 'Afghanistan: Herat',
'AF-31' => 'Afghanistan: Jowzjan',
'AF-13' => 'Afghanistan: Kabol',
'AF-23' => 'Afghanistan: Kandahar',
'AF-14' => 'Afghanistan: Kapisa',
'AF-37' => 'Afghanistan: Khowst',
'AF-15' => 'Afghanistan: Konar',
'AF-34' => 'Afghanistan: Konar',
'AF-24' => 'Afghanistan: Kondoz',
'AF-16' => 'Afghanistan: Laghman',
'AF-35' => 'Afghanistan: Laghman',
'AF-17' => 'Afghanistan: Lowgar',
'AF-18' => 'Afghanistan: Nangarhar',
'AF-19' => 'Afghanistan: Nimruz',
'AF-38' => 'Afghanistan: Nurestan',
'AF-20' => 'Afghanistan: Oruzgan',
'AF-21' => 'Afghanistan: Paktia',
'AF-36' => 'Afghanistan: Paktia',
'AF-29' => 'Afghanistan: Paktika',
'AF-22' => 'Afghanistan: Parvan',
'AF-32' => 'Afghanistan: Samangan',
'AF-33' => 'Afghanistan: Sar-e Pol',
'AF-26' => 'Afghanistan: Takhar',
'AF-27' => 'Afghanistan: Vardak',
'AF-28' => 'Afghanistan: Zabol',

'--AL' => '','-AL' => 'Albania',
'AL-40' => 'Albania: Berat',
'AL-41' => 'Albania: Diber',
'AL-42' => 'Albania: Durres',
'AL-43' => 'Albania: Elbasan',
'AL-44' => 'Albania: Fier',
'AL-45' => 'Albania: Gjirokaster',
'AL-46' => 'Albania: Korce',
'AL-47' => 'Albania: Kukes',
'AL-48' => 'Albania: Lezhe',
'AL-49' => 'Albania: Shkoder',
'AL-50' => 'Albania: Tirane',
'AL-51' => 'Albania: Vlore',

'--DZ' => '','-DZ' => 'Algeria',
'DZ-34' => 'Algeria: Adrar',
'DZ-35' => 'Algeria: Ain Defla',
'DZ-36' => 'Algeria: Ain Temouchent',
'DZ-01' => 'Algeria: Alger',
'DZ-37' => 'Algeria: Annaba',
'DZ-03' => 'Algeria: Batna',
'DZ-38' => 'Algeria: Bechar',
'DZ-18' => 'Algeria: Bejaia',
'DZ-19' => 'Algeria: Biskra',
'DZ-20' => 'Algeria: Blida',
'DZ-39' => 'Algeria: Bordj Bou Arreridj',
'DZ-21' => 'Algeria: Bouira',
'DZ-40' => 'Algeria: Boumerdes',
'DZ-41' => 'Algeria: Chlef',
'DZ-04' => 'Algeria: Constantine',
'DZ-22' => 'Algeria: Djelfa',
'DZ-42' => 'Algeria: El Bayadh',
'DZ-43' => 'Algeria: El Oued',
'DZ-44' => 'Algeria: El Tarf',
'DZ-45' => 'Algeria: Ghardaia',
'DZ-23' => 'Algeria: Guelma',
'DZ-46' => 'Algeria: Illizi',
'DZ-24' => 'Algeria: Jijel',
'DZ-47' => 'Algeria: Khenchela',
'DZ-25' => 'Algeria: Laghouat',
'DZ-26' => 'Algeria: Mascara',
'DZ-06' => 'Algeria: Medea',
'DZ-48' => 'Algeria: Mila',
'DZ-07' => 'Algeria: Mostaganem',
'DZ-27' => 'Algeria: M\'sila',
'DZ-49' => 'Algeria: Naama',
'DZ-09' => 'Algeria: Oran',
'DZ-50' => 'Algeria: Ouargla',
'DZ-29' => 'Algeria: Oum el Bouaghi',
'DZ-51' => 'Algeria: Relizane',
'DZ-10' => 'Algeria: Saida',
'DZ-12' => 'Algeria: Setif',
'DZ-30' => 'Algeria: Sidi Bel Abbes',
'DZ-31' => 'Algeria: Skikda',
'DZ-52' => 'Algeria: Souk Ahras',
'DZ-53' => 'Algeria: Tamanghasset',
'DZ-33' => 'Algeria: Tebessa',
'DZ-13' => 'Algeria: Tiaret',
'DZ-54' => 'Algeria: Tindouf',
'DZ-55' => 'Algeria: Tipaza',
'DZ-56' => 'Algeria: Tissemsilt',
'DZ-14' => 'Algeria: Tizi Ouzou',
'DZ-15' => 'Algeria: Tlemcen',

'--AD' => '','-AD' => 'Andorra',
'AD-07' => 'Andorra: Andorra la Vella',
'AD-02' => 'Andorra: Canillo',
'AD-03' => 'Andorra: Encamp',
'AD-08' => 'Andorra: Escaldes-Engordany',
'AD-04' => 'Andorra: La Massana',
'AD-05' => 'Andorra: Ordino',
'AD-06' => 'Andorra: Sant Julia de Loria',

'--AO' => '','-AO' => 'Angola',
'AO-19' => 'Angola: Bengo',
'AO-01' => 'Angola: Benguela',
'AO-02' => 'Angola: Bie',
'AO-03' => 'Angola: Cabinda',
'AO-04' => 'Angola: Cuando Cubango',
'AO-05' => 'Angola: Cuanza Norte',
'AO-06' => 'Angola: Cuanza Sul',
'AO-07' => 'Angola: Cunene',
'AO-08' => 'Angola: Huambo',
'AO-09' => 'Angola: Huila',
'AO-20' => 'Angola: Luanda',
'AO-17' => 'Angola: Lunda Norte',
'AO-18' => 'Angola: Lunda Sul',
'AO-12' => 'Angola: Malanje',
'AO-14' => 'Angola: Moxico',
'AO-15' => 'Angola: Uige',
'AO-16' => 'Angola: Zaire',

'--AG' => '','-AG' => 'Antigua and Barbuda',
'AG-01' => 'Antigua and Barbuda: Barbuda',
'AG-03' => 'Antigua and Barbuda: Saint George',
'AG-04' => 'Antigua and Barbuda: Saint John',
'AG-05' => 'Antigua and Barbuda: Saint Mary',
'AG-06' => 'Antigua and Barbuda: Saint Paul',
'AG-07' => 'Antigua and Barbuda: Saint Peter',
'AG-08' => 'Antigua and Barbuda: Saint Philip',

'--AR' => '','-AR' => 'Argentina',
'AR-01' => 'Argentina: Buenos Aires',
'AR-02' => 'Argentina: Catamarca',
'AR-03' => 'Argentina: Chaco',
'AR-04' => 'Argentina: Chubut',
'AR-05' => 'Argentina: Cordoba',
'AR-06' => 'Argentina: Corrientes',
'AR-07' => 'Argentina: Distrito Federal',
'AR-08' => 'Argentina: Entre Rios',
'AR-09' => 'Argentina: Formosa',
'AR-10' => 'Argentina: Jujuy',
'AR-11' => 'Argentina: La Pampa',
'AR-12' => 'Argentina: La Rioja',
'AR-13' => 'Argentina: Mendoza',
'AR-14' => 'Argentina: Misiones',
'AR-15' => 'Argentina: Neuquen',
'AR-16' => 'Argentina: Rio Negro',
'AR-17' => 'Argentina: Salta',
'AR-18' => 'Argentina: San Juan',
'AR-19' => 'Argentina: San Luis',
'AR-20' => 'Argentina: Santa Cruz',
'AR-21' => 'Argentina: Santa Fe',
'AR-22' => 'Argentina: Santiago del Estero',
'AR-23' => 'Argentina: Tierra del Fuego',
'AR-24' => 'Argentina: Tucuman',

'--AM' => '','-AM' => 'Armenia',
'AM-01' => 'Armenia: Aragatsotn',
'AM-02' => 'Armenia: Ararat',
'AM-03' => 'Armenia: Armavir',
'AM-04' => 'Armenia: Geghark\'unik\'',
'AM-05' => 'Armenia: Kotayk\'',
'AM-06' => 'Armenia: Lorri',
'AM-07' => 'Armenia: Shirak',
'AM-08' => 'Armenia: Syunik\'',
'AM-09' => 'Armenia: Tavush',
'AM-10' => 'Armenia: Vayots\' Dzor',
'AM-11' => 'Armenia: Yerevan',

'--AU' => '','-AU' => 'Australia',
'AU-01' => 'Australia: Australian Capital Territory',
'AU-02' => 'Australia: New South Wales',
'AU-03' => 'Australia: Northern Territory',
'AU-04' => 'Australia: Queensland',
'AU-05' => 'Australia: South Australia',
'AU-06' => 'Australia: Tasmania',
'AU-07' => 'Australia: Victoria',
'AU-08' => 'Australia: Western Australia',

'--AT' => '','-AT' => 'Austria',
'AT-01' => 'Austria: Burgenland',
'AT-02' => 'Austria: Karnten',
'AT-03' => 'Austria: Niederosterreich',
'AT-04' => 'Austria: Oberosterreich',
'AT-05' => 'Austria: Salzburg',
'AT-06' => 'Austria: Steiermark',
'AT-07' => 'Austria: Tirol',
'AT-08' => 'Austria: Vorarlberg',
'AT-09' => 'Austria: Wien',

'--AZ' => '','-AZ' => 'Azerbaijan',
'AZ-01' => 'Azerbaijan: Abseron',
'AZ-02' => 'Azerbaijan: Agcabadi',
'AZ-03' => 'Azerbaijan: Agdam',
'AZ-04' => 'Azerbaijan: Agdas',
'AZ-05' => 'Azerbaijan: Agstafa',
'AZ-06' => 'Azerbaijan: Agsu',
'AZ-07' => 'Azerbaijan: Ali Bayramli',
'AZ-08' => 'Azerbaijan: Astara',
'AZ-09' => 'Azerbaijan: Baki',
'AZ-10' => 'Azerbaijan: Balakan',
'AZ-11' => 'Azerbaijan: Barda',
'AZ-12' => 'Azerbaijan: Beylaqan',
'AZ-13' => 'Azerbaijan: Bilasuvar',
'AZ-14' => 'Azerbaijan: Cabrayil',
'AZ-15' => 'Azerbaijan: Calilabad',
'AZ-16' => 'Azerbaijan: Daskasan',
'AZ-17' => 'Azerbaijan: Davaci',
'AZ-18' => 'Azerbaijan: Fuzuli',
'AZ-19' => 'Azerbaijan: Gadabay',
'AZ-20' => 'Azerbaijan: Ganca',
'AZ-21' => 'Azerbaijan: Goranboy',
'AZ-22' => 'Azerbaijan: Goycay',
'AZ-23' => 'Azerbaijan: Haciqabul',
'AZ-24' => 'Azerbaijan: Imisli',
'AZ-25' => 'Azerbaijan: Ismayilli',
'AZ-26' => 'Azerbaijan: Kalbacar',
'AZ-27' => 'Azerbaijan: Kurdamir',
'AZ-28' => 'Azerbaijan: Lacin',
'AZ-29' => 'Azerbaijan: Lankaran',
'AZ-30' => 'Azerbaijan: Lankaran',
'AZ-31' => 'Azerbaijan: Lerik',
'AZ-32' => 'Azerbaijan: Masalli',
'AZ-33' => 'Azerbaijan: Mingacevir',
'AZ-34' => 'Azerbaijan: Naftalan',
'AZ-35' => 'Azerbaijan: Naxcivan',
'AZ-36' => 'Azerbaijan: Neftcala',
'AZ-37' => 'Azerbaijan: Oguz',
'AZ-38' => 'Azerbaijan: Qabala',
'AZ-39' => 'Azerbaijan: Qax',
'AZ-40' => 'Azerbaijan: Qazax',
'AZ-41' => 'Azerbaijan: Qobustan',
'AZ-42' => 'Azerbaijan: Quba',
'AZ-43' => 'Azerbaijan: Qubadli',
'AZ-44' => 'Azerbaijan: Qusar',
'AZ-45' => 'Azerbaijan: Saatli',
'AZ-46' => 'Azerbaijan: Sabirabad',
'AZ-47' => 'Azerbaijan: Saki',
'AZ-48' => 'Azerbaijan: Saki',
'AZ-49' => 'Azerbaijan: Salyan',
'AZ-50' => 'Azerbaijan: Samaxi',
'AZ-51' => 'Azerbaijan: Samkir',
'AZ-52' => 'Azerbaijan: Samux',
'AZ-53' => 'Azerbaijan: Siyazan',
'AZ-54' => 'Azerbaijan: Sumqayit',
'AZ-55' => 'Azerbaijan: Susa',
'AZ-56' => 'Azerbaijan: Susa',
'AZ-57' => 'Azerbaijan: Tartar',
'AZ-58' => 'Azerbaijan: Tovuz',
'AZ-59' => 'Azerbaijan: Ucar',
'AZ-60' => 'Azerbaijan: Xacmaz',
'AZ-61' => 'Azerbaijan: Xankandi',
'AZ-62' => 'Azerbaijan: Xanlar',
'AZ-63' => 'Azerbaijan: Xizi',
'AZ-64' => 'Azerbaijan: Xocali',
'AZ-65' => 'Azerbaijan: Xocavand',
'AZ-66' => 'Azerbaijan: Yardimli',
'AZ-67' => 'Azerbaijan: Yevlax',
'AZ-68' => 'Azerbaijan: Yevlax',
'AZ-69' => 'Azerbaijan: Zangilan',
'AZ-70' => 'Azerbaijan: Zaqatala',
'AZ-71' => 'Azerbaijan: Zardab',

'--BS' => '','-BS' => 'Bahamas',
'BS-24' => 'Bahamas: Acklins and Crooked Islands',
'BS-05' => 'Bahamas: Bimini',
'BS-06' => 'Bahamas: Cat Island',
'BS-10' => 'Bahamas: Exuma',
'BS-25' => 'Bahamas: Freeport',
'BS-26' => 'Bahamas: Fresh Creek',
'BS-27' => 'Bahamas: Governor\'s Harbour',
'BS-28' => 'Bahamas: Green Turtle Cay',
'BS-22' => 'Bahamas: Harbour Island',
'BS-29' => 'Bahamas: High Rock',
'BS-13' => 'Bahamas: Inagua',
'BS-30' => 'Bahamas: Kemps Bay',
'BS-15' => 'Bahamas: Long Island',
'BS-31' => 'Bahamas: Marsh Harbour',
'BS-16' => 'Bahamas: Mayaguana',
'BS-23' => 'Bahamas: New Providence',
'BS-32' => 'Bahamas: Nichollstown and Berry Islands',
'BS-18' => 'Bahamas: Ragged Island',
'BS-33' => 'Bahamas: Rock Sound',
'BS-35' => 'Bahamas: San Salvador and Rum Cay',
'BS-34' => 'Bahamas: Sandy Point',

'--BH' => '','-BH' => 'Bahrain',
'BH-01' => 'Bahrain: Al Hadd',
'BH-02' => 'Bahrain: Al Manamah',
'BH-08' => 'Bahrain: Al Mintaqah al Gharbiyah',
'BH-11' => 'Bahrain: Al Mintaqah al Wusta',
'BH-10' => 'Bahrain: Al Mintaqah ash Shamaliyah',
'BH-03' => 'Bahrain: Al Muharraq',
'BH-13' => 'Bahrain: Ar Rifa',
'BH-05' => 'Bahrain: Jidd Hafs',
'BH-14' => 'Bahrain: Madinat Hamad',
'BH-12' => 'Bahrain: Madinat',
'BH-09' => 'Bahrain: Mintaqat Juzur Hawar',
'BH-06' => 'Bahrain: Sitrah',

'--BD' => '','-BD' => 'Bangladesh',
'BD-22' => 'Bangladesh: Bagerhat',
'BD-04' => 'Bangladesh: Bandarban',
'BD-25' => 'Bangladesh: Barguna',
'BD-01' => 'Bangladesh: Barisal',
'BD-23' => 'Bangladesh: Bhola',
'BD-24' => 'Bangladesh: Bogra',
'BD-26' => 'Bangladesh: Brahmanbaria',
'BD-27' => 'Bangladesh: Chandpur',
'BD-28' => 'Bangladesh: Chapai Nawabganj',
'BD-29' => 'Bangladesh: Chattagram',
'BD-30' => 'Bangladesh: Chuadanga',
'BD-05' => 'Bangladesh: Comilla',
'BD-31' => 'Bangladesh: Cox\'s Bazar',
'BD-32' => 'Bangladesh: Dhaka',
'BD-33' => 'Bangladesh: Dinajpur',
'BD-34' => 'Bangladesh: Faridpur',
'BD-35' => 'Bangladesh: Feni',
'BD-36' => 'Bangladesh: Gaibandha',
'BD-37' => 'Bangladesh: Gazipur',
'BD-38' => 'Bangladesh: Gopalganj',
'BD-39' => 'Bangladesh: Habiganj',
'BD-40' => 'Bangladesh: Jaipurhat',
'BD-41' => 'Bangladesh: Jamalpur',
'BD-42' => 'Bangladesh: Jessore',
'BD-43' => 'Bangladesh: Jhalakati',
'BD-44' => 'Bangladesh: Jhenaidah',
'BD-45' => 'Bangladesh: Khagrachari',
'BD-46' => 'Bangladesh: Khulna',
'BD-47' => 'Bangladesh: Kishorganj',
'BD-48' => 'Bangladesh: Kurigram',
'BD-49' => 'Bangladesh: Kushtia',
'BD-50' => 'Bangladesh: Laksmipur',
'BD-51' => 'Bangladesh: Lalmonirhat',
'BD-52' => 'Bangladesh: Madaripur',
'BD-53' => 'Bangladesh: Magura',
'BD-54' => 'Bangladesh: Manikganj',
'BD-55' => 'Bangladesh: Meherpur',
'BD-56' => 'Bangladesh: Moulavibazar',
'BD-57' => 'Bangladesh: Munshiganj',
'BD-12' => 'Bangladesh: Mymensingh',
'BD-58' => 'Bangladesh: Naogaon',
'BD-59' => 'Bangladesh: Narail',
'BD-60' => 'Bangladesh: Narayanganj',
'BD-61' => 'Bangladesh: Narsingdi',
'BD-62' => 'Bangladesh: Nator',
'BD-63' => 'Bangladesh: Netrakona',
'BD-64' => 'Bangladesh: Nilphamari',
'BD-13' => 'Bangladesh: Noakhali',
'BD-65' => 'Bangladesh: Pabna',
'BD-66' => 'Bangladesh: Panchagar',
'BD-67' => 'Bangladesh: Parbattya Chattagram',
'BD-15' => 'Bangladesh: Patuakhali',
'BD-68' => 'Bangladesh: Pirojpur',
'BD-69' => 'Bangladesh: Rajbari',
'BD-70' => 'Bangladesh: Rajshahi',
'BD-71' => 'Bangladesh: Rangpur',
'BD-72' => 'Bangladesh: Satkhira',
'BD-73' => 'Bangladesh: Shariyatpur',
'BD-74' => 'Bangladesh: Sherpur',
'BD-75' => 'Bangladesh: Sirajganj',
'BD-76' => 'Bangladesh: Sunamganj',
'BD-77' => 'Bangladesh: Sylhet',
'BD-78' => 'Bangladesh: Tangail',
'BD-79' => 'Bangladesh: Thakurgaon',

'--BB' => '','-BB' => 'Barbados',
'BB-01' => 'Barbados: Christ Church',
'BB-02' => 'Barbados: Saint Andrew',
'BB-03' => 'Barbados: Saint George',
'BB-04' => 'Barbados: Saint James',
'BB-05' => 'Barbados: Saint John',
'BB-06' => 'Barbados: Saint Joseph',
'BB-07' => 'Barbados: Saint Lucy',
'BB-08' => 'Barbados: Saint Michael',
'BB-09' => 'Barbados: Saint Peter',
'BB-10' => 'Barbados: Saint Philip',
'BB-11' => 'Barbados: Saint Thomas',

'--BY' => '','-BY' => 'Belarus',
'BY-01' => 'Belarus: Brestskaya Voblasts\'',
'BY-02' => 'Belarus: Homyel\'skaya Voblasts\'',
'BY-03' => 'Belarus: Hrodzyenskaya Voblasts\'',
'BY-06' => 'Belarus: Mahilyowskaya Voblasts\'',
'BY-04' => 'Belarus: Minsk',
'BY-05' => 'Belarus: Minskaya Voblasts\'',
'BY-07' => 'Belarus: Vitsyebskaya Voblasts\'',

'--BE' => '','-BE' => 'Belgium',
'BE-01' => 'Belgium: Antwerpen',
'BE-10' => 'Belgium: Brabant Wallon',
'BE-02' => 'Belgium: Brabant',
'BE-11' => 'Belgium: Brussels Hoofdstedelijk Gewest',
'BE-03' => 'Belgium: Hainaut',
'BE-04' => 'Belgium: Liege',
'BE-05' => 'Belgium: Limburg',
'BE-06' => 'Belgium: Luxembourg',
'BE-07' => 'Belgium: Namur',
'BE-08' => 'Belgium: Oost-Vlaanderen',
'BE-12' => 'Belgium: Vlaams-Brabant',
'BE-09' => 'Belgium: West-Vlaanderen',

'--BZ' => '','-BZ' => 'Belize',
'BZ-01' => 'Belize: Belize',
'BZ-02' => 'Belize: Cayo',
'BZ-03' => 'Belize: Corozal',
'BZ-04' => 'Belize: Orange Walk',
'BZ-05' => 'Belize: Stann Creek',
'BZ-06' => 'Belize: Toledo',

'--BJ' => '','-BJ' => 'Benin',
'BJ-01' => 'Benin: Atakora',
'BJ-02' => 'Benin: Atlantique',
'BJ-03' => 'Benin: Borgou',
'BJ-04' => 'Benin: Mono',
'BJ-05' => 'Benin: Oueme',
'BJ-06' => 'Benin: Zou',

'--BM' => '','-BM' => 'Bermuda',
'BM-01' => 'Bermuda: Devonshire',
'BM-02' => 'Bermuda: Hamilton',
'BM-03' => 'Bermuda: Hamilton',
'BM-04' => 'Bermuda: Paget',
'BM-05' => 'Bermuda: Pembroke',
'BM-06' => 'Bermuda: Saint George',
'BM-07' => 'Bermuda: Saint George\'s',
'BM-08' => 'Bermuda: Sandys',
'BM-09' => 'Bermuda: Smiths',
'BM-10' => 'Bermuda: Southampton',
'BM-11' => 'Bermuda: Warwick',

'--BT' => '','-BT' => 'Bhutan',
'BT-05' => 'Bhutan: Bumthang',
'BT-06' => 'Bhutan: Chhukha',
'BT-07' => 'Bhutan: Chirang',
'BT-08' => 'Bhutan: Daga',
'BT-09' => 'Bhutan: Geylegphug',
'BT-10' => 'Bhutan: Ha',
'BT-11' => 'Bhutan: Lhuntshi',
'BT-12' => 'Bhutan: Mongar',
'BT-13' => 'Bhutan: Paro',
'BT-14' => 'Bhutan: Pemagatsel',
'BT-15' => 'Bhutan: Punakha',
'BT-16' => 'Bhutan: Samchi',
'BT-17' => 'Bhutan: Samdrup',
'BT-18' => 'Bhutan: Shemgang',
'BT-19' => 'Bhutan: Tashigang',
'BT-20' => 'Bhutan: Thimphu',
'BT-21' => 'Bhutan: Tongsa',
'BT-22' => 'Bhutan: Wangdi Phodrang',

'--BO' => '','-BO' => 'Bolivia',
'BO-01' => 'Bolivia: Chuquisaca',
'BO-02' => 'Bolivia: Cochabamba',
'BO-03' => 'Bolivia: El Beni',
'BO-04' => 'Bolivia: La Paz',
'BO-05' => 'Bolivia: Oruro',
'BO-06' => 'Bolivia: Pando',
'BO-07' => 'Bolivia: Potosi',
'BO-08' => 'Bolivia: Santa Cruz',
'BO-09' => 'Bolivia: Tarija',

'--BA' => '','-BA' => 'Bosnia and Herzegovina',
'BA-01' => 'Bosnia and Herzegovina: Federation of Bosnia and Herzegovina',
'BA-02' => 'Bosnia and Herzegovina: Republika Srpska',

'--BW' => '','-BW' => 'Botswana',
'BW-01' => 'Botswana: Central',
'BW-02' => 'Botswana: Chobe',
'BW-03' => 'Botswana: Ghanzi',
'BW-04' => 'Botswana: Kgalagadi',
'BW-05' => 'Botswana: Kgatleng',
'BW-06' => 'Botswana: Kweneng',
'BW-07' => 'Botswana: Ngamiland',
'BW-08' => 'Botswana: North-East',
'BW-09' => 'Botswana: South-East',
'BW-10' => 'Botswana: Southern',

'--BR' => '','-BR' => 'Brazil',
'BR-01' => 'Brazil: Acre',
'BR-02' => 'Brazil: Alagoas',
'BR-03' => 'Brazil: Amapa',
'BR-04' => 'Brazil: Amazonas',
'BR-05' => 'Brazil: Bahia',
'BR-06' => 'Brazil: Ceara',
'BR-07' => 'Brazil: Distrito Federal',
'BR-08' => 'Brazil: Espirito Santo',
'BR-29' => 'Brazil: Goias',
'BR-13' => 'Brazil: Maranhao',
'BR-11' => 'Brazil: Mato Grosso do Sul',
'BR-14' => 'Brazil: Mato Grosso',
'BR-15' => 'Brazil: Minas Gerais',
'BR-16' => 'Brazil: Para',
'BR-17' => 'Brazil: Paraiba',
'BR-18' => 'Brazil: Parana',
'BR-30' => 'Brazil: Pernambuco',
'BR-20' => 'Brazil: Piaui',
'BR-21' => 'Brazil: Rio de Janeiro',
'BR-22' => 'Brazil: Rio Grande do Norte',
'BR-23' => 'Brazil: Rio Grande do Sul',
'BR-24' => 'Brazil: Rondonia',
'BR-25' => 'Brazil: Roraima',
'BR-26' => 'Brazil: Santa Catarina',
'BR-27' => 'Brazil: Sao Paulo',
'BR-28' => 'Brazil: Sergipe',
'BR-31' => 'Brazil: Tocantins',

'--BN' => '','-BN' => 'Brunei Darussalam',
'BN-07' => 'Brunei Darussalam: Alibori',
'BN-08' => 'Brunei Darussalam: Belait',
'BN-09' => 'Brunei Darussalam: Brunei and Muara',
'BN-11' => 'Brunei Darussalam: Collines',
'BN-13' => 'Brunei Darussalam: Donga',
'BN-12' => 'Brunei Darussalam: Kouffo',
'BN-14' => 'Brunei Darussalam: Littoral',
'BN-16' => 'Brunei Darussalam: Oueme',
'BN-17' => 'Brunei Darussalam: Plateau',
'BN-10' => 'Brunei Darussalam: Temburong',
'BN-15' => 'Brunei Darussalam: Tutong',
'BN-18' => 'Brunei Darussalam: Zou',

'--BG' => '','-BG' => 'Bulgaria',
'BG-38' => 'Bulgaria: Blagoevgrad',
'BG-39' => 'Bulgaria: Burgas',
'BG-40' => 'Bulgaria: Dobrich',
'BG-41' => 'Bulgaria: Gabrovo',
'BG-42' => 'Bulgaria: Grad Sofiya',
'BG-43' => 'Bulgaria: Khaskovo',
'BG-44' => 'Bulgaria: Kurdzhali',
'BG-45' => 'Bulgaria: Kyustendil',
'BG-46' => 'Bulgaria: Lovech',
'BG-33' => 'Bulgaria: Mikhaylovgrad',
'BG-47' => 'Bulgaria: Montana',
'BG-48' => 'Bulgaria: Pazardzhik',
'BG-49' => 'Bulgaria: Pernik',
'BG-50' => 'Bulgaria: Pleven',
'BG-51' => 'Bulgaria: Plovdiv',
'BG-52' => 'Bulgaria: Razgrad',
'BG-53' => 'Bulgaria: Ruse',
'BG-54' => 'Bulgaria: Shumen',
'BG-55' => 'Bulgaria: Silistra',
'BG-56' => 'Bulgaria: Sliven',
'BG-57' => 'Bulgaria: Smolyan',
'BG-58' => 'Bulgaria: Sofiya',
'BG-59' => 'Bulgaria: Stara Zagora',
'BG-60' => 'Bulgaria: Turgovishte',
'BG-61' => 'Bulgaria: Varna',
'BG-62' => 'Bulgaria: Veliko Turnovo',
'BG-63' => 'Bulgaria: Vidin',
'BG-64' => 'Bulgaria: Vratsa',
'BG-65' => 'Bulgaria: Yambol',

'--BF' => '','-BF' => 'Burkina Faso',
'BF-45' => 'Burkina Faso: Bale',
'BF-15' => 'Burkina Faso: Bam',
'BF-46' => 'Burkina Faso: Banwa',
'BF-47' => 'Burkina Faso: Bazega',
'BF-48' => 'Burkina Faso: Bougouriba',
'BF-49' => 'Burkina Faso: Boulgou',
'BF-19' => 'Burkina Faso: Boulkiemde',
'BF-20' => 'Burkina Faso: Ganzourgou',
'BF-21' => 'Burkina Faso: Gnagna',
'BF-50' => 'Burkina Faso: Gourma',
'BF-51' => 'Burkina Faso: Houet',
'BF-52' => 'Burkina Faso: Ioba',
'BF-53' => 'Burkina Faso: Kadiogo',
'BF-54' => 'Burkina Faso: Kenedougou',
'BF-55' => 'Burkina Faso: Komoe',
'BF-56' => 'Burkina Faso: Komondjari',
'BF-57' => 'Burkina Faso: Kompienga',
'BF-58' => 'Burkina Faso: Kossi',
'BF-59' => 'Burkina Faso: Koulpelogo',
'BF-28' => 'Burkina Faso: Kouritenga',
'BF-60' => 'Burkina Faso: Kourweogo',
'BF-61' => 'Burkina Faso: Leraba',
'BF-62' => 'Burkina Faso: Loroum',
'BF-63' => 'Burkina Faso: Mouhoun',
'BF-64' => 'Burkina Faso: Namentenga',
'BF-65' => 'Burkina Faso: Naouri',
'BF-66' => 'Burkina Faso: Nayala',
'BF-67' => 'Burkina Faso: Noumbiel',
'BF-68' => 'Burkina Faso: Oubritenga',
'BF-33' => 'Burkina Faso: Oudalan',
'BF-34' => 'Burkina Faso: Passore',
'BF-69' => 'Burkina Faso: Poni',
'BF-36' => 'Burkina Faso: Sanguie',
'BF-70' => 'Burkina Faso: Sanmatenga',
'BF-71' => 'Burkina Faso: Seno',
'BF-72' => 'Burkina Faso: Sissili',
'BF-40' => 'Burkina Faso: Soum',
'BF-73' => 'Burkina Faso: Sourou',
'BF-42' => 'Burkina Faso: Tapoa',
'BF-74' => 'Burkina Faso: Tuy',
'BF-75' => 'Burkina Faso: Yagha',
'BF-76' => 'Burkina Faso: Yatenga',
'BF-77' => 'Burkina Faso: Ziro',
'BF-78' => 'Burkina Faso: Zondoma',
'BF-44' => 'Burkina Faso: Zoundweogo',

'--BI' => '','-BI' => 'Burundi',
'BI-09' => 'Burundi: Bubanza',
'BI-02' => 'Burundi: Bujumbura',
'BI-10' => 'Burundi: Bururi',
'BI-11' => 'Burundi: Cankuzo',
'BI-12' => 'Burundi: Cibitoke',
'BI-13' => 'Burundi: Gitega',
'BI-14' => 'Burundi: Karuzi',
'BI-15' => 'Burundi: Kayanza',
'BI-16' => 'Burundi: Kirundo',
'BI-17' => 'Burundi: Makamba',
'BI-22' => 'Burundi: Muramvya',
'BI-18' => 'Burundi: Muyinga',
'BI-23' => 'Burundi: Mwaro',
'BI-19' => 'Burundi: Ngozi',
'BI-20' => 'Burundi: Rutana',
'BI-21' => 'Burundi: Ruyigi',

'--KH' => '','-KH' => 'Cambodia',
'KH-29' => 'Cambodia: Batdambang',
'KH-02' => 'Cambodia: Kampong Cham',
'KH-03' => 'Cambodia: Kampong Chhnang',
'KH-04' => 'Cambodia: Kampong Spoe',
'KH-05' => 'Cambodia: Kampong Thum',
'KH-06' => 'Cambodia: Kampot',
'KH-07' => 'Cambodia: Kandal',
'KH-08' => 'Cambodia: Kaoh Kong',
'KH-09' => 'Cambodia: Kracheh',
'KH-10' => 'Cambodia: Mondol Kiri',
'KH-30' => 'Cambodia: Pailin',
'KH-11' => 'Cambodia: Phnum Penh',
'KH-12' => 'Cambodia: Pouthisat',
'KH-13' => 'Cambodia: Preah Vihear',
'KH-14' => 'Cambodia: Prey Veng',
'KH-15' => 'Cambodia: Rotanokiri',
'KH-16' => 'Cambodia: Siemreab-Otdar Meanchey',
'KH-17' => 'Cambodia: Stoeng Treng',
'KH-18' => 'Cambodia: Svay Rieng',
'KH-19' => 'Cambodia: Takev',

'--CM' => '','-CM' => 'Cameroon',
'CM-10' => 'Cameroon: Adamaoua',
'CM-11' => 'Cameroon: Centre',
'CM-04' => 'Cameroon: Est',
'CM-12' => 'Cameroon: Extreme-Nord',
'CM-05' => 'Cameroon: Littoral',
'CM-13' => 'Cameroon: Nord',
'CM-07' => 'Cameroon: Nord-Ouest',
'CM-08' => 'Cameroon: Ouest',
'CM-14' => 'Cameroon: Sud',
'CM-09' => 'Cameroon: Sud-Ouest',

'--CA' => '','-CA' => 'Canada',
'CA-AB' => 'Canada: Alberta',
'CA-BC' => 'Canada: British Columbia',
'CA-MB' => 'Canada: Manitoba',
'CA-NB' => 'Canada: New Brunswick',
'CA-NL' => 'Canada: Newfoundland',
'CA-NT' => 'Canada: Northwest Territories',
'CA-NS' => 'Canada: Nova Scotia',
'CA-NU' => 'Canada: Nunavut',
'CA-ON' => 'Canada: Ontario',
'CA-PE' => 'Canada: Prince Edward Island',
'CA-QC' => 'Canada: Quebec',
'CA-SK' => 'Canada: Saskatchewan',
'CA-YT' => 'Canada: Yukon Territory',

'--CV' => '','-CV' => 'Cape Verde',
'CV-01' => 'Cape Verde: Boa Vista',
'CV-02' => 'Cape Verde: Brava',
'CV-04' => 'Cape Verde: Maio',
'CV-13' => 'Cape Verde: Mosteiros',
'CV-05' => 'Cape Verde: Paul',
'CV-14' => 'Cape Verde: Praia',
'CV-07' => 'Cape Verde: Ribeira Grande',
'CV-08' => 'Cape Verde: Sal',
'CV-15' => 'Cape Verde: Santa Catarina',
'CV-16' => 'Cape Verde: Santa Cruz',
'CV-17' => 'Cape Verde: Sao Domingos',
'CV-18' => 'Cape Verde: Sao Filipe',
'CV-19' => 'Cape Verde: Sao Miguel',
'CV-10' => 'Cape Verde: Sao Nicolau',
'CV-11' => 'Cape Verde: Sao Vicente',
'CV-20' => 'Cape Verde: Tarrafal',

'--KY' => '','-KY' => 'Cayman Islands',
'KY-01' => 'Cayman Islands: Creek',
'KY-02' => 'Cayman Islands: Eastern',
'KY-03' => 'Cayman Islands: Midland',
'KY-04' => 'Cayman Islands: South Town',
'KY-05' => 'Cayman Islands: Spot Bay',
'KY-06' => 'Cayman Islands: Stake Bay',
'KY-07' => 'Cayman Islands: West End',
'KY-08' => 'Cayman Islands: Western',

'--CF' => '','-CF' => 'Central African Republic',
'CF-01' => 'Central African Republic: Bamingui-Bangoran',
'CF-18' => 'Central African Republic: Bangui',
'CF-02' => 'Central African Republic: Basse-Kotto',
'CF-03' => 'Central African Republic: Haute-Kotto',
'CF-05' => 'Central African Republic: Haut-Mbomou',
'CF-06' => 'Central African Republic: Kemo',
'CF-07' => 'Central African Republic: Lobaye',
'CF-04' => 'Central African Republic: Mambere-Kadei',
'CF-08' => 'Central African Republic: Mbomou',
'CF-15' => 'Central African Republic: Nana-Grebizi',
'CF-09' => 'Central African Republic: Nana-Mambere',
'CF-17' => 'Central African Republic: Ombella-Mpoko',
'CF-11' => 'Central African Republic: Ouaka',
'CF-12' => 'Central African Republic: Ouham',
'CF-13' => 'Central African Republic: Ouham-Pende',
'CF-16' => 'Central African Republic: Sangha-Mbaere',
'CF-14' => 'Central African Republic: Vakaga',

'--TD' => '','-TD' => 'Chad',
'TD-01' => 'Chad: Batha',
'TD-02' => 'Chad: Biltine',
'TD-03' => 'Chad: Borkou-Ennedi-Tibesti',
'TD-04' => 'Chad: Chari-Baguirmi',
'TD-05' => 'Chad: Guera',
'TD-06' => 'Chad: Kanem',
'TD-07' => 'Chad: Lac',
'TD-08' => 'Chad: Logone Occidental',
'TD-09' => 'Chad: Logone Oriental',
'TD-10' => 'Chad: Mayo-Kebbi',
'TD-11' => 'Chad: Moyen-Chari',
'TD-12' => 'Chad: Ouaddai',
'TD-13' => 'Chad: Salamat',
'TD-14' => 'Chad: Tandjile',

'--CL' => '','-CL' => 'Chile',
'CL-02' => 'Chile: Aisen del General Carlos Ibanez del Campo',
'CL-03' => 'Chile: Antofagasta',
'CL-04' => 'Chile: Araucania',
'CL-05' => 'Chile: Atacama',
'CL-06' => 'Chile: Bio-Bio',
'CL-07' => 'Chile: Coquimbo',
'CL-08' => 'Chile: Libertador General Bernardo O\'Higgins',
'CL-09' => 'Chile: Los Lagos',
'CL-10' => 'Chile: Magallanes y de la Antartica Chilena',
'CL-11' => 'Chile: Maule',
'CL-12' => 'Chile: Region Metropolitana',
'CL-13' => 'Chile: Tarapaca',
'CL-01' => 'Chile: Valparaiso',

'--CN' => '','-CN' => 'China',
'CN-01' => 'China: Anhui',
'CN-22' => 'China: Beijing',
'CN-33' => 'China: Chongqing',
'CN-07' => 'China: Fujian',
'CN-15' => 'China: Gansu',
'CN-30' => 'China: Guangdong',
'CN-16' => 'China: Guangxi',
'CN-18' => 'China: Guizhou',
'CN-31' => 'China: Hainan',
'CN-10' => 'China: Hebei',
'CN-08' => 'China: Heilongjiang',
'CN-09' => 'China: Henan',
'CN-12' => 'China: Hubei',
'CN-11' => 'China: Hunan',
'CN-04' => 'China: Jiangsu',
'CN-03' => 'China: Jiangxi',
'CN-05' => 'China: Jilin',
'CN-19' => 'China: Liaoning',
'CN-20' => 'China: Nei Mongol',
'CN-21' => 'China: Ningxia',
'CN-06' => 'China: Qinghai',
'CN-26' => 'China: Shaanxi',
'CN-25' => 'China: Shandong',
'CN-23' => 'China: Shanghai',
'CN-24' => 'China: Shanxi',
'CN-32' => 'China: Sichuan',
'CN-28' => 'China: Tianjin',
'CN-13' => 'China: Xinjiang',
'CN-14' => 'China: Xizang',
'CN-29' => 'China: Yunnan',
'CN-02' => 'China: Zhejiang',

'--CO' => '','-CO' => 'Colombia',
'CO-01' => 'Colombia: Amazonas',
'CO-02' => 'Colombia: Antioquia',
'CO-03' => 'Colombia: Arauca',
'CO-04' => 'Colombia: Atlantico',
'CO-35' => 'Colombia: Bolivar',
'CO-36' => 'Colombia: Boyaca',
'CO-37' => 'Colombia: Caldas',
'CO-08' => 'Colombia: Caqueta',
'CO-32' => 'Colombia: Casanare',
'CO-09' => 'Colombia: Cauca',
'CO-10' => 'Colombia: Cesar',
'CO-11' => 'Colombia: Choco',
'CO-12' => 'Colombia: Cordoba',
'CO-33' => 'Colombia: Cundinamarca',
'CO-34' => 'Colombia: Distrito Especial',
'CO-15' => 'Colombia: Guainia',
'CO-14' => 'Colombia: Guaviare',
'CO-16' => 'Colombia: Huila',
'CO-17' => 'Colombia: La Guajira',
'CO-38' => 'Colombia: Magdalena',
'CO-19' => 'Colombia: Meta',
'CO-20' => 'Colombia: Narino',
'CO-21' => 'Colombia: Norte de Santander',
'CO-22' => 'Colombia: Putumayo',
'CO-23' => 'Colombia: Quindio',
'CO-24' => 'Colombia: Risaralda',
'CO-25' => 'Colombia: San Andres y Providencia',
'CO-26' => 'Colombia: Santander',
'CO-27' => 'Colombia: Sucre',
'CO-28' => 'Colombia: Tolima',
'CO-29' => 'Colombia: Valle del Cauca',
'CO-30' => 'Colombia: Vaupes',
'CO-31' => 'Colombia: Vichada',

'--KM' => '','-KM' => 'Comoros',
'KM-01' => 'Comoros: Anjouan',
'KM-02' => 'Comoros: Grande Comore',
'KM-03' => 'Comoros: Moheli',

'--CD' => '','-CD' => 'Congo',
'CD-01' => 'Congo: Bandundu',
'CD-08' => 'Congo: Bas-Congo',

'--CG' => '','-CG' => 'Congo',
'CG-01' => 'Congo: Bouenza',
'CG-12' => 'Congo: Brazzamark',
'CG-03' => 'Congo: Cuvette',

'--CD' => '','-CD' => 'Congo',
'CD-02' => 'Congo: Equateur',
'CD-03' => 'Congo: Kasai-Occidental',
'CD-04' => 'Congo: Kasai-Oriental',
'CD-05' => 'Congo: Katanga',
'CD-06' => 'Congo: Kinshasa',
'CD-07' => 'Congo: Kivu',

'--CG' => '','-CG' => 'Congo',
'CG-04' => 'Congo: Kouilou',
'CG-05' => 'Congo: Lekoumou',
'CG-06' => 'Congo: Likouala',

'--CD' => '','-CD' => 'Congo',
'CD-10' => 'Congo: Maniema',

'--CG' => '','-CG' => 'Congo',
'CG-07' => 'Congo: Niari',

'--CD' => '','-CD' => 'Congo',
'CD-11' => 'Congo: Nord-Kivu',
'CD-09' => 'Congo: Orientale',

'--CG' => '','-CG' => 'Congo',
'CG-08' => 'Congo: Plateaux',
'CG-11' => 'Congo: Pool',
'CG-10' => 'Congo: Sangha',

'--CD' => '','-CD' => 'Congo',
'CD-12' => 'Congo: Sud-Kivu',

'--CR' => '','-CR' => 'Costa Rica',
'CR-01' => 'Costa Rica: Alajuela',
'CR-02' => 'Costa Rica: Cartago',
'CR-03' => 'Costa Rica: Guanacaste',
'CR-04' => 'Costa Rica: Heredia',
'CR-06' => 'Costa Rica: Limon',
'CR-07' => 'Costa Rica: Puntarenas',
'CR-08' => 'Costa Rica: San Jose',

'--CI' => '','-CI' => 'Cote D'Ivoire',
'CI-01' => 'Cote D\'Ivoire: Abengourou',
'CI-61' => 'Cote D\'Ivoire: Abidjan',
'CI-62' => 'Cote D\'Ivoire: Aboisso',
'CI-63' => 'Cote D\'Ivoire: Adiake',
'CI-05' => 'Cote D\'Ivoire: Adzope',
'CI-06' => 'Cote D\'Ivoire: Agbomark',
'CI-64' => 'Cote D\'Ivoire: Alepe',
'CI-36' => 'Cote D\'Ivoire: Bangolo',
'CI-37' => 'Cote D\'Ivoire: Beoumi',
'CI-07' => 'Cote D\'Ivoire: Biankouma',
'CI-65' => 'Cote D\'Ivoire: Bocanda',
'CI-38' => 'Cote D\'Ivoire: Bondoukou',
'CI-27' => 'Cote D\'Ivoire: Bongouanou',
'CI-39' => 'Cote D\'Ivoire: Bouafle',
'CI-40' => 'Cote D\'Ivoire: Bouake',
'CI-11' => 'Cote D\'Ivoire: Bouna',
'CI-12' => 'Cote D\'Ivoire: Boundiali',
'CI-03' => 'Cote D\'Ivoire: Dabakala',
'CI-66' => 'Cote D\'Ivoire: Dabou',
'CI-41' => 'Cote D\'Ivoire: Daloa',
'CI-14' => 'Cote D\'Ivoire: Danane',
'CI-42' => 'Cote D\'Ivoire: Daoukro',
'CI-67' => 'Cote D\'Ivoire: Dimbokro',
'CI-16' => 'Cote D\'Ivoire: Divo',
'CI-44' => 'Cote D\'Ivoire: Duekoue',
'CI-17' => 'Cote D\'Ivoire: Ferkessedougou',
'CI-18' => 'Cote D\'Ivoire: Gagnoa',
'CI-68' => 'Cote D\'Ivoire: Grand-Bassam',
'CI-45' => 'Cote D\'Ivoire: Grand-Lahou',
'CI-69' => 'Cote D\'Ivoire: Guiglo',
'CI-28' => 'Cote D\'Ivoire: Issia',
'CI-70' => 'Cote D\'Ivoire: Jacquemark',
'CI-20' => 'Cote D\'Ivoire: Katiola',
'CI-21' => 'Cote D\'Ivoire: Korhogo',
'CI-29' => 'Cote D\'Ivoire: Lakota',
'CI-47' => 'Cote D\'Ivoire: Man',
'CI-30' => 'Cote D\'Ivoire: Mankono',
'CI-48' => 'Cote D\'Ivoire: Mbahiakro',
'CI-23' => 'Cote D\'Ivoire: Odienne',
'CI-31' => 'Cote D\'Ivoire: Oume',
'CI-49' => 'Cote D\'Ivoire: Sakassou',
'CI-50' => 'Cote D\'Ivoire: San Pedro',
'CI-51' => 'Cote D\'Ivoire: Sassandra',
'CI-25' => 'Cote D\'Ivoire: Seguela',
'CI-52' => 'Cote D\'Ivoire: Sinfra',
'CI-32' => 'Cote D\'Ivoire: Soubre',
'CI-53' => 'Cote D\'Ivoire: Tabou',
'CI-54' => 'Cote D\'Ivoire: Tanda',
'CI-55' => 'Cote D\'Ivoire: Tiassale',
'CI-71' => 'Cote D\'Ivoire: Tiebissou',
'CI-33' => 'Cote D\'Ivoire: Tingrela',
'CI-26' => 'Cote D\'Ivoire: Touba',
'CI-72' => 'Cote D\'Ivoire: Toulepleu',
'CI-56' => 'Cote D\'Ivoire: Toumodi',
'CI-57' => 'Cote D\'Ivoire: Vavoua',
'CI-73' => 'Cote D\'Ivoire: Yamoussoukro',
'CI-34' => 'Cote D\'Ivoire: Zuenoula',

'--HR' => '','-HR' => 'Croatia',
'HR-01' => 'Croatia: Bjelovarsko-Bilogorska',
'HR-02' => 'Croatia: Brodsko-Posavska',
'HR-03' => 'Croatia: Dubrovacko-Neretvanska',
'HR-21' => 'Croatia: Grad Zagreb',
'HR-04' => 'Croatia: Istarska',
'HR-05' => 'Croatia: Karlovacka',
'HR-06' => 'Croatia: Koprivnicko-Krizevacka',
'HR-07' => 'Croatia: Krapinsko-Zagorska',
'HR-08' => 'Croatia: Licko-Senjska',
'HR-09' => 'Croatia: Medimurska',
'HR-10' => 'Croatia: Osjecko-Baranjska',
'HR-11' => 'Croatia: Pozesko-Slavonska',
'HR-12' => 'Croatia: Primorsko-Goranska',
'HR-13' => 'Croatia: Sibensko-Kninska',
'HR-14' => 'Croatia: Sisacko-Moslavacka',
'HR-15' => 'Croatia: Splitsko-Dalmatinska',
'HR-16' => 'Croatia: Varazdinska',
'HR-17' => 'Croatia: Viroviticko-Podravska',
'HR-18' => 'Croatia: Vukovarsko-Srijemska',
'HR-19' => 'Croatia: Zadarska',
'HR-20' => 'Croatia: Zagrebacka',

'--CU' => '','-CU' => 'Cuba',
'CU-05' => 'Cuba: Camaguey',
'CU-07' => 'Cuba: Ciego de Avila',
'CU-08' => 'Cuba: Cienfuegos',
'CU-02' => 'Cuba: Ciudad de la Habana',
'CU-09' => 'Cuba: Granma',
'CU-10' => 'Cuba: Guantanamo',
'CU-12' => 'Cuba: Holguin',
'CU-04' => 'Cuba: Isla de la Juventud',
'CU-11' => 'Cuba: La Habana',
'CU-13' => 'Cuba: Las Tunas',
'CU-03' => 'Cuba: Matanzas',
'CU-01' => 'Cuba: Pinar del Rio',
'CU-14' => 'Cuba: Sancti Spiritus',
'CU-15' => 'Cuba: Santiago de Cuba',
'CU-16' => 'Cuba: Villa Clara',

'--CY' => '','-CY' => 'Cyprus',
'CY-01' => 'Cyprus: Famagusta',
'CY-02' => 'Cyprus: Kyrenia',
'CY-03' => 'Cyprus: Larnaca',
'CY-05' => 'Cyprus: Limassol',
'CY-04' => 'Cyprus: Nicosia',
'CY-06' => 'Cyprus: Paphos',

'--CZ' => '','-CZ' => 'Czech Republic',
'CZ-03' => 'Czech Republic: Blansko',
'CZ-04' => 'Czech Republic: Breclav',
'CZ-52' => 'Czech Republic: Hlavni Mesto Praha',
'CZ-20' => 'Czech Republic: Hradec Kralove',
'CZ-21' => 'Czech Republic: Jablonec nad Nisou',
'CZ-23' => 'Czech Republic: Jiein',
'CZ-24' => 'Czech Republic: Jihlava',
'CZ-79' => 'Czech Republic: Jihocesky Kraj',
'CZ-78' => 'Czech Republic: Jihomoravsky Kraj',
'CZ-81' => 'Czech Republic: Karlovarsky Kraj',
'CZ-30' => 'Czech Republic: Kolin',
'CZ-82' => 'Czech Republic: Kralovehradecky Kraj',
'CZ-33' => 'Czech Republic: Liberec',
'CZ-83' => 'Czech Republic: Liberecky Kraj',
'CZ-36' => 'Czech Republic: Melnik',
'CZ-37' => 'Czech Republic: Mlada Boleslav',
'CZ-85' => 'Czech Republic: Moravskoslezsky Kraj',
'CZ-39' => 'Czech Republic: Nachod',
'CZ-41' => 'Czech Republic: Nymburk',
'CZ-84' => 'Czech Republic: Olomoucky Kraj',
'CZ-45' => 'Czech Republic: Pardubice',
'CZ-86' => 'Czech Republic: Pardubicky Kraj',
'CZ-87' => 'Czech Republic: Plzensky Kraj',
'CZ-61' => 'Czech Republic: Semily',
'CZ-88' => 'Czech Republic: Stredocesky Kraj',
'CZ-70' => 'Czech Republic: Trutnov',
'CZ-89' => 'Czech Republic: Ustecky Kraj',
'CZ-80' => 'Czech Republic: Vysocina',
'CZ-90' => 'Czech Republic: Zlinsky Kraj',

'--DK' => '','-DK' => 'Denmark',
'DK-01' => 'Denmark: Arhus',
'DK-02' => 'Denmark: Bornholm',
'DK-03' => 'Denmark: Frederiksborg',
'DK-04' => 'Denmark: Fyn',
'DK-05' => 'Denmark: Kobenhavn',
'DK-07' => 'Denmark: Nordjylland',
'DK-08' => 'Denmark: Ribe',
'DK-09' => 'Denmark: Ringkobing',
'DK-10' => 'Denmark: Roskilde',
'DK-11' => 'Denmark: Sonderjylland',
'DK-06' => 'Denmark: Staden Kobenhavn',
'DK-12' => 'Denmark: Storstrom',
'DK-13' => 'Denmark: Vejle',
'DK-14' => 'Denmark: Vestsjalland',
'DK-15' => 'Denmark: Viborg',

'--DJ' => '','-DJ' => 'Djibouti',
'DJ-02' => 'Djibouti: Dikhil',
'DJ-03' => 'Djibouti: Djibouti',
'DJ-04' => 'Djibouti: Obock',
'DJ-05' => 'Djibouti: Tadjoura',

'--DM' => '','-DM' => 'Dominica',
'DM-02' => 'Dominica: Saint Andrew',
'DM-03' => 'Dominica: Saint David',
'DM-04' => 'Dominica: Saint George',
'DM-05' => 'Dominica: Saint John',
'DM-06' => 'Dominica: Saint Joseph',
'DM-07' => 'Dominica: Saint Luke',
'DM-08' => 'Dominica: Saint Mark',
'DM-09' => 'Dominica: Saint Patrick',
'DM-10' => 'Dominica: Saint Paul',
'DM-11' => 'Dominica: Saint Peter',

'--DO' => '','-DO' => 'Dominican Republic',
'DO-01' => 'Dominican Republic: Azua',
'DO-02' => 'Dominican Republic: Baoruco',
'DO-03' => 'Dominican Republic: Barahona',
'DO-04' => 'Dominican Republic: Dajabon',
'DO-05' => 'Dominican Republic: Distrito Nacional',
'DO-06' => 'Dominican Republic: Duarte',
'DO-28' => 'Dominican Republic: El Seibo',
'DO-11' => 'Dominican Republic: Elias Pina',
'DO-08' => 'Dominican Republic: Espaillat',
'DO-29' => 'Dominican Republic: Hato Mayor',
'DO-09' => 'Dominican Republic: Independencia',
'DO-10' => 'Dominican Republic: La Altagracia',
'DO-12' => 'Dominican Republic: La Romana',
'DO-30' => 'Dominican Republic: La Vega',
'DO-14' => 'Dominican Republic: Maria Trinidad Sanchez',
'DO-31' => 'Dominican Republic: Monsenor Nouel',
'DO-15' => 'Dominican Republic: Monte Cristi',
'DO-32' => 'Dominican Republic: Monte Plata',
'DO-16' => 'Dominican Republic: Pedernales',
'DO-17' => 'Dominican Republic: Peravia',
'DO-18' => 'Dominican Republic: Puerto Plata',
'DO-19' => 'Dominican Republic: Salcedo',
'DO-20' => 'Dominican Republic: Samana',
'DO-33' => 'Dominican Republic: San Cristobal',
'DO-23' => 'Dominican Republic: San Juan',
'DO-24' => 'Dominican Republic: San Pedro De Macoris',
'DO-21' => 'Dominican Republic: Sanchez Ramirez',
'DO-26' => 'Dominican Republic: Santiago Rodriguez',
'DO-25' => 'Dominican Republic: Santiago',
'DO-27' => 'Dominican Republic: Valverde',

'--EC' => '','-EC' => 'Ecuador',
'EC-02' => 'Ecuador: Azuay',
'EC-03' => 'Ecuador: Bolivar',
'EC-04' => 'Ecuador: Canar',
'EC-05' => 'Ecuador: Carchi',
'EC-06' => 'Ecuador: Chimborazo',
'EC-07' => 'Ecuador: Cotopaxi',
'EC-08' => 'Ecuador: El Oro',
'EC-09' => 'Ecuador: Esmeraldas',
'EC-01' => 'Ecuador: Galapagos',
'EC-10' => 'Ecuador: Guayas',
'EC-11' => 'Ecuador: Imbabura',
'EC-12' => 'Ecuador: Loja',
'EC-13' => 'Ecuador: Los Rios',
'EC-14' => 'Ecuador: Manabi',
'EC-15' => 'Ecuador: Morona-Santiago',
'EC-23' => 'Ecuador: Napo',
'EC-24' => 'Ecuador: Orellana',
'EC-17' => 'Ecuador: Pastaza',
'EC-18' => 'Ecuador: Pichincha',
'EC-22' => 'Ecuador: Sucumbios',
'EC-19' => 'Ecuador: Tungurahua',
'EC-20' => 'Ecuador: Zamora-Chinchipe',

'--EG' => '','-EG' => 'Egypt',
'EG-01' => 'Egypt: Ad Daqahliyah',
'EG-02' => 'Egypt: Al Bahr al Ahmar',
'EG-03' => 'Egypt: Al Buhayrah',
'EG-04' => 'Egypt: Al Fayyum',
'EG-05' => 'Egypt: Al Gharbiyah',
'EG-06' => 'Egypt: Al Iskandariyah',
'EG-07' => 'Egypt: Al Isma\'iliyah',
'EG-08' => 'Egypt: Al Jizah',
'EG-09' => 'Egypt: Al Minufiyah',
'EG-10' => 'Egypt: Al Minya',
'EG-11' => 'Egypt: Al Qahirah',
'EG-12' => 'Egypt: Al Qalyubiyah',
'EG-13' => 'Egypt: Al Wadi al Jadid',
'EG-15' => 'Egypt: As Suways',
'EG-14' => 'Egypt: Ash Sharqiyah',
'EG-16' => 'Egypt: Aswan',
'EG-17' => 'Egypt: Asyut',
'EG-18' => 'Egypt: Bani Suwayf',
'EG-19' => 'Egypt: Bur Sa\'id',
'EG-20' => 'Egypt: Dumyat',
'EG-26' => 'Egypt: Janub Sina\'',
'EG-21' => 'Egypt: Kafr ash Shaykh',
'EG-22' => 'Egypt: Matruh',
'EG-23' => 'Egypt: Qina',
'EG-27' => 'Egypt: Shamal Sina\'',
'EG-24' => 'Egypt: Suhaj',

'--SV' => '','-SV' => 'El Salvador',
'SV-01' => 'El Salvador: Ahuachapan',
'SV-02' => 'El Salvador: Cabanas',
'SV-03' => 'El Salvador: Chalatenango',
'SV-04' => 'El Salvador: Cuscatlan',
'SV-05' => 'El Salvador: La Libertad',
'SV-06' => 'El Salvador: La Paz',
'SV-07' => 'El Salvador: La Union',
'SV-08' => 'El Salvador: Morazan',
'SV-09' => 'El Salvador: San Miguel',
'SV-10' => 'El Salvador: San Salvador',
'SV-12' => 'El Salvador: San Vicente',
'SV-11' => 'El Salvador: Santa Ana',
'SV-13' => 'El Salvador: Sonsonate',
'SV-14' => 'El Salvador: Usulutan',

'--GQ' => '','-GQ' => 'Equatorial Guinea',
'GQ-03' => 'Equatorial Guinea: Annobon',
'GQ-04' => 'Equatorial Guinea: Bioko Norte',
'GQ-05' => 'Equatorial Guinea: Bioko Sur',
'GQ-06' => 'Equatorial Guinea: Centro Sur',
'GQ-07' => 'Equatorial Guinea: Kie-Ntem',
'GQ-08' => 'Equatorial Guinea: Litoral',
'GQ-09' => 'Equatorial Guinea: Wele-Nzas',

'--EE' => '','-EE' => 'Estonia',
'EE-01' => 'Estonia: Harjumaa',
'EE-02' => 'Estonia: Hiiumaa',
'EE-03' => 'Estonia: Ida-Virumaa',
'EE-04' => 'Estonia: Jarvamaa',
'EE-05' => 'Estonia: Jogevamaa',
'EE-06' => 'Estonia: Kohtla-Jarve',
'EE-07' => 'Estonia: Laanemaa',
'EE-08' => 'Estonia: Laane-Virumaa',
'EE-09' => 'Estonia: Narva',
'EE-10' => 'Estonia: Parnu',
'EE-11' => 'Estonia: Parnumaa',
'EE-12' => 'Estonia: Polvamaa',
'EE-13' => 'Estonia: Raplamaa',
'EE-14' => 'Estonia: Saaremaa',
'EE-15' => 'Estonia: Sillamae',
'EE-16' => 'Estonia: Tallinn',
'EE-17' => 'Estonia: Tartu',
'EE-18' => 'Estonia: Tartumaa',
'EE-19' => 'Estonia: Valgamaa',
'EE-20' => 'Estonia: Viljandimaa',
'EE-21' => 'Estonia: Vorumaa',

'--ET' => '','-ET' => 'Ethiopia',
'ET-10' => 'Ethiopia: Addis Abeba',
'ET-44' => 'Ethiopia: Adis Abeba',
'ET-14' => 'Ethiopia: Afar',
'ET-45' => 'Ethiopia: Afar',
'ET-46' => 'Ethiopia: Amara',
'ET-02' => 'Ethiopia: Amhara',
'ET-13' => 'Ethiopia: Benishangul',
'ET-47' => 'Ethiopia: Binshangul Gumuz',
'ET-48' => 'Ethiopia: Dire Dawa',
'ET-49' => 'Ethiopia: Gambela Hizboch',
'ET-08' => 'Ethiopia: Gambella',
'ET-50' => 'Ethiopia: Hareri Hizb',
'ET-51' => 'Ethiopia: Oromiya',
'ET-07' => 'Ethiopia: Somali',
'ET-11' => 'Ethiopia: Southern',
'ET-52' => 'Ethiopia: Sumale',
'ET-12' => 'Ethiopia: Tigray',
'ET-53' => 'Ethiopia: Tigray',
'ET-54' => 'Ethiopia: YeDebub Biheroch Bihereseboch na Hizboch',

'--FJ' => '','-FJ' => 'Fiji',
'FJ-01' => 'Fiji: Central',
'FJ-02' => 'Fiji: Eastern',
'FJ-03' => 'Fiji: Northern',
'FJ-04' => 'Fiji: Rotuma',
'FJ-05' => 'Fiji: Western',

'--FI' => '','-FI' => 'Finland',
'FI-01' => 'Finland: Åland',
'FI-14' => 'Finland: Eastern Finland',
'FI-06' => 'Finland: Lapland',
'FI-08' => 'Finland: Oulu',
'FI-13' => 'Finland: Southern Finland',
'FI-15' => 'Finland: Western Finland',

'--FR' => '','-FR' => 'France',
'FR-C1' => 'France: Alsace',
'FR-97' => 'France: Aquitaine',
'FR-98' => 'France: Auvergne',
'FR-99' => 'France: Basse-Normandie',
'FR-A1' => 'France: Bourgogne',
'FR-A2' => 'France: Bretagne',
'FR-A3' => 'France: Centre',
'FR-A4' => 'France: Champagne-Ardenne',
'FR-A5' => 'France: Corse',
'FR-A6' => 'France: Franche-Comte',
'FR-A7' => 'France: Haute-Normandie',
'FR-A8' => 'France: Ile-de-France',
'FR-A9' => 'France: Languedoc-Roussillon',
'FR-B1' => 'France: Limousin',
'FR-B2' => 'France: Lorraine',
'FR-B3' => 'France: Midi-Pyrenees',
'FR-B4' => 'France: Nord-Pas-de-Calais',
'FR-B5' => 'France: Pays de la Loire',
'FR-B6' => 'France: Picardie',
'FR-B7' => 'France: Poitou-Charentes',
'FR-B8' => 'France: Provence-Alpes-Cote d\'Azur',
'FR-B9' => 'France: Rhone-Alpes',

'--GA' => '','-GA' => 'Gabon',
'GA-01' => 'Gabon: Estuaire',
'GA-02' => 'Gabon: Haut-Ogooue',
'GA-03' => 'Gabon: Moyen-Ogooue',
'GA-04' => 'Gabon: Ngounie',
'GA-05' => 'Gabon: Nyanga',
'GA-06' => 'Gabon: Ogooue-Ivindo',
'GA-07' => 'Gabon: Ogooue-Lolo',
'GA-08' => 'Gabon: Ogooue-Maritime',
'GA-09' => 'Gabon: Woleu-Ntem',

'--GM' => '','-GM' => 'Gambia',
'GM-01' => 'Gambia: Banjul',
'GM-02' => 'Gambia: Lower River',
'GM-03' => 'Gambia: MacCarthy Island',
'GM-07' => 'Gambia: North Bank',
'GM-04' => 'Gambia: Upper River',
'GM-05' => 'Gambia: Western',

'--GE' => '','-GE' => 'Georgia',
'GE-01' => 'Georgia: Abashis Raioni',
'GE-02' => 'Georgia: Abkhazia',
'GE-03' => 'Georgia: Adigenis Raioni',
'GE-04' => 'Georgia: Ajaria',
'GE-05' => 'Georgia: Akhalgoris Raioni',
'GE-06' => 'Georgia: Akhalk\'alak\'is Raioni',
'GE-07' => 'Georgia: Akhalts\'ikhis Raioni',
'GE-08' => 'Georgia: Akhmetis Raioni',
'GE-09' => 'Georgia: Ambrolauris Raioni',
'GE-10' => 'Georgia: Aspindzis Raioni',
'GE-11' => 'Georgia: Baghdat\'is Raioni',
'GE-12' => 'Georgia: Bolnisis Raioni',
'GE-13' => 'Georgia: Borjomis Raioni',
'GE-14' => 'Georgia: Chiat\'ura',
'GE-15' => 'Georgia: Ch\'khorotsqus Raioni',
'GE-16' => 'Georgia: Ch\'okhatauris Raioni',
'GE-17' => 'Georgia: Dedop\'listsqaros Raioni',
'GE-18' => 'Georgia: Dmanisis Raioni',
'GE-19' => 'Georgia: Dushet\'is Raioni',
'GE-20' => 'Georgia: Gardabanis Raioni',
'GE-21' => 'Georgia: Gori',
'GE-22' => 'Georgia: Goris Raioni',
'GE-23' => 'Georgia: Gurjaanis Raioni',
'GE-24' => 'Georgia: Javis Raioni',
'GE-25' => 'Georgia: K\'arelis Raioni',
'GE-26' => 'Georgia: Kaspis Raioni',
'GE-27' => 'Georgia: Kharagaulis Raioni',
'GE-28' => 'Georgia: Khashuris Raioni',
'GE-29' => 'Georgia: Khobis Raioni',
'GE-30' => 'Georgia: Khonis Raioni',
'GE-31' => 'Georgia: K\'ut\'aisi',
'GE-32' => 'Georgia: Lagodekhis Raioni',
'GE-33' => 'Georgia: Lanch\'khut\'is Raioni',
'GE-34' => 'Georgia: Lentekhis Raioni',
'GE-35' => 'Georgia: Marneulis Raioni',
'GE-36' => 'Georgia: Martvilis Raioni',
'GE-37' => 'Georgia: Mestiis Raioni',
'GE-38' => 'Georgia: Mts\'khet\'is Raioni',
'GE-39' => 'Georgia: Ninotsmindis Raioni',
'GE-40' => 'Georgia: Onis Raioni',
'GE-41' => 'Georgia: Ozurget\'is Raioni',
'GE-42' => 'Georgia: P\'ot\'i',
'GE-43' => 'Georgia: Qazbegis Raioni',
'GE-44' => 'Georgia: Qvarlis Raioni',
'GE-45' => 'Georgia: Rust\'avi',
'GE-46' => 'Georgia: Sach\'kheris Raioni',
'GE-47' => 'Georgia: Sagarejos Raioni',
'GE-48' => 'Georgia: Samtrediis Raioni',
'GE-49' => 'Georgia: Senakis Raioni',
'GE-50' => 'Georgia: Sighnaghis Raioni',
'GE-51' => 'Georgia: T\'bilisi',
'GE-52' => 'Georgia: T\'elavis Raioni',
'GE-53' => 'Georgia: T\'erjolis Raioni',
'GE-54' => 'Georgia: T\'et\'ritsqaros Raioni',
'GE-55' => 'Georgia: T\'ianet\'is Raioni',
'GE-56' => 'Georgia: Tqibuli',
'GE-57' => 'Georgia: Ts\'ageris Raioni',
'GE-58' => 'Georgia: Tsalenjikhis Raioni',
'GE-59' => 'Georgia: Tsalkis Raioni',
'GE-60' => 'Georgia: Tsqaltubo',
'GE-61' => 'Georgia: Vanis Raioni',
'GE-62' => 'Georgia: Zestap\'onis Raioni',
'GE-63' => 'Georgia: Zugdidi',
'GE-64' => 'Georgia: Zugdidis Raioni',

'--DE' => '','-DE' => 'Germany',
'DE-01' => 'Germany: Baden-Württemberg',
'DE-02' => 'Germany: Bayern',
'DE-16' => 'Germany: Berlin',
'DE-11' => 'Germany: Brandenburg',
'DE-03' => 'Germany: Bremen',
'DE-04' => 'Germany: Hamburg',
'DE-05' => 'Germany: Hessen',
'DE-12' => 'Germany: Mecklenburg-Vorpommern',
'DE-06' => 'Germany: Niedersachsen',
'DE-07' => 'Germany: Nordrhein-Westfalen',
'DE-08' => 'Germany: Rheinland-Pfalz',
'DE-09' => 'Germany: Saarland',
'DE-13' => 'Germany: Sachsen',
'DE-14' => 'Germany: Sachsen-Anhalt',
'DE-10' => 'Germany: Schleswig-Holstein',
'DE-15' => 'Germany: Thuringen',

'--GH' => '','-GH' => 'Ghana',
'GH-02' => 'Ghana: Ashanti',
'GH-03' => 'Ghana: Brong-Ahafo',
'GH-04' => 'Ghana: Central',
'GH-05' => 'Ghana: Eastern',
'GH-01' => 'Ghana: Greater Accra',
'GH-06' => 'Ghana: Northern',
'GH-10' => 'Ghana: Upper East',
'GH-11' => 'Ghana: Upper West',
'GH-08' => 'Ghana: Volta',
'GH-09' => 'Ghana: Western',

'--GR' => '','-GR' => 'Greece',
'GR-31' => 'Greece: Aitolia kai Akarnania',
'GR-38' => 'Greece: Akhaia',
'GR-36' => 'Greece: Argolis',
'GR-41' => 'Greece: Arkadhia',
'GR-20' => 'Greece: Arta',
'GR-35' => 'Greece: Attiki',
'GR-47' => 'Greece: Dhodhekanisos',
'GR-04' => 'Greece: Drama',
'GR-30' => 'Greece: Evritania',
'GR-01' => 'Greece: Evros',
'GR-34' => 'Greece: Evvoia',
'GR-08' => 'Greece: Florina',
'GR-32' => 'Greece: Fokis',
'GR-29' => 'Greece: Fthiotis',
'GR-10' => 'Greece: Grevena',
'GR-39' => 'Greece: Ilia',
'GR-12' => 'Greece: Imathia',
'GR-17' => 'Greece: Ioannina',
'GR-45' => 'Greece: Iraklion',
'GR-23' => 'Greece: Kardhitsa',
'GR-09' => 'Greece: Kastoria',
'GR-14' => 'Greece: Kavala',
'GR-27' => 'Greece: Kefallinia',
'GR-25' => 'Greece: Kerkira',
'GR-15' => 'Greece: Khalkidhiki',
'GR-43' => 'Greece: Khania',
'GR-50' => 'Greece: Khios',
'GR-49' => 'Greece: Kikladhes',
'GR-06' => 'Greece: Kilkis',
'GR-37' => 'Greece: Korinthia',
'GR-11' => 'Greece: Kozani',
'GR-42' => 'Greece: Lakonia',
'GR-21' => 'Greece: Larisa',
'GR-46' => 'Greece: Lasithi',
'GR-51' => 'Greece: Lesvos',
'GR-26' => 'Greece: Levkas',
'GR-24' => 'Greece: Magnisia',
'GR-40' => 'Greece: Messinia',
'GR-07' => 'Greece: Pella',
'GR-16' => 'Greece: Pieria',
'GR-19' => 'Greece: Preveza',
'GR-44' => 'Greece: Rethimni',
'GR-02' => 'Greece: Rodhopi',
'GR-48' => 'Greece: Samos',
'GR-05' => 'Greece: Serrai',
'GR-18' => 'Greece: Thesprotia',
'GR-13' => 'Greece: Thessaloniki',
'GR-22' => 'Greece: Trikala',
'GR-33' => 'Greece: Voiotia',
'GR-03' => 'Greece: Xanthi',
'GR-28' => 'Greece: Zakinthos',

'--GL' => '','-GL' => 'Greenland',
'GL-01' => 'Greenland: Nordgronland',
'GL-02' => 'Greenland: Ostgronland',
'GL-03' => 'Greenland: Vestgronland',

'--GD' => '','-GD' => 'Grenada',
'GD-01' => 'Grenada: Saint Andrew',
'GD-02' => 'Grenada: Saint David',
'GD-03' => 'Grenada: Saint George',
'GD-04' => 'Grenada: Saint John',
'GD-05' => 'Grenada: Saint Mark',
'GD-06' => 'Grenada: Saint Patrick',

'--GT' => '','-GT' => 'Guatemala',
'GT-01' => 'Guatemala: Alta Verapaz',
'GT-02' => 'Guatemala: Baja Verapaz',
'GT-03' => 'Guatemala: Chimaltenango',
'GT-04' => 'Guatemala: Chiquimula',
'GT-05' => 'Guatemala: El Progreso',
'GT-06' => 'Guatemala: Escuintla',
'GT-07' => 'Guatemala: Guatemala',
'GT-08' => 'Guatemala: Huehuetenango',
'GT-09' => 'Guatemala: Izabal',
'GT-10' => 'Guatemala: Jalapa',
'GT-11' => 'Guatemala: Jutiapa',
'GT-12' => 'Guatemala: Peten',
'GT-13' => 'Guatemala: Quetzaltenango',
'GT-14' => 'Guatemala: Quiche',
'GT-15' => 'Guatemala: Retalhuleu',
'GT-16' => 'Guatemala: Sacatepequez',
'GT-17' => 'Guatemala: San Marcos',
'GT-18' => 'Guatemala: Santa Rosa',
'GT-19' => 'Guatemala: Solola',
'GT-20' => 'Guatemala: Suchitepequez',
'GT-21' => 'Guatemala: Totonicapan',
'GT-22' => 'Guatemala: Zacapa',

'--GN' => '','-GN' => 'Guinea',
'GN-01' => 'Guinea: Beyla',
'GN-02' => 'Guinea: Boffa',
'GN-03' => 'Guinea: Boke',
'GN-04' => 'Guinea: Conakry',
'GN-30' => 'Guinea: Coyah',
'GN-05' => 'Guinea: Dabola',
'GN-06' => 'Guinea: Dalaba',
'GN-07' => 'Guinea: Dinguiraye',
'GN-31' => 'Guinea: Dubreka',
'GN-09' => 'Guinea: Faranah',
'GN-10' => 'Guinea: Forecariah',
'GN-11' => 'Guinea: Fria',
'GN-12' => 'Guinea: Gaoual',
'GN-13' => 'Guinea: Gueckedou',
'GN-32' => 'Guinea: Kankan',
'GN-15' => 'Guinea: Kerouane',
'GN-16' => 'Guinea: Kindia',
'GN-17' => 'Guinea: Kissidougou',
'GN-33' => 'Guinea: Koubia',
'GN-18' => 'Guinea: Koundara',
'GN-19' => 'Guinea: Kouroussa',
'GN-34' => 'Guinea: Labe',
'GN-35' => 'Guinea: Lelouma',
'GN-36' => 'Guinea: Lola',
'GN-21' => 'Guinea: Macenta',
'GN-22' => 'Guinea: Mali',
'GN-23' => 'Guinea: Mamou',
'GN-37' => 'Guinea: Mandiana',
'GN-38' => 'Guinea: Nzerekore',
'GN-25' => 'Guinea: Pita',
'GN-39' => 'Guinea: Siguiri',
'GN-27' => 'Guinea: Telimele',
'GN-28' => 'Guinea: Tougue',
'GN-29' => 'Guinea: Yomou',

'--GW' => '','-GW' => 'Guinea-Bissau',
'GW-01' => 'Guinea-Bissau: Bafata',
'GW-12' => 'Guinea-Bissau: Biombo',
'GW-11' => 'Guinea-Bissau: Bissau',
'GW-05' => 'Guinea-Bissau: Bolama',
'GW-06' => 'Guinea-Bissau: Cacheu',
'GW-10' => 'Guinea-Bissau: Gabu',
'GW-04' => 'Guinea-Bissau: Oio',
'GW-02' => 'Guinea-Bissau: Quinara',
'GW-07' => 'Guinea-Bissau: Tombali',

'--GY' => '','-GY' => 'Guyana',
'GY-10' => 'Guyana: Barima-Waini',
'GY-11' => 'Guyana: Cuyuni-Mazaruni',
'GY-12' => 'Guyana: Demerara-Mahaica',
'GY-13' => 'Guyana: East Berbice-Corentyne',
'GY-14' => 'Guyana: Essequibo Islands-West Demerara',
'GY-15' => 'Guyana: Mahaica-Berbice',
'GY-16' => 'Guyana: Pomeroon-Supenaam',
'GY-17' => 'Guyana: Potaro-Siparuni',
'GY-18' => 'Guyana: Upper Demerara-Berbice',
'GY-19' => 'Guyana: Upper Takutu-Upper Essequibo',

'--HT' => '','-HT' => 'Haiti',
'HT-06' => 'Haiti: Artibonite',
'HT-07' => 'Haiti: Centre',
'HT-08' => 'Haiti: Grand\' Anse',
'HT-09' => 'Haiti: Nord',
'HT-10' => 'Haiti: Nord-Est',
'HT-03' => 'Haiti: Nord-Ouest',
'HT-11' => 'Haiti: Ouest',
'HT-12' => 'Haiti: Sud',
'HT-13' => 'Haiti: Sud-Est',

'--HN' => '','-HN' => 'Honduras',
'HN-01' => 'Honduras: Atlantida',
'HN-02' => 'Honduras: Choluteca',
'HN-03' => 'Honduras: Colon',
'HN-04' => 'Honduras: Comayagua',
'HN-05' => 'Honduras: Copan',
'HN-06' => 'Honduras: Cortes',
'HN-07' => 'Honduras: El Paraiso',
'HN-08' => 'Honduras: Francisco Morazan',
'HN-09' => 'Honduras: Gracias a Dios',
'HN-10' => 'Honduras: Intibuca',
'HN-11' => 'Honduras: Islas de la Bahia',
'HN-12' => 'Honduras: La Paz',
'HN-13' => 'Honduras: Lempira',
'HN-14' => 'Honduras: Ocotepeque',
'HN-15' => 'Honduras: Olancho',
'HN-16' => 'Honduras: Santa Barbara',
'HN-17' => 'Honduras: Valle',
'HN-18' => 'Honduras: Yoro',

'--HU' => '','-HU' => 'Hungary',
'HU-01' => 'Hungary: Bacs-Kiskun',
'HU-02' => 'Hungary: Baranya',
'HU-03' => 'Hungary: Bekes',
'HU-26' => 'Hungary: Bekescsaba',
'HU-04' => 'Hungary: Borsod-Abauj-Zemplen',
'HU-05' => 'Hungary: Budapest',
'HU-06' => 'Hungary: Csongrad',
'HU-07' => 'Hungary: Debrecen',
'HU-27' => 'Hungary: Dunaujvaros',
'HU-28' => 'Hungary: Eger',
'HU-08' => 'Hungary: Fejer',
'HU-25' => 'Hungary: Gyor',
'HU-09' => 'Hungary: Gyor-Moson-Sopron',
'HU-10' => 'Hungary: Hajdu-Bihar',
'HU-11' => 'Hungary: Heves',
'HU-29' => 'Hungary: Hodmezovasarhely',
'HU-20' => 'Hungary: Jasz-Nagykun-Szolnok',
'HU-30' => 'Hungary: Kaposvar',
'HU-31' => 'Hungary: Kecskemet',
'HU-12' => 'Hungary: Komarom-Esztergom',
'HU-13' => 'Hungary: Miskolc',
'HU-32' => 'Hungary: Nagykanizsa',
'HU-14' => 'Hungary: Nograd',
'HU-33' => 'Hungary: Nyiregyhaza',
'HU-15' => 'Hungary: Pecs',
'HU-16' => 'Hungary: Pest',
'HU-17' => 'Hungary: Somogy',
'HU-34' => 'Hungary: Sopron',
'HU-18' => 'Hungary: Szabolcs-Szatmar-Bereg',
'HU-19' => 'Hungary: Szeged',
'HU-35' => 'Hungary: Szekesfehervar',
'HU-36' => 'Hungary: Szolnok',
'HU-37' => 'Hungary: Szombathely',
'HU-38' => 'Hungary: Tatabanya',
'HU-21' => 'Hungary: Tolna',
'HU-22' => 'Hungary: Vas',
'HU-23' => 'Hungary: Veszprem',
'HU-39' => 'Hungary: Veszprem',
'HU-24' => 'Hungary: Zala',
'HU-40' => 'Hungary: Zalaegerszeg',

'--IS' => '','-IS' => 'Iceland',
'IS-01' => 'Iceland: Akranes',
'IS-02' => 'Iceland: Akureyri',
'IS-03' => 'Iceland: Arnessysla',
'IS-04' => 'Iceland: Austur-Bardastrandarsysla',
'IS-05' => 'Iceland: Austur-Hunavatnssysla',
'IS-06' => 'Iceland: Austur-Skaftafellssysla',
'IS-07' => 'Iceland: Borgarfjardarsysla',
'IS-08' => 'Iceland: Dalasysla',
'IS-09' => 'Iceland: Eyjafjardarsysla',
'IS-10' => 'Iceland: Gullbringusysla',
'IS-11' => 'Iceland: Hafnarfjordur',
'IS-12' => 'Iceland: Husavik',
'IS-13' => 'Iceland: Isafjordur',
'IS-14' => 'Iceland: Keflavik',
'IS-15' => 'Iceland: Kjosarsysla',
'IS-16' => 'Iceland: Kopavogur',
'IS-17' => 'Iceland: Myrasysla',
'IS-18' => 'Iceland: Neskaupstadur',
'IS-19' => 'Iceland: Nordur-Isafjardarsysla',
'IS-20' => 'Iceland: Nordur-Mulasysla',
'IS-21' => 'Iceland: Nordur-Tingeyjarsysla',
'IS-22' => 'Iceland: Olafsfjordur',
'IS-23' => 'Iceland: Rangarvallasysla',
'IS-24' => 'Iceland: Reykjavik',
'IS-25' => 'Iceland: Saudarkrokur',
'IS-26' => 'Iceland: Seydisfjordur',
'IS-27' => 'Iceland: Siglufjordur',
'IS-28' => 'Iceland: Skagafjardarsysla',
'IS-29' => 'Iceland: Snafellsnes- og Hnappadalssysla',
'IS-30' => 'Iceland: Strandasysla',
'IS-31' => 'Iceland: Sudur-Mulasysla',
'IS-32' => 'Iceland: Sudur-Tingeyjarsysla',
'IS-33' => 'Iceland: Vestmannaeyjar',
'IS-34' => 'Iceland: Vestur-Bardastrandarsysla',
'IS-35' => 'Iceland: Vestur-Hunavatnssysla',
'IS-36' => 'Iceland: Vestur-Isafjardarsysla',
'IS-37' => 'Iceland: Vestur-Skaftafellssysla',

'--IN' => '','-IN' => 'India',
'IN-01' => 'India: Andaman and Nicobar Islands',
'IN-02' => 'India: Andhra Pradesh',
'IN-30' => 'India: Arunachal Pradesh',
'IN-03' => 'India: Assam',
'IN-34' => 'India: Bihar',
'IN-05' => 'India: Chandigarh',
'IN-37' => 'India: Chhattisgarh',
'IN-06' => 'India: Dadra and Nagar Haveli',
'IN-32' => 'India: Daman and Diu',
'IN-07' => 'India: Delhi',
'IN-33' => 'India: Goa',
'IN-09' => 'India: Gujarat',
'IN-10' => 'India: Haryana',
'IN-11' => 'India: Himachal Pradesh',
'IN-12' => 'India: Jammu and Kashmir',
'IN-38' => 'India: Jharkhand',
'IN-19' => 'India: Karnataka',
'IN-13' => 'India: Kerala',
'IN-14' => 'India: Lakshadweep',
'IN-35' => 'India: Madhya Pradesh',
'IN-16' => 'India: Maharashtra',
'IN-17' => 'India: Manipur',
'IN-18' => 'India: Meghalaya',
'IN-31' => 'India: Mizoram',
'IN-20' => 'India: Nagaland',
'IN-21' => 'India: Orissa',
'IN-22' => 'India: Pondicherry',
'IN-23' => 'India: Punjab',
'IN-24' => 'India: Rajasthan',
'IN-29' => 'India: Sikkim',
'IN-25' => 'India: Tamil Nadu',
'IN-26' => 'India: Tripura',
'IN-36' => 'India: Uttar Pradesh',
'IN-39' => 'India: Uttaranchal',
'IN-28' => 'India: West Bengal',

'--ID' => '','-ID' => 'Indonesia',
'ID-01' => 'Indonesia: Aceh',
'ID-02' => 'Indonesia: Bali',
'ID-33' => 'Indonesia: Banten',
'ID-03' => 'Indonesia: Bengkulu',
'ID-34' => 'Indonesia: Gorontalo',
'ID-04' => 'Indonesia: Jakarta Raya',
'ID-05' => 'Indonesia: Jambi',
'ID-30' => 'Indonesia: Jawa Barat',
'ID-07' => 'Indonesia: Jawa Tengah',
'ID-08' => 'Indonesia: Jawa Timur',
'ID-11' => 'Indonesia: Kalimantan Barat',
'ID-12' => 'Indonesia: Kalimantan Selatan',
'ID-13' => 'Indonesia: Kalimantan Tengah',
'ID-14' => 'Indonesia: Kalimantan Timur',
'ID-35' => 'Indonesia: Kepulauan Bangka Belitung',
'ID-15' => 'Indonesia: Lampung',
'ID-29' => 'Indonesia: Maluku Utara',
'ID-28' => 'Indonesia: Maluku',
'ID-17' => 'Indonesia: Nusa Tenggara Barat',
'ID-18' => 'Indonesia: Nusa Tenggara Timur',
'ID-09' => 'Indonesia: Papua',
'ID-19' => 'Indonesia: Riau',
'ID-20' => 'Indonesia: Sulawesi Selatan',
'ID-21' => 'Indonesia: Sulawesi Tengah',
'ID-22' => 'Indonesia: Sulawesi Tenggara',
'ID-31' => 'Indonesia: Sulawesi Utara',
'ID-24' => 'Indonesia: Sumatera Barat',
'ID-25' => 'Indonesia: Sumatera Selatan',
'ID-32' => 'Indonesia: Sumatera Selatan',
'ID-26' => 'Indonesia: Sumatera Utara',
'ID-10' => 'Indonesia: Yogyakarta',

'--IR' => '','-IR' => 'Iran',
'IR-32' => 'Iran: Ardabil',
'IR-01' => 'Iran: Azarbayjan-e Bakhtari',
'IR-02' => 'Iran: Azarbayjan-e Khavari',
'IR-13' => 'Iran: Bakhtaran',
'IR-22' => 'Iran: Bushehr',
'IR-03' => 'Iran: Chahar Mahall va Bakhtiari',
'IR-28' => 'Iran: Esfahan',
'IR-07' => 'Iran: Fars',
'IR-08' => 'Iran: Gilan',
'IR-37' => 'Iran: Golestan',
'IR-09' => 'Iran: Hamadan',
'IR-11' => 'Iran: Hormozgan',
'IR-10' => 'Iran: Ilam',
'IR-29' => 'Iran: Kerman',
'IR-30' => 'Iran: Khorasan',
'IR-15' => 'Iran: Khuzestan',
'IR-05' => 'Iran: Kohkiluyeh va Buyer Ahmadi',
'IR-16' => 'Iran: Kordestan',
'IR-23' => 'Iran: Lorestan',
'IR-34' => 'Iran: Markazi',
'IR-35' => 'Iran: Mazandaran',
'IR-38' => 'Iran: Qazvin',
'IR-39' => 'Iran: Qom',
'IR-25' => 'Iran: Semnan',
'IR-04' => 'Iran: Sistan va Baluchestan',
'IR-26' => 'Iran: Tehran',
'IR-31' => 'Iran: Yazd',
'IR-36' => 'Iran: Zanjan',

'--IQ' => '','-IQ' => 'Iraq',
'IQ-01' => 'Iraq: Al Anbar',
'IQ-02' => 'Iraq: Al Basrah',
'IQ-03' => 'Iraq: Al Muthanna',
'IQ-04' => 'Iraq: Al Qadisiyah',
'IQ-17' => 'Iraq: An Najaf',
'IQ-11' => 'Iraq: Arbil',
'IQ-05' => 'Iraq: As Sulaymaniyah',
'IQ-13' => 'Iraq: At Ta\'mim',
'IQ-06' => 'Iraq: Babil',
'IQ-07' => 'Iraq: Baghdad',
'IQ-08' => 'Iraq: Dahuk',
'IQ-09' => 'Iraq: Dhi Qar',
'IQ-10' => 'Iraq: Diyala',
'IQ-12' => 'Iraq: Karbala\'',
'IQ-14' => 'Iraq: Maysan',
'IQ-15' => 'Iraq: Ninawa',
'IQ-18' => 'Iraq: Salah ad Din',
'IQ-16' => 'Iraq: Wasit',

'--IE' => '','-IE' => 'Ireland',
'IE-01' => 'Ireland: Carlow',
'IE-02' => 'Ireland: Cavan',
'IE-03' => 'Ireland: Clare',
'IE-04' => 'Ireland: Cork',
'IE-06' => 'Ireland: Donegal',
'IE-07' => 'Ireland: Dublin',
'IE-10' => 'Ireland: Galway',
'IE-11' => 'Ireland: Kerry',
'IE-12' => 'Ireland: Kildare',
'IE-13' => 'Ireland: Kilkenny',
'IE-15' => 'Ireland: Laois',
'IE-14' => 'Ireland: Leitrim',
'IE-16' => 'Ireland: Limerick',
'IE-18' => 'Ireland: Longford',
'IE-19' => 'Ireland: Louth',
'IE-20' => 'Ireland: Mayo',
'IE-21' => 'Ireland: Meath',
'IE-22' => 'Ireland: Monaghan',
'IE-23' => 'Ireland: Offaly',
'IE-24' => 'Ireland: Roscommon',
'IE-25' => 'Ireland: Sligo',
'IE-26' => 'Ireland: Tipperary',
'IE-27' => 'Ireland: Waterford',
'IE-29' => 'Ireland: Westmeath',
'IE-30' => 'Ireland: Wexford',
'IE-31' => 'Ireland: Wicklow',

'--IL' => '','-IL' => 'Israel',
'IL-01' => 'Israel: HaDarom',
'IL-02' => 'Israel: HaMerkaz',
'IL-03' => 'Israel: HaZafon',
'IL-04' => 'Israel: Hefa',
'IL-05' => 'Israel: Tel Aviv',
'IL-06' => 'Israel: Yerushalayim',

'--IT' => '','-IT' => 'Italy',
'IT-01' => 'Italy: Abruzzi',
'IT-02' => 'Italy: Basilicata',
'IT-03' => 'Italy: Calabria',
'IT-04' => 'Italy: Campania',
'IT-05' => 'Italy: Emilia-Romagna',
'IT-06' => 'Italy: Friuli-Venezia Giulia',
'IT-07' => 'Italy: Lazio',
'IT-08' => 'Italy: Liguria',
'IT-09' => 'Italy: Lombardia',
'IT-10' => 'Italy: Marche',
'IT-11' => 'Italy: Molise',
'IT-12' => 'Italy: Piemonte',
'IT-13' => 'Italy: Puglia',
'IT-14' => 'Italy: Sardegna',
'IT-15' => 'Italy: Sicilia',
'IT-16' => 'Italy: Toscana',
'IT-17' => 'Italy: Trentino-Alto Adige',
'IT-18' => 'Italy: Umbria',
'IT-19' => 'Italy: Valle d\'Aosta',
'IT-20' => 'Italy: Veneto',

'--JM' => '','-JM' => 'Jamaica',
'JM-01' => 'Jamaica: Clarendon',
'JM-02' => 'Jamaica: Hanover',
'JM-17' => 'Jamaica: Kingston',
'JM-04' => 'Jamaica: Manchester',
'JM-07' => 'Jamaica: Portland',
'JM-08' => 'Jamaica: Saint Andrew',
'JM-09' => 'Jamaica: Saint Ann',
'JM-10' => 'Jamaica: Saint Catherine',
'JM-11' => 'Jamaica: Saint Elizabeth',
'JM-12' => 'Jamaica: Saint James',
'JM-13' => 'Jamaica: Saint Mary',
'JM-14' => 'Jamaica: Saint Thomas',
'JM-15' => 'Jamaica: Trelawny',
'JM-16' => 'Jamaica: Westmoreland',

'--JP' => '','-JP' => 'Japan',
'JP-01' => 'Japan: Aichi',
'JP-02' => 'Japan: Akita',
'JP-03' => 'Japan: Aomori',
'JP-04' => 'Japan: Chiba',
'JP-05' => 'Japan: Ehime',
'JP-06' => 'Japan: Fukui',
'JP-07' => 'Japan: Fukuoka',
'JP-08' => 'Japan: Fukushima',
'JP-09' => 'Japan: Gifu',
'JP-10' => 'Japan: Gumma',
'JP-11' => 'Japan: Hiroshima',
'JP-12' => 'Japan: Hokkaido',
'JP-13' => 'Japan: Hyogo',
'JP-14' => 'Japan: Ibaraki',
'JP-15' => 'Japan: Ishikawa',
'JP-16' => 'Japan: Iwate',
'JP-17' => 'Japan: Kagawa',
'JP-18' => 'Japan: Kagoshima',
'JP-19' => 'Japan: Kanagawa',
'JP-20' => 'Japan: Kochi',
'JP-21' => 'Japan: Kumamoto',
'JP-22' => 'Japan: Kyoto',
'JP-23' => 'Japan: Mie',
'JP-24' => 'Japan: Miyagi',
'JP-25' => 'Japan: Miyazaki',
'JP-26' => 'Japan: Nagano',
'JP-27' => 'Japan: Nagasaki',
'JP-28' => 'Japan: Nara',
'JP-29' => 'Japan: Niigata',
'JP-30' => 'Japan: Oita',
'JP-31' => 'Japan: Okayama',
'JP-47' => 'Japan: Okinawa',
'JP-32' => 'Japan: Osaka',
'JP-33' => 'Japan: Saga',
'JP-34' => 'Japan: Saitama',
'JP-35' => 'Japan: Shiga',
'JP-36' => 'Japan: Shimane',
'JP-37' => 'Japan: Shizuoka',
'JP-38' => 'Japan: Tochigi',
'JP-39' => 'Japan: Tokushima',
'JP-40' => 'Japan: Tokyo',
'JP-41' => 'Japan: Tottori',
'JP-42' => 'Japan: Toyama',
'JP-43' => 'Japan: Wakayama',
'JP-44' => 'Japan: Yamagata',
'JP-45' => 'Japan: Yamaguchi',
'JP-46' => 'Japan: Yamanashi',

'--JO' => '','-JO' => 'Jordan',
'JO-02' => 'Jordan: Al Balqa\'',
'JO-09' => 'Jordan: Al Karak',
'JO-10' => 'Jordan: Al Mafraq',
'JO-16' => 'Jordan: Amman',
'JO-12' => 'Jordan: At Tafilah',
'JO-13' => 'Jordan: Az Zarqa',
'JO-14' => 'Jordan: Irbid',
'JO-07' => 'Jordan: Ma',

'--KZ' => '','-KZ' => 'Kazakhstan',
'KZ-02' => 'Kazakhstan: Almaty City',
'KZ-01' => 'Kazakhstan: Almaty',
'KZ-03' => 'Kazakhstan: Aqmola',
'KZ-04' => 'Kazakhstan: Aqt?be',
'KZ-05' => 'Kazakhstan: Astana',
'KZ-06' => 'Kazakhstan: Atyrau',
'KZ-08' => 'Kazakhstan: Bayqonyr',
'KZ-15' => 'Kazakhstan: East Kazakhstan',
'KZ-09' => 'Kazakhstan: Mangghystau',
'KZ-16' => 'Kazakhstan: North Kazakhstan',
'KZ-11' => 'Kazakhstan: Pavlodar',
'KZ-12' => 'Kazakhstan: Qaraghandy',
'KZ-13' => 'Kazakhstan: Qostanay',
'KZ-14' => 'Kazakhstan: Qyzylorda',
'KZ-10' => 'Kazakhstan: South Kazakhstan',
'KZ-07' => 'Kazakhstan: West Kazakhstan',
'KZ-17' => 'Kazakhstan: Zhambyl',

'--KE' => '','-KE' => 'Kenya',
'KE-01' => 'Kenya: Central',
'KE-02' => 'Kenya: Coast',
'KE-03' => 'Kenya: Eastern',
'KE-05' => 'Kenya: Nairobi Area',
'KE-06' => 'Kenya: North-Eastern',
'KE-07' => 'Kenya: Nyanza',
'KE-08' => 'Kenya: Rift Valley',
'KE-09' => 'Kenya: Western',

'--KI' => '','-KI' => 'Kiribati',
'KI-01' => 'Kiribati: Gilbert Islands',
'KI-02' => 'Kiribati: Line Islands',
'KI-03' => 'Kiribati: Phoenix Islands',

'--KW' => '','-KW' => 'Kuwait',
'KW-01' => 'Kuwait: Al Ahmadi',
'KW-05' => 'Kuwait: Al Jahra',
'KW-02' => 'Kuwait: Al Kuwayt',
'KW-03' => 'Kuwait: Hawalli',

'--KG' => '','-KG' => 'Kyrgyzstan',
'KG-09' => 'Kyrgyzstan: Batken',
'KG-01' => 'Kyrgyzstan: Bishkek',
'KG-02' => 'Kyrgyzstan: Chuy',
'KG-03' => 'Kyrgyzstan: Jalal-Abad',
'KG-04' => 'Kyrgyzstan: Naryn',
'KG-08' => 'Kyrgyzstan: Osh',
'KG-06' => 'Kyrgyzstan: Talas',
'KG-07' => 'Kyrgyzstan: Ysyk-Kol',

'--LA' => '','-LA' => 'Lao',
'LA-01' => 'Lao: Attapu',
'LA-02' => 'Lao: Champasak',
'LA-03' => 'Lao: Houaphan',
'LA-04' => 'Lao: Khammouan',
'LA-05' => 'Lao: Louang Namtha',
'LA-17' => 'Lao: Louangphrabang',
'LA-07' => 'Lao: Oudomxai',
'LA-08' => 'Lao: Phongsali',
'LA-09' => 'Lao: Saravan',
'LA-10' => 'Lao: Savannakhet',
'LA-11' => 'Lao: Vientiane',
'LA-13' => 'Lao: Xaignabouri',
'LA-14' => 'Lao: Xiangkhoang',

'--LV' => '','-LV' => 'Latvia',
'LV-01' => 'Latvia: Aizkraukles',
'LV-02' => 'Latvia: Aluksnes',
'LV-03' => 'Latvia: Balvu',
'LV-04' => 'Latvia: Bauskas',
'LV-05' => 'Latvia: Césu',
'LV-06' => 'Latvia: Daugavpils',
'LV-07' => 'Latvia: Daugavpils',
'LV-08' => 'Latvia: Dobeles',
'LV-09' => 'Latvia: Gulbenes',
'LV-10' => 'Latvia: Jékabpils',
'LV-11' => 'Latvia: Jelgava',
'LV-12' => 'Latvia: Jelgavas',
'LV-13' => 'Latvia: Jurmala',
'LV-14' => 'Latvia: Kráslavas',
'LV-15' => 'Latvia: Kuldigas',
'LV-16' => 'Latvia: Liepája',
'LV-17' => 'Latvia: Liepájas',
'LV-18' => 'Latvia: Limbazu',
'LV-19' => 'Latvia: Ludzas',
'LV-20' => 'Latvia: Madonas',
'LV-21' => 'Latvia: Ogres',
'LV-22' => 'Latvia: Preilu',
'LV-23' => 'Latvia: Rézekne',
'LV-24' => 'Latvia: Rézeknes',
'LV-25' => 'Latvia: Riga',
'LV-26' => 'Latvia: Rigas',
'LV-27' => 'Latvia: Saldus',
'LV-28' => 'Latvia: Talsu',
'LV-29' => 'Latvia: Tukuma',
'LV-30' => 'Latvia: Valkas',
'LV-31' => 'Latvia: Valmieras',
'LV-32' => 'Latvia: Ventspils',
'LV-33' => 'Latvia: Ventspils',

'--LB' => '','-LB' => 'Lebanon',
'LB-01' => 'Lebanon: Beqaa',
'LB-04' => 'Lebanon: Beyrouth',
'LB-03' => 'Lebanon: Liban-Nord',
'LB-06' => 'Lebanon: Liban-Sud',
'LB-05' => 'Lebanon: Mont-Liban',
'LB-07' => 'Lebanon: Nabatiye',

'--LS' => '','-LS' => 'Lesotho',
'LS-10' => 'Lesotho: Berea',
'LS-11' => 'Lesotho: Butha-Buthe',
'LS-12' => 'Lesotho: Leribe',
'LS-13' => 'Lesotho: Mafeteng',
'LS-14' => 'Lesotho: Maseru',
'LS-15' => 'Lesotho: Mohales Hoek',
'LS-16' => 'Lesotho: Mokhotlong',
'LS-17' => 'Lesotho: Qachas Nek',
'LS-18' => 'Lesotho: Quthing',
'LS-19' => 'Lesotho: Thaba-Tseka',

'--LR' => '','-LR' => 'Liberia',
'LR-01' => 'Liberia: Bong',
'LR-11' => 'Liberia: Grand Bassa',
'LR-04' => 'Liberia: Grand Cape Mount',
'LR-02' => 'Liberia: Grand Jide',
'LR-05' => 'Liberia: Lofa',
'LR-06' => 'Liberia: Maryland',
'LR-07' => 'Liberia: Monrovia',
'LR-14' => 'Liberia: Montserrado',
'LR-09' => 'Liberia: Nimba',
'LR-10' => 'Liberia: Sino',

'--LY' => '','-LY' => 'Libyan Arab Jamahiriya',
'LY-47' => 'Libyan Arab Jamahiriya: Ajdabiya',
'LY-48' => 'Libyan Arab Jamahiriya: Al Fatih',
'LY-49' => 'Libyan Arab Jamahiriya: Al Jabal al Akhdar',
'LY-05' => 'Libyan Arab Jamahiriya: Al Jufrah',
'LY-50' => 'Libyan Arab Jamahiriya: Al Khums',
'LY-08' => 'Libyan Arab Jamahiriya: Al Kufrah',
'LY-03' => 'Libyan Arab Jamahiriya: Al',
'LY-51' => 'Libyan Arab Jamahiriya: An Nuqat al Khams',
'LY-13' => 'Libyan Arab Jamahiriya: Ash Shati\'',
'LY-52' => 'Libyan Arab Jamahiriya: Awbari',
'LY-53' => 'Libyan Arab Jamahiriya: Az Zawiyah',
'LY-54' => 'Libyan Arab Jamahiriya: Banghazi',
'LY-55' => 'Libyan Arab Jamahiriya: Darnah',
'LY-56' => 'Libyan Arab Jamahiriya: Ghadamis',
'LY-57' => 'Libyan Arab Jamahiriya: Gharyan',
'LY-58' => 'Libyan Arab Jamahiriya: Misratah',
'LY-30' => 'Libyan Arab Jamahiriya: Murzuq',
'LY-34' => 'Libyan Arab Jamahiriya: Sabha',
'LY-59' => 'Libyan Arab Jamahiriya: Sawfajjin',
'LY-60' => 'Libyan Arab Jamahiriya: Surt',
'LY-61' => 'Libyan Arab Jamahiriya: Tarabulus',
'LY-41' => 'Libyan Arab Jamahiriya: Tarhunah',
'LY-42' => 'Libyan Arab Jamahiriya: Tubruq',
'LY-62' => 'Libyan Arab Jamahiriya: Yafran',
'LY-45' => 'Libyan Arab Jamahiriya: Zlitan',

'--LI' => '','-LI' => 'Liechtenstein',
'LI-01' => 'Liechtenstein: Balzers',
'LI-02' => 'Liechtenstein: Eschen',
'LI-03' => 'Liechtenstein: Gamprin',
'LI-04' => 'Liechtenstein: Mauren',
'LI-05' => 'Liechtenstein: Planken',
'LI-06' => 'Liechtenstein: Ruggell',
'LI-07' => 'Liechtenstein: Schaan',
'LI-08' => 'Liechtenstein: Schellenberg',
'LI-09' => 'Liechtenstein: Triesen',
'LI-10' => 'Liechtenstein: Triesenberg',
'LI-11' => 'Liechtenstein: Vaduz',

'--LT' => '','-LT' => 'Lithuania',
'LT-56' => 'Lithuania: Alytaus Apskritis',
'LT-57' => 'Lithuania: Kauno Apskritis',
'LT-58' => 'Lithuania: Klaipedos Apskritis',
'LT-59' => 'Lithuania: Marijampoles Apskritis',
'LT-60' => 'Lithuania: Panevezio Apskritis',
'LT-61' => 'Lithuania: Siauliu Apskritis',
'LT-62' => 'Lithuania: Taurages Apskritis',
'LT-63' => 'Lithuania: Telsiu Apskritis',
'LT-64' => 'Lithuania: Utenos Apskritis',
'LT-65' => 'Lithuania: Vilniaus Apskritis',

'--LU' => '','-LU' => 'Luxembourg',
'LU-01' => 'Luxembourg: Diekirch',
'LU-02' => 'Luxembourg: Grevenmacher',
'LU-03' => 'Luxembourg: Luxembourg',

'--MO' => '','-MO' => 'Macau',
'MO-01' => 'Macau: Ilhas',
'MO-02' => 'Macau: Macau',

'--MK' => '','-MK' => 'Macedonia',
'MK-01' => 'Macedonia: Aracinovo',
'MK-02' => 'Macedonia: Bac',
'MK-03' => 'Macedonia: Belcista',
'MK-04' => 'Macedonia: Berovo',
'MK-05' => 'Macedonia: Bistrica',
'MK-06' => 'Macedonia: Bitola',
'MK-07' => 'Macedonia: Blatec',
'MK-08' => 'Macedonia: Bogdanci',
'MK-09' => 'Macedonia: Bogomila',
'MK-10' => 'Macedonia: Bogovinje',
'MK-11' => 'Macedonia: Bosilovo',
'MK-12' => 'Macedonia: Brvenica',
'MK-13' => 'Macedonia: Cair',
'MK-14' => 'Macedonia: Capari',
'MK-15' => 'Macedonia: Caska',
'MK-16' => 'Macedonia: Cegrane',
'MK-18' => 'Macedonia: Centar Zupa',
'MK-17' => 'Macedonia: Centar',
'MK-19' => 'Macedonia: Cesinovo',
'MK-20' => 'Macedonia: Cucer-Sandevo',
'MK-21' => 'Macedonia: Debar',
'MK-22' => 'Macedonia: Delcevo',
'MK-23' => 'Macedonia: Delogozdi',
'MK-24' => 'Macedonia: Demir Hisar',
'MK-25' => 'Macedonia: Demir Kapija',
'MK-26' => 'Macedonia: Dobrusevo',
'MK-27' => 'Macedonia: Dolna Banjica',
'MK-28' => 'Macedonia: Dolneni',
'MK-29' => 'Macedonia: Dorce Petrov',
'MK-30' => 'Macedonia: Drugovo',
'MK-31' => 'Macedonia: Dzepciste',
'MK-32' => 'Macedonia: Gazi Baba',
'MK-33' => 'Macedonia: Gevgelija',
'MK-34' => 'Macedonia: Gostivar',
'MK-35' => 'Macedonia: Gradsko',
'MK-36' => 'Macedonia: Ilinden',
'MK-37' => 'Macedonia: Izvor',
'MK-38' => 'Macedonia: Jegunovce',
'MK-39' => 'Macedonia: Kamenjane',
'MK-40' => 'Macedonia: Karbinci',
'MK-41' => 'Macedonia: Karpos',
'MK-42' => 'Macedonia: Kavadarci',
'MK-43' => 'Macedonia: Kicevo',
'MK-44' => 'Macedonia: Kisela Voda',
'MK-45' => 'Macedonia: Klecevce',
'MK-46' => 'Macedonia: Kocani',
'MK-47' => 'Macedonia: Konce',
'MK-48' => 'Macedonia: Kondovo',
'MK-49' => 'Macedonia: Konopiste',
'MK-50' => 'Macedonia: Kosel',
'MK-51' => 'Macedonia: Kratovo',
'MK-52' => 'Macedonia: Kriva Palanka',
'MK-53' => 'Macedonia: Krivogastani',
'MK-54' => 'Macedonia: Krusevo',
'MK-55' => 'Macedonia: Kuklis',
'MK-56' => 'Macedonia: Kukurecani',
'MK-57' => 'Macedonia: Kumanovo',
'MK-58' => 'Macedonia: Labunista',
'MK-59' => 'Macedonia: Lipkovo',
'MK-60' => 'Macedonia: Lozovo',
'MK-61' => 'Macedonia: Lukovo',
'MK-62' => 'Macedonia: Makedonska Kamenica',
'MK-63' => 'Macedonia: Makedonski Brod',
'MK-64' => 'Macedonia: Mavrovi Anovi',
'MK-65' => 'Macedonia: Meseista',
'MK-66' => 'Macedonia: Miravci',
'MK-67' => 'Macedonia: Mogila',
'MK-68' => 'Macedonia: Murtino',
'MK-69' => 'Macedonia: Negotino',
'MK-70' => 'Macedonia: Negotino-Polosko',
'MK-71' => 'Macedonia: Novaci',
'MK-72' => 'Macedonia: Novo Selo',
'MK-73' => 'Macedonia: Oblesevo',
'MK-74' => 'Macedonia: Ohrid',
'MK-75' => 'Macedonia: Orasac',
'MK-76' => 'Macedonia: Orizari',
'MK-77' => 'Macedonia: Oslomej',
'MK-78' => 'Macedonia: Pehcevo',
'MK-79' => 'Macedonia: Petrovec',
'MK-80' => 'Macedonia: Plasnica',
'MK-81' => 'Macedonia: Podares',
'MK-82' => 'Macedonia: Prilep',
'MK-83' => 'Macedonia: Probistip',
'MK-84' => 'Macedonia: Radovis',
'MK-85' => 'Macedonia: Rankovce',
'MK-86' => 'Macedonia: Resen',
'MK-87' => 'Macedonia: Rosoman',
'MK-88' => 'Macedonia: Rostusa',
'MK-89' => 'Macedonia: Samokov',
'MK-90' => 'Macedonia: Saraj',
'MK-91' => 'Macedonia: Sipkovica',
'MK-92' => 'Macedonia: Sopiste',
'MK-93' => 'Macedonia: Sopotnica',
'MK-94' => 'Macedonia: Srbinovo',
'MK-96' => 'Macedonia: Star Dojran',
'MK-95' => 'Macedonia: Staravina',
'MK-97' => 'Macedonia: Staro Nagoricane',
'MK-98' => 'Macedonia: Stip',
'MK-99' => 'Macedonia: Struga',
'MK-A1' => 'Macedonia: Strumica',
'MK-A2' => 'Macedonia: Studenicani',
'MK-A3' => 'Macedonia: Suto Orizari',
'MK-A4' => 'Macedonia: Sveti Nikole',
'MK-A5' => 'Macedonia: Tearce',
'MK-A6' => 'Macedonia: Tetovo',
'MK-A7' => 'Macedonia: Topolcani',
'MK-A8' => 'Macedonia: Valandovo',
'MK-A9' => 'Macedonia: Vasilevo',
'MK-B1' => 'Macedonia: Veles',
'MK-B2' => 'Macedonia: Velesta',
'MK-B3' => 'Macedonia: Vevcani',
'MK-B4' => 'Macedonia: Vinica',
'MK-B5' => 'Macedonia: Vitoliste',
'MK-B6' => 'Macedonia: Vranestica',
'MK-B7' => 'Macedonia: Vrapciste',
'MK-B8' => 'Macedonia: Vratnica',
'MK-B9' => 'Macedonia: Vrutok',
'MK-C1' => 'Macedonia: Zajas',
'MK-C2' => 'Macedonia: Zelenikovo',
'MK-C3' => 'Macedonia: Zelino',
'MK-C4' => 'Macedonia: Zitose',
'MK-C5' => 'Macedonia: Zletovo',
'MK-C6' => 'Macedonia: Zrnovci',

'--MG' => '','-MG' => 'Madagascar',
'MG-05' => 'Madagascar: Antananarivo',
'MG-01' => 'Madagascar: Antsiranana',
'MG-02' => 'Madagascar: Fianarantsoa',
'MG-03' => 'Madagascar: Mahajanga',
'MG-04' => 'Madagascar: Toamasina',
'MG-06' => 'Madagascar: Toliara',

'--MW' => '','-MW' => 'Malawi',
'MW-26' => 'Malawi: Balaka',
'MW-24' => 'Malawi: Blantyre',
'MW-02' => 'Malawi: Chikwawa',
'MW-03' => 'Malawi: Chiradzulu',
'MW-04' => 'Malawi: Chitipa',
'MW-06' => 'Malawi: Dedza',
'MW-07' => 'Malawi: Dowa',
'MW-08' => 'Malawi: Karonga',
'MW-09' => 'Malawi: Kasungu',
'MW-27' => 'Malawi: Likoma',
'MW-11' => 'Malawi: Lilongwe',
'MW-28' => 'Malawi: Machinga',
'MW-12' => 'Malawi: Mangochi',
'MW-13' => 'Malawi: Mchinji',
'MW-29' => 'Malawi: Mulanje',
'MW-25' => 'Malawi: Mwanza',
'MW-15' => 'Malawi: Mzimba',
'MW-17' => 'Malawi: Nkhata Bay',
'MW-18' => 'Malawi: Nkhotakota',
'MW-19' => 'Malawi: Nsanje',
'MW-16' => 'Malawi: Ntcheu',
'MW-20' => 'Malawi: Ntchisi',
'MW-30' => 'Malawi: Phalombe',
'MW-21' => 'Malawi: Rumphi',
'MW-22' => 'Malawi: Salima',
'MW-05' => 'Malawi: Thyolo',
'MW-23' => 'Malawi: Zomba',

'--MY' => '','-MY' => 'Malaysia',
'MY-01' => 'Malaysia: Johor',
'MY-02' => 'Malaysia: Kedah',
'MY-03' => 'Malaysia: Kelantan',
'MY-15' => 'Malaysia: Labuan',
'MY-04' => 'Malaysia: Melaka',
'MY-05' => 'Malaysia: Negeri Sembilan',
'MY-06' => 'Malaysia: Pahang',
'MY-07' => 'Malaysia: Perak',
'MY-08' => 'Malaysia: Perlis',
'MY-09' => 'Malaysia: Pulau Pinang',
'MY-16' => 'Malaysia: Sabah',
'MY-11' => 'Malaysia: Sarawak',
'MY-12' => 'Malaysia: Selangor',
'MY-13' => 'Malaysia: Terengganu',
'MY-14' => 'Malaysia: Wilayah Persekutuan',

'--MV' => '','-MV' => 'Maldives',
'MV-02' => 'Maldives: Aliff',
'MV-20' => 'Maldives: Baa',
'MV-17' => 'Maldives: Daalu',
'MV-14' => 'Maldives: Faafu',
'MV-27' => 'Maldives: Gaafu Aliff',
'MV-28' => 'Maldives: Gaafu Daalu',
'MV-07' => 'Maldives: Haa Aliff',
'MV-23' => 'Maldives: Haa Daalu',
'MV-26' => 'Maldives: Kaafu',
'MV-05' => 'Maldives: Laamu',
'MV-03' => 'Maldives: Laviyani',
'MV-12' => 'Maldives: Meemu',
'MV-29' => 'Maldives: Naviyani',
'MV-25' => 'Maldives: Noonu',
'MV-13' => 'Maldives: Raa',
'MV-01' => 'Maldives: Seenu',
'MV-24' => 'Maldives: Shaviyani',
'MV-08' => 'Maldives: Thaa',
'MV-04' => 'Maldives: Waavu',

'--ML' => '','-ML' => 'Mali',
'ML-01' => 'Mali: Bamako',
'ML-09' => 'Mali: Gao',
'ML-03' => 'Mali: Kayes',
'ML-10' => 'Mali: Kidal',
'ML-07' => 'Mali: Koulikoro',
'ML-04' => 'Mali: Mopti',
'ML-05' => 'Mali: Segou',
'ML-06' => 'Mali: Sikasso',
'ML-08' => 'Mali: Tombouctou',

'--MR' => '','-MR' => 'Mauritania',
'MR-07' => 'Mauritania: Adrar',
'MR-03' => 'Mauritania: Assaba',
'MR-05' => 'Mauritania: Brakna',
'MR-08' => 'Mauritania: Dakhlet Nouadhibou',
'MR-04' => 'Mauritania: Gorgol',
'MR-10' => 'Mauritania: Guidimaka',
'MR-01' => 'Mauritania: Hodh Ech Chargui',
'MR-02' => 'Mauritania: Hodh El Gharbi',
'MR-12' => 'Mauritania: Inchiri',
'MR-09' => 'Mauritania: Tagant',
'MR-11' => 'Mauritania: Tiris Zemmour',
'MR-06' => 'Mauritania: Trarza',

'--MU' => '','-MU' => 'Mauritius',
'MU-21' => 'Mauritius: Agalega Islands',
'MU-12' => 'Mauritius: Black River',
'MU-22' => 'Mauritius: Cargados Carajos',
'MU-13' => 'Mauritius: Flacq',
'MU-14' => 'Mauritius: Grand Port',
'MU-15' => 'Mauritius: Moka',
'MU-16' => 'Mauritius: Pamplemousses',
'MU-17' => 'Mauritius: Plaines Wilhems',
'MU-18' => 'Mauritius: Port Louis',
'MU-19' => 'Mauritius: Riviere du Rempart',
'MU-23' => 'Mauritius: Rodrigues',
'MU-20' => 'Mauritius: Savanne',

'--MX' => '','-MX' => 'Mexico',
'MX-01' => 'Mexico: Aguascalientes',
'MX-03' => 'Mexico: Baja California Sur',
'MX-02' => 'Mexico: Baja California',
'MX-04' => 'Mexico: Campeche',
'MX-05' => 'Mexico: Chiapas',
'MX-06' => 'Mexico: Chihuahua',
'MX-07' => 'Mexico: Coahuila de Zaragoza',
'MX-08' => 'Mexico: Colima',
'MX-09' => 'Mexico: Distrito Federal',
'MX-10' => 'Mexico: Durango',
'MX-11' => 'Mexico: Guanajuato',
'MX-12' => 'Mexico: Guerrero',
'MX-13' => 'Mexico: Hidalgo',
'MX-14' => 'Mexico: Jalisco',
'MX-15' => 'Mexico: Mexico',
'MX-16' => 'Mexico: Michoacan de Ocampo',
'MX-17' => 'Mexico: Morelos',
'MX-18' => 'Mexico: Nayarit',
'MX-19' => 'Mexico: Nuevo Leon',
'MX-20' => 'Mexico: Oaxaca',
'MX-21' => 'Mexico: Puebla',
'MX-22' => 'Mexico: Queretaro de Arteaga',
'MX-23' => 'Mexico: Quintana Roo',
'MX-24' => 'Mexico: San Luis Potosi',
'MX-25' => 'Mexico: Sinaloa',
'MX-26' => 'Mexico: Sonora',
'MX-27' => 'Mexico: Tabasco',
'MX-28' => 'Mexico: Tamaulipas',
'MX-29' => 'Mexico: Tlaxcala',
'MX-30' => 'Mexico: Veracruz-Llave',
'MX-31' => 'Mexico: Yucatan',
'MX-32' => 'Mexico: Zacatecas',

'--FM' => '','-FM' => 'Micronesia',
'FM-03' => 'Micronesia: Chuuk',
'FM-01' => 'Micronesia: Kosrae',
'FM-02' => 'Micronesia: Pohnpei',
'FM-04' => 'Micronesia: Yap',

'--MD' => '','-MD' => 'Moldova',
'MD-46' => 'Moldova: Balti',
'MD-47' => 'Moldova: Cahul',
'MD-48' => 'Moldova: Chisinau',
'MD-50' => 'Moldova: Edinet',
'MD-51' => 'Moldova: Gagauzia',
'MD-52' => 'Moldova: Lapusna',
'MD-53' => 'Moldova: Orhei',
'MD-54' => 'Moldova: Soroca',
'MD-49' => 'Moldova: Stinga Nistrului',
'MD-55' => 'Moldova: Tighina',
'MD-56' => 'Moldova: Ungheni',

'--MC' => '','-MC' => 'Monaco',
'MC-01' => 'Monaco: La Condamine',
'MC-02' => 'Monaco: Monaco',
'MC-03' => 'Monaco: Monte-Carlo',

'--MN' => '','-MN' => 'Mongolia',
'MN-01' => 'Mongolia: Arhangay',
'MN-02' => 'Mongolia: Bayanhongor',
'MN-03' => 'Mongolia: Bayan-Olgiy',
'MN-21' => 'Mongolia: Bulgan',
'MN-23' => 'Mongolia: Darhan Uul',
'MN-05' => 'Mongolia: Darhan',
'MN-06' => 'Mongolia: Dornod',
'MN-07' => 'Mongolia: Dornogovi',
'MN-08' => 'Mongolia: Dundgovi',
'MN-09' => 'Mongolia: Dzavhan',
'MN-22' => 'Mongolia: Erdenet',
'MN-10' => 'Mongolia: Govi-Altay',
'MN-24' => 'Mongolia: Govi-Sumber',
'MN-11' => 'Mongolia: Hentiy',
'MN-12' => 'Mongolia: Hovd',
'MN-13' => 'Mongolia: Hovsgol',
'MN-14' => 'Mongolia: Omnogovi',
'MN-25' => 'Mongolia: Orhon',
'MN-15' => 'Mongolia: Ovorhangay',
'MN-16' => 'Mongolia: Selenge',
'MN-17' => 'Mongolia: Suhbaatar',
'MN-18' => 'Mongolia: Tov',
'MN-20' => 'Mongolia: Ulaanbaatar',
'MN-19' => 'Mongolia: Uvs',

'--MS' => '','-MS' => 'Montserrat',
'MS-01' => 'Montserrat: Saint Anthony',
'MS-02' => 'Montserrat: Saint Georges',
'MS-03' => 'Montserrat: Saint Peter',

'--MA' => '','-MA' => 'Morocco',
'MA-01' => 'Morocco: Agadir',
'MA-02' => 'Morocco: Al Hoceima',
'MA-03' => 'Morocco: Azilal',
'MA-04' => 'Morocco: Ben Slimane',
'MA-05' => 'Morocco: Beni Mellal',
'MA-06' => 'Morocco: Boulemane',
'MA-07' => 'Morocco: Casablanca',
'MA-08' => 'Morocco: Chaouen',
'MA-09' => 'Morocco: El Jadida',
'MA-10' => 'Morocco: El Kelaa des Srarhna',
'MA-11' => 'Morocco: Er Rachidia',
'MA-12' => 'Morocco: Essaouira',
'MA-13' => 'Morocco: Fes',
'MA-14' => 'Morocco: Figuig',
'MA-33' => 'Morocco: Guelmim',
'MA-34' => 'Morocco: Ifrane',
'MA-15' => 'Morocco: Kenitra',
'MA-16' => 'Morocco: Khemisset',
'MA-17' => 'Morocco: Khenifra',
'MA-18' => 'Morocco: Khouribga',
'MA-35' => 'Morocco: Laayoune',
'MA-41' => 'Morocco: Larache',
'MA-19' => 'Morocco: Marrakech',
'MA-20' => 'Morocco: Meknes',
'MA-21' => 'Morocco: Nador',
'MA-22' => 'Morocco: Ouarzazate',
'MA-23' => 'Morocco: Oujda',
'MA-24' => 'Morocco: Rabat-Sale',
'MA-25' => 'Morocco: Safi',
'MA-26' => 'Morocco: Settat',
'MA-38' => 'Morocco: Sidi Kacem',
'MA-27' => 'Morocco: Tanger',
'MA-36' => 'Morocco: Tan-Tan',
'MA-37' => 'Morocco: Taounate',
'MA-39' => 'Morocco: Taroudannt',
'MA-29' => 'Morocco: Tata',
'MA-30' => 'Morocco: Taza',
'MA-40' => 'Morocco: Tetouan',
'MA-32' => 'Morocco: Tiznit',

'--MZ' => '','-MZ' => 'Mozambique',
'MZ-01' => 'Mozambique: Cabo Delgado',
'MZ-02' => 'Mozambique: Gaza',
'MZ-03' => 'Mozambique: Inhambane',
'MZ-10' => 'Mozambique: Manica',
'MZ-04' => 'Mozambique: Maputo',
'MZ-06' => 'Mozambique: Nampula',
'MZ-07' => 'Mozambique: Niassa',
'MZ-05' => 'Mozambique: Sofala',
'MZ-08' => 'Mozambique: Tete',
'MZ-09' => 'Mozambique: Zambezia',

'--MM' => '','-MM' => 'Myanmar',
'MM-02' => 'Myanmar: Chin State',
'MM-03' => 'Myanmar: Irrawaddy',
'MM-04' => 'Myanmar: Kachin State',
'MM-05' => 'Myanmar: Karan State',
'MM-06' => 'Myanmar: Kayah State',
'MM-07' => 'Myanmar: Magwe',
'MM-08' => 'Myanmar: Mandalay',
'MM-13' => 'Myanmar: Mon State',
'MM-09' => 'Myanmar: Pegu',
'MM-01' => 'Myanmar: Rakhine State',
'MM-14' => 'Myanmar: Rangoon',
'MM-10' => 'Myanmar: Sagaing',
'MM-11' => 'Myanmar: Shan State',
'MM-12' => 'Myanmar: Tenasserim',
'MM-17' => 'Myanmar: Yangon',

'--NA' => '','-NA' => 'Namibia',
'NA-01' => 'Namibia: Bethanien',
'NA-03' => 'Namibia: Boesmanland',
'NA-02' => 'Namibia: Caprivi Oos',
'NA-28' => 'Namibia: Caprivi',
'NA-22' => 'Namibia: Damaraland',
'NA-29' => 'Namibia: Erongo',
'NA-04' => 'Namibia: Gobabis',
'NA-05' => 'Namibia: Grootfontein',
'NA-30' => 'Namibia: Hardap',
'NA-23' => 'Namibia: Hereroland Oos',
'NA-24' => 'Namibia: Hereroland Wes',
'NA-06' => 'Namibia: Kaokoland',
'NA-31' => 'Namibia: Karas',
'NA-20' => 'Namibia: Karasburg',
'NA-07' => 'Namibia: Karibib',
'NA-25' => 'Namibia: Kavango',
'NA-08' => 'Namibia: Keetmanshoop',
'NA-32' => 'Namibia: Kunene',
'NA-09' => 'Namibia: Luderitz',
'NA-10' => 'Namibia: Maltahohe',
'NA-26' => 'Namibia: Mariental',
'NA-27' => 'Namibia: Namaland',
'NA-33' => 'Namibia: Ohangwena',
'NA-11' => 'Namibia: Okahandja',
'NA-34' => 'Namibia: Okavango',
'NA-35' => 'Namibia: Omaheke',
'NA-12' => 'Namibia: Omaruru',
'NA-36' => 'Namibia: Omusati',
'NA-37' => 'Namibia: Oshana',
'NA-38' => 'Namibia: Oshikoto',
'NA-13' => 'Namibia: Otjiwarongo',
'NA-39' => 'Namibia: Otjozondjupa',
'NA-14' => 'Namibia: Outjo',
'NA-15' => 'Namibia: Owambo',
'NA-16' => 'Namibia: Rehoboth',
'NA-17' => 'Namibia: Swakopmund',
'NA-18' => 'Namibia: Tsumeb',
'NA-21' => 'Namibia: Windhoek',

'--NR' => '','-NR' => 'Nauru',
'NR-01' => 'Nauru: Aiwo',
'NR-02' => 'Nauru: Anabar',
'NR-03' => 'Nauru: Anetan',
'NR-04' => 'Nauru: Anibare',
'NR-05' => 'Nauru: Baiti',
'NR-06' => 'Nauru: Boe',
'NR-07' => 'Nauru: Buada',
'NR-08' => 'Nauru: Denigomodu',
'NR-09' => 'Nauru: Ewa',
'NR-10' => 'Nauru: Ijuw',
'NR-11' => 'Nauru: Meneng',
'NR-12' => 'Nauru: Nibok',
'NR-13' => 'Nauru: Uaboe',
'NR-14' => 'Nauru: Yaren',

'--NP' => '','-NP' => 'Nepal',
'NP-01' => 'Nepal: Bagmati',
'NP-02' => 'Nepal: Bheri',
'NP-03' => 'Nepal: Dhawalagiri',
'NP-04' => 'Nepal: Gandaki',
'NP-05' => 'Nepal: Janakpur',
'NP-06' => 'Nepal: Karnali',
'NP-07' => 'Nepal: Kosi',
'NP-08' => 'Nepal: Lumbini',
'NP-09' => 'Nepal: Mahakali',
'NP-10' => 'Nepal: Mechi',
'NP-11' => 'Nepal: Narayani',
'NP-12' => 'Nepal: Rapti',
'NP-13' => 'Nepal: Sagarmatha',
'NP-14' => 'Nepal: Seti',

'--NL' => '','-NL' => 'Netherlands',
'NL-01' => 'Netherlands: Drenthe',
'NL-16' => 'Netherlands: Flevoland',
'NL-02' => 'Netherlands: Friesland',
'NL-03' => 'Netherlands: Gelderland',
'NL-04' => 'Netherlands: Groningen',
'NL-05' => 'Netherlands: Limburg',
'NL-06' => 'Netherlands: Noord-Brabant',
'NL-07' => 'Netherlands: Noord-Holland',
'NL-15' => 'Netherlands: Overijssel',
'NL-09' => 'Netherlands: Utrecht',
'NL-10' => 'Netherlands: Zeeland',
'NL-11' => 'Netherlands: Zuid-Holland',

'--NZ' => '','-NZ' => 'New Zealand',
'NZ-01' => 'New Zealand: Akaroa',
'NZ-03' => 'New Zealand: Amuri',
'NZ-04' => 'New Zealand: Ashburton',
'NZ-07' => 'New Zealand: Bay of Islands',
'NZ-08' => 'New Zealand: Bruce',
'NZ-09' => 'New Zealand: Buller',
'NZ-10' => 'New Zealand: Chatham Islands',
'NZ-11' => 'New Zealand: Cheviot',
'NZ-12' => 'New Zealand: Clifton',
'NZ-13' => 'New Zealand: Clutha',
'NZ-14' => 'New Zealand: Cook',
'NZ-16' => 'New Zealand: Dannevirke',
'NZ-17' => 'New Zealand: Egmont',
'NZ-18' => 'New Zealand: Eketahuna',
'NZ-19' => 'New Zealand: Ellesmere',
'NZ-20' => 'New Zealand: Eltham',
'NZ-21' => 'New Zealand: Eyre',
'NZ-22' => 'New Zealand: Featherston',
'NZ-24' => 'New Zealand: Franklin',
'NZ-26' => 'New Zealand: Golden Bay',
'NZ-27' => 'New Zealand: Great Barrier Island',
'NZ-28' => 'New Zealand: Grey',
'NZ-29' => 'New Zealand: Hauraki Plains',
'NZ-30' => 'New Zealand: Hawera',
'NZ-31' => 'New Zealand: Hawke\'s Bay',
'NZ-32' => 'New Zealand: Heathcote',
'NZ-D9' => 'New Zealand: Hikurangi',
'NZ-33' => 'New Zealand: Hobson',
'NZ-34' => 'New Zealand: Hokianga',
'NZ-35' => 'New Zealand: Horowhenua',
'NZ-D4' => 'New Zealand: Hurunui',
'NZ-36' => 'New Zealand: Hutt',
'NZ-37' => 'New Zealand: Inangahua',
'NZ-38' => 'New Zealand: Inglewood',
'NZ-39' => 'New Zealand: Kaikoura',
'NZ-40' => 'New Zealand: Kairanga',
'NZ-41' => 'New Zealand: Kiwitea',
'NZ-43' => 'New Zealand: Lake',
'NZ-45' => 'New Zealand: Mackenzie',
'NZ-46' => 'New Zealand: Malvern',
'NZ-E1' => 'New Zealand: Manaia',
'NZ-47' => 'New Zealand: Manawatu',
'NZ-48' => 'New Zealand: Mangonui',
'NZ-49' => 'New Zealand: Maniototo',
'NZ-50' => 'New Zealand: Marlborough',
'NZ-51' => 'New Zealand: Masterton',
'NZ-52' => 'New Zealand: Matamata',
'NZ-53' => 'New Zealand: Mount Herbert',
'NZ-54' => 'New Zealand: Ohinemuri',
'NZ-55' => 'New Zealand: Opotiki',
'NZ-56' => 'New Zealand: Oroua',
'NZ-57' => 'New Zealand: Otamatea',
'NZ-58' => 'New Zealand: Otorohanga',
'NZ-59' => 'New Zealand: Oxford',
'NZ-60' => 'New Zealand: Pahiatua',
'NZ-61' => 'New Zealand: Paparua',
'NZ-63' => 'New Zealand: Patea',
'NZ-65' => 'New Zealand: Piako',
'NZ-66' => 'New Zealand: Pohangina',
'NZ-67' => 'New Zealand: Raglan',
'NZ-68' => 'New Zealand: Rangiora',
'NZ-69' => 'New Zealand: Rangitikei',
'NZ-70' => 'New Zealand: Rodney',
'NZ-71' => 'New Zealand: Rotorua',
'NZ-E2' => 'New Zealand: Runanga',
'NZ-E3' => 'New Zealand: Saint Kilda',
'NZ-D5' => 'New Zealand: Silverpeaks',
'NZ-72' => 'New Zealand: Southland',
'NZ-73' => 'New Zealand: Stewart Island',
'NZ-74' => 'New Zealand: Stratford',
'NZ-D6' => 'New Zealand: Strathallan',
'NZ-76' => 'New Zealand: Taranaki',
'NZ-77' => 'New Zealand: Taumarunui',
'NZ-78' => 'New Zealand: Taupo',
'NZ-79' => 'New Zealand: Tauranga',
'NZ-E4' => 'New Zealand: Thames-Coromandel',
'NZ-81' => 'New Zealand: Tuapeka',
'NZ-82' => 'New Zealand: Vincent',
'NZ-83' => 'New Zealand: Waiapu',
'NZ-D8' => 'New Zealand: Waiheke',
'NZ-84' => 'New Zealand: Waihemo',
'NZ-85' => 'New Zealand: Waikato',
'NZ-86' => 'New Zealand: Waikohu',
'NZ-88' => 'New Zealand: Waimairi',
'NZ-89' => 'New Zealand: Waimarino',
'NZ-91' => 'New Zealand: Waimate West',
'NZ-90' => 'New Zealand: Waimate',
'NZ-92' => 'New Zealand: Waimea',
'NZ-93' => 'New Zealand: Waipa',
'NZ-95' => 'New Zealand: Waipawa',
'NZ-96' => 'New Zealand: Waipukurau',
'NZ-97' => 'New Zealand: Wairarapa South',
'NZ-98' => 'New Zealand: Wairewa',
'NZ-99' => 'New Zealand: Wairoa',
'NZ-A4' => 'New Zealand: Waitaki',
'NZ-A6' => 'New Zealand: Waitomo',
'NZ-A8' => 'New Zealand: Waitotara',
'NZ-E6' => 'New Zealand: Wallace',
'NZ-B2' => 'New Zealand: Wanganui',
'NZ-E5' => 'New Zealand: Waverley',
'NZ-B3' => 'New Zealand: Westland',
'NZ-B4' => 'New Zealand: Whakatane',
'NZ-A1' => 'New Zealand: Whangarei',
'NZ-A2' => 'New Zealand: Whangaroa',
'NZ-A3' => 'New Zealand: Woodmark',

'--NI' => '','-NI' => 'Nicaragua',
'NI-01' => 'Nicaragua: Boaco',
'NI-02' => 'Nicaragua: Carazo',
'NI-03' => 'Nicaragua: Chinandega',
'NI-04' => 'Nicaragua: Chontales',
'NI-05' => 'Nicaragua: Esteli',
'NI-06' => 'Nicaragua: Granada',
'NI-07' => 'Nicaragua: Jinotega',
'NI-08' => 'Nicaragua: Leon',
'NI-09' => 'Nicaragua: Madriz',
'NI-10' => 'Nicaragua: Managua',
'NI-11' => 'Nicaragua: Masaya',
'NI-12' => 'Nicaragua: Matagalpa',
'NI-13' => 'Nicaragua: Nueva Segovia',
'NI-14' => 'Nicaragua: Rio San Juan',
'NI-15' => 'Nicaragua: Rivas',
'NI-16' => 'Nicaragua: Zelaya',

'--NE' => '','-NE' => 'Niger',
'NE-01' => 'Niger: Agadez',
'NE-02' => 'Niger: Diffa',
'NE-03' => 'Niger: Dosso',
'NE-04' => 'Niger: Maradi',
'NE-05' => 'Niger: Niamey',
'NE-06' => 'Niger: Tahoua',
'NE-07' => 'Niger: Zinder',

'--NG' => '','-NG' => 'Nigeria',
'NG-45' => 'Nigeria: Abia',
'NG-11' => 'Nigeria: Abuja Capital Territory',
'NG-35' => 'Nigeria: Adamawa',
'NG-21' => 'Nigeria: Akwa Ibom',
'NG-25' => 'Nigeria: Anambra',
'NG-46' => 'Nigeria: Bauchi',
'NG-52' => 'Nigeria: Bayelsa',
'NG-26' => 'Nigeria: Benue',
'NG-27' => 'Nigeria: Borno',
'NG-22' => 'Nigeria: Cross River',
'NG-36' => 'Nigeria: Delta',
'NG-53' => 'Nigeria: Ebonyi',
'NG-37' => 'Nigeria: Edo',
'NG-54' => 'Nigeria: Ekiti',
'NG-47' => 'Nigeria: Enugu',
'NG-55' => 'Nigeria: Gombe',
'NG-28' => 'Nigeria: Imo',
'NG-39' => 'Nigeria: Jigawa',
'NG-23' => 'Nigeria: Kaduna',
'NG-29' => 'Nigeria: Kano',
'NG-24' => 'Nigeria: Katsina',
'NG-40' => 'Nigeria: Kebbi',
'NG-41' => 'Nigeria: Kogi',
'NG-30' => 'Nigeria: Kwara',
'NG-05' => 'Nigeria: Lagos',
'NG-56' => 'Nigeria: Nassarawa',
'NG-31' => 'Nigeria: Niger',
'NG-16' => 'Nigeria: Ogun',
'NG-48' => 'Nigeria: Ondo',
'NG-42' => 'Nigeria: Osun',
'NG-32' => 'Nigeria: Oyo',
'NG-49' => 'Nigeria: Plateau',
'NG-50' => 'Nigeria: Rivers',
'NG-51' => 'Nigeria: Sokoto',
'NG-43' => 'Nigeria: Taraba',
'NG-44' => 'Nigeria: Yobe',
'NG-57' => 'Nigeria: Zamfara',

'--KP' => '','-KP' => 'North Korea',
'KP-01' => 'North Korea: Chagang-do',
'KP-17' => 'North Korea: Hamgyong-bukto',
'KP-03' => 'North Korea: Hamgyong-namdo',
'KP-07' => 'North Korea: Hwanghae-bukto',
'KP-06' => 'North Korea: Hwanghae-namdo',
'KP-08' => 'North Korea: Kaesong-si',
'KP-09' => 'North Korea: Kangwon-do',
'KP-18' => 'North Korea: Najin Sonbong-si',
'KP-14' => 'North Korea: Namp\'o-si',
'KP-11' => 'North Korea: P\'yongan-bukto',
'KP-15' => 'North Korea: P\'yongan-namdo',
'KP-12' => 'North Korea: P\'yongyang-si',
'KP-13' => 'North Korea: Yanggang-do',

'--NO' => '','-NO' => 'Norway',
'NO-01' => 'Norway: Akershus',
'NO-02' => 'Norway: Aust-Agder',
'NO-04' => 'Norway: Buskerud',
'NO-05' => 'Norway: Finnmark',
'NO-06' => 'Norway: Hedmark',
'NO-07' => 'Norway: Hordaland',
'NO-08' => 'Norway: More og Romsdal',
'NO-09' => 'Norway: Nordland',
'NO-10' => 'Norway: Nord-Trondelag',
'NO-11' => 'Norway: Oppland',
'NO-12' => 'Norway: Oslo',
'NO-13' => 'Norway: Ostfold',
'NO-14' => 'Norway: Rogaland',
'NO-15' => 'Norway: Sogn og Fjordane',
'NO-16' => 'Norway: Sor-Trondelag',
'NO-17' => 'Norway: Telemark',
'NO-18' => 'Norway: Troms',
'NO-19' => 'Norway: Vest-Agder',
'NO-20' => 'Norway: Vestfold',

'--OM' => '','-OM' => 'Oman',
'OM-01' => 'Oman: Ad Dakhiliyah',
'OM-02' => 'Oman: Al Batinah',
'OM-03' => 'Oman: Al Wusta',
'OM-04' => 'Oman: Ash Sharqiyah',
'OM-05' => 'Oman: Az Zahirah',
'OM-06' => 'Oman: Masqat',
'OM-07' => 'Oman: Musandam',
'OM-08' => 'Oman: Zufar',

'--PK' => '','-PK' => 'Pakistan',
'PK-06' => 'Pakistan: Azad Kashmir',
'PK-02' => 'Pakistan: Balochistan',
'PK-01' => 'Pakistan: Federally Administered Tribal Areas',
'PK-08' => 'Pakistan: Islamabad',
'PK-07' => 'Pakistan: Northern Areas',
'PK-03' => 'Pakistan: North-West Frontier',
'PK-04' => 'Pakistan: Punjab',
'PK-05' => 'Pakistan: Sindh',

'--PA' => '','-PA' => 'Panama',
'PA-01' => 'Panama: Bocas del Toro',
'PA-02' => 'Panama: Chiriqui',
'PA-03' => 'Panama: Cocle',
'PA-04' => 'Panama: Colon',
'PA-05' => 'Panama: Darien',
'PA-06' => 'Panama: Herrera',
'PA-07' => 'Panama: Los Santos',
'PA-08' => 'Panama: Panama',
'PA-09' => 'Panama: San Blas',
'PA-10' => 'Panama: Veraguas',

'--PG' => '','-PG' => 'Papua New Guinea',
'PG-01' => 'Papua New Guinea: Central',
'PG-08' => 'Papua New Guinea: Chimbu',
'PG-10' => 'Papua New Guinea: East New Britain',
'PG-11' => 'Papua New Guinea: East Sepik',
'PG-09' => 'Papua New Guinea: Eastern Highlands',
'PG-19' => 'Papua New Guinea: Enga',
'PG-02' => 'Papua New Guinea: Gulf',
'PG-12' => 'Papua New Guinea: Madang',
'PG-13' => 'Papua New Guinea: Manus',
'PG-03' => 'Papua New Guinea: Milne Bay',
'PG-14' => 'Papua New Guinea: Morobe',
'PG-20' => 'Papua New Guinea: National Capital',
'PG-15' => 'Papua New Guinea: New Ireland',
'PG-07' => 'Papua New Guinea: North Solomons',
'PG-04' => 'Papua New Guinea: Northern',
'PG-18' => 'Papua New Guinea: Sandaun',
'PG-05' => 'Papua New Guinea: Southern Highlands',
'PG-17' => 'Papua New Guinea: West New Britain',
'PG-16' => 'Papua New Guinea: Western Highlands',
'PG-06' => 'Papua New Guinea: Western',

'--PY' => '','-PY' => 'Paraguay',
'PY-23' => 'Paraguay: Alto Paraguay',
'PY-01' => 'Paraguay: Alto Parana',
'PY-02' => 'Paraguay: Amambay',
'PY-03' => 'Paraguay: Boqueron',
'PY-04' => 'Paraguay: Caaguazu',
'PY-05' => 'Paraguay: Caazapa',
'PY-19' => 'Paraguay: Canindeyu',
'PY-06' => 'Paraguay: Central',
'PY-20' => 'Paraguay: Chaco',
'PY-07' => 'Paraguay: Concepcion',
'PY-08' => 'Paraguay: Cordillera',
'PY-10' => 'Paraguay: Guaira',
'PY-11' => 'Paraguay: Itapua',
'PY-12' => 'Paraguay: Misiones',
'PY-13' => 'Paraguay: Neembucu',
'PY-21' => 'Paraguay: Nueva Asuncion',
'PY-15' => 'Paraguay: Paraguari',
'PY-16' => 'Paraguay: Presidente Hayes',
'PY-17' => 'Paraguay: San Pedro',

'--PE' => '','-PE' => 'Peru',
'PE-01' => 'Peru: Amazonas',
'PE-02' => 'Peru: Ancash',
'PE-03' => 'Peru: Apurimac',
'PE-04' => 'Peru: Arequipa',
'PE-05' => 'Peru: Ayacucho',
'PE-06' => 'Peru: Cajamarca',
'PE-07' => 'Peru: Callao',
'PE-08' => 'Peru: Cusco',
'PE-09' => 'Peru: Huancavelica',
'PE-10' => 'Peru: Huanuco',
'PE-11' => 'Peru: Ica',
'PE-12' => 'Peru: Junin',
'PE-13' => 'Peru: La Libertad',
'PE-14' => 'Peru: Lambayeque',
'PE-15' => 'Peru: Lima',
'PE-16' => 'Peru: Loreto',
'PE-17' => 'Peru: Madre de Dios',
'PE-18' => 'Peru: Moquegua',
'PE-19' => 'Peru: Pasco',
'PE-20' => 'Peru: Piura',
'PE-21' => 'Peru: Puno',
'PE-22' => 'Peru: San Martin',
'PE-23' => 'Peru: Tacna',
'PE-24' => 'Peru: Tumbes',
'PE-25' => 'Peru: Ucayali',

'--PH' => '','-PH' => 'Philippines',
'PH-01' => 'Philippines: Abra',
'PH-02' => 'Philippines: Agusan del Norte',
'PH-03' => 'Philippines: Agusan del Sur',
'PH-04' => 'Philippines: Aklan',
'PH-05' => 'Philippines: Albay',
'PH-A1' => 'Philippines: Angeles',
'PH-06' => 'Philippines: Antique',
'PH-G8' => 'Philippines: Aurora',
'PH-A2' => 'Philippines: Bacolod',
'PH-A3' => 'Philippines: Bago',
'PH-A4' => 'Philippines: Baguio',
'PH-A5' => 'Philippines: Bais',
'PH-A6' => 'Philippines: Basilan City',
'PH-22' => 'Philippines: Basilan',
'PH-07' => 'Philippines: Bataan',
'PH-08' => 'Philippines: Batanes',
'PH-A7' => 'Philippines: Batangas City',
'PH-09' => 'Philippines: Batangas',
'PH-10' => 'Philippines: Benguet',
'PH-11' => 'Philippines: Bohol',
'PH-12' => 'Philippines: Bukidnon',
'PH-13' => 'Philippines: Bulacan',
'PH-A8' => 'Philippines: Butuan',
'PH-A9' => 'Philippines: Cabanatuan',
'PH-B1' => 'Philippines: Cadiz',
'PH-B2' => 'Philippines: Cagayan de Oro',
'PH-14' => 'Philippines: Cagayan',
'PH-B3' => 'Philippines: Calbayog',
'PH-B4' => 'Philippines: Caloocan',
'PH-15' => 'Philippines: Camarines Norte',
'PH-16' => 'Philippines: Camarines Sur',
'PH-17' => 'Philippines: Camiguin',
'PH-B5' => 'Philippines: Canlaon',
'PH-18' => 'Philippines: Capiz',
'PH-19' => 'Philippines: Catanduanes',
'PH-B6' => 'Philippines: Cavite City',
'PH-20' => 'Philippines: Cavite',
'PH-B7' => 'Philippines: Cebu City',
'PH-21' => 'Philippines: Cebu',
'PH-B8' => 'Philippines: Cotabato',
'PH-B9' => 'Philippines: Dagupan',
'PH-C1' => 'Philippines: Danao',
'PH-C2' => 'Philippines: Dapitan',
'PH-C3' => 'Philippines: Davao City',
'PH-25' => 'Philippines: Davao del Sur',
'PH-26' => 'Philippines: Davao Oriental',
'PH-24' => 'Philippines: Davao',
'PH-C4' => 'Philippines: Dipolog',
'PH-C5' => 'Philippines: Dumaguete',
'PH-23' => 'Philippines: Eastern Samar',
'PH-C6' => 'Philippines: General Santos',
'PH-C7' => 'Philippines: Gingoog',
'PH-27' => 'Philippines: Ifugao',
'PH-C8' => 'Philippines: Iligan',
'PH-28' => 'Philippines: Ilocos Norte',
'PH-29' => 'Philippines: Ilocos Sur',
'PH-C9' => 'Philippines: Iloilo City',
'PH-30' => 'Philippines: Iloilo',
'PH-D1' => 'Philippines: Iriga',
'PH-31' => 'Philippines: Isabela',
'PH-32' => 'Philippines: Kalinga-Apayao',
'PH-D2' => 'Philippines: La Carlota',
'PH-36' => 'Philippines: La Union',
'PH-33' => 'Philippines: Laguna',
'PH-34' => 'Philippines: Lanao del Norte',
'PH-35' => 'Philippines: Lanao del Sur',
'PH-D3' => 'Philippines: Laoag',
'PH-D4' => 'Philippines: Lapu-Lapu',
'PH-D5' => 'Philippines: Legaspi',
'PH-37' => 'Philippines: Leyte',
'PH-D6' => 'Philippines: Lipa',
'PH-D7' => 'Philippines: Lucena',
'PH-56' => 'Philippines: Maguindanao',
'PH-D8' => 'Philippines: Mandaue',
'PH-D9' => 'Philippines: Manila',
'PH-E1' => 'Philippines: Marawi',
'PH-38' => 'Philippines: Marinduque',
'PH-39' => 'Philippines: Masbate',
'PH-40' => 'Philippines: Mindoro Occidental',
'PH-41' => 'Philippines: Mindoro Oriental',
'PH-42' => 'Philippines: Misamis Occidental',
'PH-43' => 'Philippines: Misamis Oriental',
'PH-44' => 'Philippines: Mountain',
'PH-E2' => 'Philippines: Naga',
'PH-H3' => 'Philippines: Negros Occidental',
'PH-46' => 'Philippines: Negros Oriental',
'PH-57' => 'Philippines: North Cotabato',
'PH-67' => 'Philippines: Northern Samar',
'PH-47' => 'Philippines: Nueva Ecija',
'PH-48' => 'Philippines: Nueva Vizcaya',
'PH-E3' => 'Philippines: Olongapo',
'PH-E4' => 'Philippines: Ormoc',
'PH-E5' => 'Philippines: Oroquieta',
'PH-E6' => 'Philippines: Ozamis',
'PH-E7' => 'Philippines: Pagadian',
'PH-49' => 'Philippines: Palawan',
'PH-E8' => 'Philippines: Palayan',
'PH-50' => 'Philippines: Pampanga',
'PH-51' => 'Philippines: Pangasinan',
'PH-E9' => 'Philippines: Pasay',
'PH-F1' => 'Philippines: Puerto Princesa',
'PH-F2' => 'Philippines: Quezon City',
'PH-H2' => 'Philippines: Quezon',
'PH-68' => 'Philippines: Quirino',
'PH-53' => 'Philippines: Rizal',
'PH-54' => 'Philippines: Romblon',
'PH-F3' => 'Philippines: Roxas',
'PH-55' => 'Philippines: Samar',
'PH-F4' => 'Philippines: San Carlos',
'PH-F5' => 'Philippines: San Carlos',
'PH-F6' => 'Philippines: San Jose',
'PH-F7' => 'Philippines: San Pablo',
'PH-F8' => 'Philippines: Silay',
'PH-69' => 'Philippines: Siquijor',
'PH-58' => 'Philippines: Sorsogon',
'PH-70' => 'Philippines: South Cotabato',
'PH-59' => 'Philippines: Southern Leyte',
'PH-71' => 'Philippines: Sultan Kudarat',
'PH-60' => 'Philippines: Sulu',
'PH-61' => 'Philippines: Surigao del Norte',
'PH-62' => 'Philippines: Surigao del Sur',
'PH-F9' => 'Philippines: Surigao',
'PH-G1' => 'Philippines: Tacloban',
'PH-G2' => 'Philippines: Tagaytay',
'PH-G3' => 'Philippines: Tagbilaran',
'PH-G4' => 'Philippines: Tangub',
'PH-63' => 'Philippines: Tarlac',
'PH-72' => 'Philippines: Tawitawi',
'PH-G5' => 'Philippines: Toledo',
'PH-G6' => 'Philippines: Trece Martires',
'PH-64' => 'Philippines: Zambales',
'PH-65' => 'Philippines: Zamboanga del Norte',
'PH-66' => 'Philippines: Zamboanga del Sur',
'PH-G7' => 'Philippines: Zamboanga',

'--PL' => '','-PL' => 'Poland',
'PL-23' => 'Poland: Biala Podlaska',
'PL-24' => 'Poland: Bialystok',
'PL-25' => 'Poland: Bielsko',
'PL-26' => 'Poland: Bydgoszcz',
'PL-27' => 'Poland: Chelm',
'PL-28' => 'Poland: Ciechanow',
'PL-29' => 'Poland: Czestochowa',
'PL-72' => 'Poland: Dolnoslaskie',
'PL-30' => 'Poland: Elblag',
'PL-31' => 'Poland: Gdansk',
'PL-32' => 'Poland: Gorzow',
'PL-33' => 'Poland: Jelenia Gora',
'PL-34' => 'Poland: Kalisz',
'PL-35' => 'Poland: Katowice',
'PL-36' => 'Poland: Kielce',
'PL-37' => 'Poland: Konin',
'PL-38' => 'Poland: Koszalin',
'PL-39' => 'Poland: Krakow',
'PL-40' => 'Poland: Krosno',
'PL-73' => 'Poland: Kujawsko-Pomorskie',
'PL-41' => 'Poland: Legnica',
'PL-42' => 'Poland: Leszno',
'PL-43' => 'Poland: Lodz',
'PL-74' => 'Poland: Lodzkie',
'PL-44' => 'Poland: Lomza',
'PL-75' => 'Poland: Lubelskie',
'PL-45' => 'Poland: Lublin',
'PL-76' => 'Poland: Lubuskie',
'PL-77' => 'Poland: Malopolskie',
'PL-78' => 'Poland: Mazowieckie',
'PL-46' => 'Poland: Nowy Sacz',
'PL-47' => 'Poland: Olsztyn',
'PL-48' => 'Poland: Opole',
'PL-79' => 'Poland: Opolskie',
'PL-49' => 'Poland: Ostroleka',
'PL-50' => 'Poland: Pila',
'PL-51' => 'Poland: Piotrkow',
'PL-52' => 'Poland: Plock',
'PL-80' => 'Poland: Podkarpackie',
'PL-81' => 'Poland: Podlaskie',
'PL-82' => 'Poland: Pomorskie',
'PL-53' => 'Poland: Poznan',
'PL-54' => 'Poland: Przemysl',
'PL-55' => 'Poland: Radom',
'PL-56' => 'Poland: Rzeszow',
'PL-57' => 'Poland: Siedlce',
'PL-58' => 'Poland: Sieradz',
'PL-59' => 'Poland: Skierniewice',
'PL-83' => 'Poland: Slaskie',
'PL-60' => 'Poland: Slupsk',
'PL-61' => 'Poland: Suwalki',
'PL-84' => 'Poland: Swietokrzyskie',
'PL-62' => 'Poland: Szczecin',
'PL-63' => 'Poland: Tarnobrzeg',
'PL-64' => 'Poland: Tarnow',
'PL-65' => 'Poland: Torun',
'PL-66' => 'Poland: Walbrzych',
'PL-85' => 'Poland: Warminsko-Mazurskie',
'PL-67' => 'Poland: Warszawa',
'PL-86' => 'Poland: Wielkopolskie',
'PL-68' => 'Poland: Wloclawek',
'PL-69' => 'Poland: Wroclaw',
'PL-87' => 'Poland: Zachodniopomorskie',
'PL-70' => 'Poland: Zamosc',
'PL-71' => 'Poland: Zielona Gora',

'--PT' => '','-PT' => 'Portugal',
'PT-02' => 'Portugal: Aveiro',
'PT-23' => 'Portugal: Azores',
'PT-03' => 'Portugal: Beja',
'PT-04' => 'Portugal: Braga',
'PT-05' => 'Portugal: Braganca',
'PT-06' => 'Portugal: Castelo Branco',
'PT-07' => 'Portugal: Coimbra',
'PT-08' => 'Portugal: Evora',
'PT-09' => 'Portugal: Faro',
'PT-11' => 'Portugal: Guarda',
'PT-13' => 'Portugal: Leiria',
'PT-14' => 'Portugal: Lisboa',
'PT-10' => 'Portugal: Madeira',
'PT-16' => 'Portugal: Portalegre',
'PT-17' => 'Portugal: Porto',
'PT-18' => 'Portugal: Santarem',
'PT-19' => 'Portugal: Setubal',
'PT-20' => 'Portugal: Viana do Castelo',
'PT-21' => 'Portugal: Vila Real',
'PT-22' => 'Portugal: Viseu',

'--QA' => '','-QA' => 'Qatar',
'QA-01' => 'Qatar: Ad Dawhah',
'QA-02' => 'Qatar: Al Ghuwariyah',
'QA-03' => 'Qatar: Al Jumaliyah',
'QA-04' => 'Qatar: Al Khawr',
'QA-10' => 'Qatar: Al Wakrah',
'QA-06' => 'Qatar: Ar Rayyan',
'QA-11' => 'Qatar: Jariyan al Batnah',
'QA-08' => 'Qatar: Madinat ach Shamal',
'QA-12' => 'Qatar: Umm Sa\'id',
'QA-09' => 'Qatar: Umm Salal',

'--RO' => '','-RO' => 'Romania',
'RO-01' => 'Romania: Alba',
'RO-02' => 'Romania: Arad',
'RO-03' => 'Romania: Arges',
'RO-04' => 'Romania: Bacau',
'RO-05' => 'Romania: Bihor',
'RO-06' => 'Romania: Bistrita-Nasaud',
'RO-07' => 'Romania: Botosani',
'RO-08' => 'Romania: Braila',
'RO-09' => 'Romania: Brasov',
'RO-10' => 'Romania: Bucuresti',
'RO-11' => 'Romania: Buzau',
'RO-41' => 'Romania: Calarasi',
'RO-12' => 'Romania: Caras-Severin',
'RO-13' => 'Romania: Cluj',
'RO-14' => 'Romania: Constanta',
'RO-15' => 'Romania: Covasna',
'RO-16' => 'Romania: Dambovita',
'RO-17' => 'Romania: Dolj',
'RO-18' => 'Romania: Galati',
'RO-42' => 'Romania: Giurgiu',
'RO-19' => 'Romania: Gorj',
'RO-20' => 'Romania: Harghita',
'RO-21' => 'Romania: Hunedoara',
'RO-22' => 'Romania: Ialomita',
'RO-23' => 'Romania: Iasi',
'RO-43' => 'Romania: Ilfov',
'RO-25' => 'Romania: Maramures',
'RO-26' => 'Romania: Mehedinti',
'RO-27' => 'Romania: Mures',
'RO-28' => 'Romania: Neamt',
'RO-29' => 'Romania: Olt',
'RO-30' => 'Romania: Prahova',
'RO-31' => 'Romania: Salaj',
'RO-32' => 'Romania: Satu Mare',
'RO-33' => 'Romania: Sibiu',
'RO-34' => 'Romania: Suceava',
'RO-35' => 'Romania: Teleorman',
'RO-36' => 'Romania: Timis',
'RO-37' => 'Romania: Tulcea',
'RO-39' => 'Romania: Valcea',
'RO-38' => 'Romania: Vaslui',
'RO-40' => 'Romania: Vrancea',

'--RU' => '','-RU' => 'Russian Federation',
'RU-01' => 'Russian Federation: Adygeya',
'RU-02' => 'Russian Federation: Aginsky Buryatsky AO',
'RU-04' => 'Russian Federation: Altaisky krai',
'RU-05' => 'Russian Federation: Amur',
'RU-06' => 'Russian Federation: Arkhangel\'sk',
'RU-07' => 'Russian Federation: Astrakhan\'',
'RU-08' => 'Russian Federation: Bashkortostan',
'RU-09' => 'Russian Federation: Belgorod',
'RU-10' => 'Russian Federation: Bryansk',
'RU-11' => 'Russian Federation: Buryat',
'RU-12' => 'Russian Federation: Chechnya',
'RU-13' => 'Russian Federation: Chelyabinsk',
'RU-14' => 'Russian Federation: Chita',
'RU-15' => 'Russian Federation: Chukot',
'RU-16' => 'Russian Federation: Chuvashia',
'RU-17' => 'Russian Federation: Dagestan',
'RU-18' => 'Russian Federation: Evenk',
'RU-03' => 'Russian Federation: Gorno-Altay',
'RU-19' => 'Russian Federation: Ingush',
'RU-20' => 'Russian Federation: Irkutsk',
'RU-21' => 'Russian Federation: Ivanovo',
'RU-22' => 'Russian Federation: Kabardin-Balkar',
'RU-23' => 'Russian Federation: Kaliningrad',
'RU-24' => 'Russian Federation: Kalmyk',
'RU-25' => 'Russian Federation: Kaluga',
'RU-26' => 'Russian Federation: Kamchatka',
'RU-27' => 'Russian Federation: Karachay-Cherkess',
'RU-28' => 'Russian Federation: Karelia',
'RU-29' => 'Russian Federation: Kemerovo',
'RU-30' => 'Russian Federation: Khabarovsk',
'RU-31' => 'Russian Federation: Khakass',
'RU-32' => 'Russian Federation: Khanty-Mansiy',
'RU-33' => 'Russian Federation: Kirov',
'RU-34' => 'Russian Federation: Komi',
'RU-35' => 'Russian Federation: Komi-Permyak',
'RU-36' => 'Russian Federation: Koryak',
'RU-37' => 'Russian Federation: Kostroma',
'RU-38' => 'Russian Federation: Krasnodar',
'RU-39' => 'Russian Federation: Krasnoyarsk',
'RU-40' => 'Russian Federation: Kurgan',
'RU-41' => 'Russian Federation: Kursk',
'RU-42' => 'Russian Federation: Leningrad',
'RU-43' => 'Russian Federation: Lipetsk',
'RU-44' => 'Russian Federation: Magadan',
'RU-45' => 'Russian Federation: Mariy-El',
'RU-46' => 'Russian Federation: Mordovia',
'RU-48' => 'Russian Federation: Moscow City',
'RU-47' => 'Russian Federation: Moskva',
'RU-49' => 'Russian Federation: Murmansk',
'RU-50' => 'Russian Federation: Nenets',
'RU-51' => 'Russian Federation: Nizhegorod',
'RU-68' => 'Russian Federation: North Ossetia',
'RU-52' => 'Russian Federation: Novgorod',
'RU-53' => 'Russian Federation: Novosibirsk',
'RU-54' => 'Russian Federation: Omsk',
'RU-56' => 'Russian Federation: Orel',
'RU-55' => 'Russian Federation: Orenburg',
'RU-57' => 'Russian Federation: Penza',
'RU-58' => 'Russian Federation: Perm\'',
'RU-59' => 'Russian Federation: Primor\'ye',
'RU-60' => 'Russian Federation: Pskov',
'RU-61' => 'Russian Federation: Rostov',
'RU-62' => 'Russian Federation: Ryazan\'',
'RU-66' => 'Russian Federation: Saint Petersburg City',
'RU-63' => 'Russian Federation: Sakha',
'RU-64' => 'Russian Federation: Sakhalin',
'RU-65' => 'Russian Federation: Samara',
'RU-67' => 'Russian Federation: Saratov',
'RU-69' => 'Russian Federation: Smolensk',
'RU-70' => 'Russian Federation: Stavropol\'',
'RU-71' => 'Russian Federation: Sverdlovsk',
'RU-72' => 'Russian Federation: Tambovskaya oblast',
'RU-73' => 'Russian Federation: Tatarstan',
'RU-74' => 'Russian Federation: Taymyr',
'RU-75' => 'Russian Federation: Tomsk',
'RU-76' => 'Russian Federation: Tula',
'RU-79' => 'Russian Federation: Tuva',
'RU-77' => 'Russian Federation: Tver\'',
'RU-78' => 'Russian Federation: Tyumen\'',
'RU-80' => 'Russian Federation: Udmurt',
'RU-81' => 'Russian Federation: Ul\'yanovsk',
'RU-82' => 'Russian Federation: Ust-Orda Buryat',
'RU-83' => 'Russian Federation: Vladimir',
'RU-84' => 'Russian Federation: Volgograd',
'RU-85' => 'Russian Federation: Vologda',
'RU-86' => 'Russian Federation: Voronezh',
'RU-87' => 'Russian Federation: Yamal-Nenets',
'RU-88' => 'Russian Federation: Yaroslavl\'',
'RU-89' => 'Russian Federation: Yevrey',

'--RW' => '','-RW' => 'Rwanda',
'RW-01' => 'Rwanda: Butare',
'RW-02' => 'Rwanda: Byumba',
'RW-03' => 'Rwanda: Cyangugu',
'RW-04' => 'Rwanda: Gikongoro',
'RW-05' => 'Rwanda: Gisenyi',
'RW-06' => 'Rwanda: Gitarama',
'RW-07' => 'Rwanda: Kibungo',
'RW-08' => 'Rwanda: Kibuye',
'RW-09' => 'Rwanda: Kigali',
'RW-10' => 'Rwanda: Ruhengeri',

'--SH' => '','-SH' => 'Saint Helena',
'SH-01' => 'Saint Helena: Ascension',
'SH-02' => 'Saint Helena: Saint Helena',
'SH-03' => 'Saint Helena: Tristan da Cunha',

'--KN' => '','-KN' => 'Saint Kitts and Nevis',
'KN-01' => 'Saint Kitts and Nevis: Christ Church Nichola Town',
'KN-02' => 'Saint Kitts and Nevis: Saint Anne Sandy Point',
'KN-03' => 'Saint Kitts and Nevis: Saint George Basseterre',
'KN-04' => 'Saint Kitts and Nevis: Saint George Gingerland',
'KN-05' => 'Saint Kitts and Nevis: Saint James Windward',
'KN-06' => 'Saint Kitts and Nevis: Saint John Capisterre',
'KN-07' => 'Saint Kitts and Nevis: Saint John Figtree',
'KN-08' => 'Saint Kitts and Nevis: Saint Mary Cayon',
'KN-09' => 'Saint Kitts and Nevis: Saint Paul Capisterre',
'KN-10' => 'Saint Kitts and Nevis: Saint Paul Charlestown',
'KN-11' => 'Saint Kitts and Nevis: Saint Peter Basseterre',
'KN-12' => 'Saint Kitts and Nevis: Saint Thomas Lowland',
'KN-13' => 'Saint Kitts and Nevis: Saint Thomas Middle Island',
'KN-15' => 'Saint Kitts and Nevis: Trinity Palmetto Point',

'--LC' => '','-LC' => 'Saint Lucia',
'LC-01' => 'Saint Lucia: Anse-la-Raye',
'LC-03' => 'Saint Lucia: Castries',
'LC-04' => 'Saint Lucia: Choiseul',
'LC-02' => 'Saint Lucia: Dauphin',
'LC-05' => 'Saint Lucia: Dennery',
'LC-06' => 'Saint Lucia: Gros-Islet',
'LC-07' => 'Saint Lucia: Laborie',
'LC-08' => 'Saint Lucia: Micoud',
'LC-11' => 'Saint Lucia: Praslin',
'LC-09' => 'Saint Lucia: Soufriere',
'LC-10' => 'Saint Lucia: Vieux-Fort',

'--VC' => '','-VC' => 'Saint Vincent and the Grenadines',
'VC-01' => 'Saint Vincent and the Grenadines: Charlotte',
'VC-06' => 'Saint Vincent and the Grenadines: Grenadines',
'VC-02' => 'Saint Vincent and the Grenadines: Saint Andrew',
'VC-03' => 'Saint Vincent and the Grenadines: Saint David',
'VC-04' => 'Saint Vincent and the Grenadines: Saint George',
'VC-05' => 'Saint Vincent and the Grenadines: Saint Patrick',

'--WS' => '','-WS' => 'Samoa',
'WS-02' => 'Samoa: Aiga-i-le-Tai',
'WS-03' => 'Samoa: Atua',
'WS-04' => 'Samoa: Fa',
'WS-05' => 'Samoa: Gaga',
'WS-07' => 'Samoa: Gagaifomauga',
'WS-08' => 'Samoa: Palauli',
'WS-09' => 'Samoa: Satupa',
'WS-10' => 'Samoa: Tuamasaga',
'WS-06' => 'Samoa: Va',
'WS-11' => 'Samoa: Vaisigano',

'--SM' => '','-SM' => 'San Marino',
'SM-01' => 'San Marino: Acquaviva',
'SM-06' => 'San Marino: Borgo Maggiore',
'SM-02' => 'San Marino: Chiesanuova',
'SM-03' => 'San Marino: Domagnano',
'SM-04' => 'San Marino: Faetano',
'SM-05' => 'San Marino: Fiorentino',
'SM-08' => 'San Marino: Monte Giardino',
'SM-07' => 'San Marino: San Marino',
'SM-09' => 'San Marino: Serravalle',

'--ST' => '','-ST' => 'Sao Tome and Principe',
'ST-01' => 'Sao Tome and Principe: Principe',
'ST-02' => 'Sao Tome and Principe: Sao Tome',

'--SA' => '','-SA' => 'Saudi Arabia',
'SA-02' => 'Saudi Arabia: Al Bahah',
'SA-15' => 'Saudi Arabia: Al Hudud ash Shamaliyah',
'SA-03' => 'Saudi Arabia: Al Jawf',
'SA-20' => 'Saudi Arabia: Al Jawf',
'SA-05' => 'Saudi Arabia: Al Madinah',
'SA-08' => 'Saudi Arabia: Al Qasim',
'SA-09' => 'Saudi Arabia: Al Qurayyat',
'SA-10' => 'Saudi Arabia: Ar Riyad',
'SA-06' => 'Saudi Arabia: Ash Sharqiyah',
'SA-13' => 'Saudi Arabia: Ha\'il',
'SA-17' => 'Saudi Arabia: Jizan',
'SA-14' => 'Saudi Arabia: Makkah',
'SA-16' => 'Saudi Arabia: Najran',
'SA-19' => 'Saudi Arabia: Tabuk',

'--SN' => '','-SN' => 'Senegal',
'SN-01' => 'Senegal: Dakar',
'SN-03' => 'Senegal: Diourbel',
'SN-09' => 'Senegal: Fatick',
'SN-10' => 'Senegal: Kaolack',
'SN-11' => 'Senegal: Kolda',
'SN-08' => 'Senegal: Louga',
'SN-04' => 'Senegal: Saint-Louis',
'SN-05' => 'Senegal: Tambacounda',
'SN-07' => 'Senegal: Thies',
'SN-12' => 'Senegal: Ziguinchor',

'--RS' => '','-RS' => 'Serbia',
'RS-01' => 'Serbia: Kosovo',
'RS-02' => 'Serbia: Vojvodina',

'--SC' => '','-SC' => 'Seychelles',
'SC-01' => 'Seychelles: Anse aux Pins',
'SC-02' => 'Seychelles: Anse Boileau',
'SC-03' => 'Seychelles: Anse Etoile',
'SC-04' => 'Seychelles: Anse Louis',
'SC-05' => 'Seychelles: Anse Royale',
'SC-06' => 'Seychelles: Baie Lazare',
'SC-07' => 'Seychelles: Baie Sainte Anne',
'SC-08' => 'Seychelles: Beau Vallon',
'SC-09' => 'Seychelles: Bel Air',
'SC-10' => 'Seychelles: Bel Ombre',
'SC-11' => 'Seychelles: Cascade',
'SC-12' => 'Seychelles: Glacis',
'SC-13' => 'Seychelles: Grand\' Anse',
'SC-14' => 'Seychelles: Grand\' Anse',
'SC-15' => 'Seychelles: La Digue',
'SC-16' => 'Seychelles: La Riviere Anglaise',
'SC-17' => 'Seychelles: Mont Buxton',
'SC-18' => 'Seychelles: Mont Fleuri',
'SC-19' => 'Seychelles: Plaisance',
'SC-20' => 'Seychelles: Pointe La Rue',
'SC-21' => 'Seychelles: Port Glaud',
'SC-22' => 'Seychelles: Saint Louis',
'SC-23' => 'Seychelles: Takamaka',

'--SL' => '','-SL' => 'Sierra Leone',
'SL-01' => 'Sierra Leone: Eastern',
'SL-02' => 'Sierra Leone: Northern',
'SL-03' => 'Sierra Leone: Southern',
'SL-04' => 'Sierra Leone: Western Area',

'--SK' => '','-SK' => 'Slovakia',
'SK-01' => 'Slovakia: Banska Bystrica',
'SK-02' => 'Slovakia: Bratislava',
'SK-03' => 'Slovakia: Kosice',
'SK-04' => 'Slovakia: Nitra',
'SK-05' => 'Slovakia: Presov',
'SK-06' => 'Slovakia: Trencin',
'SK-07' => 'Slovakia: Trnava',
'SK-08' => 'Slovakia: Zilina',

'--SI' => '','-SI' => 'Slovenia',
'SI-01' => 'Slovenia: Ajdovscina',
'SI-02' => 'Slovenia: Beltinci',
'SI-03' => 'Slovenia: Bled',
'SI-04' => 'Slovenia: Bohinj',
'SI-05' => 'Slovenia: Borovnica',
'SI-06' => 'Slovenia: Bovec',
'SI-07' => 'Slovenia: Brda',
'SI-08' => 'Slovenia: Brezice',
'SI-09' => 'Slovenia: Brezovica',
'SI-11' => 'Slovenia: Celje',
'SI-12' => 'Slovenia: Cerklje na Gorenjskem',
'SI-13' => 'Slovenia: Cerknica',
'SI-14' => 'Slovenia: Cerkno',
'SI-15' => 'Slovenia: Crensovci',
'SI-16' => 'Slovenia: Crna na Koroskem',
'SI-17' => 'Slovenia: Crnomelj',
'SI-19' => 'Slovenia: Divaca',
'SI-20' => 'Slovenia: Dobrepolje',
'SI-G4' => 'Slovenia: Dobrova-Horjul-Polhov Gradec',
'SI-22' => 'Slovenia: Dol pri Ljubljani',
'SI-G7' => 'Slovenia: Domzale',
'SI-24' => 'Slovenia: Dornava',
'SI-25' => 'Slovenia: Dravograd',
'SI-26' => 'Slovenia: Duplek',
'SI-27' => 'Slovenia: Gorenja Vas-Poljane',
'SI-28' => 'Slovenia: Gorisnica',
'SI-29' => 'Slovenia: Gornja Radgona',
'SI-30' => 'Slovenia: Gornji Grad',
'SI-31' => 'Slovenia: Gornji Petrovci',
'SI-32' => 'Slovenia: Grosuplje',
'SI-34' => 'Slovenia: Hrastnik',
'SI-35' => 'Slovenia: Hrpelje-Kozina',
'SI-36' => 'Slovenia: Idrija',
'SI-37' => 'Slovenia: Ig',
'SI-38' => 'Slovenia: Ilirska Bistrica',
'SI-39' => 'Slovenia: Ivancna Gorica',
'SI-40' => 'Slovenia: Izola-Isola',
'SI-H4' => 'Slovenia: Jesenice',
'SI-42' => 'Slovenia: Jursinci',
'SI-H6' => 'Slovenia: Kamnik',
'SI-44' => 'Slovenia: Kanal',
'SI-45' => 'Slovenia: Kidricevo',
'SI-46' => 'Slovenia: Kobarid',
'SI-47' => 'Slovenia: Kobilje',
'SI-H7' => 'Slovenia: Kocevje',
'SI-49' => 'Slovenia: Komen',
'SI-50' => 'Slovenia: Koper-Capodistria',
'SI-51' => 'Slovenia: Kozje',
'SI-52' => 'Slovenia: Kranj',
'SI-53' => 'Slovenia: Kranjska Gora',
'SI-54' => 'Slovenia: Krsko',
'SI-55' => 'Slovenia: Kungota',
'SI-I2' => 'Slovenia: Kuzma',
'SI-57' => 'Slovenia: Lasko',
'SI-I3' => 'Slovenia: Lenart',
'SI-I5' => 'Slovenia: Litija',
'SI-61' => 'Slovenia: Ljubljana',
'SI-62' => 'Slovenia: Ljubno',
'SI-I6' => 'Slovenia: Ljutomer',
'SI-64' => 'Slovenia: Logatec',
'SI-I7' => 'Slovenia: Loska Dolina',
'SI-66' => 'Slovenia: Loski Potok',
'SI-I9' => 'Slovenia: Luce',
'SI-68' => 'Slovenia: Lukovica',
'SI-J1' => 'Slovenia: Majsperk',
'SI-J2' => 'Slovenia: Maribor',
'SI-71' => 'Slovenia: Medvode',
'SI-72' => 'Slovenia: Menges',
'SI-73' => 'Slovenia: Metlika',
'SI-74' => 'Slovenia: Mezica',
'SI-J5' => 'Slovenia: Miren-Kostanjevica',
'SI-76' => 'Slovenia: Mislinja',
'SI-77' => 'Slovenia: Moravce',
'SI-78' => 'Slovenia: Moravske Toplice',
'SI-79' => 'Slovenia: Mozirje',
'SI-80' => 'Slovenia: Murska Sobota',
'SI-81' => 'Slovenia: Muta',
'SI-82' => 'Slovenia: Naklo',
'SI-83' => 'Slovenia: Nazarje',
'SI-84' => 'Slovenia: Nova Gorica',
'SI-J7' => 'Slovenia: Novo Mesto',
'SI-86' => 'Slovenia: Odranci',
'SI-87' => 'Slovenia: Ormoz',
'SI-88' => 'Slovenia: Osilnica',
'SI-89' => 'Slovenia: Pesnica',
'SI-J9' => 'Slovenia: Piran',
'SI-91' => 'Slovenia: Pivka',
'SI-92' => 'Slovenia: Podcetrtek',
'SI-94' => 'Slovenia: Postojna',
'SI-K5' => 'Slovenia: Preddvor',
'SI-K7' => 'Slovenia: Ptuj',
'SI-97' => 'Slovenia: Puconci',
'SI-98' => 'Slovenia: Racam',
'SI-99' => 'Slovenia: Radece',
'SI-A1' => 'Slovenia: Radenci',
'SI-A2' => 'Slovenia: Radlje ob Dravi',
'SI-A3' => 'Slovenia: Radovljica',
'SI-L1' => 'Slovenia: Ribnica',
'SI-A7' => 'Slovenia: Rogaska Slatina',
'SI-A6' => 'Slovenia: Rogasovci',
'SI-A8' => 'Slovenia: Rogatec',
'SI-L3' => 'Slovenia: Ruse',
'SI-B1' => 'Slovenia: Semic',
'SI-B2' => 'Slovenia: Sencur',
'SI-B3' => 'Slovenia: Sentilj',
'SI-B4' => 'Slovenia: Sentjernej',
'SI-L7' => 'Slovenia: Sentjur pri Celju',
'SI-B6' => 'Slovenia: Sevnica',
'SI-B7' => 'Slovenia: Sezana',
'SI-B8' => 'Slovenia: Skocjan',
'SI-B9' => 'Slovenia: Skofja Loka',
'SI-C1' => 'Slovenia: Skofljica',
'SI-C2' => 'Slovenia: Slovenj Gradec',
'SI-L8' => 'Slovenia: Slovenska Bistrica',
'SI-C4' => 'Slovenia: Slovenske Konjice',
'SI-C5' => 'Slovenia: Smarje pri Jelsah',
'SI-C6' => 'Slovenia: Smartno ob Paki',
'SI-C7' => 'Slovenia: Sostanj',
'SI-C8' => 'Slovenia: Starse',
'SI-C9' => 'Slovenia: Store',
'SI-D1' => 'Slovenia: Sveti Jurij',
'SI-D2' => 'Slovenia: Tolmin',
'SI-D3' => 'Slovenia: Trbovlje',
'SI-D4' => 'Slovenia: Trebnje',
'SI-D5' => 'Slovenia: Trzic',
'SI-D6' => 'Slovenia: Turnisce',
'SI-D7' => 'Slovenia: Velenje',
'SI-D8' => 'Slovenia: Velike Lasce',
'SI-N2' => 'Slovenia: Videm',
'SI-E1' => 'Slovenia: Vipava',
'SI-E2' => 'Slovenia: Vitanje',
'SI-E3' => 'Slovenia: Vodice',
'SI-N3' => 'Slovenia: Vojnik',
'SI-E5' => 'Slovenia: Vrhnika',
'SI-E6' => 'Slovenia: Vuzenica',
'SI-E7' => 'Slovenia: Zagorje ob Savi',
'SI-N5' => 'Slovenia: Zalec',
'SI-E9' => 'Slovenia: Zavrc',
'SI-F1' => 'Slovenia: Zelezniki',
'SI-F2' => 'Slovenia: Ziri',
'SI-F3' => 'Slovenia: Zrece',

'--SB' => '','-SB' => 'Solomon Islands',
'SB-05' => 'Solomon Islands: Central',
'SB-06' => 'Solomon Islands: Guadalcanal',
'SB-07' => 'Solomon Islands: Isabel',
'SB-08' => 'Solomon Islands: Makira',
'SB-03' => 'Solomon Islands: Malaita',
'SB-09' => 'Solomon Islands: Temotu',
'SB-04' => 'Solomon Islands: Western',

'--SO' => '','-SO' => 'Somalia',
'SO-01' => 'Somalia: Bakool',
'SO-02' => 'Somalia: Banaadir',
'SO-03' => 'Somalia: Bari',
'SO-04' => 'Somalia: Bay',
'SO-05' => 'Somalia: Galguduud',
'SO-06' => 'Somalia: Gedo',
'SO-07' => 'Somalia: Hiiraan',
'SO-08' => 'Somalia: Jubbada Dhexe',
'SO-09' => 'Somalia: Jubbada Hoose',
'SO-10' => 'Somalia: Mudug',
'SO-11' => 'Somalia: Nugaal',
'SO-12' => 'Somalia: Sanaag',
'SO-13' => 'Somalia: Shabeellaha Dhexe',
'SO-14' => 'Somalia: Shabeellaha Hoose',
'SO-15' => 'Somalia: Togdheer',
'SO-16' => 'Somalia: Woqooyi Galbeed',

'--ZA' => '','-ZA' => 'South Africa',
'ZA-05' => 'South Africa: Eastern Cape',
'ZA-03' => 'South Africa: Free State',
'ZA-06' => 'South Africa: Gauteng',
'ZA-02' => 'South Africa: KwaZulu-Natal',
'ZA-09' => 'South Africa: Limpopo',
'ZA-07' => 'South Africa: Mpumalanga',
'ZA-08' => 'South Africa: Northern Cape',
'ZA-10' => 'South Africa: North-West',
'ZA-11' => 'South Africa: Western Cape',

'--KR' => '','-KR' => 'South Korea',
'KR-01' => 'South Korea: Cheju-do',
'KR-03' => 'South Korea: Cholla-bukto',
'KR-16' => 'South Korea: Cholla-namdo',
'KR-05' => 'South Korea: Ch\'ungch\'ong-bukto',
'KR-17' => 'South Korea: Ch\'ungch\'ong-namdo',
'KR-12' => 'South Korea: Inch\'on-jikhalsi',
'KR-06' => 'South Korea: Kangwon-do',
'KR-18' => 'South Korea: Kwangju-jikhalsi',
'KR-13' => 'South Korea: Kyonggi-do',
'KR-14' => 'South Korea: Kyongsang-bukto',
'KR-20' => 'South Korea: Kyongsang-namdo',
'KR-10' => 'South Korea: Pusan-jikhalsi',
'KR-11' => 'South Korea: Seoul-t\'ukpyolsi',
'KR-15' => 'South Korea: Taegu-jikhalsi',
'KR-19' => 'South Korea: Taejon-jikhalsi',
'KR-21' => 'South Korea: Ulsan-gwangyoksi',

'--ES' => '','-ES' => 'Spain',
'ES-51' => 'Spain: Andalucia',
'ES-52' => 'Spain: Aragon',
'ES-34' => 'Spain: Asturias',
'ES-53' => 'Spain: Canarias',
'ES-39' => 'Spain: Cantabria',
'ES-55' => 'Spain: Castilla y Leon',
'ES-54' => 'Spain: Castilla-La Mancha',
'ES-56' => 'Spain: Catalonia',
'ES-60' => 'Spain: Comunidad Valenciana',
'ES-57' => 'Spain: Extremadura',
'ES-58' => 'Spain: Galicia',
'ES-07' => 'Spain: Islas Baleares',
'ES-27' => 'Spain: La Rioja',
'ES-29' => 'Spain: Madrid',
'ES-31' => 'Spain: Murcia',
'ES-32' => 'Spain: Navarra',
'ES-59' => 'Spain: Pais Vasco',

'--LK' => '','-LK' => 'Sri Lanka',
'LK-01' => 'Sri Lanka: Amparai',
'LK-02' => 'Sri Lanka: Anuradhapura',
'LK-03' => 'Sri Lanka: Badulla',
'LK-04' => 'Sri Lanka: Batticaloa',
'LK-23' => 'Sri Lanka: Colombo',
'LK-06' => 'Sri Lanka: Galle',
'LK-24' => 'Sri Lanka: Gampaha',
'LK-07' => 'Sri Lanka: Hambantota',
'LK-25' => 'Sri Lanka: Jaffna',
'LK-09' => 'Sri Lanka: Kalutara',
'LK-10' => 'Sri Lanka: Kandy',
'LK-11' => 'Sri Lanka: Kegalla',
'LK-12' => 'Sri Lanka: Kurunegala',
'LK-26' => 'Sri Lanka: Mannar',
'LK-14' => 'Sri Lanka: Matale',
'LK-15' => 'Sri Lanka: Matara',
'LK-16' => 'Sri Lanka: Moneragala',
'LK-27' => 'Sri Lanka: Mullaittivu',
'LK-17' => 'Sri Lanka: Nuwara Eliya',
'LK-18' => 'Sri Lanka: Polonnaruwa',
'LK-19' => 'Sri Lanka: Puttalam',
'LK-20' => 'Sri Lanka: Ratnapura',
'LK-21' => 'Sri Lanka: Trincomalee',
'LK-28' => 'Sri Lanka: Vavuniya',

'--SD' => '','-SD' => 'Sudan',
'SD-28' => 'Sudan: Al Istiwa\'iyah',
'SD-29' => 'Sudan: Al Khartum',
'SD-27' => 'Sudan: Al Wusta',
'SD-30' => 'Sudan: Ash Shamaliyah',
'SD-31' => 'Sudan: Ash Sharqiyah',
'SD-32' => 'Sudan: Bahr al Ghazal',
'SD-33' => 'Sudan: Darfur',
'SD-34' => 'Sudan: Kurdufan',

'--SR' => '','-SR' => 'Suriname',
'SR-10' => 'Suriname: Brokopondo',
'SR-11' => 'Suriname: Commewijne',
'SR-12' => 'Suriname: Coronie',
'SR-13' => 'Suriname: Marowijne',
'SR-14' => 'Suriname: Nickerie',
'SR-15' => 'Suriname: Para',
'SR-16' => 'Suriname: Paramaribo',
'SR-17' => 'Suriname: Saramacca',
'SR-18' => 'Suriname: Sipaliwini',
'SR-19' => 'Suriname: Wanica',

'--SZ' => '','-SZ' => 'Swaziland',
'SZ-01' => 'Swaziland: Hhohho',
'SZ-02' => 'Swaziland: Lubombo',
'SZ-03' => 'Swaziland: Manzini',
'SZ-05' => 'Swaziland: Praslin',
'SZ-04' => 'Swaziland: Shiselweni',

'--SE' => '','-SE' => 'Sweden',
'SE-01' => 'Sweden: Alvsborgs Lan',
'SE-02' => 'Sweden: Blekinge Lan',
'SE-10' => 'Sweden: Dalarnas Lan',
'SE-03' => 'Sweden: Gavleborgs Lan',
'SE-04' => 'Sweden: Goteborgs och Bohus Lan',
'SE-05' => 'Sweden: Gotlands Lan',
'SE-06' => 'Sweden: Hallands Lan',
'SE-07' => 'Sweden: Jamtlands Lan',
'SE-08' => 'Sweden: Jonkopings Lan',
'SE-09' => 'Sweden: Kalmar Lan',
'SE-11' => 'Sweden: Kristianstads Lan',
'SE-12' => 'Sweden: Kronobergs Lan',
'SE-13' => 'Sweden: Malmohus Lan',
'SE-14' => 'Sweden: Norrbottens Lan',
'SE-15' => 'Sweden: Orebro Lan',
'SE-16' => 'Sweden: Ostergotlands Lan',
'SE-27' => 'Sweden: Skane Lan',
'SE-17' => 'Sweden: Skaraborgs Lan',
'SE-18' => 'Sweden: Sodermanlands Lan',
'SE-26' => 'Sweden: Stockholms Lan',
'SE-21' => 'Sweden: Uppsala Lan',
'SE-22' => 'Sweden: Varmlands Lan',
'SE-23' => 'Sweden: Vasterbottens Lan',
'SE-24' => 'Sweden: Vasternorrlands Lan',
'SE-25' => 'Sweden: Vastmanlands Lan',
'SE-28' => 'Sweden: Vastra Gotaland',

'--CH' => '','-CH' => 'Switzerland',
'CH-01' => 'Switzerland: Aargau',
'CH-02' => 'Switzerland: Ausser-Rhoden',
'CH-03' => 'Switzerland: Basel-Landschaft',
'CH-04' => 'Switzerland: Basel-Stadt',
'CH-05' => 'Switzerland: Bern',
'CH-06' => 'Switzerland: Fribourg',
'CH-07' => 'Switzerland: Geneve',
'CH-08' => 'Switzerland: Glarus',
'CH-09' => 'Switzerland: Graubunden',
'CH-10' => 'Switzerland: Inner-Rhoden',
'CH-26' => 'Switzerland: Jura',
'CH-11' => 'Switzerland: Luzern',
'CH-12' => 'Switzerland: Neuchatel',
'CH-13' => 'Switzerland: Nidwalden',
'CH-14' => 'Switzerland: Obwalden',
'CH-15' => 'Switzerland: Sankt Gallen',
'CH-16' => 'Switzerland: Schaffhausen',
'CH-17' => 'Switzerland: Schwyz',
'CH-18' => 'Switzerland: Solothurn',
'CH-19' => 'Switzerland: Thurgau',
'CH-20' => 'Switzerland: Ticino',
'CH-21' => 'Switzerland: Uri',
'CH-22' => 'Switzerland: Valais',
'CH-23' => 'Switzerland: Vaud',
'CH-24' => 'Switzerland: Zug',
'CH-25' => 'Switzerland: Zurich',

'--SY' => '','-SY' => 'Syrian Arab Republic',
'SY-01' => 'Syrian Arab Republic: Al Hasakah',
'SY-02' => 'Syrian Arab Republic: Al Ladhiqiyah',
'SY-03' => 'Syrian Arab Republic: Al Qunaytirah',
'SY-04' => 'Syrian Arab Republic: Ar Raqqah',
'SY-05' => 'Syrian Arab Republic: As Suwayda\'',
'SY-06' => 'Syrian Arab Republic: Dar',
'SY-07' => 'Syrian Arab Republic: Dayr az Zawr',
'SY-13' => 'Syrian Arab Republic: Dimashq',
'SY-09' => 'Syrian Arab Republic: Halab',
'SY-10' => 'Syrian Arab Republic: Hamah',
'SY-11' => 'Syrian Arab Republic: Hims',
'SY-12' => 'Syrian Arab Republic: Idlib',
'SY-08' => 'Syrian Arab Republic: Rif Dimashq',
'SY-14' => 'Syrian Arab Republic: Tartus',

'--TW' => '','-TW' => 'Taiwan',
'TW-01' => 'Taiwan: Fu-chien',
'TW-02' => 'Taiwan: Kao-hsiung',
'TW-03' => 'Taiwan: T\'ai-pei',
'TW-04' => 'Taiwan: T\'ai-wan',

'--TJ' => '','-TJ' => 'Tajikistan',
'TJ-02' => 'Tajikistan: Khatlon',
'TJ-01' => 'Tajikistan: Kuhistoni Badakhshon',
'TJ-03' => 'Tajikistan: Sughd',

'--TZ' => '','-TZ' => 'Tanwzania',
'TZ-01' => 'Tanwzania: Arusha',
'TZ-23' => 'Tanwzania: Dar es Salaam',
'TZ-03' => 'Tanwzania: Dodoma',
'TZ-04' => 'Tanwzania: Iringa',
'TZ-19' => 'Tanwzania: Kagera',
'TZ-05' => 'Tanwzania: Kigoma',
'TZ-06' => 'Tanwzania: Kilimanjaro',
'TZ-07' => 'Tanwzania: Lindi',
'TZ-08' => 'Tanwzania: Mara',
'TZ-09' => 'Tanwzania: Mbeya',
'TZ-10' => 'Tanwzania: Morogoro',
'TZ-11' => 'Tanwzania: Mtwara',
'TZ-12' => 'Tanwzania: Mwanza',
'TZ-13' => 'Tanwzania: Pemba North',
'TZ-20' => 'Tanwzania: Pemba South',
'TZ-02' => 'Tanwzania: Pwani',
'TZ-24' => 'Tanwzania: Rukwa',
'TZ-14' => 'Tanwzania: Ruvuma',
'TZ-15' => 'Tanwzania: Shinyanga',
'TZ-16' => 'Tanwzania: Singida',
'TZ-17' => 'Tanwzania: Tabora',
'TZ-18' => 'Tanwzania: Tanga',
'TZ-21' => 'Tanwzania: Zanzibar Central',
'TZ-22' => 'Tanwzania: Zanzibar North',
'TZ-25' => 'Tanwzania: Zanzibar Urban',

'--TH' => '','-TH' => 'Thailand',
'TH-35' => 'Thailand: Ang Thong',
'TH-28' => 'Thailand: Buriram',
'TH-44' => 'Thailand: Chachoengsao',
'TH-32' => 'Thailand: Chai Nat',
'TH-26' => 'Thailand: Chaiyaphum',
'TH-48' => 'Thailand: Chanthaburi',
'TH-02' => 'Thailand: Chiang Mai',
'TH-03' => 'Thailand: Chiang Rai',
'TH-46' => 'Thailand: Chon Buri',
'TH-58' => 'Thailand: Chumphon',
'TH-23' => 'Thailand: Kalasin',
'TH-11' => 'Thailand: Kamphaeng Phet',
'TH-50' => 'Thailand: Kanchanaburi',
'TH-22' => 'Thailand: Khon Kaen',
'TH-63' => 'Thailand: Krabi',
'TH-40' => 'Thailand: Krung Thep',
'TH-06' => 'Thailand: Lampang',
'TH-05' => 'Thailand: Lamphun',
'TH-18' => 'Thailand: Loei',
'TH-34' => 'Thailand: Lop Buri',
'TH-01' => 'Thailand: Mae Hong Son',
'TH-24' => 'Thailand: Maha Sarakham',
'TH-78' => 'Thailand: Mukdahan',
'TH-43' => 'Thailand: Nakhon Nayok',
'TH-53' => 'Thailand: Nakhon Pathom',
'TH-21' => 'Thailand: Nakhon Phanom',
'TH-27' => 'Thailand: Nakhon Ratchasima',
'TH-16' => 'Thailand: Nakhon Sawan',
'TH-64' => 'Thailand: Nakhon Si Thammarat',
'TH-04' => 'Thailand: Nan',
'TH-31' => 'Thailand: Narathiwat',
'TH-17' => 'Thailand: Nong Khai',
'TH-38' => 'Thailand: Nonthaburi',
'TH-39' => 'Thailand: Pathum Thani',
'TH-69' => 'Thailand: Pattani',
'TH-61' => 'Thailand: Phangnga',
'TH-66' => 'Thailand: Phatthalung',
'TH-41' => 'Thailand: Phayao',
'TH-14' => 'Thailand: Phetchabun',
'TH-56' => 'Thailand: Phetchaburi',
'TH-13' => 'Thailand: Phichit',
'TH-12' => 'Thailand: Phitsanulok',
'TH-36' => 'Thailand: Phra Nakhon Si Ayutthaya',
'TH-07' => 'Thailand: Phrae',
'TH-62' => 'Thailand: Phuket',
'TH-45' => 'Thailand: Prachin Buri',
'TH-57' => 'Thailand: Prachuap Khiri Khan',
'TH-59' => 'Thailand: Ranong',
'TH-52' => 'Thailand: Ratchaburi',
'TH-47' => 'Thailand: Rayong',
'TH-25' => 'Thailand: Roi Et',
'TH-20' => 'Thailand: Sakon Nakhon',
'TH-42' => 'Thailand: Samut Prakan',
'TH-55' => 'Thailand: Samut Sakhon',
'TH-54' => 'Thailand: Samut Songkhram',
'TH-37' => 'Thailand: Saraburi',
'TH-67' => 'Thailand: Satun',
'TH-33' => 'Thailand: Sing Buri',
'TH-30' => 'Thailand: Sisaket',
'TH-68' => 'Thailand: Songkhla',
'TH-09' => 'Thailand: Sukhothai',
'TH-51' => 'Thailand: Suphan Buri',
'TH-60' => 'Thailand: Surat Thani',
'TH-29' => 'Thailand: Surin',
'TH-08' => 'Thailand: Tak',
'TH-65' => 'Thailand: Trang',
'TH-49' => 'Thailand: Trat',
'TH-75' => 'Thailand: Ubon Ratchathani',
'TH-76' => 'Thailand: Udon Thani',
'TH-15' => 'Thailand: Uthai Thani',
'TH-10' => 'Thailand: Uttaradit',
'TH-70' => 'Thailand: Yala',
'TH-72' => 'Thailand: Yasothon',

'--TG' => '','-TG' => 'Togo',
'TG-01' => 'Togo: Amlame',
'TG-02' => 'Togo: Aneho',
'TG-03' => 'Togo: Atakpame',
'TG-15' => 'Togo: Badou',
'TG-04' => 'Togo: Bafilo',
'TG-05' => 'Togo: Bassar',
'TG-06' => 'Togo: Dapaong',
'TG-07' => 'Togo: Kante',
'TG-08' => 'Togo: Klouto',
'TG-14' => 'Togo: Kpagouda',
'TG-09' => 'Togo: Lama-Kara',
'TG-10' => 'Togo: Lome',
'TG-11' => 'Togo: Mango',
'TG-12' => 'Togo: Niamtougou',
'TG-13' => 'Togo: Notse',
'TG-16' => 'Togo: Sotouboua',
'TG-17' => 'Togo: Tabligbo',
'TG-19' => 'Togo: Tchamba',
'TG-20' => 'Togo: Tchaoudjo',
'TG-18' => 'Togo: Tsevie',
'TG-21' => 'Togo: Vogan',

'--TO' => '','-TO' => 'Tonga',
'TO-01' => 'Tonga: Ha',
'TO-02' => 'Tonga: Tongatapu',
'TO-03' => 'Tonga: Vava',

'--TT' => '','-TT' => 'Trinidad and Tobago',
'TT-01' => 'Trinidad and Tobago: Arima',
'TT-02' => 'Trinidad and Tobago: Caroni',
'TT-03' => 'Trinidad and Tobago: Mayaro',
'TT-04' => 'Trinidad and Tobago: Nariva',
'TT-05' => 'Trinidad and Tobago: Port-of-Spain',
'TT-06' => 'Trinidad and Tobago: Saint Andrew',
'TT-07' => 'Trinidad and Tobago: Saint David',
'TT-08' => 'Trinidad and Tobago: Saint George',
'TT-09' => 'Trinidad and Tobago: Saint Patrick',
'TT-10' => 'Trinidad and Tobago: San Fernando',
'TT-11' => 'Trinidad and Tobago: Tobago',
'TT-12' => 'Trinidad and Tobago: Victoria',

'--TN' => '','-TN' => 'Tunisia',
'TN-15' => 'Tunisia: Al Mahdiyah',
'TN-16' => 'Tunisia: Al Munastir',
'TN-02' => 'Tunisia: Al Qasrayn',
'TN-03' => 'Tunisia: Al Qayrawan',
'TN-38' => 'Tunisia: Ariana',
'TN-17' => 'Tunisia: Bajah',
'TN-18' => 'Tunisia: Banzart',
'TN-27' => 'Tunisia: Bin',
'TN-06' => 'Tunisia: Jundubah',
'TN-14' => 'Tunisia: Kef',
'TN-28' => 'Tunisia: Madanin',
'TN-39' => 'Tunisia: Manouba',
'TN-19' => 'Tunisia: Nabul',
'TN-29' => 'Tunisia: Qabis',
'TN-10' => 'Tunisia: Qafsah',
'TN-31' => 'Tunisia: Qibili',
'TN-32' => 'Tunisia: Safaqis',
'TN-33' => 'Tunisia: Sidi Bu Zayd',
'TN-22' => 'Tunisia: Silyanah',
'TN-23' => 'Tunisia: Susah',
'TN-34' => 'Tunisia: Tatawin',
'TN-35' => 'Tunisia: Tawzar',
'TN-36' => 'Tunisia: Tunis',
'TN-37' => 'Tunisia: Zaghwan',

'--TR' => '','-TR' => 'Turkey',
'TR-81' => 'Turkey: Adana',
'TR-02' => 'Turkey: Adiyaman',
'TR-03' => 'Turkey: Afyon',
'TR-04' => 'Turkey: Agri',
'TR-75' => 'Turkey: Aksaray',
'TR-05' => 'Turkey: Amasya',
'TR-68' => 'Turkey: Ankara',
'TR-07' => 'Turkey: Antalya',
'TR-86' => 'Turkey: Ardahan',
'TR-08' => 'Turkey: Artvin',
'TR-09' => 'Turkey: Aydin',
'TR-10' => 'Turkey: Balikesir',
'TR-87' => 'Turkey: Bartin',
'TR-76' => 'Turkey: Batman',
'TR-77' => 'Turkey: Bayburt',
'TR-11' => 'Turkey: Bilecik',
'TR-12' => 'Turkey: Bingol',
'TR-13' => 'Turkey: Bitlis',
'TR-14' => 'Turkey: Bolu',
'TR-15' => 'Turkey: Burdur',
'TR-16' => 'Turkey: Bursa',
'TR-17' => 'Turkey: Canakkale',
'TR-82' => 'Turkey: Cankiri',
'TR-19' => 'Turkey: Corum',
'TR-20' => 'Turkey: Denizli',
'TR-21' => 'Turkey: Diyarbakir',
'TR-93' => 'Turkey: Duzce',
'TR-22' => 'Turkey: Edirne',
'TR-23' => 'Turkey: Elazig',
'TR-24' => 'Turkey: Erzincan',
'TR-25' => 'Turkey: Erzurum',
'TR-26' => 'Turkey: Eskisehir',
'TR-83' => 'Turkey: Gaziantep',
'TR-28' => 'Turkey: Giresun',
'TR-69' => 'Turkey: Gumushane',
'TR-70' => 'Turkey: Hakkari',
'TR-31' => 'Turkey: Hatay',
'TR-32' => 'Turkey: Icel',
'TR-88' => 'Turkey: Igdir',
'TR-33' => 'Turkey: Isparta',
'TR-34' => 'Turkey: Istanbul',
'TR-35' => 'Turkey: Izmir',
'TR-46' => 'Turkey: Kahramanmaras',
'TR-89' => 'Turkey: Karabuk',
'TR-78' => 'Turkey: Karaman',
'TR-84' => 'Turkey: Kars',
'TR-37' => 'Turkey: Kastamonu',
'TR-38' => 'Turkey: Kayseri',
'TR-90' => 'Turkey: Kilis',
'TR-79' => 'Turkey: Kirikkale',
'TR-39' => 'Turkey: Kirklareli',
'TR-40' => 'Turkey: Kirsehir',
'TR-41' => 'Turkey: Kocaeli',
'TR-71' => 'Turkey: Konya',
'TR-43' => 'Turkey: Kutahya',
'TR-44' => 'Turkey: Malatya',
'TR-45' => 'Turkey: Manisa',
'TR-72' => 'Turkey: Mardin',
'TR-48' => 'Turkey: Mugla',
'TR-49' => 'Turkey: Mus',
'TR-50' => 'Turkey: Nevsehir',
'TR-73' => 'Turkey: Nigde',
'TR-52' => 'Turkey: Ordu',
'TR-91' => 'Turkey: Osmaniye',
'TR-53' => 'Turkey: Rize',
'TR-54' => 'Turkey: Sakarya',
'TR-55' => 'Turkey: Samsun',
'TR-63' => 'Turkey: Sanliurfa',
'TR-74' => 'Turkey: Siirt',
'TR-57' => 'Turkey: Sinop',
'TR-80' => 'Turkey: Sirnak',
'TR-58' => 'Turkey: Sivas',
'TR-59' => 'Turkey: Tekirdag',
'TR-60' => 'Turkey: Tokat',
'TR-61' => 'Turkey: Trabzon',
'TR-62' => 'Turkey: Tunceli',
'TR-64' => 'Turkey: Usak',
'TR-65' => 'Turkey: Van',
'TR-92' => 'Turkey: Yalova',
'TR-66' => 'Turkey: Yozgat',
'TR-85' => 'Turkey: Zonguldak',

'--TM' => '','-TM' => 'Turkmenistan',
'TM-01' => 'Turkmenistan: Ahal',
'TM-02' => 'Turkmenistan: Balkan',
'TM-03' => 'Turkmenistan: Dashoguz',
'TM-04' => 'Turkmenistan: Lebap',
'TM-05' => 'Turkmenistan: Mary',

'--UG' => '','-UG' => 'Uganda',
'UG-65' => 'Uganda: Adjumani',
'UG-77' => 'Uganda: Arua',
'UG-66' => 'Uganda: Bugiri',
'UG-67' => 'Uganda: Busia',
'UG-05' => 'Uganda: Busoga',
'UG-18' => 'Uganda: Central',
'UG-20' => 'Uganda: Eastern',
'UG-78' => 'Uganda: Iganga',
'UG-79' => 'Uganda: Kabarole',
'UG-80' => 'Uganda: Kaberamaido',
'UG-37' => 'Uganda: Kampala',
'UG-81' => 'Uganda: Kamwenge',
'UG-82' => 'Uganda: Kanungu',
'UG-08' => 'Uganda: Karamoja',
'UG-69' => 'Uganda: Katakwi',
'UG-83' => 'Uganda: Kayunga',
'UG-84' => 'Uganda: Kitgum',
'UG-85' => 'Uganda: Kyenjojo',
'UG-86' => 'Uganda: Mayuge',
'UG-87' => 'Uganda: Mbale',
'UG-88' => 'Uganda: Moroto',
'UG-89' => 'Uganda: Mpigi',
'UG-90' => 'Uganda: Mukono',
'UG-91' => 'Uganda: Nakapiripirit',
'UG-73' => 'Uganda: Nakasongola',
'UG-21' => 'Uganda: Nile',
'UG-22' => 'Uganda: North Buganda',
'UG-23' => 'Uganda: Northern',
'UG-92' => 'Uganda: Pader',
'UG-93' => 'Uganda: Rukungiri',
'UG-74' => 'Uganda: Sembabule',
'UG-94' => 'Uganda: Sironko',
'UG-95' => 'Uganda: Soroti',
'UG-12' => 'Uganda: South Buganda',
'UG-24' => 'Uganda: Southern',
'UG-96' => 'Uganda: Wakiso',
'UG-25' => 'Uganda: Western',
'UG-97' => 'Uganda: Yumbe',

'--UA' => '','-UA' => 'Ukraine',
'UA-01' => 'Ukraine: Cherkas\'ka Oblast\'',
'UA-02' => 'Ukraine: Chernihivs\'ka Oblast\'',
'UA-03' => 'Ukraine: Chernivets\'ka Oblast\'',
'UA-04' => 'Ukraine: Dnipropetrovs\'ka Oblast\'',
'UA-05' => 'Ukraine: Donets\'ka Oblast\'',
'UA-06' => 'Ukraine: Ivano-Frankivs\'ka Oblast\'',
'UA-07' => 'Ukraine: Kharkivs\'ka Oblast\'',
'UA-08' => 'Ukraine: Khersons\'ka Oblast\'',
'UA-09' => 'Ukraine: Khmel\'nyts\'ka Oblast\'',
'UA-10' => 'Ukraine: Kirovohrads\'ka Oblast\'',
'UA-11' => 'Ukraine: Krym',
'UA-12' => 'Ukraine: Kyyiv',
'UA-13' => 'Ukraine: Kyyivs\'ka Oblast\'',
'UA-14' => 'Ukraine: Luhans\'ka Oblast\'',
'UA-15' => 'Ukraine: L\'vivs\'ka Oblast\'',
'UA-16' => 'Ukraine: Mykolayivs\'ka Oblast\'',
'UA-17' => 'Ukraine: Odes\'ka Oblast\'',
'UA-18' => 'Ukraine: Poltavs\'ka Oblast\'',
'UA-19' => 'Ukraine: Rivnens\'ka Oblast\'',
'UA-20' => 'Ukraine: Sevastopol\'',
'UA-21' => 'Ukraine: Sums\'ka Oblast\'',
'UA-22' => 'Ukraine: Ternopil\'s\'ka Oblast\'',
'UA-23' => 'Ukraine: Vinnyts\'ka Oblast\'',
'UA-24' => 'Ukraine: Volyns\'ka Oblast\'',
'UA-25' => 'Ukraine: Zakarpats\'ka Oblast\'',
'UA-26' => 'Ukraine: Zaporiz\'ka Oblast\'',
'UA-27' => 'Ukraine: Zhytomyrs\'ka Oblast\'',

'--AE' => '','-AE' => 'United Arab Emirates',
'AE-01' => 'United Arab Emirates: Abu Dhabi',
'AE-02' => 'United Arab Emirates: Ajman',
'AE-03' => 'United Arab Emirates: Dubai',
'AE-04' => 'United Arab Emirates: Fujairah',
'AE-05' => 'United Arab Emirates: Ras Al Khaimah',
'AE-06' => 'United Arab Emirates: Sharjah',
'AE-07' => 'United Arab Emirates: Umm Al Quwain',

'--GB' => '','-GB' => 'United Kingdom',
'GB-T5' => 'United Kingdom: Aberdeen City',
'GB-T6' => 'United Kingdom: Aberdeenshire',
'GB-T7' => 'United Kingdom: Angus',
'GB-Q6' => 'United Kingdom: Antrim',
'GB-Q7' => 'United Kingdom: Ards',
'GB-T8' => 'United Kingdom: Argyll and Bute',
'GB-Q8' => 'United Kingdom: Armagh',
'GB-01' => 'United Kingdom: Avon',
'GB-Q9' => 'United Kingdom: Ballymena',
'GB-R1' => 'United Kingdom: Ballymoney',
'GB-R2' => 'United Kingdom: Banbridge',
'GB-A1' => 'United Kingdom: Barking and Dagenham',
'GB-A2' => 'United Kingdom: Barnet',
'GB-A3' => 'United Kingdom: Barnsley',
'GB-A4' => 'United Kingdom: Bath and North East Somerset',
'GB-A5' => 'United Kingdom: Bedfordshire',
'GB-R3' => 'United Kingdom: Belfast',
'GB-03' => 'United Kingdom: Berkshire',
'GB-A6' => 'United Kingdom: Bexley',
'GB-A7' => 'United Kingdom: Birmingham',
'GB-A8' => 'United Kingdom: Blackburn with Darwen',
'GB-A9' => 'United Kingdom: Blackpool',
'GB-X2' => 'United Kingdom: Blaenau Gwent',
'GB-B1' => 'United Kingdom: Bolton',
'GB-B2' => 'United Kingdom: Bournemouth',
'GB-B3' => 'United Kingdom: Bracknell Forest',
'GB-B4' => 'United Kingdom: Bradford',
'GB-B5' => 'United Kingdom: Brent',
'GB-X3' => 'United Kingdom: Bridgend',
'GB-B6' => 'United Kingdom: Brighton and Hove',
'GB-B7' => 'United Kingdom: Bristol',
'GB-B8' => 'United Kingdom: Bromley',
'GB-B9' => 'United Kingdom: Buckinghamshire',
'GB-C1' => 'United Kingdom: Bury',
'GB-X4' => 'United Kingdom: Caerphilly',
'GB-C2' => 'United Kingdom: Calderdale',
'GB-C3' => 'United Kingdom: Cambridgeshire',
'GB-C4' => 'United Kingdom: Camden',
'GB-X5' => 'United Kingdom: Cardiff',
'GB-X7' => 'United Kingdom: Carmarthenshire',
'GB-R4' => 'United Kingdom: Carrickfergus',
'GB-R5' => 'United Kingdom: Castlereagh',
'GB-79' => 'United Kingdom: Central',
'GB-X6' => 'United Kingdom: Ceredigion',
'GB-C5' => 'United Kingdom: Cheshire',
'GB-U1' => 'United Kingdom: Clackmannanshire',
'GB-07' => 'United Kingdom: Cleveland',
'GB-90' => 'United Kingdom: Clwyd',
'GB-R6' => 'United Kingdom: Coleraine',
'GB-X8' => 'United Kingdom: Conwy',
'GB-R7' => 'United Kingdom: Cookstown',
'GB-C6' => 'United Kingdom: Cornwall',
'GB-C7' => 'United Kingdom: Coventry',
'GB-R8' => 'United Kingdom: Craigavon',
'GB-C8' => 'United Kingdom: Croydon',
'GB-C9' => 'United Kingdom: Cumbria',
'GB-D1' => 'United Kingdom: Darlington',
'GB-X9' => 'United Kingdom: Denbighshire',
'GB-D2' => 'United Kingdom: Derby',
'GB-D3' => 'United Kingdom: Derbyshire',
'GB-S6' => 'United Kingdom: Derry',
'GB-D4' => 'United Kingdom: Devon',
'GB-D5' => 'United Kingdom: Doncaster',
'GB-D6' => 'United Kingdom: Dorset',
'GB-R9' => 'United Kingdom: Down',
'GB-D7' => 'United Kingdom: Dudley',
'GB-U2' => 'United Kingdom: Dumfries and Galloway',
'GB-U3' => 'United Kingdom: Dundee City',
'GB-S1' => 'United Kingdom: Dungannon',
'GB-D8' => 'United Kingdom: Durham',
'GB-91' => 'United Kingdom: Dyfed',
'GB-D9' => 'United Kingdom: Ealing',
'GB-U4' => 'United Kingdom: East Ayrshire',
'GB-U5' => 'United Kingdom: East Dunbartonshire',
'GB-U6' => 'United Kingdom: East Lothian',
'GB-U7' => 'United Kingdom: East Renfrewshire',
'GB-E1' => 'United Kingdom: East Riding of Yorkshire',
'GB-E2' => 'United Kingdom: East Sussex',
'GB-U8' => 'United Kingdom: Edinburgh',
'GB-W8' => 'United Kingdom: Eilean Siar',
'GB-E3' => 'United Kingdom: Enfield',
'GB-E4' => 'United Kingdom: Essex',
'GB-U9' => 'United Kingdom: Falkirk',
'GB-S2' => 'United Kingdom: Fermanagh',
'GB-V1' => 'United Kingdom: Fife',
'GB-Y1' => 'United Kingdom: Flintshire',
'GB-E5' => 'United Kingdom: Gateshead',
'GB-V2' => 'United Kingdom: Glasgow City',
'GB-E6' => 'United Kingdom: Gloucestershire',
'GB-82' => 'United Kingdom: Grampian',
'GB-17' => 'United Kingdom: Greater London',
'GB-18' => 'United Kingdom: Greater Manchester',
'GB-E7' => 'United Kingdom: Greenwich',
'GB-92' => 'United Kingdom: Gwent',
'GB-Y2' => 'United Kingdom: Gwynedd',
'GB-E8' => 'United Kingdom: Hackney',
'GB-E9' => 'United Kingdom: Halton',
'GB-F1' => 'United Kingdom: Hammersmith and Fulham',
'GB-F2' => 'United Kingdom: Hampshire',
'GB-F3' => 'United Kingdom: Haringey',
'GB-F4' => 'United Kingdom: Harrow',
'GB-F5' => 'United Kingdom: Hartlepool',
'GB-F6' => 'United Kingdom: Havering',
'GB-20' => 'United Kingdom: Hereford and Worcester',
'GB-F7' => 'United Kingdom: Herefordshire',
'GB-F8' => 'United Kingdom: Hertford',
'GB-V3' => 'United Kingdom: Highland',
'GB-F9' => 'United Kingdom: Hillingdon',
'GB-G1' => 'United Kingdom: Hounslow',
'GB-22' => 'United Kingdom: Humberside',
'GB-V4' => 'United Kingdom: Inverclyde',
'GB-X1' => 'United Kingdom: Isle of Anglesey',
'GB-G2' => 'United Kingdom: Isle of Wight',
'GB-G3' => 'United Kingdom: Islington',
'GB-G4' => 'United Kingdom: Kensington and Chelsea',
'GB-G5' => 'United Kingdom: Kent',
'GB-G6' => 'United Kingdom: Kingston upon Hull',
'GB-G7' => 'United Kingdom: Kingston upon Thames',
'GB-G8' => 'United Kingdom: Kirklees',
'GB-G9' => 'United Kingdom: Knowsley',
'GB-H1' => 'United Kingdom: Lambeth',
'GB-H2' => 'United Kingdom: Lancashire',
'GB-S3' => 'United Kingdom: Larne',
'GB-H3' => 'United Kingdom: Leeds',
'GB-H4' => 'United Kingdom: Leicester',
'GB-H5' => 'United Kingdom: Leicestershire',
'GB-H6' => 'United Kingdom: Lewisham',
'GB-S4' => 'United Kingdom: Limavady',
'GB-H7' => 'United Kingdom: Lincolnshire',
'GB-S5' => 'United Kingdom: Lisburn',
'GB-H8' => 'United Kingdom: Liverpool',
'GB-H9' => 'United Kingdom: London',
'GB-84' => 'United Kingdom: Lothian',
'GB-I1' => 'United Kingdom: Luton',
'GB-S7' => 'United Kingdom: Magherafelt',
'GB-I2' => 'United Kingdom: Manchester',
'GB-I3' => 'United Kingdom: Medway',
'GB-28' => 'United Kingdom: Merseyside',
'GB-Y3' => 'United Kingdom: Merthyr Tydfil',
'GB-I4' => 'United Kingdom: Merton',
'GB-94' => 'United Kingdom: Mid Glamorgan',
'GB-I5' => 'United Kingdom: Middlesbrough',
'GB-V5' => 'United Kingdom: Midlothian',
'GB-I6' => 'United Kingdom: Milton Keynes',
'GB-Y4' => 'United Kingdom: Monmouthshire',
'GB-V6' => 'United Kingdom: Moray',
'GB-S8' => 'United Kingdom: Moyle',
'GB-Y5' => 'United Kingdom: Neath Port Talbot',
'GB-I7' => 'United Kingdom: Newcastle upon Tyne',
'GB-I8' => 'United Kingdom: Newham',
'GB-Y6' => 'United Kingdom: Newport',
'GB-S9' => 'United Kingdom: Newry and Mourne',
'GB-T1' => 'United Kingdom: Newtownabbey',
'GB-I9' => 'United Kingdom: Norfolk',
'GB-V7' => 'United Kingdom: North Ayrshire',
'GB-T2' => 'United Kingdom: North Down',
'GB-J2' => 'United Kingdom: North East Lincolnshire',
'GB-V8' => 'United Kingdom: North Lanarkshire',
'GB-J3' => 'United Kingdom: North Lincolnshire',
'GB-J4' => 'United Kingdom: North Somerset',
'GB-J5' => 'United Kingdom: North Tyneside',
'GB-J7' => 'United Kingdom: North Yorkshire',
'GB-J1' => 'United Kingdom: Northamptonshire',
'GB-J6' => 'United Kingdom: Northumberland',
'GB-J8' => 'United Kingdom: Nottingham',
'GB-J9' => 'United Kingdom: Nottinghamshire',
'GB-K1' => 'United Kingdom: Oldham',
'GB-T3' => 'United Kingdom: Omagh',
'GB-V9' => 'United Kingdom: Orkney',
'GB-K2' => 'United Kingdom: Oxfordshire',
'GB-Y7' => 'United Kingdom: Pembrokeshire',
'GB-W1' => 'United Kingdom: Perth and Kinross',
'GB-K3' => 'United Kingdom: Peterborough',
'GB-K4' => 'United Kingdom: Plymouth',
'GB-K5' => 'United Kingdom: Poole',
'GB-K6' => 'United Kingdom: Portsmouth',
'GB-Y8' => 'United Kingdom: Powys',
'GB-K7' => 'United Kingdom: Reading',
'GB-K8' => 'United Kingdom: Redbridge',
'GB-K9' => 'United Kingdom: Redcar and Cleveland',
'GB-W2' => 'United Kingdom: Renfrewshire',
'GB-Y9' => 'United Kingdom: Rhondda Cynon Taff',
'GB-L1' => 'United Kingdom: Richmond upon Thames',
'GB-L2' => 'United Kingdom: Rochdale',
'GB-L3' => 'United Kingdom: Rotherham',
'GB-L4' => 'United Kingdom: Rutland',
'GB-L5' => 'United Kingdom: Salford',
'GB-L7' => 'United Kingdom: Sandwell',
'GB-T9' => 'United Kingdom: Scottish Borders',
'GB-L8' => 'United Kingdom: Sefton',
'GB-L9' => 'United Kingdom: Sheffield',
'GB-W3' => 'United Kingdom: Shetland Islands',
'GB-L6' => 'United Kingdom: Shropshire',
'GB-M1' => 'United Kingdom: Slough',
'GB-M2' => 'United Kingdom: Solihull',
'GB-M3' => 'United Kingdom: Somerset',
'GB-W4' => 'United Kingdom: South Ayrshire',
'GB-96' => 'United Kingdom: South Glamorgan',
'GB-M6' => 'United Kingdom: South Gloucestershire',
'GB-W5' => 'United Kingdom: South Lanarkshire',
'GB-M7' => 'United Kingdom: South Tyneside',
'GB-37' => 'United Kingdom: South Yorkshire',
'GB-M4' => 'United Kingdom: Southampton',
'GB-M5' => 'United Kingdom: Southend-on-Sea',
'GB-M8' => 'United Kingdom: Southwark',
'GB-N1' => 'United Kingdom: St. Helens',
'GB-M9' => 'United Kingdom: Staffordshire',
'GB-W6' => 'United Kingdom: Stirling',
'GB-N2' => 'United Kingdom: Stockport',
'GB-N3' => 'United Kingdom: Stockton-on-Tees',
'GB-N4' => 'United Kingdom: Stoke-on-Trent',
'GB-T4' => 'United Kingdom: Strabane',
'GB-87' => 'United Kingdom: Strathclyde',
'GB-N5' => 'United Kingdom: Suffolk',
'GB-N6' => 'United Kingdom: Sunderland',
'GB-N7' => 'United Kingdom: Surrey',
'GB-N8' => 'United Kingdom: Sutton',
'GB-Z1' => 'United Kingdom: Swansea',
'GB-N9' => 'United Kingdom: Swindon',
'GB-O1' => 'United Kingdom: Tameside',
'GB-88' => 'United Kingdom: Tayside',
'GB-O2' => 'United Kingdom: Telford and Wrekin',
'GB-O3' => 'United Kingdom: Thurrock',
'GB-O4' => 'United Kingdom: Torbay',
'GB-Z2' => 'United Kingdom: Torfaen',
'GB-O5' => 'United Kingdom: Tower Hamlets',
'GB-O6' => 'United Kingdom: Trafford',
'GB-41' => 'United Kingdom: Tyne and Wear',
'GB-Z3' => 'United Kingdom: Vale of Glamorgan',
'GB-O7' => 'United Kingdom: Wakefield',
'GB-O8' => 'United Kingdom: Walsall',
'GB-O9' => 'United Kingdom: Waltham Forest',
'GB-P1' => 'United Kingdom: Wandsworth',
'GB-P2' => 'United Kingdom: Warrington',
'GB-P3' => 'United Kingdom: Warwickshire',
'GB-P4' => 'United Kingdom: West Berkshire',
'GB-W7' => 'United Kingdom: West Dunbartonshire',
'GB-97' => 'United Kingdom: West Glamorgan',
'GB-W9' => 'United Kingdom: West Lothian',
'GB-43' => 'United Kingdom: West Midlands',
'GB-P6' => 'United Kingdom: West Sussex',
'GB-45' => 'United Kingdom: West Yorkshire',
'GB-P5' => 'United Kingdom: Westminster',
'GB-P7' => 'United Kingdom: Wigan',
'GB-P8' => 'United Kingdom: Wiltshire',
'GB-P9' => 'United Kingdom: Windsor and Maidenhead',
'GB-Q1' => 'United Kingdom: Wirral',
'GB-Q2' => 'United Kingdom: Wokingham',
'GB-Q3' => 'United Kingdom: Wolverhampton',
'GB-Q4' => 'United Kingdom: Worcestershire',
'GB-Z4' => 'United Kingdom: Wrexham',
'GB-Q5' => 'United Kingdom: York',

'--US' => '','-US' => 'United States',
'US-AL' => 'United States: Alabama',
'US-AK' => 'United States: Alaska',
'US-AS' => 'United States: American Samoa',
'US-AZ' => 'United States: Arizona',
'US-AR' => 'United States: Arkansas',
'US-AA' => 'United States: Armed Forces Americas',
'US-AE' => 'United States: Armed Forces Europe',
'US-AP' => 'United States: Armed Forces Pacific',
'US-CA' => 'United States: California',
'US-CO' => 'United States: Colorado',
'US-CT' => 'United States: Connecticut',
'US-DE' => 'United States: Delaware',
'US-DC' => 'United States: District of Columbia',
'US-FM' => 'United States: Federated States of Micronesia',
'US-FL' => 'United States: Florida',
'US-GA' => 'United States: Georgia',
'US-GU' => 'United States: Guam',
'US-HI' => 'United States: Hawaii',
'US-ID' => 'United States: Idaho',
'US-IL' => 'United States: Illinois',
'US-IN' => 'United States: Indiana',
'US-IA' => 'United States: Iowa',
'US-KS' => 'United States: Kansas',
'US-KY' => 'United States: Kentucky',
'US-LA' => 'United States: Louisiana',
'US-ME' => 'United States: Maine',
'US-MH' => 'United States: Marshall Islands',
'US-MD' => 'United States: Maryland',
'US-MA' => 'United States: Massachusetts',
'US-MI' => 'United States: Michigan',
'US-MN' => 'United States: Minnesota',
'US-MS' => 'United States: Mississippi',
'US-MO' => 'United States: Missouri',
'US-MT' => 'United States: Montana',
'US-NE' => 'United States: Nebraska',
'US-NV' => 'United States: Nevada',
'US-NH' => 'United States: New Hampshire',
'US-NJ' => 'United States: New Jersey',
'US-NM' => 'United States: New Mexico',
'US-NY' => 'United States: New York',
'US-NC' => 'United States: North Carolina',
'US-ND' => 'United States: North Dakota',
'US-MP' => 'United States: Northern Mariana Islands',
'US-OH' => 'United States: Ohio',
'US-OK' => 'United States: Oklahoma',
'US-OR' => 'United States: Oregon',
'US-PW' => 'United States: Palau',
'US-PA' => 'United States: Pennsylvania',
'US-PR' => 'United States: Puerto Rico',
'US-RI' => 'United States: Rhode Island',
'US-SC' => 'United States: South Carolina',
'US-SD' => 'United States: South Dakota',
'US-TN' => 'United States: Tennessee',
'US-TX' => 'United States: Texas',
'US-UT' => 'United States: Utah',
'US-VT' => 'United States: Vermont',
'US-VI' => 'United States: Virgin Islands',
'US-VA' => 'United States: Virginia',
'US-WA' => 'United States: Washington',
'US-WV' => 'United States: West Virginia',
'US-WI' => 'United States: Wisconsin',
'US-WY' => 'United States: Wyoming',

'--UY' => '','-UY' => 'Uruguay',
'UY-01' => 'Uruguay: Artigas',
'UY-02' => 'Uruguay: Canelones',
'UY-03' => 'Uruguay: Cerro Largo',
'UY-04' => 'Uruguay: Colonia',
'UY-05' => 'Uruguay: Durazno',
'UY-06' => 'Uruguay: Flores',
'UY-07' => 'Uruguay: Florida',
'UY-08' => 'Uruguay: Lavalleja',
'UY-09' => 'Uruguay: Maldonado',
'UY-10' => 'Uruguay: Montevideo',
'UY-11' => 'Uruguay: Paysandu',
'UY-12' => 'Uruguay: Rio Negro',
'UY-13' => 'Uruguay: Rivera',
'UY-14' => 'Uruguay: Rocha',
'UY-15' => 'Uruguay: Salto',
'UY-16' => 'Uruguay: San Jose',
'UY-17' => 'Uruguay: Soriano',
'UY-18' => 'Uruguay: Tacuarembo',
'UY-19' => 'Uruguay: Treinta y Tres',

'--UZ' => '','-UZ' => 'Uzbekistan',
'UZ-01' => 'Uzbekistan: Andijon',
'UZ-02' => 'Uzbekistan: Bukhoro',
'UZ-03' => 'Uzbekistan: Farghona',
'UZ-04' => 'Uzbekistan: Jizzakh',
'UZ-05' => 'Uzbekistan: Khorazm',
'UZ-06' => 'Uzbekistan: Namangan',
'UZ-07' => 'Uzbekistan: Nawoiy',
'UZ-08' => 'Uzbekistan: Qashqadaryo',
'UZ-09' => 'Uzbekistan: Qoraqalpoghiston',
'UZ-10' => 'Uzbekistan: Samarqand',
'UZ-11' => 'Uzbekistan: Sirdaryo',
'UZ-12' => 'Uzbekistan: Surkhondaryo',
'UZ-13' => 'Uzbekistan: Toshkent',
'UZ-14' => 'Uzbekistan: Toshkent',

'--VU' => '','-VU' => 'Vanuatu',
'VU-05' => 'Vanuatu: Ambrym',
'VU-06' => 'Vanuatu: Aoba',
'VU-08' => 'Vanuatu: Efate',
'VU-09' => 'Vanuatu: Epi',
'VU-10' => 'Vanuatu: Malakula',
'VU-16' => 'Vanuatu: Malampa',
'VU-11' => 'Vanuatu: Paama',
'VU-17' => 'Vanuatu: Penama',
'VU-12' => 'Vanuatu: Pentecote',
'VU-13' => 'Vanuatu: Sanma',
'VU-18' => 'Vanuatu: Shefa',
'VU-14' => 'Vanuatu: Shepherd',
'VU-15' => 'Vanuatu: Tafea',
'VU-07' => 'Vanuatu: Torba',

'--VE' => '','-VE' => 'Venezuela',
'VE-01' => 'Venezuela: Amazonas',
'VE-02' => 'Venezuela: Anzoategui',
'VE-03' => 'Venezuela: Apure',
'VE-04' => 'Venezuela: Aragua',
'VE-05' => 'Venezuela: Barinas',
'VE-06' => 'Venezuela: Bolivar',
'VE-07' => 'Venezuela: Carabobo',
'VE-08' => 'Venezuela: Cojedes',
'VE-09' => 'Venezuela: Delta Amacuro',
'VE-24' => 'Venezuela: Dependencias Federales',
'VE-25' => 'Venezuela: Distrito Federal',
'VE-11' => 'Venezuela: Falcon',
'VE-12' => 'Venezuela: Guarico',
'VE-13' => 'Venezuela: Lara',
'VE-14' => 'Venezuela: Merida',
'VE-15' => 'Venezuela: Miranda',
'VE-16' => 'Venezuela: Monagas',
'VE-17' => 'Venezuela: Nueva Esparta',
'VE-18' => 'Venezuela: Portuguesa',
'VE-19' => 'Venezuela: Sucre',
'VE-20' => 'Venezuela: Tachira',
'VE-21' => 'Venezuela: Trujillo',
'VE-26' => 'Venezuela: Vargas',
'VE-22' => 'Venezuela: Yaracuy',
'VE-23' => 'Venezuela: Zulia',

'--VN' => '','-VN' => 'Vietnam',
'VN-43' => 'Vietnam: An Giang',
'VN-53' => 'Vietnam: Ba Ria-Vung Tau',
'VN-02' => 'Vietnam: Bac Thai',
'VN-03' => 'Vietnam: Ben Tre',
'VN-54' => 'Vietnam: Binh Dinh',
'VN-55' => 'Vietnam: Binh Thuan',
'VN-56' => 'Vietnam: Can Tho',
'VN-05' => 'Vietnam: Cao Bang',
'VN-44' => 'Vietnam: Dac Lac',
'VN-45' => 'Vietnam: Dong Nai',
'VN-20' => 'Vietnam: Dong Nam Bo',
'VN-46' => 'Vietnam: Dong Thap',
'VN-57' => 'Vietnam: Gia Lai',
'VN-11' => 'Vietnam: Ha Bac',
'VN-58' => 'Vietnam: Ha Giang',
'VN-51' => 'Vietnam: Ha Noi',
'VN-59' => 'Vietnam: Ha Tay',
'VN-60' => 'Vietnam: Ha Tinh',
'VN-12' => 'Vietnam: Hai Hung',
'VN-13' => 'Vietnam: Hai Phong',
'VN-52' => 'Vietnam: Ho Chi Minh',
'VN-61' => 'Vietnam: Hoa Binh',
'VN-62' => 'Vietnam: Khanh Hoa',
'VN-47' => 'Vietnam: Kien Giang',
'VN-63' => 'Vietnam: Kon Tum',
'VN-22' => 'Vietnam: Lai Chau',
'VN-23' => 'Vietnam: Lam Dong',
'VN-39' => 'Vietnam: Lang Son',
'VN-64' => 'Vietnam: Lao Cai',
'VN-24' => 'Vietnam: Long An',
'VN-48' => 'Vietnam: Minh Hai',
'VN-65' => 'Vietnam: Nam Ha',
'VN-66' => 'Vietnam: Nghe An',
'VN-67' => 'Vietnam: Ninh Binh',
'VN-68' => 'Vietnam: Ninh Thuan',
'VN-69' => 'Vietnam: Phu Yen',
'VN-70' => 'Vietnam: Quang Binh',
'VN-29' => 'Vietnam: Quang Nam-Da Nang',
'VN-71' => 'Vietnam: Quang Ngai',
'VN-30' => 'Vietnam: Quang Ninh',
'VN-72' => 'Vietnam: Quang Tri',
'VN-73' => 'Vietnam: Soc Trang',
'VN-32' => 'Vietnam: Son La',
'VN-49' => 'Vietnam: Song Be',
'VN-33' => 'Vietnam: Tay Ninh',
'VN-35' => 'Vietnam: Thai Binh',
'VN-34' => 'Vietnam: Thanh Hoa',
'VN-74' => 'Vietnam: Thua Thien',
'VN-37' => 'Vietnam: Tien Giang',
'VN-75' => 'Vietnam: Tra Vinh',
'VN-76' => 'Vietnam: Tuyen Quang',
'VN-77' => 'Vietnam: Vinh Long',
'VN-50' => 'Vietnam: Vinh Phu',
'VN-78' => 'Vietnam: Yen Bai',

'--YE' => '','-YE' => 'Yemen',
'YE-01' => 'Yemen: Abyan',
'YE-20' => 'Yemen: Al Bayda\'',
'YE-08' => 'Yemen: Al Hudaydah',
'YE-21' => 'Yemen: Al Jawf',
'YE-03' => 'Yemen: Al Mahrah',
'YE-10' => 'Yemen: Al Mahwit',
'YE-11' => 'Yemen: Dhamar',
'YE-04' => 'Yemen: Hadramawt',
'YE-22' => 'Yemen: Hajjah',
'YE-23' => 'Yemen: Ibb',
'YE-24' => 'Yemen: Lahij',
'YE-14' => 'Yemen: Ma\'rib',
'YE-15' => 'Yemen: Sa',
'YE-16' => 'Yemen: San',
'YE-05' => 'Yemen: Shabwah',
'YE-25' => 'Yemen: Ta',

'--ZM' => '','-ZM' => 'Zambia',
'ZM-02' => 'Zambia: Central',
'ZM-08' => 'Zambia: Copperbelt',
'ZM-03' => 'Zambia: Eastern',
'ZM-04' => 'Zambia: Luapula',
'ZM-09' => 'Zambia: Lusaka',
'ZM-05' => 'Zambia: Northern',
'ZM-06' => 'Zambia: North-Western',
'ZM-07' => 'Zambia: Southern',
'ZM-01' => 'Zambia: Western',

'--ZW' => '','-ZW' => 'Zimbabwe',
'ZW-09' => 'Zimbabwe: Bulawayo',
'ZW-10' => 'Zimbabwe: Harare',
'ZW-01' => 'Zimbabwe: Manicaland',
'ZW-03' => 'Zimbabwe: Mashonaland Central',
'ZW-04' => 'Zimbabwe: Mashonaland East',
'ZW-05' => 'Zimbabwe: Mashonaland West',
'ZW-08' => 'Zimbabwe: Masvingo',
'ZW-06' => 'Zimbabwe: Matabeleland North',
'ZW-07' => 'Zimbabwe: Matabeleland South',
'ZW-02' => 'Zimbabwe: Midlands\'

version.php000060400000003014152455357510006750 0ustar00<?php
/**
 * @package         Regular Labs Library
 * @version         21.4.10972
 * 
 * @author          Peter van Westen <info@regularlabs.com>
 * @link            http://www.regularlabs.com
 * @copyright       Copyright © 2021 Regular Labs All Rights Reserved
 * @license         http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
 */

defined('_JEXEC') or die;

use Joomla\CMS\Factory as JFactory;
use RegularLabs\Library\Version as RL_Version;

if ( ! is_file(JPATH_LIBRARIES . '/regularlabs/autoload.php'))
{
	return;
}

require_once JPATH_LIBRARIES . '/regularlabs/autoload.php';

class JFormFieldRL_Version extends \RegularLabs\Library\Field
{
	public $type = 'Version';

	protected function getLabel()
	{
		return '';
	}

	protected function getInput()
	{
		$extension = $this->get('extension');
		$xml       = $this->get('xml');

		if ( ! $xml && $this->form->getValue('element'))
		{
			if ($this->form->getValue('folder'))
			{
				$xml = 'plugins/' . $this->form->getValue('folder') . '/' . $this->form->getValue('element') . '/' . $this->form->getValue('element') . '.xml';
			}
			else
			{
				$xml = 'administrator/modules/' . $this->form->getValue('element') . '/' . $this->form->getValue('element') . '.xml';
			}
			if ( ! file_exists(JPATH_SITE . '/' . $xml))
			{
				return '';
			}
		}

		if (empty($extension) || empty($xml))
		{
			return '';
		}

		if ( ! JFactory::getUser()->authorise('core.manage', 'com_installer'))
		{
			return '';
		}

		return '</div><div class="hide">' . RL_Version::getMessage($extension);
	}
}
ajax.php000060400000011024152455357510006206 0ustar00<?php
/**
 * @package         Regular Labs Library
 * @version         21.4.10972
 * 
 * @author          Peter van Westen <info@regularlabs.com>
 * @link            http://www.regularlabs.com
 * @copyright       Copyright © 2021 Regular Labs All Rights Reserved
 * @license         http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
 */

defined('_JEXEC') or die;

use Joomla\CMS\Factory as JFactory;
use Joomla\CMS\Language\Text as JText;
use RegularLabs\Library\Document as RL_Document;

if ( ! is_file(JPATH_LIBRARIES . '/regularlabs/autoload.php'))
{
	return;
}

require_once JPATH_LIBRARIES . '/regularlabs/autoload.php';

class JFormFieldRL_Ajax extends \RegularLabs\Library\Field
{
	public $type = 'Ajax';

	protected function getInput()
	{
		RL_Document::loadMainDependencies();

		$class = $this->get('class', 'btn');

		if ($this->get('disabled'))
		{
			return $this->getButton($class . ' disabled', 'disabled');
		}

		$loading = 'jQuery("#' . $this->id . ' span:nth-child(1)").attr("class", "icon-refresh icon-spin");';

		$success = '
			jQuery("#' . $this->id . '").removeClass("btn-warning").addClass("btn-success");
			jQuery("#' . $this->id . ' span:nth-child(1)").attr("class", "icon-ok");
			if(data){
				jQuery("#message_' . $this->id . '").addClass("alert alert-success alert-noclose alert-inline").html(data);
			}
			';

		$error = '
			jQuery("#' . $this->id . '").removeClass("btn-success").addClass("btn-warning");
			jQuery("#' . $this->id . ' span:nth-child(1)").attr("class", "icon-warning");
			if(data){
				let error = data;
				if(data.statusText) { 
					error = data.statusText;
					if(data.responseText.test(/<blockquote>/)) {
						error = data.responseText.replace(/^[.\\\\s\\\\S]*?<blockquote>([.\\\\s\\\\S]*?)<\\\\/blockquote>[.\\\\s\\\\S]*$/gm, "$1");
					}
				}
				jQuery("#message_' . $this->id . '").addClass("alert alert-danger alert-noclose alert-inline").html(error);
			}';

		if ($this->get('success-disabled'))
		{
			$success .= '
			jQuery("#' . $this->id . '").disabled = true;
			jQuery("#' . $this->id . '").addClass("disabled");
			jQuery("#' . $this->id . '").attr("onclick", "return false;");
			';
		}

		if ($this->get('success-text') || $this->get('error-text'))
		{
			$success_text = $this->get('success-text', $this->get('text'));
			$error_text   = $this->get('error-text', $this->get('text'));

			$success .= '
			jQuery("#' . $this->id . ' span:nth-child(2)").text("' . addslashes(JText::_($success_text)) . '");
			';

			$error .= '
			jQuery("#' . $this->id . ' span:nth-child(2)").text("' . addslashes(JText::_($error_text)) . '");
			';
		}

		$query = '';

		if ($url_query = $this->get('url-query'))
		{
			$name_prefix = $this->form->getFormControl() . '\\\[' . $this->group . '\\\]';
			$id_prefix   = $this->form->getFormControl() . '_' . $this->group . '_';
			$query_parts = [];
			$url_query   = explode(',', $url_query);

			foreach ($url_query as $url_query_part)
			{
				list($key, $id) = explode(':', $url_query_part);

				$el_name = 'document.querySelector("input[name=' . $name_prefix . '\\\[' . $id . '\\\]]:checked")';
				$el_id   = 'document.querySelector("#' . $id_prefix . $id . '")';

				$query_parts[] = '`&' . $key . '=`'
					. ' + encodeURI(' . $el_name . ' ? ' . $el_name . '.value : (' . $el_id . ' ? ' . $el_id . '.value' . ' : ""))';
			}

			$query = '+' . implode('+', $query_parts);
		}

		$script = 'function loadAjax' . $this->id . '() {
				' . $loading . '
				jQuery("#message_' . $this->id . '").attr("class", "").html("");
				RegularLabsScripts.loadajax(
					`' . addslashes($this->get('url')) . '`' . $query . ',
					`
					if(data == "" || data.substring(0,1) == "+") {
						data = data.trim().replace(/^[+]/, "");
						' . $success . '
					} else {
						data = data.trim().replace(/^[-]/, "");
						' . $error . '
					}`,
					`' . $error . '`
				);
			}';

		$script = preg_replace('#\s*\n\s*#', ' ', $script);

		JFactory::getDocument()->addScriptDeclaration($script);

		$attributes = 'onclick="loadAjax' . $this->id . '();return false;"';

		return $this->getButton($class, $attributes);
	}

	private function getButton($class = 'btn', $attributes = '')
	{
		$icon = $this->get('icon', '')
			? 'icon-' . $this->get('icon', '')
			: '';

		return
			'<button id="' . $this->id . '" class="' . $class . '"'
			. ' title="' . JText::_($this->get('description')) . '"'
			. ' ' . $attributes . '>'
			. '<span class="' . $icon . '"></span> '
			. '<span>' . JText::_($this->get('text', $this->get('label'))) . '</span>'
			. '</button>'
			. '<div id="message_' . $this->id . '"></div>';
	}
}
isinstalled.php000060400000001777152455357510007614 0ustar00<?php
/**
 * @package         Regular Labs Library
 * @version         21.4.10972
 * 
 * @author          Peter van Westen <info@regularlabs.com>
 * @link            http://www.regularlabs.com
 * @copyright       Copyright © 2021 Regular Labs All Rights Reserved
 * @license         http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
 */

defined('_JEXEC') or die;

use RegularLabs\Library\Extension as RL_Extension;

jimport('joomla.form.formfield');

if ( ! is_file(JPATH_LIBRARIES . '/regularlabs/autoload.php'))
{
	return;
}

require_once JPATH_LIBRARIES . '/regularlabs/autoload.php';

class JFormFieldRL_IsInstalled extends \RegularLabs\Library\Field
{
	public $type = 'IsInstalled';

	protected function getLabel()
	{
		return '';
	}

	protected function getInput()
	{
		$is_installed = RL_Extension::isInstalled($this->get('extension'), $this->get('extension_type'), $this->get('folder'));

		return '<input type="hidden" name="' . $this->name . '" id="' . $this->id . '" value="' . (int) $is_installed . '">';
	}
}
mijoshop.php000060400000006450152455357510007122 0ustar00<?php
/**
 * @package         Regular Labs Library
 * @version         21.4.10972
 * 
 * @author          Peter van Westen <info@regularlabs.com>
 * @link            http://www.regularlabs.com
 * @copyright       Copyright © 2021 Regular Labs All Rights Reserved
 * @license         http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
 */

defined('_JEXEC') or die;

if ( ! is_file(JPATH_LIBRARIES . '/regularlabs/autoload.php'))
{
	return;
}

require_once JPATH_LIBRARIES . '/regularlabs/autoload.php';

class JFormFieldRL_MijoShop extends \RegularLabs\Library\FieldGroup
{
	public $type        = 'MijoShop';
	public $store_id    = 0;
	public $language_id = 1;

	protected function getInput()
	{
		if ($error = $this->missingFilesOrTables(['categories' => 'category', 'products' => 'product']))
		{
			return $error;
		}

		if ( ! class_exists('MijoShop'))
		{
			require_once(JPATH_ROOT . '/components/com_mijoshop/mijoshop/mijoshop.php');
		}

		$this->store_id    = (int) MijoShop::get('opencart')->get('config')->get('config_store_id');
		$this->language_id = (int) MijoShop::get('opencart')->get('config')->get('config_language_id');

		return $this->getSelectList();
	}

	function getCategories()
	{
		$query = $this->db->getQuery(true)
			->select('COUNT(*)')
			->from('#__mijoshop_category AS c')
			->join('INNER', '#__mijoshop_category_description AS cd ON c.category_id = cd.category_id')
			->join('INNER', '#__mijoshop_category_to_store AS cts ON c.category_id = cts.category_id')
			->where('c.status = 1')
			->where('cd.language_id = ' . $this->language_id)
			->where('cts.store_id = ' . $this->store_id)
			->group('c.category_id');
		$this->db->setQuery($query);
		$total = $this->db->loadResult();

		if ($total > $this->max_list_count)
		{
			return -1;
		}

		$query->clear('select')
			->select('c.category_id AS id, c.parent_id, cd.name AS title, c.status AS published')
			->order('c.sort_order, cd.name');
		$this->db->setQuery($query);
		$items = $this->db->loadObjectList();

		return $this->getOptionsTreeByList($items);
	}

	function getProducts()
	{
		$query = $this->db->getQuery(true)
			->select('COUNT(*)')
			->from('#__mijoshop_product AS p')
			->join('INNER', '#__mijoshop_product_description AS pd ON p.product_id = pd.product_id')
			->join('INNER', '#__mijoshop_product_to_store AS pts ON p.product_id = pts.product_id')->where('p.status = 1')
			->where('p.date_available <= NOW()')
			->where('pd.language_id = ' . $this->language_id)
			->group('p.product_id');
		$this->db->setQuery($query);
		$total = $this->db->loadResult();

		if ($total > $this->max_list_count)
		{
			return -1;
		}

		$query->clear('select')
			->select('p.product_id as id, pd.name, p.model as model, cd.name AS cat, p.status AS published')
			->join('LEFT', '#__mijoshop_product_to_category AS ptc ON p.product_id = ptc.product_id')
			->join('LEFT', '#__mijoshop_category_description AS cd ON ptc.category_id = cd.category_id')
			->join('LEFT', '#__mijoshop_category_to_store AS cts ON ptc.category_id = cts.category_id')
			->where('cts.store_id = ' . $this->store_id)
			->where('cd.language_id = ' . $this->language_id)
			->where('cts.store_id = ' . $this->store_id)
			->order('pd.name, p.model');
		$this->db->setQuery($query);
		$list = $this->db->loadObjectList();

		return $this->getOptionsByList($list, ['model', 'cat', 'id']);
	}
}
accesslevel.php000060400000002726152455357510007565 0ustar00<?php
/**
 * @package     Joomla.Platform
 * @subpackage  Form
 *
 * @copyright   (C) 2009 Open Source Matters, Inc. <https://www.joomla.org>
 * @license     GNU General Public License version 2 or later; see LICENSE
 */

defined('JPATH_PLATFORM') or die;

JFormHelper::loadFieldClass('list');

/**
 * Form Field class for the Joomla Platform.
 * Provides a list of access levels. Access levels control what users in specific
 * groups can see.
 *
 * @see    JAccess
 * @since  1.7.0
 */
class JFormFieldAccessLevel extends JFormFieldList
{
	/**
	 * The form field type.
	 *
	 * @var    string
	 * @since  1.7.0
	 */
	protected $type = 'AccessLevel';

	/**
	 * Method to get the field input markup.
	 *
	 * @return  string  The field input markup.
	 *
	 * @since   1.7.0
	 */
	protected function getInput()
	{
		$attr = '';

		// Initialize some field attributes.
		$attr .= !empty($this->class) ? ' class="' . $this->class . '"' : '';
		$attr .= $this->disabled ? ' disabled' : '';
		$attr .= !empty($this->size) ? ' size="' . $this->size . '"' : '';
		$attr .= $this->multiple ? ' multiple' : '';
		$attr .= $this->required ? ' required aria-required="true"' : '';
		$attr .= $this->autofocus ? ' autofocus' : '';

		// Initialize JavaScript field attributes.
		$attr .= $this->onchange ? ' onchange="' . $this->onchange . '"' : '';

		// Get the field options.
		$options = $this->getOptions();

		return JHtml::_('access.level', $this->name, $this->value, $attr, $options, $this->id);
	}
}
akeebasubs.php000060400000002245152455357510007375 0ustar00<?php
/**
 * @package         Regular Labs Library
 * @version         21.4.10972
 * 
 * @author          Peter van Westen <info@regularlabs.com>
 * @link            http://www.regularlabs.com
 * @copyright       Copyright © 2021 Regular Labs All Rights Reserved
 * @license         http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
 */

defined('_JEXEC') or die;

if ( ! is_file(JPATH_LIBRARIES . '/regularlabs/autoload.php'))
{
	return;
}

require_once JPATH_LIBRARIES . '/regularlabs/autoload.php';

class JFormFieldRL_AkeebaSubs extends \RegularLabs\Library\FieldGroup
{
	public $type          = 'AkeebaSubs';
	public $default_group = 'Levels';

	protected function getInput()
	{
		if ($error = $this->missingFilesOrTables(['levels']))
		{
			return $error;
		}

		return $this->getSelectList();
	}

	function getLevels()
	{
		$query = $this->db->getQuery(true)
			->select('l.akeebasubs_level_id as id, l.title AS name, l.enabled as published')
			->from('#__akeebasubs_levels AS l')
			->where('l.enabled > -1')
			->order('l.title, l.akeebasubs_level_id');
		$this->db->setQuery($query);
		$list = $this->db->loadObjectList();

		return $this->getOptionsByList($list, ['id']);
	}
}
header_library.php000060400000003060152455357510010240 0ustar00<?php
/**
 * @package         Regular Labs Library
 * @version         21.4.10972
 * 
 * @author          Peter van Westen <info@regularlabs.com>
 * @link            http://www.regularlabs.com
 * @copyright       Copyright © 2021 Regular Labs All Rights Reserved
 * @license         http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
 */

defined('_JEXEC') or die;

use Joomla\CMS\Language\Text as JText;

require_once __DIR__ . '/header.php';

class JFormFieldRL_Header_Library extends JFormFieldRL_Header
{
	protected function getInput()
	{
		$extensions = [
			'Add to Menu',
			'Advanced Module Manager',
			'Advanced Template Manager',
			'Articles Anywhere',
			'Articles Field',
			'Better Preview',
			'Better Trash',
			'Cache Cleaner',
			'CDN for Joomla!',
			'Components Anywhere',
			'Conditional Content',
			'Content Templater',
			'DB Replacer',
			'Dummy Content',
			'Email Protector',
			'GeoIP',
			'IP Login',
			'Modals',
			'Modules Anywhere',
			'Quick Index',
			'Regular Labs Extension Manager',
			'ReReplacer',
			'Simple User Notes',
			'Sliders',
			'Snippets',
			'Sourcerer',
			'Tabs',
			'Tooltips',
			'What? Nothing!',
		];

		$list = '<ul><li>' . implode('</li><li>', $extensions) . '</li></ul>';

		$attributes = $this->element->attributes();

		$warning = '';
		if (isset($attributes['warning']))
		{
			$warning = '<div class="alert alert-danger">' . JText::_($attributes['warning']) . '</div>';
		}

		$this->element->attributes()['description'] = JText::sprintf($attributes['description'], $warning, $list);

		return parent::getInput();
	}
}
multiselect.php000060400000002271152455357510007621 0ustar00<?php
/**
 * @package         Regular Labs Library
 * @version         18.3.17810
 * 
 * @author          Peter van Westen <info@regularlabs.com>
 * @link            http://www.regularlabs.com
 * @copyright       Copyright © 2018 Regular Labs All Rights Reserved
 * @license         http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
 */

defined('_JEXEC') or die;

if ( ! is_file(JPATH_LIBRARIES . '/regularlabs/autoload.php'))
{
	return;
}

require_once JPATH_LIBRARIES . '/regularlabs/autoload.php';

class JFormFieldRL_MultiSelect extends \RegularLabs\Library\Field
{
	public $type = 'MultiSelect';

	protected function getInput()
	{
		$this->params = $this->element->attributes();

		if ( ! is_array($this->value))
		{
			$this->value = explode(',', $this->value);
		}

		foreach ($this->element->children() as $item)
		{
			$item_value    = (string) $item['value'];
			$item_name     = JText::_(trim((string) $item));
			$item_disabled = (int) $item['disabled'];
			$options[]     = JHtml::_('select.option', $item_value, $item_name, 'value', 'text', $item_disabled);
		}

		$size = (int) $this->get('size');

		return $this->selectList($options, $this->name, $this->value, $this->id, $size, true);
	}
}
components.php000060400000003164152455357510007456 0ustar00<?php
/**
 * @package     Joomla.Platform
 * @subpackage  Form
 *
 * @copyright   (C) 2017 Open Source Matters, Inc. <https://www.joomla.org>
 * @license     GNU General Public License version 2 or later; see LICENSE
 */

defined('JPATH_PLATFORM') or die;

use Joomla\Utilities\ArrayHelper;

JFormHelper::loadFieldClass('list');

/**
 * Form Field class for the Joomla Framework.
 *
 * @since  3.7.0
 */
class JFormFieldComponents extends JFormFieldList
{
	/**
	 * The form field type.
	 *
	 * @var     string
	 * @since   3.7.0
	 */
	protected $type = 'Components';

	/**
	 * Method to get a list of options for a list input.
	 *
	 * @return	array  An array of JHtml options.
	 *
	 * @since   2.5.0
	 */
	protected function getOptions()
	{
		$db    = JFactory::getDbo();
		$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 = JFactory::getLanguage();

			foreach ($items as &$item)
			{
				// Load language
				$extension = $item->value;

				$lang->load("$extension.sys", JPATH_ADMINISTRATOR, null, false, true)
					|| $lang->load("$extension.sys", JPATH_ADMINISTRATOR . '/components/' . $extension, null, false, true);

				// Translate component name
				$item->text = JText::_($item->text);
			}

			// Sort by component name
			$items = ArrayHelper::sortObjects($items, 'text', 1, true, true);
		}

		// Merge any additional options in the XML definition.
		$options = array_merge(parent::getOptions(), $items);

		return $options;
	}
}
toggler.php000060400000006077152455357510006742 0ustar00<?php
/**
 * @package         Regular Labs Library
 * @version         21.4.10972
 * 
 * @author          Peter van Westen <info@regularlabs.com>
 * @link            http://www.regularlabs.com
 * @copyright       Copyright © 2021 Regular Labs All Rights Reserved
 * @license         http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
 */

defined('_JEXEC') or die;

use Joomla\CMS\Factory as JFactory;
use Joomla\CMS\Form\FormField as JFormField;
use RegularLabs\Library\Document as RL_Document;
use RegularLabs\Library\RegEx as RL_RegEx;

if ( ! is_file(JPATH_LIBRARIES . '/regularlabs/autoload.php'))
{
	return;
}

require_once JPATH_LIBRARIES . '/regularlabs/autoload.php';

/**
 * @deprecated  2018-10-30  Use ShowOn instead
 */

/**
 * To use this, make a start xml param tag with the param and value set
 * And an end xml param tag without the param and value set
 * Everything between those tags will be included in the slide
 *
 * Available extra parameters:
 * param            The name of the reference parameter
 * value            a comma separated list of value on which to show the framework
 */
class JFormFieldRL_Toggler extends JFormField
{
	public $type = 'Toggler';

	protected function getLabel()
	{
		return '';
	}

	protected function getInput()
	{
		if ( ! is_file(JPATH_LIBRARIES . '/regularlabs/autoload.php'))
		{
			return null;
		}

		$field = new RLFieldToggler;

		return $field->getInput($this->element->attributes());
	}
}

class RLFieldToggler
{
	function getInput($params)
	{
		$this->params = $params;

		$option = JFactory::getApplication()->input->get('option');

		// do not place toggler stuff on JoomFish pages
		if ($option == 'com_joomfish')
		{
			return '';
		}

		$param  = $this->get('param');
		$value  = $this->get('value');
		$nofx   = $this->get('nofx');
		$method = $this->get('method');
		$div    = $this->get('div', 0);

		RL_Document::script('regularlabs/toggler.min.js');

		$param = RL_RegEx::replace('^\s*(.*?)\s*$', '\1', $param);
		$param = RL_RegEx::replace('\s*\|\s*', '|', $param);

		$html = [];
		if ( ! $param)
		{
			return '</div>';
		}

		$param      = RL_RegEx::replace('[^a-z0-9-\.\|\@]', '_', $param);
		$param      = str_replace('@', '_', $param);
		$set_groups = explode('|', $param);
		$set_values = explode('|', $value);
		$ids        = [];
		foreach ($set_groups as $i => $group)
		{
			$count = $i;
			if ($count >= count($set_values))
			{
				$count = 0;
			}
			$value = explode(',', $set_values[$count]);
			foreach ($value as $val)
			{
				$ids[] = $group . '.' . $val;
			}
		}

		if ( ! $div)
		{
			$html[] = '</div></div>';
		}

		$html[] = '<div id="' . rand(1000000, 9999999) . '___' . implode('___', $ids) . '" class="rl_toggler';
		if ($nofx)
		{
			$html[] = ' rl_toggler_nofx';
		}
		if ($method == 'and')
		{
			$html[] = ' rl_toggler_and';
		}
		$html[] = '">';

		if ( ! $div)
		{
			$html[] = '<div><div>';
		}

		return implode('', $html);
	}

	private function get($val, $default = '')
	{
		if ( ! isset($this->params[$val]) || (string) $this->params[$val] == '')
		{
			return $default;
		}

		return (string) $this->params[$val];
	}
}
zoo.php000060400000007226152455357510006103 0ustar00<?php
/**
 * @package         Regular Labs Library
 * @version         21.4.10972
 * 
 * @author          Peter van Westen <info@regularlabs.com>
 * @link            http://www.regularlabs.com
 * @copyright       Copyright © 2021 Regular Labs All Rights Reserved
 * @license         http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
 */

defined('_JEXEC') or die;

use Joomla\CMS\HTML\HTMLHelper as JHtml;
use Joomla\CMS\Language\Text as JText;
use RegularLabs\Library\Form as RL_Form;

if ( ! is_file(JPATH_LIBRARIES . '/regularlabs/autoload.php'))
{
	return;
}

require_once JPATH_LIBRARIES . '/regularlabs/autoload.php';

class JFormFieldRL_Zoo extends \RegularLabs\Library\FieldGroup
{
	public $type = 'Zoo';

	protected function getInput()
	{
		if ($error = $this->missingFilesOrTables(['applications' => 'application', 'categories' => 'category', 'items' => 'item']))
		{
			return $error;
		}

		return $this->getSelectList();
	}

	function getCategories()
	{
		$query = $this->db->getQuery(true)
			->select('COUNT(*)')
			->from('#__zoo_category AS c')
			->where('c.published > -1');
		$this->db->setQuery($query);
		$total = $this->db->loadResult();

		if ($total > $this->max_list_count)
		{
			return -1;
		}

		$options = [];
		if ($this->get('show_ignore'))
		{
			if (in_array('-1', $this->value))
			{
				$this->value = ['-1'];
			}
			$options[] = JHtml::_('select.option', '-1', '- ' . JText::_('RL_IGNORE') . ' -');
			$options[] = JHtml::_('select.option', '-', '&nbsp;', 'value', 'text', true);
		}

		$query->clear()
			->select('a.id, a.name')
			->from('#__zoo_application AS a')
			->order('a.name, a.id');
		$this->db->setQuery($query);
		$apps = $this->db->loadObjectList();

		foreach ($apps as $i => $app)
		{
			$query->clear()
				->select('c.id, c.parent AS parent_id, c.name AS title, c.published')
				->from('#__zoo_category AS c')
				->where('c.application_id = ' . (int) $app->id)
				->where('c.published > -1')
				->order('c.ordering, c.name');
			$this->db->setQuery($query);
			$items = $this->db->loadObjectList();

			if ($i)
			{
				$options[] = JHtml::_('select.option', '-', '&nbsp;', 'value', 'text', true);
			}

			// establish the hierarchy of the menu
			// TODO: use node model
			$children = [];

			if ($items)
			{
				// first pass - collect children
				foreach ($items as $v)
				{
					$pt   = $v->parent_id;
					$list = @$children[$pt] ? $children[$pt] : [];
					array_push($list, $v);
					$children[$pt] = $list;
				}
			}

			// second pass - get an indent list of the items
			$list = JHtml::_('menu.treerecurse', 0, '', [], $children, 9999, 0, 0);

			// assemble items to the array
			$options[] = JHtml::_('select.option', 'app' . $app->id, '[' . $app->name . ']');
			foreach ($list as $item)
			{
				$item->treename = '  ' . str_replace('&#160;&#160;- ', '  ', $item->treename);
				$item->treename = RL_Form::prepareSelectItem($item->treename, $item->published);
				$option         = JHtml::_('select.option', $item->id, $item->treename);
				$option->level  = 1;
				$options[]      = $option;
			}
		}

		return $options;
	}

	function getItems()
	{
		$query = $this->db->getQuery(true)
			->select('COUNT(*)')
			->from('#__zoo_item AS i')
			->where('i.state > -1');
		$this->db->setQuery($query);
		$total = $this->db->loadResult();

		if ($total > $this->max_list_count)
		{
			return -1;
		}

		$query->clear('select')
			->select('i.id, i.name, a.name as cat, i.state as published')
			->join('LEFT', '#__zoo_application AS a ON a.id = i.application_id')
			->group('i.id')
			->order('i.name, i.priority, i.id');
		$this->db->setQuery($query);
		$list = $this->db->loadObjectList();

		return $this->getOptionsByList($list, ['cat', 'id']);
	}
}
languages.php000060400000003363152455357510007240 0ustar00<?php
/**
 * @package         Regular Labs Library
 * @version         21.4.10972
 * 
 * @author          Peter van Westen <info@regularlabs.com>
 * @link            http://www.regularlabs.com
 * @copyright       Copyright © 2021 Regular Labs All Rights Reserved
 * @license         http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
 */

defined('_JEXEC') or die;

use Joomla\CMS\HTML\HTMLHelper as JHtml;
use Joomla\Registry\Registry;

if ( ! is_file(JPATH_LIBRARIES . '/regularlabs/autoload.php'))
{
	return;
}

require_once JPATH_LIBRARIES . '/regularlabs/autoload.php';

class JFormFieldRL_Languages extends \RegularLabs\Library\Field
{
	public $type = 'Languages';

	protected function getInput()
	{
		$size     = (int) $this->get('size');
		$multiple = $this->get('multiple');

		return $this->selectListSimpleAjax(
			$this->type, $this->name, $this->value, $this->id,
			compact('size', 'multiple')
		);
	}

	function getAjaxRaw(Registry $attributes)
	{
		$name     = $attributes->get('name', $this->type);
		$id       = $attributes->get('id', strtolower($name));
		$value    = $attributes->get('value', []);
		$size     = $attributes->get('size');
		$multiple = $attributes->get('multiple');

		$options = $this->getLanguages($value);

		return $this->selectListSimple($options, $name, $value, $id, $size, $multiple);
	}

	function getLanguages($value)
	{
		$langs = JHtml::_('contentlanguage.existing');

		if ( ! is_array($value))
		{
			$value = [$value];
		}

		$options = [];

		foreach ($langs as $lang)
		{
			if (empty($lang->value))
			{
				continue;
			}

			$options[] = (object) [
				'value'    => $lang->value,
				'text'     => $lang->text . ' [' . $lang->value . ']',
				'selected' => in_array($lang->value, $value),
			];
		}

		return $options;
	}
}
list.php000060400000016417152455357510006251 0ustar00<?php
/**
 * @package     Joomla.Platform
 * @subpackage  Form
 *
 * @copyright   (C) 2009 Open Source Matters, Inc. <https://www.joomla.org>
 * @license     GNU General Public License version 2 or later; see LICENSE
 */

defined('JPATH_PLATFORM') or die;

/**
 * Form Field class for the Joomla Platform.
 * Supports a generic list of options.
 *
 * @since  1.7.0
 */
class JFormFieldList extends JFormField
{
	/**
	 * The form field type.
	 *
	 * @var    string
	 * @since  1.7.0
	 */
	protected $type = 'List';

	/**
	 * Method to get the field input markup for a generic list.
	 * Use the multiple attribute to enable multiselect.
	 *
	 * @return  string  The field input markup.
	 *
	 * @since   3.7.0
	 */
	protected function getInput()
	{
		$html = array();
		$attr = '';

		// Initialize some field attributes.
		$attr .= !empty($this->class) ? ' class="' . $this->class . '"' : '';
		$attr .= !empty($this->size) ? ' size="' . $this->size . '"' : '';
		$attr .= $this->multiple ? ' multiple' : '';
		$attr .= $this->required ? ' required aria-required="true"' : '';
		$attr .= $this->autofocus ? ' autofocus' : '';

		// To avoid user's confusion, readonly="true" should imply disabled="true".
		if ((string) $this->readonly == '1' || (string) $this->readonly == 'true' || (string) $this->disabled == '1'|| (string) $this->disabled == 'true')
		{
			$attr .= ' disabled="disabled"';
		}

		// Initialize JavaScript field attributes.
		$attr .= $this->onchange ? ' onchange="' . $this->onchange . '"' : '';

		// Get the field options.
		$options = (array) $this->getOptions();

		// Create a read-only list (no name) with hidden input(s) to store the value(s).
		if ((string) $this->readonly == '1' || (string) $this->readonly == 'true')
		{
			$html[] = JHtml::_('select.genericlist', $options, '', trim($attr), 'value', 'text', $this->value, $this->id);

			// E.g. form field type tag sends $this->value as array
			if ($this->multiple && is_array($this->value))
			{
				if (!count($this->value))
				{
					$this->value[] = '';
				}

				foreach ($this->value as $value)
				{
					$html[] = '<input type="hidden" name="' . $this->name . '" value="' . htmlspecialchars($value, ENT_COMPAT, 'UTF-8') . '"/>';
				}
			}
			else
			{
				$html[] = '<input type="hidden" name="' . $this->name . '" value="' . htmlspecialchars($this->value, ENT_COMPAT, 'UTF-8') . '"/>';
			}
		}
		else
		// Create a regular list passing the arguments in an array.
		{
			$listoptions = array();
			$listoptions['option.key'] = 'value';
			$listoptions['option.text'] = 'text';
			$listoptions['list.select'] = $this->value;
			$listoptions['id'] = $this->id;
			$listoptions['list.translate'] = false;
			$listoptions['option.attr'] = 'optionattr';
			$listoptions['list.attr'] = trim($attr);

			$html[] = JHtml::_('select.genericlist', $options, $this->name, $listoptions);
		}

		return implode($html);
	}

	/**
	 * Method to get the field options.
	 *
	 * @return  array  The field option objects.
	 *
	 * @since   3.7.0
	 */
	protected function getOptions()
	{
		$fieldname = preg_replace('/[^a-zA-Z0-9_\-]/', '_', $this->fieldname);
		$options   = array();

		foreach ($this->element->xpath('option') as $option)
		{
			// Filter requirements
			if ($requires = explode(',', (string) $option['requires']))
			{
				// Requires multilanguage
				if (in_array('multilanguage', $requires) && !JLanguageMultilang::isEnabled())
				{
					continue;
				}

				// Requires associations
				if (in_array('associations', $requires) && !JLanguageAssociations::isEnabled())
				{
					continue;
				}

				// Requires adminlanguage
				if (in_array('adminlanguage', $requires) && !JModuleHelper::isAdminMultilang())
				{
					continue;
				}

				// Requires vote plugin
				if (in_array('vote', $requires) && !JPluginHelper::isEnabled('content', 'vote'))
				{
					continue;
				}
			}

			$value = (string) $option['value'];
			$text  = trim((string) $option) != '' ? trim((string) $option) : $value;

			$disabled = (string) $option['disabled'];
			$disabled = ($disabled == 'true' || $disabled == 'disabled' || $disabled == '1');
			$disabled = $disabled || ($this->readonly && $value != $this->value);

			$checked = (string) $option['checked'];
			$checked = ($checked == 'true' || $checked == 'checked' || $checked == '1');

			$selected = (string) $option['selected'];
			$selected = ($selected == 'true' || $selected == 'selected' || $selected == '1');

			$tmp = array(
					'value'    => $value,
					'text'     => JText::alt($text, $fieldname),
					'disable'  => $disabled,
					'class'    => (string) $option['class'],
					'selected' => ($checked || $selected),
					'checked'  => ($checked || $selected),
			);

			// Set some event handler attributes. But really, should be using unobtrusive js.
			$tmp['onclick']  = (string) $option['onclick'];
			$tmp['onchange'] = (string) $option['onchange'];

			if ((string) $option['showon'])
			{
				$tmp['optionattr'] = " data-showon='" .
					json_encode(
						JFormHelper::parseShowOnConditions((string) $option['showon'], $this->formControl, $this->group)
						)
					. "'";
			}
			// Add the option object to the result set.
			$options[] = (object) $tmp;
		}

		if ($this->element['useglobal'])
		{
			$tmp        = new stdClass;
			$tmp->value = '';
			$tmp->text  = JText::_('JGLOBAL_USE_GLOBAL');
			$component  = JFactory::getApplication()->input->getCmd('option');

			// Get correct component for menu items
			if ($component == 'com_menus')
			{
				$link      = $this->form->getData()->get('link');
				$uri       = new JUri($link);
				$component = $uri->getVar('option', 'com_menus');
			}

			$params = JComponentHelper::getParams($component);
			$value  = $params->get($this->fieldname);

			// Try with global configuration
			if (is_null($value))
			{
				$value = JFactory::getConfig()->get($this->fieldname);
			}

			// Try with menu configuration
			if (is_null($value) && JFactory::getApplication()->input->getCmd('option') == 'com_menus')
			{
				$value = JComponentHelper::getParams('com_menus')->get($this->fieldname);
			}

			if (!is_null($value))
			{
				$value = (string) $value;

				foreach ($options as $option)
				{
					if ($option->value === $value)
					{
						$value = $option->text;

						break;
					}
				}

				$tmp->text = JText::sprintf('JGLOBAL_USE_GLOBAL_VALUE', $value);
			}

			array_unshift($options, $tmp);
		}

		reset($options);

		return $options;
	}

	/**
	 * Method to add an option to the list field.
	 *
	 * @param   string  $text        Text/Language variable of the option.
	 * @param   array   $attributes  Array of attributes ('name' => 'value' format)
	 *
	 * @return  JFormFieldList  For chaining.
	 *
	 * @since   3.7.0
	 */
	public function addOption($text, $attributes = array())
	{
		if ($text && $this->element instanceof SimpleXMLElement)
		{
			$child = $this->element->addChild('option', $text);

			foreach ($attributes as $name => $value)
			{
				$child->addAttribute($name, $value);
			}
		}

		return $this;
	}

	/**
	 * Method to get certain otherwise inaccessible properties from the form field object.
	 *
	 * @param   string  $name  The property name for which to get the value.
	 *
	 * @return  mixed  The property value or null.
	 *
	 * @since   3.7.0
	 */
	public function __get($name)
	{
		if ($name == 'options')
		{
			return $this->getOptions();
		}

		return parent::__get($name);
	}
}
plaintext.php000060400000002360152455357510007276 0ustar00<?php
/**
 * @package         Regular Labs Library
 * @version         21.4.10972
 * 
 * @author          Peter van Westen <info@regularlabs.com>
 * @link            http://www.regularlabs.com
 * @copyright       Copyright © 2021 Regular Labs All Rights Reserved
 * @license         http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
 */

defined('_JEXEC') or die;

if ( ! is_file(JPATH_LIBRARIES . '/regularlabs/autoload.php'))
{
	return;
}

require_once JPATH_LIBRARIES . '/regularlabs/autoload.php';

class JFormFieldRL_PlainText extends \RegularLabs\Library\Field
{
	public $type = 'PlainText';

	protected function getLabel()
	{
		$label   = $this->prepareText($this->get('label'));
		$tooltip = $this->prepareText($this->get('description'));

		if ( ! $label && ! $tooltip)
		{
			return '';
		}

		if ( ! $label)
		{
			return '<div>' . $tooltip . '</div>';
		}

		if ( ! $tooltip)
		{
			return '<div>' . $label . '</div>';
		}

		return '<label class="hasPopover" title="' . $label . '" data-content="' . htmlentities($tooltip) . '">'
			. $label . '</label>';
	}

	protected function getInput()
	{
		$text = $this->prepareText($this->value);

		if ( ! $text)
		{
			return '';
		}

		return '<fieldset class="rl_plaintext">' . $text . '</fieldset>';
	}
}
k2.php000060400000006147152455357510005611 0ustar00<?php
/**
 * @package         Regular Labs Library
 * @version         21.4.10972
 * 
 * @author          Peter van Westen <info@regularlabs.com>
 * @link            http://www.regularlabs.com
 * @copyright       Copyright © 2021 Regular Labs All Rights Reserved
 * @license         http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
 */

defined('_JEXEC') or die;

if ( ! is_file(JPATH_LIBRARIES . '/regularlabs/autoload.php'))
{
	return;
}

require_once JPATH_LIBRARIES . '/regularlabs/autoload.php';

// If controller.php exists, assume this is K2 v3
defined('RL_K2_VERSION') or define('RL_K2_VERSION', file_exists(JPATH_ADMINISTRATOR . '/components/com_k2/controller.php') ? 3 : 2);

class JFormFieldRL_K2 extends \RegularLabs\Library\FieldGroup
{
	public $type = 'K2';

	protected function getInput()
	{
		if ($error = $this->missingFilesOrTables(['categories', 'items', 'tags']))
		{
			return $error;
		}

		return $this->getSelectList();
	}

	function getCategories()
	{
		$state_field = RL_K2_VERSION == 3 ? 'state' : 'published';

		$query = $this->db->getQuery(true)
			->select('COUNT(*)')
			->from('#__k2_categories AS c')
			->where('c.' . $state_field . ' > -1');
		$this->db->setQuery($query);
		$total = $this->db->loadResult();

		if ($total > $this->max_list_count)
		{
			return -1;
		}

		$parent_field   = RL_K2_VERSION == 3 ? 'parent_id' : 'parent';
		$title_field    = RL_K2_VERSION == 3 ? 'title' : 'name';
		$ordering_field = RL_K2_VERSION == 3 ? 'lft' : 'ordering';

		$query->clear('select')
			->select('c.id, c.' . $parent_field . ' AS parent_id, c.' . $title_field . ' AS title, c.' . $state_field . ' AS published');
		if ( ! $this->get('getcategories', 1))
		{
			$query->where('c.' . $parent_field . ' = 0');
		}
		$query->order('c.' . $ordering_field . ', c.' . $title_field);
		$this->db->setQuery($query);
		$items = $this->db->loadObjectList();

		return $this->getOptionsTreeByList($items);
	}

	function getTags()
	{
		$state_field = RL_K2_VERSION == 3 ? 'state' : 'published';

		$query = $this->db->getQuery(true)
			->select('t.name as id, t.name as name')
			->from('#__k2_tags AS t')
			->where('t.' . $state_field . ' = 1')
			->where('t.name != ' . $this->db->quote(''))
			->group('t.name')
			->order('t.name');
		$this->db->setQuery($query);
		$list = $this->db->loadObjectList();

		return $this->getOptionsByList($list);
	}

	function getItems()
	{
		$state_field = RL_K2_VERSION == 3 ? 'state' : 'published';

		$query = $this->db->getQuery(true)
			->select('COUNT(*)')
			->from('#__k2_items AS i')
			->where('i.' . $state_field . ' > -1');
		$this->db->setQuery($query);
		$total = $this->db->loadResult();

		if ($total > $this->max_list_count)
		{
			return -1;
		}

		$cat_title_field = RL_K2_VERSION == 3 ? 'title' : 'name';

		$query->clear('select')
			->select('i.id, i.title as name, c.' . $cat_title_field . ' as cat, i.' . $state_field . ' as published')
			->join('LEFT', '#__k2_categories AS c ON c.id = i.catid')
			->group('i.id')
			->order('i.title, i.ordering, i.id');
		$this->db->setQuery($query);
		$list = $this->db->loadObjectList();

		return $this->getOptionsByList($list, ['cat', 'id']);
	}
}
form2content.php000060400000002172152455357510007707 0ustar00<?php
/**
 * @package         Regular Labs Library
 * @version         21.4.10972
 * 
 * @author          Peter van Westen <info@regularlabs.com>
 * @link            http://www.regularlabs.com
 * @copyright       Copyright © 2021 Regular Labs All Rights Reserved
 * @license         http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
 */

defined('_JEXEC') or die;

if ( ! is_file(JPATH_LIBRARIES . '/regularlabs/autoload.php'))
{
	return;
}

require_once JPATH_LIBRARIES . '/regularlabs/autoload.php';

class JFormFieldRL_Form2Content extends \RegularLabs\Library\FieldGroup
{
	public $type          = 'Form2Content';
	public $default_group = 'Projects';

	protected function getInput()
	{
		if ($error = $this->missingFilesOrTables(['projects' => 'project'], '', 'f2c'))
		{
			return $error;
		}

		return $this->getSelectList();
	}

	function getProjects()
	{
		$query = $this->db->getQuery(true)
			->select('t.id, t.title as name')
			->from('#__f2c_project AS t')
			->where('t.published = 1')
			->order('t.title, t.id');
		$this->db->setQuery($query);
		$list = $this->db->loadObjectList();

		return $this->getOptionsByList($list);
	}
}
subform.php000060400000022156152455357510006750 0ustar00<?php
/**
 * @package     Joomla.Platform
 * @subpackage  Form
 *
 * @copyright   (C) 2016 Open Source Matters, Inc. <https://www.joomla.org>
 * @license     GNU General Public License version 2 or later; see LICENSE
 */

defined('JPATH_PLATFORM') or die;

use Joomla\CMS\Form\Form;

jimport('joomla.filesystem.path');

/**
 * The Field to load the form inside current form
 *
 * @Example with all attributes:
 * 	<field name="field-name" type="subform"
 * 		formsource="path/to/form.xml" min="1" max="3" multiple="true" buttons="add,remove,move"
 * 		layout="joomla.form.field.subform.repeatable-table" groupByFieldset="false" component="com_example" client="site"
 * 		label="Field Label" description="Field Description" />
 *
 * @since  3.6
 */
class JFormFieldSubform extends JFormField
{
	/**
	 * The form field type.
	 * @var    string
	 */
	protected $type = 'Subform';

	/**
	 * Form source
	 * @var string
	 */
	protected $formsource;

	/**
	 * Minimum items in repeat mode
	 * @var int
	 */
	protected $min = 0;

	/**
	 * Maximum items in repeat mode
	 * @var int
	 */
	protected $max = 1000;

	/**
	 * Layout to render the form
	 * @var  string
	 */
	protected $layout = 'joomla.form.field.subform.default';

	/**
	 * Whether group subform fields by it`s fieldset
	 * @var boolean
	 */
	protected $groupByFieldset = false;

	/**
	 * Which buttons to show in miltiple mode
	 * @var array $buttons
	 */
	protected $buttons = array('add' => true, 'remove' => true, 'move' => true);

	/**
	 * Method to get certain otherwise inaccessible properties from the form field object.
	 *
	 * @param   string  $name  The property name for which to get the value.
	 *
	 * @return  mixed  The property value or null.
	 *
	 * @since   3.6
	 */
	public function __get($name)
	{
		switch ($name)
		{
			case 'formsource':
			case 'min':
			case 'max':
			case 'layout':
			case 'groupByFieldset':
			case 'buttons':
				return $this->$name;
		}

		return parent::__get($name);
	}

	/**
	 * Method to set certain otherwise inaccessible properties of the form field object.
	 *
	 * @param   string  $name   The property name for which to set the value.
	 * @param   mixed   $value  The value of the property.
	 *
	 * @return  void
	 *
	 * @since   3.6
	 */
	public function __set($name, $value)
	{
		switch ($name)
		{
			case 'formsource':
				$this->formsource = (string) $value;

				// Add root path if we have a path to XML file
				if (strrpos($this->formsource, '.xml') === strlen($this->formsource) - 4)
				{
					$this->formsource = JPath::clean(JPATH_ROOT . '/' . $this->formsource);
				}

				break;

			case 'min':
				$this->min = (int) $value;
				break;

			case 'max':
				if ($value)
				{
					$this->max = max(1, (int) $value);
				}
				break;

			case 'groupByFieldset':
				if ($value !== null)
				{
					$value = (string) $value;
					$this->groupByFieldset = !($value === 'false' || $value === 'off' || $value === '0');
				}
				break;

			case 'layout':
				$this->layout = (string) $value;

				// Make sure the layout is not empty.
				if (!$this->layout)
				{
					// Set default value depend from "multiple" mode
					$this->layout = !$this->multiple ? 'joomla.form.field.subform.default' : 'joomla.form.field.subform.repeatable';
				}

				break;

			case 'buttons':

				if (!$this->multiple)
				{
					$this->buttons = array();
					break;
				}

				if ($value && !is_array($value))
				{
					$value = explode(',', (string) $value);
					$value = array_fill_keys(array_filter($value), true);
				}

				if ($value)
				{
					$value = array_merge(array('add' => false, 'remove' => false, 'move' => false), $value);
					$this->buttons = $value;
				}

				break;

			default:
				parent::__set($name, $value);
		}
	}

	/**
	 * Method to attach a JForm object to the field.
	 *
	 * @param   SimpleXMLElement  $element  The SimpleXMLElement object representing the <field /> tag for the form field object.
	 * @param   mixed             $value    The form field value to validate.
	 * @param   string            $group    The field name group control value.
	 *
	 * @return  boolean  True on success.
	 *
	 * @since   3.6
	 */
	public function setup(SimpleXMLElement $element, $value, $group = null)
	{
		if (!parent::setup($element, $value, $group))
		{
			return false;
		}

		foreach (array('formsource', 'min', 'max', 'layout', 'groupByFieldset', 'buttons') as $attributeName)
		{
			$this->__set($attributeName, $element[$attributeName]);
		}

		if ($this->value && is_string($this->value))
		{
			// Guess here is the JSON string from 'default' attribute
			$this->value = json_decode($this->value, true);
		}

		if (!$this->formsource && $element->form)
		{
			// Set the formsource parameter from the content of the node
			$this->formsource = $element->form->saveXML();
		}

		return true;
	}

	/**
	 * Method to get the field input markup.
	 *
	 * @return  string  The field input markup.
	 *
	 * @since   3.6
	 */
	protected function getInput()
	{
		// Prepare data for renderer
		$data    = parent::getLayoutData();
		$tmpl    = null;
		$control = $this->name;

		try
		{
			$tmpl  = $this->loadSubForm();
			$forms = $this->loadSubFormData($tmpl);
		}
		catch (Exception $e)
		{
			return $e->getMessage();
		}

		$data['tmpl']      = $tmpl;
		$data['forms']     = $forms;
		$data['min']       = $this->min;
		$data['max']       = $this->max;
		$data['control']   = $control;
		$data['buttons']   = $this->buttons;
		$data['fieldname'] = $this->fieldname;
		$data['groupByFieldset'] = $this->groupByFieldset;

		/**
		 * For each rendering process of a subform element, we want to have a
		 * separate unique subform id present to could distinguish the eventhandlers
		 * regarding adding/moving/removing rows from nested subforms from their parents.
		 */
		static $unique_subform_id = 0;
		$data['unique_subform_id'] = ('sr-' . ($unique_subform_id++));

		// Prepare renderer
		$renderer = $this->getRenderer($this->layout);

		// Allow to define some JLayout options as attribute of the element
		if ($this->element['component'])
		{
			$renderer->setComponent((string) $this->element['component']);
		}

		if ($this->element['client'])
		{
			$renderer->setClient((string) $this->element['client']);
		}

		// Render
		$html = $renderer->render($data);

		// Add hidden input on front of the subform inputs, in multiple mode
		// for allow to submit an empty value
		if ($this->multiple)
		{
			$html = '<input name="' . $this->name . '" type="hidden" value="" />' . $html;
		}

		return $html;
	}

	/**
	 * Method to get the name used for the field input tag.
	 *
	 * @param   string  $fieldName  The field element name.
	 *
	 * @return  string  The name to be used for the field input tag.
	 *
	 * @since   3.6
	 */
	protected function getName($fieldName)
	{
		$name = '';

		// If there is a form control set for the attached form add it first.
		if ($this->formControl)
		{
			$name .= $this->formControl;
		}

		// If the field is in a group add the group control to the field name.
		if ($this->group)
		{
			// If we already have a name segment add the group control as another level.
			$groups = explode('.', $this->group);

			if ($name)
			{
				foreach ($groups as $group)
				{
					$name .= '[' . $group . ']';
				}
			}
			else
			{
				$name .= array_shift($groups);

				foreach ($groups as $group)
				{
					$name .= '[' . $group . ']';
				}
			}
		}

		// If we already have a name segment add the field name as another level.
		if ($name)
		{
			$name .= '[' . $fieldName . ']';
		}
		else
		{
			$name .= $fieldName;
		}

		return $name;
	}

	/**
	 * Loads the form instance for the subform.
	 *
	 * @return  Form  The form instance.
	 *
	 * @throws  InvalidArgumentException if no form provided.
	 * @throws  RuntimeException if the form could not be loaded.
	 *
	 * @since   3.9.7
	 */
	public function loadSubForm()
	{
		$control = $this->name;

		if ($this->multiple)
		{
			$control .= '[' . $this->fieldname . 'X]';
		}

		// Prepare the form template
		$formname = 'subform.' . str_replace(array('jform[', '[', ']'), array('', '.', ''), $this->name);
		$tmpl     = Form::getInstance($formname, $this->formsource, array('control' => $control));

		return $tmpl;
	}

	/**
	 * Binds given data to the subform and its elements.
	 *
	 * @param   Form  &$subForm  Form instance of the subform.
	 *
	 * @return  Form[]  Array of Form instances for the rows.
	 *
	 * @since   3.9.7
	 */
	private function loadSubFormData(Form &$subForm)
	{
		$value = $this->value ? (array) $this->value : array();
		
		// Simple form, just bind the data and return one row.
		if (!$this->multiple)
		{
			$subForm->bind($value);
			return array($subForm);
		}
		
		// Multiple rows possible: Construct array and bind values to their respective forms.
		$forms = array();
		$value = array_values($value);
		
		// Show as many rows as we have values, but at least min and at most max.
		$c = max($this->min, min(count($value), $this->max));

		for ($i = 0; $i < $c; $i++)
		{
			$control  = $this->name . '[' . $this->fieldname . $i . ']';
			$itemForm = Form::getInstance($subForm->getName() . $i, $this->formsource, array('control' => $control));

			if (!empty($value[$i]))
			{
				$itemForm->bind($value[$i]);
			}

			$forms[] = $itemForm;
		}

		return $forms;
	}
}
templates.php000060400000006152152455357510007267 0ustar00<?php
/**
 * @package         Regular Labs Library
 * @version         21.4.10972
 * 
 * @author          Peter van Westen <info@regularlabs.com>
 * @link            http://www.regularlabs.com
 * @copyright       Copyright © 2021 Regular Labs All Rights Reserved
 * @license         http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
 */

defined('_JEXEC') or die;

use Joomla\CMS\Factory as JFactory;
use Joomla\CMS\HTML\HTMLHelper as JHtml;
use Joomla\CMS\Language\Text as JText;
use Joomla\Registry\Registry;

if ( ! is_file(JPATH_LIBRARIES . '/regularlabs/autoload.php'))
{
	return;
}

require_once JPATH_LIBRARIES . '/regularlabs/autoload.php';

class JFormFieldRL_Templates extends \RegularLabs\Library\Field
{
	public $type = 'Templates';

	protected function getInput()
	{
		// fix old '::' separator and change it to '--'
		$value = json_encode($this->value);
		$value = str_replace('::', '--', $value);
		$value = (array) json_decode($value, true);

		$size     = (int) $this->get('size');
		$multiple = $this->get('multiple');

		return $this->selectListAjax(
			$this->type, $this->name, $value, $this->id,
			compact('size', 'multiple')
		);
	}

	function getAjaxRaw(Registry $attributes)
	{
		$name     = $attributes->get('name', $this->type);
		$id       = $attributes->get('id', strtolower($name));
		$value    = $attributes->get('value', []);
		$size     = $attributes->get('size');
		$multiple = $attributes->get('multiple');

		$options = $this->getOptions();

		return $this->selectList($options, $name, $value, $id, $size, $multiple);
	}

	protected function getOptions()
	{
		$options = [];

		$templates = $this->getTemplates();

		foreach ($templates as $styles)
		{
			$level = 0;
			foreach ($styles as $style)
			{
				$style->level = $level;
				$options[]    = $style;

				if (count($styles) <= 2)
				{
					break;
				}

				$level = 1;
			}
		}

		return $options;
	}

	protected function getTemplates()
	{
		$groups = [];
		$lang   = JFactory::getLanguage();

		// Get the database object and a new query object.
		$db    = JFactory::getDbo();
		$query = $db->getQuery(true)
			->select('s.id, s.title, e.name as name, s.template')
			->from('#__template_styles as s')
			->where('s.client_id = 0')
			->join('LEFT', '#__extensions as e on e.element=s.template')
			->where('e.enabled=1')
			->where($db->quoteName('e.type') . '=' . $db->quote('template'))
			->order('s.template')
			->order('s.title');

		// Set the query and load the styles.
		$db->setQuery($query);
		$styles = $db->loadObjectList();

		// Build the grouped list array.
		if ($styles)
		{
			foreach ($styles as $style)
			{
				$template = $style->template;
				$lang->load('tpl_' . $template . '.sys', JPATH_SITE)
				|| $lang->load('tpl_' . $template . '.sys', JPATH_SITE . '/templates/' . $template);
				$name = JText::_($style->name);

				// Initialize the group if necessary.
				if ( ! isset($groups[$template]))
				{
					$groups[$template]   = [];
					$groups[$template][] = JHtml::_('select.option', $template, $name);
				}

				$groups[$template][] = JHtml::_('select.option', $template . '--' . $style->id, $style->title);
			}
		}

		return $groups;
	}
}
redshop.php000060400000006227152455357510006740 0ustar00<?php
/**
 * @package         Regular Labs Library
 * @version         21.4.10972
 * 
 * @author          Peter van Westen <info@regularlabs.com>
 * @link            http://www.regularlabs.com
 * @copyright       Copyright © 2021 Regular Labs All Rights Reserved
 * @license         http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
 */

defined('_JEXEC') or die;

use RegularLabs\Library\DB as RL_DB;

if ( ! is_file(JPATH_LIBRARIES . '/regularlabs/autoload.php'))
{
	return;
}

require_once JPATH_LIBRARIES . '/regularlabs/autoload.php';

class JFormFieldRL_RedShop extends \RegularLabs\Library\FieldGroup
{
	public $type = 'RedShop';

	protected function getInput()
	{
		if ($error = $this->missingFilesOrTables(['categories' => 'category', 'products' => 'product']))
		{
			return $error;
		}

		return $this->getSelectList();
	}

	function getCategories()
	{
		$query = $this->db->getQuery(true)
			->select('COUNT(*)')
			->from('#__redshop_category AS c')
			->where('c.published > -1');
		$this->db->setQuery($query);
		$total = $this->db->loadResult();

		if ($total > $this->max_list_count)
		{
			return -1;
		}

		$this->db->setQuery($this->getCategoriesQuery());
		$items = $this->db->loadObjectList();

		return $this->getOptionsTreeByList($items);
	}

	function getProducts()
	{
		$query = $this->db->getQuery(true)
			->select('COUNT(*)')
			->from('#__redshop_product AS p')
			->where('p.published > -1');
		$this->db->setQuery($query);
		$total = $this->db->loadResult();

		if ($total > $this->max_list_count)
		{
			return -1;
		}

		$this->db->setQuery($this->getProductsQuery());
		$list = $this->db->loadObjectList();

		return $this->getOptionsByList($list, ['number', 'cat']);
	}

	private function getCategoriesQuery()
	{
		$query = $this->db->getQuery(true)
			->select('c.id, c.parent_id, c.name AS title, c.published')
			->from('#__redshop_category AS c')
			->where('c.published > -1');

		if (RL_DB::tableExists('redshop_category_xref'))
		{
			$query->clear('select')
				->select('c.category_id as id, x.category_parent_id AS parent_id, c.category_name AS title, c.published')
				->join('LEFT', '#__redshop_category_xref AS x ON x.category_child_id = c.category_id')
				->group('c.category_id')
				->order('c.ordering, c.category_name');

			return $query;
		}

		$query
			->group('c.id')
			->order('c.ordering, c.name');

		return $query;
	}

	private function getProductsQuery()
	{
		$query = $this->db->getQuery(true)
			->select('p.product_id as id, p.product_name AS name, p.product_number as number, c.name AS cat, p.published')
			->from('#__redshop_product AS p')
			->where('p.published > -1')
			->join('LEFT', '#__redshop_product_category_xref AS x ON x.product_id = p.product_id')
			->group('p.product_id')
			->order('p.product_name, p.product_number');

		if (RL_DB::tableExists('redshop_category_xref'))
		{
			$query->clear('select')
				->select('p.product_id as id, p.product_name AS name, p.product_number as number, c.category_name AS cat, p.published')
				->join('LEFT', '#__redshop_category AS c ON c.category_id = x.category_id');

			return $query;
		}

		$query
			->join('LEFT', '#__redshop_category AS c ON c.id = x.category_id');

		return $query;
	}
}
easyblog.php000060400000004151152455357510007073 0ustar00<?php
/**
 * @package         Regular Labs Library
 * @version         21.4.10972
 * 
 * @author          Peter van Westen <info@regularlabs.com>
 * @link            http://www.regularlabs.com
 * @copyright       Copyright © 2021 Regular Labs All Rights Reserved
 * @license         http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
 */

defined('_JEXEC') or die;

if ( ! is_file(JPATH_LIBRARIES . '/regularlabs/autoload.php'))
{
	return;
}

require_once JPATH_LIBRARIES . '/regularlabs/autoload.php';

class JFormFieldRL_EasyBlog extends \RegularLabs\Library\FieldGroup
{
	public $type = 'EasyBlog';

	protected function getInput()
	{
		if ($error = $this->missingFilesOrTables(['categories' => 'category', 'items' => 'post', 'tags' => 'tag']))
		{
			return $error;
		}

		return $this->getSelectList();
	}

	function getCategories()
	{
		$query = $this->db->getQuery(true)
			->select('COUNT(*)')
			->from('#__easyblog_category AS c')
			->where('c.published > -1');
		$this->db->setQuery($query);
		$total = $this->db->loadResult();

		if ($total > $this->max_list_count)
		{
			return -1;
		}

		$query->clear('select')
			->select('c.id, c.parent_id, c.title, c.published')
			->order('c.ordering, c.title');
		$this->db->setQuery($query);
		$items = $this->db->loadObjectList();

		return $this->getOptionsTreeByList($items);
	}

	function getItems()
	{
		$query = $this->db->getQuery(true)
			->select('i.id, i.title as name, c.title as cat, i.published')
			->from('#__easyblog_post AS i')
			->join('LEFT', '#__easyblog_category AS c ON c.id = i.category_id')
			->where('i.published > -1')
			->order('i.title, c.title, i.id');
		$this->db->setQuery($query);
		$list = $this->db->loadObjectList();

		return $this->getOptionsByList($list, ['cat', 'id']);
	}

	function getTags()
	{
		$query = $this->db->getQuery(true)
			->select('t.alias as id, t.title as name')
			->from('#__easyblog_tag AS t')
			->where('t.published > -1')
			->where('t.title != ' . $this->db->quote(''))
			->group('t.title')
			->order('t.title');
		$this->db->setQuery($query);
		$list = $this->db->loadObjectList();

		return $this->getOptionsByList($list);
	}
}
customfieldvalue.php000060400000002544152455357510010645 0ustar00<?php
/**
 * @package         Regular Labs Library
 * @version         21.4.10972
 * 
 * @author          Peter van Westen <info@regularlabs.com>
 * @link            http://www.regularlabs.com
 * @copyright       Copyright © 2021 Regular Labs All Rights Reserved
 * @license         http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
 */

defined('_JEXEC') or die;

use Joomla\CMS\Language\Text as JText;
use RegularLabs\Library\StringHelper as RL_String;

if ( ! is_file(JPATH_LIBRARIES . '/regularlabs/autoload.php'))
{
	return;
}

require_once JPATH_LIBRARIES . '/regularlabs/autoload.php';

class JFormFieldRL_CustomFieldValue extends \RegularLabs\Library\Field
{
	public $type = 'CustomFieldValue';

	protected function getLabel()
	{
		return '';
	}

	protected function getInput()
	{
		$label       = $this->get('label') ? $this->get('label') : '';
		$size        = $this->get('size') ? 'style="width:' . $this->get('size') . 'px"' : '';
		$class       = 'class="' . ($this->get('class') ? $this->get('class') : 'text_area') . '"';
		$this->value = htmlspecialchars(RL_String::html_entity_decoder($this->value), ENT_QUOTES);

		return
			'</div></div></div>'
			. '<input type="text" name="' . $this->name . '" id="' . $this->id . '" value="' . $this->value
			. '" placeholder="' . JText::_($label) . '" title="' . JText::_($label) . '" ' . $class . ' ' . $size . '>';
	}
}
slide.php000060400000005224152455357510006370 0ustar00<?php
/**
 * @package         Regular Labs Library
 * @version         18.3.17810
 * 
 * @author          Peter van Westen <info@regularlabs.com>
 * @link            http://www.regularlabs.com
 * @copyright       Copyright © 2018 Regular Labs All Rights Reserved
 * @license         http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
 */

defined('_JEXEC') or die;

if ( ! is_file(JPATH_LIBRARIES . '/regularlabs/autoload.php'))
{
	return;
}

require_once JPATH_LIBRARIES . '/regularlabs/autoload.php';

use RegularLabs\Library\Document as RL_Document;
use RegularLabs\Library\StringHelper as RL_String;

class JFormFieldRL_Slide extends \RegularLabs\Library\Field
{
	public $type = 'Slide';

	protected function getLabel()
	{
		return '';
	}

	protected function getInput()
	{
		$this->params = $this->element->attributes();

		RL_Document::stylesheet('regularlabs/style.min.css');

		$label       = RL_String::html_entity_decoder(JText::_($this->get('label')));
		$description = $this->prepareText($this->get('description'));
		$lang_file   = $this->get('language_file');

		$html = '</td></tr></table></div></div>';
		$html .= '<div class="panel"><h3 class="jpane-toggler title" id="advanced-page"><span>';
		$html .= $label;
		$html .= '</span></h3>';
		$html .= '<div class="jpane-slider content"><table width="100%" class="paramlist admintable" cellspacing="1"><tr><td colspan="2" class="paramlist_value">';

		if ($lang_file)
		{
			jimport('joomla.filesystem.file');

			// Include extra language file
			$lang = str_replace('_', '-', JFactory::getLanguage()->getTag());

			$inc       = '';
			$lang_path = 'language/' . $lang . '/' . $lang . '.' . $lang_file . '.inc.php';
			if (JFile::exists(JPATH_ADMINISTRATOR . '/' . $lang_path))
			{
				$inc = JPATH_ADMINISTRATOR . '/' . $lang_path;
			}
			else if (JFile::exists(JPATH_SITE . '/' . $lang_path))
			{
				$inc = JPATH_SITE . '/' . $lang_path;
			}
			if ( ! $inc && $lang != 'en-GB')
			{
				$lang      = 'en-GB';
				$lang_path = 'language/' . $lang . '/' . $lang . '.' . $lang_file . '.inc.php';
				if (JFile::exists(JPATH_ADMINISTRATOR . '/' . $lang_path))
				{
					$inc = JPATH_ADMINISTRATOR . '/' . $lang_path;
				}
				else if (JFile::exists(JPATH_SITE . '/' . $lang_path))
				{
					$inc = JPATH_SITE . '/' . $lang_path;
				}
			}
			if ($inc)
			{
				include $inc;
			}
		}

		if ($description)
		{
			if ($description[0] != '<')
			{
				$description = '<p>' . $description . '</p>';
			}
			$class = 'rl_panel rl_panel_description';
			$html  .= '<div class="' . $class . '"><div class="rl_block rl_title">';
			$html  .= $description;
			$html  .= '<div style="clear: both;"></div></div></div>';
		}

		return $html;
	}
}
menuitems.php000060400000006241152455357510007276 0ustar00<?php
/**
 * @package         Regular Labs Library
 * @version         21.4.10972
 * 
 * @author          Peter van Westen <info@regularlabs.com>
 * @link            http://www.regularlabs.com
 * @copyright       Copyright © 2021 Regular Labs All Rights Reserved
 * @license         http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
 */

defined('_JEXEC') or die;

use Joomla\CMS\Language\Text as JText;
use Joomla\Registry\Registry;
use RegularLabs\Library\Language as RL_Language;
use RegularLabs\Library\RegEx as RL_RegEx;

if ( ! is_file(JPATH_LIBRARIES . '/regularlabs/autoload.php'))
{
	return;
}

require_once JPATH_LIBRARIES . '/regularlabs/autoload.php';

class JFormFieldRL_MenuItems extends \RegularLabs\Library\Field
{
	public $type = 'MenuItems';

	protected function getInput()
	{
		$size     = (int) $this->get('size');
		$multiple = $this->get('multiple', 0);

		return $this->selectListAjax(
			$this->type, $this->name, $this->value, $this->id,
			compact('size', 'multiple')
		);
	}

	function getAjaxRaw(Registry $attributes)
	{
		$name     = $attributes->get('name', $this->type);
		$id       = $attributes->get('id', strtolower($name));
		$value    = $attributes->get('value', []);
		$size     = $attributes->get('size');
		$multiple = $attributes->get('multiple');

		$options = $this->getMenuItems();

		return $this->selectList($options, $name, $value, $id, $size, $multiple);
	}

	/**
	 * Get a list of menu links for one or all menus.
	 */
	public static function getMenuItems()
	{
		RL_Language::load('com_modules', JPATH_ADMINISTRATOR);
		JLoader::register('MenusHelper', JPATH_ADMINISTRATOR . '/components/com_menus/helpers/menus.php');
		$menuTypes = MenusHelper::getMenuLinks();

		foreach ($menuTypes as &$type)
		{
			$type->value      = 'type.' . $type->menutype;
			$type->text       = $type->title;
			$type->level      = 0;
			$type->class      = 'hidechildren';
			$type->labelclass = 'nav-header';

			$rlu[$type->menutype] = &$type;

			foreach ($type->links as &$link)
			{
				$check1 = RL_RegEx::replace('[^a-z0-9]', '', strtolower($link->text));
				$check2 = RL_RegEx::replace('[^a-z0-9]', '', $link->alias);

				$text   = [];
				$text[] = $link->text;

				if ($check1 !== $check2)
				{
					$text[] = '<span class="small ghosted">[' . $link->alias . ']</span>';
				}

				if (in_array($link->type, ['separator', 'heading', 'alias', 'url']))
				{
					$text[] = '<span class="label label-info">' . JText::_('COM_MODULES_MENU_ITEM_' . strtoupper($link->type)) . '</span>';
					// Don't disable, as you need to be able to select the 'Also on Child Items' option
					// $link->disable = 1;
				}

				if ($link->published == 0)
				{
					$text[] = '<span class="label">' . JText::_('JUNPUBLISHED') . '</span>';
				}

				if (JLanguageMultilang::isEnabled() && $link->language != '' && $link->language != '*')
				{
					$text[] = $link->language_image
						? JHtml::_('image', 'mod_languages/' . $link->language_image . '.gif', $link->language_title, ['title' => $link->language_title], true)
						: '<span class="label" title="' . $link->language_title . '">' . $link->language_sef . '</span>';
				}

				$link->text = implode(' ', $text);
			}
		}

		return $menuTypes;
	}
}
textareaplus.php000060400000006626152455357510010020 0ustar00<?php
/**
 * @package         Regular Labs Library
 * @version         21.4.10972
 * 
 * @author          Peter van Westen <info@regularlabs.com>
 * @link            http://www.regularlabs.com
 * @copyright       Copyright © 2021 Regular Labs All Rights Reserved
 * @license         http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
 */

defined('_JEXEC') or die;

use Joomla\CMS\Date\Date as JDate;
use Joomla\CMS\Factory as JFactory;
use Joomla\CMS\Language\Text as JText;
use RegularLabs\Library\StringHelper as RL_String;

if ( ! is_file(JPATH_LIBRARIES . '/regularlabs/autoload.php'))
{
	return;
}

require_once JPATH_LIBRARIES . '/regularlabs/autoload.php';

class JFormFieldRL_TextAreaPlus extends \RegularLabs\Library\Field
{
	public $type = 'TextAreaPlus';

	protected function getLabel()
	{
		$resize                = $this->get('resize', 0);
		$show_insert_date_name = $this->get('show_insert_date_name', 0);
		$add_separator         = $this->get('add_separator', 1);

		$label = RL_String::html_entity_decoder(JText::_($this->get('label')));

		$attribs = 'id="' . $this->id . '-lbl" for="' . $this->id . '"';

		if ($this->description)
		{
			$attribs .= ' class="hasPopover" title="' . $label . '"'
				. ' data-content="' . JText::_($this->description) . '"';
		}

		$html = '<label ' . $attribs . '>' . $label;

		if ($show_insert_date_name)
		{
			$date_name = JDate::getInstance()->format('[Y-m-d]') . ' ' . JFactory::getUser()->name . ' : ';
			$separator = $add_separator ? '---' : 'none';
			$onclick   = "RegularLabsForm.prependTextarea('" . $this->id . "', '" . addslashes($date_name) . "', '" . $separator . "');";

			$html .= '<br><span role="button" class="btn btn-mini rl_insert_date" onclick="' . $onclick . '">'
				. JText::_('RL_INSERT_DATE_NAME')
				. '</span>';
		}

		if ($resize)
		{
			$html .= '<br><span role="button" class="rl_resize_textarea rl_maximize"'
				. ' data-id="' . $this->id . '"  data-min="' . $this->get('height', 80) . '" data-max="' . $resize . '">'
				. '<span class="rl_resize_textarea_maximize">'
				. '[ + ]'
				. '</span>'
				. '<span class="rl_resize_textarea_minimize">'
				. '[ - ]'
				. '</span>'
				. '</span>';
		}

		$html .= '</label>';

		return $html;
	}

	protected function getInput()
	{
		$width  = $this->get('width', 600);
		$height = $this->get('height', 80);
		$class  = ' class="' . trim('rl_textarea ' . $this->get('class')) . '"';
		$type   = $this->get('texttype');
		$hint   = $this->get('hint');

		if (is_array($this->value))
		{
			$this->value = trim(implode("\n", $this->value));
		}

		if ($type == 'html')
		{
			// Convert <br> tags so they are not visible when editing
			$this->value = str_replace('<br>', "\n", $this->value);
		}
		else if ($type == 'regex')
		{
			// Protects the special characters
			$this->value = str_replace('[:REGEX_ENTER:]', '\n', $this->value);
		}

		if ($this->get('translate') && $this->get('translate') !== 'false')
		{
			$this->value = JText::_($this->value);
			$hint        = JText::_($hint);
		}

		$this->value = htmlspecialchars($this->value, ENT_COMPAT, 'UTF-8');

		$hint = $hint ? ' placeholder="' . $hint . '"' : '';

		return
			'<textarea name="' . $this->name . '" cols="' . (round($width / 7.5)) . '" rows="' . (round($height / 15)) . '"'
			. ' style="width:' . (($width == '600') ? '100%' : $width . 'px') . ';height:' . $height . 'px"'
			. ' id="' . $this->id . '"' . $class . $hint . '>' . $this->value . '</textarea>';
	}
}
tags.php000060400000005062152455357510006226 0ustar00<?php
/**
 * @package         Regular Labs Library
 * @version         21.4.10972
 * 
 * @author          Peter van Westen <info@regularlabs.com>
 * @link            http://www.regularlabs.com
 * @copyright       Copyright © 2021 Regular Labs All Rights Reserved
 * @license         http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
 */

defined('_JEXEC') or die;

use Joomla\CMS\HTML\HTMLHelper as JHtml;
use Joomla\CMS\Language\Text as JText;
use Joomla\Registry\Registry;

if ( ! is_file(JPATH_LIBRARIES . '/regularlabs/autoload.php'))
{
	return;
}

require_once JPATH_LIBRARIES . '/regularlabs/autoload.php';

class JFormFieldRL_Tags extends \RegularLabs\Library\Field
{
	public $type = 'Tags';

	protected function getInput()
	{
		$size        = (int) $this->get('size');
		$simple      = (int) $this->get('simple');
		$show_ignore = $this->get('show_ignore');
		$use_names   = $this->get('use_names');

		if ($show_ignore && in_array('-1', $this->value))
		{
			$this->value = ['-1'];
		}

		return $this->selectListAjax(
			$this->type, $this->name, $this->value, $this->id,
			compact('size', 'simple', 'show_ignore', 'use_names'),
			$simple
		);
	}

	function getAjaxRaw(Registry $attributes)
	{
		$name   = $attributes->get('name', $this->type);
		$id     = $attributes->get('id', strtolower($name));
		$value  = $attributes->get('value', []);
		$size   = $attributes->get('size');
		$simple = $attributes->get('simple');

		$options = $this->getOptions(
			(bool) $attributes->get('show_all'),
			(bool) $attributes->get('use_names')
		);

		return $this->selectList($options, $name, $value, $id, $size, true, $simple);
	}

	protected function getOptions($show_ignore = false, $use_names = false, $value = [])
	{
		// assemble items to the array
		$options = [];

		if ($show_ignore)
		{
			$options[] = JHtml::_('select.option', '-1', '- ' . JText::_('RL_IGNORE') . ' -');
			$options[] = JHtml::_('select.option', '-', '&nbsp;', 'value', 'text', true);
		}

		$options = array_merge($options, $this->getTags($use_names));

		return $options;
	}

	protected function getTags($use_names)
	{
		$value = $use_names ? 'a.title' : 'a.id';

		$query = $this->db->getQuery(true)
			->select($value . ' as value, a.title as text, a.parent_id AS parent')
			->from('#__tags AS a')
			->select('COUNT(DISTINCT b.id) - 1 AS level')
			->join('LEFT', '#__tags AS b ON a.lft > b.lft AND a.rgt < b.rgt')
			->where('a.alias <> ' . $this->db->quote('root'))
			->where('a.published IN (0,1)')
			->group('a.id')
			->order('a.lft ASC');
		$this->db->setQuery($query);

		return $this->db->loadObjectList();
	}
}
block.php000060400000003360152455357510006361 0ustar00<?php
/**
 * @package         Regular Labs Library
 * @version         21.4.10972
 * 
 * @author          Peter van Westen <info@regularlabs.com>
 * @link            http://www.regularlabs.com
 * @copyright       Copyright © 2021 Regular Labs All Rights Reserved
 * @license         http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
 */

defined('_JEXEC') or die;

use Joomla\CMS\Factory as JFactory;

if ( ! is_file(JPATH_LIBRARIES . '/regularlabs/autoload.php'))
{
	return;
}

require_once JPATH_LIBRARIES . '/regularlabs/autoload.php';

class JFormFieldRL_Block extends \RegularLabs\Library\Field
{
	public $type = 'Block';

	protected function getLabel()
	{
		return '';
	}

	protected function getInput()
	{
		$title       = $this->get('label');
		$description = $this->get('description');
		$class       = $this->get('class');
		$showclose   = $this->get('showclose', 0);
		$nowell      = $this->get('nowell', 0);

		$start = $this->get('start', 0);
		$end   = $this->get('end', 0);

		$html = [];

		if ($start || ! $end)
		{
			$html[] = '</div>';

			if (strpos($class, 'alert') !== false)
			{
				$class = 'alert ' . $class;
			}
			else if ( ! $nowell)
			{
				$class = 'well well-small ' . $class;
			}

			$html[] = '<div class="' . $class . '">';

			if ($showclose && JFactory::getUser()->authorise('core.admin'))
			{
				$html[] = '<button type="button" class="close rl_remove_assignment" aria-label="Close">&times;</button>';
			}

			if ($title)
			{
				$html[] = '<h4>' . $this->prepareText($title) . '</h4>';
			}

			if ($description)
			{
				$html[] = '<div>' . $this->prepareText($description) . '</div>';
			}

			$html[] = '<div><div>';
		}

		if ( ! $start && ! $end)
		{
			$html[] = '</div>';
		}

		return '</div>' . implode('', $html);
	}
}
editor.php000060400000002042152455357510006551 0ustar00<?php
/**
 * @package         Regular Labs Library
 * @version         21.4.10972
 * 
 * @author          Peter van Westen <info@regularlabs.com>
 * @link            http://www.regularlabs.com
 * @copyright       Copyright © 2021 Regular Labs All Rights Reserved
 * @license         http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
 */

defined('_JEXEC') or die;

use Joomla\CMS\Factory as JFactory;

if ( ! is_file(JPATH_LIBRARIES . '/regularlabs/autoload.php'))
{
	return;
}

require_once JPATH_LIBRARIES . '/regularlabs/autoload.php';

class JFormFieldRL_Editor extends \RegularLabs\Library\Field
{
	public $type = 'Editor';

	protected function getLabel()
	{
		return '';
	}

	protected function getInput()
	{
		$width  = $this->get('width', '100%');
		$height = $this->get('height', 400);

		$this->value = htmlspecialchars($this->value, ENT_COMPAT, 'UTF-8');

		// Get an editor object.
		$editor = JFactory::getEditor();
		$html   = $editor->display($this->name, $this->value, $width, $height, true, $this->id);

		return '</div><div>' . $html;
	}
}
password.php000060400000010640152455357510007130 0ustar00<?php
/**
 * @package     Joomla.Platform
 * @subpackage  Form
 *
 * @copyright   (C) 2009 Open Source Matters, Inc. <https://www.joomla.org>
 * @license     GNU General Public License version 2 or later; see LICENSE
 */

defined('JPATH_PLATFORM') or die;

/**
 * Form Field class for the Joomla Platform.
 * Text field for passwords
 *
 * @link   http://www.w3.org/TR/html-markup/input.password.html#input.password
 * @note   Two password fields may be validated as matching using JFormRuleEquals
 * @since  1.7.0
 */
class JFormFieldPassword extends JFormField
{
	/**
	 * Attach an unlock button and disable the input field,
	 * also remove the value from the output.
	 *
	 * @var    boolean
	 * @since  3.9.24
	 */
	protected $lock = false;

	/**
	 * The form field type.
	 *
	 * @var    string
	 * @since  1.7.0
	 */
	protected $type = 'Password';

	/**
	 * The threshold of password field.
	 *
	 * @var    integer
	 * @since  3.2
	 */
	protected $threshold = 66;

	/**
	 * The allowable maxlength of password.
	 *
	 * @var    integer
	 * @since  3.2
	 */
	protected $maxLength;

	/**
	 * Whether to attach a password strength meter or not.
	 *
	 * @var    boolean
	 * @since  3.2
	 */
	protected $meter = false;

	/**
	 * Name of the layout being used to render the field
	 *
	 * @var    string
	 * @since  3.7
	 */
	protected $layout = 'joomla.form.field.password';

	/**
	 * Method to get certain otherwise inaccessible properties from the form field object.
	 *
	 * @param   string  $name  The property name for which to get the value.
	 *
	 * @return  mixed  The property value or null.
	 *
	 * @since   3.2
	 */
	public function __get($name)
	{
		switch ($name)
		{
			case 'lock':
			case 'threshold':
			case 'maxLength':
			case 'meter':
				return $this->$name;
		}

		return parent::__get($name);
	}

	/**
	 * Method to set certain otherwise inaccessible properties of the form field object.
	 *
	 * @param   string  $name   The property name for which to set the value.
	 * @param   mixed   $value  The value of the property.
	 *
	 * @return  void
	 *
	 * @since   3.2
	 */
	public function __set($name, $value)
	{
		$value = (string) $value;

		switch ($name)
		{
			case 'maxLength':
			case 'threshold':
				$this->$name = $value;
				break;

			case 'lock':
			case 'meter':
				$this->$name = ($value === 'true' || $value === $name || $value === '1');
				break;

			default:
				parent::__set($name, $value);
		}
	}

	/**
	 * Method to attach a JForm object to the field.
	 *
	 * @param   SimpleXMLElement  $element  The SimpleXMLElement object representing the `<field>` tag for the form field object.
	 * @param   mixed             $value    The form field value to validate.
	 * @param   string            $group    The field name group control value. This acts as an array container for the field.
	 *                                      For example if the field has name="foo" and the group value is set to "bar" then the
	 *                                      full field name would end up being "bar[foo]".
	 *
	 * @return  boolean  True on success.
	 *
	 * @see     JFormField::setup()
	 * @since   3.2
	 */
	public function setup(SimpleXMLElement $element, $value, $group = null)
	{
		$return = parent::setup($element, $value, $group);

		if ($return)
		{
			$lock       = (string) $this->element['lock'];
			$this->lock = ($lock == 'true' || $lock == 'on' || $lock == '1');

			$this->maxLength = $this->element['maxlength'] ? (int) $this->element['maxlength'] : 99;
			$this->threshold = $this->element['threshold'] ? (int) $this->element['threshold'] : 66;

			$meter       = (string) $this->element['strengthmeter'];
			$this->meter = ($meter == 'true' || $meter == 'on' || $meter == '1');
		}

		return $return;
	}

	/**
	 * Method to get the field input markup for password.
	 *
	 * @return  string  The field input markup.
	 *
	 * @since   1.7.0
	 */
	protected function getInput()
	{
		// Trim the trailing line in the layout file
		return rtrim($this->getRenderer($this->layout)->render($this->getLayoutData()), PHP_EOL);
	}

	/**
	 * Method to get the data to be passed to the layout for rendering.
	 *
	 * @return  array
	 *
	 * @since 3.7
	 */
	protected function getLayoutData()
	{
		$data = parent::getLayoutData();

		// Initialize some field attributes.
		$extraData = array(
			'lock'      => $this->lock,
			'maxLength' => $this->maxLength,
			'meter'     => $this->meter,
			'threshold' => $this->threshold,
		);

		return array_merge($data, $extraData);
	}
}
datetime.php000060400000002450152455357510007062 0ustar00<?php
/**
 * @package         Regular Labs Library
 * @version         21.4.10972
 * 
 * @author          Peter van Westen <info@regularlabs.com>
 * @link            http://www.regularlabs.com
 * @copyright       Copyright © 2021 Regular Labs All Rights Reserved
 * @license         http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
 */

defined('_JEXEC') or die;

use Joomla\CMS\Factory as JFactory;
use Joomla\CMS\Language\Text as JText;
use RegularLabs\Library\Date as RL_Date;

if ( ! is_file(JPATH_LIBRARIES . '/regularlabs/autoload.php'))
{
	return;
}

require_once JPATH_LIBRARIES . '/regularlabs/autoload.php';

class JFormFieldRL_DateTime extends \RegularLabs\Library\Field
{
	public $type = 'DateTime';

	protected function getLabel()
	{
		return '';
	}

	protected function getInput()
	{
		$label  = $this->get('label');
		$format = $this->get('format');

		$date = JFactory::getDate();

		$tz = new DateTimeZone(JFactory::getApplication()->getCfg('offset'));
		$date->setTimeZone($tz);

		if ($format)
		{
			if (strpos($format, '%') !== false)
			{
				$format = RL_Date::strftimeToDateFormat($format);
			}
			$html = $date->format($format, true);
		}
		else
		{
			$html = $date->format('', true);
		}

		if ($label)
		{
			$html = JText::sprintf($label, $html);
		}

		return '</div><div>' . $html;
	}
}
grouplevel.php000060400000004434152455357510007456 0ustar00<?php
/**
 * @package         Regular Labs Library
 * @version         21.4.10972
 * 
 * @author          Peter van Westen <info@regularlabs.com>
 * @link            http://www.regularlabs.com
 * @copyright       Copyright © 2021 Regular Labs All Rights Reserved
 * @license         http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
 */

defined('_JEXEC') or die;

use Joomla\CMS\Language\Text as JText;
use Joomla\Registry\Registry;

if ( ! is_file(JPATH_LIBRARIES . '/regularlabs/autoload.php'))
{
	return;
}

require_once JPATH_LIBRARIES . '/regularlabs/autoload.php';

class JFormFieldRL_GroupLevel extends \RegularLabs\Library\Field
{
	public $type = 'GroupLevel';

	protected function getInput()
	{
		$size      = (int) $this->get('size');
		$multiple  = $this->get('multiple');
		$show_all  = $this->get('show_all');
		$use_names = $this->get('use_names');

		return $this->selectListAjax(
			$this->type, $this->name, $this->value, $this->id,
			compact('size', 'multiple', 'show_all', 'use_names')
		);
	}

	function getAjaxRaw(Registry $attributes)
	{
		$name     = $attributes->get('name', $this->type);
		$id       = $attributes->get('id', strtolower($name));
		$value    = $attributes->get('value', []);
		$size     = $attributes->get('size');
		$multiple = $attributes->get('multiple');

		$options = $this->getOptions(
			(bool) $attributes->get('show_all'),
			(bool) $attributes->get('use_names')
		);

		return $this->selectList($options, $name, $value, $id, $size, $multiple);
	}

	protected function getOptions($show_all = false, $use_names = false)
	{
		$options = $this->getUserGroups($use_names);

		if ($show_all)
		{
			$option          = (object) [];
			$option->value   = -1;
			$option->text    = '- ' . JText::_('JALL') . ' -';
			$option->disable = '';
			array_unshift($options, $option);
		}

		return $options;
	}

	protected function getUserGroups($use_names = false)
	{
		$value = $use_names ? 'a.title' : 'a.id';

		$query = $this->db->getQuery(true)
			->select($value . ' as value, a.title as text, a.parent_id AS parent')
			->from('#__usergroups AS a')
			->select('COUNT(DISTINCT b.id) AS level')
			->join('LEFT', '#__usergroups AS b ON a.lft > b.lft AND a.rgt < b.rgt')
			->group('a.id')
			->order('a.lft ASC');
		$this->db->setQuery($query);

		return $this->db->loadObjectList();
	}
}
showon.php000060400000002115152455357510006601 0ustar00<?php
/**
 * @package         Regular Labs Library
 * @version         21.4.10972
 * 
 * @author          Peter van Westen <info@regularlabs.com>
 * @link            http://www.regularlabs.com
 * @copyright       Copyright © 2021 Regular Labs All Rights Reserved
 * @license         http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
 */

defined('_JEXEC') or die;

use RegularLabs\Library\ShowOn as RL_ShowOn;

if ( ! is_file(JPATH_LIBRARIES . '/regularlabs/autoload.php'))
{
	return;
}

require_once JPATH_LIBRARIES . '/regularlabs/autoload.php';

class JFormFieldRL_ShowOn extends \RegularLabs\Library\Field
{
	public $type = 'ShowOn';

	protected function getLabel()
	{
		return '';
	}

	protected function getInput()
	{
		$value       = (string) $this->get('value');
		$class       = $this->get('class', '');
		$formControl = $this->get('form', $this->formControl);
		$formControl = $formControl == 'root' ? '' : $formControl;

		if ( ! $value)
		{
			return RL_ShowOn::close();
		}

		return '</div></div>'
			. RL_ShowOn::open($value, $formControl, $this->group, $class)
			. '<div><div>';
	}
}
range.php000060400000002625152455357510006366 0ustar00<?php
/**
 * @package     Joomla.Platform
 * @subpackage  Form
 *
 * @copyright   (C) 2013 Open Source Matters, Inc. <https://www.joomla.org>
 * @license     GNU General Public License version 2 or later; see LICENSE
 */

defined('JPATH_PLATFORM') or die;

JFormHelper::loadFieldClass('number');

/**
 * Form Field class for the Joomla Platform.
 * Provides a horizontal scroll bar to specify a value in a range.
 *
 * @link   http://www.w3.org/TR/html-markup/input.text.html#input.text
 * @since  3.2
 */
class JFormFieldRange extends JFormFieldNumber
{
	/**
	 * The form field type.
	 *
	 * @var    string
	 * @since  3.2
	 */
	protected $type = 'Range';

	/**
	 * Name of the layout being used to render the field
	 *
	 * @var    string
	 * @since  3.7
	 */
	protected $layout = 'joomla.form.field.range';

	/**
	 * Method to get the field input markup.
	 *
	 * @return  string  The field input markup.
	 *
	 * @since   3.2
	 */
	protected function getInput()
	{
		return $this->getRenderer($this->layout)->render($this->getLayoutData());
	}

	/**
	 * Method to get the data to be passed to the layout for rendering.
	 *
	 * @return  array
	 *
	 * @since 3.7
	 */
	protected function getLayoutData()
	{
		$data = parent::getLayoutData();

		// Initialize some field attributes.
		$extraData = array(
			'max' => $this->max,
			'min' => $this->min,
			'step' => $this->step,
		);

		return array_merge($data, $extraData);
	}
}
loadlanguage.php000060400000002034152455357510007707 0ustar00<?php
/**
 * @package         Regular Labs Library
 * @version         21.4.10972
 * 
 * @author          Peter van Westen <info@regularlabs.com>
 * @link            http://www.regularlabs.com
 * @copyright       Copyright © 2021 Regular Labs All Rights Reserved
 * @license         http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
 */

defined('_JEXEC') or die;

use RegularLabs\Library\Language as RL_Language;

if ( ! is_file(JPATH_LIBRARIES . '/regularlabs/autoload.php'))
{
	return;
}

require_once JPATH_LIBRARIES . '/regularlabs/autoload.php';

class JFormFieldRL_LoadLanguage extends \RegularLabs\Library\Field
{
	public $type = 'LoadLanguage';

	protected function getLabel()
	{
		return '';
	}

	protected function getInput()
	{
		$extension = $this->get('extension');
		$admin     = $this->get('admin', 1);

		self::loadLanguage($extension, $admin);

		return '';
	}

	function loadLanguage($extension, $admin = 1)
	{
		if ( ! $extension)
		{
			return;
		}

		RL_Language::load($extension, $admin ? JPATH_ADMINISTRATOR : JPATH_SITE);
	}
}
header.php000060400000006420152455357510006517 0ustar00<?php
/**
 * @package         Regular Labs Library
 * @version         21.4.10972
 * 
 * @author          Peter van Westen <info@regularlabs.com>
 * @link            http://www.regularlabs.com
 * @copyright       Copyright © 2021 Regular Labs All Rights Reserved
 * @license         http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
 */

defined('_JEXEC') or die;

use Joomla\CMS\Application\ApplicationHelper as JApplicationHelper;
use Joomla\CMS\Language\Text as JText;
use RegularLabs\Library\RegEx as RL_RegEx;
use RegularLabs\Library\StringHelper as RL_String;

if ( ! is_file(JPATH_LIBRARIES . '/regularlabs/autoload.php'))
{
	return;
}

require_once JPATH_LIBRARIES . '/regularlabs/autoload.php';

class JFormFieldRL_Header extends \RegularLabs\Library\Field
{
	public $type = 'Header';

	protected function getLabel()
	{
		return '';
	}

	protected function getInput()
	{
		$title       = $this->get('label');
		$description = $this->get('description');
		$xml         = $this->get('xml');
		$url         = $this->get('url');

		if ($description)
		{
			$description = RL_String::html_entity_decoder(trim(JText::_($description)));
		}

		if ($title)
		{
			$title = JText::_($title);
		}

		if ($description)
		{
			// Replace inline monospace style with rl_code classname
			$description = str_replace('span style="font-family:monospace;"', 'span class="rl_code"', $description);

			// 'Break' plugin style tags
			$description = str_replace(['{', '['], ['<span>{</span>', '<span>[</span>'], $description);

			// Wrap in paragraph (if not already starting with an html tag)
			if ($description[0] != '<')
			{
				$description = '<p>' . $description . '</p>';
			}
		}

		if ( ! $xml && $this->form->getValue('element'))
		{
			if ($this->form->getValue('folder'))
			{
				$xml = 'plugins/' . $this->form->getValue('folder') . '/' . $this->form->getValue('element') . '/' . $this->form->getValue('element') . '.xml';
			}
			else
			{
				$xml = 'administrator/modules/' . $this->form->getValue('element') . '/' . $this->form->getValue('element') . '.xml';
			}
		}

		if ($xml)
		{
			$xml     = JApplicationHelper::parseXMLInstallFile(JPATH_SITE . '/' . $xml);
			$version = 0;
			if ($xml && isset($xml['version']))
			{
				$version = $xml['version'];
			}
			if ($version)
			{
				if (strpos($version, 'PRO') !== false)
				{
					$version = str_replace('PRO', '', $version);
					$version .= ' <small style="color:green">[PRO]</small>';
				}
				else if (strpos($version, 'FREE') !== false)
				{
					$version = str_replace('FREE', '', $version);
					$version .= ' <small style="color:green">[FREE]</small>';
				}
				if ($title)
				{
					$title .= ' v';
				}
				else
				{
					$title = JText::_('Version') . ' ';
				}
				$title .= $version;
			}
		}
		$html = [];

		if ($title)
		{
			if ($url)
			{
				$title = '<a href="' . $url . '" target="_blank" title="'
					. RL_RegEx::replace('<[^>]*>', '', $title) . '">' . $title . '</a>';
			}
			$html[] = '<h4>' . RL_String::html_entity_decoder($title) . '</h4>';
		}

		if ($description)
		{
			$html[] = $description;
		}

		if ($url)
		{
			$html[] = '<p><a href="' . $url . '" class="btn btn-default" target="_blank" title="' . JText::_('RL_MORE_INFO') . '">' . JText::_('RL_MORE_INFO') . ' >></a></p>';
		}

		return '</div><div>' . implode('', $html);
	}
}
users.php000060400000006475152455357510006442 0ustar00<?php
/**
 * @package     JCE
 * @subpackage  Admin
 *
 * @copyright   Copyright (C) 2005 - 2020 Open Source Matters, Inc. All rights reserved.
 * @copyright   Copyright (c) 2009-2024 Ryan Demmer. All rights reserved
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */

\defined('_JEXEC') or die;

use Joomla\CMS\Form\Field\UserField;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Table\Table;

/**
 * Field to select a user ID from a modal list.
 *
 * @since  1.6
 */
class JFormFieldUsers extends UserField
{
    /**
     * The form field type.
     *
     * @var    string
     * @since  2.7
     */
    public $type = 'Users';

    /**
     * Method to get the user field input markup.
     *
     * @return  string  The field input markup.
     *
     * @since   1.6
     */
    protected function getInput()
    {
        if (empty($this->layout)) {
            throw new \UnexpectedValueException(sprintf('%s has no layout assigned.', $this->name));
        }

        $options = $this->getOptions();

        $name = $this->name;

        // clear name
        $this->name = "";

        // set onchange to update
        $this->onchange = "(function(){WfSelectUsers();})();";

        // remove autocomplete
        $this->autocomplete = false;

        // clear value
        $this->value = "";

        $html = $this->getRenderer($this->layout)->render($this->getLayoutData());
        $html .= '<div class="users-select">';

        // add "joomla-field-fancy-select" manually for Joomla 4
        $html .= '<joomla-field-fancy-select placeholder="...">';
        $html .= '<select name="' . $name . '" id="' . $this->id . '_select" class="custom-select" data-placeholder="..." multiple>';

        foreach ($options as $option) {
            $html .= '<option value="' . $option->value . '" selected>' . $option->text . '</option>';
        }

        $html .= '</select>';
        $html .= '</joomla-field-fancy-select>';
        $html .= '</div>';

        return $html;

    }

    /**
     * Allow to override renderer include paths in child fields
     *
     * @return  array
     *
     * @since   3.5
     */
    protected function getLayoutPaths()
    {
        return array(JPATH_ADMINISTRATOR . '/components/com_jce/layouts', JPATH_SITE . '/layouts');
    }

    /**
     * Method to get the field options.
     *
     * @return array The field option objects
     *
     * @since   11.1
     */
    protected function getOptions()
    {
        $options = array();

        if (empty($this->value)) {
            return $options;
        }

        $fieldname = preg_replace('/[^a-zA-Z0-9_\-]/', '_', $this->fieldname);
        $table = Table::getInstance('user');

        // clean value
        $this->value = str_replace('"', '', $this->value);

        foreach (explode(',', $this->value) as $id) {
            if (empty($id)) {
                continue;
            }

            if ($table->load((int) $id)) {
                $text = htmlspecialchars($table->name, ENT_COMPAT, 'UTF-8');
                $text = Text::alt($text, $fieldname);

                $tmp = array(
                    'value' => $id,
                    'text' => $text,
                );

                // Add the option object to the result set.
                $options[] = (object) $tmp;
            }
        }

        return $options;
    }
}
content.php000060400000005150152455357510006740 0ustar00<?php
/**
 * @package         Regular Labs Library
 * @version         21.4.10972
 * 
 * @author          Peter van Westen <info@regularlabs.com>
 * @link            http://www.regularlabs.com
 * @copyright       Copyright © 2021 Regular Labs All Rights Reserved
 * @license         http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
 */

defined('_JEXEC') or die;

use Joomla\CMS\HTML\HTMLHelper as JHtml;
use Joomla\CMS\Language\Text as JText;
use RegularLabs\Library\ArrayHelper as RL_ArrayHelper;

if ( ! is_file(JPATH_LIBRARIES . '/regularlabs/autoload.php'))
{
	return;
}

require_once JPATH_LIBRARIES . '/regularlabs/autoload.php';

class JFormFieldRL_Content extends \RegularLabs\Library\FieldGroup
{
	public $type = 'Content';

	function getCategories()
	{
		$query = $this->db->getQuery(true)
			->select('COUNT(*)')
			->from('#__categories')
			->where('extension = ' . $this->db->quote('com_content'))
			->where('parent_id > 0')
			->where('published > -1');
		$this->db->setQuery($query);
		$total = $this->db->loadResult();

		if ($total > $this->max_list_count)
		{
			return -1;
		}

		$this->value = RL_ArrayHelper::toArray($this->value);

		// assemble items to the array
		$options = [];
		if ($this->get('show_ignore'))
		{
			if (in_array('-1', $this->value))
			{
				$this->value = ['-1'];
			}
			$options[] = JHtml::_('select.option', '-1', '- ' . JText::_('RL_IGNORE') . ' -');
			$options[] = JHtml::_('select.option', '-', '&nbsp;', 'value', 'text', true);
		}

		$query->clear('select')
			->select('id, title as name, level, published, language')
			->order('lft');

		$this->db->setQuery($query);
		$list = $this->db->loadObjectList();

		$options = array_merge($options, $this->getOptionsByList($list, ['language'], -1));

		return $options;
	}

	function getItems()
	{
		$query = $this->db->getQuery(true)
			->select('COUNT(*)')
			->from('#__content AS i')
			->where('i.access > -1');
		$this->db->setQuery($query);
		$total = $this->db->loadResult();

		if ($total > $this->max_list_count)
		{
			return -1;
		}

		$query->clear('select')
			->select('i.id, i.title as name, i.language, c.title as cat, i.state as published')
			->join('LEFT', '#__categories AS c ON c.id = i.catid')
			->order('i.title, i.ordering, i.id');
		$this->db->setQuery($query);
		$list = $this->db->loadObjectList();

		$options = $this->getOptionsByList($list, ['language', 'cat', 'id']);

		if ($this->get('showselect'))
		{
			array_unshift($options, JHtml::_('select.option', '-', '&nbsp;', 'value', 'text', true));
			array_unshift($options, JHtml::_('select.option', '-', '- ' . JText::_('Select Item') . ' -'));
		}

		return $options;
	}
}
filelist.php000060400000013037152455357510007104 0ustar00<?php
/**
 * @package     Joomla.Platform
 * @subpackage  Form
 *
 * @copyright   (C) 2010 Open Source Matters, Inc. <https://www.joomla.org>
 * @license     GNU General Public License version 2 or later; see LICENSE
 */

defined('JPATH_PLATFORM') or die;

jimport('joomla.filesystem.folder');
jimport('joomla.filesystem.file');
jimport('joomla.filesystem.path');

JFormHelper::loadFieldClass('list');

/**
 * Supports an HTML select list of files
 *
 * @since  1.7.0
 */
class JFormFieldFileList extends JFormFieldList
{
	/**
	 * The form field type.
	 *
	 * @var    string
	 * @since  1.7.0
	 */
	protected $type = 'FileList';

	/**
	 * The filter.
	 *
	 * @var    string
	 * @since  3.2
	 */
	protected $filter;

	/**
	 * The exclude.
	 *
	 * @var    string
	 * @since  3.2
	 */
	protected $exclude;

	/**
	 * The hideNone.
	 *
	 * @var    boolean
	 * @since  3.2
	 */
	protected $hideNone = false;

	/**
	 * The hideDefault.
	 *
	 * @var    boolean
	 * @since  3.2
	 */
	protected $hideDefault = false;

	/**
	 * The stripExt.
	 *
	 * @var    boolean
	 * @since  3.2
	 */
	protected $stripExt = false;

	/**
	 * The directory.
	 *
	 * @var    string
	 * @since  3.2
	 */
	protected $directory;

	/**
	 * Method to get certain otherwise inaccessible properties from the form field object.
	 *
	 * @param   string  $name  The property name for which to get the value.
	 *
	 * @return  mixed  The property value or null.
	 *
	 * @since   3.2
	 */
	public function __get($name)
	{
		switch ($name)
		{
			case 'filter':
			case 'exclude':
			case 'hideNone':
			case 'hideDefault':
			case 'stripExt':
			case 'directory':
				return $this->$name;
		}

		return parent::__get($name);
	}

	/**
	 * Method to set certain otherwise inaccessible properties of the form field object.
	 *
	 * @param   string  $name   The property name for which to set the value.
	 * @param   mixed   $value  The value of the property.
	 *
	 * @return  void
	 *
	 * @since   3.2
	 */
	public function __set($name, $value)
	{
		switch ($name)
		{
			case 'filter':
			case 'directory':
			case 'exclude':
				$this->$name = (string) $value;
				break;

			case 'hideNone':
			case 'hideDefault':
			case 'stripExt':
				$value = (string) $value;
				$this->$name = ($value === 'true' || $value === $name || $value === '1');
				break;

			default:
				parent::__set($name, $value);
		}
	}

	/**
	 * Method to attach a JForm object to the field.
	 *
	 * @param   SimpleXMLElement  $element  The SimpleXMLElement object representing the `<field>` tag for the form field object.
	 * @param   mixed             $value    The form field value to validate.
	 * @param   string            $group    The field name group control value. This acts as an array container for the field.
	 *                                      For example if the field has name="foo" and the group value is set to "bar" then the
	 *                                      full field name would end up being "bar[foo]".
	 *
	 * @return  boolean  True on success.
	 *
	 * @see     JFormField::setup()
	 * @since   3.2
	 */
	public function setup(SimpleXMLElement $element, $value, $group = null)
	{
		$return = parent::setup($element, $value, $group);

		if ($return)
		{
			$this->filter  = (string) $this->element['filter'];
			$this->exclude = (string) $this->element['exclude'];

			$hideNone       = (string) $this->element['hide_none'];
			$this->hideNone = ($hideNone == 'true' || $hideNone == 'hideNone' || $hideNone == '1');

			$hideDefault       = (string) $this->element['hide_default'];
			$this->hideDefault = ($hideDefault == 'true' || $hideDefault == 'hideDefault' || $hideDefault == '1');

			$stripExt       = (string) $this->element['stripext'];
			$this->stripExt = ($stripExt == 'true' || $stripExt == 'stripExt' || $stripExt == '1');

			// Get the path in which to search for file options.
			$this->directory = (string) $this->element['directory'];
		}

		return $return;
	}

	/**
	 * Method to get the list of files for the field options.
	 * Specify the target directory with a directory attribute
	 * Attributes allow an exclude mask and stripping of extensions from file name.
	 * Default attribute may optionally be set to null (no file) or -1 (use a default).
	 *
	 * @return  array  The field option objects.
	 *
	 * @since   1.7.0
	 */
	protected function getOptions()
	{
		$options = array();

		$path = $this->directory;

		if (!is_dir($path))
		{
			$path = JPATH_ROOT . '/' . $path;
		}
		
		$path = JPath::clean($path);

		// Prepend some default options based on field attributes.
		if (!$this->hideNone)
		{
			$options[] = JHtml::_('select.option', '-1', JText::alt('JOPTION_DO_NOT_USE', preg_replace('/[^a-zA-Z0-9_\-]/', '_', $this->fieldname)));
		}

		if (!$this->hideDefault)
		{
			$options[] = JHtml::_('select.option', '', JText::alt('JOPTION_USE_DEFAULT', preg_replace('/[^a-zA-Z0-9_\-]/', '_', $this->fieldname)));
		}

		// Get a list of files in the search path with the given filter.
		$files = JFolder::files($path, $this->filter);

		// Build the options list from the list of files.
		if (is_array($files))
		{
			foreach ($files as $file)
			{
				// Check to see if the file is in the exclude mask.
				if ($this->exclude)
				{
					if (preg_match(chr(1) . $this->exclude . chr(1), $file))
					{
						continue;
					}
				}

				// If the extension is to be stripped, do it.
				if ($this->stripExt)
				{
					$file = JFile::stripExt($file);
				}

				$options[] = JHtml::_('select.option', $file, $file);
			}
		}

		// Merge any additional options in the XML definition.
		$options = array_merge(parent::getOptions(), $options);

		return $options;
	}
}
license.php000060400000001677152455357510006722 0ustar00<?php
/**
 * @package         Regular Labs Library
 * @version         21.4.10972
 * 
 * @author          Peter van Westen <info@regularlabs.com>
 * @link            http://www.regularlabs.com
 * @copyright       Copyright © 2021 Regular Labs All Rights Reserved
 * @license         http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
 */

defined('_JEXEC') or die;

use RegularLabs\Library\License as RL_License;

if ( ! is_file(JPATH_LIBRARIES . '/regularlabs/autoload.php'))
{
	return;
}

require_once JPATH_LIBRARIES . '/regularlabs/autoload.php';

class JFormFieldRL_License extends \RegularLabs\Library\Field
{
	public $type = 'License';

	protected function getLabel()
	{
		return '';
	}

	protected function getInput()
	{
		$extension = $this->get('extension');

		if (empty($extension))
		{
			return '';
		}

		$message = RL_License::getMessage($extension, true);

		if (empty($message))
		{
			return '';
		}

		return '</div><div>' . $message;
	}
}
icons.php000060400000006063152455357510006405 0ustar00<?php
/**
 * @package         Regular Labs Library
 * @version         21.4.10972
 * 
 * @author          Peter van Westen <info@regularlabs.com>
 * @link            http://www.regularlabs.com
 * @copyright       Copyright © 2021 Regular Labs All Rights Reserved
 * @license         http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
 */

defined('_JEXEC') or die;

use Joomla\CMS\Language\Text as JText;

if ( ! is_file(JPATH_LIBRARIES . '/regularlabs/autoload.php'))
{
	return;
}

require_once JPATH_LIBRARIES . '/regularlabs/autoload.php';

class JFormFieldRL_Icons extends \RegularLabs\Library\Field
{
	public $type = 'Icons';

	protected function getInput()
	{
		$value = $this->value;
		if ( ! is_array($value))
		{
			$value = explode(',', $value);
		}

		$classes = [
			'reglab icon-contenttemplater',
			'home',
			'user',
			'locked',
			'comments',
			'comments-2',
			'out',
			'plus',
			'pencil',
			'pencil-2',
			'file',
			'file-add',
			'file-remove',
			'copy',
			'folder',
			'folder-2',
			'picture',
			'pictures',
			'list-view',
			'power-cord',
			'cube',
			'puzzle',
			'flag',
			'tools',
			'cogs',
			'cog',
			'equalizer',
			'wrench',
			'brush',
			'eye',
			'star',
			'calendar',
			'calendar-2',
			'help',
			'support',
			'warning',
			'checkmark',
			'mail',
			'mail-2',
			'drawer',
			'drawer-2',
			'box-add',
			'box-remove',
			'search',
			'filter',
			'camera',
			'play',
			'music',
			'grid-view',
			'grid-view-2',
			'menu',
			'thumbs-up',
			'thumbs-down',
			'plus-2',
			'minus-2',
			'key',
			'quote',
			'quote-2',
			'database',
			'location',
			'zoom-in',
			'zoom-out',
			'health',
			'wand',
			'refresh',
			'vcard',
			'clock',
			'compass',
			'address',
			'feed',
			'flag-2',
			'pin',
			'lamp',
			'chart',
			'bars',
			'pie',
			'dashboard',
			'lightning',
			'move',
			'printer',
			'color-palette',
			'camera-2',
			'cart',
			'basket',
			'broadcast',
			'screen',
			'tablet',
			'mobile',
			'users',
			'briefcase',
			'download',
			'upload',
			'bookmark',
			'out-2',
		];

		$html = [];

		if ($this->get('show_none'))
		{
			$checked = (in_array('0', $value) ? ' checked="checked"' : '');
			$html[]  = '<fieldset>';
			$html[]  = '<input type="radio" id="' . $this->id . '0" name="' . $this->name . '"' . ' value="0"' . $checked . '>';
			$html[]  = '<label for="' . $this->id . '0">' . JText::_('RL_NO_ICON') . '</label>';
			$html[]  = '</fieldset>';
		}

		foreach ($classes as $i => $class)
		{
			$id      = str_replace(' ', '_', $this->id . $class);
			$checked = (in_array($class, $value) ? ' checked="checked"' : '');

			$html[] = '<fieldset class="pull-left">';
			$html[] = '<input type="radio" id="' . $id . '" name="' . $this->name . '"'
				. ' value="' . htmlspecialchars($class, ENT_COMPAT, 'UTF-8') . '"' . $checked . '>';
			$html[] = '<label for="' . $id . '" class="btn btn-small hasTip" title="' . $class . '"><span class="icon-' . $class . '"></span></label>';
			$html[] = '</fieldset>';
		}

		return '<div id="' . $this->id . '" class="btn-group radio rl_icon_group">' . implode('', $html) . '</div>';
	}
}
conditionselection.php000060400000007505152455357510011170 0ustar00<?php
/**
 * @package         Regular Labs Library
 * @version         21.4.10972
 * 
 * @author          Peter van Westen <info@regularlabs.com>
 * @link            http://www.regularlabs.com
 * @copyright       Copyright © 2021 Regular Labs All Rights Reserved
 * @license         http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
 */

defined('_JEXEC') or die;

use Joomla\CMS\Factory as JFactory;
use Joomla\CMS\Language\Text as JText;
use RegularLabs\Library\ShowOn as RL_ShowOn;
use RegularLabs\Library\StringHelper as RL_String;

if ( ! is_file(JPATH_LIBRARIES . '/regularlabs/autoload.php'))
{
	return;
}

require_once JPATH_LIBRARIES . '/regularlabs/autoload.php';

class JFormFieldRL_ConditionSelection extends \RegularLabs\Library\Field
{
	public $type = 'ConditionSelection';

	protected function getLabel()
	{
		return '';
	}

	protected function getInput()
	{
		$this->value     = (int) $this->value;
		$label           = $this->get('label');
		$param_name      = $this->get('name');
		$use_main_switch = $this->get('use_main_switch', 1);
		$showclose       = $this->get('showclose', 0);

		$html = [];

		if ( ! $label)
		{
			if ($use_main_switch)
			{
				$html[] = $this->closeShowOn();
			}

			$html[] = $this->closeShowOn();

			return '</div>' . implode('', $html);
		}

		$label = RL_String::html_entity_decoder(JText::_($label));

		$html[] = '</div>';

		if ($use_main_switch)
		{
			$html[] = $this->openShowOn('show_conditions:1[OR]show_assignments:1[OR]' . $param_name . ':1,2');
		}

		$class = 'well well-small rl_well';
		if ($this->value === 1)
		{
			$class .= ' alert-success';
		}
		else if ($this->value === 2)
		{
			$class .= ' alert-error';
		}
		$html[] = '<div class="' . $class . '">';
		if ($showclose && JFactory::getUser()->authorise('core.admin'))
		{
			$html[] = '<button type="button" class="close" aria-label="Close">&times;</button>';
		}

		$html[] = '<div class="control-group">';

		$html[] = '<div class="control-label">';
		$html[] = '<label><h4>' . $label . '</h4></label>';
		$html[] = '</div>';

		$html[] = '<div class="controls">';
		$html[] = '<fieldset id="' . $this->id . '"  class="radio btn-group">';

		$onclick = ' onclick="RegularLabsForm.setToggleTitleClass(this, 0)"';
		$html[]  = '<input type="radio" id="' . $this->id . '0" name="' . $this->name . '" value="0"' . (( ! $this->value) ? ' checked="checked"' : '') . $onclick . '>';
		$html[]  = '<label class="rl_btn-ignore" for="' . $this->id . '0">' . JText::_('RL_IGNORE') . '</label>';

		$onclick = ' onclick="RegularLabsForm.setToggleTitleClass(this, 1)"';
		$html[]  = '<input type="radio" id="' . $this->id . '1" name="' . $this->name . '" value="1"' . (($this->value === 1) ? ' checked="checked"' : '') . $onclick . '>';
		$html[]  = '<label class="rl_btn-include" for="' . $this->id . '1">' . JText::_('RL_INCLUDE') . '</label>';

		$onclick = ' onclick="RegularLabsForm.setToggleTitleClass(this, 2)"';
		$onclick .= ' onload="RegularLabsForm.setToggleTitleClass(this, ' . $this->value . ', 7)"';
		$html[]  = '<input type="radio" id="' . $this->id . '2" name="' . $this->name . '" value="2"' . (($this->value === 2) ? ' checked="checked"' : '') . $onclick . '>';
		$html[]  = '<label class="rl_btn-exclude" for="' . $this->id . '2">' . JText::_('RL_EXCLUDE') . '</label>';

		$html[] = '</fieldset>';
		$html[] = '</div>';

		$html[] = '</div>';
		$html[] = '<div class="clearfix"> </div>';

		$html[] = $this->openShowOn($param_name . ':1,2');

		$html[] = '<div><div>';

		return '</div>' . implode('', $html);
	}

	protected function openShowOn($condition = '')
	{
		if ( ! $condition)
		{
			return $this->closeShowon();
		}

		$formControl = $this->get('form', $this->formControl);
		$formControl = $formControl == 'root' ? '' : $formControl;

		return RL_ShowOn::open($condition, $formControl);
	}

	protected function closeShowOn()
	{
		return RL_ShowOn::close();
	}
}
customfieldkey.php000060400000002674152455357510010325 0ustar00<?php
/**
 * @package         Regular Labs Library
 * @version         21.4.10972
 * 
 * @author          Peter van Westen <info@regularlabs.com>
 * @link            http://www.regularlabs.com
 * @copyright       Copyright © 2021 Regular Labs All Rights Reserved
 * @license         http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
 */

defined('_JEXEC') or die;

use Joomla\CMS\Language\Text as JText;
use RegularLabs\Library\StringHelper as RL_String;

if ( ! is_file(JPATH_LIBRARIES . '/regularlabs/autoload.php'))
{
	return;
}

require_once JPATH_LIBRARIES . '/regularlabs/autoload.php';

class JFormFieldRL_CustomFieldKey extends \RegularLabs\Library\Field
{
	public $type = 'CustomFieldKey';

	protected function getLabel()
	{
		$label       = $this->get('label') ? $this->get('label') : '';
		$size        = $this->get('size') ? 'style="width:' . $this->get('size') . 'px"' : '';
		$class       = 'class="' . ($this->get('class') ? $this->get('class') : 'text_area') . '"';
		$this->value = htmlspecialchars(RL_String::html_entity_decoder($this->value), ENT_QUOTES);

		return
			'<label for="' . $this->id . '" style="margin-top: -5px;">'
			. '<input type="text" name="' . $this->name . '" id="' . $this->id . '" value="' . $this->value
			. '" placeholder="' . JText::_($label) . '" title="' . JText::_($label) . '" ' . $class . ' ' . $size . '>'
			. '</label>';
	}

	protected function getInput()
	{
		return '<div style="display:none;"><div><div>';
	}
}
note.php000060400000003452152455357510006236 0ustar00<?php
/**
 * @package     Joomla.Platform
 * @subpackage  Form
 *
 * @copyright   (C) 2013 Open Source Matters, Inc. <https://www.joomla.org>
 * @license     GNU General Public License version 2 or later; see LICENSE
 */

defined('JPATH_PLATFORM') or die;

/**
 * Form Field class for the Joomla Platform.
 * Supports a one line text field.
 *
 * @link   http://www.w3.org/TR/html-markup/input.text.html#input.text
 * @since  1.7.0
 */
class JFormFieldNote extends JFormField
{
	/**
	 * The form field type.
	 *
	 * @var    string
	 * @since  1.7.0
	 */
	protected $type = 'Note';

	/**
	 * Method to get the field label markup.
	 *
	 * @return  string  The field label markup.
	 *
	 * @since   1.7.0
	 */
	protected function getLabel()
	{
		if (empty($this->element['label']) && empty($this->element['description']))
		{
			return '';
		}

		$title = $this->element['label'] ? (string) $this->element['label'] : ($this->element['title'] ? (string) $this->element['title'] : '');
		$heading = $this->element['heading'] ? (string) $this->element['heading'] : 'h4';
		$description = (string) $this->element['description'];
		$class = !empty($this->class) ? ' class="' . $this->class . '"' : '';
		$close = (string) $this->element['close'];

		$html = array();

		if ($close)
		{
			$close = $close == 'true' ? 'alert' : $close;
			$html[] = '<button type="button" class="close" data-dismiss="' . $close . '">&times;</button>';
		}

		$html[] = !empty($title) ? '<' . $heading . '>' . JText::_($title) . '</' . $heading . '>' : '';
		$html[] = !empty($description) ? JText::_($description) : '';

		return '</div><div ' . $class . '>' . implode('', $html);
	}

	/**
	 * Method to get the field input markup.
	 *
	 * @return  string  The field input markup.
	 *
	 * @since   1.7.0
	 */
	protected function getInput()
	{
		return '';
	}
}
virtuemart.php000060400000007125152455357510007474 0ustar00<?php
/**
 * @package         Regular Labs Library
 * @version         21.4.10972
 * 
 * @author          Peter van Westen <info@regularlabs.com>
 * @link            http://www.regularlabs.com
 * @copyright       Copyright © 2021 Regular Labs All Rights Reserved
 * @license         http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
 */

defined('_JEXEC') or die;

if ( ! is_file(JPATH_LIBRARIES . '/regularlabs/autoload.php'))
{
	return;
}

require_once JPATH_LIBRARIES . '/regularlabs/autoload.php';

class JFormFieldRL_VirtueMart extends \RegularLabs\Library\FieldGroup
{
	public $type     = 'VirtueMart';
	public $language = null;

	protected function getInput()
	{
		if ($error = $this->missingFilesOrTables(['categories', 'products']))
		{
			return $error;
		}

		return $this->getSelectList();
	}

	function getCategories()
	{
		$query = $this->db->getQuery(true)
			->select('COUNT(*)')
			->from('#__virtuemart_categories AS c')
			->where('c.published > -1');
		$this->db->setQuery($query);
		$total = $this->db->loadResult();

		if ($total > $this->max_list_count)
		{
			return -1;
		}

		$query->clear()
			->select('c.virtuemart_category_id as id, cc.category_parent_id AS parent_id, l.category_name AS title, c.published')
			->from('#__virtuemart_categories_' . $this->getActiveLanguage() . ' AS l')
			->join('', '#__virtuemart_categories AS c using (virtuemart_category_id)')
			->join('LEFT', '#__virtuemart_category_categories AS cc ON l.virtuemart_category_id = cc.category_child_id')
			->where('c.published > -1')
			->group('c.virtuemart_category_id')
			->order('c.ordering, l.category_name');
		$this->db->setQuery($query);
		$items = $this->db->loadObjectList();

		return $this->getOptionsTreeByList($items);
	}

	function getProducts()
	{
		$query = $this->db->getQuery(true)
			->select('COUNT(*)')
			->from('#__virtuemart_products AS p')
			->where('p.published > -1');
		$this->db->setQuery($query);
		$total = $this->db->loadResult();

		if ($total > $this->max_list_count)
		{
			return -1;
		}

		$query->clear('select')
			->select('p.virtuemart_product_id as id, l.product_name AS name, p.product_sku as sku, cl.category_name AS cat, p.published')
			->join('LEFT', '#__virtuemart_products_' . $this->getActiveLanguage() . ' AS l ON l.virtuemart_product_id = p.virtuemart_product_id')
			->join('LEFT', '#__virtuemart_product_categories AS x ON x.virtuemart_product_id = p.virtuemart_product_id')
			->join('LEFT', '#__virtuemart_categories AS c ON c.virtuemart_category_id = x.virtuemart_category_id')
			->join('LEFT', '#__virtuemart_categories_' . $this->getActiveLanguage() . ' AS cl ON cl.virtuemart_category_id = c.virtuemart_category_id')
			->group('p.virtuemart_product_id')
			->order('l.product_name, p.product_sku');
		$this->db->setQuery($query);
		$list = $this->db->loadObjectList();

		return $this->getOptionsByList($list, ['sku', 'cat', 'id']);
	}

	private function getActiveLanguage()
	{
		if (isset($this->language))
		{
			return $this->language;
		}

		$this->language = 'en_gb';

		if ( ! class_exists('VmConfig'))
		{
			require_once JPATH_ROOT . '/administrator/components/com_virtuemart/helpers/config.php';
		}

		if ( ! class_exists('VmConfig'))
		{
			return $this->language;
		}

		VmConfig::loadConfig();

		if ( ! empty(VmConfig::$vmlang))
		{
			$this->language = str_replace('-', '_', strtolower(VmConfig::$vmlang));

			return $this->language;
		}

		$active_languages = VmConfig::get('active_languages', []);

		if ( ! isset($active_languages[0]))
		{
			return $this->language;
		}

		$this->language = str_replace('-', '_', strtolower($active_languages[0]));

		return $this->language;
	}
}
simplecategories.php000060400000005732152455357510010633 0ustar00<?php
/**
 * @package         Regular Labs Library
 * @version         21.4.10972
 * 
 * @author          Peter van Westen <info@regularlabs.com>
 * @link            http://www.regularlabs.com
 * @copyright       Copyright © 2021 Regular Labs All Rights Reserved
 * @license         http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
 */

defined('_JEXEC') or die;

use Joomla\CMS\HTML\HTMLHelper as JHtml;
use Joomla\CMS\Language\Text as JText;
use RegularLabs\Library\Document as RL_Document;
use RegularLabs\Library\ShowOn as RL_ShowOn;

if ( ! is_file(JPATH_LIBRARIES . '/regularlabs/autoload.php'))
{
	return;
}

require_once JPATH_LIBRARIES . '/regularlabs/autoload.php';

class JFormFieldRL_SimpleCategories extends \RegularLabs\Library\Field
{
	public $type = 'SimpleCategories';

	protected function getInput()
	{
		$size = (int) $this->get('size');
		$attr = $this->get('onchange') ? ' onchange="' . $this->get('onchange') . '"' : '';

		$categories = $this->getOptions();
		$options    = parent::getOptions();

		if ($this->get('show_none', 1))
		{
			$options[] = JHtml::_('select.option', '', '- ' . JText::_('JNONE') . ' -');
		}

		if ($this->get('show_new', 1))
		{
			$options[] = JHtml::_('select.option', '-1', '- ' . JText::_('RL_NEW_CATEGORY') . ' -');
		}

		$options = array_merge($options, $categories);

		if ( ! $this->get('show_new', 1))
		{
			return JHtml::_('select.genericlist',
				$options,
				$this->name,
				trim($attr),
				'value',
				'text',
				$this->value,
				$this->id
			);
		}

		JHtml::_('jquery.framework');
		RL_Document::script('regularlabs/simplecategories.min.js');

		$selectlist = $this->selectListSimple(
			$options,
			$this->getName($this->fieldname . '_select'),
			$this->value,
			$this->getId('', $this->fieldname . '_select'),
			$size,
			false
		);

		$html = [];

		$html[] = '<div class="rl_simplecategory">';

		$html[] = '<div class="rl_simplecategory_select">' . $selectlist . '</div>';

		$html[] = RL_ShowOn::show(
			'<div class="rl_simplecategory_new">'
			. '<input type="text" id="' . $this->id . '_new" value="" placeholder="' . JText::_('RL_NEW_CATEGORY_ENTER') . '">'
			. '</div>',
			$this->fieldname . '_select:-1', $this->formControl
		);

		$html[] = '<input type="hidden" class="rl_simplecategory_value" id="' . $this->id . '" name="' . $this->name . '" value="' . $this->value . '" />';

		$html[] = '</div>';

		return implode('', $html);
	}

	protected function getOptions()
	{
		$table = $this->get('table');

		if ( ! $table)
		{
			return [];
		}

		// Get the user groups from the database.
		$query = $this->db->getQuery(true)
			->select([
				$this->db->quoteName('category', 'value'),
				$this->db->quoteName('category', 'text'),
			])
			->from($this->db->quoteName('#__' . $table))
			->where($this->db->quoteName('category') . ' != ' . $this->db->quote(''))
			->group($this->db->quoteName('category'))
			->order($this->db->quoteName('category') . ' ASC');
		$this->db->setQuery($query);

		return $this->db->loadObjectList();
	}
}
hr.php000060400000001455152455357510005703 0ustar00<?php
/**
 * @package         Regular Labs Library
 * @version         18.3.17810
 * 
 * @author          Peter van Westen <info@regularlabs.com>
 * @link            http://www.regularlabs.com
 * @copyright       Copyright © 2018 Regular Labs All Rights Reserved
 * @license         http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
 */

defined('_JEXEC') or die;

if ( ! is_file(JPATH_LIBRARIES . '/regularlabs/autoload.php'))
{
	return;
}

require_once JPATH_LIBRARIES . '/regularlabs/autoload.php';

use RegularLabs\Library\Document as RL_Document;

class JFormFieldRL_HR extends JFormField
{
	public $type = 'HR';

	protected function getLabel()
	{
		return '';
	}

	protected function getInput()
	{
		RL_Document::stylesheet('regularlabs/style.min.css');

		return '<div class="rl_panel rl_hr"></div>';
	}
}
hikashop.php000060400000005110152455357510007070 0ustar00<?php
/**
 * @package         Regular Labs Library
 * @version         21.4.10972
 * 
 * @author          Peter van Westen <info@regularlabs.com>
 * @link            http://www.regularlabs.com
 * @copyright       Copyright © 2021 Regular Labs All Rights Reserved
 * @license         http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
 */

defined('_JEXEC') or die;

if ( ! is_file(JPATH_LIBRARIES . '/regularlabs/autoload.php'))
{
	return;
}

require_once JPATH_LIBRARIES . '/regularlabs/autoload.php';

class JFormFieldRL_HikaShop extends \RegularLabs\Library\FieldGroup
{
	public $type = 'HikaShop';

	protected function getInput()
	{
		if ($error = $this->missingFilesOrTables(['categories' => 'category', 'products' => 'product']))
		{
			return $error;
		}

		return $this->getSelectList();
	}

	function getCategories()
	{
		$query = $this->db->getQuery(true)
			->select('COUNT(*)')
			->from('#__hikashop_category')
			->where('category_published > -1');
		$this->db->setQuery($query);
		$total = $this->db->loadResult();

		if ($total > $this->max_list_count)
		{
			return -1;
		}

		$query->clear()
			->select('c.category_id')
			->from('#__hikashop_category AS c')
			->where('c.category_type = ' . $this->db->quote('root'));
		$this->db->setQuery($query);
		$root = (int) $this->db->loadResult();

		$query->clear()
			->select('c.category_id as id, c.category_parent_id AS parent_id, c.category_name AS title, c.category_published as published')
			->from('#__hikashop_category AS c')
			->where('c.category_type = ' . $this->db->quote('product'))
			->where('c.category_published > -1')
			->order('c.category_ordering, c.category_name');
		$this->db->setQuery($query);
		$items = $this->db->loadObjectList();

		return $this->getOptionsTreeByList($items, $root);
	}

	function getProducts()
	{
		$query = $this->db->getQuery(true)
			->select('COUNT(*)')
			->from('#__hikashop_product AS p')
			->where('p.product_published = 1')
			->where('p.product_type = ' . $this->db->quote('main'));
		$this->db->setQuery($query);
		$total = $this->db->loadResult();

		if ($total > $this->max_list_count)
		{
			return -1;
		}

		$query->clear('select')
			->select('p.product_id as id, p.product_name AS name, p.product_published AS published, c.category_name AS cat')
			->join('LEFT', '#__hikashop_product_category AS x ON x.product_id = p.product_id')
			->join('INNER', '#__hikashop_category AS c ON c.category_id = x.category_id')
			->group('p.product_id')
			->order('p.product_id');
		$this->db->setQuery($query);
		$list = $this->db->loadObjectList();

		return $this->getOptionsByList($list, ['cat', 'id']);
	}
}
text.php000060400000015240152455357510006253 0ustar00<?php
/**
 * @package     Joomla.Platform
 * @subpackage  Form
 *
 * @copyright   (C) 2009 Open Source Matters, Inc. <https://www.joomla.org>
 * @license     GNU General Public License version 2 or later; see LICENSE
 */

defined('JPATH_PLATFORM') or die;

/**
 * Form Field class for the Joomla Platform.
 * Supports a one line text field.
 *
 * @link   http://www.w3.org/TR/html-markup/input.text.html#input.text
 * @since  1.7.0
 */
class JFormFieldText extends JFormField
{
	/**
	 * The form field type.
	 *
	 * @var    string
	 * @since  1.7.0
	 */
	protected $type = 'Text';

	/**
	 * The allowable maxlength of the field.
	 *
	 * @var    integer
	 * @since  3.2
	 */
	protected $maxLength;

	/**
	 * The mode of input associated with the field.
	 *
	 * @var    mixed
	 * @since  3.2
	 */
	protected $inputmode;

	/**
	 * The name of the form field direction (ltr or rtl).
	 *
	 * @var    string
	 * @since  3.2
	 */
	protected $dirname;

	/**
	 * Name of the layout being used to render the field
	 *
	 * @var    string
	 * @since  3.7
	 */
	protected $layout = 'joomla.form.field.text';

	/**
	 * Method to get certain otherwise inaccessible properties from the form field object.
	 *
	 * @param   string  $name  The property name for which to get the value.
	 *
	 * @return  mixed  The property value or null.
	 *
	 * @since   3.2
	 */
	public function __get($name)
	{
		switch ($name)
		{
			case 'maxLength':
			case 'dirname':
			case 'inputmode':
				return $this->$name;
		}

		return parent::__get($name);
	}

	/**
	 * Method to set certain otherwise inaccessible properties of the form field object.
	 *
	 * @param   string  $name   The property name for which to set the value.
	 * @param   mixed   $value  The value of the property.
	 *
	 * @return  void
	 *
	 * @since   3.2
	 */
	public function __set($name, $value)
	{
		switch ($name)
		{
			case 'maxLength':
				$this->maxLength = (int) $value;
				break;

			case 'dirname':
				$value = (string) $value;
				$this->dirname = ($value == $name || $value == 'true' || $value == '1');
				break;

			case 'inputmode':
				$this->inputmode = (string) $value;
				break;

			default:
				parent::__set($name, $value);
		}
	}

	/**
	 * Method to attach a JForm object to the field.
	 *
	 * @param   SimpleXMLElement  $element  The SimpleXMLElement object representing the `<field>` tag for the form field object.
	 * @param   mixed             $value    The form field value to validate.
	 * @param   string            $group    The field name group control value. This acts as an array container for the field.
	 *                                      For example if the field has name="foo" and the group value is set to "bar" then the
	 *                                      full field name would end up being "bar[foo]".
	 *
	 * @return  boolean  True on success.
	 *
	 * @see     JFormField::setup()
	 * @since   3.2
	 */
	public function setup(SimpleXMLElement $element, $value, $group = null)
	{
		$result = parent::setup($element, $value, $group);

		if ($result == true)
		{
			$inputmode = (string) $this->element['inputmode'];
			$dirname = (string) $this->element['dirname'];

			$this->inputmode = '';
			$inputmode = preg_replace('/\s+/', ' ', trim($inputmode));
			$inputmode = explode(' ', $inputmode);

			if (!empty($inputmode))
			{
				$defaultInputmode = in_array('default', $inputmode) ? JText::_('JLIB_FORM_INPUTMODE') . ' ' : '';

				foreach (array_keys($inputmode, 'default') as $key)
				{
					unset($inputmode[$key]);
				}

				$this->inputmode = $defaultInputmode . implode(' ', $inputmode);
			}

			// Set the dirname.
			$dirname = ((string) $dirname == 'dirname' || $dirname == 'true' || $dirname == '1');
			$this->dirname = $dirname ? $this->getName($this->fieldname . '_dir') : false;

			$this->maxLength = (int) $this->element['maxlength'];
		}

		return $result;
	}

	/**
	 * Method to get the field input markup.
	 *
	 * @return  string  The field input markup.
	 *
	 * @since   1.7.0
	 */
	protected function getInput()
	{
		if ($this->element['useglobal'])
		{
			$component = JFactory::getApplication()->input->getCmd('option');

			// Get correct component for menu items
			if ($component == 'com_menus')
			{
				$link      = $this->form->getData()->get('link');
				$uri       = new JUri($link);
				$component = $uri->getVar('option', 'com_menus');
			}

			$params = JComponentHelper::getParams($component);
			$value  = $params->get($this->fieldname);

			// Try with global configuration
			if (is_null($value))
			{
				$value = JFactory::getConfig()->get($this->fieldname);
			}

			// Try with menu configuration
			if (is_null($value) && JFactory::getApplication()->input->getCmd('option') == 'com_menus')
			{
				$value = JComponentHelper::getParams('com_menus')->get($this->fieldname);
			}

			if (!is_null($value))
			{
				$value = (string) $value;

				$this->hint = JText::sprintf('JGLOBAL_USE_GLOBAL_VALUE', $value);
			}
		}

		return $this->getRenderer($this->layout)->render($this->getLayoutData());
	}

	/**
	 * Method to get the field options.
	 *
	 * @return  array  The field option objects.
	 *
	 * @since   3.4
	 */
	protected function getOptions()
	{
		$options = array();

		foreach ($this->element->children() as $option)
		{
			// Only add <option /> elements.
			if ($option->getName() != 'option')
			{
				continue;
			}

			// Create a new option object based on the <option /> element.
			$options[] = JHtml::_(
				'select.option', (string) $option['value'],
				JText::alt(trim((string) $option), preg_replace('/[^a-zA-Z0-9_\-]/', '_', $this->fieldname)), 'value', 'text'
			);
		}

		return $options;
	}

	/**
	 * Method to get the field suggestions.
	 *
	 * @return  array  The field option objects.
	 *
	 * @since       3.2
	 * @deprecated  4.0  Use getOptions instead
	 */
	protected function getSuggestions()
	{
		return $this->getOptions();
	}

	/**
	 * Method to get the data to be passed to the layout for rendering.
	 *
	 * @return  array
	 *
	 * @since 3.7
	 */
	protected function getLayoutData()
	{
		$data = parent::getLayoutData();

		// Initialize some field attributes.
		$maxLength    = !empty($this->maxLength) ? ' maxlength="' . $this->maxLength . '"' : '';
		$inputmode    = !empty($this->inputmode) ? ' inputmode="' . $this->inputmode . '"' : '';
		$dirname      = !empty($this->dirname) ? ' dirname="' . $this->dirname . '"' : '';

		/* Get the field options for the datalist.
			Note: getSuggestions() is deprecated and will be changed to getOptions() with 4.0. */
		$options  = (array) $this->getSuggestions();

		$extraData = array(
			'maxLength' => $maxLength,
			'pattern'   => $this->pattern,
			'inputmode' => $inputmode,
			'dirname'   => $dirname,
			'options'   => $options,
		);

		return array_merge($data, $extraData);
	}
}
assignmentselection.php000060400000007301152455357510011344 0ustar00<?php
/**
 * @package         Regular Labs Library
 * @version         21.4.10972
 * 
 * @author          Peter van Westen <info@regularlabs.com>
 * @link            http://www.regularlabs.com
 * @copyright       Copyright © 2021 Regular Labs All Rights Reserved
 * @license         http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
 */

defined('_JEXEC') or die;

use Joomla\CMS\Factory as JFactory;
use Joomla\CMS\Language\Text as JText;
use RegularLabs\Library\StringHelper as RL_String;

if ( ! is_file(JPATH_LIBRARIES . '/regularlabs/autoload.php'))
{
	return;
}

require_once JPATH_LIBRARIES . '/regularlabs/autoload.php';

/**
 * @deprecated  2018-10-30  Use ConditionSelection instead
 */
class JFormFieldRL_AssignmentSelection extends \RegularLabs\Library\Field
{
	public $type = 'AssignmentSelection';

	protected function getLabel()
	{
		return '';
	}

	protected function getInput()
	{
		require_once __DIR__ . '/toggler.php';
		$toggler = new RLFieldToggler;

		$this->value     = (int) $this->value;
		$label           = $this->get('label');
		$param_name      = $this->get('name');
		$use_main_toggle = $this->get('use_main_toggle', 1);
		$showclose       = $this->get('showclose', 0);

		$html = [];

		if ( ! $label)
		{
			if ($use_main_toggle)
			{
				$html[] = $toggler->getInput(['div' => 1]);
			}

			$html[] = $toggler->getInput(['div' => 1]);

			return '</div>' . implode('', $html);
		}

		$label = RL_String::html_entity_decoder(JText::_($label));

		$html[] = '</div>';
		if ($use_main_toggle)
		{
			$html[] = $toggler->getInput(['div' => 1, 'param' => 'show_assignments|' . $param_name, 'value' => '1|1,2']);
		}

		$class = 'well well-small rl_well';
		if ($this->value === 1)
		{
			$class .= ' alert-success';
		}
		else if ($this->value === 2)
		{
			$class .= ' alert-error';
		}
		$html[] = '<div class="' . $class . '">';
		if ($showclose && JFactory::getUser()->authorise('core.admin'))
		{
			$html[] = '<button type="button" class="close rl_remove_assignment" aria-label="Close">&times;</button>';
		}

		$html[] = '<div class="control-group">';

		$html[] = '<div class="control-label">';
		$html[] = '<label><h4 class="rl_assignmentselection-header">' . $label . '</h4></label>';
		$html[] = '</div>';

		$html[] = '<div class="controls">';
		$html[] = '<fieldset id="' . $this->id . '"  class="radio btn-group">';

		$onclick = ' onclick="RegularLabsForm.setToggleTitleClass(this, 0)"';
		$html[]  = '<input type="radio" id="' . $this->id . '0" name="' . $this->name . '" value="0"' . (( ! $this->value) ? ' checked="checked"' : '') . $onclick . '>';
		$html[]  = '<label class="rl_btn-ignore" for="' . $this->id . '0">' . JText::_('RL_IGNORE') . '</label>';

		$onclick = ' onclick="RegularLabsForm.setToggleTitleClass(this, 1)"';
		$html[]  = '<input type="radio" id="' . $this->id . '1" name="' . $this->name . '" value="1"' . (($this->value === 1) ? ' checked="checked"' : '') . $onclick . '>';
		$html[]  = '<label class="rl_btn-include" for="' . $this->id . '1">' . JText::_('RL_INCLUDE') . '</label>';

		$onclick = ' onclick="RegularLabsForm.setToggleTitleClass(this, 2)"';
		$onclick .= ' onload="RegularLabsForm.setToggleTitleClass(this, ' . $this->value . ', 7)"';
		$html[]  = '<input type="radio" id="' . $this->id . '2" name="' . $this->name . '" value="2"' . (($this->value === 2) ? ' checked="checked"' : '') . $onclick . '>';
		$html[]  = '<label class="rl_btn-exclude" for="' . $this->id . '2">' . JText::_('RL_EXCLUDE') . '</label>';

		$html[] = '</fieldset>';
		$html[] = '</div>';

		$html[] = '</div>';
		$html[] = '<div class="clearfix"> </div>';

		$html[] = $toggler->getInput(['div' => 1, 'param' => $param_name, 'value' => '1,2']);
		$html[] = '<div><div>';

		return '</div>' . implode('', $html);
	}
}
radioimages.php000060400000005056152455357510007557 0ustar00<?php
/**
 * @package         Regular Labs Library
 * @version         18.3.17810
 * 
 * @author          Peter van Westen <info@regularlabs.com>
 * @link            http://www.regularlabs.com
 * @copyright       Copyright © 2018 Regular Labs All Rights Reserved
 * @license         http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
 */

defined('_JEXEC') or die;

if ( ! is_file(JPATH_LIBRARIES . '/regularlabs/autoload.php'))
{
	return;
}

require_once JPATH_LIBRARIES . '/regularlabs/autoload.php';

use RegularLabs\Library\RegEx as RL_RegEx;

class JFormFieldRL_RadioImages extends \RegularLabs\Library\Field
{
	public $type = 'RadioImages';

	protected function getInput()
	{
		$this->params = $this->element->attributes();

		jimport('joomla.filesystem.folder');
		jimport('joomla.filesystem.file');

		// path to images directory
		$path     = JPATH_ROOT . '/' . $this->get('directory');
		$filter   = $this->get('filter');
		$exclude  = $this->get('exclude');
		$stripExt = $this->get('stripext');
		$files    = JFolder::files($path, $filter);
		$rowcount = $this->get('rowcount');

		$options = [];

		if ( ! $this->get('hide_none'))
		{
			$options[] = JHtml::_('select.option', '-1', JText::_('Do not use') . '<br>');
		}

		if ( ! $this->get('hide_default'))
		{
			$options[] = JHtml::_('select.option', '', JText::_('Use default') . '<br>');
		}

		if (is_array($files))
		{
			$count = 0;
			foreach ($files as $file)
			{
				if ($exclude)
				{
					if (RL_RegEx::match(chr(1) . $exclude . chr(1), $file))
					{
						continue;
					}
				}
				$count++;
				if ($stripExt)
				{
					$file = JFile::stripExt($file);
				}
				$image = '<img src="../' . $this->get('directory') . '/' . $file . '" style="padding-right: 10px;" title="' . $file . '" alt="' . $file . '">';
				if ($rowcount && $count >= $rowcount)
				{
					$image .= '<br>';
					$count = 0;
				}
				$options[] = JHtml::_('select.option', $file, $image);
			}
		}

		$list = JHtml::_('select.radiolist', $options, '' . $this->name . '', '', 'value', 'text', $this->value, $this->id);

		$list = '<div style="float:left;">' . str_replace('<input type="radio"', '</div><div style="float:left;margin:2px 0;"><input type="radio" style="float:left;"', $list) . '</div>';
		$list = str_replace(['<label', '</label>'], ['<span style="float: left;"', '</span>'], $list);
		$list = RL_RegEx::replace('</span>(\s*)</div>', '</span></div>\1', $list);
		$list = str_replace('<br></span></div>', '<br></span></div><div style="clear:both;"></div>', $list);

		$list = '<div style="clear:both;"></div>' . $list;

		return $list;
	}
}
agents.php000060400000006526152455357510006557 0ustar00<?php
/**
 * @package         Regular Labs Library
 * @version         21.4.10972
 * 
 * @author          Peter van Westen <info@regularlabs.com>
 * @link            http://www.regularlabs.com
 * @copyright       Copyright © 2021 Regular Labs All Rights Reserved
 * @license         http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
 */

defined('_JEXEC') or die;

use Joomla\CMS\HTML\HTMLHelper as JHtml;
use Joomla\CMS\Language\Text as JText;
use Joomla\Registry\Registry;

if ( ! is_file(JPATH_LIBRARIES . '/regularlabs/autoload.php'))
{
	return;
}

require_once JPATH_LIBRARIES . '/regularlabs/autoload.php';

class JFormFieldRL_Agents extends \RegularLabs\Library\Field
{
	public $type = 'Agents';

	protected function getInput()
	{
		if ( ! is_array($this->value))
		{
			$this->value = explode(',', $this->value);
		}

		$size  = (int) $this->get('size');
		$group = $this->get('group', 'os');

		return $this->selectListSimpleAjax(
			$this->type, $this->name, $this->value, $this->id,
			compact('size', 'group')
		);
	}

	function getAjaxRaw(Registry $attributes)
	{
		$name  = $attributes->get('name', $this->type);
		$id    = $attributes->get('id', strtolower($name));
		$value = $attributes->get('value', []);
		$size  = $attributes->get('size');

		$options = $this->getAgents(
			$attributes->get('group')
		);

		return $this->selectListSimple($options, $name, $value, $id, $size, true);
	}

	function getAgents($group = 'os')
	{
		$agents = [];
		switch ($group)
		{
			/* OS */
			case 'os':
				$agents[] = ['Windows', 'Windows'];
				$agents[] = ['Mac OS', '#(Mac OS|Mac_PowerPC|Macintosh)#'];
				$agents[] = ['Linux', '#(Linux|X11)#'];
				$agents[] = ['Open BSD', 'OpenBSD'];
				$agents[] = ['Sun OS', 'SunOS'];
				$agents[] = ['QNX', 'QNX'];
				$agents[] = ['BeOS', 'BeOS'];
				$agents[] = ['OS/2', 'OS/2'];
				break;

			/* Browsers */
			case 'browsers':
				if ($this->get('simple') && $this->get('simple') !== 'false')
				{
					$agents[] = ['Chrome', 'Chrome'];
					$agents[] = ['Firefox', 'Firefox'];
					$agents[] = ['Edge', 'Edge'];
					$agents[] = ['Internet Explorer', 'MSIE'];
					$agents[] = ['Opera', 'Opera'];
					$agents[] = ['Safari', 'Safari'];
					break;
				}

				$agents[] = ['Chrome', 'Chrome'];
				$agents[] = ['Firefox', 'Firefox'];
				$agents[] = ['Microsoft Edge', 'MSIE Edge']; // missing MSIE is added to agent string in assignments/agents.php
				$agents[] = ['Internet Explorer', 'MSIE [0-9]']; // missing MSIE is added to agent string in assignments/agents.php
				$agents[] = ['Opera', 'Opera'];
				$agents[] = ['Safari', 'Safari'];
				break;

			/* Mobile browsers */
			case 'mobile':
				$agents[] = [JText::_('JALL'), 'mobile'];
				$agents[] = ['Android', 'Android'];
				$agents[] = ['Android Chrome', '#Android.*Chrome#'];
				$agents[] = ['Blackberry', 'Blackberry'];
				$agents[] = ['IE Mobile', 'IEMobile'];
				$agents[] = ['iPad', 'iPad'];
				$agents[] = ['iPhone', 'iPhone'];
				$agents[] = ['iPod Touch', 'iPod'];
				$agents[] = ['NetFront', 'NetFront'];
				$agents[] = ['Nokia', 'NokiaBrowser'];
				$agents[] = ['Opera Mini', 'Opera Mini'];
				$agents[] = ['Opera Mobile', 'Opera Mobi'];
				$agents[] = ['UC Browser', 'UC Browser'];
				break;
		}

		$options = [];
		foreach ($agents as $agent)
		{
			$option    = JHtml::_('select.option', $agent[1], $agent[0]);
			$options[] = $option;
		}

		return $options;
	}
}
codeeditor.php000060400000004264152455357510007414 0ustar00<?php
/**
 * @package         Regular Labs Library
 * @version         21.4.10972
 * 
 * @author          Peter van Westen <info@regularlabs.com>
 * @link            http://www.regularlabs.com
 * @copyright       Copyright © 2021 Regular Labs All Rights Reserved
 * @license         http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
 */

defined('_JEXEC') or die;

use Joomla\CMS\Editor\Editor as JEditor;
use Joomla\CMS\Factory as JFactory;
use Joomla\CMS\Plugin\PluginHelper as JPluginHelper;
use RegularLabs\Library\Document as RL_Document;

if ( ! is_file(JPATH_LIBRARIES . '/regularlabs/autoload.php'))
{
	return;
}

require_once JPATH_LIBRARIES . '/regularlabs/autoload.php';

class JFormFieldRL_CodeEditor extends \RegularLabs\Library\Field
{
	public $type = 'CodeEditor';

	protected function getInput()
	{
		$width  = $this->get('width', '100%');
		$height = $this->get('height', 400);
		$syntax = $this->get('syntax', 'html');

		$this->value = htmlspecialchars(str_replace('\n', "\n", $this->value), ENT_COMPAT, 'UTF-8');

		$editor_plugin = JPluginHelper::getPlugin('editors', 'codemirror');

		if (empty($editor_plugin))
		{
			return
				'<textarea name="' . $this->name . '" style="'
				. 'width:' . (strpos($width, '%') ? $width : $width . 'px') . ';'
				. 'height:' . (strpos($height, '%') ? $height : $height . 'px') . ';'
				. '" id="' . $this->id . '">' . $this->value . '</textarea>';
		}

		RL_Document::script('regularlabs/codemirror.min.js');
		RL_Document::stylesheet('regularlabs/codemirror.min.css');

		JFactory::getDocument()->addScriptDeclaration("
			jQuery(document).ready(function($) {
				RegularLabsCodeMirror.init('" . $this->id . "');
			});
		");

		JFactory::getDocument()->addStyleDeclaration("
			#rl_codemirror_" . $this->id . " .CodeMirror {
			    height: " . $height . "px;
			    min-height: " . min($height, '100') . "px;
			}
		");

		return '<div class="rl_codemirror" id="rl_codemirror_' . $this->id . '">'
			. JEditor::getInstance('codemirror')->display(
				$this->name, $this->value,
				$width, $height,
				80, 10,
				false,
				$this->id, null, null,
				['markerGutter' => false, 'activeLine' => true, 'syntax' => $syntax, 'class' => 'xxx']
			)
			. '</div>';
	}
}
dependency.php000060400000005267152455357510007415 0ustar00<?php
/**
 * @package         Regular Labs Library
 * @version         21.4.10972
 * 
 * @author          Peter van Westen <info@regularlabs.com>
 * @link            http://www.regularlabs.com
 * @copyright       Copyright © 2021 Regular Labs All Rights Reserved
 * @license         http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
 */

defined('_JEXEC') or die;

use Joomla\CMS\Factory as JFactory;
use Joomla\CMS\Language\Text as JText;
use RegularLabs\Library\RegEx as RL_RegEx;

jimport('joomla.form.formfield');

if ( ! is_file(JPATH_LIBRARIES . '/regularlabs/autoload.php'))
{
	return;
}

require_once JPATH_LIBRARIES . '/regularlabs/autoload.php';

class JFormFieldRL_Dependency extends \RegularLabs\Library\Field
{
	public $type = 'Dependency';

	protected function getLabel()
	{
		return '';
	}

	protected function getInput()
	{
		if ($file = $this->get('file'))
		{
			$label = $this->get('label', 'the main extension');

			RLFieldDependency::setMessage($file, $label);

			return '';
		}

		$path      = ($this->get('path') == 'site') ? '' : '/administrator';
		$label     = $this->get('label');
		$file      = $this->get('alias', $label);
		$file      = RL_RegEx::replace('[^a-z-]', '', strtolower($file));
		$extension = $this->get('extension');

		switch ($extension)
		{
			case 'com':
				$file = $path . '/components/com_' . $file . '/com_' . $file . '.xml';
				break;
			case 'mod':
				$file = $path . '/modules/mod_' . $file . '/mod_' . $file . '.xml';
				break;
			default:
				$file = '/plugins/' . str_replace('plg_', '', $extension) . '/' . $file . '.xml';
				break;
		}

		$label = JText::_($label) . ' (' . JText::_('RL_' . strtoupper($extension)) . ')';

		RLFieldDependency::setMessage($file, $label);

		return '';
	}
}

class RLFieldDependency
{
	static function setMessage($file, $name)
	{
		jimport('joomla.filesystem.file');

		$file = str_replace('\\', '/', $file);
		if (strpos($file, '/administrator') === 0)
		{
			$file = str_replace('/administrator', JPATH_ADMINISTRATOR, $file);
		}
		else
		{
			$file = JPATH_SITE . '/' . $file;
		}
		$file = str_replace('//', '/', $file);

		$file_alt = RL_RegEx::replace('(com|mod)_([a-z-_]+\.)', '\2', $file);

		if ( ! file_exists($file) && ! file_exists($file_alt))
		{
			$msg          = JText::sprintf('RL_THIS_EXTENSION_NEEDS_THE_MAIN_EXTENSION_TO_FUNCTION', JText::_($name));
			$message_set  = 0;
			$messageQueue = JFactory::getApplication()->getMessageQueue();
			foreach ($messageQueue as $queue_message)
			{
				if ($queue_message['type'] == 'error' && $queue_message['message'] == $msg)
				{
					$message_set = 1;
					break;
				}
			}
			if ( ! $message_set)
			{
				JFactory::getApplication()->enqueueMessage($msg, 'error');
			}
		}
	}
}
modules.php000060400000013156152455357510006743 0ustar00<?php
/**
 * @package         Regular Labs Library
 * @version         21.4.10972
 * 
 * @author          Peter van Westen <info@regularlabs.com>
 * @link            http://www.regularlabs.com
 * @copyright       Copyright © 2021 Regular Labs All Rights Reserved
 * @license         http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
 */

defined('_JEXEC') or die;

use Joomla\CMS\HTML\HTMLHelper as JHtml;
use Joomla\CMS\Language\Text as JText;
use RegularLabs\Library\Form as RL_Form;
use RegularLabs\Library\RegEx as RL_RegEx;

if ( ! is_file(JPATH_LIBRARIES . '/regularlabs/autoload.php'))
{
	return;
}

require_once JPATH_LIBRARIES . '/regularlabs/autoload.php';

class JFormFieldRL_Modules extends \RegularLabs\Library\Field
{
	public $type = 'Modules';

	protected function getInput()
	{
		JHtml::_('behavior.modal', 'a.modal');

		$size = $this->get('size') ? 'style="width:' . $this->get('size') . 'px"' : '';

		$multiple  = $this->get('multiple');
		$showtype  = $this->get('showtype');
		$showid    = $this->get('showid');
		$showinput = $this->get('showinput');
		$showlink  = ! $multiple ? $this->get('showlink') : false;

		// load the list of modules
		$query = $this->db->getQuery(true)
			->select('m.id, m.title, m.position, m.module, m.published, m.language')
			->from('#__modules AS m')
			->where('m.client_id = 0')
			->where('m.published > -2')
			->order('m.position, m.title, m.ordering, m.id');
		$this->db->setQuery($query);
		$modules = $this->db->loadObjectList();

		// assemble menu items to the array
		$options = [];

		$selected_title = '';

		$p = 0;
		foreach ($modules as $item)
		{
			if ($p !== $item->position)
			{
				$pos = $item->position;
				if ($pos == '')
				{
					$pos = ':: ' . JText::_('JNONE') . ' ::';
				}
				$options[] = JHtml::_('select.option', '-', '[ ' . $pos . ' ]', 'value', 'text', true);
			}
			$p = $item->position;

			$item->title = $item->title;
			if ($showtype)
			{
				$item->title .= ' [' . $item->module . ']';
			}
			if ($showinput || $showid)
			{
				$item->title .= ' [' . $item->id . ']';
			}
			if ($item->language && $item->language != '*')
			{
				$item->title .= ' (' . $item->language . ')';
			}
			$item->title = RL_Form::prepareSelectItem($item->title, $item->published);

			$options[] = JHtml::_('select.option', $item->id, $item->title);

			if ($showlink && $this->value == $item->id)
			{
				$selected_title = $item->title;
			}
		}

		if ($showinput)
		{
			array_unshift($options, JHtml::_('select.option', '-', '&nbsp;', 'value', 'text', true));
			array_unshift($options, JHtml::_('select.option', '-', '- ' . JText::_('Select Item') . ' -'));

			if ($multiple)
			{
				$onchange = 'if ( this.value ) { if ( ' . $this->id . '.value ) { ' . $this->id . '.value+=\',\'; } ' . $this->id . '.value+=this.value; } this.value=\'\';';
			}
			else
			{
				$onchange = 'if ( this.value ) { ' . $this->id . '.value=this.value;' . $this->id . '_text.value=this.options[this.selectedIndex].innerHTML.replace( /^((&|&amp;|&#160;)nbsp;|-)*/gm, \'\' ).trim(); } this.value=\'\';';
			}
			$attribs = 'class="inputbox" onchange="' . $onchange . '"';

			$html = '<table cellpadding="0" cellspacing="0"><tr><td style="padding: 0px;">' . "\n";
			if ( ! $multiple)
			{
				$val_name = $this->value;
				if ($this->value)
				{
					foreach ($modules as $item)
					{
						if ($item->id == $this->value)
						{
							$val_name = $item->title;
							if ($showtype)
							{
								$val_name .= ' [' . $item->module . ']';
							}
							$val_name .= ' [' . $this->value . ']';
							break;
						}
					}
				}
				$html .= '<input type="text" id="' . $this->id . '_text" value="' . $val_name . '" class="inputbox" ' . $size . ' disabled="disabled">';
				$html .= '<input type="hidden" name="' . $this->name . '" id="' . $this->id . '" value="' . $this->value . '">';
			}
			else
			{
				$html .= '<input type="text" name="' . $this->name . '" id="' . $this->id . '" value="' . $this->value . '" class="inputbox" ' . $size . '>';
			}
			$html .= '</td><td style="padding: 0px;"padding-left: 5px;>' . "\n";
			$html .= JHtml::_('select.genericlist', $options, '', $attribs, 'value', 'text', '', '');
			$html .= '</td></tr></table>' . "\n";
		}
		else
		{
			$attr = $size;
			$attr .= $multiple ? ' multiple="multiple"' : '';
			$attr .= ' class="input-xxlarge"';

			if ($showlink)
			{
				$link = '\'<a'
					. ' href=&quot;index.php?option=com_advancedmodules&task=module.edit&id=\'+this.value+\'&quot;'
					. ' target=&quot;_blank&quot; class=&quot;btn btn-small&quot;>\''
					. '+\'<span class=&quot;icon-edit&quot;></span>\' '
					. '+\'' . JText::_('JACTION_EDIT', true) . ' :\' '
					. '+(this.options[this.selectedIndex].text)'
					. '+\'</a>\'';

				$function = 'document.getElementById(\'module_link_' . $this->id . '\').innerHTML = \'\';'
					. 'if(this.value){'
					. 'document.getElementById(\'module_link_' . $this->id . '\').innerHTML = ' . $link . ';'
					. '}';

				$attr .= ' onchange="' . $function . '"';
			}

			$html = JHtml::_('select.genericlist', $options, $this->name, trim($attr), 'value', 'text', $this->value, $this->id);

			if ($showlink)
			{
				$link = $this->value
					? '<a href="index.php?option=com_advancedmodules&task=module.edit&id=' . $this->value . '"'
					. ' target="_blank" class="btn btn-small">'
					. '<span class="icon-edit"></span> '
					. JText::_('JACTION_EDIT') . ': ' . $selected_title
					. '</a>'
					: '';

				$html .= '<div id="module_link_' . $this->id . '" class="alert-block">'
					. $link
					. '</div>';
			}

			$html = '<div class="input-maximize">' . $html . '</div>';
		}

		return RL_RegEx::replace('>\[\[\:(.*?)\:\]\]', ' style="\1">', $html);
	}
}
key.php000060400000005560152455357510006063 0ustar00<?php
/**
 * @package         Regular Labs Library
 * @version         21.4.10972
 * 
 * @author          Peter van Westen <info@regularlabs.com>
 * @link            http://www.regularlabs.com
 * @copyright       Copyright © 2021 Regular Labs All Rights Reserved
 * @license         http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
 */

defined('_JEXEC') or die;

use Joomla\CMS\Language\Text as JText;

if ( ! is_file(JPATH_LIBRARIES . '/regularlabs/autoload.php'))
{
	return;
}

require_once JPATH_LIBRARIES . '/regularlabs/autoload.php';

class JFormFieldRL_Key extends \RegularLabs\Library\Field
{
	public $type = 'Key';

	protected function getInput()
	{
		$action = $this->get('action', 'Joomla.submitbutton(\'config.save.component.apply\')');

		$key = trim($this->value);

		if ( ! $key)
		{
			return '<div id="' . $this->id . '_field" class="btn-wrapper input-append clearfix">'
				. '<input type="text" class="rl_codefield" name="' . $this->name . '" id="' . $this->id . '" autocomplete="off" value="">'
				. '<button href="#" class="btn btn-success" title="' . JText::_('JAPPLY') . '" onclick="' . $action . '">'
				. '<span class="icon-checkmark"></span>'
				. '</button>'
				. '</div>';
		}

		$cloak_length = max(0, strlen($key) - 4);
		$key          = str_repeat('*', $cloak_length) . substr($this->value, $cloak_length);

		$show = 'jQuery(\'#' . $this->id . '\').attr(\'name\', \'' . $this->name . '\');'
			. 'jQuery(\'#' . $this->id . '_hidden\').attr(\'name\', \'\');'
			. 'jQuery(\'#' . $this->id . '_button\').hide();'
			. 'jQuery(\'#' . $this->id . '_field\').show();';

		$hide = 'jQuery(\'#' . $this->id . '\').attr(\'name\', \'\');'
			. 'jQuery(\'#' . $this->id . '_hidden\').attr(\'name\', \'' . $this->name . '\');'
			. 'jQuery(\'#' . $this->id . '_field\').hide();'
			. 'jQuery(\'#' . $this->id . '_button\').show();';

		return
			'<div class="rl_keycode pull-left">' . $key . '</div>'

			. '<div id="' . $this->id . '_button" class="pull-left">'
			. '<button class="btn btn-default btn-small" onclick="' . $show . ';return false;">'
			. '<span class="icon-edit"></span> '
			. JText::_('JACTION_EDIT')
			. '</button>'
			. '</div>'

			. '<div class="clearfix"></div>'

			. '<div id="' . $this->id . '_field" class="btn-wrapper input-append clearfix" style="display:none;">'
			. '<input type="text" class="rl_codefield" name="" id="' . $this->id . '" autocomplete="off" value="">'
			. '<button href="#" class="btn btn-success btn" title="' . JText::_('JAPPLY') . '" onclick="' . $action . '">'
			. '<span class="icon-checkmark"></span>'
			. '</button>'
			. '<button href="#" class="btn btn-danger btn" title="' . JText::_('JCANCEL') . '" onclick="' . $hide . ';return false;">'
			. '<span class="icon-cancel-2"></span>'
			. '</button>'
			. '</div>'

			. '<input type="hidden" name="' . $this->name . '" id="' . $this->id . '_hidden" value="' . $this->value . '">';
	}
}

checkbox.php000060400000010416152455357510007055 0ustar00<?php
/**
 * @package     Joomla.Platform
 * @subpackage  Form
 *
 * @copyright   (C) 2009 Open Source Matters, Inc. <https://www.joomla.org>
 * @license     GNU General Public License version 2 or later; see LICENSE
 */

defined('JPATH_PLATFORM') or die;

/**
 * Form Field class for the Joomla Platform.
 * Single checkbox field.
 * This is a boolean field with null for false and the specified option for true
 *
 * @link   http://www.w3.org/TR/html-markup/input.checkbox.html#input.checkbox
 * @see    JFormFieldCheckboxes
 * @since  1.7.0
 */
class JFormFieldCheckbox extends JFormField
{
	/**
	 * The form field type.
	 *
	 * @var    string
	 * @since  1.7.0
	 */
	protected $type = 'Checkbox';

	/**
	 * The checked state of checkbox field.
	 *
	 * @var    boolean
	 * @since  3.2
	 */
	protected $checked = false;

	/**
	 * Method to get certain otherwise inaccessible properties from the form field object.
	 *
	 * @param   string  $name  The property name for which to get the value.
	 *
	 * @return  mixed  The property value or null.
	 *
	 * @since   3.2
	 */
	public function __get($name)
	{
		switch ($name)
		{
			case 'checked':
				return $this->checked;
		}

		return parent::__get($name);
	}

	/**
	 * Method to set certain otherwise inaccessible properties of the form field object.
	 *
	 * @param   string  $name   The property name for which to set the value.
	 * @param   mixed   $value  The value of the property.
	 *
	 * @return  void
	 *
	 * @since   3.2
	 */
	public function __set($name, $value)
	{
		switch ($name)
		{
			case 'checked':
				$value = (string) $value;
				$this->checked = ($value == 'true' || $value == $name || $value == '1');
				break;

			default:
				parent::__set($name, $value);
		}
	}

	/**
	 * Method to attach a JForm object to the field.
	 *
	 * @param   SimpleXMLElement  $element  The SimpleXMLElement object representing the `<field>` tag for the form field object.
	 * @param   mixed             $value    The form field value to validate.
	 * @param   string            $group    The field name group control value. This acts as an array container for the field.
	 *                                      For example if the field has name="foo" and the group value is set to "bar" then the
	 *                                      full field name would end up being "bar[foo]".
	 *
	 * @return  boolean  True on success.
	 *
	 * @see     JFormField::setup()
	 * @since   3.2
	 */
	public function setup(SimpleXMLElement $element, $value, $group = null)
	{
		// Handle the default attribute
		$default = (string) $element['default'];

		if ($default)
		{
			$test = $this->form->getValue((string) $element['name'], $group);

			$value = ($test == $default) ? $default : null;
		}

		$return = parent::setup($element, $value, $group);

		if ($return)
		{
			$checked = (string) $this->element['checked'];
			$this->checked = ($checked == 'true' || $checked == 'checked' || $checked == '1');

			empty($this->value) || $this->checked ? null : $this->checked = true;
		}

		return $return;
	}

	/**
	 * Method to get the field input markup.
	 * The checked element sets the field to selected.
	 *
	 * @return  string  The field input markup.
	 *
	 * @since   1.7.0
	 */
	protected function getInput()
	{
		// Initialize some field attributes.
		$class     = !empty($this->class) ? ' class="' . $this->class . '"' : '';
		$disabled  = $this->disabled ? ' disabled' : '';
		$value     = !empty($this->default) ? $this->default : '1';
		$required  = $this->required ? ' required aria-required="true"' : '';
		$autofocus = $this->autofocus ? ' autofocus' : '';
		$checked   = $this->checked || !empty($this->value) ? ' checked' : '';

		// Initialize JavaScript field attributes.
		$onclick  = !empty($this->onclick) ? ' onclick="' . $this->onclick . '"' : '';
		$onchange = !empty($this->onchange) ? ' onchange="' . $this->onchange . '"' : '';

		// Including fallback code for HTML5 non supported browsers.
		JHtml::_('jquery.framework');
		JHtml::_('script', 'system/html5fallback.js', array('version' => 'auto', 'relative' => true, 'conditional' => 'lt IE 9'));

		return '<input type="checkbox" name="' . $this->name . '" id="' . $this->id . '" value="'
			. htmlspecialchars($value, ENT_COMPAT, 'UTF-8') . '"' . $class . $checked . $disabled . $onclick . $onchange
			. $required . $autofocus . ' />';
	}
}
color.php000060400000015025152455357510006406 0ustar00<?php
/**
 * @package     Joomla.Platform
 * @subpackage  Form
 *
 * @copyright   (C) 2011 Open Source Matters, Inc. <https://www.joomla.org>
 * @license     GNU General Public License version 2 or later; see LICENSE
 */

defined('JPATH_PLATFORM') or die;

/**
 * Color Form Field class for the Joomla Platform.
 * This implementation is designed to be compatible with HTML5's `<input type="color">`
 *
 * @link   http://www.w3.org/TR/html-markup/input.color.html
 * @since  1.7.3
 */
class JFormFieldColor extends JFormField
{
	/**
	 * The form field type.
	 *
	 * @var    string
	 * @since  1.7.3
	 */
	protected $type = 'Color';

	/**
	 * The control.
	 *
	 * @var    mixed
	 * @since  3.2
	 */
	protected $control = 'hue';

	/**
	 * The format.
	 *
	 * @var    string
	 * @since  3.6.0
	 */
	protected $format = 'hex';

	/**
	 * The keywords (transparent,initial,inherit).
	 *
	 * @var    string
	 * @since  3.6.0
	 */
	protected $keywords = '';

	/**
	 * The position.
	 *
	 * @var    mixed
	 * @since  3.2
	 */
	protected $position = 'default';

	/**
	 * The colors.
	 *
	 * @var    mixed
	 * @since  3.2
	 */
	protected $colors;

	/**
	 * The split.
	 *
	 * @var    integer
	 * @since  3.2
	 */
	protected $split = 3;

	/**
	 * Name of the layout being used to render the field
	 *
	 * @var    string
	 * @since  3.5
	 */
	protected $layout = 'joomla.form.field.color';

	/**
	 * Method to get certain otherwise inaccessible properties from the form field object.
	 *
	 * @param   string  $name  The property name for which to get the value.
	 *
	 * @return  mixed  The property value or null.
	 *
	 * @since   3.2
	 */
	public function __get($name)
	{
		switch ($name)
		{
			case 'control':
			case 'format':
			case 'keywords':
			case 'exclude':
			case 'colors':
			case 'split':
				return $this->$name;
		}

		return parent::__get($name);
	}

	/**
	 * Method to set certain otherwise inaccessible properties of the form field object.
	 *
	 * @param   string  $name   The property name for which to set the value.
	 * @param   mixed   $value  The value of the property.
	 *
	 * @return  void
	 *
	 * @since   3.2
	 */
	public function __set($name, $value)
	{
		switch ($name)
		{
			case 'split':
				$value = (int) $value;
			case 'control':
			case 'format':
				$this->$name = (string) $value;
				break;
			case 'keywords':
				$this->$name = (string) $value;
				break;
			case 'exclude':
			case 'colors':
				$this->$name = (string) $value;
				break;

			default:
				parent::__set($name, $value);
		}
	}

	/**
	 * Method to attach a JForm object to the field.
	 *
	 * @param   SimpleXMLElement  $element  The SimpleXMLElement object representing the `<field>` tag for the form field object.
	 * @param   mixed             $value    The form field value to validate.
	 * @param   string            $group    The field name group control value. This acts as an array container for the field.
	 *                                      For example if the field has name="foo" and the group value is set to "bar" then the
	 *                                      full field name would end up being "bar[foo]".
	 *
	 * @return  boolean  True on success.
	 *
	 * @see     JFormField::setup()
	 * @since   3.2
	 */
	public function setup(SimpleXMLElement $element, $value, $group = null)
	{
		$return = parent::setup($element, $value, $group);

		if ($return)
		{
			$this->control  = isset($this->element['control']) ? (string) $this->element['control'] : 'hue';
			$this->format   = isset($this->element['format']) ? (string) $this->element['format'] : 'hex';
			$this->keywords = isset($this->element['keywords']) ? (string) $this->element['keywords'] : '';
			$this->position = isset($this->element['position']) ? (string) $this->element['position'] : 'default';
			$this->colors   = (string) $this->element['colors'];
			$this->split    = isset($this->element['split']) ? (int) $this->element['split'] : 3;
		}

		return $return;
	}

	/**
	 * Method to get the field input markup.
	 *
	 * @return  string  The field input markup.
	 *
	 * @since   1.7.3
	 */
	protected function getInput()
	{
		// Switch the layouts
		$this->layout = $this->control === 'simple' ? $this->layout . '.simple' : $this->layout . '.advanced';

		// Trim the trailing line in the layout file
		return rtrim($this->getRenderer($this->layout)->render($this->getLayoutData()), PHP_EOL);
	}

	/**
	 * Method to get the data to be passed to the layout for rendering.
	 *
	 * @return  array
	 *
	 * @since 3.5
	 */
	protected function getLayoutData()
	{
		$lang  = JFactory::getLanguage();
		$data  = parent::getLayoutData();
		$color = strtolower($this->value);
		$color = ! $color ? '' : $color;

		// Position of the panel can be: right (default), left, top or bottom (default RTL is left)
		$position = ' data-position="' . (($lang->isRTL() && $this->position == 'default') ? 'left' : $this->position) . '"';

		if (!$color || in_array($color, array('none', 'transparent')))
		{
			$color = 'none';
		}
		elseif ($color['0'] != '#' && $this->format == 'hex')
		{
			$color = '#' . $color;
		}

		// Assign data for simple/advanced mode
		$controlModeData = $this->control === 'simple' ? $this->getSimpleModeLayoutData() : $this->getAdvancedModeLayoutData($lang);

		$extraData = array(
			'color'    => $color,
			'format'   => $this->format,
			'keywords' => $this->keywords,
			'position' => $position,
			'validate' => $this->validate
		);

		return array_merge($data, $extraData, $controlModeData);
	}

	/**
	 * Method to get the data for the simple mode to be passed to the layout for rendering.
	 *
	 * @return  array
	 *
	 * @since 3.5
	 */
	protected function getSimpleModeLayoutData()
	{
		$colors = strtolower($this->colors);

		if (empty($colors))
		{
			$colors = array(
				'none',
				'#049cdb',
				'#46a546',
				'#9d261d',
				'#ffc40d',
				'#f89406',
				'#c3325f',
				'#7a43b6',
				'#ffffff',
				'#999999',
				'#555555',
				'#000000',
			);
		}
		else
		{
			$colors = explode(',', $colors);
		}

		if (!$this->split)
		{
			$count = count($colors);
			if ($count % 5 == 0)
			{
				$split = 5;
			}
			else
			{
				if ($count % 4 == 0)
				{
					$split = 4;
				}
			}
		}

		$split = $this->split ? $this->split : 3;

		return array(
			'colors' => $colors,
			'split'  => $split,
		);
	}

	/**
	 * Method to get the data for the advanced mode to be passed to the layout for rendering.
	 *
	 * @param   object  $lang  The language object
	 *
	 * @return  array
	 *
	 * @since   3.5
	 */
	protected function getAdvancedModeLayoutData($lang)
	{
		return array(
			'colors'  => $this->colors,
			'control' => $this->control,
			'lang'    => $lang,
		);
	}
}
render.php000060400000003040152455572240006540 0ustar00<?php
/**
 * @package     Joomla.Site
 * @subpackage  com_fields
 *
 * @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;

// Check if we have all the data
if (!key_exists('item', $displayData) || !key_exists('context', $displayData))
{
	return;
}

// Setting up for display
$item = $displayData['item'];

if (!$item)
{
	return;
}

$context = $displayData['context'];

if (!$context)
{
	return;
}

JLoader::register('FieldsHelper', JPATH_ADMINISTRATOR . '/components/com_fields/helpers/fields.php');

$parts     = explode('.', $context);
$component = $parts[0];
$fields    = null;

if (key_exists('fields', $displayData))
{
	$fields = $displayData['fields'];
}
else
{
	$fields = $item->jcfields ?: FieldsHelper::getFields($context, $item, true);
}

if (empty($fields))
{
	return;
}

$output = array();

foreach ($fields as $field)
{
	// If the value is empty do nothing
	if (!isset($field->value) || trim($field->value) === '')
	{
		continue;
	}

	$class = $field->name . ' ' . $field->params->get('render_class');
	$layout = $field->params->get('layout', 'render');
	$content = FieldsHelper::render($context, 'field.' . $layout, array('field' => $field));

	// If the content is empty do nothing
	if (trim($content) === '') 
	{
		continue;
	}

	$output[] = '<dd class="field-entry ' . $class . '">' . $content . '</dd>';
}

if (empty($output))
{
	return;
}

?>
<dl class="fields-container">
	<?php echo implode("\n", $output); ?>
</dl>
mediajce/video.php000060400000000375152455706400010135 0ustar00<?php

defined('_JEXEC') or die;

use Joomla\Utilities\ArrayHelper;

array_walk($displayData, function (&$value, $key) {
    $value = htmlspecialchars($value, ENT_QUOTES, 'UTF-8');
});

echo '<video ' . ArrayHelper::toString($displayData) . '></video>';mediajce/iframe.php000060400000000377152455706400010274 0ustar00<?php

defined('_JEXEC') or die;

use Joomla\Utilities\ArrayHelper;

array_walk($displayData, function (&$value, $key) {
    $value = htmlspecialchars($value, ENT_QUOTES, 'UTF-8');
});

echo '<iframe ' . ArrayHelper::toString($displayData) . '></iframe>';mediajce/figure.php000060400000000750152455706400010305 0ustar00<?php

defined('_JEXEC') or die;

use Joomla\Utilities\ArrayHelper;

$caption    = $displayData['caption'];
$html       = $displayData['html']; 

unset($displayData['caption']);
unset($displayData['html']);

array_walk($displayData, function (&$value, $key) {
    $value = htmlspecialchars($value, ENT_QUOTES, 'UTF-8');
});

echo '<figure' . ArrayHelper::toString($displayData) . '>' . $html . '<figcaption>' . htmlentities($caption, ENT_COMPAT, 'UTF-8', true) . '</figcaption></figure>';mediajce/image.php000060400000000507152455706400010106 0ustar00<?php

defined('_JEXEC') or die;

use Joomla\Utilities\ArrayHelper;

array_walk($displayData, function (&$value, $key) {
    $value = htmlspecialchars($value, ENT_QUOTES, 'UTF-8');

    if ($key !== 'alt' && $value == '') {
        unset($displayData[$key]);
    }
});

echo '<img ' . ArrayHelper::toString($displayData) . '>';mediajce/object.php000060400000000435152455706400010272 0ustar00<?php

defined('_JEXEC') or die;

use Joomla\Utilities\ArrayHelper;

unset ($displayData['src']);

array_walk($displayData, function (&$value, $key) {
    $value = htmlspecialchars($value, ENT_QUOTES, 'UTF-8');
});

echo '<object ' . ArrayHelper::toString($displayData) . '></object>';mediajce/link.php000060400000000753152455706400007764 0ustar00<?php

defined('_JEXEC') or die;

use Joomla\Utilities\ArrayHelper;

$displayData['href'] = $displayData['src'];

unset($displayData['src']);

$attribs = array();

foreach ($displayData as $key => $value) {
    if ($value !== '') {
        $value = htmlspecialchars($value, ENT_QUOTES, 'UTF-8');
        $attribs[$key] = $value;
    }
};

$text = isset($attribs['title']) ? $attribs['title'] : basename($attribs['href']);

echo '<a ' . ArrayHelper::toString($attribs) . '>' . $text . '</a>';mediajce/audio.php000060400000000375152455706400010130 0ustar00<?php

defined('_JEXEC') or die;

use Joomla\Utilities\ArrayHelper;

array_walk($displayData, function (&$value, $key) {
    $value = htmlspecialchars($value, ENT_QUOTES, 'UTF-8');
});

echo '<audio ' . ArrayHelper::toString($displayData) . '></audio>';calendar/tmpl/calendar.php000060400000001044152455757150011566 0ustar00<?php
/**
 * @package     Joomla.Plugin
 * @subpackage  Fields.Calendar
 *
 * @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;

$value = $field->value;

if ($value == '')
{
	return;
}

if (is_array($value))
{
	$value = implode(', ', $value);
}

$formatString =  $field->fieldparams->get('showtime', 0) ? 'DATE_FORMAT_LC5' : 'DATE_FORMAT_LC4';

echo htmlentities(JHtml::_('date', $value, JText::_($formatString)));
calendar/params/calendar.xml000060400000000720152455757150012106 0ustar00<?xml version="1.0" encoding="utf-8"?>
<form>
	<fields name="fieldparams">
		<fieldset name="fieldparams">
			<field
				name="showtime"
				type="radio"
				label="PLG_FIELDS_CALENDAR_PARAMS_SHOWTIME_LABEL"
				description="PLG_FIELDS_CALENDAR_PARAMS_SHOWTIME_DESC"
				class="btn-group btn-group-yesno"
				default="0"
				filter="integer"
				>
				<option value="1">JYES</option>
				<option value="0">JNO</option>
			</field>
		</fieldset>
	</fields>
</form>
calendar/calendar.xml000060400000001504152455757150010624 0ustar00<?xml version="1.0" encoding="utf-8" ?>
<extension type="plugin" version="3.7.0" group="fields" method="upgrade">
	<name>plg_fields_calendar</name>
	<author>Joomla! Project</author>
	<creationDate>March 2016</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_CALENDAR_XML_DESCRIPTION</description>
	<files>
		<filename plugin="calendar">calendar.php</filename>
		<folder>params</folder>
		<folder>tmpl</folder>
	</files>
	<languages>
		<language tag="en-GB">en-GB.plg_fields_calendar.ini</language>
		<language tag="en-GB">en-GB.plg_fields_calendar.sys.ini</language>
	</languages>
</extension>
calendar/calendar.php000060400000002361152455757150010615 0ustar00<?php
/**
 * @package     Joomla.Plugin
 * @subpackage  Fields.Calendar
 *
 * @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;

JLoader::import('components.com_fields.libraries.fieldsplugin', JPATH_ADMINISTRATOR);

/**
 * Fields Calendar Plugin
 *
 * @since  3.7.0
 */
class PlgFieldsCalendar extends FieldsPlugin
{
	/**
	 * 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   JForm       $form    The form.
	 *
	 * @return  DOMElement
	 *
	 * @since   3.7.0
	 */
	public function onCustomFieldsPrepareDom($field, DOMElement $parent, JForm $form)
	{
		$fieldNode = parent::onCustomFieldsPrepareDom($field, $parent, $form);

		if (!$fieldNode)
		{
			return $fieldNode;
		}

		// Set filter to user UTC
		$fieldNode->setAttribute('filter', 'USER_UTC');

		// Set field to use translated formats
		$fieldNode->setAttribute('translateformat', '1');
		$fieldNode->setAttribute('showtime', $field->fieldparams->get('showtime', 0) ? 'true' : 'false');

		return $fieldNode;
	}
}
user/tmpl/user.php000060400000001230152455757150010175 0ustar00<?php
/**
 * @package     Joomla.Plugin
 * @subpackage  Fields.User
 *
 * @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;

$value = $field->value;

if ($value == '')
{
	return;
}

$value = (array) $value;
$texts = array();

foreach ($value as $userId)
{
	if (!$userId)
	{
		continue;
	}

	$user = JFactory::getUser($userId);

	if ($user)
	{
		// Use the Username
		$texts[] = $user->name;
		continue;
	}

	// Fallback and add the User ID if we get no JUser Object
	$texts[] = $userId;
}

echo htmlentities(implode(', ', $texts));
user/params/user.xml000060400000000600152455757150010515 0ustar00<?xml version="1.0" encoding="utf-8"?>
<form>
	<field
		name="default_value"
		type="user"
		label="PLG_FIELDS_USER_DEFAULT_VALUE_LABEL"
		description="PLG_FIELDS_USER_DEFAULT_VALUE_DESC"
	/>
	<fields name="params" label="COM_FIELDS_FIELD_BASIC_LABEL">
		<fieldset name="basic">
			<field
				name="show_on"
				type="hidden"
				filter="unset"
			/>
		</fieldset>
	</fields>
</form>
user/user.xml000060400000001422152455757150007235 0ustar00<?xml version="1.0" encoding="utf-8" ?>
<extension type="plugin" version="3.7.0" group="fields" method="upgrade">
	<name>plg_fields_user</name>
	<author>Joomla! Project</author>
	<creationDate>March 2016</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_USER_XML_DESCRIPTION</description>
	<files>
		<filename plugin="user">user.php</filename>
		<folder>tmpl</folder>
	</files>
	<languages>
		<language tag="en-GB">en-GB.plg_fields_user.ini</language>
		<language tag="en-GB">en-GB.plg_fields_user.sys.ini</language>
	</languages>
</extension>
user/user.php000060400000002004152455757150007221 0ustar00<?php
/**
 * @package     Joomla.Plugin
 * @subpackage  Fields.User
 *
 * @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;

JLoader::import('components.com_fields.libraries.fieldsplugin', JPATH_ADMINISTRATOR);

/**
 * Fields User Plugin
 *
 * @since  3.7.0
 */
class PlgFieldsUser extends FieldsPlugin
{

	/**
	 * 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   JForm       $form    The form.
	 *
	 * @return  DOMElement
	 *
	 * @since   3.7.0
	 */
	public function onCustomFieldsPrepareDom($field, DOMElement $parent, JForm $form)
	{
		if (JFactory::getApplication()->isClient('site'))
		{
			// The user field is not working on the front end
			return;
		}

		return parent::onCustomFieldsPrepareDom($field, $parent, $form);
	}
}
radio/radio.xml000060400000003011152455757150007471 0ustar00<?xml version="1.0" encoding="utf-8" ?>
<extension type="plugin" version="3.7.0" group="fields" method="upgrade">
	<name>plg_fields_radio</name>
	<author>Joomla! Project</author>
	<creationDate>March 2016</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_RADIO_XML_DESCRIPTION</description>
	<files>
		<filename plugin="radio">radio.php</filename>
		<folder>params</folder>
		<folder>tmpl</folder>
	</files>
	<languages>
		<language tag="en-GB">en-GB.plg_fields_radio.ini</language>
		<language tag="en-GB">en-GB.plg_fields_radio.sys.ini</language>
	</languages>
	<config>
		<fields name="params">
			<fieldset name="basic">
				<field
					name="options"
					type="subform"
					label="PLG_FIELDS_RADIO_PARAMS_OPTIONS_LABEL"
					description="PLG_FIELDS_RADIO_PARAMS_OPTIONS_DESC"
					layout="joomla.form.field.subform.repeatable-table"
					icon="list"
					multiple="true"
					>
					<form hidden="true" name="list_templates_modal" repeat="true">
						<field
							name="name"
							type="text"
							label="PLG_FIELDS_RADIO_PARAMS_OPTIONS_NAME_LABEL"
							size="30"
						/>

						<field
							name="value"
							type="text"
							label="PLG_FIELDS_RADIO_PARAMS_OPTIONS_VALUE_LABEL"
							size="30"
						/>
					</form>
				</field>
			</fieldset>
		</fields>
	</config>
</extension>
radio/radio.php000060400000000703152455757150007465 0ustar00<?php
/**
 * @package     Joomla.Plugin
 * @subpackage  Fields.Radio
 *
 * @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;

JLoader::import('components.com_fields.libraries.fieldslistplugin', JPATH_ADMINISTRATOR);

/**
 * Fields Radio Plugin
 *
 * @since  3.7.0
 */
class PlgFieldsRadio extends FieldsListPlugin
{
}
radio/tmpl/radio.php000060400000001124152455757150010437 0ustar00<?php
/**
 * @package     Joomla.Plugin
 * @subpackage  Fields.Radio
 *
 * @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;

$value = $field->value;

if ($value == '')
{
	return;
}

$value   = (array) $value;
$texts   = array();
$options = $this->getOptionsFromField($field);

foreach ($options as $optionValue => $optionText)
{
	if (in_array((string) $optionValue, $value))
	{
		$texts[] = JText::_($optionText);
	}
}


echo htmlentities(implode(', ', $texts));
radio/params/radio.xml000060400000001777152455757150010775 0ustar00<?xml version="1.0" encoding="utf-8"?>
<form>
	<fields name="fieldparams">
		<fieldset name="fieldparams">
			<field
				name="options"
				type="subform"
				label="PLG_FIELDS_RADIO_PARAMS_OPTIONS_LABEL"
				description="PLG_FIELDS_RADIO_PARAMS_OPTIONS_DESC"
				layout="joomla.form.field.subform.repeatable-table"
				icon="list"
				multiple="true"
				>
				<form hidden="true" name="list_templates_modal" repeat="true">
					<field
						name="name"
						type="text"
						label="PLG_FIELDS_RADIO_PARAMS_OPTIONS_NAME_LABEL"
						size="30"
					/>

					<field
						name="value"
						type="text"
						label="PLG_FIELDS_RADIO_PARAMS_OPTIONS_VALUE_LABEL"
						size="30"
					/>
				</form>
			</field>
		</fieldset>
	</fields>

	<fields name="params">
		<fieldset name="basic">
			<field
				name="class"
				type="textarea"
				label="COM_FIELDS_FIELD_CLASS_LABEL"
				description="COM_FIELDS_FIELD_CLASS_DESC"
				class="input-xxlarge"
				size="40"
				default="btn-group"
			/>
		</fieldset>
	</fields>
</form>
textarea/tmpl/textarea.php000060400000000550152455757150011677 0ustar00<?php
/**
 * @package     Joomla.Plugin
 * @subpackage  Fields.Textarea
 *
 * @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;

$value = $field->value;

if ($value == '')
{
	return;
}

echo JHtml::_('content.prepare', $value);
textarea/params/textarea.xml000060400000002671152455757150012225 0ustar00<?xml version="1.0" encoding="utf-8"?>
<form>
	<fields name="fieldparams">
		<fieldset name="fieldparams">
			<field
				name="rows"
				type="number"
				label="PLG_FIELDS_TEXTAREA_PARAMS_ROWS_LABEL"
				description="PLG_FIELDS_TEXTAREA_PARAMS_ROWS_DESC"
				filter="integer"
				size="5"
			/>

			<field
				name="cols"
				type="number"
				label="PLG_FIELDS_TEXTAREA_PARAMS_COLS_LABEL"
				description="PLG_FIELDS_TEXTAREA_PARAMS_COLS_DESC"
				filter="integer"
				size="5"
			/>

			<field
				name="maxlength"
				type="number"
				label="PLG_FIELDS_TEXTAREA_PARAMS_MAXLENGTH_LABEL"
				description="PLG_FIELDS_TEXTAREA_PARAMS_MAXLENGTH_DESC"
				filter="integer"
			/>

			<field
				name="filter"
				type="list"
				label="PLG_FIELDS_TEXTAREA_PARAMS_FILTER_LABEL"
				description="PLG_FIELDS_TEXTAREA_PARAMS_FILTER_DESC"
				class="btn-group"
				validate="options"
				>
				<option value="">COM_FIELDS_FIELD_USE_GLOBAL</option>
				<option value="0">JNO</option>
				<option value="raw">JLIB_FILTER_PARAMS_RAW</option>
				<option value="safehtml">JLIB_FILTER_PARAMS_SAFEHTML</option>
				<option value="JComponentHelper::filterText">JLIB_FILTER_PARAMS_TEXT</option>
				<option value="alnum">JLIB_FILTER_PARAMS_ALNUM</option>
				<option value="integer">JLIB_FILTER_PARAMS_INTEGER</option>
				<option value="float">JLIB_FILTER_PARAMS_FLOAT</option>
				<option value="tel">JLIB_FILTER_PARAMS_TEL</option>
			</field>
		</fieldset>
	</fields>
</form>
textarea/textarea.xml000060400000004423152455757150010737 0ustar00<?xml version="1.0" encoding="utf-8" ?>
<extension type="plugin" version="3.7.0" group="fields" method="upgrade">
	<name>plg_fields_textarea</name>
	<author>Joomla! Project</author>
	<creationDate>March 2016</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_TEXTAREA_XML_DESCRIPTION</description>
	<files>
		<filename plugin="textarea">textarea.php</filename>
		<folder>params</folder>
		<folder>tmpl</folder>
	</files>
	<languages>
		<language tag="en-GB">en-GB.plg_fields_textarea.ini</language>
		<language tag="en-GB">en-GB.plg_fields_textarea.sys.ini</language>
	</languages>
	<config>
		<fields name="params">
			<fieldset name="basic">
				<field
					name="rows"
					type="number"
					label="PLG_FIELDS_TEXTAREA_PARAMS_ROWS_LABEL"
					description="PLG_FIELDS_TEXTAREA_PARAMS_ROWS_DESC"
					default="10"
					filter="integer"
					size="5"
				/>

				<field
					name="cols"
					type="number"
					label="PLG_FIELDS_TEXTAREA_PARAMS_COLS_LABEL"
					description="PLG_FIELDS_TEXTAREA_PARAMS_COLS_DESC"
					default="10"
					filter="integer"
					size="5"
				/>

				<field
					name="maxlength"
					type="number"
					label="PLG_FIELDS_TEXTAREA_PARAMS_MAXLENGTH_LABEL"
					description="PLG_FIELDS_TEXTAREA_PARAMS_MAXLENGTH_DESC"
					filter="integer"
				/>

				<field
					name="filter"
					type="list"
					label="PLG_FIELDS_TEXTAREA_PARAMS_FILTER_LABEL"
					description="PLG_FIELDS_TEXTAREA_PARAMS_FILTER_DESC"
					class="btn-group"
					default="JComponentHelper::filterText"
					validate="options"
					>
					<option value="0">JNO</option>
					<option value="raw">JLIB_FILTER_PARAMS_RAW</option>
					<option value="safehtml">JLIB_FILTER_PARAMS_SAFEHTML</option>
					<option value="JComponentHelper::filterText">JLIB_FILTER_PARAMS_TEXT</option>
					<option value="alnum">JLIB_FILTER_PARAMS_ALNUM</option>
					<option value="integer">JLIB_FILTER_PARAMS_INTEGER</option>
					<option value="float">JLIB_FILTER_PARAMS_FLOAT</option>
					<option value="tel">JLIB_FILTER_PARAMS_TEL</option>
				</field>
			</fieldset>
		</fields>
	</config>
</extension>
textarea/textarea.php000060400000000704152455757150010724 0ustar00<?php
/**
 * @package     Joomla.Plugin
 * @subpackage  Fields.Textarea
 *
 * @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;

JLoader::import('components.com_fields.libraries.fieldsplugin', JPATH_ADMINISTRATOR);

/**
 * Fields Textarea Plugin
 *
 * @since  3.7.0
 */
class PlgFieldsTextarea extends FieldsPlugin
{
}
color/color.xml000060400000001430152455757150007534 0ustar00<?xml version="1.0" encoding="utf-8" ?>
<extension type="plugin" version="3.7.0" group="fields" method="upgrade">
	<name>plg_fields_color</name>
	<author>Joomla! Project</author>
	<creationDate>March 2016</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_COLOR_XML_DESCRIPTION</description>
	<files>
		<filename plugin="color">color.php</filename>
		<folder>tmpl</folder>
	</files>
	<languages>
		<language tag="en-GB">en-GB.plg_fields_color.ini</language>
		<language tag="en-GB">en-GB.plg_fields_color.sys.ini</language>
	</languages>
</extension>
color/color.php000060400000002011152455757150007517 0ustar00<?php
/**
 * @package     Joomla.Plugin
 * @subpackage  Fields.Color
 *
 * @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;

JLoader::import('components.com_fields.libraries.fieldsplugin', JPATH_ADMINISTRATOR);

/**
 * Fields Color Plugin
 *
 * @since  3.7.0
 */
class PlgFieldsColor extends FieldsPlugin
{
	/**
	 * 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   JForm       $form    The form.
	 *
	 * @return  DOMElement
	 *
	 * @since   3.7.0
	 */
	public function onCustomFieldsPrepareDom($field, DOMElement $parent, JForm $form)
	{
		$fieldNode = parent::onCustomFieldsPrepareDom($field, $parent, $form);

		if (!$fieldNode)
		{
			return $fieldNode;
		}

		$fieldNode->setAttribute('validate', 'color');

		return $fieldNode;
	}
}
color/tmpl/color.php000060400000000623152455757150010502 0ustar00<?php
/**
 * @package     Joomla.Plugin
 * @subpackage  Fields.Color
 *
 * @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;

$value = $field->value;

if ($value == '')
{
	return;
}

if (is_array($value))
{
	$value = implode(', ', $value);
}

echo htmlentities($value);
sql/params/sql.xml000060400000001223152455757150010161 0ustar00<?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="multiple"
				type="list"
				label="PLG_FIELDS_SQL_PARAMS_MULTIPLE_LABEL"
				description="PLG_FIELDS_SQL_PARAMS_MULTIPLE_DESC"
				filter="integer"
				>
				<option value="">COM_FIELDS_FIELD_USE_GLOBAL</option>
				<option value="1">JYES</option>
				<option value="0">JNO</option>
			</field>
		</fieldset>
	</fields>
</form>
sql/tmpl/sql.php000060400000001754152455757150007652 0ustar00<?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;

$value = $field->value;

if ($value == '')
{
	return;
}

$db        = JFactory::getDbo();
$value     = (array) $value;
$condition = '';

foreach ($value as $v)
{
	if (!$v)
	{
		continue;
	}

	$condition .= ', ' . $db->q($v);
}

$query = $fieldParams->get('query', '');

// Run the query with a having condition because it supports aliases
$db->setQuery($query . ' having value in (' . trim($condition, ',') . ')');

try
{
	$items = $db->loadObjectlist();
}
catch (Exception $e)
{
	// If the query failed, we fetch all elements
	$db->setQuery($query);
	$items = $db->loadObjectlist();
}

$texts = array();

foreach ($items as $item)
{
	if (in_array($item->value, $value))
	{
		$texts[] = $item->text;
	}
}

echo htmlentities(implode(', ', $texts));
sql/sql.xml000060400000002643152455757150006705 0ustar00<?xml version="1.0" encoding="utf-8" ?>
<extension type="plugin" version="3.7.0" group="fields" method="upgrade">
	<name>plg_fields_sql</name>
	<author>Joomla! Project</author>
	<creationDate>March 2016</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>
	<files>
		<filename plugin="sql">sql.php</filename>
		<folder>params</folder>
		<folder>tmpl</folder>
	</files>
	<languages>
		<language tag="en-GB">en-GB.plg_fields_sql.ini</language>
		<language tag="en-GB">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="multiple"
					type="radio"
					label="PLG_FIELDS_SQL_PARAMS_MULTIPLE_LABEL"
					description="PLG_FIELDS_SQL_PARAMS_MULTIPLE_DESC"
					class="btn-group btn-group-yesno"
					default="0"
					filter="integer"
					>
					<option value="1">JYES</option>
					<option value="0">JNO</option>
				</field>
			</fieldset>
		</fields>
	</config>
</extension>
sql/sql.php000060400000003516152455757150006674 0ustar00<?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;

JLoader::import('components.com_fields.libraries.fieldslistplugin', JPATH_ADMINISTRATOR);

/**
 * Fields Sql Plugin
 *
 * @since  3.7.0
 */
class PlgFieldsSql extends FieldsListPlugin
{
	/**
	 * 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   JForm       $form    The form.
	 *
	 * @return  DOMElement
	 *
	 * @since   3.7.0
	 */
	public function onCustomFieldsPrepareDom($field, DOMElement $parent, JForm $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   string   $context  The context
	 * @param   JTable   $item     The table
	 * @param   boolean  $isNew    Is new item
	 * @param   array    $data     The validated data
	 *
	 * @return  boolean
	 *
	 * @since   3.7.0
	 */
	public function onContentBeforeSave($context, $item, $isNew, $data = array())
	{
		// Only work on new SQL fields
		if ($context != 'com_fields.field' || !isset($item->type) || $item->type != 'sql')
		{
			return true;
		}

		// If we are not a super admin, don't let the user create or update a SQL field
		if (!JAccess::getAssetRules(1)->allow('core.admin', JFactory::getUser()->getAuthorisedGroups()))
		{
			$item->setError(JText::_('PLG_FIELDS_SQL_CREATE_NOT_POSSIBLE'));

			return false;
		}

		return true;
	}
}
url/params/url.xml000060400000001560152455757150010173 0ustar00<?xml version="1.0" encoding="utf-8"?>
<form>
	<fields name="fieldparams">
		<fieldset name="fieldparams">
			<field
				name="schemes"
				type="list"
				label="PLG_FIELDS_URL_PARAMS_SCHEMES_LABEL"
				description="PLG_FIELDS_URL_PARAMS_SCHEMES_DESC"
				multiple="true"
				>
				<option value="http">HTTP</option>
				<option value="https">HTTPS</option>
				<option value="ftp">FTP</option>
				<option value="ftps">FTPS</option>
				<option value="file">FILE</option>
				<option value="mailto">MAILTO</option>
			</field>

			<field
				name="relative"
				type="list"
				label="PLG_FIELDS_URL_PARAMS_RELATIVE_LABEL"
				description="PLG_FIELDS_URL_PARAMS_RELATIVE_DESC"
				filter="integer"
				>
				<option value="">COM_FIELDS_FIELD_USE_GLOBAL</option>
				<option value="1">JYES</option>
				<option value="0">JNO</option>
			</field>
		</fieldset>
	</fields>
</form>
url/url.xml000060400000003205152455757150006706 0ustar00<?xml version="1.0" encoding="utf-8" ?>
<extension type="plugin" version="3.7.0" group="fields" method="upgrade">
	<name>plg_fields_url</name>
	<author>Joomla! Project</author>
	<creationDate>March 2016</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_URL_XML_DESCRIPTION</description>
	<files>
		<filename plugin="url">url.php</filename>
		<folder>params</folder>
		<folder>tmpl</folder>
	</files>
	<languages>
		<language tag="en-GB">en-GB.plg_fields_url.ini</language>
		<language tag="en-GB">en-GB.plg_fields_url.sys.ini</language>
	</languages>
	<config>
		<fields name="params">
			<fieldset name="basic">
				<field
					name="schemes"
					type="list"
					label="PLG_FIELDS_URL_PARAMS_SCHEMES_LABEL"
					description="PLG_FIELDS_URL_PARAMS_SCHEMES_DESC"
					multiple="true"
					>
					<option value="http">HTTP</option>
					<option value="https">HTTPS</option>
					<option value="ftp">FTP</option>
					<option value="ftps">FTPS</option>
					<option value="file">FILE</option>
					<option value="mailto">MAILTO</option>
				</field>

				<field
					name="relative"
					type="radio"
					label="PLG_FIELDS_URL_PARAMS_RELATIVE_LABEL"
					description="PLG_FIELDS_URL_PARAMS_RELATIVE_DESC"
					class="btn-group btn-group-yesno"
					default="1"
					filter="integer"
					>
					<option value="1">JYES</option>
					<option value="0">JNO</option>
				</field>
			</fieldset>
		</fields>
	</config>
</extension>
url/url.php000060400000002144152455757150006676 0ustar00<?php
/**
 * @package     Joomla.Plugin
 * @subpackage  Fields.URL
 *
 * @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;

JLoader::import('components.com_fields.libraries.fieldsplugin', JPATH_ADMINISTRATOR);

/**
 * Fields URL Plugin
 *
 * @since  3.7.0
 */
class PlgFieldsUrl extends FieldsPlugin
{
	/**
	 * 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   JForm       $form    The form.
	 *
	 * @return  DOMElement
	 *
	 * @since   3.7.0
	 */
	public function onCustomFieldsPrepareDom($field, DOMElement $parent, JForm $form)
	{
		$fieldNode = parent::onCustomFieldsPrepareDom($field, $parent, $form);

		if (!$fieldNode)
		{
			return $fieldNode;
		}

		$fieldNode->setAttribute('validate', 'url');

		if (! $fieldNode->getAttribute('relative'))
		{
			$fieldNode->removeAttribute('relative');
		}

		return $fieldNode;
	}
}
url/tmpl/url.php000060400000001042152455757150007646 0ustar00<?php
/**
 * @package     Joomla.Plugin
 * @subpackage  Fields.URL
 *
 * @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;

$value = $field->value;

if ($value == '')
{
	return;
}

$attributes = '';

if (!JUri::isInternal($value))
{
	$attributes = ' rel="nofollow noopener noreferrer" target="_blank"';
}

echo sprintf('<a href="%s"%s>%s</a>',
	htmlspecialchars($value),
	$attributes,
	htmlspecialchars($value)
);
mediajce/mediajce.xml000060400000004455152455757150010614 0ustar00<?xml version="1.0" encoding="utf-8" ?>
<extension type="plugin" version="3.8" group="fields" method="upgrade">
	<name>plg_fields_mediajce</name>
	 <version>2.9.99.2</version>
  	<creationDate>22-04-2026</creationDate>
  	<author>Ryan Demmer</author>
  	<authorEmail>info@joomlacontenteditor.net</authorEmail>
  	<authorUrl>https://www.joomlacontenteditor.net</authorUrl>
  	<copyright>Copyright (C) 2006 - 2026 Ryan Demmer. All rights reserved</copyright>
  	<license>GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html</license>
	<description>PLG_FIELDS_MEDIAJCE_XML_DESCRIPTION</description>

	<namespace path="src">Joomla\Plugin\Fields\MediaJce</namespace>

	<files folder="plugins/fields/mediajce">
		<filename plugin="mediajce">mediajce.php</filename>
		<folder>fields</folder>
		<folder>helper</folder>
		<folder>layouts</folder>
		<folder>params</folder>
		<folder>services</folder>
		<folder>src</folder>
		<folder>tmpl</folder>
	</files>

	<languages folder="administrator/language/en-GB">
		<language tag="en-GB">en-GB.plg_fields_mediajce.ini</language>
		<language tag="en-GB">en-GB.plg_fields_mediajce.sys.ini</language>
	</languages>

	<config>
		<fields name="params">
			<fieldset name="basic">
				<field
					name="legacymedia"
					type="list"
					label="PLG_FIELDS_MEDIAJCE_PARAMS_LEGACYMEDIA_LABEL"
					description="PLG_FIELDS_MEDIAJCE_PARAMS_LEGACYMEDIA_DESC"
					default="0"
				>
				<option value="1">JYES</option>
				<option value="0">JNO</option>
				</field>
				<field
					name="mediatype"
					type="combo"
					label="PLG_FIELDS_MEDIAJCE_PARAMS_MEDIATYPE_LABEL"
					description="PLG_FIELDS_MEDIAJCE_PARAMS_MEDIATYPE_DESC"
					layout="joomla.form.field.list-fancy-select"
				>
				<option value="images">images</option>
				<option value="media">media</option>
				<option value="documents">documents</option>
				<option value="files">files</option>
				</field>
				<field
					name="media_class"
					type="text"
					label="PLG_FIELDS_MEDIAJCE_PARAMS_MEDIA_CLASS_LABEL"
					description="PLG_FIELDS_MEDIAJCE_PARAMS_MEDIA_CLASS_DESC"
				/>
				<field
					name="media_description"
					type="text"
					label="PLG_FIELDS_MEDIAJCE_PARAMS_MEDIA_DESCRIPTION_LABEL"
					description="PLG_FIELDS_MEDIAJCE_PARAMS_MEDIA_DESCRIPTION_DESC"
				/>
			</fieldset>
		</fields>
	</config>
</extension>
mediajce/mediajce.php000060400000001752152455757150010600 0ustar00<?php
/**
 * @package     JCE
 * @subpackage  Fields.MediaJce
 *
 * @copyright   Copyright (C) 2005 - 2023 Open Source Matters, Inc. All rights reserved.
 * @copyright   Copyright (C) 2020 - 2023 Ryan Demmer. All rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */

defined('_JEXEC') or die;

JLoader::registerNamespace('Joomla\\Plugin\\Fields\\MediaJce', JPATH_PLUGINS . '/fields/mediajce/src', false, false, 'psr4');

use Joomla\Component\Fields\Administrator\Plugin\FieldsPlugin;
use Joomla\Plugin\Fields\MediaJce\PluginTraits\FormTrait;

if (!class_exists('\\Joomla\\Component\\Fields\\Administrator\\Plugin\\FieldsPlugin', false)) {
    JLoader::import('components.com_fields.libraries.fieldsplugin', JPATH_ADMINISTRATOR);
    class_alias('FieldsPlugin', '\\Joomla\\Component\\Fields\\Administrator\\Plugin\\FieldsPlugin');
}

/**
 * Fields MediaJce Plugin
 *
 * @since  2.6.27
 */
class PlgFieldsMediaJce extends FieldsPlugin
{
    use FormTrait;
}mediajce/params/mediajce.xml000060400000001307152455757150012070 0ustar00<?xml version="1.0" encoding="utf-8"?>
<form>
	<fields name="fieldparams">
		<fieldset name="fieldparams">
			<field name="mediatype" type="combo" label="PLG_FIELDS_MEDIAJCE_PARAMS_MEDIATYPE_LABEL" description="PLG_FIELDS_MEDIAJCE_PARAMS_MEDIATYPE_DESC">
				<option value="images">images</option>
				<option value="files">files</option>
			</field>
			<field name="media_class" type="text" label="PLG_FIELDS_MEDIAJCE_PARAMS_MEDIA_CLASS_LABEL" description="PLG_FIELDS_MEDIAJCE_PARAMS_MEDIA_CLASS_DESC" />
			<field name="media_description" type="text" label="PLG_FIELDS_MEDIAJCE_PARAMS_MEDIA_DESCRIPTION_LABEL" description="PLG_FIELDS_MEDIAJCE_PARAMS_MEDIA_DESCRIPTION_DESC" />
		</fieldset>
	</fields>
</form>mediajce/fields/mediajce.xml000060400000000523152455757150012052 0ustar00<?xml version="1.0" encoding="utf-8"?>
<form>
	<fieldset name="media">
		<field name="media_src" type="mediajce" label="PLG_FIELDS_MEDIAJCE_MEDIA_FILE_LABEL" schemes="http,https,ftp,ftps,data,file" validate="url" relative="true" />
		<field name="media_text" type="text" label="PLG_FIELDS_MEDIAJCE_MEDIA_TEXT_LABEL" />
	</fieldset>
</form>mediajce/fields/mediajce.php000060400000011054152455757150012042 0ustar00<?php
/**
 * @package     JCE
 * @subpackage  Fields.MediaJce
 *
 * @copyright   Copyright (C) 2005 - 2023 Open Source Matters, Inc. All rights reserved.
 * @copyright   Copyright (C) 2020 - 2024 Ryan Demmer. All rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */

\defined('_JEXEC') or die;

use Joomla\CMS\Component\ComponentHelper;
use Joomla\CMS\Plugin\PluginHelper;
use Joomla\CMS\Form\Field\MediaField;
use Joomla\CMS\Form\Form;
use Joomla\CMS\Helper\MediaHelper;

/**
 * Provides a modal media selector field for the JCE File Browser
 *
 * @since  2.6.17
 */
class JFormFieldMediaJce extends MediaField
{
    /**
     * The form field type.
     *
     * @var    string
     */
    protected $type = 'MediaJce';

    /**
     * Layout to render
     *
     * @var    string
     * @since  3.5
     */
    protected $layout = 'joomla.form.field.media';

    /**
     * The mediatype for the form field.
     *
     * @var    string
     * @since  2.9.37
     */
    protected $mediatype = 'images';

    /**
     * Method to attach a JForm object to the field.
     *
     * @param   SimpleXMLElement  $element  The SimpleXMLElement object representing the `<field>` tag for the form field object.
     * @param   mixed             $value    The form field value to validate.
     * @param   string            $group    The field name group control value. This acts as an array container for the field.
     *                                      For example if the field has name="foo" and the group value is set to "bar" then the
     *                                      full field name would end up being "bar[foo]".
     *
     * @return  boolean  True on success.
     *
     * @see     JFormField::setup()
     */
    public function setup(SimpleXMLElement $element, $value, $group = null)
    {
        // decode value if it is a string
        if (is_string($value)) {
            $json = json_decode($value, true);

            if ($json) {
                $value = isset($json['media_src']) ? $json['media_src'] : $value;
            }
        } else {
            $value = (array) $value;
            $value = isset($value['media_src']) ? $value['media_src'] : '';
        }

        $result = parent::setup($element, $value, $group);

        if ($result === true) {
            $this->mediatype = isset($this->element['mediatype']) ? (string) $this->element['mediatype'] : 'images';

            if (isset($this->types) && (bool) $this->element['converted'] === false) {
                if (is_string($this->value)) {
                    $this->value = MediaHelper::getCleanMediaFieldValue($this->value);
                }
            }
        }

        return $result;
    }

    /**
     * Get the data that is going to be passed to the layout
     *
     * @return  array
     */
    public function getLayoutData()
    {
        // Get the basic field data
        $data = parent::getLayoutData();

        // component must be installed and enabled
        if (!ComponentHelper::isEnabled('com_jce')) {
            return $data;
        }
        
        // plugin must be enabled
        if (!PluginHelper::isEnabled('system', 'jce')) {
            return $data;
        }

        $data['class'] .= ' input-medium wf-media-input';

        // not enabled for media field
        if (!WfBrowserHelper::isMediaFieldEnabled()) {
            $data['readonly'] = true;
            $data['link'] = '';
            return $data;
        }

        $converted = (bool) $this->element['converted'];

        $config = array(
            'element' => $this->id,
            'mediatype' => strtolower($this->mediatype),
            'converted' => $converted,
            'mediafolder' => isset($this->element['media_folder']) ? (string) $this->element['media_folder'] : '',
        );

        // get individual field link
        $this->link = WfBrowserHelper::getMediaFieldUrl($config);

        $extraData = array(
            'link'  => $this->link,
            'class' => $data['class'] .= ' wf-media-input-active',
        );

        if ($converted) {
            $extraData['class'] .= ' wf-media-input-converted';;
        }

        // get global field options
        $options = WfBrowserHelper::getMediaFieldOptions();

        if ($options['upload'] == 1) {
            $extraData['class'] .= ' wf-media-input-upload';
        }

        if ($options['select_button'] == 0) {
            $extraData['class'] .= ' wf-media-input-no-select-button';
        }

        $extraData['class'] .= ' wf-media-input-core';

        return array_merge($data, $extraData);
    }
}
mediajce/helper/mediahelper.php000060400000006135152455757150012575 0ustar00<?php 

final class WfMediaHelper {
    /**
     * An array of supported embed types and their mime types
     */
    private static $embedMimes = array(
        "doc"=> "application/msword",
        "xls"=> "application/vnd.ms-excel",
        "ppt"=> "application/vnd.ms-powerpoint",
        "dot"=> "application/msword",
        "pps"=> "application/vnd.ms-powerpoint",
        "docx"=> "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
        "dotx"=> "application/vnd.openxmlformats-officedocument.wordprocessingml.template",
        "pptx"=> "application/vnd.openxmlformats-officedocument.presentationml.presentation",
        "xlsx"=> "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
        "xlsm"=> "application/vnd.ms-excel.sheet.macroEnabled.12",
        "ppsx"=> "application/vnd.openxmlformats-officedocument.presentationml.slideshow",
        "sldx"=> "application/vnd.openxmlformats-officedocument.presentationml.slide",
        "potx"=> "application/vnd.openxmlformats-officedocument.presentationml.template",
        "xltx"=> "application/vnd.openxmlformats-officedocument.spreadsheetml.template",
        "odt"=> "application/vnd.oasis.opendocument.text",
        "odg"=> "application/vnd.oasis.opendocument.graphics",
        "odp"=> "application/vnd.oasis.opendocument.presentation",
        "ods"=> "application/vnd.oasis.opendocument.spreadsheet",
        "odf"=> "application/vnd.oasis.opendocument.formula",
        "txt"=> "text/plain",
        "rtf"=> "application/rtf",
        "md"=> "text/markdown",
        "pdf"=> "application/pdf"
    );

    /**
     * An array of supported media layout types and their file extensions
     */
    private static $allowable = array(
        'image'     => 'jpg,jpeg,png,gif',
        'audio'     => 'mp3,m4a,mp4a,ogg',
        'video'     => 'mp4,mp4v,mpeg,mov,webm',
        'object'    => 'doc,docx,odg,odp,ods,odt,pdf,ppt,pptx,txt,xcf,xls,xlsx,csv',
        'iframe'    => '',
    );

    /**
     * Get the embed type from the file extension
     *
     * @param [string] $extension File extension
     * @return Mime type or false
     */
    public static function getMimeType($extension) {
        if (array_key_exists($extension, self::$embedMimes)) {
            return self::$embedMimes[$extension];
        }

        return false;
    }
    /**
     * Get the media layout from the file extension
     *
     * @param [type] $extension File extension
     * @return Layout type
     */
    public static function getLayoutFromExtension($extension) {
        $layout = 'link';
        
        array_walk(self::$allowable, function ($values, $key) use ($extension, &$layout) {
            if (in_array($extension, explode(',', $values))) {
                $layout = $key;
            }
        });

        return $layout;
    }

    /**
     * Determine whether the value is an image
     *
     * @param [string] $value
     * @return boolean
     */
    public static function isImage($value) {
        $extension = pathinfo($value, PATHINFO_EXTENSION);
        return in_array($extension, explode(',', self::$allowable['image']));
    }
}mediajce/src/Extension/MediaJce.php000060400000001273152455757150013241 0ustar00<?php

/**
 * @package     Jce.Plugin
 * @subpackage  Fields.mediajce
 *
 * @copyright   (C) 2017 Open Source Matters, Inc. <https://www.joomla.org>
 * @copyright   (C) 2020 - 2024 Ryan Demmer. All rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */

namespace Joomla\Plugin\Fields\MediaJce\Extension;

use Joomla\Component\Fields\Administrator\Plugin\FieldsPlugin;
use Joomla\Plugin\Fields\MediaJce\PluginTraits\FormTrait;

// phpcs:disable PSR1.Files.SideEffects
\defined('_JEXEC') or die;
// phpcs:enable PSR1.Files.SideEffects

/**
 * Fields Media Plugin
 *
 * @since  2.9.73
 */
final class MediaJce extends FieldsPlugin
{   
    use FormTrait;
}mediajce/src/PluginTraits/FormTrait.php000060400000006466152455757150014171 0ustar00<?php
/**
 * @package     JCE
 * @subpackage  Fields.MediaJce
 *
 * @copyright   Copyright (C) 2005 - 2023 Open Source Matters, Inc. All rights reserved.
 * @copyright   Copyright (C) 2020 - 2024 Ryan Demmer. All rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */

namespace Joomla\Plugin\Fields\MediaJce\PluginTraits;

defined('_JEXEC') or die;

use Joomla\CMS\Component\ComponentHelper;
use Joomla\CMS\Factory;
use Joomla\CMS\Form\Form;
use Joomla\CMS\Form\FormHelper;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Plugin\PluginHelper;
use Joomla\CMS\Uri\Uri;

/**
 * Fields MediaJce FormTrait
 *
 * @since  2.9.73
 */
trait FormTrait
{
    private $mediaLoaded = false;
    
    /**
     * 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;
        }

        if ($field->type !== 'mediajce') {
            return $fieldNode;
        }

        // override "Edit Custom Field Value" permission if set
        $fieldNode->setAttribute('disabled', 'false');

        $fieldParams = clone $this->params;
        $fieldParams->merge($field->fieldparams);

        $field->fieldparams = clone $fieldParams;

        $form->addFieldPath(JPATH_PLUGINS . '/fields/mediajce/fields');

        Factory::getApplication()->triggerEvent('onWfCustomFieldsPrepareDom', array($field, $fieldNode, $form));

        return $fieldNode;
    }

    /**
     * Before prepares the field value.
     *
     * @param   string     $context  The context.
     * @param   \stdclass  $item     The item.
     * @param   \stdclass  $field    The field.
     *
     * @return  void
     *
     * @since   3.7.0
     */
    public function onCustomFieldsBeforePrepareField($context, $item, $field)
    {
        // Check if the field should be processed by us
        if ($field->type !== 'mediajce') {
            return;
        }

        // Check if the field value is an old (string) value
        if (is_string($field->value)) {
            $field->value = $this->checkValue($field->value);
        }

        $fieldParams = clone $this->params;
        $fieldParams->merge($field->fieldparams);

        $field->fieldparams = clone $fieldParams;

        // if extendedmedia is disabled, use restricted media support
        if ((int) $fieldParams->get('extendedmedia', 0) == 0 && is_array($field->value)) {
            $field->value['media_supported'] = array('img', 'a');
        }
    }

    /**
     * Before prepares the field value.
     *
     * @param   string  $value  The value to check.
     *
     * @return  array  The checked value
     *
     * @since   4.0.0
     */
    private function checkValue($value)
    {
        json_decode($value);

        if (json_last_error() === JSON_ERROR_NONE) {
            return (array) json_decode($value, true);
        }

        return array('media_src' => $value, 'media_text' => '');
    }
}
mediajce/tmpl/mediajce.php000060400000014101152455757150011544 0ustar00<?php

/**
 * @package     JCE
 * @subpackage  Fields.MediaJce
 *
 * @copyright   Copyright (C) 2005 - 2023 Open Source Matters, Inc. All rights reserved.
 * @copyright   Copyright (C) 2020 - 2024 Ryan Demmer. All rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */
defined('_JEXEC') or die;

use Joomla\CMS\Layout\LayoutHelper;
use Joomla\Filesystem\File;
use Joomla\Filesystem\Path;

// load helper
require_once JPATH_PLUGINS . '/fields/mediajce/helper/mediahelper.php';

if (empty($field->value)) {
    return;
}

// single value, may be subform
if (is_string($field->value)) {
    $field->value = array(
        'media_src' => $field->value,
        'media_type' => WfMediaHelper::isImage($field->value) ? 'embed' : 'link',
    );
}

// no src value set
if (empty($field->value['media_src'])) {
    return;
}

$data = array(
    'media_src' => '',
    'media_text' => (string) $fieldParams->get('media_description', ''),
    'media_type' => (string) $fieldParams->get('display_type', 'embed'),
    'media_target' => (string) $fieldParams->get('media_target', '_blank'),
    'media_class' => (string) $fieldParams->get('media_class', ''),
    'media_caption' => '',
    'media_supported' => array('img', 'video', 'audio', 'iframe', 'a', 'object'),
);

foreach ($field->value as $key => $value) {
    if (empty($value)) {
        continue;
    }

    $data[$key] = $value;
}

// convert to object
$data = (object) $data;

// convert legacy value
if (isset($data->src)) {
    $data->media_src = $data->src;
}

// add "image" to supported media to allow for "image" and "img"
$data->media_supported[] = 'image';

// clean Joomla 4 media stuff
if ($pos = strpos($data->media_src, '#')) {
    $data->media_src = substr($data->media_src, 0, $pos);
}

// get file extension to determine tag
$extension = pathinfo($data->media_src, PATHINFO_EXTENSION);

// lowercase
$extension = strtolower($extension);

// get layout from extension
$layout = WfMediaHelper::getLayoutFromExtension($extension);

// reset to link if not extended media
if ((int) $fieldParams->get('extendedmedia') == 0 && $layout !== 'image') {
    $layout = 'link';
}

// reset layout as link
if (!in_array($layout, $data->media_supported) || $data->media_type == 'link') {
    $layout = 'link';
}

$attribs = array();

if ($data->media_class) {
    $data->media_class = preg_replace('#[^-\w ]#i', '', $data->media_class);
    $attribs['class'] = trim($data->media_class);
}

$text = '';

if ($data->media_text) {
    $text = $data->media_text; // htmlspecialchars encoded in layout
}

// links
if ($layout == 'link') {
    $attribs['title'] = $text;
}

// images
if ($layout == 'image') {
    if (isset($data->media_width)) {
        $attribs['width'] = $data->media_width;
    }

    if (isset($data->media_height)) {
        $attribs['height'] = $data->media_height;
    }

    // set lazy loading only if dimensions are set
    if (!empty($data->media_width) && !empty($data->media_height)) {
        $attribs['loading'] = 'lazy';
    }

    // set alt text or emty value
    $attribs['alt'] = $text;
}

// audio
if ($layout == 'audio') {
    $attribs['controls'] = 'controls';

    if ($text) {
        $attribs['title'] = $text;
    }
}

// video
if ($layout == 'video') {
    $attribs['controls'] = 'controls';

    $attribs['width'] = isset($data->media_width) ? $data->media_width : '';
    $attribs['height'] = isset($data->media_height) ? $data->media_height : '';

    if ($text) {
        $attribs['title'] = $text;
    }
}

// object
if ($layout == 'object') {
    $attribs['width'] = isset($data->media_width) ? $data->media_width : '100%';
    $attribs['height'] = isset($data->media_height) ? $data->media_height : '100%';

    if ($text) {
        $attribs['title'] = $text;
    }

    $attribs['data'] = $data->media_src;

    $mimetype = WfMediaHelper::getMimeType($extension);

    if ($mimetype) {
        $attribs['type'] = $mimetype;
    } else {
        $layout = 'iframe';
    }
}

// iframe
if ($layout == 'iframe') {
    $attribs['frameborder'] = 0;
    $attribs['width'] = isset($data->media_width) ? $data->media_width : '100%';
    $attribs['height'] = isset($data->media_height) ? $data->media_height : '100%';

    // set lazy loading only if dimensions are set
    if (!empty($data->media_width) && !empty($data->media_height)) {
        $attribs['loading'] = 'lazy';
    }

    if ($text) {
        $attribs['title'] = $text;
    }
}

$buffer = '';

// perform pcre replacement of common invalid characters
$path = preg_replace('#[\+\\\?\#%&<>"\'=\[\]\{\},;@\^\(\)£€$]#u', '', $data->media_src);

// trim
$path = trim($path);

if ($path) {
    // clean slashes
    $path = Path::clean($path);

    // set text as basename if not an image
    if ($layout == 'link') {
        // set default target
        $attribs['target'] = $data->media_target;

        // set target as download
        if ($data->media_target == 'download') {
            $attribs['download'] = pathinfo($path, PATHINFO_FILENAME);
        }
    }

    if (!isset($attribs['class'])) {
        $attribs['class'] = '';
    }

    // add media type class
    $attribs['class'] .= ' mediajce-' . $layout;

    // trim class
    $attribs['class'] = trim($attribs['class']);

    // check for valid path after clean
    if (is_file(JPATH_SITE . '/' . $path)) {
        $attribs['src'] = $path;

        LayoutHelper::$defaultBasePath = JPATH_PLUGINS . '/fields/mediajce/layouts';

        $buffer = LayoutHelper::render('plugins.fields.mediajce.' . $layout, $attribs);

        // render with figure and figcaption
        if ($data->media_type == 'embed' && $data->media_caption) {

            $figure = array();
            $caption_class = (string) $fieldParams->get('media_caption_class', '');

            if ($caption_class) {
                $caption_class = preg_replace('#[^ \w-]#i', '', $caption_class);
                $figure['class'] = $caption_class;
            }

            $figure['caption'] = $data->media_caption;
            $figure['html'] = $buffer;

            $buffer = LayoutHelper::render('plugins.fields.mediajce.figure', $figure);
        }
    }
}

echo $buffer;
mediajce/layouts/plugins/fields/mediajce/video.php000060400000000375152455757150016335 0ustar00<?php

defined('_JEXEC') or die;

use Joomla\Utilities\ArrayHelper;

array_walk($displayData, function (&$value, $key) {
    $value = htmlspecialchars($value, ENT_QUOTES, 'UTF-8');
});

echo '<video ' . ArrayHelper::toString($displayData) . '></video>';mediajce/layouts/plugins/fields/mediajce/iframe.php000060400000000377152455757150016474 0ustar00<?php

defined('_JEXEC') or die;

use Joomla\Utilities\ArrayHelper;

array_walk($displayData, function (&$value, $key) {
    $value = htmlspecialchars($value, ENT_QUOTES, 'UTF-8');
});

echo '<iframe ' . ArrayHelper::toString($displayData) . '></iframe>';mediajce/layouts/plugins/fields/mediajce/figure.php000060400000000750152455757150016505 0ustar00<?php

defined('_JEXEC') or die;

use Joomla\Utilities\ArrayHelper;

$caption    = $displayData['caption'];
$html       = $displayData['html']; 

unset($displayData['caption']);
unset($displayData['html']);

array_walk($displayData, function (&$value, $key) {
    $value = htmlspecialchars($value, ENT_QUOTES, 'UTF-8');
});

echo '<figure' . ArrayHelper::toString($displayData) . '>' . $html . '<figcaption>' . htmlentities($caption, ENT_COMPAT, 'UTF-8', true) . '</figcaption></figure>';mediajce/layouts/plugins/fields/mediajce/image.php000060400000000507152455757150016306 0ustar00<?php

defined('_JEXEC') or die;

use Joomla\Utilities\ArrayHelper;

array_walk($displayData, function (&$value, $key) {
    $value = htmlspecialchars($value, ENT_QUOTES, 'UTF-8');

    if ($key !== 'alt' && $value == '') {
        unset($displayData[$key]);
    }
});

echo '<img ' . ArrayHelper::toString($displayData) . '>';mediajce/layouts/plugins/fields/mediajce/object.php000060400000000435152455757150016472 0ustar00<?php

defined('_JEXEC') or die;

use Joomla\Utilities\ArrayHelper;

unset ($displayData['src']);

array_walk($displayData, function (&$value, $key) {
    $value = htmlspecialchars($value, ENT_QUOTES, 'UTF-8');
});

echo '<object ' . ArrayHelper::toString($displayData) . '></object>';mediajce/layouts/plugins/fields/mediajce/link.php000060400000000753152455757150016164 0ustar00<?php

defined('_JEXEC') or die;

use Joomla\Utilities\ArrayHelper;

$displayData['href'] = $displayData['src'];

unset($displayData['src']);

$attribs = array();

foreach ($displayData as $key => $value) {
    if ($value !== '') {
        $value = htmlspecialchars($value, ENT_QUOTES, 'UTF-8');
        $attribs[$key] = $value;
    }
};

$text = isset($attribs['title']) ? $attribs['title'] : basename($attribs['href']);

echo '<a ' . ArrayHelper::toString($attribs) . '>' . $text . '</a>';mediajce/layouts/plugins/fields/mediajce/audio.php000060400000000375152455757150016330 0ustar00<?php

defined('_JEXEC') or die;

use Joomla\Utilities\ArrayHelper;

array_walk($displayData, function (&$value, $key) {
    $value = htmlspecialchars($value, ENT_QUOTES, 'UTF-8');
});

echo '<audio ' . ArrayHelper::toString($displayData) . '></audio>';mediajce/services/provider.php000060400000002554152455757150012515 0ustar00<?php

/**
 * @package     Joomla.Plugin
 * @subpackage  Fields.mediajce
 *
 * @copyright   (C) 2023 Open Source Matters, Inc. <https://www.joomla.org>
 * @copyright   (C) 2020 - 2024 Ryan Demmer. All rights reserved.
 * @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\Fields\MediaJce\Extension\MediaJce;

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) {
                $dispatcher = $container->get(DispatcherInterface::class);
                $plugin     = new MediaJce(
                    $dispatcher,
                    (array) PluginHelper::getPlugin('fields', 'mediajce')
                );

                $plugin->setApplication(Factory::getApplication());

                return $plugin;
            }
        );
    }
};
text/text.php000060400000000670152455757150007244 0ustar00<?php
/**
 * @package     Joomla.Plugin
 * @subpackage  Fields.Text
 *
 * @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;

JLoader::import('components.com_fields.libraries.fieldsplugin', JPATH_ADMINISTRATOR);

/**
 * Fields Text Plugin
 *
 * @since  3.7.0
 */
class PlgFieldsText extends FieldsPlugin
{
}
text/text.xml000060400000003473152455757150007261 0ustar00<?xml version="1.0" encoding="utf-8" ?>
<extension type="plugin" version="3.7.0" group="fields" method="upgrade">
	<name>plg_fields_text</name>
	<author>Joomla! Project</author>
	<creationDate>March 2016</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_TEXT_XML_DESCRIPTION</description>
	<files>
		<filename plugin="text">text.php</filename>
		<folder>params</folder>
		<folder>tmpl</folder>
	</files>
	<languages>
		<language tag="en-GB">en-GB.plg_fields_text.ini</language>
		<language tag="en-GB">en-GB.plg_fields_text.sys.ini</language>
	</languages>
	<config>
		<fields name="params">
			<fieldset name="basic">
				<field
					name="filter"
					type="list"
					label="PLG_FIELDS_TEXT_PARAMS_FILTER_LABEL"
					description="PLG_FIELDS_TEXT_PARAMS_FILTER_DESC"
					class="btn-group"
					default="JComponentHelper::filterText"
					validate="options"
					>
					<option value="0">JNO</option>
					<option value="raw">JLIB_FILTER_PARAMS_RAW</option>
					<option value="safehtml">JLIB_FILTER_PARAMS_SAFEHTML</option>
					<option value="JComponentHelper::filterText">JLIB_FILTER_PARAMS_TEXT</option>
					<option value="alnum">JLIB_FILTER_PARAMS_ALNUM</option>
					<option value="integer">JLIB_FILTER_PARAMS_INTEGER</option>
					<option value="float">JLIB_FILTER_PARAMS_FLOAT</option>
					<option value="tel">JLIB_FILTER_PARAMS_TEL</option>
				</field>

				<field
					name="maxlength"
					type="number"
					label="PLG_FIELDS_TEXT_PARAMS_MAXLENGTH_LABEL"
					description="PLG_FIELDS_TEXT_PARAMS_MAXLENGTH_DESC"
					filter="integer"
				/>
			</fieldset>
		</fields>
	</config>
</extension>
text/params/text.xml000060400000002055152455757150010537 0ustar00<?xml version="1.0" encoding="utf-8"?>
<form>
	<fields name="fieldparams">
		<fieldset name="fieldparams">
			<field
				name="filter"
				type="list"
				label="PLG_FIELDS_TEXT_PARAMS_FILTER_LABEL"
				description="PLG_FIELDS_TEXT_PARAMS_FILTER_DESC"
				class="btn-group"
				validate="options"
				>
				<option value="">COM_FIELDS_FIELD_USE_GLOBAL</option>
				<option value="0">JNO</option>
				<option value="raw">JLIB_FILTER_PARAMS_RAW</option>
				<option value="safehtml">JLIB_FILTER_PARAMS_SAFEHTML</option>
				<option value="JComponentHelper::filterText">JLIB_FILTER_PARAMS_TEXT</option>
				<option value="alnum">JLIB_FILTER_PARAMS_ALNUM</option>
				<option value="integer">JLIB_FILTER_PARAMS_INTEGER</option>
				<option value="float">JLIB_FILTER_PARAMS_FLOAT</option>
				<option value="tel">JLIB_FILTER_PARAMS_TEL</option>
			</field>

			<field
				name="maxlength"
				type="number"
				label="PLG_FIELDS_TEXT_PARAMS_MAXLENGTH_LABEL"
				description="PLG_FIELDS_TEXT_PARAMS_MAXLENGTH_DESC"
				filter="integer"
			/>
		</fieldset>
	</fields>
</form>
text/tmpl/text.php000060400000000622152455757150010215 0ustar00<?php
/**
 * @package     Joomla.Plugin
 * @subpackage  Fields.Text
 *
 * @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;

$value = $field->value;

if ($value == '')
{
	return;
}

if (is_array($value))
{
	$value = implode(', ', $value);
}

echo htmlentities($value);
imagelist/params/imagelist.xml000060400000002011152455757150012513 0ustar00<?xml version="1.0" encoding="utf-8"?>
<form>
	<fields name="fieldparams">
		<fieldset name="fieldparams">
			<field
				name="directory"
				type="folderlist"
				label="PLG_FIELDS_IMAGELIST_PARAMS_DIRECTORY_LABEL"
				description="PLG_FIELDS_IMAGELIST_PARAMS_DIRECTORY_DESC"
				directory="images"
				hide_none="true"
				hide_default="true"
				recursive="true"
				>
				<option value="">COM_FIELDS_FIELD_USE_GLOBAL</option>
				<option value="/">/</option>
			</field>

			<field
				name="multiple"
				type="list"
				label="PLG_FIELDS_IMAGELIST_PARAMS_MULTIPLE_LABEL"
				description="PLG_FIELDS_IMAGELIST_PARAMS_MULTIPLE_DESC"
				filter="integer"
				>
				<option value="">COM_FIELDS_FIELD_USE_GLOBAL</option>
				<option value="1">JYES</option>
				<option value="0">JNO</option>
			</field>

			<field
				name="image_class"
				type="textarea"
				label="PLG_FIELDS_IMAGELIST_PARAMS_IMAGE_CLASS_LABEL"
				description="PLG_FIELDS_IMAGELIST_PARAMS_IMAGE_CLASS_DESC"
				size="40"
			/>
		</fieldset>
	</fields>
</form>
imagelist/imagelist.xml000060400000003436152455757150011244 0ustar00<?xml version="1.0" encoding="utf-8" ?>
<extension type="plugin" version="3.7.0" group="fields" method="upgrade">
	<name>plg_fields_imagelist</name>
	<author>Joomla! Project</author>
	<creationDate>March 2016</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_IMAGELIST_XML_DESCRIPTION</description>
	<files>
		<filename plugin="imagelist">imagelist.php</filename>
		<folder>params</folder>
		<folder>tmpl</folder>
	</files>
	<languages>
		<language tag="en-GB">en-GB.plg_fields_imagelist.ini</language>
		<language tag="en-GB">en-GB.plg_fields_imagelist.sys.ini</language>
	</languages>
	<config>
		<fields name="params">
			<fieldset name="basic">
				<field
					name="directory"
					type="folderlist"
					label="PLG_FIELDS_IMAGELIST_PARAMS_DIRECTORY_LABEL"
					description="PLG_FIELDS_IMAGELIST_PARAMS_DIRECTORY_DESC"
					directory="images"
					hide_none="true"
					hide_default="true"
					recursive="true"
					default="/"
					>
					<option value="/">/</option>
				</field>

				<field
					name="multiple"
					type="radio"
					label="PLG_FIELDS_IMAGELIST_PARAMS_MULTIPLE_LABEL"
					description="PLG_FIELDS_IMAGELIST_PARAMS_MULTIPLE_DESC"
					class="btn-group btn-group-yesno"
					default="0"
					filter="integer"
					>
					<option value="1">JYES</option>
					<option value="0">JNO</option>
				</field>

				<field
					name="image_class"
					type="textarea"
					label="PLG_FIELDS_IMAGELIST_PARAMS_IMAGE_CLASS_LABEL"
					description="PLG_FIELDS_IMAGELIST_PARAMS_IMAGE_CLASS_DESC"
					size="40"
				/>
			</fieldset>
		</fields>
	</config>
</extension>
imagelist/imagelist.php000060400000002165152455757150011231 0ustar00<?php
/**
 * @package     Joomla.Plugin
 * @subpackage  Fields.Imagelist
 *
 * @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;

JLoader::import('components.com_fields.libraries.fieldsplugin', JPATH_ADMINISTRATOR);

/**
 * Fields Imagelist Plugin
 *
 * @since  3.7.0
 */
class PlgFieldsImagelist extends FieldsPlugin
{
	/**
	 * 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   JForm       $form    The form.
	 *
	 * @return  DOMElement
	 *
	 * @since   3.7.0
	 */
	public function onCustomFieldsPrepareDom($field, DOMElement $parent, JForm $form)
	{
		$fieldNode = parent::onCustomFieldsPrepareDom($field, $parent, $form);

		if (!$fieldNode)
		{
			return $fieldNode;
		}

		$fieldNode->setAttribute('hide_default', 'true');
		$fieldNode->setAttribute('directory', '/images/' . $fieldNode->getAttribute('directory'));

		return $fieldNode;
	}
}
imagelist/tmpl/imagelist.php000060400000001711152455757150012201 0ustar00<?php
/**
 * @package     Joomla.Plugin
 * @subpackage  Fields.Imagelist
 *
 * @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;

if ($field->value == '')
{
	return;
}

$class = $fieldParams->get('image_class');

if ($class)
{
	// space before, so if no class sprintf below works
	$class = ' class="' . htmlentities($class, ENT_COMPAT, 'UTF-8', true) . '"';
}

$value  = (array) $field->value;
$buffer = '';

foreach ($value as $path)
{
	if (!$path || $path == '-1')
	{
		continue;
	}

	if ($fieldParams->get('directory', '/') !== '/')
	{
		$buffer .= sprintf('<img src="images/%s/%s"%s>',
			$fieldParams->get('directory'),
			htmlentities($path, ENT_COMPAT, 'UTF-8', true),
			$class
		);
	}
	else
	{
		$buffer .= sprintf('<img src="images/%s"%s>',
			htmlentities($path, ENT_COMPAT, 'UTF-8', true),
			$class
		);
	}
}

echo $buffer;
editor/params/editor.xml000060400000002746152455757150011352 0ustar00<?xml version="1.0" encoding="utf-8"?>
<form>
	<fields name="fieldparams">
		<fieldset name="fieldparams">
			<field
				name="buttons"
				type="list"
				label="PLG_FIELDS_EDITOR_PARAMS_SHOW_BUTTONS_LABEL"
				description="PLG_FIELDS_EDITOR_PARAMS_SHOW_BUTTONS_DESC"
				filter="integer"
				>
				<option value="">COM_FIELDS_FIELD_USE_GLOBAL</option>
				<option value="1">JYES</option>
				<option value="0">JNO</option>
			</field>

			<field
				name="hide"
				type="plugins"
				label="PLG_FIELDS_EDITOR_PARAMS_BUTTONS_HIDE_LABEL"
				description="JGLOBAL_SELECT_SOME_OPTIONS"
				folder="editors-xtd"
				multiple="true"
			/>

			<field
				name="width"
				type="text"
				label="PLG_FIELDS_EDITOR_PARAMS_WIDTH_LABEL"
				description="PLG_FIELDS_EDITOR_PARAMS_WIDTH_DESC"
				size="5"
			/>

			<field
				name="height"
				type="text"
				label="PLG_FIELDS_EDITOR_PARAMS_HEIGHT_LABEL"
				description="PLG_FIELDS_EDITOR_PARAMS_HEIGHT_DESC"
				size="5"
			/>

			<field
				name="filter"
				type="list"
				label="PLG_FIELDS_TEXT_PARAMS_FILTER_LABEL"
				description="PLG_FIELDS_TEXT_PARAMS_FILTER_DESC"
				class="btn-group"
				validate="options"
				>
				<option value="">COM_FIELDS_FIELD_USE_GLOBAL</option>
				<option value="0">JNO</option>
				<option value="raw">JLIB_FILTER_PARAMS_RAW</option>
				<option value="safehtml">JLIB_FILTER_PARAMS_SAFEHTML</option>
				<option value="JComponentHelper::filterText">JLIB_FILTER_PARAMS_TEXT</option>
			</field>
		</fieldset>
	</fields>
</form>
editor/tmpl/editor.php000060400000000546152455757150011026 0ustar00<?php
/**
 * @package     Joomla.Plugin
 * @subpackage  Fields.Editor
 *
 * @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;

$value = $field->value;

if ($value == '')
{
	return;
}

echo JHtml::_('content.prepare', $value);
editor/editor.php000060400000002271152455757150010047 0ustar00<?php
/**
 * @package     Joomla.Plugin
 * @subpackage  Fields.Editor
 *
 * @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;

JLoader::import('components.com_fields.libraries.fieldsplugin', JPATH_ADMINISTRATOR);

/**
 * Fields Editor Plugin
 *
 * @since  3.7.0
 */
class PlgFieldsEditor extends FieldsPlugin
{
	/**
	 * 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   JForm       $form    The form.
	 *
	 * @return  DOMElement
	 *
	 * @since   3.7.0
	 */
	public function onCustomFieldsPrepareDom($field, DOMElement $parent, JForm $form)
	{
		$fieldNode = parent::onCustomFieldsPrepareDom($field, $parent, $form);

		if (!$fieldNode)
		{
			return $fieldNode;
		}

		$fieldNode->setAttribute('buttons', $field->fieldparams->get('buttons', $this->params->get('buttons', 0)) ? 'true' : 'false');
		$fieldNode->setAttribute('hide', implode(',', $field->fieldparams->get('hide', array())));

		return $fieldNode;
	}
}
editor/editor.xml000060400000004501152455757150010056 0ustar00<?xml version="1.0" encoding="utf-8" ?>
<extension type="plugin" version="3.7.0" group="fields" method="upgrade">
	<name>plg_fields_editor</name>
	<author>Joomla! Project</author>
	<creationDate>March 2016</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_EDITOR_XML_DESCRIPTION</description>
	<files>
		<filename plugin="editor">editor.php</filename>
		<folder>params</folder>
		<folder>tmpl</folder>
	</files>
	<languages>
		<language tag="en-GB">en-GB.plg_fields_editor.ini</language>
		<language tag="en-GB">en-GB.plg_fields_editor.sys.ini</language>
	</languages>
	<config>
		<fields name="params">
			<fieldset name="basic">
				<field
					name="buttons"
					type="radio"
					label="PLG_FIELDS_EDITOR_PARAMS_SHOW_BUTTONS_LABEL"
					description="PLG_FIELDS_EDITOR_PARAMS_SHOW_BUTTONS_DESC"
					class="btn-group btn-group-yesno"
					default="0"
					filter="integer"
					>
					<option value="1">JYES</option>
					<option value="0">JNO</option>
				</field>

				<field
					name="hide"
					type="plugins"
					label="PLG_FIELDS_EDITOR_PARAMS_BUTTONS_HIDE_LABEL"
					description="JGLOBAL_SELECT_SOME_OPTIONS"
					folder="editors-xtd"
					multiple="true"
				/>

				<field
					name="width"
					type="text"
					label="PLG_FIELDS_EDITOR_PARAMS_WIDTH_LABEL"
					description="PLG_FIELDS_EDITOR_PARAMS_WIDTH_DESC"
					default="100%"
					size="5"
				/>

				<field
					name="height"
					type="text"
					label="PLG_FIELDS_EDITOR_PARAMS_HEIGHT_LABEL"
					description="PLG_FIELDS_EDITOR_PARAMS_HEIGHT_DESC"
					default="250px"
					size="5"
				/>

				<field
					name="filter"
					type="list"
					label="PLG_FIELDS_EDITOR_PARAMS_FILTER_LABEL"
					description="PLG_FIELDS_EDITOR_PARAMS_FILTER_DESC"
					class="btn-group"
					default="JComponentHelper::filterText"
					validate="options"
					>
					<option value="0">JNO</option>
					<option value="raw">JLIB_FILTER_PARAMS_RAW</option>
					<option value="safehtml">JLIB_FILTER_PARAMS_SAFEHTML</option>
					<option value="JComponentHelper::filterText">JLIB_FILTER_PARAMS_TEXT</option>
				</field>
			</fieldset>
		</fields>
	</config>
</extension>
checkboxes/params/checkboxes.xml000060400000001373152455757150013025 0ustar00<?xml version="1.0" encoding="utf-8"?>
<form>
	<fields name="fieldparams">
		<fieldset name="fieldparams">
			<field
				name="options"
				type="subform"
				label="PLG_FIELDS_CHECKBOXES_PARAMS_OPTIONS_LABEL"
				description="PLG_FIELDS_CHECKBOXES_PARAMS_OPTIONS_DESC"
				layout="joomla.form.field.subform.repeatable-table"
				icon="list"
				multiple="true"
				>
				<form hidden="true" name="list_templates_modal" repeat="true">
					<field
						name="name"
						type="text"
						label="PLG_FIELDS_CHECKBOXES_PARAMS_OPTIONS_NAME_LABEL"
						size="30"
					/>

					<field
						name="value"
						type="text"
						label="PLG_FIELDS_CHECKBOXES_PARAMS_OPTIONS_VALUE_LABEL"
						size="30"
					/>
				</form>
			</field>
		</fieldset>
	</fields>
</form>
checkboxes/tmpl/checkboxes.php000060400000001166152455757150012505 0ustar00<?php
/**
 * @package     Joomla.Plugin
 * @subpackage  Fields.Checkboxes
 *
 * @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;

$fieldValue = $field->value;

if ($fieldValue === '' || $fieldValue === null)
{
	return;
}

$fieldValue = (array) $fieldValue;
$texts      = array();
$options    = $this->getOptionsFromField($field);

foreach ($options as $value => $name)
{
	if (in_array((string) $value, $fieldValue))
	{
		$texts[] = JText::_($name);
	}
}

echo htmlentities(implode(', ', $texts));
checkboxes/checkboxes.php000060400000000722152455757150011526 0ustar00<?php
/**
 * @package     Joomla.Plugin
 * @subpackage  Fields.Checkboxes
 *
 * @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;

JLoader::import('components.com_fields.libraries.fieldslistplugin', JPATH_ADMINISTRATOR);

/**
 * Fields Checkboxes Plugin
 *
 * @since  3.7.0
 */
class PlgFieldsCheckboxes extends FieldsListPlugin
{
}
checkboxes/checkboxes.xml000060400000003073152455757150011541 0ustar00<?xml version="1.0" encoding="utf-8" ?>
<extension type="plugin" version="3.7.0" group="fields" method="upgrade">
	<name>plg_fields_checkboxes</name>
	<author>Joomla! Project</author>
	<creationDate>March 2016</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_CHECKBOXES_XML_DESCRIPTION</description>
	<files>
		<filename plugin="checkboxes">checkboxes.php</filename>
		<folder>params</folder>
		<folder>tmpl</folder>
	</files>
	<languages>
		<language tag="en-GB">en-GB.plg_fields_checkboxes.ini</language>
		<language tag="en-GB">en-GB.plg_fields_checkboxes.sys.ini</language>
	</languages>
	<config>
		<fields name="params">
			<fieldset name="basic">
				<field
					name="options"
					type="subform"
					label="PLG_FIELDS_CHECKBOXES_PARAMS_OPTIONS_LABEL"
					description="PLG_FIELDS_CHECKBOXES_PARAMS_OPTIONS_DESC"
					layout="joomla.form.field.subform.repeatable-table"
					icon="list"
					multiple="true"
					>
					<form hidden="true" name="list_templates_modal" repeat="true">
						<field
							name="name"
							type="text"
							label="PLG_FIELDS_CHECKBOXES_PARAMS_OPTIONS_NAME_LABEL"
							size="30"
						/>

						<field
							name="value"
							type="text"
							label="PLG_FIELDS_CHECKBOXES_PARAMS_OPTIONS_VALUE_LABEL"
							size="30"
						/>
					</form>
				</field>
			</fieldset>
		</fields>
	</config>
</extension>
list/params/list.xml000060400000002043152455757150010512 0ustar00<?xml version="1.0" encoding="utf-8"?>
<form>
	<fields name="fieldparams">
		<fieldset name="fieldparams">
			<field
				name="multiple"
				type="list"
				label="PLG_FIELDS_LIST_PARAMS_MULTIPLE_LABEL"
				description="PLG_FIELDS_LIST_PARAMS_MULTIPLE_DESC"
				filter="integer"
				>
				<option value="">COM_FIELDS_FIELD_USE_GLOBAL</option>
				<option value="1">JYES</option>
				<option value="0">JNO</option>
			</field>

			<field
				name="options"
				type="subform"
				label="PLG_FIELDS_LIST_PARAMS_OPTIONS_LABEL"
				description="PLG_FIELDS_LIST_PARAMS_OPTIONS_DESC"
				layout="joomla.form.field.subform.repeatable-table"
				icon="list"
				multiple="true"
				>
				<form hidden="true" name="list_templates_modal" repeat="true">
					<field
						name="name"
						type="text"
						label="PLG_FIELDS_LIST_PARAMS_OPTIONS_NAME_LABEL"
						size="30"
					/>

					<field
						name="value"
						type="text"
						label="PLG_FIELDS_LIST_PARAMS_OPTIONS_VALUE_LABEL"
						size="30"
					/>
				</form>
			</field>
		</fieldset>
	</fields>
</form>
list/tmpl/list.php000060400000001130152455757150010166 0ustar00<?php
/**
 * @package     Joomla.Plugin
 * @subpackage  Fields.List
 *
 * @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;

$fieldValue = $field->value;

if ($fieldValue == '')
{
	return;
}

$fieldValue = (array) $fieldValue;
$texts      = array();
$options    = $this->getOptionsFromField($field);

foreach ($options as $value => $name)
{
	if (in_array((string) $value, $fieldValue))
	{
		$texts[] = JText::_($name);
	}
}


echo htmlentities(implode(', ', $texts));
list/list.xml000060400000003426152455757150007235 0ustar00<?xml version="1.0" encoding="utf-8" ?>
<extension type="plugin" version="3.7.0" group="fields" method="upgrade">
	<name>plg_fields_list</name>
	<author>Joomla! Project</author>
	<creationDate>March 2016</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_LIST_XML_DESCRIPTION</description>
	<files>
		<filename plugin="list">list.php</filename>
	</files>
	<languages>
		<language tag="en-GB">en-GB.plg_fields_list.ini</language>
		<language tag="en-GB">en-GB.plg_fields_list.sys.ini</language>
	</languages>
	<config>
		<fields name="params">
			<fieldset name="basic">
				<field
					name="multiple"
					type="radio"
					label="PLG_FIELDS_LIST_PARAMS_MULTIPLE_LABEL"
					description="PLG_FIELDS_LIST_PARAMS_MULTIPLE_DESC"
					class="btn-group btn-group-yesno"
					default="0"
					filter="integer"
					>
					<option value="1">JYES</option>
					<option value="0">JNO</option>
				</field>

				<field
					name="options"
					type="subform"
					label="PLG_FIELDS_LIST_PARAMS_OPTIONS_LABEL"
					description="PLG_FIELDS_LIST_PARAMS_OPTIONS_DESC"
					layout="joomla.form.field.subform.repeatable-table"
					icon="list"
					multiple="true"
					>
					<form hidden="true" name="list_templates_modal" repeat="true">
						<field
							name="name"
							type="text"
							label="PLG_FIELDS_LIST_PARAMS_OPTIONS_NAME_LABEL"
							size="30"
						/>

						<field
							name="value"
							type="text"
							label="PLG_FIELDS_LIST_PARAMS_OPTIONS_VALUE_LABEL"
							size="30"
						/>
					</form>
				</field>
			</fieldset>
		</fields>
	</config>
</extension>
list/list.php000060400000002040152455757150007213 0ustar00<?php
/**
 * @package     Joomla.Plugin
 * @subpackage  Fields.List
 *
 * @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;

JLoader::import('components.com_fields.libraries.fieldslistplugin', JPATH_ADMINISTRATOR);

/**
 * Fields list Plugin
 *
 * @since  3.7.0
 */
class PlgFieldsList extends FieldsListPlugin
{
	/**
	 * Prepares the field
	 *
	 * @param   string    $context  The context.
	 * @param   stdclass  $item     The item.
	 * @param   stdclass  $field    The field.
	 *
	 * @return  object
	 *
	 * @since   3.9.2
	 */
	public function onCustomFieldsPrepareField($context, $item, $field)
	{
		// Check if the field should be processed
		if (!$this->isTypeSupported($field->type))
		{
			return;
		}

		// The field's rawvalue should be an array
		if (!is_array($field->rawvalue))
		{
			$field->rawvalue = (array) $field->rawvalue;
		}

		return parent::onCustomFieldsPrepareField($context, $item, $field);
	}
}
usergrouplist/tmpl/usergrouplist.php000060400000001245152455757150014125 0ustar00<?php
/**
 * @package     Joomla.Plugin
 * @subpackage  Fields.Usergrouplist
 *
 * @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;

$value = $field->value;

if ($value == '')
{
	return;
}

JLoader::register('UsersHelper', JPATH_ADMINISTRATOR . '/components/com_users/helpers/users.php');

$value  = (array) $value;
$texts  = array();
$groups = UsersHelper::getGroups();

foreach ($groups as $group)
{
	if (in_array($group->value, $value))
	{
		$texts[] = htmlentities(trim($group->text, '- '));
	}
}

echo htmlentities(implode(', ', $texts));
usergrouplist/usergrouplist.xml000060400000002440152455757150013160 0ustar00<?xml version="1.0" encoding="utf-8" ?>
<extension type="plugin" version="3.7.0" group="fields" method="upgrade">
	<name>plg_fields_usergrouplist</name>
	<author>Joomla! Project</author>
	<creationDate>March 2016</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_USERGROUPLIST_XML_DESCRIPTION</description>
	<files>
		<filename plugin="usergrouplist">usergrouplist.php</filename>
		<folder>params</folder>
		<folder>tmpl</folder>
	</files>
	<languages>
		<language tag="en-GB">en-GB.plg_fields_usergrouplist.ini</language>
		<language tag="en-GB">en-GB.plg_fields_usergrouplist.sys.ini</language>
	</languages>
	<config>
		<fields name="params">
			<fieldset name="basic">
				<field
					name="multiple"
					type="radio"
					label="PLG_FIELDS_USERGROUPLIST_PARAMS_MULTIPLE_LABEL"
					description="PLG_FIELDS_USERGROUPLIST_PARAMS_MULTIPLE_DESC"
					class="btn-group btn-group-yesno"
					default="0"
					filter="integer"
					>
					<option value="1">JYES</option>
					<option value="0">JNO</option>
				</field>
			</fieldset>
		</fields>
	</config>
</extension>
usergrouplist/usergrouplist.php000060400000000723152455757150013151 0ustar00<?php
/**
 * @package     Joomla.Plugin
 * @subpackage  Fields.Usergrouplist
 *
 * @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;

JLoader::import('components.com_fields.libraries.fieldsplugin', JPATH_ADMINISTRATOR);

/**
 * Fields Usergrouplist Plugin
 *
 * @since  3.7.0
 */
class PlgFieldsUsergrouplist extends FieldsPlugin
{
}
usergrouplist/params/usergrouplist.xml000060400000000735152455757150014450 0ustar00<?xml version="1.0" encoding="utf-8"?>
<form>
	<fields name="fieldparams">
		<fieldset name="fieldparams">
			<field
				name="multiple"
				type="list"
				label="PLG_FIELDS_USERGROUPLIST_PARAMS_MULTIPLE_LABEL"
				description="PLG_FIELDS_USERGROUPLIST_PARAMS_MULTIPLE_DESC"
				filter="integer"
				>
				<option value="">COM_FIELDS_FIELD_USE_GLOBAL</option>
				<option value="1">JYES</option>
				<option value="0">JNO</option>
			</field>
		</fieldset>
	</fields>
</form>
media/tmpl/media.php000060400000001230152455757150010377 0ustar00<?php
/**
 * @package     Joomla.Plugin
 * @subpackage  Fields.Media
 *
 * @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;

if ($field->value == '')
{
	return;
}

$class = $fieldParams->get('image_class');

if ($class)
{
	$class = ' class="' . htmlentities($class, ENT_COMPAT, 'UTF-8', true) . '"';
}

$value  = (array) $field->value;
$buffer = '';

foreach ($value as $path)
{
	if (!$path)
	{
		continue;
	}

	$buffer .= sprintf('<img src="%s"%s>',
		htmlentities($path, ENT_COMPAT, 'UTF-8', true),
		$class
	);
}

echo $buffer;
media/media.xml000060400000003350152455757150007441 0ustar00<?xml version="1.0" encoding="utf-8" ?>
<extension type="plugin" version="3.7.0" group="fields" method="upgrade">
	<name>plg_fields_media</name>
	<author>Joomla! Project</author>
	<creationDate>March 2016</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_MEDIA_XML_DESCRIPTION</description>
	<files>
		<filename plugin="media">media.php</filename>
		<folder>params</folder>
		<folder>tmpl</folder>
	</files>
	<languages>
		<language tag="en-GB">en-GB.plg_fields_media.ini</language>
		<language tag="en-GB">en-GB.plg_fields_media.sys.ini</language>
	</languages>
	<config>
		<fields name="params">
			<fieldset name="basic">
				<field
					name="directory"
					type="folderlist"
					label="PLG_FIELDS_MEDIA_PARAMS_DIRECTORY_LABEL"
					description="PLG_FIELDS_MEDIA_PARAMS_DIRECTORY_DESC"
					directory="images"
					hide_none="true"
					recursive="true"
				/>

				<field
					name="preview"
					type="list"
					label="PLG_FIELDS_MEDIA_PARAMS_PREVIEW_LABEL"
					description="PLG_FIELDS_MEDIA_PARAMS_PREVIEW_DESC"
					class="btn-group"
					default="tooltip"
					>
					<option value="tooltip">PLG_FIELDS_MEDIA_PARAMS_PREVIEW_TOOLTIP</option>
					<option value="true">PLG_FIELDS_MEDIA_PARAMS_PREVIEW_INLINE</option>
					<option value="false">JNO</option>
				</field>

				<field
					name="image_class"
					type="textarea"
					label="PLG_FIELDS_MEDIA_PARAMS_IMAGE_CLASS_LABEL"
					description="PLG_FIELDS_MEDIA_PARAMS_IMAGE_CLASS_DESC"
					size="40"
				/>
			</fieldset>
		</fields>
	</config>
</extension>
media/params/media.xml000060400000001720152455757150010723 0ustar00<?xml version="1.0" encoding="utf-8"?>
<form>
	<fields name="fieldparams">
		<fieldset name="fieldparams">
			<field
				name="directory"
				type="folderlist"
				label="PLG_FIELDS_MEDIA_PARAMS_DIRECTORY_LABEL"
				description="PLG_FIELDS_MEDIA_PARAMS_DIRECTORY_DESC"
				directory="images"
				hide_none="true"
				recursive="true"
			/>

			<field
				name="preview"
				type="list"
				label="PLG_FIELDS_MEDIA_PARAMS_PREVIEW_LABEL"
				description="PLG_FIELDS_MEDIA_PARAMS_PREVIEW_DESC"
				>
				<option value="">COM_FIELDS_FIELD_USE_GLOBAL</option>
				<option value="tooltip">PLG_FIELDS_MEDIA_PARAMS_PREVIEW_TOOLTIP</option>
				<option value="true">PLG_FIELDS_MEDIA_PARAMS_PREVIEW_INLINE</option>
				<option value="false">JNO</option>
			</field>

			<field
				name="image_class"
				type="textarea"
				label="PLG_FIELDS_MEDIA_PARAMS_IMAGE_CLASS_LABEL"
				description="PLG_FIELDS_MEDIA_PARAMS_IMAGE_CLASS_DESC"
				size="40"
			/>
		</fieldset>
	</fields>
</form>
media/media.php000060400000002014152455757150007424 0ustar00<?php
/**
 * @package     Joomla.Plugin
 * @subpackage  Fields.Media
 *
 * @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;

JLoader::import('components.com_fields.libraries.fieldsplugin', JPATH_ADMINISTRATOR);

/**
 * Fields Media Plugin
 *
 * @since  3.7.0
 */
class PlgFieldsMedia extends FieldsPlugin
{
	/**
	 * 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   JForm       $form    The form.
	 *
	 * @return  DOMElement
	 *
	 * @since   3.7.0
	 */
	public function onCustomFieldsPrepareDom($field, DOMElement $parent, JForm $form)
	{
		$fieldNode = parent::onCustomFieldsPrepareDom($field, $parent, $form);

		if (!$fieldNode)
		{
			return $fieldNode;
		}

		$fieldNode->setAttribute('hide_default', 'true');

		return $fieldNode;
	}
}
integer/integer.php000060400000000701152455757150010361 0ustar00<?php
/**
 * @package     Joomla.Plugin
 * @subpackage  Fields.Integer
 *
 * @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;

JLoader::import('components.com_fields.libraries.fieldsplugin', JPATH_ADMINISTRATOR);

/**
 * Fields Integer Plugin
 *
 * @since  3.7.0
 */
class PlgFieldsInteger extends FieldsPlugin
{
}
integer/integer.xml000060400000003564152455757150010404 0ustar00<?xml version="1.0" encoding="utf-8" ?>
<extension type="plugin" version="3.7.0" group="fields" method="upgrade">
	<name>plg_fields_integer</name>
	<author>Joomla! Project</author>
	<creationDate>March 2016</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_INTEGER_XML_DESCRIPTION</description>
	<files>
		<filename plugin="integer">integer.php</filename>
		<folder>params</folder>
		<folder>tmpl</folder>
	</files>
	<languages>
		<language tag="en-GB">en-GB.plg_fields_integer.ini</language>
		<language tag="en-GB">en-GB.plg_fields_integer.sys.ini</language>
	</languages>
	<config>
		<fields name="params">
			<fieldset name="basic">
				<field
					name="multiple"
					type="radio"
					label="PLG_FIELDS_INTEGER_PARAMS_MULTIPLE_LABEL"
					description="PLG_FIELDS_INTEGER_PARAMS_MULTIPLE_DESC"
					class="btn-group btn-group-yesno"
					default="0"
					filter="integer"
					>
					<option value="1">JYES</option>
					<option value="0">JNO</option>
				</field>

				<field
					name="first"
					type="number"
					label="PLG_FIELDS_INTEGER_PARAMS_FIRST_LABEL"
					description="PLG_FIELDS_INTEGER_PARAMS_FIRST_DESC"
					default="1"
					filter="integer"
					size="5"
				/>

				<field
					name="last"
					type="number"
					label="PLG_FIELDS_INTEGER_PARAMS_LAST_LABEL"
					description="PLG_FIELDS_INTEGER_PARAMS_LAST_DESC"
					default="100"
					filter="integer"
					size="5"
				/>

				<field
					name="step"
					type="number"
					label="PLG_FIELDS_INTEGER_PARAMS_STEP_LABEL"
					description="PLG_FIELDS_INTEGER_PARAMS_STEP_DESC"
					default="1"
					filter="integer"
					size="5"
				/>
			</fieldset>
		</fields>
	</config>
</extension>
integer/params/integer.xml000060400000002010152455757150011650 0ustar00<?xml version="1.0" encoding="utf-8"?>
<form>
	<fields name="fieldparams">
		<fieldset name="fieldparams">
			<field
				name="multiple"
				type="list"
				label="PLG_FIELDS_INTEGER_PARAMS_MULTIPLE_LABEL"
				description="PLG_FIELDS_INTEGER_PARAMS_MULTIPLE_DESC"
				filter="integer"
				>
				<option value="">COM_FIELDS_FIELD_USE_GLOBAL</option>
				<option value="1">JYES</option>
				<option value="0">JNO</option>
			</field>

			<field
				name="first"
				type="number"
				label="PLG_FIELDS_INTEGER_PARAMS_FIRST_LABEL"
				description="PLG_FIELDS_INTEGER_PARAMS_FIRST_DESC"
				filter="integer"
				size="5"
			/>

			<field
				name="last"
				type="number"
				label="PLG_FIELDS_INTEGER_PARAMS_LAST_LABEL"
				description="PLG_FIELDS_INTEGER_PARAMS_LAST_DESC"
				filter="integer"
				size="5"
			/>

			<field
				name="step"
				type="number"
				label="PLG_FIELDS_INTEGER_PARAMS_STEP_LABEL"
				description="PLG_FIELDS_INTEGER_PARAMS_STEP_DESC"
				filter="integer"
				size="5"
			/>
		</fieldset>
	</fields>
</form>
integer/tmpl/integer.php000060400000000675152455757150011347 0ustar00<?php
/**
 * @package     Joomla.Plugin
 * @subpackage  Fields.Integer
 *
 * @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;

$value = $field->value;

if ($value == '')
{
	return;
}

if (is_array($value))
{
	$value = implode(', ', array_map('intval', $value));
}
else
{
	$value = (int) $value;
}

echo $value;
repeatable/tmpl/repeatable.php000060400000001077152455757150012462 0ustar00<?php
/**
 * @package     Joomla.Plugin
 * @subpackage  Fields.Repeatable
 *
 * @copyright   (C) 2018 Open Source Matters, Inc. <https://www.joomla.org>
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */

defined('_JEXEC') or die;

$fieldValue = $field->value;

if ($fieldValue === '')
{
	return;
}

// Get the values
$fieldValues = json_decode($fieldValue, true);

if (empty($fieldValues))
{
	return;
}

$html = '<ul>';

foreach ($fieldValues as $value)
{
	$html .= '<li>' . implode(', ', $value) . '</li>';
}

$html .= '</ul>';

echo $html;
repeatable/repeatable.php000060400000007333152455757150011507 0ustar00<?php
/**
 * @package     Joomla.Plugin
 * @subpackage  Fields.Repeatable
 *
 * @copyright   (C) 2018 Open Source Matters, Inc. <https://www.joomla.org>
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */

use Joomla\CMS\MVC\Model\BaseDatabaseModel;

defined('_JEXEC') or die;

JLoader::import('components.com_fields.libraries.fieldsplugin', JPATH_ADMINISTRATOR);

/**
 * Repeatable plugin.
 *
 * @since  3.9.0
 */
class PlgFieldsRepeatable extends FieldsPlugin
{
	/**
	 * 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   JForm       $form    The form.
	 *
	 * @return  DOMElement
	 *
	 * @since   3.9.0
	 */
	public function onCustomFieldsPrepareDom($field, DOMElement $parent, JForm $form)
	{
		$fieldNode = parent::onCustomFieldsPrepareDom($field, $parent, $form);

		if (!$fieldNode)
		{
			return $fieldNode;
		}

		$readonly = false;

		if (!FieldsHelper::canEditFieldValue($field))
		{
			$readonly = true;
		}

		$fieldNode->setAttribute('type', 'subform');
		$fieldNode->setAttribute('multiple', 'true');
		$fieldNode->setAttribute('layout', 'joomla.form.field.subform.repeatable-table');

		// Build the form source
		$fieldsXml = new SimpleXMLElement('<form/>');
		$fields    = $fieldsXml->addChild('fields');

		// Get the form settings
		$formFields = $field->fieldparams->get('fields');

		// Add the fields to the form
		foreach ($formFields as $index => $formField)
		{
			$child = $fields->addChild('field');
			$child->addAttribute('name', $formField->fieldname);
			$child->addAttribute('type', $formField->fieldtype);
			$child->addAttribute('readonly', $readonly);

			if (isset($formField->fieldfilter))
			{
				$child->addAttribute('filter', $formField->fieldfilter);
			}
		}

		$fieldNode->setAttribute('formsource', $fieldsXml->asXML());

		// Return the node
		return $fieldNode;
	}

	/**
	 * The save event.
	 *
	 * @param   string   $context  The context
	 * @param   JTable   $item     The article data
	 * @param   boolean  $isNew    Is new item
	 * @param   array    $data     The validated data
	 *
	 * @return  boolean
	 *
	 * @since   3.9.0
	 */
	public function onContentAfterSave($context, $item, $isNew, $data = array())
	{
		// Create correct context for category
		if ($context == 'com_categories.category')
		{
			$context = $item->get('extension') . '.categories';

			// Set the catid on the category to get only the fields which belong to this category
			$item->set('catid', $item->get('id'));
		}

		// Check the context
		$parts = FieldsHelper::extract($context, $item);

		if (!$parts)
		{
			return true;
		}

		// Compile the right context for the fields
		$context = $parts[0] . '.' . $parts[1];

		// Loading the fields
		$fields = FieldsHelper::getFields($context, $item);

		if (!$fields)
		{
			return true;
		}

		// Get the fields data
		$fieldsData = !empty($data['com_fields']) ? $data['com_fields'] : array();

		// Loading the model
		/** @var FieldsModelField $model */
		$model = BaseDatabaseModel::getInstance('Field', 'FieldsModel', array('ignore_request' => true));

		// Loop over the fields
		foreach ($fields as $field)
		{
			// Find the field of this type repeatable
			if ($field->type !== $this->_name)
			{
				continue;
			}

			// Determine the value if it is available from the data
			$value = key_exists($field->name, $fieldsData) ? $fieldsData[$field->name] : null;

			// Handle json encoded values
			if (!is_array($value))
			{
				$value = json_decode($value, true);
			}

			// Setting the value for the field and the item
			$model->setFieldValue($field->id, $item->get('id'), json_encode($value));
		}

		return true;
	}
}
repeatable/repeatable.xml000060400000001556152455757150011521 0ustar00<?xml version="1.0" encoding="utf-8" ?>
<extension type="plugin" version="3.8.0" group="fields" method="upgrade">
	<name>plg_fields_repeatable</name>
	<author>Joomla! Project</author>
	<creationDate>April 2018</creationDate>
	<copyright>(C) 2018 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.9.0</version>
	<description>PLG_FIELDS_REPEATABLE_XML_DESCRIPTION</description>
	<files>
		<filename plugin="repeatable">repeatable.php</filename>
		<folder>params</folder>
		<folder>tmpl</folder>
	</files>
	<languages folder="language">
		<language tag="en-GB">en-GB/en-GB.plg_fields_repeatable.ini</language>
		<language tag="en-GB">en-GB/en-GB.plg_fields_repeatable.sys.ini</language>
	</languages>
</extension>
repeatable/params/repeatable.xml000060400000004710152455757150012777 0ustar00<?xml version="1.0" encoding="utf-8"?>
<form>
	<fields name="fieldparams">
		<fieldset name="fieldparams">
			<field
				name="fields"
				type="subform"
				label="PLG_FIELDS_REPEATABLE_PARAMS_FIELDS_LABEL"
				description="PLG_FIELDS_REPEATABLE_PARAMS_FIELDS_DESC"
				multiple="true">
				<form>
					<fields>
						<fieldset>
							<field
								name="fieldname"
								type="text"
								label="PLG_FIELDS_REPEATABLE_PARAMS_FIELDNAME_NAME_LABEL"
								description="PLG_FIELDS_REPEATABLE_PARAMS_FIELDNAME_NAME_DESC"
								required="true"
							/>
							<field
								name="fieldtype"
								type="list"
								label="PLG_FIELDS_REPEATABLE_PARAMS_FIELDNAME_TYPE_LABEL"
								description="PLG_FIELDS_REPEATABLE_PARAMS_FIELDNAME_TYPE_DESC"
								>
								<option value="editor">PLG_FIELDS_REPEATABLE_PARAMS_FIELDNAME_TYPE_EDITOR</option>
								<option value="media">PLG_FIELDS_REPEATABLE_PARAMS_FIELDNAME_TYPE_MEDIA</option>
								<option value="number">PLG_FIELDS_REPEATABLE_PARAMS_FIELDNAME_TYPE_NUMBER</option>
								<option value="text">PLG_FIELDS_REPEATABLE_PARAMS_FIELDNAME_TYPE_TEXT</option>
								<option value="textarea">PLG_FIELDS_REPEATABLE_PARAMS_FIELDNAME_TYPE_TEXTAREA</option>
							</field>
							<field
								name="fieldfilter"
								type="list"
								label="PLG_FIELDS_TEXT_PARAMS_FILTER_LABEL"
								description="PLG_FIELDS_TEXT_PARAMS_FILTER_DESC"
								class="btn-group"
								validate="options"
								showon="fieldtype!:media,number"
								>
								<option value="0">JNO</option>
								<option
									showon="fieldtype:editor,text,textarea"
									value="raw">JLIB_FILTER_PARAMS_RAW</option>
								<option
									showon="fieldtype:editor,text,textarea"
									value="safehtml">JLIB_FILTER_PARAMS_SAFEHTML</option>
								<option
									showon="fieldtype:editor,text,textarea"
									value="JComponentHelper::filterText">JLIB_FILTER_PARAMS_TEXT</option>
								<option
									showon="fieldtype:text,textarea"
									value="alnum">JLIB_FILTER_PARAMS_ALNUM</option>
								<option
									showon="fieldtype:text,textarea"
									value="integer">JLIB_FILTER_PARAMS_INTEGER</option>
								<option
									showon="fieldtype:text,textarea"
									value="float">JLIB_FILTER_PARAMS_FLOAT</option>
								<option
									showon="fieldtype:text,textarea"
									value="tel">JLIB_FILTER_PARAMS_TEL</option>
							</field>
						</fieldset>
					</fields>
				</form>
			</field>
		</fieldset>
	</fields>
</form>
consentbox.php000060400000015164152456134000007442 0ustar00<?php
/**
 * @package     Joomla.Plugin
 * @subpackage  Content.confirmconsent
 *
 * @copyright   (C) 2018 Open Source Matters, Inc. <https://www.joomla.org>
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */

defined('JPATH_PLATFORM') or die;

use Joomla\CMS\Factory;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Language\Associations;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Router\Route;

JFormHelper::loadFieldClass('Checkboxes');

/**
 * Consentbox Field class for the Confirm Consent Plugin.
 *
 * @since  3.9.1
 */
class JFormFieldConsentBox extends JFormFieldCheckboxes
{
	/**
	 * The form field type.
	 *
	 * @var    string
	 * @since  3.9.1
	 */
	protected $type = 'ConsentBox';

	/**
	 * Flag to tell the field to always be in multiple values mode.
	 *
	 * @var    boolean
	 * @since  3.9.1
	 */
	protected $forceMultiple = false;

	/**
	 * The article ID.
	 *
	 * @var    integer
	 * @since  3.9.1
	 */
	protected $articleid;

	/**
	 * Method to set certain otherwise inaccessible properties of the form field object.
	 *
	 * @param   string  $name   The property name for which to set the value.
	 * @param   mixed   $value  The value of the property.
	 *
	 * @return  void
	 *
	 * @since   3.9.1
	 */
	public function __set($name, $value)
	{
		switch ($name)
		{
			case 'articleid':
				$this->articleid = (int) $value;
				break;

			default:
				parent::__set($name, $value);
		}
	}

	/**
	 * Method to get certain otherwise inaccessible properties from the form field object.
	 *
	 * @param   string  $name  The property name for which to get the value.
	 *
	 * @return  mixed  The property value or null.
	 *
	 * @since   3.9.1
	 */
	public function __get($name)
	{
		switch ($name)
		{
			case 'articleid':
				return $this->$name;
		}

		return parent::__get($name);
	}

	/**
	 * Method to attach a JForm object to the field.
	 *
	 * @param   SimpleXMLElement  $element  The SimpleXMLElement object representing the `<field>` tag for the form field object.
	 * @param   mixed             $value    The form field value to validate.
	 * @param   string            $group    The field name group control value. This acts as an array container for the field.
	 *                                      For example if the field has name="foo" and the group value is set to "bar" then the
	 *                                      full field name would end up being "bar[foo]".
	 *
	 * @return  boolean  True on success.
	 *
	 * @see     JFormField::setup()
	 * @since   3.9.1
	 */
	public function setup(SimpleXMLElement $element, $value, $group = null)
	{
		$return = parent::setup($element, $value, $group);

		if ($return)
		{
			$this->articleid = (int) $this->element['articleid'];
		}

		return $return;
	}

	/**
	 * Method to get the field label markup.
	 *
	 * @return  string  The field label markup.
	 *
	 * @since   3.9.1
	 */
	protected function getLabel()
	{
		if ($this->hidden)
		{
			return '';
		}

		$data = $this->getLayoutData();

		// Forcing the Alias field to display the tip below
		$position = $this->element['name'] == 'alias' ? ' data-placement="bottom" ' : '';

		// When we have an article let's add the modal and make the title clickable
		if ($data['articleid'])
		{
			$attribs['data-toggle'] = 'modal';

			$data['label'] = HTMLHelper::_(
				'link',
				'#modal-' . $this->id,
				$data['label'],
				$attribs
			);
		}

		// Here mainly for B/C with old layouts. This can be done in the layouts directly
		$extraData = array(
			'text'     => $data['label'],
			'for'      => $this->id,
			'classes'  => explode(' ', $data['labelclass']),
			'position' => $position,
		);

		return $this->getRenderer($this->renderLabelLayout)->render(array_merge($data, $extraData));
	}

	/**
	 * Method to get the field input markup.
	 *
	 * @return  string  The field input markup.
	 *
	 * @since   3.9.2
	 */
	protected function getInput()
	{
		$modalHtml  = '';
		$layoutData = $this->getLayoutData();

		if ($this->articleid)
		{
			$modalParams['title']  = $layoutData['label'];
			$modalParams['url']    = $this->getAssignedArticleUrl();
			$modalParams['height'] = 800;
			$modalParams['width']  = '100%';
			$modalHtml = HTMLHelper::_('bootstrap.renderModal', 'modal-' . $this->id, $modalParams);
		}

		return $modalHtml . parent::getInput();
	}

	/**
	 * Method to get the data to be passed to the layout for rendering.
	 *
	 * @return  array
	 *
	 * @since   3.9.1
	 */
	protected function getLayoutData()
	{
		$data = parent::getLayoutData();

		$extraData = array(
			'articleid' => (integer) $this->articleid,
		);

		return array_merge($data, $extraData);
	}

	/**
	 * Return the url of the assigned article based on the current user language
	 *
	 * @return  string  Returns the link to the article
	 *
	 * @since   3.9.1
	 */
	private function getAssignedArticleUrl()
	{
		$db = Factory::getDbo();

		// Get the info from the article
		$query = $db->getQuery(true)
			->select($db->quoteName(array('id', 'catid', 'language')))
			->from($db->quoteName('#__content'))
			->where($db->quoteName('id') . ' = ' . (int) $this->articleid);
		$db->setQuery($query);

		try
		{
			$article = $db->loadObject();
		}
		catch (JDatabaseExceptionExecuting $e)
		{
			// Something at the database layer went wrong
			return Route::_(
				'index.php?option=com_content&view=article&id='
				. $this->articleid . '&tmpl=component'
			);
		}

		if (!is_object($article))
		{
			// We have not found the article object lets show a 404 to the user
			return Route::_(
				'index.php?option=com_content&view=article&id='
				. $this->articleid . '&tmpl=component'
			);
		}

		// Register ContentHelperRoute
		JLoader::register('ContentHelperRoute', JPATH_BASE . '/components/com_content/helpers/route.php');

		if (!Associations::isEnabled())
		{
			return Route::_(
				ContentHelperRoute::getArticleRoute(
					$article->id,
					$article->catid,
					$article->language
				) . '&tmpl=component'
			);
		}

		$associatedArticles = Associations::getAssociations('com_content', '#__content', 'com_content.item', $article->id);
		$currentLang        = Factory::getLanguage()->getTag();

		if (isset($associatedArticles) && $currentLang !== $article->language && array_key_exists($currentLang, $associatedArticles))
		{
			return Route::_(
				ContentHelperRoute::getArticleRoute(
					$associatedArticles[$currentLang]->id,
					$associatedArticles[$currentLang]->catid,
					$associatedArticles[$currentLang]->language
				) . '&tmpl=component'
			);
		}

		// Association is enabled but this article is not associated
		return Route::_(
			'index.php?option=com_content&view=article&id='
				. $article->id . '&catid=' . $article->catid
				. '&tmpl=component&lang=' . $article->language
		);
	}
}
default.php000060400000015702152456173630006716 0ustar00<?php
/**
 * @package     Joomla.Administrator
 * @subpackage  com_fields
 *
 * @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;

// Include the component HTML helpers.
JHtml::addIncludePath(JPATH_COMPONENT . '/helpers/html');

JHtml::_('bootstrap.tooltip');
JHtml::_('behavior.multiselect');
JHtml::_('formbehavior.chosen', 'select');

$app       = JFactory::getApplication();
$user      = JFactory::getUser();
$userId    = $user->get('id');
$context   = $this->escape($this->state->get('filter.context'));
$component = $this->state->get('filter.component');
$listOrder = $this->escape($this->state->get('list.ordering'));
$listDirn  = $this->escape($this->state->get('list.direction'));
$ordering  = ($listOrder == 'a.ordering');
$saveOrder = ($listOrder == 'a.ordering' && strtolower($listDirn) == 'asc');

// The category object of the component
$category = JCategories::getInstance(str_replace('com_', '', $component));

if ($saveOrder)
{
	$saveOrderingUrl = 'index.php?option=com_fields&task=fields.saveOrderAjax&tmpl=component';
	JHtml::_('sortablelist.sortable', 'fieldList', 'adminForm', strtolower($listDirn), $saveOrderingUrl, false, true);
}
?>

<form action="<?php echo JRoute::_('index.php?option=com_fields&view=fields'); ?>" method="post" name="adminForm" id="adminForm">
	<div id="j-sidebar-container" class="span2">
		<?php echo $this->sidebar; ?>
	</div>
	<div id="j-main-container" class="span10">
		<div id="filter-bar" class="js-stools-container-bar pull-left">
			<div class="btn-group pull-left">
				<?php echo $this->filterForm->getField('context')->input; ?>
			</div>&nbsp;
		</div>
		<?php echo JLayoutHelper::render('joomla.searchtools.default', array('view' => $this)); ?>
		<?php if (empty($this->items)) : ?>
			<div class="alert alert-no-items">
				<?php echo JText::_('JGLOBAL_NO_MATCHING_RESULTS'); ?>
			</div>
		<?php else : ?>
			<table class="adminlist" id="fieldList">
				<thead>
					<tr>
						<th class="checkmark-col">
							<input type="checkbox" name="checkall-toggle" value="" title="<?php echo JText::_('JGLOBAL_CHECK_ALL'); ?>" onclick="Joomla.checkAll(this)" />
						</th>
						<th width="1%" class="nowrap center">
							<?php echo JHtml::_('searchtools.sort', 'JSTATUS', 'a.state', $listDirn, $listOrder); ?>
						</th>
						<th>
							<?php echo JHtml::_('searchtools.sort', 'JGLOBAL_TITLE', 'a.title', $listDirn, $listOrder); ?>
						</th>
						<th>
							<?php echo JHtml::_('searchtools.sort', 'COM_FIELDS_FIELD_TYPE_LABEL', 'a.type', $listDirn, $listOrder); ?>
						</th>
						<th>
							<?php echo JHtml::_('searchtools.sort', 'COM_FIELDS_FIELD_GROUP_LABEL', 'g.title', $listDirn, $listOrder); ?>
						</th>
						<th width="10%" class="nowrap hidden-phone">
							<?php echo JHtml::_('searchtools.sort', 'JGRID_HEADING_ACCESS', 'a.access', $listDirn, $listOrder); ?>
						</th>
						<th width="5%" class="nowrap hidden-phone">
							<?php echo JHtml::_('searchtools.sort', 'JGRID_HEADING_LANGUAGE', 'a.language', $listDirn, $listOrder); ?>
						</th>
						<th width="1%" class="nowrap hidden-phone">
							<?php echo JHtml::_('searchtools.sort', 'JGRID_HEADING_ID', 'a.id', $listDirn, $listOrder); ?>
						</th>
					</tr>
				</thead>
				<tfoot>
					<tr>
						<td colspan="9">
							<?php echo $this->pagination->getListFooter(); ?>
						</td>
					</tr>
				</tfoot>
				<tbody>
					<?php foreach ($this->items as $i => $item) : ?>
						<?php $ordering   = ($listOrder == 'a.ordering'); ?>
						<?php $canEdit    = $user->authorise('core.edit', $component . '.field.' . $item->id); ?>
						<?php $canCheckin = $user->authorise('core.admin', 'com_checkin') || $item->checked_out == $userId || $item->checked_out == 0; ?>
						<?php $canEditOwn = $user->authorise('core.edit.own', $component . '.field.' . $item->id) && $item->created_user_id == $userId; ?>
						<?php $canChange  = $user->authorise('core.edit.state', $component . '.field.' . $item->id) && $canCheckin; ?>
						<tr class="row<?php echo $i % 2; ?>" item-id="<?php echo $item->id ?>">
							<td class="center">
								<?php echo JHtml::_('grid.id', $i, $item->id); ?>
							</td>
							<td class="center">
								<?php echo JHtml::_('jgrid.published', $item->state, $i, 'fields.', $canChange); ?>
							</td>
							<td>
								<div class="pull-left break-word">
									<?php if ($item->checked_out) : ?>
										<?php echo JHtml::_('jgrid.checkedout', $i, $item->editor, $item->checked_out_time, 'fields.', $canCheckin); ?>
									<?php endif; ?>
									<?php if ($canEdit || $canEditOwn) : ?>
										<a href="<?php echo JRoute::_('index.php?option=com_fields&task=field.edit&id=' . $item->id . '&context=' . $context); ?>">
											<?php echo $this->escape($item->title); ?></a>
									<?php else : ?>
										<?php echo $this->escape($item->title); ?>
									<?php endif; ?>
									<span class="small break-word">
										<?php if (empty($item->note)) : ?>
											<?php echo JText::sprintf('JGLOBAL_LIST_NAME', $this->escape($item->name)); ?>
										<?php else : ?>
											<?php echo JText::sprintf('JGLOBAL_LIST_NAME_NOTE', $this->escape($item->name), $this->escape($item->note)); ?>
										<?php endif; ?>
									</span>
									<div class="small">
										<?php if ($category) : ?>
											<?php echo JText::_('JCATEGORY') . ': '; ?>
											<?php $categories = FieldsHelper::getAssignedCategoriesTitles($item->id); ?>
											<?php if ($categories) : ?>
												<?php echo implode(', ', $categories); ?>
											<?php else : ?>
												<?php echo JText::_('JALL'); ?>
											<?php endif; ?>
										<?php endif; ?>
									</div>
								</div>
							</td>
							<td class="small">
								<?php echo $this->escape($item->type); ?>
							</td>
							<td>
								<?php echo $this->escape($item->group_title); ?>
							</td>
							<td class="small hidden-phone">
								<?php echo $this->escape($item->access_level); ?>
							</td>
							<td class="small nowrap hidden-phone">
								<?php echo JLayoutHelper::render('joomla.content.language', $item); ?>
							</td>
							<td class="center hidden-phone">
								<span><?php echo (int) $item->id; ?></span>
							</td>
						</tr>
					<?php endforeach; ?>
				</tbody>
			</table>
			<?php //Load the batch processing form. ?>
			<?php if ($user->authorise('core.create', $component)
				&& $user->authorise('core.edit', $component)
				&& $user->authorise('core.edit.state', $component)) : ?>
				<?php echo JHtml::_(
						'bootstrap.renderModal',
						'collapseModal',
						array(
							'title' => JText::_('COM_FIELDS_VIEW_FIELDS_BATCH_OPTIONS'),
							'footer' => $this->loadTemplate('batch_footer')
						),
						$this->loadTemplate('batch_body')
					); ?>
			<?php endif; ?>
		<?php endif; ?>
		<input type="hidden" name="task" value="" />
		<input type="hidden" name="boxchecked" value="0" />
		<?php echo JHtml::_('form.token'); ?>
	</div>
</form>
modulesposition.php000060400000001711152456247540010524 0ustar00<?php
/**
 * @package     Joomla.Administrator
 * @subpackage  com_modules
 *
 * @copyright   (C) 2015 Open Source Matters, Inc. <https://www.joomla.org>
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */

defined('_JEXEC') or die;

JLoader::register('ModulesHelper', JPATH_ADMINISTRATOR . '/components/com_modules/helpers/modules.php');

JFormHelper::loadFieldClass('list');

/**
 * Modules Position field.
 *
 * @since  3.4.2
 */
class JFormFieldModulesPosition extends JFormFieldList
{
	/**
	 * The form field type.
	 *
	 * @var    string
	 * @since  3.4.2
	 */
	protected $type = 'ModulesPosition';

	/**
	 * Method to get the field options.
	 *
	 * @return  array  The field option objects.
	 *
	 * @since   3.4.2
	 */
	public function getOptions()
	{
		$options = ModulesHelper::getPositions(JFactory::getApplication()->getUserState('com_modules.modules.client_id', 0));

		return array_merge(parent::getOptions(), $options);
	}
}
modulesmodule.php000060400000001701152456247540010144 0ustar00<?php
/**
 * @package     Joomla.Administrator
 * @subpackage  com_modules
 *
 * @copyright   (C) 2015 Open Source Matters, Inc. <https://www.joomla.org>
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */

defined('_JEXEC') or die;

JLoader::register('ModulesHelper', JPATH_ADMINISTRATOR . '/components/com_modules/helpers/modules.php');

JFormHelper::loadFieldClass('list');

/**
 * Modules Module field.
 *
 * @since  3.4.2
 */
class JFormFieldModulesModule extends JFormFieldList
{
	/**
	 * The form field type.
	 *
	 * @var    string
	 * @since  3.4.2
	 */
	protected $type = 'ModulesModule';

	/**
	 * Method to get the field options.
	 *
	 * @return  array  The field option objects.
	 *
	 * @since   3.4.2
	 */
	public function getOptions()
	{
		$options = ModulesHelper::getModules(JFactory::getApplication()->getUserState('com_modules.modules.client_id', 0));

		return array_merge(parent::getOptions(), $options);
	}
}
view.html.php000060400000011676152456276270007221 0ustar00<?php
/**
 * @package     Joomla.Administrator
 * @subpackage  com_fields
 *
 * @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;

/**
 * Fields View
 *
 * @since  3.7.0
 */
class FieldsViewFields extends JViewLegacy
{
	/**
	 * @var  JForm
	 *
	 * @since  3.7.0
	 */
	public $filterForm;

	/**
	 * @var  array
	 *
	 * @since  3.7.0
	 */
	public $activeFilters;

	/**
	 * @var  array
	 *
	 * @since  3.7.0
	 */
	protected $items;

	/**
	 * @var  JPagination
	 *
	 * @since  3.7.0
	 */
	protected $pagination;

	/**
	 * @var  JObject
	 *
	 * @since  3.7.0
	 */
	protected $state;

	/**
	 * @var  string
	 *
	 * @since  3.7.0
	 */
	protected $sidebar;

	/**
	 * Execute and display a template script.
	 *
	 * @param   string  $tpl  The name of the template file to parse; automatically searches through the template paths.
	 *
	 * @return  mixed  A string if successful, otherwise an Error object.
	 *
	 * @see     JViewLegacy::loadTemplate()
	 * @since   3.7.0
	 */
	public function display($tpl = null)
	{
		$this->state         = $this->get('State');
		$this->items         = $this->get('Items');
		$this->pagination    = $this->get('Pagination');
		$this->filterForm    = $this->get('FilterForm');
		$this->activeFilters = $this->get('ActiveFilters');

		// Check for errors.
		if (count($errors = $this->get('Errors')))
		{
			throw new Exception(implode("\n", $errors), 500);
		}

		// Display a warning if the fields system plugin is disabled
		if (!JPluginHelper::isEnabled('system', 'fields'))
		{
			$link = JRoute::_('index.php?option=com_plugins&task=plugin.edit&extension_id=' . FieldsHelper::getFieldsPluginId());
			JFactory::getApplication()->enqueueMessage(JText::sprintf('COM_FIELDS_SYSTEM_PLUGIN_NOT_ENABLED', $link), 'warning');
		}

		// Only add toolbar when not in modal window.
		if ($this->getLayout() !== 'modal')
		{
			$this->addToolbar();
			FieldsHelper::addSubmenu($this->state->get('filter.context'), 'fields');
			$this->sidebar = JHtmlSidebar::render();
		}

		return parent::display($tpl);
	}

	/**
	 * Adds the toolbar.
	 *
	 * @return  void
	 *
	 * @since   3.7.0
	 */
	protected function addToolbar()
	{
		$fieldId   = $this->state->get('filter.field_id');
		$component = $this->state->get('filter.component');
		$section   = $this->state->get('filter.section');
		$canDo     = JHelperContent::getActions($component, 'field', $fieldId);

		// Get the toolbar object instance
		$bar = JToolBar::getInstance('toolbar');

		// Avoid nonsense situation.
		if ($component == 'com_fields')
		{
			return;
		}

		// Load extension language file
		$lang = JFactory::getLanguage();
		$lang->load($component, JPATH_ADMINISTRATOR)
		|| $lang->load($component, JPath::clean(JPATH_ADMINISTRATOR . '/components/' . $component));

		$title = JText::sprintf('COM_FIELDS_VIEW_FIELDS_TITLE', JText::_(strtoupper($component)));

		// Prepare the toolbar.
		JToolbarHelper::title($title, 'puzzle fields ' . substr($component, 4) . ($section ? "-$section" : '') . '-fields');

		if ($canDo->get('core.create'))
		{
			JToolbarHelper::addNew('field.add');
		}

		if ($canDo->get('core.edit') || $canDo->get('core.edit.own'))
		{
			JToolbarHelper::editList('field.edit');
		}

		if ($canDo->get('core.edit.state'))
		{
			JToolbarHelper::publish('fields.publish', 'JTOOLBAR_PUBLISH', true);
			JToolbarHelper::unpublish('fields.unpublish', 'JTOOLBAR_UNPUBLISH', true);
			JToolbarHelper::archiveList('fields.archive');
		}

		if (JFactory::getUser()->authorise('core.admin'))
		{
			JToolbarHelper::checkin('fields.checkin');
		}

		// Add a batch button
		if ($canDo->get('core.create') && $canDo->get('core.edit') && $canDo->get('core.edit.state'))
		{
			$title = JText::_('JTOOLBAR_BATCH');

			// Instantiate a new JLayoutFile instance and render the batch button
			$layout = new JLayoutFile('joomla.toolbar.batch');

			$dhtml = $layout->render(
				array(
					'title' => $title,
				)
			);

			$bar->appendButton('Custom', $dhtml, 'batch');
		}

		if ($canDo->get('core.admin') || $canDo->get('core.options'))
		{
			JToolbarHelper::preferences($component);
		}

		if ($this->state->get('filter.state') == -2 && $canDo->get('core.delete', $component))
		{
			JToolbarHelper::deleteList('', 'fields.delete', 'JTOOLBAR_EMPTY_TRASH');
		}
		elseif ($canDo->get('core.edit.state'))
		{
			JToolbarHelper::trash('fields.trash');
		}

		JToolbarHelper::help('JHELP_COMPONENTS_FIELDS_FIELDS');
	}

	/**
	 * Returns the sort fields.
	 *
	 * @return  array
	 *
	 * @since   3.7.0
	 */
	protected function getSortFields()
	{
		return array(
			'a.ordering' => JText::_('JGRID_HEADING_ORDERING'),
			'a.state'    => JText::_('JSTATUS'),
			'a.title'    => JText::_('JGLOBAL_TITLE'),
			'a.type'     => JText::_('COM_FIELDS_FIELD_TYPE_LABEL'),
			'a.access'   => JText::_('JGRID_HEADING_ACCESS'),
			'a.language' => JText::_('JGRID_HEADING_LANGUAGE'),
			'a.id'       => JText::_('JGRID_HEADING_ID'),
		);
	}
}
tmpl/default.php000060400000020764152456276270007702 0ustar00<?php
/**
 * @package     Joomla.Administrator
 * @subpackage  com_fields
 *
 * @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;

// Include the component HTML helpers.
JHtml::addIncludePath(JPATH_COMPONENT . '/helpers/html');

JHtml::_('bootstrap.tooltip');
JHtml::_('behavior.multiselect');
JHtml::_('formbehavior.chosen', 'select');

$app       = JFactory::getApplication();
$user      = JFactory::getUser();
$userId    = $user->get('id');
$context   = $this->escape($this->state->get('filter.context'));
$component = $this->state->get('filter.component');
$section   = $this->state->get('filter.section');
$listOrder = $this->escape($this->state->get('list.ordering'));
$listDirn  = $this->escape($this->state->get('list.direction'));
$ordering  = ($listOrder == 'a.ordering');
$saveOrder = ($listOrder == 'a.ordering' && strtolower($listDirn) == 'asc');

// The category object of the component
$category = JCategories::getInstance(str_replace('com_', '', $component) . '.' . $section);

// If there is no category for the component and section, so check the component only
if (!$category)
{
	$category = JCategories::getInstance(str_replace('com_', '', $component));
}

if ($saveOrder)
{
	$saveOrderingUrl = 'index.php?option=com_fields&task=fields.saveOrderAjax&tmpl=component';
	JHtml::_('sortablelist.sortable', 'fieldList', 'adminForm', strtolower($listDirn), $saveOrderingUrl, false, true);
}
?>

<form action="<?php echo JRoute::_('index.php?option=com_fields&view=fields'); ?>" method="post" name="adminForm" id="adminForm">
	<div id="j-sidebar-container" class="span2">
		<?php echo $this->sidebar; ?>
	</div>
	<div id="j-main-container" class="span10">
		<div id="filter-bar" class="js-stools-container-bar pull-left">
			<div class="btn-group pull-left">
				<?php echo $this->filterForm->getField('context')->input; ?>
			</div>&nbsp;
		</div>
		<?php echo JLayoutHelper::render('joomla.searchtools.default', array('view' => $this)); ?>
		<?php if (empty($this->items)) : ?>
			<div class="alert alert-no-items">
				<?php echo JText::_('JGLOBAL_NO_MATCHING_RESULTS'); ?>
			</div>
		<?php else : ?>
			<table class="table table-striped" id="fieldList">
				<thead>
					<tr>
						<th width="1%" class="nowrap center hidden-phone">
							<?php echo JHtml::_('searchtools.sort', '', 'a.ordering', $listDirn, $listOrder, null, 'asc', 'JGRID_HEADING_ORDERING', 'icon-menu-2'); ?>
						</th>
						<th width="1%" class="center">
							<?php echo JHtml::_('grid.checkall'); ?>
						</th>
						<th width="1%" class="nowrap center">
							<?php echo JHtml::_('searchtools.sort', 'JSTATUS', 'a.state', $listDirn, $listOrder); ?>
						</th>
						<th>
							<?php echo JHtml::_('searchtools.sort', 'JGLOBAL_TITLE', 'a.title', $listDirn, $listOrder); ?>
						</th>
						<th>
							<?php echo JHtml::_('searchtools.sort', 'COM_FIELDS_FIELD_TYPE_LABEL', 'a.type', $listDirn, $listOrder); ?>
						</th>
						<th>
							<?php echo JHtml::_('searchtools.sort', 'COM_FIELDS_FIELD_GROUP_LABEL', 'g.title', $listDirn, $listOrder); ?>
						</th>
						<th width="10%" class="nowrap hidden-phone">
							<?php echo JHtml::_('searchtools.sort', 'JGRID_HEADING_ACCESS', 'a.access', $listDirn, $listOrder); ?>
						</th>
						<th width="5%" class="nowrap hidden-phone">
							<?php echo JHtml::_('searchtools.sort', 'JGRID_HEADING_LANGUAGE', 'a.language', $listDirn, $listOrder); ?>
						</th>
						<th width="1%" class="nowrap hidden-phone">
							<?php echo JHtml::_('searchtools.sort', 'JGRID_HEADING_ID', 'a.id', $listDirn, $listOrder); ?>
						</th>
					</tr>
				</thead>
				<tfoot>
					<tr>
						<td colspan="9">
							<?php echo $this->pagination->getListFooter(); ?>
						</td>
					</tr>
				</tfoot>
				<tbody>
					<?php foreach ($this->items as $i => $item) : ?>
						<?php $ordering   = ($listOrder == 'a.ordering'); ?>
						<?php $canEdit    = $user->authorise('core.edit', $component . '.field.' . $item->id); ?>
						<?php $canCheckin = $user->authorise('core.admin', 'com_checkin') || $item->checked_out == $userId || $item->checked_out == 0; ?>
						<?php $canEditOwn = $user->authorise('core.edit.own', $component . '.field.' . $item->id) && $item->created_user_id == $userId; ?>
						<?php $canChange  = $user->authorise('core.edit.state', $component . '.field.' . $item->id) && $canCheckin; ?>
						<tr class="row<?php echo $i % 2; ?>" item-id="<?php echo $item->id ?>">
							<td class="order nowrap center hidden-phone">
								<?php $iconClass = ''; ?>
								<?php if (!$canChange) : ?>
									<?php $iconClass = ' inactive'; ?>
								<?php elseif (!$saveOrder) : ?>
									<?php $iconClass = ' inactive tip-top hasTooltip" title="' . JHtml::tooltipText('JORDERINGDISABLED'); ?>
								<?php endif; ?>
								<span class="sortable-handler<?php echo $iconClass; ?>">
									<span class="icon-menu" aria-hidden="true"></span>
								</span>
								<?php if ($canChange && $saveOrder) : ?>
									<input type="text" style="display:none" name="order[]" size="5" value="<?php echo $item->ordering; ?>" />
								<?php endif; ?>
							</td>
							<td class="center">
								<?php echo JHtml::_('grid.id', $i, $item->id); ?>
							</td>
							<td class="center">
								<div class="btn-group">
									<?php echo JHtml::_('jgrid.published', $item->state, $i, 'fields.', $canChange, 'cb'); ?>
									<?php // Create dropdown items and render the dropdown list. ?>
									<?php if ($canChange) : ?>
										<?php JHtml::_('actionsdropdown.' . ((int) $item->state === 2 ? 'un' : '') . 'archive', 'cb' . $i, 'fields'); ?>
										<?php JHtml::_('actionsdropdown.' . ((int) $item->state === -2 ? 'un' : '') . 'trash', 'cb' . $i, 'fields'); ?>
										<?php echo JHtml::_('actionsdropdown.render', $this->escape($item->title)); ?>
									<?php endif; ?>
								</div>
							</td>
							<td>
								<div class="pull-left break-word">
									<?php if ($item->checked_out) : ?>
										<?php echo JHtml::_('jgrid.checkedout', $i, $item->editor, $item->checked_out_time, 'fields.', $canCheckin); ?>
									<?php endif; ?>
									<?php if ($canEdit || $canEditOwn) : ?>
										<a href="<?php echo JRoute::_('index.php?option=com_fields&task=field.edit&id=' . $item->id . '&context=' . $context); ?>">
											<?php echo $this->escape($item->title); ?></a>
									<?php else : ?>
										<?php echo $this->escape($item->title); ?>
									<?php endif; ?>
									<span class="small break-word">
										<?php if (empty($item->note)) : ?>
											<?php echo JText::sprintf('JGLOBAL_LIST_NAME', $this->escape($item->name)); ?>
										<?php else : ?>
											<?php echo JText::sprintf('JGLOBAL_LIST_NAME_NOTE', $this->escape($item->name), $this->escape($item->note)); ?>
										<?php endif; ?>
									</span>
									<div class="small">
										<?php if ($category) : ?>
											<?php echo JText::_('JCATEGORY') . ': '; ?>
											<?php $categories = FieldsHelper::getAssignedCategoriesTitles($item->id); ?>
											<?php if ($categories) : ?>
												<?php echo implode(', ', $categories); ?>
											<?php else : ?>
												<?php echo JText::_('JALL'); ?>
											<?php endif; ?>
										<?php endif; ?>
									</div>
								</div>
							</td>
							<td class="small">
								<?php echo $this->escape($item->type); ?>
							</td>
							<td>
								<?php echo $this->escape($item->group_title); ?>
							</td>
							<td class="small hidden-phone">
								<?php echo $this->escape($item->access_level); ?>
							</td>
							<td class="small nowrap hidden-phone">
								<?php echo JLayoutHelper::render('joomla.content.language', $item); ?>
							</td>
							<td class="center hidden-phone">
								<span><?php echo (int) $item->id; ?></span>
							</td>
						</tr>
					<?php endforeach; ?>
				</tbody>
			</table>
			<?php //Load the batch processing form. ?>
			<?php if ($user->authorise('core.create', $component)
				&& $user->authorise('core.edit', $component)
				&& $user->authorise('core.edit.state', $component)) : ?>
				<?php echo JHtml::_(
						'bootstrap.renderModal',
						'collapseModal',
						array(
							'title' => JText::_('COM_FIELDS_VIEW_FIELDS_BATCH_OPTIONS'),
							'footer' => $this->loadTemplate('batch_footer')
						),
						$this->loadTemplate('batch_body')
					); ?>
			<?php endif; ?>
		<?php endif; ?>
		<input type="hidden" name="task" value="" />
		<input type="hidden" name="boxchecked" value="0" />
		<?php echo JHtml::_('form.token'); ?>
	</div>
</form>
tmpl/modal.php000060400000011173152456276270007344 0ustar00<?php
/**
 * @package     Joomla.Administrator
 * @subpackage  com_fields
 *
 * @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;

if (JFactory::getApplication()->isClient('site'))
{
	JSession::checkToken('get') or die(JText::_('JINVALID_TOKEN'));
}

JHtml::_('behavior.core');
JHtml::_('bootstrap.tooltip', '.hasTooltip', array('placement' => 'bottom'));
JHtml::_('bootstrap.popover', '.hasPopover', array('placement' => 'bottom'));
JHtml::_('formbehavior.chosen', 'select');
JHtml::_('script', 'com_fields/admin-fields-modal.js', array('version' => 'auto', 'relative' => true));

// Special case for the search field tooltip.
$searchFilterDesc = $this->filterForm->getFieldAttribute('search', 'description', null, 'filter');
JHtml::_('bootstrap.tooltip', '#filter_search', array('title' => JText::_($searchFilterDesc), 'placement' => 'bottom'));

$listOrder = $this->escape($this->state->get('list.ordering'));
$listDirn  = $this->escape($this->state->get('list.direction'));
$editor    = JFactory::getApplication()->input->get('editor', '', 'cmd');
?>
<div class="container-popup">

	<form action="<?php echo JRoute::_('index.php?option=com_fields&view=fields&layout=modal&tmpl=component&editor=' . $editor . '&' . JSession::getFormToken() . '=1'); ?>" method="post" name="adminForm" id="adminForm">

		<?php echo JLayoutHelper::render('joomla.searchtools.default', array('view' => $this)); ?>
		<?php if (empty($this->items)) : ?>
			<div class="alert alert-no-items">
				<?php echo JText::_('JGLOBAL_NO_MATCHING_RESULTS'); ?>
			</div>
		<?php else : ?>
			<table class="table table-striped" id="moduleList">
				<thead>
					<tr>
						<th width="1%" class="nowrap center">
							<?php echo JHtml::_('searchtools.sort', 'JSTATUS', 'a.state', $listDirn, $listOrder); ?>
						</th>
						<th class="title">
							<?php echo JHtml::_('searchtools.sort', 'JGLOBAL_TITLE', 'a.title', $listDirn, $listOrder); ?>
						</th>
						<th width="15%" class="nowrap hidden-phone">
							<?php echo JHtml::_('searchtools.sort', 'COM_FIELDS_FIELD_GROUP_LABEL', 'g.title', $listDirn, $listOrder); ?>
						</th>
						<th width="10%" class="nowrap hidden-phone">
							<?php echo JHtml::_('searchtools.sort', 'COM_FIELDS_FIELD_TYPE_LABEL', 'a.type', $listDirn, $listOrder); ?>
						</th>
						<th width="10%" class="nowrap hidden-phone">
							<?php echo JHtml::_('searchtools.sort', 'JGRID_HEADING_ACCESS', 'a.access', $listDirn, $listOrder); ?>
						</th>
						<th width="10%" class="nowrap hidden-phone">
							<?php echo JHtml::_('searchtools.sort', 'JGRID_HEADING_LANGUAGE', 'a.language', $listDirn, $listOrder); ?>
						</th>
						<th width="1%" class="nowrap hidden-phone">
							<?php echo JHtml::_('searchtools.sort', 'JGRID_HEADING_ID', 'a.id', $listDirn, $listOrder); ?>
						</th>
					</tr>
				</thead>
				<tfoot>
					<tr>
						<td colspan="8">
							<?php echo $this->pagination->getListFooter(); ?>
						</td>
					</tr>
				</tfoot>
				<tbody>
					<?php
					$iconStates = array(
						-2 => 'icon-trash',
						0  => 'icon-unpublish',
						1  => 'icon-publish',
						2  => 'icon-archive',
					);
					foreach ($this->items as $i => $item) :
					?>
					<tr class="row<?php echo $i % 2; ?>">
						<td class="center">
							<span class="<?php echo $iconStates[$this->escape($item->state)]; ?>" aria-hidden="true"></span>
						</td>
						<td class="has-context">
							<a class="btn btn-small btn-block btn-success" href="#" onclick="Joomla.fieldIns('<?php echo $this->escape($item->id); ?>', '<?php echo $this->escape($editor); ?>');"><?php echo $this->escape($item->title); ?></a>
						</td>
						<td class="small hidden-phone">
							<a class="btn btn-small btn-block btn-warning" href="#" onclick="Joomla.fieldgroupIns('<?php echo $this->escape($item->group_id); ?>', '<?php echo $this->escape($editor); ?>');"><?php echo $item->group_id ? $this->escape($item->group_title) : JText::_('JNONE'); ?></a>
						</td>
						<td class="small hidden-phone">
							<?php echo $item->type; ?>
						</td>
						<td class="small hidden-phone">
							<?php echo $this->escape($item->access_level); ?>
						</td>
						<td class="small hidden-phone">
							<?php echo JLayoutHelper::render('joomla.content.language', $item); ?>
						</td>
						<td class="hidden-phone">
							<?php echo (int) $item->id; ?>
						</td>
					</tr>
				<?php endforeach; ?>
				</tbody>
			</table>
		<?php endif; ?>

		<input type="hidden" name="task" value="" />
		<input type="hidden" name="boxchecked" value="0" />
		<?php echo JHtml::_('form.token'); ?>

	</form>
</div>
tmpl/default_batch_body.php000060400000004433152456276270012053 0ustar00<?php
/**
 * @package     Joomla.Administrator
 * @subpackage  com_fields
 *
 * @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;

JHtml::_('formbehavior.chosen', 'select');
JFactory::getDocument()->addScriptDeclaration(
	'
		jQuery(document).ready(function($){
			if ($("#batch-group-id").length){var batchSelector = $("#batch-group-id");}
			if ($("#batch-copy-move").length) {
				$("#batch-copy-move").hide();
				batchSelector.on("change", function(){
					if (batchSelector.val() != 0 || batchSelector.val() != "") {
						$("#batch-copy-move").show();
					} else {
						$("#batch-copy-move").hide();
					}
				});
			}
		});
			'
);

$context   = $this->escape($this->state->get('filter.context'));
?>

<div class="container-fluid">
	<div class="row-fluid">
		<div class="control-group span6">
			<div class="controls">
				<?php echo JLayoutHelper::render('joomla.html.batch.language', array()); ?>
			</div>
		</div>
		<div class="control-group span6">
			<div class="controls">
				<?php echo JLayoutHelper::render('joomla.html.batch.access', array()); ?>
			</div>
		</div>
	</div>
	<div class="row-fluid">
		<div class="control-group span6">
			<div class="controls">
				<?php $options = array(
					JHtml::_('select.option', 'c', JText::_('JLIB_HTML_BATCH_COPY')),
					JHtml::_('select.option', 'm', JText::_('JLIB_HTML_BATCH_MOVE'))
				);
				?>
				<label id="batch-choose-action-lbl" for="batch-choose-action"><?php echo JText::_('COM_FIELDS_BATCH_GROUP_LABEL'); ?></label>
				<div id="batch-choose-action" class="control-group">
					<select name="batch[group_id]" class="inputbox" id="batch-group-id">
						<option value=""><?php echo JText::_('JLIB_HTML_BATCH_NO_CATEGORY'); ?></option>
						<option value="nogroup"><?php echo JText::_('COM_FIELDS_BATCH_GROUP_OPTION_NONE'); ?></option>
						<?php echo JHtml::_('select.options', $this->get('Groups'), 'value', 'text'); ?>
					</select>
				</div>
				<div id="batch-copy-move" class="control-group radio">
					<?php echo JText::_('JLIB_HTML_BATCH_MOVE_QUESTION'); ?>
					<?php echo JHtml::_('select.radiolist', $options, 'batch[move_copy]', '', 'value', 'text', 'm'); ?>
				</div>
			</div>
		</div>
	</div>
</div>
tmpl/default_batch_footer.php000060400000001272152456276270012412 0ustar00<?php
/**
 * @package     Joomla.Administrator
 * @subpackage  com_fields
 *
 * @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;

?>
<button type="button" class="btn" onclick="document.getElementById('batch-field-id').value='';document.getElementById('batch-access').value='';document.getElementById('batch-language-id').value=''" data-dismiss="modal">
	<?php echo JText::_('JCANCEL'); ?>
</button>
<button type="submit" class="btn btn-success" onclick="Joomla.submitbutton('field.batch');return false;">
	<?php echo JText::_('JGLOBAL_BATCH_PROCESS'); ?>
</button>
location.php000060400000001557152456303670007104 0ustar00<?php
/**
 * @package     Joomla.Administrator
 * @subpackage  com_installer
 *
 * @copyright   (C) 2015 Open Source Matters, Inc. <https://www.joomla.org>
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */

defined('_JEXEC') or die;

JLoader::register('InstallerHelper', JPATH_ADMINISTRATOR . '/components/com_installer/helpers/installer.php');

JFormHelper::loadFieldClass('list');

/**
 * Location field.
 *
 * @since  3.5
 */
class JFormFieldLocation extends JFormFieldList
{
	/**
	 * The form field type.
	 *
	 * @var	   string
	 * @since  3.5
	 */
	protected $type = 'Location';

	/**
	 * Method to get the field options.
	 *
	 * @return  array  The field option objects.
	 *
	 * @since   3.5
	 */
	public function getOptions()
	{
		$options = InstallerHelper::getClientOptions();

		return array_merge(parent::getOptions(), $options);
	}
}
folder.php000060400000001554152456303670006544 0ustar00<?php
/**
 * @package     Joomla.Administrator
 * @subpackage  com_installer
 *
 * @copyright   (C) 2015 Open Source Matters, Inc. <https://www.joomla.org>
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */

defined('_JEXEC') or die;

JLoader::register('InstallerHelper', JPATH_ADMINISTRATOR . '/components/com_installer/helpers/installer.php');

JFormHelper::loadFieldClass('list');

/**
 * Folder field.
 *
 * @since  3.5
 */
class JFormFieldFolder extends JFormFieldList
{
	/**
	 * The form field type.
	 *
	 * @var    string
	 * @since  3.5
	 */
	protected $type = 'Folder';

	/**
	 * Method to get the field options.
	 *
	 * @return  array  The field option objects.
	 *
	 * @since   3.5
	 */
	public function getOptions()
	{
		$options = InstallerHelper::getExtensionGroupes();

		return array_merge(parent::getOptions(), $options);
	}
}
extensionstatus.php000060400000001604152456303670010545 0ustar00<?php
/**
 * @package     Joomla.Administrator
 * @subpackage  com_installer
 *
 * @copyright   (C) 2015 Open Source Matters, Inc. <https://www.joomla.org>
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */

defined('_JEXEC') or die;

JLoader::register('InstallerHelper', JPATH_ADMINISTRATOR . '/components/com_installer/helpers/installer.php');

JFormHelper::loadFieldClass('list');

/**
 * Extension Status field.
 *
 * @since  3.5
 */
class JFormFieldExtensionStatus extends JFormFieldList
{
	/**
	 * The form field type.
	 *
	 * @var    string
	 * @since  3.5
	 */
	protected $type = 'ExtensionStatus';

	/**
	 * Method to get the field options.
	 *
	 * @return  array  The field option objects.
	 *
	 * @since   3.5
	 */
	public function getOptions()
	{
		$options = InstallerHelper::getStateOptions();

		return array_merge(parent::getOptions(), $options);
	}
}
type.php000060400000004163152456303670006251 0ustar00<?php
/**
 * @package     Joomla.Administrator
 * @subpackage  com_fields
 *
 * @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;

JFormHelper::loadFieldClass('list');

/**
 * Fields Type
 *
 * @since  3.7.0
 */
class JFormFieldType extends JFormFieldList
{
	public $type = 'Type';

	/**
	 * Method to attach a JForm object to the field.
	 *
	 * @param   SimpleXMLElement  $element  The SimpleXMLElement object representing the `<field>` tag for the form field object.
	 * @param   mixed             $value    The form field value to validate.
	 * @param   string            $group    The field name group control value. This acts as an array container for the field.
	 *                                      For example if the field has name="foo" and the group value is set to "bar" then the
	 *                                      full field name would end up being "bar[foo]".
	 *
	 * @return  boolean  True on success.
	 *
	 * @since   3.7.0
	 */
	public function setup(SimpleXMLElement $element, $value, $group = null)
	{
		$return = parent::setup($element, $value, $group);

		$this->onchange = 'typeHasChanged(this);';

		return $return;
	}

	/**
	 * Method to get the field options.
	 *
	 * @return  array  The field option objects.
	 *
	 * @since   3.7.0
	 */
	protected function getOptions()
	{
		$options = parent::getOptions();

		$fieldTypes = FieldsHelper::getFieldTypes();

		foreach ($fieldTypes as $fieldType)
		{
			$options[] = JHtml::_('select.option', $fieldType['type'], $fieldType['label']);
		}

		// Sorting the fields based on the text which is displayed
		usort(
			$options,
			function ($a, $b)
			{
				return strcmp($a->text, $b->text);
			}
		);

		JFactory::getDocument()->addScriptDeclaration("
			jQuery( document ).ready(function() {
				Joomla.loadingLayer('load');
			});
			function typeHasChanged(element){
				Joomla.loadingLayer('show');
				var cat = jQuery(element);
				jQuery('input[name=task]').val('field.reload');
				element.form.submit();
			}
		"
		);

		return $options;
	}
}
modal/newsfeed.php000060400000023453152456323360010165 0ustar00<?php
/**
 * @package     Joomla.Administrator
 * @subpackage  com_newsfeeds
 *
 * @copyright   (C) 2013 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\Language\LanguageHelper;

/**
 * Supports a modal newsfeeds picker.
 *
 * @since  1.6
 */
class JFormFieldModal_Newsfeed extends JFormField
{
	/**
	 * The form field type.
	 *
	 * @var     string
	 * @since   1.6
	 */
	protected $type = 'Modal_Newsfeed';

	/**
	 * Method to get the field input markup.
	 *
	 * @return  string  The field input markup.
	 *
	 * @since   1.6
	 */
	protected function getInput()
	{
		$allowNew       = ((string) $this->element['new'] == 'true');
		$allowEdit      = ((string) $this->element['edit'] == 'true');
		$allowClear     = ((string) $this->element['clear'] != 'false');
		$allowSelect    = ((string) $this->element['select'] != 'false');
		$allowPropagate = ((string) $this->element['propagate'] == 'true');

		$languages = LanguageHelper::getContentLanguages(array(0, 1));

		// Load language
		JFactory::getLanguage()->load('com_newsfeeds', JPATH_ADMINISTRATOR);

		// The active newsfeed id field.
		$value = (int) $this->value > 0 ? (int) $this->value : '';

		// Create the modal id.
		$modalId = 'Newsfeed_' . $this->id;

		// Add the modal field script to the document head.
		JHtml::_('jquery.framework');
		JHtml::_('script', 'system/modal-fields.js', array('version' => 'auto', 'relative' => true));

		// Script to proxy the select modal function to the modal-fields.js file.
		if ($allowSelect)
		{
			static $scriptSelect = null;

			if (is_null($scriptSelect))
			{
				$scriptSelect = array();
			}

			if (!isset($scriptSelect[$this->id]))
			{
				JFactory::getDocument()->addScriptDeclaration("
				function jSelectNewsfeed_" . $this->id . "(id, title, object) {
					window.processModalSelect('Newsfeed', '" . $this->id . "', id, title, '', object);
				}
				"
				);

				JText::script('JGLOBAL_ASSOCIATIONS_PROPAGATE_FAILED');

				$scriptSelect[$this->id] = true;
			}
		}

		// Setup variables for display.
		$linkNewsfeeds = 'index.php?option=com_newsfeeds&amp;view=newsfeeds&amp;layout=modal&amp;tmpl=component&amp;' . JSession::getFormToken() . '=1';
		$linkNewsfeed  = 'index.php?option=com_newsfeeds&amp;view=newsfeed&amp;layout=modal&amp;tmpl=component&amp;' . JSession::getFormToken() . '=1';
		$modalTitle    = JText::_('COM_NEWSFEEDS_CHANGE_FEED');

		if (isset($this->element['language']))
		{
			$linkNewsfeeds .= '&amp;forcedLanguage=' . $this->element['language'];
			$linkNewsfeed  .= '&amp;forcedLanguage=' . $this->element['language'];
			$modalTitle    .= ' &#8212; ' . $this->element['label'];
		}

		$urlSelect = $linkNewsfeeds . '&amp;function=jSelectNewsfeed_' . $this->id;
		$urlEdit   = $linkNewsfeed . '&amp;task=newsfeed.edit&amp;id=\' + document.getElementById("' . $this->id . '_id").value + \'';
		$urlNew    = $linkNewsfeed . '&amp;task=newsfeed.add';

		if ($value)
		{
			$db    = JFactory::getDbo();
			$query = $db->getQuery(true)
				->select($db->quoteName('name'))
				->from($db->quoteName('#__newsfeeds'))
				->where($db->quoteName('id') . ' = ' . (int) $value);
			$db->setQuery($query);

			try
			{
				$title = $db->loadResult();
			}
			catch (RuntimeException $e)
			{
				JError::raiseWarning(500, $e->getMessage());
			}
		}

		$title = empty($title) ? JText::_('COM_NEWSFEEDS_SELECT_A_FEED') : htmlspecialchars($title, ENT_QUOTES, 'UTF-8');

		// The current newsfeed display field.
		$html  = '<span class="input-append">';
		$html .= '<input class="input-medium" id="' . $this->id . '_name" type="text" value="' . $title . '" disabled="disabled" size="35" />';

		// Select newsfeed button
		if ($allowSelect)
		{
			$html .= '<button'
				. ' type="button"'
				. ' class="btn hasTooltip' . ($value ? ' hidden' : '') . '"'
				. ' id="' . $this->id . '_select"'
				. ' data-toggle="modal"'
				. ' data-target="#ModalSelect' . $modalId . '"'
				. ' title="' . JHtml::tooltipText('COM_NEWSFEEDS_CHANGE_FEED') . '">'
				. '<span class="icon-file" aria-hidden="true"></span> ' . JText::_('JSELECT')
				. '</button>';
		}

		// New newsfeed button
		if ($allowNew)
		{
			$html .= '<button'
				. ' type="button"'
				. ' class="btn hasTooltip' . ($value ? ' hidden' : '') . '"'
				. ' id="' . $this->id . '_new"'
				. ' data-toggle="modal"'
				. ' data-target="#ModalNew' . $modalId . '"'
				. ' title="' . JHtml::tooltipText('COM_NEWSFEEDS_NEW_NEWSFEED') . '">'
				. '<span class="icon-new" aria-hidden="true"></span> ' . JText::_('JACTION_CREATE')
				. '</button>';
		}

		// Edit newsfeed button
		if ($allowEdit)
		{
			$html .= '<button'
				. ' type="button"'
				. ' class="btn hasTooltip' . ($value ? '' : ' hidden') . '"'
				. ' id="' . $this->id . '_edit"'
				. ' data-toggle="modal"'
				. ' data-target="#ModalEdit' . $modalId . '"'
				. ' title="' . JHtml::tooltipText('COM_NEWSFEEDS_EDIT_NEWSFEED') . '">'
				. '<span class="icon-edit" aria-hidden="true"></span> ' . JText::_('JACTION_EDIT')
				. '</button>';
		}

		// Clear newsfeed button
		if ($allowClear)
		{
			$html .= '<button'
				. ' type="button"'
				. ' class="btn' . ($value ? '' : ' hidden') . '"'
				. ' id="' . $this->id . '_clear"'
				. ' onclick="window.processModalParent(\'' . $this->id . '\'); return false;">'
				. '<span class="icon-remove" aria-hidden="true"></span>' . JText::_('JCLEAR')
				. '</button>';
		}

		// Propagate newsfeed button
		if ($allowPropagate && count($languages) > 2)
		{
			// Strip off language tag at the end
			$tagLength = (int) strlen($this->element['language']);
			$callbackFunctionStem = substr("jSelectNewsfeed_" . $this->id, 0, -$tagLength);

			$html .= '<a'
			. ' class="btn hasTooltip' . ($value ? '' : ' hidden') . '"'
			. ' id="' . $this->id . '_propagate"'
			. ' href="#"'
			. ' title="' . JHtml::tooltipText('JGLOBAL_ASSOCIATIONS_PROPAGATE_TIP') . '"'
			. ' onclick="Joomla.propagateAssociation(\'' . $this->id . '\', \'' . $callbackFunctionStem . '\');">'
			. '<span class="icon-refresh" aria-hidden="true"></span>' . JText::_('JGLOBAL_ASSOCIATIONS_PROPAGATE_BUTTON')
			. '</a>';
		}

		$html .= '</span>';

		// Select newsfeed modal
		if ($allowSelect)
		{
			$html .= JHtml::_(
				'bootstrap.renderModal',
				'ModalSelect' . $modalId,
				array(
					'title'       => $modalTitle,
					'url'         => $urlSelect,
					'height'      => '400px',
					'width'       => '800px',
					'bodyHeight'  => '70',
					'modalWidth'  => '80',
					'footer'      => '<button type="button" class="btn" data-dismiss="modal">' . JText::_('JLIB_HTML_BEHAVIOR_CLOSE') . '</button>',
				)
			);
		}

		// New newsfeed modal
		if ($allowNew)
		{
			$html .= JHtml::_(
				'bootstrap.renderModal',
				'ModalNew' . $modalId,
				array(
					'title'       => JText::_('COM_NEWSFEEDS_NEW_NEWSFEED'),
					'backdrop'    => 'static',
					'keyboard'    => false,
					'closeButton' => false,
					'url'         => $urlNew,
					'height'      => '400px',
					'width'       => '800px',
					'bodyHeight'  => '70',
					'modalWidth'  => '80',
					'footer'      => '<button type="button" class="btn"'
							. ' onclick="window.processModalEdit(this, \''
							. $this->id . '\', \'add\', \'newsfeed\', \'cancel\', \'newsfeed-form\', \'jform_id\', \'jform_name\'); return false;">'
							. JText::_('JLIB_HTML_BEHAVIOR_CLOSE') . '</button>'
							. '<button type="button" class="btn btn-primary"'
							. ' onclick="window.processModalEdit(this, \''
							. $this->id . '\', \'add\', \'newsfeed\', \'save\', \'newsfeed-form\', \'jform_id\', \'jform_name\'); return false;">'
							. JText::_('JSAVE') . '</button>'
							. '<button type="button" class="btn btn-success"'
							. ' onclick="window.processModalEdit(this, \''
							. $this->id . '\', \'add\', \'newsfeed\', \'apply\', \'newsfeed-form\', \'jform_id\', \'jform_name\'); return false;">'
							. JText::_('JAPPLY') . '</button>',
				)
			);
		}

		// Edit newsfeed modal.
		if ($allowEdit)
		{
			$html .= JHtml::_(
				'bootstrap.renderModal',
				'ModalEdit' . $modalId,
				array(
					'title'       => JText::_('COM_NEWSFEEDS_EDIT_NEWSFEED'),
					'backdrop'    => 'static',
					'keyboard'    => false,
					'closeButton' => false,
					'url'         => $urlEdit,
					'height'      => '400px',
					'width'       => '800px',
					'bodyHeight'  => '70',
					'modalWidth'  => '80',
					'footer'      => '<button type="button" class="btn"'
							. ' onclick="window.processModalEdit(this, \'' . $this->id
							. '\', \'edit\', \'newsfeed\', \'cancel\', \'newsfeed-form\', \'jform_id\', \'jform_name\'); return false;">'
							. JText::_('JLIB_HTML_BEHAVIOR_CLOSE') . '</button>'
							. '<button type="button" class="btn btn-primary"'
							. ' onclick="window.processModalEdit(this, \''
							. $this->id . '\', \'edit\', \'newsfeed\', \'save\', \'newsfeed-form\', \'jform_id\', \'jform_name\'); return false;">'
							. JText::_('JSAVE') . '</button>'
							. '<button type="button" class="btn btn-success"'
							. ' onclick="window.processModalEdit(this, \''
							. $this->id . '\', \'edit\', \'newsfeed\', \'apply\', \'newsfeed-form\', \'jform_id\', \'jform_name\'); return false;">'
							. JText::_('JAPPLY') . '</button>',
				)
			);
		}

		// Add class='required' for client side validation
		$class = $this->required ? ' class="required modal-value"' : '';

		$html .= '<input type="hidden" id="' . $this->id . '_id"' . $class . ' data-required="' . (int) $this->required . '" name="' . $this->name
			. '" data-text="' . htmlspecialchars(JText::_('COM_NEWSFEEDS_SELECT_A_FEED', true), ENT_COMPAT, 'UTF-8') . '" value="' . $value . '" />';

		return $html;
	}

	/**
	 * Method to get the field label markup.
	 *
	 * @return  string  The field label markup.
	 *
	 * @since   3.4
	 */
	protected function getLabel()
	{
		return str_replace($this->id, $this->id . '_id', parent::getLabel());
	}
}
newsfeeds.php000060400000002226152456323360007247 0ustar00<?php
/**
 * @package     Joomla.Administrator
 * @subpackage  com_newsfeeds
 *
 * @copyright   (C) 2009 Open Source Matters, Inc. <https://www.joomla.org>
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */

defined('_JEXEC') or die;

JFormHelper::loadFieldClass('list');

/**
 * News Feed List field.
 *
 * @since  1.6
 */
class JFormFieldNewsfeeds extends JFormFieldList
{
	/**
	 * The form field type.
	 *
	 * @var		string
	 * @since   1.6
	 */
	protected $type = 'Newsfeeds';

	/**
	 * Method to get the field options.
	 *
	 * @return  array  The field option objects.
	 *
	 * @since   1.6
	 */
	protected function getOptions()
	{
		$options = array();

		$db    = JFactory::getDbo();
		$query = $db->getQuery(true)
			->select('id As value, name As text')
			->from('#__newsfeeds AS a')
			->order('a.name');

		// Get the options.
		$db->setQuery($query);

		try
		{
			$options = $db->loadObjectList();
		}
		catch (RuntimeException $e)
		{
			JError::raiseWarning(500, $db->getMessage());
		}

		// Merge any additional options in the XML definition.
		$options = array_merge(parent::getOptions(), $options);

		return $options;
	}
}
index.html000060400000000032152456531770006547 0ustar00<html><body></body></html>iclist/index.html000060400000000032152456531770010036 0ustar00<html><body></body></html>iclist/globalization.php000060400000021467152456531770011427 0ustar00<?php
/**
 *------------------------------------------------------------------------------
 *  iCagenda v3 by Jooml!C - Events Management Extension for Joomla! 2.5 / 3.x
 *------------------------------------------------------------------------------
 * @package     com_icagenda
 * @copyright   Copyright (c)2012-2015 Cyril Rezé, Jooml!C - All rights reserved
 *
 * @license     GNU General Public License version 3 or later; see LICENSE.txt
 * @author      Cyril Rezé (Lyr!C)
 * @link        http://www.joomlic.com
 *
 * @version     3.5.7 2015-07-12
 * @since       2.1.7
 *------------------------------------------------------------------------------
*/

// No direct access to this file
defined('_JEXEC') or die();

jimport( 'joomla.filesystem.path' );
jimport('joomla.form.formfield');

class JFormFieldiClist_globalization extends JFormField
{
	protected $type='iclist_globalization';

	protected function getInput()
	{
		$lang		= JFactory::getLanguage();
		$langTag	= $lang->getTag();
		$langName	= $lang->getName();

		if ( ! file_exists(JPATH_LIBRARIES . '/ic_library/globalize/culture/' . $langTag . '.php'))
		{
			$langTag = 'en-GB';
			$currentText = JTEXT::_('COM_ICAGENDA_DATE_FORMAT_DEFAULT') . ' [' . $langTag . '] :';

		}
		else
		{
			$currentText = JTEXT::_('COM_ICAGENDA_DATE_FORMAT_CURRENT') . ' [' . $langTag . '] :';
		}

		$globalize		= JPATH_LIBRARIES . '/ic_library/globalize/culture/' . $langTag . '.php';
		$iso			= JPATH_LIBRARIES . '/ic_library/globalize/culture/iso.php';

		require_once $globalize;
		require_once $iso;

		$class		= isset($class) ? ' class="' . $class . '"' : '';
		$selected	= ' selected="selected" style="background:#D4D4D4;"';

		// Start Select List of Date Formats
		$html = '<select id="' . $this->id . '_id"' . $class . ' name="' . $this->name . '" style="width:250px;" >';

		if ($this->name != 'jform[format]' && $this->name != 'format')
		{
			$html.= '<option value="" style="text-align:center;">- ' . JTEXT::_('COM_ICAGENDA_SELECT_FORMAT') . ' -</option>';
		}

		// Date Formats in Current Language of User (admin)
		if (version_compare(JVERSION, '3.0', 'lt'))
		{
			$html.= '<optgroup label="&nbsp;"></optgroup>';
			$html.= '<optgroup label="' . $currentText . '" style="font-style:normal; color:#333333;"></optgroup>';
		}
		else
		{
			$html.= '<optgroup label="' . $currentText . '">';
		}

		$dateglobalize_array[] = array();
		$dateglobalize_array[] = $dateglobalize_1;
		$dateglobalize_array[] = $dateglobalize_2;
		$dateglobalize_array[] = $dateglobalize_3;
		$dateglobalize_array[] = $dateglobalize_4;
		$dateglobalize_array[] = isset($dateglobalize_5) ? $dateglobalize_5 : ''; // en-GB, en-US
		$dateglobalize_array[] = $dateglobalize_6;
		$dateglobalize_array[] = $dateglobalize_7;
		$dateglobalize_array[] = $dateglobalize_8;
		$dateglobalize_array[] = isset($dateglobalize_9) ? $dateglobalize_9 : ''; // en-GB
		$dateglobalize_array[] = isset($dateglobalize_10) ? $dateglobalize_10 : ''; // en-GB
		$dateglobalize_array[] = $dateglobalize_11;
		$dateglobalize_array[] = $dateglobalize_12;

		foreach ($dateglobalize_array as $format => $label)
		{
			if (isset($label) && $label)
			{
				$html.= '<option value="' . $format . '"';
				$html.= ($this->value == $format) ? $selected : '';
				$html.= '>' . $label . '</option>';
			}
		}

		if (version_compare(JVERSION, '3.0', 'ge'))
		{
			$html.= '</optgroup>';
		}


		// Other date format in English (if 'en-GB' is current language)
		if ($langTag == 'en-GB')
		{
			// Extra en-US
			if (version_compare(JVERSION, '3.0', 'lt'))
			{
				$html.= '<optgroup label="&nbsp;"></optgroup>';
				$html.= '<optgroup label="Other date format in English" style="font-style:normal; color:#333333;"></optgroup>';
				$html.= '<optgroup label="en-US (more formats if current language) :" style="font-weight:normal; color:#777777;"></optgroup>';
			}
			else
			{
				$html.= '<optgroup label="en-US (more formats if current language) :">';
			}

			$extra_array = array(
					$extravalue_1 => $extra_1,
					$extravalue_2 => $extra_2,
					$extravalue_3 => $extra_3,
					$extravalue_4 => $extra_4,
					$extravalue_5 => $extra_5,
				);

			foreach ($extra_array as $format => $label)
			{
				$html.= '<option value="' . $format . '"';
				$html.= ($this->value == $format) ? $selected : '';
				$html.= '>' . $label . '</option>';
			}

			if (version_compare(JVERSION, '3.0', 'ge'))
			{
				$html.= '</optgroup>';
			}

			// Extra en-CA
			if (version_compare(JVERSION, '3.0', 'lt'))
			{
				$html.= '<optgroup label="en-CA :" style="font-weight:normal; color:#777777;"></optgroup>';
			}
			else
			{
				$html.= '<optgroup label="en-CA :">';
			}

			$html.= '<option value="' . $extravalue_6 . '"';
			$html.= ($this->value == $extravalue_6) ? $selected : '';
			$html.= '>' . $extra_6 . '</option>';

			if (version_compare(JVERSION, '3.0', 'ge'))
			{
				$html.= '</optgroup>';
			}

			// Extra en-SG
			if (version_compare(JVERSION, '3.0', 'lt'))
			{
				$html.= '<optgroup label="en-SG :" style="font-weight:normal; color:#777777;"></optgroup>';
			}
			else
			{
				$html.= '<optgroup label="en-SG :">';
			}

			$html.= '<option value="' . $extravalue_7 . '"';
			$html.= ($this->value == $extravalue_7) ? $selected : '';
			$html.= '>' . $extra_7 . '</option>';

			if (version_compare(JVERSION, '3.0', 'ge'))
			{
				$html.= '</optgroup>';
			}
		}


		// International Date Format (ISO)
		if (version_compare(JVERSION, '3.0', 'lt'))
		{
			$html.= '<optgroup label="&nbsp;"></optgroup>';
			$html.= '<optgroup label="' . JTEXT::_('COM_ICAGENDA_DATE_FORMAT_ISO') . '" style="font-style:normal; color:#333333;"></optgroup>';
		}
		else
		{
			$html.= '<optgroup label="' . JTEXT::_('COM_ICAGENDA_DATE_FORMAT_ISO') . '">';
		}

		$html.= '<option value="' . $iso . '"';
		$html.= ($this->value == $iso) ? $selected : '';
		$html.= '>1993-04-30</option>';

		if (version_compare(JVERSION, '3.0', 'ge'))
		{
			$html.= '</optgroup>';
		}


		// Global date formats with separator
		if (version_compare(JVERSION, '3.0', 'lt'))
		{
			$html.= '<optgroup label="&nbsp;"></optgroup>';
			$html.= '<optgroup label="' . JTEXT::_('COM_ICAGENDA_DATE_FORMAT_SEPARATOR') . '" style="font-style:normal; color:#333333;"></optgroup>';
		}


		// DMY Little-endian (day, month, year), e.g. 22.04.96 or 22/04/96
		if (version_compare(JVERSION, '3.0', 'lt'))
		{
			$html.= '<optgroup label="' . JTEXT::_('COM_ICAGENDA_DATE_FORMAT_DMY') . ' :" style="font-weight:normal; color:#777777;"></optgroup>';
		}
		else
		{
			$html.= '<optgroup label="' . JTEXT::_('COM_ICAGENDA_DATE_FORMAT_DMY') . '">';
		}

		$dmy_array = array(
				$dmy_1 => '30␣04␣1993',
				$dmy_2 => '30␣04␣93',
				$dmy_3 => '30␣04',
				$dmy_4 => '04␣93',
				$dmy_5 => isset($dmy_text_5) ? $dmy_text_5 : '',
				$dmy_6 => isset($dmy_text_6) ? $dmy_text_6 : ''
			);

		foreach ($dmy_array as $format => $label)
		{
			if ($label)
			{
				$html.= '<option value="' . $format . '"';
				$html.= ($this->value == $format) ? $selected : '';
				$html.= '>' . $label . '</option>';
			}
		}

		if (version_compare(JVERSION, '3.0', 'ge'))
		{
			$html.= '</optgroup>';
		}


		// MDY Middle-endian (month, day, year), e.g. 04/22/96
		if (version_compare(JVERSION, '3.0', 'lt'))
		{
			$html.= '<optgroup label="' . JTEXT::_('COM_ICAGENDA_DATE_FORMAT_MDY') . ' :" style="font-weight:normal; color:#777777;"></optgroup>';
		}
		else
		{
			$html.= '<optgroup label="' . JTEXT::_('COM_ICAGENDA_DATE_FORMAT_MDY') . '">';
		}

		$mdy_array = array(
				$mdy_1 => '04␣30␣1993',
				$mdy_2 => '04␣30␣93',
				$mdy_3 => '04␣30',
				$mdy_4 => '04␣93',
				$mdy_5 => isset($mdy_text_5) ? $mdy_text_5 : '',
				$mdy_6 => isset($mdy_text_6) ? $mdy_text_6 : ''
			);

		foreach ($mdy_array as $format => $label)
		{
			if ($label)
			{
				$html.= '<option value="' . $format . '"';
				$html.= ($this->value == $format) ? $selected : '';
				$html.= '>' . $label . '</option>';
			}
		}

		if (version_compare(JVERSION, '3.0', 'ge'))
		{
			$html.= '</optgroup>';
		}


		// YMD Big-endian (year, month, day), e.g. 1996-04-22
		if (version_compare(JVERSION, '3.0', 'lt'))
		{
			$html.= '<optgroup label="' . JTEXT::_('COM_ICAGENDA_DATE_FORMAT_YMD') . ' :" style="font-weight:normal; color:#777777;"></optgroup>';
		}
		else
		{
			$html.= '<optgroup label="' . JTEXT::_('COM_ICAGENDA_DATE_FORMAT_YMD') . '">';
		}

		$ymd_array = array(
				$ymd_1 => '1993␣04␣30',
				$ymd_2 => '93␣04␣30',
				$ymd_3 => '04␣30',
				$ymd_4 => '93␣04',
				$ymd_5 => isset($ymd_text_5) ? $ymd_text_5 : '',
				$ymd_6 => isset($ymd_text_6) ? $ymd_text_6 : ''
			);

		foreach ($ymd_array as $format => $label)
		{
			if ($label)
			{
				$html.= '<option value="' . $format . '"';
				$html.= ($this->value == $format) ? $selected : '';
				$html.= '>' . $label . '</option>';
			}
		}

		if (version_compare(JVERSION, '3.0', 'ge'))
		{
			$html.= '</optgroup>';
		}

		$html.= '</select>';

		return $html;
	}
}
icmap/lat.php000060400000004112152456531770007137 0ustar00<?php
/**
 *------------------------------------------------------------------------------
 *  iCagenda v3 by Jooml!C - Events Management Extension for Joomla! 2.5 / 3.x
 *------------------------------------------------------------------------------
 * @package     com_icagenda
 * @copyright   Copyright (c)2012-2015 Cyril Rez�, Jooml!C - All rights reserved
 *
 * @license     GNU General Public License version 3 or later; see LICENSE.txt
 * @author      Cyril Rez� (Lyr!C)
 * @link        http://www.joomlic.com
 *
 * @version     3.5.0 2015-02-15
 * @since       1.0
 *------------------------------------------------------------------------------
*/

// No direct access to this file
defined('_JEXEC') or die();

jimport( 'joomla.filesystem.path' );
jimport('joomla.form.formfield');

/**
 * Returns Latitude from Google Maps address auto-complete field.
 */
class JFormFieldiCmap_lat extends JFormField
{
	protected $type='icmap_lat';

	protected function getInput()
	{
		// Check if coords set (deprecated)
		$id = JRequest::getVar('id');

		$class = isset($this->class) ? ' class="' . $this->class . '"' : '';

		if (isset($id))
		{
			$db	= JFactory::getDBO();
			$db->setQuery(
				'SELECT a.coordinate' .
				' FROM #__icagenda_events AS a' .
				' WHERE a.id = '.(int) $id
			);

			$coords = $db->loadResult();
		}
		else
		{
			$coords = NULL;
		}

		$session = JFactory::getSession();
		$ic_submit_lat = $session->get('ic_submit_lat', '');

		$lat_value = $ic_submit_lat ? $ic_submit_lat : $this->value;

		if ($coords != NULL
			&& $lat_value == '0.0000000000000000')
		{
			$ex			= explode(', ', $coords);
			$lat_value	= $ex[0];
		}
		elseif ($lat_value != '0.0000000000000000')
		{
			$lat_value	= $lat_value;
		}
		else
		{
			$lat_value	= NULL;
		}

		$html= '<div class="clr"></div>';
		$html.= '<label class="icmap-label">' . JText::_('COM_ICAGENDA_GOOGLE_MAPS_LATITUDE_LBL') . '</label> <input name="' . $this->name . '" id="lat" type="text"' . $class . ' value="' . $lat_value . '"/>';

		// clear the data so we don't process it again
		$session->clear('ic_submit_lat');

		return $html;
	}
}

icmap/city.php000060400000003031152456531770007326 0ustar00<?php
/**
 *------------------------------------------------------------------------------
 *  iCagenda v3 by Jooml!C - Events Management Extension for Joomla! 2.5 / 3.x
 *------------------------------------------------------------------------------
 * @package     com_icagenda
 * @copyright   Copyright (c)2012-2015 Cyril Rez�, Jooml!C - All rights reserved
 *
 * @license     GNU General Public License version 3 or later; see LICENSE.txt
 * @author      Cyril Rez� (Lyr!C)
 * @link        http://www.joomlic.com
 *
 * @version     3.5.0 2015-02-25
 * @since       1.0
 *------------------------------------------------------------------------------
*/

// No direct access to this file
defined('_JEXEC') or die();

jimport( 'joomla.filesystem.path' );
jimport('joomla.form.formfield');

/**
 * Returns City from Google Maps address auto-complete field.
 */
class JFormFieldiCmap_city extends JFormField
{
	protected $type='icmap_city';

	protected function getInput()
	{
		$session = JFactory::getSession();
		$ic_submit_city = $session->get('ic_submit_city', '');

		$city_value = $ic_submit_city ? $ic_submit_city : $this->value;

		$class = isset($this->class) ? ' class="' . $this->class . '"' : '';

		$html = '<div class="clr"></div>';
		$html.= '<label class="icmap-label">' . JText::_('COM_ICAGENDA_FORM_LBL_EVENT_CITY') . '</label> <input name="' . $this->name . '" id="locality" type="text"' . $class . ' value="' . $city_value . '"/>';

		// clear the data so we don't process it again
		$session->clear('ic_submit_city');

		return $html;
	}
}
icmap/index.html000060400000000032152456531770007640 0ustar00<html><body></body></html>icmap/lng.php000060400000004112152456531770007137 0ustar00<?php
/**
 *------------------------------------------------------------------------------
 *  iCagenda v3 by Jooml!C - Events Management Extension for Joomla! 2.5 / 3.x
 *------------------------------------------------------------------------------
 * @package     com_icagenda
 * @copyright   Copyright (c)2012-2015 Cyril Rez�, Jooml!C - All rights reserved
 *
 * @license     GNU General Public License version 3 or later; see LICENSE.txt
 * @author      Cyril Rez� (Lyr!C)
 * @link        http://www.joomlic.com
 *
 * @version     3.5.0 2015-02-15
 * @since       1.0
 *------------------------------------------------------------------------------
*/

// No direct access to this file
defined('_JEXEC') or die();

jimport( 'joomla.filesystem.path' );
jimport('joomla.form.formfield');

/**
 * Returns Latitude from Google Maps address auto-complete field.
 */
class JFormFieldiCmap_lng extends JFormField
{
	protected $type='icmap_lng';

	protected function getInput()
	{
		// Check if coords set (deprecated)
		$id = JRequest::getVar('id');

		$class = isset($this->class) ? ' class="' . $this->class . '"' : '';

		if (isset($id))
		{
			$db	= JFactory::getDBO();
			$db->setQuery(
				'SELECT a.coordinate' .
				' FROM #__icagenda_events AS a' .
				' WHERE a.id = '.(int) $id
			);

			$coords = $db->loadResult();
		}
		else
		{
			$coords = NULL;
		}

		$session = JFactory::getSession();
		$ic_submit_lng = $session->get('ic_submit_lng', '');

		$lng_value = $ic_submit_lng ? $ic_submit_lng : $this->value;

		if ($coords != NULL
			&& $lng_value == '0.0000000000000000')
		{
			$ex			= explode(', ', $coords);
			$lng_value	= $ex[1];
		}
		elseif ($lng_value != '0.0000000000000000')
		{
			$lng_value	= $lng_value;
		}
		else
		{
			$lng_value	= NULL;
		}

		$html= '<div class="clr"></div>';
		$html.= '<label class="icmap-label">' . JText::_('COM_ICAGENDA_GOOGLE_MAPS_LONGITUDE_LBL') . '</label> <input name="' . $this->name . '" id="lng" type="text"' . $class . ' value="' . $lng_value . '"/>';

		// clear the data so we don't process it again
		$session->clear('ic_submit_lng');

		return $html;
	}
}
icmap/country.php000060400000003072152456531770010066 0ustar00<?php
/**
 *------------------------------------------------------------------------------
 *  iCagenda v3 by Jooml!C - Events Management Extension for Joomla! 2.5 / 3.x
 *------------------------------------------------------------------------------
 * @package     com_icagenda
 * @copyright   Copyright (c)2012-2015 Cyril Rez�, Jooml!C - All rights reserved
 *
 * @license     GNU General Public License version 3 or later; see LICENSE.txt
 * @author      Cyril Rez� (Lyr!C)
 * @link        http://www.joomlic.com
 *
 * @version     3.5.0 2015-02-25
 * @since       1.0
 *------------------------------------------------------------------------------
*/

// No direct access to this file
defined('_JEXEC') or die();

jimport( 'joomla.filesystem.path' );
jimport('joomla.form.formfield');

/**
 * Returns Country from Google Maps address auto-complete field.
 */
class JFormFieldiCmap_country extends JFormField
{
	protected $type='icmap_country';

	protected function getInput()
	{
		$session = JFactory::getSession();
		$ic_submit_country = $session->get('ic_submit_country', '');

		$country_value = $ic_submit_country ? $ic_submit_country : $this->value;

		$class = isset($this->class) ? ' class="' . $this->class . '"' : '';

		$html = '<div class="clr"></div>';
		$html.= '<label class="icmap-label">' . JText::_('COM_ICAGENDA_FORM_LBL_EVENT_COUNTRY') . '</label> <input name="' . $this->name . '" id="country" type="text"' . $class . ' value="' . $country_value . '" />';

		// clear the data so we don't process it again
		$session->clear('ic_submit_country');

		return $html;
	}
}
modal/tos_article.php000060400000015034152456531770010677 0ustar00<?php
/**
 *------------------------------------------------------------------------------
 *  iCagenda v3 by Jooml!C - Events Management Extension for Joomla! 2.5 / 3.x
 *------------------------------------------------------------------------------
 * @package     com_icagenda
 * @copyright   Copyright (c)2012-2015 Cyril Rezé, Jooml!C - All rights reserved
 *
 * @license     GNU General Public License version 3 or later; see LICENSE.txt
 * @author      Cyril Rezé (Lyr!C)
 * @link        http://www.joomlic.com
 *
 * @version     3.2.0 2013-09-18
 * @since       3.2.0
 *------------------------------------------------------------------------------
*/

// No direct access to this file
defined('_JEXEC') or die();

/**
 * Supports a modal article picker.
 */
class JFormFieldModal_tos_article extends JFormField
{
	/**
	 * The form field type.
	 */
	protected $type = 'modal_tos_article';

//	protected function getLabel()
//	{
//	   return ' ';
//	}

	/**
	 * Method to get the field input markup.
	 */
	protected function getInput()
	{
		$icagendaParams = JComponentHelper::getParams('com_icagenda');
		$tos_Type = $icagendaParams->get('tos_Type', '1');

		$allowEdit		= ((string) $this->element['edit'] == 'true') ? true : false;
		$allowClear		= ((string) $this->element['clear'] != 'false') ? true : false;

		// Load language
		JFactory::getLanguage()->load('com_content', JPATH_ADMINISTRATOR);

		// Load the modal behavior script.
		JHtml::_('behavior.modal', 'a.modal');

		// Build the script.
		$script = array();

		// Select button script
		$script[] = '	function jSelectArticle_'.$this->id.'(id, title, catid, object) {';
		$script[] = '		document.getElementById("'.$this->id.'_id").value = id;';
		$script[] = '		document.getElementById("'.$this->id.'_name").value = title;';

		if ($allowEdit)
		{
			$script[] = '		jQuery("#'.$this->id.'_edit").removeClass("hidden");';
		}

		if ($allowClear)
		{
			$script[] = '		jQuery("#'.$this->id.'_clear").removeClass("hidden");';
		}

		$script[] = '		SqueezeBox.close();';
		$script[] = '	}';

		// Clear button script
		static $scriptClear;

		if ($allowClear && !$scriptClear)
		{
			$scriptClear = true;

			$script[] = '	function jClearArticle(id) {';
			$script[] = '		document.getElementById(id + "_id").value = "";';
			$script[] = '		document.getElementById(id + "_name").value = "'.htmlspecialchars(JText::_('COM_CONTENT_SELECT_AN_ARTICLE', true), ENT_COMPAT, 'UTF-8').'";';
			$script[] = '		jQuery("#"+id + "_clear").addClass("hidden");';
			$script[] = '		if (document.getElementById(id + "_edit")) {';
			$script[] = '			jQuery("#"+id + "_edit").addClass("hidden");';
			$script[] = '		}';
			$script[] = '		return false;';
			$script[] = '	}';
		}

		// Add the script to the document head.
		JFactory::getDocument()->addScriptDeclaration(implode("\n", $script));

		// Setup variables for display.
		$html	= array();
		$link	= 'index.php?option=com_content&amp;view=articles&amp;layout=modal&amp;tmpl=component&amp;function=jSelectArticle_'.$this->id;

		if (isset($this->element['language']))
		{
			$link .= '&amp;forcedLanguage='.$this->element['language'];
		}

		$db	= JFactory::getDbo();
		$db->setQuery(
			'SELECT title' .
			' FROM #__content' .
			' WHERE id = '.(int) $this->value
		);

		try
		{
			$title = $db->loadResult();
		}
		catch (RuntimeException $e)
		{
			JError::raiseWarning(500, $e->getMessage());
		}

		if (empty($title))
		{
			$title = JText::_('COM_CONTENT_SELECT_AN_ARTICLE');
		}
		$title = htmlspecialchars($title, ENT_QUOTES, 'UTF-8');

		// The active article id field.
		if (0 == (int) $this->value)
		{
			$value = '';
		}
		else
		{
			$value = (int) $this->value;
		}

		// The current article display field.
		$html[] = '<div id="ic_article"><fieldset class="span9 iCleft"><div>&nbsp;</div><span class="input-append">';
		$html[] = '<input type="text" class="input-medium" style="margin:0px" id="'.$this->id.'_name" value="'.$title.'" disabled="disabled" size="35" />';

		if(version_compare(JVERSION, '3.0', 'lt')) {
			$html[] = '<a class="modal btn hasTooltip" title="'.JText::_('COM_CONTENT_CHANGE_ARTICLE').'"  href="'.$link.'&amp;'.JSession::getFormToken().'=1" rel="{handler: \'iframe\', size: {x: 800, y: 450}}">'.JText::_('JSELECT').'</a>';
		} else {
			$html[] = '<a class="modal btn hasTooltip" title="'.JHtml::tooltipText('COM_CONTENT_CHANGE_ARTICLE').'"  href="'.$link.'&amp;'.JSession::getFormToken().'=1" rel="{handler: \'iframe\', size: {x: 800, y: 450}}"><i class="icon-file"></i> '.JText::_('JSELECT').'</a>';
		}

		// Edit article button
		if ($allowEdit)
		{
			if(version_compare(JVERSION, '3.0', 'lt')) {
				$html[] = '<a class="btn hasTooltip'.($value ? '' : ' hidden').'" href="index.php?option=com_content&view=article&layout=edit&id=' . $value. '" target="_blank" title="'.JText::_('COM_CONTENT_EDIT_ARTICLE').'" alt="'.JText::_('COM_CONTENT_EDIT_ARTICLE').'" >' . JText::_('JACTION_EDIT') . '</a>';
			} else {
				$html[] = '<a class="btn hasTooltip'.($value ? '' : ' hidden').'" href="index.php?option=com_content&layout=modal&tmpl=component&task=article.edit&id=' . $value. '" target="_blank" title="'.JHtml::tooltipText('COM_CONTENT_EDIT_ARTICLE').'" ><span class="icon-edit"></span> ' . JText::_('JACTION_EDIT') . '</a>';
			}
		}

		// Clear article button
		if ($allowClear)
		{
			if(version_compare(JVERSION, '3.0', 'lt')) {
				$html[] = '<a id="'.$this->id.'_clear" class="btn'.($value ? '' : ' hidden').'" onclick="return jClearArticle(\''.$this->id.'\')">' . JText::_('JCLEAR') . '</a>';
			} else {
				$html[] = '<button id="'.$this->id.'_clear" class="btn'.($value ? '' : ' hidden').'" onclick="return jClearArticle(\''.$this->id.'\')"><span class="icon-remove"></span> ' . JText::_('JCLEAR') . '</button>';
			}
		}

		$html[] = '</span>';

		// class='required' for client side validation
		$class = '';
		if ($this->required)
		{
			$class = ' class="required modal-value"';
		}


		$html[] = '<input type="hidden" id="'.$this->id.'_id"'.$class.' name="'.$this->name.'" value="'.$value.'" /></fieldset></div>';

//		if ($tos_Type == 'on') {
//			$tos_Type = '1';
//		}
		if ($tos_Type == '1') {
			$html[] = '<script type="text/javascript">';
			$html[] = 'document.getElementById("ic_default").style.display = "none";';
			$html[] = 'document.getElementById("ic_article").style.display = "block";';
			$html[] = 'document.getElementById("tos_custom").style.display = "none";';
			$html[] = '</script>';
		} else {
			$html[] = '<script type="text/javascript">';
			$html[] = 'document.getElementById("ic_article").style.display = "none";';
			$html[] = '</script>';
		}


		return implode("\n", $html);
	}
}
modal/evt_date.php000060400000007245152456531770010167 0ustar00<?php
/**
 *------------------------------------------------------------------------------
 *  iCagenda v3 by Jooml!C - Events Management Extension for Joomla! 2.5 / 3.x
 *------------------------------------------------------------------------------
 * @package     com_icagenda
 * @copyright   Copyright (c)2012-2015 Cyril Rezé, Jooml!C - All rights reserved
 *
 * @license     GNU General Public License version 3 or later; see LICENSE.txt
 * @author      Cyril Rezé (Lyr!C)
 * @link        http://www.joomlic.com
 *
 * @version     3.5.9 2015-07-30
 * @since       3.3.3
 *------------------------------------------------------------------------------
*/

// No direct access to this file
defined('_JEXEC') or die();

jimport( 'joomla.filesystem.path' );
jimport('joomla.form.formfield');

class JFormFieldModal_evt_date extends JFormField
{
	protected $type = 'modal_evt_date';

	protected function getInput()
	{
		$jinput	= JFactory::getApplication()->input;
		$view	= $jinput->get('view');

		$id		= ($view == 'mail') ? $jinput->get('eventid', '0') : $jinput->get('id', '0');

		if ($id != 0)
		{
			$db		= JFactory::getDbo();
			$query	= $db->getQuery(true);
			$query->select('r.id as reg_id, r.date AS reg_date, r.period AS reg_period, r.eventid AS reg_eventid, sum(r.people) AS reg_count')
				->from('`#__icagenda_registration` AS r');

			if ($view == 'mail')
			{
				$query->where('r.state = 1');
				$query->group('r.date');
			}

			$query->where('r.eventid = ' . (int) $id);

			$db->setQuery($query);

			if ($view == 'mail')
			{
				$result = $db->loadObjectList();
			}
			else
			{
				$result = $db->loadObject();
				$event_id	= $result->reg_eventid;
				$saveddate	= $result->reg_date;
			}
		}
		elseif ($view == 'registration')
		{
			$event_id	= '';
			$saveddate	= '';
		}

		if ($view == 'registration')
		{
			// Test if date saved in in datetime data format
			$date_is_datetime_sql	= false;
			$array_ex_date			= array('-', ' ', ':');
			$d_ex					= str_replace($array_ex_date, '-', $saveddate);
			$d_ex					= explode('-', $d_ex);

			if (count($d_ex) > 4)
			{
				if (   strlen($d_ex[0]) == 4
					&& strlen($d_ex[1]) == 2
					&& strlen($d_ex[2]) == 2
					&& strlen($d_ex[3]) == 2
					&& strlen($d_ex[4]) == 2   )
				{
					$date_is_datetime_sql = true;
				}
			}

			// Test if registered date before 3.3.3 could be converted
			// Control if new date format (Y-m-d H:i:s)
			$input		= trim($saveddate);
			$is_valid	= date('Y-m-d H:i:s', strtotime($input)) == $input;

			if ($is_valid
				&& strtotime($saveddate))
			{
				$date_get		= explode (' ', $saveddate);
				$saved_date		= $date_get['0'];
				$saved_time		= date('H:i:s', strtotime($date_get['1']));
			}
			else
			{
				// Explode to test if stored in old format in database
				$ex_saveddate	= explode (' - ', $saveddate);
				$saved_date		= isset($ex_saveddate['0']) ? trim($ex_saveddate['0']) : '';
				$saved_time		= isset($ex_saveddate['1']) ? trim(date('H:i:s', strtotime($ex_saveddate['1']))) : '';
			}

			$data_eventid = $event_id;

			$eventid_url = JRequest::getVar('eventid', '');

			if ( ! $date_is_datetime_sql && $saveddate )
			{
				$saveddate_text = '"<b>' . $saveddate . '</b>"';
				echo '<div class="ic-alert ic-alert-note"><span class="iCicon-info"></span> <strong>' . JText::_('NOTICE') . '</strong><br />'
					. JText::sprintf('COM_ICAGENDA_REGISTRATION_ERROR_DATE_CONTROL', $saveddate_text) . '</div>';
			}

			$event_id = isset($event_id) ? $eventid_url : '';

			$html = '<select name="' . $this->name . '" id="' . $this->id . '_id" data-chosen="true"></select>';
		}
		else
		{
			$html = '<select name="' . $this->name . '" id="' . $this->id . '_id" data-chosen="true"></select>';
		}

		return $html;
	}
}
modal/ph_regbt.php000060400000002610152456531770010155 0ustar00<?php
/**
 *------------------------------------------------------------------------------
 *  iCagenda v3 by Jooml!C - Events Management Extension for Joomla! 2.5 / 3.x
 *------------------------------------------------------------------------------
 * @package     com_icagenda
 * @copyright   Copyright (c)2012-2015 Cyril Rezé, Jooml!C - All rights reserved
 *
 * @license     GNU General Public License version 3 or later; see LICENSE.txt
 * @author      Cyril Rezé (Lyr!C)
 * @link        http://www.joomlic.com
 *
 * @version     3.1.3 2013-08-08
 * @since       3.0
 *------------------------------------------------------------------------------
*/

// No direct access to this file
defined('_JEXEC') or die();

jimport( 'joomla.filesystem.path' );
jimport('joomla.form.formfield');

class JFormFieldModal_ph_regbt extends JFormField
{
	protected $type='modal_ph_regbt';

	protected function getInput()
	{
		$class = JRequest::getVar('class');

		jimport('joomla.application.component.helper');
		$icagendaParams = JComponentHelper::getParams('com_icagenda');
		$extRegButtonText = $icagendaParams->get('RegButtonText');

		if (!isset($extRegButtonText)) { $extRegButtonText = JText::_( 'COM_ICAGENDA_REGISTRATION_REGISTER'); }

		$html ='<input type="text" id="'.$this->id.'" class="'.$class.'" name="'.$this->name.'" value="'.$this->value.'" placeholder="'.$extRegButtonText.'"/>';

		return $html;
	}
}
modal/icvalue_field.php000060400000003350152456531770011160 0ustar00<?php
/**
 *------------------------------------------------------------------------------
 *  iCagenda v3 by Jooml!C - Events Management Extension for Joomla! 2.5 / 3.x
 *------------------------------------------------------------------------------
 * @package     com_icagenda
 * @copyright   Copyright (c)2012-2015 Cyril Rezé, Jooml!C - All rights reserved
 *
 * @license     GNU General Public License version 3 or later; see LICENSE.txt
 * @author      Cyril Rezé (Lyr!C)
 * @link        http://www.joomlic.com
 *
 * @version     3.2.3 2013-10-17
 * @since       3.2.3
 *------------------------------------------------------------------------------
*/

// No direct access to this file
defined('_JEXEC') or die();

jimport( 'joomla.filesystem.path' );
jimport('joomla.form.formfield');

class JFormFieldModal_icvalue_field extends JFormField
{
	protected $type='modal_icvalue_field';

	protected function getInput()
	{

		$Explode = explode('_', $this->name);
		$TypeName = $Explode[0].']';

		$replace = array("jform", "[params]", "[", "]");
		$name = str_replace($replace, "", $TypeName);

		$Type_default = $name.'_default';
		$Type_content = $name.'_custom';

		$html	= array();

		$html[] = '<div id="'.$Type_content.'"><fieldset class="span9 iCleft">';
		$html[] = '<input type="text" value="'.$this->value.'" name="'.$this->name.'"/>';
		$html[] = '</fieldset></div>';

		$html[] = '<script type="text/javascript">';
		$html[] = 'if (typeset == 1) {';
		$html[] = 'document.getElementById("'.$Type_content.'").style.display = "block";';
		$html[] = '}';
		$html[] = 'if (typeset == 0) {';
		$html[] = 'document.getElementById("'.$Type_content.'").style.display = "none";';
		$html[] = '}';
		$html[] = '</script>';

		return implode("\n", $html);
	}
}
modal/ictextarea_counter.php000060400000013220152456531770012252 0ustar00<?php
/**
 *------------------------------------------------------------------------------
 *  iCagenda v3 by Jooml!C - Events Management Extension for Joomla! 2.5 / 3.x
 *------------------------------------------------------------------------------
 * @package     com_icagenda
 * @copyright   Copyright (c)2012-2015 Cyril Rezé, Jooml!C - All rights reserved
 *
 * @license     GNU General Public License version 3 or later; see LICENSE.txt
 * @author      Cyril Rezé (Lyr!C)
 * @link        http://www.joomlic.com
 *
 * @version     3.5.0 2015-02-14
 * @since       3.4.0
 *------------------------------------------------------------------------------
*/

// No direct access to this file
defined('_JEXEC') or die();

jimport( 'joomla.filesystem.path' );
jimport('joomla.form.formfield');

/**
 * Textarea with a counter. Short Description and Meta Description
 *
 * @package		iCagenda
 * @subpackage	com_icagenda
 * @since		3.4.0
 */
class JFormFieldModal_ictextarea_counter extends JFormField
{
	protected $type = 'modal_ictextarea_counter';

	protected function getInput()
	{
		$app		= JFactory::getApplication();
		$replace	= array("jform", "[", "]");
		$name		= str_replace($replace, "", $this->name);
		$nb_chars	= strlen(trim(utf8_decode($this->value)));
		$class		= !empty($this->class) ? ' class="' . $this->class . '"' : '';

		if ($app->isAdmin())
		{
			$params	= JComponentHelper::getParams('com_icagenda');
			$iCparams	= JComponentHelper::getParams('com_icagenda');
		}
		else
		{
			$params	= $app->getParams();
			$iCparams	= JComponentHelper::getParams('com_icagenda');
		}

		$session = JFactory::getSession();
		$ic_submit_shortdesc = $session->get('ic_submit_shortdesc', '');
		$ic_submit_metadesc = $session->get('ic_submit_metadesc', '');

		$event_shortdesc = $ic_submit_shortdesc ? $ic_submit_shortdesc : $this->value;
		$event_metadesc = $ic_submit_metadesc ? $ic_submit_metadesc : $this->value;

		if ($name == 'shortdesc')
		{
			$ic_max_component	= $iCparams->get('char_limit_short_description', '100');
			$ic_max				= $params->get('char_limit_short_description', '100');
			$ic_max				= ($ic_max_component >= $ic_max) ? $ic_max : $ic_max_component;
		}
		elseif ($name == 'metadesc')
		{
			$ic_max_component	= $iCparams->get('char_limit_meta_description', '160');
			$ic_max				= $params->get('char_limit_meta_description', '160');
			$ic_max				= ($ic_max_component >= $ic_max) ? $ic_max : $ic_max_component;
		}
		else
		{
			$ic_max = $params->get('ShortDescLimit', '100');
		}

		// Alert if text stored in the database exceeds the character limit currently set.
		$display_alert	= ($nb_chars > $ic_max) ? true : false;

		$count_value = $nb_chars ? ($ic_max-$nb_chars) : $ic_max;
		$ic_size = (strlen($ic_max))-1;
		$ic_size = $ic_size ? $ic_size : '1';

		$counter_input = '<input id="' . $name . '-counter"';
//		$counter_input.= ' onblur="iCtextCounter(this.form.' . $this->name . ', this, ' . $ic_max . ');"';
		$counter_input.= ' class="valid"';
//		$counter_input.= ' onfocus="this.blur();"';
//		$counter_input.= ' tabindex="999" maxlength="' . $ic_size . '" size="' . $ic_size . '"';
		$counter_input.= ' size="' . $ic_size . '"';
		$counter_input.= ' value="' . $count_value . '"';
		$counter_input.= ' name="counter_' . $name . '">';

		$html = '<div>';

		if ($display_alert)
		{
			$html.= '<div class="alert alert-danger"><h3>Warning</h3><strong>'
					. JText::sprintf('COM_ICAGENDA_ALERT_S_TEXT_S_EXCEEDS_CHARACTER_LIMIT', $this->title) . '</strong><br />'
					. JText::_('COM_ICAGENDA_ALERT_EDIT_TEXT_TO_FIT_CHAR_LIMIT') . '<br /><br /><u>'
					. JText::sprintf('COM_ICAGENDA_ALERT_S_TEXT_S_CURRENTLY_STORED_IN_DATABASE', $this->title) . '</u> :<br/><i>'
					. $this->value . '</i></div>';
		}
		$html.= '<textarea';
		$html.= ' onKeyPress="iCtextCounter(this, this.form.counter_' . $name.', ' . $ic_max . ');"';
		$html.= ' onKeyUp="iCtextCounter(' . $name . ', counter_' . $name . ', ' . $ic_max . ');"';
		$html.= ' onkeydown="iCtextCounter(' . $name . ', counter_' . $name . ', ' . $ic_max . ');"';
		$html.= ' onmouseout="iCtextCounter(' . $name . ', counter_' . $name . ', ' . $ic_max . ');"';
//		$html.= ' onpaste="' . $name . 'useractions();"';
		$html.= $class . ' name="' . $this->name . '" id="' . $name . '">';

		if ($name == 'shortdesc')
		{
			$html.= $event_shortdesc;

			// clear the data so we don't process it again
			$session->clear('ic_submit_shortdesc');
		}
		elseif ($name == 'metadesc')
		{
			$html.= $event_metadesc;

			// clear the data so we don't process it again
			$session->clear('ic_submit_metadesc');
		}
		else
		{
			$html.= $this->value;
		}

		$html.= '</textarea>';

		$html.= '</div>';
		$html.= '<div id="'.$name.'-counter-container" class="ic-counter-container">';
		$html.= '<div class="ic-counter">';
		$html.= JText::sprintf('COM_ICAGENDA_MAXIMUM_N_CHARACTERS', $ic_max);
		$html.= '</div> ';
		$html.= '<div class="ic-counter">';
		$html.= JText::sprintf('COM_ICAGENDA_N_REMAINING', $counter_input);
		$html.= '</div>';
		$html.= '</div>';
		$html.= '<div>&nbsp;</div>';

//		$html.= '<textarea';
//		$html.= ' onMouseOut="CheckFieldLength(this.' . $name . ', \'' . $name . '_charcount\', \'' . $name . '_remaining\', 140);"';
//		$html.= ' onKeyDown="CheckFieldLength(this.' . $name . ', \'' . $name . '_charcount\', \'' . $name . '_remaining\', 140);"';
//		$html.= ' onkeyup="CheckFieldLength(this.' . $name . ', \'' . $name . '_charcount\', \'' . $name . '_remaining\', 140);"';
//		$html.= $class . ' name="' . $this->name . '" id ="' . $name . '">';
//		$html.= '</textarea>';
//		$html.= '<h2><span id="' . $name . '_charcount">0</span> characters entered   | <span id="' . $name . '_remaining">140</span> characters remaining</h2>';

		return $html;
	}
}
modal/thumbs.php000060400000011033152456531770007664 0ustar00<?php
/**
 *------------------------------------------------------------------------------
 *  iCagenda v3 by Jooml!C - Events Management Extension for Joomla! 2.5 / 3.x
 *------------------------------------------------------------------------------
 * @package     com_icagenda
 * @copyright   Copyright (c)2012-2015 Cyril Rezé, Jooml!C - All rights reserved
 *
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 * @author      Cyril Rezé (Lyr!C)
 * @link        http://www.joomlic.com
 *
 * @version     3.5.2 2015-03-13
 * @since       3.4.0
 *------------------------------------------------------------------------------
*/

// No direct access to this file
defined('_JEXEC') or die();

jimport( 'joomla.filesystem.path' );
jimport('joomla.form.formfield');

class JFormFieldModal_thumbs extends JFormField
{
	protected $type='modal_thumbs';

	protected function getInput()
	{
		$replace = array("jform", "params", "[", "]");
		$name_input = str_replace($replace, "", $this->name);

		jimport('joomla.application.component.helper');
		$iCparams = JComponentHelper::getParams('com_icagenda');

		if ($name_input == 'thumb_large')
		{
			$thumbOptions = $iCparams->get('thumb_large');
			$width = is_numeric($thumbOptions[0]) ? $thumbOptions[0] : '900';
			$height = is_numeric($thumbOptions[1]) ? $thumbOptions[1] : '600';
			$quality = is_numeric($thumbOptions[2]) ? $thumbOptions[2] : '100';
			$crop = $thumbOptions[3] ? $thumbOptions[3] : false;
			$default_width = '900';
			$default_height = '600';
			$default_quality = '100';
			$default_crop = '0';
		}
		elseif ($name_input == 'thumb_medium')
		{
			$thumbOptions = $iCparams->get('thumb_medium');
			$width = is_numeric($thumbOptions[0]) ? $thumbOptions[0] : '300';
			$height = is_numeric($thumbOptions[1]) ? $thumbOptions[1] : '300';
			$quality = is_numeric($thumbOptions[2]) ? $thumbOptions[2] : '100';
			$crop = $thumbOptions[3] ? $thumbOptions[3] : false;
			$default_width = '300';
			$default_height = '300';
			$default_quality = '100';
			$default_crop = '0';
		}
		elseif ($name_input == 'thumb_small')
		{
			$thumbOptions = $iCparams->get('thumb_small');
			$width = is_numeric($thumbOptions[0]) ? $thumbOptions[0] : '100';
			$height = is_numeric($thumbOptions[1]) ? $thumbOptions[1] : '100';
			$quality = is_numeric($thumbOptions[2]) ? $thumbOptions[2] : '100';
			$crop = $thumbOptions[3] ? $thumbOptions[3] : false;
			$default_width = '100';
			$default_height = '100';
			$default_quality = '100';
			$default_crop = '0';
		}
		elseif ($name_input == 'thumb_xsmall')
		{
			$thumbOptions = $iCparams->get('thumb_xsmall');
			$width = is_numeric($thumbOptions[0]) ? $thumbOptions[0] : '48';
			$height = is_numeric($thumbOptions[1]) ? $thumbOptions[1] : '48';
			$quality = is_numeric($thumbOptions[2]) ? $thumbOptions[2] : '80';
			$crop = $thumbOptions[3] ? $thumbOptions[3] : true;
			$default_width = '48';
			$default_height = '48';
			$default_quality = '80';
			$default_crop = '1';
		}

		$crop_false = $crop_true = '';

		if (!empty($crop))
		{
			$crop_true = ' selected="selected"';
		}
		else
		{
			$crop_false = ' selected="selected"';
		}

		$quality_80 = '';

		if ($quality == '80')
		{
			$quality_80 =  ' selected="selected"';
		}

		$quality_values = array('100', '95', '90', '85', '80', '75', '70', '60', '50');

		$html = array();

		$html[] = '<div class="span2">' . JText::_('IC_WIDTH') . '<br />';
		$html[] = '<input type="text" class="input-mini" name="'.$this->name.'[]" value="'.$width.'" default="'.$default_width.'"/></div>';

		$html[] = '<div class="span2">' . JText::_('IC_HEIGHT') . '<br />';
		$html[] = '<input type="text" class="input-mini" name="'.$this->name.'[]" value="'.$height.'" default="'.$default_height.'"/></div>';

		$html[] = '<div class="span2">' . JText::_('IC_QUALITY') . '<br />';
		$html[] = '<select id="ThumbMedium_quality" class="input-small" name="'.$this->name.'[]" value="'.$quality.'">';

		foreach ($quality_values AS $qv)
		{
			$html[] = '<option value="'.$qv.'"';

			if ($qv == $quality)
			{
				$html[] = ' selected="selected"';
			}

			$html[] = '>' . JText::_('IC'.$qv.'') . '</option>';
		}

		$html[] = '</select></div>';

		$html[] = '<div class="span2">' . JText::_('IC_CROPPED') . '<br />';
		$html[] = '<select id="ThumbMedium_crop" class="input-small" name="' . $this->name . '[]" value="' . $crop . '">';
		$html[] = '<option value="0" ' . $crop_false . '>'.JText::_('JNO').'</option>';
		$html[] = '<option value="1" ' . $crop_true . '>'.JText::_('JYES').'</option>';
		$html[] = '</select></div>';

		return implode("\n", $html);
	}
}
modal/startdate.php000060400000003111152456531770010353 0ustar00<?php
/**
 *------------------------------------------------------------------------------
 *  iCagenda v3 by Jooml!C - Events Management Extension for Joomla! 2.5 / 3.x
 *------------------------------------------------------------------------------
 * @package     com_icagenda
 * @copyright   Copyright (c)2012-2015 Cyril Rezé, Jooml!C - All rights reserved
 *
 * @license     GNU General Public License version 3 or later; see LICENSE.txt
 * @author      Cyril Rezé (Lyr!C)
 * @link        http://www.joomlic.com
 *
 * @version     3.5.10 2015-08-13
 * @since       2.0.0
 *------------------------------------------------------------------------------
*/

// No direct access to this file
defined('_JEXEC') or die();

jimport('joomla.filesystem.path');
jimport('joomla.form.formfield');

/**
 * Form Field to load a startdate datetime picker input
 *
 * @since	2.0.0
 */
class JFormFieldModal_startdate extends JFormField
{
	protected $type = 'modal_startdate';

	protected function getInput()
	{
		$class = ! empty($this->class) ? ' class="' . $this->class . '"' : '';

		$lang = JFactory::getLanguage();

		if ($lang->getTag() == 'fa-IR')
		{
			// Including fallback code for HTML5 non supported browsers.
			JHtml::_('jquery.framework');
			JHtml::_('script', 'system/html5fallback.js', false, true);

			$attributes = '';

			$html = JHtml::_('calendar', $this->value, $this->name, 'startdate_jalali', '%Y-%m-%d %H:%M:%S', $attributes);
		}
		else
		{
			$html ='<input type="text" id="startdate"' . $class . ' name="' . $this->name . '" value="' . $this->value . '"/>';
		}

		return $html;
	}
}
modal/ictxt_content.php000060400000003772152456531770011262 0ustar00<?php
/**
 *------------------------------------------------------------------------------
 *  iCagenda v3 by Jooml!C - Events Management Extension for Joomla! 2.5 / 3.x
 *------------------------------------------------------------------------------
 * @package     com_icagenda
 * @copyright   Copyright (c)2012-2015 Cyril Rezé, Jooml!C - All rights reserved
 *
 * @license     GNU General Public License version 3 or later; see LICENSE.txt
 * @author      Cyril Rezé (Lyr!C)
 * @link        http://www.joomlic.com
 *
 * @version     3.2.5 2013-11-10
 * @since       3.2.5
 *------------------------------------------------------------------------------
*/

// No direct access to this file
defined('_JEXEC') or die();

jimport( 'joomla.filesystem.path' );
jimport('joomla.form.formfield');

class JFormFieldModal_ictxt_content extends JFormField
{
	/**
	 * The form field type.
	 */
	protected $type = 'modal_ictxt_content';

	/**
	 * Method to get the field input markup.
	 */
	protected function getInput()
	{
		jimport('joomla.application.component.helper');
		$icagendaParams = JComponentHelper::getParams('com_icagenda');

		$replace = array("jform", "[", "]", "Content");
		$name = str_replace($replace, "", $this->name);

		$tosContent = $icagendaParams->get($name.'Content', '');
		$tos_Type = $icagendaParams->get($name.'_Type', '');

		$editor = JFactory::getEditor();

		$html	= array();

		$html[] = '<div id="'.$name.'_custom"><fieldset class="span9 iCleft">';
		$html[] = $editor->display($this->name, $tosContent, "100%", "300", "300", "20", 1, null, null, null, array('mode' => 'advanced'));
		$html[] = '</fieldset></div>';

		if ($tos_Type == '2') {
			$html[] = '<script type="text/javascript">';
			$html[] = 'document.getElementById("'.$name.'_custom").style.display = "block";';
			$html[] = '</script>';
		} else {
			$html[] = '<script type="text/javascript">';
			$html[] = 'document.getElementById("'.$name.'_custom").style.display = "none";';
			$html[] = '</script>';
		}

		return implode("\n", $html);
	}
}
modal/coordinate.php000060400000002731152456531770010516 0ustar00<?php
/** 
 *	iCagenda
 *----------------------------------------------------------------------------
 * @package     com_icagenda
 * @copyright	Copyright (C) 2012 JOOMLIC - All rights reserved.
 * @license     GNU General Public License version 3 or later; see LICENSE.txt
 * @author      Jooml!C - http://www.joomlic.com
 * 
 * @update		2013-04-18
 * @version		2.1.7
 *----------------------------------------------------------------------------
*/

// No direct access to this file
defined( '_JEXEC' ) or die( 'Restricted access' );

jimport( 'joomla.filesystem.path' );
jimport('joomla.form.formfield');


class JFormFieldModal_coordinate extends JFormField
{
	protected $type='modal_coordinate';
	
	protected function getInput()
	{	
		$def=JRequest::getVar('def');
		if ($def=='')$def=$this->value;
	
	
	
		$html= '
			<!--div class="clr"></div>
			<div id="map_canvas" style="width:100%; height:300px"></div><br/>
			<label>'.JText::_('COM_ICAGENDA_FORM_LBL_EVENT_GPS').'</label>&nbsp;<input name="'.$this->name.'" id="jform_coordinate" type="text" size="41" value="'.$def.'"/-->
			<div class="clr"></div>
			<!--input name="latitude" id="lat" type="text"/>
			<input name="longitude" id="lng" type="text"/-->';

		
			$html.= '<input name="'.$this->name.'" id="lat" type="text" size="41" value="'.$this->value.'"/>
		<!--script>
			document.getElementById("coords").value=document.getElementById("lat").value+", "+document.getElementById("lng").value;
		</script-->';

		return $html;
	}
}modal/checkdnsrr.php000060400000003055152456531770010515 0ustar00<?php
/**
 *------------------------------------------------------------------------------
 *  iCagenda v3 by Jooml!C - Events Management Extension for Joomla! 2.5 / 3.x
 *------------------------------------------------------------------------------
 * @package     com_icagenda
 * @copyright   Copyright (c)2012-2015 Cyril Rezé, Jooml!C - All rights reserved
 *
 * @license     GNU General Public License version 3 or later; see LICENSE.txt
 * @author      Cyril Rezé (Lyr!C)
 * @link        http://www.joomlic.com
 *
 * @version     3.1.7 2013-08-28
 * @since       3.1.7
 *------------------------------------------------------------------------------
*/

// No direct access to this file
defined('_JEXEC') or die();

jimport( 'joomla.filesystem.path' );
jimport('joomla.form.formfield');

class JFormFieldModal_checkdnsrr extends JFormField
{
	protected $type='modal_checkdnsrr';

	protected function getInput()
	{
		$test='0';
		if (function_exists('checkdnsrr')) {
			$test='1';
		}
		if ($test!=1) {
			if(version_compare(JVERSION, '3.0', 'lt')) {
				$html='<label style="color:red"><b> '.JText::_('COM_ICAGENDA_REGISTRATION_EMAIL_CHECKDNSRR_NOT_PRESENT_1').'</b><br/>'.JText::_('COM_ICAGENDA_REGISTRATION_EMAIL_CHECKDNSRR_NOT_PRESENT_2').'</label><br/>';
			} else {
				$html='<div class="alert alert-error"><span class="icon-warning"></span><b> '.JText::_('COM_ICAGENDA_REGISTRATION_EMAIL_CHECKDNSRR_NOT_PRESENT_1').'</b><br/>'.JText::_('COM_ICAGENDA_REGISTRATION_EMAIL_CHECKDNSRR_NOT_PRESENT_2').'</div>';
			}
			return $html;
		} else {
			return false;
		}

	}
}
modal/period.php000060400000002542152456531770007651 0ustar00<?php
/** 
 *	iCagenda
 *----------------------------------------------------------------------------
 * @package     com_icagenda
 * @copyright	Copyright (C) 2012 JOOMLIC - All rights reserved.
 * @license     GNU General Public License version 3 or later; see LICENSE.txt
 * @author      Jooml!C - http://www.joomlic.com
 * 
 * @since		1.3
 *----------------------------------------------------------------------------
*/

// No direct access to this file
defined( '_JEXEC' ) or die( 'Restricted access' );

jimport( 'joomla.filesystem.path' );
jimport('joomla.form.formfield');


JText::script('COM_ICAGENDA_TP_CURRENT');
JText::script('COM_ICAGENDA_TP_CLOSE');
JText::script('COM_ICAGENDA_TP_TITLE');
JText::script('COM_ICAGENDA_TP_TIME');
JText::script('COM_ICAGENDA_TP_HOUR');
JText::script('COM_ICAGENDA_TP_MINUTE');


class JFormFieldModal_period extends JFormField
{
	protected $type='modal_period';
	
	protected function getInput()
	{
		$html ='<script>
		$(function(){
			$(\'#jform_period\').datetimepicker({
				dateFormat: \'yy-mm-dd\',
				hourGrid: 4,
				minuteGrid: 10
			});
		})

		</script>
		<input type="text" id="'.$this->id.'" class="'.$this->class.'" name="'.$this->name.'" value="'.$this->value.'"/>';
		$html ='<input type="text" id="'.$this->id.'" class="'.$this->class.'" name="'.$this->name.'" value="'.$this->value.'"/>';
			
		return $html;
	}
}modal/ictxt_article.php000060400000014612152456531770011226 0ustar00<?php
/**
 *------------------------------------------------------------------------------
 *  iCagenda v3 by Jooml!C - Events Management Extension for Joomla! 2.5 / 3.x
 *------------------------------------------------------------------------------
 * @package     com_icagenda
 * @copyright   Copyright (c)2012-2015 Cyril Rezé, Jooml!C - All rights reserved
 *
 * @license     GNU General Public License version 3 or later; see LICENSE.txt
 * @author      Cyril Rezé (Lyr!C)
 * @link        http://www.joomlic.com
 *
 * @version     3.2.5 2013-11-10
 * @since       3.2.5
 *------------------------------------------------------------------------------
*/

// No direct access to this file
defined('_JEXEC') or die();

/**
 * Supports a modal article picker.
 */
class JFormFieldModal_ictxt_article extends JFormField
{
	/**
	 * The form field type.
	 */
	protected $type = 'modal_ictxt_article';

	/**
	 * Method to get the field input markup.
	 */
	protected function getInput()
	{
		$icagendaParams = JComponentHelper::getParams('com_icagenda');

		$replace = array("jform", "[", "]", "Article");
		$name = str_replace($replace, "", $this->name);

		$tos_Type = $icagendaParams->get($name.'_Type', '');

		$allowEdit		= ((string) $this->element['edit'] == 'true') ? true : false;
		$allowClear		= ((string) $this->element['clear'] != 'false') ? true : false;

		// Load language
		JFactory::getLanguage()->load('com_content', JPATH_ADMINISTRATOR);

		// Load the modal behavior script.
		JHtml::_('behavior.modal', 'a.modal');

		// Build the script.
		$script = array();

		// Select button script
		$script[] = '	function jSelectArticle_'.$this->id.'(id, title, catid, object) {';
		$script[] = '		document.getElementById("'.$this->id.'_id").value = id;';
		$script[] = '		document.getElementById("'.$this->id.'_name").value = title;';

		if ($allowEdit)
		{
			$script[] = '		jQuery("#'.$this->id.'_edit").removeClass("hidden");';
		}

		if ($allowClear)
		{
			$script[] = '		jQuery("#'.$this->id.'_clear").removeClass("hidden");';
		}

		$script[] = '		SqueezeBox.close();';
		$script[] = '	}';

		// Clear button script
		static $scriptClear;

		if ($allowClear && !$scriptClear)
		{
			$scriptClear = true;

			$script[] = '	function jClearArticle(id) {';
			$script[] = '		document.getElementById(id + "_id").value = "";';
			$script[] = '		document.getElementById(id + "_name").value = "'.htmlspecialchars(JText::_('COM_CONTENT_SELECT_AN_ARTICLE', true), ENT_COMPAT, 'UTF-8').'";';
			$script[] = '		jQuery("#"+id + "_clear").addClass("hidden");';
			$script[] = '		if (document.getElementById(id + "_edit")) {';
			$script[] = '			jQuery("#"+id + "_edit").addClass("hidden");';
			$script[] = '		}';
			$script[] = '		return false;';
			$script[] = '	}';
		}

		// Add the script to the document head.
		JFactory::getDocument()->addScriptDeclaration(implode("\n", $script));

		// Setup variables for display.
		$html	= array();
		$link	= 'index.php?option=com_content&amp;view=articles&amp;layout=modal&amp;tmpl=component&amp;function=jSelectArticle_'.$this->id;

		if (isset($this->element['language']))
		{
			$link .= '&amp;forcedLanguage='.$this->element['language'];
		}

		$db	= JFactory::getDbo();
		$db->setQuery(
			'SELECT title' .
			' FROM #__content' .
			' WHERE id = '.(int) $this->value
		);

		try
		{
			$title = $db->loadResult();
		}
		catch (RuntimeException $e)
		{
			JError::raiseWarning(500, $e->getMessage());
		}

		if (empty($title))
		{
			$title = JText::_('COM_CONTENT_SELECT_AN_ARTICLE');
		}
		$title = htmlspecialchars($title, ENT_QUOTES, 'UTF-8');

		// The active article id field.
		if (0 == (int) $this->value)
		{
			$value = '';
		}
		else
		{
			$value = (int) $this->value;
		}

		// The current article display field.
		$html[] = '<div id="'.$name.'_article"><fieldset class="span9 iCleft"><div>&nbsp;</div><span class="input-append">';
		$html[] = '<input type="text" class="input-medium" style="margin:0px" id="'.$this->id.'_name" value="'.$title.'" disabled="disabled" size="35" />';

		if(version_compare(JVERSION, '3.0', 'lt')) {
			$html[] = '<a class="modal btn hasTooltip" title="'.JText::_('COM_CONTENT_CHANGE_ARTICLE').'"  href="'.$link.'&amp;'.JSession::getFormToken().'=1" rel="{handler: \'iframe\', size: {x: 800, y: 450}}">'.JText::_('JSELECT').'</a>';
		} else {
			$html[] = '<a class="modal btn hasTooltip" title="'.JHtml::tooltipText('COM_CONTENT_CHANGE_ARTICLE').'"  href="'.$link.'&amp;'.JSession::getFormToken().'=1" rel="{handler: \'iframe\', size: {x: 800, y: 450}}"><i class="icon-file"></i> '.JText::_('JSELECT').'</a>';
		}

		// Edit article button
		if ($allowEdit)
		{
			if(version_compare(JVERSION, '3.0', 'lt')) {
				$html[] = '<a class="btn hasTooltip'.($value ? '' : ' hidden').'" href="index.php?option=com_content&view=article&layout=edit&id=' . $value. '" target="_blank" title="'.JText::_('COM_CONTENT_EDIT_ARTICLE').'" alt="'.JText::_('COM_CONTENT_EDIT_ARTICLE').'" >' . JText::_('JACTION_EDIT') . '</a>';
			} else {
				$html[] = '<a class="btn hasTooltip'.($value ? '' : ' hidden').'" href="index.php?option=com_content&layout=modal&tmpl=component&task=article.edit&id=' . $value. '" target="_blank" title="'.JHtml::tooltipText('COM_CONTENT_EDIT_ARTICLE').'" ><span class="icon-edit"></span> ' . JText::_('JACTION_EDIT') . '</a>';
			}
		}

		// Clear article button
		if ($allowClear)
		{
			if(version_compare(JVERSION, '3.0', 'lt')) {
				$html[] = '<a id="'.$this->id.'_clear" class="btn'.($value ? '' : ' hidden').'" onclick="return jClearArticle(\''.$this->id.'\')">' . JText::_('JCLEAR') . '</a>';
			} else {
				$html[] = '<button id="'.$this->id.'_clear" class="btn'.($value ? '' : ' hidden').'" onclick="return jClearArticle(\''.$this->id.'\')"><span class="icon-remove"></span> ' . JText::_('JCLEAR') . '</button>';
			}
		}

		$html[] = '</span>';

		// class='required' for client side validation
		$class = '';
		if ($this->required)
		{
			$class = ' class="required modal-value"';
		}


		$html[] = '<input type="hidden" id="'.$this->id.'_id"'.$class.' name="'.$this->name.'" value="'.$value.'" /></fieldset></div>';

		if ($tos_Type == '1') {
			$html[] = '<script type="text/javascript">';
			$html[] = 'document.getElementById("'.$name.'_article").style.display = "block";';
			$html[] = '</script>';
		} else {
			$html[] = '<script type="text/javascript">';
			$html[] = 'document.getElementById("'.$name.'_article").style.display = "none";';
			$html[] = '</script>';
		}


		return implode("\n", $html);
	}
}
modal/icmulti_checkbox.php000060400000005042152456531770011701 0ustar00<?php
/**
 *------------------------------------------------------------------------------
 *  iCagenda v3 by Jooml!C - Events Management Extension for Joomla! 2.5 / 3.x
 *------------------------------------------------------------------------------
 * @package     com_icagenda
 * @copyright   Copyright (c)2012-2015 Cyril Rezé, Jooml!C - All rights reserved
 *
 * @license     GNU General Public License version 3 or later; see LICENSE.txt
 * @author      Cyril Rezé (Lyr!C)
 * @link        http://www.joomlic.com
 *
 * @version     3.2.6 2013-11-21
 * @since       3.2.6
 *------------------------------------------------------------------------------
*/

// No direct access to this file
defined('_JEXEC') or die();

jimport( 'joomla.filesystem.path' );
jimport('joomla.form.formfield');

class JFormFieldModal_icmulti_checkbox extends JFormField
{
	protected $type='modal_icmulti_checkbox';

	protected function getLabel()
	{
	   return ' ';
	}

	protected function getInput()
	{

		$Explode = explode('_', $this->name);
		$TypeName = $Explode[0].']';

		$replace = array("jform", "[params]", "[", "]");
		$name = str_replace($replace, "", $TypeName);

		$selected = $this->value;
		if (!is_array($selected)) $selected = array();

		$check_1 = ' checked="checked"';
		$check_2 = ' checked="checked"';

		if (in_array('1', $selected)) {
			$check_1 = ' checked="checked"';
		} else {
			$check_1 = '';
		}
		if (in_array('2', $selected)) {
			$check_2 = ' checked="checked"';
		} else {
			$check_2 = '';
		}

		$Type_none = $name.'_none';
		$Type_checkbox = $name.'_checkbox';

		$html	= array();

		$html[] = '<div id="'.$Type_checkbox.'"><fieldset class="span9 iCleft">';
//		$html[] = '<input type="text" value="'.$this->value.'" name="'.$this->name.'"/>';
		$html[] = '<div style="display: inline-block"><input type="checkbox" value="1" name="'.$this->name.'[]"'.$check_1.'/>&nbsp;'.JText::_( 'ICTITLE' ).'</div>';
		$html[] = '<div style="display: inline-block"><input type="checkbox" value="2" name="'.$this->name.'[]"'.$check_2.'/>&nbsp;'.JText::_( 'ICDESC' ).'</div>';
		$html[] = '</fieldset></div>';

		$html[] = '<script type="text/javascript">';
		$html[] = 'document.getElementById("'.$Type_checkbox.'").style.display = "none";';
		$html[] = 'if (typeset == 1) {';
		$html[] = 'document.getElementById("'.$Type_checkbox.'").style.display = "block";';
		$html[] = '}';
//		$html[] = 'if (typeset == 0) {';
//		$html[] = 'document.getElementById("'.$Type_checkbox.'").style.display = "none";';
//		$html[] = '}';
		$html[] = '</script>';

		return implode("\n", $html);
	}
}
modal/icvalue_opt.php000060400000005524152456531770010704 0ustar00<?php
/**
 *------------------------------------------------------------------------------
 *  iCagenda v3 by Jooml!C - Events Management Extension for Joomla! 2.5 / 3.x
 *------------------------------------------------------------------------------
 * @package     com_icagenda
 * @copyright   Copyright (c)2012-2015 Cyril Rezé, Jooml!C - All rights reserved
 *
 * @license     GNU General Public License version 3 or later; see LICENSE.txt
 * @author      Cyril Rezé (Lyr!C)
 * @link        http://www.joomlic.com
 *
 * @version     3.2.9 2013-12-22
 * @since       3.2.3
 *------------------------------------------------------------------------------
*/

// No direct access to this file
defined('_JEXEC') or die();

jimport( 'joomla.filesystem.path' );
jimport('joomla.form.formfield');

class JFormFieldModal_icvalue_opt extends JFormField
{
	protected $type='modal_icvalue_opt';

	protected function getInput()
	{

		$replace = array("jform", "params", "[", "]");
		$name = str_replace($replace, "", $this->name);

		$Type = $this->value;

		if ($name == 'calendarclosebtn') {
			$default_text = JText::_( 'JTOOLBAR_DEFAULT' );
		} else {
			$default_text = JText::_( 'JGLOBAL_USE_GLOBAL' );
		}

		$Type_default = $name.'_default';
		$Type_content = $name.'_custom';

		$class_default = '';
		$class_custom = '';
		$checked_default = ' checked="checked"';
		$checked_custom = '';
		if ($Type == '0') {
			$class_default = 'btn-primary';
			$checked_default = ' checked="checked"';
			$checked_custom = '';
		}
		elseif ($Type == '1') {
			$class_custom = 'btn-success';
			$checked_default = '';
			$checked_custom = ' checked="checked"';
		} else {
			$class_default = 'btn-primary';
			$checked_default = ' checked="checked"';
			$checked_custom = '';
		}

		$html	= array();


		$html[]	= '<fieldset class="radio btn-group">';
		$html[]	= '<label class="'.$class_default.'">'.$default_text.'<input type="radio"  id="'.$name.'_0" name="'.$this->name.'" value="0"  onClick="icdefault_'.$name.'();"'.$checked_default.' /></label>';
		$html[]	= '<label class="'.$class_custom.'">'.JText::_( 'COM_ICAGENDA_LBL_CUSTOM_VALUE' ).'<input type="radio"  id="'.$name.'_1" name="'.$this->name.'" value="1"  onClick="iccustom_'.$name.'();"'.$checked_custom.' /></label>';
		$html[]	= '</fieldset>';


		$html[]	= '<script type="text/javascript">';
		$html[]	= 'var typeset = '.$Type.';';
		$html[]	= 'function icdefault_'.$name.'()';
		$html[]	= '{';
		$html[]	= 'document.getElementById("'.$Type_content.'").style.display = "none";';
		$html[]	= '$("#'.$name.'_0").attr("checked", "checked");';
		$html[]	= '}';
		$html[]	= 'function iccustom_'.$name.'()';
		$html[]	= '{';
		$html[]	= 'document.getElementById("'.$Type_content.'").style.display = "block";';
		$html[]	= '$("#'.$name.'_1").attr("checked", "checked");';
		$html[]	= '}';
		$html[]	= '</script>';

		return implode("\n", $html);
	}
}
modal/tos_type.php000060400000010641152456531770010234 0ustar00<?php
/**
 *------------------------------------------------------------------------------
 *  iCagenda v3 by Jooml!C - Events Management Extension for Joomla! 2.5 / 3.x
 *------------------------------------------------------------------------------
 * @package     com_icagenda
 * @copyright   Copyright (c)2012-2015 Cyril Rezé, Jooml!C - All rights reserved
 *
 * @license     GNU General Public License version 3 or later; see LICENSE.txt
 * @author      Cyril Rezé (Lyr!C)
 * @link        http://www.joomlic.com
 *
 * @version     3.2.0 2013-09-18
 * @since       3.2.0
 *------------------------------------------------------------------------------
*/

// No direct access to this file
defined('_JEXEC') or die();

jimport( 'joomla.filesystem.path' );
jimport('joomla.form.formfield');

class JFormFieldModal_tos_type extends JFormField
{
	protected $type='modal_tos_type';

	protected function getInput()
	{
		jimport('joomla.application.component.helper');

		$icagendaParams = JComponentHelper::getParams('com_icagenda');
		$tos_Type = $icagendaParams->get('tos_Type', '');
		$class_default = '';
		$class_article = '';
		$class_custom = '';
		$checked_default = '';
		$checked_article = '';
		$checked_custom = '';
		if ($tos_Type == '') {
			$class_default = 'btn-success';
			$checked_default = ' checked="checked"';
			$checked_article = '';
			$checked_custom = '';
		}
		elseif ($tos_Type == '1') {
			$class_article = 'btn-success';
			$checked_default = '';
			$checked_article = ' checked="checked"';
			$checked_custom = '';
		}
		elseif ($tos_Type == '2') {
			$class_custom = 'btn-success';
			$checked_default = '';
			$checked_article = '';
			$checked_custom = ' checked="checked"';
		} else {
			$class_default = 'btn-success';
			$checked_default = ' checked="checked"';
			$checked_article = '';
			$checked_custom = '';
		}

		$html	= array();
		$html[]	= '<fieldset class="radio btn-group">';
		$html[]	= '<label class="'.$class_default.'">'.JText::_( 'IC_DEFAULT' ).'<input type="radio"  id="tos_Type0" name="'.$this->name.'" value=""  onClick="tosdefault();"'.$checked_default.' /></label>';
		$html[]	= '<label class="'.$class_article.'">'.JText::_( 'IC_ARTICLE' ).'<input type="radio"  id="tos_Type1" name="'.$this->name.'" value="1"  onClick="tosarticle();"'.$checked_article.' /></label>';
		$html[]	= '<label class="'.$class_custom.'">'.JText::_( 'IC_CUSTOM_TEXT' ).'<input type="radio"  id="tos_Type2" name="'.$this->name.'" value="2"  onClick="toscustom();"'.$checked_custom.' /></label>';
		$html[]	= '</fieldset>';



		$html[]	= '<script type="text/javascript">';
//		$html[]	= 'var tos_Type0 = document.getElementById("tos_Type0").checked;';
//		$html[]	= 'var tos_Type1 = document.getElementById("tos_Type1").checked;';
//		$html[]	= 'var tos_Type2 = document.getElementById("tos_Type2").checked;';
//		$html[]	= 'if(tos_Type0==true)';
//		$html[]	= '{';
//		$html[]	= 'document.getElementByName("tos_Type").value = "";';
//		$html[]	= '$("#tos_Type1").attr("checked", "checked");';
//		$html[]	= '}';
//		$html[]	= 'if(tos_Type1==true)';
//		$html[]	= '{';
//		$html[]	= 'document.getElementByName("tos_Type").value = 1;';
//		$html[]	= '}';
//		$html[]	= 'if(tos_Type2==true)';
//		$html[]	= '{';
//		$html[]	= 'document.getElementByName("tos_Type").value = 2;';
//		$html[]	= '}';
//		$html[]	= '';
//		$html[]	= '';
		$html[]	= 'function tosdefault()';
		$html[]	= '{';
		$html[]	= 'document.getElementById("ic_default").style.display = "block";';
		$html[]	= 'document.getElementById("ic_article").style.display = "none";';
		$html[]	= 'document.getElementById("tos_custom").style.display = "none";';
		$html[]	= '$("#tos_Type0").attr("checked", "checked");';
		$html[]	= '}';
		$html[]	= 'function tosarticle()';
		$html[]	= '{';
		$html[]	= 'document.getElementById("ic_default").style.display = "none";';
		$html[]	= 'document.getElementById("ic_article").style.display = "block";';
		$html[]	= 'document.getElementById("tos_custom").style.display = "none";';
		$html[]	= '$("#tos_Type1").attr("checked", "checked");';
		$html[]	= '}';
		$html[]	= 'function toscustom()';
		$html[]	= '{';
		$html[]	= 'document.getElementById("ic_default").style.display = "none";';
		$html[]	= 'document.getElementById("ic_article").style.display = "none";';
		$html[]	= 'document.getElementById("tos_custom").style.display = "block";';
		$html[]	= '$("#tos_Type2").attr("checked", "checked");';
		$html[]	= '}';
		$html[]	= '</script>';

		return implode("\n", $html);
	}
}
modal/cat.php000060400000007206152456531770007140 0ustar00<?php
/**
 *------------------------------------------------------------------------------
 *  iCagenda v3 by Jooml!C - Events Management Extension for Joomla! 2.5 / 3.x
 *------------------------------------------------------------------------------
 * @package     com_icagenda
 * @copyright   Copyright (c)2012-2015 Cyril Rezé, Jooml!C - All rights reserved
 *
 * @license     GNU General Public License version 3 or later; see LICENSE.txt
 * @author      Cyril Rezé (Lyr!C)
 * @link        http://www.joomlic.com
 *
 * @version     3.4.1 2015-01-03
 * @since       1.0
 *------------------------------------------------------------------------------
*/

// No direct access to this file
defined('_JEXEC') or die();

jimport( 'joomla.filesystem.path' );
jimport('joomla.form.formfield');

class JFormFieldModal_cat extends JFormField
{
	protected $type='modal_cat';

	protected function getInput()
	{
		$app		= JFactory::getApplication();
		$session	= JFactory::getSession();

		// Initialize some field attributes.
		$class		= !empty($this->class) ? ' class="' . $this->class . '"' : '';

		if ($app->isAdmin())
		{
			$iCparams = JComponentHelper::getParams('com_icagenda');
		}
		else
		{
			$iCparams	= $app->getParams();
		}

		$orderby_catlist		= $iCparams->get('orderby_catlist', 'alpha');
		$default_catlist		= $iCparams->get('default_catlist', '');

		$admin_status_catlist	= $iCparams->get('admin_status_catlist', '1');
		$site_status_catlist	= $iCparams->get('site_status_catlist', '1');

		$admin_status_array		= is_array($admin_status_catlist) ? $admin_status_catlist : array($admin_status_catlist);
		$site_status_array		= is_array($site_status_catlist) ? $site_status_catlist : array($site_status_catlist);

		$admin_status			= implode(',', $admin_status_array);
		$site_status			= implode(',', $site_status_array);

		$catid = $session->get('ic_submit_catid', '');

		// Query List of Categories
		$db		= JFactory::getDbo();
		$query	= $db->getQuery(true);
		$query->select('c.ordering, c.title, c.state, c.id')
			->from('`#__icagenda_category` AS c');

		// Not display Trashed Categories
		$query->where('c.state <> -2');

		if ($app->isAdmin())
		{
			$query->where($db->qn('c.state') . ' IN (' . $admin_status . ') ');
		}
		else
		{
			$query->where($db->qn('c.state') . ' IN (' . $site_status . ') ');
		}

		if ($orderby_catlist == 'alpha')
		{
			$query->order('c.title ASC');
		}
		elseif ($orderby_catlist == 'ralpha')
		{
			$query->order('c.title DESC');
		}
		elseif ($orderby_catlist == 'order')
		{
			$query->order('c.ordering ASC');
		}

		$db->setQuery($query);
		$categories = $db->loadObjectList();

		$html = '<select id="' . $this->id . '" name="' . $this->name . '"' . $class . '>';

		$html.= ' <option value="">' . JTEXT::_('JOPTION_SELECT_CATEGORY') . '</option>';

		foreach ($categories as $c)
		{
			$html.= '<option value="' . $c->id . '"';

			if ($c->state == '0')
			{
				$html.= ' style="color:red"';
//				$c->title = '[' . $c->title . '] (' . JTEXT::_('JUNPUBLISHED') . ')';
				$c->title = '[' . $c->title . ']';
			}
			elseif ($c->state == '2')
			{
				$html.= ' style="color:orange"';
//				$c->title = $c->title . ' (' . JTEXT::_('JARCHIVED') . ')';
				$c->title = '[' . $c->title . ']';
			}

			if ($this->value == $c->id)
			{
				$html.= ' selected="selected"';
			}

			if ($catid == $c->id)
			{
				$html.= ' selected="selected"';
			}

			if (empty($this->value) && empty($catid)
				&& ($c->id == $default_catlist))
			{
				$html.= ' selected="selected"';
			}

			$html.= '>' . $c->title . '</option>';
		}

		$html.= '</select>';

		// clear the data so we don't process it again
		$session->clear('ic_submit_catid');

		return $html;
	}
}
modal/enddate.php000060400000003130152456531770007765 0ustar00<?php
/**
 *------------------------------------------------------------------------------
 *  iCagenda v3 by Jooml!C - Events Management Extension for Joomla! 2.5 / 3.x
 *------------------------------------------------------------------------------
 * @package     com_icagenda
 * @copyright   Copyright (c)2012-2015 Cyril Rezé, Jooml!C - All rights reserved
 *
 * @license     GNU General Public License version 3 or later; see LICENSE.txt
 * @author      Cyril Rezé (Lyr!C)
 * @link        http://www.joomlic.com
 *
 * @version     3.5.10 2015-08-13
 * @since       2.0.0
 *------------------------------------------------------------------------------
*/

// No direct access to this file
defined( '_JEXEC' ) or die( 'Restricted access' );

jimport( 'joomla.filesystem.path' );
jimport('joomla.form.formfield');

/**
 * Form Field to load a enddate datetime picker input
 *
 * @since	2.0.0
 */
class JFormFieldModal_enddate extends JFormField
{
	protected $type = 'modal_enddate';

	protected function getInput()
	{
		$class = ! empty($this->class) ? ' class="' . $this->class . '"' : '';

		$lang = JFactory::getLanguage();

		if ($lang->getTag() == 'fa-IR')
		{
			// Including fallback code for HTML5 non supported browsers.
			JHtml::_('jquery.framework');
			JHtml::_('script', 'system/html5fallback.js', false, true);

			$attributes = '';

			$html = JHtml::_('calendar', $this->value, $this->name, 'enddate_jalali', '%Y-%m-%d %H:%M:%S', $attributes);
		}
		else
		{
			$html ='<input type="text" id="enddate"' . $class . ' name="' . $this->name . '" value="' . $this->value . '"/>';
		}

		return $html;
	}
}
modal/icalert_msg.php000060400000012410152456531770010653 0ustar00<?php
/**
 *------------------------------------------------------------------------------
 *  iCagenda v3 by Jooml!C - Events Management Extension for Joomla! 2.5 / 3.x
 *------------------------------------------------------------------------------
 * @package     com_icagenda
 * @copyright   Copyright (c)2012-2015 Cyril Rezé, Jooml!C - All rights reserved
 *
 * @license     GNU General Public License version 3 or later; see LICENSE.txt
 * @author      Cyril Rezé (Lyr!C)
 * @link        http://www.joomlic.com
 *
 * @version     3.3.3 2014-04-12
 * @since       3.2.8
 *------------------------------------------------------------------------------
*/

// No direct access to this file
defined('_JEXEC') or die();

jimport( 'joomla.filesystem.path' );
jimport('joomla.form.formfield');

class JFormFieldModal_icalert_msg extends JFormField
{
	protected $type='modal_icalert_msg';

	protected function getLabel()
	{
		return ' ';
	}

	protected function getInput()
	{
		$replace = array("jform", "params", "[", "]");
		$name_input = str_replace($replace, "", $this->name);
		$get_error = explode('_', $name_input);
		$error = $get_error['1'];
		$name = $get_error['0'];

		$url=JPATH_SITE.'/components/com_icagenda/themes/packs';

		// Set Function to condition to be checked
		$events_php=$this->getList($url);
		$cal_date=$this->getCalDate($url);

		if ($name == 'eventsfile')
		{
			$list = $events_php;
			$doc_url = 'http://www.icagenda.com/theme-pack-upgrade/3-2-8-new-option-all-dates';
			$parent_field = 'datesDisplay';
			$action_value = '1';
		}
		elseif ($name == 'caldate')
		{
			$list = $cal_date;
			$doc_url = 'http://www.icagenda.com/theme-pack-upgrade/3-3-3-change-cal-date-to-data-cal-date';
			$parent_field = 'setTodayTimezone';
			$action_value = '';
		}

		$span_style	= 'input-xlarge';

		if (version_compare(JVERSION, '3.0', 'lt')) {
			$listP		= implode('<br /> - ', $list);
			$setlist	= ' - '.$listP.' ';
		} else {
			$listP		= implode('</li><li>', $list);
			$setlist	= '<ul><li>'.$listP.'</li></ul>';
//			$span_style	= 'span8';
		}

		$html	= array();

		if (count($list) >= 1)
		{
			$html[]	= '<div id="icalert_'.$this->id.'" class="'.$span_style.' alert alert-error" style="clear:both">';
			$html[]	=  '<b>'.JText::_( $this->title ).'</b>';
			$html[]	= '<p>';
			$html[]	=  JText::_( $this->description ) . ' <a class="modal" rel="{size: {x: 700, y: 500}, handler:\'iframe\'}" href="'.$doc_url.'">' .JText::_( 'IC_MORE_INFORMATION' ). '</a>';
			$html[]	= '</p>';

			if ($this->id == 'jform_params_'.$name.'_error')
			{
				$html[]	= '<p>';
				$html[]	= '<b><i>'.JText::_( 'COM_ICAGENDA_EVENTS_PHPFILE_MISSING_PACKS_LIST' ).'</i></b><br />';
				$html[]	= $setlist;
				$html[]	= '</p>';
			}
			$html[]	= '</div>';

			$html[] = '<script type="text/javascript">';
			$html[]	= '		var icdisplay = document.getElementById("jform_params_'.$parent_field.'").value;';
			$html[] = '		document.getElementById("icalert_'.$this->id.'").style.display = "none";';
			$html[] = '		if (icdisplay == "'.$action_value.'") {';
			$html[] = '			document.getElementById("icalert_'.$this->id.'").style.display = "block";';
			$html[] = '		}';
			$html[]	= '	function icalert()';
			$html[]	= '	{';
			$html[]	= '		var icdisplay = document.getElementById("jform_params_'.$parent_field.'").value;';
			$html[] = '		document.getElementById("icalert_'.$this->id.'").style.display = "none";';
			$html[] = '		if (icdisplay == "'.$action_value.'") {';
			$html[] = '			document.getElementById("icalert_'.$this->id.'").style.display = "block";';
			$html[] = '		}';
			$html[]	= '	}';
			$html[] = '</script>';
		}

		return implode("\n", $html);
	}

	/**
	 * Function to check if the file 'THEME_events.php' exists in each Theme Pack
	 */
	function getList($dirname)
	{
		$arrayfiles = Array();

		if(file_exists($dirname))
		{
			$handle = opendir($dirname);

			while (false !== ($file = readdir($handle)))
			{
				if ( !is_file($dirname.$file)
					&& $file!= '.'
					&& $file!='..'
					&& $file!='index.php'
					&& $file!='index.html'
					&& $file!='.DS_Store'
					&& $file!='.thumbs' )
				{
					if (!file_exists($dirname.'/'.$file.'/'.$file.'_events.php'))
					{
						array_push($arrayfiles,$file);
					}
				}
			}
			$handle = closedir($handle);
		}
		sort($arrayfiles);

		return $arrayfiles;
	}

	/**
	 * Function to check if 'data-cal-date' is defined inside the file 'THEME_day.php' for each Theme Pack.
	 * Returns an alert if deprecated 'cal_date' found.
	 */
	function getCalDate($dirname)
	{
		$arrayfiles = Array();

		if (ini_get('allow_url_fopen'))
		{
			if (file_exists($dirname))
			{
				$handle = opendir($dirname);

				while (false !== ($file = readdir($handle)))
				{
					if ( !is_file($dirname.$file)
						&& $file!= '.'
						&& $file!='..'
						&& $file!='index.php'
						&& $file!='index.html'
						&& $file!='.DS_Store'
						&& $file!='.thumbs' )
					{
						$t_day = $dirname.'/'.$file.'/'.$file.'_day.php';
						$file_t_day = file_get_contents($t_day);

						if (!strpos($file_t_day, "cal_date")
							&& !strpos($file_t_day, "data-cal-date"))
						{
							array_push($arrayfiles,$file);
						}
						elseif (strpos($file_t_day, "cal_date"))
						{
							array_push($arrayfiles,$file);
						}
					}
				}
			}
			$handle = closedir($handle);
		}
		sort($arrayfiles);

		return $arrayfiles;
	}

}
modal/ictext_content.php000060400000004165152456531770011424 0ustar00<?php
/**
 *------------------------------------------------------------------------------
 *  iCagenda v3 by Jooml!C - Events Management Extension for Joomla! 2.5 / 3.x
 *------------------------------------------------------------------------------
 * @package     com_icagenda
 * @copyright   Copyright (c)2012-2015 Cyril Rezé, Jooml!C - All rights reserved
 *
 * @license     GNU General Public License version 3 or later; see LICENSE.txt
 * @author      Cyril Rezé (Lyr!C)
 * @link        http://www.joomlic.com
 *
 * @version     3.2.0.1 2013-09-22
 * @since       3.2.0.1
 *------------------------------------------------------------------------------
*/

// No direct access to this file
defined('_JEXEC') or die();

jimport( 'joomla.filesystem.path' );
jimport('joomla.form.formfield');

class JFormFieldModal_ictext_content extends JFormField
{
	protected $type='modal_ictext_content';

	protected function getInput()
	{

		jimport('joomla.application.component.helper');
		$icagendaParams = JComponentHelper::getParams('com_icagenda');

		$Explode = explode('_', $this->name);
		$TypeName = $Explode[0].']';

		$replace = array("jform", "[", "]");
		$name = str_replace($replace, "", $TypeName);
		$icContent = $icagendaParams->get($name.'_Content', '');

		$Type = $icagendaParams->get($name, '');

		$Type_default = $name.'_default';
		$Type_content = $name.'_custom';


		$editor = JFactory::getEditor();

		$html	= array();

		$html[] = '<div id="'.$Type_content.'"><fieldset class="span9 iCleft">';
		$html[] = $editor->display($this->name, $icContent, "100%", "300", "300", "20", 1, null, null, null, array('mode' => 'advanced'));
		$html[] = '</fieldset></div>';

		if ($Type == '2') {
			$html[] = '<script type="text/javascript">';
//			$html[] = 'document.getElementById("'.$Type_default.'").style.display = "none";';
			$html[] = 'document.getElementById("'.$Type_content.'").style.display = "block";';
			$html[] = '</script>';
		} else {
			$html[] = '<script type="text/javascript">';
			$html[] = 'document.getElementById("'.$Type_content.'").style.display = "none";';
			$html[] = '</script>';
		}

		return implode("\n", $html);
	}
}
modal/iclink_type.php000060400000010042152456531770010673 0ustar00<?php
/**
 *------------------------------------------------------------------------------
 *  iCagenda v3 by Jooml!C - Events Management Extension for Joomla! 2.5 / 3.x
 *------------------------------------------------------------------------------
 * @package     com_icagenda
 * @copyright   Copyright (c)2012-2015 Cyril Rezé, Jooml!C - All rights reserved
 *
 * @license     GNU General Public License version 3 or later; see LICENSE.txt
 * @author      Cyril Rezé (Lyr!C)
 * @link        http://www.joomlic.com
 *
 * @version     3.5.1 2015-02-27
 * @since       3.3.3
 *------------------------------------------------------------------------------
*/

// No direct access to this file
defined('_JEXEC') or die();

jimport( 'joomla.filesystem.path' );
jimport('joomla.form.formfield');

class JFormFieldModal_iclink_type extends JFormField
{
	protected $type='modal_iclink_type';

	protected function getInput()
	{
		jimport('joomla.application.component.helper');

		$location = JRequest::getVar('option', 'com_config');

		if ($location != 'com_config')
		{
			$default_text	= JText::_('JGLOBAL_USE_GLOBAL');
		}
		else
		{
			$default_text = JText::_("IC_DEFAULT");
		}

		// Get Type value
		$Type			= isset($this->value) ? $this->value : '';

		// Clean jform name
		$replace		= array("jform", "params", "[", "]");
		$name			= str_replace($replace, "", $this->name);

		$Type_default	= $name . '_default';
		$Type_article	= $name . '_article';
		$Type_url		= $name . '_url';

		// Set Var type, to get selected option
		JRequest::setVar('type', $Type);

		// Article
		if ($Type == '1')
		{
			$class_default		= '';
			$class_article		= 'btn-success';
			$class_url			= '';
			$checked_default	= '';
			$checked_article	= ' checked="checked"';
			$checked_url		= '';
		}

		// URL
		elseif ($Type == '2')
		{
			$class_default		= '';
			$class_article		= '';
			$class_url			= 'btn-success';
			$checked_default	= '';
			$checked_article	= '';
			$checked_url		= ' checked="checked"';
		}

		// iCagenda default
		else
		{
			$class_default		= 'btn-primary';
			$class_article		= '';
			$class_url			= '';
			$checked_default	= ' checked="checked"';
			$checked_article	= '';
			$checked_url		= '';
		}

		$html	= array();
		$html[]	= '<fieldset class="radio btn-group">';
		$html[]	= '<label class="' . $class_default . '">' . $default_text . '<input type="radio"  id="' . $name . '_0" name="' . $this->name . '" value=""  onClick="icdefault_' . $name . '();"' . $checked_default . ' /></label>';
		$html[]	= '<label class="' . $class_article . '">' . JText::_( 'COM_ICAGENDA_REGISTRATION_LINK_ARTICLE' ) . '<input type="radio"  id="' . $name . '_1" name="' . $this->name . '" value="1"  onClick="icarticle_' . $name . '();"' . $checked_article . ' /></label>';
		$html[]	= '<label class="' . $class_url . '">' . JText::_( 'COM_ICAGENDA_REGISTRATION_LINK_URL' ) . '<input type="radio"  id="' . $name . '_2" name="' . $this->name . '" value="2"  onClick="icurl_' . $name . '();"' . $checked_url . ' /></label>';
		$html[]	= '</fieldset>';

		// Script
		$html[]	= '<script type="text/javascript">';
		$html[]	= 'function icdefault_' . $name . '()';
		$html[]	= '{';
		$html[]	= 'document.getElementById("' . $Type_article . '").style.display = "none";';
		$html[]	= 'document.getElementById("' . $Type_url . '").style.display = "none";';
//		$html[]	= '$("#'.$name.'_0").attr("checked", "checked");';
		$html[]	= '}';
		$html[]	= 'function icarticle_' . $name . '()';
		$html[]	= '{';
		$html[]	= 'document.getElementById("' . $Type_article . '").style.display = "block";';
		$html[]	= 'document.getElementById("' . $Type_url . '").style.display = "none";';
//		$html[]	= '$("#'.$name.'_1").attr("checked", "checked");';
		$html[]	= '}';
		$html[]	= 'function icurl_' . $name . '()';
		$html[]	= '{';
		$html[]	= 'document.getElementById("' . $Type_article . '").style.display = "none";';
		$html[]	= 'document.getElementById("' . $Type_url . '").style.display = "block";';
//		$html[]	= '$("#'.$name.'_2").attr("checked", "checked");';
		$html[]	= '}';
		$html[]	= '</script>';

		return implode("\n", $html);
	}
}
modal/index.html000060400000000032152456531770007643 0ustar00<html><body></body></html>modal/iclink_article.php000060400000016067152456531770011352 0ustar00<?php
/**
 *------------------------------------------------------------------------------
 *  iCagenda v3 by Jooml!C - Events Management Extension for Joomla! 2.5 / 3.x
 *------------------------------------------------------------------------------
 * @package     com_icagenda
 * @copyright   Copyright (c)2012-2015 Cyril Rezé, Jooml!C - All rights reserved
 *
 * @license     GNU General Public License version 3 or later; see LICENSE.txt
 * @author      Cyril Rezé (Lyr!C)
 * @link        http://www.joomlic.com
 *
 * @version     3.5.1 2015-02-27
 * @since       3.3.3
 *------------------------------------------------------------------------------
*/

// No direct access to this file
defined('_JEXEC') or die();

jimport( 'joomla.filesystem.path' );
jimport('joomla.form.formfield');

/**
 * Supports a modal article picker.
 */
class JFormFieldModal_iclink_article extends JFormField
{
	/**
	 * The form field type.
	 */
	protected $type = 'modal_iclink_article';

	/**
	 * Method to get the field input markup.
	 */
	protected function getInput()
	{
		jimport('joomla.application.component.helper');
		$icagendaParams	= JComponentHelper::getParams('com_icagenda');

		$Explode		= explode('_', $this->name);
		$TypeName		= $Explode[0] . ']';

		$replace		= array("jform", "params", "[", "]");
		$name			= str_replace($replace, "", $TypeName);

//		$Type = JRequest::getVar('type');

		$allowEdit		= ((string) $this->element['edit'] == 'true') ? true : false;
		$allowClear		= ((string) $this->element['clear'] != 'false') ? true : false;

		// Load language
		JFactory::getLanguage()->load('com_content', JPATH_ADMINISTRATOR);

		// Load the modal behavior script.
		JHtml::_('behavior.modal', 'a.modal');

		// Build the script.
		$script = array();

		// Select button script
		$script[] = '	function jSelectArticle_'.$this->id.'(id, title, catid, object) {';
		$script[] = '		document.getElementById("'.$this->id.'_id").value = id;';
		$script[] = '		document.getElementById("'.$this->id.'_name").value = title;';

		if ($allowEdit)
		{
			$script[] = '		jQuery("#'.$this->id.'_edit").removeClass("hidden");';
		}

		if ($allowClear)
		{
			$script[] = '		jQuery("#'.$this->id.'_clear").removeClass("hidden");';
		}

		$script[] = '		SqueezeBox.close();';
		$script[] = '	}';

		// Clear button script
		static $scriptClear;

		if ($allowClear && !$scriptClear)
		{
			$scriptClear = true;

			$script[] = '	function jClearArticle(id) {';
			$script[] = '		document.getElementById(id + "_id").value = "";';
			$script[] = '		document.getElementById(id + "_name").value = "'.htmlspecialchars(JText::_('COM_CONTENT_SELECT_AN_ARTICLE', true), ENT_COMPAT, 'UTF-8').'";';
			$script[] = '		jQuery("#"+id + "_clear").addClass("hidden");';
			$script[] = '		if (document.getElementById(id + "_edit")) {';
			$script[] = '			jQuery("#"+id + "_edit").addClass("hidden");';
			$script[] = '		}';
			$script[] = '		return false;';
			$script[] = '	}';
		}

		// Add the script to the document head.
		JFactory::getDocument()->addScriptDeclaration(implode("\n", $script));

		// Setup variables for display.
		$html	= array();
		$link	= 'index.php?option=com_content&amp;view=articles&amp;layout=modal&amp;tmpl=component&amp;function=jSelectArticle_'.$this->id;

		if (isset($this->element['language']))
		{
			$link .= '&amp;forcedLanguage='.$this->element['language'];
		}

		$db	= JFactory::getDbo();
		$db->setQuery(
			'SELECT title' .
			' FROM #__content' .
			' WHERE id = '.(int) $this->value
		);

		try
		{
			$title = $db->loadResult();
		}
		catch (RuntimeException $e)
		{
			JError::raiseWarning(500, $e->getMessage());
		}

		if (empty($title))
		{
			$title = JText::_('COM_CONTENT_SELECT_AN_ARTICLE');
		}
		$title = htmlspecialchars($title, ENT_QUOTES, 'UTF-8');

		// The active article id field.
		if (0 == (int) $this->value)
		{
			$value = '';
		}
		else
		{
			$value = (int) $this->value;
		}

		// The current article display field.
		$html[] = '<div id="'.$name.'_article"><fieldset class="span9 iCleft"><div>&nbsp;</div><span class="input-append">';
		$html[] = '<input type="text" class="input-medium" style="margin:0px" id="'.$this->id.'_name" value="'.$title.'" disabled="disabled" size="35" />';

		if(version_compare(JVERSION, '3.0', 'lt'))
		{
			$html[] = '<a class="modal btn hasTooltip" title="'.JText::_('COM_CONTENT_CHANGE_ARTICLE').'"  href="'.$link.'&amp;'.JSession::getFormToken().'=1" rel="{handler: \'iframe\', size: {x: 800, y: 450}}">'.JText::_('JSELECT').'</a>';
		}
		else
		{
			$html[] = '<a class="modal btn hasTooltip" title="'.JHtml::tooltipText('COM_CONTENT_CHANGE_ARTICLE').'"  href="'.$link.'&amp;'.JSession::getFormToken().'=1" rel="{handler: \'iframe\', size: {x: 800, y: 450}}"><i class="icon-file"></i> '.JText::_('JSELECT').'</a>';
		}

		// Edit article button
		if ($allowEdit)
		{
			if(version_compare(JVERSION, '3.0', 'lt'))
			{
				$html[] = '<a class="btn hasTooltip'.($value ? '' : ' hidden').'" href="index.php?option=com_content&view=article&layout=edit&id=' . $value. '" target="_blank" title="'.JText::_('COM_CONTENT_EDIT_ARTICLE').'" alt="'.JText::_('COM_CONTENT_EDIT_ARTICLE').'" >' . JText::_('JACTION_EDIT') . '</a>';
			}
			else
			{
				$html[] = '<a class="btn hasTooltip'.($value ? '' : ' hidden').'" href="index.php?option=com_content&layout=modal&tmpl=component&task=article.edit&id=' . $value. '" target="_blank" title="'.JHtml::tooltipText('COM_CONTENT_EDIT_ARTICLE').'" ><span class="icon-edit"></span> ' . JText::_('JACTION_EDIT') . '</a>';
			}
		}

		// Clear article button
		if ($allowClear)
		{
			if(version_compare(JVERSION, '3.0', 'lt'))
			{
				$html[] = '<a id="'.$this->id.'_clear" class="btn'.($value ? '' : ' hidden').'" onclick="return jClearArticle(\''.$this->id.'\')">' . JText::_('JCLEAR') . '</a>';
			}
			else
			{
				$html[] = '<button id="'.$this->id.'_clear" class="btn'.($value ? '' : ' hidden').'" onclick="return jClearArticle(\''.$this->id.'\')"><span class="icon-remove"></span> ' . JText::_('JCLEAR') . '</button>';
			}
		}

		$html[] = '</span>';

		// class='required' for client side validation
		$class = '';
		if ($this->required)
		{
			$class = ' class="required modal-value"';
		}


		$html[] = '<input type="hidden" id="'.$this->id.'_id"'.$class.' name="'.$this->name.'" value="'.$value.'" /></fieldset></div>';

//		if ($Type == '1')
//		{
//			$html[] = '<script type="text/javascript">';
//			$html[] = 'document.getElementById("'.$name.'_article").style.display = "block";';
//			$html[] = 'document.getElementById("'.$name.'_url").style.display = "none";';
//			$html[] = '</script>';
//		}
//		elseif ($Type == '2')
//		{
//			$html[] = '<script type="text/javascript">';
//			$html[] = 'document.getElementById("'.$name.'_article").style.display = "none";';
//			$html[] = 'document.getElementById("'.$name.'_url").style.display = "block";';
//			$html[] = '</script>';
//		}
//		else
//		{
//			$html[] = '<script type="text/javascript">';
//			$html[] = 'document.getElementById("'.$name.'_article").style.display = "none";';
//			$html[] = 'document.getElementById("'.$name.'_url").style.display = "none";';
//			$html[] = '</script>';
//		}

		return implode("\n", $html);
	}
}
modal/tos_content.php000060400000004037152456531770010727 0ustar00<?php
/**
 *------------------------------------------------------------------------------
 *  iCagenda v3 by Jooml!C - Events Management Extension for Joomla! 2.5 / 3.x
 *------------------------------------------------------------------------------
 * @package     com_icagenda
 * @copyright   Copyright (c)2012-2015 Cyril Rezé, Jooml!C - All rights reserved
 *
 * @license     GNU General Public License version 3 or later; see LICENSE.txt
 * @author      Cyril Rezé (Lyr!C)
 * @link        http://www.joomlic.com
 *
 * @version     3.2.0 2013-09-18
 * @since       3.2.0
 *------------------------------------------------------------------------------
*/

// No direct access to this file
defined('_JEXEC') or die();

jimport( 'joomla.filesystem.path' );
jimport('joomla.form.formfield');

class JFormFieldModal_tos_content extends JFormField
{
	protected $type='modal_tos_content';

//	protected function getLabel()
//	{
//	   return ' ';
//	}

	protected function getInput()
	{

		jimport('joomla.application.component.helper');
		$icagendaParams = JComponentHelper::getParams('com_icagenda');
		$tosContent = $icagendaParams->get('tosContent', '');
		$tos_Type = $icagendaParams->get('tos_Type', '');


		$editor = JFactory::getEditor();
//		$editor = JEditor::getEditor();

		$html	= array();

		$html[] = '<div id="tos_custom"><fieldset class="span9 iCleft">';
		$html[] = $editor->display($this->name, $tosContent, "100%", "300", "300", "20", 1, null, null, null, array('mode' => 'advanced'));
		$html[] = '</fieldset></div>';

		if ($tos_Type == '2') {
			$html[] = '<script type="text/javascript">';
			$html[] = 'document.getElementById("ic_default").style.display = "none";';
			$html[] = 'document.getElementById("ic_article").style.display = "none";';
			$html[] = 'document.getElementById("tos_custom").style.display = "block";';
			$html[] = '</script>';
		} else {
			$html[] = '<script type="text/javascript">';
			$html[] = 'document.getElementById("tos_custom").style.display = "none";';
			$html[] = '</script>';
		}

		return implode("\n", $html);
	}
}
modal/evt.php000060400000030331152456531770007162 0ustar00<?php
/**
 *------------------------------------------------------------------------------
 *  iCagenda v3 by Jooml!C - Events Management Extension for Joomla! 2.5 / 3.x
 *------------------------------------------------------------------------------
 * @package     com_icagenda
 * @copyright   Copyright (c)2012-2015 Cyril Rezé, Jooml!C - All rights reserved
 *
 * @license     GNU General Public License version 3 or later; see LICENSE.txt
 * @author      Cyril Rezé (Lyr!C)
 * @link        http://www.joomlic.com
 *
 * @version     3.5.9 2015-08-01
 * @since       3.3.3
 *------------------------------------------------------------------------------
*/

// No direct access to this file
defined('_JEXEC') or die();

jimport( 'joomla.filesystem.path' );
jimport('joomla.form.formfield');

class JFormFieldModal_evt extends JFormField
{
	protected $type = 'modal_evt';

	protected function getInput()
	{
		$jinput		= JFactory::getApplication()->input;
		$view		= $jinput->get('view');
		$id			= $jinput->get('id', null);
		$eventid	= $jinput->get('eventid', $this->value);

		$class		= isset($this->class) ? ' class="' . $this->class . '"' : '';

		$typeReg = $db_date = $db_period = $db_date_is_valid = '';

		$db		= JFactory::getDbo();
		$query	= $db->getQuery(true);
		$query->select('e.title, e.state, e.id, e.weekdays, e.params')
			->from('`#__icagenda_events` AS e');

		if ($view == 'mail')
		{
			// Join Total of registrations
			$query->select('r.count AS registered');
			$sub_query = $db->getQuery(true);
			$sub_query->select('r.state, r.date AS reg_date, r.period AS reg_period, r.eventid, sum(r.people) AS count');
			$sub_query->from('`#__icagenda_registration` AS r');
			$sub_query->where('r.state = 1');
			$sub_query->where('r.email <> ""');
			$sub_query->group('r.eventid');
			$query->leftJoin('(' . (string) $sub_query . ') AS r ON (e.id = r.eventid)');
			$query->where('r.count > 0');
		}

		$query->order('e.title ASC');

		$db->setQuery($query);
		$events	= $db->loadObjectList();

		if ($eventid != 0 && $view == 'registration')
		{
			$query	= $db->getQuery(true);
			$query->select('r.date AS reg_date, r.period AS reg_period')
				->from('`#__icagenda_registration` AS r');
			$query->where('r.eventid = ' . (int) $eventid);
			$query->where('r.id = ' . (int) $id);
			$db->setQuery($query);
			$reg	= $db->loadObject();
			$db_date			= $reg->reg_date;
			$db_date_is_valid	= iCDate::isDate($db_date);
			$db_period			= $reg->reg_period;
		}

		// User state used in Newsletter
		$data				= JFactory::getApplication()->getUserState('com_icagenda.mail.data', array());
		$session_eventid	= isset($data['eventid']) ? $data['eventid'] : $eventid;
		$session_date		= isset($data['date']) ? $data['date'] : '';

		$html = '<div style="margin-bottom: 10px">';
		$html.= '<select id="' . $this->id . '_id"' . $class . ' name="' .
			$this->name . '">';

		$value = isset($this->value) ? $this->value : '';

		$html.= '<option value=""';

		if ( ! $id || ! $this->value)
		{
			$html.= ' selected="selected"';
		}

		$html.= '>' . JText::_('COM_ICAGENDA_SELECT_EVENT') . '</option>';

		foreach ($events as $e)
		{
			if ($e->state == '1')
			{
				$html.= '<option value="' . $e->id . '"';

				if ($eventid == $e->id)
				{
					$eventparam			= new JRegistry($e->params);
					$typeReg			= $eventparam->get('typeReg', 1);
					$weekdays			= $e->weekdays;

					$html.= ' selected="selected"';
				}

				if ($view == 'registration')
				{
					$html.= '>' . $e->title . ' (id:' . $e->id . ')</option>';
				}
				else
				{
					$html.= '>' . $e->title . ' (&#10003;' . $e->registered . ' - id:' . $e->id . ')</option>';
				}
			}
			elseif ($eventid == $e->id)
			{
				$html.= '<option value="' . $value . '"';
				$html.= ' selected="selected"';
				$html.= '>' . JText::_('COM_ICAGENDA_REGISTRATION_EVENT_NOT_PUBLISHED') . '</option>';
			}
		}

		$html.= '</select>';
		$html.= '</div>';

		$id_display = $id ? '&id=' . (int) $id : '';

		if ($view == 'registration')
		{
			// Info message with 'Registration Type' option setting, if the saved date is not in the list of dates for selected event.
			if ($typeReg == 1)
			{
				$reg_type = JText::_('COM_ICAGENDA_REG_BY_INDIVIDUAL_DATE');
			}
			elseif ($typeReg == 2)
			{
				$reg_type = JText::_('COM_ICAGENDA_REG_FOR_ALL_DATES');
			}
			else
			{
				$reg_type = JText::_('COM_ICAGENDA_REG_BY_DATE_OR_PERIOD');
			}

			$registration_type = '<strong>' . $reg_type . '</strong>';

			$alert_reg_type = '<div class="alert alert-info">';
			$alert_reg_type.= '<small>' . JText::sprintf('COM_ICAGENDA_REGISTRATION_TYPE_FOR_THIS_EVENT', $registration_type) . '</small>';
			$alert_reg_type.= '</div>';
			$alert_reg_type = addslashes($alert_reg_type);

			// Alert message for a date saved with a version before 3.3.3 (date not formatted as expected in sql format)
			$date_no_longer_exists = '<strong>"' . $db_date . '"</strong>';
			$alert_date_format = '<div class="ic-alert ic-alert-note"><span class="iCicon-info"></span> <strong>' . JText::_('NOTICE') . '</strong><br />' . JText::sprintf('COM_ICAGENDA_REGISTRATION_ERROR_DATE_CONTROL', $date_no_longer_exists) . '</div>';
			$alert_date_format = addslashes($alert_date_format);

			// Alert message if a date does not exist anymore for the selected event
			$alert_date_no_longer_exists = '<div class="alert alert-error"><strong>' . JText::_('COM_ICAGENDA_FORM_WARNING') . '</strong><br /><small>' . JText::sprintf('COM_ICAGENDA_REGISTRATION_DATE_NO_LONGER_EXISTS', $date_no_longer_exists) . '</small></div>';
			$alert_date_no_longer_exists = addslashes($alert_date_no_longer_exists);

			// Alert message if a date does not exist anymore for the selected event
			$alert_full_period_no_longer_exists = '<div class="alert alert-error"><strong>' . JText::_('COM_ICAGENDA_FORM_WARNING') . '</strong><br /><small>' . JText::sprintf('COM_ICAGENDA_REGISTRATION_PERIOD_NO_LONGER_EXISTS', $date_no_longer_exists) . '</small></div>';
			$alert_full_period_no_longer_exists = addslashes($alert_full_period_no_longer_exists);

			// Alert message if a date or period is set for the registration, but event registration type is now 'for all dates of the event'
			$for_all_dates = '<strong>' . JText::_('COM_ICAGENDA_ADMIN_REGISTRATION_FOR_ALL_DATES') . '</strong>';
			$alert_by_date_no_longer_possible = '<div class="alert alert-error"><strong>' . JText::_('COM_ICAGENDA_FORM_WARNING') . '</strong><br /><small>' . JText::sprintf('COM_ICAGENDA_REGISTRATION_BY_DATE_NO_LONGER_POSSIBLE', $for_all_dates, $for_all_dates) . '</small></div>';
			$alert_by_date_no_longer_possible = addslashes($alert_by_date_no_longer_possible);

			// Alert message if registration for all dates of the event, but event registration type is now 'select list of dates'
			$by_date = '<strong>' . JText::_('COM_ICAGENDA_ADMIN_REGISTRATION_BY_INDIVIDUAL_DATE') . '</strong>';
			$alert_for_all_dates_no_longer_possible = '<div class="alert alert-error"><strong>' . JText::_('COM_ICAGENDA_FORM_WARNING') . '</strong><br /><small>' . JText::sprintf('COM_ICAGENDA_REGISTRATION_FOR_ALL_DATES_NO_LONGER_POSSIBLE', $by_date) . '</small></div>';
			$alert_for_all_dates_no_longer_possible = addslashes($alert_for_all_dates_no_longer_possible);

			$html.= '<div id="date-alert">';
			$html.= '</div>';

			if ($typeReg == '1')
			{
				?>
				<script type="text/javascript">
					jQuery(document).ready(function($) {
						var value = $('#jform_date_id').val(),
							db_date = '<?php echo $db_date; ?>',
							db_period = '<?php echo $db_period; ?>',
							db_weekdays = '<?php echo $weekdays; ?>',
							db_date_is_valid = '<?php echo $db_date_is_valid; ?>',
							alert_reg_type = '<?php echo $alert_reg_type; ?>',
							alert_date_format = '<?php echo $alert_date_format; ?>',
							alert_date_no_longer_exists = '<?php echo $alert_date_no_longer_exists; ?>',
							alert_full_period_no_longer_exists = '<?php echo $alert_full_period_no_longer_exists; ?>',
							alert_for_all_dates_no_longer_possible = '<?php echo $alert_for_all_dates_no_longer_possible; ?>';

						if ( db_date == '' && db_period == '1' ) {
							// Registration for all dates, not possible if registration type is per date
							$('#date-alert').html(alert_reg_type+alert_for_all_dates_no_longer_possible);
						}
						else if ( !db_date_is_valid && db_date !== '' ) {
							// Date is not empty, but not a valid sql format (registration before release 3.3.3)
							$('#date-alert').html(alert_reg_type+alert_date_format);
						}
						else if ( db_date !== value && db_period !== '0') {
							// Date is not empty, but date is not anymore set for this event
							$('#date-alert').html(alert_date_no_longer_exists);
						}
						else if ( db_date == '' && db_period == '0' &&
							db_weekdays !== '' && db_weekdays !== '0') {
							// Date is not empty, but date is not anymore set for this event
							$('#date-alert').html(alert_full_period_no_longer_exists);
						}

						$('#jform_date_id').change(function(e) {
							$('#jform_period').val('0');
							$('#date-alert').html('');
						});
					});
				</script>
				<?php
			}
			elseif ($typeReg == '2')
			{
				?>
				<script type="text/javascript">
					jQuery(document).ready(function($) {
						var value = $('#jform_date_id').val(),
							db_date = '<?php echo $db_date; ?>',
							db_period = '<?php echo $db_period; ?>',
							alert_reg_type = '<?php echo $alert_reg_type; ?>',
							alert_by_date_no_longer_possible = '<?php echo $alert_by_date_no_longer_possible; ?>';

						$('#date-alert').html(alert_reg_type);

						if ( db_period !== '1' ) {
							// Date is empty, not possible if registration type is per date
							$('#date-alert').html(alert_reg_type+alert_by_date_no_longer_possible);
						}

						$('#jform_date_id').change(function(e) {
//							if ( value == 'update' ) {
								$('#jform_period').val('1');
								$('#date-alert').html('');
//							}
						});
					});
				</script>
			<?php
			}
		}
		?>
		<script type="text/javascript">
		jQuery(document).ready(function($) {
			var view = '<?php echo $view; ?>',
				regid = '<?php echo $id; ?>',
				eventid = '<?php echo $session_eventid; ?>',
				date = '<?php echo $session_date; ?>',
				list_target_id = 'jform_date_id',
				list_select_id = '<?php echo $this->id; ?>_id',
				initial_target_html = '<option value=""><?php echo JText::_("COM_ICAGENDA_SELECT_NO_EVENT_SELECTED"); ?>...</option>',
				loading = '<?php echo JText::_("IC_LOADING"); ?>';

			if (eventid) {
				$('#'+list_target_id).removeAttr('readonly');
				$('#'+list_target_id).val(date);

				$.ajax({url: 'index.php?option=com_icagenda&task='+view+'.dates&eventid='+eventid+'&regid='+regid,
					success: function(output) {
							$('#'+list_target_id).html(output);
					},
					error: function (xhr, ajaxOptions, thrownError) {
							alert(xhr.status + " "+ thrownError);
					}
				});

				$('#'+list_select_id).change(function(e) {
					$('#'+list_target_id).removeAttr('readonly');

					var selectvalue = $(this).val();

					$('#'+list_target_id).html('<option value="">'+loading+'</option>');

					if (selectvalue == "") {
						$('#'+list_target_id).attr('readonly', 'true');
						$('#'+list_target_id).html(initial_target_html);
					} else {
						$.ajax({url: 'index.php?option=com_icagenda&task='+view+'.dates&eventid='+selectvalue+'&regid='+regid,
							success: function(output) {
									$('#'+list_target_id).html(output);
							},
							error: function (xhr, ajaxOptions, thrownError) {
									alert(xhr.status + " "+ thrownError);
							}
						});
					}
				});
			} else {
				$('#'+list_target_id).attr('readonly', 'true');
				$('#'+list_target_id).html(initial_target_html);

				$('#'+list_select_id).change(function(e) {
					$('#'+list_target_id).removeAttr('readonly');

					var selectvalue = $(this).val();

					$('#'+list_target_id).html('<option value="">'+loading+'</option>');

					if (selectvalue == "") {
						$('#'+list_target_id).attr('readonly', 'true');
						$('#'+list_target_id).html(initial_target_html);
					} else {
						$.ajax({url: 'index.php?option=com_icagenda&task='+view+'.dates&eventid='+selectvalue+'&regid='+regid,
							success: function(output) {
									$('#'+list_target_id).html(output);
							},
							error: function (xhr, ajaxOptions, thrownError) {
									alert(xhr.status + " "+ thrownError);
							}
						});
					}
				});
			}
		});
		</script>
		<?php

		return $html;
	}
}
modal/param_place.php000060400000002643152456531770010635 0ustar00<?php
/** 
 *	iCagenda
 *----------------------------------------------------------------------------
 * @package     com_icagenda
 * @copyright	Copyright (C) 2012 JOOMLIC - All rights reserved.
 * @license     GNU General Public License version 3 or later; see LICENSE.txt
 * @author      Jooml!C - http://www.joomlic.com
 * 
 * @since		1.0
 *----------------------------------------------------------------------------
*/

// No direct access to this file
defined( '_JEXEC' ) or die( 'Restricted access' );

jimport( 'joomla.filesystem.path' );
jimport('joomla.form.formfield');

JHTML::_('stylesheet', 'style.css', 'administrator/components/com_icagenda/add/css/');

class JFormFieldModal_param_place extends JFormField
{
	protected $type='modal_param_place';
	
	protected function getInput()
	{
		
		$db		= JFactory::getDbo();
		$query	= $db->getQuery(true);
		$query->select('a.place, a.id, a.coordinate')
			->from('`#__icagenda_events` AS a');
		$db->setQuery($query);
		$loc = $db->loadObjectList();
	
		$html= '
			<select id="'.$this->id.'_id"'.$class.' place="'.$this->place.'">
			<option value="NULL">-</option>';
		foreach ($loc as $l){
			$html.='<option value="'.$l->id.'"';
			if ($this->value == $l->id){
				$html.='selected="selected"';
			}
			$html.='>'.$l->place.'</option>';
			$span.='<span id="coord'.$l->id.'" style="display:none;">'.$l->coordinate.'</span>';
		}
		$html.='</select>'.$span;
			
		return $html;
	}
}modal/ictext_placeholder.php000060400000003074152456531770012232 0ustar00<?php
/**
 *------------------------------------------------------------------------------
 *  iCagenda v3 by Jooml!C - Events Management Extension for Joomla! 2.5 / 3.x
 *------------------------------------------------------------------------------
 * @package     com_icagenda
 * @copyright   Copyright (c)2012-2015 Cyril Rezé, Jooml!C - All rights reserved
 *
 * @license     GNU General Public License version 3 or later; see LICENSE.txt
 * @author      Cyril Rezé (Lyr!C)
 * @link        http://www.joomlic.com
 *
 * @version     3.5.3 2014-03-24
 * @since       3.2.10
 *------------------------------------------------------------------------------
*/

// No direct access to this file
defined('_JEXEC') or die();

jimport( 'joomla.filesystem.path' );
jimport('joomla.form.formfield');

class JFormFieldModal_ictext_Placeholder extends JFormField
{
	protected $type='modal_ictext_Placeholder';

	protected function getInput()
	{
		$class = JRequest::getVar('class');

		jimport('joomla.application.component.helper');
		$icagendaParams = JComponentHelper::getParams('com_icagenda');

		$replace = array("jform", "[", "]", "_Placeholder");
		$name = str_replace($replace, "", $this->name);

		$Type = $name . '_Placeholder';
		$tos_Type = $icagendaParams->get($Type);

		$placeholder = ( ! isset($tos_Type)) ? JText::_( 'COM_ICAGENDA_' . strtoupper($name) . '_PLACEHOLDER') : '';

		$html ='<input type="text" id="' . $this->id . '" class="' . $class . ' input-xxlarge" name="' . $this->name . '" value="' . $this->value . '" placeholder="' . $placeholder . '"/>';

		return $html;
	}
}
modal/template.php000060400000003665152456531770010211 0ustar00<?php
/**
 *------------------------------------------------------------------------------
 *  iCagenda v3 by Jooml!C - Events Management Extension for Joomla! 2.5 / 3.x
 *------------------------------------------------------------------------------
 * @package     com_icagenda
 * @copyright   Copyright (c)2012-2015 Cyril Rezé, Jooml!C - All rights reserved
 *
 * @license     GNU General Public License version 3 or later; see LICENSE.txt
 * @author      Cyril Rezé (Lyr!C)
 * @link        http://www.joomlic.com
 *
 * @version     3.4.1 2015-01-30
 * @since       1.0
 *------------------------------------------------------------------------------
*/

// No direct access to this file
defined('_JEXEC') or die();

jimport( 'joomla.filesystem.path' );
jimport('joomla.form.formfield');

class JFormFieldModal_Template extends JFormField
{
	protected $type = 'modal_template';

	protected function getInput()
	{
		$url	= JPATH_SITE.'/components/com_icagenda/themes/packs';
		$list	= $this->getList($url);
		$class 	= !empty($this->class) ? ' class="' . $this->class . '"' : '';
		$html	= '<select id="' . $this->id . '_id"' . $class . ' name="' . $this->name . '">';

		foreach ($list as $l)
		{
			$html.= '<option value="' . $l . '"';

			if ($this->value == $l)
			{
				$html.= ' selected="selected"';
			}

			$html.= '>' . $l . '</option>';
		}

		$html.= '</select>';

		return $html;
	}

	function getList($dirname)
	{
		$arrayfiles = Array();

		if (file_exists($dirname))
		{
			$handle = opendir($dirname);

			while (false !== ($file = readdir($handle)))
			{
				if (!is_file($dirname.$file)
					&& $file != '.'
					&& $file != '..'
					&& $file != '.DS_Store'
					&& $file != '.htaccess'
					&& $file != '.thumbs'
					&& $file != 'index.php'
					&& $file != 'index.html'
					&& $file != 'php.ini'
					)
				{
					array_push($arrayfiles, $file);
				}
			}

			$handle = closedir($handle);
		}

		sort($arrayfiles);

		return $arrayfiles;
	}
}
modal/ictxt_type.php000060400000010034152456531770010556 0ustar00<?php
/**
 *------------------------------------------------------------------------------
 *  iCagenda v3 by Jooml!C - Events Management Extension for Joomla! 2.5 / 3.x
 *------------------------------------------------------------------------------
 * @package     com_icagenda
 * @copyright   Copyright (c)2012-2015 Cyril Rezé, Jooml!C - All rights reserved
 *
 * @license     GNU General Public License version 3 or later; see LICENSE.txt
 * @author      Cyril Rezé (Lyr!C)
 * @link        http://www.joomlic.com
 *
 * @version     3.2.5 2013-11-10
 * @since       3.2.5
 *------------------------------------------------------------------------------
*/

// No direct access to this file
defined('_JEXEC') or die();

jimport( 'joomla.filesystem.path' );
jimport('joomla.form.formfield');

class JFormFieldModal_ictxt_type extends JFormField
{
	/**
	 * The form field type.
	 */
	protected $type = 'modal_ictxt_type';

	/**
	 * Method to get the field input markup.
	 */
	protected function getInput()
	{
		jimport('joomla.application.component.helper');
		$icagendaParams = JComponentHelper::getParams('com_icagenda');

		$replace = array("jform", "[", "]", "_Type");
		$name = str_replace($replace, "", $this->name);

		$Type = $name.'_Type';
		$tos_Type = $icagendaParams->get($Type, '');

		$class_default = '';
		$class_article = '';
		$class_custom = '';
		$checked_default = '';
		$checked_article = '';
		$checked_custom = '';
		if ($tos_Type == '') {
			$class_default = 'btn-success';
			$checked_default = ' checked="checked"';
			$checked_article = '';
			$checked_custom = '';
		}
		elseif ($tos_Type == '1') {
			$class_article = 'btn-success';
			$checked_default = '';
			$checked_article = ' checked="checked"';
			$checked_custom = '';
		}
		elseif ($tos_Type == '2') {
			$class_custom = 'btn-success';
			$checked_default = '';
			$checked_article = '';
			$checked_custom = ' checked="checked"';
		} else {
			$class_default = 'btn-success';
			$checked_default = ' checked="checked"';
			$checked_article = '';
			$checked_custom = '';
		}

		$html	= array();
		$html[]	= '<fieldset class="radio btn-group">';
		$html[]	= '<label class="'.$class_default.'">'.JText::_( 'IC_DEFAULT' ).'<input type="radio"  id="'.$name.'_Type0" name="'.$this->name.'" value=""  onClick="tosdefault_'.$name.'();"'.$checked_default.' /></label>';
		$html[]	= '<label class="'.$class_article.'">'.JText::_( 'IC_ARTICLE' ).'<input type="radio"  id="'.$name.'_Type1" name="'.$this->name.'" value="1"  onClick="tosarticle_'.$name.'();"'.$checked_article.' /></label>';
		$html[]	= '<label class="'.$class_custom.'">'.JText::_( 'IC_CUSTOM_TEXT' ).'<input type="radio"  id="'.$name.'_Type2" name="'.$this->name.'" value="2"  onClick="toscustom_'.$name.'();"'.$checked_custom.' /></label>';
		$html[]	= '</fieldset>';



		$html[]	= '<script type="text/javascript">';
		$html[]	= 'function tosdefault_'.$name.'()';
		$html[]	= '{';
		$html[]	= 'document.getElementById("'.$name.'_default").style.display = "block";';
		$html[]	= 'document.getElementById("'.$name.'_article").style.display = "none";';
		$html[]	= 'document.getElementById("'.$name.'_custom").style.display = "none";';
		$html[]	= '$("#'.$name.'_Type0").attr("checked", "checked");';
		$html[]	= '}';
		$html[]	= 'function tosarticle_'.$name.'()';
		$html[]	= '{';
		$html[]	= 'document.getElementById("'.$name.'_default").style.display = "none";';
		$html[]	= 'document.getElementById("'.$name.'_article").style.display = "block";';
		$html[]	= 'document.getElementById("'.$name.'_custom").style.display = "none";';
		$html[]	= '$("#'.$name.'_Type1").attr("checked", "checked");';
		$html[]	= '}';
		$html[]	= 'function toscustom_'.$name.'()';
		$html[]	= '{';
		$html[]	= 'document.getElementById("'.$name.'_default").style.display = "none";';
		$html[]	= 'document.getElementById("'.$name.'_article").style.display = "none";';
		$html[]	= 'document.getElementById("'.$name.'_custom").style.display = "block";';
		$html[]	= '$("#'.$name.'_Type2").attr("checked", "checked");';
		$html[]	= '}';
		$html[]	= '</script>';

		return implode("\n", $html);
	}
}
modal/menulink.php000060400000003272152456531770010212 0ustar00<?php
/**
 *------------------------------------------------------------------------------
 *  iCagenda v3 by Jooml!C - Events Management Extension for Joomla! 2.5 / 3.x
 *------------------------------------------------------------------------------
 * @package     com_icagenda
 * @copyright   Copyright (c)2012-2015 Cyril Rez�, Jooml!C - All rights reserved
 *
 * @license     GNU General Public License version 3 or later; see LICENSE.txt
 * @author      Cyril Rez� (Lyr!C)
 * @link        http://www.joomlic.com
 *
 * @version     3.3.6 2014-04-29
 * @since       2.1.4
 *------------------------------------------------------------------------------
*/

// No direct access to this file
defined('_JEXEC') or die();

jimport( 'joomla.filesystem.path' );
jimport('joomla.form.formfield');

class JFormFieldModal_Menulink extends JFormField
{
	protected $type='modal_menulink';

	protected function getInput()
	{

		$db		= JFactory::getDbo();
		$query	= $db->getQuery(true);
		$query->select('a.title, a.published, a.id, a.path')
			->from('`#__menu` AS a')
			->where( "(link = 'index.php?option=com_icagenda&view=list') AND (published > 0)" );
		$db->setQuery($query);
		$link = $db->loadObjectList();
		$class = JRequest::getVar('class');

		$html= '
			<select id="'.$this->id.'_id"'.$class.' name="'.$this->name.'">';
		if ($this->name!='jform[catid]' && $this->name!='catid') $html.='<option value="">- '.JTEXT::_('JGLOBAL_AUTO').' -</option>';
		foreach ($link as $l){
		if ($l->published == '1') {
			$html.='<option value="'.$l->id.'"';
			if ($this->value == $l->id){
				$html.='selected="selected"';
			}
			$html.='>['.$l->id.'] '.$l->title.'</option>';
		}
		}
		$html.='</select>';
		return $html;

	}
}
modal/tos_default.php000060400000003740152456531770010701 0ustar00<?php
/**
 *------------------------------------------------------------------------------
 *  iCagenda v3 by Jooml!C - Events Management Extension for Joomla! 2.5 / 3.x
 *------------------------------------------------------------------------------
 * @package     com_icagenda
 * @copyright   Copyright (c)2012-2015 Cyril Rezé, Jooml!C - All rights reserved
 *
 * @license     GNU General Public License version 3 or later; see LICENSE.txt
 * @author      Cyril Rezé (Lyr!C)
 * @link        http://www.joomlic.com
 *
 * @version     3.2.0 2013-09-18
 * @since       3.2.0
 *------------------------------------------------------------------------------
*/

// No direct access to this file
defined('_JEXEC') or die();

jimport( 'joomla.filesystem.path' );
jimport('joomla.form.formfield');

class JFormFieldModal_tos_default extends JFormField
{
	protected $type='modal_tos_default';

//	protected function getLabel()
//	{
//	   return ' ';
//	}

	protected function getInput()
	{
		jimport('joomla.application.component.helper');
		$icagendaParams = JComponentHelper::getParams('com_icagenda');
		$tosContent = $icagendaParams->get('tosContent');
		$tos_Type = $icagendaParams->get('tos_Type', '');

		$html	= array();

		$html[] = '<div id="ic_default"><fieldset class="span9 iCleft">';
		$html[] = ''.JText::_( 'COM_ICAGENDA_SUBMIT_TOS_TYPE_DEFAULT_LBL' ).'<br /><div class="alert alert-info">'.JText::_( 'COM_ICAGENDA_TOS' ).'</div>';
		$html[] = '</fieldset></div>';

		if ($tos_Type == '') {
			$html[] = '<script type="text/javascript">';
			$html[] = 'document.getElementById("ic_default").style.display = "block";';
			$html[] = 'document.getElementById("ic_article").style.display = "none";';
			$html[] = 'document.getElementById("tos_custom").style.display = "none";';
			$html[] = '</script>';
		} else {
			$html[] = '<script type="text/javascript">';
			$html[] = 'document.getElementById("ic_default").style.display = "none";';
			$html[] = '</script>';
		}

		return implode("\n", $html);
	}
}
modal/media.php000060400000010700152456531770007441 0ustar00<?php
/**
 *	iCagenda
 *----------------------------------------------------------------------------
 * @package     com_icagenda
 * @copyright	Copyright (C) 2012 JOOMLIC - All rights reserved.

 * @license     GNU General Public License version 3 or later; see LICENSE.txt
 * @author      Jooml!C - http://www.joomlic.com
 *
 * @update		2013-04-04
 * @version		2.1.4
 *----------------------------------------------------------------------------
*/

// No direct access to this file
defined( '_JEXEC' ) or die( 'Restricted access' );

jimport( 'joomla.filesystem.path' );
jimport('joomla.form.formfield');

class JFormFieldModal_media extends JFormField
{
	/**
	 * The form field type.
	 *
	 * @var    string
	 * @since  11.1
	 */
	protected $type = 'modal_media';

	/**
	 * The initialised state of the document object.
	 *
	 * @var    boolean
	 * @since  11.1
	 */
	protected static $initialised = false;

	/**
	 * Method to get the field input markup for a media selector.
	 * Use attributes to identify specific created_by and asset_id fields
	 *
	 * @return  string  The field input markup.
	 *
	 * @since   11.1
	 */
	protected function getInput()
	{
		$assetField = $this->element['asset_field'] ? (string) $this->element['asset_field'] : 'asset_id';
		$authorField = $this->element['created_by_field'] ? (string) $this->element['created_by_field'] : 'created_by';
		$asset = $this->form->getValue($assetField) ? $this->form->getValue($assetField) : (string) $this->element['asset_id'];
		if ($asset == '')
		{
			$asset = JRequest::getCmd('option');
		}

		$link = (string) $this->element['link'];
		if (!self::$initialised)
		{

			// Load the modal behavior script.
			JHtml::_('behavior.modal');

			// Build the script.
			$script = array();
			$script[] = '	function jInsertFieldValue(value, id) {';
			$script[] = '		var old_id = document.id(id).value;';
			$script[] = '		if (old_id != id) {';
			$script[] = '			var elem = document.id(id)';
			$script[] = '			elem.value = value;';
			$script[] = '			elem.fireEvent("change");';
			$script[] = '		}';
			$script[] = '	}';

			// Add the script to the document head.
			JFactory::getDocument()->addScriptDeclaration(implode("\n", $script));

			self::$initialised = true;
		}

		// Initialize variables.
		$html = array();
		$attr = '';

		// Initialize some field attributes.
		$attr .= $this->element['class'] ? ' class="' . (string) $this->element['class'] . '"' : '';
		$attr .= $this->element['size'] ? ' size="' . (int) $this->element['size'] . '"' : '';

		// Initialize JavaScript field attributes.
		$attr .= $this->element['onchange'] ? ' onchange="' . (string) $this->element['onchange'] . '"' : '';

		// The text field.
		$html[] = '<span class="media_field">';
		$html[] = '	<input type="text" name="' . $this->name . '" id="' . $this->id . '"' . ' value="'
			. htmlspecialchars($this->value, ENT_COMPAT, 'UTF-8') . '"' . ' readonly="readonly"' . $attr . ' />';
		$html[] = '</span>';

		$directory = (string) $this->element['directory'];
		if ($this->value && file_exists(JPATH_ROOT . '/' . $this->value))
		{
			$folder = explode('/', $this->value);
			array_shift($folder);
			array_pop($folder);
			$folder = implode('/', $folder);
		}
		elseif (file_exists(JPATH_ROOT . '/' . JComponentHelper::getParams('com_media')->get('image_path', 'images') . '/' . $directory))
		{
			$folder = $directory;
		}
		else
		{
			$folder = '';
		}
		// The button.
		$html[] = '<span class="ic_button">';
		$html[] = '	<span class="blank">';
		$html[] = '		<a class="modal" title="' . JText::_('JLIB_FORM_BUTTON_SELECT') . '"' . ' href="'
			. ($this->element['readonly'] ? ''
			: ($link ? $link
				: 'index.php?option=com_media&amp;view=images&amp;tmpl=component&amp;asset=' . $asset . '&amp;author='
				. $this->form->getValue($authorField)) . '&amp;fieldid=' . $this->id . '&amp;folder=' . $folder) . '"'
			. ' rel="{handler: \'iframe\', size: {x: 800, y: 500}}">';
		$html[] = JText::_('JLIB_FORM_BUTTON_SELECT') . '</a>';
		$html[] = '	</span>';
		$html[] = '</span>';

		$html[] = '<span class="ic_button">';
		$html[] = '	<span class="blank">';
		$html[] = '		<a title="' . JText::_('JLIB_FORM_BUTTON_CLEAR') . '"' . ' href="#" onclick="';
		$html[] = 'document.id(\'' . $this->id . '\').value=\'\';';
		$html[] = 'document.id(\'' . $this->id . '\').fireEvent(\'change\');';
		$html[] = 'return false;';
		$html[] = '">';
		$html[] = JText::_('JLIB_FORM_BUTTON_CLEAR') . '</a>';
		$html[] = '	</span>';
		$html[] = '</span>';

		return implode("\n", $html);
	}
}
modal/icfile.php000060400000011750152456531770007623 0ustar00<?php
/**
 *------------------------------------------------------------------------------
 *  iCagenda v3 by Jooml!C - Events Management Extension for Joomla! 2.5 / 3.x
 *------------------------------------------------------------------------------
 * @package     com_icagenda
 * @copyright   Copyright (c)2012-2015 Cyril Rezé, Jooml!C - All rights reserved
 *
 * @license     GNU General Public License version 3 or later; see LICENSE.txt
 * @author      Cyril Rezé (Lyr!C)
 * @link        http://www.joomlic.com
 *
 * @version     3.2.13 2014-01-23
 * @since       1.0
 *------------------------------------------------------------------------------
*/

// No direct access to this file
defined('_JEXEC') or die();

jimport('joomla.form.formfield');

class JFormFieldModal_icfile extends JFormField
{
	public $type = 'modal_icfile';


	protected static $initialised = false;

	/**
	 * Method to get the field input markup for a media selector.
	 * Use attributes to identify specific created_by and asset_id fields
	 *
	 * @return  string  The field input markup.
	 *
	 * @since   11.1
	 */
	protected function getInput()
	{
		$assetField = $this->element['asset_field'] ? (string) $this->element['asset_field'] : 'asset_id';
		$authorField = $this->element['created_by_field'] ? (string) $this->element['created_by_field'] : 'created_by';
		$asset = $this->form->getValue($assetField) ? $this->form->getValue($assetField) : (string) $this->element['asset_id'];
		if ($asset == '')
		{
			$asset = JRequest::getCmd('option');
		}

		$link = (string) $this->element['link'];
		if (!self::$initialised)
		{

			// Load the modal behavior script.
			JHtml::_('behavior.modal');

			// Build the script.
			$script = array();
			$script[] = '	function jInsertFieldValue(value, id) {';
			$script[] = '		var old_id = document.id(id).value;';
			$script[] = '		if (old_id != id) {';
			$script[] = '			var elem = document.id(id)';
			$script[] = '			elem.value = value;';
			$script[] = '			elem.fireEvent("change");';
			$script[] = '		}';
			$script[] = '	}';

			// Add the script to the document head.
			JFactory::getDocument()->addScriptDeclaration(implode("\n", $script));

			self::$initialised = true;
		}

		// Initialize variables.
		$html = array();
		$attr = '';

		// Initialize some field attributes.
		$attr .= $this->element['class'] ? ' class="' . (string) $this->element['class'] . '"' : '';
		$attr .= $this->element['size'] ? ' size="' . (int) $this->element['size'] . '"' : '';
		$attr .= $this->element['accept'] ? ' accept="' . (string) $this->element['accept'] . '"' : '';
		$attr .= ((string) $this->element['disabled'] == 'true') ? ' disabled="disabled"' : '';

		// Initialize JavaScript field attributes.
		$attr .= $this->element['onchange'] ? ' onchange="' . (string) $this->element['onchange'] . '"' : '';

		// The text field.
		if ($this->value == NULL) {
			$html[] = '<span>';
			$html[] = '	<input type="file" style="cursor: pointer" name="' . $this->name . '" id="' . $this->id . '"' . ' value="'
				. htmlspecialchars($this->value, ENT_COMPAT, 'UTF-8') . '"' . ' ' . $attr . ' />';
			$html[] = '</span>';
		} else {
			$html[] = '<span>';
			$html[] = '	<input type="text" name="' . $this->name . '" id="' . $this->id . '"' . ' value="'
				. htmlspecialchars($this->value, ENT_COMPAT, 'UTF-8') . '"' . ' readonly="readonly"' . $attr . ' />';
			$html[] = '</span>';
		}


		$folder = 'icagenda_doc';
		// The button.
//		$html[] = '<div class="button2-left">';
//		$html[] = '	<div class="blank">';
//		$html[] = '		<a class="modal" title="' . JText::_('JLIB_FORM_BUTTON_SELECT') . '"' . ' href="'
//			. ($this->element['readonly'] ? ''
//			: ($link ? $link
//				: 'index.php?option=com_media&amp;view=images&amp;tmpl=component&amp;asset=' . $asset . '&amp;author='
//				. $this->form->getValue($authorField)) . '&amp;fieldid=' . $this->id . '&amp;folder=' . $folder) . '"'
//			. ' rel="{handler: \'iframe\', size: {x: 800, y: 500}}">';
//		$html[] = JText::_('JLIB_FORM_BUTTON_SELECT') . '</a>';
//		$html[] = '	</div>';
//		$html[] = '</div>';

		if ($this->value == NULL) {
		$html[] = '<div class="button2-left">';
		$html[] = '	<div class="blank">';
		$html[] = '		<a title="' . JText::_('JLIB_FORM_BUTTON_CLEAR') . '"' . ' href="#" onclick="';
		$html[] = 'document.id(\'' . $this->id . '\').value=\'\';';
		$html[] = 'document.id(\'' . $this->id . '\').fireEvent(\'change\');';
		$html[] = 'return false;';
		$html[] = '">';
		$html[] = JText::_('JLIB_FORM_BUTTON_CLEAR') . '</a>';
		$html[] = '</div>';
		$html[] = '</div>';
		} else {
		$html[] = '<div class="button2-left">';
		$html[] = '	<div class="blank">';
		$html[] = '		<a title="' . JText::_('JLIB_FORM_BUTTON_CLEAR') . '"' . ' href="#" onclick="';
		$html[] = 'document.id(\'' . $this->id . '\').value=\'\';';
		$html[] = 'document.id(\'' . $this->id . '\').fireEvent(\'change\');';
		$html[] = 'return false;';
		$html[] = '">';
		$html[] = JText::_('JLIB_FORM_BUTTON_CLEAR') . '</a>';
		$html[] = '</div>';
		$html[] = '</div>';
		}

		return implode("\n", $html);







	}
}
modal/ic_editor.php000060400000003774152456531770010340 0ustar00<?php
/**
 *------------------------------------------------------------------------------
 *  iCagenda v3 by Jooml!C - Events Management Extension for Joomla! 2.5 / 3.x
 *------------------------------------------------------------------------------
 * @package     com_icagenda
 * @copyright   Copyright (c)2012-2015 Cyril Rezé, Jooml!C - All rights reserved
 *
 * @license     GNU General Public License version 3 or later; see LICENSE.txt
 * @author      Cyril Rezé (Lyr!C)
 * @link        http://www.joomlic.com
 *
 * @version     3.3.7 2014-05-18
 * @since       3.3.7
 *------------------------------------------------------------------------------
*/

// No direct access to this file
defined('_JEXEC') or die();

jimport( 'joomla.filesystem.path' );
jimport('joomla.form.formfield');

class JFormFieldModal_iC_editor extends JFormField
{
	/**
	 * The form field type.
	 */
	protected $type = 'modal_iC_editor';

	/**
	 * Method to get the field input markup.
	 */
	protected function getInput()
	{
		$icName = $this->name;
		$icDefault = $this->default;
		$icValue = $this->value;

		if (strpos($icValue,'\n') !== false)
		{
			$array_newline = array('\\n', '\n');
			$icValue = str_replace($array_newline, '<br />', $icValue);
		}

		$get_period_string = JText::_('COM_ICAGENDA_REGISTRATION_EMAIL_USER_PERIOD_DEFAULT_BODY');
		$get_date_string = JText::_('COM_ICAGENDA_REGISTRATION_EMAIL_USER_DATE_DEFAULT_BODY');

		if  ($icValue == 'COM_ICAGENDA_REGISTRATION_EMAIL_USER_PERIOD_DEFAULT_BODY')
		{
			$icBody = $get_period_string;
		}
		elseif ($icValue == 'COM_ICAGENDA_REGISTRATION_EMAIL_USER_DATE_DEFAULT_BODY')
		{
			$icBody = $get_date_string;
		}
		else
		{
			$icBody = $icValue;
		}

		$editor = JFactory::getEditor();

		$html	= array();

		$html[] = '<div id="'.$this->name.'_ic_editor"><fieldset class="span9 iCleft">';
		$html[] = $editor->display($this->name, $icBody, "100%", "300", "300", "20", 1, null, null, null, array('mode' => 'advanced'));
		$html[] = '</fieldset></div>';

		return implode("\n", $html);
	}
}
modal/date.php000060400000010726152456531770007307 0ustar00<?php
/**
 *------------------------------------------------------------------------------
 *  iCagenda v3 by Jooml!C - Events Management Extension for Joomla! 2.5 / 3.x
 *------------------------------------------------------------------------------
 * @package     com_icagenda
 * @copyright   Copyright (c)2012-2015 Cyril Rezé, Jooml!C - All rights reserved
 *
 * @license     GNU General Public License version 3 or later; see LICENSE.txt
 * @author      Cyril Rezé (Lyr!C)
 * @link        http://www.joomlic.com
 *
 * @version     3.5.10 2015-08-13
 * @since       1.0
 *------------------------------------------------------------------------------
*/

// No direct access to this file
defined('_JEXEC') or die();

jimport( 'joomla.filesystem.path' );
jimport('joomla.form.formfield');

/**
 * Supports unlimited modal datetime picker (add / delete).
 *
 * @package		iCagenda
 * @subpackage	com_icagenda
 * @since		1.0
 */
class JFormFieldModal_date extends JFormField
{
	protected $type = 'modal_date';

	protected function getInput()
	{
		$lang = JFactory::getLanguage();

		$id_suffix = ($lang->getTag() == 'fa-IR') ? '_jalali' : '';

		if ($lang->getTag() == 'fa-IR')
		{
			// Including fallback code for HTML5 non supported browsers.
			JHtml::_('jquery.framework');
			JHtml::_('script', 'system/html5fallback.js', false, true);
		}

		$id = JRequest::getInt('id');
		$class = !empty($this->class) ? ' ' . $this->class : '';

		$session = JFactory::getSession();
		$datesDB = $session->get('ic_submit_dates', '');

		if ($id && empty($datesDB))
		{
			$db	= JFactory::getDBO();
			$db->setQuery(
				'SELECT a.dates' .
				' FROM #__icagenda_events AS a' .
				' WHERE a.id = '.(int) $id
			);
			$datesDB = $db->loadResult();
		}

		$dates = iCString::isSerialized($datesDB) ? unserialize($datesDB) : false;

//		if ($lang->getTag() == 'fa-IR'
//			&& $dates
//			&& $dates != array('0000-00-00 00:00'))
//		{
//			$dates_to_sql = array();

//			foreach ($dates AS $date)
//			{
//				if (iCDate::isDate($date))
//				{
//					$year		= date('Y', strtotime($date));
//					$month		= date('m', strtotime($date));
//					$day		= date('d', strtotime($date));
//					$time		= date('H:i', strtotime($date));

//					$dates_to_sql[] = iCGlobalizeConvert::gregorianToJalali($year, $month, $day, true) . ' ' . $time;
//				}
//			}

//			$dates = $dates_to_sql;
//		}

		$html = '<table id="dTable' . $id_suffix . '" style="border:0px">';

		$html.= '<thead>';
		$html.= '<tr>';
		$html.= '<th width="70%">';
		$html.= JText::_('COM_ICAGENDA_TB_DATE');
		$html.= '</th>';
		$html.= '<th width="30%">';
//		$html.= JText::_('COM_ICAGENDA_TB_ACT');
		$html.= '</th>';
		$html.= '</tr>';
		$html.= '</thead>';

		$add_counter = 0;

		if ($dates
			&& $dates != array('0000-00-00 00:00'))
		{
			foreach ($dates as $date)
			{
				$html.= '<tr>';
				$html.= '<td>';

				if ($lang->getTag() == 'fa-IR')
				{
					$add_counter = $add_counter+1;
//					$this_number = $add_counter ? $add_counter : '';
					$html.= JHtml::_('calendar', $date, 'd', 'date_jalali' . $add_counter, '%Y-%m-%d %H:%M', ' class="ic-date-input' . $id_suffix . '"');
				}
				else
				{
					$html.= '<input class="ic-date-input' . $id_suffix . '" type="text" name="d" value="' . $date . '" />';
				}

				$html.= '</td>';
				$html.= '<td>';
				$html.= '<a class="del btn btn-danger btn-mini" href="#">' . JText::_('COM_ICAGENDA_DELETE_DATE') . '</a>';
				$html.= '</td>';
				$html.= '</tr>';
			}

			// clear the data so we don't process it again
			$session->clear('ic_submit_dates');
		}
		else
		{
			$html.= '<tr>';
			$html.= '<td>';

			if ($lang->getTag() == 'fa-IR')
			{
				$html.= JHtml::_('calendar', '0000-00-00 00:00', 'd', 'date_jalali', '%Y-%m-%d %H:%M', ' class="ic-date-input' . $id_suffix . '"');
			}
			else
			{
				$html.= '<input class="ic-date-input' . $id_suffix . '" type="text" name="d" value="0000-00-00 00:00" />';
			}
			$html.= '</td>';
			$html.= '<td>';
			$html.= '<a class="del btn btn-danger btn-mini" href="#">' . JText::_('COM_ICAGENDA_DELETE_DATE') . '</a>';
			$html.= '</td>';
			$html.= '</tr>';
		}

		$html.= '</table>';

		$html.= '<a id="add" href="#"><span class="btn btn-success btn-small input-medium" style="float:left"><strong>' . JText::_('COM_ICAGENDA_ADD_DATE') . '</strong></span></a><br/>';

		$html.= '<input type="hidden"';
		$html.= ' class="date' . $class . '"';
		$html.= ' id="' . $this->id . '_id"';
		$html.= ' name="' . $this->name . '"';
		$html.= ' value=\''.$datesDB.'\'';
		$html.= '/>';

		return $html;
	}
}
modal/ictext_type.php000060400000005643152456531770010735 0ustar00<?php
/**
 *------------------------------------------------------------------------------
 *  iCagenda v3 by Jooml!C - Events Management Extension for Joomla! 2.5 / 3.x
 *------------------------------------------------------------------------------
 * @package     com_icagenda
 * @copyright   Copyright (c)2012-2015 Cyril Rezé, Jooml!C - All rights reserved
 *
 * @license     GNU General Public License version 3 or later; see LICENSE.txt
 * @author      Cyril Rezé (Lyr!C)
 * @link        http://www.joomlic.com
 *
 * @version     3.2.0.1 2013-09-22
 * @since       3.2.0.1
 *------------------------------------------------------------------------------
*/

// No direct access to this file
defined('_JEXEC') or die();

jimport( 'joomla.filesystem.path' );
jimport('joomla.form.formfield');

class JFormFieldModal_ictext_type extends JFormField
{
	protected $type='modal_ictext_type';

	protected function getInput()
	{
		jimport('joomla.application.component.helper');

		$icagendaParams = JComponentHelper::getParams('com_icagenda');

		$replace = array("jform", "[", "]");
		$name = str_replace($replace, "", $this->name);
		$Type = $icagendaParams->get($name, '');

		$Type_default = $name.'_default';
		$Type_content = $name.'_custom';

		$class_default = '';
		$class_custom = '';
		$checked_default = '';
		$checked_custom = '';
		if ($Type == '') {
			$class_default = 'btn-success';
			$checked_default = ' checked="checked"';
			$checked_custom = '';
		}
		elseif ($Type == '2') {
			$class_custom = 'btn-success';
			$checked_default = '';
			$checked_custom = ' checked="checked"';
		} else {
			$class_default = 'btn-success';
			$checked_default = ' checked="checked"';
			$checked_custom = '';
		}

		$html	= array();
		$html[]	= '<fieldset class="radio btn-group">';
		$html[]	= '<label class="'.$class_default.'">'.JText::_( 'IC_DEFAULT' ).'<input type="radio"  id="'.$name.'_0" name="'.$this->name.'" value=""  onClick="icdefault_'.$name.'();"'.$checked_default.' /></label>';
		$html[]	= '<label class="'.$class_custom.'">'.JText::_( 'IC_CUSTOM_TEXT' ).'<input type="radio"  id="'.$name.'_2" name="'.$this->name.'" value="2"  onClick="iccustom_'.$name.'();"'.$checked_custom.' /></label>';
		$html[]	= '</fieldset>';



		$html[]	= '<script type="text/javascript">';
		$html[]	= 'function icdefault_'.$name.'()';
		$html[]	= '{';
//		$html[]	= 'document.getElementById("'.$Type_default.'").style.display = "block";';
		$html[]	= 'document.getElementById("'.$Type_content.'").style.display = "none";';
		$html[]	= '$("#'.$name.'_0").attr("checked", "checked");';
		$html[]	= '}';
		$html[]	= 'function iccustom_'.$name.'()';
		$html[]	= '{';
//		$html[]	= 'document.getElementById("'.$Type_default.'").style.display = "none";';
		$html[]	= 'document.getElementById("'.$Type_content.'").style.display = "block";';
		$html[]	= '$("#'.$name.'_2").attr("checked", "checked");';
		$html[]	= '}';
		$html[]	= '</script>';

		return implode("\n", $html);
	}
}
modal/color.php000060400000001725152456531770007507 0ustar00<?php
/** 
 *	iCagenda
 *----------------------------------------------------------------------------
 * @package     com_icagenda
 * @copyright	Copyright (C) 2012 JOOMLIC - All rights reserved.
 * @license     GNU General Public License version 3 or later; see LICENSE.txt
 * @author      Jooml!C - http://www.joomlic.com
 * 
 * @update		2.0.4
 *----------------------------------------------------------------------------
*/

// No direct access to this file
defined( '_JEXEC' ) or die( 'Restricted access' );

jimport( 'joomla.filesystem.path' );
jimport('joomla.form.formfield');


class JFormFieldModal_color extends JFormField
{
	protected $type='modal_color';
	
	protected function getInput()
	{
		$html= '
		<div class="color">
			<div class="form-item">
				<input type="text" id="'.$this->id.'" name="'.$this->name.'" value="'.$this->value.'" />
			</div>
			<div id="picker"></div>
			<div class="clr"></div>
		</div>
		<div class="clr"></div>
		';

		return $html;
	}
}modal/icmulti_opt.php000060400000007047152456531770010724 0ustar00<?php
/**
 *------------------------------------------------------------------------------
 *  iCagenda v3 by Jooml!C - Events Management Extension for Joomla! 2.5 / 3.x
 *------------------------------------------------------------------------------
 * @package     com_icagenda
 * @copyright   Copyright (c)2012-2015 Cyril Rezé, Jooml!C - All rights reserved
 *
 * @license     GNU General Public License version 3 or later; see LICENSE.txt
 * @author      Cyril Rezé (Lyr!C)
 * @link        http://www.joomlic.com
 *
 * @version     3.2.6 2013-11-20
 * @since       3.2.6
 *------------------------------------------------------------------------------
*/

// No direct access to this file
defined('_JEXEC') or die();

jimport( 'joomla.filesystem.path' );
jimport('joomla.form.formfield');

class JFormFieldModal_icmulti_opt extends JFormField
{
	protected $type='modal_icmulti_opt';

	protected function getInput()
	{

		$replace = array("jform", "params", "[", "]");
		$name_input = str_replace($replace, "", $this->name);
		$get_location = explode('_', $name_input);
		$location = $get_location['1'];
		$name = $get_location['0'];

		$Type = $this->value;

		$Type_none = $name.'_none';
		$Type_checkbox = $name.'_checkbox';

		$class_global = 'btn-primary';
		$class_none = 'btn-danger';
		$class_checkbox = 'btn-success';
		$checked_none = ' checked="checked"';
		$checked_checkbox = '';
		if ($Type == '0') {
			$class_global = '';
			$class_none = 'btn-danger';
			$class_checkbox = '';
			$checked_global = '';
			$checked_none = ' checked="checked"';
			$checked_checkbox = '';
		}
		elseif ($Type == '1') {
			$class_global = '';
			$class_none = '';
			$class_checkbox = 'btn-success';
			$checked_global = '';
			$checked_none = '';
			$checked_checkbox = ' checked="checked"';
		}
		else {
			$class_global = 'btn-primary';
			$class_none = '';
			$class_checkbox = '';
			$checked_global = ' checked="checked"';
			$checked_none = '';
			$checked_checkbox = '';
		}

		$html	= array();


		$html[]	= '<fieldset class="radio btn-group">';
		if ($location == 'menu') {
			$html[]	= '<label class="'.$class_global.'">'.JText::_( 'JGLOBAL_USE_GLOBAL' ).'<input type="radio"  id="'.$name.'_global" name="'.$this->name.'" value="global"  onClick="icglobal_'.$name.'();"'.$checked_global.' /></label>';
		}
		$html[]	= '<label class="'.$class_none.'">'.JText::_( 'JNO' ).'<input type="radio"  id="'.$name.'_0" name="'.$this->name.'" value="0"  onClick="icnone_'.$name.'();"'.$checked_none.' /></label>';
		$html[]	= '<label class="'.$class_checkbox.'">'.JText::_( 'JYES' ).'<input type="radio"  id="'.$name.'_1" name="'.$this->name.'" value="1"  onClick="iccheckbox_'.$name.'();"'.$checked_checkbox.' /></label>';
		$html[]	= '</fieldset>';


		$html[]	= '<script type="text/javascript">';
		$html[]	= 'var typeset = '.$Type.';';
		if ($location == 'menu') {
			$html[]	= 'function icglobal_'.$name.'()';
			$html[]	= '{';
			$html[]	= 'document.getElementById("'.$Type_checkbox.'").style.display = "none";';
			$html[]	= '$("#'.$name.'_global").attr("checked", "checked");';
			$html[]	= '}';
		}
		$html[]	= 'function icnone_'.$name.'()';
		$html[]	= '{';
		$html[]	= 'document.getElementById("'.$Type_checkbox.'").style.display = "none";';
		$html[]	= '$("#'.$name.'_0").attr("checked", "checked");';
		$html[]	= '}';
		$html[]	= 'function iccheckbox_'.$name.'()';
		$html[]	= '{';
		$html[]	= 'document.getElementById("'.$Type_checkbox.'").style.display = "block";';
		$html[]	= '$("#'.$name.'_1").attr("checked", "checked");';
		$html[]	= '}';
		$html[]	= '</script>';

		return implode("\n", $html);
	}
}
modal/iclink_url.php000060400000005123152456531770010520 0ustar00<?php
/**
 *------------------------------------------------------------------------------
 *  iCagenda v3 by Jooml!C - Events Management Extension for Joomla! 2.5 / 3.x
 *------------------------------------------------------------------------------
 * @package     com_icagenda
 * @copyright   Copyright (c)2012-2015 Cyril Rezé, Jooml!C - All rights reserved
 *
 * @license     GNU General Public License version 3 or later; see LICENSE.txt
 * @author      Cyril Rezé (Lyr!C)
 * @link        http://www.joomlic.com
 *
 * @version     3.5.1 2015-02-27
 * @since       3.3.3
 *------------------------------------------------------------------------------
*/

// No direct access to this file
defined('_JEXEC') or die();

jimport( 'joomla.filesystem.path' );
jimport('joomla.form.formfield');

/**
 * Supports a url type field.
 */
class JFormFieldModal_iclink_url extends JFormField
{
	/**
	 * The form field type.
	 */
	protected $type='modal_iclink_url';

	/**
	 * Method to get the field input markup.
	 */
	protected function getInput()
	{
		jimport('joomla.application.component.helper');
		$icagendaParams	= JComponentHelper::getParams('com_icagenda');

		$Explode		= explode('_', $this->name);
		$TypeName		= $Explode[0] . ']';

		$replace		= array("jform", "params", "[", "]");
		$name			= str_replace($replace, "", $TypeName);

		$Type			= JRequest::getVar('type');

		$Type_default	= $name.'_default';
		$Type_article	= $name.'_article';
		$Type_url		= $name.'_url';


		$editor = JFactory::getEditor();

		$html	= array();

		$html[] = '<div id="' . $Type_url . '"><fieldset class="span9 iCleft">';
		$html[] = '<input type="url" name="' . $this->name . '" value="' . $this->value . '" />';
		$html[] = '</fieldset></div>';

		// Article
		if ($Type == '1')
		{
			$html[] = '<script type="text/javascript">';
			$html[] = 'document.getElementById("' . $Type_article . '").style.display = "block";';
			$html[] = 'document.getElementById("' . $Type_url . '").style.display = "none";';
			$html[] = '</script>';
		}

		// URL
		elseif ($Type == '2')
		{
			$html[] = '<script type="text/javascript">';
			$html[] = 'document.getElementById("' . $Type_article . '").style.display = "none";';
			$html[] = 'document.getElementById("' . $Type_url . '").style.display = "block";';
			$html[] = '</script>';
		}

		// iCagenda default
		else
		{
			$html[] = '<script type="text/javascript">';
			$html[] = 'document.getElementById("' . $Type_article . '").style.display = "none";';
			$html[] = 'document.getElementById("' . $Type_url . '").style.display = "none";';
			$html[] = '</script>';
		}

		return implode("\n", $html);
	}
}
modal/ictxt_default.php000060400000005000152456531770011216 0ustar00<?php
/**
 *------------------------------------------------------------------------------
 *  iCagenda v3 by Jooml!C - Events Management Extension for Joomla! 2.5 / 3.x
 *------------------------------------------------------------------------------
 * @package     com_icagenda
 * @copyright   Copyright (c)2012-2015 Cyril Rezé, Jooml!C - All rights reserved
 *
 * @license     GNU General Public License version 3 or later; see LICENSE.txt
 * @author      Cyril Rezé (Lyr!C)
 * @link        http://www.joomlic.com
 *
 * @version     3.2.5 2013-11-10
 * @since       3.2.5
 *------------------------------------------------------------------------------
*/

// No direct access to this file
defined('_JEXEC') or die();

jimport( 'joomla.filesystem.path' );
jimport('joomla.form.formfield');

class JFormFieldModal_ictxt_default extends JFormField
{
	/**
	 * The form field type.
	 */
	protected $type = 'modal_ictxt_default';

	/**
	 * Method to create a blank label.
	 */
	protected function getLabel()
	{
	   return ' ';
	}

	/**
	 * Method to get the field input markup.
	 */
	protected function getInput()
	{
		jimport('joomla.application.component.helper');
		$icagendaParams = JComponentHelper::getParams('com_icagenda');

		$replace = array("jform", "[", "]", "Default");
		$name = str_replace($replace, "", $this->name);

		$tos_Type = $icagendaParams->get($name.'_Type', '');

		$Type_default = $name.'_default';
		$Type_article = $name.'_article';
		$Type_content = $name.'_custom';

		$html	= array();

		$html[] = '<div id="'.$name.'_default"><fieldset class="span9 iCleft">';
		$html[] = '<div class="alert alert-error">';
		if(version_compare(JVERSION, '3.0', 'ge')) {
			$html[] = '<i class="icon-warning-2"></i>';
		}
		$html[] = ' '.JText::sprintf( 'COM_ICAGENDA_TERMS_IMPORTANT_INFOS', $this->description ).'</div><div>'.JText::_( 'COM_ICAGENDA_SUBMIT_TOS_TYPE_DEFAULT_LBL' ).'<br /><small>'.$this->description.'</small></div><div class="alert alert-info">'.JText::_( $this->description ).'</div>';
		$html[] = '<input type="hidden" id="'.$this->id.'_id" name="'.$this->name.'" value="'.$this->value.'" />';
		$html[] = '</fieldset></div>';

		if ($tos_Type == '') {
			$html[] = '<script type="text/javascript">';
			$html[] = 'document.getElementById("'.$name.'_default").style.display = "block";';
			$html[] = '</script>';
		} else {
			$html[] = '<script type="text/javascript">';
			$html[] = 'document.getElementById("'.$name.'_default").style.display = "none";';
			$html[] = '</script>';
		}

		return implode("\n", $html);
	}
}
modal/ic_password.php000060400000002352152456531770010703 0ustar00<?php
/**
 *------------------------------------------------------------------------------
 *  iCagenda v3 by Jooml!C - Events Management Extension for Joomla! 2.5 / 3.x
 *------------------------------------------------------------------------------
 * @package     com_icagenda
 * @copyright   Copyright (c)2012-2015 Cyril Rezé, Jooml!C - All rights reserved
 *
 * @license     GNU General Public License version 3 or later; see LICENSE.txt
 * @author      Cyril Rezé (Lyr!C)
 * @link        http://www.joomlic.com
 *
 * @version     3.4.0 2014-12-21
 * @since       3.4.0
 *------------------------------------------------------------------------------
*/

// No direct access to this file
defined('_JEXEC') or die();

jimport( 'joomla.filesystem.path' );
jimport('joomla.form.formfield');

class JFormFieldModal_ic_password extends JFormField
{
	protected $type='modal_ic_password';

	protected function getInput()
	{
		$_pass = str_replace('/', '.', $this->value);
		$pass_ex = explode('.', $_pass);

		if (isset($pass_ex[1]))
		{
			$value = base64_decode($pass_ex[1]);
		}
		else
		{
			$value = $this->value;
		}

		$html = '<input type="password" id="' . $this->id . '" name="' . $this->name . '" value="' . $value . '" />';

		return $html;
	}
}
modal/multicat.php000060400000004063152456531770010211 0ustar00<?php
/**
 *------------------------------------------------------------------------------
 *  iCagenda v3 by Jooml!C - Events Management Extension for Joomla! 2.5 / 3.x
 *------------------------------------------------------------------------------
 * @package     com_icagenda
 * @copyright   Copyright (c)2012-2015 Cyril Rezé, Jooml!C - All rights reserved
 *
 * @license     GNU General Public License version 3 or later; see LICENSE.txt
 * @author      Cyril Rezé (Lyr!C)
 * @link        http://www.joomlic.com
 *
 * @version     3.4.0 2014-12-06
 * @since       3.2.0
 *------------------------------------------------------------------------------
*/

// No direct access to this file
defined('_JEXEC') or die();

jimport( 'joomla.filesystem.path' );
jimport('joomla.form.formfield');

class JFormFieldModal_multicat extends JFormField
{
	protected $type='modal_multicat';

	protected function getInput()
	{
		// Initialize some field attributes.
		$class	= !empty($this->class) ? ' class="' . $this->class . '"' : '';

		// Query List of Categories
		$db		= JFactory::getDbo();
		$query	= $db->getQuery(true);
		$query->select('a.title, a.state, a.id')
			->from('`#__icagenda_category` AS a');
		$db->setQuery($query);
		$cat	= $db->loadObjectList();

		if (!is_array($this->value))
		{
			$this->value = array($this->value);
		}

		$html = ' <select multiple id="' . $this->id . '_id" name="' . $this->name . '"' . $class . '>';

		if (version_compare(JVERSION, '3.0', 'lt'))
		 {
			if ($this->name != 'jform[catid]' && $this->name != 'catid')
			{
				$html.= '<option value="0"';

				if (in_array('0', $this->value))
				{
					$html.= ' selected="selected"';
				}

				$html.= '>-- '.JTEXT::_('COM_ICAGENDA_ALL_CATEGORIES').' --</option>';
			}
		}

		foreach ($cat as $c)
		{
			if ($c->state == '1')
			{
				$html.= '<option value="' . $c->id . '"';

				if ( (in_array($c->id, $this->value)) && (!in_array('0', $this->value)) )
				{
					$html.= ' selected="selected"';
				}

				$html.= '>' . $c->title . '</option>';
			}
		}

		$html.= '</select>';

		return $html;
	}
}
menupreset.php000060400000001715152456532740007461 0ustar00<?php
/**
 * @package     Joomla.Administrator
 * @subpackage  com_menus
 *
 * @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\Menu\MenuHelper;

JFormHelper::loadFieldClass('list');

/**
 * Administrator Menu Presets list field.
 *
 * @since  3.8.0
 */
class JFormFieldMenuPreset extends JFormFieldList
{
	/**
	 * The form field type.
	 *
	 * @var     string
	 *
	 * @since   3.8.0
	 */
	protected $type = 'MenuPreset';

	/**
	 * Method to get the field options.
	 *
	 * @return  array  The field option objects.
	 *
	 * @since  3.8.0
	 */
	protected function getOptions()
	{
		$options = array();
		$presets = MenuHelper::getPresets();

		foreach ($presets as $preset)
		{
			$options[] = JHtml::_('select.option', $preset->name, JText::_($preset->title));
		}

		return array_merge(parent::getOptions(), $options);
	}
}
menuitembytype.php000060400000014365152456532740010357 0ustar00<?php
/**
 * @package     Joomla.Administrator
 * @subpackage  com_menus
 *
 * @copyright   (C) 2017 Open Source Matters, Inc. <https://www.joomla.org>
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */

defined('JPATH_PLATFORM') or die;

JFormHelper::loadFieldClass('groupedlist');

// Import the com_menus helper.
JLoader::register('MenusHelper', JPATH_ADMINISTRATOR . '/components/com_menus/helpers/menus.php');

/**
 * Supports an HTML grouped select list of menu item grouped by menu
 *
 * @since  3.8.0
 */
class JFormFieldMenuitemByType extends JFormFieldGroupedList
{
	/**
	 * The form field type.
	 *
	 * @var    string
	 * @since  3.8.0
	 */
	public $type = 'MenuItemByType';

	/**
	 * The menu type.
	 *
	 * @var    string
	 * @since  3.8.0
	 */
	protected $menuType;

	/**
	 * The client id.
	 *
	 * @var    string
	 * @since  3.8.0
	 */
	protected $clientId;

	/**
	 * The language.
	 *
	 * @var    array
	 * @since  3.8.0
	 */
	protected $language;

	/**
	 * The published status.
	 *
	 * @var    array
	 * @since  3.8.0
	 */
	protected $published;

	/**
	 * The disabled status.
	 *
	 * @var    array
	 * @since  3.8.0
	 */
	protected $disable;

	/**
	 * Method to get certain otherwise inaccessible properties from the form field object.
	 *
	 * @param   string  $name  The property name for which to get the value.
	 *
	 * @return  mixed  The property value or null.
	 *
	 * @since   3.8.0
	 */
	public function __get($name)
	{
		switch ($name)
		{
			case 'menuType':
			case 'clientId':
			case 'language':
			case 'published':
			case 'disable':
				return $this->$name;
		}

		return parent::__get($name);
	}

	/**
	 * Method to set certain otherwise inaccessible properties of the form field object.
	 *
	 * @param   string  $name   The property name for which to set the value.
	 * @param   mixed   $value  The value of the property.
	 *
	 * @return  void
	 *
	 * @since   3.8.0
	 */
	public function __set($name, $value)
	{
		switch ($name)
		{
			case 'menuType':
				$this->menuType = (string) $value;
				break;

			case 'clientId':
				$this->clientId = (int) $value;
				break;

			case 'language':
			case 'published':
			case 'disable':
				$value = (string) $value;
				$this->$name = $value ? explode(',', $value) : array();
				break;

			default:
				parent::__set($name, $value);
		}
	}

	/**
	 * Method to attach a JForm object to the field.
	 *
	 * @param   SimpleXMLElement  $element  The SimpleXMLElement object representing the `<field>` tag for the form field object.
	 * @param   mixed             $value    The form field value to validate.
	 * @param   string            $group    The field name group control value. This acts as an array container for the field.
	 *                                      For example if the field has name="foo" and the group value is set to "bar" then the
	 *                                      full field name would end up being "bar[foo]".
	 *
	 * @return  boolean  True on success.
	 *
	 * @see     JFormField::setup()
	 * @since   3.8.0
	 */
	public function setup(SimpleXMLElement $element, $value, $group = null)
	{
		$result = parent::setup($element, $value, $group);

		if ($result == true)
		{
			$menuType = (string) $this->element['menu_type'];

			if (!$menuType)
			{
				$app = JFactory::getApplication('administrator');
				$currentMenuType = $app->getUserState('com_menus.items.menutype', '');
				$menuType        = $app->input->getString('menutype', $currentMenuType);
			}

			$this->menuType  = $menuType;
			$this->clientId  = (int) $this->element['client_id'];
			$this->published = $this->element['published'] ? explode(',', (string) $this->element['published']) : array();
			$this->disable   = $this->element['disable'] ? explode(',', (string) $this->element['disable']) : array();
			$this->language  = $this->element['language'] ? explode(',', (string) $this->element['language']) : array();
		}

		return $result;
	}

	/**
	 * Method to get the field option groups.
	 *
	 * @return  array  The field option objects as a nested array in groups.
	 *
	 * @since   3.8.0
	 */
	protected function getGroups()
	{
		$groups = array();

		$menuType = $this->menuType;

		// Get the menu items.
		$items = MenusHelper::getMenuLinks($menuType, 0, 0, $this->published, $this->language, $this->clientId);

		// Build group for a specific menu type.
		if ($menuType)
		{
			// If the menutype is empty, group the items by menutype.
			$db    = JFactory::getDbo();
			$query = $db->getQuery(true)
				->select($db->quoteName('title'))
				->from($db->quoteName('#__menu_types'))
				->where($db->quoteName('menutype') . ' = ' . $db->quote($menuType));
			$db->setQuery($query);

			try
			{
				$menuTitle = $db->loadResult();
			}
			catch (RuntimeException $e)
			{
				$menuTitle = $menuType;
			}

			// Initialize the group.
			$groups[$menuTitle] = array();

			// Build the options array.
			foreach ($items as $key => $link)
			{
				// Unset if item is menu_item_root
				if ($link->text === 'Menu_Item_Root')
				{
					unset($items[$key]);
					continue;
				}

				$levelPrefix = str_repeat('- ', max(0, $link->level - 1));

				// Displays language code if not set to All
				if ($link->language !== '*')
				{
					$lang = ' (' . $link->language . ')';
				}
				else
				{
					$lang = '';
				}

				$groups[$menuTitle][] = JHtml::_('select.option',
					$link->value, $levelPrefix . $link->text . $lang,
					'value',
					'text',
					in_array($link->type, $this->disable)
				);
			}
		}
		// Build groups for all menu types.
		else
		{
			// Build the groups arrays.
			foreach ($items as $menu)
			{
				// Initialize the group.
				$groups[$menu->title] = array();

				// Build the options array.
				foreach ($menu->links as $link)
				{
					$levelPrefix = str_repeat('- ', max(0, $link->level - 1));

					// Displays language code if not set to All
					if ($link->language !== '*')
					{
						$lang = ' (' . $link->language . ')';
					}
					else
					{
						$lang = '';
					}

					$groups[$menu->title][] = JHtml::_('select.option',
						$link->value,
						$levelPrefix . $link->text . $lang,
						'value',
						'text',
						in_array($link->type, $this->disable)
					);
				}
			}
		}

		// Merge any additional groups in the XML definition.
		$groups = array_merge(parent::getGroups(), $groups);

		return $groups;
	}
}
menutype.php000060400000006642152456532740007144 0ustar00<?php
/**
 * @package     Joomla.Administrator
 * @subpackage  com_menus
 *
 * @copyright   (C) 2009 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\Utilities\ArrayHelper;

JFormHelper::loadFieldClass('list');

/**
 * Menu Type field.
 *
 * @since  1.6
 */
class JFormFieldMenutype extends JFormFieldList
{
	/**
	 * The form field type.
	 *
	 * @var     string
	 * @since   1.6
	 */
	protected $type = 'menutype';

	/**
	 * Method to get the field input markup.
	 *
	 * @return  string  The field input markup.
	 *
	 * @since   1.6
	 */
	protected function getInput()
	{
		$html     = array();
		$recordId = (int) $this->form->getValue('id');
		$size     = (string) ($v = $this->element['size']) ? ' size="' . $v . '"' : '';
		$class    = (string) ($v = $this->element['class']) ? ' class="' . $v . '"' : 'class="text_area"';
		$required = (string) $this->element['required'] ? ' required="required"' : '';
		$clientId = (int) $this->element['clientid'] ?: 0;

		// Get a reverse lookup of the base link URL to Title
		switch ($this->value)
		{
			case 'url':
				$value = JText::_('COM_MENUS_TYPE_EXTERNAL_URL');
				break;

			case 'alias':
				$value = JText::_('COM_MENUS_TYPE_ALIAS');
				break;

			case 'separator':
				$value = JText::_('COM_MENUS_TYPE_SEPARATOR');
				break;

			case 'heading':
				$value = JText::_('COM_MENUS_TYPE_HEADING');
				break;

			case 'container':
				$value = JText::_('COM_MENUS_TYPE_CONTAINER');
				break;

			default:
				$link = $this->form->getValue('link');

				/** @var  MenusModelMenutypes $model */
				$model = JModelLegacy::getInstance('Menutypes', 'MenusModel', array('ignore_request' => true));
				$model->setState('client_id', $clientId);

				$rlu   = $model->getReverseLookup();

				// Clean the link back to the option, view and layout
				$value = JText::_(ArrayHelper::getValue($rlu, MenusHelper::getLinkKey($link)));
				break;
		}

		// Include jQuery
		JHtml::_('jquery.framework');

		// Add the script to the document head.
		JFactory::getDocument()->addScriptDeclaration('
			function jSelectPosition_' . $this->id . '(name) {
				document.getElementById("' . $this->id . '").value = name;
			}
		'
		);

		$link = JRoute::_('index.php?option=com_menus&view=menutypes&tmpl=component&client_id=' . $clientId . '&recordId=' . $recordId);
		$html[] = '<span class="input-append"><input type="text" ' . $required . ' readonly="readonly" id="' . $this->id
			. '" value="' . $value . '" ' . $size . $class . ' />';
		$html[] = '<button type="button" data-target="#menuTypeModal" class="btn btn-primary" data-toggle="modal" title="' . JText::_('JSELECT') . '">'
			. '<span class="icon-list icon-white" aria-hidden="true"></span> '
			. JText::_('JSELECT') . '</button></span>';
		$html[] = JHtml::_(
			'bootstrap.renderModal',
			'menuTypeModal',
			array(
				'url'        => $link,
				'title'      => JText::_('COM_MENUS_ITEM_FIELD_TYPE_LABEL'),
				'width'      => '800px',
				'height'     => '300px',
				'modalWidth' => '80',
				'bodyHeight' => '70',
				'footer'     => '<button type="button" class="btn" data-dismiss="modal">'
						. JText::_('JLIB_HTML_BEHAVIOR_CLOSE') . '</button>'
			)
		);
		$html[] = '<input class="input-small" type="hidden" name="' . $this->name . '" value="'
			. htmlspecialchars($this->value, ENT_COMPAT, 'UTF-8') . '" />';

		return implode("\n", $html);
	}
}
menuparent.php000060400000004507152456532740007452 0ustar00<?php
/**
 * @package     Joomla.Administrator
 * @subpackage  com_menus
 *
 * @copyright   (C) 2009 Open Source Matters, Inc. <https://www.joomla.org>
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */

defined('_JEXEC') or die;

JFormHelper::loadFieldClass('list');

/**
 * Menu Parent field.
 *
 * @since  1.6
 */
class JFormFieldMenuParent extends JFormFieldList
{
	/**
	 * The form field type.
	 *
	 * @var        string
	 * @since   1.6
	 */
	protected $type = 'MenuParent';

	/**
	 * Method to get the field options.
	 *
	 * @return  array  The field option objects.
	 *
	 * @since   1.6
	 */
	protected function getOptions()
	{
		$options = array();

		$db = JFactory::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
		{
			// Skip special menu types
			$query->where('a.menutype != ' . $db->quote(''));
			$query->where('a.menutype != ' . $db->quote('main'));
		}

		// 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)
		{
			JError::raiseWarning(500, $e->getMessage());
		}

		// 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) . JText::_($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;
	}
}
componentscategory.php000060400000003404152456532740011212 0ustar00<?php
/**
 * @package     Joomla.Administrator
 * @subpackage  com_menus
 *
 * @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\Utilities\ArrayHelper;

JFormHelper::loadFieldClass('list');

/**
 * Components Category field.
 *
 * @since  1.6
 */
class JFormFieldComponentsCategory extends JFormFieldList
{
	/**
	 * The form field type.
	 *
	 * @var     string
	 * @since   3.7.0
	 */
	protected $type = 'ComponentsCategory';

	/**
	 * 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()
	{
		// Initialise variable.
		$db = JFactory::getDbo();
		$query = $db->getQuery(true)
			->select('DISTINCT a.name AS text, a.element AS value')
			->from('#__extensions as a')
			->where('a.enabled >= 1')
			->where('a.type =' . $db->quote('component'))
			->join('INNER', '#__categories as b ON a.element=b.extension');

		$items = $db->setQuery($query)->loadObjectList();

		if (count($items))
		{
			$lang = JFactory::getLanguage();

			foreach ($items as &$item)
			{
				// Load language
				$extension = $item->value;
				$source = JPATH_ADMINISTRATOR . '/components/' . $extension;
				$lang->load("$extension.sys", JPATH_ADMINISTRATOR, null, false, true)
					|| $lang->load("$extension.sys", $source, null, false, true);

				// Translate component name
				$item->text = JText::_($item->text);
			}

			// Sort by component name
			$items = ArrayHelper::sortObjects($items, 'text', 1, true, true);
		}

		// Merge any additional options in the XML definition.
		$options = array_merge(parent::getOptions(), $items);

		return $options;
	}
}
modal/menu.php000060400000031650152456532740007333 0ustar00<?php
/**
 * @package     Joomla.Administrator
 * @subpackage  com_menus
 *
 * @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\CMS\Language\LanguageHelper;

JHtml::_('bootstrap.tooltip', '.hasTooltip');

/**
 * Supports a modal menu item picker.
 *
 * @since  3.7.0
 */
class JFormFieldModal_Menu extends JFormField
{
	/**
	 * The form field type.
	 *
	 * @var     string
	 * @since   3.7.0
	 */
	protected $type = 'Modal_Menu';

	/**
	 * Determinate, if the select button is shown
	 *
	 * @var     boolean
	 * @since   3.7.0
	 */
	protected $allowSelect = true;

	/**
	 * Determinate, if the clear button is shown
	 *
	 * @var     boolean
	 * @since   3.7.0
	 */
	protected $allowClear = true;

	/**
	 * Determinate, if the create button is shown
	 *
	 * @var     boolean
	 * @since   3.7.0
	 */
	protected $allowNew = false;

	/**
	 * Determinate, if the edit button is shown
	 *
	 * @var     boolean
	 * @since   3.7.0
	 */
	protected $allowEdit = false;

	/**
	 * Determinate, if the propagate button is shown
	 *
	 * @var     boolean
	 * @since   3.9.0
	 */
	protected $allowPropagate = false;

	/**
	 * Method to get certain otherwise inaccessible properties from the form field object.
	 *
	 * @param   string  $name  The property name for which to get the value.
	 *
	 * @return  mixed  The property value or null.
	 *
	 * @since   3.7.0
	 */
	public function __get($name)
	{
		switch ($name)
		{
			case 'allowSelect':
			case 'allowClear':
			case 'allowNew':
			case 'allowEdit':
			case 'allowPropagate':
				return $this->$name;
		}

		return parent::__get($name);
	}

	/**
	 * Method to set certain otherwise inaccessible properties of the form field object.
	 *
	 * @param   string  $name   The property name for which to set the value.
	 * @param   mixed   $value  The value of the property.
	 *
	 * @return  void
	 *
	 * @since   3.7.0
	 */
	public function __set($name, $value)
	{
		switch ($name)
		{
			case 'allowSelect':
			case 'allowClear':
			case 'allowNew':
			case 'allowEdit':
			case 'allowPropagate':
				$value = (string) $value;
				$this->$name = !($value === 'false' || $value === 'off' || $value === '0');
				break;

			default:
				parent::__set($name, $value);
		}
	}

	/**
	 * Method to attach a JForm object to the field.
	 *
	 * @param   SimpleXMLElement  $element  The SimpleXMLElement object representing the `<field>` tag for the form field object.
	 * @param   mixed             $value    The form field value to validate.
	 * @param   string            $group    The field name group control value. This acts as an array container for the field.
	 *                                      For example if the field has name="foo" and the group value is set to "bar" then the
	 *                                      full field name would end up being "bar[foo]".
	 *
	 * @return  boolean  True on success.
	 *
	 * @see     JFormField::setup()
	 * @since   3.7.0
	 */
	public function setup(SimpleXMLElement $element, $value, $group = null)
	{
		$return = parent::setup($element, $value, $group);

		if ($return)
		{
			$this->allowSelect = ((string) $this->element['select']) !== 'false';
			$this->allowClear = ((string) $this->element['clear']) !== 'false';
			$this->allowPropagate = ((string) $this->element['propagate']) === 'true';

			// Creating/editing menu items is not supported in frontend.
			$isAdministrator = JFactory::getApplication()->isClient('administrator');
			$this->allowNew = $isAdministrator ? ((string) $this->element['new']) === 'true' : false;
			$this->allowEdit = $isAdministrator ? ((string) $this->element['edit']) === 'true' : false;
		}

		return $return;
	}

	/**
	 * Method to get the field input markup.
	 *
	 * @return  string  The field input markup.
	 *
	 * @since   3.7.0
	 */
	protected function getInput()
	{
		$clientId    = (int) $this->element['clientid'];
		$languages   = LanguageHelper::getContentLanguages(array(0, 1));

		// Load language
		JFactory::getLanguage()->load('com_menus', JPATH_ADMINISTRATOR);

		// The active article id field.
		$value = (int) $this->value > 0 ? (int) $this->value : '';

		// Create the modal id.
		$modalId = 'Item_' . $this->id;

		// Add the modal field script to the document head.
		JHtml::_('jquery.framework');
		JHtml::_('script', 'system/modal-fields.js', array('version' => 'auto', 'relative' => true));

		// Script to proxy the select modal function to the modal-fields.js file.
		if ($this->allowSelect)
		{
			static $scriptSelect = null;

			if (is_null($scriptSelect))
			{
				$scriptSelect = array();
			}

			if (!isset($scriptSelect[$this->id]))
			{
				JFactory::getDocument()->addScriptDeclaration("
				function jSelectMenu_" . $this->id . "(id, title, object) {
					window.processModalSelect('Item', '" . $this->id . "', id, title, '', object);
				}
				"
				);

				JText::script('JGLOBAL_ASSOCIATIONS_PROPAGATE_FAILED');

				$scriptSelect[$this->id] = true;
			}
		}

		// Setup variables for display.
		$linkSuffix = '&amp;layout=modal&amp;client_id=' . $clientId . '&amp;tmpl=component&amp;' . JSession::getFormToken() . '=1';
		$linkItems  = 'index.php?option=com_menus&amp;view=items' . $linkSuffix;
		$linkItem   = 'index.php?option=com_menus&amp;view=item' . $linkSuffix;
		$modalTitle = JText::_('COM_MENUS_CHANGE_MENUITEM');

		if (isset($this->element['language']))
		{
			$linkItems  .= '&amp;forcedLanguage=' . $this->element['language'];
			$linkItem   .= '&amp;forcedLanguage=' . $this->element['language'];
			$modalTitle .= ' &#8212; ' . $this->element['label'];
		}

		$urlSelect = $linkItems . '&amp;function=jSelectMenu_' . $this->id;
		$urlEdit   = $linkItem . '&amp;task=item.edit&amp;id=\' + document.getElementById("' . $this->id . '_id").value + \'';
		$urlNew    = $linkItem . '&amp;task=item.add';

		if ($value)
		{
			$db    = JFactory::getDbo();
			$query = $db->getQuery(true)
				->select($db->quoteName('title'))
				->from($db->quoteName('#__menu'))
				->where($db->quoteName('id') . ' = ' . (int) $value);

			$db->setQuery($query);

			try
			{
				$title = $db->loadResult();
			}
			catch (RuntimeException $e)
			{
				JError::raiseWarning(500, $e->getMessage());
			}
		}

		// Placeholder if option is present or not
		if (empty($title))
		{
			if ($this->element->option && (string) $this->element->option['value'] == '')
			{
				$title_holder = JText::_($this->element->option);
			}
			else
			{
				$title_holder = JText::_('COM_MENUS_SELECT_A_MENUITEM');
			}
		}

		$title = empty($title) ? $title_holder : htmlspecialchars($title, ENT_QUOTES, 'UTF-8');

		// The current menu item display field.
		$html  = '<span class="input-append">';
		$html .= '<input class="input-medium" id="' . $this->id . '_name" type="text" value="' . $title . '" disabled="disabled" size="35" />';

		// Select menu item button
		if ($this->allowSelect)
		{
			$html .= '<button'
				. ' type="button"'
				. ' class="btn hasTooltip' . ($value ? ' hidden' : '') . '"'
				. ' id="' . $this->id . '_select"'
				. ' data-toggle="modal"'
				. ' data-target="#ModalSelect' . $modalId . '"'
				. ' title="' . JHtml::tooltipText('COM_MENUS_CHANGE_MENUITEM') . '">'
				. '<span class="icon-file" aria-hidden="true"></span> ' . JText::_('JSELECT')
				. '</button>';
		}

		// New menu item button
		if ($this->allowNew)
		{
			$html .= '<button'
				. ' type="button"'
				. ' class="btn hasTooltip' . ($value ? ' hidden' : '') . '"'
				. ' id="' . $this->id . '_new"'
				. ' data-toggle="modal"'
				. ' data-target="#ModalNew' . $modalId . '"'
				. ' title="' . JHtml::tooltipText('COM_MENUS_NEW_MENUITEM') . '">'
				. '<span class="icon-new" aria-hidden="true"></span> ' . JText::_('JACTION_CREATE')
				. '</button>';
		}

		// Edit menu item button
		if ($this->allowEdit)
		{
			$html .= '<button'
				. ' type="button"'
				. ' class="btn hasTooltip' . ($value ? '' : ' hidden') . '"'
				. ' id="' . $this->id . '_edit"'
				. ' data-toggle="modal"'
				. ' data-target="#ModalEdit' . $modalId . '"'
				. ' title="' . JHtml::tooltipText('COM_MENUS_EDIT_MENUITEM') . '">'
				. '<span class="icon-edit" aria-hidden="true"></span> ' . JText::_('JACTION_EDIT')
				. '</button>';
		}

		// Clear menu item button
		if ($this->allowClear)
		{
			$html .= '<button'
				. ' type="button"'
				. ' class="btn' . ($value ? '' : ' hidden') . '"'
				. ' id="' . $this->id . '_clear"'
				. ' onclick="window.processModalParent(\'' . $this->id . '\'); return false;">'
				. '<span class="icon-remove" aria-hidden="true"></span>' . JText::_('JCLEAR')
				. '</button>';
		}

		// Propagate menu item button
		if ($this->allowPropagate && count($languages) > 2)
		{
			// Strip off language tag at the end
			$tagLength = (int) strlen($this->element['language']);
			$callbackFunctionStem = substr("jSelectMenu_" . $this->id, 0, -$tagLength);

			$html .= '<a'
			. ' class="btn hasTooltip' . ($value ? '' : ' hidden') . '"'
			. ' id="' . $this->id . '_propagate"'
			. ' href="#"'
			. ' title="' . JHtml::tooltipText('JGLOBAL_ASSOCIATIONS_PROPAGATE_TIP') . '"'
			. ' onclick="Joomla.propagateAssociation(\'' . $this->id . '\', \'' . $callbackFunctionStem . '\');">'
			. '<span class="icon-refresh" aria-hidden="true"></span>' . JText::_('JGLOBAL_ASSOCIATIONS_PROPAGATE_BUTTON')
			. '</a>';
		}

		$html .= '</span>';


		// Select menu item modal
		if ($this->allowSelect)
		{
			$html .= JHtml::_(
				'bootstrap.renderModal',
				'ModalSelect' . $modalId,
				array(
					'title'       => $modalTitle,
					'url'         => $urlSelect,
					'height'      => '400px',
					'width'       => '800px',
					'bodyHeight'  => '70',
					'modalWidth'  => '80',
					'footer'      => '<button type="button" class="btn" data-dismiss="modal">' . JText::_('JLIB_HTML_BEHAVIOR_CLOSE') . '</button>',
				)
			);
		}

		// New menu item modal
		if ($this->allowNew)
		{
			$html .= JHtml::_(
				'bootstrap.renderModal',
				'ModalNew' . $modalId,
				array(
					'title'       => JText::_('COM_MENUS_NEW_MENUITEM'),
					'backdrop'    => 'static',
					'keyboard'    => false,
					'closeButton' => false,
					'url'         => $urlNew,
					'height'      => '400px',
					'width'       => '800px',
					'bodyHeight'  => '70',
					'modalWidth'  => '80',
					'footer'      => '<button type="button" class="btn"'
							. ' onclick="window.processModalEdit(this, \'' . $this->id . '\', \'add\', \'item\', \'cancel\', \'item-form\'); return false;">'
							. JText::_('JLIB_HTML_BEHAVIOR_CLOSE') . '</button>'
							. '<button type="button" class="btn btn-primary"'
							. ' onclick="window.processModalEdit(this, \'' . $this->id . '\', \'add\', \'item\', \'save\', \'item-form\'); return false;">'
							. JText::_('JSAVE') . '</button>'
							. '<button type="button" class="btn btn-success"'
							. ' onclick="window.processModalEdit(this, \'' . $this->id . '\', \'add\', \'item\', \'apply\', \'item-form\'); return false;">'
							. JText::_('JAPPLY') . '</button>',
				)
			);
		}

		// Edit menu item modal
		if ($this->allowEdit)
		{
			$html .= JHtml::_(
				'bootstrap.renderModal',
				'ModalEdit' . $modalId,
				array(
					'title'       => JText::_('COM_MENUS_EDIT_MENUITEM'),
					'backdrop'    => 'static',
					'keyboard'    => false,
					'closeButton' => false,
					'url'         => $urlEdit,
					'height'      => '400px',
					'width'       => '800px',
					'bodyHeight'  => '70',
					'modalWidth'  => '80',
					'footer'      => '<button type="button" class="btn"'
							. ' onclick="window.processModalEdit(this, \'' . $this->id . '\', \'edit\', \'item\', \'cancel\', \'item-form\'); return false;">'
							. JText::_('JLIB_HTML_BEHAVIOR_CLOSE') . '</button>'
							. '<button type="button" class="btn btn-primary"'
							. ' onclick="window.processModalEdit(this, \'' . $this->id . '\', \'edit\', \'item\', \'save\', \'item-form\'); return false;">'
							. JText::_('JSAVE') . '</button>'
							. '<button type="button" class="btn btn-success"'
							. ' onclick="window.processModalEdit(this, \'' . $this->id . '\', \'edit\', \'item\', \'apply\', \'item-form\'); return false;">'
							. JText::_('JAPPLY') . '</button>',
				)
			);
		}

		// Note: class='required' for client side validation.
		$class = $this->required ? ' class="required modal-value"' : '';

		// Placeholder if option is present or not when clearing field
		if ($this->element->option && (string) $this->element->option['value'] == '')
		{
			$title_holder = JText::_($this->element->option);
		}
		else
		{
			$title_holder = JText::_('COM_MENUS_SELECT_A_MENUITEM');
		}

		$html .= '<input type="hidden" id="' . $this->id . '_id" ' . $class . ' data-required="' . (int) $this->required . '" name="' . $this->name
			. '" data-text="' . htmlspecialchars($title_holder, ENT_COMPAT, 'UTF-8') . '" value="' . $value . '" />';

		return $html;
	}

	/**
	 * Method to get the field label markup.
	 *
	 * @return  string  The field label markup.
	 *
	 * @since   3.7.0
	 */
	protected function getLabel()
	{
		return str_replace($this->id, $this->id . '_id', parent::getLabel());
	}
}
menuordering.php000060400000004701152456532740007766 0ustar00<?php
/**
 * @package     Joomla.Administrator
 * @subpackage  com_menus
 *
 * @copyright   (C) 2011 Open Source Matters, Inc. <https://www.joomla.org>
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */

defined('_JEXEC') or die;

JFormHelper::loadFieldClass('list');

/**
 * Menu Ordering field.
 *
 * @since  1.6
 */
class JFormFieldMenuOrdering extends JFormFieldList
{
	/**
	 * The form field type.
	 *
	 * @var        string
	 * @since   1.7
	 */
	protected $type = 'MenuOrdering';

	/**
	 * Method to get the list of siblings in a menu.
	 * The method requires that parent be set.
	 *
	 * @return  array  The field option objects or false if the parent field has not been set
	 *
	 * @since   1.7
	 */
	protected function getOptions()
	{
		$options = array();

		// Get the parent
		$parent_id = $this->form->getValue('parent_id', 0);

		if (empty($parent_id))
		{
			return false;
		}

		$db = JFactory::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)
		{
			JError::raiseWarning(500, $e->getMessage());
		}

		// Allow translation of custom admin menus
		foreach ($options as &$option)
		{
			if ($option->clientId != 0)
			{
				$option->text = JText::_($option->text);
			}
		}

		$options = array_merge(
			array(array('value' => '-1', 'text' => JText::_('COM_MENUS_ITEM_FIELD_ORDERING_VALUE_FIRST'))),
			$options,
			array(array('value' => '-2', 'text' => JText::_('COM_MENUS_ITEM_FIELD_ORDERING_VALUE_LAST')))
		);

		// Merge any additional options in the XML definition.
		$options = array_merge(parent::getOptions(), $options);

		return $options;
	}

	/**
	 * Method to get the field input markup.
	 *
	 * @return  string  The field input markup.
	 *
	 * @since   1.7
	 */
	protected function getInput()
	{
		if ($this->form->getValue('id', 0) == 0)
		{
			return '<span class="readonly">' . JText::_('COM_MENUS_ITEM_FIELD_ORDERING_TEXT') . '</span>';
		}
		else
		{
			return parent::getInput();
		}
	}
}
fieldlayout.php000060400000011051152456624060007602 0ustar00<?php
/**
 * @package     Joomla.Administrator
 * @subpackage  com_fields
 *
 * @copyright   (C) 2018 Open Source Matters, Inc. <https://www.joomla.org>
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */

defined('_JEXEC') or die;

jimport('joomla.filesystem.folder');

/**
 * Form Field to display a list of the layouts for a field from
 * the extension or template overrides.
 *
 * @since  3.9.0
 */
class JFormFieldFieldlayout extends JFormField
{
	/**
	 * The form field type.
	 *
	 * @var    string
	 * @since  3.9.0
	 */
	protected $type = 'FieldLayout';

	/**
	 * Method to get the field input for a field layout field.
	 *
	 * @return  string   The field input.
	 *
	 * @since   3.9.0
	 */
	protected function getInput()
	{
		$extension = explode('.', $this->form->getValue('context'));
		$extension = $extension[0];

		if ($extension)
		{
			// Get the database object and a new query object.
			$db = JFactory::getDbo();
			$query = $db->getQuery(true);

			// Build the query.
			$query->select('element, name')
				->from('#__extensions')
				->where('client_id = 0')
				->where('type = ' . $db->quote('template'))
				->where('enabled = 1');

			// Set the query and load the templates.
			$db->setQuery($query);
			$templates = $db->loadObjectList('element');

			// Build the search paths for component layouts.
			$component_path = JPath::clean(JPATH_SITE . '/components/' . $extension . '/layouts/field');

			// Prepare array of component layouts
			$component_layouts = array();

			// Prepare the grouped list
			$groups = array();

			// Add "Use Default"
			$groups[]['items'][] = JHtml::_('select.option', '', JText::_('JOPTION_USE_DEFAULT'));

			// Add the layout options from the component path.
			if (is_dir($component_path) && ($component_layouts = JFolder::files($component_path, '^[^_]*\.php$', false, true)))
			{
				// Create the group for the component
				$groups['_'] = array();
				$groups['_']['id'] = $this->id . '__';
				$groups['_']['text'] = JText::sprintf('JOPTION_FROM_COMPONENT');
				$groups['_']['items'] = array();

				foreach ($component_layouts as $i => $file)
				{
					// Add an option to the component group
					$value = basename($file, '.php');
					$component_layouts[$i] = $value;

					if ($value === 'render')
					{
						continue;
					}

					$groups['_']['items'][] = JHtml::_('select.option', $value, $value);
				}
			}

			// Loop on all templates
			if ($templates)
			{
				foreach ($templates as $template)
				{
					$files = array();
					$template_paths = array(
						JPath::clean(JPATH_SITE . '/templates/' . $template->element . '/html/layouts/' . $extension . '/field'),
						JPath::clean(JPATH_SITE . '/templates/' . $template->element . '/html/layouts/com_fields/field'),
						JPath::clean(JPATH_SITE . '/templates/' . $template->element . '/html/layouts/field'),
					);

					// Add the layout options from the template paths.
					foreach ($template_paths as $template_path)
					{
						if (is_dir($template_path))
						{
							$files = array_merge($files, JFolder::files($template_path, '^[^_]*\.php$', false, true));
						}
					}

					foreach ($files as $i => $file)
					{
						$value = basename($file, '.php');

						// Remove the default "render.php" or layout files that exist in the component folder
						if ($value === 'render' || in_array($value, $component_layouts))
						{
							unset($files[$i]);
						}
					}

					if (count($files))
					{
						// Create the group for the template
						$groups[$template->name] = array();
						$groups[$template->name]['id'] = $this->id . '_' . $template->element;
						$groups[$template->name]['text'] = JText::sprintf('JOPTION_FROM_TEMPLATE', $template->name);
						$groups[$template->name]['items'] = array();

						foreach ($files as $file)
						{
							// Add an option to the template group
							$value = basename($file, '.php');
							$groups[$template->name]['items'][] = JHtml::_('select.option', $value, $value);
						}
					}
				}
			}

			// Compute attributes for the grouped list
			$attr = $this->element['size'] ? ' size="' . (int) $this->element['size'] . '"' : '';
			$attr .= $this->element['class'] ? ' class="' . (string) $this->element['class'] . '"' : '';

			// Prepare HTML code
			$html = array();

			// Compute the current selected values
			$selected = array($this->value);

			// Add a grouped list
			$html[] = JHtml::_(
				'select.groupedlist', $groups, $this->name,
				array('id' => $this->id, 'group.id' => 'id', 'list.attr' => $attr, 'list.select' => $selected)
			);

			return implode($html);
		}

		return '';
	}
}
section.php000060400000004032152456624060006726 0ustar00<?php
/**
 * @package     Joomla.Administrator
 * @subpackage  com_fields
 *
 * @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;

JFormHelper::loadFieldClass('list');

/**
 * Fields Section
 *
 * @since  3.7.0
 */
class JFormFieldSection extends JFormFieldList
{
	public $type = 'Section';

	/**
	 * Method to attach a JForm object to the field.
	 *
	 * @param   SimpleXMLElement  $element  The SimpleXMLElement object representing the `<field>` tag for the form field object.
	 * @param   mixed             $value    The form field value to validate.
	 * @param   string            $group    The field name group control value. This acts as an array container for the field.
	 *                                      For example if the field has name="foo" and the group value is set to "bar" then the
	 *                                      full field name would end up being "bar[foo]".
	 *
	 * @return  boolean  True on success.
	 *
	 * @since   3.7.0
	 */
	public function setup(SimpleXMLElement $element, $value, $group = null)
	{
		$return = parent::setup($element, $value, $group);

		// Onchange must always be the change context function
		$this->onchange = 'fieldsChangeContext(jQuery(this).val());';

		return $return;
	}

	/**
	 * Method to get the field input markup for a generic list.
	 * Use the multiple attribute to enable multiselect.
	 *
	 * @return  string  The field input markup.
	 *
	 * @since   3.7.0
	 */
	protected function getInput()
	{
		// Add the change context function to the document
		JFactory::getDocument()->addScriptDeclaration(
			"function fieldsChangeContext(context)
				{
					var regex = new RegExp(\"([?;&])context[^&;]*[;&]?\");
					var url = window.location.href;
					var query = url.replace(regex, \"$1\").replace(/&$/, '');
    					window.location.href = (query.length > 2 ? query + \"&\" : \"?\") + (context ? \"context=\" + context : '');
				}"
		);

		return parent::getInput();
	}
}
fieldcontexts.php000060400000002725152456624060010144 0ustar00<?php
/**
 * @package     Joomla.Administrator
 * @subpackage  com_fields
 *
 * @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;

JFormHelper::loadFieldClass('list');

/**
 * Fields Contexts
 *
 * @since  3.7.0
 */
class JFormFieldFieldcontexts extends JFormFieldList
{
	public $type = 'Fieldcontexts';

	/**
	 * Method to get the field input markup for a generic list.
	 * Use the multiple attribute to enable multiselect.
	 *
	 * @return  string  The field input markup.
	 *
	 * @since   3.7.0
	 */
	protected function getInput()
	{
		return $this->getOptions() ? parent::getInput() : '';
	}

	/**
	 * Method to get the field options.
	 *
	 * @return  array  The field option objects.
	 *
	 * @since   3.7.0
	 */
	protected function getOptions()
	{
		$parts = explode('.', $this->value);
		$eName = str_replace('com_', '', $parts[0]);
		$file = JPath::clean(JPATH_ADMINISTRATOR . '/components/' . $parts[0] . '/helpers/' . $eName . '.php');
		$contexts = array();

		if (!file_exists($file))
		{
			return array();
		}

		$prefix = ucfirst($eName);
		$cName = $prefix . 'Helper';

		JLoader::register($cName, $file);

		if (class_exists($cName) && is_callable(array($cName, 'getContexts')))
		{
			$contexts = $cName::getContexts();
		}

		if (!$contexts || !is_array($contexts) || count($contexts) == 1)
		{
			return array();
		}

		return $contexts;
	}
}
fieldgroups.php000060400000003105152456624060007605 0ustar00<?php
/**
 * @package     Joomla.Administrator
 * @subpackage  com_fields
 *
 * @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\Utilities\ArrayHelper;

JFormHelper::loadFieldClass('list');

/**
 * Fields Groups
 *
 * @since  3.7.0
 */
class JFormFieldFieldgroups extends JFormFieldList
{
	public $type = 'Fieldgroups';

	/**
	 * Method to get the field options.
	 *
	 * @return  array  The field option objects.
	 *
	 * @since   3.7.0
	 */
	protected function getOptions()
	{
		$context = (string) $this->element['context'];
		$states    = $this->element['state'] ?: '0,1';
		$states    = ArrayHelper::toInteger(explode(',', $states));

		$user       = JFactory::getUser();
		$viewlevels = ArrayHelper::toInteger($user->getAuthorisedViewLevels());

		$db    = JFactory::getDbo();
		$query = $db->getQuery(true);
		$query->select('title AS text, id AS value, state');
		$query->from('#__fields_groups');
		$query->where('state IN (' . implode(',', $states) . ')');
		$query->where('context = ' . $db->quote($context));
		$query->where('access IN (' . implode(',', $viewlevels) . ')');
		$query->order('ordering asc, id asc');

		$db->setQuery($query);
		$options = $db->loadObjectList();

		foreach ($options AS $option)
		{
			if ($option->state == 0)
			{
				$option->text = '[' . $option->text . ']';
			}

			if ($option->state == 2)
			{
				$option->text = '{' . $option->text . '}';
			}
		}

		return array_merge(parent::getOptions(), $options);
	}
}
languageclient.php000060400000003361152456625020010245 0ustar00<?php
/**
 * @package     Joomla.Administrator
 * @subpackage  com_newsfeeds
 *
 * @copyright   (C) 2018 Open Source Matters, Inc. <https://www.joomla.org>
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */

defined('_JEXEC') or die;

JFormHelper::loadFieldClass('list');

/**
 * Client Language List field.
 *
 * @since  3.9.0
 */
class JFormFieldLanguageclient extends JFormFieldList
{
	/**
	 * The form field type.
	 *
	 * @var		string
	 * @since   3.9.0
	 */
	protected $type = 'Languageclient';

	/**
	 * Cached form field options.
	 *
	 * @var		array
	 * @since   3.9.0
	 */
	protected $cache = array();

	/**
	 * Method to get the field options.
	 *
	 * @return  array  The field option objects.
	 *
	 * @since   3.9.0
	 */
	protected function getOptions()
	{
		// Try to load the data from our mini-cache.
		if (!empty($this->cache))
		{
			return $this->cache;
		}

		// Get all languages of frontend and backend.
		$languages       = array();
		$site_languages  = JLanguageHelper::getKnownLanguages(JPATH_SITE);
		$admin_languages = JLanguageHelper::getKnownLanguages(JPATH_ADMINISTRATOR);

		// Create a single array of them.
		foreach ($site_languages as $tag => $language)
		{
			$languages[$tag . '0'] = JText::sprintf('COM_LANGUAGES_VIEW_OVERRIDES_LANGUAGES_BOX_ITEM', $language['name'], JText::_('JSITE'));
		}

		foreach ($admin_languages as $tag => $language)
		{
			$languages[$tag . '1'] = JText::sprintf('COM_LANGUAGES_VIEW_OVERRIDES_LANGUAGES_BOX_ITEM', $language['name'], JText::_('JADMINISTRATOR'));
		}

		// Sort it by language tag and by client after that.
		ksort($languages);

		// Add the languages to the internal cache.
		$this->cache = array_merge(parent::getOptions(), $languages);

		return $this->cache;
	}
}
searchfilter.php000060400000002173152456625340007743 0ustar00<?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
 */

defined('JPATH_BASE') or die();

JFormHelper::loadFieldClass('list');

/**
 * Search Filter field for the Finder package.
 *
 * @since  2.5
 */
class JFormFieldSearchFilter extends JFormFieldList
{
	/**
	 * 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 = JFactory::getDbo();
		$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, JHtml::_('select.option', '', JText::_('COM_FINDER_SELECT_SEARCH_FILTER'), 'value', 'text'));

		return $options;
	}
}
contentmap.php000060400000006155152456625340007444 0ustar00<?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
 */

defined('JPATH_PLATFORM') or die;

JFormHelper::loadFieldClass('groupedlist');

JLoader::register('FinderHelperLanguage', JPATH_ADMINISTRATOR . '/components/com_finder/helpers/language.php');

/**
 * Supports a select grouped list of finder content map.
 *
 * @since  3.6.0
 */
class JFormFieldContentMap extends JFormFieldGroupedList
{
	/**
	 * 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 = array();

		// Get the database object and a new query object.
		$db = JFactory::getDbo();

		// Levels subquery.
		$levelQuery = $db->getQuery(true);
		$levelQuery->select('title AS branch_title, 1 as level')
			->select($db->quoteName('id'))
			->from($db->quoteName('#__finder_taxonomy'))
			->where($db->quoteName('parent_id') . ' = 1');
		$levelQuery2 = $db->getQuery(true);
		$levelQuery2->select('b.title AS branch_title, 2 as level')
			->select($db->quoteName('a.id'))
			->from($db->quoteName('#__finder_taxonomy', 'a'))
			->join('LEFT', $db->quoteName('#__finder_taxonomy', 'b') . ' ON ' . $db->qn('a.parent_id') . ' = ' . $db->qn('b.id'))
			->where($db->quoteName('a.parent_id') . ' NOT IN (0, 1)');

		$levelQuery->union($levelQuery2);

		// Main query.
		$query = $db->getQuery(true)
			->select($db->quoteName('a.title', 'text'))
			->select($db->quoteName('a.id', 'value'))
			->select($db->quoteName('d.level'))
			->from($db->quoteName('#__finder_taxonomy', 'a'))
			->join('LEFT', '(' . $levelQuery . ') AS d ON ' . $db->qn('d.id') . ' = ' . $db->qn('a.id'))
			->where($db->quoteName('a.parent_id') . ' <> 0')
			->order('d.branch_title ASC, d.level ASC, a.title ASC');

		$db->setQuery($query);

		try
		{
			$contentMap = $db->loadObjectList();
		}
		catch (RuntimeException $e)
		{
			return;
		}

		// Build the grouped list array.
		if ($contentMap)
		{
			$lang = JFactory::getLanguage();

			foreach ($contentMap as $branch)
			{
				if ((int) $branch->level === 1)
				{
					$name = $branch->text;
				}
				else
				{
					$levelPrefix = str_repeat('- ', max(0, $branch->level - 1));

					if (trim($name, '**') === 'Language')
					{
						$text = FinderHelperLanguage::branchLanguageTitle($branch->text);
					}
					else
					{
						$key = FinderHelperLanguage::branchSingular($branch->text);
						$text = $lang->hasKey($key) ? JText::_($key) : $branch->text;
					}

					// Initialize the group if necessary.
					if (!isset($groups[$name]))
					{
						$groups[$name] = array();
					}

					$groups[$name][] = JHtml::_('select.option', $branch->value, $levelPrefix . $text);
				}
			}
		}

		// Merge any additional groups in the XML definition.
		$groups = array_merge(parent::getGroups(), $groups);

		return $groups;
	}
}
contenttypes.php000060400000003662152456625340010033 0ustar00<?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
 */

defined('JPATH_BASE') or die();

use Joomla\Utilities\ArrayHelper;

JLoader::register('FinderHelperLanguage', JPATH_ADMINISTRATOR . '/components/com_finder/helpers/language.php');

JFormHelper::loadFieldClass('list');

/**
 * Content Types Filter field for the Finder package.
 *
 * @since  3.6.0
 */
class JFormFieldContentTypes extends JFormFieldList
{
	/**
	 * 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    = JFactory::getLanguage();
		$options = array();

		$db    = JFactory::getDbo();
		$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)
		{
			JError::raiseWarning(500, $db->getMessage());
		}

		// Translate.
		foreach ($contentTypes as $contentType)
		{
			$key = FinderHelperLanguage::branchSingular($contentType->text);
			$contentType->translatedText = $lang->hasKey($key) ? JText::_($key) : $contentType->text;
		}

		// Order by title.
		$contentTypes = ArrayHelper::sortObjects($contentTypes, 'translatedText', 1, true, true);

		// Convert the values to options.
		foreach ($contentTypes as $contentType)
		{
			$options[] = JHtml::_('select.option', $contentType->value, $contentType->translatedText);
		}

		// Merge any additional options in the XML definition.
		$options = array_merge(parent::getOptions(), $options);

		return $options;
	}
}
directories.php000060400000004215152456625340007603 0ustar00<?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
 */

defined('_JEXEC') or die;

// Load the base adapter.
JLoader::register('FinderIndexerAdapter', JPATH_ADMINISTRATOR . '/components/com_finder/helpers/indexer/adapter.php');

JFormHelper::loadFieldClass('list');

/**
 * Renders a list of directories.
 *
 * @since       2.5
 * @deprecated  4.0  Use JFormFieldFolderlist
 */
class JFormFieldDirectories extends JFormFieldList
{
	/**
	 * The form field type.
	 *
	 * @var    string
	 * @since  2.5
	 */
	protected $type = 'Directories';

	/**
	 * Method to get the field options.
	 *
	 * @return  array  The field option objects.
	 *
	 * @since   2.5
	 */
	public function getOptions()
	{
		$values  = array();
		$options = array();
		$exclude = array(
			JPATH_ADMINISTRATOR,
			JPATH_INSTALLATION,
			JPATH_LIBRARIES,
			JPATH_PLUGINS,
			JPATH_SITE . '/cache',
			JPATH_SITE . '/components',
			JPATH_SITE . '/includes',
			JPATH_SITE . '/language',
			JPATH_SITE . '/modules',
			JPATH_THEMES,
			JFactory::getApplication()->get('log_path'),
			JFactory::getApplication()->get('tmp_path')
		);

		// Get the base directories.
		jimport('joomla.filesystem.folder');
		$dirs = JFolder::folders(JPATH_SITE, '.', false, true);

		// Iterate through the base directories and find the subdirectories.
		foreach ($dirs as $dir)
		{
			// Check if the directory should be excluded.
			if (in_array($dir, $exclude))
			{
				continue;
			}

			// Get the child directories.
			$return = JFolder::folders($dir, '.', true, true);

			// Merge the directories.
			if (is_array($return))
			{
				$values[] = $dir;
				$values = array_merge($values, $return);
			}
		}

		// Convert the values to options.
		foreach ($values as $value)
		{
			$options[] = JHtml::_('select.option', str_replace(JPATH_SITE . '/', '', $value), str_replace(JPATH_SITE . '/', '', $values));
		}

		// Add a null option.
		array_unshift($options, JHtml::_('select.option', '', '- ' . JText::_('JNONE') . ' -'));

		return $options;
	}
}
branches.php000060400000001335152456625340007054 0ustar00<?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
 */

defined('JPATH_BASE') or die();

JFormHelper::loadFieldClass('list');

/**
 * Search Branches field for the Finder package.
 *
 * @since  3.5
 */
class JFormFieldBranches extends JFormFieldList
{
	/**
	 * 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()
	{
		return JHtml::_('finder.mapslist');
	}
}
usermessages.php000060400000003240152456625440007773 0ustar00<?php
/**
 * @package     Joomla.Administrator
 * @subpackage  com_messages
 *
 * @copyright   (C) 2010 Open Source Matters, Inc. <https://www.joomla.org>
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */

defined('_JEXEC') or die;

JFormHelper::loadFieldClass('user');

/**
 * Supports a modal select of users that have access to com_messages
 *
 * @since  1.6
 */
class JFormFieldUserMessages extends JFormFieldUser
{
	/**
	 * The form field type.
	 *
	 * @var		string
	 * @since   1.6
	 */
	public $type = 'UserMessages';

	/**
	 * Method to get the filtering groups (null means no filtering)
	 *
	 * @return  array|null	array of filtering groups or null.
	 *
	 * @since   1.6
	 */
	protected function getGroups()
	{
		// Compute usergroups
		$db = JFactory::getDbo();
		$query = $db->getQuery(true)
			->select('id')
			->from('#__usergroups');
		$db->setQuery($query);

		try
		{
			$groups = $db->loadColumn();
		}
		catch (RuntimeException $e)
		{
			JError::raiseNotice(500, $e->getMessage());

			return null;
		}

		foreach ($groups as $i => $group)
		{
			if (JAccess::checkGroup($group, 'core.admin'))
			{
				continue;
			}

			if (!JAccess::checkGroup($group, 'core.manage', 'com_messages'))
			{
				unset($groups[$i]);
				continue;
			}

			if (!JAccess::checkGroup($group, 'core.login.admin'))
			{
				unset($groups[$i]);
				continue;
			}
		}

		return array_values($groups);
	}

	/**
	 * Method to get the users to exclude from the list of users
	 *
	 * @return  array|null array of users to exclude or null to to not exclude them
	 *
	 * @since   1.6
	 */
	protected function getExcluded()
	{
		return array(JFactory::getUser()->id);
	}
}
messagestates.php000060400000001670152456625440010142 0ustar00<?php
/**
 * @package     Joomla.Administrator
 * @subpackage  com_messages
 *
 * @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;

JLoader::register('MessagesHelper', JPATH_ADMINISTRATOR . '/components/com_messages/helpers/messages.php');

JFormHelper::loadFieldClass('list');

/**
 * Message States field.
 *
 * @since  3.6.0
 */
class JFormFieldMessageStates extends JFormFieldList
{
	/**
	 * The form field type.
	 *
	 * @var     string
	 * @since   3.6.0
	 */
	protected $type = 'MessageStates';

	/**
	 * Method to get the field options.
	 *
	 * @return  array  The field option objects.
	 *
	 * @since   3.6.0
	 */
	protected function getOptions()
	{
		// Merge state options with any additional options in the XML definition.
		return array_merge(parent::getOptions(), MessagesHelper::getStateOptions());
	}
}
templatename.php000060400000002223152456625440007741 0ustar00<?php
/**
 * @package     Joomla.Administrator
 * @subpackage  com_templates
 *
 * @copyright   (C) 2015 Open Source Matters, Inc. <https://www.joomla.org>
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */

defined('_JEXEC') or die;

JLoader::register('TemplatesHelper', JPATH_ADMINISTRATOR . '/components/com_templates/helpers/templates.php');

JFormHelper::loadFieldClass('list');

/**
 * Template Name field.
 *
 * @since  3.5
 */
class JFormFieldTemplateName extends JFormFieldList
{
	/**
	 * The form field type.
	 *
	 * @var	   string
	 * @since  3.5
	 */
	protected $type = 'TemplateName';

	/**
	 * Method to get the field options.
	 *
	 * @return  array  The field option objects.
	 *
	 * @since   1.6
	 */
	public function getOptions()
	{
		// Get the client_id filter from the user state.
		$clientId = JFactory::getApplication()->getUserStateFromRequest('com_templates.styles.client_id', 'client_id', '0', 'string');

		// Get the templates for the selected client_id.
		$options = TemplatesHelper::getTemplateOptions($clientId);

		// Merge into the parent options.
		return array_merge(parent::getOptions(), $options);
	}
}
templatelocation.php000060400000001610152456625440010630 0ustar00<?php
/**
 * @package     Joomla.Administrator
 * @subpackage  com_templates
 *
 * @copyright   (C) 2015 Open Source Matters, Inc. <https://www.joomla.org>
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */

defined('_JEXEC') or die;

JLoader::register('TemplatesHelper', JPATH_ADMINISTRATOR . '/components/com_templates/helpers/templates.php');

JFormHelper::loadFieldClass('list');

/**
 * Template Location field.
 *
 * @since  3.5
 */
class JFormFieldTemplateLocation extends JFormFieldList
{
	/**
	 * The form field type.
	 *
	 * @var	   string
	 * @since  3.5
	 */
	protected $type = 'TemplateLocation';

	/**
	 * Method to get the field options.
	 *
	 * @return  array  The field option objects.
	 *
	 * @since   3.5
	 */
	public function getOptions()
	{
		$options = TemplatesHelper::getClientOptions();

		return array_merge(parent::getOptions(), $options);
	}
}
dob.php000060400000001163152456631720006031 0ustar00<?php
/**
 * @package     Joomla.Site
 * @subpackage  Layout
 *
 * @copyright   (C) 2014 Open Source Matters, Inc. <https://www.joomla.org>
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */

defined('_JEXEC') or die;

/**
 * $text  string  infotext to be displayed
 */
extract($displayData);

// Closing the opening .control-group and .control-label div so we can add our info text on own line ?>
</div></div>
<div class="controls"><?php echo $text; ?></div>
<?php // Creating new .control-group and .control-label for the actual field ?>
<div class="control-group"><div class="control-label">
requeststatus.php000060400000001525152456637040010224 0ustar00<?php
/**
 * @package     Joomla.Administrator
 * @subpackage  com_privacy
 *
 * @copyright   (C) 2018 Open Source Matters, Inc. <https://www.joomla.org>
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */

defined('_JEXEC') or die;

JFormHelper::loadFieldClass('predefinedlist');

/**
 * Form Field to load a list of request statuses
 *
 * @since  3.9.0
 */
class PrivacyFormFieldRequeststatus extends JFormFieldPredefinedList
{
	/**
	 * The form field type.
	 *
	 * @var    string
	 * @since  3.9.0
	 */
	public $type = 'RequestStatus';

	/**
	 * Available statuses
	 *
	 * @var    array
	 * @since  3.9.0
	 */
	protected $predefinedOptions = array(
		'-1' => 'COM_PRIVACY_STATUS_INVALID',
		'0'  => 'COM_PRIVACY_STATUS_PENDING',
		'1'  => 'COM_PRIVACY_STATUS_CONFIRMED',
		'2'  => 'COM_PRIVACY_STATUS_COMPLETED',
	);
}
requesttype.php000060400000001443152456637040007661 0ustar00<?php
/**
 * @package     Joomla.Administrator
 * @subpackage  com_privacy
 *
 * @copyright   (C) 2018 Open Source Matters, Inc. <https://www.joomla.org>
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */

defined('_JEXEC') or die;

JFormHelper::loadFieldClass('predefinedlist');

/**
 * Form Field to load a list of request types
 *
 * @since  3.9.0
 */
class PrivacyFormFieldRequesttype extends JFormFieldPredefinedList
{
	/**
	 * The form field type.
	 *
	 * @var    string
	 * @since  3.9.0
	 */
	public $type = 'RequestType';

	/**
	 * Available types
	 *
	 * @var    array
	 * @since  3.9.0
	 */
	protected $predefinedOptions = array(
		'export' => 'COM_PRIVACY_HEADING_REQUEST_TYPE_TYPE_EXPORT',
		'remove' => 'COM_PRIVACY_HEADING_REQUEST_TYPE_TYPE_REMOVE',
	);
}
user.xml000060400000000357152456637140006262 0ustar00<?xml version="1.0" encoding="utf-8"?>
<form>
	<fields name="params" label="COM_FIELDS_FIELD_BASIC_LABEL">
		<fieldset name="basic">
			<field
				name="display"
				type="hidden"
			    	default="2"
			/>
		</fieldset>
	</fields>
</form>
calendar-rtl.css000060400000010250152456673550007642 0ustar00/**
 * @copyright	(C) 2016 Open Source Matters, Inc. <https://www.joomla.org>
 * @license		GNU General Public License version 2 or later; see LICENSE.txt
 */
 .js-calendar {
	box-shadow: 0 0 15px 4px rgba(0,0,0,.15) !important;
 }
.calendar-container {
	float: left;
	min-width: 160px;
	padding: 0;
	list-style: none;
	border-radius: 5px;
	background-color: #ffffff !important;
	z-index: 1100 !important;
}
.calendar-container table {
	table-layout: fixed;
	max-width: 262px;
	border-radius: 5px;
	background-color: #ffffff !important;
	z-index: 1100 !important;
}
/* The main calendar widget.  DIV containing a table. */
div.calendar-container table th, .calendar-container table td {
	padding: 8px 0;
	line-height: 1.1em;
	text-align: center;
}

div.calendar-container table body td {
	line-height: 2em;
}

div.calendar-container table td.title { /* This holds the current "month, year" */
	vertical-align: middle;
	text-align: center;
}

.calendar-container table thead td.headrow { /* Row <TR> containing navigation buttons */
	background: #fff;
	color: #000;
}

.calendar-container table thead td.name { /* Cells <TD> containing the day names */
	border-bottom: 1px solid #fff;
	text-align: center;
	color: #000;
}

.calendar-container table thead td.weekend { /* How a weekend day name shows in header */
	color: #999;
}

/* The body part -- contains all the days in month. */

.calendar-container table tbody td.day { /* Cells <TD> containing month days dates */
	text-align: right;
}

.calendar-container table tbody td.wn {
	background: #fff;
}

.calendar-container table tbody td.weekend { /* Cells showing weekend days */
	color: #999;
}

.calendar-container table tbody td.hilite { /* Hovered cells <TD> */
	background: #999999;
	color: #ffffff;
}

.calendar-container table tbody td.day {
	border: 0;
	cursor : pointer;
	font-size: 12px;
	min-width: 38px;
}

.calendar-container table tbody td.day.wn {
	text-align: center;
	background-color: #f4f4f4;
}

.calendar-container table tbody td.day.selected { /* Cell showing today date */
	background: #3071a9;
	color: #fff;
	border: 0;
}

.calendar-container table tbody td.today {
	position: relative;
	height: 100%;
	width: auto;
	font-weight: bold;
}
.calendar-container table tbody td.today:after {
	position: absolute;
	bottom: 3px;
	left: 3px;
	right: 3px;
	content: "";
	height: 3px;
	border-radius: 1.5px;
	background-color: #46a546;
}
.calendar-container table tbody td.today.selected:after {
	background-color: #fff;
}

.calendar-container table tbody td.day:hover {
	cursor: pointer;
	background: #3d8fd7;
	color: #fff;
}
.calendar-container table tbody td.day:hover:after {
	background-color: #fff;
}

.calendar-container table tbody .disabled {
	color: #999;
	background-color: #fafafa;
}

.calendar-container table tbody .emptycell { /* Empty cells (the best is to hide them) */
	visibility: hidden;
}

.calendar-container table tbody .emptyrow { /* Empty row (some months need less than 6 rows) */
	display: none;
}

.buttons-wrapper {
	padding: 5px 5px;
}
a.js-btn.btn.btn-exit, a.js-btn.btn.btn-today, a.js-btn.btn.btn-clear {
	cursor: pointer;
	text-decoration: none;
	min-width: 60px;
}
.calendar-container .calendar-head-row td {
	padding: 4px 0 !important;
}
.calendar-container .day-name {
	font-size: 0.7rem;
	font-weight: bold;
}
.calendar-container .time td {
	padding: 8px 8px 8px 0;
}
.time .time-title {
	background-image: url("data:image/png;base64, iVBORw0KGgoAAAANSUhEUgAAABYAAAAWCAYAAADEtGw7AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAdlJREFUeNqklUsohFEUx7/5kgWGjEcRJULJSmJhITQLr8UoFko2k2SDLGZD2SglJcXOxo6Fx0ayUt4jWXgNG2rIwsgMJZPn/+o/dRvfa8yp33zfPfecM+e795x7bYqxtIAaUA2KgA3cgn3gBcsgrMQg3eAAfJtwBYa0Atg0dAugg+/3YAUcgkvqCkAVcIIy6raBCwT0/mRdymYG5Bt8VQoYBe+0Pwdpik6mwuAVNMawbJXgmr7e6FVokzKt1XBOZnYuneB54Jn+w/LEMZXTOo65nN80yNxNmyBIF4o6Ku6AXccpmzbzJstyQbs+FT/1VC6CFyU+mePTqbIBhBwp8csGn8UqO0qIz8AhstNBk8BP4As4RGCVyk8LgUVVlFvIXFXZ+4qUuZY8gn6W1QmYBKkadklM9PfLJriTYxYyEYFXpZp3s8Yj0kv9mhi0cuCTlsVMuqRWbpL0Xuo8YpAotaQnhgoQSzEAMjhuZoywfMb0UCmyKP1HmSXzJBQxpqIn9zhxA0piCJoFdqXu/bOpmeCMBiF+ZoJJ0E7gp0/AKCF71M1xCkZ4NRWSCjAIdiQ7v9UlHAcPUdfQh1QJEd7ArOg0K1dTRHJAO2hg8zhoH2IVbYElvaPgR4ABAFM/gtHnpJfxAAAAAElFTkSuQmCC");
	background-repeat: no-repeat;
	background-position: center; 
}

calendar.css000060400000010252152456673550007045 0ustar00/**
 * @copyright	(C) 2016 Open Source Matters, Inc. <https://www.joomla.org>
 * @license		GNU General Public License version 2 or later; see LICENSE.txt
 */
 .js-calendar {
	box-shadow: 0 0 15px 4px rgba(0,0,0,.15) !important;
 }
.calendar-container {
	float: left;
	min-width: 160px;
	padding: 0;
	list-style: none;
	border-radius: 5px;
	background-color: #ffffff !important;
	z-index: 1100 !important;
}
.calendar-container table {
	table-layout: fixed;
	max-width: 262px;
	border-radius: 5px;
	background-color: #ffffff !important;
	z-index: 1100 !important;
}
/* The main calendar widget.  DIV containing a table. */
div.calendar-container table th, .calendar-container table td {
	padding: 8px 0;
	line-height: 1.1em;
	text-align: center;
}

div.calendar-container table body td {
	line-height: 2em;
}

div.calendar-container table td.title { /* This holds the current "month, year" */
	vertical-align: middle;
	text-align: center;
}

.calendar-container table thead td.headrow { /* Row <TR> containing navigation buttons */
	background: #fff;
	color: #000;
}

.calendar-container table thead td.name { /* Cells <TD> containing the day names */
	border-bottom: 1px solid #fff;
	text-align: center;
	color: #000;
}

.calendar-container table thead td.weekend { /* How a weekend day name shows in header */
	color: #999;
}

/* The body part -- contains all the days in month. */

.calendar-container table tbody td.day { /* Cells <TD> containing month days dates */
	text-align: right;
}

.calendar-container table tbody td.wn {
	background: #fff;
}

.calendar-container table tbody td.weekend { /* Cells showing weekend days */
	color: #999;
}

.calendar-container table tbody td.hilite { /* Hovered cells <TD> */
	background: #999999;
	color: #ffffff;
}

.calendar-container table tbody td.day {
	border: 0;
	cursor : pointer;
	font-size: 12px;
	min-width: 38px;
}

.calendar-container table tbody td.day.wn {
	text-align: center;
	background-color: #f4f4f4;
}

.calendar-container table tbody td.day.selected { /* Cell showing today date */
	background: #3071a9;
	color: #fff;
	border: 0;
}

.calendar-container table tbody td.today {
	position: relative;
	height: 100%;
	width: auto;
	font-weight: bold;
}
.calendar-container table tbody td.today:after {
	position: absolute;
	bottom: 3px;
	left: 3px;
	right: 3px;
	content: "";
	height: 3px;
	border-radius: 1.5px;
	background-color: #46a546;
}
.calendar-container table tbody td.today.selected:after {
	background-color: #fff;
}

.calendar-container table tbody td.day:hover {
	cursor: pointer;
	background: #3d8fd7;
	color: #fff;
}
.calendar-container table tbody td.day:hover:after {
	background-color: #fff;
}

.calendar-container table tbody .disabled {
	color: #999;
	background-color: #fafafa;
}

.calendar-container table tbody .emptycell { /* Empty cells (the best is to hide them) */
	visibility: hidden;
}

.calendar-container table tbody .emptyrow { /* Empty row (some months need less than 6 rows) */
	display: none;
}
.buttons-wrapper {
	padding: 5px 5px;
}
a.js-btn.btn.btn-exit, a.js-btn.btn.btn-today, a.js-btn.btn.btn-clear {
	cursor: pointer;
	text-decoration: none;
	min-width: 60px;
}
.calendar-container .calendar-head-row td {
    padding: 4px 0 !important;
}
.calendar-container .day-name {
	font-size: 0.7rem;
	font-weight: bold;
}
.calendar-container .time td {
	padding: 8px 0 8px 8px;
}
.time .time-title {
	background-image: url("data:image/png;base64, iVBORw0KGgoAAAANSUhEUgAAABYAAAAWCAYAAADEtGw7AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAdlJREFUeNqklUsohFEUx7/5kgWGjEcRJULJSmJhITQLr8UoFko2k2SDLGZD2SglJcXOxo6Fx0ayUt4jWXgNG2rIwsgMJZPn/+o/dRvfa8yp33zfPfecM+e795x7bYqxtIAaUA2KgA3cgn3gBcsgrMQg3eAAfJtwBYa0Atg0dAugg+/3YAUcgkvqCkAVcIIy6raBCwT0/mRdymYG5Bt8VQoYBe+0Pwdpik6mwuAVNMawbJXgmr7e6FVokzKt1XBOZnYuneB54Jn+w/LEMZXTOo65nN80yNxNmyBIF4o6Ku6AXccpmzbzJstyQbs+FT/1VC6CFyU+mePTqbIBhBwp8csGn8UqO0qIz8AhstNBk8BP4As4RGCVyk8LgUVVlFvIXFXZ+4qUuZY8gn6W1QmYBKkadklM9PfLJriTYxYyEYFXpZp3s8Yj0kv9mhi0cuCTlsVMuqRWbpL0Xuo8YpAotaQnhgoQSzEAMjhuZoywfMb0UCmyKP1HmSXzJBQxpqIn9zhxA0piCJoFdqXu/bOpmeCMBiF+ZoJJ0E7gp0/AKCF71M1xCkZ4NRWSCjAIdiQ7v9UlHAcPUdfQh1QJEd7ArOg0K1dTRHJAO2hg8zhoH2IVbYElvaPgR4ABAFM/gtHnpJfxAAAAAElFTkSuQmCC");
	background-repeat: no-repeat;
	background-position: center; 
}

modal/article.php000060400000023130152456701570010003 0ustar00<?php
/**
 * @package     Joomla.Administrator
 * @subpackage  com_content
 *
 * @copyright   (C) 2009 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\Language\LanguageHelper;

/**
 * Supports a modal article picker.
 *
 * @since  1.6
 */
class JFormFieldModal_Article extends JFormField
{
	/**
	 * The form field type.
	 *
	 * @var    string
	 * @since  1.6
	 */
	protected $type = 'Modal_Article';

	/**
	 * Method to get the field input markup.
	 *
	 * @return  string  The field input markup.
	 *
	 * @since   1.6
	 */
	protected function getInput()
	{
		$allowNew       = ((string) $this->element['new'] == 'true');
		$allowEdit      = ((string) $this->element['edit'] == 'true');
		$allowClear     = ((string) $this->element['clear'] != 'false');
		$allowSelect    = ((string) $this->element['select'] != 'false');
		$allowPropagate = ((string) $this->element['propagate'] == 'true');

		$languages = LanguageHelper::getContentLanguages(array(0, 1));

		// Load language
		JFactory::getLanguage()->load('com_content', JPATH_ADMINISTRATOR);

		// The active article id field.
		$value = (int) $this->value > 0 ? (int) $this->value : '';

		// Create the modal id.
		$modalId = 'Article_' . $this->id;

		// Add the modal field script to the document head.
		JHtml::_('jquery.framework');
		JHtml::_('script', 'system/modal-fields.js', array('version' => 'auto', 'relative' => true));

		// Script to proxy the select modal function to the modal-fields.js file.
		if ($allowSelect)
		{
			static $scriptSelect = null;

			if (is_null($scriptSelect))
			{
				$scriptSelect = array();
			}

			if (!isset($scriptSelect[$this->id]))
			{
				JFactory::getDocument()->addScriptDeclaration("
				function jSelectArticle_" . $this->id . "(id, title, catid, object, url, language) {
					window.processModalSelect('Article', '" . $this->id . "', id, title, catid, object, url, language);
				}
				");

				JText::script('JGLOBAL_ASSOCIATIONS_PROPAGATE_FAILED');

				$scriptSelect[$this->id] = true;
			}
		}

		// Setup variables for display.
		$linkArticles = 'index.php?option=com_content&amp;view=articles&amp;layout=modal&amp;tmpl=component&amp;' . JSession::getFormToken() . '=1';
		$linkArticle  = 'index.php?option=com_content&amp;view=article&amp;layout=modal&amp;tmpl=component&amp;' . JSession::getFormToken() . '=1';

		if (isset($this->element['language']))
		{
			$linkArticles .= '&amp;forcedLanguage=' . $this->element['language'];
			$linkArticle  .= '&amp;forcedLanguage=' . $this->element['language'];
			$modalTitle    = JText::_('COM_CONTENT_CHANGE_ARTICLE') . ' &#8212; ' . $this->element['label'];
		}
		else
		{
			$modalTitle    = JText::_('COM_CONTENT_CHANGE_ARTICLE');
		}

		$urlSelect = $linkArticles . '&amp;function=jSelectArticle_' . $this->id;
		$urlEdit   = $linkArticle . '&amp;task=article.edit&amp;id=\' + document.getElementById("' . $this->id . '_id").value + \'';
		$urlNew    = $linkArticle . '&amp;task=article.add';

		if ($value)
		{
			$db    = JFactory::getDbo();
			$query = $db->getQuery(true)
				->select($db->quoteName('title'))
				->from($db->quoteName('#__content'))
				->where($db->quoteName('id') . ' = ' . (int) $value);
			$db->setQuery($query);

			try
			{
				$title = $db->loadResult();
			}
			catch (RuntimeException $e)
			{
				JError::raiseWarning(500, $e->getMessage());
			}
		}

		$title = empty($title) ? JText::_('COM_CONTENT_SELECT_AN_ARTICLE') : htmlspecialchars($title, ENT_QUOTES, 'UTF-8');

		// The current article display field.
		$html  = '<span class="input-append">';
		$html .= '<input class="input-medium" id="' . $this->id . '_name" type="text" value="' . $title . '" disabled="disabled" size="35" />';

		// Select article button
		if ($allowSelect)
		{
			$html .= '<button'
				. ' type="button"'
				. ' class="btn hasTooltip' . ($value ? ' hidden' : '') . '"'
				. ' id="' . $this->id . '_select"'
				. ' data-toggle="modal"'
				. ' data-target="#ModalSelect' . $modalId . '"'
				. ' title="' . JHtml::tooltipText('COM_CONTENT_CHANGE_ARTICLE') . '">'
				. '<span class="icon-file" aria-hidden="true"></span> ' . JText::_('JSELECT')
				. '</button>';
		}

		// New article button
		if ($allowNew)
		{
			$html .= '<button'
				. ' type="button"'
				. ' class="btn hasTooltip' . ($value ? ' hidden' : '') . '"'
				. ' id="' . $this->id . '_new"'
				. ' data-toggle="modal"'
				. ' data-target="#ModalNew' . $modalId . '"'
				. ' title="' . JHtml::tooltipText('COM_CONTENT_NEW_ARTICLE') . '">'
				. '<span class="icon-new" aria-hidden="true"></span> ' . JText::_('JACTION_CREATE')
				. '</button>';
		}

		// Edit article button
		if ($allowEdit)
		{
			$html .= '<button'
				. ' type="button"'
				. ' class="btn hasTooltip' . ($value ? '' : ' hidden') . '"'
				. ' id="' . $this->id . '_edit"'
				. ' data-toggle="modal"'
				. ' data-target="#ModalEdit' . $modalId . '"'
				. ' title="' . JHtml::tooltipText('COM_CONTENT_EDIT_ARTICLE') . '">'
				. '<span class="icon-edit" aria-hidden="true"></span> ' . JText::_('JACTION_EDIT')
				. '</button>';
		}

		// Clear article button
		if ($allowClear)
		{
			$html .= '<button'
				. ' type="button"'
				. ' class="btn' . ($value ? '' : ' hidden') . '"'
				. ' id="' . $this->id . '_clear"'
				. ' onclick="window.processModalParent(\'' . $this->id . '\'); return false;">'
				. '<span class="icon-remove" aria-hidden="true"></span>' . JText::_('JCLEAR')
				. '</button>';
		}

		// Propagate article button
		if ($allowPropagate && count($languages) > 2)
		{
			// Strip off language tag at the end
			$tagLength = (int) strlen($this->element['language']);
			$callbackFunctionStem = substr("jSelectArticle_" . $this->id, 0, -$tagLength);

			$html .= '<a'
			. ' class="btn hasTooltip' . ($value ? '' : ' hidden') . '"'
			. ' id="' . $this->id . '_propagate"'
			. ' href="#"'
			. ' title="' . JHtml::tooltipText('JGLOBAL_ASSOCIATIONS_PROPAGATE_TIP') . '"'
			. ' onclick="Joomla.propagateAssociation(\'' . $this->id . '\', \'' . $callbackFunctionStem . '\');">'
			. '<span class="icon-refresh" aria-hidden="true"></span>' . JText::_('JGLOBAL_ASSOCIATIONS_PROPAGATE_BUTTON')
			. '</a>';
		}

		$html .= '</span>';

		// Select article modal
		if ($allowSelect)
		{
			$html .= JHtml::_(
				'bootstrap.renderModal',
				'ModalSelect' . $modalId,
				array(
					'title'       => $modalTitle,
					'url'         => $urlSelect,
					'height'      => '400px',
					'width'       => '800px',
					'bodyHeight'  => '70',
					'modalWidth'  => '80',
					'footer'      => '<button type="button" class="btn" data-dismiss="modal">' . JText::_('JLIB_HTML_BEHAVIOR_CLOSE') . '</button>',
				)
			);
		}

		// New article modal
		if ($allowNew)
		{
			$html .= JHtml::_(
				'bootstrap.renderModal',
				'ModalNew' . $modalId,
				array(
					'title'       => JText::_('COM_CONTENT_NEW_ARTICLE'),
					'backdrop'    => 'static',
					'keyboard'    => false,
					'closeButton' => false,
					'url'         => $urlNew,
					'height'      => '400px',
					'width'       => '800px',
					'bodyHeight'  => '70',
					'modalWidth'  => '80',
					'footer'      => '<button type="button" class="btn"'
							. ' onclick="window.processModalEdit(this, \'' . $this->id . '\', \'add\', \'article\', \'cancel\', \'item-form\'); return false;">'
							. JText::_('JLIB_HTML_BEHAVIOR_CLOSE') . '</button>'
							. '<button type="button" class="btn btn-primary"'
							. ' onclick="window.processModalEdit(this, \'' . $this->id . '\', \'add\', \'article\', \'save\', \'item-form\'); return false;">'
							. JText::_('JSAVE') . '</button>'
							. '<button type="button" class="btn btn-success"'
							. ' onclick="window.processModalEdit(this, \'' . $this->id . '\', \'add\', \'article\', \'apply\', \'item-form\'); return false;">'
							. JText::_('JAPPLY') . '</button>',
				)
			);
		}

		// Edit article modal
		if ($allowEdit)
		{
			$html .= JHtml::_(
				'bootstrap.renderModal',
				'ModalEdit' . $modalId,
				array(
					'title'       => JText::_('COM_CONTENT_EDIT_ARTICLE'),
					'backdrop'    => 'static',
					'keyboard'    => false,
					'closeButton' => false,
					'url'         => $urlEdit,
					'height'      => '400px',
					'width'       => '800px',
					'bodyHeight'  => '70',
					'modalWidth'  => '80',
					'footer'      => '<button type="button" class="btn"'
							. ' onclick="window.processModalEdit(this, \'' . $this->id . '\', \'edit\', \'article\', \'cancel\', \'item-form\'); return false;">'
							. JText::_('JLIB_HTML_BEHAVIOR_CLOSE') . '</button>'
							. '<button type="button" class="btn btn-primary"'
							. ' onclick="window.processModalEdit(this, \'' . $this->id . '\', \'edit\', \'article\', \'save\', \'item-form\'); return false;">'
							. JText::_('JSAVE') . '</button>'
							. '<button type="button" class="btn btn-success"'
							. ' onclick="window.processModalEdit(this, \'' . $this->id . '\', \'edit\', \'article\', \'apply\', \'item-form\'); return false;">'
							. JText::_('JAPPLY') . '</button>',
				)
			);
		}

		// Note: class='required' for client side validation.
		$class = $this->required ? ' class="required modal-value"' : '';

		$html .= '<input type="hidden" id="' . $this->id . '_id" ' . $class . ' data-required="' . (int) $this->required . '" name="' . $this->name
			. '" data-text="' . htmlspecialchars(JText::_('COM_CONTENT_SELECT_AN_ARTICLE'), ENT_COMPAT, 'UTF-8') . '" value="' . $value . '" />';

		return $html;
	}

	/**
	 * Method to get the field label markup.
	 *
	 * @return  string  The field label markup.
	 *
	 * @since   3.4
	 */
	protected function getLabel()
	{
		return str_replace($this->id, $this->id . '_id', parent::getLabel());
	}
}
voteradio.php000060400000002132152456701570007257 0ustar00<?php
/**
 * @package     Joomla.Administrator
 * @subpackage  com_content
 *
 * @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;

JFormHelper::loadFieldClass('radio');

/**
 * Voteradio Field class.
 *
 * @since  3.8.0
 */
class JFormFieldVoteradio extends JFormFieldRadio
{
	/**
	 * The form field type.
	 *
	 * @var    string
	 * @since  3.7.1
	 */
	protected $type = 'Voteradio';

	/**
	 * Method to get the field Label.
	 *
	 * @return array The field label objects.
	 *
	 * @throws \Exception
	 *
	 * @since  3.8.2
	 */
	public function getLabel()
	{
		// Requires vote plugin enabled
		return JPluginHelper::isEnabled('content', 'vote') ? parent::getLabel() : null;
	}

	/**
	 * Method to get the field options.
	 *
	 * @return array The field option objects.
	 *
	 * @throws \Exception
	 *
	 * @since  3.7.1
	 */
	public function getOptions()
	{
		// Requires vote plugin enabled
		return JPluginHelper::isEnabled('content', 'vote') ? parent::getOptions() : array();
	}
}
impmade.php000060400000002032152456702530006673 0ustar00<?php
/**
 * @package     Joomla.Administrator
 * @subpackage  com_banners
 *
 * @copyright   (C) 2009 Open Source Matters, Inc. <https://www.joomla.org>
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */

defined('_JEXEC') or die;

/**
 * Impressions field.
 *
 * @since  1.6
 */
class JFormFieldImpMade extends JFormField
{
	/**
	 * The form field type.
	 *
	 * @var    string
	 * @since  1.6
	 */
	protected $type = 'ImpMade';

	/**
	 * Method to get the field input markup.
	 *
	 * @return  string	The field input markup.
	 *
	 * @since   1.6
	 */
	protected function getInput()
	{
		$onclick = ' onclick="document.getElementById(\'' . $this->id . '\').value=\'0\';"';

		return '<input class="input-small" type="text" name="' . $this->name . '" id="' . $this->id . '" value="'
			. htmlspecialchars($this->value, ENT_COMPAT, 'UTF-8') . '" readonly="readonly" /> <a class="btn" ' . $onclick . '>'
			. '<span class="icon-refresh" aria-hidden="true"></span> ' . JText::_('COM_BANNERS_RESET_IMPMADE') . '</a>';
	}
}
bannerclient.php000060400000001531152456702530007726 0ustar00<?php
/**
 * @package     Joomla.Administrator
 * @subpackage  com_banners
 *
 * @copyright   (C) 2009 Open Source Matters, Inc. <https://www.joomla.org>
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */

defined('_JEXEC') or die;

JLoader::register('BannersHelper', JPATH_ADMINISTRATOR . '/components/com_banners/helpers/banners.php');

JFormHelper::loadFieldClass('list');

/**
 * Bannerclient field.
 *
 * @since  1.6
 */
class JFormFieldBannerClient extends JFormFieldList
{
	/**
	 * The form field type.
	 *
	 * @var    string
	 * @since  1.6
	 */
	protected $type = 'BannerClient';

	/**
	 * Method to get the field options.
	 *
	 * @return  array  The field option objects.
	 *
	 * @since   1.6
	 */
	public function getOptions()
	{
		return array_merge(parent::getOptions(), BannersHelper::getClientOptions());
	}
}
clicks.php000060400000002022152456702530006526 0ustar00<?php
/**
 * @package     Joomla.Administrator
 * @subpackage  com_banners
 *
 * @copyright   (C) 2009 Open Source Matters, Inc. <https://www.joomla.org>
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */

defined('_JEXEC') or die;

/**
 * Clicks field.
 *
 * @since  1.6
 */
class JFormFieldClicks extends JFormField
{
	/**
	 * The form field type.
	 *
	 * @var    string
	 * @since  1.6
	 */
	protected $type = 'Clicks';

	/**
	 * Method to get the field input markup.
	 *
	 * @return  string	The field input markup.
	 *
	 * @since   1.6
	 */
	protected function getInput()
	{
		$onclick = ' onclick="document.getElementById(\'' . $this->id . '\').value=\'0\';"';

		return '<input class="input-small" type="text" name="' . $this->name . '" id="' . $this->id . '" value="'
			. htmlspecialchars($this->value, ENT_COMPAT, 'UTF-8') . '" readonly="readonly" /> <a class="btn" ' . $onclick . '>'
			. '<span class="icon-refresh" aria-hidden="true"></span> ' . JText::_('COM_BANNERS_RESET_CLICKS') . '</a>';
	}
}
imptotal.php000060400000003046152456702530007116 0ustar00<?php
/**
 * @package     Joomla.Administrator
 * @subpackage  com_banners
 *
 * @copyright   (C) 2009 Open Source Matters, Inc. <https://www.joomla.org>
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */

defined('_JEXEC') or die;

/**
 * Total Impressions field.
 *
 * @since  1.6
 */
class JFormFieldImpTotal extends JFormField
{
	/**
	 * The form field type.
	 *
	 * @var    string
	 * @since  1.6
	 */
	protected $type = 'ImpTotal';

	/**
	 * Method to get the field input markup.
	 *
	 * @return  string	The field input markup.
	 *
	 * @since   1.6
	 */
	protected function getInput()
	{
		$class    = ' class="validate-numeric text_area"';
		$onchange = ' onchange="document.getElementById(\'' . $this->id . '_unlimited\').checked=document.getElementById(\'' . $this->id
			. '\').value==\'\';"';
		$onclick  = ' onclick="if (document.getElementById(\'' . $this->id . '_unlimited\').checked) document.getElementById(\'' . $this->id
			. '\').value=\'\';"';
		$value    = empty($this->value) ? '' : $this->value;
		$checked  = empty($this->value) ? ' checked="checked"' : '';

		return '<input type="text" name="' . $this->name . '" id="' . $this->id . '" size="9" value="' . htmlspecialchars($value, ENT_COMPAT, 'UTF-8')
			. '" ' . $class . $onchange . ' />'
			. '<fieldset class="checkbox impunlimited"><input id="' . $this->id . '_unlimited" type="checkbox"' . $checked . $onclick . ' />'
			. '<label for="' . $this->id . '_unlimited" id="jform-imp" type="text">' . JText::_('COM_BANNERS_UNLIMITED') . '</label></fieldset>';
	}
}
logtype.php000060400000003213152456703310006741 0ustar00<?php
/**
 * @package     Joomla.Administrator
 * @subpackage  System.actionlogs
 *
 * @copyright   (C) 2018 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\Application\ApplicationHelper;
use Joomla\CMS\Factory;
use Joomla\CMS\Form\FormHelper;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;

FormHelper::loadFieldClass('checkboxes');
JLoader::register('ActionlogsHelper', JPATH_ADMINISTRATOR . '/components/com_actionlogs/helpers/actionlogs.php');

/**
 * Field to load a list of all users that have logged actions
 *
 * @since 3.9.0
 */
class JFormFieldLogType extends JFormFieldCheckboxes
{
	/**
	 * The form field type.
	 *
	 * @var    string
	 * @since  3.9.0
	 */
	protected $type = 'LogType';

	/**
	 * Method to get the field options.
	 *
	 * @return  array  The field option objects.
	 *
	 * @since   3.9.0
	 */
	public function getOptions()
	{
		$db = Factory::getDbo();
		$query = $db->getQuery(true)
			->select($db->quoteName('extension'))
			->from($db->quoteName('#__action_logs_extensions'));

		$extensions = $db->setQuery($query)->loadColumn();

		$options = array();
		$tmp     = array('checked' => true);

		foreach ($extensions as $extension)
		{
			ActionlogsHelper::loadTranslationFiles($extension);
			$option = HTMLHelper::_('select.option', $extension, Text::_($extension));
			$options[ApplicationHelper::stringURLSafe(Text::_($extension)) . '_' . $extension] = (object) array_merge($tmp, (array) $option);
		}

		ksort($options);

		return array_merge(parent::getOptions(), array_values($options));
	}
}
plugininfo.php000060400000002702152456703310007432 0ustar00<?php
/**
 * @package     Joomla.Administrator
 * @subpackage  com_actionlogs
 *
 * @copyright   (C) 2018 Open Source Matters, Inc. <https://www.joomla.org>
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */

defined('_JEXEC') or die;

/**
 * Information field.
 *
 * @since  3.9.2
 */
class JFormFieldPluginInfo extends JFormField
{
	/**
	 * The form field type.
	 *
	 * @var    string
	 * @since  3.9.2
	 */
	protected $type = 'PluginInfo';

	/**
	 * Method to get the field input markup.
	 *
	 * @return  string	The field input markup.
	 *
	 * @since   3.9.2
	 */
	protected function getInput()
	{
		$db = JFactory::getDbo();
		$result = null;
		$query = $db->getQuery(true)
			->select($db->quoteName('extension_id'))
			->from($db->quoteName('#__extensions'))
			->where($db->quoteName('folder') . ' = ' . $db->quote('actionlog'))
			->where($db->quoteName('element') . ' = ' . $db->quote('joomla'));
		$db->setQuery($query);

		try
		{
			$result = (int) $db->loadResult();
		}
		catch (RuntimeException $e)
		{
			JError::raiseWarning(500, $e->getMessage());
		}

		$link = JHtml::_(
			'link',
			JRoute::_('index.php?option=com_plugins&task=plugin.edit&extension_id=' . $result),
			JText::_('PLG_SYSTEM_ACTIONLOGS_JOOMLA_ACTIONLOG_DISABLED'),
			array('class' => 'alert-link')
		);

		return '<div class="alert alert-info">'
			. JText::sprintf('PLG_SYSTEM_ACTIONLOGS_JOOMLA_ACTIONLOG_DISABLED_REDIRECT', $link)
			. '</div>';
	}
}
logcreator.php000060400000003423152456703310007422 0ustar00<?php
/**
 * @package     Joomla.Administrator
 * @subpackage  com_actionlogs
 *
 * @copyright   (C) 2018 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\CMS\Form\FormHelper;

FormHelper::loadFieldClass('list');

/**
 * Field to load a list of all users that have logged actions
 *
 * @since  3.9.0
 */
class JFormFieldLogCreator extends JFormFieldList
{
	/**
	 * The form field type.
	 *
	 * @var    string
	 * @since  3.9.0
	 */
	protected $type = 'LogCreator';

	/**
	 * Cached array of the category items.
	 *
	 * @var    array
	 * @since  3.9.0
	 */
	protected static $options = array();

	/**
	 * Method to get the options to populate list
	 *
	 * @return  array  The field option objects.
	 *
	 * @since   3.9.0
	 */
	protected function getOptions()
	{
		// Accepted modifiers
		$hash = md5($this->element);

		if (!isset(static::$options[$hash]))
		{
			static::$options[$hash] = parent::getOptions();

			$options = array();

			$db = Factory::getDbo();

			// Construct the query
			$query = $db->getQuery(true)
				->select($db->quoteName('u.id', 'value'))
				->select($db->quoteName('u.username', 'text'))
				->from($db->quoteName('#__users', 'u'))
				->join('INNER', $db->quoteName('#__action_logs', 'c') . ' ON ' . $db->quoteName('c.user_id') . ' = ' . $db->quoteName('u.id'))
				->group($db->quoteName('u.id'))
				->group($db->quoteName('u.username'))
				->order($db->quoteName('u.username'));

			// Setup the query
			$db->setQuery($query);

			// Return the result
			if ($options = $db->loadObjectList())
			{
				static::$options[$hash] = array_merge(static::$options[$hash], $options);
			}
		}

		return static::$options[$hash];
	}
}
extension.php000060400000000215152456703310007271 0ustar00<?php

defined('JPATH_PLATFORM') or die;

JFormHelper::loadFieldClass('filetype');

class JFormFieldExtension extends JFormFieldFiletype
{

}logsdaterange.php000060400000002675152456703310010110 0ustar00<?php
/**
 * @package     Joomla.Administrator
 * @subpackage  com_actionlogs
 *
 * @copyright   (C) 2018 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\CMS\Form\FormHelper;

FormHelper::loadFieldClass('predefinedlist');

/**
 * Field to show a list of range dates to sort with
 *
 * @since  3.9.0
 */
class JFormFieldLogsDateRange extends JFormFieldPredefinedList
{
	/**
	 * The form field type.
	 *
	 * @var     string
	 * @since   3.9.0
	 */
	protected $type = 'logsdaterange';

	/**
	 * Available options
	 *
	 * @var    array
	 * @since  3.9.0
	 */
	protected $predefinedOptions = array(
		'today'       => 'COM_ACTIONLOGS_OPTION_RANGE_TODAY',
		'past_week'   => 'COM_ACTIONLOGS_OPTION_RANGE_PAST_WEEK',
		'past_1month' => 'COM_ACTIONLOGS_OPTION_RANGE_PAST_1MONTH',
		'past_3month' => 'COM_ACTIONLOGS_OPTION_RANGE_PAST_3MONTH',
		'past_6month' => 'COM_ACTIONLOGS_OPTION_RANGE_PAST_6MONTH',
		'past_year'   => 'COM_ACTIONLOGS_OPTION_RANGE_PAST_YEAR',
	);

	/**
	 * Method to instantiate the form field object.
	 *
	 * @param   JForm  $form  The form to attach to the form field object.
	 *
	 * @since  3.9.0
	 */
	public function __construct($form = null)
	{
		parent::__construct($form);

		// Load the required language
		$lang = Factory::getLanguage();
		$lang->load('com_actionlogs', JPATH_ADMINISTRATOR);
	}
}
groupparent.php000060400000005316152456730400007632 0ustar00<?php
/**
 * @package     Joomla.Administrator
 * @subpackage  com_users
 *
 * @copyright   (C) 2010 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\Access\Access;
use Joomla\CMS\Factory;
use Joomla\CMS\Form\FormHelper;
use Joomla\CMS\Helper\UserGroupsHelper;

FormHelper::loadFieldClass('list');

/**
 * User Group Parent field..
 *
 * @since  1.6
 */
class JFormFieldGroupParent extends JFormFieldList
{
	/**
	 * The form field type.
	 *
	 * @var        string
	 * @since   1.6
	 */
	protected $type = 'GroupParent';

	/**
	 * Method to clean the Usergroup Options from all children starting by a given father
	 *
	 * @param   array    $userGroupsOptions  The usergroup options to clean
	 * @param   integer  $fatherId           The father ID to start with
	 *
	 * @return  array  The cleaned field options
	 *
	 * @since   3.9.4
	 */
	private function cleanOptionsChildrenByFather($userGroupsOptions, $fatherId)
	{
		foreach ($userGroupsOptions as $userGroupsOptionsId => $userGroupsOptionsData)
		{
			if ((int) $userGroupsOptionsData->parent_id === (int) $fatherId)
			{
				unset($userGroupsOptions[$userGroupsOptionsId]);

				$userGroupsOptions = $this->cleanOptionsChildrenByFather($userGroupsOptions, $userGroupsOptionsId);
			}
		}

		return $userGroupsOptions;
	}

	/**
	 * Method to get the field options.
	 *
	 * @return  array  The field option objects
	 *
	 * @since   1.6
	 */
	protected function getOptions()
	{
		$options        = UserGroupsHelper::getInstance()->getAll();
		$currentGroupId = (int) Factory::getApplication()->input->get('id', 0, 'int');

		// Prevent to set yourself as parent
		if ($currentGroupId)
		{
			unset($options[$currentGroupId]);
		}

		// We should not remove any groups when we are creating a new group
		if ($currentGroupId !== 0)
		{
			// Prevent parenting direct children and children of children of this item.
			$options = $this->cleanOptionsChildrenByFather($options, $currentGroupId);
		}

		$options      = array_values($options);
		$isSuperAdmin = Factory::getUser()->authorise('core.admin');

		// Pad the option text with spaces using depth level as a multiplier.
		for ($i = 0, $n = count($options); $i < $n; $i++)
		{
			// Show groups only if user is super admin or group is not super admin
			if ($isSuperAdmin || !Access::checkGroup($options[$i]->id, 'core.admin'))
			{
				$options[$i]->value = $options[$i]->id;
				$options[$i]->text = str_repeat('- ', $options[$i]->level) . $options[$i]->title;
			}
			else
			{
				unset($options[$i]);
			}
		}

		// Merge any additional options in the XML definition.
		return array_merge(parent::getOptions(), $options);
	}
}
levels.php000060400000001450152456730400006551 0ustar00<?php
/**
 * @package     Joomla.Administrator
 * @subpackage  com_users
 *
 * @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;

JFormHelper::loadFieldClass('list');

/**
 * Access Levels field.
 *
 * @since  3.6.0
 */
class JFormFieldLevels extends JFormFieldList
{
	/**
	 * The form field type.
	 *
	 * @var     string
	 * @since   3.6.0
	 */
	protected $type = 'Levels';

	/**
	 * Method to get the field options.
	 *
	 * @return  array  The field option objects
	 *
	 * @since   3.6.0
	 */
	protected function getOptions()
	{
		// Merge any additional options in the XML definition.
		return array_merge(parent::getOptions(), UsersHelperDebug::getLevelsOptions());
	}
}
plugintype.php000060400000001551152456735770007500 0ustar00<?php
/**
 * @package     Joomla.Administrator
 * @subpackage  com_plugins
 *
 * @copyright   (C) 2015 Open Source Matters, Inc. <https://www.joomla.org>
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */

defined('_JEXEC') or die;

JLoader::register('PluginsHelper', JPATH_ADMINISTRATOR . '/components/com_plugins/helpers/plugins.php');

JFormHelper::loadFieldClass('list');

/**
 * Plugin Type field.
 *
 * @since  3.5
 */
class JFormFieldPluginType extends JFormFieldList
{
	/**
	 * The form field type.
	 *
	 * @var    string
	 * @since  3.5
	 */
	protected $type = 'PluginType';

	/**
	 * Method to get the field options.
	 *
	 * @return  array  The field option objects.
	 *
	 * @since   3.5
	 */
	public function getOptions()
	{
		$options = PluginsHelper::folderOptions();

		return array_merge(parent::getOptions(), $options);
	}
}
pluginelement.php000060400000001571152456735770010152 0ustar00<?php
/**
 * @package     Joomla.Administrator
 * @subpackage  com_plugins
 *
 * @copyright   (C) 2018 Open Source Matters, Inc. <https://www.joomla.org>
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */

defined('_JEXEC') or die;

JLoader::register('PluginsHelper', JPATH_ADMINISTRATOR . '/components/com_plugins/helpers/plugins.php');

JFormHelper::loadFieldClass('list');

/**
 * Plugin Element field.
 *
 * @since  3.9.0
 */
class JFormFieldPluginElement extends JFormFieldList
{
	/**
	 * The form field type.
	 *
	 * @var    string
	 * @since  3.9.0
	 */
	protected $type = 'PluginElement';

	/**
	 * Method to get the field options.
	 *
	 * @return  array  The field option objects.
	 *
	 * @since   3.9.0
	 */
	public function getOptions()
	{
		$options = PluginsHelper::elementOptions();

		return array_merge(parent::getOptions(), $options);
	}
}
pluginordering.php000060400000002625152456735770010333 0ustar00<?php
/**
 * @package     Joomla.Administrator
 * @subpackage  com_plugins
 *
 * @copyright   (C) 2013 Open Source Matters, Inc. <https://www.joomla.org>
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */

defined('_JEXEC') or die;

JFormHelper::loadFieldClass('ordering');

/**
 * Supports an HTML select list of plugins.
 *
 * @since  1.6
 */
class JFormFieldPluginordering extends JFormFieldOrdering
{
	/**
	 * The form field type.
	 *
	 * @var		string
	 * @since   1.6
	 */
	protected $type = 'Pluginordering';

	/**
	 * Builds the query for the ordering list.
	 *
	 * @return  JDatabaseQuery  The query for the ordering form field.
	 */
	protected function getQuery()
	{
		$db     = JFactory::getDbo();
		$folder = $this->form->getValue('folder');

		// Build the query for the ordering list.
		$query = $db->getQuery(true)
			->select(
				array(
					$db->quoteName('ordering', 'value'),
					$db->quoteName('name', 'text'),
					$db->quoteName('type'),
					$db->quote('folder'),
					$db->quote('extension_id')
				)
			)
			->from($db->quoteName('#__extensions'))
			->where('(type =' . $db->quote('plugin') . 'AND folder=' . $db->quote($folder) . ')')
			->order('ordering');

		return $query;
	}

	/**
	 * Retrieves the current Item's Id.
	 *
	 * @return  integer  The current item ID.
	 */
	protected function getItemId()
	{
		return (int) $this->form->getValue('extension_id');
	}
}
redirect.php000060400000007435152457004570007074 0ustar00<?php
/**
 * @package     Joomla.Administrator
 * @subpackage  com_redirect
 *
 * @copyright   (C) 2014 Open Source Matters, Inc. <https://www.joomla.org>
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */

defined('_JEXEC') or die;

JFormHelper::loadFieldClass('list');

/**
 * A dropdown containing all valid HTTP 1.1 response codes.
 *
 * @package     Joomla.Administrator
 * @subpackage  com_redirect
 * @since       3.4
 */
class JFormFieldRedirect extends JFormFieldList
{
	/**
	 * The form field type.
	 *
	 * @var    string
	 * @since  3.4
	 */
	protected $type = 'Redirect';

	/**
	 * A map of integer HTTP 1.1 response codes to the full HTTP Status for the headers.
	 *
	 * @var    object
	 * @since  3.4
	 * @link   http://www.iana.org/assignments/http-status-codes/
	 */
	protected $responseMap = array(
		100 => 'HTTP/1.1 100 Continue',
		101 => 'HTTP/1.1 101 Switching Protocols',
		102 => 'HTTP/1.1 102 Processing',
		200 => 'HTTP/1.1 200 OK',
		201 => 'HTTP/1.1 201 Created',
		202 => 'HTTP/1.1 202 Accepted',
		203 => 'HTTP/1.1 203 Non-Authoritative Information',
		204 => 'HTTP/1.1 204 No Content',
		205 => 'HTTP/1.1 205 Reset Content',
		206 => 'HTTP/1.1 206 Partial Content',
		207 => 'HTTP/1.1 207 Multi-Status',
		208 => 'HTTP/1.1 208 Already Reported',
		226 => 'HTTP/1.1 226 IM Used',
		300 => 'HTTP/1.1 300 Multiple Choices',
		301 => 'HTTP/1.1 301 Moved Permanently',
		302 => 'HTTP/1.1 302 Found',
		303 => 'HTTP/1.1 303 See other',
		304 => 'HTTP/1.1 304 Not Modified',
		305 => 'HTTP/1.1 305 Use Proxy',
		306 => 'HTTP/1.1 306 (Unused)',
		307 => 'HTTP/1.1 307 Temporary Redirect',
		308 => 'HTTP/1.1 308 Permanent Redirect',
		400 => 'HTTP/1.1 400 Bad Request',
		401 => 'HTTP/1.1 401 Unauthorized',
		402 => 'HTTP/1.1 402 Payment Required',
		403 => 'HTTP/1.1 403 Forbidden',
		404 => 'HTTP/1.1 404 Not Found',
		405 => 'HTTP/1.1 405 Method Not Allowed',
		406 => 'HTTP/1.1 406 Not Acceptable',
		407 => 'HTTP/1.1 407 Proxy Authentication Required',
		408 => 'HTTP/1.1 408 Request Timeout',
		409 => 'HTTP/1.1 409 Conflict',
		410 => 'HTTP/1.1 410 Gone',
		411 => 'HTTP/1.1 411 Length Required',
		412 => 'HTTP/1.1 412 Precondition Failed',
		413 => 'HTTP/1.1 413 Payload Too Large',
		414 => 'HTTP/1.1 414 URI Too Long',
		415 => 'HTTP/1.1 415 Unsupported Media Type',
		416 => 'HTTP/1.1 416 Requested Range Not Satisfiable',
		417 => 'HTTP/1.1 417 Expectation Failed',
		418 => 'HTTP/1.1 418 I\'m a teapot',
		422 => 'HTTP/1.1 422 Unprocessable Entity',
		423 => 'HTTP/1.1 423 Locked',
		424 => 'HTTP/1.1 424 Failed Dependency',
		425 => 'HTTP/1.1 425 Reserved for WebDAV advanced collections expired proposal',
		426 => 'HTTP/1.1 426 Upgrade Required',
		428 => 'HTTP/1.1 428 Precondition Required',
		429 => 'HTTP/1.1 429 Too Many Requests',
		431 => 'HTTP/1.1 431 Request Header Fields Too Large',
		451 => 'HTTP/1.1 451 Unavailable For Legal Reasons',
		500 => 'HTTP/1.1 500 Internal Server Error',
		501 => 'HTTP/1.1 501 Not Implemented',
		502 => 'HTTP/1.1 502 Bad Gateway',
		503 => 'HTTP/1.1 503 Service Unavailable',
		504 => 'HTTP/1.1 504 Gateway Timeout',
		505 => 'HTTP/1.1 505 HTTP Version Not Supported',
		506 => 'HTTP/1.1 506 Variant Also Negotiates (Experimental)',
		507 => 'HTTP/1.1 507 Insufficient Storage',
		508 => 'HTTP/1.1 508 Loop Detected',
		510 => 'HTTP/1.1 510 Not Extended',
		511 => 'HTTP/1.1 511 Network Authentication Required',
	);

	/**
	 * Method to get the field input markup.
	 *
	 * @return  string	The field input markup.
	 *
	 * @since   3.4
	 */
	protected function getOptions()
	{
		$options = array();

		foreach ($this->responseMap as $key => $value)
		{
			$options[] = JHtml::_('select.option', $key, $value);
		}

		// Merge any additional options in the XML definition.
		$options = array_merge(parent::getOptions(), $options);

		return $options;
	}
}
searchplugins.php000060400000005463152457032700010135 0ustar00<?php
/**
 * @package     JCE
 * @subpackage  Admin
 *
 * @copyright   Copyright (C) 2005 - 2020 Open Source Matters, Inc. All rights reserved.
 * @copyright   Copyright (c) 2009-2024 Ryan Demmer. All rights reserved
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */

\defined('_JEXEC') or die;

use Joomla\CMS\Form\Field\PluginsField;
use Joomla\CMS\Language\Text;

class JFormFieldSearchPlugins extends PluginsField
{
    /**
     * The form field type.
     *
     * @var string
     *
     * @since  11.1
     */
    protected $type = 'SearchPlugins';

    /**
     * Method to attach a JForm object to the field.
     *
     * @param   SimpleXMLElement  $element  The SimpleXMLElement object representing the `<field>` tag for the form field object.
     * @param   mixed             $value    The form field value to validate.
     * @param   string            $group    The field name group control value. This acts as an array container for the field.
     *                                      For example if the field has name="foo" and the group value is set to "bar" then the
     *                                      full field name would end up being "bar[foo]".
     *
     * @return  boolean  True on success.
     *
     * @see     JFormField::setup()
     * @since   3.2
     */
    public function setup(SimpleXMLElement $element, $value, $group = null)
    {
        if (is_string($value) && strpos($value, ',') !== false) {
            $value = explode(',', $value);
        }

        $return = parent::setup($element, $value, $group);

        if ($return) {
            $this->folder = 'search';
            $this->element['useaccess'] = 'true';
        }

        return $return;
    }

    /**
     * Method to get a list of options for a list input.
     *
     * @return array An array of JHtml options
     *
     * @since   11.4
     */
    protected function getOptions()
    {
        $options = array();
        $default = explode(',', $this->default);

        foreach (parent::getOptions() as $item) {
            if (in_array($item->value, $default)) {
                continue;
            }

            // skip "newsfeeds"
            if ($item->value == 'newsfeeds') {
                continue;
            }

            $options[] = $item;
        }

        foreach ($default as $name) {
            if (!is_dir(JPATH_SITE . '/components/com_jce/editor/extensions/search/adapter/' . $name)) {
                continue;
            }

            $option = new StdClass;

            $option->text = Text::_('PLG_SEARCH_' . strtoupper($name) . '_' . strtoupper($name), true);
            $option->disable = '';
            $option->value = $name;

            $options[] = $option;
        }

        // Merge any additional options in the XML definition.
        return $options;
    }
}
profileordering.php000060400000002565152457032700010460 0ustar00<?php
/**
 * @package     JCE
 * @subpackage  Admin
 *
 * @copyright   Copyright (C) 2005 - 2020 Open Source Matters, Inc. All rights reserved.
 * @copyright   Copyright (c) 2009-2024 Ryan Demmer. All rights reserved
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */

\defined('_JEXEC') or die;

use Joomla\CMS\Factory;
use Joomla\CMS\Form\Field\OrderingField;

/**
 * Supports an HTML select list of plugins.
 *
 * @since       1.6
 */
class JFormFieldProfileordering extends OrderingField
{
    /**
     * The form field type.
     *
     * @var string
     *
     * @since   1.6
     */
    protected $type = 'Profileordering';

    /**
     * Builds the query for the ordering list.
     *
     * @return JDatabaseQuery The query for the ordering form field
     */
    protected function getQuery()
    {
        $db = Factory::getDbo();

        // Build the query for the ordering list.
        $query = $db->getQuery(true)
            ->select(array($db->quoteName('ordering', 'value'), $db->quoteName('name', 'text'), $db->quote('id')))
            ->from($db->quoteName('#__wf_profiles'))
            ->order('ordering');

        return $query;
    }

    /**
     * Retrieves the current Item's Id.
     *
     * @return int The current item ID
     */
    protected function getItemId()
    {
        return (int) $this->form->getValue('id');
    }
}
filesystempath.php000060400000007040152457032700010320 0ustar00<?php

/**
 * @package     JCE
 * @subpackage  Admin
 *
 * @copyright   Copyright (C) 2005 - 2020 Open Source Matters, Inc. All rights reserved.
 * @copyright   Copyright (c) 2009-2026 Ryan Demmer. All rights reserved
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */

\defined('_JEXEC') or die;

use Joomla\CMS\Form\Field\TextField;

class JFormFieldFilesystemPath extends TextField
{

    /**
     * The form field type.
     *
     * @var    string
     *
     * @since  2.8
     */
    protected $type = 'FilesystemPath';

    /**
     * Method to attach a JForm object to the field.
     *
     * @param   SimpleXMLElement  $element  The SimpleXMLElement object representing the <field /> tag for the form field object.
     * @param   mixed             $value    The form field value to validate.
     * @param   string            $group    The field name group control value. This acts as as an array container for the field.
     *                                      For example if the field has name="foo" and the group value is set to "bar" then the
     *                                      full field name would end up being "bar[foo]".
     *
     * @return  boolean  True on success.
     *
     * @since   2.8
     */
    public function setup(SimpleXMLElement $element, $value, $group = null)
    {
        $return = parent::setup($element, $value, $group);

        return $return;
    }

    /**
     * Method to get the field input markup.
     *
     * @return  string  The field input markup.
     *
     * @since   11.1
     */
    protected function getInput()
    {
        $values = $this->value;
        $path   = '';

        // Step 1: If it's an array, flatten the "first meaningful" item.
        if (is_array($values) && !empty($values)) {
            
            // If it's an associative array already (eg: ['path' => 'images']), use it as-is.
            if (array_key_exists('path', $values)) {
                $values = [$values];
            } else {
                // Otherwise take the first non-empty item (eg: first JSON string in the array)
                $values = reset($values);
            }
        }

        // Step 2: If it's a string, try decode JSON; if not JSON, treat as path string.
        if (is_string($values)) {
            $value = trim(htmlspecialchars_decode($values));

            if ($value !== '') {
                $decoded = json_decode($value, true);

                if (json_last_error() === JSON_ERROR_NONE && $decoded !== null && $decoded !== []) {
                    $values = $decoded;
                } else {
                    // Not valid JSON -> it’s a plain path
                    $values = [['path' => $value]];
                }
            } else {
                $values = [];
            }
        }

        // Step 3: Extract first path
        if (is_array($values) && !empty($values)) {
            // If decoded to a single associative item, normalise to a list.
            if (array_key_exists('path', $values)) {
                $values = [$values];
            }

            $first = reset($values);

            if (is_array($first) && isset($first['path'])) {
                $path = (string) $first['path'];
            }
        }

        $this->value = $path;

        // collect the layout data...
        $layoutData = $this->getLayoutData();

        // ...and reset the value to the processed value
        $layoutData['value'] = htmlspecialchars($this->value, ENT_COMPAT, 'UTF-8');

        return $this->getRenderer($this->layout)->render($layoutData);
    }
}fonts.php000060400000010101152457032700006400 0ustar00<?php
/**
 * @package     JCE
 * @subpackage  Admin
 *
 * @copyright   Copyright (C) 2005 - 2020 Open Source Matters, Inc. All rights reserved.
 * @copyright   Copyright (c) 2009-2024 Ryan Demmer. All rights reserved
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */

\defined('_JEXEC') or die;

use Joomla\CMS\Form\Field\CheckboxesField;
use Joomla\CMS\Language\Text;

class JFormFieldFonts extends CheckboxesField
{
    /**
     * The form field type.
     *
     * @var string
     *
     * @since  11.1
     */
    protected $type = 'Fonts';

    /**
     * Name of the layout being used to render the field
     *
     * @var    string
     * @since  3.5
     */
    protected $layout = 'form.field.fonts';

    /**
     * Flag to tell the field to always be in multiple values mode.
     *
     * @var    boolean
     * @since  11.1
     */
    protected $forceMultiple = false;

    private static $fonts = array(
        'Andale Mono' => 'andale mono,times',
        'Arial' => 'arial,helvetica,sans-serif',
        'Arial Black' => 'arial black,avant garde',
        'Book Antiqua' => 'book antiqua,palatino',
        'Comic Sans MS' => 'comic sans ms,sans-serif',
        'Courier New' => 'courier new,courier',
        'Georgia' => 'georgia,palatino',
        'Helvetica' => 'helvetica',
        'Impact' => 'impact,chicago',
        'Symbol' => 'symbol',
        'Tahoma' => 'tahoma,arial,helvetica,sans-serif',
        'Terminal' => 'terminal,monaco',
        'Times New Roman' => 'times new roman,times',
        'Trebuchet MS' => 'trebuchet ms,geneva',
        'Verdana' => 'verdana,geneva',
        'Webdings' => 'webdings',
        'Wingdings' => 'wingdings,zapf dingbats',
    );

    /**
     * Allow to override renderer include paths in child fields
     *
     * @return  array
     *
     * @since   3.5
     */
    protected function getLayoutPaths()
    {
        return array(JPATH_ADMINISTRATOR . '/components/com_jce/layouts', JPATH_SITE . '/layouts');
    }

    protected function getOptions()
    {
        $fieldname = preg_replace('/[^a-zA-Z0-9_\-]/', '_', $this->fieldname);
        $options = array();

        if (is_string($this->value)) {
            $this->value = json_decode(htmlspecialchars_decode($this->value), true);
        }

        // cast to array
        $this->value = (array) $this->value;

        $fonts = array();

        // map associative array to array of key value pairs
        foreach ($this->value as $key => $value) {
            if (is_numeric($key) && is_array($value)) {
                $fonts[] = $value;
            } else {
                $fonts[] = array($key => $value);
            }
        }
        // array of font names to exclude from default list
        $exclude = array();
        // array of custom font key/value pairs
        $custom = array();

        foreach ($fonts as $font) {
            list($text) = array_keys($font);
            list($value) = array_values($font);

            // add to $exclude array
            $exclude[] = $text;

            $value = htmlspecialchars_decode($value, ENT_QUOTES);

            $isCustom = !in_array($value, array_values(self::$fonts));

            $item = array(
                'value' => $value,
                'text' => Text::alt($text, $fieldname),
                'checked' => true,
                'custom' => $isCustom,
            );

            $item = (object) $item;

            if ($isCustom) {
                $custom[] = $item;
            } else {
                $options[] = $item;
            }
        }

        $checked = empty($exclude) ? true : false;

        // assign empty (unchecked) options for unused fonts
        foreach (self::$fonts as $text => $value) {

            if (in_array($text, $exclude)) {
                continue;
            }

            $tmp = array(
                'value' => $value,
                'text' => Text::alt($text, $fieldname),
                'checked' => $checked,
                'custom' => false,
            );

            $options[] = (object) $tmp;
        }

        return array_merge($options, $custom);
    }
}
yesno.php000060400000002677152457032700006427 0ustar00<?php
/**
 * @package     JCE
 * @subpackage  Admin
 *
 * @copyright   Copyright (C) 2005 - 2020 Open Source Matters, Inc. All rights reserved.
 * @copyright   Copyright (c) 2009-2024 Ryan Demmer. All rights reserved
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */

\defined('_JEXEC') or die;

use Joomla\CMS\Form\Field\RadioField;

class JFormFieldYesNo extends RadioField
{
    /**
     * The form field type.
     *
     * @var string
     *
     * @since  11.1
     */
    protected $type = 'YesNo';

    /**
     * Method to attach a JForm object to the field.
     *
     * @param SimpleXMLElement $element The SimpleXMLElement object representing the <field /> tag for the form field object
     * @param mixed            $value   The form field value to validate
     * @param string           $group   The field name group control value. This acts as as an array container for the field.
     *                                  For example if the field has name="foo" and the group value is set to "bar" then the
     *                                  full field name would end up being "bar[foo]"
     *
     * @return bool True on success
     *
     * @since   11.1
     */
    public function setup(SimpleXMLElement $element, $value, $group = null)
    {
        $return = parent::setup($element, $value, $group);

        $this->class = trim($this->class . ' btn-group btn-group-yesno');

        return $return;
    }
}
uploadmaxsize.php000060400000006273152457032700010153 0ustar00<?php
/**
 * @package     JCE
 * @subpackage  Admin
 *
 * @copyright   Copyright (C) 2005 - 2020 Open Source Matters, Inc. All rights reserved.
 * @copyright   Copyright (c) 2009-2024 Ryan Demmer. All rights reserved
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */

\defined('_JEXEC') or die;

use Joomla\CMS\Form\Field\NumberField;
use Joomla\CMS\Language\Text;

/**
 * Form Field class for the Joomla Platform.
 * Supports a one line text field.
 *
 * @link        http://www.w3.org/TR/html-markup/input.text.html#input.text
 * @since       11.1
 */
class JFormFieldUploadMaxSize extends NumberField
{
    /**
     * The form field type.
     *
     * @var string
     *
     * @since  11.1
     */
    protected $type = 'uploadmaxsize';

    /**
     * Method to get the field input markup.
     *
     * @return string The field input markup
     *
     * @since   11.1
     */
    protected function getInput()
    {
        $max = $this->getUploadValue();

        $this->max = (int) $max;
        $this->class = trim($this->class . ' input-small');

        $html = '<div class="input-append input-group">';
        $html .= parent::getInput();
        $html .= '  <div class="input-group-append">';
        $html .= '      <span class="add-on input-group-text">Kb</span>';
        $html .= '  </div>';
        $html .= '	<small class="help-inline form-text">&nbsp;<em>' . Text::_('WF_SERVER_UPLOAD_SIZE') . ' : ' . (string) $max . '</em></small>';
        $html .= '</div>';

        return $html;
    }

    public function getUploadValue()
    {
        $upload = trim(ini_get('upload_max_filesize'));
        $post = trim(ini_get('post_max_size'));

        $upload = $this->convertValue($upload);
        $post = $this->convertValue($post);

        if (intval($post) === 0) {
            return $upload;
        }

        if (intval($upload) < intval($post)) {
            return $upload;
        }

        return $post;
    }

    public function convertValue($value)
    {
        $unit = 'KB';
        $prefix = '';

        preg_match('#([0-9]+)\s?([a-z]*)#i', $value, $matches);

        // get unit
        if (isset($matches[2])) {
            $prefix = $matches[2];

            // extract first character only, eg: g, m, k
            if ($prefix) {
                $prefix = strtolower($prefix[0]);
            }
        }

        // get value
        if (isset($matches[1])) {
            $value = (int) $matches[1];
        }

        $value = intval($value);

        // Convert to bytes
        switch ($prefix) {
            case 'g':
                $value *= 1073741824;
                break;
            case 'm':
                $value *= 1048576;
                break;
            case 'k':
                $value *= 1024;
                break;
        }

        // Convert to unit value
        switch (strtolower($unit[0])) {
            case 'g':
                $value /= 1073741824;
                break;
            case 'm':
                $value /= 1048576;
                break;
            case 'k':
                $value /= 1024;
                break;
        }

        if ($unit) {
            return (int) $value . ' ' . $unit;
        }

        return 0;
    }
}
plugin.php000060400000007264152457032700006565 0ustar00<?php
/**
 * @package     JCE
 * @subpackage  Admin
 *
 * @copyright   Copyright (C) 2005 - 2020 Open Source Matters, Inc. All rights reserved.
 * @copyright   Copyright (c) 2009-2024 Ryan Demmer. All rights reserved
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */

\defined('_JEXEC') or die;

use Joomla\CMS\Factory;
use Joomla\CMS\Form\Form;
use Joomla\CMS\Form\Field\FilelistField;

class JFormFieldPlugin extends FilelistField
{
    /**
     * The form field type.
     *
     * @var string
     *
     * @since  11.1
     */
    protected $type = 'Plugin';

    /**
     * Method to attach a JForm object to the field.
     *
     * @param SimpleXMLElement $element The SimpleXMLElement object representing the <field /> tag for the form field object
     * @param mixed            $value   The form field value to validate
     * @param string           $group   The field name group control value. This acts as as an array container for the field.
     *                                  For example if the field has name="foo" and the group value is set to "bar" then the
     *                                  full field name would end up being "bar[foo]"
     *
     * @return bool True on success
     *
     * @since   11.1
     */
    public function setup(SimpleXMLElement $element, $value, $group = null)
    {
        $return = parent::setup($element, $value, $group);

        return $return;
    }

    /**
     * Method to get the field input markup.
     *
     * @return string The field input markup
     *
     * @since   11.1
     */
    protected function getInput()
    {
        $value = $this->value;

        // decode json string
        if (!empty($value) && is_string($value)) {
            $value = json_decode($value, true);
        }

        // default
        if (empty($value)) {
            $type = $this->default;
            $path = '';
        }

        $plugins = $this->getPlugins();

        $html = '<div class="span9">';
        foreach ($plugins as $plugin) {
            $name = (string) str_replace($this->name . '-', '', $plugin->element);

            $form = Form::getInstance('plg_jce_' . $plugin->element, $plugin->manifest, array('control' => $this->name . '[' . $name . ']'), true, '//extension');

            if ($form) {
                $html .= $form->renderFieldset('extension.' . $name . '.' . $name);
            }
        }

        $html .= '</div>';

        return $html;
    }

    /**
     * Method to get the field options.
     *
     * @return array The field option objects
     *
     * @since   11.1
     */
    protected function getPlugins()
    {
        static $plugins;

        if (!isset($plugins)) {
            $language = Factory::getLanguage();

            $db = Factory::getDbo();
            $query = $db->getQuery(true)
                ->select('name, element')
                ->from('#__extensions')
                ->where('enabled = 1')
                ->where('type =' . $db->quote('plugin'))
                ->where('state IN (0,1)')
                ->where('folder = ' . $db->quote('jce'))
                ->where('element LIKE ' . $db->quote($this->name . '-%'))
                ->order('ordering');

            $plugins = $db->setQuery($query)->loadObjectList();

            foreach ($plugins as $plugin) {
                $name = str_replace($this->name, '', $plugin->element);

                // load language file
                $language->load('plg_jce_' . $this->name . '_' . $name, JPATH_ADMINISTRATOR);

                // create manifest path
                $plugin->manifest = JPATH_PLUGINS . '/jce/' . $plugin->element . '/' . $plugin->element . '.xml';
            }
        }

        return $plugins;
    }
}
customlist.php000060400000004375152457032700007475 0ustar00<?php
/**
 * @package     JCE
 * @subpackage  Admin
 *
 * @copyright   Copyright (C) 2005 - 2020 Open Source Matters, Inc. All rights reserved.
 * @copyright   Copyright (c) 2009-2024 Ryan Demmer. All rights reserved
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */

\defined('_JEXEC') or die;

use Joomla\CMS\Form\Field\ListField;

class JFormFieldCustomList extends ListField
{
    /**
     * The form field type.
     *
     * @var string
     *
     * @since  11.1
     */
    protected $type = 'CustomList';

    /**
     * Method to attach a JForm object to the field.
     *
     * @param SimpleXMLElement $element The SimpleXMLElement object representing the <field /> tag for the form field object
     * @param mixed            $value   The form field value to validate
     * @param string           $group   The field name group control value. This acts as as an array container for the field.
     *                                  For example if the field has name="foo" and the group value is set to "bar" then the
     *                                  full field name would end up being "bar[foo]"
     *
     * @return bool True on success
     *
     * @since   11.1
     */
    public function setup(SimpleXMLElement $element, $value, $group = null)
    {
        $return = parent::setup($element, $value, $group);

        $this->class = trim($this->class . ' com_jce_select_custom');

        return $return;
    }

    protected function getOptions()
    {
        $options = parent::getOptions();

        $this->value = is_array($this->value) ? $this->value : explode(',', $this->value);

        $custom = array();

        foreach ($this->value as $value) {
            $tmp = array(
                'value' => $value,
                'text' => $value,
                'selected' => true,
            );

            $found = false;

            foreach ($options as $option) {
                if ($option->value === $value) {
                    $found = true;
                }
            }

            if (!$found) {
                $custom[] = (object) $tmp;
            }
        }

        // Merge any additional options in the XML definition.
        $options = array_merge($options, $custom);

        return $options;
    }
}
keyvalue.php000060400000017100152457032700007102 0ustar00<?php
/**
 * @package     JCE
 * @subpackage  Admin
 *
 * @copyright   Copyright (C) 2005 - 2020 Open Source Matters, Inc. All rights reserved.
 * @copyright   Copyright (c) 2009-2024 Ryan Demmer. All rights reserved
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */

\defined('_JEXEC') or die;

use Joomla\CMS\Form\Form;
use Joomla\CMS\Form\FormField;
use Joomla\CMS\Language\Text;

class JFormFieldKeyValue extends FormField
{

    /**
     * The form field type.
     *
     * @var    string
     *
     * @since  2.8
     */
    protected $type = 'KeyValue';

    /**
     * Method to attach a JForm object to the field.
     *
     * @param   SimpleXMLElement  $element  The SimpleXMLElement object representing the <field /> tag for the form field object.
     * @param   mixed             $value    The form field value to validate.
     * @param   string            $group    The field name group control value. This acts as as an array container for the field.
     *                                      For example if the field has name="foo" and the group value is set to "bar" then the
     *                                      full field name would end up being "bar[foo]".
     *
     * @return  boolean  True on success.
     *
     * @since   2.8
     */
    public function setup(SimpleXMLElement $element, $value, $group = null)
    {
        $return = parent::setup($element, $value, $group);

        return $return;
    }

    /**
     * Method to get the field input markup.
     *
     * @return  string  The field input markup.
     *
     * @since   11.1
     */
    protected function getInput()
    {
        $values = $this->value;

        if (is_string($values) && !empty($values)) {
            $value = htmlspecialchars_decode($this->value);
            $value = html_entity_decode($value, ENT_QUOTES | ENT_HTML5, 'UTF-8');

            $values = json_decode($value, true);

            // not valid json
            if (empty($values) || json_last_error() !== JSON_ERROR_NONE) {
                $values = array();

                // If the value is a string with key-value pairs, convert it to an array
                if (strpos($value, ':') !== false && strpos($value, '{') === false) {
                    foreach (explode(',', $value) as $item) {
                        $pair = explode(':', $item);

                        array_walk($pair, function (&$val) {
                            $val = trim($val, chr(0x22) . chr(0x27) . chr(0x38));
                        });

                        $values[] = array(
                            'name' => $pair[0],
                            'value' => $pair[1],
                        );
                    }
                } else {
                    // where the value is a string with no key-value pairs, use only the "name" key
                    $values = array(
                        array(
                            'name' => $value,
                            'value' => '',
                        ),
                    );
                }
            }
        }

        // default
        if (empty($values)) {
            $values = array(
                array(
                    'name' => '',
                    'value' => '',
                ),
            );
        }

        $subForm = new Form($this->name, array('control' => $this->formControl));

        $children = (array) $this->element->children();

        // if field has defined children
        if (count($children)) {
            $children = $this->element->children();

            $subForm->load($children, true);
            $subForm->setFields($children);
        } else {
            $label = $this->element['label'];

            $xml = '<form><fields name="' . $this->name . '">';

            $keyName = 'name';
            $keyLabel = 'WF_LABEL_NAME';

            if (isset($this->element['keyName'])) {
                $keyName = $this->element['keyName'];
            }

            if (isset($this->element['keyLabel'])) {
                $keyLabel = htmlspecialchars($this->element['keyLabel'], ENT_QUOTES, 'UTF-8');
            }

            $xml .= '<field name="' . $keyName . '" type="text" label="' . $keyLabel . '" description="" />';

            $valueName = 'value';
            $valueLabel = 'WF_LABEL_VALUE';

            if (isset($this->element['valueName'])) {
                $valueName = $this->element['valueName'];
            }

            if (isset($this->element['valueLabel'])) {
                $valueLabel = htmlspecialchars($this->element['valueLabel'], ENT_QUOTES, 'UTF-8');
            }

            $xml .= '<field name="' . $valueName . '" type="text" label="' . $valueLabel . '" description="" />';

            if ($this->element['boolean']) {
                $xml .= '<field name="boolean" type="checkbox" class="wf-keyvalue-boolean" label="' . Text::_('WF_LABEL_BOOLEAN') . '" description="" />';
            }

            $xml .= '</fields></form>';

            $subForm->load($xml);
        }

        $fields = $subForm->getFieldset();

        // And finaly build a main container
        $str = array();

        $sortable = '';

        if (isset($this->element['sortable'])) {
            $sortable = ' data-sortable="' . $this->element['sortable'] . '"';
        }

        $str[] = '<div class="form-field-repeatable"' . $sortable . '>';

        // the default field names for the key-value pairs
        $fieldItem = array('name', 'value');

        foreach ($values as $value) {
            $str[] = '<div class="form-field-repeatable-item wf-keyvalue">';
            $str[] = '  <div class="form-field-repeatable-item-group well p-4 card">';

            $n = 0;

            foreach ($fields as $field) {
                $tmpField = clone $field;

                $tmpField->element['multiple'] = true;

                $name = (string) $tmpField->element['name'];

                $val = is_array($value) && isset($value[$name]) ? $value[$name] : '';

                // if the original value is a string and does not match the field name, use the default field item name
                if (!isset($value[$name]) && is_string($this->value)) {
                    $key = $fieldItem[$n] ?? '';

                    if ($key) {
                        $val = $value[$key] ?? '';
                    }
                }

                // escape value
                $tmpField->value = htmlspecialchars_decode($val);

                $tmpField->setup($tmpField->element, $tmpField->value, $this->group);

                // reset id
                $tmpField->id .= '_' . $n;

                // reset name
                $tmpField->name = $name;

                $str[] = $tmpField->renderField(array('description' => $tmpField->description));

                $n++;
            }

            $str[] = '  </div>';

            $str[] = '  <div class="form-field-repeatable-item-control">';
            $str[] = '      <button class="btn btn-link form-field-repeatable-add" aria-label="' . Text::_('JGLOBAL_FIELD_ADD') . '"><i class="icon icon-plus pull-right float-right"></i></button>';
            $str[] = '      <button class="btn btn-link form-field-repeatable-remove" aria-label="' . Text::_('JGLOBAL_FIELD_REMOVE') . '"><i class="icon icon-trash pull-right float-right"></i></button>';
            $str[] = '  </div>';

            $str[] = '</div>';
        }

        if (!empty($this->value)) {
            $this->value = htmlspecialchars(json_encode($values));
        }

        $str[] = '<input type="hidden" name="' . $this->name . '" value="' . $this->value . '" />';

        $str[] = '</div>';

        return implode("", $str);
    }
}
styleformat.php000060400000010600152457032700007624 0ustar00<?php
/**
 * @package     JCE
 * @subpackage  Admin
 *
 * @copyright   Copyright (C) 2005 - 2020 Open Source Matters, Inc. All rights reserved.
 * @copyright   Copyright (c) 2009-2024 Ryan Demmer. All rights reserved
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */

\defined('_JEXEC') or die;

use Joomla\CMS\Form\Form;
use Joomla\CMS\Form\FormField;
use Joomla\CMS\Language\Text;

/**
 * Renders a select element.
 */
class JFormFieldStyleFormat extends FormField
{
    /*
     * Element type
     *
     * @access    protected
     * @var        string
     */
    protected $type = 'StyleFormat';

    private function loadSubForm()
    {
        $subForm = new Form($this->name);
        
        // editor manifest
        $manifest = JPATH_ADMINISTRATOR . '/components/com_jce/models/forms/styleformat.xml';
        $xml = simplexml_load_file($manifest);
        $subForm->load($xml);

        return $subForm;
    }

    private function renderFields($form, $item)
    {
        $fields = $form->getFieldset();
        
        $data = array();

        foreach ($fields as $field) {
            $tmpField = clone $field;
            
            $key = (string) $tmpField->element['name'];

            // default value
            $tmpField->value = "";

            if (array_key_exists($key, $item)) {
                $tmpField->value = htmlspecialchars_decode($item[$key], ENT_QUOTES);
            }

            $tmpField->setup($tmpField->element, $tmpField->value, $this->group);
            $tmpField->id = '';
            $tmpField->name = '';

            $data[] = '<div class="styleformat-item-' . $key . '" data-key="' . $key . '">' . $tmpField->renderField(array('description' => $tmpField->description)) . '</div>';
        }

        return implode('', $data);
    }

    protected function getInput()
    {
        $wf = WFApplication::getInstance();

        $output = array();

        // default item list (remove "attributes" for now)
        $default = array('title' => '', 'element' => '', 'selector' => '', 'classes' => '', 'styles' => '', 'attributes' => '');

        // pass to items
        $items = $this->value;

        if (is_string($items)) {
            $items = json_decode(htmlspecialchars_decode($this->value), true);
        }

        // cast to array
        $items = (array) $items;

        /* Convert legacy styles */
        $theme_advanced_styles = $wf->getParam('editor.theme_advanced_styles', '');

        if (!empty($theme_advanced_styles)) {
            foreach (explode(',', $theme_advanced_styles) as $styles) {
                $style = json_decode('{' . preg_replace('#([^=]+)=([^=]+)#', '"title":"$1","classes":"$2"', $styles) . '}', true);

                if ($style) {
                    $items[] = $style;
                }
            }
        }

        // create default array if no items
        if (empty($items)) {
            $items = array($default);
        }

        $output[] = '<div class="styleformat-list">';

        $x = 0;

        $subForm = $this->loadSubForm();

        foreach ($items as $item) {
            $elements = array('<div class="styleformat border bg-light-subtle">');

            $elements[] = $this->renderFields($subForm, $item);

            $elements[] = '<div class="styleformat-header">';

            // handle
            $elements[] = '<span class="styleformat-item-handle"></span>';
            // delete button
            $elements[] = '<button class="styleformat-item-trash btn btn-link"><i class="icon icon-trash"></i></button>';
            // collapse
            $elements[] = '<button class="close collapse btn btn-link"><i class="icon icon-chevron-up"></i><i class="icon icon-chevron-down"></i></button>';

            $elements[] = '</div>';

            $elements[] = '</div>';

            $output[] = implode('', $elements);

            $x++;
        }

        $output[] = '<button class="btn btn-link styleformat-item-plus border"><span class="text-left">' . Text::_('WF_STYLEFORMAT_NEW') . '</span><i class="icon icon-plus"></i></button>';

        // hidden field
        $output[] = '<input type="hidden" name="' . $this->name . '" value="" />';

        if (!empty($theme_advanced_styles)) {
            $output[] = '<input type="hidden" name="' . $this->getName('theme_advanced_styles') . '" value="" class="isdirty" />';
        }

        $output[] = '</div>';

        return implode("\n", $output);
    }
}filesystem.php000060400000011223152457032700007441 0ustar00<?php
/**
 * @package     JCE
 * @subpackage  Admin
 *
 * @copyright   Copyright (C) 2005 - 2020 Open Source Matters, Inc. All rights reserved.
 * @copyright   Copyright (c) 2009-2024 Ryan Demmer. All rights reserved
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */

\defined('_JEXEC') or die;

use Joomla\CMS\Form\Field\ListField;
use Joomla\CMS\Form\Form;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;

class JFormFieldFilesystem extends ListField
{
    /**
     * The form field type.
     *
     * @var string
     *
     * @since  11.1
     */
    protected $type = 'Filesystem';

    /**
     * Method to attach a JForm object to the field.
     *
     * @param SimpleXMLElement $element The SimpleXMLElement object representing the <field /> tag for the form field object
     * @param mixed            $value   The form field value to validate
     * @param string           $group   The field name group control value. This acts as as an array container for the field.
     *                                  For example if the field has name="foo" and the group value is set to "bar" then the
     *                                  full field name would end up being "bar[foo]"
     *
     * @return bool True on success
     *
     * @since   11.1
     */
    public function setup(SimpleXMLElement $element, $value, $group = null)
    {
        $return = parent::setup($element, $value, $group);

        return $return;
    }

    /**
     * Method to get the field input markup.
     *
     * @return string The field input markup
     *
     * @since   11.1
     */
    protected function getInput()
    {
        $value = $this->value;

        // decode json string
        if (!empty($value) && is_string($value)) {
            $value = json_decode($value, true);
        }

        // default
        if (empty($value)) {
            $value = array('name' => $this->default);
        } else {
            if (!isset($value['name'])) {
                $value['name'] = $this->default;
            }
        }

        $plugins = $this->getPlugins();
        $options = $this->getOptions();

        $html = '';
        $html .= '<div class="controls-row">';

        $html .= '<div class="control-group">';
        $html .= HTMLHelper::_('select.genericlist', $options, $this->name . '[name]', 'data-toggle="filesystem-options" class="custom-select"', 'value', 'text', $value['name']);
        $html .= '</div>';

        $html .= '<div class="filesystem-options clearfix">';

        foreach ($plugins as $plugin) {
            $form = Form::getInstance('plg_jce_' . $this->name . '_' . $plugin->name, $plugin->manifest, array('control' => $this->name . '[' . $plugin->name . ']'), true, '//extension');

            if ($form) {
                // get the data for this form, if set
                $data = isset($value[$plugin->name]) ? $value[$plugin->name] : array();

                // bind data to form
                $form->bind($data);

                $html .= '<div class="well well-small p-3 card" data-toggle-target="filesystem-options-' . $plugin->name . '">';

                $fields = $form->getFieldset('filesystem.' . $plugin->name);

                foreach ($fields as $field) {
                    $html .= $field->renderField(array('description' => $field->description));
                }

                $html .= '</div>';
            }
        }

        $html .= '</div>';
        $html .= '</div>';

        return $html;
    }

    /**
     * Method to get the field options.
     *
     * @return array The field option objects
     *
     * @since   11.1
     */
    protected function getPlugins()
    {
        static $plugins;

        if (!isset($plugins)) {
            $plugins = JcePluginsHelper::getExtensions('filesystem');
        }

        return $plugins;
    }

    /**
     * Method to get the field options.
     *
     * @return array The field option objects
     *
     * @since   11.1
     */
    protected function getOptions()
    {
        $fieldname = preg_replace('/[^a-zA-Z0-9_\-]/', '_', $this->fieldname);

        $options = parent::getOptions();

        $plugins = $this->getPlugins();

        foreach ($plugins as $plugin) {
            $value = (string) $plugin->name;
            $text = (string) $plugin->title;

            $tmp = array(
                'value' => $value,
                'text' => Text::alt($text, $fieldname),
                'disable' => false,
                'class' => '',
                'selected' => false,
            );

            // Add the option object to the result set.
            $options[] = (object) $tmp;
        }

        reset($options);

        return $options;
    }
}
componentslist.php000060400000005450152457032700010343 0ustar00<?php

/**
 * @package     JCE
 * @subpackage  Admin
 *
 * @copyright   Copyright (C) 2005 - 2020 Open Source Matters, Inc. All rights reserved.
 * @copyright   Copyright (c) 2009-2024 Ryan Demmer. All rights reserved
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */

\defined('_JEXEC') or die;

use Joomla\CMS\Factory;
use Joomla\CMS\Form\Field\ListField;
use Joomla\CMS\Language\Text;
use Joomla\Utilities\ArrayHelper;

/**
 * Form Field class for the Joomla Framework.
 *
 * @since       11.4
 */
class JFormFieldComponentsList extends ListField
{
    /**
     * The field type.
     *
     * @var string
     *
     * @since  11.4
     */
    protected $type = 'ComponentsList';

    /**
     * Method to get a list of options for a list input.
     *
     * @return array An array of JHtml options
     *
     * @since   11.4
     */
    protected function getOptions()
    {
        $language = Factory::getLanguage();

        $exclude = array(
            'com_admin',
            'com_cache',
            'com_checkin',
            'com_config',
            'com_cpanel',
            'com_fields',
            'com_finder',
            'com_installer',
            'com_languages',
            'com_login',
            'com_mailto',
            'com_menus',
            'com_media',
            'com_messages',
            'com_newsfeeds',
            'com_plugins',
            'com_redirect',
            'com_templates',
            'com_users',
            'com_wrapper',
            'com_search',
            'com_user',
            'com_updates',
        );

        // Get list of plugins
        $db = Factory::getDbo();
        $query = $db->getQuery(true)
            ->select('element AS value, name AS text')
            ->from('#__extensions')
            ->where('type = ' . $db->quote('component'))
            ->where('enabled = 1')
            ->order('ordering, name');
        $db->setQuery($query);

        $items = $db->loadObjectList();

        $options = array();

        foreach ($items as $item) {
            // Load language
            $extension = $item->value;

            $language->load("$extension.sys", JPATH_ADMINISTRATOR)
                || $language->load("$extension.sys", JPATH_ADMINISTRATOR . '/components/' . $extension);

            $text = strtoupper($item->text);

            if ($text === 'COM_JCE') {
                $text = 'WF_CPANEL_BROWSER';
            }

            // Translate component name
            $item->text = Text::_($text);

            $options[] = $item;
        }

        // Sort by component name
        $options = ArrayHelper::sortObjects($options, 'text', 1, true, true);

        // Merge any additional options in the XML definition.
        $options = array_merge(parent::getOptions(), $options);

        return $options;
    }
}
heading.php000060400000004027152457032700006660 0ustar00<?php
/**
 * @package     JCE
 * @subpackage  Admin
 *
 * @copyright   Copyright (C) 2005 - 2020 Open Source Matters, Inc. All rights reserved.
 * @copyright   Copyright (c) 2009-2024 Ryan Demmer. All rights reserved
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */

\defined('_JEXEC') or die;

use Joomla\CMS\Form\FormField;
use Joomla\CMS\Language\Text;

class JFormFieldHeading extends FormField
{
    /**
     * The form field type.
     *
     * @var string
     *
     * @since  11.1
     */
    protected $type = 'Heading';

    /**
     * Method to get the field input markup for a spacer.
     * The spacer does not have accept input.
     *
     * @return string The field input markup
     *
     * @since   11.1
     */
    protected function getInput()
    {
        return ' ';
    }

    /**
     * Method to get the field label markup for a spacer.
     * Use the label text or name from the XML element as the spacer or
     * Use a hr="true" to automatically generate plain hr markup.
     *
     * @return string The field label markup
     *
     * @since   11.1
     */
    protected function getLabel()
    {
        $html = array();
        $class = !empty($this->class) ? ' class="' . $this->class . '"' : '';
        $html[] = '<h3' . $class . '>';

        // Get the label text from the XML element, defaulting to the element name.
        $text = $this->element['label'] ? (string) $this->element['label'] : (string) $this->element['name'];
        $text = $this->translateLabel ? Text::_($text) : $text;

        $html[] = $text;

        $html[] = '</h3>';

        // If a description is specified, use it to build a tooltip.
        if (!empty($this->description)) {
            $html[] = '<small>' . Text::_($this->description) . '</small>';
        }

        return implode('', $html);
    }

    /**
     * Method to get the field title.
     *
     * @return string The field title
     *
     * @since   11.1
     */
    protected function getTitle()
    {
        return $this->getLabel();
    }
}
container.php000060400000023312152457032700007241 0ustar00<?php

/**
 * @package     JCE
 * @subpackage  Admin
 *
 * @copyright   Copyright (C) 2005 - 2020 Open Source Matters, Inc. All rights reserved.
 * @copyright   Copyright (c) 2009-2024 Ryan Demmer. All rights reserved
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */

\defined('_JEXEC') or die;

use Joomla\CMS\Form\Form;
use Joomla\CMS\Form\FormField;
use Joomla\CMS\Language\Text;

/**
 * Form Field class for the JCE.
 * Display a field with a repeatable set of defined sub fields
 *
 * @since       2.8.13
 */
class JFormFieldContainer extends FormField
{
    /**
     * The form field type.
     *
     * @var    string
     * @since  2.8.13
     */
    protected $type = 'Container';

    /**
     * Method to get the field label markup for a spacer.
     * Use the label text or name from the XML element as the spacer or
     * Use a hr="true" to automatically generate plain hr markup.
     *
     * @return string The field label markup
     *
     * @since   11.1
     */
    protected function getLabel()
    {
        return '';
    }

    // Function to check if two arrays are equal
    private function arraysEqual($arr1, $arr2)
    {
        if (count($arr1) !== count($arr2)) {
            return false;
        }

        for ($i = 0; $i < count($arr1); $i++) {
            if ($arr1[$i] !== $arr2[$i]) {
                return false;
            }
        }

        return true;
    }

    // Function to check if an array exists within another array of arrays
    private function arrayExistsInContainer($container, $array)
    {
        foreach ($container as $containedArray) {
            if ($this->arraysEqual($containedArray, $array)) {
                return true;
            }
        }

        return false;
    }

    /**
     * Build a subform from a container <field> but strip nested <field> descendants.
     *
     * @param  SimpleXMLElement $container  The <field type="container" ...> element (eg. $this->element)
     * @param  array            $data       Data to bind
     * @param  string           $control    Control name
     * @param  string           $name       Form name
     * @return \Joomla\CMS\Form\Form
     */
    private function buildContainerSubForm(SimpleXMLElement $container, array $data, string $control, string $name)
    {
        // Create a minimal wrapper <form><fields/></form>
        $wrapper   = new SimpleXMLElement('<form><fields/></form>');
        $fieldsDst = $wrapper->fields;

        // Take only the container’s *direct* children (field / fieldset)
        // but strip any descendant <field> nodes inside them.
        $directNodes = $container->xpath('./field | ./fieldset');

        // Types that must KEEP their inner <field> schema
        $keepInnerFor = array('repeatable', 'subform'); // add more as needed

        foreach ($directNodes as $node) {
            // Clone the node
            $clone = new SimpleXMLElement($node->asXML());

            $type = (string) $node['type'];

            if (!in_array($type, $keepInnerFor, true)) {
                // Remove ALL descendant <field> nodes from the clone
                foreach ($clone->xpath('.//field') as $desc) {
                    $d = dom_import_simplexml($desc);
                    $d->parentNode->removeChild($d);
                }
            }

            // Append the cleaned clone to the wrapper
            $to   = dom_import_simplexml($fieldsDst);
            $from = dom_import_simplexml($clone);
            $to->appendChild($to->ownerDocument->importNode($from, true));
        }

        // Load the cleaned XML into a new Form (no setFields!)
        $subForm = new Form($name, ['control' => $control]);

        $subForm->load($wrapper);

        // Bind values
        $subForm->bind($data);

        return $subForm;
    }

    /**
     * Method to get the field input markup.
     *
     * @return  string  The field input markup.
     *
     * @since   2.8.13
     */
    protected function getInput()
    {
        $group = $this->group;

        // expand group with container name
        if ($this->element['name']) {
            $group .= '.' . (string) $this->element['name'];
        }

        $children = $this->element->children();

        // extract group data
        $data = $this->form->getData()->get($group);
        // to array
        $data = (array) $data;

        $count = 1;

        $repeatable = (string) $this->element['repeatable'];

        if ($repeatable) {
            // find number of potential repeatable fields
            foreach ($children as $child) {
                $name = (string) $child->attributes()['name'];

                if (isset($data[$name]) && is_array($data[$name])) {
                    $count = max(count($data[$name]), $count);
                }
            }
        }

        // And finaly build a main container
        $str = array();

        if ($this->class == 'inset') {
            $this->class .= ' well well-light p-4 card';
        }

        $str[] = '<div class="form-field-container ' . $this->class . '">';
        $str[] = '<fieldset class="form-field-container-group">';

        if ($this->element['label']) {
            $text = $this->element['label'];
            $text = $this->translateLabel ? Text::_($text) : $text;

            $str[] = '<legend>' . $text . '</legend>';
        }

        if ((string) $this->element['description']) {
            $text = $this->element['description'];
            $text = $this->translateLabel ? Text::_($text) : $text;

            $descriptionClass = isset($this->element['descriptionclass']) ? 'description ' . $this->element['descriptionclass'] : 'description';

            $str[] = '<small class="' . $descriptionClass . '">' . $text . '</small>';

            // reset description
            $this->description = '';
        }

        // repeatable
        if ($repeatable) {
            // collapse
            $str[] = '<div class="form-field-repeatable">';
        }

        $containerValues = array();

        for ($i = 0; $i < $count; $i++) {
            $item = array();

            if ($repeatable) {
                $item[] = '<div class="form-field-repeatable-item well p-3 card my-2">';
                $item[] = '  <div class="form-field-repeatable-item-group">';
            }

            $control = $this->formControl . '[' . str_replace('.', '][', $group) . ']';
            $subForm = $this->buildContainerSubForm($this->element, (array) $data, $control, $this->fieldname);

            $fields = $subForm->getFieldset();

            $defaultValues = array();
            $fieldValues = array();

            foreach ($fields as $field) {
                $tmpField = clone $field;

                $name = (string) $tmpField->element['name'];
                $value = (string) $tmpField->element['default'];

                $defaultValues[] = $value;

                if (empty($name)) {
                    continue;
                }

                if (is_array($data) && isset($data[$name])) {
                    $value = $data[$name];
                }

                $type = (string) $tmpField->element['type'];

                // convert checkboxes value to string
                if ($type == 'checkboxes') {
                    if (is_array($value)) {
                        $value = implode(',', $value);
                    }
                }

                // extract value if this is a repeatable container
                if (is_array($value) && $repeatable) {
                    $value = isset($value[$i]) ? $value[$i] : '';
                }

                // escape values
                if (is_array($value)) {
                    // handle nested arrays
                    array_walk_recursive($value, function (&$item) {
                        if (is_string($item)) {
                            $item = htmlspecialchars($item, ENT_COMPAT, 'UTF-8');
                        }
                    });
                } else {
                    $value = htmlspecialchars($value, ENT_COMPAT, 'UTF-8');
                }

                // store value for repeatable check
                $fieldValues[] = $value;

                $tmpField->value = $value;
                $tmpField->setup($tmpField->element, $tmpField->value);

                if ($repeatable) {
                    // reset id
                    $tmpField->id .= '_' . $i;

                    if (strpos($tmpField->name, '[]') === false) {
                        $tmpField->name .= '[]';
                    }
                }

                $item[] = $tmpField->renderField(array('description' => $tmpField->description));
            }

            if ($repeatable) {
                $item[] = '</div>';

                $item[] = '<div class="form-field-repeatable-item-control">';
                $item[] = '<button class="btn btn-link form-field-repeatable-add" aria-label="' . Text::_('JGLOBAL_FIELD_ADD') . '"><i class="icon icon-plus"></i></button>';
                $item[] = '<button class="btn btn-link form-field-repeatable-remove" aria-label="' . Text::_('JGLOBAL_FIELD_REMOVE') . '"><i class="icon icon-trash"></i></button>';
                $item[] = '</div>';

                $item[] = '</div>';
            }

            // remove empty fields with default values
            if ($count > 1 && $this->arraysEqual($defaultValues, $fieldValues)) {
                continue;
            }

            // only add if unique
            if ($this->arrayExistsInContainer($containerValues, $fieldValues)) {
                continue;
            }

            $str[] = implode('', $item);
            $containerValues[] = $fieldValues;
        }

        // repeatable
        if ($repeatable) {
            $str[] = '</div>';
        }

        $str[] = '</fieldset>';
        $str[] = '</div>';

        return implode("", $str);
    }
}
blockformats.php000060400000005566152457032700007760 0ustar00<?php
/**
 * @package     JCE
 * @subpackage  Admin
 *
 * @copyright   Copyright (C) 2005 - 2020 Open Source Matters, Inc. All rights reserved.
 * @copyright   Copyright (c) 2009-2024 Ryan Demmer. All rights reserved
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */

\defined('_JEXEC') or die;

use Joomla\CMS\Form\Field\CheckboxesField;
use Joomla\CMS\Language\Text;

class JFormFieldBlockformats extends CheckboxesField
{
    /**
     * The form field type.
     *
     * @var string
     *
     * @since  11.1
     */
    protected $type = 'Blockformats';

    /**
     * Name of the layout being used to render the field
     *
     * @var    string
     * @since  3.5
     */
    protected $layout = 'form.field.blockformats';

    protected static $blockformats = array(
        'p' => 'Paragraph',
        'div' => 'Div',
        'div_container' => 'Div Container',
        'h1' => 'Heading1',
        'h2' => 'Heading2',
        'h3' => 'Heading3',
        'h4' => 'Heading4',
        'h5' => 'Heading5',
        'h6' => 'Heading6',
        'blockquote' => 'Blockquote',
        'address' => 'Address',
        'code' => 'Code',
        'pre' => 'Preformatted',
        'samp' => 'Sample',
        'span' => 'Span',
        'section' => 'Section',
        'article' => 'Article',
        'aside' => 'Aside',
        'header' => 'Header',
        'footer' => 'Footer',
        'nav' => 'Nav',
        'figure' => 'Figure',
        'dl' => 'Definition List',
        'dt' => 'Definition Term',
        'dd' => 'Definition Description'
    );

    /**
     * Allow to override renderer include paths in child fields
     *
     * @return  array
     *
     * @since   3.5
     */
    protected function getLayoutPaths()
    {
        return array(JPATH_ADMINISTRATOR . '/components/com_jce/layouts', JPATH_SITE . '/layouts');
    }

    protected function getOptions()
    {
        $fieldname = preg_replace('/[^a-zA-Z0-9_\-]/', '_', $this->fieldname);
        $options = array();

        if (empty($this->value)) {
            $data = array_keys(self::$blockformats);
            $values = $data;
        } else {
            if (is_string($this->value)) {
                $this->value = explode(',', $this->value);
            }
            $values = $this->value;
            $data = array_unique(array_merge($this->value, array_keys(self::$blockformats)));
        }

        // create default font structure
        foreach ($data as $format) {
            if (array_key_exists($format, self::$blockformats) === false) {
                continue;
            }

            $text = self::$blockformats[$format];

            $tmp = array(
                'value' => $format,
                'text' => Text::alt($text, $fieldname),
                'checked' => in_array($format, $values),
            );

            $options[] = (object) $tmp;
        }

        return $options;
    }
}
popups.php000060400000002375152457032700006613 0ustar00<?php
/**
 * @package     JCE
 * @subpackage  Admin
 *
 * @copyright   Copyright (C) 2005 - 2020 Open Source Matters, Inc. All rights reserved.
 * @copyright   Copyright (c) 2009-2024 Ryan Demmer. All rights reserved
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */

\defined('_JEXEC') or die;

use Joomla\CMS\Form\Field\ListField;
use Joomla\CMS\Form\Form;
use Joomla\CMS\Language\Text;

class JFormFieldPopups extends ListField
{
    /**
     * The form field type.
     *
     * @var string
     *
     * @since  11.1
     */
    protected $type = 'Popups';

    /**
     * Method to get a list of options for a list input.
     *
     * @return array An array of JHtml options
     *
     * @since   11.4
     */
    protected function getOptions()
    {
        $extensions = JcePluginsHelper::getExtensions('popups');

        $options = array();

        foreach ($extensions as $item) {
            $option = new StdClass;

            $option->text = Text::_($item->title, true);
            $option->disable = '';
            $option->value = $item->name;

            $options[] = $option;
        }

        // Merge any additional options in the XML definition.
        return array_merge(parent::getOptions(), $options);
    }
}
code.php000060400000002305152457032700006170 0ustar00<?php
/**
 * @package     JCE
 * @subpackage  Admin
 *
 * @copyright   Copyright (C) 2005 - 2020 Open Source Matters, Inc. All rights reserved.
 * @copyright   Copyright (c) 2009-2024 Ryan Demmer. All rights reserved
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */

\defined('_JEXEC') or die;

use Joomla\CMS\Form\Field\TextareaField;

/**
 * Color Form Field class for the Joomla Platform.
 * This implementation is designed to be compatible with HTML5's `<input type="color">`
 *
 * @link   http://www.w3.org/TR/html-markup/input.color.html
 * @since  11.3
 */
class JFormFieldCode extends TextareaField
{
    /**
     * The form field type.
     *
     * @var    string
     * @since  11.3
     */
    protected $type = 'Code';

    /**
     * Name of the layout being used to render the field
     *
     * @var    string
     * @since  3.5
     */
    protected $layout = 'form.field.code';

    /**
     * Allow to override renderer include paths in child fields
     *
     * @return  array
     *
     * @since   3.5
     */
    protected function getLayoutPaths()
    {
        return array(JPATH_ADMINISTRATOR . '/components/com_jce/layouts', JPATH_SITE . '/layouts');
    }
}buttons.php000060400000004361152457032700006760 0ustar00<?php
/**
 * @package     JCE
 * @subpackage  Admin
 *
 * @copyright   Copyright (C) 2005 - 2020 Open Source Matters, Inc. All rights reserved.
 * @copyright   Copyright (c) 2009-2024 Ryan Demmer. All rights reserved
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */

\defined('_JEXEC') or die;

use Joomla\CMS\Form\Field\CheckboxesField;

class JFormFieldButtons extends CheckboxesField
{
    /**
     * The form field type.
     *
     * @var string
     *
     * @since  11.1
     */
    protected $type = 'Buttons';

    /**
     * Name of the layout being used to render the field
     *
     * @var    string
     * @since  3.5
     */
    protected $layout = 'form.field.buttons';

    /**
     * Method to get the field label markup for a spacer.
     * Use the label text or name from the XML element as the spacer or
     * Use a hr="true" to automatically generate plain hr markup.
     *
     * @return string The field label markup
     *
     * @since   11.1
     */
    protected function getLabel()
    {
        return '';
    }

    /**
     * Method to attach a JForm object to the field.
     *
     * @param SimpleXMLElement $element The SimpleXMLElement object representing the <field /> tag for the form field object
     * @param mixed            $value   The form field value to validate
     * @param string           $group   The field name group control value. This acts as as an array container for the field.
     *                                  For example if the field has name="foo" and the group value is set to "bar" then the
     *                                  full field name would end up being "bar[foo]"
     *
     * @return bool True on success
     *
     * @since   11.1
     */
    public function setup(SimpleXMLElement $element, $value, $group = null)
    {
        $return = parent::setup($element, $value, $group);

        $this->class = trim($this->class . ' mceDefaultSkin');

        return $return;
    }

    /**
     * Allow to override renderer include paths in child fields
     *
     * @return  array
     *
     * @since   3.5
     */
    protected function getLayoutPaths()
    {
        return array(JPATH_ADMINISTRATOR . '/components/com_jce/layouts', JPATH_SITE . '/layouts');
    }
}
elementlist.php000060400000003716152457032700007612 0ustar00<?php
/**
 * @package     JCE
 * @subpackage  Admin
 *
 * @copyright   Copyright (C) 2005 - 2020 Open Source Matters, Inc. All rights reserved.
 * @copyright   Copyright (c) 2009-2024 Ryan Demmer. All rights reserved
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */

\defined('_JEXEC') or die;

use Joomla\CMS\Form\Field\ListField;
use Joomla\CMS\Language\Text;

class JFormFieldElementList extends ListField
{
    /**
     * The form field type.
     *
     * @var string
     *
     * @since  11.1
     */
    protected $type = 'ElementList';

    /**
     * Method to get the field options.
     *
     * @return array The field option objects
     *
     * @since   11.1
     */
    protected function getOptions()
    {
        $fieldname = preg_replace('/[^a-zA-Z0-9_\-]/', '_', $this->fieldname);
        $options = array();

        $tags = 'a,abbr,address,area,article,aside,audio,b,bdi,bdo,blockquote,br,button,canvas,caption,cite,code,col,colgroup,data,datalist,dd,del,details,dfn,dialog,div,dl,dt,em,fieldset,figcaption,figure,footer,form,h1,h2,h3,h4,h5,h6,header,hgroup,hr,i,img,input,ins,kbd,keygen,label,legend,li,main,map,mark,menu,menuitem,meter,nav,noscript,ol,optgroup,option,output,p,param,pre,progress,q,rb,rp,rt,rtc,ruby,s,samp,section,select,small,source,span,strong,sub,summary,sup,table,tbody,td,template,textarea,tfoot,th,thead,time,tr,track,u,ul,var,video,wbr';

        foreach (explode(',', $tags) as $option) {
            $value = (string) $option;
            $text = trim((string) $option);

            $tmp = array(
                'value' => $value,
                'text' => Text::alt($text, $fieldname),
                'disable' => false,
                'class' => '',
                'selected' => false,
                'checked' => false,
            );

            // Add the option object to the result set.
            $options[] = (object) $tmp;
        }

        reset($options);

        return $options;
    }
}
repeatable.php000060400000013137152457032700007367 0ustar00<?php
/**
 * @package     Joomla.Platform
 * @subpackage  Form
 *
 * @copyright   (C) 2013 Open Source Matters, Inc. <https://www.joomla.org>
 * @license     GNU General Public License version 2 or later; see LICENSE
 */

defined('JPATH_PLATFORM') or die;

/**
 * Form Field class for the Joomla Platform.
 * Display a JSON loaded window with a repeatable set of sub fields
 *
 * @since       3.2
 *
 * @deprecated  4.0  Use JFormFieldSubform
 */
class JFormFieldRepeatable extends JFormField
{
	/**
	 * The form field type.
	 *
	 * @var    string
	 * @since  3.2
	 */
	protected $type = 'Repeatable';

	/**
	 * Method to get the field input markup.
	 *
	 * @return  string  The field input markup.
	 *
	 * @since   3.2
	 */
	protected function getInput()
	{
		JLog::add('JFormFieldRepeatable is deprecated. Use JFormFieldSubform instead.', JLog::WARNING, 'deprecated');

		// Initialize variables.
		$subForm = new JForm($this->name, array('control' => 'jform'));
		$xml = $this->element->children()->asXml();
		$subForm->load($xml);

		// Needed for repeating modals in gmaps
		// @TODO: what and where???
		$subForm->repeatCounter = (int) @$this->form->repeatCounter;

		$children = $this->element->children();
		$subForm->setFields($children);

		// If a maximum value isn't set then we'll make the maximum amount of cells a large number
		$maximum = $this->element['maximum'] ? (int) $this->element['maximum'] : '999';

		// Build a Table
		$head_row_str = array();
		$body_row_str = array();
		$head_row_str[] = '<th></th>';
		$body_row_str[] = '<td><span class="sortable-handler " style="cursor: move;"><span class="icon-menu" aria-hidden="true"></span></span></td>';
		foreach ($subForm->getFieldset() as $field)
		{
			// Reset name to simple
			$field->name = (string) $field->element['name'];

			// Build heading
			$head_row_str[] = '<th>' . strip_tags($field->getLabel($field->name));
			$head_row_str[] = '<br /><small style="font-weight:normal">' . JText::_($field->description) . '</small>';
			$head_row_str[] = '</th>';

			// Build body
			$body_row_str[] = '<td>' . $field->getInput() . '</td>';
		}

		// Append buttons
		$head_row_str[] = '<th><div class="btn-group"><a href="#" class="add btn button btn-success" aria-label="' . JText::_('JGLOBAL_FIELD_ADD') . '">';
		$head_row_str[] = '<span class="icon-plus" aria-hidden="true"></span> </a></div></th>';
		$body_row_str[] = '<td><div class="btn-group">';
		$body_row_str[] = '<a class="add btn button btn-success" aria-label="' . JText::_('JGLOBAL_FIELD_ADD') . '">';
		$body_row_str[] = '<span class="icon-plus" aria-hidden="true"></span> </a>';
		$body_row_str[] = '<a class="remove btn button btn-danger" aria-label="' . JText::_('JGLOBAL_FIELD_REMOVE') . '">';
		$body_row_str[] = '<span class="icon-minus" aria-hidden="true"></span> </a>';
		$body_row_str[] = '</div></td>';

		// Put all table parts together
		$table = '<table id="' . $this->id . '_table" class="adminlist ' . $this->element['class'] . ' table table-striped">'
					. '<thead><tr>' . implode("\n", $head_row_str) . '</tr></thead>'
					. '<tbody><tr>' . implode("\n", $body_row_str) . '</tr></tbody>'
				. '</table>';

		// And finally build a main container
		$str = array();
		$str[] = '<div id="' . $this->id . '_container">';

		// Add the table to modal
		$str[] = '<div id="' . $this->id . '_modal" class="modal hide">';
		$str[] = $table;
		$str[] = '<div class="modal-footer">';
		$str[] = '<button class="close-modal btn button btn-link">' . JText::_('JCANCEL') . '</button>';
		$str[] = '<button class="save-modal-data btn button btn-primary">' . JText::_('JAPPLY') . '</button>';
		$str[] = '</div>';

		// Close modal container
		$str[] = '</div>';

		// Close main container
		$str[] = '</div>';

		// Button for display the modal window
		$select = (string) $this->element['select'] ? JText::_((string) $this->element['select']) : JText::_('JLIB_FORM_BUTTON_SELECT');
		$icon = $this->element['icon'] ? '<span class="icon-' . $this->element['icon'] . '"></span> ' : '';
		$str[] = '<button class="open-modal btn" id="' . $this->id . '_button" >' . $icon . $select . '</button>';

		if (is_array($this->value))
		{
			$this->value = array_shift($this->value);
		}

		// Script params
		$data = array();
		$data[] = 'data-container="#' . $this->id . '_container"';
		$data[] = 'data-modal-element="#' . $this->id . '_modal"';
		$data[] = 'data-repeatable-element="table tbody tr"';
		$data[] = 'data-bt-add="a.add"';
		$data[] = 'data-bt-remove="a.remove"';
		$data[] = 'data-bt-modal-open="#' . $this->id . '_button"';
		$data[] = 'data-bt-modal-close="button.close-modal"';
		$data[] = 'data-bt-modal-save-data="button.save-modal-data"';
		$data[] = 'data-maximum="' . $maximum . '"';
		$data[] = 'data-input="#' . $this->id . '"';

		// Hidden input, where the main value is
		$value = htmlspecialchars($this->value, ENT_COMPAT, 'UTF-8');
		$str[] = '<input type="hidden" name="' . $this->name . '" id="' . $this->id . '" value="' . $value
				. '"  class="form-field-repeatable" ' . implode(' ', $data) . ' />';

		// Add scripts
		JHtml::_('bootstrap.framework');

		// Depends on jQuery UI
		JHtml::_('jquery.ui', array('core', 'sortable'));

		JHtml::_('script', 'jui/sortablelist.js', array('version' => 'auto', 'relative' => true));
		JHtml::_('stylesheet', 'jui/sortablelist.css', array('version' => 'auto', 'relative' => true));
		JHtml::_('script', 'system/repeatable.js', array('framework' => true, 'version' => 'auto', 'relative' => true));

		$javascript = 'jQuery(document).ready(function($) { $("#' . $this->id . '_table tbody").sortable(); });';

		JFactory::getDocument()->addScriptDeclaration($javascript);

		return implode("\n", $str);
	}
}
filetype.php000060400000023067152457032700007107 0ustar00<?php
/**
 * @package     JCE
 * @subpackage  Admin
 *
 * @copyright   Copyright (C) 2005 - 2020 Open Source Matters, Inc. All rights reserved.
 * @copyright   Copyright (c) 2009-2024 Ryan Demmer. All rights reserved
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */

\defined('_JEXEC') or die;

use Joomla\CMS\Form\Field\TextField;
use Joomla\CMS\Language\Text;

class JFormFieldFiletype extends TextField
{
    /**
     * The form field type.
     *
     * @var string
     *
     * @since  11.1
     */
    protected $type = 'Filetype';

    /**
     * The default value for the field.
     *
     * @var string
     */
    protected $defaultValue = '';

    /**
     * Method to attach a JForm object to the field.
     *
     * @param SimpleXMLElement $element The SimpleXMLElement object representing the <field /> tag for the form field object
     * @param mixed            $value   The form field value to validate
     * @param string           $group   The field name group control value. This acts as as an array container for the field.
     *                                  For example if the field has name="foo" and the group value is set to "bar" then the
     *                                  full field name would end up being "bar[foo]"
     *
     * @return bool True on success
     *
     * @since   11.1
     */
    public function setup(SimpleXMLElement $element, $value, $group = null)
    {
        $return = parent::setup($element, $value, $group);

        return $return;
    }

    private static function array_flatten($array, $return)
    {
        foreach ($array as $key => $value) {
            if (is_array($value)) {
                $return = self::array_flatten($value, $return);
            } else {
                $return[] = $value;
            }
        }

        return $return;
    }

    private function mapValue($value, $isGrouped = false)
    {
        $data = array();

        // no grouping
        if (strpos($value, '=') === false) {
            return array(explode(',', $value));
        }

        foreach (explode(';', $value) as $group) {
            $items = explode('=', $group);
            $name = $items[0];
            $values = explode(',', $items[1]);

            array_walk($values, function (&$item) use ($name) {
                if ($name === '-') {
                    $item = '-' . $item;
                }
            });

            if ($isGrouped) {
                $data[$name] = $values;
            } else {
                // remove empty values
                $values = array_filter($values, function ($value) {
                    return !empty($value);
                });

                $data = array_merge($data, $values);
            }
        }

        if (!$isGrouped) {
            $data = array($data);
        }

        return $data;
    }

    private function cleanValue($value)
    {
        $data = $this->mapValue($value);
        // get array values only
        $values = self::array_flatten($data, array());

        // convert to string
        $string = implode(',', $values);

        // return single array
        return explode(',', $string);
    }

    private function getDefaultValues()
    {
        $defaultValues = [
            'default' => [],
        ];

        foreach ($this->element->children() as $element) {
            if ($element->getName() === 'option') {
                $defaultValues['default'][] = (string) $element;
            }

            if ($element->getName() === 'group') {
                $name = (string) $element['label'];

                $defaultValues[$name] = array();

                // Iterate through the children and build an array of options.
                foreach ($element->children() as $option) {
                    // Only add <option /> elements.
                    if ($option->getName() !== 'option') {
                        continue;
                    }

                    $defaultValues[$name][] = (string) $option;
                }
            }
        }

        return $defaultValues;
    }

    private function isGrouped($values)
    {
        $keys = array_keys($values);

        if (count($keys) == 1) {
            $firstKey = $keys[0];

            if (is_string($firstKey) && $firstKey !== 'default') {
                return true;
            }

        } else {
            return true;
        }

        return false;
    }

    private function reorderItems($items, $values)
    {
        // re-order the items so the non-default items are at the end
        usort($items, function ($a, $b) use ($values) {
            $a = strtolower($a);
            $b = strtolower($b);

            $is_default_a = !empty($values) && in_array($a, $values);
            $is_default_b = !empty($values) && in_array($b, $values);

            if ($is_default_a && !$is_default_b) {
                return -1;
            }

            if (!$is_default_a && $is_default_b) {
                return 1;
            }

            return 0;
        });

        return $items;
    }

    /**
     * Method to get the field input markup.
     *
     * @return string The field input markup
     *
     * @since   11.1
     */
    protected function getInput()
    {
        // cleanup string
        $value = htmlspecialchars_decode($this->value);

        // get default values from the manifest
        $defaultValues = $this->getDefaultValues();

        // remove leading = if any (legacy clean up)
        if ($value && $value[0] === '=') {
            $value = substr($value, 1);
        }

        // check if these values are grouped by type
        $grouped = $this->isGrouped($defaultValues);

        // map value to groups or single array
        $data = $this->mapValue($value, $grouped);

        // reset value from $data for non-grouped values
        if (!$grouped) {
            $value = implode(',', $data[0]);
        }

        $html = array();

        $html[] = '<div class="filetype">';
        $html[] = ' <div class="input-append input-group">';

        $html[] = '     <input type="text" value="' . $value . '" disabled class="form-control" />';
        $html[] = '     <input type="hidden" name="' . $this->name . '" value="' . $value . '" />';
        $html[] = '     <div class="input-group-append">';
        $html[] = '         <a class="btn btn-secondary filetype-edit add-on input-group-text" role="button"><i class="icon-edit icon-apply"></i><span role="none">Edit</span></a>';
        $html[] = '     </div>';
        $html[] = ' </div>';

        $customCount = 0;

        foreach ($data as $group => $items) {
            $custom = array();

            if (empty($items)) {
                continue;
            }

            $html[] = '<dl class="filetype-list list-group">';

            if (is_string($group)) {
                $checked = '';

                $is_default = isset($defaultValues[$group]);

                if (empty($value) || $is_default || (!$is_default && $group[0] !== '-')) {
                    $checked = ' checked="checked"';
                }

                // clear minus sign
                $group = str_replace('-', '', $group);

                $groupKey = 'WF_FILEGROUP_' . strtoupper($group);
                $groupName = Text::_('WF_FILEGROUP_' . strtoupper($group));

                // create simple label if there is no translation
                if ($groupName === $groupKey) {
                    $groupName = ucfirst($group);
                }

                $html[] = '<dt class="filetype-group list-group-item" data-filetype-group="' . $group . '"><label><input type="checkbox" value="' . $group . '"' . $checked . ' />' . $groupName . '</label></dt>';
            }

            if (is_numeric($group)) {
                $group = 'default';
            }

            $items = $this->reorderItems($items, $defaultValues[$group]);

            foreach ($items as $item) {
                $checked = '';

                $item = strtolower($item);

                // clear minus sign from beginning of item
                $mod = str_replace('-', '', $item);

                // check if this is a default value or a custom value
                $is_default = !empty($defaultValues[$group]) && in_array($mod, $defaultValues[$group]);

                $class = '';

                if (!$is_default) {
                    $customCount++;

                    $html[] = '<dd class="filetype-item filetype-custom row form-row list-group-item"><div class="file"></div><input type="text" class="span8 col-md-8 form-control" value="' . $mod . '" />';
                    $html[] = '<button class="btn btn-link filetype-remove"><span class="icon-trash"></span></button>';
                } else {
                    if (empty($value) || $mod === $item) {
                        $checked = ' checked="checked"';
                    }
                    
                    $html[] = '<dd class="filetype-item list-group-item"><label><input type="checkbox" value="' . $mod . '"' . $checked . ' /><span class="file ' . $mod . '"></span>&nbsp;' . $mod . '</label>';
                }
            }

            $html[] = '<dd class="filetype-item filetype-custom row form-row list-group-item"><div class="file"></div><input type="text" class="span8 col-md-8 form-control" value="" placeholder="' . Text::_('WF_EXTENSION_MAPPER_TYPE_NEW') . '" />';

            $html[] = '<button class="btn btn-link filetype-remove"><span class="icon-trash"></span></button>';
            $html[] = '<button class="btn btn-link filetype-add"><span class="icon-plus"></span></button>';

            $html[] = '</dl>';
        }

        $html[] = ' </div>';

        return implode("\n", $html);
    }
}checkboxes.php000060400000007742152457032700007406 0ustar00<?php
/**
 * @package     Joomla.Platform
 * @subpackage  Form
 *
 * @copyright   (C) 2010 Open Source Matters, Inc. <https://www.joomla.org>
 * @license     GNU General Public License version 2 or later; see LICENSE
 */

defined('JPATH_PLATFORM') or die;

JFormHelper::loadFieldClass('list');

/**
 * Form Field class for the Joomla Platform.
 * Displays options as a list of checkboxes.
 * Multiselect may be forced to be true.
 *
 * @see    JFormFieldCheckbox
 * @since  1.7.0
 */
class JFormFieldCheckboxes extends JFormFieldList
{
	/**
	 * The form field type.
	 *
	 * @var    string
	 * @since  1.7.0
	 */
	protected $type = 'Checkboxes';

	/**
	 * Name of the layout being used to render the field
	 *
	 * @var    string
	 * @since  3.5
	 */
	protected $layout = 'joomla.form.field.checkboxes';

	/**
	 * Flag to tell the field to always be in multiple values mode.
	 *
	 * @var    boolean
	 * @since  1.7.0
	 */
	protected $forceMultiple = true;

	/**
	 * The comma separated list of checked checkboxes value.
	 *
	 * @var    mixed
	 * @since  3.2
	 */
	public $checkedOptions;

	/**
	 * Method to get certain otherwise inaccessible properties from the form field object.
	 *
	 * @param   string  $name  The property name for which to get the value.
	 *
	 * @return  mixed  The property value or null.
	 *
	 * @since   3.2
	 */
	public function __get($name)
	{
		switch ($name)
		{
			case 'forceMultiple':
			case 'checkedOptions':
				return $this->$name;
		}

		return parent::__get($name);
	}

	/**
	 * Method to set certain otherwise inaccessible properties of the form field object.
	 *
	 * @param   string  $name   The property name for which to set the value.
	 * @param   mixed   $value  The value of the property.
	 *
	 * @return  void
	 *
	 * @since   3.2
	 */
	public function __set($name, $value)
	{
		switch ($name)
		{
			case 'checkedOptions':
				$this->checkedOptions = (string) $value;
				break;

			default:
				parent::__set($name, $value);
		}
	}

	/**
	 * Method to get the radio button field input markup.
	 *
	 * @return  string  The field input markup.
	 *
	 * @since   1.7.0
	 */
	protected function getInput()
	{
		if (empty($this->layout))
		{
			throw new UnexpectedValueException(sprintf('%s has no layout assigned.', $this->name));
		}

		return $this->getRenderer($this->layout)->render($this->getLayoutData());
	}

	/**
	 * Method to attach a JForm object to the field.
	 *
	 * @param   SimpleXMLElement  $element  The SimpleXMLElement object representing the `<field>` tag for the form field object.
	 * @param   mixed             $value    The form field value to validate.
	 * @param   string            $group    The field name group control value. This acts as an array container for the field.
	 *                                      For example if the field has name="foo" and the group value is set to "bar" then the
	 *                                      full field name would end up being "bar[foo]".
	 *
	 * @return  boolean  True on success.
	 *
	 * @see     JFormField::setup()
	 * @since   3.2
	 */
	public function setup(SimpleXMLElement $element, $value, $group = null)
	{
		$return = parent::setup($element, $value, $group);

		if ($return)
		{
			$this->checkedOptions = (string) $this->element['checked'];
		}

		return $return;
	}

	/**
	 * Method to get the data to be passed to the layout for rendering.
	 *
	 * @return  array
	 *
	 * @since   3.5
	 */
	protected function getLayoutData()
	{
		$data = parent::getLayoutData();

		// True if the field has 'value' set. In other words, it has been stored, don't use the default values.
		$hasValue = (isset($this->value) && !empty($this->value));

		// If a value has been stored, use it. Otherwise, use the defaults.
		$checkedOptions = $hasValue ? $this->value : $this->checkedOptions;

		$extraData = array(
			'checkedOptions' => is_array($checkedOptions) ? $checkedOptions : explode(',', (string) $checkedOptions),
			'hasValue'       => $hasValue,
			'options'        => $this->getOptions(),
		);

		return array_merge($data, $extraData);
	}
}
fontlist.php000060400000001762152457032700007126 0ustar00<?php
/**
 * @package     JCE
 * @subpackage  Admin
 *
 * @copyright   Copyright (C) 2005 - 2020 Open Source Matters, Inc. All rights reserved.
 * @copyright   Copyright (c) 2009-2024 Ryan Demmer. All rights reserved
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */

\defined('_JEXEC') or die;

use Joomla\CMS\Form\Field\FilelistField;

class JFormFieldFontList extends FilelistField
{
    /**
     * The form field type.
     *
     * @var string
     *
     * @since  11.1
     */
    protected $type = 'FontList';

    /**
     * Method to get the field input for a fontlist field.
     *
     * @return string The field input
     *
     * @since   3.1
     */
    protected function getInput()
    {
        if (!is_array($this->value) && !empty($this->value)) {
            // String in format 2,5,4
            if (is_string($this->value)) {
                $this->value = explode(',', $this->value);
            }
        }

        return parent::getInput();
    }
}
sortablecheckboxes.php000060400000005034152457032700011132 0ustar00<?php
/**
 * @package     JCE
 * @subpackage  Admin
 *
 * @copyright   Copyright (C) 2005 - 2020 Open Source Matters, Inc. All rights reserved.
 * @copyright   Copyright (c) 2009-2024 Ryan Demmer. All rights reserved
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */

\defined('_JEXEC') or die;

use Joomla\CMS\Form\Field\CheckboxesField;

class JFormFieldSortableCheckboxes extends CheckboxesField
{
    /**
     * The form field type.
     *
     * @var string
     *
     * @since  2.8.16
     */
    protected $type = 'SortableCheckboxes';

    /**
     * Method to attach a JForm object to the field.
     *
     * @param SimpleXMLElement $element The SimpleXMLElement object representing the <field /> tag for the form field object
     * @param mixed            $value   The form field value to validate
     * @param string           $group   The field name group control value. This acts as as an array container for the field.
     *                                  For example if the field has name="foo" and the group value is set to "bar" then the
     *                                  full field name would end up being "bar[foo]"
     *
     * @return bool True on success
     *
     * @since  2.8.16
     */
    public function setup(SimpleXMLElement $element, $value, $group = null)
    {
        $return = parent::setup($element, $value, $group);

        $this->class = trim($this->class . ' sortable');

        return $return;
    }

    private function getOptionFromValue($value)
    {
        $options = parent::getOptions();

        foreach ($options as $option) {
            if ($option->value == $value) {
                return $option;
            }
        }

        return (object) array(
            'value' => $value,
            'text' => $value,
        );
    }

    protected function getOptions()
    {
        $options = parent::getOptions();

        $values = is_array($this->value) ? $this->value : explode(',', $this->value);

        if (!empty($values)) {
            $custom = array();

            foreach ($values as $value) {
                $tmp = $this->getOptionFromValue($value);
                $tmp->checked = true;

                $custom[] = $tmp;
            }

            // add default options not checked to the end of the options array
            foreach ($options as $option) {
                if (!in_array($option->value, $values)) {
                    $custom[] = $option;
                }
            }

            return $custom;
        }

        return $options;
    }
}
modal/category.php000060400000023564152457033620010203 0ustar00<?php
/**
 * @package     Joomla.Administrator
 * @subpackage  com_categories
 *
 * @copyright   (C) 2013 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\Language\LanguageHelper;

/**
 * Supports a modal category picker.
 *
 * @since  3.1
 */
class JFormFieldModal_Category extends JFormField
{
	/**
	 * The form field type.
	 *
	 * @var     string
	 * @since   1.6
	 */
	protected $type = 'Modal_Category';

	/**
	 * Method to get the field input markup.
	 *
	 * @return  string  The field input markup.
	 *
	 * @since   1.6
	 */
	protected function getInput()
	{
		if ($this->element['extension'])
		{
			$extension = (string) $this->element['extension'];
		}
		else
		{
			$extension = (string) JFactory::getApplication()->input->get('extension', 'com_content');
		}

		$allowNew       = ((string) $this->element['new'] == 'true');
		$allowEdit      = ((string) $this->element['edit'] == 'true');
		$allowClear     = ((string) $this->element['clear'] != 'false');
		$allowSelect    = ((string) $this->element['select'] != 'false');
		$allowPropagate = ((string) $this->element['propagate'] == 'true');

		$languages = LanguageHelper::getContentLanguages(array(0, 1));

		// Load language.
		JFactory::getLanguage()->load('com_categories', JPATH_ADMINISTRATOR);

		// The active category id field.
		$value = (int) $this->value > 0 ? (int) $this->value : '';

		// Create the modal id.
		$modalId = 'Category_' . $this->id;

		// Add the modal field script to the document head.
		JHtml::_('jquery.framework');
		JHtml::_('script', 'system/modal-fields.js', array('version' => 'auto', 'relative' => true));

		// Script to proxy the select modal function to the modal-fields.js file.
		if ($allowSelect)
		{
			static $scriptSelect = null;

			if (is_null($scriptSelect))
			{
				$scriptSelect = array();
			}

			if (!isset($scriptSelect[$this->id]))
			{
				JFactory::getDocument()->addScriptDeclaration("
				function jSelectCategory_" . $this->id . "(id, title, object) {
					window.processModalSelect('Category', '" . $this->id . "', id, title, '', object);
				}
				");

				JText::script('JGLOBAL_ASSOCIATIONS_PROPAGATE_FAILED');

				$scriptSelect[$this->id] = true;
			}
		}

		// Setup variables for display.
		$linkCategories = 'index.php?option=com_categories&amp;view=categories&amp;layout=modal&amp;tmpl=component&amp;' . JSession::getFormToken() . '=1'
			. '&amp;extension=' . $extension;
		$linkCategory  = 'index.php?option=com_categories&amp;view=category&amp;layout=modal&amp;tmpl=component&amp;' . JSession::getFormToken() . '=1'
			. '&amp;extension=' . $extension;
		$modalTitle    = JText::_('COM_CATEGORIES_CHANGE_CATEGORY');

		if (isset($this->element['language']))
		{
			$linkCategories .= '&amp;forcedLanguage=' . $this->element['language'];
			$linkCategory   .= '&amp;forcedLanguage=' . $this->element['language'];
			$modalTitle     .= ' &#8212; ' . $this->element['label'];
		}

		$urlSelect = $linkCategories . '&amp;function=jSelectCategory_' . $this->id;
		$urlEdit   = $linkCategory . '&amp;task=category.edit&amp;id=\' + document.getElementById("' . $this->id . '_id").value + \'';
		$urlNew    = $linkCategory . '&amp;task=category.add';

		if ($value)
		{
			$db    = JFactory::getDbo();
			$query = $db->getQuery(true)
				->select($db->quoteName('title'))
				->from($db->quoteName('#__categories'))
				->where($db->quoteName('id') . ' = ' . (int) $value);
			$db->setQuery($query);

			try
			{
				$title = $db->loadResult();
			}
			catch (RuntimeException $e)
			{
				JError::raiseWarning(500, $e->getMessage());
			}
		}

		$title = empty($title) ? JText::_('COM_CATEGORIES_SELECT_A_CATEGORY') : htmlspecialchars($title, ENT_QUOTES, 'UTF-8');

		// The current category display field.
		$html  = '<span class="input-append">';
		$html .= '<input class="input-medium" id="' . $this->id . '_name" type="text" value="' . $title . '" disabled="disabled" size="35" />';

		// Select category button.
		if ($allowSelect)
		{
			$html .= '<button'
				. ' type="button"'
				. ' class="btn hasTooltip' . ($value ? ' hidden' : '') . '"'
				. ' id="' . $this->id . '_select"'
				. ' data-toggle="modal"'
				. ' data-target="#ModalSelect' . $modalId . '"'
				. ' title="' . JHtml::tooltipText('COM_CATEGORIES_CHANGE_CATEGORY') . '">'
				. '<span class="icon-file" aria-hidden="true"></span> ' . JText::_('JSELECT')
				. '</button>';
		}

		// New category button.
		if ($allowNew)
		{
			$html .= '<button'
				. ' type="button"'
				. ' class="btn hasTooltip' . ($value ? ' hidden' : '') . '"'
				. ' id="' . $this->id . '_new"'
				. ' data-toggle="modal"'
				. ' data-target="#ModalNew' . $modalId . '"'
				. ' title="' . JHtml::tooltipText('COM_CATEGORIES_NEW_CATEGORY') . '">'
				. '<span class="icon-new" aria-hidden="true"></span> ' . JText::_('JACTION_CREATE')
				. '</button>';
		}

		// Edit category button.
		if ($allowEdit)
		{
			$html .= '<button'
				. ' type="button"'
				. ' class="btn hasTooltip' . ($value ? '' : ' hidden') . '"'
				. ' id="' . $this->id . '_edit"'
				. ' data-toggle="modal"'
				. ' data-target="#ModalEdit' . $modalId . '"'
				. ' title="' . JHtml::tooltipText('COM_CATEGORIES_EDIT_CATEGORY') . '">'
				. '<span class="icon-edit" aria-hidden="true"></span> ' . JText::_('JACTION_EDIT')
				. '</button>';
		}

		// Clear category button.
		if ($allowClear)
		{
			$html .= '<button'
				. ' type="button"'
				. ' class="btn' . ($value ? '' : ' hidden') . '"'
				. ' id="' . $this->id . '_clear"'
				. ' onclick="window.processModalParent(\'' . $this->id . '\'); return false;">'
				. '<span class="icon-remove" aria-hidden="true"></span>' . JText::_('JCLEAR')
				. '</button>';
		}

		// Propagate category button
		if ($allowPropagate && count($languages) > 2)
		{
			// Strip off language tag at the end
			$tagLength = (int) strlen($this->element['language']);
			$callbackFunctionStem = substr("jSelectCategory_" . $this->id, 0, -$tagLength);

			$html .= '<a'
			. ' class="btn hasTooltip' . ($value ? '' : ' hidden') . '"'
			. ' id="' . $this->id . '_propagate"'
			. ' href="#"'
			. ' title="' . JHtml::tooltipText('JGLOBAL_ASSOCIATIONS_PROPAGATE_TIP') . '"'
			. ' onclick="Joomla.propagateAssociation(\'' . $this->id . '\', \'' . $callbackFunctionStem . '\');">'
			. '<span class="icon-refresh" aria-hidden="true"></span>' . JText::_('JGLOBAL_ASSOCIATIONS_PROPAGATE_BUTTON')
			. '</a>';
		}

		$html .= '</span>';

		// Select category modal.
		if ($allowSelect)
		{
			$html .= JHtml::_(
				'bootstrap.renderModal',
				'ModalSelect' . $modalId,
				array(
					'title'       => $modalTitle,
					'url'         => $urlSelect,
					'height'      => '400px',
					'width'       => '800px',
					'bodyHeight'  => '70',
					'modalWidth'  => '80',
					'footer'      => '<button type="button" class="btn" data-dismiss="modal">' . JText::_('JLIB_HTML_BEHAVIOR_CLOSE') . '</button>',
				)
			);
		}

		// New category modal.
		if ($allowNew)
		{
			$html .= JHtml::_(
				'bootstrap.renderModal',
				'ModalNew' . $modalId,
				array(
					'title'       => JText::_('COM_CATEGORIES_NEW_CATEGORY'),
					'backdrop'    => 'static',
					'keyboard'    => false,
					'closeButton' => false,
					'url'         => $urlNew,
					'height'      => '400px',
					'width'       => '800px',
					'bodyHeight'  => '70',
					'modalWidth'  => '80',
					'footer'      => '<button type="button" class="btn"'
							. ' onclick="window.processModalEdit(this, \'' . $this->id . '\', \'add\', \'category\', \'cancel\', \'item-form\'); return false;">'
							. JText::_('JLIB_HTML_BEHAVIOR_CLOSE') . '</button>'
							. '<button type="button" class="btn btn-primary"'
							. ' onclick="window.processModalEdit(this, \'' . $this->id . '\', \'add\', \'category\', \'save\', \'item-form\'); return false;">'
							. JText::_('JSAVE') . '</button>'
							. '<button type="button" class="btn btn-success"'
							. ' onclick="window.processModalEdit(this, \'' . $this->id . '\', \'add\', \'category\', \'apply\', \'item-form\'); return false;">'
							. JText::_('JAPPLY') . '</button>',
				)
			);
		}

		// Edit category modal.
		if ($allowEdit)
		{
			$html .= JHtml::_(
				'bootstrap.renderModal',
				'ModalEdit' . $modalId,
				array(
					'title'       => JText::_('COM_CATEGORIES_EDIT_CATEGORY'),
					'backdrop'    => 'static',
					'keyboard'    => false,
					'closeButton' => false,
					'url'         => $urlEdit,
					'height'      => '400px',
					'width'       => '800px',
					'bodyHeight'  => '70',
					'modalWidth'  => '80',
					'footer'      => '<button type="button" class="btn"'
							. ' onclick="window.processModalEdit(this, \'' . $this->id . '\', \'edit\', \'category\', \'cancel\', \'item-form\'); return false;">'
							. JText::_('JLIB_HTML_BEHAVIOR_CLOSE') . '</button>'
							. '<button type="button" class="btn btn-primary"'
							. ' onclick="window.processModalEdit(this, \'' . $this->id . '\', \'edit\', \'category\', \'save\', \'item-form\'); return false;">'
							. JText::_('JSAVE') . '</button>'
							. '<button type="button" class="btn btn-success"'
							. ' onclick="window.processModalEdit(this, \'' . $this->id . '\', \'edit\', \'category\', \'apply\', \'item-form\'); return false;">'
							. JText::_('JAPPLY') . '</button>',
				)
			);
		}

		// Note: class='required' for client side validation
		$class = $this->required ? ' class="required modal-value"' : '';

		$html .= '<input type="hidden" id="' . $this->id . '_id"' . $class . ' data-required="' . (int) $this->required . '" name="' . $this->name
			. '" data-text="' . htmlspecialchars(JText::_('COM_CATEGORIES_SELECT_A_CATEGORY', true), ENT_COMPAT, 'UTF-8') . '" value="' . $value . '" />';

		return $html;
	}

	/**
	 * Method to get the field label markup.
	 *
	 * @return  string  The field label markup.
	 *
	 * @since   3.7.0
	 */
	protected function getLabel()
	{
		return str_replace($this->id, $this->id . '_id', parent::getLabel());
	}
}
categoryparent.php000060400000012155152457033620010313 0ustar00<?php
/**
 * @package     Joomla.Administrator
 * @subpackage  com_categories
 *
 * @copyright   (C) 2009 Open Source Matters, Inc. <https://www.joomla.org>
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */

defined('_JEXEC') or die;

JFormHelper::loadFieldClass('list');

/**
 * Category Parent field.
 *
 * @since       1.6
 * @deprecated  4.0  Use categoryedit instead.
 */
class JFormFieldCategoryParent extends JFormFieldList
{
	/**
	 * The form field type.
	 *
	 * @var    string
	 * @since  1.6
	 */
	protected $type = 'CategoryParent';

	/**
	 * Method to get the field options.
	 *
	 * @return  array  The field option objects.
	 *
	 * @since   1.6
	 */
	protected function getOptions()
	{
		// Initialise variables.
		$options = array();
		$name = (string) $this->element['name'];

		// Let's get the id for the current item, either category or content item.
		$jinput = JFactory::getApplication()->input;

		// For categories the old category is the category id 0 for new category.
		if ($this->element['parent'])
		{
			$oldCat = $jinput->get('id', 0);
		}
		else
			// For items the old category is the category they are in when opened or 0 if new.
		{
			$oldCat = $this->form->getValue($name);
		}

		$db = JFactory::getDbo();
		$query = $db->getQuery(true)
			->select('a.id AS value, a.title AS text, a.level')
			->from('#__categories AS a')
			->join('LEFT', $db->quoteName('#__categories') . ' AS b ON a.lft > b.lft AND a.rgt < b.rgt');

		// Filter by the type
		if ($extension = $this->form->getValue('extension'))
		{
			$query->where('(a.extension = ' . $db->quote($extension) . ' OR a.parent_id = 0)');
		}

		if ($this->element['parent'])
		{
			// Prevent parenting to children of this item.
			if ($id = $this->form->getValue('id'))
			{
				$query->join('LEFT', $db->quoteName('#__categories') . ' AS p ON p.id = ' . (int) $id)
					->where('NOT(a.lft >= p.lft AND a.rgt <= p.rgt)');

				$rowQuery = $db->getQuery(true);
				$rowQuery->select('a.id AS value, a.title AS text, a.level, a.parent_id')
					->from('#__categories AS a')
					->where('a.id = ' . (int) $id);
				$db->setQuery($rowQuery);
				$row = $db->loadObject();
			}
		}

		$query->where('a.published IN (0,1)')
			->group('a.id, a.title, a.level, a.lft, a.rgt, a.extension, a.parent_id')
			->order('a.lft ASC');

		// Get the options.
		$db->setQuery($query);

		try
		{
			$options = $db->loadObjectList();
		}
		catch (RuntimeException $e)
		{
			JError::raiseWarning(500, $e->getMessage());
		}

		// Pad the option text with spaces using depth level as a multiplier.
		for ($i = 0, $n = count($options); $i < $n; $i++)
		{
			// Translate ROOT
			if ($options[$i]->level == 0)
			{
				$options[$i]->text = JText::_('JGLOBAL_ROOT_PARENT');
			}

			// Displays language code if not set to All
			$db = JFactory::getDbo();
			$query = $db->getQuery(true)
				->select($db->quoteName('language'))
				->where($db->quoteName('id') . '=' . (int) $options[$i]->value)
				->from($db->quoteName('#__categories'));

			$db->setQuery($query);
			$language = $db->loadResult();

			$options[$i]->text = str_repeat('- ', $options[$i]->level) . $options[$i]->text;

			if ($language !== '*')
			{
				$options[$i]->text = $options[$i]->text . ' (' . $language . ')';
			}
		}

		// Get the current user object.
		$user = JFactory::getUser();

		// For new items we want a list of categories you are allowed to create in.
		if ($oldCat == 0)
		{
			foreach ($options as $i => $option)
			{
				/*
				 * To take save or create in a category you need to have create rights for that category unless the item is already in that category.
				 * Unset the option if the user isn't authorised for it. In this field assets are always categories.
				 */
				if ($user->authorise('core.create', $extension . '.category.' . $option->value) != true)
				{
					unset($options[$i]);
				}
			}
		}
		// If you have an existing category id things are more complex.
		else
		{
			foreach ($options as $i => $option)
			{
				/*
				 * If you are only allowed to edit in this category but not edit.state, you should not get any
				 * option to change the category parent for a category or the category for a content item,
				 * but you should be able to save in that category.
				 */
				if ($user->authorise('core.edit.state', $extension . '.category.' . $oldCat) != true)
				{
					if ($option->value != $oldCat)
					{
						echo 'y';
						unset($options[$i]);
					}
				}
				/*
				 * However, if you can edit.state you can also move this to another category for which you have
				 * create permission and you should also still be able to save in the current category.
				 */
				elseif (($user->authorise('core.create', $extension . '.category.' . $option->value) != true)
					&& $option->value != $oldCat
				)
				{
					echo 'x';
					unset($options[$i]);
				}
			}
		}

		if (isset($row) && !isset($options[0]))
		{
			if ($row->parent_id == '1')
			{
				$parent = new stdClass;
				$parent->text = JText::_('JGLOBAL_ROOT_PARENT');
				array_unshift($options, $parent);
			}
		}

		// Merge any additional options in the XML definition.
		return array_merge(parent::getOptions(), $options);
	}
}
categoryedit.php000060400000031524152457033620007750 0ustar00<?php
/**
 * @package     Joomla.Administrator
 * @subpackage  com_categories
 *
 * @copyright   (C) 2012 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\Utilities\ArrayHelper;

JFormHelper::loadFieldClass('list');

/**
 * Category Edit field..
 *
 * @since  1.6
 */
class JFormFieldCategoryEdit extends JFormFieldList
{
	/**
	 * To allow creation of new categories.
	 *
	 * @var    integer
	 * @since  3.6
	 */
	protected $allowAdd;

	/**
	 * Optional prefix for new categories.
	 *
	 * @var    string
	 * @since  3.9.11
	 */
	protected $customPrefix;

	/**
	 * A flexible category list that respects access controls
	 *
	 * @var    string
	 * @since  1.6
	 */
	public $type = 'CategoryEdit';

	/**
	 * Method to attach a JForm object to the field.
	 *
	 * @param   SimpleXMLElement  $element  The SimpleXMLElement object representing the <field /> tag for the form field object.
	 * @param   mixed             $value    The form field value to validate.
	 * @param   string            $group    The field name group control value. This acts as an array container for the field.
	 *                                      For example if the field has name="foo" and the group value is set to "bar" then the
	 *                                      full field name would end up being "bar[foo]".
	 *
	 * @return  boolean  True on success.
	 *
	 * @see     JFormField::setup()
	 * @since   3.2
	 */
	public function setup(SimpleXMLElement $element, $value, $group = null)
	{
		$return = parent::setup($element, $value, $group);

		if ($return)
		{
			$this->allowAdd = isset($this->element['allowAdd']) ? $this->element['allowAdd'] : '';
			$this->customPrefix = (string) $this->element['customPrefix'];
		}

		return $return;
	}

	/**
	 * Method to get certain otherwise inaccessible properties from the form field object.
	 *
	 * @param   string  $name  The property name for which to get the value.
	 *
	 * @return  mixed  The property value or null.
	 *
	 * @since   3.6
	 */
	public function __get($name)
	{
		switch ($name)
		{
			case 'allowAdd':
			case 'customPrefix':
				return $this->$name;
		}

		return parent::__get($name);
	}

	/**
	 * Method to set certain otherwise inaccessible properties of the form field object.
	 *
	 * @param   string  $name   The property name for which to set the value.
	 * @param   mixed   $value  The value of the property.
	 *
	 * @return  void
	 *
	 * @since   3.6
	 */
	public function __set($name, $value)
	{
		$value = (string) $value;

		switch ($name)
		{
			case 'allowAdd':
				$value = (string) $value;
				$this->$name = ($value === 'true' || $value === $name || $value === '1');
				break;
			case 'customPrefix':
				$this->$name = (string) $value;
				break;
			default:
				parent::__set($name, $value);
		}
	}

	/**
	 * Method to get a list of categories that respects access controls and can be used for
	 * either category assignment or parent category assignment in edit screens.
	 * Use the parent element to indicate that the field will be used for assigning parent categories.
	 *
	 * @return  array  The field option objects.
	 *
	 * @since   1.6
	 */
	protected function getOptions()
	{
		$options = array();
		$published = $this->element['published'] ? explode(',', (string) $this->element['published']) : array(0, 1);
		$name = (string) $this->element['name'];

		// Let's get the id for the current item, either category or content item.
		$jinput = JFactory::getApplication()->input;

		// Load the category options for a given extension.

		// For categories the old category is the category id or 0 for new category.
		if ($this->element['parent'] || $jinput->get('option') == 'com_categories')
		{
			$oldCat = $jinput->get('id', 0);
			$oldParent = $this->form->getValue($name, 0);
			$extension = $this->element['extension'] ? (string) $this->element['extension'] : (string) $jinput->get('extension', 'com_content');
		}
		else
			// For items the old category is the category they are in when opened or 0 if new.
		{
			$oldCat = $this->form->getValue($name, 0);
			$extension = $this->element['extension'] ? (string) $this->element['extension'] : (string) $jinput->get('option', 'com_content');
		}

		// Account for case that a submitted form has a multi-value category id field (e.g. a filtering form), just use the first category
		$oldCat = is_array($oldCat)
			? (int) reset($oldCat)
			: (int) $oldCat;

		$db = JFactory::getDbo();
		$user = JFactory::getUser();

		$query = $db->getQuery(true)
			->select('a.id AS value, a.title AS text, a.level, a.published, a.lft, a.language')
			->from('#__categories AS a');

		// Filter by the extension type
		if ($this->element['parent'] == true || $jinput->get('option') == 'com_categories')
		{
			$query->where('(a.extension = ' . $db->quote($extension) . ' OR a.parent_id = 0)');
		}
		else
		{
			$query->where('(a.extension = ' . $db->quote($extension) . ')');
		}

		// Filter language
		if (!empty($this->element['language']))
		{
			if (strpos($this->element['language'], ',') !== false)
			{
				$language = implode(',', $db->quote(explode(',', $this->element['language'])));
			}
			else
			{
				$language = $db->quote($this->element['language']);
			}

			$query->where($db->quoteName('a.language') . ' IN (' . $language . ')');
		}

		// Filter on the published state
		$query->where('a.published IN (' . implode(',', ArrayHelper::toInteger($published)) . ')');

		// Filter categories on User Access Level
		// Filter by access level on categories.
		if (!$user->authorise('core.admin'))
		{
			$groups = implode(',', $user->getAuthorisedViewLevels());
			$query->where('a.access IN (' . $groups . ')');
		}

		$query->order('a.lft ASC');

		// If parent isn't explicitly stated but we are in com_categories assume we want parents
		if ($oldCat != 0 && ($this->element['parent'] == true || $jinput->get('option') == 'com_categories'))
		{
			// Prevent parenting to children of this item.
			// To rearrange parents and children move the children up, not the parents down.
			$query->join('LEFT', $db->quoteName('#__categories') . ' AS p ON p.id = ' . (int) $oldCat)
				->where('NOT(a.lft >= p.lft AND a.rgt <= p.rgt)');

			$rowQuery = $db->getQuery(true);
			$rowQuery->select('a.id AS value, a.title AS text, a.level, a.parent_id')
				->from('#__categories AS a')
				->where('a.id = ' . (int) $oldCat);
			$db->setQuery($rowQuery);
			$row = $db->loadObject();
		}

		// Get the options.
		$db->setQuery($query);

		try
		{
			$options = $db->loadObjectList();
		}
		catch (RuntimeException $e)
		{
			JError::raiseWarning(500, $e->getMessage());
		}

		// Pad the option text with spaces using depth level as a multiplier.
		for ($i = 0, $n = count($options); $i < $n; $i++)
		{
			// Translate ROOT
			if ($this->element['parent'] == true || $jinput->get('option') == 'com_categories')
			{
				if ($options[$i]->level == 0)
				{
					$options[$i]->text = JText::_('JGLOBAL_ROOT_PARENT');
				}
			}

			if ($options[$i]->published == 1)
			{
				$options[$i]->text = str_repeat('- ', !$options[$i]->level ? 0 : $options[$i]->level - 1) . $options[$i]->text;
			}
			else
			{
				$options[$i]->text = str_repeat('- ', !$options[$i]->level ? 0 : $options[$i]->level - 1) . '[' . $options[$i]->text . ']';
			}

			// Displays language code if not set to All
			if ($options[$i]->language !== '*')
			{
				$options[$i]->text = $options[$i]->text . ' (' . $options[$i]->language . ')';
			}
		}

		// For new items we want a list of categories you are allowed to create in.
		if ($oldCat == 0)
		{
			foreach ($options as $i => $option)
			{
				/*
				 * To take save or create in a category you need to have create rights for that category unless the item is already in that category.
				 * Unset the option if the user isn't authorised for it. In this field assets are always categories.
				 */
				if ($option->level != 0 && !$user->authorise('core.create', $extension . '.category.' . $option->value))
				{
					unset($options[$i]);
				}
			}
		}
		// If you have an existing category id things are more complex.
		else
		{
			/*
			 * If you are only allowed to edit in this category but not edit.state, you should not get any
			 * option to change the category parent for a category or the category for a content item,
			 * but you should be able to save in that category.
			 */
			foreach ($options as $i => $option)
			{
				$assetKey = $extension . '.category.' . $oldCat;

				if ($option->level != 0 && !isset($oldParent) && $option->value != $oldCat && !$user->authorise('core.edit.state', $assetKey))
				{
					unset($options[$i]);
					continue;
				}

				if ($option->level != 0	&& isset($oldParent) && $option->value != $oldParent && !$user->authorise('core.edit.state', $assetKey))
				{
					unset($options[$i]);
					continue;
				}

				/*
				 * However, if you can edit.state you can also move this to another category for which you have
				 * create permission and you should also still be able to save in the current category.
				 */
				$assetKey = $extension . '.category.' . $option->value;

				if ($option->level != 0 && !isset($oldParent) && $option->value != $oldCat && !$user->authorise('core.create', $assetKey))
				{
					unset($options[$i]);
					continue;
				}

				if ($option->level != 0	&& isset($oldParent) && $option->value != $oldParent && !$user->authorise('core.create', $assetKey))
				{
					unset($options[$i]);
					continue;
				}
			}
		}

		if (($this->element['parent'] == true || $jinput->get('option') == 'com_categories')
			&& (isset($row) && !isset($options[0]))
			&& isset($this->element['show_root']))
		{
			if ($row->parent_id == '1')
			{
				$parent = new stdClass;
				$parent->text = JText::_('JGLOBAL_ROOT_PARENT');
				array_unshift($options, $parent);
			}

			array_unshift($options, JHtml::_('select.option', '0', JText::_('JGLOBAL_ROOT')));
		}

		// Merge any additional options in the XML definition.
		return array_merge(parent::getOptions(), $options);
	}

	/**
	 * Method to get the field input markup for a generic list.
	 * Use the multiple attribute to enable multiselect.
	 *
	 * @return  string  The field input markup.
	 *
	 * @since   3.6
	 */
	protected function getInput()
	{
		$html = array();
		$class = array();
		$attr = '';

		// Initialize some field attributes.
		$class[] = !empty($this->class) ? $this->class : '';

		if ($this->allowAdd)
		{
			$customGroupText = JText::_('JGLOBAL_CUSTOM_CATEGORY');

			$class[] = 'chzn-custom-value';
			$attr .= ' data-custom_group_text="' . $customGroupText . '" '
					. 'data-no_results_text="' . JText::_('JGLOBAL_ADD_CUSTOM_CATEGORY') . '" '
					. 'data-placeholder="' . JText::_('JGLOBAL_TYPE_OR_SELECT_CATEGORY') . '" ';

			if ($this->customPrefix !== '')
			{
				$attr .= 'data-custom_value_prefix="' . $this->customPrefix . '" ';
			}
		}

		if ($class)
		{
			$attr .= 'class="' . implode(' ', $class) . '"';
		}

		$attr .= !empty($this->size) ? ' size="' . $this->size . '"' : '';
		$attr .= $this->multiple ? ' multiple' : '';
		$attr .= $this->required ? ' required aria-required="true"' : '';
		$attr .= $this->autofocus ? ' autofocus' : '';

		// To avoid user's confusion, readonly="true" should imply disabled="true".
		if ((string) $this->readonly == '1'
			|| (string) $this->readonly == 'true'
			|| (string) $this->disabled == '1'
			|| (string) $this->disabled == 'true')
		{
			$attr .= ' disabled="disabled"';
		}

		// Initialize JavaScript field attributes.
		$attr .= $this->onchange ? ' onchange="' . $this->onchange . '"' : '';

		// Get the field options.
		$options = (array) $this->getOptions();

		// Create a read-only list (no name) with hidden input(s) to store the value(s).
		if ((string) $this->readonly == '1' || (string) $this->readonly == 'true')
		{
			$html[] = JHtml::_('select.genericlist', $options, '', trim($attr), 'value', 'text', $this->value, $this->id);

			// E.g. form field type tag sends $this->value as array
			if ($this->multiple && is_array($this->value))
			{
				if (!count($this->value))
				{
					$this->value[] = '';
				}

				foreach ($this->value as $value)
				{
					$html[] = '<input type="hidden" name="' . $this->name . '" value="' . htmlspecialchars($value, ENT_COMPAT, 'UTF-8') . '"/>';
				}
			}
			else
			{
				$html[] = '<input type="hidden" name="' . $this->name . '" value="' . htmlspecialchars($this->value, ENT_COMPAT, 'UTF-8') . '"/>';
			}
		}
		else
		{
			// Create a regular list.
			if (count($options) === 0)
			{
				// All Categories have been deleted, so we need a new category (This will create on save if selected).
				$options[0]            = new stdClass;
				$options[0]->value     = 'Uncategorised';
				$options[0]->text      = 'Uncategorised';
				$options[0]->level     = '1';
				$options[0]->published = '1';
				$options[0]->lft       = '1';
			}

			$html[] = JHtml::_('select.genericlist', $options, $this->name, trim($attr), 'value', 'text', $this->value, $this->id);
		}

		return implode($html);
	}
}
email.php000060400000002712152457271650006360 0ustar00<?php
/**
 * @package     Joomla.Platform
 * @subpackage  Form
 *
 * @copyright   (C) 2011 Open Source Matters, Inc. <https://www.joomla.org>
 * @license     GNU General Public License version 2 or later; see LICENSE
 */

defined('JPATH_PLATFORM') or die;

JFormHelper::loadFieldClass('text');

/**
 * Form Field class for the Joomla Platform.
 * Provides and input field for email addresses
 *
 * @link   http://www.w3.org/TR/html-markup/input.email.html#input.email
 * @see    JFormRuleEmail
 * @since  1.7.0
 */
class JFormFieldEMail extends JFormFieldText
{
	/**
	 * The form field type.
	 *
	 * @var    string
	 * @since  1.7.0
	 */
	protected $type = 'Email';

	/**
	 * Name of the layout being used to render the field
	 *
	 * @var    string
	 * @since  3.7
	 */
	protected $layout = 'joomla.form.field.email';

	/**
	 * Method to get the field input markup for email addresses.
	 *
	 * @return  string  The field input markup.
	 *
	 * @since   1.7.0
	 */
	protected function getInput()
	{
		// Trim the trailing line in the layout file
		return rtrim($this->getRenderer($this->layout)->render($this->getLayoutData()), PHP_EOL);
	}
	/**
	 * Method to get the data to be passed to the layout for rendering.
	 *
	 * @return  array
	 *
	 * @since 3.5
	 */
	protected function getLayoutData()
	{
		$data = parent::getLayoutData();

		$extraData = array(
			'maxLength'  => $this->maxLength,
			'multiple'   => $this->multiple,
		);

		return array_merge($data, $extraData);
	}
}
integer.php000060400000003353152457271650006730 0ustar00<?php
/**
 * @package     Joomla.Platform
 * @subpackage  Form
 *
 * @copyright   (C) 2009 Open Source Matters, Inc. <https://www.joomla.org>
 * @license     GNU General Public License version 2 or later; see LICENSE
 */

defined('JPATH_PLATFORM') or die;

JFormHelper::loadFieldClass('list');

/**
 * Form Field class for the Joomla Platform.
 * Provides a select list of integers with specified first, last and step values.
 *
 * @since  1.7.0
 */
class JFormFieldInteger extends JFormFieldList
{
	/**
	 * The form field type.
	 *
	 * @var    string
	 * @since  1.7.0
	 */
	protected $type = 'Integer';

	/**
	 * Method to get the field options.
	 *
	 * @return  array  The field option objects.
	 *
	 * @since   1.7.0
	 */
	protected function getOptions()
	{
		$options = array();

		// Initialize some field attributes.
		$first = (int) $this->element['first'];
		$last = (int) $this->element['last'];
		$step = (int) $this->element['step'];

		// Sanity checks.
		if ($step == 0)
		{
			// Step of 0 will create an endless loop.
			return $options;
		}
		elseif ($first < $last && $step < 0)
		{
			// A negative step will never reach the last number.
			return $options;
		}
		elseif ($first > $last && $step > 0)
		{
			// A position step will never reach the last number.
			return $options;
		}
		elseif ($step < 0)
		{
			// Build the options array backwards.
			for ($i = $first; $i >= $last; $i += $step)
			{
				$options[] = JHtml::_('select.option', $i);
			}
		}
		else
		{
			// Build the options array.
			for ($i = $first; $i <= $last; $i += $step)
			{
				$options[] = JHtml::_('select.option', $i);
			}
		}

		// Merge any additional options in the XML definition.
		$options = array_merge(parent::getOptions(), $options);

		return $options;
	}
}
radio.php000060400000002744152457271650006374 0ustar00<?php
/**
 * @package     Joomla.Platform
 * @subpackage  Form
 *
 * @copyright   (C) 2009 Open Source Matters, Inc. <https://www.joomla.org>
 * @license     GNU General Public License version 2 or later; see LICENSE
 */

defined('JPATH_PLATFORM') or die;

JFormHelper::loadFieldClass('list');

/**
 * Form Field class for the Joomla Platform.
 * Provides radio button inputs
 *
 * @link   http://www.w3.org/TR/html-markup/command.radio.html#command.radio
 * @since  1.7.0
 */
class JFormFieldRadio extends JFormFieldList
{
	/**
	 * The form field type.
	 *
	 * @var    string
	 * @since  1.7.0
	 */
	protected $type = 'Radio';

	/**
	 * Name of the layout being used to render the field
	 *
	 * @var    string
	 * @since  3.5
	 */
	protected $layout = 'joomla.form.field.radio';

	/**
	 * Method to get the radio button field input markup.
	 *
	 * @return  string  The field input markup.
	 *
	 * @since   1.7.0
	 */
	protected function getInput()
	{
		if (empty($this->layout))
		{
			throw new UnexpectedValueException(sprintf('%s has no layout assigned.', $this->name));
		}

		return $this->getRenderer($this->layout)->render($this->getLayoutData());
	}

	/**
	 * Method to get the data to be passed to the layout for rendering.
	 *
	 * @return  array
	 *
	 * @since   3.5
	 */
	protected function getLayoutData()
	{
		$data = parent::getLayoutData();

		$extraData = array(
			'options' => $this->getOptions(),
			'value'   => (string) $this->value,
		);

		return array_merge($data, $extraData);
	}
}
meter.php000060400000010773152457271650006413 0ustar00<?php
/**
 * @package     Joomla.Platform
 * @subpackage  Form
 *
 * @copyright   (C) 2013 Open Source Matters, Inc. <https://www.joomla.org>
 * @license     GNU General Public License version 2 or later; see LICENSE
 */

defined('JPATH_PLATFORM') or die;

JFormHelper::loadFieldClass('number');

/**
 * Form Field class for the Joomla Platform.
 * Provides a meter to show value in a range.
 *
 * @link   http://www.w3.org/TR/html-markup/input.text.html#input.text
 * @since  3.2
 */
class JFormFieldMeter extends JFormFieldNumber
{
	/**
	 * The form field type.
	 *
	 * @var    string
	 * @since  3.2
	 */
	protected $type = 'Meter';

	/**
	 * The width of the field increased or decreased.
	 *
	 * @var    string
	 * @since  3.2
	 */
	protected $width;

	/**
	 * Whether the field is active or not.
	 *
	 * @var    boolean
	 * @since  3.2
	 */
	protected $active = false;

	/**
	 * Whether the field is animated or not.
	 *
	 * @var    boolean
	 * @since  3.2
	 */
	protected $animated = true;

	/**
	 * The color of the field
	 *
	 * @var    boolean
	 * @since  3.2
	 */
	protected $color;

	/**
	 * Name of the layout being used to render the field
	 *
	 * @var    string
	 * @since  3.7
	 */
	protected $layout = 'joomla.form.field.meter';

	/**
	 * Method to get certain otherwise inaccessible properties from the form field object.
	 *
	 * @param   string  $name  The property name for which to get the value.
	 *
	 * @return  mixed  The property value or null.
	 *
	 * @since   3.2
	 */
	public function __get($name)
	{
		switch ($name)
		{
			case 'active':
			case 'width':
			case 'animated':
			case 'color':
				return $this->$name;
		}

		return parent::__get($name);
	}

	/**
	 * Method to set certain otherwise inaccessible properties of the form field object.
	 *
	 * @param   string  $name   The property name for which to set the value.
	 * @param   mixed   $value  The value of the property.
	 *
	 * @return  void
	 *
	 * @since   3.2
	 */
	public function __set($name, $value)
	{
		switch ($name)
		{
			case 'width':
			case 'color':
				$this->$name = (string) $value;
				break;

			case 'active':
				$value = (string) $value;
				$this->active = ($value === 'true' || $value === $name || $value === '1');
				break;

			case 'animated':
				$value = (string) $value;
				$this->animated = !($value === 'false' || $value === 'off' || $value === '0');
				break;

			default:
				parent::__set($name, $value);
		}
	}

	/**
	 * Method to attach a JForm object to the field.
	 *
	 * @param   SimpleXMLElement  $element  The SimpleXMLElement object representing the `<field>` tag for the form field object.
	 * @param   mixed             $value    The form field value to validate.
	 * @param   string            $group    The field name group control value. This acts as an array container for the field.
	 *                                      For example if the field has name="foo" and the group value is set to "bar" then the
	 *                                      full field name would end up being "bar[foo]".
	 *
	 * @return  boolean  True on success.
	 *
	 * @see     JFormField::setup()
	 * @since   3.2
	 */
	public function setup(SimpleXMLElement $element, $value, $group = null)
	{
		$return = parent::setup($element, $value, $group);

		if ($return)
		{
			$this->width = isset($this->element['width']) ? (string) $this->element['width'] : '';
			$this->color = isset($this->element['color']) ? (string) $this->element['color'] : '';

			$active       = (string) $this->element['active'];
			$this->active = ($active == 'true' || $active == 'on' || $active == '1');

			$animated       = (string) $this->element['animated'];
			$this->animated = !($animated == 'false' || $animated == 'off' || $animated == '0');
		}

		return $return;
	}

	/**
	 * Method to get the field input markup.
	 *
	 * @return  string  The field input markup.
	 *
	 * @since   3.2
	 */
	protected function getInput()
	{
		// Trim the trailing line in the layout file
		return rtrim($this->getRenderer($this->layout)->render($this->getLayoutData()), PHP_EOL);
	}

	/**
	 * Method to get the data to be passed to the layout for rendering.
	 *
	 * @return  array
	 *
	 * @since 3.5
	 */
	protected function getLayoutData()
	{
		$data = parent::getLayoutData();

		// Initialize some field attributes.
		$extraData = array(
			'width'    => $this->width,
			'color'    => $this->color,
			'animated' => $this->animated,
			'active'   => $this->active,
			'max'      => $this->max,
			'min'      => $this->min,
			'step'     => $this->step,
		);

		return array_merge($data, $extraData);
	}
}
sessionhandler.php000060400000002153152457271650010311 0ustar00<?php
/**
 * @package     Joomla.Platform
 * @subpackage  Form
 *
 * @copyright   (C) 2009 Open Source Matters, Inc. <https://www.joomla.org>
 * @license     GNU General Public License version 2 or later; see LICENSE
 */

defined('JPATH_PLATFORM') or die;

JFormHelper::loadFieldClass('list');

/**
 * Form Field class for the Joomla Platform.
 * Provides a select list of session handler options.
 *
 * @since  1.7.0
 */
class JFormFieldSessionHandler extends JFormFieldList
{
	/**
	 * The form field type.
	 *
	 * @var    string
	 * @since  1.7.0
	 */
	protected $type = 'SessionHandler';

	/**
	 * Method to get the session handler field options.
	 *
	 * @return  array  The field option objects.
	 *
	 * @since   1.7.0
	 */
	protected function getOptions()
	{
		$options = array();

		// Get the options from JSession.
		foreach (JSession::getStores() as $store)
		{
			$options[] = JHtml::_('select.option', $store, JText::_('JLIB_FORM_VALUE_SESSION_' . $store), 'value', 'text');
		}

		// Merge any additional options in the XML definition.
		$options = array_merge(parent::getOptions(), $options);

		return $options;
	}
}
hidden.php000060400000002323152457271650006522 0ustar00<?php
/**
 * @package     Joomla.Platform
 * @subpackage  Form
 *
 * @copyright   (C) 2009 Open Source Matters, Inc. <https://www.joomla.org>
 * @license     GNU General Public License version 2 or later; see LICENSE
 */

defined('JPATH_PLATFORM') or die;

/**
 * Form Field class for the Joomla Platform.
 * Provides a hidden field
 *
 * @link   http://www.w3.org/TR/html-markup/input.hidden.html#input.hidden
 * @since  1.7.0
 */
class JFormFieldHidden extends JFormField
{
	/**
	 * The form field type.
	 *
	 * @var    string
	 * @since  1.7.0
	 */
	protected $type = 'Hidden';

	/**
	 * Name of the layout being used to render the field
	 *
	 * @var    string
	 * @since  3.7
	 */
	protected $layout = 'joomla.form.field.hidden';

	/**
	 * Method to get the field input markup.
	 *
	 * @return  string  The field input markup.
	 *
	 * @since   1.7.0
	 */
	protected function getInput()
	{
		// Trim the trailing line in the layout file
		return rtrim($this->getRenderer($this->layout)->render($this->getLayoutData()), PHP_EOL);
	}

	/**
	 * Method to get the data to be passed to the layout for rendering.
	 *
	 * @return  array
	 *
	 * @since 3.7
	 */
	protected function getLayoutData()
	{
		return parent::getLayoutData();
	}
}
calendar.php000060400000022133152457271650007041 0ustar00<?php
/**
 * @package     Joomla.Platform
 * @subpackage  Form
 *
 * @copyright   (C) 2009 Open Source Matters, Inc. <https://www.joomla.org>
 * @license     GNU General Public License version 2 or later; see LICENSE
 */

defined('JPATH_PLATFORM') or die;

/**
 * Form Field class for the Joomla Platform.
 *
 * Provides a pop up date picker linked to a button.
 * Optionally may be filtered to use user's or server's time zone.
 *
 * @since  1.7.0
 */
class JFormFieldCalendar extends JFormField
{
	/**
	 * The form field type.
	 *
	 * @var    string
	 * @since  1.7.0
	 */
	protected $type = 'Calendar';

	/**
	 * The allowable maxlength of calendar field.
	 *
	 * @var    integer
	 * @since  3.2
	 */
	protected $maxlength;

	/**
	 * The format of date and time.
	 *
	 * @var    integer
	 * @since  3.2
	 */
	protected $format;

	/**
	 * The filter.
	 *
	 * @var    integer
	 * @since  3.2
	 */
	protected $filter;

	/**
	 * The minimum year number to subtract/add from the current year
	 *
	 * @var    integer
	 * @since  3.7.0
	 */
	protected $minyear;

	/**
	 * The maximum year number to subtract/add from the current year
	 *
	 * @var    integer
	 * @since  3.7.0
	 */
	protected $maxyear;

	/**
	 * Name of the layout being used to render the field
	 *
	 * @var    string
	 * @since  3.7.0
	 */
	protected $layout = 'joomla.form.field.calendar';

	/**
	 * Method to get certain otherwise inaccessible properties from the form field object.
	 *
	 * @param   string  $name  The property name for which to get the value.
	 *
	 * @return  mixed  The property value or null.
	 *
	 * @since   3.2
	 */
	public function __get($name)
	{
		switch ($name)
		{
			case 'maxlength':
			case 'format':
			case 'filter':
			case 'timeformat':
			case 'todaybutton':
			case 'singleheader':
			case 'weeknumbers':
			case 'showtime':
			case 'filltable':
			case 'minyear':
			case 'maxyear':
				return $this->$name;
		}

		return parent::__get($name);
	}

	/**
	 * Method to set certain otherwise inaccessible properties of the form field object.
	 *
	 * @param   string  $name   The property name for which to set the value.
	 * @param   mixed   $value  The value of the property.
	 *
	 * @return  void
	 *
	 * @since   3.2
	 */
	public function __set($name, $value)
	{
		switch ($name)
		{
			case 'maxlength':
			case 'timeformat':
				$this->$name = (int) $value;
				break;
			case 'todaybutton':
			case 'singleheader':
			case 'weeknumbers':
			case 'showtime':
			case 'filltable':
			case 'format':
			case 'filter':
			case 'minyear':
			case 'maxyear':
				$this->$name = (string) $value;
				break;

			default:
				parent::__set($name, $value);
		}
	}

	/**
	 * Method to attach a JForm object to the field.
	 *
	 * @param   SimpleXMLElement  $element  The SimpleXMLElement object representing the `<field>` tag for the form field object.
	 * @param   mixed             $value    The form field value to validate.
	 * @param   string            $group    The field name group control value. This acts as an array container for the field.
	 *                                      For example if the field has name="foo" and the group value is set to "bar" then the
	 *                                      full field name would end up being "bar[foo]".
	 *
	 * @return  boolean  True on success.
	 *
	 * @see     JFormField::setup()
	 * @since   3.2
	 */
	public function setup(SimpleXMLElement $element, $value, $group = null)
	{
		$return = parent::setup($element, $value, $group);

		if ($return)
		{
			$this->maxlength    = (int) $this->element['maxlength'] ? (int) $this->element['maxlength'] : 45;
			$this->format       = (string) $this->element['format'] ? (string) $this->element['format'] : '%Y-%m-%d';
			$this->filter       = (string) $this->element['filter'] ? (string) $this->element['filter'] : 'USER_UTC';
			$this->todaybutton  = (string) $this->element['todaybutton'] ? (string) $this->element['todaybutton'] : 'true';
			$this->weeknumbers  = (string) $this->element['weeknumbers'] ? (string) $this->element['weeknumbers'] : 'true';
			$this->showtime     = (string) $this->element['showtime'] ? (string) $this->element['showtime'] : 'false';
			$this->filltable    = (string) $this->element['filltable'] ? (string) $this->element['filltable'] : 'true';
			$this->timeformat   = (int) $this->element['timeformat'] ? (int) $this->element['timeformat'] : 24;
			$this->singleheader = (string) $this->element['singleheader'] ? (string) $this->element['singleheader'] : 'false';
			$this->minyear      = strlen((string) $this->element['minyear']) ? (string) $this->element['minyear'] : null;
			$this->maxyear      = strlen((string) $this->element['maxyear']) ? (string) $this->element['maxyear'] : null;

			if ($this->maxyear < 0 || $this->minyear > 0)
			{
				$this->todaybutton = 'false';
			}
		}

		return $return;
	}

	/**
	 * Method to get the field input markup.
	 *
	 * @return  string  The field input markup.
	 *
	 * @since   1.7.0
	 */
	protected function getInput()
	{
		$config    = JFactory::getConfig();
		$user      = JFactory::getUser();

		// Translate the format if requested
		$translateFormat = (string) $this->element['translateformat'];

		if ($translateFormat && $translateFormat != 'false')
		{
			$showTime = (string) $this->element['showtime'];

			$lang  = \JFactory::getLanguage();
			$debug = $lang->setDebug(false);

			if ($showTime && $showTime != 'false')
			{
				$this->format = JText::_('DATE_FORMAT_CALENDAR_DATETIME');
			}
			else
			{
				$this->format = JText::_('DATE_FORMAT_CALENDAR_DATE');
			}

			$lang->setDebug($debug);
		}

		// If a known filter is given use it.
		switch (strtoupper($this->filter))
		{
			case 'SERVER_UTC':
				// Convert a date to UTC based on the server timezone.
				if ($this->value && $this->value != JFactory::getDbo()->getNullDate())
				{
					// Get a date object based on the correct timezone.
					$date = JFactory::getDate($this->value, 'UTC');
					$date->setTimezone(new DateTimeZone($config->get('offset')));

					// Transform the date string.
					$this->value = $date->format('Y-m-d H:i:s', true, false);
				}
				break;
			case 'USER_UTC':
				// Convert a date to UTC based on the user timezone.
				if ($this->value && $this->value != JFactory::getDbo()->getNullDate())
				{
					// Get a date object based on the correct timezone.
					$date = JFactory::getDate($this->value, 'UTC');
					$date->setTimezone($user->getTimezone());

					// Transform the date string.
					$this->value = $date->format('Y-m-d H:i:s', true, false);
				}
				break;
		}

		// Format value when not nulldate ('0000-00-00 00:00:00'), otherwise blank it as it would result in 1970-01-01.
		if ($this->value && $this->value != JFactory::getDbo()->getNullDate() && strtotime($this->value) !== false)
		{
			$tz = date_default_timezone_get();
			date_default_timezone_set('UTC');
			$this->value = strftime($this->format, strtotime($this->value));
			date_default_timezone_set($tz);
		}
		else
		{
			$this->value = '';
		}

		return $this->getRenderer($this->layout)->render($this->getLayoutData());
	}

	/**
	 * Method to get the data to be passed to the layout for rendering.
	 *
	 * @return  array
	 *
	 * @since  3.7.0
	 */
	protected function getLayoutData()
	{
		$data      = parent::getLayoutData();
		$tag       = JFactory::getLanguage()->getTag();
		$calendar  = JFactory::getLanguage()->getCalendar();
		$direction = strtolower(JFactory::getDocument()->getDirection());

		// Get the appropriate file for the current language date helper
		$helperPath = 'system/fields/calendar-locales/date/gregorian/date-helper.min.js';

		if (!empty($calendar) && is_dir(JPATH_ROOT . '/media/system/js/fields/calendar-locales/date/' . strtolower($calendar)))
		{
			$helperPath = 'system/fields/calendar-locales/date/' . strtolower($calendar) . '/date-helper.min.js';
		}

		// Get the appropriate locale file for the current language
		$localesPath = 'system/fields/calendar-locales/en.js';

		if (is_file(JPATH_ROOT . '/media/system/js/fields/calendar-locales/' . strtolower($tag) . '.js'))
		{
			$localesPath = 'system/fields/calendar-locales/' . strtolower($tag) . '.js';
		}
		elseif (is_file(JPATH_ROOT . '/media/system/js/fields/calendar-locales/' . $tag . '.js'))
		{
			$localesPath = 'system/fields/calendar-locales/' . $tag . '.js';
		}
		elseif (is_file(JPATH_ROOT . '/media/system/js/fields/calendar-locales/' . strtolower(substr($tag, 0, -3)) . '.js'))
		{
			$localesPath = 'system/fields/calendar-locales/' . strtolower(substr($tag, 0, -3)) . '.js';
		}

		$extraData = array(
			'value'        => $this->value,
			'maxLength'    => $this->maxlength,
			'format'       => $this->format,
			'filter'       => $this->filter,
			'todaybutton'  => ($this->todaybutton === 'true') ? 1 : 0,
			'weeknumbers'  => ($this->weeknumbers === 'true') ? 1 : 0,
			'showtime'     => ($this->showtime === 'true') ? 1 : 0,
			'filltable'    => ($this->filltable === 'true') ? 1 : 0,
			'timeformat'   => $this->timeformat,
			'singleheader' => ($this->singleheader === 'true') ? 1 : 0,
			'helperPath'   => $helperPath,
			'localesPath'  => $localesPath,
			'minYear'      => $this->minyear,
			'maxYear'      => $this->maxyear,
			'direction'    => $direction,
		);

		return array_merge($data, $extraData);
	}
}
cachehandler.php000060400000002045152457271650007671 0ustar00<?php
/**
 * @package     Joomla.Platform
 * @subpackage  Form
 *
 * @copyright   (C) 2009 Open Source Matters, Inc. <https://www.joomla.org>
 * @license     GNU General Public License version 2 or later; see LICENSE
 */

defined('JPATH_PLATFORM') or die;

JFormHelper::loadFieldClass('list');

/**
 * Form Field class for the Joomla Platform.
 * Provides a list of available cache handlers
 *
 * @see    JCache
 * @since  1.7.0
 */
class JFormFieldCacheHandler extends JFormFieldList
{
	/**
	 * The form field type.
	 *
	 * @var    string
	 * @since  1.7.0
	 */
	protected $type = 'CacheHandler';

	/**
	 * Method to get the field options.
	 *
	 * @return  array  The field option objects.
	 *
	 * @since   1.7.0
	 */
	protected function getOptions()
	{
		$options = array();

		// Convert to name => name array.
		foreach (JCache::getStores() as $store)
		{
			$options[] = JHtml::_('select.option', $store, JText::_('JLIB_FORM_VALUE_CACHE_' . $store), 'value', 'text');
		}

		$options = array_merge(parent::getOptions(), $options);

		return $options;
	}
}
usergroup.php000060400000004555152457271650007333 0ustar00<?php
/**
 * @package     Joomla.Platform
 * @subpackage  Form
 *
 * @copyright   (C) 2009 Open Source Matters, Inc. <https://www.joomla.org>
 * @license     GNU General Public License version 2 or later; see LICENSE
 */

defined('JPATH_PLATFORM') or die;

/**
 * Form Field class for the Joomla Platform.
 * Supports a nested checkbox field listing user groups.
 * Multiselect is available by default.
 *
 * @since       1.7.0
 * @deprecated  3.5
 */
class JFormFieldUsergroup extends JFormField
{
	/**
	 * The form field type.
	 *
	 * @var    string
	 * @since  1.7.0
	 */
	protected $type = 'Usergroup';

	/**
	 * Method to get the user group field input markup.
	 *
	 * @return  string  The field input markup.
	 *
	 * @since   1.7.0
	 */
	protected function getInput()
	{
		JLog::add('JFormFieldUsergroup is deprecated. Use JFormFieldUserGroupList instead.', JLog::WARNING, 'deprecated');

		$options = array();
		$attr = '';

		// Initialize some field attributes.
		$attr .= !empty($this->class) ? ' class="' . $this->class . '"' : '';
		$attr .= $this->disabled ? ' disabled' : '';
		$attr .= $this->size ? ' size="' . $this->size . '"' : '';
		$attr .= $this->multiple ? ' multiple' : '';
		$attr .= $this->required ? ' required aria-required="true"' : '';
		$attr .= $this->autofocus ? ' autofocus' : '';

		// Initialize JavaScript field attributes.
		$attr .= !empty($this->onchange) ? ' onchange="' . $this->onchange . '"' : '';
		$attr .= !empty($this->onclick) ? ' onclick="' . $this->onclick . '"' : '';

		// Iterate through the children and build an array of options.
		foreach ($this->element->children() as $option)
		{
			// Only add <option /> elements.
			if ($option->getName() != 'option')
			{
				continue;
			}

			$disabled = (string) $option['disabled'];
			$disabled = ($disabled == 'true' || $disabled == 'disabled' || $disabled == '1');

			// Create a new option object based on the <option /> element.
			$tmp = JHtml::_(
				'select.option', (string) $option['value'], trim((string) $option), 'value', 'text',
				$disabled
			);

			// Set some option attributes.
			$tmp->class = (string) $option['class'];

			// Set some JavaScript option attributes.
			$tmp->onclick = (string) $option['onclick'];

			// Add the option object to the result set.
			$options[] = $tmp;
		}

		return JHtml::_('access.usergroup', $this->name, $this->value, $attr, $options, $this->id);
	}
}
imagelist.php000060400000001671152457271650007252 0ustar00<?php
/**
 * @package     Joomla.Platform
 * @subpackage  Form
 *
 * @copyright   (C) 2010 Open Source Matters, Inc. <https://www.joomla.org>
 * @license     GNU General Public License version 2 or later; see LICENSE
 */

defined('JPATH_PLATFORM') or die;

JFormHelper::loadFieldClass('filelist');

/**
 * Supports an HTML select list of image
 *
 * @since  1.7.0
 */
class JFormFieldImageList extends JFormFieldFileList
{
	/**
	 * The form field type.
	 *
	 * @var    string
	 * @since  1.7.0
	 */
	protected $type = 'ImageList';

	/**
	 * Method to get the list of images field options.
	 * Use the filter attribute to specify allowable file extensions.
	 *
	 * @return  array  The field option objects.
	 *
	 * @since   1.7.0
	 */
	protected function getOptions()
	{
		// Define the image file type filter.
		$this->filter = '\.png$|\.gif$|\.jpg$|\.bmp$|\.ico$|\.jpeg$|\.psd$|\.eps$';

		// Get the field options.
		return parent::getOptions();
	}
}
tel.php000060400000003116152457271650006054 0ustar00<?php
/**
 * @package     Joomla.Platform
 * @subpackage  Form
 *
 * @copyright   (C) 2011 Open Source Matters, Inc. <https://www.joomla.org>
 * @license     GNU General Public License version 2 or later; see LICENSE
 */

defined('JPATH_PLATFORM') or die;

JFormHelper::loadFieldClass('text');

/**
 * Form Field class for the Joomla Platform.
 * Supports a text field telephone numbers.
 *
 * @link   http://www.w3.org/TR/html-markup/input.tel.html
 * @see    JFormRuleTel for telephone number validation
 * @see    JHtmlTel for rendering of telephone numbers
 * @since  1.7.0
 */
class JFormFieldTel extends JFormFieldText
{
	/**
	 * The form field type.
	 *
	 * @var    string
	 * @since  1.7.0
	 */
	protected $type = 'Tel';

	/**
	 * Name of the layout being used to render the field
	 *
	 * @var    string
	 * @since  3.7.0
	 */
	protected $layout = 'joomla.form.field.tel';

	/**
	 * Method to get the field input markup.
	 *
	 * @return  string  The field input markup.
	 *
	 * @since   3.2
	 */
	protected function getInput()
	{
		// Trim the trailing line in the layout file
		return rtrim($this->getRenderer($this->layout)->render($this->getLayoutData()), PHP_EOL);
	}

	/**
	 * Method to get the data to be passed to the layout for rendering.
	 *
	 * @return  array
	 *
	 * @since 3.7.0
	 */
	protected function getLayoutData()
	{
		$data = parent::getLayoutData();

		// Initialize some field attributes.
		$maxLength    = !empty($this->maxLength) ? ' maxlength="' . $this->maxLength . '"' : '';

		$extraData = array(
			'maxLength' => $maxLength,
		);

		return array_merge($data, $extraData);
	}
}
predefinedlist.php000060400000003634152457271650010276 0ustar00<?php
/**
 * @package     Joomla.Libraries
 * @subpackage  Form
 *
 * @copyright   (C) 2013 Open Source Matters, Inc. <https://www.joomla.org>
 * @license     GNU General Public License version 2 or later; see LICENSE
 */

defined('JPATH_PLATFORM') or die;

JFormHelper::loadFieldClass('list');

/**
 * Form Field to load a list of predefined values
 *
 * @since  3.2
 */
abstract class JFormFieldPredefinedList extends JFormFieldList
{
	/**
	 * The form field type.
	 *
	 * @var    string
	 * @since  3.2
	 */
	protected $type = 'PredefinedList';

	/**
	 * Cached array of the category items.
	 *
	 * @var    array
	 * @since  3.2
	 */
	protected static $options = array();

	/**
	 * Available predefined options
	 *
	 * @var  array
	 * @since  3.2
	 */
	protected $predefinedOptions = array();

	/**
	 * Translate options labels ?
	 *
	 * @var  boolean
	 * @since  3.2
	 */
	protected $translate = true;

	/**
	 * Method to get the options to populate list
	 *
	 * @return  array  The field option objects.
	 *
	 * @since   3.2
	 */
	protected function getOptions()
	{
		// Hash for caching
		$hash = md5($this->element);
		$type = strtolower($this->type);

		if (!isset(static::$options[$type][$hash]) && !empty($this->predefinedOptions))
		{
			static::$options[$type][$hash] = parent::getOptions();

			$options = array();

			// Allow to only use specific values of the predefined list
			$filter = isset($this->element['filter']) ? explode(',', $this->element['filter']) : array();

			foreach ($this->predefinedOptions as $value => $text)
			{
				$val = (string) $value;
	
				if (empty($filter) || in_array($val, $filter, true))
				{
					$text = $this->translate ? JText::_($text) : $text;

					$options[] = (object) array(
						'value' => $value,
						'text'  => $text,
					);
				}
			}

			static::$options[$type][$hash] = array_merge(static::$options[$type][$hash], $options);
		}

		return static::$options[$type][$hash];
	}
}
rules.php000060400000034654152457271650006435 0ustar00<?php
/**
 * @package     Joomla.Platform
 * @subpackage  Form
 *
 * @copyright   (C) 2009 Open Source Matters, Inc. <https://www.joomla.org>
 * @license     GNU General Public License version 2 or later; see LICENSE
 */

defined('JPATH_PLATFORM') or die;

/**
 * Form Field class for the Joomla Platform.
 * Field for assigning permissions to groups for a given asset
 *
 * @see    JAccess
 * @since  1.7.0
 */
class JFormFieldRules extends JFormField
{
	/**
	 * The form field type.
	 *
	 * @var    string
	 * @since  1.7.0
	 */
	protected $type = 'Rules';

	/**
	 * The section.
	 *
	 * @var    string
	 * @since  3.2
	 */
	protected $section;

	/**
	 * The component.
	 *
	 * @var    string
	 * @since  3.2
	 */
	protected $component;

	/**
	 * The assetField.
	 *
	 * @var    string
	 * @since  3.2
	 */
	protected $assetField;

	/**
	 * Method to get certain otherwise inaccessible properties from the form field object.
	 *
	 * @param   string  $name  The property name for which to get the value.
	 *
	 * @return  mixed  The property value or null.
	 *
	 * @since   3.2
	 */
	public function __get($name)
	{
		switch ($name)
		{
			case 'section':
			case 'component':
			case 'assetField':
				return $this->$name;
		}

		return parent::__get($name);
	}

	/**
	 * Method to set certain otherwise inaccessible properties of the form field object.
	 *
	 * @param   string  $name   The property name for which to set the value.
	 * @param   mixed   $value  The value of the property.
	 *
	 * @return  void
	 *
	 * @since   3.2
	 */
	public function __set($name, $value)
	{
		switch ($name)
		{
			case 'section':
			case 'component':
			case 'assetField':
				$this->$name = (string) $value;
				break;

			default:
				parent::__set($name, $value);
		}
	}

	/**
	 * Method to attach a JForm object to the field.
	 *
	 * @param   SimpleXMLElement  $element  The SimpleXMLElement object representing the `<field>` tag for the form field object.
	 * @param   mixed             $value    The form field value to validate.
	 * @param   string            $group    The field name group control value. This acts as an array container for the field.
	 *                                      For example if the field has name="foo" and the group value is set to "bar" then the
	 *                                      full field name would end up being "bar[foo]".
	 *
	 * @return  boolean  True on success.
	 *
	 * @see     JFormField::setup()
	 * @since   3.2
	 */
	public function setup(SimpleXMLElement $element, $value, $group = null)
	{
		$return = parent::setup($element, $value, $group);

		if ($return)
		{
			$this->section    = $this->element['section'] ? (string) $this->element['section'] : '';
			$this->component  = $this->element['component'] ? (string) $this->element['component'] : '';
			$this->assetField = $this->element['asset_field'] ? (string) $this->element['asset_field'] : 'asset_id';
		}

		return $return;
	}

	/**
	 * Method to get the field input markup for Access Control Lists.
	 * Optionally can be associated with a specific component and section.
	 *
	 * @return  string  The field input markup.
	 *
	 * @since   1.7.0
	 * @todo:   Add access check.
	 */
	protected function getInput()
	{
		JHtml::_('bootstrap.tooltip');

		// Add Javascript for permission change
		JHtml::_('script', 'system/permissions.js', array('version' => 'auto', 'relative' => true));

		// Load JavaScript message titles
		JText::script('ERROR');
		JText::script('WARNING');
		JText::script('NOTICE');
		JText::script('MESSAGE');

		// Add strings for JavaScript error translations.
		JText::script('JLIB_JS_AJAX_ERROR_CONNECTION_ABORT');
		JText::script('JLIB_JS_AJAX_ERROR_NO_CONTENT');
		JText::script('JLIB_JS_AJAX_ERROR_OTHER');
		JText::script('JLIB_JS_AJAX_ERROR_PARSE');
		JText::script('JLIB_JS_AJAX_ERROR_TIMEOUT');

		// Initialise some field attributes.
		$section    = $this->section;
		$assetField = $this->assetField;
		$component  = empty($this->component) ? 'root.1' : $this->component;

		// Current view is global config?
		$isGlobalConfig = $component === 'root.1';

		// Get the actions for the asset.
		$actions = JAccess::getActions($component, $section);

		// Iterate over the children and add to the actions.
		foreach ($this->element->children() as $el)
		{
			if ($el->getName() == 'action')
			{
				$actions[] = (object) array(
					'name' => (string) $el['name'],
					'title' => (string) $el['title'],
					'description' => (string) $el['description'],
				);
			}
		}

		// Get the asset id.
		// Note that for global configuration, com_config injects asset_id = 1 into the form.
		$assetId       = $this->form->getValue($assetField);
		$newItem       = empty($assetId) && $isGlobalConfig === false && $section !== 'component';
		$parentAssetId = null;

		// If the asset id is empty (component or new item).
		if (empty($assetId))
		{
			// Get the component asset id as fallback.
			$db = JFactory::getDbo();
			$query = $db->getQuery(true)
				->select($db->quoteName('id'))
				->from($db->quoteName('#__assets'))
				->where($db->quoteName('name') . ' = ' . $db->quote($component));

			$db->setQuery($query);

			$assetId = (int) $db->loadResult();

			/**
			 * @to do: incorrect info
			 * When creating a new item (not saving) it uses the calculated permissions from the component (item <-> component <-> global config).
			 * But if we have a section too (item <-> section(s) <-> component <-> global config) this is not correct.
			 * Also, currently it uses the component permission, but should use the calculated permissions for achild of the component/section.
			 */
		}

		// If not in global config we need the parent_id asset to calculate permissions.
		if (!$isGlobalConfig)
		{
			// In this case we need to get the component rules too.
			$db = JFactory::getDbo();

			$query = $db->getQuery(true)
				->select($db->quoteName('parent_id'))
				->from($db->quoteName('#__assets'))
				->where($db->quoteName('id') . ' = ' . $assetId);

			$db->setQuery($query);

			$parentAssetId = (int) $db->loadResult();
		}

		// Full width format.

		// Get the rules for just this asset (non-recursive).
		$assetRules = JAccess::getAssetRules($assetId, false, false);

		// Get the available user groups.
		$groups = $this->getUserGroups();

		// Ajax request data.
		$ajaxUri = JRoute::_('index.php?option=com_config&task=config.store&format=json&' . JSession::getFormToken() . '=1');

		// Prepare output
		$html = array();

		// Description
		$html[] = '<p class="rule-desc">' . JText::_('JLIB_RULES_SETTINGS_DESC') . '</p>';

		// Begin tabs
		$html[] = '<div class="tabbable tabs-left" data-ajaxuri="' . $ajaxUri . '" id="permissions-sliders">';

		// Building tab nav
		$html[] = '<ul class="nav nav-tabs">';

		foreach ($groups as $group)
		{
			// Initial Active Tab
			$active = (int) $group->value === 1 ? ' class="active"' : '';

			$html[] = '<li' . $active . '>';
			$html[] = '<a href="#permission-' . $group->value . '" data-toggle="tab">';
			$html[] = JLayoutHelper::render('joomla.html.treeprefix', array('level' => $group->level + 1)) . $group->text;
			$html[] = '</a>';
			$html[] = '</li>';
		}

		$html[] = '</ul>';

		$html[] = '<div class="tab-content">';

		// Start a row for each user group.
		foreach ($groups as $group)
		{
			// Initial Active Pane
			$active = (int) $group->value === 1 ? ' active' : '';

			$html[] = '<div class="tab-pane' . $active . '" id="permission-' . $group->value . '">';
			$html[] = '<table class="table table-striped">';
			$html[] = '<thead>';
			$html[] = '<tr>';

			$html[] = '<th class="actions" id="actions-th' . $group->value . '">';
			$html[] = '<span class="acl-action">' . JText::_('JLIB_RULES_ACTION') . '</span>';
			$html[] = '</th>';

			$html[] = '<th class="settings" id="settings-th' . $group->value . '">';
			$html[] = '<span class="acl-action">' . JText::_('JLIB_RULES_SELECT_SETTING') . '</span>';
			$html[] = '</th>';

			$html[] = '<th id="aclactionth' . $group->value . '">';
			$html[] = '<span class="acl-action">' . JText::_('JLIB_RULES_CALCULATED_SETTING') . '</span>';
			$html[] = '</th>';

			$html[] = '</tr>';
			$html[] = '</thead>';
			$html[] = '<tbody>';

			// Check if this group has super user permissions
			$isSuperUserGroup = JAccess::checkGroup($group->value, 'core.admin');

			foreach ($actions as $action)
			{
				$html[] = '<tr>';
				$html[] = '<td headers="actions-th' . $group->value . '">';
				$html[] = '<label for="' . $this->id . '_' . $action->name . '_' . $group->value . '" class="hasTooltip" title="'
					. JHtml::_('tooltipText', $action->title, $action->description) . '">';
				$html[] = JText::_($action->title);
				$html[] = '</label>';
				$html[] = '</td>';

				$html[] = '<td headers="settings-th' . $group->value . '">';

				$html[] = '<select onchange="sendPermissions.call(this, event)" data-chosen="true" class="input-small novalidate"'
					. ' name="' . $this->name . '[' . $action->name . '][' . $group->value . ']"'
					. ' id="' . $this->id . '_' . $action->name	. '_' . $group->value . '"'
					. ' title="' . strip_tags(
						JText::sprintf(
							'JLIB_RULES_SELECT_ALLOW_DENY_GROUP',
							JText::_($action->title),
							htmlspecialchars(trim($group->text), ENT_QUOTES, 'UTF-8')
						)
					) . '">';

				/**
				 * Possible values:
				 * null = not set means inherited
				 * false = denied
				 * true = allowed
				 */

				// Get the actual setting for the action for this group.
				$assetRule = $newItem === false ? $assetRules->allow($action->name, $group->value) : null;

				// Build the dropdowns for the permissions sliders

				// The parent group has "Not Set", all children can rightly "Inherit" from that.
				$html[] = '<option value=""' . ($assetRule === null ? ' selected="selected"' : '') . '>'
					. JText::_(empty($group->parent_id) && $isGlobalConfig ? 'JLIB_RULES_NOT_SET' : 'JLIB_RULES_INHERITED') . '</option>';
				$html[] = '<option value="1"' . ($assetRule === true ? ' selected="selected"' : '') . '>' . JText::_('JLIB_RULES_ALLOWED')
					. '</option>';
				$html[] = '<option value="0"' . ($assetRule === false ? ' selected="selected"' : '') . '>' . JText::_('JLIB_RULES_DENIED')
					. '</option>';

				$html[] = '</select>&#160; ';

				$html[] = '<span id="icon_' . $this->id . '_' . $action->name . '_' . $group->value . '"' . '></span>';
				$html[] = '</td>';

				// Build the Calculated Settings column.
				$html[] = '<td headers="aclactionth' . $group->value . '">';

				$result = array();

				// Get the group, group parent id, and group global config recursive calculated permission for the chosen action.
				$inheritedGroupRule            = JAccess::checkGroup((int) $group->value, $action->name, $assetId);
				$inheritedGroupParentAssetRule = !empty($parentAssetId) ? JAccess::checkGroup($group->value, $action->name, $parentAssetId) : null;
				$inheritedParentGroupRule      = !empty($group->parent_id) ? JAccess::checkGroup($group->parent_id, $action->name, $assetId) : null;

				// Current group is a Super User group, so calculated setting is "Allowed (Super User)".
				if ($isSuperUserGroup)
				{
					$result['class'] = 'label label-success';
					$result['text'] = '<span class="icon-lock icon-white"></span>' . JText::_('JLIB_RULES_ALLOWED_ADMIN');
				}
				// Not super user.
				else
				{
					// First get the real recursive calculated setting and add (Inherited) to it.

					// If recursive calculated setting is "Denied" or null. Calculated permission is "Not Allowed (Inherited)".
					if ($inheritedGroupRule === null || $inheritedGroupRule === false)
					{
						$result['class'] = 'label label-important';
						$result['text']  = JText::_('JLIB_RULES_NOT_ALLOWED_INHERITED');
					}
					// If recursive calculated setting is "Allowed". Calculated permission is "Allowed (Inherited)".
					else
					{
						$result['class'] = 'label label-success';
						$result['text']  = JText::_('JLIB_RULES_ALLOWED_INHERITED');
					}

					// Second part: Overwrite the calculated permissions labels if there is an explicit permission in the current group.

					/**
					 * @to do: incorrect info
					 * If a component has a permission that doesn't exists in global config (ex: frontend editing in com_modules) by default
					 * we get "Not Allowed (Inherited)" when we should get "Not Allowed (Default)".
					 */

					// If there is an explicit permission "Not Allowed". Calculated permission is "Not Allowed".
					if ($assetRule === false)
					{
						$result['class'] = 'label label-important';
						$result['text']  = JText::_('JLIB_RULES_NOT_ALLOWED');
					}
					// If there is an explicit permission is "Allowed". Calculated permission is "Allowed".
					elseif ($assetRule === true)
					{
						$result['class'] = 'label label-success';
						$result['text']  = JText::_('JLIB_RULES_ALLOWED');
					}

					// Third part: Overwrite the calculated permissions labels for special cases.

					// Global configuration with "Not Set" permission. Calculated permission is "Not Allowed (Default)".
					if (empty($group->parent_id) && $isGlobalConfig === true && $assetRule === null)
					{
						$result['class'] = 'label label-important';
						$result['text']  = JText::_('JLIB_RULES_NOT_ALLOWED_DEFAULT');
					}

					/**
					 * Component/Item with explicit "Denied" permission at parent Asset (Category, Component or Global config) configuration.
					 * Or some parent group has an explicit "Denied".
					 * Calculated permission is "Not Allowed (Locked)".
					 */
					elseif ($inheritedGroupParentAssetRule === false || $inheritedParentGroupRule === false)
					{
						$result['class'] = 'label label-important';
						$result['text']  = '<span class="icon-lock icon-white"></span>' . JText::_('JLIB_RULES_NOT_ALLOWED_LOCKED');
					}
				}

				$html[] = '<span class="' . $result['class'] . '">' . $result['text'] . '</span>';
				$html[] = '</td>';
				$html[] = '</tr>';
			}

			$html[] = '</tbody>';
			$html[] = '</table></div>';
		}

		$html[] = '</div></div>';
		$html[] = '<div class="clr"></div>';
		$html[] = '<div class="alert">';

		if ($section === 'component' || !$section)
		{
			$html[] = JText::alt('JLIB_RULES_SETTING_NOTES', $component);
		}
		else
		{
			$html[] = JText::alt('JLIB_RULES_SETTING_NOTES_ITEM', $component . '_' . $section);
		}

		$html[] = '</div>';

		return implode("\n", $html);
	}

	/**
	 * Get a list of the user groups.
	 *
	 * @return  array
	 *
	 * @since   1.7.0
	 */
	protected function getUserGroups()
	{
		$options = JHelperUsergroups::getInstance()->getAll();

		foreach ($options as &$option)
		{
			$option->value = $option->id;
			$option->text  = $option->title;
		}

		return array_values($options);
	}
}
file.php000060400000006517152457271650006217 0ustar00<?php
/**
 * @package     Joomla.Platform
 * @subpackage  Form
 *
 * @copyright   (C) 2009 Open Source Matters, Inc. <https://www.joomla.org>
 * @license     GNU General Public License version 2 or later; see LICENSE
 */

defined('JPATH_PLATFORM') or die;

/**
 * Form Field class for the Joomla Platform.
 * Provides an input field for files
 *
 * @link   http://www.w3.org/TR/html-markup/input.file.html#input.file
 * @since  1.7.0
 */
class JFormFieldFile extends JFormField
{
	/**
	 * The form field type.
	 *
	 * @var    string
	 * @since  1.7.0
	 */
	protected $type = 'File';

	/**
	 * The accepted file type list.
	 *
	 * @var    mixed
	 * @since  3.2
	 */
	protected $accept;

	/**
	 * Name of the layout being used to render the field
	 *
	 * @var    string
	 * @since  3.6
	 */
	protected $layout = 'joomla.form.field.file';

	/**
	 * Method to get certain otherwise inaccessible properties from the form field object.
	 *
	 * @param   string  $name  The property name for which to get the value.
	 *
	 * @return  mixed  The property value or null.
	 *
	 * @since   3.2
	 */
	public function __get($name)
	{
		switch ($name)
		{
			case 'accept':
				return $this->accept;
		}

		return parent::__get($name);
	}

	/**
	 * Method to set certain otherwise inaccessible properties of the form field object.
	 *
	 * @param   string  $name   The property name for which to set the value.
	 * @param   mixed   $value  The value of the property.
	 *
	 * @return  void
	 *
	 * @since   3.2
	 */
	public function __set($name, $value)
	{
		switch ($name)
		{
			case 'accept':
				$this->accept = (string) $value;
				break;

			default:
				parent::__set($name, $value);
		}
	}

	/**
	 * Method to attach a JForm object to the field.
	 *
	 * @param   SimpleXMLElement  $element  The SimpleXMLElement object representing the `<field>` tag for the form field object.
	 * @param   mixed             $value    The form field value to validate.
	 * @param   string            $group    The field name group control value. This acts as an array container for the field.
	 *                                      For example if the field has name="foo" and the group value is set to "bar" then the
	 *                                      full field name would end up being "bar[foo]".
	 *
	 * @return  boolean  True on success.
	 *
	 * @see     JFormField::setup()
	 * @since   3.2
	 */
	public function setup(SimpleXMLElement $element, $value, $group = null)
	{
		$return = parent::setup($element, $value, $group);

		if ($return)
		{
			$this->accept = (string) $this->element['accept'];
		}

		return $return;
	}

	/**
	 * Method to get the field input markup for the file field.
	 * Field attributes allow specification of a maximum file size and a string
	 * of accepted file extensions.
	 *
	 * @return  string  The field input markup.
	 *
	 * @note    The field does not include an upload mechanism.
	 * @see     JFormFieldMedia
	 * @since   1.7.0
	 */
	protected function getInput()
	{
		return $this->getRenderer($this->layout)->render($this->getLayoutData());
	}

	/**
	 * Method to get the data to be passed to the layout for rendering.
	 *
	 * @return  array
	 *
	 * @since   3.6
	 */
	protected function getLayoutData()
	{
		$data = parent::getLayoutData();

		$extraData = array(
			'accept'   => $this->accept,
			'multiple' => $this->multiple,
		);

		return array_merge($data, $extraData);
	}
}
textarea.php000060400000010133152457271650007102 0ustar00<?php
/**
 * @package     Joomla.Platform
 * @subpackage  Form
 *
 * @copyright   (C) 2009 Open Source Matters, Inc. <https://www.joomla.org>
 * @license     GNU General Public License version 2 or later; see LICENSE
 */

defined('JPATH_PLATFORM') or die;

/**
 * Form Field class for the Joomla Platform.
 * Supports a multi line area for entry of plain text
 *
 * @link   http://www.w3.org/TR/html-markup/textarea.html#textarea
 * @since  1.7.0
 */
class JFormFieldTextarea extends JFormField
{
	/**
	 * The form field type.
	 *
	 * @var    string
	 * @since  1.7.0
	 */
	protected $type = 'Textarea';

	/**
	 * The number of rows in textarea.
	 *
	 * @var    mixed
	 * @since  3.2
	 */
	protected $rows;

	/**
	 * The number of columns in textarea.
	 *
	 * @var    mixed
	 * @since  3.2
	 */
	protected $columns;

	/**
	 * The maximum number of characters in textarea.
	 *
	 * @var    mixed
	 * @since  3.4
	 */
	protected $maxlength;

	/**
	 * Name of the layout being used to render the field
	 *
	 * @var    string
	 * @since  3.7
	 */
	protected $layout = 'joomla.form.field.textarea';

	/**
	 * Method to get certain otherwise inaccessible properties from the form field object.
	 *
	 * @param   string  $name  The property name for which to get the value.
	 *
	 * @return  mixed  The property value or null.
	 *
	 * @since   3.2
	 */
	public function __get($name)
	{
		switch ($name)
		{
			case 'rows':
			case 'columns':
			case 'maxlength':
				return $this->$name;
		}

		return parent::__get($name);
	}

	/**
	 * Method to set certain otherwise inaccessible properties of the form field object.
	 *
	 * @param   string  $name   The property name for which to set the value.
	 * @param   mixed   $value  The value of the property.
	 *
	 * @return  void
	 *
	 * @since   3.2
	 */
	public function __set($name, $value)
	{
		switch ($name)
		{
			case 'rows':
			case 'columns':
			case 'maxlength':
				$this->$name = (int) $value;
				break;

			default:
				parent::__set($name, $value);
		}
	}

	/**
	 * Method to attach a JForm object to the field.
	 *
	 * @param   SimpleXMLElement  $element  The SimpleXMLElement object representing the `<field>` tag for the form field object.
	 * @param   mixed             $value    The form field value to validate.
	 * @param   string            $group    The field name group control value. This acts as an array container for the field.
	 *                                      For example if the field has name="foo" and the group value is set to "bar" then the
	 *                                      full field name would end up being "bar[foo]".
	 *
	 * @return  boolean  True on success.
	 *
	 * @see     JFormField::setup()
	 * @since   3.2
	 */
	public function setup(SimpleXMLElement $element, $value, $group = null)
	{
		$return = parent::setup($element, $value, $group);

		if ($return)
		{
			$this->rows      = isset($this->element['rows']) ? (int) $this->element['rows'] : false;
			$this->columns   = isset($this->element['cols']) ? (int) $this->element['cols'] : false;
			$this->maxlength = isset($this->element['maxlength']) ? (int) $this->element['maxlength'] : false;
		}

		return $return;
	}

	/**
	 * Method to get the textarea field input markup.
	 * Use the rows and columns attributes to specify the dimensions of the area.
	 *
	 * @return  string  The field input markup.
	 *
	 * @since   1.7.0
	 */
	protected function getInput()
	{
		// Trim the trailing line in the layout file
		return rtrim($this->getRenderer($this->layout)->render($this->getLayoutData()), PHP_EOL);
	}

	/**
	 * Method to get the data to be passed to the layout for rendering.
	 *
	 * @return  array
	 *
	 * @since 3.7
	 */
	protected function getLayoutData()
	{
		$data = parent::getLayoutData();

		// Initialize some field attributes.
		$columns      = $this->columns ? ' cols="' . $this->columns . '"' : '';
		$rows         = $this->rows ? ' rows="' . $this->rows . '"' : '';
		$maxlength    = $this->maxlength ? ' maxlength="' . $this->maxlength . '"' : '';

		$extraData = array(
			'maxlength'    => $maxlength,
			'rows'         => $rows,
			'columns'      => $columns
		);

		return array_merge($data, $extraData);
	}
}
combo.php000060400000002662152457271650006374 0ustar00<?php
/**
 * @package     Joomla.Platform
 * @subpackage  Form
 *
 * @copyright   (C) 2009 Open Source Matters, Inc. <https://www.joomla.org>
 * @license     GNU General Public License version 2 or later; see LICENSE
 */

defined('JPATH_PLATFORM') or die;

JFormHelper::loadFieldClass('list');

/**
 * Form Field class for the Joomla Platform.
 * Implements a combo box field.
 *
 * @since  1.7.0
 */
class JFormFieldCombo extends JFormFieldList
{
	/**
	 * The form field type.
	 *
	 * @var    string
	 * @since  1.7.0
	 */
	protected $type = 'Combo';

	/**
	 * Name of the layout being used to render the field
	 *
	 * @var    string
	 * @since  3.8.0
	 */
	protected $layout = 'joomla.form.field.combo';

	/**
	 * Method to get the field input markup for a combo box field.
	 *
	 * @return  string  The field input markup.
	 *
	 * @since   1.7.0
	 */
	protected function getInput()
	{
		if (empty($this->layout))
		{
			throw new UnexpectedValueException(sprintf('%s has no layout assigned.', $this->name));
		}

		return $this->getRenderer($this->layout)->render($this->getLayoutData());
	}

	/**
	 * Method to get the data to be passed to the layout for rendering.
	 *
	 * @return  array
	 *
	 * @since   3.8.0
	 */
	protected function getLayoutData()
	{
		$data = parent::getLayoutData();

		// Get the field options.
		$options = $this->getOptions();

		$extraData = array(
			'options' => $options,
		);

		return array_merge($data, $extraData);
	}
}
plugins.php000060400000010327152457271650006753 0ustar00<?php
/**
 * @package     Joomla.Platform
 * @subpackage  Form
 *
 * @copyright   (C) 2011 Open Source Matters, Inc. <https://www.joomla.org>
 * @license     GNU General Public License version 2 or later; see LICENSE
 */

defined('JPATH_PLATFORM') or die;

JFormHelper::loadFieldClass('list');

/**
 * Form Field class for the Joomla Framework.
 *
 * @since  2.5.0
 */
class JFormFieldPlugins extends JFormFieldList
{
	/**
	 * The field type.
	 *
	 * @var    string
	 * @since  2.5.0
	 */
	protected $type = 'Plugins';

	/**
	 * The path to folder for plugins.
	 *
	 * @var    string
	 * @since  3.2
	 */
	protected $folder;

	/**
	 * Method to get certain otherwise inaccessible properties from the form field object.
	 *
	 * @param   string  $name  The property name for which to get the value.
	 *
	 * @return  mixed  The property value or null.
	 *
	 * @since   3.2
	 */
	public function __get($name)
	{
		switch ($name)
		{
			case 'folder':
				return $this->folder;
		}

		return parent::__get($name);
	}

	/**
	 * Method to set certain otherwise inaccessible properties of the form field object.
	 *
	 * @param   string  $name   The property name for which to set the value.
	 * @param   mixed   $value  The value of the property.
	 *
	 * @return  void
	 *
	 * @since   3.2
	 */
	public function __set($name, $value)
	{
		switch ($name)
		{
			case 'folder':
				$this->folder = (string) $value;
				break;

			default:
				parent::__set($name, $value);
		}
	}

	/**
	 * Method to attach a JForm object to the field.
	 *
	 * @param   SimpleXMLElement  $element  The SimpleXMLElement object representing the `<field>` tag for the form field object.
	 * @param   mixed             $value    The form field value to validate.
	 * @param   string            $group    The field name group control value. This acts as an array container for the field.
	 *                                      For example if the field has name="foo" and the group value is set to "bar" then the
	 *                                      full field name would end up being "bar[foo]".
	 *
	 * @return  boolean  True on success.
	 *
	 * @see     JFormField::setup()
	 * @since   3.2
	 */
	public function setup(SimpleXMLElement $element, $value, $group = null)
	{
		$return = parent::setup($element, $value, $group);

		if ($return)
		{
			$this->folder = (string) $this->element['folder'];
		}

		return $return;
	}

	/**
	 * Method to get a list of options for a list input.
	 *
	 * @return	array  An array of JHtml options.
	 *
	 * @since   2.5.0
	 */
	protected function getOptions()
	{
		$folder        = $this->folder;
		$parentOptions = parent::getOptions();

		if (!empty($folder))
		{
			// Get list of plugins
			$db    = JFactory::getDbo();
			$query = $db->getQuery(true)
				->select('element AS value, name AS text')
				->from('#__extensions')
				->where('folder = ' . $db->quote($folder))
				->where('enabled = 1')
				->order('ordering, name');

			if ((string) $this->element['useaccess'] === 'true')
			{
				$groups = implode(',', JFactory::getUser()->getAuthorisedViewLevels());
				$query->where($db->quoteName('access') . ' IN (' . $groups . ')');
			}

			$options   = $db->setQuery($query)->loadObjectList();
			$lang      = JFactory::getLanguage();
			$useGlobal = $this->element['useglobal'];

			if ($useGlobal)
			{
				$globalValue = JFactory::getConfig()->get($this->fieldname);
			}

			foreach ($options as $i => $item)
			{
				$source    = JPATH_PLUGINS . '/' . $folder . '/' . $item->value;
				$extension = 'plg_' . $folder . '_' . $item->value;
				$lang->load($extension . '.sys', JPATH_ADMINISTRATOR, null, false, true) || $lang->load($extension . '.sys', $source, null, false, true);
				$options[$i]->text = JText::_($item->text);

				// If we are using useglobal update the use global value text with the plugin text.
				if ($useGlobal && isset($parentOptions[0]) && $item->value === $globalValue)
				{
					$text                   = JText::_($extension);
					$parentOptions[0]->text = JText::sprintf('JGLOBAL_USE_GLOBAL_VALUE', ($text === '' || $text === $extension ? $item->value : $text));
				}
			}
		}
		else
		{
			JLog::add(JText::_('JFRAMEWORK_FORM_FIELDS_PLUGINS_ERROR_FOLDER_EMPTY'), JLog::WARNING, 'jerror');
		}

		return array_merge($parentOptions, $options);
	}
}
timezone.php000060400000007514152457271650007130 0ustar00<?php
/**
 * @package     Joomla.Platform
 * @subpackage  Form
 *
 * @copyright   (C) 2009 Open Source Matters, Inc. <https://www.joomla.org>
 * @license     GNU General Public License version 2 or later; see LICENSE
 */

defined('JPATH_PLATFORM') or die;

JFormHelper::loadFieldClass('groupedlist');

/**
 * Form Field class for the Joomla Platform.
 *
 * @since  1.7.0
 */
class JFormFieldTimezone extends JFormFieldGroupedList
{
	/**
	 * The form field type.
	 *
	 * @var    string
	 * @since  1.7.0
	 */
	protected $type = 'Timezone';

	/**
	 * The list of available timezone groups to use.
	 *
	 * @var    array
	 * @since  1.7.0
	 */
	protected static $zones = array('Africa', 'America', 'Antarctica', 'Arctic', 'Asia', 'Atlantic', 'Australia', 'Europe', 'Indian', 'Pacific');

	/**
	 * The keyField of timezone field.
	 *
	 * @var    integer
	 * @since  3.2
	 */
	protected $keyField;

	/**
	 * Method to get certain otherwise inaccessible properties from the form field object.
	 *
	 * @param   string  $name  The property name for which to get the value.
	 *
	 * @return  mixed  The property value or null.
	 *
	 * @since   3.2
	 */
	public function __get($name)
	{
		switch ($name)
		{
			case 'keyField':
				return $this->keyField;
		}

		return parent::__get($name);
	}

	/**
	 * Method to set certain otherwise inaccessible properties of the form field object.
	 *
	 * @param   string  $name   The property name for which to set the value.
	 * @param   mixed   $value  The value of the property.
	 *
	 * @return  void
	 *
	 * @since   3.2
	 */
	public function __set($name, $value)
	{
		switch ($name)
		{
			case 'keyField':
				$this->keyField = (string) $value;
				break;

			default:
				parent::__set($name, $value);
		}
	}

	/**
	 * Method to attach a JForm object to the field.
	 *
	 * @param   SimpleXMLElement  $element  The SimpleXMLElement object representing the `<field>` tag for the form field object.
	 * @param   mixed             $value    The form field value to validate.
	 * @param   string            $group    The field name group control value. This acts as an array container for the field.
	 *                                      For example if the field has name="foo" and the group value is set to "bar" then the
	 *                                      full field name would end up being "bar[foo]".
	 *
	 * @return  boolean  True on success.
	 *
	 * @see     JFormField::setup()
	 * @since   3.2
	 */
	public function setup(SimpleXMLElement $element, $value, $group = null)
	{
		$return = parent::setup($element, $value, $group);

		if ($return)
		{
			$this->keyField = (string) $this->element['key_field'];
		}

		return $return;
	}

	/**
	 * Method to get the time zone field option groups.
	 *
	 * @return  array  The field option objects as a nested array in groups.
	 *
	 * @since   1.7.0
	 */
	protected function getGroups()
	{
		$groups = array();

		// Get the list of time zones from the server.
		$zones = DateTimeZone::listIdentifiers();

		// Build the group lists.
		foreach ($zones as $zone)
		{
			// Time zones not in a group we will ignore.
			if (strpos($zone, '/') === false)
			{
				continue;
			}

			// Get the group/locale from the timezone.
			list ($group, $locale) = explode('/', $zone, 2);

			// Only use known groups.
			if (in_array($group, self::$zones))
			{
				// Initialize the group if necessary.
				if (!isset($groups[$group]))
				{
					$groups[$group] = array();
				}

				// Only add options where a locale exists.
				if (!empty($locale))
				{
					$groups[$group][$zone] = JHtml::_('select.option', $zone, str_replace('_', ' ', $locale), 'value', 'text', false);
				}
			}
		}

		// Sort the group lists.
		ksort($groups);

		foreach ($groups as &$location)
		{
			sort($location);
		}

		// Merge any additional groups in the XML definition.
		$groups = array_merge(parent::getGroups(), $groups);

		return $groups;
	}
}
language.php000060400000004026152457271650007054 0ustar00<?php
/**
 * @package     Joomla.Platform
 * @subpackage  Form
 *
 * @copyright   (C) 2009 Open Source Matters, Inc. <https://www.joomla.org>
 * @license     GNU General Public License version 2 or later; see LICENSE
 */

defined('JPATH_PLATFORM') or die;

JFormHelper::loadFieldClass('list');

/**
 * Form Field class for the Joomla Platform.
 * Supports a list of installed application languages
 *
 * @see    JFormFieldContentLanguage for a select list of content languages.
 * @since  1.7.0
 */
class JFormFieldLanguage extends JFormFieldList
{
	/**
	 * The form field type.
	 *
	 * @var    string
	 * @since  1.7.0
	 */
	protected $type = 'Language';

	/**
	 * Method to get the field options.
	 *
	 * @return  array  The field option objects.
	 *
	 * @since   1.7.0
	 */
	protected function getOptions()
	{
		// Initialize some field attributes.
		$client = (string) $this->element['client'];

		if ($client != 'site' && $client != 'administrator')
		{
			$client = 'site';
		}

		// Make sure the languages are sorted base on locale instead of random sorting
		$languages = JLanguageHelper::createLanguageList($this->value, constant('JPATH_' . strtoupper($client)), true, true);
		if (count($languages) > 1)
		{
			usort(
				$languages,
				function ($a, $b)
				{
					return strcmp($a['value'], $b['value']);
				}
			);
		}

		// Merge any additional options in the XML definition.
		$options = array_merge(
			parent::getOptions(),
			$languages
		);

		// Set the default value active language
		if ($langParams = JComponentHelper::getParams('com_languages'))
		{
			switch ((string) $this->value)
			{
				case 'site':
				case 'frontend':
				case '0':
					$this->value = $langParams->get('site', 'en-GB');
					break;
				case 'admin':
				case 'administrator':
				case 'backend':
				case '1':
					$this->value = $langParams->get('administrator', 'en-GB');
					break;
				case 'active':
				case 'auto':
					$lang = JFactory::getLanguage();
					$this->value = $lang->getTag();
					break;
				default:
				break;
			}
		}

		return $options;
	}
}
url.php000060400000003431152457271650006072 0ustar00<?php
/**
 * @package     Joomla.Platform
 * @subpackage  Form
 *
 * @copyright   (C) 2011 Open Source Matters, Inc. <https://www.joomla.org>
 * @license     GNU General Public License version 2 or later; see LICENSE
 */

defined('JPATH_PLATFORM') or die;

JFormHelper::loadFieldClass('text');

/**
 * Form Field class for the Joomla Platform.
 * Supports a URL text field
 *
 * @link   http://www.w3.org/TR/html-markup/input.url.html#input.url
 * @see    JFormRuleUrl for validation of full urls
 * @since  1.7.0
 */
class JFormFieldUrl extends JFormFieldText
{
	/**
	 * The form field type.
	 *
	 * @var    string
	 * @since  1.7.0
	 */
	protected $type = 'Url';

	/**
	 * Name of the layout being used to render the field
	 *
	 * @var    string
	 * @since  3.7
	 */
	protected $layout = 'joomla.form.field.url';

	/**
	 * Method to get the field input markup.
	 *
	 * @return  string  The field input markup.
	 *
	 * @since   3.1.2 (CMS)
	 */
	protected function getInput()
	{
		// Trim the trailing line in the layout file
		return rtrim($this->getRenderer($this->layout)->render($this->getLayoutData()), PHP_EOL);
	}

	/**
	 * Method to get the data to be passed to the layout for rendering.
	 *
	 * @return  array
	 *
	 * @since 3.7
	 */
	protected function getLayoutData()
	{
		$data = parent::getLayoutData();

		// Initialize some field attributes.
		$maxLength    = !empty($this->maxLength) ? ' maxlength="' . $this->maxLength . '"' : '';

		// Note that the input type "url" is suitable only for external URLs, so if internal URLs are allowed
		// we have to use the input type "text" instead.
		$inputType    = $this->element['relative'] ? 'type="text"' : 'type="url"';

		$extraData = array(
			'maxLength' => $maxLength,
			'inputType' => $inputType,
		);

		return array_merge($data, $extraData);
	}
}
spacer.php000060400000006366152457271650006557 0ustar00<?php
/**
 * @package     Joomla.Platform
 * @subpackage  Form
 *
 * @copyright   (C) 2009 Open Source Matters, Inc. <https://www.joomla.org>
 * @license     GNU General Public License version 2 or later; see LICENSE
 */

defined('JPATH_PLATFORM') or die;

/**
 * Form Field class for the Joomla Platform.
 * Provides spacer markup to be used in form layouts.
 *
 * @since  1.7.0
 */
class JFormFieldSpacer extends JFormField
{
	/**
	 * The form field type.
	 *
	 * @var    string
	 * @since  1.7.0
	 */
	protected $type = 'Spacer';

	/**
	 * Method to get the field input markup for a spacer.
	 * The spacer does not have accept input.
	 *
	 * @return  string  The field input markup.
	 *
	 * @since   1.7.0
	 */
	protected function getInput()
	{
		return ' ';
	}

	/**
	 * Method to get the field label markup for a spacer.
	 * Use the label text or name from the XML element as the spacer or
	 * Use a hr="true" to automatically generate plain hr markup
	 *
	 * @return  string  The field label markup.
	 *
	 * @since   1.7.0
	 */
	protected function getLabel()
	{
		$html = array();
		$class = !empty($this->class) ? ' class="' . $this->class . '"' : '';
		$html[] = '<span class="spacer">';
		$html[] = '<span class="before"></span>';
		$html[] = '<span' . $class . '>';

		if ((string) $this->element['hr'] == 'true')
		{
			$html[] = '<hr' . $class . ' />';
		}
		else
		{
			$label = '';

			// Get the label text from the XML element, defaulting to the element name.
			$text = $this->element['label'] ? (string) $this->element['label'] : (string) $this->element['name'];
			$text = $this->translateLabel ? JText::_($text) : $text;

			// Build the class for the label.
			$class = !empty($this->description) ? 'hasPopover' : '';
			$class = $this->required == true ? $class . ' required' : $class;

			// Add the opening label tag and main attributes attributes.
			$label .= '<label id="' . $this->id . '-lbl" class="' . $class . '"';

			// If a description is specified, use it to build a tooltip.
			if (!empty($this->description))
			{
				JHtml::_('bootstrap.popover');
				$label .= ' title="' . htmlspecialchars(trim($text, ':'), ENT_COMPAT, 'UTF-8') . '"';
				$label .= ' data-content="' . htmlspecialchars(
					$this->translateDescription ? JText::_($this->description) : $this->description,
					ENT_COMPAT,
					'UTF-8'
				) . '"';

				if (JFactory::getLanguage()->isRtl())
				{
					$label .= ' data-placement="left"';
				}
			}

			// Add the label text and closing tag.
			$label .= '>' . $text . '</label>';
			$html[] = $label;
		}

		$html[] = '</span>';
		$html[] = '<span class="after"></span>';
		$html[] = '</span>';

		return implode('', $html);
	}

	/**
	 * Method to get the field title.
	 *
	 * @return  string  The field title.
	 *
	 * @since   1.7.0
	 */
	protected function getTitle()
	{
		return $this->getLabel();
	}

	/**
	 * Method to get a control group with label and input.
	 *
	 * @param   array  $options  Options to be passed into the rendering of the field
	 *
	 * @return  string  A string containing the html for the control group
	 *
	 * @since   3.7.3
	 */
	public function renderField($options = array())
	{
		$options['class'] = empty($options['class']) ? 'field-spacer' : $options['class'] . ' field-spacer';

		return parent::renderField($options);
	}
}
aliastag.php000060400000003202152457271650007051 0ustar00<?php
/**
 * @package     Joomla.Platform
 * @subpackage  Form
 *
 * @copyright   (C) 2016 Open Source Matters, Inc. <https://www.joomla.org>
 * @license     GNU General Public License version 2 or later; see LICENSE
 */

defined('JPATH_PLATFORM') or die;

JFormHelper::loadFieldClass('list');

/**
 * Form Field class for the Joomla Framework.
 *
 * @since  2.5.0
 */
class JFormFieldAliastag extends JFormFieldList
{
	/**
	 * The field type.
	 *
	 * @var    string
	 * @since  3.6
	 */
	protected $type = 'Aliastag';

	/**
	 * Method to get a list of options for a list input.
	 *
	 * @return	array  An array of JHtml options.
	 *
	 * @since   3.6
	 */
	protected function getOptions()
	{
			// Get list of tag type alias
			$db    = JFactory::getDbo();
			$query = $db->getQuery(true)
				->select('Distinct type_alias AS value, type_alias AS text')
				->from('#__contentitem_tag_map');
			$db->setQuery($query);

			$options = $db->loadObjectList();

			$lang = JFactory::getLanguage();

			foreach ($options as $i => $item)
			{
				$parts     = explode('.', $item->value);
				$extension = $parts[0];
				$lang->load($extension . '.sys', JPATH_ADMINISTRATOR, null, false, true)
				|| $lang->load($extension, JPath::clean(JPATH_ADMINISTRATOR . '/components/' . $extension), null, false, true);
				$options[$i]->text = JText::_(strtoupper($extension) . '_TAGS_' . strtoupper($parts[1]));
			}

		// Merge any additional options in the XML definition.
		$options = array_merge(parent::getOptions(), $options);

		// Sort by language value
		usort(
			$options,
			function($a, $b)
			{
				return strcmp($a->text, $b->text);
			}
		);

		return $options;
	}
}
groupedlist.php000060400000012562152457271650007636 0ustar00<?php
/**
 * @package     Joomla.Platform
 * @subpackage  Form
 *
 * @copyright   (C) 2010 Open Source Matters, Inc. <https://www.joomla.org>
 * @license     GNU General Public License version 2 or later; see LICENSE
 */

defined('JPATH_PLATFORM') or die;

/**
 * Form Field class for the Joomla Platform.
 * Provides a grouped list select field.
 *
 * @since  1.7.0
 */
class JFormFieldGroupedList extends JFormField
{
	/**
	 * The form field type.
	 *
	 * @var    string
	 * @since  1.7.0
	 */
	protected $type = 'GroupedList';

	/**
	 * Method to get the field option groups.
	 *
	 * @return  array  The field option objects as a nested array in groups.
	 *
	 * @since   1.7.0
	 * @throws  UnexpectedValueException
	 */
	protected function getGroups()
	{
		$groups = array();
		$label = 0;

		foreach ($this->element->children() as $element)
		{
			switch ($element->getName())
			{
				// The element is an <option />
				case 'option':
					// Initialize the group if necessary.
					if (!isset($groups[$label]))
					{
						$groups[$label] = array();
					}

					$disabled = (string) $element['disabled'];
					$disabled = ($disabled == 'true' || $disabled == 'disabled' || $disabled == '1');

					// Create a new option object based on the <option /> element.
					$tmp = JHtml::_(
						'select.option', ($element['value']) ? (string) $element['value'] : trim((string) $element),
						JText::alt(trim((string) $element), preg_replace('/[^a-zA-Z0-9_\-]/', '_', $this->fieldname)), 'value', 'text',
						$disabled
					);

					// Set some option attributes.
					$tmp->class = (string) $element['class'];

					// Set some JavaScript option attributes.
					$tmp->onclick = (string) $element['onclick'];

					// Add the option.
					$groups[$label][] = $tmp;
					break;

				// The element is a <group />
				case 'group':
					// Get the group label.
					if ($groupLabel = (string) $element['label'])
					{
						$label = JText::_($groupLabel);
					}

					// Initialize the group if necessary.
					if (!isset($groups[$label]))
					{
						$groups[$label] = array();
					}

					// Iterate through the children and build an array of options.
					foreach ($element->children() as $option)
					{
						// Only add <option /> elements.
						if ($option->getName() != 'option')
						{
							continue;
						}

						$disabled = (string) $option['disabled'];
						$disabled = ($disabled == 'true' || $disabled == 'disabled' || $disabled == '1');

						// Create a new option object based on the <option /> element.
						$tmp = JHtml::_(
							'select.option', ($option['value']) ? (string) $option['value'] : JText::_(trim((string) $option)),
							JText::_(trim((string) $option)), 'value', 'text', $disabled
						);

						// Set some option attributes.
						$tmp->class = (string) $option['class'];

						// Set some JavaScript option attributes.
						$tmp->onclick = (string) $option['onclick'];

						// Add the option.
						$groups[$label][] = $tmp;
					}

					if ($groupLabel)
					{
						$label = count($groups);
					}
					break;

				// Unknown element type.
				default:
					throw new UnexpectedValueException(sprintf('Unsupported element %s in JFormFieldGroupedList', $element->getName()), 500);
			}
		}

		reset($groups);

		return $groups;
	}

	/**
	 * Method to get the field input markup fora grouped list.
	 * Multiselect is enabled by using the multiple attribute.
	 *
	 * @return  string  The field input markup.
	 *
	 * @since   1.7.0
	 */
	protected function getInput()
	{
		$html = array();
		$attr = '';

		// Initialize some field attributes.
		$attr .= !empty($this->class) ? ' class="' . $this->class . '"' : '';
		$attr .= !empty($this->size) ? ' size="' . $this->size . '"' : '';
		$attr .= $this->multiple ? ' multiple' : '';
		$attr .= $this->required ? ' required aria-required="true"' : '';
		$attr .= $this->autofocus ? ' autofocus' : '';

		// To avoid user's confusion, readonly="true" should imply disabled="true".
		if ($this->readonly || $this->disabled)
		{
			$attr .= ' disabled="disabled"';
		}

		// Initialize JavaScript field attributes.
		$attr .= !empty($this->onchange) ? ' onchange="' . $this->onchange . '"' : '';

		// Get the field groups.
		$groups = (array) $this->getGroups();

		// Create a read-only list (no name) with a hidden input to store the value.
		if ($this->readonly)
		{
			$html[] = JHtml::_(
				'select.groupedlist', $groups, null,
				array(
					'list.attr' => $attr, 'id' => $this->id, 'list.select' => $this->value, 'group.items' => null, 'option.key.toHtml' => false,
					'option.text.toHtml' => false,
				)
			);

			// E.g. form field type tag sends $this->value as array
			if ($this->multiple && is_array($this->value))
			{
				if (!count($this->value))
				{
					$this->value[] = '';
				}

				foreach ($this->value as $value)
				{
					$html[] = '<input type="hidden" name="' . $this->name . '" value="' . htmlspecialchars($value, ENT_COMPAT, 'UTF-8') . '"/>';
				}
			}
			else
			{
				$html[] = '<input type="hidden" name="' . $this->name . '" value="' . htmlspecialchars($this->value, ENT_COMPAT, 'UTF-8') . '"/>';
			}
		}

		// Create a regular list.
		else
		{
			$html[] = JHtml::_(
				'select.groupedlist', $groups, $this->name,
				array(
					'list.attr' => $attr, 'id' => $this->id, 'list.select' => $this->value, 'group.items' => null, 'option.key.toHtml' => false,
					'option.text.toHtml' => false,
				)
			);
		}

		return implode($html);
	}
}
sql.php000060400000016167152457271650006101 0ustar00<?php
/**
 * @package     Joomla.Platform
 * @subpackage  Form
 *
 * @copyright   (C) 2010 Open Source Matters, Inc. <https://www.joomla.org>
 * @license     GNU General Public License version 2 or later; see LICENSE
 */

defined('JPATH_PLATFORM') or die;

JFormHelper::loadFieldClass('list');

/**
 * Supports a custom SQL select list
 *
 * @since  1.7.0
 */
class JFormFieldSQL extends JFormFieldList
{
	/**
	 * The form field type.
	 *
	 * @var    string
	 * @since  1.7.0
	 */
	public $type = 'SQL';

	/**
	 * The keyField.
	 *
	 * @var    string
	 * @since  3.2
	 */
	protected $keyField;

	/**
	 * The valueField.
	 *
	 * @var    string
	 * @since  3.2
	 */
	protected $valueField;

	/**
	 * The translate.
	 *
	 * @var    boolean
	 * @since  3.2
	 */
	protected $translate = false;

	/**
	 * The query.
	 *
	 * @var    string
	 * @since  3.2
	 */
	protected $query;

	/**
	 * Method to get certain otherwise inaccessible properties from the form field object.
	 *
	 * @param   string  $name  The property name for which to get the value.
	 *
	 * @return  mixed  The property value or null.
	 *
	 * @since   3.2
	 */
	public function __get($name)
	{
		switch ($name)
		{
			case 'keyField':
			case 'valueField':
			case 'translate':
			case 'query':
				return $this->$name;
		}

		return parent::__get($name);
	}

	/**
	 * Method to set certain otherwise inaccessible properties of the form field object.
	 *
	 * @param   string  $name   The property name for which to set the value.
	 * @param   mixed   $value  The value of the property.
	 *
	 * @return  void
	 *
	 * @since   3.2
	 */
	public function __set($name, $value)
	{
		switch ($name)
		{
			case 'keyField':
			case 'valueField':
			case 'translate':
			case 'query':
				$this->$name = (string) $value;
				break;

			default:
				parent::__set($name, $value);
		}
	}

	/**
	 * Method to attach a JForm object to the field.
	 *
	 * @param   SimpleXMLElement  $element  The SimpleXMLElement object representing the `<field>` tag for the form field object.
	 * @param   mixed             $value    The form field value to validate.
	 * @param   string            $group    The field name group control value. This acts as an array container for the field.
	 *                                      For example if the field has name="foo" and the group value is set to "bar" then the
	 *                                      full field name would end up being "bar[foo]".
	 *
	 * @return  boolean  True on success.
	 *
	 * @see     JFormField::setup()
	 * @since   3.2
	 */
	public function setup(SimpleXMLElement $element, $value, $group = null)
	{
		$return = parent::setup($element, $value, $group);

		if ($return)
		{
			// Check if its using the old way
			$this->query = (string) $this->element['query'];

			if (empty($this->query))
			{
				// Get the query from the form
				$query    = array();
				$defaults = array();

				$sql_select = (string) $this->element['sql_select'];
				$sql_from   = (string) $this->element['sql_from'];

				if ($sql_select && $sql_from)
				{
					$query['select'] = $sql_select;
					$query['from']   = $sql_from;
					$query['join']   = (string) $this->element['sql_join'];
					$query['where']  = (string) $this->element['sql_where'];
					$query['group']  = (string) $this->element['sql_group'];
					$query['order']  = (string) $this->element['sql_order'];

					// Get the filters
					$filters = isset($this->element['sql_filter']) ? explode(',', $this->element['sql_filter']) : '';

					// Get the default value for query if empty
					if (is_array($filters))
					{
						foreach ($filters as $filter)
						{
							$name   = "sql_default_{$filter}";
							$attrib = (string) $this->element[$name];

							if (!empty($attrib))
							{
								$defaults[$filter] = $attrib;
							}
						}
					}

					// Process the query
					$this->query = $this->processQuery($query, $filters, $defaults);
				}
			}

			$this->keyField   = (string) $this->element['key_field'] ?: 'value';
			$this->valueField = (string) $this->element['value_field'] ?: (string) $this->element['name'];
			$this->translate  = (string) $this->element['translate'] ?: false;
			$this->header     = (string) $this->element['header'] ?: false;
		}

		return $return;
	}

	/**
	 * Method to process the query from form.
	 *
	 * @param   array   $conditions  The conditions from the form.
	 * @param   string  $filters     The columns to filter.
	 * @param   array   $defaults    The defaults value to set if condition is empty.
	 *
	 * @return  JDatabaseQuery  The query object.
	 *
	 * @since   3.5
	 */
	protected function processQuery($conditions, $filters, $defaults)
	{
		// Get the database object.
		$db = JFactory::getDbo();

		// Get the query object
		$query = $db->getQuery(true);

		// Select fields
		$query->select($conditions['select']);

		// From selected table
		$query->from($conditions['from']);

		// Join over the groups
		if (!empty($conditions['join']))
		{
			$query->join('LEFT', $conditions['join']);
		}

		// Where condition
		if (!empty($conditions['where']))
		{
			$query->where($conditions['where']);
		}

		// Group by
		if (!empty($conditions['group']))
		{
			$query->group($conditions['group']);
		}

		// Process the filters
		if (is_array($filters))
		{
			$html_filters = JFactory::getApplication()->getUserStateFromRequest($this->context . '.filter', 'filter', array(), 'array');

			foreach ($filters as $k => $value)
			{
				if (!empty($html_filters[$value]))
				{
					$escape = $db->quote($db->escape($html_filters[$value]), false);

					$query->where("{$value} = {$escape}");
				}
				elseif (!empty($defaults[$value]))
				{
					$escape = $db->quote($db->escape($defaults[$value]), false);

					$query->where("{$value} = {$escape}");
				}
			}
		}

		// Add order to query
		if (!empty($conditions['order']))
		{
			$query->order($conditions['order']);
		}

		return $query;
	}

	/**
	 * Method to get the custom field options.
	 * Use the query attribute to supply a query to generate the list.
	 *
	 * @return  array  The field option objects.
	 *
	 * @since   1.7.0
	 */
	protected function getOptions()
	{
		$options = array();

		// Initialize some field attributes.
		$key   = $this->keyField;
		$value = $this->valueField;
		$header = $this->header;

		if ($this->query)
		{
			// Get the database object.
			$db = JFactory::getDbo();

			// Set the query and get the result list.
			$db->setQuery($this->query);

			try
			{
				$items = $db->loadObjectlist();
			}
			catch (JDatabaseExceptionExecuting $e)
			{
				JFactory::getApplication()->enqueueMessage(JText::_('JERROR_AN_ERROR_HAS_OCCURRED'), 'error');
			}
		}

		// Add header.
		if (!empty($header))
		{
			$header_title = JText::_($header);
			$options[] = JHtml::_('select.option', '', $header_title);
		}

		// Build the field options.
		if (!empty($items))
		{
			foreach ($items as $item)
			{
				if ($this->translate == true)
				{
					$options[] = JHtml::_('select.option', $item->$key, JText::_($item->$value));
				}
				else
				{
					$options[] = JHtml::_('select.option', $item->$key, $item->$value);
				}
			}
		}

		// Merge any additional options in the XML definition.
		$options = array_merge(parent::getOptions(), $options);

		return $options;
	}
}
number.php000060400000011446152457271650006565 0ustar00<?php
/**
 * @package     Joomla.Platform
 * @subpackage  Form
 *
 * @copyright   (C) 2013 Open Source Matters, Inc. <https://www.joomla.org>
 * @license     GNU General Public License version 2 or later; see LICENSE
 */

defined('JPATH_PLATFORM') or die;

/**
 * Form Field class for the Joomla Platform.
 * Provides a one line text box with up-down handles to set a number in the field.
 *
 * @link   http://www.w3.org/TR/html-markup/input.text.html#input.text
 * @since  3.2
 */
class JFormFieldNumber extends JFormField
{
	/**
	 * The form field type.
	 *
	 * @var    string
	 * @since  3.2
	 */
	protected $type = 'Number';

	/**
	 * The allowable maximum value of the field.
	 *
	 * @var    float
	 * @since  3.2
	 */
	protected $max = null;

	/**
	 * The allowable minimum value of the field.
	 *
	 * @var    float
	 * @since  3.2
	 */
	protected $min = null;

	/**
	 * The step by which value of the field increased or decreased.
	 *
	 * @var    float
	 * @since  3.2
	 */
	protected $step = 0;

	/**
	 * Name of the layout being used to render the field
	 *
	 * @var    string
	 * @since  3.7
	 */
	protected $layout = 'joomla.form.field.number';

	/**
	 * Method to get certain otherwise inaccessible properties from the form field object.
	 *
	 * @param   string  $name  The property name for which to get the value.
	 *
	 * @return  mixed  The property value or null.
	 *
	 * @since   3.2
	 */
	public function __get($name)
	{
		switch ($name)
		{
			case 'max':
			case 'min':
			case 'step':
				return $this->$name;
		}

		return parent::__get($name);
	}

	/**
	 * Method to set certain otherwise inaccessible properties of the form field object.
	 *
	 * @param   string  $name   The property name for which to set the value.
	 * @param   mixed   $value  The value of the property.
	 *
	 * @return  void
	 *
	 * @since   3.2
	 */
	public function __set($name, $value)
	{
		switch ($name)
		{
			case 'step':
			case 'min':
			case 'max':
				$this->$name = (float) $value;
				break;

			default:
				parent::__set($name, $value);
		}
	}

	/**
	 * Method to attach a JForm object to the field.
	 *
	 * @param   SimpleXMLElement  $element  The SimpleXMLElement object representing the `<field>` tag for the form field object.
	 * @param   mixed             $value    The form field value to validate.
	 * @param   string            $group    The field name group control value. This acts as an array container for the field.
	 *                                      For example if the field has name="foo" and the group value is set to "bar" then the
	 *                                      full field name would end up being "bar[foo]".
	 *
	 * @return  boolean  True on success.
	 *
	 * @see     JFormField::setup()
	 * @since   3.2
	 */
	public function setup(SimpleXMLElement $element, $value, $group = null)
	{
		$return = parent::setup($element, $value, $group);

		if ($return)
		{
			// It is better not to force any default limits if none is specified
			$this->max  = isset($this->element['max']) ? (float) $this->element['max'] : null;
			$this->min  = isset($this->element['min']) ? (float) $this->element['min'] : null;
			$this->step = isset($this->element['step']) ? (float) $this->element['step'] : 1;
		}

		return $return;
	}

	/**
	 * Method to get the field input markup.
	 *
	 * @return  string  The field input markup.
	 *
	 * @since   3.2
	 */
	protected function getInput()
	{
		if ($this->element['useglobal'])
		{
			$component = JFactory::getApplication()->input->getCmd('option');

			// Get correct component for menu items
			if ($component == 'com_menus')
			{
				$link      = $this->form->getData()->get('link');
				$uri       = new JUri($link);
				$component = $uri->getVar('option', 'com_menus');
			}

			$params = JComponentHelper::getParams($component);
			$value  = $params->get($this->fieldname);

			// Try with global configuration
			if (is_null($value))
			{
				$value = JFactory::getConfig()->get($this->fieldname);
			}

			// Try with menu configuration
			if (is_null($value) && JFactory::getApplication()->input->getCmd('option') == 'com_menus')
			{
				$value = JComponentHelper::getParams('com_menus')->get($this->fieldname);
			}

			if (!is_null($value))
			{
				$value = (string) $value;

				$this->hint = JText::sprintf('JGLOBAL_USE_GLOBAL_VALUE', $value);
			}
		}

		// Trim the trailing line in the layout file
		return rtrim($this->getRenderer($this->layout)->render($this->getLayoutData()), PHP_EOL);
	}

	/**
	 * Method to get the data to be passed to the layout for rendering.
	 *
	 * @return  array
	 *
	 * @since 3.7
	 */
	protected function getLayoutData()
	{
		$data = parent::getLayoutData();

		// Initialize some field attributes.
		$extraData = array(
			'max'   => $this->max,
			'min'   => $this->min,
			'step'  => $this->step,
			'value' => $this->value,
		);

		return array_merge($data, $extraData);
	}
}
databaseconnection.php000060400000003774152457271650011126 0ustar00<?php
/**
 * @package     Joomla.Platform
 * @subpackage  Form
 *
 * @copyright   (C) 2011 Open Source Matters, Inc. <https://www.joomla.org>
 * @license     GNU General Public License version 2 or later; see LICENSE
 */

defined('JPATH_PLATFORM') or die;

JFormHelper::loadFieldClass('list');

/**
 * Form Field class for the Joomla Platform.
 * Provides a list of available database connections, optionally limiting to
 * a given list.
 *
 * @see    JDatabaseDriver
 * @since  1.7.3
 */
class JFormFieldDatabaseConnection extends JFormFieldList
{
	/**
	 * The form field type.
	 *
	 * @var    string
	 * @since  1.7.3
	 */
	protected $type = 'DatabaseConnection';

	/**
	 * Method to get the list of database options.
	 *
	 * This method produces a drop down list of available databases supported
	 * by JDatabaseDriver classes that are also supported by the application.
	 *
	 * @return  array  The field option objects.
	 *
	 * @since   1.7.3
	 * @see     JDatabaseDriver::getConnectors()
	 */
	protected function getOptions()
	{
		// This gets the connectors available in the platform and supported by the server.
		$available = JDatabaseDriver::getConnectors();

		/**
		 * This gets the list of database types supported by the application.
		 * This should be entered in the form definition as a comma separated list.
		 * If no supported databases are listed, it is assumed all available databases
		 * are supported.
		 */
		$supported = $this->element['supported'];

		if (!empty($supported))
		{
			$supported = explode(',', $supported);

			foreach ($supported as $support)
			{
				if (in_array($support, $available))
				{
					$options[$support] = JText::_(ucfirst($support));
				}
			}
		}
		else
		{
			foreach ($available as $support)
			{
				$options[$support] = JText::_(ucfirst($support));
			}
		}

		// This will come into play if an application is installed that requires
		// a database that is not available on the server.
		if (empty($options))
		{
			$options[''] = JText::_('JNONE');
		}

		return $options;
	}
}
folderlist.php000060400000012564152457271650007446 0ustar00<?php
/**
 * @package     Joomla.Platform
 * @subpackage  Form
 *
 * @copyright   (C) 2010 Open Source Matters, Inc. <https://www.joomla.org>
 * @license     GNU General Public License version 2 or later; see LICENSE
 */

defined('JPATH_PLATFORM') or die;

jimport('joomla.filesystem.folder');
jimport('joomla.filesystem.path');

JFormHelper::loadFieldClass('list');

/**
 * Supports an HTML select list of folder
 *
 * @since  1.7.0
 */
class JFormFieldFolderList extends JFormFieldList
{
	/**
	 * The form field type.
	 *
	 * @var    string
	 * @since  1.7.0
	 */
	protected $type = 'FolderList';

	/**
	 * The filter.
	 *
	 * @var    string
	 * @since  3.2
	 */
	protected $filter;

	/**
	 * The exclude.
	 *
	 * @var    string
	 * @since  3.2
	 */
	protected $exclude;

	/**
	 * The recursive.
	 *
	 * @var    string
	 * @since  3.6
	 */
	protected $recursive;

	/**
	 * The hideNone.
	 *
	 * @var    boolean
	 * @since  3.2
	 */
	protected $hideNone = false;

	/**
	 * The hideDefault.
	 *
	 * @var    boolean
	 * @since  3.2
	 */
	protected $hideDefault = false;

	/**
	 * The directory.
	 *
	 * @var    string
	 * @since  3.2
	 */
	protected $directory;

	/**
	 * Method to get certain otherwise inaccessible properties from the form field object.
	 *
	 * @param   string  $name  The property name for which to get the value.
	 *
	 * @return  mixed  The property value or null.
	 *
	 * @since   3.2
	 */
	public function __get($name)
	{
		switch ($name)
		{
			case 'filter':
			case 'exclude':
			case 'recursive':
			case 'hideNone':
			case 'hideDefault':
			case 'directory':
				return $this->$name;
		}

		return parent::__get($name);
	}

	/**
	 * Method to set certain otherwise inaccessible properties of the form field object.
	 *
	 * @param   string  $name   The property name for which to set the value.
	 * @param   mixed   $value  The value of the property.
	 *
	 * @return  void
	 *
	 * @since   3.2
	 */
	public function __set($name, $value)
	{
		switch ($name)
		{
			case 'filter':
			case 'directory':
			case 'exclude':
			case 'recursive':
				$this->$name = (string) $value;
				break;

			case 'hideNone':
			case 'hideDefault':
				$value = (string) $value;
				$this->$name = ($value === 'true' || $value === $name || $value === '1');
				break;

			default:
				parent::__set($name, $value);
		}
	}

	/**
	 * Method to attach a JForm object to the field.
	 *
	 * @param   SimpleXMLElement  $element  The SimpleXMLElement object representing the `<field>` tag for the form field object.
	 * @param   mixed             $value    The form field value to validate.
	 * @param   string            $group    The field name group control value. This acts as an array container for the field.
	 *                                      For example if the field has name="foo" and the group value is set to "bar" then the
	 *                                      full field name would end up being "bar[foo]".
	 *
	 * @return  boolean  True on success.
	 *
	 * @see     JFormField::setup()
	 * @since   3.2
	 */
	public function setup(SimpleXMLElement $element, $value, $group = null)
	{
		$return = parent::setup($element, $value, $group);

		if ($return)
		{
			$this->filter  = (string) $this->element['filter'];
			$this->exclude = (string) $this->element['exclude'];

			$recursive       = (string) $this->element['recursive'];
			$this->recursive = ($recursive == 'true' || $recursive == 'recursive' || $recursive == '1');

			$hideNone       = (string) $this->element['hide_none'];
			$this->hideNone = ($hideNone == 'true' || $hideNone == 'hideNone' || $hideNone == '1');

			$hideDefault       = (string) $this->element['hide_default'];
			$this->hideDefault = ($hideDefault == 'true' || $hideDefault == 'hideDefault' || $hideDefault == '1');

			// Get the path in which to search for file options.
			$this->directory = (string) $this->element['directory'];
		}

		return $return;
	}

	/**
	 * Method to get the field options.
	 *
	 * @return  array  The field option objects.
	 *
	 * @since   1.7.0
	 */
	protected function getOptions()
	{
		$options = array();

		$path = $this->directory;

		if (!is_dir($path))
		{
			if (is_dir(JPATH_ROOT . '/' . $path))
			{
				$path = JPATH_ROOT . '/' . $path;
			}
			else 
			{
				return;
			}
		}

		$path = JPath::clean($path);

		// Prepend some default options based on field attributes.
		if (!$this->hideNone)
		{
			$options[] = JHtml::_('select.option', '-1', JText::alt('JOPTION_DO_NOT_USE', preg_replace('/[^a-zA-Z0-9_\-]/', '_', $this->fieldname)));
		}

		if (!$this->hideDefault)
		{
			$options[] = JHtml::_('select.option', '', JText::alt('JOPTION_USE_DEFAULT', preg_replace('/[^a-zA-Z0-9_\-]/', '_', $this->fieldname)));
		}

		// Get a list of folders in the search path with the given filter.
		$folders = JFolder::folders($path, $this->filter, $this->recursive, true);

		// Build the options list from the list of folders.
		if (is_array($folders))
		{
			foreach ($folders as $folder)
			{
				// Remove the root part and the leading /
				$folder = trim(str_replace($path, '', $folder), '/');

				// Check to see if the file is in the exclude mask.
				if ($this->exclude)
				{
					if (preg_match(chr(1) . $this->exclude . chr(1), $folder))
					{
						continue;
					}
				}

				$options[] = JHtml::_('select.option', $folder, $folder);
			}
		}

		// Merge any additional options in the XML definition.
		$options = array_merge(parent::getOptions(), $options);

		return $options;
	}
}