AAAAindex.html000066600000000037151372600300006542 0ustar00 field.php000066600000032055151372600300006346 0ustar00 XML element that describes the form field. * * @var SimpleXMLElement * @since 11.1 */ protected $element; /** * The JForm object of the form attached to the form field. * * @var JForm * @since 11.1 */ protected $form; /** * The form control prefix for field names from the JForm object attached to the form field. * * @var string * @since 11.1 */ protected $formControl; /** * The hidden state for the form field. * * @var boolean * @since 11.1 */ protected $hidden = false; /** * True to translate the field label string. * * @var boolean * @since 11.1 */ protected $translateLabel = true; /** * True to translate the field description string. * * @var boolean * @since 11.1 */ protected $translateDescription = true; /** * The document id for the form field. * * @var string * @since 11.1 */ protected $id; /** * The input for the form field. * * @var string * @since 11.1 */ protected $input; /** * The label for the form field. * * @var string * @since 11.1 */ protected $label; /** * The multiple state for the form field. If true then multiple values are allowed for the * field. Most often used for list field types. * * @var boolean * @since 11.1 */ protected $multiple = false; /** * The name of the form field. * * @var string * @since 11.1 */ protected $name; /** * The name of the field. * * @var string * @since 11.1 */ protected $fieldname; /** * The group of the field. * * @var string * @since 11.1 */ protected $group; /** * The required state for the form field. If true then there must be a value for the field to * be considered valid. * * @var boolean * @since 11.1 */ protected $required = false; /** * The form field type. * * @var string * @since 11.1 */ protected $type; /** * The validation method for the form field. This value will determine which method is used * to validate the value for a field. * * @var string * @since 11.1 */ protected $validate; /** * The value of the form field. * * @var mixed * @since 11.1 */ protected $value; /** * The label's CSS class of the form field * * @var mixed * @since 11.1 */ protected $labelClass; /** * The count value for generated name field * * @var integer * @since 11.1 */ protected static $count = 0; /** * The string used for generated fields names * * @var integer * @since 11.1 */ protected static $generated_fieldname = '__field'; /** * Method to instantiate the form field object. * * @param object $form The form to attach to the form field object. * * @since 11.1 */ public function __construct($form = null) { // If there is a form passed into the constructor set the form and form control properties. if ($form instanceof JForm) { $this->form = $form; $this->formControl = $form->getFormControl(); } // Detect the field type if not set if (!isset($this->type)) { $parts = JString::splitCamelCase(get_class($this)); if ($parts[0] == 'J') { $this->type = JString::ucfirst($parts[count($parts) - 1], '_'); } else { $this->type = JString::ucfirst($parts[0], '_') . JString::ucfirst($parts[count($parts) - 1], '_'); } } } /** * Method to get certain otherwise inaccessible properties from the form field object. * * @param string $name The property name for which to the the value. * * @return mixed The property value or null. * * @since 11.1 */ public function __get($name) { switch ($name) { case 'class': case 'description': case 'formControl': case 'hidden': case 'id': case 'multiple': case 'name': case 'required': case 'type': case 'validate': case 'value': case 'labelClass': case 'fieldname': case 'group': return $this->$name; break; case 'input': // If the input hasn't yet been generated, generate it. if (empty($this->input)) { $this->input = $this->getInput(); } return $this->input; break; case 'label': // If the label hasn't yet been generated, generate it. if (empty($this->label)) { $this->label = $this->getLabel(); } return $this->label; break; case 'title': return $this->getTitle(); break; } return null; } /** * Method to attach a JForm object to the field. * * @param JForm $form The JForm object to attach to the form field. * * @return object The form field object so that the method can be used in a chain. * * @since 11.1 */ public function setForm(JForm $form) { $this->form = $form; $this->formControl = $form->getFormControl(); return $this; } /** * Method to attach a JForm object to the field. * * @param object &$element The SimpleXMLElement object representing the 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 11.1 */ public function setup(&$element, $value, $group = null) { // Make sure there is a valid JFormField XML element. if (!($element instanceof SimpleXMLElement) || (string) $element->getName() != 'field') { return false; } // Reset the input and label values. $this->input = null; $this->label = null; // Set the XML element object. $this->element = $element; // Get some important attributes from the form field element. $class = (string) $element['class']; $id = (string) $element['id']; $multiple = (string) $element['multiple']; $name = (string) $element['name']; $required = (string) $element['required']; // Set the required and validation options. $this->required = ($required == 'true' || $required == 'required' || $required == '1'); $this->validate = (string) $element['validate']; // Add the required class if the field is required. if ($this->required) { if ($class) { if (strpos($class, 'required') === false) { $this->element['class'] = $class . ' required'; } } else { $this->element->addAttribute('class', 'required'); } } // Set the multiple values option. $this->multiple = ($multiple == 'true' || $multiple == 'multiple'); // Allow for field classes to force the multiple values option. if (isset($this->forceMultiple)) { $this->multiple = (bool) $this->forceMultiple; } // Set the field description text. $this->description = (string) $element['description']; // Set the visibility. $this->hidden = ((string) $element['type'] == 'hidden' || (string) $element['hidden'] == 'true'); // Determine whether to translate the field label and/or description. $this->translateLabel = !((string) $this->element['translate_label'] == 'false' || (string) $this->element['translate_label'] == '0'); $this->translateDescription = !((string) $this->element['translate_description'] == 'false' || (string) $this->element['translate_description'] == '0'); // Set the group of the field. $this->group = $group; // Set the field name and id. $this->fieldname = $this->getFieldName($name); $this->name = $this->getName($this->fieldname); $this->id = $this->getId($id, $this->fieldname); // Set the field default value. $this->value = $value; // Set the CSS class of field label $this->labelClass = (string) $element['labelclass']; return true; } /** * Method to get the id used for the field input tag. * * @param string $fieldId The field element id. * @param string $fieldName The field element name. * * @return string The id to be used for the field input tag. * * @since 11.1 */ protected function getId($fieldId, $fieldName) { // Initialise variables. $id = ''; // If there is a form control set for the attached form add it first. if ($this->formControl) { $id .= $this->formControl; } // If the field is in a group add the group control to the field id. if ($this->group) { // If we already have an id segment add the group control as another level. if ($id) { $id .= '_' . str_replace('.', '_', $this->group); } else { $id .= str_replace('.', '_', $this->group); } } // If we already have an id segment add the field id/name as another level. if ($id) { $id .= '_' . ($fieldId ? $fieldId : $fieldName); } else { $id .= ($fieldId ? $fieldId : $fieldName); } // Clean up any invalid characters. $id = preg_replace('#\W#', '_', $id); return $id; } /** * Method to get the field input markup. * * @return string The field input markup. * * @since 11.1 */ abstract protected function getInput(); /** * Method to get the field title. * * @return string The field title. * * @since 11.1 */ protected function getTitle() { // Initialise variables. $title = ''; if ($this->hidden) { return $title; } // Get the label text from the XML element, defaulting to the element name. $title = $this->element['label'] ? (string) $this->element['label'] : (string) $this->element['name']; $title = $this->translateLabel ? JText::_($title) : $title; return $title; } /** * Method to get the field label markup. * * @return string The field label markup. * * @since 11.1 */ protected function getLabel() { // Initialise variables. $label = ''; if ($this->hidden) { return $label; } // Get the label text from the XML element, defaulting to the element name. $text = $this->element['label'] ? (string) $this->element['label'] : (string) $this->element['name']; $text = $this->translateLabel ? JText::_($text) : $text; // Build the class for the label. $class = !empty($this->description) ? 'hasTip' : ''; $class = $this->required == true ? $class . ' required' : $class; $class = !empty($this->labelClass) ? $class . ' ' . $this->labelClass : $class; // Add the opening label tag and main attributes attributes. $label .= ''; } else { $label .= '>' . $text . ''; } return $label; } /** * Method to get the name used for the field input tag. * * @param string $fieldName The field element name. * * @return string The name to be used for the field input tag. * * @since 11.1 */ protected function getName($fieldName) { // Initialise variables. $name = ''; // If there is a form control set for the attached form add it first. if ($this->formControl) { $name .= $this->formControl; } // If the field is in a group add the group control to the field name. if ($this->group) { // If we already have a name segment add the group control as another level. $groups = explode('.', $this->group); if ($name) { foreach ($groups as $group) { $name .= '[' . $group . ']'; } } else { $name .= array_shift($groups); foreach ($groups as $group) { $name .= '[' . $group . ']'; } } } // If we already have a name segment add the field name as another level. if ($name) { $name .= '[' . $fieldName . ']'; } else { $name .= $fieldName; } // If the field should support multiple values add the final array segment. if ($this->multiple) { $name .= '[]'; } return $name; } /** * Method to get the field name used. * * @param string $fieldName The field element name. * * @return string The field name * * @since 11.1 */ protected function getFieldName($fieldName) { if ($fieldName) { return $fieldName; } else { self::$count = self::$count + 1; return self::$generated_fieldname . self::$count; } } } fields/folderlist.php000066600000004346151372600300010702 0ustar00element['filter']; $exclude = (string) $this->element['exclude']; $hideNone = (string) $this->element['hide_none']; $hideDefault = (string) $this->element['hide_default']; // Get the path in which to search for file options. $path = (string) $this->element['directory']; if (!is_dir($path)) { $path = JPATH_ROOT . '/' . $path; } // Prepend some default options based on field attributes. if (!$hideNone) { $options[] = JHtml::_('select.option', '-1', JText::alt('JOPTION_DO_NOT_USE', preg_replace('/[^a-zA-Z0-9_\-]/', '_', $this->fieldname))); } if (!$hideDefault) { $options[] = JHtml::_('select.option', '', JText::alt('JOPTION_USE_DEFAULT', preg_replace('/[^a-zA-Z0-9_\-]/', '_', $this->fieldname))); } // Get a list of folders in the search path with the given filter. $folders = JFolder::folders($path, $filter); // Build the options list from the list of folders. if (is_array($folders)) { foreach ($folders as $folder) { // Check to see if the file is in the exclude mask. if ($exclude) { if (preg_match(chr(1) . $exclude . chr(1), $folder)) { continue; } } $options[] = JHtml::_('select.option', $folder, $folder); } } // Merge any additional options in the XML definition. $options = array_merge(parent::getOptions(), $options); return $options; } } fields/menuitem.php000066600000004531151372600300010352 0ustar00element['menu_type']; $published = $this->element['published'] ? explode(',', (string) $this->element['published']) : array(); $disable = $this->element['disable'] ? explode(',', (string) $this->element['disable']) : array(); $language = $this->element['language'] ? explode(',', (string) $this->element['language']) : array(); // Get the menu items. $items = MenusHelper::getMenuLinks($menuType, 0, 0, $published, $language); // Build group for a specific menu type. if ($menuType) { // Initialize the group. $groups[$menuType] = array(); // Build the options array. foreach ($items as $link) { $groups[$menuType][] = JHtml::_('select.option', $link->value, $link->text, 'value', 'text', in_array($link->type, $disable)); } } // Build groups for all menu types. else { // Build the groups arrays. foreach ($items as $menu) { // Initialize the group. $groups[$menu->menutype] = array(); // Build the options array. foreach ($menu->links as $link) { $groups[$menu->menutype][] = JHtml::_( 'select.option', $link->value, $link->text, 'value', 'text', in_array($link->type, $disable) ); } } } // Merge any additional groups in the XML definition. $groups = array_merge(parent::getGroups(), $groups); return $groups; } } fields/textarea.php000066600000003234151372600300010343 0ustar00element['class'] ? ' class="' . (string) $this->element['class'] . '"' : ''; $disabled = ((string) $this->element['disabled'] == 'true') ? ' disabled="disabled"' : ''; $columns = $this->element['cols'] ? ' cols="' . (int) $this->element['cols'] . '"' : ''; $rows = $this->element['rows'] ? ' rows="' . (int) $this->element['rows'] . '"' : ''; // Initialize JavaScript field attributes. $onchange = $this->element['onchange'] ? ' onchange="' . (string) $this->element['onchange'] . '"' : ''; return ''; } } fields/text.php000066600000003441151372600300007512 0ustar00element['size'] ? ' size="' . (int) $this->element['size'] . '"' : ''; $maxLength = $this->element['maxlength'] ? ' maxlength="' . (int) $this->element['maxlength'] . '"' : ''; $class = $this->element['class'] ? ' class="' . (string) $this->element['class'] . '"' : ''; $auto = ((string) $this->element['autocomplete'] == 'off') ? ' autocomplete="off"' : ''; $readonly = ((string) $this->element['readonly'] == 'true') ? ' readonly="readonly"' : ''; $disabled = ((string) $this->element['disabled'] == 'true') ? ' disabled="disabled"' : ''; // Initialize JavaScript field attributes. $onchange = $this->element['onchange'] ? ' onchange="' . (string) $this->element['onchange'] . '"' : ''; return ''; } } fields/spacer.php000066600000005275151372600300010012 0ustar00element['class'] ? (string) $this->element['class'] : ''; $html[] = ''; $html[] = ''; $html[] = ''; if ((string) $this->element['hr'] == 'true') { $html[] = '
'; } else { $label = ''; // Get the label text from the XML element, defaulting to the element name. $text = $this->element['label'] ? (string) $this->element['label'] : (string) $this->element['name']; $text = $this->translateLabel ? JText::_($text) : $text; // Build the class for the label. $class = !empty($this->description) ? 'hasTip' : ''; $class = $this->required == true ? $class . ' required' : $class; // Add the opening label tag and main attributes attributes. $label .= ''; $html[] = $label; } $html[] = '
'; $html[] = ''; $html[] = '
'; return implode('', $html); } /** * Method to get the field title. * * @return string The field title. * * @since 11.1 */ protected function getTitle() { return $this->getLabel(); } } fields/calendar.php000066600000005526151372600300010305 0ustar00element['format'] ? (string) $this->element['format'] : '%Y-%m-%d'; // Build the attributes array. $attributes = array(); if ($this->element['size']) { $attributes['size'] = (int) $this->element['size']; } if ($this->element['maxlength']) { $attributes['maxlength'] = (int) $this->element['maxlength']; } if ($this->element['class']) { $attributes['class'] = (string) $this->element['class']; } if ((string) $this->element['readonly'] == 'true') { $attributes['readonly'] = 'readonly'; } if ((string) $this->element['disabled'] == 'true') { $attributes['disabled'] = 'disabled'; } if ($this->element['onchange']) { $attributes['onchange'] = (string) $this->element['onchange']; } // Handle the special case for "now". if (strtoupper($this->value) == 'NOW') { $this->value = strftime($format); } // Get some system objects. $config = JFactory::getConfig(); $user = JFactory::getUser(); // If a known filter is given use it. switch (strtoupper((string) $this->element['filter'])) { case 'SERVER_UTC': // Convert a date to UTC based on the server timezone. if (intval($this->value)) { // Get a date object based on the correct timezone. $date = JFactory::getDate($this->value, 'UTC'); $date->setTimezone(new DateTimeZone($config->get('offset'))); // Transform the date string. $this->value = $date->format('Y-m-d H:i:s', true, false); } break; case 'USER_UTC': // Convert a date to UTC based on the user timezone. if (intval($this->value)) { // Get a date object based on the correct timezone. $date = JFactory::getDate($this->value, 'UTC'); $date->setTimezone(new DateTimeZone($user->getParam('timezone', $config->get('offset')))); // Transform the date string. $this->value = $date->format('Y-m-d H:i:s', true, false); } break; } return JHtml::_('calendar', $this->value, $this->name, $this->id, $format, $attributes); } } fields/file.php000066600000003345151372600300007450 0ustar00element['accept'] ? ' accept="' . (string) $this->element['accept'] . '"' : ''; $size = $this->element['size'] ? ' size="' . (int) $this->element['size'] . '"' : ''; $class = $this->element['class'] ? ' class="' . (string) $this->element['class'] . '"' : ''; $disabled = ((string) $this->element['disabled'] == 'true') ? ' disabled="disabled"' : ''; // Initialize JavaScript field attributes. $onchange = $this->element['onchange'] ? ' onchange="' . (string) $this->element['onchange'] . '"' : ''; return ''; } } fields/rules.php000066600000025165151372600300007667 0ustar00element['section'] ? (string) $this->element['section'] : ''; $component = $this->element['component'] ? (string) $this->element['component'] : ''; $assetField = $this->element['asset_field'] ? (string) $this->element['asset_field'] : 'asset_id'; // Get the actions for the asset. $actions = JAccess::getActions($component, $section); // Iterate over the children and add to the actions. foreach ($this->element->children() as $el) { if ($el->getName() == 'action') { $actions[] = (object) array('name' => (string) $el['name'], 'title' => (string) $el['title'], 'description' => (string) $el['description']); } } // Get the explicit rules for this asset. if ($section == 'component') { // Need to find the asset id by the name of the component. $db = JFactory::getDbo(); $query = $db->getQuery(true); $query->select($db->quoteName('id')); $query->from($db->quoteName('#__assets')); $query->where($db->quoteName('name') . ' = ' . $db->quote($component)); $db->setQuery($query); $assetId = (int) $db->loadResult(); if ($error = $db->getErrorMsg()) { JError::raiseNotice(500, $error); } } else { // Find the asset id of the content. // Note that for global configuration, com_config injects asset_id = 1 into the form. $assetId = $this->form->getValue($assetField); } // Use the compact form for the content rules (deprecated). //if (!empty($component) && $section != 'component') { // return JHtml::_('rules.assetFormWidget', $actions, $assetId, $assetId ? null : $component, $this->name, $this->id); //} // Full width format. // Get the rules for just this asset (non-recursive). $assetRules = JAccess::getAssetRules($assetId); // Get the available user groups. $groups = $this->getUserGroups(); // Build the form control. $curLevel = 0; // Prepare output $html = array(); $html[] = '
'; $html[] = '

' . JText::_('JLIB_RULES_SETTINGS_DESC') . '

'; $html[] = '', $curLevel); $html[] = '
'; if ($section == 'component' || $section == null) { $html[] = JText::_('JLIB_RULES_SETTING_NOTES'); } else { $html[] = JText::_('JLIB_RULES_SETTING_NOTES_ITEM'); } $html[] = '
'; $js = "window.addEvent('domready', function(){ new Fx.Accordion($$('div#permissions-sliders.pane-sliders .panel h3.pane-toggler')," . "$$('div#permissions-sliders.pane-sliders .panel div.pane-slider'), {onActive: function(toggler, i) {toggler.addClass('pane-toggler-down');" . "toggler.removeClass('pane-toggler');i.addClass('pane-down');i.removeClass('pane-hide');Cookie.write('jpanesliders_permissions-sliders" . $component . "',$$('div#permissions-sliders.pane-sliders .panel h3').indexOf(toggler));}," . "onBackground: function(toggler, i) {toggler.addClass('pane-toggler');toggler.removeClass('pane-toggler-down');i.addClass('pane-hide');" . "i.removeClass('pane-down');}, duration: 300, display: " . JRequest::getInt('jpanesliders_permissions-sliders' . $component, 0, 'cookie') . ", show: " . JRequest::getInt('jpanesliders_permissions-sliders' . $component, 0, 'cookie') . ", alwaysHide:true, opacity: false}); });"; JFactory::getDocument()->addScriptDeclaration($js); return implode("\n", $html); } /** * Get a list of the user groups. * * @return array * * @since 11.1 */ protected function getUserGroups() { // Initialise variables. $db = JFactory::getDBO(); $query = $db->getQuery(true); $query->select('a.id AS value, a.title AS text, COUNT(DISTINCT b.id) AS level, a.parent_id') ->from('#__usergroups AS a') ->leftJoin($db->quoteName('#__usergroups') . ' AS b ON a.lft > b.lft AND a.rgt < b.rgt') ->group('a.id, a.title, a.lft, a.rgt, a.parent_id') ->order('a.lft ASC'); $db->setQuery($query); $options = $db->loadObjectList(); return $options; } } fields/editor.php000066600000007541151372600300010021 0ustar00element['rows']; $cols = (int) $this->element['cols']; $height = ((string) $this->element['height']) ? (string) $this->element['height'] : '250'; $width = ((string) $this->element['width']) ? (string) $this->element['width'] : '100%'; $assetField = $this->element['asset_field'] ? (string) $this->element['asset_field'] : 'asset_id'; $authorField = $this->element['created_by_field'] ? (string) $this->element['created_by_field'] : 'created_by'; $asset = $this->form->getValue($assetField) ? $this->form->getValue($assetField) : (string) $this->element['asset_id']; // Build the buttons array. $buttons = (string) $this->element['buttons']; if ($buttons == 'true' || $buttons == 'yes' || $buttons == '1') { $buttons = true; } elseif ($buttons == 'false' || $buttons == 'no' || $buttons == '0') { $buttons = false; } else { $buttons = explode(',', $buttons); } $hide = ((string) $this->element['hide']) ? explode(',', (string) $this->element['hide']) : array(); // Get an editor object. $editor = $this->getEditor(); return $editor ->display( $this->name, htmlspecialchars($this->value, ENT_COMPAT, 'UTF-8'), $width, $height, $cols, $rows, $buttons ? (is_array($buttons) ? array_merge($buttons, $hide) : $hide) : false, $this->id, $asset, $this->form->getValue($authorField) ); } /** * Method to get a JEditor object based on the form field. * * @return JEditor The JEditor object. * * @since 11.1 */ protected function &getEditor() { // Only create the editor if it is not already created. if (empty($this->editor)) { // Initialize variables. $editor = null; // Get the editor type attribute. Can be in the form of: editor="desired|alternative". $type = trim((string) $this->element['editor']); if ($type) { // Get the list of editor types. $types = explode('|', $type); // Get the database object. $db = JFactory::getDBO(); // Iterate over teh types looking for an existing editor. foreach ($types as $element) { // Build the query. $query = $db->getQuery(true); $query->select('element'); $query->from('#__extensions'); $query->where('element = ' . $db->quote($element)); $query->where('folder = ' . $db->quote('editors')); $query->where('enabled = 1'); // Check of the editor exists. $db->setQuery($query, 0, 1); $editor = $db->loadResult(); // If an editor was found stop looking. if ($editor) { break; } } } // Create the JEditor instance based on the given editor. $this->editor = JFactory::getEditor($editor ? $editor : null); } return $this->editor; } /** * Method to get the JEditor output for an onSave event. * * @return string The JEditor object output. * * @since 11.1 */ public function save() { return $this->getEditor()->save($this->id); } } fields/index.html000066600000000037151372600300010010 0ustar00 fields/url.php000066600000001352151372600300007327 0ustar00element['size'] ? ' size="' . (int) $this->element['size'] . '"' : ''; $maxLength = $this->element['maxlength'] ? ' maxlength="' . (int) $this->element['maxlength'] . '"' : ''; $class = $this->element['class'] ? ' ' . (string) $this->element['class'] : ''; $readonly = ((string) $this->element['readonly'] == 'true') ? ' readonly="readonly"' : ''; $disabled = ((string) $this->element['disabled'] == 'true') ? ' disabled="disabled"' : ''; // " and \ are always forbidden in email unless escaped. $this->value = str_replace(array('"','\\'), '', $this->value); // Initialize JavaScript field attributes. $onchange = $this->element['onchange'] ? ' onchange="' . (string) $this->element['onchange'] . '"' : ''; return ''; } } fields/groupedlist.php000066600000011433151372600300011067 0ustar00element->children() as $element) { switch ($element->getName()) { // The element is an