Skip to content

Commit

Permalink
Code style fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
elinw committed Dec 9, 2011
1 parent e6f1136 commit f6a3307
Showing 1 changed file with 34 additions and 33 deletions.
67 changes: 34 additions & 33 deletions libraries/joomla/form/fields/url.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,48 +22,49 @@
* @see JFormRuleUrl for validation of full urls
* @since 11.1
*/
class JFormFieldUrl extends JFormFieldText
class JFormFieldUrl extends JFormField
{
/**
* The form field type.
*
* @var string
* @since 11.1
* @since 11.4
*/
protected $type = 'Url';
/**
* Method to get the field input markup.
* When used in conjunction with the url filter in JFormField, ifthe relative element is
* false the method assumes most URLS are external.
* When relative is true a url that does not include a protocol is assumed to be local.
* This method does not validate a url which should be done using JFormRuleUrl.
*
* @return string
*
* @see JFormRuleUrl, JForm::Filter
* @since 11.1
*/
protected function getInput()
{
// Initialize some field attributes.
$accept = $this->element['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"' : '';
$readonly = ((string) $this->element['readonly'] == 'true') ? ' readonly="readonly"' : '';
$maxLength = $this->element['maxlength'] ? ' maxlength="'.(int) $this->element['maxlength'].'"' : '';
// Element to assume of relative URLs without protocols are local. If not set or false, URLS
// without protocols are assumed to be external (with some exceptions based on string matching).
// Do not use if you intend to use the URL rule to validate.
$relative = ((string) $this->element['relative'] == 'true') ? ' relative="relative"' : '';

/**
* Method to get the field input markup.
* When used in conjunction with the url filter in JFormField, ifthe relative element is
* false the method assumes most URLS are external.
* When relative is true a url that does not include a protocol is assumed to be local.
* This method does not validate a url which should be done using JFormRuleUrl.
*
* @return string
*
* @see JFormRuleUrl, JForm::Filter
* @since 11.1
*/
protected function getInput()
{
// Initialize some field attributes.
$accept = $this->element['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"' : '';
$readonly = ((string) $this->element['readonly'] == 'true') ? ' readonly="readonly"' : '';
$maxLength = $this->element['maxlength'] ? ' maxlength="'.(int) $this->element['maxlength'].'"' : '';
// Element to assume of relative URLs without protocols are local. If not set or false, URLS
// without protocols are assumed to be external (with some exceptions based on string matching).
// Do not use if you intend to use the URL rule to validate.
$relative = ((string) $this->element['relative'] == 'true') ? ' relative="relative"' : '';


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

return '<input type="text" name="'.$this->name.'" id="'.$this->id.'"' .
' value="'.htmlspecialchars($this->value, ENT_COMPAT, 'UTF-8').'"' .
$class.$size.$disabled.$relative.$readonly.$onchange.$maxLength.'/>';
return '<input type="text" name="'.$this->name.'" id="'.$this->id.'"' .
' value="'.htmlspecialchars($this->value, ENT_COMPAT, 'UTF-8').'"' .
$class.$size.$disabled.$relative.$readonly.$onchange.$maxLength.'/>';

}
}
}

0 comments on commit f6a3307

Please sign in to comment.