Minor - format code, remove unused comments

pull/2733/head
Julio Montoya 7 years ago
parent d9c37bf1f3
commit b0ccba6e77
  1. 3
      main/inc/lib/agenda.lib.php
  2. 7
      main/inc/lib/attendance.lib.php
  3. 20
      main/inc/lib/pear/HTML/Common.php
  4. 6
      main/inc/lib/pear/HTML/QuickForm.php
  5. 5
      main/inc/lib/pear/HTML/QuickForm/Renderer.php
  6. 85
      main/inc/lib/pear/HTML/QuickForm/element.php
  7. 41
      main/inc/lib/pear/HTML/QuickForm/input.php
  8. 10
      main/inc/lib/pear/HTML/QuickForm/label.php
  9. 8
      main/inc/lib/pear/HTML/QuickForm/link.php
  10. 12
      main/inc/lib/pear/HTML/QuickForm/reset.php
  11. 48
      main/inc/lib/pear/HTML/QuickForm/static.php
  12. 16
      main/inc/lib/pear/HTML/QuickForm/submit.php
  13. 2
      main/inc/lib/pear/HTML/QuickForm/text.php
  14. 47
      main/inc/lib/pear/HTML/QuickForm/textarea.php

@ -2337,10 +2337,9 @@ class Agenda
$action = isset($params['action']) ? Security::remove_XSS($params['action']) : null; $action = isset($params['action']) ? Security::remove_XSS($params['action']) : null;
$id = isset($params['id']) ? (int) $params['id'] : 0; $id = isset($params['id']) ? (int) $params['id'] : 0;
$url = api_get_self().'?action='.$action.'&id='.$id.'&type='.$this->type;
if ($this->type == 'course') { if ($this->type == 'course') {
$url = api_get_self().'?'.api_get_cidreq().'&action='.$action.'&id='.$id.'&type='.$this->type; $url = api_get_self().'?'.api_get_cidreq().'&action='.$action.'&id='.$id.'&type='.$this->type;
} else {
$url = api_get_self().'?action='.$action.'&id='.$id.'&type='.$this->type;
} }
$form = new FormValidator( $form = new FormValidator(

@ -117,9 +117,9 @@ class Attendance
$course_id = api_get_course_int_id(); $course_id = api_get_course_int_id();
$session_id = api_get_session_id(); $session_id = api_get_session_id();
$condition_session = api_get_session_condition($session_id); $condition_session = api_get_session_condition($session_id);
$column = intval($column); $column = (int) $column;
$from = intval($from); $from = (int) $from;
$number_of_items = intval($number_of_items); $number_of_items = (int) $number_of_items;
if (!in_array($direction, ['ASC', 'DESC'])) { if (!in_array($direction, ['ASC', 'DESC'])) {
$direction = 'ASC'; $direction = 'ASC';
@ -163,6 +163,7 @@ class Attendance
if (api_get_session_id() == $attendance[6]) { if (api_get_session_id() == $attendance[6]) {
$session_star = api_get_session_image(api_get_session_id(), $user_info['status']); $session_star = api_get_session_image(api_get_session_id(), $user_info['status']);
} }
if ($attendance[5] == 1) { if ($attendance[5] == 1) {
$isDrhOfCourse = CourseManager::isUserSubscribedInCourseAsDrh( $isDrhOfCourse = CourseManager::isUserSubscribedInCourseAsDrh(
api_get_user_id(), api_get_user_id(),

@ -126,7 +126,7 @@ class HTML_Common
function _getTabs() function _getTabs()
{ {
return str_repeat($this->_getTab(), $this->_tabOffset); return str_repeat($this->_getTab(), $this->_tabOffset);
} // end func _getTabs }
/** /**
* Returns an HTML formatted attribute string * Returns an HTML formatted attribute string
@ -146,6 +146,7 @@ class HTML_Common
$strAttr .= ' ' . $key . '= "' . $value. '"'; $strAttr .= ' ' . $key . '= "' . $value. '"';
} }
} }
return $strAttr; return $strAttr;
} }
@ -155,7 +156,7 @@ class HTML_Common
* @access private * @access private
* @return array * @return array
*/ */
function _parseAttributes($attributes) public function _parseAttributes($attributes)
{ {
if (is_array($attributes)) { if (is_array($attributes)) {
$ret = array(); $ret = array();
@ -457,17 +458,6 @@ class HTML_Common
*/ */
function charset($newCharset = null) function charset($newCharset = null)
{ {
// Modified by Ivan Tcholakov, 16-MAR-2010 return 'UTF-8';
//static $charset = 'ISO-8859-1'; }
static $charset;
if (!isset($charset)) {
$charset = api_get_system_encoding();
}
//
if (!is_null($newCharset)) {
$charset = $newCharset;
}
return $charset;
} // end func charset
} }

@ -350,19 +350,19 @@ class HTML_QuickForm extends HTML_Common
if (is_array($filter) && (2 != count($filter) || !is_callable($filter))) { if (is_array($filter) && (2 != count($filter) || !is_callable($filter))) {
foreach ($filter as $val) { foreach ($filter as $val) {
if (!is_callable($val)) { if (!is_callable($val)) {
throw new \Exception("Callback function does not exist in QuickForm::setDefaults()"); throw new \Exception('Callback function does not exist in QuickForm::setDefaults()');
} else { } else {
$defaultValues = $this->_recursiveFilter($val, $defaultValues); $defaultValues = $this->_recursiveFilter($val, $defaultValues);
} }
} }
} elseif (!is_callable($filter)) { } elseif (!is_callable($filter)) {
throw new \Exception("Callback function does not exist in QuickForm::setDefaults()"); throw new \Exception('Callback function does not exist in QuickForm::setDefaults()');
} else { } else {
$defaultValues = $this->_recursiveFilter($filter, $defaultValues); $defaultValues = $this->_recursiveFilter($filter, $defaultValues);
} }
} }
$this->_defaultValues = HTML_QuickForm::arrayMerge($this->_defaultValues, $defaultValues); $this->_defaultValues = self::arrayMerge($this->_defaultValues, $defaultValues);
$this->_constantValues = $this->_defaultValues; $this->_constantValues = $this->_defaultValues;
foreach (array_keys($this->_elements) as $key) { foreach (array_keys($this->_elements) as $key) {
$this->_elements[$key]->onQuickFormEvent('updateValue', null, $this); $this->_elements[$key]->onQuickFormEvent('updateValue', null, $this);

@ -153,6 +153,5 @@ class HTML_QuickForm_Renderer
function finishGroup(&$group) function finishGroup(&$group)
{ {
return; return;
} // end func finishGroup }
} // end class HTML_QuickForm_Renderer }
?>

@ -43,17 +43,15 @@ class HTML_QuickForm_element extends HTML_Common
/** /**
* Label of the field * Label of the field
* @var string * @var string
* @since 1.3
* @access private
*/ */
var $_label = ''; public $_label = '';
/** /**
* Label "for" a field... (Chamilo LMS customization) * Label "for" a field... (Chamilo LMS customization)
* @var string * @var string
* @access private * @access private
*/ */
var $_label_for = ''; public $_label_for = '';
/** /**
* Form element type * Form element type
@ -61,7 +59,7 @@ class HTML_QuickForm_element extends HTML_Common
* @since 1.0 * @since 1.0
* @access private * @access private
*/ */
var $_type = ''; public $_type = '';
/** /**
* Flag to tell if element is frozen * Flag to tell if element is frozen
@ -69,7 +67,7 @@ class HTML_QuickForm_element extends HTML_Common
* @since 1.0 * @since 1.0
* @access private * @access private
*/ */
var $_flagFrozen = false; public $_flagFrozen = false;
/** /**
* Does the element support persistant data when frozen * Does the element support persistant data when frozen
@ -77,7 +75,7 @@ class HTML_QuickForm_element extends HTML_Common
* @since 1.3 * @since 1.3
* @access private * @access private
*/ */
var $_persistantFreeze = false; public $_persistantFreeze = false;
protected $columnsSize; protected $columnsSize;
@ -177,10 +175,7 @@ class HTML_QuickForm_element extends HTML_Common
public function apiVersion() public function apiVersion()
{ {
return 3.2; return 3.2;
} // end func apiVersion }
// }}}
// {{{ getType()
/** /**
* Returns element type * Returns element type
@ -192,10 +187,7 @@ class HTML_QuickForm_element extends HTML_Common
public function getType() public function getType()
{ {
return $this->_type; return $this->_type;
} // end func getType }
// }}}
// {{{ setName()
/** /**
* Sets the input field name * Sets the input field name
@ -207,11 +199,7 @@ class HTML_QuickForm_element extends HTML_Common
*/ */
public function setName($name) public function setName($name)
{ {
// interface method }
} //end func setName
// }}}
// {{{ getName()
/** /**
* Returns the element name * Returns the element name
@ -222,11 +210,7 @@ class HTML_QuickForm_element extends HTML_Common
*/ */
public function getName() public function getName()
{ {
// interface method }
} //end func getName
// }}}
// {{{ setValue()
/** /**
* Sets the value of the form element * Sets the value of the form element
@ -238,11 +222,7 @@ class HTML_QuickForm_element extends HTML_Common
*/ */
public function setValue($value) public function setValue($value)
{ {
// interface }
} // end func setValue
// }}}
// {{{ getValue()
/** /**
* Returns the value of the form element * Returns the value of the form element
@ -287,10 +267,7 @@ class HTML_QuickForm_element extends HTML_Common
public function freeze() public function freeze()
{ {
$this->_flagFrozen = true; $this->_flagFrozen = true;
} //end func freeze }
// }}}
// {{{ unfreeze()
/** /**
* Unfreezes the element so that it becomes editable * Unfreezes the element so that it becomes editable
@ -304,9 +281,6 @@ class HTML_QuickForm_element extends HTML_Common
$this->_flagFrozen = false; $this->_flagFrozen = false;
} }
// }}}
// {{{ getFrozenHtml()
/** /**
* Returns the value of field without HTML tags * Returns the value of field without HTML tags
* *
@ -351,9 +325,6 @@ class HTML_QuickForm_element extends HTML_Common
} }
} }
// }}}
// {{{ isFrozen()
/** /**
* Returns whether or not the element is frozen * Returns whether or not the element is frozen
* *
@ -364,10 +335,7 @@ class HTML_QuickForm_element extends HTML_Common
public function isFrozen() public function isFrozen()
{ {
return $this->_flagFrozen; return $this->_flagFrozen;
} // end func isFrozen }
// }}}
// {{{ setPersistantFreeze()
/** /**
* Sets wether an element value should be kept in an hidden field * Sets wether an element value should be kept in an hidden field
@ -381,10 +349,7 @@ class HTML_QuickForm_element extends HTML_Common
function setPersistantFreeze($persistant=false) function setPersistantFreeze($persistant=false)
{ {
$this->_persistantFreeze = $persistant; $this->_persistantFreeze = $persistant;
} //end func setPersistantFreeze }
// }}}
// {{{ setLabel()
/** /**
* Sets display text for the element * Sets display text for the element
@ -401,10 +366,7 @@ class HTML_QuickForm_element extends HTML_Common
if (!empty($labelFor)) { if (!empty($labelFor)) {
$this->_label_for = $labelFor; $this->_label_for = $labelFor;
} }
} //end func setLabel }
// }}}
// {{{ getLabel()
/** /**
* Returns display text for the element * Returns display text for the element
@ -416,7 +378,7 @@ class HTML_QuickForm_element extends HTML_Common
function getLabel() function getLabel()
{ {
return $this->_label; return $this->_label;
} //end func getLabel }
/** /**
* Returns "for" attribute for the element * Returns "for" attribute for the element
@ -427,10 +389,7 @@ class HTML_QuickForm_element extends HTML_Common
function getLabelFor() function getLabelFor()
{ {
return $this->_label_for; return $this->_label_for;
} //end func getLabelFor }
// }}}
// {{{ _findValue()
/** /**
* Tries to find the element value from the values array * Tries to find the element value from the values array
@ -471,10 +430,7 @@ class HTML_QuickForm_element extends HTML_Common
} else { } else {
return null; return null;
} }
} //end func _findValue }
// }}}
// {{{ onQuickFormEvent()
/** /**
* Called by HTML_QuickForm whenever form event is made on this element * Called by HTML_QuickForm whenever form event is made on this element
@ -569,9 +525,6 @@ class HTML_QuickForm_element extends HTML_Common
return $this->_prepareValue($value, $assoc); return $this->_prepareValue($value, $assoc);
} }
// }}}
// {{{ _prepareValue()
/** /**
* Used by exportValue() to prepare the value for returning * Used by exportValue() to prepare the value for returning
* *
@ -631,8 +584,4 @@ class HTML_QuickForm_element extends HTML_Common
return $this; return $this;
} }
} }

@ -1,6 +1,4 @@
<?php <?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
/** /**
* Base class for <input /> form elements * Base class for <input /> form elements
* *
@ -35,8 +33,6 @@
*/ */
class HTML_QuickForm_input extends HTML_QuickForm_element class HTML_QuickForm_input extends HTML_QuickForm_element
{ {
// {{{ constructor
/** /**
* Class constructor * Class constructor
* *
@ -50,10 +46,7 @@ class HTML_QuickForm_input extends HTML_QuickForm_element
public function __construct($elementName=null, $elementLabel=null, $attributes=null) public function __construct($elementName=null, $elementLabel=null, $attributes=null)
{ {
parent::__construct($elementName, $elementLabel, $attributes); parent::__construct($elementName, $elementLabel, $attributes);
} //end constructor }
// }}}
// {{{ setType()
/** /**
* Sets the element type * Sets the element type
@ -67,10 +60,7 @@ class HTML_QuickForm_input extends HTML_QuickForm_element
{ {
$this->_type = $type; $this->_type = $type;
$this->updateAttributes(array('type'=>$type)); $this->updateAttributes(array('type'=>$type));
} // end func setType }
// }}}
// {{{ setName()
/** /**
* Sets the input field name * Sets the input field name
@ -83,10 +73,7 @@ class HTML_QuickForm_input extends HTML_QuickForm_element
function setName($name) function setName($name)
{ {
$this->updateAttributes(array('name'=>$name)); $this->updateAttributes(array('name'=>$name));
} //end func setName }
// }}}
// {{{ getName()
/** /**
* Returns the element name * Returns the element name
@ -98,10 +85,7 @@ class HTML_QuickForm_input extends HTML_QuickForm_element
function getName() function getName()
{ {
return $this->getAttribute('name'); return $this->getAttribute('name');
} //end func getName }
// }}}
// {{{ setValue()
/** /**
* Sets the value of the form element * Sets the value of the form element
@ -113,11 +97,8 @@ class HTML_QuickForm_input extends HTML_QuickForm_element
*/ */
public function setValue($value) public function setValue($value)
{ {
$this->updateAttributes(array('value'=>$value)); $this->updateAttributes(array('value' => $value));
} // end func setValue }
// }}}
// {{{ getValue()
/** /**
* Returns the value of the form element * Returns the value of the form element
@ -129,10 +110,7 @@ class HTML_QuickForm_input extends HTML_QuickForm_element
public function getValue() public function getValue()
{ {
return $this->getAttribute('value'); return $this->getAttribute('value');
} // end func getValue }
// }}}
// {{{ toHtml()
/** /**
* Returns the input field in HTML * Returns the input field in HTML
@ -148,10 +126,7 @@ class HTML_QuickForm_input extends HTML_QuickForm_element
} else { } else {
return $this->_getTabs() . '<input' . $this->_getAttrString($this->_attributes) . ' />'; return $this->_getTabs() . '<input' . $this->_getAttrString($this->_attributes) . ' />';
} }
} //end func toHtml }
// }}}
// {{{ onQuickFormEvent()
/** /**
* Called by HTML_QuickForm whenever form event is made on this element * Called by HTML_QuickForm whenever form event is made on this element

@ -19,8 +19,6 @@
*/ */
class HTML_QuickForm_label extends HTML_QuickForm_static class HTML_QuickForm_label extends HTML_QuickForm_static
{ {
// {{{ constructor
/** /**
* Class constructor * Class constructor
* *
@ -36,12 +34,4 @@ class HTML_QuickForm_label extends HTML_QuickForm_static
parent::__construct(null, $label, $text, $attributes); parent::__construct(null, $label, $text, $attributes);
$this->_type = 'html'; $this->_type = 'html';
} }
/**
* @return string
*/
public function toHtml()
{
return parent::toHtml();
}
} }

@ -187,9 +187,5 @@ class HTML_QuickForm_link extends HTML_QuickForm_static
function getFrozenHtml() function getFrozenHtml()
{ {
return; return;
} //end func getFrozenHtml }
}
// }}}
} //end class HTML_QuickForm_textarea
?>

@ -2,8 +2,6 @@
class HTML_QuickForm_reset extends HTML_QuickForm_button class HTML_QuickForm_reset extends HTML_QuickForm_button
{ {
// {{{ constructor
/** /**
* Class constructor * Class constructor
* *
@ -20,10 +18,7 @@ class HTML_QuickForm_reset extends HTML_QuickForm_button
parent::__construct($elementName, null, $attributes); parent::__construct($elementName, null, $attributes);
$this->setValue($value); $this->setValue($value);
$this->setType('reset'); $this->setType('reset');
} //end constructor }
// }}}
// {{{ freeze()
/** /**
* Freeze the element so that only its value is returned * Freeze the element so that only its value is returned
@ -34,8 +29,5 @@ class HTML_QuickForm_reset extends HTML_QuickForm_button
function freeze() function freeze()
{ {
return false; return false;
} //end func freeze }
// }}}
} }

@ -32,9 +32,6 @@
*/ */
class HTML_QuickForm_static extends HTML_QuickForm_element class HTML_QuickForm_static extends HTML_QuickForm_element
{ {
// {{{ properties
/** /**
* Display text * Display text
* @var string * @var string
@ -42,9 +39,6 @@ class HTML_QuickForm_static extends HTML_QuickForm_element
*/ */
var $_text = null; var $_text = null;
// }}}
// {{{ constructor
/** /**
* Class constructor * Class constructor
* *
@ -59,10 +53,7 @@ class HTML_QuickForm_static extends HTML_QuickForm_element
$this->_persistantFreeze = false; $this->_persistantFreeze = false;
$this->_type = 'static'; $this->_type = 'static';
$this->_text = $text; $this->_text = $text;
} //end constructor }
// }}}
// {{{ setName()
/** /**
* Sets the element name * Sets the element name
@ -74,10 +65,7 @@ class HTML_QuickForm_static extends HTML_QuickForm_element
function setName($name) function setName($name)
{ {
$this->updateAttributes(array('name'=>$name)); $this->updateAttributes(array('name'=>$name));
} //end func setName }
// }}}
// {{{ getName()
/** /**
* Returns the element name * Returns the element name
@ -88,10 +76,7 @@ class HTML_QuickForm_static extends HTML_QuickForm_element
function getName() function getName()
{ {
return $this->getAttribute('name'); return $this->getAttribute('name');
} //end func getName }
// }}}
// {{{ setText()
/** /**
* Sets the text * Sets the text
@ -103,10 +88,7 @@ class HTML_QuickForm_static extends HTML_QuickForm_element
function setText($text) function setText($text)
{ {
$this->_text = $text; $this->_text = $text;
} // end func setText }
// }}}
// {{{ setValue()
/** /**
* Sets the text (uses the standard setValue call to emulate a form element. * Sets the text (uses the standard setValue call to emulate a form element.
@ -118,10 +100,7 @@ class HTML_QuickForm_static extends HTML_QuickForm_element
function setValue($text) function setValue($text)
{ {
$this->setText($text); $this->setText($text);
} // end func setValue }
// }}}
// {{{ toHtml()
/** /**
* Returns the static text element in HTML * Returns the static text element in HTML
@ -132,10 +111,7 @@ class HTML_QuickForm_static extends HTML_QuickForm_element
public function toHtml() public function toHtml()
{ {
return $this->_getTabs() . $this->_text; return $this->_getTabs() . $this->_text;
} //end func toHtml }
// }}}
// {{{ getFrozenHtml()
/** /**
* Returns the value of field without HTML tags * Returns the value of field without HTML tags
@ -146,10 +122,7 @@ class HTML_QuickForm_static extends HTML_QuickForm_element
function getFrozenHtml() function getFrozenHtml()
{ {
return $this->toHtml(); return $this->toHtml();
} //end func getFrozenHtml }
// }}}
// {{{ onQuickFormEvent()
/** /**
* Called by HTML_QuickForm whenever form event is made on this element * Called by HTML_QuickForm whenever form event is made on this element
@ -179,12 +152,9 @@ class HTML_QuickForm_static extends HTML_QuickForm_element
parent::onQuickFormEvent($event, $arg, $caller); parent::onQuickFormEvent($event, $arg, $caller);
} }
return true; return true;
} // end func onQuickFormEvent }
// }}}
// {{{ exportValue()
/** /**
* We override this here because we don't want any values from static elements * We override this here because we don't want any values from static elements
*/ */
function exportValue(&$submitValues, $assoc = false) function exportValue(&$submitValues, $assoc = false)

@ -34,8 +34,6 @@
*/ */
class HTML_QuickForm_submit extends HTML_QuickForm_input class HTML_QuickForm_submit extends HTML_QuickForm_input
{ {
// {{{ constructor
/** /**
* Class constructor * Class constructor
* *
@ -51,10 +49,7 @@ class HTML_QuickForm_submit extends HTML_QuickForm_input
parent::__construct($elementName, null, $attributes); parent::__construct($elementName, null, $attributes);
$this->setValue($value); $this->setValue($value);
$this->setType('submit'); $this->setType('submit');
} //end constructor }
// }}}
// {{{ freeze()
/** /**
* Freeze the element so that only its value is returned * Freeze the element so that only its value is returned
@ -65,10 +60,7 @@ class HTML_QuickForm_submit extends HTML_QuickForm_input
function freeze() function freeze()
{ {
return false; return false;
} //end func freeze }
// }}}
// {{{ exportValue()
/** /**
* Only return the value if it is found within $submitValues (i.e. if * Only return the value if it is found within $submitValues (i.e. if
@ -79,6 +71,4 @@ class HTML_QuickForm_submit extends HTML_QuickForm_input
return $this->_prepareValue($this->_findValue($submitValues), $assoc); return $this->_prepareValue($this->_findValue($submitValues), $assoc);
} }
// }}} }
} //end class HTML_QuickForm_submit
?>

@ -223,7 +223,7 @@ class HTML_QuickForm_text extends HTML_QuickForm_input
if ($this->isFrozen()) { if ($this->isFrozen()) {
return $this->getFrozenHtml(); return $this->getFrozenHtml();
} else { } else {
return '<input ' . $this->_getAttrString($this->_attributes) . ' />'; return '<input '.$this->_getAttrString($this->_attributes).' />';
} }
} }
} }

@ -40,7 +40,7 @@ class HTML_QuickForm_textarea extends HTML_QuickForm_element
* @since 1.0 * @since 1.0
* @access private * @access private
*/ */
public $_value = null; public $_value;
/** /**
* Class constructor * Class constructor
@ -62,6 +62,7 @@ class HTML_QuickForm_textarea extends HTML_QuickForm_element
parent::__construct($elementName, $elementLabel, $attributes); parent::__construct($elementName, $elementLabel, $attributes);
$this->_persistantFreeze = true; $this->_persistantFreeze = true;
$this->_type = 'textarea'; $this->_type = 'textarea';
$this->_value = null;
} }
/** /**
@ -75,10 +76,7 @@ class HTML_QuickForm_textarea extends HTML_QuickForm_element
function setName($name) function setName($name)
{ {
$this->updateAttributes(array('name'=>$name)); $this->updateAttributes(array('name'=>$name));
} //end func setName }
// }}}
// {{{ getName()
/** /**
* Returns the element name * Returns the element name
@ -90,10 +88,7 @@ class HTML_QuickForm_textarea extends HTML_QuickForm_element
function getName() function getName()
{ {
return $this->getAttribute('name'); return $this->getAttribute('name');
} //end func getName }
// }}}
// {{{ setValue()
/** /**
* Sets value for textarea element * Sets value for textarea element
@ -106,10 +101,7 @@ class HTML_QuickForm_textarea extends HTML_QuickForm_element
function setValue($value) function setValue($value)
{ {
$this->_value = $value; $this->_value = $value;
} //end func setValue }
// }}}
// {{{ getValue()
/** /**
* Returns the value of the form element * Returns the value of the form element
@ -121,10 +113,7 @@ class HTML_QuickForm_textarea extends HTML_QuickForm_element
function getValue() function getValue()
{ {
return $this->_value; return $this->_value;
} // end func getValue }
// }}}
// {{{ setWrap()
/** /**
* Sets wrap type for textarea element * Sets wrap type for textarea element
@ -137,10 +126,7 @@ class HTML_QuickForm_textarea extends HTML_QuickForm_element
function setWrap($wrap) function setWrap($wrap)
{ {
$this->updateAttributes(array('wrap' => $wrap)); $this->updateAttributes(array('wrap' => $wrap));
} //end func setWrap }
// }}}
// {{{ setRows()
/** /**
* Sets height in rows for textarea element * Sets height in rows for textarea element
@ -153,10 +139,7 @@ class HTML_QuickForm_textarea extends HTML_QuickForm_element
function setRows($rows) function setRows($rows)
{ {
$this->updateAttributes(array('rows' => $rows)); $this->updateAttributes(array('rows' => $rows));
} //end func setRows }
// }}}
// {{{ setCols()
/** /**
* Sets width in cols for textarea element * Sets width in cols for textarea element
@ -169,10 +152,7 @@ class HTML_QuickForm_textarea extends HTML_QuickForm_element
function setCols($cols) function setCols($cols)
{ {
$this->updateAttributes(array('cols' => $cols)); $this->updateAttributes(array('cols' => $cols));
} //end func setCols }
// }}}
// {{{ toHtml()
/** /**
* Returns the textarea element in HTML * Returns the textarea element in HTML
@ -191,7 +171,7 @@ class HTML_QuickForm_textarea extends HTML_QuickForm_element
// because we wrap the form later we don't want the text indented // because we wrap the form later we don't want the text indented
// Modified by Ivan Tcholakov, 16-MAR-2010. // Modified by Ivan Tcholakov, 16-MAR-2010.
//preg_replace("/(\r\n|\n|\r)/", '&#010;', htmlspecialchars($this->_value)) . //preg_replace("/(\r\n|\n|\r)/", '&#010;', htmlspecialchars($this->_value)) .
preg_replace("/(\r\n|\n|\r)/", '&#010;', @htmlspecialchars($this->_value, ENT_COMPAT, HTML_Common::charset())) . preg_replace("/(\r\n|\n|\r)/", '&#010;', $this->getCleanValue()) .
// //
'</textarea>'; '</textarea>';
} }
@ -206,10 +186,7 @@ class HTML_QuickForm_textarea extends HTML_QuickForm_element
*/ */
public function getFrozenHtml() public function getFrozenHtml()
{ {
// Modified by Ivan Tcholakov, 16-MAR-2010. $value = $this->getCleanValue();
//$value = htmlspecialchars($this->getValue());
$value = @htmlspecialchars($this->getValue(), ENT_COMPAT, HTML_Common::charset());
//
if ($this->getAttribute('wrap') == 'off') { if ($this->getAttribute('wrap') == 'off') {
$html = $this->_getTabs() . '<pre>' . $value."</pre>\n"; $html = $this->_getTabs() . '<pre>' . $value."</pre>\n";
} else { } else {
@ -281,6 +258,4 @@ class HTML_QuickForm_textarea extends HTML_QuickForm_element
break; break;
} }
} }
} }

Loading…
Cancel
Save