diff --git a/administrator/components/com_admin/script.php b/administrator/components/com_admin/script.php index e27036715fb5d..c69b3f3acdee6 100644 --- a/administrator/components/com_admin/script.php +++ b/administrator/components/com_admin/script.php @@ -242,6 +242,7 @@ protected function updateManifestCaches() array('component', 'com_contenthistory', '', 1), array('component', 'com_postinstall', '', 1), array('component', 'com_joomlaupdate', '', 1), + array('component', 'com_fields', '', 1), // Libraries array('library', 'phputf8', '', 0), @@ -349,6 +350,8 @@ protected function updateManifestCaches() array('plugin', 'phpversioncheck', 'quickicon', 0), array('plugin', 'menu', 'editors-xtd', 0), array('plugin', 'contact', 'editors-xtd', 0), + array('plugin', 'fields', 'system', 0), + array('plugin', 'gallery', 'fields', 0), // Templates array('template', 'beez3', '', 0), @@ -1449,7 +1452,7 @@ public function deleteUnexistingFiles() '/media/editors/tinymce/plugins/compat3x/editable_selects.js', '/media/editors/tinymce/plugins/compat3x/form_utils.js', '/media/editors/tinymce/plugins/compat3x/mctabs.js', - '/media/editors/tinymce/plugins/compat3x/tiny_mce_popup.js', + '/media/editors/tinymce/plugins/compat3x/tiny_mce_popup.js', '/media/editors/tinymce/plugins/compat3x/validate.js', '/libraries/vendor/symfony/yaml/Symfony/Component/Yaml/Dumper.php', '/libraries/vendor/symfony/yaml/Symfony/Component/Yaml/Escaper.php', @@ -1695,7 +1698,8 @@ public function updateAssets() 'com_tags', 'com_contenthistory', 'com_ajax', - 'com_postinstall' + 'com_postinstall', + 'com_fields', ); foreach ($newComponents as $component) diff --git a/administrator/components/com_admin/sql/updates/mysql/3.7.0-2016-08-29.sql b/administrator/components/com_admin/sql/updates/mysql/3.7.0-2016-08-29.sql new file mode 100644 index 0000000000000..94a7880ec9d16 --- /dev/null +++ b/administrator/components/com_admin/sql/updates/mysql/3.7.0-2016-08-29.sql @@ -0,0 +1,58 @@ +CREATE TABLE IF NOT EXISTS `#__fields` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `asset_id` int(10) NOT NULL DEFAULT 0, + `context` varchar(255) NOT NULL DEFAULT '', + `catid` int(10) NOT NULL DEFAULT 0, + `assigned_cat_ids` varchar(255) NOT NULL DEFAULT '', + `title` varchar(255) NOT NULL DEFAULT '', + `alias` varchar(255) NOT NULL DEFAULT '', + `label` varchar(255) NOT NULL DEFAULT '', + `default_value` text NOT NULL DEFAULT '', + `type` varchar(255) NOT NULL DEFAULT 'text', + `options` varchar(255) NOT NULL DEFAULT '', + `note` varchar(255) NOT NULL DEFAULT '', + `description` text NOT NULL, + `state` tinyint(1) NOT NULL DEFAULT '0', + `required` tinyint(1) NOT NULL DEFAULT '0', + `checked_out` int(11) NOT NULL DEFAULT '0', + `checked_out_time` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + `ordering` int(11) NOT NULL DEFAULT '0', + `params` text NOT NULL, + `fieldparams` text NOT NULL, + `attributes` text NOT NULL, + `language` char(7) NOT NULL DEFAULT '', + `created_time` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + `created_user_id` int(10) unsigned NOT NULL DEFAULT '0', + `created_by_alias` varchar(255) NOT NULL DEFAULT '', + `version` int(10) unsigned NOT NULL DEFAULT '0', + `modified_time` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + `modified_by` int(10) unsigned NOT NULL DEFAULT '0', + `publish_up` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + `publish_down` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + `access` int(11) NOT NULL DEFAULT '1', + `hits` int(10) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`id`), + KEY `idx_checkout` (`checked_out`), + KEY `idx_state` (`state`), + KEY `idx_created_user_id` (`created_user_id`), + KEY `idx_access` (`access`), + KEY `idx_context` (`context`), + KEY `idx_language` (`language`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_unicode_ci; + +CREATE TABLE IF NOT EXISTS `#__fields_values` ( + `field_id` int(10) unsigned NOT NULL, + `context` varchar(255) NOT NULL, + `item_id` varchar(255) NOT NULL COMMENT 'Allow references to items which have strings as ids, eg. none db systems.', + `value` text NOT NULL DEFAULT '', + KEY (`field_id`), + KEY (`context`), + KEY (`item_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_unicode_ci; + +INSERT INTO `#__extensions` (`extension_id`, `name`, `type`, `element`, `folder`, `client_id`, `enabled`, `access`, `protected`, `manifest_cache`, `params`, `custom_data`, `system_data`, `checked_out`, `checked_out_time`, `ordering`, `state`) VALUES +(33, 'com_fields', 'component', 'com_fields', '', 1, 1, 1, 0, '', '', '', '', 0, '0000-00-00 00:00:00', 0, 0); +INSERT INTO `#__extensions` (`extension_id`, `name`, `type`, `element`, `folder`, `client_id`, `enabled`, `access`, `protected`, `manifest_cache`, `params`, `custom_data`, `system_data`, `checked_out`, `checked_out_time`, `ordering`, `state`) VALUES +(461, 'plg_system_fields', 'plugin', 'fields', 'system', 0, 1, 1, 0, '', '', '', '', 0, '0000-00-00 00:00:00', 0, 0); +INSERT INTO `#__extensions` (`extension_id`, `name`, `type`, `element`, `folder`, `client_id`, `enabled`, `access`, `protected`, `manifest_cache`, `params`, `custom_data`, `system_data`, `checked_out`, `checked_out_time`, `ordering`, `state`) VALUES +(462, 'plg_fields_gallery', 'plugin', 'gallery', 'fields', 0, 1, 1, 0, '', '', '', '', 0, '0000-00-00 00:00:00', 0, 0); diff --git a/administrator/components/com_admin/sql/updates/postgresql/3.7.0-2016-08-29.sql b/administrator/components/com_admin/sql/updates/postgresql/3.7.0-2016-08-29.sql new file mode 100644 index 0000000000000..0f6659c44f3c9 --- /dev/null +++ b/administrator/components/com_admin/sql/updates/postgresql/3.7.0-2016-08-29.sql @@ -0,0 +1,63 @@ +-- +-- Table: #__fields +-- +CREATE TABLE "#__fields" ( + "id" serial NOT NULL, + "asset_id" bigint DEFAULT 0 NOT NULL, + "context" varchar(255) DEFAULT '' NOT NULL, + "catid" bigint DEFAULT 0 NOT NULL, + "assigned_cat_ids" varchar(255) DEFAULT '' NOT NULL, + "title" varchar(255) DEFAULT '' NOT NULL, + "alias" varchar(255) DEFAULT '' NOT NULL, + "label" varchar(255) DEFAULT '' NOT NULL, + "default_value" text DEFAULT '' NOT NULL, + "type" varchar(255) DEFAULT 'text' NOT NULL, + "options" varchar(255) DEFAULT '' NOT NULL, + "note" varchar(255) DEFAULT '' NOT NULL, + "description" text DEFAULT '' NOT NULL, + "state" smallint DEFAULT 0 NOT NULL, + "required" smallint DEFAULT 0 NOT NULL, + "checked_out" integer DEFAULT 0 NOT NULL, + "checked_out_time" timestamp without time zone DEFAULT '1970-01-01 00:00:00' NOT NULL, + "ordering" bigint DEFAULT 0 NOT NULL, + "params" text DEFAULT '' NOT NULL, + "fieldparams" text DEFAULT '' NOT NULL, + "attributes" text DEFAULT '' NOT NULL, + "language" varchar(7) DEFAULT '' NOT NULL, + "created_time" timestamp without time zone DEFAULT '1970-01-01 00:00:00' NOT NULL, + "created_user_id" bigint DEFAULT 0 NOT NULL, + "created_by_alias" varchar(255) DEFAULT '' NOT NULL, + "version" bigint DEFAULT 0 NOT NULL, + "modified_time" timestamp without time zone DEFAULT '1970-01-01 00:00:00' NOT NULL, + "modified_by" bigint DEFAULT 0 NOT NULL, + "publish_up" timestamp without time zone DEFAULT '1970-01-01 00:00:00' NOT NULL, + "publish_down" timestamp without time zone DEFAULT '1970-01-01 00:00:00' NOT NULL, + "access" bigint DEFAULT 0 NOT NULL, + "hits" integer DEFAULT 0 NOT NULL, + PRIMARY KEY ("id") +); +CREATE INDEX "#__fields_idx_checked_out" ON "#__fields" ("checked_out"); +CREATE INDEX "#__fields_idx_state" ON "#__fields" ("state"); +CREATE INDEX "#__fields_idx_created_user_id" ON "#__fields" ("created_user_id"); +CREATE INDEX "#__fields_idx_access" ON "#__fields" ("access"); +CREATE INDEX "#__fields_idx_context" ON "#__fields" ("context"); +CREATE INDEX "#__fields_idx_language" ON "#__fields" ("language"); + +-- +-- Table: #__fields_values +-- +CREATE TABLE "#__fields_values" ( +"field_id" bigint DEFAULT 0 NOT NULL, +"item_id" varchar(255) DEFAULT '' NOT NULL, +"context" varchar(255) DEFAULT '' NOT NULL, +"value" text DEFAULT '' NOT NULL +); +CREATE INDEX "#__fields_values_idx_field_id" ON "#__fields_values" ("field_id"); +CREATE INDEX "#__fields_values_idx_context" ON "#__fields_values" ("context"); +CREATE INDEX "#__fields_values_idx_item_id" ON "#__fields_values" ("item_id"); + +INSERT INTO "#__extensions" ("extension_id", "name", "type", "element", "folder", "client_id", "enabled", "access", "protected", "manifest_cache", "params", "custom_data", "system_data", "checked_out", "checked_out_time", "ordering", "state") VALUES +(33, 'com_fields', 'component', 'com_fields', '', 1, 1, 1, 1, '', '', '', '', 0, '1970-01-01 00:00:00', 0, 0), +(461, 'plg_system_fields', 'plugin', 'fields', 'system', 0, 1, 1, 0, '', '', '', '', 0, '1970-01-01 00:00:00', 0, 0), +(462, 'plg_fields_gallery', 'plugin', 'gallery', 'fields', 0, 1, 1, 0, '', '', '', '', 0, '1970-01-01 00:00:00', 0, 0); + diff --git a/administrator/components/com_banners/models/fields/bannerclient.php b/administrator/components/com_banners/models/fields/bannerclient.php index ec9281ed9a341..1351a2afa1827 100644 --- a/administrator/components/com_banners/models/fields/bannerclient.php +++ b/administrator/components/com_banners/models/fields/bannerclient.php @@ -9,8 +9,6 @@ defined('JPATH_BASE') or die; -JFormHelper::loadFieldClass('list'); - JLoader::register('BannersHelper', JPATH_ADMINISTRATOR . '/components/com_banners/helpers/banners.php'); /** @@ -18,7 +16,7 @@ * * @since 1.6 */ -class JFormFieldBannerClient extends JFormFieldList +class JFormFieldBannerClient extends JFormAbstractlist { /** * The form field type. diff --git a/administrator/components/com_categories/models/categories.php b/administrator/components/com_categories/models/categories.php index 12436c0824bb2..8a40d397e9c35 100644 --- a/administrator/components/com_categories/models/categories.php +++ b/administrator/components/com_categories/models/categories.php @@ -370,13 +370,19 @@ public function getItems() */ public function countItems(&$items, $extension) { - $parts = explode('.', $extension); + $parts = explode('.', $extension, 2); $component = $parts[0]; $section = null; if (count($parts) > 1) { $section = $parts[1]; + + // If the section ends with .fields, then the category belongs to com_fields + if (substr($section, -strlen('.fields')) === '.fields') + { + $component = 'com_fields'; + } } // Try to find the component helper. diff --git a/administrator/components/com_categories/models/fields/categoryedit.php b/administrator/components/com_categories/models/fields/categoryedit.php index 5b7fc7ce90dfb..8adbe0508ea3b 100644 --- a/administrator/components/com_categories/models/fields/categoryedit.php +++ b/administrator/components/com_categories/models/fields/categoryedit.php @@ -11,14 +11,12 @@ use Joomla\Utilities\ArrayHelper; -JFormHelper::loadFieldClass('list'); - /** * Form Field class for the Joomla Framework. * * @since 1.6 */ -class JFormFieldCategoryEdit extends JFormFieldList +class JFormFieldCategoryEdit extends JFormAbstractlist { /** * To allow creation of new categories. diff --git a/administrator/components/com_categories/models/fields/categoryparent.php b/administrator/components/com_categories/models/fields/categoryparent.php index bbb4954f7e81a..67e36f0704bba 100644 --- a/administrator/components/com_categories/models/fields/categoryparent.php +++ b/administrator/components/com_categories/models/fields/categoryparent.php @@ -9,14 +9,12 @@ defined('JPATH_BASE') or die; -JFormHelper::loadFieldClass('list'); - /** * Form Field class for the Joomla Framework. * * @since 1.6 */ -class JFormFieldCategoryParent extends JFormFieldList +class JFormFieldCategoryParent extends JFormAbstractlist { /** * The form field type. diff --git a/administrator/components/com_categories/views/categories/tmpl/default.php b/administrator/components/com_categories/views/categories/tmpl/default.php index aa388b7289bac..da9fec00f58da 100644 --- a/administrator/components/com_categories/views/categories/tmpl/default.php +++ b/administrator/components/com_categories/views/categories/tmpl/default.php @@ -25,7 +25,7 @@ $listOrder = $this->escape($this->state->get('list.ordering')); $listDirn = $this->escape($this->state->get('list.direction')); $saveOrder = ($listOrder == 'a.lft' && strtolower($listDirn) == 'asc'); -$parts = explode('.', $extension); +$parts = explode('.', $extension, 2); $component = $parts[0]; $section = null; $columns = 7; @@ -40,6 +40,13 @@ { $section = $inflector->toPlural($section); } + + // If the section ends with .fields, then the category belongs to com_fields + if (substr($section, -strlen('.fields')) === '.fields') + { + $component = 'com_fields'; + $section = 'fields&context=' . str_replace('.fields', '', implode('.', $parts)); + } } if ($saveOrder) diff --git a/administrator/components/com_config/model/form/application.xml b/administrator/components/com_config/model/form/application.xml index 0e60be69d120b..7044291ae91a2 100644 --- a/administrator/components/com_config/model/form/application.xml +++ b/administrator/components/com_config/model/form/application.xml @@ -1077,6 +1077,10 @@ name="core.edit.own" title="JACTION_EDITOWN" description="COM_CONFIG_ACTION_EDITOWN_DESC" /> + diff --git a/administrator/components/com_contact/access.xml b/administrator/components/com_contact/access.xml index bec45dc97d690..911c69072684b 100644 --- a/administrator/components/com_contact/access.xml +++ b/administrator/components/com_contact/access.xml @@ -9,6 +9,7 @@ +
diff --git a/administrator/components/com_contact/config.xml b/administrator/components/com_contact/config.xml index 80c50d21a08da..093077862fdd5 100644 --- a/administrator/components/com_contact/config.xml +++ b/administrator/components/com_contact/config.xml @@ -337,6 +337,17 @@ + + + + JNO + + + + +
params->get('custom_fields_enable', '1')) + { + JHtmlSidebar::addEntry( + JText::_('JGLOBAL_FIELDS'), + 'index.php?option=com_fields&context=com_contact.contact', + $vName == 'fields.contact' + ); + JHtmlSidebar::addEntry( + JText::_('JGLOBAL_FIELD_GROUPS'), + 'index.php?option=com_categories&extension=com_contact.contact.fields', + $vName == 'categories.contact' + ); + } } /** diff --git a/administrator/components/com_contact/models/forms/contact.xml b/administrator/components/com_contact/models/forms/contact.xml index ba12c81fe591c..ea23f60bc03cf 100644 --- a/administrator/components/com_contact/models/forms/contact.xml +++ b/administrator/components/com_contact/models/forms/contact.xml @@ -714,6 +714,17 @@ + + + + +
+ +
+ + + + +
+
+
diff --git a/administrator/components/com_content/access.xml b/administrator/components/com_content/access.xml index 49aa10819ead2..f43aaac7069af 100644 --- a/administrator/components/com_content/access.xml +++ b/administrator/components/com_content/access.xml @@ -9,6 +9,7 @@ +
diff --git a/administrator/components/com_content/config.xml b/administrator/components/com_content/config.xml index 886a3954549c7..4b5e160ee30d0 100644 --- a/administrator/components/com_content/config.xml +++ b/administrator/components/com_content/config.xml @@ -1013,6 +1013,18 @@ + + + + +
params->get('custom_fields_enable', '1')) + { + JHtmlSidebar::addEntry( + JText::_('JGLOBAL_FIELDS'), + 'index.php?option=com_fields&context=com_content.article', + $vName == 'fields.article' + ); + JHtmlSidebar::addEntry( + JText::_('JGLOBAL_FIELD_GROUPS'), + 'index.php?option=com_categories&extension=com_content.article.fields', + $vName == 'categories.article' + ); + } + JHtmlSidebar::addEntry( JText::_('COM_CONTENT_SUBMENU_FEATURED'), 'index.php?option=com_content&view=featured', diff --git a/administrator/components/com_content/models/fields/modal/article.php b/administrator/components/com_content/models/fields/modal/article.php index b968b79eb4b30..3447c316f4abd 100644 --- a/administrator/components/com_content/models/fields/modal/article.php +++ b/administrator/components/com_content/models/fields/modal/article.php @@ -14,7 +14,7 @@ * * @since 1.6 */ -class JFormFieldModal_Article extends JFormField +class JFormFieldModal_Article extends JFormField implements JFormDomfieldinterface { /** * The form field type. diff --git a/administrator/components/com_fields/access.xml b/administrator/components/com_fields/access.xml new file mode 100644 index 0000000000000..0a1ddce88d5ad --- /dev/null +++ b/administrator/components/com_fields/access.xml @@ -0,0 +1,19 @@ + + +
+ + + + + + +
+
+ + + + + + +
+
diff --git a/administrator/components/com_fields/controller.php b/administrator/components/com_fields/controller.php new file mode 100644 index 0000000000000..4dd5041903367 --- /dev/null +++ b/administrator/components/com_fields/controller.php @@ -0,0 +1,98 @@ +context)) + { + $this->context = $this->input->get('context', 'com_content'); + } + } + + /** + * Typical view method for MVC based architecture + * + * This function is provide as a default implementation, in most cases + * you will need to override it in your own controllers. + * + * @param boolean $cachable If true, the view output will be cached + * @param array $urlparams An array of safe url parameters and their variable types, for valid values see {@link JFilterInput::clean()}. + * + * @return JControllerLegacy A JControllerLegacy object to support chaining. + * + * @since __DEPLOY_VERSION__ + */ + public function display($cachable = false, $urlparams = false) + { + // Get the document object. + $document = JFactory::getDocument(); + + // Set the default view name and format from the Request. + $vName = $this->input->get('view', 'fields'); + $vFormat = $document->getType(); + $lName = $this->input->get('layout', 'default', 'string'); + $id = $this->input->getInt('id'); + + // Check for edit form. + if ($vName == 'field' && $lName == 'edit' && !$this->checkEditId('com_fields.edit.field', $id)) + { + // Somehow the person just went to the form - we don't allow that. + $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_UNHELD_ID', $id)); + $this->setMessage($this->getError(), 'error'); + $this->setRedirect(JRoute::_('index.php?option=com_fields&view=fields&context=' . $this->context, false)); + + return false; + } + + // Get and render the view. + if ($view = $this->getView($vName, $vFormat)) + { + // Get the model for the view. + $model = $this->getModel( + $vName, 'FieldsModel', array( + 'name' => $vName . '.' . substr($this->context, 4) + ) + ); + + // Push the model into the view (as default). + $view->setModel($model, true); + $view->setLayout($lName); + + // Push document object into the view. + $view->document = $document; + + FieldsHelperInternal::addSubmenu($model->getState('filter.context')); + $view->display(); + } + + return $this; + } +} diff --git a/administrator/components/com_fields/controllers/field.php b/administrator/components/com_fields/controllers/field.php new file mode 100644 index 0000000000000..b65977738a089 --- /dev/null +++ b/administrator/components/com_fields/controllers/field.php @@ -0,0 +1,214 @@ +internalContext = $this->input->getCmd('context', 'com_content.article'); + $parts = FieldsHelper::extract($this->internalContext); + $this->component = $parts ? $parts[0] : null; + } + + /** + * Stores the form data into the user state. + * + * @return void + * + * @since __DEPLOY_VERSION__ + */ + public function storeform() + { + JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); + + $app = JFactory::getApplication(); + $data = $this->input->get($this->input->get('formcontrol', 'jform'), array(), 'array'); + + $parts = FieldsHelper::extract($this->input->getCmd('context')); + + if ($parts) + { + $app->setUserState($parts[0] . '.edit.' . $parts[1] . '.data', $data); + } + + if ($this->input->get('userstatevariable')) + { + $app->setUserState($this->input->get('userstatevariable'), $data); + } + + $app->redirect(base64_decode($this->input->get->getBase64('return'))); + $app->close(); + } + + /** + * Method override to check if you can add a new record. + * + * @param array $data An array of input data. + * + * @return boolean + * + * @since __DEPLOY_VERSION__ + */ + protected function allowAdd($data = array()) + { + return JFactory::getUser()->authorise('core.create', $this->component); + } + + /** + * Method override to check if you can edit an existing record. + * + * @param array $data An array of input data. + * @param string $key The name of the key for the primary key. + * + * @return boolean + * + * @since 1.6 + */ + protected function allowEdit($data = array(), $key = 'parent_id') + { + $recordId = (int) isset($data[$key]) ? $data[$key] : 0; + $user = JFactory::getUser(); + $userId = $user->get('id'); + + // Check general edit permission first. + if ($user->authorise('core.edit', $this->component)) + { + return true; + } + + // Check specific edit permission. + if ($user->authorise('core.edit', $this->internalContext . '.field.' . $recordId)) + { + return true; + } + + // Fallback on edit.own. + // First test if the permission is available. + if ($user->authorise('core.edit.own', $this->internalContext . '.field.' . $recordId) || $user->authorise('core.edit.own', $this->component)) + { + // Now test the owner is the user. + $ownerId = (int) isset($data['created_user_id']) ? $data['created_user_id'] : 0; + + if (empty($ownerId) && $recordId) + { + // Need to do a lookup from the model. + $record = $this->getModel()->getItem($recordId); + + if (empty($record)) + { + return false; + } + + $ownerId = $record->created_user_id; + } + + // If the owner matches 'me' then do the test. + if ($ownerId == $userId) + { + return true; + } + } + + return false; + } + + /** + * Method to run batch operations. + * + * @param object $model The model. + * + * @return boolean True if successful, false otherwise and internal error is set. + * + * @since __DEPLOY_VERSION__ + */ + public function batch($model = null) + { + JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN')); + + // Set the model + $model = $this->getModel('Field'); + + // Preset the redirect + $this->setRedirect('index.php?option=com_fields&view=fields&context=' . $this->internalContext); + + return parent::batch($model); + } + + /** + * Gets the URL arguments to append to an item redirect. + * + * @param integer $recordId The primary key id for the item. + * @param string $urlVar The name of the URL variable for the id. + * + * @return string The arguments to append to the redirect URL. + * + * @since __DEPLOY_VERSION__ + */ + protected function getRedirectToItemAppend($recordId = null, $urlVar = 'id') + { + return parent::getRedirectToItemAppend($recordId) . '&context=' . $this->internalContext; + } + + /** + * Gets the URL arguments to append to a list redirect. + * + * @return string The arguments to append to the redirect URL. + * + * @since __DEPLOY_VERSION__ + */ + protected function getRedirectToListAppend() + { + return parent::getRedirectToListAppend() . '&context=' . $this->internalContext; + } + + /** + * Function that allows child controller access to model data after the data has been saved. + * + * @param JModelLegacy $model The data model object. + * @param array $validData The validated data. + * + * @return void + * + * @since __DEPLOY_VERSION__ + */ + protected function postSaveHook(JModelLegacy $model, $validData = array()) + { + $item = $model->getItem(); + + if (isset($item->params) && is_array($item->params)) + { + $registry = new Registry; + $registry->loadArray($item->params); + $item->params = (string) $registry; + } + + return; + } +} diff --git a/administrator/components/com_fields/controllers/fields.php b/administrator/components/com_fields/controllers/fields.php new file mode 100644 index 0000000000000..a7c7ca53d2880 --- /dev/null +++ b/administrator/components/com_fields/controllers/fields.php @@ -0,0 +1,93 @@ +setRedirect( + JRoute::_('index.php?option=' . $this->option . '&view=' . $this->view_list . + '&context=' . $this->input->getCmd('context', 'com_content.article'), false + ) + ); + + return $return; + } + + /** + * Removes an item + * + * @return void + * + * @since __DEPLOY_VERSION__ + */ + public function delete() + { + $return = parent::delete(); + + $this->setRedirect( + JRoute::_('index.php?option=' . $this->option . '&view=' . $this->view_list . + '&context=' . $this->input->getCmd('context', 'com_content.article'), false + ) + ); + + return $return; + } + + /** + * Method to publish a list of items + * + * @return void + * + * @since __DEPLOY_VERSION__ + */ + public function publish() + { + $return = parent::publish(); + + $this->setRedirect( + JRoute::_('index.php?option=' . $this->option . '&view=' . $this->view_list . + '&context=' . $this->input->getCmd('context', 'com_content.article'), false + ) + ); + + return $return; + } + + /** + * Proxy for getModel. + * + * @param string $name The model name. Optional. + * @param string $prefix The class prefix. Optional. + * @param array $config The array of possible config values. Optional. + * + * @return JModel + * + * @since __DEPLOY_VERSION__ + */ + public function getModel($name = 'Field', $prefix = 'FieldsModel', $config = array('ignore_request' => true)) + { + return parent::getModel($name, $prefix, $config); + } +} diff --git a/administrator/components/com_fields/fields.php b/administrator/components/com_fields/fields.php new file mode 100644 index 0000000000000..13bb1ee6cc4a8 --- /dev/null +++ b/administrator/components/com_fields/fields.php @@ -0,0 +1,25 @@ +input; + +$parts = explode('.', $input->get('context')); +$component = $parts[0]; + +if (!JFactory::getUser()->authorise('core.manage', $component)) +{ + return JError::raiseWarning(404, JText::_('JERROR_ALERTNOAUTHOR')); +} + +JLoader::import('components.com_fields.helpers.internal', JPATH_ADMINISTRATOR); + +$controller = JControllerLegacy::getInstance('Fields'); +$controller->execute($input->get('task')); +$controller->redirect(); diff --git a/administrator/components/com_fields/fields.xml b/administrator/components/com_fields/fields.xml new file mode 100644 index 0000000000000..3036577069a21 --- /dev/null +++ b/administrator/components/com_fields/fields.xml @@ -0,0 +1,38 @@ + + + com_fields + Joomla! Project + March 2016 + (C) 2005 - 2016 Open Source Matters. All rights reserved. + GNU General Public License version 2 or later; see LICENSE.txt + admin@joomla.org + www.joomla.org + __DEPLOY_VERSION__ + COM_FIELDS_XML_DESCRIPTION + + controller.php + fields.php + controllers + layouts + + + + access.xml + controller.php + fields.php + controllers + helpers + libraries + models + sql + tables + views + + + language/en-GB.com_fields.ini + language/en-GB.com_fields.sys.ini + + + + + diff --git a/administrator/components/com_fields/helpers/fields.php b/administrator/components/com_fields/helpers/fields.php new file mode 100644 index 0000000000000..22cb15f4eea85 --- /dev/null +++ b/administrator/components/com_fields/helpers/fields.php @@ -0,0 +1,557 @@ + true) + ); + + self::$fieldsCache->setState('filter.published', 1); + self::$fieldsCache->setState('list.limit', 0); + } + + if (is_array($item)) + { + $item = (object) $item; + } + if (isset($item->language) && $item->language !='*') + { + self::$fieldsCache->setState('filter.language', array('*', $item->language)); + } + self::$fieldsCache->setState('filter.context', $context); + + /* + * If item has assigned_cat_ids parameter display only fields which + * belong to the category + */ + if ($item && (isset($item->catid) || isset($item->fieldscatid))) + { + $assignedCatIds = isset($item->catid) ? $item->catid : $item->fieldscatid; + self::$fieldsCache->setState('filter.assigned_cat_ids', is_array($assignedCatIds) ? $assignedCatIds : explode(',', $assignedCatIds)); + } + + $fields = self::$fieldsCache->getItems(); + + if ($item && isset($item->id)) + { + if (self::$fieldCache === null) + { + self::$fieldCache = JModelLegacy::getInstance('Field', 'FieldsModel', array( + 'ignore_request' => true) + ); + } + + $new = array(); + + foreach ($fields as $key => $original) + { + /* + * Doing a clone, otherwise fields for different items will + * always reference to the same object + */ + $field = clone $original; + + if ($valuesToOverride && key_exists($field->alias, $valuesToOverride)) + { + $field->value = $valuesToOverride[$field->alias]; + } + elseif ($valuesToOverride && key_exists($field->id, $valuesToOverride)) + { + $field->value = $valuesToOverride[$field->id]; + } + else + { + $field->value = self::$fieldCache->getFieldValue($field->id, $field->context, $item->id); + } + + if (! $field->value) + { + $field->value = $field->default_value; + } + + $field->rawvalue = $field->value; + + if ($prepareValue) + { + $value = null; + + /* + * On before field prepare + * Event allow plugins to modfify the output of the field before it is prepared + */ + $dispatcher = JEventDispatcher::getInstance(); + $dispatcher->trigger('onFieldBeforePrepare', array($context, $item, &$field)); + + // Prepare the value from the type layout + $value = self::render($context, 'field.prepare.' . $field->type, array('field' => $field)); + + // If the value is empty, render the base layout + if (! $value) + { + $value = self::render($context, 'field.prepare.base', array('field' => $field)); + } + + /* + * On after field render + * Event allow plugins to modfify the output of the prepared field + */ + $dispatcher->trigger('onFieldAfterPrepare', array($context, $item, $field, &$value)); + $field->value = $value; + } + + $new[$key] = $field; + } + + $fields = $new; + } + + return $fields; + } + + /** + * Renders the layout file and data on the context and does a fall back to + * Fields afterwards. + * + * @param string $context The context of the content passed to the helper + * @param string $layoutFile layoutFile + * @param array $displayData displayData + * + * @return NULL|string + * + * @since __DEPLOY_VERSION__ + */ + public static function render($context, $layoutFile, $displayData) + { + $value = null; + + /* + * Because the layout refreshes the paths before the render function is + * called, so there is no way to load the layout overrides in the order + * template -> context -> fields. + * If there is no override in the context then we need to call the + * layout from Fields. + */ + if ($parts = self::extract($context)) + { + // Trying to render the layout on the component fom the context + $value = JLayoutHelper::render($layoutFile, $displayData, null, array('component' => $parts[0], 'client' => 0)); + } + + if (!$value) + { + // Trying to render the layout on Fields itself + $value = JLayoutHelper::render($layoutFile, $displayData, null, array('component' => 'com_fields','client' => 0)); + } + + if (!$value) + { + // Trying to render the layout of the plugins + foreach (JFolder::listFolderTree(JPATH_PLUGINS . '/fields', '.', 1) as $folder) + { + $value = JLayoutHelper::render($layoutFile, $displayData, $folder['fullname'] . '/layouts'); + } + } + + return $value; + } + + /** + * PrepareForm + * + * @param string $context The context of the content passed to the helper + * @param JForm $form form + * @param object $data data. + * + * @return boolean + * + * @since __DEPLOY_VERSION__ + */ + public static function prepareForm($context, JForm $form, $data) + { + // Extracting the component and section + $parts = self::extract($context); + + if (! $parts) + { + return true; + } + + // When no fields available return here + $fields = self::getFields($parts[0] . '.' . $parts[1], new JObject); + + if (! $fields) + { + return true; + } + + $component = $parts[0]; + $section = $parts[1]; + + $assignedCatids = isset($data->catid) ? $data->catid : (isset($data->fieldscatid) ? $data->fieldscatid : null); + + if (!$assignedCatids && $form->getField('catid')) + { + // Choose the first category available + $xml = new DOMDocument; + $xml->loadHTML($form->getField('catid')->__get('input')); + $options = $xml->getElementsByTagName('option'); + + if ($firstChoice = $options->item(0)) + { + $assignedCatids = $firstChoice->getAttribute('value'); + $data->fieldscatid = $assignedCatids; + } + } + + /* + * If there is a catid field we need to reload the page when the catid + * is changed + */ + if ($form->getField('catid') && $parts[0] != 'com_fields') + { + // The uri to submit to + $uri = clone JUri::getInstance('index.php'); + + /* + * Removing the catid parameter from the actual url and set it as + * return + */ + $returnUri = clone JUri::getInstance(); + $returnUri->setVar('catid', null); + $uri->setVar('return', base64_encode($returnUri->toString())); + + // Setting the options + $uri->setVar('option', 'com_fields'); + $uri->setVar('task', 'field.storeform'); + $uri->setVar('context', $parts[0] . '.' . $parts[1]); + $uri->setVar('formcontrol', $form->getFormControl()); + $uri->setVar('view', null); + $uri->setVar('layout', null); + + /* + * Setting the onchange event to reload the page when the category + * has changed + */ + $form->setFieldAttribute('catid', 'onchange', "categoryHasChanged(this);"); + JFactory::getDocument()->addScriptDeclaration( + "function categoryHasChanged(element){ + var cat = jQuery(element); + if (cat.val() == '" . $assignedCatids . "')return; + jQuery('input[name=task]').val('field.storeform'); + element.form.action='" . $uri . "'; + element.form.submit(); + } + jQuery( document ).ready(function() { + var formControl = '#" . $form->getFormControl() . "_catid'; + if (!jQuery(formControl).val() != '" . $assignedCatids . "'){jQuery(formControl).val('" . $assignedCatids . "');} + });"); + } + + // Getting the fields + $fields = self::getFields($parts[0] . '.' . $parts[1], $data); + + if (!$fields) + { + return true; + } + + FieldsHelperInternal::loadPlugins(); + + // Creating the dom + $xml = new DOMDocument('1.0', 'UTF-8'); + $fieldsNode = $xml->appendChild(new DOMElement('form'))->appendChild(new DOMElement('fields')); + $fieldsNode->setAttribute('name', 'params'); + + // Organizing the fields according to their category + $fieldsPerCategory = array( + 0 => array() + ); + + foreach ($fields as $field) + { + if (! key_exists($field->catid, $fieldsPerCategory)) + { + $fieldsPerCategory[$field->catid] = array(); + } + + $fieldsPerCategory[$field->catid][] = $field; + } + + // On the front, sometimes the admin fields path is not included + JFormHelper::addFieldPath(JPATH_ADMINISTRATOR . '/components/' . $component . '/models/fields'); + + // Looping trough the categories + foreach ($fieldsPerCategory as $catid => $catFields) + { + if (! $catFields) + { + continue; + } + + // Defining the field set + $fieldset = $fieldsNode->appendChild(new DOMElement('fieldset')); + $fieldset->setAttribute('name', 'fields-' . $catid); + $fieldset->setAttribute('addfieldpath', '/administrator/components/' . $component . '/models/fields'); + $fieldset->setAttribute('addrulepath', '/administrator/components/' . $component . '/models/rules'); + + $label = ''; + $description = ''; + + if ($catid > 0) + { + /* + * JCategories can't handle com_content with a section, going + * directly to the table + */ + $category = JTable::getInstance('Category'); + $category->load($catid); + + if ($category->id) + { + $label = $category->title; + $description = $category->description; + } + } + + if (! $label || !$description) + { + $lang = JFactory::getLanguage(); + + if (!$label) + { + $key = strtoupper($component . '_FIELDS_' . $section . '_LABEL'); + + if (!$lang->hasKey($key)) + { + $key = 'JGLOBAL_FIELDS'; + } + + $label = JText::_($key); + } + + if (!$description) + { + $key = strtoupper($component . '_FIELDS_' . $section . '_DESC'); + + if ($lang->hasKey($key)) + { + $description = JText::_($key); + } + } + } + + $fieldset->setAttribute('label', $label); + $fieldset->setAttribute('description', strip_tags($description)); + + // Looping trough the fields for that context + foreach ($catFields as $field) + { + // Creating the XML form data + $type = JFormHelper::loadFieldType($field->type); + + if (!$type) + { + continue; + } + + try + { + // Rendering the type + $node = $type->appendXMLFieldTag($field, $fieldset, $form); + + if (!FieldsHelperInternal::canEditFieldValue($field)) + { + $node->setAttribute('disabled', 'true'); + } + + /* + *If the field belongs to a assigned_cat_ids but the + * assigned_cat_ids in the data is not known, set the + * required + * flag to false on any circumstance + */ + if (! $assignedCatids && $field->assigned_cat_ids) + { + $node->setAttribute('required', 'false'); + } + } + catch (Exception $e) + { + JFactory::getApplication()->enqueueMessage($e->getMessage(), 'error'); + } + } + } + + // Loading the XML fields string into the form + $form->load($xml->saveXML()); + + $model = JModelLegacy::getInstance('Field', 'FieldsModel', array( + 'ignore_request' => true) + ); + + if ((!isset($data->id) || !$data->id) && JFactory::getApplication()->input->getCmd('controller') == 'config.display.modules' + && JFactory::getApplication()->isSite()) + { + // Modules on front end editing don't have data and an id set + $data->id = $input->getInt('id'); + } + + // Looping trough the fields again to set the value + if (isset($data->id) && $data->id) + { + foreach ($fields as $field) + { + $value = $model->getFieldValue($field->id, $field->context, $data->id); + + if ($value === null) + { + continue; + } + + // Setting the value on the field + $form->setValue($field->alias, 'params', $value); + } + } + + return true; + } + + /** + * Return a boolean if the actual logged in user can edit the given field value. + * + * @param stdClass $field The field + * + * @return boolean + * + * @since __DEPLOY_VERSION__ + */ + public static function canEditFieldValue($field) + { + return JFactory::getUser()->authorise('core.edit.value', $field->context . '.field.' . (int) $field->id); + } + + /** + * Adds Count Items for Category Manager. + * + * @param stdClass[] &$items The field category objects + * + * @return stdClass[] + * + * @since __DEPLOY_VERSION__ + */ + public static function countItems(&$items) + { + $db = JFactory::getDbo(); + + foreach ($items as $item) + { + $item->count_trashed = 0; + $item->count_archived = 0; + $item->count_unpublished = 0; + $item->count_published = 0; + + $query = $db->getQuery(true); + $query->select('state, count(*) AS count') + ->from($db->quoteName('#__fields')) + ->where('catid = ' . (int) $item->id) + ->group('state'); + $db->setQuery($query); + + $fields = $db->loadObjectList(); + + foreach ($fields as $article) + { + if ($article->state == 1) + { + $item->count_published = $article->count; + } + + if ($article->state == 0) + { + $item->count_unpublished = $article->count; + } + + if ($article->state == 2) + { + $item->count_archived = $article->count; + } + + if ($article->state == -2) + { + $item->count_trashed = $article->count; + } + } + } + + return $items; + } +} diff --git a/administrator/components/com_fields/helpers/internal.php b/administrator/components/com_fields/helpers/internal.php new file mode 100644 index 0000000000000..f6326ab0ff2e8 --- /dev/null +++ b/administrator/components/com_fields/helpers/internal.php @@ -0,0 +1,114 @@ +load($component, JPATH_BASE, null, false, true) + || $lang->load($component, JPath::clean(JPATH_ADMINISTRATOR . '/components/' . $component), null, false, true); + + call_user_func(array($cName, 'addSubmenu'), 'fields' . (isset($section) ? '.' . $section : '')); + } + } + } + } + + /** + * Return a boolean if the actual logged in user can edit the given field value. + * + * @param stdClass $field The field + * + * @return boolean + * + * @since __DEPLOY_VERSION__ + */ + public static function canEditFieldValue($field) + { + return JFactory::getUser()->authorise('core.edit.value', $field->context . '.field.' . (int) $field->id); + } + + /** + * Loads the fields plugins. + * + * @return void + * + * @since __DEPLOY_VERSION__ + */ + public static function loadPlugins() + { + foreach (JFolder::listFolderTree(JPATH_PLUGINS . '/fields', '.', 1) as $folder) + { + if (!JPluginHelper::isEnabled('fields', $folder['name'])) + { + continue; + } + + JFactory::getLanguage()->load('plg_fields_' . strtolower($folder['name']), JPATH_ADMINISTRATOR); + JFactory::getLanguage()->load('plg_fields_' . strtolower($folder['name']), $folder['fullname']); + JFormHelper::addFieldPath($folder['fullname'] . '/fields'); + } + } +} diff --git a/administrator/components/com_fields/models/field.php b/administrator/components/com_fields/models/field.php new file mode 100644 index 0000000000000..f2fee8e180728 --- /dev/null +++ b/administrator/components/com_fields/models/field.php @@ -0,0 +1,814 @@ +typeAlias = JFactory::getApplication()->input->getCmd('context', 'com_content.article') . '.field'; + } + + /** + * Method to test whether a record can be deleted. + * + * @param object $record A record object. + * + * @return boolean True if allowed to delete the record. Defaults to the permission for the component. + * + * @since __DEPLOY_VERSION__ + */ + protected function canDelete($record) + { + if (!empty($record->id)) + { + if ($record->state != - 2) + { + return; + } + + return JFactory::getUser()->authorise('core.delete', $record->context . '.field.' . (int) $record->id); + } + } + + /** + * Method to test whether a record can be deleted. + * + * @param object $record A record object. + * + * @return boolean True if allowed to change the state of the record. Defaults to the permission for the component. + * + * @since __DEPLOY_VERSION__ + */ + protected function canEditState($record) + { + $user = JFactory::getUser(); + + // Check for existing field. + if (!empty($record->id)) + { + return $user->authorise('core.edit.state', $record->context . '.field.' . (int) $record->id); + } + else + { + return $user->authorise('core.edit.state', $record->context); + } + } + + /** + * Method to save the form data. + * + * @param array $data The form data. + * + * @return boolean True on success, False on error. + * + * @since __DEPLOY_VERSION__ + */ + public function save($data) + { + $field = null; + + if (isset($data['id']) && $data['id']) + { + $field = $this->getItem($data['id']); + } + + if (! isset($data['assigned_cat_ids'])) + { + $data['assigned_cat_ids'] = array(); + } + else + { + $cats = (array) $data['assigned_cat_ids']; + + foreach ($cats as $key => $c) + { + if (empty($c)) + { + unset($cats[$key]); + } + } + + $data['assigned_cat_ids'] = $cats; + } + + if (!isset($data['label']) && isset($data['params']['label'])) + { + $data['label'] = $data['params']['label']; + + unset($data['params']['label']); + } + + // Alter the title for save as copy + $input = JFactory::getApplication()->input; + + if ($input->get('task') == 'save2copy') + { + $origTable = clone $this->getTable(); + $origTable->load($input->getInt('id')); + + if ($data['title'] == $origTable->title) + { + list($title, $alias) = $this->generateNewTitle($data['catid'], $data['alias'], $data['title']); + $data['title'] = $title; + $data['alias'] = $alias; + } + else + { + if ($data['alias'] == $origTable->alias) + { + $data['alias'] = ''; + } + } + + $data['state'] = 0; + } + + JLoader::register('CategoriesHelper', JPATH_ADMINISTRATOR . '/components/com_categories/helpers/categories.php'); + + // Cast catid to integer for comparison + $catid = (int) $data['catid']; + + // Check if New Category exists + if ($catid > 0) + { + $catid = CategoriesHelper::validateCategoryId($data['catid'], $data['context'] . '.fields'); + } + + // Save New Category + if ($catid === 0 && is_string($data['catid']) && $data['catid'] != '') + { + $table = array(); + $table['title'] = $data['catid']; + $table['parent_id'] = 1; + $table['extension'] = $data['context'] . '.fields'; + $table['language'] = $data['language']; + $table['published'] = 1; + + // Create new category and get catid back + $data['catid'] = CategoriesHelper::createCategory($table); + } + + if ($data['catid'] === '') + { + $data['catid'] = '0'; + } + + $success = parent::save($data); + + // If the options have changed delete the values + if ($success && $field && isset($data['fieldparams']['options']) && isset($field->fieldparams['options'])) + { + $oldParams = json_decode($field->fieldparams['options']); + $newParams = json_decode($data['fieldparams']['options']); + + if (is_object($oldParams) && is_object($newParams) && $oldParams->name != $newParams->name) + { + $query = $this->_db->getQuery(true); + $query->delete('#__fields_values')->where('field_id = ' . (int) $field->id) + ->where("value not in ('" . implode("','", $newParams->name) . "')"); + $this->_db->setQuery($query); + $this->_db->execute(); + } + } + + return $success; + } + + /** + * Method to delete one or more records. + * + * @param array &$pks An array of record primary keys. + * + * @return boolean True if successful, false if an error occurs. + * + * @since __DEPLOY_VERSION__ + */ + public function delete(&$pks) + { + $success = parent::delete($pks); + + if ($success) + { + $pks = (array) $pks; + $pks = ArrayHelper::toInteger($pks); + $pks = array_filter($pks); + + if (!empty($pks)) + { + $query = $this->getDbo()->getQuery(true); + + $query ->delete($query->qn('#__fields_values')) + ->where($query->qn('field_id') . ' IN(' . implode(',', $pks) . ')'); + + $this->getDbo()->setQuery($query)->execute(); + } + } + + return $success; + } + + /** + * Method to get a table object, load it if necessary. + * + * @param string $name The table name. Optional. + * @param string $prefix The class prefix. Optional. + * @param array $options Configuration array for model. Optional. + * + * @return JTable A JTable object + * + * @since __DEPLOY_VERSION__ + * @throws Exception + */ + public function getTable ($name = 'Field', $prefix = 'FieldsTable', $options = array()) + { + if (strpos(JPATH_COMPONENT, 'com_fields') === false) + { + $this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_fields/tables'); + } + + return JTable::getInstance($name, $prefix, $options); + } + + /** + * Stock method to auto-populate the model state. + * + * @return void + * + * @since __DEPLOY_VERSION__ + */ + protected function populateState() + { + $app = JFactory::getApplication('administrator'); + + // Load the User state. + $pk = $app->input->getInt('id'); + $this->setState($this->getName() . '.id', $pk); + + $context = $app->input->get('context', 'com_content.article'); + $this->setState('field.context', $context); + $parts = FieldsHelper::extract($context); + + // Extract the component name + $this->setState('field.component', $parts[0]); + + // Extract the optional section name + $this->setState('field.section', (count($parts) > 1) ? $parts[1] : null); + + // Load the parameters. + $params = JComponentHelper::getParams('com_fields'); + $this->setState('params', $params); + } + + /** + * Method to get a single record. + * + * @param integer $pk The id of the primary key. + * + * @return mixed Object on success, false on failure. + * + * @since __DEPLOY_VERSION__ + */ + public function getItem($pk = null) + { + $result = parent::getItem($pk); + + if ($result) + { + // Prime required properties. + if (empty($result->id)) + { + $result->context = JFactory::getApplication()->input->getCmd('context', $this->getState('field.context')); + } + + if (property_exists($result, 'fieldparams')) + { + $registry = new Registry; + $registry->loadString($result->fieldparams); + $result->fieldparams = $registry->toArray(); + } + + if ($result->assigned_cat_ids) + { + $result->assigned_cat_ids = explode(',', $result->assigned_cat_ids); + } + + // Convert the created and modified dates to local user time for + // display in the form. + $tz = new DateTimeZone(JFactory::getApplication()->get('offset')); + + if ((int) $result->created_time) + { + $date = new JDate($result->created_time); + $date->setTimezone($tz); + + $result->created_time = $date->toSql(true); + } + else + { + $result->created_time = null; + } + + if ((int) $result->modified_time) + { + $date = new JDate($result->modified_time); + $date->setTimezone($tz); + + $result->modified_time = $date->toSql(true); + } + else + { + $result->modified_time = null; + } + } + + return $result; + } + + /** + * Abstract method for getting the form from the model. + * + * @param array $data Data for the form. + * @param boolean $loadData True if the form is to load its own data (default case), false if not. + * + * @return mixed A JForm object on success, false on failure + * + * @since __DEPLOY_VERSION__ + */ + public function getForm($data = array(), $loadData = true) + { + $context = $this->getState('field.context'); + $jinput = JFactory::getApplication()->input; + + // A workaround to get the context into the model for save requests. + if (empty($context) && isset($data['context'])) + { + $context = $data['context']; + $parts = explode('.', $context); + + $this->setState('field.context', $context); + $this->setState('field.component', $parts[0]); + $this->setState('field.section', isset($parts[1]) ? $parts[1] : ''); + } + + // Get the form. + $form = $this->loadForm( + 'com_fields.field' . $context, 'field', + array( + 'control' => 'jform', + 'load_data' => $loadData, + ) + ); + + if (empty($form)) + { + return false; + } + + // Modify the form based on Edit State access controls. + if (empty($data['context'])) + { + $data['context'] = $context; + } + + if (isset($data['type'])) + { + $parts = explode('.', $jinput->getCmd('context', $this->getState('field.context'))); + $component = $parts[0]; + $this->loadTypeForms($form, $data['type'], $component); + } + + if (!JFactory::getUser()->authorise('core.edit.state', $context . '.field.' . $jinput->get('id'))) + { + // Disable fields for display. + $form->setFieldAttribute('ordering', 'disabled', 'true'); + $form->setFieldAttribute('state', 'disabled', 'true'); + + // Disable fields while saving. The controller has already verified this is a record you can edit. + $form->setFieldAttribute('ordering', 'filter', 'unset'); + $form->setFieldAttribute('state', 'filter', 'unset'); + } + + return $form; + } + + /** + * A protected method to get a set of ordering conditions. + * + * @param JTable $table A JTable object. + * + * @return array An array of conditions to add to ordering queries. + * + * @since __DEPLOY_VERSION__ + */ + protected function getReorderConditions($table) + { + return 'context = ' . $this->_db->quote($table->context); + } + + /** + * Method to get the data that should be injected in the form. + * + * @return array The default data is an empty array. + * + * @since __DEPLOY_VERSION__ + */ + protected function loadFormData() + { + // Check the session for previously entered form data. + $app = JFactory::getApplication(); + $data = $app->getUserState('com_fields.edit.field.data', array()); + + if (empty($data)) + { + $data = $this->getItem(); + + // Pre-select some filters (Status, Language, Access) in edit form + // if those have been selected in Category Manager + if (!$data->id) + { + // Check for which context the Category Manager is used and + // get selected fields + $context = substr($app->getUserState('com_fields.fields.filter.context'), 4); + $component = FieldsHelper::extract($context); + $component = $component ? $component[0] : null; + + $filters = (array) $app->getUserState('com_fields.fields.' . $component . '.filter'); + + $data->set('published', $app->input->getInt('published', (! empty($filters['published']) ? $filters['published'] : null))); + $data->set('language', $app->input->getString('language', (! empty($filters['language']) ? $filters['language'] : null))); + $data->set( + 'access', + $app->input->getInt('access', (! empty($filters['access']) ? $filters['access'] : JFactory::getConfig()->get('access'))) + ); + + // Set the type if available from the request + $data->set('type', $app->input->getWord('type', $data->get('type'))); + } + + if ($data->label && !isset($data->params['label'])) + { + $data->params['label'] = $data->label; + } + } + + $this->preprocessData('com_fields.field', $data); + + return $data; + } + + /** + * Method to allow derived classes to preprocess the form. + * + * @param JForm $form A JForm object. + * @param mixed $data The data expected for the form. + * @param string $group The name of the plugin group to import (defaults to "content"). + * + * @return void + * + * @see JFormField + * @since __DEPLOY_VERSION__ + * @throws Exception if there is an error in the form event. + */ + protected function preprocessForm(JForm $form, $data, $group = 'content') + { + $parts = FieldsHelper::extract(JFactory::getApplication()->input->getCmd('context', $this->getState('field.context'))); + + if ($parts) + { + $component = $parts[0]; + + $dataObject = $data; + + if (is_array($dataObject)) + { + $dataObject = (object) $dataObject; + } + + if (isset($dataObject->type)) + { + $this->loadTypeForms($form, $dataObject->type, $component); + + $form->setFieldAttribute('type', 'component', $component); + + // Not alowed to change the type of an existing record + if ($dataObject->id) + { + $form->setFieldAttribute('type', 'readonly', 'true'); + } + } + + // Setting the context for the category field + $cat = JCategories::getInstance(str_replace('com_', '', $component)); + + if ($cat && $cat->get('root')->hasChildren()) + { + $form->setFieldAttribute('assigned_cat_ids', 'extension', $component); + } + else + { + $form->removeField('assigned_cat_ids'); + } + + $form->setFieldAttribute('type', 'component', $component); + $form->setFieldAttribute('catid', 'extension', $component . '.' . $parts[1] . '.fields'); + } + + // Trigger the default form events. + parent::preprocessForm($form, $data, $group); + } + + /** + * Returning the value for the given field id, context and item id. + * + * @param string $fieldId The field ID. + * @param string $context The context. + * @param string $itemId The ID of the item. + * + * @return NULL|string + * + * @since __DEPLOY_VERSION__ + */ + public function getFieldValue($fieldId, $context, $itemId) + { + $key = md5($fieldId . $context . $itemId); + + if (!key_exists($key, $this->valueCache)) + { + $this->valueCache[$key] = null; + $db = $this->_db; + + $query = $this->getDbo()->getQuery(true); + + $query->select($query->qn('value')) + ->from($query->qn('#__fields_values')) + ->where($query->qn('field_id') . ' = ' . (int) $fieldId) + ->where($query->qn('context') . ' = ' . $query->q($context)) + ->where($query->qn('item_id') . ' = ' . $query->q($itemId)); + + $rows = $this->getDbo()->setQuery($query)->loadObjectList(); + + if (count($rows) == 1) + { + $this->valueCache[$key] = array_shift($rows)->value; + } + elseif (count($rows) > 1) + { + $data = array(); + + foreach ($rows as $row) + { + $data[] = $row->value; + } + + $this->valueCache[$key] = $data; + } + } + + return $this->valueCache[$key]; + } + + /** + * Setting the value for the gven field id, context and item id. + * + * @param string $fieldId The field ID. + * @param string $context The context. + * @param string $itemId The ID of the item. + * @param string $value The value. + * + * @return boolean + * + * @since __DEPLOY_VERSION__ + */ + public function setFieldValue($fieldId, $context, $itemId, $value) + { + $field = $this->getItem($fieldId); + $params = $field->params; + + if (is_array($params)) + { + $params = new Registry($params); + } + + // Don't save the value when the field is disabled or the user is + // not authorized to change it + if (!$field || $params->get('disabled', 0) || ! FieldsHelperInternal::canEditFieldValue($field)) + { + return false; + } + + $needsDelete = false; + $needsInsert = false; + $needsUpdate = false; + + if ($field->default_value == $value) + { + $needsDelete = true; + } + else + { + $oldValue = $this->getFieldValue($fieldId, $context, $itemId); + $value = (array) $value; + + if ($oldValue === null) + { + // No records available, doing normal insert + $needsInsert = true; + } + elseif (count($value) == 1 && count((array) $oldValue) == 1) + { + // Only a single row value update can be done + $needsUpdate = true; + } + else + { + // Multiple values, we need to purge the data and do a new + // insert + $needsDelete = true; + $needsInsert = true; + } + } + + if ($needsDelete) + { + // Deleting the existing record as it is a reset + $query = $this->getDbo()->getQuery(true); + + $query ->delete($query->qn('#__fields_values')) + ->where($query->qn('field_id') . ' = ' . (int) $fieldId) + ->where($query->qn('context') . ' = ' . $query->q($context)) + ->where($query->qn('item_id') . ' = ' . $query->q($itemId)); + + $this->getDbo()->setQuery($query)->execute(); + } + + if ($needsInsert) + { + $newObj = new stdClass; + + $newObj->field_id = (int) $fieldId; + $newObj->context = $context; + $newObj->item_id = $itemId; + + foreach ($value as $v) + { + $newObj->value = $v; + + $this->getDbo()->insertObject('#__fields_values', $newObj); + } + } + + if ($needsUpdate) + { + $updateObj = new stdClass; + + $updateObj->field_id = (int) $fieldId; + $updateObj->context = $context; + $updateObj->item_id = $itemId; + $updateObj->value = reset($value); + + $this->getDbo()->updateObject('#__fields_values', $updateObj, array('field_id', 'context', 'item_id')); + } + + $this->valueCache = array(); + + return true; + } + + /** + * Cleaning up the values for the given item on the context. + * + * @param string $context The context. + * @param string $itemId The Item ID. + * + * @return void + * + * @since __DEPLOY_VERSION__ + */ + public function cleanupValues($context, $itemId) + { + $query = $this->getDbo()->getQuery(true); + + $query->delete($query->qn('#__fields_values')) + ->where($query->qn('context') . ' = ' . $query->q($context)) + ->where($query->qn('item_id') . ' = ' . $query->q($itemId)); + + $this->getDbo()->setQuery($query)->execute(); + } + + /** + * Clean the cache + * + * @param string $group The cache group + * @param integer $client_id The ID of the client + * + * @return void + * + * @since __DEPLOY_VERSION__ + */ + protected function cleanCache($group = null, $client_id = 0) + { + $context = JFactory::getApplication()->input->get('context'); + + switch ($context) + { + case 'com_content': + parent::cleanCache('com_content'); + parent::cleanCache('mod_articles_archive'); + parent::cleanCache('mod_articles_categories'); + parent::cleanCache('mod_articles_category'); + parent::cleanCache('mod_articles_latest'); + parent::cleanCache('mod_articles_news'); + parent::cleanCache('mod_articles_popular'); + break; + default: + parent::cleanCache($context); + break; + } + } + + /** + * Method to change the title & alias. + * + * @param integer $category_id The id of the category. + * @param string $alias The alias. + * @param string $title The title. + * + * @return array Contains the modified title and alias. + * + * @since __DEPLOY_VERSION__ + */ + protected function generateNewTitle($category_id, $alias, $title) + { + // Alter the title & alias + $table = $this->getTable(); + + while ($table->load(array('alias' => $alias))) + { + $title = StringHelper::increment($title); + $alias = StringHelper::increment($alias, 'dash'); + } + + return array( + $title, + $alias, + ); + } + + /** + * Load the form declaration for the type. + * + * @param JForm &$form The form + * @param string $type The type + * @param string $component The component + * + * @return void + * + * @since __DEPLOY_VERSION__ + */ + private function loadTypeForms(JForm &$form, $type, $component) + { + FieldsHelperInternal::loadPlugins(); + + $type = JFormHelper::loadFieldType($type); + + // Load all children that's why we need to define the xpath + if (!($type instanceof JFormDomfieldinterface)) + { + return; + } + + $form->load($type->getFormParameters(), true, '/form/*'); + } +} diff --git a/administrator/components/com_fields/models/fields.php b/administrator/components/com_fields/models/fields.php new file mode 100644 index 0000000000000..b2bcf059ee954 --- /dev/null +++ b/administrator/components/com_fields/models/fields.php @@ -0,0 +1,414 @@ +context; + + $context = $app->getUserStateFromRequest('com_fields.fields.filter.context', 'context', 'com_content.article', 'cmd'); + + $this->setState('filter.context', $context); + $parts = explode('.', $context); + + // Extract the component name + $this->setState('filter.component', $parts[0]); + + // Extract the optional section name + $this->setState('filter.section', (count($parts) > 1) ? $parts[1] : null); + + $search = $this->getUserStateFromRequest($context . '.search', 'filter_search'); + $this->setState('filter.search', $search); + + $level = $this->getUserStateFromRequest($context . '.filter.level', 'filter_level'); + $this->setState('filter.level', $level); + + $access = $this->getUserStateFromRequest($context . '.filter.access', 'filter_access'); + $this->setState('filter.access', $access); + + $published = $this->getUserStateFromRequest($context . '.filter.published', 'filter_published', ''); + $this->setState('filter.published', $published); + + $categoryId = $this->getUserStateFromRequest($this->context . '.filter.category_id', 'filter_category_id'); + $this->setState('filter.category_id', $categoryId); + + $language = $this->getUserStateFromRequest($context . '.filter.language', 'filter_language', ''); + $this->setState('filter.language', $language); + + // List state information. + parent::populateState('a.ordering', 'asc'); + + // Force a language + $forcedLanguage = $app->input->get('forcedLanguage'); + + if (! empty($forcedLanguage)) + { + $this->setState('filter.language', $forcedLanguage); + $this->setState('filter.forcedLanguage', $forcedLanguage); + } + } + + /** + * Method to get a store id based on the model configuration state. + * + * This is necessary because the model is used by the component and + * different modules that might need different sets of data or different + * ordering requirements. + * + * @param string $id An identifier string to generate the store id. + * + * @return string A store id. + * + * @since __DEPLOY_VERSION__ + */ + protected function getStoreId($id = '') + { + // Compile the store id. + $id .= ':' . $this->getState('filter.search'); + $id .= ':' . $this->getState('filter.context'); + $id .= ':' . serialize($this->getState('filter.assigned_cat_ids')); + $id .= ':' . $this->getState('filter.published'); + $id .= ':' . $this->getState('filter.category_id'); + $id .= ':' . print_r($this->getState('filter.language'), true); + + return parent::getStoreId($id); + } + + /** + * Method to get a JDatabaseQuery object for retrieving the data set from a database. + * + * @return JDatabaseQuery A JDatabaseQuery object to retrieve the data set. + * + * @since __DEPLOY_VERSION__ + */ + protected function getListQuery() + { + // Create a new query object. + $db = $this->getDbo(); + $query = $db->getQuery(true); + $user = JFactory::getUser(); + + // Select the required fields from the table. + $query->select($this->getState('list.select', 'a.*')); + $query->from('#__fields AS a'); + + // Join over the language + $query->select('l.title AS language_title, l.image AS language_image') + ->join('LEFT', $db->quoteName('#__languages') . ' AS l ON l.lang_code = a.language'); + + // Join over the users for the checked out user. + $query->select('uc.name AS editor')->join('LEFT', '#__users AS uc ON uc.id=a.checked_out'); + + // Join over the asset groups. + $query->select('ag.title AS access_level')->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access'); + + // Join over the users for the author. + $query->select('ua.name AS author_name')->join('LEFT', '#__users AS ua ON ua.id = a.created_user_id'); + + // Join over the categories. + $query->select('c.title as category_title, c.access, c.published')->join('LEFT', '#__categories AS c ON c.id = a.catid'); + + // Filter by context + if ($context = $this->getState('filter.context')) + { + $query->where('a.context = ' . $db->quote($context)); + } + + // Filter by access level. + if ($access = $this->getState('filter.access')) + { + if (is_array($access)) + { + $access = ArrayHelper::toInteger($access); + $query->where('a.access in (' . implode(',', $access) . ')'); + } + else + { + $query->where('a.access = ' . (int) $access); + } + } + + if (($categories = $this->getState('filter.assigned_cat_ids')) && $context) + { + $categories = (array) $categories; + $condition = "a.assigned_cat_ids = '' or find_in_set(0, a.assigned_cat_ids) "; + $parts = FieldsHelper::extract($context); + + if ($parts) + { + // Get the category + $cat = JCategories::getInstance(str_replace('com_', '', $parts[0])); + + if ($cat) + { + foreach ($categories as $assignedCatIds) + { + // Check if we have the actual category + $parent = $cat->get($assignedCatIds); + + if ($parent) + { + $condition .= 'or find_in_set(' . (int) $parent->id . ',a.assigned_cat_ids) '; + + // Traverse the tree up to get all the fields which + // are attached to a parent + while ($parent->getParent() && $parent->getParent()->id != 'root') + { + $parent = $parent->getParent(); + $condition .= 'or find_in_set(' . (int) $parent->id . ',a.assigned_cat_ids) '; + } + } + } + } + } + + $query->where('(' . $condition . ')'); + } + + // Implement View Level Access + if (!$user->authorise('core.admin')) + { + $groups = implode(',', $user->getAuthorisedViewLevels()); + $query->where('a.access IN (' . $groups . ') AND (c.id IS NULL OR c.access IN (' . $groups . '))'); + } + + // Filter by published state + $published = $this->getState('filter.published'); + + if (is_numeric($published)) + { + $query->where('a.state = ' . (int) $published); + + if (JFactory::getApplication()->isSite()) + { + $query->where('(c.id IS NULL OR c.published = ' . (int) $published . ')', 'AND'); + } + } + elseif ($published === '') + { + $query->where('a.state IN (0, 1)'); + + if (JFactory::getApplication()->isSite()) + { + $query->where('(c.id IS NULL OR c.published IN (0, 1)', 'AND'); + } + } + + // Filter by a single or group of categories. + $baselevel = 1; + $categoryId = $this->getState('filter.category_id'); + + if (is_numeric($categoryId)) + { + $cat_tbl = JTable::getInstance('Category', 'JTable'); + $cat_tbl->load($categoryId); + $rgt = $cat_tbl->rgt; + $lft = $cat_tbl->lft; + $baselevel = (int) $cat_tbl->level; + $query->where('c.lft >= ' . (int) $lft) + ->where('c.rgt <= ' . (int) $rgt); + } + elseif (is_array($categoryId)) + { + $categoryId = ArrayHelper::toInteger($categoryId); + $categoryId = implode(',', $categoryId); + $query->where('a.catid IN (' . $categoryId . ')'); + } + + // Filter by search in title + $search = $this->getState('filter.search'); + + if (! empty($search)) + { + if (stripos($search, 'id:') === 0) + { + $query->where('a.id = ' . (int) substr($search, 3)); + } + elseif (stripos($search, 'author:') === 0) + { + $search = $db->quote('%' . $db->escape(substr($search, 7), true) . '%'); + $query->where('(ua.name LIKE ' . $search . ' OR ua.username LIKE ' . $search . ')'); + } + else + { + $search = $db->quote('%' . str_replace(' ', '%', $db->escape(trim($search), true) . '%')); + $query->where('(a.title LIKE ' . $search . ' OR a.alias LIKE ' . $search . ' OR a.note LIKE ' . $search . ')'); + } + } + + // Filter on the language. + if ($language = $this->getState('filter.language')) + { + $language = (array) $language; + + foreach ($language as $key => $l) + { + $language[$key] = $db->quote($l); + } + + $query->where('a.language in (' . implode(',', $language) . ')'); + } + + // Add the list ordering clause + $listOrdering = $this->getState('list.ordering', 'a.ordering'); + $listDirn = $db->escape($this->getState('list.direction', 'ASC')); + + if ($listOrdering == 'a.access') + { + $query->order('a.access ' . $listDirn); + } + else + { + $query->order($db->escape($listOrdering) . ' ' . $listDirn); + } + + return $query; + } + + /** + * Gets an array of objects from the results of database query. + * + * @param string $query The query. + * @param integer $limitstart Offset. + * @param integer $limit The number of records. + * + * @return array An array of results. + * + * @since __DEPLOY_VERSION__ + * @throws RuntimeException + */ + protected function _getList($query, $limitstart = 0, $limit = 0) + { + $result = parent::_getList($query, $limitstart, $limit); + + if (is_array($result)) + { + foreach ($result as $field) + { + $field->fieldparams = new Registry($field->fieldparams); + $field->params = new Registry($field->params); + } + } + + return $result; + } + + /** + * Get the filter form + * + * @param array $data data + * @param boolean $loadData load current data + * + * @return JForm/false the JForm object or false + * + * @since __DEPLOY_VERSION__ + */ + public function getFilterForm($data = array(), $loadData = true) + { + $form = parent::getFilterForm($data, $loadData); + + if ($form) + { + $path = JPATH_ADMINISTRATOR . '/components/' . $this->getState('filter.component') . '/models/forms/filter_fields.xml'; + + if (file_exists($path)) + { + // Load all children that's why we need to define the xpath + if (!$form->loadFile($path, true, '/form/*')) + { + throw new Exception(JText::_('JERROR_LOADFILE_FAILED')); + } + } + + $context = JFactory::getApplication()->input->getCmd('context'); + + // If the context has multiple sections, this is the input field + // to display them + $form->setValue('section', 'custom', $context); + + $form->setFieldAttribute('category_id', 'extension', $context . '.fields', 'filter'); + } + + return $form; + } +} diff --git a/administrator/components/com_fields/models/fields/modal/field.php b/administrator/components/com_fields/models/fields/modal/field.php new file mode 100644 index 0000000000000..e0bc2043dfb32 --- /dev/null +++ b/administrator/components/com_fields/models/fields/modal/field.php @@ -0,0 +1,182 @@ +element['context']) + { + $context = (string) $this->element['context']; + } + else + { + $context = (string) JFactory::getApplication()->input->get('context', 'com_content'); + } + + $allowEdit = ((string) $this->element['edit'] == 'true') ? true : false; + $allowClear = ((string) $this->element['clear'] != 'false') ? true : false; + + // Load language + JFactory::getLanguage()->load('com_fields', JPATH_ADMINISTRATOR); + + // Build the script. + $script = array(); + + // Select button script + $script[] = ' function jSelectCategory_' . $this->id . '(id, title, 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[] = ' jQuery("#modalCategory-' . $this->id . '").modal("hide");'; + $script[] = ' }'; + + // Clear button script + static $scriptClear; + + if ($allowClear && !$scriptClear) + { + $scriptClear = true; + + $script[] = ' function jClearCategory(id) {'; + $script[] = ' document.getElementById(id + "_id").value = "";'; + $script[] = ' document.getElementById(id + "_name").value = "' . + htmlspecialchars(JText::_('COM_FIELDS_SELECT_A_FIELD', 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_fields&view=fields&layout=modal&tmpl=component&context=' . $context . + '&function=jSelectCategory_' . $this->id; + + if (isset($this->element['language'])) + { + $link .= '&forcedLanguage=' . $this->element['language']; + } + + if ((int) $this->value > 0) + { + $db = JFactory::getDbo(); + $query = $db->getQuery(true) + ->select($db->quoteName('title')) + ->from($db->quoteName('#__fields')) + ->where($db->quoteName('id') . ' = ' . (int) $this->value); + $db->setQuery($query); + + try + { + $title = $db->loadResult(); + } + catch (RuntimeException $e) + { + JError::raiseWarning(500, $e->getMessage()); + } + } + + if (empty($title)) + { + $title = JText::_('COM_FIELDS_SELECT_A_FIELD'); + } + + $title = htmlspecialchars($title, ENT_QUOTES, 'UTF-8'); + + // The active field id field. + if (0 == (int) $this->value) + { + $value = ''; + } + else + { + $value = (int) $this->value; + } + + // The current field display field. + $html[] = ''; + $html[] = ''; + $html[] = '' . ' ' . JText::_('JSELECT') . ''; + + // Edit field button + if ($allowEdit) + { + $html[] = '' . '' . JText::_('JACTION_EDIT') . + ''; + + $html[] = JHtml::_( + 'bootstrap.renderModal', 'modalCategory-' . $this->id, + array( + 'url' => $link . '&' . JSession::getFormToken() . '=1"', + 'title' => JText::_('COM_FIELDS_SELECT_A_FIELD'), + 'width' => '800px', + 'height' => '300px', + 'footer' => '' + ) + ); + } + + // Clear field button + if ($allowClear) + { + $html[] = '' . '' . JText::_('JCLEAR') . + ''; + } + + $html[] = ''; + + // Note: class='required' for client side validation + $class = ''; + + if ($this->required) + { + $class = ' class="required modal-value"'; + } + + $html[] = ''; + + return implode("\n", $html); + } +} diff --git a/administrator/components/com_fields/models/fields/section.php b/administrator/components/com_fields/models/fields/section.php new file mode 100644 index 0000000000000..0ba0b68e0729a --- /dev/null +++ b/administrator/components/com_fields/models/fields/section.php @@ -0,0 +1,65 @@ +` 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 __DEPLOY_VERSION__ + */ + 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 __DEPLOY_VERSION__ + */ + 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(); + } +} diff --git a/administrator/components/com_fields/models/fields/type.php b/administrator/components/com_fields/models/fields/type.php new file mode 100644 index 0000000000000..8eafc4539a54b --- /dev/null +++ b/administrator/components/com_fields/models/fields/type.php @@ -0,0 +1,191 @@ +` 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 __DEPLOY_VERSION__ + */ + 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 __DEPLOY_VERSION__ + */ + protected function getOptions() + { + $options = parent::getOptions(); + + FieldsHelperInternal::loadPlugins(); + JFormHelper::addFieldPath(JPATH_LIBRARIES . '/cms/form/field'); + $paths = JFormHelper::addFieldPath(JPATH_ADMINISTRATOR . '/components/com_fields/models/fields'); + + $component = null; + + $parts = FieldsHelper::extract(JFactory::getApplication()->input->get('context')); + + if ($parts) + { + $component = $parts[0]; + $paths[] = JPATH_ADMINISTRATOR . '/components/' . $component . '/models/fields'; + JFactory::getLanguage()->load($component, JPATH_ADMINISTRATOR); + JFactory::getLanguage()->load($component, JPATH_ADMINISTRATOR . '/components/' . $component); + } + + foreach ($paths as $path) + { + if (!JFolder::exists($path)) + { + continue; + } + // Looping trough the types + foreach (JFolder::files($path, 'php', true, true) as $filePath) + { + $name = str_replace('.php', '', basename($filePath)); + + if (in_array(strtolower($name), self::$BLACKLIST)) + { + continue; + } + + $className = JFormHelper::loadFieldClass($name); + + if ($className === false) + { + continue; + } + + // Check if the field implements JFormField and JFormDomFieldInterface + if (!is_subclass_of($className, 'JFormField') || !is_subclass_of($className, 'JFormDomfieldinterface')) + { + continue; + } + + // Adjust the name + $name = strtolower(str_replace('JFormField', '', $className)); + + $label = StringHelper::ucfirst($name); + + if (JFactory::getLanguage()->hasKey('COM_FIELDS_TYPE_' . strtoupper($name))) + { + $label = 'COM_FIELDS_TYPE_' . strtoupper($name); + } + + if ($component && JFactory::getLanguage()->hasKey(strtoupper($component) . '_FIELDS_TYPE_' . strtoupper($name))) + { + $label = strtoupper($component) . '_FIELDS_TYPE_' . strtoupper($name); + } + + $options[] = JHtml::_('select.option', $name, JText::_($label)); + } + } + + // Sorting the fields based on the text which is displayed + usort( + $options, + function ($a, $b) + { + return strcmp($a->text, $b->text); + } + ); + + // Reload the page when the type changes + $uri = clone JUri::getInstance('index.php'); + + // Removing the catid parameter from the actual url and set it as + // return + $returnUri = clone JUri::getInstance(); + $returnUri->setVar('catid', null); + $uri->setVar('return', base64_encode($returnUri->toString())); + + // Setting the options + $uri->setVar('option', 'com_fields'); + $uri->setVar('task', 'field.storeform'); + $uri->setVar('context', 'com_fields.field'); + $uri->setVar('formcontrol', $this->form->getFormControl()); + $uri->setVar('userstatevariable', 'com_fields.edit.field.data'); + $uri->setVar('view', null); + $uri->setVar('layout', null); + + JFactory::getDocument()->addScriptDeclaration( + "function typeHasChanged(element){ + var cat = jQuery(element); + jQuery('input[name=task]').val('field.storeform'); + element.form.action='" . $uri . "'; + element.form.submit(); + }"); + + return $options; + } + + /** + * Parses the file with the given path. If it is a class starting with the + * name JFormField and implementing JFormDomfieldinterface, then the class name is returned. + * + * @param string $path The path. + * + * @return string|boolean + * + * @since __DEPLOY_VERSION__ + */ + private function getClassNameFromFile($path) + { + $tokens = token_get_all(JFile::read($path)); + $className = null; + + for ($i = 2; $i < count($tokens); $i ++) + { + if ($tokens[$i - 2][0] == T_CLASS && $tokens[$i - 1][0] == T_WHITESPACE && $tokens[$i][0] == T_STRING + && strpos($tokens[$i][1], 'JFormField') !== false) + { + $className = $tokens[$i][1]; + } + + if ($tokens[$i - 2][0] == T_IMPLEMENTS && $tokens[$i - 1][0] == T_WHITESPACE && $tokens[$i][1] == 'JFormDomfieldinterface') + { + return $className; + } + } + + return false; + } +} diff --git a/administrator/components/com_fields/models/forms/field.xml b/administrator/components/com_fields/models/forms/field.xml new file mode 100644 index 0000000000000..60fd58ea7938e --- /dev/null +++ b/administrator/components/com_fields/models/forms/field.xml @@ -0,0 +1,343 @@ + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
diff --git a/administrator/components/com_fields/models/forms/filter_fields.xml b/administrator/components/com_fields/models/forms/filter_fields.xml new file mode 100644 index 0000000000000..c2ec5c44f00da --- /dev/null +++ b/administrator/components/com_fields/models/forms/filter_fields.xml @@ -0,0 +1,92 @@ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/administrator/components/com_fields/tables/field.php b/administrator/components/com_fields/tables/field.php new file mode 100644 index 0000000000000..a6301b8cf865d --- /dev/null +++ b/administrator/components/com_fields/tables/field.php @@ -0,0 +1,251 @@ +setColumnAlias('published', 'state'); + } + + /** + * Method to bind an associative array or object to the JTable instance.This + * method only binds properties that are publicly accessible and optionally + * takes an array of properties to ignore when binding. + * + * @param mixed $src An associative array or object to bind to the JTable instance. + * @param mixed $ignore An optional array or space separated list of properties to ignore while binding. + * + * @return boolean True on success. + * + * @since __DEPLOY_VERSION__ + * @throws InvalidArgumentException + */ + public function bind($src, $ignore = '') + { + if (isset($src['params']) && is_array($src['params'])) + { + $registry = new Registry; + $registry->loadArray($src['params']); + $src['params'] = (string) $registry; + } + + if (isset($src['fieldparams']) && is_array($src['fieldparams'])) + { + $registry = new Registry; + $registry->loadArray($src['fieldparams']); + $src['fieldparams'] = (string) $registry; + } + + // Bind the rules. + if (isset($src['rules']) && is_array($src['rules'])) + { + $rules = new JRules($src['rules']); + $this->setRules($rules); + } + + return parent::bind($src, $ignore); + } + + /** + * Method to perform sanity checks on the JTable instance properties to ensure + * they are safe to store in the database. Child classes should override this + * method to make sure the data they are storing in the database is safe and + * as expected before storage. + * + * @return boolean True if the instance is sane and able to be stored in the database. + * + * @link https://docs.joomla.org/JTable/check + * @since __DEPLOY_VERSION__ + */ + public function check() + { + // Check for valid name + if (trim($this->title) == '') + { + $this->setError(JText::_('COM_FIELDS_LOCATION_ERR_TABLES_TITLE')); + + return false; + } + + if (empty($this->alias)) + { + $this->alias = $this->title; + } + + $this->alias = JApplication::stringURLSafe($this->alias); + + if (trim(str_replace('-', '', $this->alias)) == '') + { + $this->alias = JString::increment($alias, 'dash'); + } + + $this->alias = str_replace(',', '-', $this->alias); + + if (empty($this->type)) + { + $this->type = 'text'; + } + + if (is_array($this->assigned_cat_ids)) + { + $this->assigned_cat_ids = implode(',', $this->assigned_cat_ids); + } + + $date = JFactory::getDate(); + $user = JFactory::getUser(); + + if ($this->id) + { + // Existing item + $this->modified_time = $date->toSql(); + $this->modified_by = $user->get('id'); + } + else + { + if (! (int) $this->created_time) + { + $this->created_time = $date->toSql(); + } + + if (empty($this->created_user_id)) + { + $this->created_user_id = $user->get('id'); + } + } + + return true; + } + + /** + * Method to compute the default name of the asset. + * The default name is in the form table_name.id + * where id is the value of the primary key of the table. + * + * @return string + * + * @since __DEPLOY_VERSION__ + */ + protected function _getAssetName() + { + $k = $this->_tbl_key; + + return $this->context . '.field.' . (int) $this->$k; + } + + /** + * Method to return the title to use for the asset table. In + * tracking the assets a title is kept for each asset so that there is some + * context available in a unified access manager. Usually this would just + * return $this->title or $this->name or whatever is being used for the + * primary name of the row. If this method is not overridden, the asset name is used. + * + * @return string The string to use as the title in the asset table. + * + * @link https://docs.joomla.org/JTable/getAssetTitle + * @since __DEPLOY_VERSION__ + */ + protected function _getAssetTitle() + { + return $this->title; + } + + /** + * Method to get the parent asset under which to register this one. + * By default, all assets are registered to the ROOT node with ID, + * which will default to 1 if none exists. + * The extended class can define a table and id to lookup. If the + * asset does not exist it will be created. + * + * @param JTable $table A JTable object for the asset parent. + * @param integer $id Id to look up + * + * @return integer + * + * @since __DEPLOY_VERSION__ + */ + protected function _getAssetParentId(JTable $table = null, $id = null) + { + $parts = FieldsHelper::extract($this->context); + $component = $parts ? $parts[0] : null; + + if ($parts && $this->catid) + { + $assetId = $this->getAssetId($parts[0] . '.' . $parts[1] . '.fields.category.' . $this->catid); + + if ($assetId !== false) + { + return $assetId; + } + } + elseif ($component) + { + $assetId = $this->getAssetId($component); + + if ($assetId !== false) + { + return $assetId; + } + } + + return parent::_getAssetParentId($table, $id); + } + + /** + * Returns an asset id for the given name or false. + * + * @param string $name The asset name + * + * @return number|boolean + * + * since __DEPLOY_VERSION__ + */ + private function getAssetId($name) + { + // Build the query to get the asset id for the name. + $query = $this->_db->getQuery(true) + ->select($this->_db->quoteName('id')) + ->from($this->_db->quoteName('#__assets')) + ->where($this->_db->quoteName('name') . ' = ' . $this->_db->quote($name)); + + // Get the asset id from the database. + $this->_db->setQuery($query); + + $assetId = null; + + if ($result = $this->_db->loadResult()) + { + $assetId = (int) $result; + + if ($assetId) + { + return $assetId; + } + } + + return false; + } +} diff --git a/administrator/components/com_fields/views/field/tmpl/edit.php b/administrator/components/com_fields/views/field/tmpl/edit.php new file mode 100644 index 0000000000000..a7cf8a63fbc15 --- /dev/null +++ b/administrator/components/com_fields/views/field/tmpl/edit.php @@ -0,0 +1,104 @@ + 0 )); + +$app = JFactory::getApplication(); +$input = $app->input; + +JFactory::getDocument()->addScriptDeclaration(' + Joomla.submitbutton = function(task) + { + if (task == "field.cancel" || document.formvalidator.isValid(document.getElementById("item-form"))) + { + Joomla.submitform(task, document.getElementById("item-form")); + } + }; + jQuery(document).ready(function() { + jQuery("#jform_title").data("dp-old-value", jQuery("#jform_title").val()); + jQuery("#jform_title").change(function(data, handler) { + if(jQuery("#jform_title").data("dp-old-value") == jQuery("#jform_params_label").val()) { + jQuery("#jform_params_label").val(jQuery("#jform_title").val()); + } + + jQuery("#jform_title").data("dp-old-value", jQuery("#jform_title").val()); + }); + }); +'); + +?> + +
+ +
+ 'general')); ?> + +
+
+ form->renderField('type'); ?> + form->renderField('required'); ?> + form->renderField('default_value'); ?> + + form->getFieldsets('fieldparams') as $name => $fieldSet) : ?> + form->getFieldset($name) as $field) : ?> + renderField(); ?> + + + + form->renderField('description'); ?> +
+
+ set('fields', + array( + array( + 'published', + 'state', + 'enabled', + ), + 'catid', + 'assigned_cat_ids', + 'access', + 'language', + 'note', + ) + ); ?> + + set('fields', null); ?> +
+
+ + +
+
+ +
+
+
+
+ + set('ignore_fieldsets', array('fieldparams')); ?> + + canDo->get('core.admin')) : ?> + + form->getInput('rules'); ?> + + + + form->getInput('context'); ?> + + +
+
diff --git a/administrator/components/com_fields/views/field/tmpl/modal.php b/administrator/components/com_fields/views/field/tmpl/modal.php new file mode 100644 index 0000000000000..8f222fbbab6f1 --- /dev/null +++ b/administrator/components/com_fields/views/field/tmpl/modal.php @@ -0,0 +1,93 @@ +input; + +JFactory::getDocument()->addScriptDeclaration(" + Joomla.submitbutton = function(task) + { + if (task == 'field.cancel' || document.formvalidator.isValid(document.getElementById('item-form'))) + { + " . $this->form->getField('description')->save() . " + + if (window.opener && (task == 'field.save' || task == 'field.cancel')) + { + window.opener.document.closeEditWindow = self; + window.opener.setTimeout('window.document.closeEditWindow.close()', 1000); + } + + Joomla.submitform(task, document.getElementById('item-form')); + } + }; +"); +?> +
+ +
+ + + +
+ +
+
+ +
+ + +
+ 'general')); ?> + + +
+
+ form->getLabel('description'); ?> + form->getInput('description'); ?> +
+
+ +
+
+ + + +
+
+ +
+
+
+
+ + + canDo->get('core.admin')) : ?> + + form->getInput('rules'); ?> + + + + + + + + form->getInput('context'); ?> + + +
+
+
diff --git a/administrator/components/com_fields/views/field/tmpl/modal_options.php b/administrator/components/com_fields/views/field/tmpl/modal_options.php new file mode 100644 index 0000000000000..bed0300d6a433 --- /dev/null +++ b/administrator/components/com_fields/views/field/tmpl/modal_options.php @@ -0,0 +1,45 @@ + 'collapse0')); + +$fieldSets = $this->form->getFieldsets('params'); +$i = 0; +?> + $fieldSet) : ?> + label) ? $fieldSet->label : 'COM_FIELDS_' . $name . '_FIELDSET_LABEL'; ?> + + description) && trim($fieldSet->description)) : ?> + ' . $this->escape(JText::_($fieldSet->description)) . '

'; ?> + + form->getFieldset($name) as $field) : ?> +
+
+ label; ?> +
+
+ input; ?> +
+
+ + + +
+
+ form->getLabel('note'); ?> +
+
+ form->getInput('note'); ?> +
+
+ + + + diff --git a/administrator/components/com_fields/views/field/view.html.php b/administrator/components/com_fields/views/field/view.html.php new file mode 100644 index 0000000000000..807d6cefd42b8 --- /dev/null +++ b/administrator/components/com_fields/views/field/view.html.php @@ -0,0 +1,202 @@ +form = $this->get('Form'); + $this->item = $this->get('Item'); + $this->state = $this->get('State'); + + $section = $this->state->get('field.section') ? $this->state->get('field.section') . '.' : ''; + $this->canDo = JHelperContent::getActions($this->state->get('field.component'), $section . 'field', $this->item->id); + + $input = JFactory::getApplication()->input; + + // Check for errors. + if (count($errors = $this->get('Errors'))) + { + JError::raiseError(500, implode("\n", $errors)); + + return false; + } + + $input->set('hidemainmenu', true); + + if ($this->getLayout() == 'modal') + { + $this->form->setFieldAttribute('language', 'readonly', 'true'); + $this->form->setFieldAttribute('parent_id', 'readonly', 'true'); + } + + $this->addToolbar(); + parent::display($tpl); + } + + /** + * Adds the toolbar. + * + * @return void + * + * @since __DEPLOY_VERSION__ + */ + protected function addToolbar() + { + $input = JFactory::getApplication()->input; + $context = $input->get('context'); + $user = JFactory::getUser(); + $userId = $user->get('id'); + + $isNew = ($this->item->id == 0); + $checkedOut = ! ($this->item->checked_out == 0 || $this->item->checked_out == $userId); + + // Check to see if the type exists + $ucmType = new JUcmType; + $this->typeId = $ucmType->getTypeId($context . '.field'); + + // Avoid nonsense situation. + if ($context == 'com_fields') + { + return; + } + + // The context can be in the form com_foo.section + $parts = explode('.', $context); + $component = $parts[0]; + $section = (count($parts) > 1) ? $parts[1] : null; + $componentParams = JComponentHelper::getParams($component); + + // Need to load the menu language file as mod_menu hasn't been loaded yet. + $lang = JFactory::getLanguage(); + $lang->load($component, JPATH_BASE, null, false, true) || + $lang->load($component, JPATH_ADMINISTRATOR . '/components/' . $component, null, false, true); + + // Load the field helper. + require_once JPATH_COMPONENT . '/helpers/fields.php'; + + // Get the results for each action. + $canDo = $this->canDo; + + // If a component fields title string is present, let's use it. + if ($lang->hasKey( + $component_title_key = $component . '_FIELDS_' . ($section ? $section : '') . '_FIELD_' . ($isNew ? 'ADD' : 'EDIT') . '_TITLE')) + { + $title = JText::_($component_title_key); + } + // Else if the component section string exits, let's use it + elseif ($lang->hasKey($component_section_key = $component . '_FIELDS_SECTION_' . ($section ? $section : ''))) + { + $title = JText::sprintf( + 'COM_FIELDS_VIEW_FIELD_' . ($isNew ? 'ADD' : 'EDIT') . '_TITLE', + $this->escape(JText::_($component_section_key)) + ); + } + // Else use the base title + else + { + $title = JText::_('COM_FIELDS_VIEW_FIELD_BASE_' . ($isNew ? 'ADD' : 'EDIT') . '_TITLE'); + } + + // Load specific component css + JHtml::_('stylesheet', $component . '/administrator/fields.css', array(), true); + + // Prepare the toolbar. + JToolbarHelper::title( + $title, + 'puzzle field-' . ($isNew ? 'add' : 'edit') . ' ' . substr($component, 4) . ($section ? "-$section" : '') . '-field-' . + ($isNew ? 'add' : 'edit') + ); + + // For new records, check the create permission. + if ($isNew) + { + JToolbarHelper::apply('field.apply'); + JToolbarHelper::save('field.save'); + JToolbarHelper::save2new('field.save2new'); + } + + // If not checked out, can save the item. + elseif (! $checkedOut && ($canDo->get('core.edit') || ($canDo->get('core.edit.own') && $this->item->created_user_id == $userId))) + { + JToolbarHelper::apply('field.apply'); + JToolbarHelper::save('field.save'); + + if ($canDo->get('core.create')) + { + JToolbarHelper::save2new('field.save2new'); + } + } + + // If an existing item, can save to a copy. + if (! $isNew && $canDo->get('core.create')) + { + JToolbarHelper::save2copy('field.save2copy'); + } + + if (empty($this->item->id)) + { + JToolbarHelper::cancel('field.cancel'); + } + else + { + JToolbarHelper::cancel('field.cancel', 'JTOOLBAR_CLOSE'); + } + + JToolbarHelper::divider(); + + // Compute the ref_key if it does exist in the component + if (! $lang->hasKey($ref_key = strtoupper($component . ($section ? "_$section" : '')) . '_FIELD_' . ($isNew ? 'ADD' : 'EDIT') . '_HELP_KEY')) + { + $ref_key = 'JHELP_COMPONENTS_' . strtoupper(substr($component, 4) . ($section ? "_$section" : '')) . '_FIELD_' . ($isNew ? 'ADD' : 'EDIT'); + } + + /* + * Get help for the field/section view for the component by + * -remotely searching in a language defined dedicated URL: + * *component*_HELP_URL + * -locally searching in a component help file if helpURL param exists + * in the component and is set to '' + * -remotely searching in a component URL if helpURL param exists in the + * component and is NOT set to '' + */ + if ($lang->hasKey($lang_help_url = strtoupper($component) . '_HELP_URL')) + { + $debug = $lang->setDebug(false); + $url = JText::_($lang_help_url); + $lang->setDebug($debug); + } + else + { + $url = null; + } + } +} diff --git a/administrator/components/com_fields/views/fields/tmpl/default.php b/administrator/components/com_fields/views/fields/tmpl/default.php new file mode 100644 index 0000000000000..e9d64ab666811 --- /dev/null +++ b/administrator/components/com_fields/views/fields/tmpl/default.php @@ -0,0 +1,211 @@ +get('id'); +$context = $this->escape($this->state->get('filter.context')); +$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'); + +if ($saveOrder) +{ + $saveOrderingUrl = 'index.php?option=com_fields&task=fields.saveOrderAjax&tmpl=component'; + JHtml::_('sortablelist.sortable', 'fieldList', 'adminForm', strtolower($listDirn), $saveOrderingUrl, false, true); +} +?> + +
+
+ sidebar; ?> +
+
+
+
+ filterForm->getFieldsets('custom'); ?> + $fieldSet) : ?> + filterForm->getFieldset($name) as $field) : ?> + input; ?> + + +
  +
+ $this)); ?> + items)) : ?> +
+ +
+ + + + + + + + + + + + + + + + + + + + + + items as $i => $item) : ?> + + authorise('core.edit', $context . '.field.' . $item->id); ?> + authorise('core.admin', 'com_checkin') || $item->checked_out == $userId || $item->checked_out == 0; ?> + authorise('core.edit.own', $context . '.field.' . $item->id) && $item->created_user_id == $userId; ?> + authorise('core.edit.state', $context . '.field.' . $item->id) && $canCheckin; ?> + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + state->get('list.direction'), $this->state->get('list.ordering')); ?> + + +
+ pagination->getListFooter(); ?> +
+ + + + + + + + + + + + + + id); ?> + + state, $i, 'fields.', $canChange); ?> + +
+ checked_out) : ?> + editor, $item->checked_out_time, 'fields.', $canCheckin); ?> + + + + escape($item->title); ?> + + escape($item->title); ?> + + + note)) : ?> + escape($item->alias)); ?> + + escape($item->alias), $this->escape($item->note)); ?> + + +
+ component)); ?> + + + assigned_cat_ids)); ?> + + + + + + + + get($cat); ?> + id == 'root') : ?> + + + title . ','; ?> + + + +
+
+
+ type); ?> + hasKey($label)) : ?> + type); ?> + + escape(JText::_($label)); ?> + + escape($item->category_title); ?> + + escape($item->access_level); ?> + + language == '*') : ?> + + + language_title ? JHtml::_('image', 'mod_languages/' . $item->language_image . '.gif', $item->language_title, array('title' => $item->language_title), true) . ' ' . $this->escape($item->language_title) : JText::_('JUNDEFINED'); ?> + + + id; ?> +
+ + authorise('core.create', $context) + && $user->authorise('core.edit', $context) + && $user->authorise('core.edit.state', $context)) : ?> + JText::_('COM_FIELDS_VIEW_FIELDS_BATCH_OPTIONS'), + 'footer' => $this->loadTemplate('batch_footer') + ), + $this->loadTemplate('batch_body') + ); ?> + + + + + + + +
+
diff --git a/administrator/components/com_fields/views/fields/tmpl/default_batch_body.php b/administrator/components/com_fields/views/fields/tmpl/default_batch_body.php new file mode 100644 index 0000000000000..f54cf1e92e85c --- /dev/null +++ b/administrator/components/com_fields/views/fields/tmpl/default_batch_body.php @@ -0,0 +1,35 @@ +state->get('filter.published'); +$context = $this->escape($this->state->get('filter.context')); +?> + +
+
+
+ +
+
+
+
+ +
+
+
+
+
+
+ +
+
+
diff --git a/administrator/components/com_fields/views/fields/tmpl/default_batch_footer.php b/administrator/components/com_fields/views/fields/tmpl/default_batch_footer.php new file mode 100644 index 0000000000000..d7865e9ec4543 --- /dev/null +++ b/administrator/components/com_fields/views/fields/tmpl/default_batch_footer.php @@ -0,0 +1,17 @@ + + + \ No newline at end of file diff --git a/administrator/components/com_fields/views/fields/tmpl/modal.php b/administrator/components/com_fields/views/fields/tmpl/modal.php new file mode 100644 index 0000000000000..da9906b4fa693 --- /dev/null +++ b/administrator/components/com_fields/views/fields/tmpl/modal.php @@ -0,0 +1,171 @@ +isSite()) +{ + JSession::checkToken('get') or die(JText::_('JINVALID_TOKEN')); +} + +JHtml::addIncludePath(JPATH_COMPONENT . '/helpers/html'); +JHtml::_('bootstrap.tooltip'); +JHtml::_('behavior.framework', true); +JHtml::_('formbehavior.chosen', 'select'); + +$function = $app->input->getCmd('function', 'jSelectField'); +$listOrder = $this->escape($this->state->get('list.ordering')); +$listDirn = $this->escape($this->state->get('list.direction')); +?> +
+
+
+
+ +
+
+ +
+
+ + +
+
+
+
+ + + + + state->get('filter.forcedLanguage')) : ?> + + + + + +
+
+ + items)) : ?> +
+ +
+ + + + + + + + + + + + + + + + + + + items as $i => $item) : ?> + + + + + + + + + + +
+ + + + + + + + + + + +
+ pagination->getListFooter(); ?> +
+ state, $i, 'fields.', false); ?> + + + escape($item->title); ?> + + note)) : ?> + escape($item->alias)); ?> + + escape($item->alias), $this->escape($item->note)); ?> + + component)); ?> + + + assigned_cat_ids); ?> + + + + + get($cat); ?> + id == 'root') : ?> + + + title . ','; ?> + + + + + + type); ?> + hasKey($label)) : ?> + type); ?> + + escape(JText::_($label)); ?> + + escape($item->access_level); ?> + + language == '*'):?> + + + language_title ? $this->escape($item->language_title) : JText::_('JUNDEFINED'); ?> + + + id; ?> +
+ + +
+ + + + + +
+
diff --git a/administrator/components/com_fields/views/fields/view.html.php b/administrator/components/com_fields/views/fields/view.html.php new file mode 100644 index 0000000000000..91b40808b03ec --- /dev/null +++ b/administrator/components/com_fields/views/fields/view.html.php @@ -0,0 +1,226 @@ +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'))) + { + JError::raiseError(500, implode("\n", $errors)); + + return false; + } + + $this->context = JFactory::getApplication()->input->getCmd('context'); + $parts = FieldsHelper::extract($this->context); + + if (!$parts) + { + JError::raiseError(500, 'Invalid context!!'); + + return; + } + + $this->component = $parts[0]; + $this->section = $parts[1]; + + $this->addToolbar(); + $this->sidebar = JHtmlSidebar::render(); + parent::display($tpl); + } + + /** + * Adds the toolbar. + * + * @return void + * + * @since __DEPLOY_VERSION__ + */ + protected function addToolbar() + { + $fieldId = $this->state->get('filter.field_id'); + $user = JFactory::getUser(); + $component = $this->component; + $section = $this->section; + $canDo = new JObject; + + if (JFile::exists(JPATH_ADMINISTRATOR . '/components/' . $component . '/access.xml')) + { + $canDo = JHelperContent::getActions($component, 'field', $fieldId); + } + + // Get the toolbar object instance + $bar = JToolBar::getInstance('toolbar'); + + // Avoid nonsense situation. + if ($component == 'com_fields') + { + return; + } + + // Need to load the menu language file as mod_menu hasn't been loaded yet. + $lang = JFactory::getLanguage(); + $lang->load($component, JPATH_BASE, null, false, true) || + $lang->load($component, JPATH_ADMINISTRATOR . '/components/' . $component, null, false, true); + + // If a component categories title string is present, let's use it. + if ($lang->hasKey($component_title_key = strtoupper($component . '_FIELDS_' . ($section ? $section : '')) . '_FIELDS_TITLE')) + { + $title = JText::_($component_title_key); + } + elseif ($lang->hasKey($component_section_key = strtoupper($component . '_FIELDS_SECTION_' . ($section ? $section : '')))) + { + // Else if the component section string exits, let's use it + $title = JText::sprintf('COM_FIELDS_VIEW_FIELDS_TITLE', $this->escape(JText::_($component_section_key))); + } + else + { + $title = JText::_('COM_FIELDS_VIEW_FIELDS_BASE_TITLE'); + } + + // Load specific component css + JHtml::_('stylesheet', $component . '/administrator/fields.css', array(), true); + + // 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 ($user->authorise('core.create', $this->context) && $user->authorise('core.edit', $this->context) + && $user->authorise('core.edit.state', $this->context)) + { + $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.published') == - 2 && $canDo->get('core.delete', $component)) + { + JToolbarHelper::deleteList('', 'fields.delete', 'JTOOLBAR_EMPTY_TRASH'); + } + elseif ($canDo->get('core.edit.state')) + { + JToolbarHelper::trash('fields.trash'); + } + + // Compute the ref_key if it does exist in the component + if (!$lang->hasKey($ref_key = strtoupper($component . ($section ? "_$section" : '')) . '_FIELDS_HELP_KEY')) + { + $ref_key = 'JHELP_COMPONENTS_' . strtoupper(substr($component, 4) . ($section ? "_$section" : '')) . '_FIELDS'; + } + + /* + * Get help for the fields view for the component by + * -remotely searching in a language defined dedicated URL: + * *component*_HELP_URL + * -locally searching in a component help file if helpURL param exists + * in the component and is set to '' + * -remotely searching in a component URL if helpURL param exists in the + * component and is NOT set to '' + */ + if ($lang->hasKey($lang_help_url = strtoupper($component) . '_HELP_URL')) + { + $debug = $lang->setDebug(false); + $url = JText::_($lang_help_url); + $lang->setDebug($debug); + } + else + { + $url = null; + } + + } + + /** + * Returns the sort fields. + * + * @return array + * + * @since __DEPLOY_VERSION__ + */ + protected function getSortFields() + { + return array( + 'a.ordering' => JText::_('JGRID_HEADING_ORDERING'), + 'a.published' => JText::_('JSTATUS'), + 'a.title' => JText::_('JGLOBAL_TITLE'), + 'a.type' => JText::_('COM_FIELDS_FIELD_TYPE_LABEL'), + 'a.access' => JText::_('JGRID_HEADING_ACCESS'), + 'language' => JText::_('JGRID_HEADING_LANGUAGE'), + 'a.id' => JText::_('JGRID_HEADING_ID'), + ); + } +} diff --git a/administrator/components/com_finder/models/fields/branches.php b/administrator/components/com_finder/models/fields/branches.php index ae6f63e2d4ea0..1451cc358403e 100644 --- a/administrator/components/com_finder/models/fields/branches.php +++ b/administrator/components/com_finder/models/fields/branches.php @@ -9,14 +9,12 @@ defined('JPATH_BASE') or die(); -JFormHelper::loadFieldClass('list'); - /** * Search Filter field for the Finder package. * * @since 3.5 */ -class JFormFieldBranches extends JFormFieldList +class JFormFieldBranches extends JFormAbstractlist { /** * The form field type. diff --git a/administrator/components/com_finder/models/fields/contenttypes.php b/administrator/components/com_finder/models/fields/contenttypes.php index a14ebf5afc5b2..a8c37a2ea9e11 100644 --- a/administrator/components/com_finder/models/fields/contenttypes.php +++ b/administrator/components/com_finder/models/fields/contenttypes.php @@ -9,8 +9,6 @@ defined('JPATH_BASE') or die(); -JFormHelper::loadFieldClass('list'); - use Joomla\Utilities\ArrayHelper; JLoader::register('FinderHelperLanguage', JPATH_ADMINISTRATOR . '/components/com_finder/helpers/language.php'); @@ -20,7 +18,7 @@ * * @since 3.6.0 */ -class JFormFieldContentTypes extends JFormFieldList +class JFormFieldContentTypes extends JFormAbstractlist { /** * The form field type. diff --git a/administrator/components/com_finder/models/fields/directories.php b/administrator/components/com_finder/models/fields/directories.php index a65657b02d3f9..c9905536e98d5 100644 --- a/administrator/components/com_finder/models/fields/directories.php +++ b/administrator/components/com_finder/models/fields/directories.php @@ -9,8 +9,6 @@ defined('_JEXEC') or die; -JFormHelper::loadFieldClass('list'); - // Load the base adapter. JLoader::register('FinderIndexerAdapter', JPATH_ADMINISTRATOR . '/components/com_finder/helpers/indexer/adapter.php'); @@ -19,7 +17,7 @@ * * @since 2.5 */ -class JFormFieldDirectories extends JFormFieldList +class JFormFieldDirectories extends JFormAbstractlist { /** * The form field type. diff --git a/administrator/components/com_finder/models/fields/searchfilter.php b/administrator/components/com_finder/models/fields/searchfilter.php index 4e5a034213606..e56213efe101b 100644 --- a/administrator/components/com_finder/models/fields/searchfilter.php +++ b/administrator/components/com_finder/models/fields/searchfilter.php @@ -9,14 +9,12 @@ defined('JPATH_BASE') or die(); -JFormHelper::loadFieldClass('list'); - /** * Search Filter field for the Finder package. * * @since 2.5 */ -class JFormFieldSearchFilter extends JFormFieldList +class JFormFieldSearchFilter extends JFormAbstractlist { /** * The form field type. diff --git a/administrator/components/com_installer/models/fields/extensionstatus.php b/administrator/components/com_installer/models/fields/extensionstatus.php index 1a6ef20416835..425367cee0dab 100644 --- a/administrator/components/com_installer/models/fields/extensionstatus.php +++ b/administrator/components/com_installer/models/fields/extensionstatus.php @@ -9,8 +9,6 @@ defined('_JEXEC') or die; -JFormHelper::loadFieldClass('list'); - JLoader::register('InstallerHelper', JPATH_ADMINISTRATOR . '/components/com_installer/helpers/installer.php'); /** @@ -18,7 +16,7 @@ * * @since 3.5 */ -class JFormFieldExtensionStatus extends JFormFieldList +class JFormFieldExtensionStatus extends JFormAbstractlist { /** * The form field type. diff --git a/administrator/components/com_installer/models/fields/folder.php b/administrator/components/com_installer/models/fields/folder.php index 08dbfd35fd24a..48878e49d921c 100644 --- a/administrator/components/com_installer/models/fields/folder.php +++ b/administrator/components/com_installer/models/fields/folder.php @@ -9,8 +9,6 @@ defined('_JEXEC') or die; -JFormHelper::loadFieldClass('list'); - JLoader::register('InstallerHelper', JPATH_ADMINISTRATOR . '/components/com_installer/helpers/installer.php'); /** @@ -18,7 +16,7 @@ * * @since 3.5 */ -class JFormFieldFolder extends JFormFieldList +class JFormFieldFolder extends JFormAbstractlist { /** * The form field type. diff --git a/administrator/components/com_installer/models/fields/location.php b/administrator/components/com_installer/models/fields/location.php index a73177b668000..25c541add72f0 100644 --- a/administrator/components/com_installer/models/fields/location.php +++ b/administrator/components/com_installer/models/fields/location.php @@ -9,8 +9,6 @@ defined('_JEXEC') or die; -JFormHelper::loadFieldClass('list'); - JLoader::register('InstallerHelper', JPATH_ADMINISTRATOR . '/components/com_installer/helpers/installer.php'); /** @@ -18,7 +16,7 @@ * * @since 3.5 */ -class JFormFieldLocation extends JFormFieldList +class JFormFieldLocation extends JFormAbstractlist { /** * The form field type. diff --git a/administrator/components/com_installer/models/fields/type.php b/administrator/components/com_installer/models/fields/type.php index e3f01db143824..456f47c3f7c3e 100644 --- a/administrator/components/com_installer/models/fields/type.php +++ b/administrator/components/com_installer/models/fields/type.php @@ -9,8 +9,6 @@ defined('_JEXEC') or die; -JFormHelper::loadFieldClass('list'); - JLoader::register('InstallerHelper', JPATH_ADMINISTRATOR . '/components/com_installer/helpers/installer.php'); /** @@ -18,7 +16,7 @@ * * @since 3.5 */ -class JFormFieldType extends JFormFieldList +class JFormFieldType extends JFormAbstractlist { /** * The form field type. diff --git a/administrator/components/com_menus/models/fields/menuordering.php b/administrator/components/com_menus/models/fields/menuordering.php index d78d8e19252e5..2e25df45651ae 100644 --- a/administrator/components/com_menus/models/fields/menuordering.php +++ b/administrator/components/com_menus/models/fields/menuordering.php @@ -9,14 +9,12 @@ defined('JPATH_BASE') or die; -JFormHelper::loadFieldClass('list'); - /** * Form Field class for the Joomla Framework. * * @since 1.6 */ -class JFormFieldMenuOrdering extends JFormFieldList +class JFormFieldMenuOrdering extends JFormAbstractlist { /** * The form field type. diff --git a/administrator/components/com_menus/models/fields/menuparent.php b/administrator/components/com_menus/models/fields/menuparent.php index cb665c34e41f6..fe25a5591b2b9 100644 --- a/administrator/components/com_menus/models/fields/menuparent.php +++ b/administrator/components/com_menus/models/fields/menuparent.php @@ -9,14 +9,12 @@ defined('JPATH_BASE') or die; -JFormHelper::loadFieldClass('list'); - /** * Form Field class for the Joomla Framework. * * @since 1.6 */ -class JFormFieldMenuParent extends JFormFieldList +class JFormFieldMenuParent extends JFormAbstractlist { /** * The form field type. diff --git a/administrator/components/com_menus/models/fields/menutype.php b/administrator/components/com_menus/models/fields/menutype.php index 68c7b4b82d78a..4bc104fc59485 100644 --- a/administrator/components/com_menus/models/fields/menutype.php +++ b/administrator/components/com_menus/models/fields/menutype.php @@ -11,14 +11,12 @@ use Joomla\Utilities\ArrayHelper; -JFormHelper::loadFieldClass('list'); - /** * Form Field class for the Joomla Framework. * * @since 1.6 */ -class JFormFieldMenutype extends JFormFieldList +class JFormFieldMenutype extends JFormAbstractlist { /** * The form field type. diff --git a/administrator/components/com_messages/models/fields/messagestates.php b/administrator/components/com_messages/models/fields/messagestates.php index b505fe4550ad8..68d3f8863af53 100644 --- a/administrator/components/com_messages/models/fields/messagestates.php +++ b/administrator/components/com_messages/models/fields/messagestates.php @@ -9,8 +9,6 @@ defined('JPATH_BASE') or die; -JFormHelper::loadFieldClass('list'); - JLoader::register('MessagesHelper', JPATH_ADMINISTRATOR . '/components/com_messages/helpers/messages.php'); /** @@ -18,7 +16,7 @@ * * @since 3.6.0 */ -class JFormFieldMessageStates extends JFormFieldList +class JFormFieldMessageStates extends JFormAbstractlist { /** * The form field type. diff --git a/administrator/components/com_modules/models/fields/modulesmodule.php b/administrator/components/com_modules/models/fields/modulesmodule.php index 81c3586a416c1..09fe040606ea3 100644 --- a/administrator/components/com_modules/models/fields/modulesmodule.php +++ b/administrator/components/com_modules/models/fields/modulesmodule.php @@ -9,8 +9,6 @@ defined('JPATH_BASE') or die; -JFormHelper::loadFieldClass('list'); - JLoader::register('ModulesHelper', JPATH_ADMINISTRATOR . '/components/com_modules/helpers/modules.php'); /** @@ -18,7 +16,7 @@ * * @since 3.4.2 */ -class JFormFieldModulesModule extends JFormFieldList +class JFormFieldModulesModule extends JFormAbstractlist { /** * The form field type. diff --git a/administrator/components/com_modules/models/fields/modulesposition.php b/administrator/components/com_modules/models/fields/modulesposition.php index 8cda336e44462..fef92bce13f35 100644 --- a/administrator/components/com_modules/models/fields/modulesposition.php +++ b/administrator/components/com_modules/models/fields/modulesposition.php @@ -9,8 +9,6 @@ defined('JPATH_BASE') or die; -JFormHelper::loadFieldClass('list'); - JLoader::register('ModulesHelper', JPATH_ADMINISTRATOR . '/components/com_modules/helpers/modules.php'); /** @@ -18,7 +16,7 @@ * * @since 3.4.2 */ -class JFormFieldModulesPosition extends JFormFieldList +class JFormFieldModulesPosition extends JFormAbstractlist { /** * The form field type. diff --git a/administrator/components/com_newsfeeds/models/fields/newsfeeds.php b/administrator/components/com_newsfeeds/models/fields/newsfeeds.php index 53f65997dfedb..f6691c667137c 100644 --- a/administrator/components/com_newsfeeds/models/fields/newsfeeds.php +++ b/administrator/components/com_newsfeeds/models/fields/newsfeeds.php @@ -9,14 +9,12 @@ defined('JPATH_BASE') or die; -JFormHelper::loadFieldClass('list'); - /** * Form Field class for the Joomla Framework. * * @since 1.6 */ -class JFormFieldNewsfeeds extends JFormFieldList +class JFormFieldNewsfeeds extends JFormAbstractlist { /** * The form field type. diff --git a/administrator/components/com_plugins/models/fields/plugintype.php b/administrator/components/com_plugins/models/fields/plugintype.php index 16e0ebd8dcee6..ec4cadf358080 100644 --- a/administrator/components/com_plugins/models/fields/plugintype.php +++ b/administrator/components/com_plugins/models/fields/plugintype.php @@ -9,8 +9,6 @@ defined('_JEXEC') or die; -JFormHelper::loadFieldClass('list'); - JLoader::register('PluginsHelper', JPATH_ADMINISTRATOR . '/components/com_plugins/helpers/plugins.php'); /** @@ -18,7 +16,7 @@ * * @since 3.5 */ -class JFormFieldPluginType extends JFormFieldList +class JFormFieldPluginType extends JFormAbstractlist { /** * The form field type. diff --git a/administrator/components/com_redirect/models/fields/redirect.php b/administrator/components/com_redirect/models/fields/redirect.php index 47a2296046e68..54dcf55378b1b 100644 --- a/administrator/components/com_redirect/models/fields/redirect.php +++ b/administrator/components/com_redirect/models/fields/redirect.php @@ -9,8 +9,6 @@ defined('JPATH_BASE') or die; -JFormHelper::loadFieldClass('list'); - /** * A dropdown containing all valid HTTP 1.1 response codes. * @@ -18,7 +16,7 @@ * @subpackage com_redirect * @since 3.4 */ -class JFormFieldRedirect extends JFormFieldList +class JFormFieldRedirect extends JFormAbstractlist { /** * The form field type. diff --git a/administrator/components/com_templates/models/fields/templatelocation.php b/administrator/components/com_templates/models/fields/templatelocation.php index a7fd6ab1736cc..74fd97ddfddbd 100644 --- a/administrator/components/com_templates/models/fields/templatelocation.php +++ b/administrator/components/com_templates/models/fields/templatelocation.php @@ -9,8 +9,6 @@ defined('_JEXEC') or die; -JFormHelper::loadFieldClass('list'); - JLoader::register('TemplatesHelper', JPATH_ADMINISTRATOR . '/components/com_templates/helpers/templates.php'); /** @@ -18,7 +16,7 @@ * * @since 3.5 */ -class JFormFieldTemplateLocation extends JFormFieldList +class JFormFieldTemplateLocation extends JFormAbstractlist { /** * The form field type. diff --git a/administrator/components/com_templates/models/fields/templatename.php b/administrator/components/com_templates/models/fields/templatename.php index 954fc4f10f791..df238437ff893 100644 --- a/administrator/components/com_templates/models/fields/templatename.php +++ b/administrator/components/com_templates/models/fields/templatename.php @@ -9,8 +9,6 @@ defined('_JEXEC') or die; -JFormHelper::loadFieldClass('list'); - JLoader::register('TemplatesHelper', JPATH_ADMINISTRATOR . '/components/com_templates/helpers/templates.php'); /** @@ -18,7 +16,7 @@ * * @since 3.5 */ -class JFormFieldTemplateName extends JFormFieldList +class JFormFieldTemplateName extends JFormAbstractlist { /** * The form field type. diff --git a/administrator/components/com_users/access.xml b/administrator/components/com_users/access.xml index b10b8fe446277..591aeb52bbc75 100644 --- a/administrator/components/com_users/access.xml +++ b/administrator/components/com_users/access.xml @@ -8,6 +8,7 @@ +
diff --git a/administrator/components/com_users/config.xml b/administrator/components/com_users/config.xml index 2fa3d94d9cfb3..47762db7fb1dd 100644 --- a/administrator/components/com_users/config.xml +++ b/administrator/components/com_users/config.xml @@ -253,6 +253,18 @@ + + + + +
params->get('custom_fields_enable', '1')) + { + JHtmlSidebar::addEntry( + JText::_('JGLOBAL_FIELDS'), + 'index.php?option=com_fields&context=com_users.user', + $vName == 'fields.user' + ); + JHtmlSidebar::addEntry( + JText::_('JGLOBAL_FIELD_GROUPS'), + 'index.php?option=com_categories&extension=com_users.user.fields', + $vName == 'categories.user' + ); + } } /** diff --git a/administrator/components/com_users/models/fields/components.php b/administrator/components/com_users/models/fields/components.php index 80372bc387b57..ef606dd9cd62a 100644 --- a/administrator/components/com_users/models/fields/components.php +++ b/administrator/components/com_users/models/fields/components.php @@ -9,14 +9,12 @@ defined('JPATH_BASE') or die; -JFormHelper::loadFieldClass('list'); - /** * Form Field class for the Joomla Framework. * * @since 3.6.0 */ -class JFormFieldComponents extends JFormFieldList +class JFormFieldComponents extends JFormAbstractlist { /** * The form field type. diff --git a/administrator/components/com_users/models/fields/groupparent.php b/administrator/components/com_users/models/fields/groupparent.php index 1288dd5e7110a..47f88050f7a7c 100644 --- a/administrator/components/com_users/models/fields/groupparent.php +++ b/administrator/components/com_users/models/fields/groupparent.php @@ -9,14 +9,12 @@ defined('JPATH_BASE') or die; -JFormHelper::loadFieldClass('list'); - /** * Form Field class for the Joomla Framework. * * @since 1.6 */ -class JFormFieldGroupParent extends JFormFieldList +class JFormFieldGroupParent extends JFormAbstractlist { /** * The form field type. diff --git a/administrator/components/com_users/models/fields/levels.php b/administrator/components/com_users/models/fields/levels.php index a3b9a9bf10eb1..6ee98fd5cc228 100644 --- a/administrator/components/com_users/models/fields/levels.php +++ b/administrator/components/com_users/models/fields/levels.php @@ -9,14 +9,12 @@ defined('JPATH_BASE') or die; -JFormHelper::loadFieldClass('list'); - /** * Form Field class for the Joomla Framework. * * @since 3.6.0 */ -class JFormFieldLevels extends JFormFieldList +class JFormFieldLevels extends JFormAbstractlist { /** * The form field type. diff --git a/administrator/language/en-GB/en-GB.com_categories.ini b/administrator/language/en-GB/en-GB.com_categories.ini index 2d9d3ece8f95a..b7d66ef649b81 100644 --- a/administrator/language/en-GB/en-GB.com_categories.ini +++ b/administrator/language/en-GB/en-GB.com_categories.ini @@ -9,6 +9,7 @@ COM_CATEGORIES_ACCESS_CREATE_DESC="New setting for create actionsgetParent(); } + if (JComponentHelper::getComponent('com_users')->params->get('custom_fields_enable', '1')) + { + $menu->addChild( + new JMenuNode( + JText::_('MOD_MENU_FIELDS'), 'index.php?option=com_fields&context=com_users.user', 'class:fields') + ); + + $menu->addChild( + new JMenuNode( + JText::_('MOD_MENU_FIELDS_GROUP'), 'index.php?option=com_categories&extension=com_users.user.fields', 'class:category') + ); + } + if (JFactory::getApplication()->get('massmailoff') != 1) { $menu->addSeparator(); @@ -232,6 +245,19 @@ $menu->getParent(); } + if (JComponentHelper::getComponent('com_content')->params->get('custom_fields_enable', '1')) + { + $menu->addChild( + new JMenuNode( + JText::_('MOD_MENU_FIELDS'), 'index.php?option=com_fields&context=com_content.article', 'class:fields') + ); + + $menu->addChild( + new JMenuNode( + JText::_('MOD_MENU_FIELDS_GROUP'), 'index.php?option=com_categories&extension=com_content.article.fields', 'class:category') + ); + } + $menu->addChild(new JMenuNode(JText::_('MOD_MENU_COM_CONTENT_FEATURED'), 'index.php?option=com_content&view=featured', 'class:featured')); if ($user->authorise('core.manage', 'com_media')) diff --git a/components/com_contact/controllers/contact.php b/components/com_contact/controllers/contact.php index 8993230bc55dd..9c5d8aff3a14b 100644 --- a/components/com_contact/controllers/contact.php +++ b/components/com_contact/controllers/contact.php @@ -198,6 +198,20 @@ private function _sendEmail($data, $contact, $copy_email_activated) $prefix = JText::sprintf('COM_CONTACT_ENQUIRY_TEXT', JUri::base()); $body = $prefix . "\n" . $name . ' <' . $email . '>' . "\r\n\r\n" . stripslashes($body); + // Load the custom fields + if ($data['params'] && $fields = FieldsHelper::getFields('com_contact.mail', $contact, true, $data['params'])) + { + $output = FieldsHelper::render( + 'com_contact.mail', + 'fields.render', + array('context' => 'com_contact.mail', 'item' => $contact, 'fields' => $fields) + ); + if ($output) + { + $body .= "\r\n\r\n" . $output; + } + } + $mail = JFactory::getMailer(); $mail->addRecipient($contact->email_to); $mail->addReplyTo($email, $name); diff --git a/components/com_contact/layouts/field/render.php b/components/com_contact/layouts/field/render.php new file mode 100644 index 0000000000000..d8f9c75cb43f4 --- /dev/null +++ b/components/com_contact/layouts/field/render.php @@ -0,0 +1,40 @@ +label; +$value = $field->value; +$class = $field->render_class; + +if (!$value) +{ + return; +} + +if ($field->context == 'com_contact.mail') +{ + // Prepare the value for the contact form mail + echo $label . ': ' . $value . "\r\n"; + return; +} + +?> + +
+ : +
+
+ +
diff --git a/components/com_contact/layouts/fields/render.php b/components/com_contact/layouts/fields/render.php new file mode 100644 index 0000000000000..732f42229b811 --- /dev/null +++ b/components/com_contact/layouts/fields/render.php @@ -0,0 +1,89 @@ +fields ? $item->fields : FieldsHelper::getFields($context, $item, true); +} + +if (!$fields) +{ + return; +} + +// Load some output definitions +$container = 'dl'; + +if (key_exists('container', $displayData) && $displayData['container']) +{ + $container = $displayData['container']; +} + +$class = 'contact-fields dl-horizontal'; + +if (key_exists('container-class', $displayData) && $displayData['container-class']) +{ + $class = $displayData['container-class']; +} + +if ($fields[0]->context != 'com_contact.mail') +{ + // Print the container tag + echo '<' . $container . ' class="fields-container ' . $class . '">'; +} + +// Loop through the fields and print them +foreach ($fields as $field) +{ + // If the value is empty dp nothing + if (!isset($field->value) || !$field->value) + { + continue; + } + + echo FieldsHelper::render($context, 'field.render', array('field' => $field)); +} + +if ($fields[0]->context != 'com_contact.mail') +{ + // Close the container + echo ''; +} diff --git a/components/com_contact/models/contact.php b/components/com_contact/models/contact.php index 24ae2308bfb0f..6b0c235863919 100644 --- a/components/com_contact/models/contact.php +++ b/components/com_contact/models/contact.php @@ -85,7 +85,7 @@ protected function populateState() public function getForm($data = array(), $loadData = true) { // Get the form. - $form = $this->loadForm('com_contact.contact', 'contact', array('control' => 'jform', 'load_data' => true)); + $form = $this->loadForm('com_contact.mail', 'contact', array('control' => 'jform', 'load_data' => true)); if (empty($form)) { diff --git a/components/com_contact/models/forms/form.xml b/components/com_contact/models/forms/form.xml index 97c2d2e9f847b..236fe0978862c 100644 --- a/components/com_contact/models/forms/form.xml +++ b/components/com_contact/models/forms/form.xml @@ -461,6 +461,17 @@ + + + + JSHOW + + + + + get('show_user_custom_fields') && $this->contactUser) : ?> + loadTemplate('user_custom_fields'); ?> + + contact->misc && $tparams->get('show_misc')) : ?> diff --git a/components/com_contact/views/contact/tmpl/default.xml b/components/com_contact/views/contact/tmpl/default.xml index 391513adaf8c7..b81110abf6ed5 100644 --- a/components/com_contact/views/contact/tmpl/default.xml +++ b/components/com_contact/views/contact/tmpl/default.xml @@ -271,6 +271,17 @@ + + + + params; +$presentation_style = $params->get('presentation_style'); + +$displayGroups = $params->get('show_user_custom_fields'); +$userFieldGroups = array(); +?> + +contactUser) : ?> + + + +contactUser->fields as $field) :?> + catid, $displayGroups)) : ?> + + + category_title, $userFieldGroups)) : ?> + category_title] = array();?> + + category_title][] = $field;?> + + + $fields) :?> + + + + + + + ' . ($categoryTitle ? $categoryTitle : JText::_('COM_CONTACT_USER_FIELDS')) . ''; ?> + + +
+
+ + value) : ?> + + + + ' . $field->label . ''; ?> + ' . $field->value . ''; ?> + +
+
+ + + + + + + diff --git a/components/com_contact/views/contact/view.html.php b/components/com_contact/views/contact/view.html.php index 80e347ef52edd..5189b34f53604 100644 --- a/components/com_contact/views/contact/view.html.php +++ b/components/com_contact/views/contact/view.html.php @@ -263,16 +263,29 @@ public function display($tpl = null) $item->misc = $item->text; } + $contactUser = null; + if ($params->get('show_user_custom_fields') && $item->user_id && $contactUser = JFactory::getUser($item->user_id)) + { + $contactUser->text = ''; + JEventDispatcher::getInstance()->trigger('onContentPrepare', array ('com_users.user', &$contactUser, &$item->params, 0)); + + if (!isset($contactUser->fields)) + { + $contactUser->fields = array(); + } + } + // Escape strings for HTML output $this->pageclass_sfx = htmlspecialchars($params->get('pageclass_sfx')); - $this->contact = &$item; - $this->params = &$params; - $this->return = &$return; - $this->state = &$state; - $this->item = &$item; - $this->user = &$user; - $this->contacts = &$contacts; + $this->contact = &$item; + $this->params = &$params; + $this->return = &$return; + $this->state = &$state; + $this->item = &$item; + $this->user = &$user; + $this->contacts = &$contacts; + $this->contactUser = $contactUser; $item->tags = new JHelperTags; $item->tags->getItemTags('com_contact.contact', $this->item->id); diff --git a/components/com_content/layouts/field/prepare/modal_article.php b/components/com_content/layouts/field/prepare/modal_article.php new file mode 100644 index 0000000000000..f8e22cfea0a56 --- /dev/null +++ b/components/com_content/layouts/field/prepare/modal_article.php @@ -0,0 +1,47 @@ +value; + +if (!$value) +{ + return; +} + +JLoader::import('joomla.application.component.model'); +JModelLegacy::addIncludePath(JPATH_BASE . '/components/com_content/models', 'ContentModel'); +$model = JModelLegacy::getInstance('Article', 'ContentModel'); + +// If the article is not found an error is thrown we need to hold the +// old error handler +$errorHandler = JError::getErrorHandling(E_ERROR); + +// Ignoring all errors +JError::setErrorHandling(E_ERROR, 'ignore'); + +// Fetching the article +$article = $model->getItem($value); + +// Restoreing the old error handler +JError::setErrorHandling(E_ERROR, $errorHandler['mode'], $errorHandler['options']); + +if ($article instanceof JException) +{ + return; +} + +echo htmlentities($article->title); diff --git a/components/com_content/views/form/tmpl/edit.php b/components/com_content/views/form/tmpl/edit.php index 12439bef6c1f2..fc67e01253fd2 100644 --- a/components/com_content/views/form/tmpl/edit.php +++ b/components/com_content/views/form/tmpl/edit.php @@ -100,6 +100,9 @@ form->getFieldsets('params') as $name => $fieldSet) : ?> label)); ?> + description) && trim($fieldSet->description)): ?> + ' . $this->escape(JText::_($fieldSet->description)) . '

'; ?> + form->getFieldset($name) as $field) : ?> renderField(); ?> diff --git a/components/com_fields/controller.php b/components/com_fields/controller.php new file mode 100644 index 0000000000000..e5632f402f6bd --- /dev/null +++ b/components/com_fields/controller.php @@ -0,0 +1,18 @@ +input->get($this->input->get('formcontrol', 'jform'), array(), 'array'); + $parts = FieldsHelper::extract($this->input->getCmd('context')); + + if ($parts) + { + $app->setUserState($parts[0] . '.edit.' . $parts[1] . '.data', $data); + } + + $app->redirect(base64_decode($this->input->get->getBase64('return'))); + $app->close(); + } +} diff --git a/components/com_fields/fields.php b/components/com_fields/fields.php new file mode 100644 index 0000000000000..9226ce51142f4 --- /dev/null +++ b/components/com_fields/fields.php @@ -0,0 +1,15 @@ +execute(JFactory::getApplication()->input->get('task')); +$controller->redirect(); diff --git a/components/com_fields/layouts/field/prepare/base.php b/components/com_fields/layouts/field/prepare/base.php new file mode 100644 index 0000000000000..6af8b844a2d0c --- /dev/null +++ b/components/com_fields/layouts/field/prepare/base.php @@ -0,0 +1,29 @@ +value; + +if (!$value) +{ + return; +} + +if (is_array($value)) +{ + $value = implode(', ', $value); +} + +echo htmlentities($value); diff --git a/components/com_fields/layouts/field/prepare/captcha.php b/components/com_fields/layouts/field/prepare/captcha.php new file mode 100644 index 0000000000000..331fb288d1e18 --- /dev/null +++ b/components/com_fields/layouts/field/prepare/captcha.php @@ -0,0 +1,11 @@ +value; + +if (!$value) +{ + return; +} + +$value = (array) $value; +$texts = array();$options = JFormFieldList::getOptionsFromField($field); + +foreach ($options as $index => $optionsValue) +{ + if (in_array($index, $value)) + { + $texts[] = $optionsValue; + } +} + +echo htmlentities(implode(', ', $texts)); diff --git a/components/com_fields/layouts/field/prepare/editor.php b/components/com_fields/layouts/field/prepare/editor.php new file mode 100644 index 0000000000000..5a68253c2a72c --- /dev/null +++ b/components/com_fields/layouts/field/prepare/editor.php @@ -0,0 +1,24 @@ +value; + +if (!$value) +{ + return; +} + +echo JHTML::_('content.prepare', $value); diff --git a/components/com_fields/layouts/field/prepare/imagelist.php b/components/com_fields/layouts/field/prepare/imagelist.php new file mode 100644 index 0000000000000..85dec1cd10c15 --- /dev/null +++ b/components/com_fields/layouts/field/prepare/imagelist.php @@ -0,0 +1,38 @@ +value; + +if (!$value) +{ + return; +} + +$value = (array) $value; +$buffer = ''; + +foreach ($value as $path) +{ + if (!$path || $path == '-1') + { + continue; + } + + $buffer .= ''; +} + +echo $buffer; diff --git a/components/com_fields/layouts/field/prepare/list.php b/components/com_fields/layouts/field/prepare/list.php new file mode 100644 index 0000000000000..3882ddba1be8b --- /dev/null +++ b/components/com_fields/layouts/field/prepare/list.php @@ -0,0 +1,35 @@ +value; + +if (!$value) +{ + return; +} + +$value = (array) $value; +$texts = array();$options = JFormAbstractlist::getOptionsFromField($field); + +foreach ($options as $index => $optionsValue) +{ + if (in_array($index, $value)) + { + $texts[] = $optionsValue; + } +} + +echo htmlentities(implode(', ', $texts)); diff --git a/components/com_fields/layouts/field/prepare/media.php b/components/com_fields/layouts/field/prepare/media.php new file mode 100644 index 0000000000000..a758a21f653f2 --- /dev/null +++ b/components/com_fields/layouts/field/prepare/media.php @@ -0,0 +1,37 @@ +value; + +if (!$value) +{ + return; +} + +$value = (array) $value; +$buffer = ''; + +foreach ($value as $path) +{ + if (!$path) + { + continue; + } + + $buffer .= ''; +} + +echo $buffer; diff --git a/components/com_fields/layouts/field/prepare/sql.php b/components/com_fields/layouts/field/prepare/sql.php new file mode 100644 index 0000000000000..f53cc691937a8 --- /dev/null +++ b/components/com_fields/layouts/field/prepare/sql.php @@ -0,0 +1,64 @@ +value; + +if (!$value) +{ + return; +} + +$db = JFactory::getDbo(); +$value = (array) $value; +$condition = ''; + +foreach ($value as $v) +{ + if (!$v) + { + continue; + } + + $condition .= ', ' . $db->q($v); +} + +$query = $field->fieldparams->get('query', 'select id as value, name as text from #__users'); + +// 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)); diff --git a/components/com_fields/layouts/field/prepare/textarea.php b/components/com_fields/layouts/field/prepare/textarea.php new file mode 100644 index 0000000000000..5a68253c2a72c --- /dev/null +++ b/components/com_fields/layouts/field/prepare/textarea.php @@ -0,0 +1,24 @@ +value; + +if (!$value) +{ + return; +} + +echo JHTML::_('content.prepare', $value); diff --git a/components/com_fields/layouts/field/prepare/url.php b/components/com_fields/layouts/field/prepare/url.php new file mode 100644 index 0000000000000..32ab25cda21cf --- /dev/null +++ b/components/com_fields/layouts/field/prepare/url.php @@ -0,0 +1,31 @@ +value; + +if (!$value) +{ + return; +} + +$attributes = ''; + +if (!JUri::isInternal($value)) +{ + $attributes = 'rel="nofollow" target="_blank"'; +} + +echo '' . $value . ''; diff --git a/components/com_fields/layouts/field/prepare/user.php b/components/com_fields/layouts/field/prepare/user.php new file mode 100644 index 0000000000000..27047ee6f3f6b --- /dev/null +++ b/components/com_fields/layouts/field/prepare/user.php @@ -0,0 +1,47 @@ +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)); diff --git a/components/com_fields/layouts/field/prepare/usergrouplist.php b/components/com_fields/layouts/field/prepare/usergrouplist.php new file mode 100644 index 0000000000000..925343ba5066e --- /dev/null +++ b/components/com_fields/layouts/field/prepare/usergrouplist.php @@ -0,0 +1,38 @@ +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)); diff --git a/components/com_fields/layouts/field/render.php b/components/com_fields/layouts/field/render.php new file mode 100644 index 0000000000000..cfcc338d0a919 --- /dev/null +++ b/components/com_fields/layouts/field/render.php @@ -0,0 +1,31 @@ +label; +$value = $field->value; +$class = $field->params->get('render_class'); + +if (!$value) +{ + return; +} + +?> + +
+ : + +
diff --git a/components/com_fields/layouts/fields/render.php b/components/com_fields/layouts/fields/render.php new file mode 100644 index 0000000000000..bd37bba14cbe8 --- /dev/null +++ b/components/com_fields/layouts/fields/render.php @@ -0,0 +1,83 @@ +fields ? $item->fields : FieldsHelper::getFields($context, $item, true); +} + +if (!$fields) +{ + return; +} + +// Load some output definitions +$container = 'dl'; + +if (key_exists('container', $displayData) && $displayData['container']) +{ + $container = $displayData['container']; +} + +$class = 'article-info muted'; + +if (key_exists('container-class', $displayData) && $displayData['container-class']) +{ + $class = $displayData['container-class']; +} + +// Print the container tag +echo '<' . $container . ' class="fields-container ' . $class . '">'; + +// Loop through the fields and print them +foreach ($fields as $field) +{ + // If the value is empty dp nothing + if (!isset($field->value) || !$field->value) + { + continue; + } + + echo FieldsHelper::render($context, 'field.render', array('field' => $field)); +} + +// Close the container +echo ''; diff --git a/components/com_users/models/profile.php b/components/com_users/models/profile.php index 5e45ccae75284..d880d469170b8 100644 --- a/components/com_users/models/profile.php +++ b/components/com_users/models/profile.php @@ -192,6 +192,10 @@ public function getForm($data = array(), $loadData = true) return false; } + // For com_fields the context is com_users.user + JLoader::import('components.com_fields.helpers.fields', JPATH_ADMINISTRATOR); + FieldsHelper::prepareForm('com_users.user', $form, $data); + // Check for username compliance and parameter set $isUsernameCompliant = true; diff --git a/components/com_users/views/profile/tmpl/default_custom.php b/components/com_users/views/profile/tmpl/default_custom.php index 5a93f6fbaf5df..8876039cd5ec0 100644 --- a/components/com_users/views/profile/tmpl/default_custom.php +++ b/components/com_users/views/profile/tmpl/default_custom.php @@ -23,6 +23,14 @@ { unset($fieldsets['params']); } + +$tmp = isset($this->data->fields) ? $this->data->fields : array(); +$customFields = array(); + +foreach ($tmp as $customField) +{ + $customFields[$customField->alias] = $customField; +} ?> $fieldset) : ?> form->getFieldset($group); ?> @@ -36,7 +44,9 @@ hidden && $field->type !== 'Spacer') : ?>
title; ?>
- id)) : ?> + fieldname, $customFields)) : ?> + fieldname]->value; ?> + id)) : ?> id, $field->value); ?> fieldname)) : ?> fieldname, $field->value); ?> diff --git a/components/com_users/views/profile/tmpl/edit.php b/components/com_users/views/profile/tmpl/edit.php index 668cbda9072c8..01e06f4ba0fe4 100644 --- a/components/com_users/views/profile/tmpl/edit.php +++ b/components/com_users/views/profile/tmpl/edit.php @@ -55,6 +55,9 @@ label); ?> + description) && trim($fieldset->description)): ?> + ' . $this->escape(JText::_($fieldset->description)) . '

'; ?> + diff --git a/components/com_users/views/profile/view.html.php b/components/com_users/views/profile/view.html.php index 084347ff4cbf7..8b4e76512e053 100644 --- a/components/com_users/views/profile/view.html.php +++ b/components/com_users/views/profile/view.html.php @@ -43,9 +43,11 @@ class UsersViewProfile extends JViewLegacy */ public function display($tpl = null) { + $user = JFactory::getUser(); + // Get the view data. $this->data = $this->get('Data'); - $this->form = $this->get('Form'); + $this->form = $this->getModel()->getForm(new JObject(array('id' => $user->id))); $this->state = $this->get('State'); $this->params = $this->state->get('params'); $this->twofactorform = $this->get('Twofactorform'); @@ -62,7 +64,6 @@ public function display($tpl = null) } // View also takes responsibility for checking if the user logged in with remember me. - $user = JFactory::getUser(); $cookieLogin = $user->get('cookieLogin'); if (!empty($cookieLogin)) @@ -87,6 +88,11 @@ public function display($tpl = null) $this->data->tags = new JHelperTags; $this->data->tags->getItemTags('com_users.user.', $this->data->id); + JPluginHelper::importPlugin('content'); + $this->data->text = ''; + JEventDispatcher::getInstance()->trigger('onContentPrepare', array ('com_users.user', &$this->data, &$this->data->params, 0)); + unset($this->data->text); + // Check for layout override $active = JFactory::getApplication()->getMenu()->getActive(); diff --git a/installation/form/field/language.php b/installation/form/field/language.php index ad7935d21644e..6d98a7c1c4f84 100644 --- a/installation/form/field/language.php +++ b/installation/form/field/language.php @@ -8,14 +8,12 @@ defined('JPATH_BASE') or die; -JFormHelper::loadFieldClass('list'); - /** * Language Form Field class. * * @since 1.6 */ -class InstallationFormFieldLanguage extends JFormFieldList +class InstallationFormFieldLanguage extends JFormAbstractlist { /** * The form field type. diff --git a/installation/sql/mysql/joomla.sql b/installation/sql/mysql/joomla.sql index e9ac270eff6d6..348fd87ca92d0 100644 --- a/installation/sql/mysql/joomla.sql +++ b/installation/sql/mysql/joomla.sql @@ -514,6 +514,7 @@ INSERT INTO `#__extensions` (`extension_id`, `name`, `type`, `element`, `folder` (30, 'com_contenthistory', 'component', 'com_contenthistory', '', 1, 1, 1, 0, '', '', '', '', 0, '0000-00-00 00:00:00', 0, 0), (31, 'com_ajax', 'component', 'com_ajax', '', 1, 1, 1, 1, '', '', '', '', 0, '0000-00-00 00:00:00', 0, 0), (32, 'com_postinstall', 'component', 'com_postinstall', '', 1, 1, 1, 1, '', '', '', '', 0, '0000-00-00 00:00:00', 0, 0), +(33, 'com_fields', 'component', 'com_fields', '', 1, 1, 1, 0, '', '', '', '', 0, '0000-00-00 00:00:00', 0, 0), (102, 'phputf8', 'library', 'phputf8', '', 0, 1, 1, 1, '', '', '', '', 0, '0000-00-00 00:00:00', 0, 0), (103, 'Joomla! Platform', 'library', 'joomla', '', 0, 1, 1, 1, '', '', '', '', 0, '0000-00-00 00:00:00', 0, 0), (104, 'IDNA Convert', 'library', 'idna_convert', '', 0, 1, 1, 1, '', '', '', '', 0, '0000-00-00 00:00:00', 0, 0), @@ -617,6 +618,8 @@ INSERT INTO `#__extensions` (`extension_id`, `name`, `type`, `element`, `folder` (458, 'plg_quickicon_phpversioncheck', 'plugin', 'phpversioncheck', 'quickicon', 0, 1, 1, 1, '', '', '', '', 0, '0000-00-00 00:00:00', 0, 0), (459, 'plg_editors-xtd_menu', 'plugin', 'menu', 'editors-xtd', 0, 1, 1, 0, '', '', '', '', 0, '0000-00-00 00:00:00', 0, 0), (460, 'plg_editors-xtd_contact', 'plugin', 'contact', 'editors-xtd', 0, 1, 1, 0, '', '', '', '', 0, '0000-00-00 00:00:00', 0, 0), +(461, 'plg_system_fields', 'plugin', 'fields', 'system', 0, 1, 1, 0, '', '', '', '', 0, '0000-00-00 00:00:00', 0, 0), +(462, 'plg_fields_gallery', 'plugin', 'gallery', 'fields', 0, 1, 1, 0, '', '', '', '', 0, '0000-00-00 00:00:00', 0, 0), (503, 'beez3', 'template', 'beez3', '', 0, 1, 1, 0, '', '{"wrapperSmall":"53","wrapperLarge":"72","sitetitle":"","sitedescription":"","navposition":"center","templatecolor":"nature"}', '', '', 0, '0000-00-00 00:00:00', 0, 0), (504, 'hathor', 'template', 'hathor', '', 1, 1, 1, 0, '', '{"showSiteName":"0","colourChoice":"0","boldText":"0"}', '', '', 0, '0000-00-00 00:00:00', 0, 0), (506, 'protostar', 'template', 'protostar', '', 0, 1, 1, 0, '', '{"templateColor":"","logoFile":"","googleFont":"1","googleFontName":"Open+Sans","fluidContainer":"0"}', '', '', 0, '0000-00-00 00:00:00', 0, 0), @@ -628,6 +631,70 @@ INSERT INTO `#__extensions` (`extension_id`, `name`, `type`, `element`, `folder` -- -------------------------------------------------------- +-- +-- Table structure for table `#__fields` +-- + +CREATE TABLE IF NOT EXISTS `#__fields` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `asset_id` int(10) NOT NULL DEFAULT 0, + `context` varchar(255) NOT NULL DEFAULT '', + `catid` int(10) NOT NULL DEFAULT 0, + `assigned_cat_ids` varchar(255) NOT NULL DEFAULT '', + `title` varchar(255) NOT NULL DEFAULT '', + `alias` varchar(255) NOT NULL DEFAULT '', + `label` varchar(255) NOT NULL DEFAULT '', + `default_value` text NOT NULL DEFAULT '', + `type` varchar(255) NOT NULL DEFAULT 'text', + `options` varchar(255) NOT NULL DEFAULT '', + `note` varchar(255) NOT NULL DEFAULT '', + `description` text NOT NULL, + `state` tinyint(1) NOT NULL DEFAULT '0', + `required` tinyint(1) NOT NULL DEFAULT '0', + `checked_out` int(11) NOT NULL DEFAULT '0', + `checked_out_time` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + `ordering` int(11) NOT NULL DEFAULT '0', + `params` text NOT NULL, + `fieldparams` text NOT NULL, + `attributes` text NOT NULL, + `language` char(7) NOT NULL DEFAULT '', + `created_time` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + `created_user_id` int(10) unsigned NOT NULL DEFAULT '0', + `created_by_alias` varchar(255) NOT NULL DEFAULT '', + `version` int(10) unsigned NOT NULL DEFAULT '0', + `modified_time` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + `modified_by` int(10) unsigned NOT NULL DEFAULT '0', + `publish_up` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + `publish_down` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', + `access` int(11) NOT NULL DEFAULT '1', + `hits` int(10) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`id`), + KEY `idx_checkout` (`checked_out`), + KEY `idx_state` (`state`), + KEY `idx_created_user_id` (`created_user_id`), + KEY `idx_access` (`access`), + KEY `idx_context` (`context`), + KEY `idx_language` (`language`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_unicode_ci; + +-- -------------------------------------------------------- + +-- +-- Table structure for table `#__fields_values` +-- + +CREATE TABLE IF NOT EXISTS `#__fields_values` ( + `field_id` int(10) unsigned NOT NULL, + `context` varchar(255) NOT NULL, + `item_id` varchar(255) NOT NULL COMMENT 'Allow references to items which have strings as ids, eg. none db systems.', + `value` text NOT NULL DEFAULT '', + KEY (`field_id`), + KEY (`context`), + KEY (`item_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_unicode_ci; + +-- -------------------------------------------------------- + -- -- Table structure for table `#__finder_filters` -- diff --git a/installation/sql/postgresql/joomla.sql b/installation/sql/postgresql/joomla.sql index 231c45b6271ab..54e368f96845f 100644 --- a/installation/sql/postgresql/joomla.sql +++ b/installation/sql/postgresql/joomla.sql @@ -500,7 +500,8 @@ INSERT INTO "#__extensions" ("extension_id", "name", "type", "element", "folder" (29, 'com_tags', 'component', 'com_tags', '', 1, 1, 1, 1, '', '{"tag_layout":"_:default","save_history":"1","history_limit":5,"show_tag_title":"0","tag_list_show_tag_image":"0","tag_list_show_tag_description":"0","tag_list_image":"","show_tag_num_items":"0","tag_list_orderby":"title","tag_list_orderby_direction":"ASC","show_headings":"0","tag_list_show_date":"0","tag_list_show_item_image":"0","tag_list_show_item_description":"0","tag_list_item_maximum_characters":0,"return_any_or_all":"1","include_children":"0","maximum":200,"tag_list_language_filter":"all","tags_layout":"_:default","all_tags_orderby":"title","all_tags_orderby_direction":"ASC","all_tags_show_tag_image":"0","all_tags_show_tag_descripion":"0","all_tags_tag_maximum_characters":20,"all_tags_show_tag_hits":"0","filter_field":"1","show_pagination_limit":"1","show_pagination":"2","show_pagination_results":"1","tag_field_ajax_mode":"1","show_feed_link":"1"}', '', '', 0, '1970-01-01 00:00:00', 0, 0), (30, 'com_contenthistory', 'component', 'com_contenthistory', '', 1, 1, 1, 0, '', '', '', '', 0, '1970-01-01 00:00:00', 0, 0), (31, 'com_ajax', 'component', 'com_ajax', '', 1, 1, 1, 1, '', '', '', '', 0, '1970-01-01 00:00:00', 0, 0), -(32, 'com_postinstall', 'component', 'com_postinstall', '', 1, 1, 1, 1, '', '', '', '', 0, '1970-01-01 00:00:00', 0, 0); +(32, 'com_postinstall', 'component', 'com_postinstall', '', 1, 1, 1, 1, '', '', '', '', 0, '1970-01-01 00:00:00', 0, 0), +(33, 'com_fields', 'component', 'com_fields', '', 1, 1, 1, 1, '', '', '', '', 0, '1970-01-01 00:00:00', 0, 0); -- Libraries INSERT INTO "#__extensions" ("extension_id", "name", "type", "element", "folder", "client_id", "enabled", "access", "protected", "manifest_cache", "params", "custom_data", "system_data", "checked_out", "checked_out_time", "ordering", "state") VALUES @@ -616,7 +617,9 @@ INSERT INTO "#__extensions" ("extension_id", "name", "type", "element", "folder" (457, 'plg_installer_urlinstaller', 'plugin', 'urlinstaller', 'installer', 0, 1, 1, 1, '', '', '', '', 0, '1970-01-01 00:00:00', 3, 0), (458, 'plg_quickicon_phpversioncheck', 'plugin', 'phpversioncheck', 'quickicon', 0, 1, 1, 1, '', '', '', '', 0, '1970-01-01 00:00:00', 0, 0), (459, 'plg_editors-xtd_menu', 'plugin', 'menu', 'editors-xtd', 0, 1, 1, 0, '', '', '', '', 0, '1970-01-01 00:00:00', 0, 0), -(460, 'plg_editors-xtd_contact', 'plugin', 'contact', 'editors-xtd', 0, 1, 1, 0, '', '', '', '', 0, '1970-01-01 00:00:00', 0, 0); +(460, 'plg_editors-xtd_contact', 'plugin', 'contact', 'editors-xtd', 0, 1, 1, 0, '', '', '', '', 0, '1970-01-01 00:00:00', 0, 0), +(461, 'plg_system_fields', 'plugin', 'fields', 'system', 0, 1, 1, 0, '', '', '', '', 0, '1970-01-01 00:00:00', 0, 0), +(462, 'plg_fields_gallery', 'plugin', 'gallery', 'fields', 0, 1, 1, 0, '', '', '', '', 0, '1970-01-01 00:00:00', 0, 0); -- Templates INSERT INTO "#__extensions" ("extension_id", "name", "type", "element", "folder", "client_id", "enabled", "access", "protected", "manifest_cache", "params", "custom_data", "system_data", "checked_out", "checked_out_time", "ordering", "state") VALUES @@ -640,6 +643,64 @@ INSERT INTO "#__extensions" ("extension_id", "name", "type", "element", "folder" SELECT setval('#__extensions_extension_id_seq', 10000, false); +-- +-- Table: #__fields +-- +CREATE TABLE "#__fields" ( + "id" serial NOT NULL, + "asset_id" bigint DEFAULT 0 NOT NULL, + "context" varchar(255) DEFAULT '' NOT NULL, + "catid" bigint DEFAULT 0 NOT NULL, + "assigned_cat_ids" varchar(255) DEFAULT '' NOT NULL, + "title" varchar(255) DEFAULT '' NOT NULL, + "alias" varchar(255) DEFAULT '' NOT NULL, + "label" varchar(255) DEFAULT '' NOT NULL, + "default_value" text DEFAULT '' NOT NULL, + "type" varchar(255) DEFAULT 'text' NOT NULL, + "options" varchar(255) DEFAULT '' NOT NULL, + "note" varchar(255) DEFAULT '' NOT NULL, + "description" text DEFAULT '' NOT NULL, + "state" smallint DEFAULT 0 NOT NULL, + "required" smallint DEFAULT 0 NOT NULL, + "checked_out" integer DEFAULT 0 NOT NULL, + "checked_out_time" timestamp without time zone DEFAULT '1970-01-01 00:00:00' NOT NULL, + "ordering" bigint DEFAULT 0 NOT NULL, + "params" text DEFAULT '' NOT NULL, + "fieldparams" text DEFAULT '' NOT NULL, + "attributes" text DEFAULT '' NOT NULL, + "language" varchar(7) DEFAULT '' NOT NULL, + "created_time" timestamp without time zone DEFAULT '1970-01-01 00:00:00' NOT NULL, + "created_user_id" bigint DEFAULT 0 NOT NULL, + "created_by_alias" varchar(255) DEFAULT '' NOT NULL, + "version" bigint DEFAULT 0 NOT NULL, + "modified_time" timestamp without time zone DEFAULT '1970-01-01 00:00:00' NOT NULL, + "modified_by" bigint DEFAULT 0 NOT NULL, + "publish_up" timestamp without time zone DEFAULT '1970-01-01 00:00:00' NOT NULL, + "publish_down" timestamp without time zone DEFAULT '1970-01-01 00:00:00' NOT NULL, + "access" bigint DEFAULT 0 NOT NULL, + "hits" integer DEFAULT 0 NOT NULL, + PRIMARY KEY ("id") +); +CREATE INDEX "#__fields_idx_checked_out" ON "#__fields" ("checked_out"); +CREATE INDEX "#__fields_idx_state" ON "#__fields" ("state"); +CREATE INDEX "#__fields_idx_created_user_id" ON "#__fields" ("created_user_id"); +CREATE INDEX "#__fields_idx_access" ON "#__fields" ("access"); +CREATE INDEX "#__fields_idx_context" ON "#__fields" ("context"); +CREATE INDEX "#__fields_idx_language" ON "#__fields" ("language"); + +-- +-- Table: #__fields_values +-- +CREATE TABLE "#__fields_values" ( +"field_id" bigint DEFAULT 0 NOT NULL, +"item_id" varchar(255) DEFAULT '' NOT NULL, +"context" varchar(255) DEFAULT '' NOT NULL, +"value" text DEFAULT '' NOT NULL +); +CREATE INDEX "#__fields_values_idx_field_id" ON "#__fields_values" ("field_id"); +CREATE INDEX "#__fields_values_idx_context" ON "#__fields_values" ("context"); +CREATE INDEX "#__fields_values_idx_item_id" ON "#__fields_values" ("item_id"); + -- -- Table: #__finder_filters -- diff --git a/language/en-GB/en-GB.com_contact.ini b/language/en-GB/en-GB.com_contact.ini index 3948802802169..48e2086e2e0d1 100644 --- a/language/en-GB/en-GB.com_contact.ini +++ b/language/en-GB/en-GB.com_contact.ini @@ -62,3 +62,4 @@ COM_CONTACT_SUBURB="Suburb" COM_CONTACT_TELEPHONE="Phone" COM_CONTACT_TELEPHONE_NUMBER="Phone: %s" COM_CONTACT_VCARD="vCard" +COM_CONTACT_USER_FIELDS="Fields" diff --git a/language/en-GB/en-GB.ini b/language/en-GB/en-GB.ini index 932947d277e03..1b629d44b1acc 100644 --- a/language/en-GB/en-GB.ini +++ b/language/en-GB/en-GB.ini @@ -56,6 +56,7 @@ JASSOCIATIONS="Also available:" JAUTHOR="Author" JCANCEL="Cancel" JCATEGORY="Category" +JCLEAR="Clear" JDATE="Date" JDEFAULT="Default" JDETAILS="Details" @@ -86,6 +87,7 @@ JPUBLISHED="Published" JREGISTER="Register" JREQUIRED="Required" JSAVE="Save" +JSELECT="Select" JSHOW="Show" JSITE="Site" JSTATUS="Status" @@ -155,6 +157,7 @@ JFIELD_TITLE_DESC="Title for the article." JGLOBAL_ADD_CUSTOM_CATEGORY="Add new Category" JGLOBAL_ARTICLES="Articles" +JGLOBAL_FIELDS="Fields" JGLOBAL_AUTH_ACCESS_DENIED="Access Denied" JGLOBAL_AUTH_ACCESS_GRANTED="Access Granted" JGLOBAL_AUTH_BIND_FAILED="Failed binding to LDAP server" @@ -280,6 +283,7 @@ JLIB_DATABASE_ERROR_DATABASE_CONNECT="Could not connect to database" JLIB_DATABASE_ERROR_LOAD_DATABASE_DRIVER="Unable to load Database Driver: %s" JLIB_ERROR_INFINITE_LOOP="Infinite loop detected in JError" +JOPTION_DO_NOT_USE="- None Selected -" JOPTION_SELECT_ACCESS="- Select Access -" JOPTION_SELECT_AUTHOR="- Select Author -" JOPTION_SELECT_CATEGORY="- Select Category -" diff --git a/libraries/cms/form/field/author.php b/libraries/cms/form/field/author.php index 3776264d7f92f..9fc516404f324 100644 --- a/libraries/cms/form/field/author.php +++ b/libraries/cms/form/field/author.php @@ -9,14 +9,12 @@ defined('JPATH_PLATFORM') or die; -JFormHelper::loadFieldClass('list'); - /** * Form Field to load a list of content authors * * @since 3.2 */ -class JFormFieldAuthor extends JFormFieldList +class JFormFieldAuthor extends JFormAbstractlist { /** * The form field type. diff --git a/libraries/cms/form/field/captcha.php b/libraries/cms/form/field/captcha.php index c1674b40d2654..e232272b8244b 100644 --- a/libraries/cms/form/field/captcha.php +++ b/libraries/cms/form/field/captcha.php @@ -14,7 +14,7 @@ * * @since 2.5 */ -class JFormFieldCaptcha extends JFormField +class JFormFieldCaptcha extends JFormField implements JFormDomfieldinterface { /** * The field type. @@ -145,4 +145,37 @@ protected function getInput() return $captcha->display($this->name, $this->id, $this->class); } + + /** + * Function to manipulate the DOM element of the field. The form can be + * manipulated at that point. + * + * @param stdClass $field The field. + * @param DOMElement $fieldNode The field node. + * @param JForm $form The form. + * + * @return void + * + * @since __DEPLOY_VERSION__ + */ + protected function postProcessDomNode($field, DOMElement $fieldNode, JForm $form) + { + $input = JFactory::getApplication()->input; + + if (JFactory::getApplication()->isAdmin()) + { + $fieldNode->setAttribute('plugin', JFactory::getConfig()->get('captcha')); + } + elseif ($input->get('option') == 'com_users' && $input->get('view') == 'profile' && $input->get('layout') != 'edit' && + $input->get('task') != 'save') + { + // The user profile page does show the values by creating the form + // and getting the values from it so we need to disable the field + $fieldNode->setAttribute('plugin', null); + } + + $fieldNode->setAttribute('validate', 'captcha'); + + return parent::postProcessDomNode($field, $fieldNode, $form); + } } diff --git a/libraries/cms/form/field/contentlanguage.php b/libraries/cms/form/field/contentlanguage.php index 67a6be7cbb8b2..c0e2f854e76dc 100644 --- a/libraries/cms/form/field/contentlanguage.php +++ b/libraries/cms/form/field/contentlanguage.php @@ -9,8 +9,6 @@ defined('JPATH_PLATFORM') or die; -JFormHelper::loadFieldClass('list'); - /** * Form Field class for the Joomla Platform. * Provides a list of content languages @@ -18,7 +16,7 @@ * @see JFormFieldLanguage for a select list of application languages. * @since 1.6 */ -class JFormFieldContentlanguage extends JFormFieldList +class JFormFieldContentlanguage extends JFormAbstractlist { /** * The form field type. diff --git a/libraries/cms/form/field/contenttype.php b/libraries/cms/form/field/contenttype.php index 20ee4209bac28..fccdba1c2a0f8 100644 --- a/libraries/cms/form/field/contenttype.php +++ b/libraries/cms/form/field/contenttype.php @@ -9,14 +9,12 @@ defined('JPATH_PLATFORM') or die; -JFormHelper::loadFieldClass('list'); - /** * Form Field class for the Joomla Framework. * * @since 3.1 */ -class JFormFieldContenttype extends JFormFieldList +class JFormFieldContenttype extends JFormAbstractlist { /** * A flexible tag list that respects access controls diff --git a/libraries/cms/form/field/editor.php b/libraries/cms/form/field/editor.php index 8f5aaa95b52a3..dac7aa73f47e8 100644 --- a/libraries/cms/form/field/editor.php +++ b/libraries/cms/form/field/editor.php @@ -18,7 +18,7 @@ * @see JEditor * @since 1.6 */ -class JFormFieldEditor extends JFormFieldTextarea +class JFormFieldEditor extends JFormFieldTextarea implements JFormDomfieldinterface { /** * The form field type. @@ -318,4 +318,24 @@ public function save() { return $this->getEditor()->save($this->id); } + + /** + * Function to manipulate the DOM element of the field. The form can be + * manipulated at that point. + * + * @param stdClass $field The field. + * @param DOMElement $fieldNode The field node. + * @param JForm $form The form. + * + * @return void + * + * @since __DEPLOY_VERSION__ + */ + protected function postProcessDomNode($field, DOMElement $fieldNode, JForm $form) + { + $fieldNode->setAttribute('buttons', $field->fieldparams->get('buttons', 0) ? 'true' : 'false'); + $fieldNode->setAttribute('filter', 'JComponentHelper::filterText'); + + return parent::postProcessDomNode($field, $fieldNode, $form); + } } diff --git a/libraries/cms/form/field/frontend_language.php b/libraries/cms/form/field/frontend_language.php index 0c8959fabe022..3c5b4b3115887 100644 --- a/libraries/cms/form/field/frontend_language.php +++ b/libraries/cms/form/field/frontend_language.php @@ -9,8 +9,6 @@ defined('JPATH_PLATFORM') or die; -JFormHelper::loadFieldClass('list'); - /** * Form Field class for the Joomla Platform. * Provides a list of published content languages with home pages @@ -18,7 +16,7 @@ * @see JFormFieldLanguage for a select list of application languages. * @since 3.5 */ -class JFormFieldFrontend_Language extends JFormFieldList +class JFormFieldFrontend_Language extends JFormAbstractlist { /** * The form field type. diff --git a/libraries/cms/form/field/headertag.php b/libraries/cms/form/field/headertag.php index 37949c3bab0d8..8cb232489de1d 100644 --- a/libraries/cms/form/field/headertag.php +++ b/libraries/cms/form/field/headertag.php @@ -9,14 +9,12 @@ defined('JPATH_PLATFORM') or die; -JFormHelper::loadFieldClass('list'); - /** * Form Field class for the Joomla! CMS. * * @since 3.0 */ -class JFormFieldHeadertag extends JFormFieldList +class JFormFieldHeadertag extends JFormAbstractlist { /** * The form field type. diff --git a/libraries/cms/form/field/helpsite.php b/libraries/cms/form/field/helpsite.php index 052c9a8c7e82f..a6084c42686f0 100644 --- a/libraries/cms/form/field/helpsite.php +++ b/libraries/cms/form/field/helpsite.php @@ -9,15 +9,13 @@ defined('JPATH_PLATFORM') or die; -JFormHelper::loadFieldClass('list'); - /** * Form Field class for the Joomla Platform. * Provides a select list of help sites. * * @since 1.6 */ -class JFormFieldHelpsite extends JFormFieldList +class JFormFieldHelpsite extends JFormAbstractlist { /** * The form field type. diff --git a/libraries/cms/form/field/limitbox.php b/libraries/cms/form/field/limitbox.php index b32ce9f6c3077..bb5a369ca0623 100644 --- a/libraries/cms/form/field/limitbox.php +++ b/libraries/cms/form/field/limitbox.php @@ -9,14 +9,12 @@ defined('JPATH_PLATFORM') or die; -JFormHelper::loadFieldClass('list'); - /** * Field to load a list of posible item count limits * * @since 3.2 */ -class JFormFieldLimitbox extends JFormFieldList +class JFormFieldLimitbox extends JFormAbstractlist { /** * The form field type. diff --git a/libraries/cms/form/field/media.php b/libraries/cms/form/field/media.php index e954a84274aca..1f7d13ac4fbf4 100644 --- a/libraries/cms/form/field/media.php +++ b/libraries/cms/form/field/media.php @@ -15,7 +15,7 @@ * * @since 1.6 */ -class JFormFieldMedia extends JFormField +class JFormFieldMedia extends JFormField implements JFormDomfieldinterface { /** * The form field type. @@ -267,4 +267,43 @@ public function getLayoutData() return array_merge($data, $extraData); } + + /** + * Function to manipulate the DOM element of the field. The form can be + * manipulated at that point. + * + * @param stdClass $field The field. + * @param DOMElement $fieldNode The field node. + * @param JForm $form The form. + * + * @return void + * + * @since __DEPLOY_VERSION__ + */ + protected function postProcessDomNode($field, DOMElement $fieldNode, JForm $form) + { + $fieldNode->setAttribute('hide_default', 'true'); + + if ($field->fieldparams->get('home')) + { + $userName = JFactory::getUser()->username; + $root = $field->fieldparams->get('directory'); + + if (!$root) + { + $root = 'images'; + } + + $directory = JPATH_ROOT . '/images/' . $root . '/' . $userName; + + if (!JFolder::exists($directory)) + { + JFolder::create($directory); + } + + $fieldNode->setAttribute('directory', str_replace(JPATH_ROOT . '/images', '', $directory)); + } + + return parent::postProcessDomNode($field, $fieldNode, $form); + } } diff --git a/libraries/cms/form/field/menu.php b/libraries/cms/form/field/menu.php index d8fdc2e183d99..b3c6863acb592 100644 --- a/libraries/cms/form/field/menu.php +++ b/libraries/cms/form/field/menu.php @@ -9,8 +9,6 @@ defined('JPATH_PLATFORM') or die; -JFormHelper::loadFieldClass('list'); - // Import the com_menus helper. require_once realpath(JPATH_ADMINISTRATOR . '/components/com_menus/helpers/menus.php'); @@ -19,7 +17,7 @@ * * @since 1.6 */ -class JFormFieldMenu extends JFormFieldList +class JFormFieldMenu extends JFormAbstractlist { /** * The form field type. diff --git a/libraries/cms/form/field/moduletag.php b/libraries/cms/form/field/moduletag.php index f1bfb80081b92..a4030e4a52889 100644 --- a/libraries/cms/form/field/moduletag.php +++ b/libraries/cms/form/field/moduletag.php @@ -9,14 +9,12 @@ defined('JPATH_PLATFORM') or die; -JFormHelper::loadFieldClass('list'); - /** * Form Field class for the Joomla! CMS. * * @since 3.0 */ -class JFormFieldModuletag extends JFormFieldList +class JFormFieldModuletag extends JFormAbstractlist { /** * The form field type. diff --git a/libraries/cms/form/field/tag.php b/libraries/cms/form/field/tag.php index 3ebf582c04a13..5d340311fc0a6 100644 --- a/libraries/cms/form/field/tag.php +++ b/libraries/cms/form/field/tag.php @@ -11,14 +11,12 @@ use Joomla\Utilities\ArrayHelper; -JFormHelper::loadFieldClass('list'); - /** * Form Field class for the Joomla Framework. * * @since 3.1 */ -class JFormFieldTag extends JFormFieldList +class JFormFieldTag extends JFormAbstractlist { /** * A flexible tag list that respects access controls diff --git a/libraries/cms/form/field/user.php b/libraries/cms/form/field/user.php index 4c4c1feb9de99..008165d79718f 100644 --- a/libraries/cms/form/field/user.php +++ b/libraries/cms/form/field/user.php @@ -14,7 +14,7 @@ * * @since 1.6 */ -class JFormFieldUser extends JFormField +class JFormFieldUser extends JFormField implements JFormDomfieldinterface { /** * The form field type. @@ -131,4 +131,29 @@ protected function getExcluded() { return explode(',', $this->element['exclude']); } + + /** + * Transforms the field into an XML element and appends it as child on the given parent. This + * is the default implementation of a field. Form fields which do support to be transformed into + * an XML Element mut implemet the JFormDomfieldinterface. + * + * @param stdClass $field The field. + * @param DOMElement $parent The field node parent. + * @param JForm $form The form. + * + * @return DOMElement + * + * @since __DEPLOY_VERSION__ + * @see JFormDomfieldinterface::appendXMLFieldTag + */ + public function appendXMLFieldTag($field, DOMElement $parent, JForm $form) + { + if (JFactory::getApplication()->isSite()) + { + // The user field is not working on the front end + return; + } + + return parent::appendXMLFieldTag($field, $parent, $form); + } } diff --git a/libraries/cms/form/field/usergrouplist.php b/libraries/cms/form/field/usergrouplist.php index f4b79f5265b54..3ac44f4f091e0 100644 --- a/libraries/cms/form/field/usergrouplist.php +++ b/libraries/cms/form/field/usergrouplist.php @@ -9,14 +9,12 @@ defined('JPATH_PLATFORM') or die; -JFormHelper::loadFieldClass('list'); - /** * Field to load a dropdown list of available user groups * * @since 3.2 */ -class JFormFieldUserGroupList extends JFormFieldList +class JFormFieldUserGroupList extends JFormAbstractlist implements JFormDomfieldinterface { /** * The form field type. diff --git a/libraries/cms/form/parameters/editor.xml b/libraries/cms/form/parameters/editor.xml new file mode 100644 index 0000000000000..6a13b62d990dc --- /dev/null +++ b/libraries/cms/form/parameters/editor.xml @@ -0,0 +1,67 @@ + +
+ +
+ + + + + + + + + + + + + + +
+
+
diff --git a/libraries/cms/form/parameters/media.xml b/libraries/cms/form/parameters/media.xml new file mode 100644 index 0000000000000..490416d1dfb37 --- /dev/null +++ b/libraries/cms/form/parameters/media.xml @@ -0,0 +1,49 @@ + +
+ +
+ + + + + + + + + + + + + + +
+
+
diff --git a/libraries/cms/form/parameters/user.xml b/libraries/cms/form/parameters/user.xml new file mode 100644 index 0000000000000..4b7ff6bfde898 --- /dev/null +++ b/libraries/cms/form/parameters/user.xml @@ -0,0 +1,18 @@ + +
+ +
+ + + + +
+
+
diff --git a/libraries/cms/form/parameters/usergrouplist.xml b/libraries/cms/form/parameters/usergrouplist.xml new file mode 100644 index 0000000000000..4b7ff6bfde898 --- /dev/null +++ b/libraries/cms/form/parameters/usergrouplist.xml @@ -0,0 +1,18 @@ + +
+ +
+ + + + +
+
+
diff --git a/libraries/fof/form/field/actions.php b/libraries/fof/form/field/actions.php index fc232da742c59..5b3267f9bb8bb 100644 --- a/libraries/fof/form/field/actions.php +++ b/libraries/fof/form/field/actions.php @@ -8,8 +8,6 @@ // Protect from unauthorized access defined('FOF_INCLUDED') or die; -JFormHelper::loadFieldClass('list'); - /** * Form Field class for FOF * Supports a generic list of options. @@ -17,7 +15,7 @@ * @package FrameworkOnFramework * @since 2.0 */ -class FOFFormFieldActions extends JFormFieldList implements FOFFormField +class FOFFormFieldActions extends JFormAbstractlist implements FOFFormField { protected $static; diff --git a/libraries/fof/form/field/components.php b/libraries/fof/form/field/components.php index f236632b0eb2d..1fdafddde23dd 100644 --- a/libraries/fof/form/field/components.php +++ b/libraries/fof/form/field/components.php @@ -8,8 +8,6 @@ // Protect from unauthorized access defined('FOF_INCLUDED') or die; -JFormHelper::loadFieldClass('list'); - /** * Form Field class for FOF * Components installed on the site @@ -17,7 +15,7 @@ * @package FrameworkOnFramework * @since 2.1 */ -class FOFFormFieldComponents extends JFormFieldList implements FOFFormField +class FOFFormFieldComponents extends JFormAbstractlist implements FOFFormField { protected $static; diff --git a/libraries/fof/form/field/list.php b/libraries/fof/form/field/list.php index 1c9ee7bf01bf0..1765f0946edce 100644 --- a/libraries/fof/form/field/list.php +++ b/libraries/fof/form/field/list.php @@ -8,8 +8,6 @@ // Protect from unauthorized access defined('FOF_INCLUDED') or die; -JFormHelper::loadFieldClass('list'); - /** * Form Field class for FOF * Supports a generic list of options. @@ -17,7 +15,7 @@ * @package FrameworkOnFramework * @since 2.0 */ -class FOFFormFieldList extends JFormFieldList implements FOFFormField +class FOFFormFieldList extends JFormAbstractlist implements FOFFormField { protected $static; diff --git a/libraries/fof/form/field/published.php b/libraries/fof/form/field/published.php index ceea5439cec54..be420a1a9a04b 100644 --- a/libraries/fof/form/field/published.php +++ b/libraries/fof/form/field/published.php @@ -8,8 +8,6 @@ // Protect from unauthorized access defined('FOF_INCLUDED') or die; -JFormHelper::loadFieldClass('list'); - /** * Form Field class for FOF * Supports a generic list of options. @@ -17,7 +15,7 @@ * @package FrameworkOnFramework * @since 2.0 */ -class FOFFormFieldPublished extends JFormFieldList implements FOFFormField +class FOFFormFieldPublished extends JFormAbstractlist implements FOFFormField { protected $static; diff --git a/libraries/joomla/form/abstractlist.php b/libraries/joomla/form/abstractlist.php new file mode 100644 index 0000000000000..4442a55b2c622 --- /dev/null +++ b/libraries/joomla/form/abstractlist.php @@ -0,0 +1,209 @@ +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[] = ''; + } + } + else + { + $html[] = ''; + } + } + else + // Create a regular list. + { + $html[] = JHtml::_('select.genericlist', $options, $this->name, trim($attr), 'value', 'text', $this->value, $this->id); + } + + return implode($html); + } + + /** + * Method to get the field options. + * + * @return array The field option objects. + * + * @since __DEPLOY_VERSION__ + */ + 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 vote plugin enabled + 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']; + + // Add the option object to the result set. + $options[] = (object) $tmp; + } + + reset($options); + + return $options; + } + + /** + * Returns an array of key values to put in a list from the given field. + * + * @param stdClass $field The field. + * + * @return array + * + * @since __DEPLOY_VERSION__ + */ + public static function getOptionsFromField($field) + { + $options = $field->fieldparams->get('options', array()); + + if (!is_array($options)) + { + $options = json_decode($options); + } + + $data = array(); + + if (isset($options->name)) + { + foreach ($options->name as $index => $key) + { + $data[$key] = $options->value[$index]; + } + } + + return $data; + } + + /** + * Function to manipulate the DOM element of the field. The form can be + * manipulated at that point. + * + * @param stdClass $field The field. + * @param DOMElement $fieldNode The field node. + * @param JForm $form The form. + * + * @return void + * + * @since __DEPLOY_VERSION__ + */ + protected function postProcessDomNode($field, DOMElement $fieldNode, JForm $form) + { + foreach (self::getOptionsFromField($field) as $index => $name) + { + $element = $fieldNode->appendChild(new DOMElement('option', $name)); + $element->setAttribute('value', $index); + } + + return parent::postProcessDomNode($field, $fieldNode, $form); + } +} diff --git a/libraries/joomla/form/domfieldinterface.php b/libraries/joomla/form/domfieldinterface.php new file mode 100644 index 0000000000000..e903512966aeb --- /dev/null +++ b/libraries/joomla/form/domfieldinterface.php @@ -0,0 +1,41 @@ +getAttribute('debug', 'false') === 'true'; } + + /** + * Transforms the field into an XML element and appends it as child on the given parent. This + * is the default implementation of a field. Form fields which do support to be transformed into + * an XML Element mut implemet the JFormDomfieldinterface. + * + * @param stdClass $field The field. + * @param DOMElement $parent The field node parent. + * @param JForm $form The form. + * + * @return DOMElement + * + * @since __DEPLOY_VERSION__ + * @see JFormDomfieldinterface::appendXMLFieldTag + */ + public function appendXMLFieldTag($field, DOMElement $parent, JForm $form) + { + $app = JFactory::getApplication(); + + if ($field->params->get('show_on') == 1 && $app->isAdmin()) + { + return; + } + elseif ($field->params->get('show_on') == 2 && $app->isSite()) + { + return; + } + + $node = $parent->appendChild(new DOMElement('field')); + + $node->setAttribute('name', $field->alias); + $node->setAttribute('type', $field->type); + $node->setAttribute('default', $field->default_value); + $node->setAttribute('label', $field->label); + $node->setAttribute('description', $field->description); + $node->setAttribute('class', $field->params->get('class')); + $node->setAttribute('hint', $field->params->get('hint')); + $node->setAttribute('required', $field->required ? 'true' : 'false'); + $node->setAttribute('readonly', $field->params->get('readonly', 0) ? 'true' : 'false'); + + // Set the disabled state based on the parameter and the permission + if ($field->params->get('disabled', 0)) + { + $node->setAttribute('disabled', 'true'); + } + + foreach ($field->fieldparams->toArray() as $key => $param) + { + if (is_array($param)) + { + $param = implode(',', $param); + } + + $node->setAttribute($key, $param); + } + + $this->postProcessDomNode($field, $node, $form); + + return $node; + } + + /** + * Function to manipulate the DOM element of the field. The form can be + * manipulated at that point. + * + * @param stdClass $field The field. + * @param DOMElement $fieldNode The field node. + * @param JForm $form The form. + * + * @return void + * + * @since __DEPLOY_VERSION__ + */ + protected function postProcessDomNode ($field, DOMElement $fieldNode, JForm $form) + { + } + + /** + * Returns the attributes of the field as an XML string which can be loaded + * into JForm. + * + * @return string + * + * @since __DEPLOY_VERSION__ + */ + public function getFormParameters() + { + $reflectionClass = new ReflectionClass($this); + $fileName = dirname($reflectionClass->getFileName()) . '/../parameters/'; + $fileName .= str_replace('.php', '.xml', basename($reflectionClass->getFileName())); + + if (JFile::exists($fileName)) + { + return JFile::read($fileName); + } + + return ''; + } } diff --git a/libraries/joomla/form/fields/accesslevel.php b/libraries/joomla/form/fields/accesslevel.php index 7634b53976619..4abd822bc3ac0 100644 --- a/libraries/joomla/form/fields/accesslevel.php +++ b/libraries/joomla/form/fields/accesslevel.php @@ -9,8 +9,6 @@ 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 @@ -19,7 +17,7 @@ * @see JAccess * @since 11.1 */ -class JFormFieldAccessLevel extends JFormFieldList +class JFormFieldAccessLevel extends JFormAbstractlist { /** * The form field type. diff --git a/libraries/joomla/form/fields/cachehandler.php b/libraries/joomla/form/fields/cachehandler.php index 7323be59d021e..aab972895c94a 100644 --- a/libraries/joomla/form/fields/cachehandler.php +++ b/libraries/joomla/form/fields/cachehandler.php @@ -9,8 +9,6 @@ defined('JPATH_PLATFORM') or die; -JFormHelper::loadFieldClass('list'); - /** * Form Field class for the Joomla Platform. * Provides a list of available cache handlers @@ -18,7 +16,7 @@ * @see JCache * @since 11.1 */ -class JFormFieldCacheHandler extends JFormFieldList +class JFormFieldCacheHandler extends JFormAbstractlist { /** * The form field type. diff --git a/libraries/joomla/form/fields/calendar.php b/libraries/joomla/form/fields/calendar.php index 707f89b544e73..41161a31b0aba 100644 --- a/libraries/joomla/form/fields/calendar.php +++ b/libraries/joomla/form/fields/calendar.php @@ -17,7 +17,7 @@ * * @since 11.1 */ -class JFormFieldCalendar extends JFormField +class JFormFieldCalendar extends JFormField implements JFormDomfieldinterface { /** * The form field type. diff --git a/libraries/joomla/form/fields/checkboxes.php b/libraries/joomla/form/fields/checkboxes.php index 6d31a4a25d8d3..2bdda4fe5d578 100644 --- a/libraries/joomla/form/fields/checkboxes.php +++ b/libraries/joomla/form/fields/checkboxes.php @@ -9,8 +9,6 @@ defined('JPATH_PLATFORM') or die; -JFormHelper::loadFieldClass('list'); - /** * Form Field class for the Joomla Platform. * Displays options as a list of checkboxes. @@ -19,7 +17,7 @@ * @see JFormFieldCheckbox * @since 11.1 */ -class JFormFieldCheckboxes extends JFormFieldList +class JFormFieldCheckboxes extends JFormAbstractlist implements JFormDomfieldinterface { /** * The form field type. diff --git a/libraries/joomla/form/fields/color.php b/libraries/joomla/form/fields/color.php index 49237d3203ef1..a21de15e797b3 100644 --- a/libraries/joomla/form/fields/color.php +++ b/libraries/joomla/form/fields/color.php @@ -16,7 +16,7 @@ * @link http://www.w3.org/TR/html-markup/input.color.html * @since 11.3 */ -class JFormFieldColor extends JFormField +class JFormFieldColor extends JFormField implements JFormDomfieldinterface { /** * The form field type. diff --git a/libraries/joomla/form/fields/combo.php b/libraries/joomla/form/fields/combo.php index 25d52ba5426c9..8bed141d2c7ab 100644 --- a/libraries/joomla/form/fields/combo.php +++ b/libraries/joomla/form/fields/combo.php @@ -9,15 +9,13 @@ defined('JPATH_PLATFORM') or die; -JFormHelper::loadFieldClass('list'); - /** * Form Field class for the Joomla Platform. * Implements a combo box field. * * @since 11.1 */ -class JFormFieldCombo extends JFormFieldList +class JFormFieldCombo extends JFormAbstractlist { /** * The form field type. diff --git a/libraries/joomla/form/fields/databaseconnection.php b/libraries/joomla/form/fields/databaseconnection.php index ca9ecb672e679..e01d1e14fa327 100644 --- a/libraries/joomla/form/fields/databaseconnection.php +++ b/libraries/joomla/form/fields/databaseconnection.php @@ -9,8 +9,6 @@ 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 @@ -19,7 +17,7 @@ * @see JDatabaseDriver * @since 11.3 */ -class JFormFieldDatabaseConnection extends JFormFieldList +class JFormFieldDatabaseConnection extends JFormAbstractlist { /** * The form field type. diff --git a/libraries/joomla/form/fields/email.php b/libraries/joomla/form/fields/email.php index e19c99b9c9e8f..0e933c5c2bb8c 100644 --- a/libraries/joomla/form/fields/email.php +++ b/libraries/joomla/form/fields/email.php @@ -19,7 +19,7 @@ * @see JFormRuleEmail * @since 11.1 */ -class JFormFieldEMail extends JFormFieldText +class JFormFieldEMail extends JFormFieldText implements JFormDomfieldinterface { /** * The form field type. @@ -64,6 +64,26 @@ protected function getLayoutData() 'maxLength' => $this->maxLength, 'multiple' => $this->multiple, ); + return array_merge($data, $extraData); } + + /** + * Function to manipulate the DOM element of the field. The form can be + * manipulated at that point. + * + * @param stdClass $field The field. + * @param DOMElement $fieldNode The field node. + * @param JForm $form The form. + * + * @return void + * + * @since __DEPLOY_VERSION__ + */ + protected function postProcessDomNode($field, DOMElement $fieldNode, JForm $form) + { + $fieldNode->setAttribute('validate', 'email'); + + return parent::postProcessDomNode($field, $fieldNode, $form); + } } diff --git a/libraries/joomla/form/fields/file.php b/libraries/joomla/form/fields/file.php index dd686d17350bb..0f629491e6ea4 100644 --- a/libraries/joomla/form/fields/file.php +++ b/libraries/joomla/form/fields/file.php @@ -132,7 +132,7 @@ protected function getInput() * * @return array * - * @since 3.6 + * @since 3.6 */ protected function getLayoutData() { diff --git a/libraries/joomla/form/fields/filelist.php b/libraries/joomla/form/fields/filelist.php index 4c8a42e5e4f85..a3627c9c1d096 100644 --- a/libraries/joomla/form/fields/filelist.php +++ b/libraries/joomla/form/fields/filelist.php @@ -11,14 +11,12 @@ jimport('joomla.filesystem.folder'); jimport('joomla.filesystem.file'); -JFormHelper::loadFieldClass('list'); - /** * Supports an HTML select list of files * * @since 11.1 */ -class JFormFieldFileList extends JFormFieldList +class JFormFieldFileList extends JFormAbstractlist { /** * The form field type. diff --git a/libraries/joomla/form/fields/folderlist.php b/libraries/joomla/form/fields/folderlist.php index 259901aa27166..659e483f0a7f7 100644 --- a/libraries/joomla/form/fields/folderlist.php +++ b/libraries/joomla/form/fields/folderlist.php @@ -10,14 +10,12 @@ defined('JPATH_PLATFORM') or die; jimport('joomla.filesystem.folder'); -JFormHelper::loadFieldClass('list'); - /** * Supports an HTML select list of folder * * @since 11.1 */ -class JFormFieldFolderList extends JFormFieldList +class JFormFieldFolderList extends JFormAbstractlist { /** * The form field type. diff --git a/libraries/joomla/form/fields/imagelist.php b/libraries/joomla/form/fields/imagelist.php index 04b14171ec983..64212f86ff965 100644 --- a/libraries/joomla/form/fields/imagelist.php +++ b/libraries/joomla/form/fields/imagelist.php @@ -16,7 +16,7 @@ * * @since 11.1 */ -class JFormFieldImageList extends JFormFieldFileList +class JFormFieldImageList extends JFormFieldFileList implements JFormDomfieldinterface { /** * The form field type. @@ -42,4 +42,24 @@ protected function getOptions() // Get the field options. return parent::getOptions(); } + + /** + * Function to manipulate the DOM element of the field. The form can be + * manipulated at that point. + * + * @param stdClass $field The field. + * @param DOMElement $fieldNode The field node. + * @param JForm $form The form. + * + * @return void + * + * @since __DEPLOY_VERSION__ + */ + protected function postProcessDomNode($field, DOMElement $fieldNode, JForm $form) + { + $fieldNode->setAttribute('hide_default', 'true'); + $fieldNode->setAttribute('directory', '/images/' . $fieldNode->getAttribute('directory')); + + return parent::postProcessDomNode($field, $fieldNode, $form); + } } diff --git a/libraries/joomla/form/fields/integer.php b/libraries/joomla/form/fields/integer.php index 88b16915a7479..a5039ae10d12d 100644 --- a/libraries/joomla/form/fields/integer.php +++ b/libraries/joomla/form/fields/integer.php @@ -9,15 +9,13 @@ 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 11.1 */ -class JFormFieldInteger extends JFormFieldList +class JFormFieldInteger extends JFormAbstractlist implements JFormDomfieldinterface { /** * The form field type. diff --git a/libraries/joomla/form/fields/language.php b/libraries/joomla/form/fields/language.php index 55a79d4c90eef..862799ed064ca 100644 --- a/libraries/joomla/form/fields/language.php +++ b/libraries/joomla/form/fields/language.php @@ -9,8 +9,6 @@ defined('JPATH_PLATFORM') or die; -JFormHelper::loadFieldClass('list'); - /** * Form Field class for the Joomla Platform. * Supports a list of installed application languages @@ -18,7 +16,7 @@ * @see JFormFieldContentLanguage for a select list of content languages. * @since 11.1 */ -class JFormFieldLanguage extends JFormFieldList +class JFormFieldLanguage extends JFormAbstractlist { /** * The form field type. diff --git a/libraries/joomla/form/fields/list.php b/libraries/joomla/form/fields/list.php index 6b2e5d4ffb974..9d2da628739b4 100644 --- a/libraries/joomla/form/fields/list.php +++ b/libraries/joomla/form/fields/list.php @@ -15,7 +15,7 @@ * * @since 11.1 */ -class JFormFieldList extends JFormField +class JFormFieldList extends JFormAbstractlist implements JFormDomfieldinterface { /** * The form field type. @@ -24,139 +24,4 @@ class JFormFieldList extends JFormField * @since 11.1 */ 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 11.1 - */ - 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[] = ''; - } - } - else - { - $html[] = ''; - } - } - else - // Create a regular list. - { - $html[] = JHtml::_('select.genericlist', $options, $this->name, trim($attr), 'value', 'text', $this->value, $this->id); - } - - return implode($html); - } - - /** - * 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(); - - 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 vote plugin enabled - 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']; - - // Add the option object to the result set. - $options[] = (object) $tmp; - } - - reset($options); - - return $options; - } } diff --git a/libraries/joomla/form/fields/plugins.php b/libraries/joomla/form/fields/plugins.php index b3ca9ee7704b0..9587e5f5001c3 100644 --- a/libraries/joomla/form/fields/plugins.php +++ b/libraries/joomla/form/fields/plugins.php @@ -9,14 +9,12 @@ defined('JPATH_PLATFORM') or die; -JFormHelper::loadFieldClass('list'); - /** * Form Field class for the Joomla Framework. * * @since 11.4 */ -class JFormFieldPlugins extends JFormFieldList +class JFormFieldPlugins extends JFormAbstractlist { /** * The field type. diff --git a/libraries/joomla/form/fields/predefinedlist.php b/libraries/joomla/form/fields/predefinedlist.php index 98436d8d8cd63..b88a4693f7e5d 100644 --- a/libraries/joomla/form/fields/predefinedlist.php +++ b/libraries/joomla/form/fields/predefinedlist.php @@ -9,14 +9,12 @@ 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 +abstract class JFormFieldPredefinedList extends JFormAbstractlist { /** * The form field type. diff --git a/libraries/joomla/form/fields/radio.php b/libraries/joomla/form/fields/radio.php index d43b80259f9cf..d41a1f6f763fd 100644 --- a/libraries/joomla/form/fields/radio.php +++ b/libraries/joomla/form/fields/radio.php @@ -9,8 +9,6 @@ defined('JPATH_PLATFORM') or die; -JFormHelper::loadFieldClass('list'); - /** * Form Field class for the Joomla Platform. * Provides radio button inputs @@ -18,7 +16,7 @@ * @link http://www.w3.org/TR/html-markup/command.radio.html#command.radio * @since 11.1 */ -class JFormFieldRadio extends JFormFieldList +class JFormFieldRadio extends JFormAbstractlist implements JFormDomfieldinterface { /** * The form field type. diff --git a/libraries/joomla/form/fields/sessionhandler.php b/libraries/joomla/form/fields/sessionhandler.php index 812a520061785..02c3605a52fe6 100644 --- a/libraries/joomla/form/fields/sessionhandler.php +++ b/libraries/joomla/form/fields/sessionhandler.php @@ -9,15 +9,13 @@ defined('JPATH_PLATFORM') or die; -JFormHelper::loadFieldClass('list'); - /** * Form Field class for the Joomla Platform. * Provides a select list of session handler options. * * @since 11.1 */ -class JFormFieldSessionHandler extends JFormFieldList +class JFormFieldSessionHandler extends JFormAbstractlist { /** * The form field type. diff --git a/libraries/joomla/form/fields/sql.php b/libraries/joomla/form/fields/sql.php index 733116575f67e..6c0dc6f2ee219 100644 --- a/libraries/joomla/form/fields/sql.php +++ b/libraries/joomla/form/fields/sql.php @@ -9,14 +9,12 @@ defined('JPATH_PLATFORM') or die; -JFormHelper::loadFieldClass('list'); - /** * Supports an custom SQL select list * * @since 11.1 */ -class JFormFieldSQL extends JFormFieldList +class JFormFieldSQL extends JFormAbstractlist implements JFormDomfieldinterface { /** * The form field type. @@ -305,4 +303,29 @@ protected function getOptions() return $options; } + + /** + * Function to manipulate the DOM element of the field. The form can be + * manipulated at that point. + * + * @param stdClass $field The field. + * @param DOMElement $fieldNode The field node. + * @param JForm $form The form. + * + * @return void + * + * @since __DEPLOY_VERSION__ + */ + protected function postProcessDomNode($field, DOMElement $fieldNode, JForm $form) + { + $fieldNode->setAttribute('value_field', 'text'); + $fieldNode->setAttribute('key_field', 'value'); + + if (! $fieldNode->getAttribute('query')) + { + $fieldNode->setAttribute('query', 'select id as value, name as text from #__users'); + } + + return parent::postProcessDomNode($field, $fieldNode, $form); + } } diff --git a/libraries/joomla/form/fields/tel.php b/libraries/joomla/form/fields/tel.php index 2728f24d66cbb..af2824ea6847d 100644 --- a/libraries/joomla/form/fields/tel.php +++ b/libraries/joomla/form/fields/tel.php @@ -20,7 +20,7 @@ * @see JHtmlTel for rendering of telephone numbers * @since 11.1 */ -class JFormFieldTel extends JFormFieldText +class JFormFieldTel extends JFormFieldText implements JFormDomfieldinterface { /** * The form field type. @@ -66,4 +66,23 @@ protected function getInput() . htmlspecialchars($this->value, ENT_COMPAT, 'UTF-8') . '"' . $size . $disabled . $readonly . $hint . $autocomplete . $autofocus . $spellcheck . $onchange . $maxLength . $required . ' />'; } + + /** + * Function to manipulate the DOM element of the field. The form can be + * manipulated at that point. + * + * @param stdClass $field The field. + * @param DOMElement $fieldNode The field node. + * @param JForm $form The form. + * + * @return void + * + * @since __DEPLOY_VERSION__ + */ + protected function postProcessDomNode($field, DOMElement $fieldNode, JForm $form) + { + $fieldNode->setAttribute('validate', 'tel'); + + return parent::postProcessDomNode($field, $fieldNode, $form); + } } diff --git a/libraries/joomla/form/fields/text.php b/libraries/joomla/form/fields/text.php index 1f0026cac8496..e50ac8e9f2f50 100644 --- a/libraries/joomla/form/fields/text.php +++ b/libraries/joomla/form/fields/text.php @@ -16,7 +16,7 @@ * @link http://www.w3.org/TR/html-markup/input.text.html#input.text * @since 11.1 */ -class JFormFieldText extends JFormField +class JFormFieldText extends JFormField implements JFormDomfieldinterface { /** * The form field type. diff --git a/libraries/joomla/form/fields/textarea.php b/libraries/joomla/form/fields/textarea.php index 5bdfb608ebc63..949fcb30f845d 100644 --- a/libraries/joomla/form/fields/textarea.php +++ b/libraries/joomla/form/fields/textarea.php @@ -16,7 +16,7 @@ * @link http://www.w3.org/TR/html-markup/textarea.html#textarea * @since 11.1 */ -class JFormFieldTextarea extends JFormField +class JFormFieldTextarea extends JFormField implements JFormDomfieldinterface { /** * The form field type. @@ -171,4 +171,23 @@ protected function getLayoutData() return array_merge($data, $extraData); } + + /** + * Function to manipulate the DOM element of the field. The form can be + * manipulated at that point. + * + * @param stdClass $field The field. + * @param DOMElement $fieldNode The field node. + * @param JForm $form The form. + * + * @return void + * + * @since __DEPLOY_VERSION__ + */ + protected function postProcessDomNode($field, DOMElement $fieldNode, JForm $form) + { + $fieldNode->setAttribute('filter', 'JComponentHelper::filterText'); + + return parent::postProcessDomNode($field, $fieldNode, $form); + } } diff --git a/libraries/joomla/form/fields/timezone.php b/libraries/joomla/form/fields/timezone.php index ded39d8af3e35..fbda44ee36631 100644 --- a/libraries/joomla/form/fields/timezone.php +++ b/libraries/joomla/form/fields/timezone.php @@ -16,7 +16,7 @@ * * @since 11.1 */ -class JFormFieldTimezone extends JFormFieldGroupedList +class JFormFieldTimezone extends JFormFieldGroupedList implements JFormDomfieldinterface { /** * The form field type. diff --git a/libraries/joomla/form/fields/url.php b/libraries/joomla/form/fields/url.php index 42ca304fa5abb..3ec397ad6443e 100644 --- a/libraries/joomla/form/fields/url.php +++ b/libraries/joomla/form/fields/url.php @@ -19,7 +19,7 @@ * @see JFormRuleUrl for validation of full urls * @since 11.1 */ -class JFormFieldUrl extends JFormFieldText +class JFormFieldUrl extends JFormFieldText implements JFormDomfieldinterface { /** * The form field type. @@ -75,4 +75,28 @@ protected function getLayoutData() return array_merge($data, $extraData); } + + /** + * Function to manipulate the DOM element of the field. The form can be + * manipulated at that point. + * + * @param stdClass $field The field. + * @param DOMElement $fieldNode The field node. + * @param JForm $form The form. + * + * @return void + * + * @since __DEPLOY_VERSION__ + */ + protected function postProcessDomNode($field, DOMElement $fieldNode, JForm $form) + { + $fieldNode->setAttribute('validate', 'url'); + + if (! $fieldNode->getAttribute('relative')) + { + $fieldNode->removeAttribute('relative'); + } + + return parent::postProcessDomNode($field, $fieldNode, $form); + } } diff --git a/libraries/joomla/form/parameters/calendar.xml b/libraries/joomla/form/parameters/calendar.xml new file mode 100644 index 0000000000000..9baed970604f7 --- /dev/null +++ b/libraries/joomla/form/parameters/calendar.xml @@ -0,0 +1,16 @@ + +
+ +
+ +
+
+
diff --git a/libraries/joomla/form/parameters/checkboxes.xml b/libraries/joomla/form/parameters/checkboxes.xml new file mode 100644 index 0000000000000..2a35b41bdc2c3 --- /dev/null +++ b/libraries/joomla/form/parameters/checkboxes.xml @@ -0,0 +1,30 @@ + +
+ +
+ + + +
+
+
diff --git a/libraries/joomla/form/parameters/imagelist.xml b/libraries/joomla/form/parameters/imagelist.xml new file mode 100644 index 0000000000000..2ccc1d6855697 --- /dev/null +++ b/libraries/joomla/form/parameters/imagelist.xml @@ -0,0 +1,43 @@ + +
+ +
+ + + + + + + + + + +
+
+
diff --git a/libraries/joomla/form/parameters/integer.xml b/libraries/joomla/form/parameters/integer.xml new file mode 100644 index 0000000000000..718500e74ebf2 --- /dev/null +++ b/libraries/joomla/form/parameters/integer.xml @@ -0,0 +1,51 @@ + +
+ +
+ + + + + + + + + + +
+
+
diff --git a/libraries/joomla/form/parameters/list.xml b/libraries/joomla/form/parameters/list.xml new file mode 100644 index 0000000000000..78d811c52ef87 --- /dev/null +++ b/libraries/joomla/form/parameters/list.xml @@ -0,0 +1,41 @@ + +
+ +
+ + + + + + + +
+
+
diff --git a/libraries/joomla/form/parameters/radio.xml b/libraries/joomla/form/parameters/radio.xml new file mode 100644 index 0000000000000..a28629f144bd9 --- /dev/null +++ b/libraries/joomla/form/parameters/radio.xml @@ -0,0 +1,40 @@ + +
+ +
+ + + +
+
+ + + diff --git a/libraries/joomla/form/parameters/sql.xml b/libraries/joomla/form/parameters/sql.xml new file mode 100644 index 0000000000000..84a500f27540b --- /dev/null +++ b/libraries/joomla/form/parameters/sql.xml @@ -0,0 +1,29 @@ + +
+ +
+ + + + + + +
+
+
diff --git a/libraries/joomla/form/parameters/textarea.xml b/libraries/joomla/form/parameters/textarea.xml new file mode 100644 index 0000000000000..1afdceea853e8 --- /dev/null +++ b/libraries/joomla/form/parameters/textarea.xml @@ -0,0 +1,26 @@ + +
+ +
+ + + +
+
+
diff --git a/libraries/joomla/form/parameters/url.xml b/libraries/joomla/form/parameters/url.xml new file mode 100644 index 0000000000000..f1a19b5e9f077 --- /dev/null +++ b/libraries/joomla/form/parameters/url.xml @@ -0,0 +1,35 @@ + +
+ +
+ + + + + + + + + + + + + + +
+
+
diff --git a/libraries/legacy/form/field/category.php b/libraries/legacy/form/field/category.php index c5cabb9fb5fd7..e037a4f7cddd8 100644 --- a/libraries/legacy/form/field/category.php +++ b/libraries/legacy/form/field/category.php @@ -9,15 +9,13 @@ defined('JPATH_PLATFORM') or die; -JFormHelper::loadFieldClass('list'); - /** * Form Field class for the Joomla Platform. * Supports an HTML select list of categories * * @since 11.1 */ -class JFormFieldCategory extends JFormFieldList +class JFormFieldCategory extends JFormAbstractlist { /** * The form field type. diff --git a/libraries/vendor/composer/autoload_files.php b/libraries/vendor/composer/autoload_files.php index 791ac6a40f886..bc30413ae6f83 100644 --- a/libraries/vendor/composer/autoload_files.php +++ b/libraries/vendor/composer/autoload_files.php @@ -22,7 +22,7 @@ '4292e2fa66516089e6006723267587b4' => $vendorDir . '/joomla/string/src/phputf8/utils/ascii.php', '87465e33b7551b401bf051928f220e9a' => $vendorDir . '/joomla/string/src/phputf8/utils/validation.php', 'e40631d46120a9c38ea139981f8dab26' => $vendorDir . '/ircmaxell/password-compat/lib/password.php', - 'edc6464955a37aa4d5fbf39d40fb6ee7' => $vendorDir . '/symfony/polyfill-php55/bootstrap.php', '5255c38a0faeba867671b61dfda6d864' => $vendorDir . '/paragonie/random_compat/lib/random.php', 'bd9634f2d41831496de0d3dfe4c94881' => $vendorDir . '/symfony/polyfill-php56/bootstrap.php', + 'edc6464955a37aa4d5fbf39d40fb6ee7' => $vendorDir . '/symfony/polyfill-php55/bootstrap.php', ); diff --git a/libraries/vendor/composer/autoload_real.php b/libraries/vendor/composer/autoload_real.php index f919171466c14..1298690b3bb5d 100644 --- a/libraries/vendor/composer/autoload_real.php +++ b/libraries/vendor/composer/autoload_real.php @@ -23,35 +23,24 @@ public static function getLoader() self::$loader = $loader = new \Composer\Autoload\ClassLoader(); spl_autoload_unregister(array('ComposerAutoloaderInit205c915b9c7d3e718e7c95793ee67ffe', 'loadClassLoader')); - $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION'); - if ($useStaticLoader) { - require_once __DIR__ . '/autoload_static.php'; - - call_user_func(\Composer\Autoload\ComposerStaticInit205c915b9c7d3e718e7c95793ee67ffe::getInitializer($loader)); - } else { - $map = require __DIR__ . '/autoload_namespaces.php'; - foreach ($map as $namespace => $path) { - $loader->set($namespace, $path); - } + $map = require __DIR__ . '/autoload_namespaces.php'; + foreach ($map as $namespace => $path) { + $loader->set($namespace, $path); + } - $map = require __DIR__ . '/autoload_psr4.php'; - foreach ($map as $namespace => $path) { - $loader->setPsr4($namespace, $path); - } + $map = require __DIR__ . '/autoload_psr4.php'; + foreach ($map as $namespace => $path) { + $loader->setPsr4($namespace, $path); + } - $classMap = require __DIR__ . '/autoload_classmap.php'; - if ($classMap) { - $loader->addClassMap($classMap); - } + $classMap = require __DIR__ . '/autoload_classmap.php'; + if ($classMap) { + $loader->addClassMap($classMap); } $loader->register(true); - if ($useStaticLoader) { - $includeFiles = Composer\Autoload\ComposerStaticInit205c915b9c7d3e718e7c95793ee67ffe::$files; - } else { - $includeFiles = require __DIR__ . '/autoload_files.php'; - } + $includeFiles = require __DIR__ . '/autoload_files.php'; foreach ($includeFiles as $fileIdentifier => $file) { composerRequire205c915b9c7d3e718e7c95793ee67ffe($fileIdentifier, $file); } diff --git a/libraries/vendor/composer/installed.json b/libraries/vendor/composer/installed.json index 6a755b3e597c5..8589ce2a48165 100644 --- a/libraries/vendor/composer/installed.json +++ b/libraries/vendor/composer/installed.json @@ -262,6 +262,69 @@ "joomla" ] }, + { + "name": "phpmailer/phpmailer", + "version": "v5.2.14", + "version_normalized": "5.2.14.0", + "source": { + "type": "git", + "url": "https://github.com/PHPMailer/PHPMailer.git", + "reference": "e774bc9152de85547336e22b8926189e582ece95" + }, + "dist": { + "type": "zip", + "url": "https://github.com/gitapi/repos/PHPMailer/PHPMailer/zipball/e774bc9152de85547336e22b8926189e582ece95", + "reference": "e774bc9152de85547336e22b8926189e582ece95", + "shasum": "" + }, + "require": { + "php": ">=5.0.0" + }, + "require-dev": { + "phpdocumentor/phpdocumentor": "*", + "phpunit/phpunit": "4.7.*" + }, + "suggest": { + "league/oauth2-client": "Needed for XOAUTH2 authentication", + "league/oauth2-google": "Needed for Gmail XOAUTH2" + }, + "time": "2015-11-01 10:15:28", + "type": "library", + "installation-source": "dist", + "autoload": { + "classmap": [ + "class.phpmailer.php", + "class.phpmaileroauth.php", + "class.phpmaileroauthgoogle.php", + "class.smtp.php", + "class.pop3.php", + "extras/EasyPeasyICS.php", + "extras/ntlm_sasl_client.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "LGPL-2.1" + ], + "authors": [ + { + "name": "Jim Jagielski", + "email": "jimjag@gmail.com" + }, + { + "name": "Marcus Bointon", + "email": "phpmailer@synchromedia.co.uk" + }, + { + "name": "Andy Prevost", + "email": "codeworxtech@users.sourceforge.net" + }, + { + "name": "Brent R. Matzelle" + } + ], + "description": "PHPMailer is a full-featured email creation and transfer class for PHP" + }, { "name": "leafo/lessphp", "version": "v0.5.0", @@ -623,152 +686,144 @@ ] }, { - "name": "joomla/application", - "version": "1.6.0", - "version_normalized": "1.6.0.0", + "name": "symfony/polyfill-php56", + "version": "v1.1.1", + "version_normalized": "1.1.1.0", "source": { "type": "git", - "url": "https://github.com/joomla-framework/application.git", - "reference": "2c2fb32553819f22ee15d4022dec805e750f43ce" + "url": "https://github.com/symfony/polyfill-php56.git", + "reference": "4d891fff050101a53a4caabb03277284942d1ad9" }, "dist": { "type": "zip", - "url": "https://github.com/gitapi/repos/joomla-framework/application/zipball/2c2fb32553819f22ee15d4022dec805e750f43ce", - "reference": "2c2fb32553819f22ee15d4022dec805e750f43ce", + "url": "https://github.com/gitapi/repos/symfony/polyfill-php56/zipball/4d891fff050101a53a4caabb03277284942d1ad9", + "reference": "4d891fff050101a53a4caabb03277284942d1ad9", "shasum": "" }, "require": { - "joomla/input": "~1.2", - "joomla/registry": "~1.1", - "php": ">=5.3.10|>=7.0", - "psr/log": "~1.0" - }, - "require-dev": { - "joomla/session": "^1.2.1", - "joomla/test": "~1.1", - "joomla/uri": "~1.1", - "phpunit/phpunit": "~4.8|~5.0", - "squizlabs/php_codesniffer": "1.*" - }, - "suggest": { - "joomla/session": "To use AbstractWebApplication with session support, install joomla/session", - "joomla/uri": "To use AbstractWebApplication, install joomla/uri" + "php": ">=5.3.3", + "symfony/polyfill-util": "~1.0" }, - "time": "2016-04-09 03:08:55", - "type": "joomla-package", + "time": "2016-01-20 09:13:37", + "type": "library", "extra": { "branch-alias": { - "dev-master": "1.x-dev" + "dev-master": "1.1-dev" } }, "installation-source": "dist", "autoload": { "psr-4": { - "Joomla\\Application\\": "src/" - } + "Symfony\\Polyfill\\Php56\\": "" + }, + "files": [ + "bootstrap.php" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ - "GPL-2.0+" + "MIT" ], - "description": "Joomla Application Package", - "homepage": "https://github.com/joomla-framework/application", + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 5.6+ features to lower PHP versions", + "homepage": "https://symfony.com", "keywords": [ - "application", - "framework", - "joomla" + "compatibility", + "polyfill", + "portable", + "shim" ] }, { - "name": "simplepie/simplepie", - "version": "1.3.1", - "version_normalized": "1.3.1.0", + "name": "symfony/yaml", + "version": "v2.8.4", + "version_normalized": "2.8.4.0", "source": { "type": "git", - "url": "https://github.com/simplepie/simplepie.git", - "reference": "ce53709778bc1e2e4deda1651b66e5081398d5cc" + "url": "https://github.com/symfony/yaml.git", + "reference": "584e52cb8f788a887553ba82db6caacb1d6260bb" }, "dist": { "type": "zip", - "url": "https://github.com/gitapi/repos/simplepie/simplepie/zipball/ce53709778bc1e2e4deda1651b66e5081398d5cc", - "reference": "ce53709778bc1e2e4deda1651b66e5081398d5cc", + "url": "https://github.com/gitapi/repos/symfony/yaml/zipball/584e52cb8f788a887553ba82db6caacb1d6260bb", + "reference": "584e52cb8f788a887553ba82db6caacb1d6260bb", "shasum": "" }, "require": { - "php": ">=5.2.0" + "php": ">=5.3.9" }, - "time": "2012-10-30 17:54:03", + "time": "2016-03-04 07:54:35", "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.8-dev" + } + }, "installation-source": "dist", "autoload": { - "psr-0": { - "SimplePie": "library" - } + "psr-4": { + "Symfony\\Component\\Yaml\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ - "BSD-3-Clause" + "MIT" ], "authors": [ { - "name": "Ryan Parman", - "homepage": "http://ryanparman.com/", - "role": "Creator, alumnus developer" - }, - { - "name": "Geoffrey Sneddon", - "homepage": "http://gsnedders.com/", - "role": "Alumnus developer" + "name": "Fabien Potencier", + "email": "fabien@symfony.com" }, { - "name": "Ryan McCue", - "email": "me@ryanmccue.info", - "homepage": "http://ryanmccue.info/", - "role": "Developer" + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" } ], - "description": "A simple Atom/RSS parsing library for PHP", - "homepage": "http://simplepie.org/", - "keywords": [ - "atom", - "feeds", - "rss" - ] + "description": "Symfony Yaml Component", + "homepage": "https://symfony.com" }, { - "name": "symfony/polyfill-php55", - "version": "v1.2.0", - "version_normalized": "1.2.0.0", + "name": "symfony/polyfill-util", + "version": "v1.1.1", + "version_normalized": "1.1.1.0", "source": { "type": "git", - "url": "https://github.com/symfony/polyfill-php55.git", - "reference": "bf2ff9ad6be1a4772cb873e4eea94d70daa95c6d" + "url": "https://github.com/symfony/polyfill-util.git", + "reference": "8de62801aa12bc4dfcf85eef5d21981ae7bb3cc4" }, "dist": { "type": "zip", - "url": "https://github.com/gitapi/repos/symfony/polyfill-php55/zipball/bf2ff9ad6be1a4772cb873e4eea94d70daa95c6d", - "reference": "bf2ff9ad6be1a4772cb873e4eea94d70daa95c6d", + "url": "https://github.com/gitapi/repos/symfony/polyfill-util/zipball/8de62801aa12bc4dfcf85eef5d21981ae7bb3cc4", + "reference": "8de62801aa12bc4dfcf85eef5d21981ae7bb3cc4", "shasum": "" }, "require": { - "ircmaxell/password-compat": "~1.0", "php": ">=5.3.3" }, - "time": "2016-05-18 14:26:46", + "time": "2016-01-20 09:13:37", "type": "library", "extra": { "branch-alias": { - "dev-master": "1.2-dev" + "dev-master": "1.1-dev" } }, "installation-source": "dist", "autoload": { "psr-4": { - "Symfony\\Polyfill\\Php55\\": "" - }, - "files": [ - "bootstrap.php" - ] + "Symfony\\Polyfill\\Util\\": "" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -784,97 +839,34 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony polyfill backporting some PHP 5.5+ features to lower PHP versions", + "description": "Symfony utilities for portability of PHP codes", "homepage": "https://symfony.com", "keywords": [ + "compat", "compatibility", "polyfill", - "portable", "shim" ] }, - { - "name": "phpmailer/phpmailer", - "version": "v5.2.16", - "version_normalized": "5.2.16.0", - "source": { - "type": "git", - "url": "https://github.com/PHPMailer/PHPMailer.git", - "reference": "1d85f9ef3ecfc42bbc4f3c70d5e37ca9a65f629a" - }, - "dist": { - "type": "zip", - "url": "https://github.com/gitapi/repos/PHPMailer/PHPMailer/zipball/1d85f9ef3ecfc42bbc4f3c70d5e37ca9a65f629a", - "reference": "1d85f9ef3ecfc42bbc4f3c70d5e37ca9a65f629a", - "shasum": "" - }, - "require": { - "php": ">=5.0.0" - }, - "require-dev": { - "phpdocumentor/phpdocumentor": "*", - "phpunit/phpunit": "4.7.*" - }, - "suggest": { - "league/oauth2-google": "Needed for Google XOAUTH2 authentication" - }, - "time": "2016-06-06 09:09:37", - "type": "library", - "installation-source": "dist", - "autoload": { - "classmap": [ - "class.phpmailer.php", - "class.phpmaileroauth.php", - "class.phpmaileroauthgoogle.php", - "class.smtp.php", - "class.pop3.php", - "extras/EasyPeasyICS.php", - "extras/ntlm_sasl_client.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "LGPL-2.1" - ], - "authors": [ - { - "name": "Jim Jagielski", - "email": "jimjag@gmail.com" - }, - { - "name": "Marcus Bointon", - "email": "phpmailer@synchromedia.co.uk" - }, - { - "name": "Andy Prevost", - "email": "codeworxtech@users.sourceforge.net" - }, - { - "name": "Brent R. Matzelle" - } - ], - "description": "PHPMailer is a full-featured email creation and transfer class for PHP" - }, { "name": "joomla/registry", - "version": "1.5.2", - "version_normalized": "1.5.2.0", + "version": "1.5.1", + "version_normalized": "1.5.1.0", "source": { "type": "git", "url": "https://github.com/joomla-framework/registry.git", - "reference": "bd3592c6f0554a72811df52aeaea98c7815f6e5a" + "reference": "b9fd1812e19619bb4722a0711b691dbfefff8ee9" }, "dist": { "type": "zip", - "url": "https://github.com/gitapi/repos/joomla-framework/registry/zipball/bd3592c6f0554a72811df52aeaea98c7815f6e5a", - "reference": "bd3592c6f0554a72811df52aeaea98c7815f6e5a", + "url": "https://github.com/gitapi/repos/joomla-framework/registry/zipball/b9fd1812e19619bb4722a0711b691dbfefff8ee9", + "reference": "b9fd1812e19619bb4722a0711b691dbfefff8ee9", "shasum": "" }, "require": { "joomla/compat": "~1.0", "joomla/utilities": "~1.0", - "php": ">=5.3.10|>=7.0", - "symfony/polyfill-php55": "~1.0" + "php": ">=5.3.10|>=7.0" }, "require-dev": { "joomla/test": "~1.0", @@ -885,7 +877,7 @@ "suggest": { "symfony/yaml": "Install symfony/yaml if you require YAML support." }, - "time": "2016-05-14 20:42:05", + "time": "2016-04-18 23:57:43", "type": "joomla-package", "extra": { "branch-alias": { @@ -911,130 +903,135 @@ ] }, { - "name": "symfony/polyfill-php56", - "version": "v1.2.0", - "version_normalized": "1.2.0.0", + "name": "joomla/application", + "version": "1.6.0", + "version_normalized": "1.6.0.0", "source": { "type": "git", - "url": "https://github.com/symfony/polyfill-php56.git", - "reference": "3edf57a8fbf9a927533344cef65ad7e1cf31030a" + "url": "https://github.com/joomla-framework/application.git", + "reference": "2c2fb32553819f22ee15d4022dec805e750f43ce" }, "dist": { "type": "zip", - "url": "https://github.com/gitapi/repos/symfony/polyfill-php56/zipball/3edf57a8fbf9a927533344cef65ad7e1cf31030a", - "reference": "3edf57a8fbf9a927533344cef65ad7e1cf31030a", + "url": "https://github.com/gitapi/repos/joomla-framework/application/zipball/2c2fb32553819f22ee15d4022dec805e750f43ce", + "reference": "2c2fb32553819f22ee15d4022dec805e750f43ce", "shasum": "" }, "require": { - "php": ">=5.3.3", - "symfony/polyfill-util": "~1.0" + "joomla/input": "~1.2", + "joomla/registry": "~1.1", + "php": ">=5.3.10|>=7.0", + "psr/log": "~1.0" }, - "time": "2016-05-18 14:26:46", - "type": "library", + "require-dev": { + "joomla/session": "^1.2.1", + "joomla/test": "~1.1", + "joomla/uri": "~1.1", + "phpunit/phpunit": "~4.8|~5.0", + "squizlabs/php_codesniffer": "1.*" + }, + "suggest": { + "joomla/session": "To use AbstractWebApplication with session support, install joomla/session", + "joomla/uri": "To use AbstractWebApplication, install joomla/uri" + }, + "time": "2016-04-09 03:08:55", + "type": "joomla-package", "extra": { "branch-alias": { - "dev-master": "1.2-dev" + "dev-master": "1.x-dev" } }, "installation-source": "dist", "autoload": { "psr-4": { - "Symfony\\Polyfill\\Php56\\": "" - }, - "files": [ - "bootstrap.php" - ] + "Joomla\\Application\\": "src/" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } + "GPL-2.0+" ], - "description": "Symfony polyfill backporting some PHP 5.6+ features to lower PHP versions", - "homepage": "https://symfony.com", + "description": "Joomla Application Package", + "homepage": "https://github.com/joomla-framework/application", "keywords": [ - "compatibility", - "polyfill", - "portable", - "shim" + "application", + "framework", + "joomla" ] }, { - "name": "symfony/yaml", - "version": "v2.8.8", - "version_normalized": "2.8.8.0", + "name": "simplepie/simplepie", + "version": "1.3.1", + "version_normalized": "1.3.1.0", "source": { "type": "git", - "url": "https://github.com/symfony/yaml.git", - "reference": "dba4bb5846798cd12f32e2d8f3f35d77045773c8" + "url": "https://github.com/simplepie/simplepie.git", + "reference": "ce53709778bc1e2e4deda1651b66e5081398d5cc" }, "dist": { "type": "zip", - "url": "https://github.com/gitapi/repos/symfony/yaml/zipball/dba4bb5846798cd12f32e2d8f3f35d77045773c8", - "reference": "dba4bb5846798cd12f32e2d8f3f35d77045773c8", + "url": "https://github.com/gitapi/repos/simplepie/simplepie/zipball/ce53709778bc1e2e4deda1651b66e5081398d5cc", + "reference": "ce53709778bc1e2e4deda1651b66e5081398d5cc", "shasum": "" }, "require": { - "php": ">=5.3.9" + "php": ">=5.2.0" }, - "time": "2016-06-29 05:29:29", + "time": "2012-10-30 17:54:03", "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.8-dev" - } - }, "installation-source": "dist", "autoload": { - "psr-4": { - "Symfony\\Component\\Yaml\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] + "psr-0": { + "SimplePie": "library" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ - "MIT" + "BSD-3-Clause" ], "authors": [ { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" + "name": "Ryan Parman", + "homepage": "http://ryanparman.com/", + "role": "Creator, alumnus developer" }, { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" + "name": "Geoffrey Sneddon", + "homepage": "http://gsnedders.com/", + "role": "Alumnus developer" + }, + { + "name": "Ryan McCue", + "email": "me@ryanmccue.info", + "homepage": "http://ryanmccue.info/", + "role": "Developer" } ], - "description": "Symfony Yaml Component", - "homepage": "https://symfony.com" + "description": "A simple Atom/RSS parsing library for PHP", + "homepage": "http://simplepie.org/", + "keywords": [ + "atom", + "feeds", + "rss" + ] }, { - "name": "symfony/polyfill-util", + "name": "symfony/polyfill-php55", "version": "v1.2.0", "version_normalized": "1.2.0.0", "source": { "type": "git", - "url": "https://github.com/symfony/polyfill-util.git", - "reference": "ef830ce3d218e622b221d6bfad42c751d974bf99" + "url": "https://github.com/symfony/polyfill-php55.git", + "reference": "bf2ff9ad6be1a4772cb873e4eea94d70daa95c6d" }, "dist": { "type": "zip", - "url": "https://github.com/gitapi/repos/symfony/polyfill-util/zipball/ef830ce3d218e622b221d6bfad42c751d974bf99", - "reference": "ef830ce3d218e622b221d6bfad42c751d974bf99", + "url": "https://github.com/gitapi/repos/symfony/polyfill-php55/zipball/bf2ff9ad6be1a4772cb873e4eea94d70daa95c6d", + "reference": "bf2ff9ad6be1a4772cb873e4eea94d70daa95c6d", "shasum": "" }, "require": { + "ircmaxell/password-compat": "~1.0", "php": ">=5.3.3" }, "time": "2016-05-18 14:26:46", @@ -1047,8 +1044,11 @@ "installation-source": "dist", "autoload": { "psr-4": { - "Symfony\\Polyfill\\Util\\": "" - } + "Symfony\\Polyfill\\Php55\\": "" + }, + "files": [ + "bootstrap.php" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -1064,12 +1064,12 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony utilities for portability of PHP codes", + "description": "Symfony polyfill backporting some PHP 5.5+ features to lower PHP versions", "homepage": "https://symfony.com", "keywords": [ - "compat", "compatibility", "polyfill", + "portable", "shim" ] }, diff --git a/libraries/vendor/joomla/registry/src/Format/Json.php b/libraries/vendor/joomla/registry/src/Format/Json.php index 0aed96abb6e3a..6f4b8682ef2aa 100644 --- a/libraries/vendor/joomla/registry/src/Format/Json.php +++ b/libraries/vendor/joomla/registry/src/Format/Json.php @@ -53,7 +53,6 @@ public function objectToString($object, $options = array()) * @return object Data object. * * @since 1.0 - * @throws \RuntimeException */ public function stringToObject($data, array $options = array('processSections' => false)) { @@ -64,14 +63,6 @@ public function stringToObject($data, array $options = array('processSections' = return AbstractRegistryFormat::getInstance('Ini')->stringToObject($data, $options); } - $decoded = json_decode($data); - - // Check for an error decoding the data - if ($decoded === null) - { - throw new \RuntimeException(sprintf('Error decoding JSON data: %s', json_last_error_msg())); - } - - return $decoded; + return json_decode($data); } } diff --git a/libraries/vendor/joomla/registry/src/Registry.php b/libraries/vendor/joomla/registry/src/Registry.php index 8f753549e43b4..7ce6f45e42d88 100644 --- a/libraries/vendor/joomla/registry/src/Registry.php +++ b/libraries/vendor/joomla/registry/src/Registry.php @@ -25,14 +25,6 @@ class Registry implements \JsonSerializable, \ArrayAccess, \IteratorAggregate, \ */ protected $data; - /** - * Flag if the Registry data object has been initialized - * - * @var boolean - * @since 1.5.2 - */ - protected $initialized = false; - /** * Registry instances container. * @@ -364,16 +356,6 @@ public function loadString($data, $format = 'JSON', $options = array()) $handler = AbstractRegistryFormat::getInstance($format, $options); $obj = $handler->stringToObject($data, $options); - - // If the data object has not yet been initialized, direct assign the object - if (!$this->initialized) - { - $this->data = $obj; - $this->initialized = true; - - return $this; - } - $this->loadObject($obj); return $this; @@ -680,9 +662,6 @@ public function toString($format = 'JSON', $options = array()) */ protected function bindData($parent, $data, $recursive = true, $allowNull = true) { - // The data object is now initialized - $this->initialized = true; - // Ensure the input data is an array. $data = is_object($data) ? get_object_vars($data) diff --git a/libraries/vendor/phpmailer/phpmailer/VERSION b/libraries/vendor/phpmailer/phpmailer/VERSION index 56f1219b499cf..ba678f2d2cf28 100644 --- a/libraries/vendor/phpmailer/phpmailer/VERSION +++ b/libraries/vendor/phpmailer/phpmailer/VERSION @@ -1 +1 @@ -5.2.16 \ No newline at end of file +5.2.14 \ No newline at end of file diff --git a/libraries/vendor/phpmailer/phpmailer/class.phpmailer.php b/libraries/vendor/phpmailer/phpmailer/class.phpmailer.php index f9013ebb1744a..e4dd00bf39eaa 100644 --- a/libraries/vendor/phpmailer/phpmailer/class.phpmailer.php +++ b/libraries/vendor/phpmailer/phpmailer/class.phpmailer.php @@ -31,7 +31,7 @@ class PHPMailer * The PHPMailer Version number. * @var string */ - public $Version = '5.2.16'; + public $Version = '5.2.14'; /** * Email priority. @@ -285,7 +285,7 @@ class PHPMailer /** * SMTP auth type. - * Options are CRAM-MD5, LOGIN, PLAIN, NTLM, XOAUTH2, attempted in that order if not specified + * Options are LOGIN (default), PLAIN, NTLM, CRAM-MD5 * @var string */ public $AuthType = ''; @@ -352,7 +352,6 @@ class PHPMailer /** * Whether to split multiple to addresses into multiple messages * or send them all in one message. - * Only supported in `mail` and `sendmail` transports, not in SMTP. * @var boolean */ public $SingleTo = false; @@ -395,7 +394,7 @@ class PHPMailer /** * DKIM Identity. - * Usually the email address used as the source of the email. + * Usually the email address used as the source of the email * @var string */ public $DKIM_identity = ''; @@ -447,15 +446,6 @@ class PHPMailer */ public $XMailer = ''; - /** - * Which validator to use by default when validating email addresses. - * May be a callable to inject your own validator, but there are several built-in validators. - * @see PHPMailer::validateAddress() - * @var string|callable - * @static - */ - public static $validator = 'auto'; - /** * An instance of the SMTP sender class. * @var SMTP @@ -644,11 +634,9 @@ class PHPMailer * Constructor. * @param boolean $exceptions Should we throw external exceptions? */ - public function __construct($exceptions = null) + public function __construct($exceptions = false) { - if ($exceptions !== null) { - $this->exceptions = (boolean)$exceptions; - } + $this->exceptions = (boolean)$exceptions; } /** @@ -657,7 +645,9 @@ public function __construct($exceptions = null) public function __destruct() { //Close any open SMTP connection nicely - $this->smtpClose(); + if ($this->Mailer == 'smtp') { + $this->smtpClose(); + } } /** @@ -681,9 +671,7 @@ private function mailPassthru($to, $subject, $body, $header, $params) } else { $subject = $this->encodeHeader($this->secureHeader($subject)); } - //Can't use additional_parameters in safe_mode - //@link http://php.net/manual/en/function.mail.php - if (ini_get('safe_mode') or !$this->UseSendmailOptions) { + if (ini_get('safe_mode') || !($this->UseSendmailOptions)) { $result = @mail($to, $subject, $body, $header); } else { $result = @mail($to, $subject, $body, $header, $params); @@ -725,7 +713,7 @@ protected function edebug($str) case 'echo': default: //Normalize line breaks - $str = preg_replace('/\r\n?/ms', "\n", $str); + $str = preg_replace('/(\r\n|\r|\n)/ms', "\n", $str); echo gmdate('Y-m-d H:i:s') . "\t" . str_replace( "\n", "\n \t ", @@ -862,7 +850,7 @@ protected function addOrEnqueueAnAddress($kind, $address, $name) $name = trim(preg_replace('/[\r\n]+/', '', $name)); //Strip breaks and trim if (($pos = strrpos($address, '@')) === false) { // At-sign is misssing. - $error_message = $this->lang('invalid_address') . " (addAnAddress $kind): $address"; + $error_message = $this->lang('invalid_address') . $address; $this->setError($error_message); $this->edebug($error_message); if ($this->exceptions) { @@ -912,7 +900,7 @@ protected function addAnAddress($kind, $address, $name = '') return false; } if (!$this->validateAddress($address)) { - $error_message = $this->lang('invalid_address') . " (addAnAddress $kind): $address"; + $error_message = $this->lang('invalid_address') . $address; $this->setError($error_message); $this->edebug($error_message); if ($this->exceptions) { @@ -1006,7 +994,7 @@ public function setFrom($address, $name = '', $auto = true) if (($pos = strrpos($address, '@')) === false or (!$this->has8bitChars(substr($address, ++$pos)) or !$this->idnSupported()) and !$this->validateAddress($address)) { - $error_message = $this->lang('invalid_address') . " (setFrom) $address"; + $error_message = $this->lang('invalid_address') . $address; $this->setError($error_message); $this->edebug($error_message); if ($this->exceptions) { @@ -1039,30 +1027,19 @@ public function getLastMessageID() /** * Check that a string looks like an email address. * @param string $address The email address to check - * @param string|callable $patternselect A selector for the validation pattern to use : + * @param string $patternselect A selector for the validation pattern to use : * * `auto` Pick best pattern automatically; * * `pcre8` Use the squiloople.com pattern, requires PCRE > 8.0, PHP >= 5.3.2, 5.2.14; * * `pcre` Use old PCRE implementation; * * `php` Use PHP built-in FILTER_VALIDATE_EMAIL; * * `html5` Use the pattern given by the HTML5 spec for 'email' type form input elements. * * `noregex` Don't use a regex: super fast, really dumb. - * Alternatively you may pass in a callable to inject your own validator, for example: - * PHPMailer::validateAddress('user@example.com', function($address) { - * return (strpos($address, '@') !== false); - * }); - * You can also set the PHPMailer::$validator static to a callable, allowing built-in methods to use your validator. * @return boolean * @static * @access public */ - public static function validateAddress($address, $patternselect = null) + public static function validateAddress($address, $patternselect = 'auto') { - if (is_null($patternselect)) { - $patternselect = self::$validator; - } - if (is_callable($patternselect)) { - return call_user_func($patternselect, $address); - } //Reject line breaks in addresses; it's valid RFC5322, but not RFC5321 if (strpos($address, "\n") !== false or strpos($address, "\r") !== false) { return false; @@ -1239,7 +1216,7 @@ public function preSend() } $this->$address_kind = $this->punyencodeAddress($this->$address_kind); if (!$this->validateAddress($this->$address_kind)) { - $error_message = $this->lang('invalid_address') . ' (punyEncode) ' . $this->$address_kind; + $error_message = $this->lang('invalid_address') . $this->$address_kind; $this->setError($error_message); $this->edebug($error_message); if ($this->exceptions) { @@ -1250,7 +1227,7 @@ public function preSend() } // Set whether the message is multipart/alternative - if ($this->alternativeExists()) { + if (!empty($this->AltBody)) { $this->ContentType = 'multipart/alternative'; } @@ -1427,9 +1404,9 @@ protected function mailSend($header, $body) } $to = implode(', ', $toArr); - $params = null; - //This sets the SMTP envelope sender which gets turned into a return-path header by the receiver - if (!empty($this->Sender)) { + if (empty($this->Sender)) { + $params = ' '; + } else { $params = sprintf('-f%s', $this->Sender); } if ($this->Sender != '' and !ini_get('safe_mode')) { @@ -1437,7 +1414,7 @@ protected function mailSend($header, $body) ini_set('sendmail_from', $this->Sender); } $result = false; - if ($this->SingleTo and count($toArr) > 1) { + if ($this->SingleTo && count($toArr) > 1) { foreach ($toArr as $toAddr) { $result = $this->mailPassthru($toAddr, $this->Subject, $body, $header, $params); $this->doCallback($result, array($toAddr), $this->cc, $this->bcc, $this->Subject, $body, $this->From); @@ -1543,17 +1520,12 @@ protected function smtpSend($header, $body) * @throws phpmailerException * @return boolean */ - public function smtpConnect($options = null) + public function smtpConnect($options = array()) { if (is_null($this->smtp)) { $this->smtp = $this->getSMTPInstance(); } - //If no options are provided, use whatever is set in the instance - if (is_null($options)) { - $options = $this->SMTPOptions; - } - // Already connected? if ($this->smtp->connected()) { return true; @@ -1623,7 +1595,7 @@ public function smtpConnect($options = null) if (!$this->smtp->startTLS()) { throw new phpmailerException($this->lang('connect_host')); } - // We must resend EHLO after TLS negotiation + // We must resend HELO after tls negotiation $this->smtp->hello($hello); } if ($this->SMTPAuth) { @@ -1662,7 +1634,7 @@ public function smtpConnect($options = null) */ public function smtpClose() { - if (is_a($this->smtp, 'SMTP')) { + if ($this->smtp !== null) { if ($this->smtp->connected()) { $this->smtp->quit(); $this->smtp->close(); @@ -2000,7 +1972,7 @@ public function createHeader() $result .= $this->headerLine('Subject', $this->encodeHeader($this->secureHeader($this->Subject))); } - if ('' != $this->MessageID and preg_match('/^<.*@.*>$/', $this->MessageID)) { + if ($this->MessageID != '') { $this->lastMessageID = $this->MessageID; } else { $this->lastMessageID = sprintf('<%s@%s>', $this->uniqueid, $this->serverHostname()); @@ -2102,7 +2074,7 @@ public function getMailMIME() */ public function getSentMIMEMessage() { - return rtrim($this->MIMEHeader . $this->mailHeader, "\n\r") . self::CRLF . self::CRLF . $this->MIMEBody; + return $this->MIMEHeader . $this->mailHeader . self::CRLF . $this->MIMEBody; } /** @@ -2132,12 +2104,12 @@ public function createBody() //Can we do a 7-bit downgrade? if ($bodyEncoding == '8bit' and !$this->has8bitChars($this->Body)) { $bodyEncoding = '7bit'; - //All ISO 8859, Windows codepage and UTF-8 charsets are ascii compatible up to 7-bit $bodyCharSet = 'us-ascii'; } //If lines are too long, and we're not already using an encoding that will shorten them, - //change to quoted-printable transfer encoding for the body part only + //change to quoted-printable transfer encoding if ('base64' != $this->Encoding and self::hasLineLongerThanMax($this->Body)) { + $this->Encoding = 'quoted-printable'; $bodyEncoding = 'quoted-printable'; } @@ -2146,12 +2118,10 @@ public function createBody() //Can we do a 7-bit downgrade? if ($altBodyEncoding == '8bit' and !$this->has8bitChars($this->AltBody)) { $altBodyEncoding = '7bit'; - //All ISO 8859, Windows codepage and UTF-8 charsets are ascii compatible up to 7-bit $altBodyCharSet = 'us-ascii'; } - //If lines are too long, and we're not already using an encoding that will shorten them, - //change to quoted-printable transfer encoding for the alt body part only - if ('base64' != $altBodyEncoding and self::hasLineLongerThanMax($this->AltBody)) { + //If lines are too long, change to quoted-printable transfer encoding + if (self::hasLineLongerThanMax($this->AltBody)) { $altBodyEncoding = 'quoted-printable'; } //Use this as a preamble in all multipart message types @@ -2254,10 +2224,8 @@ public function createBody() $body .= $this->attachAll('attachment', $this->boundary[1]); break; default: - // Catch case 'plain' and case '', applies to simple `text/plain` and `text/html` body content types - //Reset the `Encoding` property in case we changed it for line length reasons - $this->Encoding = $bodyEncoding; - $body .= $this->encodeString($this->Body, $this->Encoding); + // catch case 'plain' and case '' + $body .= $this->encodeString($this->Body, $bodyEncoding); break; } @@ -2363,7 +2331,8 @@ protected function endBoundary($boundary) /** * Set the message type. - * PHPMailer only supports some preset message types, not arbitrary MIME structures. + * PHPMailer only supports some preset message types, + * not arbitrary MIME structures. * @access protected * @return void */ @@ -2381,7 +2350,6 @@ protected function setMessageType() } $this->message_type = implode('_', $type); if ($this->message_type == '') { - //The 'plain' message_type refers to the message having a single body element, not that it is plain-text $this->message_type = 'plain'; } } @@ -3328,7 +3296,7 @@ public function msgHTML($message, $basedir = '', $advanced = false) $message ); } - } elseif (substr($url, 0, 4) !== 'cid:' && !preg_match('#^[a-z][a-z0-9+.-]*://#i', $url)) { + } elseif (substr($url, 0, 4) !== 'cid:' && !preg_match('#^[A-z]+://#', $url)) { // Do not change urls for absolute images (thanks to corvuscorax) // Do not change urls that are already inline images $filename = basename($url); @@ -3364,7 +3332,7 @@ public function msgHTML($message, $basedir = '', $advanced = false) // Convert all message body line breaks to CRLF, makes quoted-printable encoding work much better $this->Body = $this->normalizeBreaks($message); $this->AltBody = $this->normalizeBreaks($this->html2text($message, $advanced)); - if (!$this->alternativeExists()) { + if (empty($this->AltBody)) { $this->AltBody = 'To view this email message, open it in a program that understands HTML!' . self::CRLF . self::CRLF; } @@ -3689,13 +3657,11 @@ public function DKIM_Sign($signHeader) if ($this->DKIM_passphrase != '') { $privKey = openssl_pkey_get_private($privKeyStr, $this->DKIM_passphrase); } else { - $privKey = openssl_pkey_get_private($privKeyStr); + $privKey = $privKeyStr; } - if (openssl_sign($signHeader, $signature, $privKey, 'sha256WithRSAEncryption')) { //sha1WithRSAEncryption - openssl_pkey_free($privKey); + if (openssl_sign($signHeader, $signature, $privKey)) { return base64_encode($signature); } - openssl_pkey_free($privKey); return ''; } @@ -3712,7 +3678,7 @@ public function DKIM_HeaderC($signHeader) foreach ($lines as $key => $line) { list($heading, $value) = explode(':', $line, 2); $heading = strtolower($heading); - $value = preg_replace('/\s{2,}/', ' ', $value); // Compress useless spaces + $value = preg_replace('/\s+/', ' ', $value); // Compress useless spaces $lines[$key] = $heading . ':' . trim($value); // Don't forget to remove WSP around the value } $signHeader = implode("\r\n", $lines); @@ -3750,7 +3716,7 @@ public function DKIM_BodyC($body) */ public function DKIM_Add($headers_line, $subject, $body) { - $DKIMsignatureType = 'rsa-sha256'; // Signature & hash algorithms + $DKIMsignatureType = 'rsa-sha1'; // Signature & hash algorithms $DKIMcanonicalization = 'relaxed/simple'; // Canonicalization of header/body $DKIMquery = 'dns/txt'; // Query method $DKIMtime = time(); // Signature Timestamp = seconds since 00:00:00 - Jan 1, 1970 (UTC time zone) @@ -3758,7 +3724,6 @@ public function DKIM_Add($headers_line, $subject, $body) $headers = explode($this->LE, $headers_line); $from_header = ''; $to_header = ''; - $date_header = ''; $current = ''; foreach ($headers as $header) { if (strpos($header, 'From:') === 0) { @@ -3767,9 +3732,6 @@ public function DKIM_Add($headers_line, $subject, $body) } elseif (strpos($header, 'To:') === 0) { $to_header = $header; $current = 'to_header'; - } elseif (strpos($header, 'Date:') === 0) { - $date_header = $header; - $current = 'date_header'; } else { if (!empty($$current) && strpos($header, ' =?') === 0) { $$current .= $header; @@ -3780,7 +3742,6 @@ public function DKIM_Add($headers_line, $subject, $body) } $from = str_replace('|', '=7C', $this->DKIM_QP($from_header)); $to = str_replace('|', '=7C', $this->DKIM_QP($to_header)); - $date = str_replace('|', '=7C', $this->DKIM_QP($date_header)); $subject = str_replace( '|', '=7C', @@ -3788,7 +3749,7 @@ public function DKIM_Add($headers_line, $subject, $body) ); // Copied header fields (dkim-quoted-printable) $body = $this->DKIM_BodyC($body); $DKIMlen = strlen($body); // Length of body - $DKIMb64 = base64_encode(pack('H*', hash('sha256', $body))); // Base64 of packed binary SHA-256 hash of body + $DKIMb64 = base64_encode(pack('H*', sha1($body))); // Base64 of packed binary SHA-1 hash of body if ('' == $this->DKIM_identity) { $ident = ''; } else { @@ -3801,18 +3762,16 @@ public function DKIM_Add($headers_line, $subject, $body) $this->DKIM_selector . ";\r\n" . "\tt=" . $DKIMtime . '; c=' . $DKIMcanonicalization . ";\r\n" . - "\th=From:To:Date:Subject;\r\n" . + "\th=From:To:Subject;\r\n" . "\td=" . $this->DKIM_domain . ';' . $ident . "\r\n" . "\tz=$from\r\n" . "\t|$to\r\n" . - "\t|$date\r\n" . "\t|$subject;\r\n" . "\tbh=" . $DKIMb64 . ";\r\n" . "\tb="; $toSign = $this->DKIM_HeaderC( $from_header . "\r\n" . $to_header . "\r\n" . - $date_header . "\r\n" . $subject_header . "\r\n" . $dkimhdrs ); diff --git a/libraries/vendor/phpmailer/phpmailer/class.phpmaileroauthgoogle.php b/libraries/vendor/phpmailer/phpmailer/class.phpmaileroauthgoogle.php index 71c9bd32ff6af..ab6292b82f301 100644 --- a/libraries/vendor/phpmailer/phpmailer/class.phpmaileroauthgoogle.php +++ b/libraries/vendor/phpmailer/phpmailer/class.phpmaileroauthgoogle.php @@ -49,8 +49,7 @@ public function __construct( $this->oauthUserEmail = $UserEmail; } - private function getProvider() - { + private function getProvider() { return new League\OAuth2\Client\Provider\Google([ 'clientId' => $this->oauthClientId, 'clientSecret' => $this->oauthClientSecret diff --git a/libraries/vendor/phpmailer/phpmailer/class.pop3.php b/libraries/vendor/phpmailer/phpmailer/class.pop3.php index 56ad1bfcf9e6c..403b573eb3710 100644 --- a/libraries/vendor/phpmailer/phpmailer/class.pop3.php +++ b/libraries/vendor/phpmailer/phpmailer/class.pop3.php @@ -34,7 +34,7 @@ class POP3 * @var string * @access public */ - public $Version = '5.2.16'; + public $Version = '5.2.14'; /** * Default POP3 port number. diff --git a/libraries/vendor/phpmailer/phpmailer/class.smtp.php b/libraries/vendor/phpmailer/phpmailer/class.smtp.php index 0c016f12191d3..2e32e2fce00ea 100644 --- a/libraries/vendor/phpmailer/phpmailer/class.smtp.php +++ b/libraries/vendor/phpmailer/phpmailer/class.smtp.php @@ -30,7 +30,7 @@ class SMTP * The PHPMailer SMTP version number. * @var string */ - const VERSION = '5.2.16'; + const VERSION = '5.2.14'; /** * SMTP line break constant. @@ -81,7 +81,7 @@ class SMTP * @deprecated Use the `VERSION` constant instead * @see SMTP::VERSION */ - public $Version = '5.2.16'; + public $Version = '5.2.14'; /** * SMTP server port number. @@ -336,22 +336,11 @@ public function startTLS() if (!$this->sendCommand('STARTTLS', 'STARTTLS', 220)) { return false; } - - //Allow the best TLS version(s) we can - $crypto_method = STREAM_CRYPTO_METHOD_TLS_CLIENT; - - //PHP 5.6.7 dropped inclusion of TLS 1.1 and 1.2 in STREAM_CRYPTO_METHOD_TLS_CLIENT - //so add them back in manually if we can - if (defined('STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT')) { - $crypto_method |= STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT; - $crypto_method |= STREAM_CRYPTO_METHOD_TLSv1_1_CLIENT; - } - // Begin encrypted connection if (!stream_socket_enable_crypto( $this->smtp_conn, true, - $crypto_method + STREAM_CRYPTO_METHOD_TLS_CLIENT )) { return false; } @@ -400,7 +389,7 @@ public function authenticate( ); if (empty($authtype)) { - foreach (array('CRAM-MD5', 'LOGIN', 'PLAIN', 'NTLM', 'XOAUTH2') as $method) { + foreach (array('LOGIN', 'CRAM-MD5', 'NTLM', 'PLAIN', 'XOAUTH2') as $method) { if (in_array($method, $this->server_caps['AUTH'])) { $authtype = $method; break; @@ -747,7 +736,7 @@ protected function sendHello($hello, $host) protected function parseHelloFields($type) { $this->server_caps = array(); - $lines = explode("\n", $this->helo_rply); + $lines = explode("\n", $this->last_reply); foreach ($lines as $n => $s) { //First 4 chars contain response code followed by - or space diff --git a/libraries/vendor/phpmailer/phpmailer/composer.lock b/libraries/vendor/phpmailer/phpmailer/composer.lock index 3e8cb618a9661..15a841d8a35eb 100644 --- a/libraries/vendor/phpmailer/phpmailer/composer.lock +++ b/libraries/vendor/phpmailer/phpmailer/composer.lock @@ -4,8 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "ca5abc72444d9608a35c39f9064c139b", - "content-hash": "8b66ed71ae9ca8cd0258c814615d624f", + "hash": "0eb36ae77d61050323a94e312176ea66", "packages": [], "packages-dev": [ { @@ -331,16 +330,16 @@ }, { "name": "erusev/parsedown", - "version": "1.6.0", + "version": "1.5.4", "source": { "type": "git", "url": "https://github.com/erusev/parsedown.git", - "reference": "3ebbd730b5c2cf5ce78bc1bf64071407fc6674b7" + "reference": "0e89e3714bda18973184d30646306bb0a482bd96" }, "dist": { "type": "zip", - "url": "https://github.com/gitapi/repos/erusev/parsedown/zipball/3ebbd730b5c2cf5ce78bc1bf64071407fc6674b7", - "reference": "3ebbd730b5c2cf5ce78bc1bf64071407fc6674b7", + "url": "https://github.com/gitapi/repos/erusev/parsedown/zipball/0e89e3714bda18973184d30646306bb0a482bd96", + "reference": "0e89e3714bda18973184d30646306bb0a482bd96", "shasum": "" }, "type": "library", @@ -366,7 +365,7 @@ "markdown", "parser" ], - "time": "2015-10-04 16:44:32" + "time": "2015-08-03 09:24:05" }, { "name": "herrera-io/json", @@ -627,9 +626,9 @@ ], "authors": [ { - "name": "Johannes M. Schmitt", + "name": "Johannes Schmitt", "email": "schmittjoh@gmail.com", - "homepage": "http://jmsyst.com", + "homepage": "https://github.com/schmittjoh", "role": "Developer of wrapped JMSSerializerBundle" } ], @@ -646,16 +645,16 @@ }, { "name": "justinrainbow/json-schema", - "version": "v1.6.0", + "version": "1.4.4", "source": { "type": "git", "url": "https://github.com/justinrainbow/json-schema.git", - "reference": "f9e27c3e202faf14fd581ef41355d83bb4b7eb7d" + "reference": "8dc9b9d85ab639ca60ab4608b34c1279d6ae7bce" }, "dist": { "type": "zip", - "url": "https://github.com/gitapi/repos/justinrainbow/json-schema/zipball/f9e27c3e202faf14fd581ef41355d83bb4b7eb7d", - "reference": "f9e27c3e202faf14fd581ef41355d83bb4b7eb7d", + "url": "https://github.com/gitapi/repos/justinrainbow/json-schema/zipball/8dc9b9d85ab639ca60ab4608b34c1279d6ae7bce", + "reference": "8dc9b9d85ab639ca60ab4608b34c1279d6ae7bce", "shasum": "" }, "require": { @@ -676,8 +675,8 @@ } }, "autoload": { - "psr-4": { - "JsonSchema\\": "src/JsonSchema/" + "psr-0": { + "JsonSchema": "src/" } }, "notification-url": "https://packagist.org/downloads/", @@ -708,7 +707,7 @@ "json", "schema" ], - "time": "2016-01-06 14:37:04" + "time": "2015-07-14 16:29:50" }, { "name": "kherge/version", @@ -755,16 +754,16 @@ }, { "name": "monolog/monolog", - "version": "1.17.2", + "version": "1.17.1", "source": { "type": "git", "url": "https://github.com/Seldaek/monolog.git", - "reference": "bee7f0dc9c3e0b69a6039697533dca1e845c8c24" + "reference": "0524c87587ab85bc4c2d6f5b41253ccb930a5422" }, "dist": { "type": "zip", - "url": "https://github.com/gitapi/repos/Seldaek/monolog/zipball/bee7f0dc9c3e0b69a6039697533dca1e845c8c24", - "reference": "bee7f0dc9c3e0b69a6039697533dca1e845c8c24", + "url": "https://github.com/gitapi/repos/Seldaek/monolog/zipball/0524c87587ab85bc4c2d6f5b41253ccb930a5422", + "reference": "0524c87587ab85bc4c2d6f5b41253ccb930a5422", "shasum": "" }, "require": { @@ -778,11 +777,10 @@ "aws/aws-sdk-php": "^2.4.9", "doctrine/couchdb": "~1.0@dev", "graylog2/gelf-php": "~1.0", - "jakub-onderka/php-parallel-lint": "0.9", "php-console/php-console": "^3.1.3", "phpunit/phpunit": "~4.5", "phpunit/phpunit-mock-objects": "2.3.0", - "raven/raven": "^0.13", + "raven/raven": "~0.11", "ruflin/elastica": ">=0.90 <3.0", "swiftmailer/swiftmailer": "~5.3", "videlalvaro/php-amqplib": "~2.4" @@ -828,7 +826,7 @@ "logging", "psr-3" ], - "time": "2015-10-14 12:51:02" + "time": "2015-08-31 09:17:37" }, { "name": "nikic/php-parser", @@ -909,9 +907,9 @@ ], "authors": [ { - "name": "Johannes M. Schmitt", + "name": "Johannes Schmitt", "email": "schmittjoh@gmail.com", - "homepage": "http://jmsyst.com", + "homepage": "https://github.com/schmittjoh", "role": "Developer of wrapped JMSSerializerBundle" } ], @@ -1313,16 +1311,16 @@ }, { "name": "phpunit/php-code-coverage", - "version": "2.2.4", + "version": "2.2.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "eabf68b476ac7d0f73793aada060f1c1a9bf8979" + "reference": "2d7c03c0e4e080901b8f33b2897b0577be18a13c" }, "dist": { "type": "zip", - "url": "https://github.com/gitapi/repos/sebastianbergmann/php-code-coverage/zipball/eabf68b476ac7d0f73793aada060f1c1a9bf8979", - "reference": "eabf68b476ac7d0f73793aada060f1c1a9bf8979", + "url": "https://github.com/gitapi/repos/sebastianbergmann/php-code-coverage/zipball/2d7c03c0e4e080901b8f33b2897b0577be18a13c", + "reference": "2d7c03c0e4e080901b8f33b2897b0577be18a13c", "shasum": "" }, "require": { @@ -1371,7 +1369,7 @@ "testing", "xunit" ], - "time": "2015-10-06 15:47:00" + "time": "2015-08-04 03:42:39" }, { "name": "phpunit/php-file-iterator", @@ -1504,16 +1502,16 @@ }, { "name": "phpunit/php-token-stream", - "version": "1.4.8", + "version": "1.4.6", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-token-stream.git", - "reference": "3144ae21711fb6cac0b1ab4cbe63b75ce3d4e8da" + "reference": "3ab72c62e550370a6cd5dc873e1a04ab57562f5b" }, "dist": { "type": "zip", - "url": "https://github.com/gitapi/repos/sebastianbergmann/php-token-stream/zipball/3144ae21711fb6cac0b1ab4cbe63b75ce3d4e8da", - "reference": "3144ae21711fb6cac0b1ab4cbe63b75ce3d4e8da", + "url": "https://github.com/gitapi/repos/sebastianbergmann/php-token-stream/zipball/3ab72c62e550370a6cd5dc873e1a04ab57562f5b", + "reference": "3ab72c62e550370a6cd5dc873e1a04ab57562f5b", "shasum": "" }, "require": { @@ -1549,7 +1547,7 @@ "keywords": [ "tokenizer" ], - "time": "2015-09-15 10:49:45" + "time": "2015-08-16 08:51:00" }, { "name": "phpunit/phpunit", @@ -1625,16 +1623,16 @@ }, { "name": "phpunit/phpunit-mock-objects", - "version": "2.3.8", + "version": "2.3.7", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git", - "reference": "ac8e7a3db35738d56ee9a76e78a4e03d97628983" + "reference": "5e2645ad49d196e020b85598d7c97e482725786a" }, "dist": { "type": "zip", - "url": "https://github.com/gitapi/repos/sebastianbergmann/phpunit-mock-objects/zipball/ac8e7a3db35738d56ee9a76e78a4e03d97628983", - "reference": "ac8e7a3db35738d56ee9a76e78a4e03d97628983", + "url": "https://github.com/gitapi/repos/sebastianbergmann/phpunit-mock-objects/zipball/5e2645ad49d196e020b85598d7c97e482725786a", + "reference": "5e2645ad49d196e020b85598d7c97e482725786a", "shasum": "" }, "require": { @@ -1677,7 +1675,7 @@ "mock", "xunit" ], - "time": "2015-10-02 06:51:40" + "time": "2015-08-19 09:14:08" }, { "name": "pimple/pimple", @@ -1714,9 +1712,7 @@ "authors": [ { "name": "Fabien Potencier", - "email": "fabien@symfony.com", - "homepage": "http://fabien.potencier.org", - "role": "Lead Developer" + "email": "fabien@symfony.com" } ], "description": "Pimple is a simple Dependency Injection Container for PHP 5.3", @@ -1831,28 +1827,28 @@ }, { "name": "sebastian/diff", - "version": "1.4.1", + "version": "1.3.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "13edfd8706462032c2f52b4b862974dd46b71c9e" + "reference": "863df9687835c62aa423a22412d26fa2ebde3fd3" }, "dist": { "type": "zip", - "url": "https://github.com/gitapi/repos/sebastianbergmann/diff/zipball/13edfd8706462032c2f52b4b862974dd46b71c9e", - "reference": "13edfd8706462032c2f52b4b862974dd46b71c9e", + "url": "https://github.com/gitapi/repos/sebastianbergmann/diff/zipball/863df9687835c62aa423a22412d26fa2ebde3fd3", + "reference": "863df9687835c62aa423a22412d26fa2ebde3fd3", "shasum": "" }, "require": { "php": ">=5.3.3" }, "require-dev": { - "phpunit/phpunit": "~4.8" + "phpunit/phpunit": "~4.2" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.4-dev" + "dev-master": "1.3-dev" } }, "autoload": { @@ -1875,24 +1871,24 @@ } ], "description": "Diff implementation", - "homepage": "https://github.com/sebastianbergmann/diff", + "homepage": "http://www.github.com/sebastianbergmann/diff", "keywords": [ "diff" ], - "time": "2015-12-08 07:14:41" + "time": "2015-02-22 15:13:53" }, { "name": "sebastian/environment", - "version": "1.3.3", + "version": "1.3.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "6e7133793a8e5a5714a551a8324337374be209df" + "reference": "6324c907ce7a52478eeeaede764f48733ef5ae44" }, "dist": { "type": "zip", - "url": "https://github.com/gitapi/repos/sebastianbergmann/environment/zipball/6e7133793a8e5a5714a551a8324337374be209df", - "reference": "6e7133793a8e5a5714a551a8324337374be209df", + "url": "https://github.com/gitapi/repos/sebastianbergmann/environment/zipball/6324c907ce7a52478eeeaede764f48733ef5ae44", + "reference": "6324c907ce7a52478eeeaede764f48733ef5ae44", "shasum": "" }, "require": { @@ -1929,7 +1925,7 @@ "environment", "hhvm" ], - "time": "2015-12-02 08:37:27" + "time": "2015-08-03 06:14:51" }, { "name": "sebastian/exporter", @@ -1999,16 +1995,16 @@ }, { "name": "sebastian/global-state", - "version": "1.1.1", + "version": "1.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "bc37d50fea7d017d3d340f230811c9f1d7280af4" + "reference": "c7428acdb62ece0a45e6306f1ae85e1c05b09c01" }, "dist": { "type": "zip", - "url": "https://github.com/gitapi/repos/sebastianbergmann/global-state/zipball/bc37d50fea7d017d3d340f230811c9f1d7280af4", - "reference": "bc37d50fea7d017d3d340f230811c9f1d7280af4", + "url": "https://github.com/gitapi/repos/sebastianbergmann/global-state/zipball/c7428acdb62ece0a45e6306f1ae85e1c05b09c01", + "reference": "c7428acdb62ece0a45e6306f1ae85e1c05b09c01", "shasum": "" }, "require": { @@ -2046,20 +2042,20 @@ "keywords": [ "global state" ], - "time": "2015-10-12 03:26:01" + "time": "2014-10-06 09:23:50" }, { "name": "sebastian/recursion-context", - "version": "1.0.2", + "version": "1.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/recursion-context.git", - "reference": "913401df809e99e4f47b27cdd781f4a258d58791" + "reference": "994d4a811bafe801fb06dccbee797863ba2792ba" }, "dist": { "type": "zip", - "url": "https://github.com/gitapi/repos/sebastianbergmann/recursion-context/zipball/913401df809e99e4f47b27cdd781f4a258d58791", - "reference": "913401df809e99e4f47b27cdd781f4a258d58791", + "url": "https://github.com/gitapi/repos/sebastianbergmann/recursion-context/zipball/994d4a811bafe801fb06dccbee797863ba2792ba", + "reference": "994d4a811bafe801fb06dccbee797863ba2792ba", "shasum": "" }, "require": { @@ -2099,7 +2095,7 @@ ], "description": "Provides functionality to recursively process PHP variables", "homepage": "http://www.github.com/sebastianbergmann/recursion-context", - "time": "2015-11-11 19:50:13" + "time": "2015-06-21 08:04:50" }, { "name": "sebastian/version", @@ -2138,20 +2134,20 @@ }, { "name": "seld/jsonlint", - "version": "1.4.0", + "version": "1.3.1", "source": { "type": "git", "url": "https://github.com/Seldaek/jsonlint.git", - "reference": "66834d3e3566bb5798db7294619388786ae99394" + "reference": "863ae85c6d3ef60ca49cb12bd051c4a0648c40c4" }, "dist": { "type": "zip", - "url": "https://github.com/gitapi/repos/Seldaek/jsonlint/zipball/66834d3e3566bb5798db7294619388786ae99394", - "reference": "66834d3e3566bb5798db7294619388786ae99394", + "url": "https://github.com/gitapi/repos/Seldaek/jsonlint/zipball/863ae85c6d3ef60ca49cb12bd051c4a0648c40c4", + "reference": "863ae85c6d3ef60ca49cb12bd051c4a0648c40c4", "shasum": "" }, "require": { - "php": "^5.3 || ^7.0" + "php": ">=5.3.0" }, "bin": [ "bin/jsonlint" @@ -2180,39 +2176,39 @@ "parser", "validator" ], - "time": "2015-11-21 02:21:41" + "time": "2015-01-04 21:18:15" }, { "name": "symfony/config", - "version": "v2.8.1", + "version": "v2.7.3", "source": { "type": "git", - "url": "https://github.com/symfony/config.git", - "reference": "17d4b2e64ce1c6ba7caa040f14469b3c44d7f7d2" + "url": "https://github.com/symfony/Config.git", + "reference": "6c905bbed1e728226de656e4c07d620dfe9e80d9" }, "dist": { "type": "zip", - "url": "https://github.com/gitapi/repos/symfony/config/zipball/17d4b2e64ce1c6ba7caa040f14469b3c44d7f7d2", - "reference": "17d4b2e64ce1c6ba7caa040f14469b3c44d7f7d2", + "url": "https://github.com/gitapi/repos/symfony/Config/zipball/6c905bbed1e728226de656e4c07d620dfe9e80d9", + "reference": "6c905bbed1e728226de656e4c07d620dfe9e80d9", "shasum": "" }, "require": { "php": ">=5.3.9", - "symfony/filesystem": "~2.3|~3.0.0" + "symfony/filesystem": "~2.3" + }, + "require-dev": { + "symfony/phpunit-bridge": "~2.7" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.8-dev" + "dev-master": "2.7-dev" } }, "autoload": { "psr-4": { "Symfony\\Component\\Config\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -2230,30 +2226,30 @@ ], "description": "Symfony Config Component", "homepage": "https://symfony.com", - "time": "2015-12-26 13:37:56" + "time": "2015-07-09 16:07:40" }, { "name": "symfony/console", - "version": "v2.8.1", + "version": "v2.7.3", "source": { "type": "git", - "url": "https://github.com/symfony/console.git", - "reference": "2e06a5ccb19dcf9b89f1c6a677a39a8df773635a" + "url": "https://github.com/symfony/Console.git", + "reference": "d6cf02fe73634c96677e428f840704bfbcaec29e" }, "dist": { "type": "zip", - "url": "https://github.com/gitapi/repos/symfony/console/zipball/2e06a5ccb19dcf9b89f1c6a677a39a8df773635a", - "reference": "2e06a5ccb19dcf9b89f1c6a677a39a8df773635a", + "url": "https://github.com/gitapi/repos/symfony/Console/zipball/d6cf02fe73634c96677e428f840704bfbcaec29e", + "reference": "d6cf02fe73634c96677e428f840704bfbcaec29e", "shasum": "" }, "require": { - "php": ">=5.3.9", - "symfony/polyfill-mbstring": "~1.0" + "php": ">=5.3.9" }, "require-dev": { "psr/log": "~1.0", - "symfony/event-dispatcher": "~2.1|~3.0.0", - "symfony/process": "~2.1|~3.0.0" + "symfony/event-dispatcher": "~2.1", + "symfony/phpunit-bridge": "~2.7", + "symfony/process": "~2.1" }, "suggest": { "psr/log": "For using the console logger", @@ -2263,16 +2259,13 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.8-dev" + "dev-master": "2.7-dev" } }, "autoload": { "psr-4": { "Symfony\\Component\\Console\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -2290,20 +2283,20 @@ ], "description": "Symfony Console Component", "homepage": "https://symfony.com", - "time": "2015-12-22 10:25:57" + "time": "2015-07-28 15:18:12" }, { "name": "symfony/event-dispatcher", - "version": "v2.8.1", + "version": "v2.7.3", "source": { "type": "git", - "url": "https://github.com/symfony/event-dispatcher.git", - "reference": "a5eb815363c0388e83247e7e9853e5dbc14999cc" + "url": "https://github.com/symfony/EventDispatcher.git", + "reference": "9310b5f9a87ec2ea75d20fec0b0017c77c66dac3" }, "dist": { "type": "zip", - "url": "https://github.com/gitapi/repos/symfony/event-dispatcher/zipball/a5eb815363c0388e83247e7e9853e5dbc14999cc", - "reference": "a5eb815363c0388e83247e7e9853e5dbc14999cc", + "url": "https://github.com/gitapi/repos/symfony/EventDispatcher/zipball/9310b5f9a87ec2ea75d20fec0b0017c77c66dac3", + "reference": "9310b5f9a87ec2ea75d20fec0b0017c77c66dac3", "shasum": "" }, "require": { @@ -2311,10 +2304,11 @@ }, "require-dev": { "psr/log": "~1.0", - "symfony/config": "~2.0,>=2.0.5|~3.0.0", - "symfony/dependency-injection": "~2.6|~3.0.0", - "symfony/expression-language": "~2.6|~3.0.0", - "symfony/stopwatch": "~2.3|~3.0.0" + "symfony/config": "~2.0,>=2.0.5", + "symfony/dependency-injection": "~2.6", + "symfony/expression-language": "~2.6", + "symfony/phpunit-bridge": "~2.7", + "symfony/stopwatch": "~2.3" }, "suggest": { "symfony/dependency-injection": "", @@ -2323,16 +2317,13 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.8-dev" + "dev-master": "2.7-dev" } }, "autoload": { "psr-4": { "Symfony\\Component\\EventDispatcher\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -2350,38 +2341,38 @@ ], "description": "Symfony EventDispatcher Component", "homepage": "https://symfony.com", - "time": "2015-10-30 20:15:42" + "time": "2015-06-18 19:21:56" }, { "name": "symfony/filesystem", - "version": "v3.0.1", + "version": "v2.7.3", "source": { "type": "git", - "url": "https://github.com/symfony/filesystem.git", - "reference": "c2e59d11dccd135dc8f00ee97f34fe1de842e70c" + "url": "https://github.com/symfony/Filesystem.git", + "reference": "2d7b2ddaf3f548f4292df49a99d19c853d43f0b8" }, "dist": { "type": "zip", - "url": "https://github.com/gitapi/repos/symfony/filesystem/zipball/c2e59d11dccd135dc8f00ee97f34fe1de842e70c", - "reference": "c2e59d11dccd135dc8f00ee97f34fe1de842e70c", + "url": "https://github.com/gitapi/repos/symfony/Filesystem/zipball/2d7b2ddaf3f548f4292df49a99d19c853d43f0b8", + "reference": "2d7b2ddaf3f548f4292df49a99d19c853d43f0b8", "shasum": "" }, "require": { - "php": ">=5.5.9" + "php": ">=5.3.9" + }, + "require-dev": { + "symfony/phpunit-bridge": "~2.7" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.0-dev" + "dev-master": "2.7-dev" } }, "autoload": { "psr-4": { "Symfony\\Component\\Filesystem\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -2399,38 +2390,38 @@ ], "description": "Symfony Filesystem Component", "homepage": "https://symfony.com", - "time": "2015-12-22 10:39:06" + "time": "2015-07-09 16:07:40" }, { "name": "symfony/finder", - "version": "v2.8.1", + "version": "v2.7.3", "source": { "type": "git", - "url": "https://github.com/symfony/finder.git", - "reference": "dd41ae57f4f737be271d944a0cc5f5f21203a7c6" + "url": "https://github.com/symfony/Finder.git", + "reference": "ae0f363277485094edc04c9f3cbe595b183b78e4" }, "dist": { "type": "zip", - "url": "https://github.com/gitapi/repos/symfony/finder/zipball/dd41ae57f4f737be271d944a0cc5f5f21203a7c6", - "reference": "dd41ae57f4f737be271d944a0cc5f5f21203a7c6", + "url": "https://github.com/gitapi/repos/symfony/Finder/zipball/ae0f363277485094edc04c9f3cbe595b183b78e4", + "reference": "ae0f363277485094edc04c9f3cbe595b183b78e4", "shasum": "" }, "require": { "php": ">=5.3.9" }, + "require-dev": { + "symfony/phpunit-bridge": "~2.7" + }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.8-dev" + "dev-master": "2.7-dev" } }, "autoload": { "psr-4": { "Symfony\\Component\\Finder\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -2448,97 +2439,38 @@ ], "description": "Symfony Finder Component", "homepage": "https://symfony.com", - "time": "2015-12-05 11:09:21" - }, - { - "name": "symfony/polyfill-mbstring", - "version": "v1.0.1", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "49ff736bd5d41f45240cec77b44967d76e0c3d25" - }, - "dist": { - "type": "zip", - "url": "https://github.com/gitapi/repos/symfony/polyfill-mbstring/zipball/49ff736bd5d41f45240cec77b44967d76e0c3d25", - "reference": "49ff736bd5d41f45240cec77b44967d76e0c3d25", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "suggest": { - "ext-mbstring": "For best performance" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Mbstring\\": "" - }, - "files": [ - "bootstrap.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill for the Mbstring extension", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "mbstring", - "polyfill", - "portable", - "shim" - ], - "time": "2015-11-20 09:19:13" + "time": "2015-07-09 16:07:40" }, { "name": "symfony/process", - "version": "v2.8.1", + "version": "v2.7.3", "source": { "type": "git", - "url": "https://github.com/symfony/process.git", - "reference": "62c254438b5040bc2217156e1570cf2206e8540c" + "url": "https://github.com/symfony/Process.git", + "reference": "48aeb0e48600321c272955132d7606ab0a49adb3" }, "dist": { "type": "zip", - "url": "https://github.com/gitapi/repos/symfony/process/zipball/62c254438b5040bc2217156e1570cf2206e8540c", - "reference": "62c254438b5040bc2217156e1570cf2206e8540c", + "url": "https://github.com/gitapi/repos/symfony/Process/zipball/48aeb0e48600321c272955132d7606ab0a49adb3", + "reference": "48aeb0e48600321c272955132d7606ab0a49adb3", "shasum": "" }, "require": { "php": ">=5.3.9" }, + "require-dev": { + "symfony/phpunit-bridge": "~2.7" + }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.8-dev" + "dev-master": "2.7-dev" } }, "autoload": { "psr-4": { "Symfony\\Component\\Process\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -2556,38 +2488,38 @@ ], "description": "Symfony Process Component", "homepage": "https://symfony.com", - "time": "2015-12-23 11:03:46" + "time": "2015-07-01 11:25:50" }, { "name": "symfony/stopwatch", - "version": "v2.8.1", + "version": "v2.7.3", "source": { "type": "git", - "url": "https://github.com/symfony/stopwatch.git", - "reference": "5f1e2ebd1044da542d2b9510527836e8be92b1cb" + "url": "https://github.com/symfony/Stopwatch.git", + "reference": "b07a866719bbac5294c67773340f97b871733310" }, "dist": { "type": "zip", - "url": "https://github.com/gitapi/repos/symfony/stopwatch/zipball/5f1e2ebd1044da542d2b9510527836e8be92b1cb", - "reference": "5f1e2ebd1044da542d2b9510527836e8be92b1cb", + "url": "https://github.com/gitapi/repos/symfony/Stopwatch/zipball/b07a866719bbac5294c67773340f97b871733310", + "reference": "b07a866719bbac5294c67773340f97b871733310", "shasum": "" }, "require": { "php": ">=5.3.9" }, + "require-dev": { + "symfony/phpunit-bridge": "~2.7" + }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.8-dev" + "dev-master": "2.7-dev" } }, "autoload": { "psr-4": { "Symfony\\Component\\Stopwatch\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -2605,34 +2537,34 @@ ], "description": "Symfony Stopwatch Component", "homepage": "https://symfony.com", - "time": "2015-10-30 20:15:42" + "time": "2015-07-01 18:23:16" }, { "name": "symfony/translation", - "version": "v3.0.1", + "version": "v2.7.3", "source": { "type": "git", - "url": "https://github.com/symfony/translation.git", - "reference": "dff0867826a7068d673801b7522f8e2634016ef9" + "url": "https://github.com/symfony/Translation.git", + "reference": "c8dc34cc936152c609cdd722af317e4239d10dd6" }, "dist": { "type": "zip", - "url": "https://github.com/gitapi/repos/symfony/translation/zipball/dff0867826a7068d673801b7522f8e2634016ef9", - "reference": "dff0867826a7068d673801b7522f8e2634016ef9", + "url": "https://github.com/gitapi/repos/symfony/Translation/zipball/c8dc34cc936152c609cdd722af317e4239d10dd6", + "reference": "c8dc34cc936152c609cdd722af317e4239d10dd6", "shasum": "" }, "require": { - "php": ">=5.5.9", - "symfony/polyfill-mbstring": "~1.0" + "php": ">=5.3.9" }, "conflict": { - "symfony/config": "<2.8" + "symfony/config": "<2.7" }, "require-dev": { "psr/log": "~1.0", - "symfony/config": "~2.8|~3.0", - "symfony/intl": "~2.8|~3.0", - "symfony/yaml": "~2.8|~3.0" + "symfony/config": "~2.7", + "symfony/intl": "~2.3", + "symfony/phpunit-bridge": "~2.7", + "symfony/yaml": "~2.2" }, "suggest": { "psr/log": "To use logging capability in translator", @@ -2642,16 +2574,13 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.0-dev" + "dev-master": "2.7-dev" } }, "autoload": { "psr-4": { "Symfony\\Component\\Translation\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -2669,36 +2598,37 @@ ], "description": "Symfony Translation Component", "homepage": "https://symfony.com", - "time": "2015-12-05 17:45:07" + "time": "2015-07-09 16:07:40" }, { "name": "symfony/validator", - "version": "v2.8.1", + "version": "v2.7.3", "source": { "type": "git", - "url": "https://github.com/symfony/validator.git", - "reference": "ab56537745fe90066e23275f3dd8a002ff4e2c25" + "url": "https://github.com/symfony/Validator.git", + "reference": "646df03e635a8a232804274401449ccdf5f03cad" }, "dist": { "type": "zip", - "url": "https://github.com/gitapi/repos/symfony/validator/zipball/ab56537745fe90066e23275f3dd8a002ff4e2c25", - "reference": "ab56537745fe90066e23275f3dd8a002ff4e2c25", + "url": "https://github.com/gitapi/repos/symfony/Validator/zipball/646df03e635a8a232804274401449ccdf5f03cad", + "reference": "646df03e635a8a232804274401449ccdf5f03cad", "shasum": "" }, "require": { "php": ">=5.3.9", - "symfony/translation": "~2.4|~3.0.0" + "symfony/translation": "~2.4" }, "require-dev": { "doctrine/annotations": "~1.0", "doctrine/cache": "~1.0", "egulias/email-validator": "~1.2,>=1.2.1", - "symfony/config": "~2.2|~3.0.0", - "symfony/expression-language": "~2.4|~3.0.0", - "symfony/http-foundation": "~2.1|~3.0.0", - "symfony/intl": "~2.4|~3.0.0", - "symfony/property-access": "~2.3|~3.0.0", - "symfony/yaml": "~2.0,>=2.0.5|~3.0.0" + "symfony/config": "~2.2", + "symfony/expression-language": "~2.4", + "symfony/http-foundation": "~2.1", + "symfony/intl": "~2.3", + "symfony/phpunit-bridge": "~2.7", + "symfony/property-access": "~2.3", + "symfony/yaml": "~2.0,>=2.0.5" }, "suggest": { "doctrine/annotations": "For using the annotation mapping. You will also need doctrine/cache.", @@ -2714,16 +2644,13 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.8-dev" + "dev-master": "2.7-dev" } }, "autoload": { "psr-4": { "Symfony\\Component\\Validator\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -2741,38 +2668,38 @@ ], "description": "Symfony Validator Component", "homepage": "https://symfony.com", - "time": "2015-12-26 13:37:56" + "time": "2015-07-31 06:49:15" }, { "name": "symfony/yaml", - "version": "v3.0.1", + "version": "v2.7.3", "source": { "type": "git", - "url": "https://github.com/symfony/yaml.git", - "reference": "3df409958a646dad2bc5046c3fb671ee24a1a691" + "url": "https://github.com/symfony/Yaml.git", + "reference": "71340e996171474a53f3d29111d046be4ad8a0ff" }, "dist": { "type": "zip", - "url": "https://github.com/gitapi/repos/symfony/yaml/zipball/3df409958a646dad2bc5046c3fb671ee24a1a691", - "reference": "3df409958a646dad2bc5046c3fb671ee24a1a691", + "url": "https://github.com/gitapi/repos/symfony/Yaml/zipball/71340e996171474a53f3d29111d046be4ad8a0ff", + "reference": "71340e996171474a53f3d29111d046be4ad8a0ff", "shasum": "" }, "require": { - "php": ">=5.5.9" + "php": ">=5.3.9" + }, + "require-dev": { + "symfony/phpunit-bridge": "~2.7" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.0-dev" + "dev-master": "2.7-dev" } }, "autoload": { "psr-4": { "Symfony\\Component\\Yaml\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -2790,20 +2717,20 @@ ], "description": "Symfony Yaml Component", "homepage": "https://symfony.com", - "time": "2015-12-26 13:39:53" + "time": "2015-07-28 14:07:07" }, { "name": "twig/twig", - "version": "v1.23.1", + "version": "v1.21.1", "source": { "type": "git", "url": "https://github.com/twigphp/Twig.git", - "reference": "d9b6333ae8dd2c8e3fd256e127548def0bc614c6" + "reference": "ca8d3aa90b6a01c82e07909fe815d6b443e75a23" }, "dist": { "type": "zip", - "url": "https://github.com/gitapi/repos/twigphp/Twig/zipball/d9b6333ae8dd2c8e3fd256e127548def0bc614c6", - "reference": "d9b6333ae8dd2c8e3fd256e127548def0bc614c6", + "url": "https://github.com/gitapi/repos/twigphp/Twig/zipball/ca8d3aa90b6a01c82e07909fe815d6b443e75a23", + "reference": "ca8d3aa90b6a01c82e07909fe815d6b443e75a23", "shasum": "" }, "require": { @@ -2816,7 +2743,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.23-dev" + "dev-master": "1.21-dev" } }, "autoload": { @@ -2851,32 +2778,32 @@ "keywords": [ "templating" ], - "time": "2015-11-05 12:49:06" + "time": "2015-08-26 08:58:31" }, { "name": "zendframework/zend-cache", - "version": "2.5.3", + "version": "2.5.2", "source": { "type": "git", "url": "https://github.com/zendframework/zend-cache.git", - "reference": "7ff9d6b922ae29dbdc53f6a62b471fb6e58565df" + "reference": "325afc68d4381cf8b95288ebb9b1d38dc32ed579" }, "dist": { "type": "zip", - "url": "https://github.com/gitapi/repos/zendframework/zend-cache/zipball/7ff9d6b922ae29dbdc53f6a62b471fb6e58565df", - "reference": "7ff9d6b922ae29dbdc53f6a62b471fb6e58565df", + "url": "https://github.com/gitapi/repos/zendframework/zend-cache/zipball/325afc68d4381cf8b95288ebb9b1d38dc32ed579", + "reference": "325afc68d4381cf8b95288ebb9b1d38dc32ed579", "shasum": "" }, "require": { "php": ">=5.5", "zendframework/zend-eventmanager": "~2.5", + "zendframework/zend-serializer": "~2.5", "zendframework/zend-servicemanager": "~2.5", "zendframework/zend-stdlib": "~2.5" }, "require-dev": { "fabpot/php-cs-fixer": "1.7.*", "phpunit/phpunit": "~4.0", - "zendframework/zend-serializer": "~2.5", "zendframework/zend-session": "~2.5" }, "suggest": { @@ -2914,7 +2841,7 @@ "cache", "zf2" ], - "time": "2015-09-15 16:09:09" + "time": "2015-07-16 18:44:41" }, { "name": "zendframework/zend-config", @@ -2975,16 +2902,16 @@ }, { "name": "zendframework/zend-eventmanager", - "version": "2.6.1", + "version": "2.5.2", "source": { "type": "git", "url": "https://github.com/zendframework/zend-eventmanager.git", - "reference": "a03de810b99b0302059ab744c535d464b8dc4721" + "reference": "135af03d07fd048c322259aab6611d2be290475c" }, "dist": { "type": "zip", - "url": "https://github.com/gitapi/repos/zendframework/zend-eventmanager/zipball/a03de810b99b0302059ab744c535d464b8dc4721", - "reference": "a03de810b99b0302059ab744c535d464b8dc4721", + "url": "https://github.com/gitapi/repos/zendframework/zend-eventmanager/zipball/135af03d07fd048c322259aab6611d2be290475c", + "reference": "135af03d07fd048c322259aab6611d2be290475c", "shasum": "" }, "require": { @@ -2992,15 +2919,14 @@ "zendframework/zend-stdlib": "~2.5" }, "require-dev": { - "athletic/athletic": "dev-master", "fabpot/php-cs-fixer": "1.7.*", "phpunit/phpunit": "~4.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.6-dev", - "dev-develop": "3.0-dev" + "dev-master": "2.5-dev", + "dev-develop": "2.6-dev" } }, "autoload": { @@ -3017,7 +2943,7 @@ "eventmanager", "zf2" ], - "time": "2015-10-06 11:53:40" + "time": "2015-07-16 19:00:49" }, { "name": "zendframework/zend-filter", @@ -3077,62 +3003,6 @@ ], "time": "2015-06-03 15:32:01" }, - { - "name": "zendframework/zend-hydrator", - "version": "1.0.0", - "source": { - "type": "git", - "url": "https://github.com/zendframework/zend-hydrator.git", - "reference": "f3ed8b833355140350bbed98d8a7b8b66875903f" - }, - "dist": { - "type": "zip", - "url": "https://github.com/gitapi/repos/zendframework/zend-hydrator/zipball/f3ed8b833355140350bbed98d8a7b8b66875903f", - "reference": "f3ed8b833355140350bbed98d8a7b8b66875903f", - "shasum": "" - }, - "require": { - "php": ">=5.5", - "zendframework/zend-stdlib": "^2.5.1" - }, - "require-dev": { - "phpunit/phpunit": "~4.0", - "squizlabs/php_codesniffer": "^2.0@dev", - "zendframework/zend-eventmanager": "^2.5.1", - "zendframework/zend-filter": "^2.5.1", - "zendframework/zend-inputfilter": "^2.5.1", - "zendframework/zend-serializer": "^2.5.1", - "zendframework/zend-servicemanager": "^2.5.1" - }, - "suggest": { - "zendframework/zend-eventmanager": "^2.5.1, to support aggregate hydrator usage", - "zendframework/zend-filter": "^2.5.1, to support naming strategy hydrator usage", - "zendframework/zend-serializer": "^2.5.1, to use the SerializableStrategy", - "zendframework/zend-servicemanager": "^2.5.1, to support hydrator plugin manager usage" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0-dev", - "dev-develop": "1.1-dev" - } - }, - "autoload": { - "psr-4": { - "Zend\\Hydrator\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "homepage": "https://github.com/zendframework/zend-hydrator", - "keywords": [ - "hydrator", - "zf2" - ], - "time": "2015-09-17 14:06:43" - }, { "name": "zendframework/zend-i18n", "version": "2.5.1", @@ -3198,40 +3068,39 @@ }, { "name": "zendframework/zend-json", - "version": "2.6.0", + "version": "2.5.2", "source": { "type": "git", "url": "https://github.com/zendframework/zend-json.git", - "reference": "e2945611a98e1fefcaaf69969350a0bfa6a8d574" + "reference": "4a3add6505fd8618728239d8ce35f182dfbdac02" }, "dist": { "type": "zip", - "url": "https://github.com/gitapi/repos/zendframework/zend-json/zipball/e2945611a98e1fefcaaf69969350a0bfa6a8d574", - "reference": "e2945611a98e1fefcaaf69969350a0bfa6a8d574", + "url": "https://github.com/gitapi/repos/zendframework/zend-json/zipball/4a3add6505fd8618728239d8ce35f182dfbdac02", + "reference": "4a3add6505fd8618728239d8ce35f182dfbdac02", "shasum": "" }, "require": { - "php": ">=5.5" + "php": ">=5.5", + "zendframework/zend-stdlib": "~2.5" }, "require-dev": { "fabpot/php-cs-fixer": "1.7.*", "phpunit/phpunit": "~4.0", "zendframework/zend-http": "~2.5", "zendframework/zend-server": "~2.5", - "zendframework/zend-stdlib": "~2.5", "zendframework/zendxml": "~1.0" }, "suggest": { "zendframework/zend-http": "Zend\\Http component", "zendframework/zend-server": "Zend\\Server component", - "zendframework/zend-stdlib": "To use the cache for Zend\\Server", "zendframework/zendxml": "To support Zend\\Json\\Json::fromXml() usage" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.6-dev", - "dev-develop": "2.7-dev" + "dev-master": "2.5-dev", + "dev-develop": "2.6-dev" } }, "autoload": { @@ -3249,24 +3118,24 @@ "json", "zf2" ], - "time": "2015-11-18 13:59:33" + "time": "2015-08-05 14:45:17" }, { "name": "zendframework/zend-math", - "version": "2.5.2", + "version": "2.5.1", "source": { "type": "git", "url": "https://github.com/zendframework/zend-math.git", - "reference": "2648ee3cce39aa3876788c837e3b58f198dc8a78" + "reference": "9f02a1ac4d3374d3332c80f9215deec9c71558fc" }, "dist": { "type": "zip", - "url": "https://github.com/gitapi/repos/zendframework/zend-math/zipball/2648ee3cce39aa3876788c837e3b58f198dc8a78", - "reference": "2648ee3cce39aa3876788c837e3b58f198dc8a78", + "url": "https://github.com/gitapi/repos/zendframework/zend-math/zipball/9f02a1ac4d3374d3332c80f9215deec9c71558fc", + "reference": "9f02a1ac4d3374d3332c80f9215deec9c71558fc", "shasum": "" }, "require": { - "php": ">=5.5" + "php": ">=5.3.23" }, "require-dev": { "fabpot/php-cs-fixer": "1.7.*", @@ -3301,7 +3170,7 @@ "math", "zf2" ], - "time": "2015-12-17 15:31:58" + "time": "2015-06-03 15:32:02" }, { "name": "zendframework/zend-serializer", @@ -3408,24 +3277,22 @@ }, { "name": "zendframework/zend-stdlib", - "version": "2.7.4", + "version": "2.6.0", "source": { "type": "git", "url": "https://github.com/zendframework/zend-stdlib.git", - "reference": "cae029346a33663b998507f94962eb27de060683" + "reference": "a35758803fc9051ec1aff43989e679b6b451b1b4" }, "dist": { "type": "zip", - "url": "https://github.com/gitapi/repos/zendframework/zend-stdlib/zipball/cae029346a33663b998507f94962eb27de060683", - "reference": "cae029346a33663b998507f94962eb27de060683", + "url": "https://github.com/gitapi/repos/zendframework/zend-stdlib/zipball/a35758803fc9051ec1aff43989e679b6b451b1b4", + "reference": "a35758803fc9051ec1aff43989e679b6b451b1b4", "shasum": "" }, "require": { - "php": ">=5.5", - "zendframework/zend-hydrator": "~1.0" + "php": ">=5.5" }, "require-dev": { - "athletic/athletic": "~0.1", "fabpot/php-cs-fixer": "1.7.*", "phpunit/phpunit": "~4.0", "zendframework/zend-config": "~2.5", @@ -3444,8 +3311,8 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.7-dev", - "dev-develop": "2.8-dev" + "dev-master": "2.6-dev", + "dev-develop": "2.7-dev" } }, "autoload": { @@ -3462,7 +3329,7 @@ "stdlib", "zf2" ], - "time": "2015-10-15 15:57:32" + "time": "2015-07-21 17:08:05" }, { "name": "zetacomponents/base", diff --git a/libraries/vendor/symfony/yaml/Dumper.php b/libraries/vendor/symfony/yaml/Dumper.php index 05817f5d73063..21351a5c34fc9 100644 --- a/libraries/vendor/symfony/yaml/Dumper.php +++ b/libraries/vendor/symfony/yaml/Dumper.php @@ -28,7 +28,7 @@ class Dumper /** * Sets the indentation. * - * @param int $num The amount of spaces to use for indentation of nested nodes + * @param int $num The amount of spaces to use for indentation of nested nodes. */ public function setIndentation($num) { @@ -58,7 +58,7 @@ public function dump($input, $inline = 0, $indent = 0, $exceptionOnInvalidType = if ($inline <= 0 || !is_array($input) || empty($input)) { $output .= $prefix.Inline::dump($input, $exceptionOnInvalidType, $objectSupport); } else { - $isAHash = Inline::isHash($input); + $isAHash = array_keys($input) !== range(0, count($input) - 1); foreach ($input as $key => $value) { $willBeInlined = $inline - 1 <= 0 || !is_array($value) || empty($value); diff --git a/libraries/vendor/symfony/yaml/Escaper.php b/libraries/vendor/symfony/yaml/Escaper.php index a74f14dd9c17a..7bac8dde40ead 100644 --- a/libraries/vendor/symfony/yaml/Escaper.php +++ b/libraries/vendor/symfony/yaml/Escaper.php @@ -46,7 +46,7 @@ class Escaper * * @param string $value A PHP value * - * @return bool True if the value would require double quotes + * @return bool True if the value would require double quotes. */ public static function requiresDoubleQuoting($value) { @@ -70,7 +70,7 @@ public static function escapeWithDoubleQuotes($value) * * @param string $value A PHP value * - * @return bool True if the value would require single quotes + * @return bool True if the value would require single quotes. */ public static function requiresSingleQuoting($value) { diff --git a/libraries/vendor/symfony/yaml/Inline.php b/libraries/vendor/symfony/yaml/Inline.php index 717cbfd5ec8f2..bb2db360f7e35 100644 --- a/libraries/vendor/symfony/yaml/Inline.php +++ b/libraries/vendor/symfony/yaml/Inline.php @@ -157,28 +157,6 @@ public static function dump($value, $exceptionOnInvalidType = false, $objectSupp } } - /** - * Check if given array is hash or just normal indexed array. - * - * @internal - * - * @param array $value The PHP array to check - * - * @return bool true if value is hash array, false otherwise - */ - public static function isHash(array $value) - { - $expectedKey = 0; - - foreach ($value as $key => $val) { - if ($key !== $expectedKey++) { - return true; - } - } - - return false; - } - /** * Dumps a PHP array to a YAML string. * @@ -191,7 +169,11 @@ public static function isHash(array $value) private static function dumpArray($value, $exceptionOnInvalidType, $objectSupport) { // array - if ($value && !self::isHash($value)) { + $keys = array_keys($value); + $keysCount = count($keys); + if ((1 === $keysCount && '0' == $keys[0]) + || ($keysCount > 1 && array_reduce($keys, function ($v, $w) { return (int) $v + $w; }, 0) === $keysCount * ($keysCount - 1) / 2) + ) { $output = array(); foreach ($value as $val) { $output[] = self::dump($val, $exceptionOnInvalidType, $objectSupport); @@ -200,7 +182,7 @@ private static function dumpArray($value, $exceptionOnInvalidType, $objectSuppor return sprintf('[%s]', implode(', ', $output)); } - // hash + // mapping $output = array(); foreach ($value as $key => $val) { $output[] = sprintf('%s: %s', self::dump($key, $exceptionOnInvalidType, $objectSupport), self::dump($val, $exceptionOnInvalidType, $objectSupport)); diff --git a/libraries/vendor/symfony/yaml/Parser.php b/libraries/vendor/symfony/yaml/Parser.php index 7cdb964393bc2..41134e6b6c72e 100644 --- a/libraries/vendor/symfony/yaml/Parser.php +++ b/libraries/vendor/symfony/yaml/Parser.php @@ -25,26 +25,19 @@ class Parser const FOLDED_SCALAR_PATTERN = self::BLOCK_SCALAR_HEADER_PATTERN; private $offset = 0; - private $totalNumberOfLines; private $lines = array(); private $currentLineNb = -1; private $currentLine = ''; private $refs = array(); - private $skippedLineNumbers = array(); - private $locallySkippedLineNumbers = array(); /** * Constructor. * - * @param int $offset The offset of YAML document (used for line numbers in error messages) - * @param int|null $totalNumberOfLines The overall number of lines being parsed - * @param int[] $skippedLineNumbers Number of comment lines that have been skipped by the parser + * @param int $offset The offset of YAML document (used for line numbers in error messages) */ - public function __construct($offset = 0, $totalNumberOfLines = null, array $skippedLineNumbers = array()) + public function __construct($offset = 0) { $this->offset = $offset; - $this->totalNumberOfLines = $totalNumberOfLines; - $this->skippedLineNumbers = $skippedLineNumbers; } /** @@ -69,10 +62,6 @@ public function parse($value, $exceptionOnInvalidType = false, $objectSupport = $value = $this->cleanup($value); $this->lines = explode("\n", $value); - if (null === $this->totalNumberOfLines) { - $this->totalNumberOfLines = count($this->lines); - } - if (2 /* MB_OVERLOAD_STRING */ & (int) ini_get('mbstring.func_overload')) { $mbEncoding = mb_internal_encoding(); mb_internal_encoding('UTF-8'); @@ -94,7 +83,7 @@ public function parse($value, $exceptionOnInvalidType = false, $objectSupport = $isRef = $mergeNode = false; if (preg_match('#^\-((?P\s+)(?P.+?))?\s*$#u', $this->currentLine, $values)) { if ($context && 'mapping' == $context) { - throw new ParseException('You cannot define a sequence item when in a mapping', $this->getRealCurrentLineNb() + 1, $this->currentLine); + throw new ParseException('You cannot define a sequence item when in a mapping'); } $context = 'sequence'; @@ -105,18 +94,25 @@ public function parse($value, $exceptionOnInvalidType = false, $objectSupport = // array if (!isset($values['value']) || '' == trim($values['value'], ' ') || 0 === strpos(ltrim($values['value'], ' '), '#')) { - $data[] = $this->parseBlock($this->getRealCurrentLineNb() + 1, $this->getNextEmbedBlock(null, true), $exceptionOnInvalidType, $objectSupport, $objectForMap); + $c = $this->getRealCurrentLineNb() + 1; + $parser = new self($c); + $parser->refs = &$this->refs; + $data[] = $parser->parse($this->getNextEmbedBlock(null, true), $exceptionOnInvalidType, $objectSupport, $objectForMap); } else { if (isset($values['leadspaces']) && preg_match('#^(?P'.Inline::REGEX_QUOTED_STRING.'|[^ \'"\{\[].*?) *\:(\s+(?P.+?))?\s*$#u', $values['value'], $matches) ) { // this is a compact notation element, add to next block and parse + $c = $this->getRealCurrentLineNb(); + $parser = new self($c); + $parser->refs = &$this->refs; + $block = $values['value']; if ($this->isNextLineIndented()) { $block .= "\n".$this->getNextEmbedBlock($this->getCurrentLineIndentation() + strlen($values['leadspaces']) + 1); } - $data[] = $this->parseBlock($this->getRealCurrentLineNb(), $block, $exceptionOnInvalidType, $objectSupport, $objectForMap); + $data[] = $parser->parse($block, $exceptionOnInvalidType, $objectSupport, $objectForMap); } else { $data[] = $this->parseValue($values['value'], $exceptionOnInvalidType, $objectSupport, $objectForMap, $context); } @@ -126,7 +122,7 @@ public function parse($value, $exceptionOnInvalidType = false, $objectSupport = } } elseif (preg_match('#^(?P'.Inline::REGEX_QUOTED_STRING.'|[^ \'"\[\{].*?) *\:(\s+(?P.+?))?\s*$#u', $this->currentLine, $values) && (false === strpos($values['key'], ' #') || in_array($values['key'][0], array('"', "'")))) { if ($context && 'sequence' == $context) { - throw new ParseException('You cannot define a mapping item when in a sequence', $this->currentLineNb + 1, $this->currentLine); + throw new ParseException('You cannot define a mapping item when in a sequence'); } $context = 'mapping'; @@ -172,7 +168,10 @@ public function parse($value, $exceptionOnInvalidType = false, $objectSupport = } else { $value = $this->getNextEmbedBlock(); } - $parsed = $this->parseBlock($this->getRealCurrentLineNb() + 1, $value, $exceptionOnInvalidType, $objectSupport, $objectForMap); + $c = $this->getRealCurrentLineNb() + 1; + $parser = new self($c); + $parser->refs = &$this->refs; + $parsed = $parser->parse($value, $exceptionOnInvalidType, $objectSupport, $objectForMap); if (!is_array($parsed)) { throw new ParseException('YAML merge keys used with a scalar value instead of an array.', $this->getRealCurrentLineNb() + 1, $this->currentLine); @@ -220,7 +219,10 @@ public function parse($value, $exceptionOnInvalidType = false, $objectSupport = $data[$key] = null; } } else { - $value = $this->parseBlock($this->getRealCurrentLineNb() + 1, $this->getNextEmbedBlock(), $exceptionOnInvalidType, $objectSupport, $objectForMap); + $c = $this->getRealCurrentLineNb() + 1; + $parser = new self($c); + $parser->refs = &$this->refs; + $value = $parser->parse($this->getNextEmbedBlock(), $exceptionOnInvalidType, $objectSupport, $objectForMap); // Spec: Keys MUST be unique; first one wins. // But overwriting is allowed when a merge node is used in current block. if ($allowOverwrite || !isset($data[$key])) { @@ -241,7 +243,7 @@ public function parse($value, $exceptionOnInvalidType = false, $objectSupport = } else { // multiple documents are not supported if ('---' === $this->currentLine) { - throw new ParseException('Multiple documents are not supported.', $this->currentLineNb + 1, $this->currentLine); + throw new ParseException('Multiple documents are not supported.'); } // 1-liner optionally followed by newline(s) @@ -314,24 +316,6 @@ public function parse($value, $exceptionOnInvalidType = false, $objectSupport = return empty($data) ? null : $data; } - private function parseBlock($offset, $yaml, $exceptionOnInvalidType, $objectSupport, $objectForMap) - { - $skippedLineNumbers = $this->skippedLineNumbers; - - foreach ($this->locallySkippedLineNumbers as $lineNumber) { - if ($lineNumber < $offset) { - continue; - } - - $skippedLineNumbers[] = $lineNumber; - } - - $parser = new self($offset, $this->totalNumberOfLines, $skippedLineNumbers); - $parser->refs = &$this->refs; - - return $parser->parse($yaml, $exceptionOnInvalidType, $objectSupport, $objectForMap); - } - /** * Returns the current line number (takes the offset into account). * @@ -339,17 +323,7 @@ private function parseBlock($offset, $yaml, $exceptionOnInvalidType, $objectSupp */ private function getRealCurrentLineNb() { - $realCurrentLineNumber = $this->currentLineNb + $this->offset; - - foreach ($this->skippedLineNumbers as $skippedLineNumber) { - if ($skippedLineNumber > $realCurrentLineNumber) { - break; - } - - ++$realCurrentLineNumber; - } - - return $realCurrentLineNumber; + return $this->currentLineNb + $this->offset; } /** @@ -452,14 +426,6 @@ private function getNextEmbedBlock($indentation = null, $inSequence = false) // we ignore "comment" lines only when we are not inside a scalar block if (empty($blockScalarIndentations) && $this->isCurrentLineComment()) { - // remember ignored comment lines (they are used later in nested - // parser calls to determine real line numbers) - // - // CAUTION: beware to not populate the global property here as it - // will otherwise influence the getRealCurrentLineNb() call here - // for consecutive comment lines and subsequent embedded blocks - $this->locallySkippedLineNumbers[] = $this->getRealCurrentLineNb(); - continue; } @@ -495,18 +461,10 @@ private function moveToNextLine() /** * Moves the parser to the previous line. - * - * @return bool */ private function moveToPreviousLine() { - if ($this->currentLineNb < 1) { - return false; - } - $this->currentLine = $this->lines[--$this->currentLineNb]; - - return true; } /** @@ -532,7 +490,7 @@ private function parseValue($value, $exceptionOnInvalidType, $objectSupport, $ob } if (!array_key_exists($value, $this->refs)) { - throw new ParseException(sprintf('Reference "%s" does not exist.', $value), $this->currentLineNb + 1, $this->currentLine); + throw new ParseException(sprintf('Reference "%s" does not exist.', $value), $this->currentLine); } return $this->refs[$value]; @@ -627,8 +585,6 @@ private function parseBlockScalar($style, $chomping = '', $indentation = 0) if ($notEOF) { $blockLines[] = ''; $this->moveToPreviousLine(); - } elseif (!$notEOF && !$this->isCurrentLineLastLineInDocument()) { - $blockLines[] = ''; } // folded style @@ -735,11 +691,6 @@ private function isCurrentLineComment() return '' !== $ltrimmedLine && $ltrimmedLine[0] === '#'; } - private function isCurrentLineLastLineInDocument() - { - return ($this->offset + $this->currentLineNb) >= ($this->totalNumberOfLines - 1); - } - /** * Cleanups a YAML string to be parsed. * @@ -817,7 +768,7 @@ private function isNextLineUnIndentedCollection() */ private function isStringUnIndentedCollectionItem() { - return '-' === rtrim($this->currentLine) || 0 === strpos($this->currentLine, '- '); + return 0 === strpos($this->currentLine, '- '); } /** diff --git a/libraries/vendor/symfony/yaml/Unescaper.php b/libraries/vendor/symfony/yaml/Unescaper.php index 1e02cc9fd8086..bb3301615b4a2 100644 --- a/libraries/vendor/symfony/yaml/Unescaper.php +++ b/libraries/vendor/symfony/yaml/Unescaper.php @@ -39,9 +39,9 @@ class Unescaper /** * Unescapes a single quoted string. * - * @param string $value A single quoted string + * @param string $value A single quoted string. * - * @return string The unescaped string + * @return string The unescaped string. */ public function unescapeSingleQuotedString($value) { @@ -51,9 +51,9 @@ public function unescapeSingleQuotedString($value) /** * Unescapes a double quoted string. * - * @param string $value A double quoted string + * @param string $value A double quoted string. * - * @return string The unescaped string + * @return string The unescaped string. */ public function unescapeDoubleQuotedString($value) { diff --git a/libraries/vendor/symfony/yaml/Yaml.php b/libraries/vendor/symfony/yaml/Yaml.php index d5fbbeeccf7f5..374365492f3a2 100644 --- a/libraries/vendor/symfony/yaml/Yaml.php +++ b/libraries/vendor/symfony/yaml/Yaml.php @@ -80,7 +80,7 @@ public static function parse($input, $exceptionOnInvalidType = false, $objectSup * * @param array $array PHP array * @param int $inline The level where you switch to inline YAML - * @param int $indent The amount of spaces to use for indentation of nested nodes + * @param int $indent The amount of spaces to use for indentation of nested nodes. * @param bool $exceptionOnInvalidType true if an exception must be thrown on invalid types (a PHP resource or object), false otherwise * @param bool $objectSupport true if object support is enabled, false otherwise * diff --git a/media/plg_fields_gallery/css/fotorama.min.css b/media/plg_fields_gallery/css/fotorama.min.css new file mode 100644 index 0000000000000..8064fb729f216 --- /dev/null +++ b/media/plg_fields_gallery/css/fotorama.min.css @@ -0,0 +1,4 @@ +/*! + * Fotorama 4.6.4 | http://fotorama.io/license/ + */ +.fotorama__arr:focus:after,.fotorama__fullscreen-icon:focus:after,.fotorama__html,.fotorama__img,.fotorama__nav__frame:focus .fotorama__dot:after,.fotorama__nav__frame:focus .fotorama__thumb:after,.fotorama__stage__frame,.fotorama__stage__shaft,.fotorama__video iframe{position:absolute;width:100%;height:100%;top:0;right:0;left:0;bottom:0}.fotorama--fullscreen,.fotorama__img{max-width:99999px!important;max-height:99999px!important;min-width:0!important;min-height:0!important;border-radius:0!important;box-shadow:none!important;padding:0!important}.fotorama__wrap .fotorama__grab{cursor:move;cursor:-webkit-grab;cursor:-o-grab;cursor:-ms-grab;cursor:grab}.fotorama__grabbing *{cursor:move;cursor:-webkit-grabbing;cursor:-o-grabbing;cursor:-ms-grabbing;cursor:grabbing}.fotorama__spinner{position:absolute!important;top:50%!important;left:50%!important}.fotorama__wrap--css3 .fotorama__arr,.fotorama__wrap--css3 .fotorama__fullscreen-icon,.fotorama__wrap--css3 .fotorama__nav__shaft,.fotorama__wrap--css3 .fotorama__stage__shaft,.fotorama__wrap--css3 .fotorama__thumb-border,.fotorama__wrap--css3 .fotorama__video-close,.fotorama__wrap--css3 .fotorama__video-play{-webkit-transform:translate3d(0,0,0);transform:translate3d(0,0,0)}.fotorama__caption,.fotorama__nav:after,.fotorama__nav:before,.fotorama__stage:after,.fotorama__stage:before,.fotorama__wrap--css3 .fotorama__html,.fotorama__wrap--css3 .fotorama__nav,.fotorama__wrap--css3 .fotorama__spinner,.fotorama__wrap--css3 .fotorama__stage,.fotorama__wrap--css3 .fotorama__stage .fotorama__img,.fotorama__wrap--css3 .fotorama__stage__frame{-webkit-transform:translateZ(0);transform:translateZ(0)}.fotorama__arr:focus,.fotorama__fullscreen-icon:focus,.fotorama__nav__frame{outline:0}.fotorama__arr:focus:after,.fotorama__fullscreen-icon:focus:after,.fotorama__nav__frame:focus .fotorama__dot:after,.fotorama__nav__frame:focus .fotorama__thumb:after{content:'';border-radius:inherit;background-color:rgba(0,175,234,.5)}.fotorama__wrap--video .fotorama__stage,.fotorama__wrap--video .fotorama__stage__frame--video,.fotorama__wrap--video .fotorama__stage__frame--video .fotorama__html,.fotorama__wrap--video .fotorama__stage__frame--video .fotorama__img,.fotorama__wrap--video .fotorama__stage__shaft{-webkit-transform:none!important;transform:none!important}.fotorama__wrap--css3 .fotorama__nav__shaft,.fotorama__wrap--css3 .fotorama__stage__shaft,.fotorama__wrap--css3 .fotorama__thumb-border{transition-property:-webkit-transform,width;transition-property:transform,width;transition-timing-function:cubic-bezier(0.1,0,.25,1);transition-duration:0ms}.fotorama__arr,.fotorama__fullscreen-icon,.fotorama__no-select,.fotorama__video-close,.fotorama__video-play,.fotorama__wrap{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.fotorama__select{-webkit-user-select:text;-moz-user-select:text;-ms-user-select:text;user-select:text}.fotorama__nav,.fotorama__nav__frame{margin:auto;padding:0}.fotorama__caption__wrap,.fotorama__nav__frame,.fotorama__nav__shaft{-moz-box-orient:vertical;display:inline-block;vertical-align:middle;*display:inline;*zoom:1}.fotorama__nav__frame,.fotorama__thumb-border{box-sizing:content-box}.fotorama__caption__wrap{box-sizing:border-box}.fotorama--hidden,.fotorama__load{position:absolute;left:-99999px;top:-99999px;z-index:-1}.fotorama__arr,.fotorama__fullscreen-icon,.fotorama__nav,.fotorama__nav__frame,.fotorama__nav__shaft,.fotorama__stage__frame,.fotorama__stage__shaft,.fotorama__video-close,.fotorama__video-play{-webkit-tap-highlight-color:transparent}.fotorama__arr,.fotorama__fullscreen-icon,.fotorama__video-close,.fotorama__video-play{background:url(fotorama.png) no-repeat}@media (-webkit-min-device-pixel-ratio:1.5),(min-resolution:2dppx){.fotorama__arr,.fotorama__fullscreen-icon,.fotorama__video-close,.fotorama__video-play{background:url(fotorama@2x.png) 0 0/96px 160px no-repeat}}.fotorama__thumb{background-color:#7f7f7f;background-color:rgba(127,127,127,.2)}@media print{.fotorama__arr,.fotorama__fullscreen-icon,.fotorama__thumb-border,.fotorama__video-close,.fotorama__video-play{background:none!important}}.fotorama{min-width:1px;overflow:hidden}.fotorama:not(.fotorama--unobtrusive)>*:not(:first-child){display:none}.fullscreen{width:100%!important;height:100%!important;max-width:100%!important;max-height:100%!important;margin:0!important;padding:0!important;overflow:hidden!important;background:#000}.fotorama--fullscreen{position:absolute!important;top:0!important;left:0!important;right:0!important;bottom:0!important;float:none!important;z-index:2147483647!important;background:#000;width:100%!important;height:100%!important;margin:0!important}.fotorama--fullscreen .fotorama__nav,.fotorama--fullscreen .fotorama__stage{background:#000}.fotorama__wrap{-webkit-text-size-adjust:100%;position:relative;direction:ltr;z-index:0}.fotorama__wrap--rtl .fotorama__stage__frame{direction:rtl}.fotorama__nav,.fotorama__stage{overflow:hidden;position:relative;max-width:100%}.fotorama__wrap--pan-y{-ms-touch-action:pan-y}.fotorama__wrap .fotorama__pointer{cursor:pointer}.fotorama__wrap--slide .fotorama__stage__frame{opacity:1!important}.fotorama__stage__frame{overflow:hidden}.fotorama__stage__frame.fotorama__active{z-index:8}.fotorama__wrap--fade .fotorama__stage__frame{display:none}.fotorama__wrap--fade .fotorama__fade-front,.fotorama__wrap--fade .fotorama__fade-rear,.fotorama__wrap--fade .fotorama__stage__frame.fotorama__active{display:block;left:0;top:0}.fotorama__wrap--fade .fotorama__fade-front{z-index:8}.fotorama__wrap--fade .fotorama__fade-rear{z-index:7}.fotorama__wrap--fade .fotorama__fade-rear.fotorama__active{z-index:9}.fotorama__wrap--fade .fotorama__stage .fotorama__shadow{display:none}.fotorama__img{-ms-filter:"alpha(Opacity=0)";filter:alpha(opacity=0);opacity:0;border:none!important}.fotorama__error .fotorama__img,.fotorama__loaded .fotorama__img{-ms-filter:"alpha(Opacity=100)";filter:alpha(opacity=100);opacity:1}.fotorama--fullscreen .fotorama__loaded--full .fotorama__img,.fotorama__img--full{display:none}.fotorama--fullscreen .fotorama__loaded--full .fotorama__img--full{display:block}.fotorama__wrap--only-active .fotorama__nav,.fotorama__wrap--only-active .fotorama__stage{max-width:99999px!important}.fotorama__wrap--only-active .fotorama__stage__frame{visibility:hidden}.fotorama__wrap--only-active .fotorama__stage__frame.fotorama__active{visibility:visible}.fotorama__nav{font-size:0;line-height:0;text-align:center;display:none;white-space:nowrap;z-index:5}.fotorama__nav__shaft{position:relative;left:0;top:0;text-align:left}.fotorama__nav__frame{position:relative;cursor:pointer}.fotorama__nav--dots{display:block}.fotorama__nav--dots .fotorama__nav__frame{width:18px;height:30px}.fotorama__nav--dots .fotorama__nav__frame--thumb,.fotorama__nav--dots .fotorama__thumb-border{display:none}.fotorama__nav--thumbs{display:block}.fotorama__nav--thumbs .fotorama__nav__frame{padding-left:0!important}.fotorama__nav--thumbs .fotorama__nav__frame:last-child{padding-right:0!important}.fotorama__nav--thumbs .fotorama__nav__frame--dot{display:none}.fotorama__dot{display:block;width:4px;height:4px;position:relative;top:12px;left:6px;border-radius:6px;border:1px solid #7f7f7f}.fotorama__nav__frame:focus .fotorama__dot:after{padding:1px;top:-1px;left:-1px}.fotorama__nav__frame.fotorama__active .fotorama__dot{width:0;height:0;border-width:3px}.fotorama__nav__frame.fotorama__active .fotorama__dot:after{padding:3px;top:-3px;left:-3px}.fotorama__thumb{overflow:hidden;position:relative;width:100%;height:100%}.fotorama__nav__frame:focus .fotorama__thumb{z-index:2}.fotorama__thumb-border{position:absolute;z-index:9;top:0;left:0;border-style:solid;border-color:#00afea;background-image:linear-gradient(to bottom right,rgba(255,255,255,.25),rgba(64,64,64,.1))}.fotorama__caption{position:absolute;z-index:12;bottom:0;left:0;right:0;font-family:'Helvetica Neue',Arial,sans-serif;font-size:14px;line-height:1.5;color:#000}.fotorama__caption a{text-decoration:none;color:#000;border-bottom:1px solid;border-color:rgba(0,0,0,.5)}.fotorama__caption a:hover{color:#333;border-color:rgba(51,51,51,.5)}.fotorama__wrap--rtl .fotorama__caption{left:auto;right:0}.fotorama__wrap--no-captions .fotorama__caption,.fotorama__wrap--video .fotorama__caption{display:none}.fotorama__caption__wrap{background-color:#fff;background-color:rgba(255,255,255,.9);padding:5px 10px}@-webkit-keyframes spinner{0%{-webkit-transform:rotate(0);transform:rotate(0)}100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}@keyframes spinner{0%{-webkit-transform:rotate(0);transform:rotate(0)}100%{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}.fotorama__wrap--css3 .fotorama__spinner{-webkit-animation:spinner 24s infinite linear;animation:spinner 24s infinite linear}.fotorama__wrap--css3 .fotorama__html,.fotorama__wrap--css3 .fotorama__stage .fotorama__img{transition-property:opacity;transition-timing-function:linear;transition-duration:.3s}.fotorama__wrap--video .fotorama__stage__frame--video .fotorama__html,.fotorama__wrap--video .fotorama__stage__frame--video .fotorama__img{-ms-filter:"alpha(Opacity=0)";filter:alpha(opacity=0);opacity:0}.fotorama__select{cursor:auto}.fotorama__video{top:32px;right:0;bottom:0;left:0;position:absolute;z-index:10}@-moz-document url-prefix(){.fotorama__active{box-shadow:0 0 0 transparent}}.fotorama__arr,.fotorama__fullscreen-icon,.fotorama__video-close,.fotorama__video-play{position:absolute;z-index:11;cursor:pointer}.fotorama__arr{position:absolute;width:32px;height:32px;top:50%;margin-top:-16px}.fotorama__arr--prev{left:2px;background-position:0 0}.fotorama__arr--next{right:2px;background-position:-32px 0}.fotorama__arr--disabled{pointer-events:none;cursor:default;*display:none;opacity:.1}.fotorama__fullscreen-icon{width:32px;height:32px;top:2px;right:2px;background-position:0 -32px;z-index:20}.fotorama__arr:focus,.fotorama__fullscreen-icon:focus{border-radius:50%}.fotorama--fullscreen .fotorama__fullscreen-icon{background-position:-32px -32px}.fotorama__video-play{width:96px;height:96px;left:50%;top:50%;margin-left:-48px;margin-top:-48px;background-position:0 -64px;opacity:0}.fotorama__wrap--css2 .fotorama__video-play,.fotorama__wrap--video .fotorama__stage .fotorama__video-play{display:none}.fotorama__error .fotorama__video-play,.fotorama__loaded .fotorama__video-play,.fotorama__nav__frame .fotorama__video-play{opacity:1;display:block}.fotorama__nav__frame .fotorama__video-play{width:32px;height:32px;margin-left:-16px;margin-top:-16px;background-position:-64px -32px}.fotorama__video-close{width:32px;height:32px;top:0;right:0;background-position:-64px 0;z-index:20;opacity:0}.fotorama__wrap--css2 .fotorama__video-close{display:none}.fotorama__wrap--css3 .fotorama__video-close{-webkit-transform:translate3d(32px,-32px,0);transform:translate3d(32px,-32px,0)}.fotorama__wrap--video .fotorama__video-close{display:block;opacity:1}.fotorama__wrap--css3.fotorama__wrap--video .fotorama__video-close{-webkit-transform:translate3d(0,0,0);transform:translate3d(0,0,0)}.fotorama__wrap--no-controls.fotorama__wrap--toggle-arrows .fotorama__arr,.fotorama__wrap--no-controls.fotorama__wrap--toggle-arrows .fotorama__fullscreen-icon{opacity:0}.fotorama__wrap--no-controls.fotorama__wrap--toggle-arrows .fotorama__arr:focus,.fotorama__wrap--no-controls.fotorama__wrap--toggle-arrows .fotorama__fullscreen-icon:focus{opacity:1}.fotorama__wrap--video .fotorama__arr,.fotorama__wrap--video .fotorama__fullscreen-icon{opacity:0!important}.fotorama__wrap--css2.fotorama__wrap--no-controls.fotorama__wrap--toggle-arrows .fotorama__arr,.fotorama__wrap--css2.fotorama__wrap--no-controls.fotorama__wrap--toggle-arrows .fotorama__fullscreen-icon{display:none}.fotorama__wrap--css2.fotorama__wrap--no-controls.fotorama__wrap--toggle-arrows .fotorama__arr:focus,.fotorama__wrap--css2.fotorama__wrap--no-controls.fotorama__wrap--toggle-arrows .fotorama__fullscreen-icon:focus{display:block}.fotorama__wrap--css2.fotorama__wrap--video .fotorama__arr,.fotorama__wrap--css2.fotorama__wrap--video .fotorama__fullscreen-icon{display:none!important}.fotorama__wrap--css3.fotorama__wrap--no-controls.fotorama__wrap--slide.fotorama__wrap--toggle-arrows .fotorama__fullscreen-icon:not(:focus){-webkit-transform:translate3d(32px,-32px,0);transform:translate3d(32px,-32px,0)}.fotorama__wrap--css3.fotorama__wrap--no-controls.fotorama__wrap--slide.fotorama__wrap--toggle-arrows .fotorama__arr--prev:not(:focus){-webkit-transform:translate3d(-48px,0,0);transform:translate3d(-48px,0,0)}.fotorama__wrap--css3.fotorama__wrap--no-controls.fotorama__wrap--slide.fotorama__wrap--toggle-arrows .fotorama__arr--next:not(:focus){-webkit-transform:translate3d(48px,0,0);transform:translate3d(48px,0,0)}.fotorama__wrap--css3.fotorama__wrap--video .fotorama__fullscreen-icon{-webkit-transform:translate3d(32px,-32px,0)!important;transform:translate3d(32px,-32px,0)!important}.fotorama__wrap--css3.fotorama__wrap--video .fotorama__arr--prev{-webkit-transform:translate3d(-48px,0,0)!important;transform:translate3d(-48px,0,0)!important}.fotorama__wrap--css3.fotorama__wrap--video .fotorama__arr--next{-webkit-transform:translate3d(48px,0,0)!important;transform:translate3d(48px,0,0)!important}.fotorama__wrap--css3 .fotorama__arr:not(:focus),.fotorama__wrap--css3 .fotorama__fullscreen-icon:not(:focus),.fotorama__wrap--css3 .fotorama__video-close:not(:focus),.fotorama__wrap--css3 .fotorama__video-play:not(:focus){transition-property:-webkit-transform,opacity;transition-property:transform,opacity;transition-duration:.3s}.fotorama__nav:after,.fotorama__nav:before,.fotorama__stage:after,.fotorama__stage:before{content:"";display:block;position:absolute;text-decoration:none;top:0;bottom:0;width:10px;height:auto;z-index:10;pointer-events:none;background-repeat:no-repeat;background-size:1px 100%,5px 100%}.fotorama__nav:before,.fotorama__stage:before{background-image:linear-gradient(transparent,rgba(0,0,0,.2) 25%,rgba(0,0,0,.3) 75%,transparent),radial-gradient(farthest-side at 0 50%,rgba(0,0,0,.4),transparent);background-position:0 0,0 0;left:-10px}.fotorama__nav.fotorama__shadows--left:before,.fotorama__stage.fotorama__shadows--left:before{left:0}.fotorama__nav:after,.fotorama__stage:after{background-image:linear-gradient(transparent,rgba(0,0,0,.2) 25%,rgba(0,0,0,.3) 75%,transparent),radial-gradient(farthest-side at 100% 50%,rgba(0,0,0,.4),transparent);background-position:100% 0,100% 0;right:-10px}.fotorama__nav.fotorama__shadows--right:after,.fotorama__stage.fotorama__shadows--right:after{right:0}.fotorama--fullscreen .fotorama__nav:after,.fotorama--fullscreen .fotorama__nav:before,.fotorama--fullscreen .fotorama__stage:after,.fotorama--fullscreen .fotorama__stage:before,.fotorama__wrap--fade .fotorama__stage:after,.fotorama__wrap--fade .fotorama__stage:before,.fotorama__wrap--no-shadows .fotorama__nav:after,.fotorama__wrap--no-shadows .fotorama__nav:before,.fotorama__wrap--no-shadows .fotorama__stage:after,.fotorama__wrap--no-shadows .fotorama__stage:before{display:none} \ No newline at end of file diff --git a/media/plg_fields_gallery/css/fotorama.png b/media/plg_fields_gallery/css/fotorama.png new file mode 100644 index 0000000000000..b59419a93109b Binary files /dev/null and b/media/plg_fields_gallery/css/fotorama.png differ diff --git a/media/plg_fields_gallery/css/fotorama@2x.png b/media/plg_fields_gallery/css/fotorama@2x.png new file mode 100644 index 0000000000000..f94f06d028b89 Binary files /dev/null and b/media/plg_fields_gallery/css/fotorama@2x.png differ diff --git a/media/plg_fields_gallery/js/fotorama.min.js b/media/plg_fields_gallery/js/fotorama.min.js new file mode 100644 index 0000000000000..5081132a164ef --- /dev/null +++ b/media/plg_fields_gallery/js/fotorama.min.js @@ -0,0 +1,5 @@ +/*! + * Fotorama 4.6.4 | http://fotorama.io/license/ + */ +fotoramaVersion="4.6.4",function(a,b,c,d,e){"use strict";function f(a){var b="bez_"+d.makeArray(arguments).join("_").replace(".","p");if("function"!=typeof d.easing[b]){var c=function(a,b){var c=[null,null],d=[null,null],e=[null,null],f=function(f,g){return e[g]=3*a[g],d[g]=3*(b[g]-a[g])-e[g],c[g]=1-e[g]-d[g],f*(e[g]+f*(d[g]+f*c[g]))},g=function(a){return e[0]+a*(2*d[0]+3*c[0]*a)},h=function(a){for(var b,c=a,d=0;++d<14&&(b=f(c,0)-a,!(Math.abs(b)<.001));)c-=b/g(c);return c};return function(a){return f(h(a),1)}};d.easing[b]=function(b,d,e,f,g){return f*c([a[0],a[1]],[a[2],a[3]])(d/g)+e}}return b}function g(){}function h(a,b,c){return Math.max(isNaN(b)?-1/0:b,Math.min(isNaN(c)?1/0:c,a))}function i(a){return a.match(/ma/)&&a.match(/-?\d+(?!d)/g)[a.match(/3d/)?12:4]}function j(a){return Ic?+i(a.css("transform")):+a.css("left").replace("px","")}function k(a){var b={};return Ic?b.transform="translate3d("+a+"px,0,0)":b.left=a,b}function l(a){return{"transition-duration":a+"ms"}}function m(a,b){return isNaN(a)?b:a}function n(a,b){return m(+String(a).replace(b||"px",""))}function o(a){return/%$/.test(a)?n(a,"%"):e}function p(a,b){return m(o(a)/100*b,n(a))}function q(a){return(!isNaN(n(a))||!isNaN(n(a,"%")))&&a}function r(a,b,c,d){return(a-(d||0))*(b+(c||0))}function s(a,b,c,d){return-Math.round(a/(b+(c||0))-(d||0))}function t(a){var b=a.data();if(!b.tEnd){var c=a[0],d={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",msTransition:"MSTransitionEnd",transition:"transitionend"};T(c,d[uc.prefixed("transition")],function(a){b.tProp&&a.propertyName.match(b.tProp)&&b.onEndFn()}),b.tEnd=!0}}function u(a,b,c,d){var e,f=a.data();f&&(f.onEndFn=function(){e||(e=!0,clearTimeout(f.tT),c())},f.tProp=b,clearTimeout(f.tT),f.tT=setTimeout(function(){f.onEndFn()},1.5*d),t(a))}function v(a,b){if(a.length){var c=a.data();Ic?(a.css(l(0)),c.onEndFn=g,clearTimeout(c.tT)):a.stop();var d=w(b,function(){return j(a)});return a.css(k(d)),d}}function w(){for(var a,b=0,c=arguments.length;c>b&&(a=b?arguments[b]():arguments[b],"number"!=typeof a);b++);return a}function x(a,b){return Math.round(a+(b-a)/1.5)}function y(){return y.p=y.p||("https:"===c.protocol?"https://":"http://"),y.p}function z(a){var c=b.createElement("a");return c.href=a,c}function A(a,b){if("string"!=typeof a)return a;a=z(a);var c,d;if(a.host.match(/youtube\.com/)&&a.search){if(c=a.search.split("v=")[1]){var e=c.indexOf("&");-1!==e&&(c=c.substring(0,e)),d="youtube"}}else a.host.match(/youtube\.com|youtu\.be/)?(c=a.pathname.replace(/^\/(embed\/|v\/)?/,"").replace(/\/.*/,""),d="youtube"):a.host.match(/vimeo\.com/)&&(d="vimeo",c=a.pathname.replace(/^\/(video\/)?/,"").replace(/\/.*/,""));return c&&d||!b||(c=a.href,d="custom"),c?{id:c,type:d,s:a.search.replace(/^\?/,""),p:y()}:!1}function B(a,b,c){var e,f,g=a.video;return"youtube"===g.type?(f=y()+"img.youtube.com/vi/"+g.id+"/default.jpg",e=f.replace(/\/default.jpg$/,"/hqdefault.jpg"),a.thumbsReady=!0):"vimeo"===g.type?d.ajax({url:y()+"vimeo.com/api/v2/video/"+g.id+".json",dataType:"jsonp",success:function(d){a.thumbsReady=!0,C(b,{img:d[0].thumbnail_large,thumb:d[0].thumbnail_small},a.i,c)}}):a.thumbsReady=!0,{img:e,thumb:f}}function C(a,b,c,e){for(var f=0,g=a.length;g>f;f++){var h=a[f];if(h.i===c&&h.thumbsReady){var i={videoReady:!0};i[Xc]=i[Zc]=i[Yc]=!1,e.splice(f,1,d.extend({},h,i,b));break}}}function D(a){function b(a,b,e){var f=a.children("img").eq(0),g=a.attr("href"),h=a.attr("src"),i=f.attr("src"),j=b.video,k=e?A(g,j===!0):!1;k?g=!1:k=j,c(a,f,d.extend(b,{video:k,img:b.img||g||h||i,thumb:b.thumb||i||h||g}))}function c(a,b,c){var e=c.thumb&&c.img!==c.thumb,f=n(c.width||a.attr("width")),g=n(c.height||a.attr("height"));d.extend(c,{width:f,height:g,thumbratio:S(c.thumbratio||n(c.thumbwidth||b&&b.attr("width")||e||f)/n(c.thumbheight||b&&b.attr("height")||e||g))})}var e=[];return a.children().each(function(){var a=d(this),f=R(d.extend(a.data(),{id:a.attr("id")}));if(a.is("a, img"))b(a,f,!0);else{if(a.is(":empty"))return;c(a,null,d.extend(f,{html:this,_html:a.html()}))}e.push(f)}),e}function E(a){return 0===a.offsetWidth&&0===a.offsetHeight}function F(a){return!d.contains(b.documentElement,a)}function G(a,b,c,d){return G.i||(G.i=1,G.ii=[!0]),d=d||G.i,"undefined"==typeof G.ii[d]&&(G.ii[d]=!0),a()?b():G.ii[d]&&setTimeout(function(){G.ii[d]&&G(a,b,c,d)},c||100),G.i++}function H(a){c.replace(c.protocol+"//"+c.host+c.pathname.replace(/^\/?/,"/")+c.search+"#"+a)}function I(a,b,c,d){var e=a.data(),f=e.measures;if(f&&(!e.l||e.l.W!==f.width||e.l.H!==f.height||e.l.r!==f.ratio||e.l.w!==b.w||e.l.h!==b.h||e.l.m!==c||e.l.p!==d)){var g=f.width,i=f.height,j=b.w/b.h,k=f.ratio>=j,l="scaledown"===c,m="contain"===c,n="cover"===c,o=$(d);k&&(l||m)||!k&&n?(g=h(b.w,0,l?g:1/0),i=g/f.ratio):(k&&n||!k&&(l||m))&&(i=h(b.h,0,l?i:1/0),g=i*f.ratio),a.css({width:g,height:i,left:p(o.x,b.w-g),top:p(o.y,b.h-i)}),e.l={W:f.width,H:f.height,r:f.ratio,w:b.w,h:b.h,m:c,p:d}}return!0}function J(a,b){var c=a[0];c.styleSheet?c.styleSheet.cssText=b:a.html(b)}function K(a,b,c){return b===c?!1:b>=a?"left":a>=c?"right":"left right"}function L(a,b,c,d){if(!c)return!1;if(!isNaN(a))return a-(d?0:1);for(var e,f=0,g=b.length;g>f;f++){var h=b[f];if(h.id===a){e=f;break}}return e}function M(a,b,c){c=c||{},a.each(function(){var a,e=d(this),f=e.data();f.clickOn||(f.clickOn=!0,d.extend(cb(e,{onStart:function(b){a=b,(c.onStart||g).call(this,b)},onMove:c.onMove||g,onTouchEnd:c.onTouchEnd||g,onEnd:function(c){c.moved||b.call(this,a)}}),{noMove:!0}))})}function N(a,b){return'
'+(b||"")+"
"}function O(a){for(var b=a.length;b;){var c=Math.floor(Math.random()*b--),d=a[b];a[b]=a[c],a[c]=d}return a}function P(a){return"[object Array]"==Object.prototype.toString.call(a)&&d.map(a,function(a){return d.extend({},a)})}function Q(a,b,c){a.scrollLeft(b||0).scrollTop(c||0)}function R(a){if(a){var b={};return d.each(a,function(a,c){b[a.toLowerCase()]=c}),b}}function S(a){if(a){var b=+a;return isNaN(b)?(b=a.split("/"),+b[0]/+b[1]||e):b}}function T(a,b,c,d){b&&(a.addEventListener?a.addEventListener(b,c,!!d):a.attachEvent("on"+b,c))}function U(a){return!!a.getAttribute("disabled")}function V(a){return{tabindex:-1*a+"",disabled:a}}function W(a,b){T(a,"keyup",function(c){U(a)||13==c.keyCode&&b.call(a,c)})}function X(a,b){T(a,"focus",a.onfocusin=function(c){b.call(a,c)},!0)}function Y(a,b){a.preventDefault?a.preventDefault():a.returnValue=!1,b&&a.stopPropagation&&a.stopPropagation()}function Z(a){return a?">":"<"}function $(a){return a=(a+"").split(/\s+/),{x:q(a[0])||bd,y:q(a[1])||bd}}function _(a,b){var c=a.data(),e=Math.round(b.pos),f=function(){c.sliding=!1,(b.onEnd||g)()};"undefined"!=typeof b.overPos&&b.overPos!==b.pos&&(e=b.overPos,f=function(){_(a,d.extend({},b,{overPos:b.pos,time:Math.max(Qc,b.time/2)}))});var h=d.extend(k(e),b.width&&{width:b.width});c.sliding=!0,Ic?(a.css(d.extend(l(b.time),h)),b.time>10?u(a,"transform",f,b.time):f()):a.stop().animate(h,b.time,_c,f)}function ab(a,b,c,e,f,h){var i="undefined"!=typeof h;if(i||(f.push(arguments),Array.prototype.push.call(arguments,f.length),!(f.length>1))){a=a||d(a),b=b||d(b);var j=a[0],k=b[0],l="crossfade"===e.method,m=function(){if(!m.done){m.done=!0;var a=(i||f.shift())&&f.shift();a&&ab.apply(this,a),(e.onEnd||g)(!!a)}},n=e.time/(h||1);c.removeClass(Rb+" "+Qb),a.stop().addClass(Rb),b.stop().addClass(Qb),l&&k&&a.fadeTo(0,0),a.fadeTo(l?n:0,1,l&&m),b.fadeTo(n,0,m),j&&l||k||m()}}function bb(a){var b=(a.touches||[])[0]||a;a._x=b.pageX,a._y=b.clientY,a._now=d.now()}function cb(a,c){function e(a){return m=d(a.target),u.checked=p=q=s=!1,k||u.flow||a.touches&&a.touches.length>1||a.which>1||ed&&ed.type!==a.type&&gd||(p=c.select&&m.is(c.select,t))?p:(o="touchstart"===a.type,q=m.is("a, a *",t),n=u.control,r=u.noMove||u.noSwipe||n?16:u.snap?0:4,bb(a),l=ed=a,fd=a.type.replace(/down|start/,"move").replace(/Down/,"Move"),(c.onStart||g).call(t,a,{control:n,$target:m}),k=u.flow=!0,void((!o||u.go)&&Y(a)))}function f(a){if(a.touches&&a.touches.length>1||Nc&&!a.isPrimary||fd!==a.type||!k)return k&&h(),void(c.onTouchEnd||g)();bb(a);var b=Math.abs(a._x-l._x),d=Math.abs(a._y-l._y),e=b-d,f=(u.go||u.x||e>=0)&&!u.noSwipe,i=0>e;o&&!u.checked?(k=f)&&Y(a):(Y(a),(c.onMove||g).call(t,a,{touch:o})),!s&&Math.sqrt(Math.pow(b,2)+Math.pow(d,2))>r&&(s=!0),u.checked=u.checked||f||i}function h(a){(c.onTouchEnd||g)();var b=k;u.control=k=!1,b&&(u.flow=!1),!b||q&&!u.checked||(a&&Y(a),gd=!0,clearTimeout(hd),hd=setTimeout(function(){gd=!1},1e3),(c.onEnd||g).call(t,{moved:s,$target:m,control:n,touch:o,startEvent:l,aborted:!a||"MSPointerCancel"===a.type}))}function i(){u.flow||setTimeout(function(){u.flow=!0},10)}function j(){u.flow&&setTimeout(function(){u.flow=!1},Pc)}var k,l,m,n,o,p,q,r,s,t=a[0],u={};return Nc?(T(t,"MSPointerDown",e),T(b,"MSPointerMove",f),T(b,"MSPointerCancel",h),T(b,"MSPointerUp",h)):(T(t,"touchstart",e),T(t,"touchmove",f),T(t,"touchend",h),T(b,"touchstart",i),T(b,"touchend",j),T(b,"touchcancel",j),Ec.on("scroll",j),a.on("mousedown",e),Fc.on("mousemove",f).on("mouseup",h)),a.on("click","a",function(a){u.checked&&Y(a)}),u}function db(a,b){function c(c,d){A=!0,j=l=c._x,q=c._now,p=[[q,j]],m=n=D.noMove||d?0:v(a,(b.getPos||g)()),(b.onStart||g).call(B,c)}function e(a,b){s=D.min,t=D.max,u=D.snap,w=a.altKey,A=z=!1,y=b.control,y||C.sliding||c(a)}function f(d,e){D.noSwipe||(A||c(d),l=d._x,p.push([d._now,l]),n=m-(j-l),o=K(n,s,t),s>=n?n=x(n,s):n>=t&&(n=x(n,t)),D.noMove||(a.css(k(n)),z||(z=!0,e.touch||Nc||a.addClass(ec)),(b.onMove||g).call(B,d,{pos:n,edge:o})))}function i(e){if(!D.noSwipe||!e.moved){A||c(e.startEvent,!0),e.touch||Nc||a.removeClass(ec),r=d.now();for(var f,i,j,k,o,q,v,x,y,z=r-Pc,C=null,E=Qc,F=b.friction,G=p.length-1;G>=0;G--){if(f=p[G][0],i=Math.abs(f-z),null===C||j>i)C=f,k=p[G][1];else if(C===z||i>j)break;j=i}v=h(n,s,t);var H=k-l,I=H>=0,J=r-C,K=J>Pc,L=!K&&n!==m&&v===n;u&&(v=h(Math[L?I?"floor":"ceil":"round"](n/u)*u,s,t),s=t=v),L&&(u||v===n)&&(y=-(H/J),E*=h(Math.abs(y),b.timeLow,b.timeHigh),o=Math.round(n+y*E/F),u||(v=o),(!I&&o>t||I&&s>o)&&(q=I?s:t,x=o-q,u||(v=q),x=h(v+.03*x,q-50,q+50),E=Math.abs((n-x)/(y/F)))),E*=w?10:1,(b.onEnd||g).call(B,d.extend(e,{moved:e.moved||K&&u,pos:n,newPos:v,overPos:x,time:E}))}}var j,l,m,n,o,p,q,r,s,t,u,w,y,z,A,B=a[0],C=a.data(),D={};return D=d.extend(cb(b.$wrap,d.extend({},b,{onStart:e,onMove:f,onEnd:i})),D)}function eb(a,b){var c,e,f,h=a[0],i={prevent:{}};return T(h,Oc,function(a){var h=a.wheelDeltaY||-1*a.deltaY||0,j=a.wheelDeltaX||-1*a.deltaX||0,k=Math.abs(j)&&!Math.abs(h),l=Z(0>j),m=e===l,n=d.now(),o=Pc>n-f;e=l,f=n,k&&i.ok&&(!i.prevent[l]||c)&&(Y(a,!0),c&&m&&o||(b.shift&&(c=!0,clearTimeout(i.t),i.t=setTimeout(function(){c=!1},Rc)),(b.onEnd||g)(a,b.shift?l:j)))}),i}function fb(){d.each(d.Fotorama.instances,function(a,b){b.index=a})}function gb(a){d.Fotorama.instances.push(a),fb()}function hb(a){d.Fotorama.instances.splice(a.index,1),fb()}var ib="fotorama",jb="fullscreen",kb=ib+"__wrap",lb=kb+"--css2",mb=kb+"--css3",nb=kb+"--video",ob=kb+"--fade",pb=kb+"--slide",qb=kb+"--no-controls",rb=kb+"--no-shadows",sb=kb+"--pan-y",tb=kb+"--rtl",ub=kb+"--only-active",vb=kb+"--no-captions",wb=kb+"--toggle-arrows",xb=ib+"__stage",yb=xb+"__frame",zb=yb+"--video",Ab=xb+"__shaft",Bb=ib+"__grab",Cb=ib+"__pointer",Db=ib+"__arr",Eb=Db+"--disabled",Fb=Db+"--prev",Gb=Db+"--next",Hb=ib+"__nav",Ib=Hb+"-wrap",Jb=Hb+"__shaft",Kb=Hb+"--dots",Lb=Hb+"--thumbs",Mb=Hb+"__frame",Nb=Mb+"--dot",Ob=Mb+"--thumb",Pb=ib+"__fade",Qb=Pb+"-front",Rb=Pb+"-rear",Sb=ib+"__shadow",Tb=Sb+"s",Ub=Tb+"--left",Vb=Tb+"--right",Wb=ib+"__active",Xb=ib+"__select",Yb=ib+"--hidden",Zb=ib+"--fullscreen",$b=ib+"__fullscreen-icon",_b=ib+"__error",ac=ib+"__loading",bc=ib+"__loaded",cc=bc+"--full",dc=bc+"--img",ec=ib+"__grabbing",fc=ib+"__img",gc=fc+"--full",hc=ib+"__dot",ic=ib+"__thumb",jc=ic+"-border",kc=ib+"__html",lc=ib+"__video",mc=lc+"-play",nc=lc+"-close",oc=ib+"__caption",pc=ib+"__caption__wrap",qc=ib+"__spinner",rc='" tabindex="0" role="button',sc=d&&d.fn.jquery.split(".");if(!sc||sc[0]<1||1==sc[0]&&sc[1]<8)throw"Fotorama requires jQuery 1.8 or later and will not run without it.";var tc={},uc=function(a,b,c){function d(a){r.cssText=a}function e(a,b){return typeof a===b}function f(a,b){return!!~(""+a).indexOf(b)}function g(a,b){for(var d in a){var e=a[d];if(!f(e,"-")&&r[e]!==c)return"pfx"==b?e:!0}return!1}function h(a,b,d){for(var f in a){var g=b[a[f]];if(g!==c)return d===!1?a[f]:e(g,"function")?g.bind(d||b):g}return!1}function i(a,b,c){var d=a.charAt(0).toUpperCase()+a.slice(1),f=(a+" "+u.join(d+" ")+d).split(" ");return e(b,"string")||e(b,"undefined")?g(f,b):(f=(a+" "+v.join(d+" ")+d).split(" "),h(f,b,c))}var j,k,l,m="2.6.2",n={},o=b.documentElement,p="modernizr",q=b.createElement(p),r=q.style,s=({}.toString," -webkit- -moz- -o- -ms- ".split(" ")),t="Webkit Moz O ms",u=t.split(" "),v=t.toLowerCase().split(" "),w={},x=[],y=x.slice,z=function(a,c,d,e){var f,g,h,i,j=b.createElement("div"),k=b.body,l=k||b.createElement("body");if(parseInt(d,10))for(;d--;)h=b.createElement("div"),h.id=e?e[d]:p+(d+1),j.appendChild(h);return f=["­",'"].join(""),j.id=p,(k?j:l).innerHTML+=f,l.appendChild(j),k||(l.style.background="",l.style.overflow="hidden",i=o.style.overflow,o.style.overflow="hidden",o.appendChild(l)),g=c(j,a),k?j.parentNode.removeChild(j):(l.parentNode.removeChild(l),o.style.overflow=i),!!g},A={}.hasOwnProperty;l=e(A,"undefined")||e(A.call,"undefined")?function(a,b){return b in a&&e(a.constructor.prototype[b],"undefined")}:function(a,b){return A.call(a,b)},Function.prototype.bind||(Function.prototype.bind=function(a){var b=this;if("function"!=typeof b)throw new TypeError;var c=y.call(arguments,1),d=function(){if(this instanceof d){var e=function(){};e.prototype=b.prototype;var f=new e,g=b.apply(f,c.concat(y.call(arguments)));return Object(g)===g?g:f}return b.apply(a,c.concat(y.call(arguments)))};return d}),w.csstransforms3d=function(){var a=!!i("perspective");return a};for(var B in w)l(w,B)&&(k=B.toLowerCase(),n[k]=w[B](),x.push((n[k]?"":"no-")+k));return n.addTest=function(a,b){if("object"==typeof a)for(var d in a)l(a,d)&&n.addTest(d,a[d]);else{if(a=a.toLowerCase(),n[a]!==c)return n;b="function"==typeof b?b():b,"undefined"!=typeof enableClasses&&enableClasses&&(o.className+=" "+(b?"":"no-")+a),n[a]=b}return n},d(""),q=j=null,n._version=m,n._prefixes=s,n._domPrefixes=v,n._cssomPrefixes=u,n.testProp=function(a){return g([a])},n.testAllProps=i,n.testStyles=z,n.prefixed=function(a,b,c){return b?i(a,b,c):i(a,"pfx")},n}(a,b),vc={ok:!1,is:function(){return!1},request:function(){},cancel:function(){},event:"",prefix:""},wc="webkit moz o ms khtml".split(" ");if("undefined"!=typeof b.cancelFullScreen)vc.ok=!0;else for(var xc=0,yc=wc.length;yc>xc;xc++)if(vc.prefix=wc[xc],"undefined"!=typeof b[vc.prefix+"CancelFullScreen"]){vc.ok=!0;break}vc.ok&&(vc.event=vc.prefix+"fullscreenchange",vc.is=function(){switch(this.prefix){case"":return b.fullScreen;case"webkit":return b.webkitIsFullScreen;default:return b[this.prefix+"FullScreen"]}},vc.request=function(a){return""===this.prefix?a.requestFullScreen():a[this.prefix+"RequestFullScreen"]()},vc.cancel=function(){return""===this.prefix?b.cancelFullScreen():b[this.prefix+"CancelFullScreen"]()});var zc,Ac={lines:12,length:5,width:2,radius:7,corners:1,rotate:15,color:"rgba(128, 128, 128, .75)",hwaccel:!0},Bc={top:"auto",left:"auto",className:""};!function(a,b){zc=b()}(this,function(){function a(a,c){var d,e=b.createElement(a||"div");for(d in c)e[d]=c[d];return e}function c(a){for(var b=1,c=arguments.length;c>b;b++)a.appendChild(arguments[b]);return a}function d(a,b,c,d){var e=["opacity",b,~~(100*a),c,d].join("-"),f=.01+c/d*100,g=Math.max(1-(1-a)/b*(100-f),a),h=m.substring(0,m.indexOf("Animation")).toLowerCase(),i=h&&"-"+h+"-"||"";return o[e]||(p.insertRule("@"+i+"keyframes "+e+"{0%{opacity:"+g+"}"+f+"%{opacity:"+a+"}"+(f+.01)+"%{opacity:1}"+(f+b)%100+"%{opacity:"+a+"}100%{opacity:"+g+"}}",p.cssRules.length),o[e]=1),e}function f(a,b){var c,d,f=a.style;for(b=b.charAt(0).toUpperCase()+b.slice(1),d=0;d',c)}p.addRule(".spin-vml","behavior:url(#default#VML)"),k.prototype.lines=function(a,d){function e(){return g(b("group",{coordsize:k+" "+k,coordorigin:-i+" "+-i}),{width:k,height:k})}function f(a,f,h){c(m,c(g(e(),{rotation:360/d.lines*a+"deg",left:~~f}),c(g(b("roundrect",{arcsize:d.corners}),{width:i,height:d.width,left:d.radius,top:-d.width>>1,filter:h}),b("fill",{color:j(d.color,a),opacity:d.opacity}),b("stroke",{opacity:0}))))}var h,i=d.length+d.width,k=2*i,l=2*-(d.width+d.length)+"px",m=g(e(),{position:"absolute",top:l,left:l});if(d.shadow)for(h=1;h<=d.lines;h++)f(h,-2,"progid:DXImageTransform.Microsoft.Blur(pixelradius=2,makeshadow=1,shadowopacity=.3)");for(h=1;h<=d.lines;h++)f(h);return c(a,m)},k.prototype.opacity=function(a,b,c,d){var e=a.firstChild;d=d.shadow&&d.lines||0,e&&b+d>1):parseInt(f.left,10)+j)+"px",top:("auto"==f.top?d.y-c.y+(b.offsetHeight>>1):parseInt(f.top,10)+j)+"px"})),h.setAttribute("role","progressbar"),e.lines(h,e.opts),!m){var k,l=0,n=(f.lines-1)*(1-f.direction)/2,o=f.fps,p=o/f.speed,q=(1-f.opacity)/(p*f.trail/100),r=p/f.lines;!function s(){l++;for(var a=0;a>1)+"px"})}for(var h,i=0,k=(e.lines-1)*(1-e.direction)/2;i":36===a.keyCode&&g("home")?c="<<":35===a.keyCode&&g("end")&&(c=">>")),(b||c)&&Y(a),c&&ie.show({index:c,slow:a.altKey,user:!0})}),ie.index||Fc.off(b).on(b,"textarea, input, select",function(a){!Dc.hasClass(jb)&&a.stopPropagation()}),Ec.on(f,ie.resize)):(Fc.off(d),Ec.off(f))}function j(b){b!==j.f&&(b?(a.html("").addClass(ib+" "+ke).append(qe).before(oe).before(pe),gb(ie)):(qe.detach(),oe.detach(),pe.detach(),a.html(ne.urtext).removeClass(ke),hb(ie)),i(b),j.f=b)}function m(){yd=ie.data=yd||P(e.data)||D(a),zd=ie.size=yd.length,!xd.ok&&e.shuffle&&O(yd),f(),Je=y(Je),zd&&j(!0)}function o(){var a=2>zd&&!e.enableifsingleframe||Cd;Me.noMove=a||Sd,Me.noSwipe=a||!e.swipe,!Wd&&se.toggleClass(Bb,!e.click&&!Me.noMove&&!Me.noSwipe),Nc&&qe.toggleClass(sb,!Me.noSwipe)}function t(a){a===!0&&(a=""),e.autoplay=Math.max(+a||Sc,1.5*Vd)}function u(){function a(a,c){b[a?"add":"remove"].push(c)}ie.options=e=R(e),Sd="crossfade"===e.transition||"dissolve"===e.transition,Md=e.loop&&(zd>2||Sd&&(!Wd||"slide"!==Wd)),Vd=+e.transitionduration||Qc,Yd="rtl"===e.direction,Zd=d.extend({},e.keyboard&&dd,e.keyboard);var b={add:[],remove:[]};zd>1||e.enableifsingleframe?(Nd=e.nav,Pd="top"===e.navposition,b.remove.push(Xb),we.toggle(!!e.arrows)):(Nd=!1,we.hide()),Rb(),Bd=new zc(d.extend(Ac,e.spinner,Bc,{direction:Yd?-1:1})),Gc(),Hc(),e.autoplay&&t(e.autoplay),Td=n(e.thumbwidth)||Uc,Ud=n(e.thumbheight)||Uc,Ne.ok=Pe.ok=e.trackpad&&!Mc,o(),ed(e,[Le]),Od="thumbs"===Nd,Od?(lc(zd,"navThumb"),Ad=Be,he=Zc,J(oe,d.Fotorama.jst.style({w:Td,h:Ud,b:e.thumbborderwidth,m:e.thumbmargin,s:je,q:!Jc})),ye.addClass(Lb).removeClass(Kb)):"dots"===Nd?(lc(zd,"navDot"),Ad=Ae,he=Yc,ye.addClass(Kb).removeClass(Lb)):(Nd=!1,ye.removeClass(Lb+" "+Kb)),Nd&&(Pd?xe.insertBefore(re):xe.insertAfter(re),wc.nav=!1,wc(Ad,ze,"nav")),Qd=e.allowfullscreen,Qd?(De.prependTo(re),Rd=Kc&&"native"===Qd):(De.detach(),Rd=!1),a(Sd,ob),a(!Sd,pb),a(!e.captions,vb),a(Yd,tb),a("always"!==e.arrows,wb),Xd=e.shadows&&!Mc,a(!Xd,rb),qe.addClass(b.add.join(" ")).removeClass(b.remove.join(" ")),Ke=d.extend({},e)}function x(a){return 0>a?(zd+a%zd)%zd:a>=zd?a%zd:a}function y(a){return h(a,0,zd-1)}function z(a){return Md?x(a):y(a)}function E(a){return a>0||Md?a-1:!1}function U(a){return zd-1>a||Md?a+1:!1}function $(){Me.min=Md?-1/0:-r(zd-1,Le.w,e.margin,Fd),Me.max=Md?1/0:-r(0,Le.w,e.margin,Fd),Me.snap=Le.w+e.margin}function bb(){Oe.min=Math.min(0,Le.nw-ze.width()),Oe.max=0,ze.toggleClass(Bb,!(Oe.noMove=Oe.min===Oe.max))}function cb(a,b,c){if("number"==typeof a){a=new Array(a);var e=!0}return d.each(a,function(a,d){if(e&&(d=a),"number"==typeof d){var f=yd[x(d)];if(f){var g="$"+b+"Frame",h=f[g];c.call(this,a,d,f,h,g,h&&h.data())}}})}function fb(a,b,c,d){(!$d||"*"===$d&&d===Ld)&&(a=q(e.width)||q(a)||Vc,b=q(e.height)||q(b)||Wc,ie.resize({width:a,ratio:e.ratio||c||a/b},0,d!==Ld&&"*"))}function Pb(a,b,c,f,g,h){cb(a,b,function(a,i,j,k,l,m){function n(a){var b=x(i);fd(a,{index:b,src:w,frame:yd[b]})}function o(){t.remove(),d.Fotorama.cache[w]="error",j.html&&"stage"===b||!y||y===w?(!w||j.html||r?"stage"===b&&(k.trigger("f:load").removeClass(ac+" "+_b).addClass(bc),n("load"),fb()):(k.trigger("f:error").removeClass(ac).addClass(_b),n("error")),m.state="error",!(zd>1&&yd[i]===j)||j.html||j.deleted||j.video||r||(j.deleted=!0,ie.splice(i,1))):(j[v]=w=y,Pb([i],b,c,f,g,!0))}function p(){d.Fotorama.measures[w]=u.measures=d.Fotorama.measures[w]||{width:s.width,height:s.height,ratio:s.width/s.height},fb(u.measures.width,u.measures.height,u.measures.ratio,i),t.off("load error").addClass(fc+(r?" "+gc:"")).prependTo(k),I(t,(d.isFunction(c)?c():c)||Le,f||j.fit||e.fit,g||j.position||e.position),d.Fotorama.cache[w]=m.state="loaded",setTimeout(function(){k.trigger("f:load").removeClass(ac+" "+_b).addClass(bc+" "+(r?cc:dc)),"stage"===b?n("load"):(j.thumbratio===$c||!j.thumbratio&&e.thumbratio===$c)&&(j.thumbratio=u.measures.ratio,vd())},0)}function q(){var a=10;G(function(){return!fe||!a--&&!Mc},function(){p()})}if(k){var r=ie.fullScreen&&j.full&&j.full!==j.img&&!m.$full&&"stage"===b;if(!m.$img||h||r){var s=new Image,t=d(s),u=t.data();m[r?"$full":"$img"]=t;var v="stage"===b?r?"full":"img":"thumb",w=j[v],y=r?null:j["stage"===b?"thumb":"img"];if("navThumb"===b&&(k=m.$wrap),!w)return void o();d.Fotorama.cache[w]?!function z(){"error"===d.Fotorama.cache[w]?o():"loaded"===d.Fotorama.cache[w]?setTimeout(q,0):setTimeout(z,100)}():(d.Fotorama.cache[w]="*",t.on("load",q).on("error",o)),m.state="",s.src=w}}})}function Qb(a){Ie.append(Bd.spin().el).appendTo(a)}function Rb(){Ie.detach(),Bd&&Bd.stop()}function Sb(){var a=Dd[Xc];a&&!a.data().state&&(Qb(a),a.on("f:load f:error",function(){a.off("f:load f:error"),Rb()}))}function ec(a){W(a,sd),X(a,function(){setTimeout(function(){Q(ye)},0),Rc({time:Vd,guessIndex:d(this).data().eq,minMax:Oe})})}function lc(a,b){cb(a,b,function(a,c,e,f,g,h){if(!f){f=e[g]=qe[g].clone(),h=f.data(),h.data=e;var i=f[0];"stage"===b?(e.html&&d('
').append(e._html?d(e.html).removeAttr("id").html(e._html):e.html).appendTo(f),e.caption&&d(N(oc,N(pc,e.caption))).appendTo(f),e.video&&f.addClass(zb).append(Fe.clone()),X(i,function(){setTimeout(function(){Q(re)},0),pd({index:h.eq,user:!0})}),te=te.add(f)):"navDot"===b?(ec(i),Ae=Ae.add(f)):"navThumb"===b&&(ec(i),h.$wrap=f.children(":first"),Be=Be.add(f),e.video&&h.$wrap.append(Fe.clone()))}})}function sc(a,b,c,d){return a&&a.length&&I(a,b,c,d)}function tc(a){cb(a,"stage",function(a,b,c,f,g,h){if(f){var i=x(b),j=c.fit||e.fit,k=c.position||e.position;h.eq=i,Re[Xc][i]=f.css(d.extend({left:Sd?0:r(b,Le.w,e.margin,Fd)},Sd&&l(0))),F(f[0])&&(f.appendTo(se),md(c.$video)),sc(h.$img,Le,j,k),sc(h.$full,Le,j,k)}})}function uc(a,b){if("thumbs"===Nd&&!isNaN(a)){var c=-a,f=-a+Le.nw;Be.each(function(){var a=d(this),g=a.data(),h=g.eq,i=function(){return{h:Ud,w:g.w}},j=i(),k=yd[h]||{},l=k.thumbfit||e.thumbfit,m=k.thumbposition||e.thumbposition;j.w=g.w,g.l+g.wf||sc(g.$img,j,l,m)||b&&Pb([h],"navThumb",i,l,m)})}}function wc(a,b,c){if(!wc[c]){var f="nav"===c&&Od,g=0;b.append(a.filter(function(){for(var a,b=d(this),c=b.data(),e=0,f=yd.length;f>e;e++)if(c.data===yd[e]){a=!0,c.eq=e;break}return a||b.remove()&&!1}).sort(function(a,b){return d(a).data().eq-d(b).data().eq}).each(function(){if(f){var a=d(this),b=a.data(),c=Math.round(Ud*b.data.thumbratio)||Td;b.l=g,b.w=c,a.css({width:c}),g+=c+e.thumbmargin}})),wc[c]=!0}}function xc(a){return a-Se>Le.w/3}function yc(a){return!(Md||Je+a&&Je-zd+a||Cd)}function Gc(){var a=yc(0),b=yc(1);ue.toggleClass(Eb,a).attr(V(a)),ve.toggleClass(Eb,b).attr(V(b))}function Hc(){Ne.ok&&(Ne.prevent={"<":yc(0),">":yc(1)})}function Lc(a){var b,c,d=a.data();return Od?(b=d.l,c=d.w):(b=a.position().left,c=a.width()),{c:b+c/2,min:-b+10*e.thumbmargin,max:-b+Le.w-c-10*e.thumbmargin}}function Oc(a){var b=Dd[he].data();_(Ce,{time:1.2*a,pos:b.l,width:b.w-2*e.thumbborderwidth})}function Rc(a){var b=yd[a.guessIndex][he];if(b){var c=Oe.min!==Oe.max,d=a.minMax||c&&Lc(Dd[he]),e=c&&(a.keep&&Rc.l?Rc.l:h((a.coo||Le.nw/2)-Lc(b).c,d.min,d.max)),f=c&&h(e,Oe.min,Oe.max),g=1.1*a.time;_(ze,{time:g,pos:f||0,onEnd:function(){uc(f,!0)}}),ld(ye,K(f,Oe.min,Oe.max)),Rc.l=e}}function Tc(){_c(he),Qe[he].push(Dd[he].addClass(Wb))}function _c(a){for(var b=Qe[a];b.length;)b.shift().removeClass(Wb)}function bd(a){var b=Re[a];d.each(Ed,function(a,c){delete b[x(c)]}),d.each(b,function(a,c){delete b[a],c.detach()})}function cd(a){Fd=Gd=Je;var b=Dd[Xc];b&&(_c(Xc),Qe[Xc].push(b.addClass(Wb)),a||ie.show.onEnd(!0),v(se,0,!0),bd(Xc),tc(Ed),$(),bb())}function ed(a,b){a&&d.each(b,function(b,c){c&&d.extend(c,{width:a.width||c.width,height:a.height,minwidth:a.minwidth,maxwidth:a.maxwidth,minheight:a.minheight,maxheight:a.maxheight,ratio:S(a.ratio)})})}function fd(b,c){a.trigger(ib+":"+b,[ie,c])}function gd(){clearTimeout(hd.t),fe=1,e.stopautoplayontouch?ie.stopAutoplay():ce=!0}function hd(){fe&&(e.stopautoplayontouch||(id(),jd()),hd.t=setTimeout(function(){fe=0},Qc+Pc))}function id(){ce=!(!Cd&&!de)}function jd(){if(clearTimeout(jd.t),G.stop(jd.w),!e.autoplay||ce)return void(ie.autoplay&&(ie.autoplay=!1,fd("stopautoplay")));ie.autoplay||(ie.autoplay=!0,fd("startautoplay"));var a=Je,b=Dd[Xc].data();jd.w=G(function(){return b.state||a!==Je},function(){jd.t=setTimeout(function(){if(!ce&&a===Je){var b=Kd,c=yd[b][Xc].data();jd.w=G(function(){return c.state||b!==Kd},function(){ce||b!==Kd||ie.show(Md?Z(!Yd):Kd)})}},e.autoplay)})}function kd(){ie.fullScreen&&(ie.fullScreen=!1,Kc&&vc.cancel(le),Dc.removeClass(jb),Cc.removeClass(jb),a.removeClass(Zb).insertAfter(pe),Le=d.extend({},ee),md(Cd,!0,!0),rd("x",!1),ie.resize(),Pb(Ed,"stage"),Q(Ec,ae,_d),fd("fullscreenexit"))}function ld(a,b){Xd&&(a.removeClass(Ub+" "+Vb),b&&!Cd&&a.addClass(b.replace(/^|\s/g," "+Tb+"--")))}function md(a,b,c){b&&(qe.removeClass(nb),Cd=!1,o()),a&&a!==Cd&&(a.remove(),fd("unloadvideo")),c&&(id(),jd())}function nd(a){qe.toggleClass(qb,a)}function od(a){if(!Me.flow){var b=a?a.pageX:od.x,c=b&&!yc(xc(b))&&e.click;od.p!==c&&re.toggleClass(Cb,c)&&(od.p=c,od.x=b)}}function pd(a){clearTimeout(pd.t),e.clicktransition&&e.clicktransition!==e.transition?setTimeout(function(){var b=e.transition;ie.setOptions({transition:e.clicktransition}),Wd=b,pd.t=setTimeout(function(){ie.show(a)},10)},0):ie.show(a)}function qd(a,b){var c=a.target,f=d(c);f.hasClass(mc)?ie.playVideo():c===Ee?ie.toggleFullScreen():Cd?c===He&&md(Cd,!0,!0):b?nd():e.click&&pd({index:a.shiftKey||Z(xc(a._x)),slow:a.altKey,user:!0})}function rd(a,b){Me[a]=Oe[a]=b}function sd(a){var b=d(this).data().eq;pd({index:b,slow:a.altKey,user:!0,coo:a._x-ye.offset().left})}function td(a){pd({index:we.index(this)?">":"<",slow:a.altKey,user:!0})}function ud(a){X(a,function(){setTimeout(function(){Q(re)},0),nd(!1)})}function vd(){if(m(),u(),!vd.i){vd.i=!0;var a=e.startindex;(a||e.hash&&c.hash)&&(Ld=L(a||c.hash.replace(/^#/,""),yd,0===ie.index||a,a)),Je=Fd=Gd=Hd=Ld=z(Ld)||0}if(zd){if(wd())return;Cd&&md(Cd,!0),Ed=[],bd(Xc),vd.ok=!0,ie.show({index:Je,time:0}),ie.resize()}else ie.destroy()}function wd(){return!wd.f===Yd?(wd.f=Yd,Je=zd-1-Je,ie.reverse(),!0):void 0}function xd(){xd.ok||(xd.ok=!0,fd("ready"))}Cc=d("html"),Dc=d("body");var yd,zd,Ad,Bd,Cd,Dd,Ed,Fd,Gd,Hd,Id,Jd,Kd,Ld,Md,Nd,Od,Pd,Qd,Rd,Sd,Td,Ud,Vd,Wd,Xd,Yd,Zd,$d,_d,ae,be,ce,de,ee,fe,ge,he,ie=this,je=d.now(),ke=ib+je,le=a[0],me=1,ne=a.data(),oe=d(""),pe=d(N(Yb)),qe=d(N(kb)),re=d(N(xb)).appendTo(qe),se=(re[0],d(N(Ab)).appendTo(re)),te=d(),ue=d(N(Db+" "+Fb+rc)),ve=d(N(Db+" "+Gb+rc)),we=ue.add(ve).appendTo(re),xe=d(N(Ib)),ye=d(N(Hb)).appendTo(xe),ze=d(N(Jb)).appendTo(ye),Ae=d(),Be=d(),Ce=(se.data(),ze.data(),d(N(jc)).appendTo(ze)),De=d(N($b+rc)),Ee=De[0],Fe=d(N(mc)),Ge=d(N(nc)).appendTo(re),He=Ge[0],Ie=d(N(qc)),Je=!1,Ke={},Le={},Me={},Ne={},Oe={},Pe={},Qe={},Re={},Se=0,Te=[]; +qe[Xc]=d(N(yb)),qe[Zc]=d(N(Mb+" "+Ob+rc,N(ic))),qe[Yc]=d(N(Mb+" "+Nb+rc,N(hc))),Qe[Xc]=[],Qe[Zc]=[],Qe[Yc]=[],Re[Xc]={},qe.addClass(Ic?mb:lb).toggleClass(qb,!e.controlsonstart),ne.fotorama=this,ie.startAutoplay=function(a){return ie.autoplay?this:(ce=de=!1,t(a||e.autoplay),jd(),this)},ie.stopAutoplay=function(){return ie.autoplay&&(ce=de=!0,jd()),this},ie.show=function(a){var b;"object"!=typeof a?(b=a,a={}):b=a.index,b=">"===b?Gd+1:"<"===b?Gd-1:"<<"===b?0:">>"===b?zd-1:b,b=isNaN(b)?L(b,yd,!0):b,b="undefined"==typeof b?Je||0:b,ie.activeIndex=Je=z(b),Id=E(Je),Jd=U(Je),Kd=x(Je+(Yd?-1:1)),Ed=[Je,Id,Jd],Gd=Md?b:Je;var c=Math.abs(Hd-Gd),d=w(a.time,function(){return Math.min(Vd*(1+(c-1)/12),2*Vd)}),f=a.overPos;a.slow&&(d*=10);var g=Dd;ie.activeFrame=Dd=yd[Je];var i=g===Dd&&!a.user;md(Cd,Dd.i!==yd[x(Fd)].i),lc(Ed,"stage"),tc(Mc?[Gd]:[Gd,E(Gd),U(Gd)]),rd("go",!0),i||fd("show",{user:a.user,time:d}),ce=!0;var j=ie.show.onEnd=function(b){if(!j.ok){if(j.ok=!0,b||cd(!0),i||fd("showend",{user:a.user}),!b&&Wd&&Wd!==e.transition)return ie.setOptions({transition:Wd}),void(Wd=!1);Sb(),Pb(Ed,"stage"),rd("go",!1),Hc(),od(),id(),jd()}};if(Sd){var k=Dd[Xc],l=Je!==Hd?yd[Hd][Xc]:null;ab(k,l,te,{time:d,method:e.transition,onEnd:j},Te)}else _(se,{pos:-r(Gd,Le.w,e.margin,Fd),overPos:f,time:d,onEnd:j});if(Gc(),Nd){Tc();var m=y(Je+h(Gd-Hd,-1,1));Rc({time:d,coo:m!==Je&&a.coo,guessIndex:"undefined"!=typeof a.coo?m:Je,keep:i}),Od&&Oc(d)}return be="undefined"!=typeof Hd&&Hd!==Je,Hd=Je,e.hash&&be&&!ie.eq&&H(Dd.id||Je+1),this},ie.requestFullScreen=function(){return Qd&&!ie.fullScreen&&(_d=Ec.scrollTop(),ae=Ec.scrollLeft(),Q(Ec),rd("x",!0),ee=d.extend({},Le),a.addClass(Zb).appendTo(Dc.addClass(jb)),Cc.addClass(jb),md(Cd,!0,!0),ie.fullScreen=!0,Rd&&vc.request(le),ie.resize(),Pb(Ed,"stage"),Sb(),fd("fullscreenenter")),this},ie.cancelFullScreen=function(){return Rd&&vc.is()?vc.cancel(b):kd(),this},ie.toggleFullScreen=function(){return ie[(ie.fullScreen?"cancel":"request")+"FullScreen"]()},T(b,vc.event,function(){!yd||vc.is()||Cd||kd()}),ie.resize=function(a){if(!yd)return this;var b=arguments[1]||0,c=arguments[2];ed(ie.fullScreen?{width:"100%",maxwidth:null,minwidth:null,height:"100%",maxheight:null,minheight:null}:R(a),[Le,c||ie.fullScreen||e]);var d=Le.width,f=Le.height,g=Le.ratio,i=Ec.height()-(Nd?ye.height():0);return q(d)&&(qe.addClass(ub).css({width:d,minWidth:Le.minwidth||0,maxWidth:Le.maxwidth||ad}),d=Le.W=Le.w=qe.width(),Le.nw=Nd&&p(e.navwidth,d)||d,e.glimpse&&(Le.w-=Math.round(2*(p(e.glimpse,d)||0))),se.css({width:Le.w,marginLeft:(Le.W-Le.w)/2}),f=p(f,i),f=f||g&&d/g,f&&(d=Math.round(d),f=Le.h=Math.round(h(f,p(Le.minheight,i),p(Le.maxheight,i))),re.stop().animate({width:d,height:f},b,function(){qe.removeClass(ub)}),cd(),Nd&&(ye.stop().animate({width:Le.nw},b),Rc({guessIndex:Je,time:b,keep:!0}),Od&&wc.nav&&Oc(b)),$d=c||!0,xd())),Se=re.offset().left,this},ie.setOptions=function(a){return d.extend(e,a),vd(),this},ie.shuffle=function(){return yd&&O(yd)&&vd(),this},ie.destroy=function(){return ie.cancelFullScreen(),ie.stopAutoplay(),yd=ie.data=null,j(),Ed=[],bd(Xc),vd.ok=!1,this},ie.playVideo=function(){var a=Dd,b=a.video,c=Je;return"object"==typeof b&&a.videoReady&&(Rd&&ie.fullScreen&&ie.cancelFullScreen(),G(function(){return!vc.is()||c!==Je},function(){c===Je&&(a.$video=a.$video||d(d.Fotorama.jst.video(b)),a.$video.appendTo(a[Xc]),qe.addClass(nb),Cd=a.$video,o(),we.blur(),De.blur(),fd("loadvideo"))})),this},ie.stopVideo=function(){return md(Cd,!0,!0),this},re.on("mousemove",od),Me=db(se,{onStart:gd,onMove:function(a,b){ld(re,b.edge)},onTouchEnd:hd,onEnd:function(a){ld(re);var b=(Nc&&!ge||a.touch)&&e.arrows&&"always"!==e.arrows;if(a.moved||b&&a.pos!==a.newPos&&!a.control){var c=s(a.newPos,Le.w,e.margin,Fd);ie.show({index:c,time:Sd?Vd:a.time,overPos:a.overPos,user:!0})}else a.aborted||a.control||qd(a.startEvent,b)},timeLow:1,timeHigh:1,friction:2,select:"."+Xb+", ."+Xb+" *",$wrap:re}),Oe=db(ze,{onStart:gd,onMove:function(a,b){ld(ye,b.edge)},onTouchEnd:hd,onEnd:function(a){function b(){Rc.l=a.newPos,id(),jd(),uc(a.newPos,!0)}if(a.moved)a.pos!==a.newPos?(ce=!0,_(ze,{time:a.time,pos:a.newPos,overPos:a.overPos,onEnd:b}),uc(a.newPos),Xd&&ld(ye,K(a.newPos,Oe.min,Oe.max))):b();else{var c=a.$target.closest("."+Mb,ze)[0];c&&sd.call(c,a.startEvent)}},timeLow:.5,timeHigh:2,friction:5,$wrap:ye}),Ne=eb(re,{shift:!0,onEnd:function(a,b){gd(),hd(),ie.show({index:b,slow:a.altKey})}}),Pe=eb(ye,{onEnd:function(a,b){gd(),hd();var c=v(ze)+.25*b;ze.css(k(h(c,Oe.min,Oe.max))),Xd&&ld(ye,K(c,Oe.min,Oe.max)),Pe.prevent={"<":c>=Oe.max,">":c<=Oe.min},clearTimeout(Pe.t),Pe.t=setTimeout(function(){Rc.l=c,uc(c,!0)},Pc),uc(c)}}),qe.hover(function(){setTimeout(function(){fe||nd(!(ge=!0))},0)},function(){ge&&nd(!(ge=!1))}),M(we,function(a){Y(a),td.call(this,a)},{onStart:function(){gd(),Me.control=!0},onTouchEnd:hd}),we.each(function(){W(this,function(a){td.call(this,a)}),ud(this)}),W(Ee,ie.toggleFullScreen),ud(Ee),d.each("load push pop shift unshift reverse sort splice".split(" "),function(a,b){ie[b]=function(){return yd=yd||[],"load"!==b?Array.prototype[b].apply(yd,arguments):arguments[0]&&"object"==typeof arguments[0]&&arguments[0].length&&(yd=P(arguments[0])),vd(),ie}}),vd()},d.fn.fotorama=function(b){return this.each(function(){var c=this,e=d(this),f=e.data(),g=f.fotorama;g?g.setOptions(b,!0):G(function(){return!E(c)},function(){f.urtext=e.html(),new d.Fotorama(e,d.extend({},cd,a.fotoramaDefaults,b,f))})})},d.Fotorama.instances=[],d.Fotorama.cache={},d.Fotorama.measures={},d=d||{},d.Fotorama=d.Fotorama||{},d.Fotorama.jst=d.Fotorama.jst||{},d.Fotorama.jst.style=function(a){{var b,c="";tc.escape}return c+=".fotorama"+(null==(b=a.s)?"":b)+" .fotorama__nav--thumbs .fotorama__nav__frame{\npadding:"+(null==(b=a.m)?"":b)+"px;\nheight:"+(null==(b=a.h)?"":b)+"px}\n.fotorama"+(null==(b=a.s)?"":b)+" .fotorama__thumb-border{\nheight:"+(null==(b=a.h-a.b*(a.q?0:2))?"":b)+"px;\nborder-width:"+(null==(b=a.b)?"":b)+"px;\nmargin-top:"+(null==(b=a.m)?"":b)+"px}"},d.Fotorama.jst.video=function(a){function b(){c+=d.call(arguments,"")}var c="",d=(tc.escape,Array.prototype.join);return c+='
\n'},d(function(){d("."+ib+':not([data-auto="false"])').fotorama()})}(window,document,location,"undefined"!=typeof jQuery&&jQuery); \ No newline at end of file diff --git a/plugins/editors/codemirror/fonts.php b/plugins/editors/codemirror/fonts.php index b6e42cea179a2..f3ac0043e30c1 100644 --- a/plugins/editors/codemirror/fonts.php +++ b/plugins/editors/codemirror/fonts.php @@ -10,8 +10,6 @@ // No direct access defined('_JEXEC') or die; -JFormHelper::loadFieldClass('list'); - /** * Supports an HTML select list of fonts * @@ -19,7 +17,7 @@ * @subpackage Editors.codemirror * @since 3.4 */ -class JFormFieldFonts extends JFormFieldList +class JFormFieldFonts extends JFormAbstractlist { /** * The form field type. diff --git a/plugins/editors/tinymce/field/skins.php b/plugins/editors/tinymce/field/skins.php index 1704863f2e62a..e1f6ceff3c3a9 100644 --- a/plugins/editors/tinymce/field/skins.php +++ b/plugins/editors/tinymce/field/skins.php @@ -10,8 +10,6 @@ defined('_JEXEC') or die; jimport('joomla.form.helper'); -JFormHelper::loadFieldClass('list'); - /** * Form Field class for the TinyMCE editor. * Generates the list of options for available skins. @@ -20,7 +18,7 @@ * @subpackage Editors.tinymce * @since 3.4 */ -class JFormFieldSkins extends JFormFieldList +class JFormFieldSkins extends JFormAbstractlist { protected $type = 'skins'; diff --git a/plugins/fields/gallery/fields/gallery.php b/plugins/fields/gallery/fields/gallery.php new file mode 100644 index 0000000000000..ae29583e3cf5f --- /dev/null +++ b/plugins/fields/gallery/fields/gallery.php @@ -0,0 +1,65 @@ +required) + { + $options[] = JHtml::_('select.option', '', JText::alt('JOPTION_DO_NOT_USE', preg_replace('/[^a-zA-Z0-9_\-]/', '_', $this->fieldname))); + } + + $path = (string) $this->element['directory']; + + if (! is_dir($path)) + { + $path = JPATH_ROOT . '/' . $path; + } + + // Get a list of folders in the search path with the given filter. + $folders = JFolder::folders($path, '.', true, true); + + // Build the options list from the list of folders. + if (is_array($folders)) + { + foreach ($folders as $folder) + { + $relativePath = str_replace($path . '/', '', $folder); + + $options[] = JHtml::_('select.option', $relativePath, $relativePath); + } + } + + // Merge any additional options in the XML definition. + return array_merge(parent::getOptions(), $options); + } +} diff --git a/plugins/fields/gallery/gallery.php b/plugins/fields/gallery/gallery.php new file mode 100644 index 0000000000000..acc93e3e7f355 --- /dev/null +++ b/plugins/fields/gallery/gallery.php @@ -0,0 +1,19 @@ + + + plg_fields_gallery + Joomla! Project + March 2016 + Copyright (C) 2005 - 2016 Open Source Matters. All rights reserved. + GNU General Public License version 2 or later; see LICENSE.txt + admin@joomla.org + www.joomla.org + __DEPLOY_VERSION__ + PLG_FIELDS_GALLERY_XML_DESCRIPTION + + gallery.php + + + en-GB.plg_fields_gallery.ini + en-GB.plg_fields_gallery.sys.ini + + diff --git a/plugins/fields/gallery/layouts/field/prepare/gallery.php b/plugins/fields/gallery/layouts/field/prepare/gallery.php new file mode 100644 index 0000000000000..be3d45835229d --- /dev/null +++ b/plugins/fields/gallery/layouts/field/prepare/gallery.php @@ -0,0 +1,171 @@ +value; + +if (!$value) +{ + return; +} + +// Loading the language +JFactory::getLanguage()->load('plg_fields_gallery', JPATH_ADMINISTRATOR); + +JHtml::_('jquery.framework'); + +$doc = JFactory::getDocument(); + +// Adding the javascript gallery library +$doc->addScript('media/plg_fields_gallery/js/fotorama.min.js'); +$doc->addStyleSheet('media/plg_fields_gallery/css/fotorama.min.css'); + +$value = (array) $value; + +$thumbWidth = $field->fieldparams->get('thumbnail_width', '64'); +$maxImageWidth = $field->fieldparams->get('max_width', 0); +$maxImageHeight = $field->fieldparams->get('max_height', 0); + +// Main container +$buffer = '
'; + +foreach ($value as $path) +{ + // Only process valid paths + if (!$path) + { + continue; + } + + // The root folder + $root = $field->fieldparams->get('directory', 'images'); + + foreach (JFolder::files(JPATH_ROOT . '/' . $root . '/' . $path, '.', $field->fieldparams->get('recursive', '1'), true) as $file) + { + // Skip none image files + if (!in_array( + strtolower(JFile::getExt($file)), + array( + 'jpg', + 'png', + 'bmp', + 'gif', + ) + ) + ) + { + continue; + } + + // Getting the properties of the image + $properties = JImage::getImageFileProperties($file); + + // Relative path + $localPath = str_replace(JPATH_ROOT . '/' . $root . '/', '', $file); + $webImagePath = $root . '/' . $localPath; + + if (($maxImageWidth && $properties->width > $maxImageWidth) || ($maxImageHeight && $properties->height > $maxImageHeight)) + { + $resizeWidth = $maxImageWidth ? $maxImageWidth : ''; + $resizeHeight = $maxImageHeight ? $maxImageHeight : ''; + + if ($resizeWidth && $resizeHeight) + { + $resizeWidth .= 'x'; + } + + $resize = JPATH_CACHE . '/plg_fields_gallery/gallery/' . $field->id . '/' . $resizeWidth . $resizeHeight . '/' . $localPath; + + if (!JFile::exists($resize)) + { + // Creating the folder structure for the max sized image + if (!JFolder::exists(dirname($resize))) + { + JFolder::create(dirname($resize)); + } + + try + { + // Creating the max sized image for the image + $imgObject = new JImage($file); + + $imgObject = $imgObject->resize( + $properties->width > $maxImageWidth ? $maxImageWidth : 0, + $properties->height > $maxImageHeight ? $maxImageHeight : 0, + true, + JImage::SCALE_INSIDE + ); + + $imgObject->toFile($resize); + } + catch (Exception $e) + { + JFactory::getApplication()->enqueueMessage(JText::sprintf('PLG_FIELDS_GALLERY_IMAGE_ERROR', $file, $e->getMessage())); + } + } + + if (JFile::exists($resize)) + { + $webImagePath = JUri::base(true) . str_replace(JPATH_ROOT, '', $resize); + } + } + + // Thumbnail path for the image + $thumb = JPATH_CACHE . '/plg_fields_gallery/gallery/' . $field->id . '/' . $thumbWidth . '/' . $localPath; + + if (!JFile::exists($thumb)) + { + try + { + // Creating the folder structure for the thumbnail + if (!JFolder::exists(dirname($thumb))) + { + JFolder::create(dirname($thumb)); + } + + // Getting the properties of the image + $properties = JImage::getImageFileProperties($file); + + if ($properties->width > $thumbWidth) + { + // Creating the thumbnail for the image + $imgObject = new JImage($file); + $imgObject->resize($thumbWidth, 0, false, JImage::SCALE_INSIDE); + $imgObject->toFile($thumb); + } + } + catch (Exception $e) + { + JFactory::getApplication()->enqueueMessage(JText::sprintf('PLG_FIELDS_GALLERY_IMAGE_ERROR', $file, $e->getMessage())); + } + } + + if (JFile::exists($thumb)) + { + // Linking to the real image and loading only the thumbnail + $buffer .= ''; + } + else + { + // Thumbnail doesn't exist, loading the full image + $buffer .= ''; + } + } +} + +$buffer .= '
'; + +echo $buffer; diff --git a/plugins/fields/gallery/parameters/gallery.xml b/plugins/fields/gallery/parameters/gallery.xml new file mode 100644 index 0000000000000..5ee8caa543231 --- /dev/null +++ b/plugins/fields/gallery/parameters/gallery.xml @@ -0,0 +1,63 @@ + +
+ +
+ + + + + + + + + + + + + + + + + +
+
+
\ No newline at end of file diff --git a/plugins/search/content/content.php b/plugins/search/content/content.php index 1595d7b1d905a..5da886c0e89c7 100644 --- a/plugins/search/content/content.php +++ b/plugins/search/content/content.php @@ -92,6 +92,7 @@ public function onContentSearch($text, $phrase = '', $ordering = '', $areas = nu $wheres2[] = 'a.fulltext LIKE ' . $text; $wheres2[] = 'a.metakey LIKE ' . $text; $wheres2[] = 'a.metadesc LIKE ' . $text; + $wheres2[] = 'fv.value LIKE ' . $text; $where = '(' . implode(') OR (', $wheres2) . ')'; break; @@ -110,7 +111,7 @@ public function onContentSearch($text, $phrase = '', $ordering = '', $areas = nu $wheres2[] = 'LOWER(a.fulltext) LIKE LOWER(' . $word . ')'; $wheres2[] = 'LOWER(a.metakey) LIKE LOWER(' . $word . ')'; $wheres2[] = 'LOWER(a.metadesc) LIKE LOWER(' . $word . ')'; - $wheres[] = implode(' OR ', $wheres2); + $wheres2[] = 'LOWER(fv.value) LIKE LOWER(' . $word . ')'; } $where = '(' . implode(($phrase == 'all' ? ') AND (' : ') OR ('), $wheres) . ')'; @@ -168,13 +169,16 @@ public function onContentSearch($text, $phrase = '', $ordering = '', $areas = nu $query->select('a.title AS title, a.metadesc, a.metakey, a.created AS created, a.language, a.catid') ->select($query->concatenate(array('a.introtext', 'a.fulltext')) . ' AS text') + ->select('GROUP_CONCAT(fv.value SEPARATOR \', \') AS fields') ->select('c.title AS section, ' . $case_when . ',' . $case_when1 . ', ' . '\'2\' AS browsernav') ->from('#__content AS a') ->join('INNER', '#__categories AS c ON c.id=a.catid') + ->join('INNER', '#__fields AS f ON f.context = ' . $db->q('com_content.article')) + ->join('LEFT', '#__fields_values AS fv ON fv.item_id = a.id AND fv.field_id = f.id AND fv.context = ' . $db->q('com_content.article')) ->where( - '(' . $where . ') AND a.state=1 AND c.published = 1 AND a.access IN (' . $groups . ') ' - . 'AND c.access IN (' . $groups . ') ' + '(' . $where . ') AND a.state=1 AND f.state=1 AND c.published = 1 AND a.access IN (' . $groups . ') ' + . 'AND c.access IN (' . $groups . ') AND f.access IN (' . $groups . ') ' . 'AND (a.publish_up = ' . $db->quote($nullDate) . ' OR a.publish_up <= ' . $db->quote($now) . ') ' . 'AND (a.publish_down = ' . $db->quote($nullDate) . ' OR a.publish_down >= ' . $db->quote($now) . ')' ) @@ -185,7 +189,8 @@ public function onContentSearch($text, $phrase = '', $ordering = '', $areas = nu if ($app->isSite() && JLanguageMultilang::isEnabled()) { $query->where('a.language in (' . $db->quote($tag) . ',' . $db->quote('*') . ')') - ->where('c.language in (' . $db->quote($tag) . ',' . $db->quote('*') . ')'); + ->where('c.language in (' . $db->quote($tag) . ',' . $db->quote('*') . ')') + ->where('f.language in (' . $db->quote($tag) . ',' . $db->quote('*') . ')'); } $db->setQuery($query, 0, $limit); @@ -239,14 +244,17 @@ public function onContentSearch($text, $phrase = '', $ordering = '', $areas = nu . $query->concatenate(array("a.introtext", "a.fulltext")) . ' AS text,' . $case_when . ',' . $case_when1 . ', ' . 'c.title AS section, \'2\' AS browsernav' - ); + ) + ->select('GROUP_CONCAT(fv.value SEPARATOR \', \') AS fields'); // .'CONCAT_WS("/", c.title) AS section, \'2\' AS browsernav' ); $query->from('#__content AS a') ->join('INNER', '#__categories AS c ON c.id=a.catid AND c.access IN (' . $groups . ')') + ->join('INNER', '#__fields AS f ON f.context = ' . $db->q('com_content.article')) + ->join('LEFT', '#__fields_values AS fv ON fv.item_id = a.id AND fv.field_id = f.id AND fv.context = ' . $db->q('com_content.article')) ->where( - '(' . $where . ') AND a.state = 2 AND c.published = 1 AND a.access IN (' . $groups - . ') AND c.access IN (' . $groups . ') ' + '(' . $where . ') AND a.state = 2 AND f.state=1 AND c.published = 1 AND a.access IN (' . $groups + . ') AND c.access IN (' . $groups . ') AND f.access IN (' . $groups . ') ' . 'AND (a.publish_up = ' . $db->quote($nullDate) . ' OR a.publish_up <= ' . $db->quote($now) . ') ' . 'AND (a.publish_down = ' . $db->quote($nullDate) . ' OR a.publish_down >= ' . $db->quote($now) . ')' ) @@ -256,7 +264,8 @@ public function onContentSearch($text, $phrase = '', $ordering = '', $areas = nu if ($app->isSite() && JLanguageMultilang::isEnabled()) { $query->where('a.language in (' . $db->quote($tag) . ',' . $db->quote('*') . ')') - ->where('c.language in (' . $db->quote($tag) . ',' . $db->quote('*') . ')'); + ->where('c.language in (' . $db->quote($tag) . ',' . $db->quote('*') . ')') + ->where('f.language in (' . $db->quote($tag) . ',' . $db->quote('*') . ')'); } $db->setQuery($query, 0, $limit); @@ -301,7 +310,7 @@ public function onContentSearch($text, $phrase = '', $ordering = '', $areas = nu foreach ($row as $article) { - if (SearchHelper::checkNoHtml($article, $searchText, array('text', 'title', 'metadesc', 'metakey'))) + if (SearchHelper::checkNoHtml($article, $searchText, array('text', 'title', 'fields', 'metadesc', 'metakey'))) { $new_row[] = $article; } diff --git a/plugins/system/fields/fields.php b/plugins/system/fields/fields.php new file mode 100644 index 0000000000000..13d90b987c879 --- /dev/null +++ b/plugins/system/fields/fields.php @@ -0,0 +1,647 @@ +input->getCmd('extension') . '.category'; + } + + $parts = $this->getParts($context); + + if (!$parts) + { + return true; + } + + $context = $parts[0] . '.' . $parts[1]; + + // Loading the fields + $fieldsObjects = FieldsHelper::getFields($context, $item); + + if (!$fieldsObjects) + { + return true; + } + + $params = new Registry; + + // Load the item params from the request + $data = JFactory::getApplication()->input->post->get('jform', array(), 'array'); + + if (key_exists('params', $data)) + { + $params->loadArray($data['params']); + } + + // Load the params from the item itself + if (isset($item->params)) + { + $params->loadString($item->params); + } + + $params = $params->toArray(); + + if (!$params) + { + return true; + } + + // Create the new internal fields field + $fields = array(); + + foreach ($fieldsObjects as $field) + { + // Only save the fields with the alias from the data + if (!key_exists($field->alias, $params)) + { + continue; + } + + // Set the param on the fields variable + $fields[$field->alias] = $params[$field->alias]; + + // Remove it from the params array + unset($params[$field->alias]); + } + + $item->_fields = $fields; + + // Update the cleaned up params + if (isset($item->params)) + { + $item->params = json_encode($params); + } + } + + /** + * The save event. + * + * @param string $context The context + * @param stdClass $item The item + * @param boolean $isNew Is new + * + * @return boolean + * + * @since __DEPLOY_VERSION__ + */ + public function onContentAfterSave($context, $item, $isNew) + { + // Load the category context based on the extension + if ($context == 'com_categories.category') + { + $context = JFactory::getApplication()->input->getCmd('extension') . '.category'; + } + + $parts = $this->getParts($context); + + if (!$parts) + { + return true; + } + + $context = $parts[0] . '.' . $parts[1]; + + // Return if the item has no valid state + $fields = null; + + if (isset($item->_fields)) + { + $fields = $item->_fields; + } + + if (!$fields) + { + return true; + } + + // Loading the fields + $fieldsObjects = FieldsHelper::getFields($context, $item); + + if (!$fieldsObjects) + { + return true; + } + + // Loading the model + $model = JModelLegacy::getInstance('Field', 'FieldsModel', array('ignore_request' => true)); + + foreach ($fieldsObjects as $field) + { + // Only save the fields with the alias from the data + if (!key_exists($field->alias, $fields)) + { + continue; + } + + $id = null; + + if (isset($item->id)) + { + $id = $item->id; + } + + if (!$id) + { + continue; + } + + // Setting the value for the field and the item + $model->setFieldValue($field->id, $context, $id, $fields[$field->alias]); + } + + return true; + } + + /** + * The save event. + * + * @param array $userData The date + * @param boolean $isNew Is new + * @param boolean $success Is success + * @param string $msg The message + * + * @return boolean + * + * @since __DEPLOY_VERSION__ + */ + public function onUserAfterSave($userData, $isNew, $success, $msg) + { + // It is not possible to manipulate the user during save events + // Check if data is valid or we are in a recursion + if (!$userData['id'] || !$success) + { + return true; + } + + $user = JFactory::getUser($userData['id']); + $user->params = (string) $user->getParameters(); + + // Trigger the events with a real user + $this->onContentBeforeSave('com_users.user', $user, false); + $this->onContentAfterSave('com_users.user', $user, false); + + // Save the user with the modified params + $db = JFactory::getDbo(); + $query = $db->getQuery(true)->update('#__users') + ->set(array('params = ' . $db->quote($user->params))) + ->where('id = ' . $user->id); + $db->setQuery($query); + $db->execute(); + + return true; + } + + /** + * The delete event. + * + * @param string $context The context + * @param stdClass $item The item + * + * @return boolean + * + * @since __DEPLOY_VERSION__ + */ + public function onContentAfterDelete($context, $item) + { + $parts = $this->getParts($context); + + if (!$parts) + { + return true; + } + + $context = $parts[0] . '.' . $parts[1]; + + JLoader::import('joomla.application.component.model'); + JModelLegacy::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_fields/models', 'FieldsModel'); + + $model = JModelLegacy::getInstance('Field', 'FieldsModel', array('ignore_request' => true)); + $model->cleanupValues($context, $item->id); + + return true; + } + + /** + * The user delete event. + * + * @param stdClass $user The context + * @param boolean $succes Is success + * @param string $msg The message + * + * @return boolean + * + * @since __DEPLOY_VERSION__ + */ + public function onUserAfterDelete($user, $succes, $msg) + { + $item = new stdClass; + $item->id = $user['id']; + + return $this->onContentAfterDelete('com_users.user', $item); + } + + /** + * The form event. + * + * @param JForm $form The form + * @param stdClass $data The data + * + * @return boolean + * + * @since __DEPLOY_VERSION__ + */ + public function onContentPrepareForm(JForm $form, $data) + { + $context = $form->getName(); + + if (strpos($context, 'com_categories.category') === 0 && strpos($context, '.fields') != false) + { + // Tags are not working on custom field groups because there is no entry + // in the content_types table + $form->removeField('tags'); + return true; + } + + // Extracting the component and section + $parts = $this->getParts($context); + + if (!$parts) + { + return true; + } + + $app = JFactory::getApplication(); + $input = $app->input; + + // If we are on the save command we need the actual data + $jformData = $input->get('jform', array(), 'array'); + + if ($jformData && !$data) + { + $data = $jformData; + } + + if (is_array($data)) + { + $data = (object) $data; + } + + if ((!isset($data->catid) || !$data->catid) && JFactory::getApplication()->isSite() && $component = 'com_content') + { + $activeMenu = $app->getMenu()->getActive(); + + if ($activeMenu && $activeMenu->params) + { + $data->catid = $activeMenu->params->get('catid'); + } + } + + FieldsHelper::prepareForm($parts[0] . '.' . $parts[1], $form, $data); + + if ($app->isAdmin() && $input->get('option') == 'com_categories' && strpos($input->get('extension'), 'fields') !== false) + { + // Set the right permission extension + $form->setFieldAttribute('rules', 'component', 'com_fields'); + $form->setFieldAttribute('rules', 'section', 'category'); + } + + return true; + } + + /** + * The prepare data event. + * + * @param string $context The context + * @param stdClass $data The data + * + * @return void + * + * @since __DEPLOY_VERSION__ + */ + public function onContentPrepareData($context, $data) + { + $parts = $this->getParts($context); + + if (!$parts) + { + return; + } + + if (isset($data->params) && $data->params instanceof Registry) + { + $data->params = $data->params->toArray(); + } + } + + /** + * The display event. + * + * @param string $context The context + * @param stdClass $item The item + * @param Registry $params The params + * @param number $limitstart The start + * + * @return string + * + * @since __DEPLOY_VERSION__ + */ + public function onContentAfterTitle($context, $item, $params, $limitstart = 0) + { + return $this->display($context, $item, $params, 1); + } + + /** + * The display event. + * + * @param string $context The context + * @param stdClass $item The item + * @param Registry $params The params + * @param number $limitstart The start + * + * @return string + * + * @since __DEPLOY_VERSION__ + */ + public function onContentBeforeDisplay($context, $item, $params, $limitstart = 0) + { + return $this->display($context, $item, $params, 2); + } + + /** + * The display event. + * + * @param string $context The context + * @param stdClass $item The item + * @param Registry $params The params + * @param number $limitstart The start + * + * @return string + * + * @since __DEPLOY_VERSION__ + */ + public function onContentAfterDisplay($context, $item, $params, $limitstart = 0) + { + return $this->display($context, $item, $params, 3); + } + + /** + * Performs the display event. + * + * @param string $context The context + * @param stdClass $item The item + * @param Registry $params The params + * @param integer $displayType The type + * + * @return string + * + * @since __DEPLOY_VERSION__ + */ + private function display($context, $item, $params, $displayType) + { + $parts = $this->getParts($context); + + if (!$parts) + { + return ''; + } + + $context = $parts[0] . '.' . $parts[1]; + + if (is_string($params) || !$params) + { + $params = new Registry($params); + } + + $fields = FieldsHelper::getFields($context, $item, true); + + if ($fields) + { + foreach ($fields as $key => $field) + { + $fieldDisplayType = $field->params->get('display', '-1'); + + if ($fieldDisplayType == '-1') + { + $fieldDisplayType = $this->params->get('display', '2'); + } + + if ($fieldDisplayType == $displayType) + { + continue; + } + + unset($fields[$key]); + } + } + + if ($fields) + { + return FieldsHelper::render( + $context, + 'fields.render', + array( + 'item' => $item, + 'context' => $context, + 'fields' => $fields, + 'container' => $params->get('fields-container'), + 'container-class' => $params->get('fields-container-class'), + ) + ); + } + + return ''; + } + + /** + * Performs the display event. + * + * @param string $context The context + * @param stdClass $item The item + * + * @return boolean + * + * @since __DEPLOY_VERSION__ + */ + public function onContentPrepare($context, $item) + { + $parts = $this->getParts($context); + + if (!$parts) + { + return; + } + + $fields = FieldsHelper::getFields($parts[0] . '.' . $parts[1], $item, true); + + // Adding the fields to the object + $item->fields = array(); + + foreach ($fields as $key => $field) + { + $item->fields[$field->id] = $field; + } + + return true; + } + + /** + * The finder event. + * + * @param stdClass $item The item + * + * @return boolean + * + * @since __DEPLOY_VERSION__ + */ + public function onPrepareFinderContent($item) + { + $section = strtolower($item->layout); + $tax = $item->getTaxonomy('Type'); + + if ($tax) + { + foreach ($tax as $context => $value) + { + // This is only a guess, needs to be improved + $component = strtolower($context); + + if (strpos($context, 'com_') !== 0) + { + $component = 'com_' . $component; + } + + // Transofrm com_article to com_content + if ($component == 'com_article') + { + $component = 'com_content'; + } + + // Create a dummy object with the required fields + $tmp = new stdClass; + $tmp->id = $item->__get('id'); + + if ($item->__get('catid')) + { + $tmp->catid = $item->__get('catid'); + } + + // Getting the fields for the constructed context + $fields = FieldsHelper::getFields($component . '.' . $section, $tmp, true); + + if (is_array($fields)) + { + foreach ($fields as $field) + { + // Adding the instructions how to handle the text + $item->addInstruction(FinderIndexer::TEXT_CONTEXT, $field->alias); + + // Adding the field value as a field + $item->{$field->alias} = $field->value; + } + } + } + } + + return true; + } + + /** + * Returns the parts for the context. + * + * @param string $context The context + * + * @return array + * + * @since __DEPLOY_VERSION__ + */ + private function getParts($context) + { + // Some context mapping + // @todo needs to be done in a general lookup table on some point + $mapping = array( + 'com_users.registration' => 'com_users.user', + 'com_content.category' => 'com_content.article', + ); + + if (key_exists($context, $mapping)) + { + $context = $mapping[$context]; + } + + $parts = FieldsHelper::extract($context); + + if (!$parts) + { + return null; + } + + if ($parts[1] == 'form') + { + // The context is not from a known one, we need to do a lookup + // @todo use the api here. + $db = JFactory::getDbo(); + $query = $db->getQuery(true) + ->select('context') + ->from('#__fields') + ->where('context like ' . $db->quote($parts[0] . '.%')) + ->group(array('context')); + $db->setQuery($query); + $tmp = $db->loadObjectList(); + + if (count($tmp) == 1) + { + $parts = FieldsHelper::extract($tmp[0]->context); + + if (count($parts) < 2) + { + return null; + } + } + } + + return $parts; + } +} diff --git a/plugins/system/fields/fields.xml b/plugins/system/fields/fields.xml new file mode 100644 index 0000000000000..c4714c101d22e --- /dev/null +++ b/plugins/system/fields/fields.xml @@ -0,0 +1,49 @@ + + + plg_system_fields + Joomla! Project + March 2016 + Copyright (C) 2005 - 2016 Open Source Matters. All rights reserved. + GNU General Public License version 2 or later; see LICENSE.txt + admin@joomla.org + www.joomla.org + __DEPLOY_VERSION__ + PLG_SYSTEM_FIELDS_XML_DESCRIPTION + + fields.php + + + en-GB.plg_system_fields.ini + en-GB.plg_system_fields.sys.ini + + + +
+ + + + + + + + + + + +
+
+
+
diff --git a/templates/beez3/html/com_contact/contact/default.php b/templates/beez3/html/com_contact/contact/default.php index 097549368cb14..67c04d48e0e88 100644 --- a/templates/beez3/html/com_contact/contact/default.php +++ b/templates/beez3/html/com_contact/contact/default.php @@ -141,6 +141,10 @@ + params->get('show_user_custom_fields') && $this->contactUser) : ?> + loadTemplate('user_custom_fields'); ?> + + contact->misc && $this->params->get('show_misc')) : ?> params->get('presentation_style') == 'sliders') : diff --git a/templates/beez3/html/com_contact/contact/default_user_custom_fields.php b/templates/beez3/html/com_contact/contact/default_user_custom_fields.php new file mode 100644 index 0000000000000..b49ffba6ba081 --- /dev/null +++ b/templates/beez3/html/com_contact/contact/default_user_custom_fields.php @@ -0,0 +1,57 @@ +params; + +$displayGroups = $params->get('show_user_custom_fields'); +$userFieldGroups = array(); +?> + +contactUser) : ?> + + + +contactUser->fields as $field) :?> + catid, $displayGroups)) : ?> + + + category_title, $userFieldGroups)) : ?> + category_title] = array();?> + + category_title][] = $field;?> + + + $fields) :?> + + params->get('presentation_style') == 'sliders') : + echo JHtml::_('sliders.panel', $categoryTitle ? $categoryTitle : JText::_('COM_CONTACT_USER_FIELDS'), 'display-' . $id); ?> + + params->get('presentation_style') == 'tabs') : ?> + + + params->get('presentation_style') == 'plain'):?> + '. ( $categoryTitle ? $categoryTitle : JText::_('COM_CONTACT_USER_FIELDS')).''; ?> + + +
+
+ + value) : ?> + + + + ' . $field->label . ''; ?> + ' . $field->value . '
'; ?> + + + + + diff --git a/tests/unit/suites/libraries/joomla/form/fields/JFormFieldListTest.php b/tests/unit/suites/libraries/joomla/form/fields/JFormFieldListTest.php index bddc51c5b76b9..c1834a9d251d3 100644 --- a/tests/unit/suites/libraries/joomla/form/fields/JFormFieldListTest.php +++ b/tests/unit/suites/libraries/joomla/form/fields/JFormFieldListTest.php @@ -7,8 +7,6 @@ * @license GNU General Public License version 2 or later; see LICENSE */ -JFormHelper::loadFieldClass('list'); - /** * Test class for JFormFieldList. *