Skip to content
This repository has been archived by the owner on Nov 26, 2017. It is now read-only.

Commit

Permalink
Merge pull request #1171 from simonharrer/master
Browse files Browse the repository at this point in the history
Several small refactorings.
  • Loading branch information
LouisLandry committed Apr 26, 2012
2 parents 8bee952 + 1aaa4fc commit 7f7d459
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 19 deletions.
1 change: 1 addition & 0 deletions libraries/joomla/client/ldap.php
Expand Up @@ -628,6 +628,7 @@ public static function generatePassword($password, $type = 'md5')
{
case 'sha':
$userpassword = '{SHA}' . base64_encode(pack('H*', sha1($password)));
break;
case 'md5':
default:
$userpassword = '{MD5}' . base64_encode(pack('H*', md5($password)));
Expand Down
1 change: 0 additions & 1 deletion libraries/joomla/database/driver/oracle.php
Expand Up @@ -255,7 +255,6 @@ public function getTableKeys($table)
{
$this->connect();

$keys = array();
$query = $this->getQuery(true);

$fieldCasing = $this->getOption(PDO::ATTR_CASE);
Expand Down
6 changes: 0 additions & 6 deletions libraries/joomla/form/fields/password.php
Expand Up @@ -48,9 +48,6 @@ protected function getInput()
$meter = ((string) $this->element['strengthmeter'] == 'true');
$threshold = $this->element['threshold'] ? (int) $this->element['threshold'] : 66;

// Initialize JavaScript field attributes.
$onchange = $this->element['onchange'] ? ' onchange="' . (string) $this->element['onchange'] . '"' : '';

$script = '';
if ($meter)
{
Expand All @@ -65,9 +62,6 @@ protected function getInput()
);</script>';
}

// Initialize JavaScript field attributes.
$onchange = $this->element['onchange'] ? ' onchange="' . (string) $this->element['onchange'] . '"' : '';

return '<input type="password" name="' . $this->name . '" id="' . $this->id . '"' .
' value="' . htmlspecialchars($this->value, ENT_COMPAT, 'UTF-8') . '"' .
$auto . $class . $readonly . $disabled . $size . $maxLength . '/>' . $script;
Expand Down
12 changes: 6 additions & 6 deletions libraries/joomla/form/form.php
Expand Up @@ -308,7 +308,7 @@ public function getFieldAttribute($name, $attribute, $default = null, $group = n
// Make sure there is a valid JForm XML document.
if (!($this->xml instanceof SimpleXMLElement))
{
throw new UnexpectedValueException(sprint('%s::getFieldAttribute `xml` is not an instance of SimpleXMLElement', get_class($this)));
throw new UnexpectedValueException(sprintf('%s::getFieldAttribute `xml` is not an instance of SimpleXMLElement', get_class($this)));
}

// Find the form field element from the definition.
Expand Down Expand Up @@ -791,7 +791,7 @@ public function removeField($name, $group = null)
// Make sure there is a valid JForm XML document.
if (!($this->xml instanceof SimpleXMLElement))
{
throw new UnexpectedValueException(sprint('%s::getFieldAttribute `xml` is not an instance of SimpleXMLElement', get_class($this)));
throw new UnexpectedValueException(sprintf('%s::getFieldAttribute `xml` is not an instance of SimpleXMLElement', get_class($this)));
}

// Find the form field element from the definition.
Expand Down Expand Up @@ -822,7 +822,7 @@ public function removeGroup($group)
// Make sure there is a valid JForm XML document.
if (!($this->xml instanceof SimpleXMLElement))
{
throw new UnexpectedValueException(sprint('%s::getFieldAttribute `xml` is not an instance of SimpleXMLElement', get_class($this)));
throw new UnexpectedValueException(sprintf('%s::getFieldAttribute `xml` is not an instance of SimpleXMLElement', get_class($this)));
}

// Get the fields elements for a given group.
Expand Down Expand Up @@ -878,7 +878,7 @@ public function setField(SimpleXMLElement $element, $group = null, $replace = tr
// Make sure there is a valid JForm XML document.
if (!($this->xml instanceof SimpleXMLElement))
{
throw new UnexpectedValueException(sprint('%s::getFieldAttribute `xml` is not an instance of SimpleXMLElement', get_class($this)));
throw new UnexpectedValueException(sprintf('%s::getFieldAttribute `xml` is not an instance of SimpleXMLElement', get_class($this)));
}

// Find the form field element from the definition.
Expand Down Expand Up @@ -940,7 +940,7 @@ public function setFieldAttribute($name, $attribute, $value, $group = null)
// Make sure there is a valid JForm XML document.
if (!($this->xml instanceof SimpleXMLElement))
{
throw new UnexpectedValueException(sprint('%s::getFieldAttribute `xml` is not an instance of SimpleXMLElement', get_class($this)));
throw new UnexpectedValueException(sprintf('%s::getFieldAttribute `xml` is not an instance of SimpleXMLElement', get_class($this)));
}

// Find the form field element from the definition.
Expand Down Expand Up @@ -982,7 +982,7 @@ public function setFields(&$elements, $group = null, $replace = true)
// Make sure there is a valid JForm XML document.
if (!($this->xml instanceof SimpleXMLElement))
{
throw new UnexpectedValueException(sprint('%s::getFieldAttribute `xml` is not an instance of SimpleXMLElement', get_class($this)));
throw new UnexpectedValueException(sprintf('%s::getFieldAttribute `xml` is not an instance of SimpleXMLElement', get_class($this)));
}

// Make sure the elements to set are valid.
Expand Down
4 changes: 2 additions & 2 deletions libraries/joomla/form/helper.php
Expand Up @@ -105,15 +105,15 @@ protected static function loadType($entity, $type, $new = true)

// Initialize variables.
$key = md5($type);
$class = '';

// Return an entity object if it already exists and we don't need a new one.
if (isset($types[$key]) && $new === false)
{
return $types[$key];
}

if (($class = self::loadClass($entity, $type)) !== false)
$class = self::loadClass($entity, $type);
if ($class !== false)
{
// Instantiate a new type object.
$types[$key] = new $class;
Expand Down
4 changes: 2 additions & 2 deletions libraries/joomla/html/html/rules.php
Expand Up @@ -66,9 +66,9 @@ public static function assetFormWidget($actions, $assetId = null, $parent = null
{
$html[] = ' <tr class="row' . ($i % 2) . '">';
$html[] = ' <td class="col1">' . $group->text . '</td>';
foreach ($actions as $i => $action)
foreach ($actions as $j => $action)
{
$html[] = ' <td class="col' . ($i + 2) . '">'
$html[] = ' <td class="col' . ($j + 2) . '">'
. ($assetId ? ($inherited->allow($action->name, $group->identities) ? $images['allow'] : $images['deny'])
: ($inheriting->allow($action->name, $group->identities) ? $images['allow'] : $images['deny'])) . '</td>';
}
Expand Down
2 changes: 0 additions & 2 deletions libraries/joomla/table/table.php
Expand Up @@ -1008,8 +1008,6 @@ public function reorder($where = '')
if (!property_exists($this, 'ordering'))
{
throw new UnexpectedValueException(sprintf('%s does not support ordering.', get_class($this)));
$this->setError($e);
return false;
}

// Initialise variables.
Expand Down

0 comments on commit 7f7d459

Please sign in to comment.