Skip to content

Commit

Permalink
Affected files now comply with Joomla PHPCS standard.
Browse files Browse the repository at this point in the history
  • Loading branch information
okonomiyaki3000 committed Oct 5, 2015
1 parent 0156819 commit dd7a14e
Show file tree
Hide file tree
Showing 13 changed files with 31 additions and 94 deletions.
47 changes: 0 additions & 47 deletions libraries/joomla/form/fields/list.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,54 +105,7 @@ protected function getOptions()

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;
}
}

<<<<<<< 9c37b27d5b2cc24361ea09777f6b92c2cf22e214
$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;
=======
$options = array_merge($options, JFormOption::getOptions($option, $this->fieldname));
>>>>>>> Make JFormFieldCheckboxes and JFormFieldRadio subclasses of JFormFieldList so that there is only one implementation of getOptions().
}

reset($options);
Expand Down
1 change: 1 addition & 0 deletions libraries/joomla/form/form.php
Original file line number Diff line number Diff line change
Expand Up @@ -1480,6 +1480,7 @@ protected function filterField($element, $value)
{
$return = JFilterInput::getInstance()->clean($value, $filter);
}

break;
}

Expand Down
6 changes: 2 additions & 4 deletions libraries/joomla/form/options/cachehandlers.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,13 @@
*/
abstract class JFormOptionCacheHandlers
{

protected $type = 'CacheHandlers';

/**
* Method to get a list of options.
*
* @param SimpleXMLElement $option <option/> element
* @param string $fieldname The name of the field containing this option.
* @param SimpleXMLElement $option <option/> element
* @param string $fieldname The name of the field containing this option.
*
* @return array A list of objects representing HTML option elements (such as created by JHtmlSelect::option).
*
Expand All @@ -43,5 +42,4 @@ public static function getOptions(SimpleXMLElement $option, $fieldname = '')

return $options;
}

}
7 changes: 3 additions & 4 deletions libraries/joomla/form/options/databaseconnections.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,13 @@
*/
abstract class JFormOptionDatabaseConnections
{

protected $type = 'DatabaseConnections';

/**
* Method to get a list of options.
*
* @param SimpleXMLElement $option <option/> element
* @param string $fieldname The name of the field containing this option.
* @param SimpleXMLElement $option <option/> element
* @param string $fieldname The name of the field containing this option.
*
* @return array A list of objects representing HTML option elements (such as created by JHtmlSelect::option).
*
Expand All @@ -46,6 +45,7 @@ public static function getOptions(SimpleXMLElement $option, $fieldname = '')
* are supported.
*/
$supported = array_filter(array_map('trim', explode(',', $option['supported'])));

if (!empty($supported))
{
$connectors = array_intersect($connectors, $supported);
Expand All @@ -65,5 +65,4 @@ public static function getOptions(SimpleXMLElement $option, $fieldname = '')

return $options;
}

}
9 changes: 4 additions & 5 deletions libraries/joomla/form/options/files.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,13 @@
*/
abstract class JFormOptionFiles
{

protected $type = 'Files';

/**
* Method to get a list of options.
*
* @param SimpleXMLElement $option <option/> element
* @param string $fieldname The name of the field containing this option.
* @param SimpleXMLElement $option <option/> element
* @param string $fieldname The name of the field containing this option.
*
* @return array A list of objects representing HTML option elements (such as created by JHtmlSelect::option).
*
Expand All @@ -44,6 +43,7 @@ public static function getOptions(SimpleXMLElement $option, $fieldname = '')

// Get the path in which to search for file options.
$path = (string) $option['directory'];

if (!is_dir($path))
{
$path = JPATH_ROOT . '/' . $path;
Expand All @@ -54,6 +54,7 @@ public static function getOptions(SimpleXMLElement $option, $fieldname = '')
{
$options[] = JHtml::_('select.option', '-1', JText::alt('JOPTION_DO_NOT_USE', preg_replace('/[^a-zA-Z0-9_\-]/', '_', $fieldname)));
}

if (!$hideDefault)
{
$options[] = JHtml::_('select.option', '', JText::alt('JOPTION_USE_DEFAULT', preg_replace('/[^a-zA-Z0-9_\-]/', '_', $fieldname)));
Expand All @@ -67,7 +68,6 @@ public static function getOptions(SimpleXMLElement $option, $fieldname = '')
{
foreach ($files as $file)
{

// Check to see if the file is in the exclude mask.
if ($exclude)
{
Expand All @@ -89,5 +89,4 @@ public static function getOptions(SimpleXMLElement $option, $fieldname = '')

return $options;
}

}
9 changes: 4 additions & 5 deletions libraries/joomla/form/options/folders.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,13 @@
*/
abstract class JFormOptionFolders
{

protected $type = 'Folders';

/**
* Method to get a list of options.
*
* @param SimpleXMLElement $option <option/> element
* @param string $fieldname The name of the field containing this option.
* @param SimpleXMLElement $option <option/> element
* @param string $fieldname The name of the field containing this option.
*
* @return array A list of objects representing HTML option elements (such as created by JHtmlSelect::option).
*
Expand All @@ -43,6 +42,7 @@ public static function getOptions(SimpleXMLElement $option, $fieldname = '')

// Get the path in which to search for file options.
$path = (string) $option['directory'];

if (!is_dir($path))
{
$path = JPATH_ROOT . '/' . $path;
Expand All @@ -53,6 +53,7 @@ public static function getOptions(SimpleXMLElement $option, $fieldname = '')
{
$options[] = JHtml::_('select.option', '-1', JText::alt('JOPTION_DO_NOT_USE', preg_replace('/[^a-zA-Z0-9_\-]/', '_', $fieldname)));
}

if (!$hideDefault)
{
$options[] = JHtml::_('select.option', '', JText::alt('JOPTION_USE_DEFAULT', preg_replace('/[^a-zA-Z0-9_\-]/', '_', $fieldname)));
Expand All @@ -66,7 +67,6 @@ public static function getOptions(SimpleXMLElement $option, $fieldname = '')
{
foreach ($folders as $folder)
{

// Check to see if the file is in the exclude mask.
if ($exclude)
{
Expand All @@ -82,5 +82,4 @@ public static function getOptions(SimpleXMLElement $option, $fieldname = '')

return $options;
}

}
6 changes: 2 additions & 4 deletions libraries/joomla/form/options/images.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,13 @@
*/
abstract class JFormOptionImages extends JFormOptionFiles
{

protected $type = 'Images';

/**
* Method to get a list of options.
*
* @param SimpleXMLElement $option <option/> element
* @param string $fieldname The name of the field containing this option.
* @param SimpleXMLElement $option <option/> element
* @param string $fieldname The name of the field containing this option.
*
* @return array A list of objects representing HTML option elements (such as created by JHtmlSelect::option).
*
Expand All @@ -44,5 +43,4 @@ public static function getOptions(SimpleXMLElement $option, $fieldname = '')
// Get the field options.
return parent::getOptions($option, $fieldname);
}

}
9 changes: 4 additions & 5 deletions libraries/joomla/form/options/languages.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,13 @@
*/
abstract class JFormOptionLanguages
{

protected $type = 'Languages';

/**
* Method to get a list of options.
*
* @param SimpleXMLElement $option <option/> element
* @param string $fieldname The name of the field containing this option.
* @param SimpleXMLElement $option <option/> element
* @param string $fieldname The name of the field containing this option.
*
* @return array A list of objects representing HTML option elements (such as created by JHtmlSelect::option).
*
Expand All @@ -35,6 +34,7 @@ public static function getOptions(SimpleXMLElement $option, $fieldname = '')
{
// Initialize some field attributes.
$client = (string) $option['client'];

if ($client != 'site' && $client != 'administrator')
{
$client = 'site';
Expand All @@ -45,12 +45,11 @@ public static function getOptions(SimpleXMLElement $option, $fieldname = '')
$path = constant('JPATH_' . strtoupper($client));

// For some reason we get a list of associative arrays, we need objects.
foreach(JLanguageHelper::createLanguageList($language, $path, true, true) as $option)
foreach (JLanguageHelper::createLanguageList($language, $path, true, true) as $option)
{
$options[] = (object) $option;
}

return $options;
}

}
7 changes: 3 additions & 4 deletions libraries/joomla/form/options/plugins.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,13 @@
*/
abstract class JFormOptionPlugins
{

protected $type = 'Plugins';

/**
* Method to get a list of options.
*
* @param SimpleXMLElement $option <option/> element
* @param string $fieldname The name of the field containing this option.
* @param SimpleXMLElement $option <option/> element
* @param string $fieldname The name of the field containing this option.
*
* @return array A list of objects representing HTML option elements (such as created by JHtmlSelect::option).
*
Expand All @@ -49,6 +48,7 @@ public static function getOptions(SimpleXMLElement $option, $fieldname = '')
$options = $db->setQuery($query)->loadObjectList();

$lang = JFactory::getLanguage();

foreach ($options as $i => $item)
{
$source = JPATH_PLUGINS . '/' . $folder . '/' . $item->value;
Expand All @@ -67,5 +67,4 @@ public static function getOptions(SimpleXMLElement $option, $fieldname = '')

return $options;
}

}
6 changes: 2 additions & 4 deletions libraries/joomla/form/options/range.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,13 @@
*/
abstract class JFormOptionRange
{

protected $type = 'Range';

/**
* Method to get a list of options.
*
* @param SimpleXMLElement $option <option/> element
* @param string $fieldname The name of the field containing this option.
* @param SimpleXMLElement $option <option/> element
* @param string $fieldname The name of the field containing this option.
*
* @return array A list of objects representing HTML option elements (such as created by JHtmlSelect::option).
*
Expand Down Expand Up @@ -67,5 +66,4 @@ public static function getOptions(SimpleXMLElement $option, $fieldname = '')

return $options;
}

}
6 changes: 2 additions & 4 deletions libraries/joomla/form/options/sessionhandlers.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,13 @@
*/
abstract class JFormOptionSessionHandlers
{

protected $type = 'SessionHandlers';

/**
* Method to get a list of options.
*
* @param SimpleXMLElement $option <option/> element
* @param string $fieldname The name of the field containing this option.
* @param SimpleXMLElement $option <option/> element
* @param string $fieldname The name of the field containing this option.
*
* @return array A list of objects representing HTML option elements (such as created by JHtmlSelect::option).
*
Expand All @@ -43,5 +42,4 @@ public static function getOptions(SimpleXMLElement $option, $fieldname = '')

return $options;
}

}
6 changes: 2 additions & 4 deletions libraries/joomla/form/options/sql.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,13 @@
*/
abstract class JFormOptionSQL
{

protected $type = 'SQL';

/**
* Method to get a list of options.
*
* @param SimpleXMLElement $option <option/> element
* @param string $fieldname The name of the field containing this option.
* @param SimpleXMLElement $option <option/> element
* @param string $fieldname The name of the field containing this option.
*
* @return array A list of objects representing HTML option elements (such as created by JHtmlSelect::option).
*
Expand Down Expand Up @@ -80,5 +79,4 @@ public static function getOptions(SimpleXMLElement $option, $fieldname = '')

return $options;
}

}
6 changes: 2 additions & 4 deletions libraries/joomla/form/options/table.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,13 @@
*/
abstract class JFormOptionTable
{

protected $type = 'Table';

/**
* Method to get a list of options.
*
* @param SimpleXMLElement $option <option/> element
* @param string $fieldname The name of the field containing this option.
* @param SimpleXMLElement $option <option/> element
* @param string $fieldname The name of the field containing this option.
*
* @return array A list of objects representing HTML option elements (such as created by JHtmlSelect::option).
*
Expand Down Expand Up @@ -82,5 +81,4 @@ public static function getOptions(SimpleXMLElement $option, $fieldname = '')

return $options;
}

}

0 comments on commit dd7a14e

Please sign in to comment.