Skip to content

Instantly share code, notes, and snippets.

@seamuslee001
Last active August 24, 2021 23:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save seamuslee001/0bc090be3643e1b965c9429e5c924ed4 to your computer and use it in GitHub Desktop.
Save seamuslee001/0bc090be3643e1b965c9429e5c924ed4 to your computer and use it in GitHub Desktop.
diff -ruwN _ORIGINAL_/HTML/QuickForm/Action/Back.php HTML/QuickForm/Action/Back.php
--- _ORIGINAL_/HTML/QuickForm/Action/Back.php 2021-08-25 09:24:31.902785868 +1000
+++ HTML/QuickForm/Action/Back.php 2021-05-23 06:58:15.325915587 +1000
@@ -15,9 +15,9 @@
* @category HTML
* @package HTML_QuickForm_Controller
* @author Alexey Borzov <avb@php.net>
- * @copyright 2003-2009 The PHP Group
+ * @copyright 2003-2007 The PHP Group
* @license http://www.php.net/license/3_01.txt PHP License 3.01
- * @version SVN: $Id: Back.php 289084 2009-10-02 06:53:09Z avb $
+ * @version CVS: $Id: Back.php,v 1.6 2007/05/18 09:34:18 avb Exp $
* @link http://pear.php.net/package/HTML_QuickForm_Controller
*/
@@ -32,7 +32,7 @@
* @category HTML
* @package HTML_QuickForm_Controller
* @author Alexey Borzov <avb@php.net>
- * @version Release: 1.0.10
+ * @version Release: 1.0.9
*/
class HTML_QuickForm_Action_Back extends HTML_QuickForm_Action
{
diff -ruwN _ORIGINAL_/HTML/QuickForm/Action/Direct.php HTML/QuickForm/Action/Direct.php
--- _ORIGINAL_/HTML/QuickForm/Action/Direct.php 2021-08-25 09:24:31.902785868 +1000
+++ HTML/QuickForm/Action/Direct.php 2021-05-23 06:58:15.325915587 +1000
@@ -15,9 +15,9 @@
* @category HTML
* @package HTML_QuickForm_Controller
* @author Alexey Borzov <avb@php.net>
- * @copyright 2003-2009 The PHP Group
+ * @copyright 2003-2007 The PHP Group
* @license http://www.php.net/license/3_01.txt PHP License 3.01
- * @version SVN: $Id: Direct.php 289084 2009-10-02 06:53:09Z avb $
+ * @version CVS: $Id: Direct.php,v 1.4 2007/05/18 09:34:18 avb Exp $
* @link http://pear.php.net/package/HTML_QuickForm_Controller
*/
@@ -35,7 +35,7 @@
* @category HTML
* @package HTML_QuickForm_Controller
* @author Alexey Borzov <avb@php.net>
- * @version Release: 1.0.10
+ * @version Release: 1.0.9
*/
class HTML_QuickForm_Action_Direct extends HTML_QuickForm_Action
{
diff -ruwN _ORIGINAL_/HTML/QuickForm/Action/Display.php HTML/QuickForm/Action/Display.php
--- _ORIGINAL_/HTML/QuickForm/Action/Display.php 2021-08-25 09:24:31.902785868 +1000
+++ HTML/QuickForm/Action/Display.php 2021-05-23 06:58:15.325915587 +1000
@@ -15,9 +15,9 @@
* @category HTML
* @package HTML_QuickForm_Controller
* @author Alexey Borzov <avb@php.net>
- * @copyright 2003-2009 The PHP Group
+ * @copyright 2003-2007 The PHP Group
* @license http://www.php.net/license/3_01.txt PHP License 3.01
- * @version SVN: $Id: Display.php 289084 2009-10-02 06:53:09Z avb $
+ * @version CVS: $Id: Display.php,v 1.7 2007/05/18 09:34:18 avb Exp $
* @link http://pear.php.net/package/HTML_QuickForm_Controller
*/
@@ -36,7 +36,7 @@
* @category HTML
* @package HTML_QuickForm_Controller
* @author Alexey Borzov <avb@php.net>
- * @version Release: 1.0.10
+ * @version Release: 1.0.9
*/
class HTML_QuickForm_Action_Display extends HTML_QuickForm_Action
{
diff -ruwN _ORIGINAL_/HTML/QuickForm/Action/Jump.php HTML/QuickForm/Action/Jump.php
--- _ORIGINAL_/HTML/QuickForm/Action/Jump.php 2021-08-25 09:24:31.902785868 +1000
+++ HTML/QuickForm/Action/Jump.php 2021-05-23 06:58:15.325915587 +1000
@@ -15,9 +15,9 @@
* @category HTML
* @package HTML_QuickForm_Controller
* @author Alexey Borzov <avb@php.net>
- * @copyright 2003-2009 The PHP Group
+ * @copyright 2003-2007 The PHP Group
* @license http://www.php.net/license/3_01.txt PHP License 3.01
- * @version SVN: $Id: Jump.php 289084 2009-10-02 06:53:09Z avb $
+ * @version CVS: $Id: Jump.php,v 1.6 2008/07/22 11:05:20 avb Exp $
* @link http://pear.php.net/package/HTML_QuickForm_Controller
*/
@@ -32,7 +32,7 @@
* @category HTML
* @package HTML_QuickForm_Controller
* @author Alexey Borzov <avb@php.net>
- * @version Release: 1.0.10
+ * @version Release: 1.0.9
*/
class HTML_QuickForm_Action_Jump extends HTML_QuickForm_Action
{
@@ -102,7 +102,7 @@
*/
function _resolveRelativeURL($url)
{
- $https = !empty($_SERVER['HTTPS']) && ('off' != strtolower($_SERVER['HTTPS']));
+ $https = !empty($_SERVER['HTTPS']) && ('off' != $_SERVER['HTTPS']);
$scheme = ($https? 'https:': 'http:');
if ('//' == substr($url, 0, 2)) {
return $scheme . $url;
diff -ruwN _ORIGINAL_/HTML/QuickForm/Action/Next.php HTML/QuickForm/Action/Next.php
--- _ORIGINAL_/HTML/QuickForm/Action/Next.php 2021-08-25 09:24:31.902785868 +1000
+++ HTML/QuickForm/Action/Next.php 2021-05-23 06:58:15.325915587 +1000
@@ -15,9 +15,9 @@
* @category HTML
* @package HTML_QuickForm_Controller
* @author Alexey Borzov <avb@php.net>
- * @copyright 2003-2009 The PHP Group
+ * @copyright 2003-2007 The PHP Group
* @license http://www.php.net/license/3_01.txt PHP License 3.01
- * @version SVN: $Id: Next.php 289084 2009-10-02 06:53:09Z avb $
+ * @version CVS: $Id: Next.php,v 1.6 2007/05/18 09:34:18 avb Exp $
* @link http://pear.php.net/package/HTML_QuickForm_Controller
*/
@@ -32,7 +32,7 @@
* @category HTML
* @package HTML_QuickForm_Controller
* @author Alexey Borzov <avb@php.net>
- * @version Release: 1.0.10
+ * @version Release: 1.0.9
*/
class HTML_QuickForm_Action_Next extends HTML_QuickForm_Action
{
diff -ruwN _ORIGINAL_/HTML/QuickForm/Action/Submit.php HTML/QuickForm/Action/Submit.php
--- _ORIGINAL_/HTML/QuickForm/Action/Submit.php 2021-08-25 09:24:31.902785868 +1000
+++ HTML/QuickForm/Action/Submit.php 2021-05-23 06:58:15.325915587 +1000
@@ -15,9 +15,9 @@
* @category HTML
* @package HTML_QuickForm_Controller
* @author Alexey Borzov <avb@php.net>
- * @copyright 2003-2009 The PHP Group
+ * @copyright 2003-2007 The PHP Group
* @license http://www.php.net/license/3_01.txt PHP License 3.01
- * @version SVN: $Id: Submit.php 289084 2009-10-02 06:53:09Z avb $
+ * @version CVS: $Id: Submit.php,v 1.5 2007/05/18 09:34:18 avb Exp $
* @link http://pear.php.net/package/HTML_QuickForm_Controller
*/
@@ -32,7 +32,7 @@
* @category HTML
* @package HTML_QuickForm_Controller
* @author Alexey Borzov <avb@php.net>
- * @version Release: 1.0.10
+ * @version Release: 1.0.9
*/
class HTML_QuickForm_Action_Submit extends HTML_QuickForm_Action
{
diff -ruwN _ORIGINAL_/HTML/QuickForm/Action.php HTML/QuickForm/Action.php
--- _ORIGINAL_/HTML/QuickForm/Action.php 2021-08-25 09:24:31.902785868 +1000
+++ HTML/QuickForm/Action.php 2021-05-23 06:58:15.325915587 +1000
@@ -15,9 +15,9 @@
* @category HTML
* @package HTML_QuickForm_Controller
* @author Alexey Borzov <avb@php.net>
- * @copyright 2003-2009 The PHP Group
+ * @copyright 2003-2007 The PHP Group
* @license http://www.php.net/license/3_01.txt PHP License 3.01
- * @version SVN: $Id: Action.php 289084 2009-10-02 06:53:09Z avb $
+ * @version CVS: $Id: Action.php,v 1.3 2007/05/18 09:34:18 avb Exp $
* @link http://pear.php.net/package/HTML_QuickForm_Controller
*/
@@ -31,7 +31,7 @@
* @category HTML
* @package HTML_QuickForm_Controller
* @author Alexey Borzov <avb@php.net>
- * @version Release: 1.0.10
+ * @version Release: 1.0.9
* @abstract
*/
class HTML_QuickForm_Action
diff -ruwN _ORIGINAL_/HTML/QuickForm/advcheckbox.php HTML/QuickForm/advcheckbox.php
--- _ORIGINAL_/HTML/QuickForm/advcheckbox.php 2021-08-25 09:24:31.890785757 +1000
+++ HTML/QuickForm/advcheckbox.php 2021-05-23 06:58:15.329915618 +1000
@@ -86,9 +86,9 @@
* @access public
* @return void
*/
- function HTML_QuickForm_advcheckbox($elementName=null, $elementLabel=null, $text=null, $attributes=null, $values=null)
+ function __construct($elementName=null, $elementLabel=null, $text=null, $attributes=null, $values=null)
{
- $this->HTML_QuickForm_checkbox($elementName, $elementLabel, $text, $attributes);
+ parent::__construct($elementName, $elementLabel, $text, $attributes);
$this->setValues($values);
} //end constructor
diff -ruwN _ORIGINAL_/HTML/QuickForm/advmultiselect.php HTML/QuickForm/advmultiselect.php
--- _ORIGINAL_/HTML/QuickForm/advmultiselect.php 2021-08-25 09:24:31.906785905 +1000
+++ HTML/QuickForm/advmultiselect.php 2021-05-23 06:58:15.329915618 +1000
@@ -63,7 +63,7 @@
* @author Laurent Laville <pear@laurent-laville.org>
* @copyright 2005-2009 Laurent Laville
* @license http://www.opensource.org/licenses/bsd-license.php BSD
- * @version Release: @package_version@
+ * @version Release: 1.5.1
* @link http://pear.php.net/package/HTML_QuickForm_advmultiselect
* @since Class available since Release 0.4.0
*/
@@ -272,13 +272,13 @@
* @return void
* @since version 0.4.0 (2005-06-25)
*/
- function HTML_QuickForm_advmultiselect($elementName = null, $elementLabel = null,
+ function __construct($elementName = null, $elementLabel = null,
$options = null, $attributes = null,
$sort = null)
{
$opts = $options;
$options = null; // prevent to use the default select element load options
- $this->HTML_QuickForm_select($elementName, $elementLabel,
+ parent::__construct($elementName, $elementLabel,
$options, $attributes);
// allow to load options at once and take care of fancy attributes
@@ -725,7 +725,7 @@
$attrHidden = $this->_getAttrString($this->_attributesHidden);
// prepare option tables to be displayed as in POST order
- $append = count($this->_values);
+ $append = ($this->_values === NULL ? 0 : count($this->_values));
if ($append > 0) {
$arrHtmlSelected = array_fill(0, $append, ' ');
} else {
@@ -1010,8 +1010,7 @@
*/
function getElementJs($raw = true, $min = false)
{
- $js = '@data_dir@' . DIRECTORY_SEPARATOR
- . '@package_name@' . DIRECTORY_SEPARATOR;
+ $js = Civi::paths()->getPath('[civicrm.packages]/data/HTML_QuickForm_advmultiselect/');
if ($min) {
$js .= 'qfamsHandler-min.js';
diff -ruwN _ORIGINAL_/HTML/QuickForm/autocomplete.php HTML/QuickForm/autocomplete.php
--- _ORIGINAL_/HTML/QuickForm/autocomplete.php 2021-08-25 09:24:31.890785757 +1000
+++ HTML/QuickForm/autocomplete.php 2021-05-23 06:58:15.329915618 +1000
@@ -84,9 +84,9 @@
* @access public
* @return void
*/
- function HTML_QuickForm_autocomplete($elementName = null, $elementLabel = null, $options = null, $attributes = null)
+ function __construct($elementName = null, $elementLabel = null, $options = null, $attributes = null)
{
- $this->HTML_QuickForm_text($elementName, $elementLabel, $attributes);
+ parent::__construct($elementName, $elementLabel, $attributes);
$this->_persistantFreeze = true;
$this->_type = 'autocomplete';
if (isset($options)) {
diff -ruwN _ORIGINAL_/HTML/QuickForm/button.php HTML/QuickForm/button.php
--- _ORIGINAL_/HTML/QuickForm/button.php 2021-08-25 09:24:31.890785757 +1000
+++ HTML/QuickForm/button.php 2021-05-23 06:58:15.329915618 +1000
@@ -52,9 +52,9 @@
* @access public
* @return void
*/
- function HTML_QuickForm_button($elementName=null, $value=null, $attributes=null)
+ function __construct($elementName=null, $value=null, $attributes=null)
{
- HTML_QuickForm_input::HTML_QuickForm_input($elementName, null, $attributes);
+ parent::__construct($elementName, null, $attributes);
$this->_persistantFreeze = false;
$this->setValue($value);
$this->setType('button');
diff -ruwN _ORIGINAL_/HTML/QuickForm/checkbox.php HTML/QuickForm/checkbox.php
--- _ORIGINAL_/HTML/QuickForm/checkbox.php 2021-08-25 09:24:31.890785757 +1000
+++ HTML/QuickForm/checkbox.php 2021-05-23 06:58:15.329915618 +1000
@@ -66,9 +66,19 @@
* @access public
* @return void
*/
- function HTML_QuickForm_checkbox($elementName=null, $elementLabel=null, $text='', $attributes=null)
+ function __construct($elementName=null, $elementLabel=null, $text='', $attributes=null)
{
- HTML_QuickForm_input::HTML_QuickForm_input($elementName, $elementLabel, $attributes);
+ //hack to add 'id' for checkbox
+ if ( !$attributes ) {
+ $attributes = array( 'id' => $elementName );
+ } else {
+ // set element id only if its not set
+ if ( !isset( $attributes['id'] ) ) {
+ $attributes['id'] = $elementName;
+ }
+ }
+
+ parent::__construct($elementName, $elementLabel, $attributes);
$this->_persistantFreeze = true;
$this->_text = $text;
$this->setType('checkbox');
@@ -123,13 +133,17 @@
*/
function toHtml()
{
+ $attributes = $this->getAttributes();
+
if (0 == strlen($this->_text)) {
$label = '';
- } elseif ($this->_flagFrozen) {
+ } elseif ($this->_flagFrozen || isset( $attributes['skiplabel']) ) {
$label = $this->_text;
} else {
$label = '<label for="' . $this->getAttribute('id') . '">' . $this->_text . '</label>';
}
+
+ unset( $attributes['skipLabel'] );
return HTML_QuickForm_input::toHtml() . $label;
} //end func toHtml
diff -ruwN _ORIGINAL_/HTML/QuickForm/Controller.php HTML/QuickForm/Controller.php
--- _ORIGINAL_/HTML/QuickForm/Controller.php 2021-08-25 09:24:31.902785868 +1000
+++ HTML/QuickForm/Controller.php 2021-05-23 06:58:15.325915587 +1000
@@ -16,9 +16,9 @@
* @package HTML_QuickForm_Controller
* @author Alexey Borzov <avb@php.net>
* @author Bertrand Mansion <bmansion@mamasam.com>
- * @copyright 2003-2009 The PHP Group
+ * @copyright 2003-2007 The PHP Group
* @license http://www.php.net/license/3_01.txt PHP License 3.01
- * @version SVN: $Id: Controller.php 289084 2009-10-02 06:53:09Z avb $
+ * @version CVS: $Id: Controller.php,v 1.13 2007/05/18 09:34:18 avb Exp $
* @link http://pear.php.net/package/HTML_QuickForm_Controller
*/
@@ -40,7 +40,7 @@
* @package HTML_QuickForm_Controller
* @author Alexey Borzov <avb@php.net>
* @author Bertrand Mansion <bmansion@mamasam.com>
- * @version Release: 1.0.10
+ * @version Release: 1.0.9
*/
class HTML_QuickForm_Controller
{
@@ -86,7 +86,7 @@
* @param string form name
* @param bool whether the form is modal
*/
- function HTML_QuickForm_Controller($name, $modal = true)
+ function __construct($name, $modal = true)
{
$this->_name = $name;
$this->_modal = $modal;
@@ -149,9 +149,9 @@
* @param string name of the action
* @param HTML_QuickForm_Action the handler for the action
*/
- function addAction($actionName, &$action)
+ function addAction($actionName, $action)
{
- $this->_actions[$actionName] =& $action;
+ $this->_actions[$actionName] = $action;
}
@@ -210,7 +210,7 @@
case 'jump':
include_once 'HTML/QuickForm/Action/' . ucfirst($actionName) . '.php';
$className = 'HTML_QuickForm_Action_' . $actionName;
- $this->_actions[$actionName] =& new $className();
+ $this->_actions[$actionName] = new $className();
return $this->_actions[$actionName]->perform($page, $actionName);
break;
default:
@@ -218,7 +218,6 @@
} // switch
}
-
/**
* Checks whether the form is modal.
*
@@ -347,9 +346,15 @@
return $this->_actionName;
}
$names = array_map('preg_quote', array_keys($this->_pages));
- $regex = '/^_qf_(' . implode('|', $names) . ')_(.+?)(_x)?$/';
+ $regex = '/^_qf_(' . implode('|', $names) . ')_(.+?)(_.+?)?(_x)?$/';
+ $data =& $this->container();
+ unset( $data['_qf_button_name'] );
foreach (array_keys($_REQUEST) as $key) {
if (preg_match($regex, $key, $matches)) {
+ $data['_qf_button_name'] = $key;
+ if ( array_key_exists( 3, $matches ) ) {
+ $key = preg_replace( '/_(x|y)$/', '', $key );
+ }
return array($matches[1], $matches[2]);
}
}
@@ -514,5 +519,23 @@
$data =& $this->container();
return isset($data['values'][$pageName][$elementName])? $data['values'][$pageName][$elementName]: null;
}
+
+ /**
+ * resets a specifc page in the container
+ *
+ * @access public
+ * @param string name of the page
+ * @return void
+ */
+ function resetPage($pageName, $valid = null)
+ {
+ $data =& $this->container();
+ if (isset($data['values'][$pageName]) ||
+ isset($data['valid'][$pageName])) {
+ $data['values'][$pageName] = array( );
+ $data['valid'][$pageName] = $valid;
+ }
+ }
+
}
?>
diff -ruwN _ORIGINAL_/HTML/QuickForm/date.php HTML/QuickForm/date.php
--- _ORIGINAL_/HTML/QuickForm/date.php 2021-08-25 09:24:31.894785793 +1000
+++ HTML/QuickForm/date.php 2021-05-23 06:58:15.329915618 +1000
@@ -53,7 +53,6 @@
* @var array
*/
var $_options = array(
- 'language' => 'en',
'format' => 'dMY',
'minYear' => 2001,
'maxYear' => null, // set in the constructor
@@ -71,184 +70,12 @@
var $_wrap = array('', '');
/**
- * Options in different languages
- *
- * Note to potential translators: to avoid encoding problems please send
- * your translations with "weird" letters encoded as HTML Unicode entities
+ * Locale array build from CRM_Utils_Date-provided names
*
* @access private
* @var array
*/
- var $_locale = array(
- 'en' => array (
- 'weekdays_short'=> array ('Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'),
- 'weekdays_long' => array ('Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'),
- 'months_short' => array ('Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'),
- 'months_long' => array ('January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December')
- ),
- 'de' => array (
- 'weekdays_short'=> array ('So', 'Mon', 'Di', 'Mi', 'Do', 'Fr', 'Sa'),
- 'weekdays_long' => array ('Sonntag', 'Montag', 'Dienstag', 'Mittwoch', 'Donnerstag', 'Freitag', 'Samstag'),
- 'months_short' => array ('Jan', 'Feb', 'M&#xe4;rz', 'April', 'Mai', 'Juni', 'Juli', 'Aug', 'Sept', 'Okt', 'Nov', 'Dez'),
- 'months_long' => array ('Januar', 'Februar', 'M&#xe4;rz', 'April', 'Mai', 'Juni', 'Juli', 'August', 'September', 'Oktober', 'November', 'Dezember')
- ),
- 'fr' => array (
- 'weekdays_short'=> array ('Dim', 'Lun', 'Mar', 'Mer', 'Jeu', 'Ven', 'Sam'),
- 'weekdays_long' => array ('Dimanche', 'Lundi', 'Mardi', 'Mercredi', 'Jeudi', 'Vendredi', 'Samedi'),
- 'months_short' => array ('Jan', 'F&#xe9;v', 'Mar', 'Avr', 'Mai', 'Juin', 'Juil', 'Ao&#xfb;t', 'Sep', 'Oct', 'Nov', 'D&#xe9;c'),
- 'months_long' => array ('Janvier', 'F&#xe9;vrier', 'Mars', 'Avril', 'Mai', 'Juin', 'Juillet', 'Ao&#xfb;t', 'Septembre', 'Octobre', 'Novembre', 'D&#xe9;cembre')
- ),
- 'hu' => array (
- 'weekdays_short'=> array ('V', 'H', 'K', 'Sze', 'Cs', 'P', 'Szo'),
- 'weekdays_long' => array ('vas&#xe1;rnap', 'h&#xe9;tf&#x151;', 'kedd', 'szerda', 'cs&#xfc;t&#xf6;rt&#xf6;k', 'p&#xe9;ntek', 'szombat'),
- 'months_short' => array ('jan', 'feb', 'm&#xe1;rc', '&#xe1;pr', 'm&#xe1;j', 'j&#xfa;n', 'j&#xfa;l', 'aug', 'szept', 'okt', 'nov', 'dec'),
- 'months_long' => array ('janu&#xe1;r', 'febru&#xe1;r', 'm&#xe1;rcius', '&#xe1;prilis', 'm&#xe1;jus', 'j&#xfa;nius', 'j&#xfa;lius', 'augusztus', 'szeptember', 'okt&#xf3;ber', 'november', 'december')
- ),
- 'pl' => array (
- 'weekdays_short'=> array ('Nie', 'Pn', 'Wt', '&#x15a;r', 'Czw', 'Pt', 'Sob'),
- 'weekdays_long' => array ('Niedziela', 'Poniedzia&#x142;ek', 'Wtorek', '&#x15a;roda', 'Czwartek', 'Pi&#x105;tek', 'Sobota'),
- 'months_short' => array ('Sty', 'Lut', 'Mar', 'Kwi', 'Maj', 'Cze', 'Lip', 'Sie', 'Wrz', 'Pa&#x17a;', 'Lis', 'Gru'),
- 'months_long' => array ('Stycze&#x144;', 'Luty', 'Marzec', 'Kwiecie&#x144;', 'Maj', 'Czerwiec', 'Lipiec', 'Sierpie&#x144;', 'Wrzesie&#x144;', 'Pa&#x17a;dziernik', 'Listopad', 'Grudzie&#x144;')
- ),
- 'sl' => array (
- 'weekdays_short'=> array ('Ned', 'Pon', 'Tor', 'Sre', 'Cet', 'Pet', 'Sob'),
- 'weekdays_long' => array ('Nedelja', 'Ponedeljek', 'Torek', 'Sreda', 'Cetrtek', 'Petek', 'Sobota'),
- 'months_short' => array ('Jan', 'Feb', 'Mar', 'Apr', 'Maj', 'Jun', 'Jul', 'Avg', 'Sep', 'Okt', 'Nov', 'Dec'),
- 'months_long' => array ('Januar', 'Februar', 'Marec', 'April', 'Maj', 'Junij', 'Julij', 'Avgust', 'September', 'Oktober', 'November', 'December')
- ),
- 'ru' => array (
- 'weekdays_short'=> array ('&#x412;&#x441;', '&#x41f;&#x43d;', '&#x412;&#x442;', '&#x421;&#x440;', '&#x427;&#x442;', '&#x41f;&#x442;', '&#x421;&#x431;'),
- 'weekdays_long' => array ('&#x412;&#x43e;&#x441;&#x43a;&#x440;&#x435;&#x441;&#x435;&#x43d;&#x44c;&#x435;', '&#x41f;&#x43e;&#x43d;&#x435;&#x434;&#x435;&#x43b;&#x44c;&#x43d;&#x438;&#x43a;', '&#x412;&#x442;&#x43e;&#x440;&#x43d;&#x438;&#x43a;', '&#x421;&#x440;&#x435;&#x434;&#x430;', '&#x427;&#x435;&#x442;&#x432;&#x435;&#x440;&#x433;', '&#x41f;&#x44f;&#x442;&#x43d;&#x438;&#x446;&#x430;', '&#x421;&#x443;&#x431;&#x431;&#x43e;&#x442;&#x430;'),
- 'months_short' => array ('&#x42f;&#x43d;&#x432;', '&#x424;&#x435;&#x432;', '&#x41c;&#x430;&#x440;', '&#x410;&#x43f;&#x440;', '&#x41c;&#x430;&#x439;', '&#x418;&#x44e;&#x43d;', '&#x418;&#x44e;&#x43b;', '&#x410;&#x432;&#x433;', '&#x421;&#x435;&#x43d;', '&#x41e;&#x43a;&#x442;', '&#x41d;&#x43e;&#x44f;', '&#x414;&#x435;&#x43a;'),
- 'months_long' => array ('&#x42f;&#x43d;&#x432;&#x430;&#x440;&#x44c;', '&#x424;&#x435;&#x432;&#x440;&#x430;&#x43b;&#x44c;', '&#x41c;&#x430;&#x440;&#x442;', '&#x410;&#x43f;&#x440;&#x435;&#x43b;&#x44c;', '&#x41c;&#x430;&#x439;', '&#x418;&#x44e;&#x43d;&#x44c;', '&#x418;&#x44e;&#x43b;&#x44c;', '&#x410;&#x432;&#x433;&#x443;&#x441;&#x442;', '&#x421;&#x435;&#x43d;&#x442;&#x44f;&#x431;&#x440;&#x44c;', '&#x41e;&#x43a;&#x442;&#x44f;&#x431;&#x440;&#x44c;', '&#x41d;&#x43e;&#x44f;&#x431;&#x440;&#x44c;', '&#x414;&#x435;&#x43a;&#x430;&#x431;&#x440;&#x44c;')
- ),
- 'es' => array (
- 'weekdays_short'=> array ('Dom', 'Lun', 'Mar', 'Mi&#xe9;', 'Jue', 'Vie', 'S&#xe1;b'),
- 'weekdays_long' => array ('Domingo', 'Lunes', 'Martes', 'Mi&#xe9;rcoles', 'Jueves', 'Viernes', 'S&#xe1;bado'),
- 'months_short' => array ('Ene', 'Feb', 'Mar', 'Abr', 'May', 'Jun', 'Jul', 'Ago', 'Sep', 'Oct', 'Nov', 'Dic'),
- 'months_long' => array ('Enero', 'Febrero', 'Marzo', 'Abril', 'Mayo', 'Junio', 'Julio', 'Agosto', 'Septiembre', 'Octubre', 'Noviembre', 'Diciembre')
- ),
- 'da' => array (
- 'weekdays_short'=> array ('S&#xf8;n', 'Man', 'Tir', 'Ons', 'Tor', 'Fre', 'L&#xf8;r'),
- 'weekdays_long' => array ('S&#xf8;ndag', 'Mandag', 'Tirsdag', 'Onsdag', 'Torsdag', 'Fredag', 'L&#xf8;rdag'),
- 'months_short' => array ('Jan', 'Feb', 'Mar', 'Apr', 'Maj', 'Jun', 'Jul', 'Aug', 'Sep', 'Okt', 'Nov', 'Dec'),
- 'months_long' => array ('Januar', 'Februar', 'Marts', 'April', 'Maj', 'Juni', 'Juli', 'August', 'September', 'Oktober', 'November', 'December')
- ),
- 'is' => array (
- 'weekdays_short'=> array ('Sun', 'M&#xe1;n', '&#xde;ri', 'Mi&#xf0;', 'Fim', 'F&#xf6;s', 'Lau'),
- 'weekdays_long' => array ('Sunnudagur', 'M&#xe1;nudagur', '&#xde;ri&#xf0;judagur', 'Mi&#xf0;vikudagur', 'Fimmtudagur', 'F&#xf6;studagur', 'Laugardagur'),
- 'months_short' => array ('Jan', 'Feb', 'Mar', 'Apr', 'Ma&#xed;', 'J&#xfa;n', 'J&#xfa;l', '&#xc1;g&#xfa;', 'Sep', 'Okt', 'N&#xf3;v', 'Des'),
- 'months_long' => array ('Jan&#xfa;ar', 'Febr&#xfa;ar', 'Mars', 'Apr&#xed;l', 'Ma&#xed;', 'J&#xfa;n&#xed;', 'J&#xfa;l&#xed;', '&#xc1;g&#xfa;st', 'September', 'Okt&#xf3;ber', 'N&#xf3;vember', 'Desember')
- ),
- 'it' => array (
- 'weekdays_short'=> array ('Dom', 'Lun', 'Mar', 'Mer', 'Gio', 'Ven', 'Sab'),
- 'weekdays_long' => array ('Domenica', 'Luned&#xec;', 'Marted&#xec;', 'Mercoled&#xec;', 'Gioved&#xec;', 'Venerd&#xec;', 'Sabato'),
- 'months_short' => array ('Gen', 'Feb', 'Mar', 'Apr', 'Mag', 'Giu', 'Lug', 'Ago', 'Set', 'Ott', 'Nov', 'Dic'),
- 'months_long' => array ('Gennaio', 'Febbraio', 'Marzo', 'Aprile', 'Maggio', 'Giugno', 'Luglio', 'Agosto', 'Settembre', 'Ottobre', 'Novembre', 'Dicembre')
- ),
- 'sk' => array (
- 'weekdays_short'=> array ('Ned', 'Pon', 'Uto', 'Str', '&#x8a;tv', 'Pia', 'Sob'),
- 'weekdays_long' => array ('Nede&#x17e;a', 'Pondelok', 'Utorok', 'Streda', '&#x8a;tvrtok', 'Piatok', 'Sobota'),
- 'months_short' => array ('Jan', 'Feb', 'Mar', 'Apr', 'M&#xe1;j', 'J&#xfa;n', 'J&#xfa;l', 'Aug', 'Sep', 'Okt', 'Nov', 'Dec'),
- 'months_long' => array ('Janu&#xe1;r', 'Febru&#xe1;r', 'Marec', 'Apr&#xed;l', 'M&#xe1;j', 'J&#xfa;n', 'J&#xfa;l', 'August', 'September', 'Okt&#xf3;ber', 'November', 'December')
- ),
- 'cs' => array (
- 'weekdays_short'=> array ('Ne', 'Po', '&#xda;t', 'St', '&#x10c;t', 'P&#xe1;', 'So'),
- 'weekdays_long' => array ('Ned&#x11b;le', 'Pond&#x11b;l&#xed;', '&#xda;ter&#xfd;', 'St&#x159;eda', '&#x10c;tvrtek', 'P&#xe1;tek', 'Sobota'),
- 'months_short' => array ('Led', '&#xda;no', 'B&#x159;e', 'Dub', 'Kv&#x11b;', '&#x10c;en', '&#x10c;ec', 'Srp', 'Z&#xe1;&#x159;', '&#x158;&#xed;j', 'Lis', 'Pro'),
- 'months_long' => array ('Leden', '&#xda;nor', 'B&#x159;ezen', 'Duben', 'Kv&#x11b;ten', '&#x10c;erven', '&#x10c;ervenec', 'Srpen', 'Z&#xe1;&#x159;&#xed;', '&#x158;&#xed;jen', 'Listopad', 'Prosinec')
- ),
- 'hy' => array (
- 'weekdays_short'=> array ('&#x53f;&#x580;&#x56f;', '&#x535;&#x580;&#x56f;', '&#x535;&#x580;&#x584;', '&#x549;&#x580;&#x584;', '&#x540;&#x576;&#x563;', '&#x548;&#x582;&#x580;', '&#x547;&#x562;&#x569;'),
- 'weekdays_long' => array ('&#x53f;&#x56b;&#x580;&#x561;&#x56f;&#x56b;', '&#x535;&#x580;&#x56f;&#x578;&#x582;&#x577;&#x561;&#x562;&#x569;&#x56b;', '&#x535;&#x580;&#x565;&#x584;&#x577;&#x561;&#x562;&#x569;&#x56b;', '&#x549;&#x578;&#x580;&#x565;&#x584;&#x577;&#x561;&#x562;&#x569;&#x56b;', '&#x540;&#x56b;&#x576;&#x563;&#x577;&#x561;&#x562;&#x569;&#x56b;', '&#x548;&#x582;&#x580;&#x562;&#x561;&#x569;', '&#x547;&#x561;&#x562;&#x561;&#x569;'),
- 'months_short' => array ('&#x540;&#x576;&#x57e;', '&#x553;&#x57f;&#x580;', '&#x544;&#x580;&#x57f;', '&#x531;&#x57a;&#x580;', '&#x544;&#x575;&#x57d;', '&#x540;&#x576;&#x57d;', '&#x540;&#x56c;&#x57d;', '&#x555;&#x563;&#x57d;', '&#x54d;&#x57a;&#x57f;', '&#x540;&#x56f;&#x57f;', '&#x546;&#x575;&#x574;', '&#x534;&#x56f;&#x57f;'),
- 'months_long' => array ('&#x540;&#x578;&#x582;&#x576;&#x57e;&#x561;&#x580;', '&#x553;&#x565;&#x57f;&#x580;&#x57e;&#x561;&#x580;', '&#x544;&#x561;&#x580;&#x57f;', '&#x531;&#x57a;&#x580;&#x56b;&#x56c;', '&#x544;&#x561;&#x575;&#x56b;&#x57d;', '&#x540;&#x578;&#x582;&#x576;&#x56b;&#x57d;', '&#x540;&#x578;&#x582;&#x56c;&#x56b;&#x57d;', '&#x555;&#x563;&#x578;&#x57d;&#x57f;&#x578;&#x57d;', '&#x54d;&#x565;&#x57a;&#x57f;&#x565;&#x574;&#x562;&#x565;&#x580;', '&#x540;&#x578;&#x56f;&#x57f;&#x565;&#x574;&#x562;&#x565;&#x580;', '&#x546;&#x578;&#x575;&#x565;&#x574;&#x562;&#x565;&#x580;', '&#x534;&#x565;&#x56f;&#x57f;&#x565;&#x574;&#x562;&#x565;&#x580;')
- ),
- 'nl' => array (
- 'weekdays_short'=> array ('Zo', 'Ma', 'Di', 'Wo', 'Do', 'Vr', 'Za'),
- 'weekdays_long' => array ('Zondag', 'Maandag', 'Dinsdag', 'Woensdag', 'Donderdag', 'Vrijdag', 'Zaterdag'),
- 'months_short' => array ('Jan', 'Feb', 'Mar', 'Apr', 'Mei', 'Jun', 'Jul', 'Aug', 'Sep', 'Okt', 'Nov', 'Dec'),
- 'months_long' => array ('Januari', 'Februari', 'Maart', 'April', 'Mei', 'Juni', 'Juli', 'Augustus', 'September', 'Oktober', 'November', 'December')
- ),
- 'et' => array (
- 'weekdays_short'=> array ('P', 'E', 'T', 'K', 'N', 'R', 'L'),
- 'weekdays_long' => array ('P&#xfc;hap&#xe4;ev', 'Esmasp&#xe4;ev', 'Teisip&#xe4;ev', 'Kolmap&#xe4;ev', 'Neljap&#xe4;ev', 'Reede', 'Laup&#xe4;ev'),
- 'months_short' => array ('Jaan', 'Veebr', 'M&#xe4;rts', 'Aprill', 'Mai', 'Juuni', 'Juuli', 'Aug', 'Sept', 'Okt', 'Nov', 'Dets'),
- 'months_long' => array ('Jaanuar', 'Veebruar', 'M&#xe4;rts', 'Aprill', 'Mai', 'Juuni', 'Juuli', 'August', 'September', 'Oktoober', 'November', 'Detsember')
- ),
- 'tr' => array (
- 'weekdays_short'=> array ('Paz', 'Pzt', 'Sal', '&#xc7;ar', 'Per', 'Cum', 'Cts'),
- 'weekdays_long' => array ('Pazar', 'Pazartesi', 'Sal&#x131;', '&#xc7;ar&#x15f;amba', 'Per&#x15f;embe', 'Cuma', 'Cumartesi'),
- 'months_short' => array ('Ock', '&#x15e;bt', 'Mrt', 'Nsn', 'Mys', 'Hzrn', 'Tmmz', 'A&#x11f;st', 'Eyl', 'Ekm', 'Ksm', 'Arlk'),
- 'months_long' => array ('Ocak', '&#x15e;ubat', 'Mart', 'Nisan', 'May&#x131;s', 'Haziran', 'Temmuz', 'A&#x11f;ustos', 'Eyl&#xfc;l', 'Ekim', 'Kas&#x131;m', 'Aral&#x131;k')
- ),
- 'no' => array (
- 'weekdays_short'=> array ('S&#xf8;n', 'Man', 'Tir', 'Ons', 'Tor', 'Fre', 'L&#xf8;r'),
- 'weekdays_long' => array ('S&#xf8;ndag', 'Mandag', 'Tirsdag', 'Onsdag', 'Torsdag', 'Fredag', 'L&#xf8;rdag'),
- 'months_short' => array ('Jan', 'Feb', 'Mar', 'Apr', 'Mai', 'Jun', 'Jul', 'Aug', 'Sep', 'Okt', 'Nov', 'Des'),
- 'months_long' => array ('Januar', 'Februar', 'Mars', 'April', 'Mai', 'Juni', 'Juli', 'August', 'September', 'Oktober', 'November', 'Desember')
- ),
- 'eo' => array (
- 'weekdays_short'=> array ('Dim', 'Lun', 'Mar', 'Mer', '&#x134;a&#x16D;', 'Ven', 'Sab'),
- 'weekdays_long' => array ('Diman&#x109;o', 'Lundo', 'Mardo', 'Merkredo', '&#x134;a&#x16D;do', 'Vendredo', 'Sabato'),
- 'months_short' => array ('Jan', 'Feb', 'Mar', 'Apr', 'Maj', 'Jun', 'Jul', 'A&#x16D;g', 'Sep', 'Okt', 'Nov', 'Dec'),
- 'months_long' => array ('Januaro', 'Februaro', 'Marto', 'Aprilo', 'Majo', 'Junio', 'Julio', 'A&#x16D;gusto', 'Septembro', 'Oktobro', 'Novembro', 'Decembro')
- ),
- 'ua' => array (
- 'weekdays_short'=> array('&#x41d;&#x434;&#x43b;', '&#x41f;&#x43d;&#x434;', '&#x412;&#x442;&#x440;', '&#x421;&#x440;&#x434;', '&#x427;&#x442;&#x432;', '&#x41f;&#x442;&#x43d;', '&#x421;&#x431;&#x442;'),
- 'weekdays_long' => array('&#x41d;&#x435;&#x434;&#x456;&#x43b;&#x44f;', '&#x41f;&#x43e;&#x43d;&#x435;&#x434;&#x456;&#x43b;&#x43e;&#x43a;', '&#x412;&#x456;&#x432;&#x442;&#x43e;&#x440;&#x43e;&#x43a;', '&#x421;&#x435;&#x440;&#x435;&#x434;&#x430;', '&#x427;&#x435;&#x442;&#x432;&#x435;&#x440;', '&#x41f;\'&#x44f;&#x442;&#x43d;&#x438;&#x446;&#x44f;', '&#x421;&#x443;&#x431;&#x43e;&#x442;&#x430;'),
- 'months_short' => array('&#x421;&#x456;&#x447;', '&#x41b;&#x44e;&#x442;', '&#x411;&#x435;&#x440;', '&#x41a;&#x432;&#x456;', '&#x422;&#x440;&#x430;', '&#x427;&#x435;&#x440;', '&#x41b;&#x438;&#x43f;', '&#x421;&#x435;&#x440;', '&#x412;&#x435;&#x440;', '&#x416;&#x43e;&#x432;', '&#x41b;&#x438;&#x441;', '&#x413;&#x440;&#x443;'),
- 'months_long' => array('&#x421;&#x456;&#x447;&#x435;&#x43d;&#x44c;', '&#x41b;&#x44e;&#x442;&#x438;&#x439;', '&#x411;&#x435;&#x440;&#x435;&#x437;&#x435;&#x43d;&#x44c;', '&#x41a;&#x432;&#x456;&#x442;&#x435;&#x43d;&#x44c;', '&#x422;&#x440;&#x430;&#x432;&#x435;&#x43d;&#x44c;', '&#x427;&#x435;&#x440;&#x432;&#x435;&#x43d;&#x44c;', '&#x41b;&#x438;&#x43f;&#x435;&#x43d;&#x44c;', '&#x421;&#x435;&#x440;&#x43f;&#x435;&#x43d;&#x44c;', '&#x412;&#x435;&#x440;&#x435;&#x441;&#x435;&#x43d;&#x44c;', '&#x416;&#x43e;&#x432;&#x442;&#x435;&#x43d;&#x44c;', '&#x41b;&#x438;&#x441;&#x442;&#x43e;&#x43f;&#x430;&#x434;', '&#x413;&#x440;&#x443;&#x434;&#x435;&#x43d;&#x44c;')
- ),
- 'ro' => array (
- 'weekdays_short'=> array ('Dum', 'Lun', 'Mar', 'Mie', 'Joi', 'Vin', 'Sam'),
- 'weekdays_long' => array ('Duminica', 'Luni', 'Marti', 'Miercuri', 'Joi', 'Vineri', 'Sambata'),
- 'months_short' => array ('Ian', 'Feb', 'Mar', 'Apr', 'Mai', 'Iun', 'Iul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'),
- 'months_long' => array ('Ianuarie', 'Februarie', 'Martie', 'Aprilie', 'Mai', 'Iunie', 'Iulie', 'August', 'Septembrie', 'Octombrie', 'Noiembrie', 'Decembrie')
- ),
- 'he' => array (
- 'weekdays_short'=> array ('&#1512;&#1488;&#1513;&#1493;&#1503;', '&#1513;&#1504;&#1497;', '&#1513;&#1500;&#1497;&#1513;&#1497;', '&#1512;&#1489;&#1497;&#1506;&#1497;', '&#1495;&#1502;&#1497;&#1513;&#1497;', '&#1513;&#1497;&#1513;&#1497;', '&#1513;&#1489;&#1514;'),
- 'weekdays_long' => array ('&#1497;&#1493;&#1501; &#1512;&#1488;&#1513;&#1493;&#1503;', '&#1497;&#1493;&#1501; &#1513;&#1504;&#1497;', '&#1497;&#1493;&#1501; &#1513;&#1500;&#1497;&#1513;&#1497;', '&#1497;&#1493;&#1501; &#1512;&#1489;&#1497;&#1506;&#1497;', '&#1497;&#1493;&#1501; &#1495;&#1502;&#1497;&#1513;&#1497;', '&#1497;&#1493;&#1501; &#1513;&#1497;&#1513;&#1497;', '&#1513;&#1489;&#1514;'),
- 'months_short' => array ('&#1497;&#1504;&#1493;&#1488;&#1512;', '&#1508;&#1489;&#1512;&#1493;&#1488;&#1512;', '&#1502;&#1512;&#1509;', '&#1488;&#1508;&#1512;&#1497;&#1500;', '&#1502;&#1488;&#1497;', '&#1497;&#1493;&#1504;&#1497;', '&#1497;&#1493;&#1500;&#1497;', '&#1488;&#1493;&#1490;&#1493;&#1505;&#1496;', '&#1505;&#1508;&#1496;&#1502;&#1489;&#1512;', '&#1488;&#1493;&#1511;&#1496;&#1493;&#1489;&#1512;', '&#1504;&#1493;&#1489;&#1502;&#1489;&#1512;', '&#1491;&#1510;&#1502;&#1489;&#1512;'),
- 'months_long' => array ('&#1497;&#1504;&#1493;&#1488;&#1512;', '&#1508;&#1489;&#1512;&#1493;&#1488;&#1512;', '&#1502;&#1512;&#1509;', '&#1488;&#1508;&#1512;&#1497;&#1500;', '&#1502;&#1488;&#1497;', '&#1497;&#1493;&#1504;&#1497;', '&#1497;&#1493;&#1500;&#1497;', '&#1488;&#1493;&#1490;&#1493;&#1505;&#1496;', '&#1505;&#1508;&#1496;&#1502;&#1489;&#1512;', '&#1488;&#1493;&#1511;&#1496;&#1493;&#1489;&#1512;', '&#1504;&#1493;&#1489;&#1502;&#1489;&#1512;', '&#1491;&#1510;&#1502;&#1489;&#1512;')
- ),
- 'sv' => array (
- 'weekdays_short'=> array ('S&#xf6;n', 'M&#xe5;n', 'Tis', 'Ons', 'Tor', 'Fre', 'L&#xf6;r'),
- 'weekdays_long' => array ('S&#xf6;ndag', 'M&#xe5;ndag', 'Tisdag', 'Onsdag', 'Torsdag', 'Fredag', 'L&#xf6;rdag'),
- 'months_short' => array ('Jan', 'Feb', 'Mar', 'Apr', 'Maj', 'Jun', 'Jul', 'Aug', 'Sep', 'Okt', 'Nov', 'Dec'),
- 'months_long' => array ('Januari', 'Februari', 'Mars', 'April', 'Maj', 'Juni', 'Juli', 'Augusti', 'September', 'Oktober', 'November', 'December')
- ),
- 'pt' => array (
- 'weekdays_short'=> array ('Dom', 'Seg', 'Ter', 'Qua', 'Qui', 'Sex', 'S&aacute;b'),
- 'weekdays_long' => array ('Domingo', 'Segunda-feira', 'Ter&ccedil;a-feira', 'Quarta-feira', 'Quinta-feira', 'Sexta-feira', 'S&aacute;bado'),
- 'months_short' => array ('Jan', 'Fev', 'Mar', 'Abr', 'Mai', 'Jun', 'Jul', 'Ago', 'Set', 'Out', 'Nov', 'Dez'),
- 'months_long' => array ('Janeiro', 'Fevereiro', 'Mar&ccedil;o', 'Abril', 'Maio', 'Junho', 'Julho', 'Agosto', 'Setembro', 'Outubro', 'Novembro', 'Dezembro')
- ),
- 'tw' => array (
- 'weekdays_short'=> array ('&#36913;&#26085;','&#36913;&#19968;', '&#36913;&#20108;','&#36913;&#19977;', '&#36913;&#22235;','&#36913;&#20116;', '&#36913;&#20845;'),
- 'weekdays_long' => array ('&#26143;&#26399;&#26085;', '&#26143;&#26399;&#19968;', '&#26143;&#26399;&#20108;', '&#26143;&#26399;&#19977;', '&#26143;&#26399;&#22235;', '&#26143;&#26399;&#20116;', '&#26143;&#26399;&#20845;'),
- 'months_short' => array ('&#19968;&#26376;', '&#20108;&#26376;', '&#19977;&#26376;', '&#22235;&#26376;', '&#20116;&#26376;', '&#20845;&#26376;', '&#19971;&#26376;', '&#20843;&#26376;', '&#20061;&#26376;', '&#21313;&#26376;', '&#21313;&#19968;&#26376;', '&#21313;&#20108;&#26376;'),
- 'months_long' => array ('&#19968;&#26376;', '&#20108;&#26376;', '&#19977;&#26376;', '&#22235;&#26376;', '&#20116;&#26376;', '&#20845;&#26376;', '&#19971;&#26376;', '&#20843;&#26376;', '&#20061;&#26376;', '&#21313;&#26376;', '&#21313;&#19968;&#26376;', '&#21313;&#20108;&#26376;')
- ),
- 'pt-br' => array (
- 'weekdays_short'=> array ('Dom', 'Seg', 'Ter', 'Qua', 'Qui', 'Sex', 'S&aacute;b'),
- 'weekdays_long' => array ('Domingo', 'Segunda', 'Ter&ccedil;a', 'Quarta', 'Quinta', 'Sexta', 'S&aacute;bado'),
- 'months_short' => array ('Jan', 'Fev', 'Mar', 'Abr', 'Mai', 'Jun', 'Jul', 'Ago', 'Set', 'Out', 'Nov', 'Dez'),
- 'months_long' => array ('Janeiro', 'Fevereiro', 'Mar&ccedil;o', 'Abril', 'Maio', 'Junho', 'Julho', 'Agosto', 'Setembro', 'Outubro', 'Novembro', 'Dezembro')
- ),
- 'sr' => array (
- 'weekdays_short'=> array ('&#1053;&#1077;&#1076;', '&#1055;&#1086;&#1085;', '&#1059;&#1090;&#1086;', '&#1057;&#1088;&#1077;', '&#1063;&#1077;&#1090;', '&#1055;&#1077;&#1090;', '&#1057;&#1091;&#1073;'),
- 'weekdays_long' => array ('&#1053;&#1077;&#1076;&#1077;&#1113;&#1072;', '&#1055;&#1086;&#1085;&#1077;&#1076;&#1077;&#1113;&#1072;&#1082;', '&#1059;&#1090;&#1086;&#1088;&#1072;&#1082;', '&#1057;&#1088;&#1077;&#1076;&#1072;', '&#1063;&#1077;&#1090;&#1074;&#1088;&#1090;&#1072;&#1082;', '&#1055;&#1077;&#1090;&#1072;&#1082;', '&#1057;&#1091;&#1073;&#1086;&#1090;&#1072;'),
- 'months_short' => array ('&#1032;&#1072;&#1085;', '&#1060;&#1077;&#1073;', '&#1052;&#1072;&#1088;', '&#1040;&#1087;&#1088;', '&#1052;&#1072;&#1112;', '&#1032;&#1091;&#1085;', '&#1032;&#1091;&#1083;', '&#1040;&#1074;&#1075;', '&#1057;&#1077;&#1087;', '&#1054;&#1082;&#1090;', '&#1053;&#1086;&#1074;', '&#1044;&#1077;&#1094;'),
- 'months_long' => array ('&#1032;&#1072;&#1085;&#1091;&#1072;&#1088;', '&#1060;&#1077;&#1073;&#1088;&#1091;&#1072;&#1088;', '&#1052;&#1072;&#1088;&#1090;', '&#1040;&#1087;&#1088;&#1080;&#1083;', '&#1052;&#1072;&#1112;', '&#1032;&#1091;&#1085;', '&#1032;&#1091;&#1083;', '&#1040;&#1074;&#1075;&#1091;&#1089;&#1090;', '&#1057;&#1077;&#1087;&#1090;&#1077;&#1084;&#1073;&#1072;&#1088;', '&#1054;&#1082;&#1090;&#1086;&#1073;&#1072;&#1088;', '&#1053;&#1086;&#1074;&#1077;&#1084;&#1073;&#1072;&#1088;', '&#1044;&#1077;&#1094;&#1077;&#1084;&#1073;&#1072;&#1088;')
- ),
- 'el' => array (
- 'weekdays_short'=> array ('&#916;&#949;&#965;', '&#932;&#961;&#943;', '&#932;&#949;&#964;', '&#928;&#941;&#956;', '&#928;&#945;&#961;', '&#931;&#940;&#946;', '&#922;&#965;&#961;'),
- 'weekdays_long' => array ('&#916;&#949;&#965;&#964;&#941;&#961;&#945;', '&#932;&#961;&#943;&#964;&#951;', '&#932;&#949;&#964;&#940;&#961;&#964;&#951;', '&#928;&#941;&#956;&#960;&#964;&#951;', '&#928;&#945;&#961;&#945;&#963;&#954;&#949;&#965;&#942;', '&#931;&#940;&#946;&#946;&#945;&#964;&#959;', '&#922;&#965;&#961;&#953;&#945;&#954;&#942;'),
- 'months_short' => array ('&#921;&#945;&#957;', '&#934;&#949;&#946;', '&#924;&#940;&#961;', '&#913;&#960;&#961;', '&#924;&#940;&#970;', 'Io&#973;&#957;', '&#921;&#959;&#973;&#955;', '&#913;&#973;&#947;', '&#931;&#949;&#960;', '&#927;&#954;&#964;', '&#925;&#959;&#941;', '&#916;&#949;&#954;'),
- 'months_long' => array ('&#921;&#945;&#957;&#959;&#965;&#940;&#961;&#953;&#959;&#962;', '&#934;&#949;&#946;&#961;&#959;&#965;&#940;&#961;&#953;&#959;&#962;', '&#924;&#940;&#961;&#964;&#953;&#959;&#962;', '&#913;&#960;&#961;&#943;&#955;&#953;&#959;&#962;', '&#924;&#940;&#970;&#959;&#962;', '&#921;&#959;&#973;&#957;&#953;&#959;&#962;', 'Io&#973;&#955;&#953;&#959;&#962;', '&#913;&#973;&#947;&#959;&#965;&#963;&#964;&#959;&#962;', '&#931;&#949;&#960;&#964;&#941;&#956;&#946;&#961;&#953;&#959;&#962;', '&#927;&#954;&#964;&#974;&#946;&#961;&#953;&#959;&#962;', '&#925;&#959;&#941;&#956;&#946;&#961;&#953;&#959;&#962;', '&#916;&#949;&#954;&#941;&#956;&#946;&#961;&#953;&#959;&#962;')
- )
- );
+ var $_locale = array();
// }}}
// {{{ constructor
@@ -290,9 +117,15 @@
* @param array Options to control the element's display
* @param mixed Either a typical HTML attribute string or an associative array
*/
- function HTML_QuickForm_date($elementName = null, $elementLabel = null, $options = array(), $attributes = null)
+ function __construct($elementName = null, $elementLabel = null, $options = array(), $attributes = null)
{
- $this->HTML_QuickForm_element($elementName, $elementLabel, $attributes);
+ $this->_locale = array(
+ 'weekdays_short'=> CRM_Utils_Date::getAbbrWeekdayNames(),
+ 'weekdays_long' => CRM_Utils_Date::getFullWeekdayNames(),
+ 'months_short' => CRM_Utils_Date::getAbbrMonthNames(),
+ 'months_long' => CRM_Utils_Date::getFullMonthNames()
+ );
+ parent::__construct($elementName, $elementLabel, null, null, null, $attributes);
$this->_persistantFreeze = true;
$this->_appendName = true;
$this->_type = 'date';
@@ -303,9 +136,7 @@
// set the options, do not bother setting bogus ones
if (is_array($options)) {
foreach ($options as $name => $value) {
- if ('language' == $name) {
- $this->_options['language'] = isset($this->_locale[$value])? $value: 'en';
- } elseif (isset($this->_options[$name])) {
+ if (isset($this->_options[$name])) {
if (is_array($value) && is_array($this->_options[$name])) {
$this->_options[$name] = @array_merge($this->_options[$name], $value);
} else {
@@ -323,38 +154,57 @@
{
$this->_separator = $this->_elements = array();
$separator = '';
- $locale =& $this->_locale[$this->_options['language']];
+ $locale =& $this->_locale;
$backslash = false;
for ($i = 0, $length = strlen($this->_options['format']); $i < $length; $i++) {
- $sign = $this->_options['format']{$i};
+ $sign = $this->_options['format'][$i];
if ($backslash) {
$backslash = false;
$separator .= $sign;
} else {
$loadSelect = true;
+ $ariaLabel = $this->getLabel() ?: '';
switch ($sign) {
case 'D':
// Sunday is 0 like with 'w' in date()
$options = $locale['weekdays_short'];
+ $emptyText = ts('-day of week-');
+ $ariaLabel .= ts(' day of week');
break;
case 'l':
$options = $locale['weekdays_long'];
+ $emptyText = ts('-day of week-');
+ $ariaLabel .= ts(' day of week');
break;
case 'd':
$options = $this->_createOptionList(1, 31);
+ $emptyText = ts('-day-');
+ $ariaLabel .= ts(' day');
+ break;
+ case 'j':
+ // the no-zero-padding option (CRM-2793)
+ $options = $this->_createOptionList(1, 31, 1, false);
+ $emptyText = ts('-day-');
+ $ariaLabel .= ts(' day');
break;
case 'M':
$options = $locale['months_short'];
array_unshift($options , '');
unset($options[0]);
+ $emptyText = ts('-month-');
+ $ariaLabel .= ts(' month');
break;
case 'm':
$options = $this->_createOptionList(1, 12);
+ $emptyText = ts('-month-');
+ $ariaLabel .= ts(' month');
break;
case 'F':
$options = $locale['months_long'];
array_unshift($options , '');
unset($options[0]);
+ $emptyText = ts('-month-');
+ $ariaLabel .= ts(' month');
break;
case 'Y':
$options = $this->_createOptionList(
@@ -362,6 +212,8 @@
$this->_options['maxYear'],
$this->_options['minYear'] > $this->_options['maxYear']? -1: 1
);
+ $emptyText = ts('-year-');
+ $ariaLabel .= ts(' year');
break;
case 'y':
$options = $this->_createOptionList(
@@ -370,9 +222,13 @@
$this->_options['minYear'] > $this->_options['maxYear']? -1: 1
);
array_walk($options, create_function('&$v,$k','$v = substr($v,-2);'));
+ $emptyText = ts('-year-');
+ $ariaLabel .= ts(' year');
break;
case 'h':
$options = $this->_createOptionList(1, 12);
+ $emptyText = ts('-hour-');
+ $ariaLabel .= ts(' hour');
break;
case 'g':
$options = $this->_createOptionList(1, 12);
@@ -380,18 +236,28 @@
break;
case 'H':
$options = $this->_createOptionList(0, 23);
+ $emptyText = ts('-hour-');
+ $ariaLabel .= ts(' hour');
break;
case 'i':
$options = $this->_createOptionList(0, 59, $this->_options['optionIncrement']['i']);
+ $emptyText = ts('-min-');
+ $ariaLabel .= ts(' minute');
break;
case 's':
$options = $this->_createOptionList(0, 59, $this->_options['optionIncrement']['s']);
+ $emptyText = ts('-sec-');
+ $ariaLabel .= ts(' second');
break;
case 'a':
$options = array('am' => 'am', 'pm' => 'pm');
+ $emptyText = '-am/pm-';
+ $ariaLabel .= ts(' am or pm');
break;
case 'A':
$options = array('AM' => 'AM', 'PM' => 'PM');
+ $emptyText = '-AM/PM-';
+ $ariaLabel .= ts(' AM or PM');
break;
case 'W':
$options = $this->_createOptionList(1, 53);
@@ -418,12 +284,23 @@
// Using '+' array operator to preserve the keys
if (is_array($this->_options['emptyOptionText']) && !empty($this->_options['emptyOptionText'][$sign])) {
- $options = array($this->_options['emptyOptionValue'] => $this->_options['emptyOptionText'][$sign]) + $options;
+ $text = $emptyText ? $emptyText : $this->_options['emptyOptionText'][$sign];
+ $options = array($this->_options['emptyOptionValue'] => $text) + $options;
} else {
- $options = array($this->_options['emptyOptionValue'] => $this->_options['emptyOptionText']) + $options;
+ $text = $emptyText ? $emptyText : $this->_options['emptyOptionText'];
+ $options = array($this->_options['emptyOptionValue'] => $text) + $options;
}
}
- $this->_elements[] =& new HTML_QuickForm_select($sign, null, $options, $this->getAttributes());
+
+ //modified autogenerated id for date select boxes.
+ $attribs = $this->getAttributes();
+ $elementName = $this->getName();
+ $attribs['id'] = $elementName.'['.$sign.']';
+ if ($ariaLabel !== '') {
+ $attribs['aria-label'] = $ariaLabel;
+ }
+
+ $this->_elements[] = new HTML_QuickForm_select($sign, null, $options, $attribs);
}
}
}
@@ -439,13 +316,14 @@
* @param int The start number
* @param int The end number
* @param int Increment by this value
+ * @param bool Whether to pad the result with leading zero (CRM-2793)
* @access private
* @return array An array of numeric options.
*/
- function _createOptionList($start, $end, $step = 1)
+ function _createOptionList($start, $end, $step = 1, $pad = true)
{
for ($i = $start, $options = array(); $start > $end? $i >= $end: $i <= $end; $i += $step) {
- $options[$i] = sprintf('%02d', $i);
+ $options[$i] = $pad ? sprintf('%02d', $i) : sprintf('%d', $i);
}
return $options;
}
@@ -511,7 +389,7 @@
function toHtml()
{
include_once('HTML/QuickForm/Renderer/Default.php');
- $renderer =& new HTML_QuickForm_Renderer_Default();
+ $renderer = new HTML_QuickForm_Renderer_Default();
$renderer->setElementTemplate('{element}');
parent::accept($renderer);
return $this->_wrap[0] . $renderer->toHtml() . $this->_wrap[1];
diff -ruwN _ORIGINAL_/HTML/QuickForm/element.php HTML/QuickForm/element.php
--- _ORIGINAL_/HTML/QuickForm/element.php 2021-08-25 09:24:31.894785793 +1000
+++ HTML/QuickForm/element.php 2021-05-23 06:58:15.329915618 +1000
@@ -93,9 +93,9 @@
* @access public
* @return void
*/
- function HTML_QuickForm_element($elementName=null, $elementLabel=null, $attributes=null)
+ function __construct($elementName=null, $elementLabel=null, $attributes=null)
{
- HTML_Common::HTML_Common($attributes);
+ parent::__construct($attributes);
if (isset($elementName)) {
$this->setName($elementName);
}
@@ -348,14 +348,8 @@
if (isset($values[$elementName])) {
return $values[$elementName];
} elseif (strpos($elementName, '[')) {
-
- $keys = str_replace(
- array('\\', '\'', ']', '['), array('\\\\', '\\\'', '', "']['"),
- $elementName
- );
- $arrayKeys = explode("']['", $keys);
- return HTML_QuickForm_utils::recursiveValue($values, $arrayKeys);
-
+ $keys = explode('[', str_replace(']', '', $elementName));
+ return CRM_Utils_Array::pathGet($values, $keys);
} else {
return null;
}
@@ -378,8 +372,7 @@
{
switch ($event) {
case 'createElement':
- $className = get_class($this);
- $this->$className($arg[0], $arg[1], $arg[2], $arg[3], $arg[4]);
+ $this->__construct($arg[0], $arg[1], $arg[2], $arg[3], $arg[4]);
break;
case 'addElement':
$this->onQuickFormEvent('createElement', $arg, $caller);
@@ -485,13 +478,10 @@
if (!strpos($name, '[')) {
return array($name => $value);
} else {
-
- $keys = str_replace(
- array('\\', '\'', ']', '['), array('\\\\', '\\\'', '', "']['"),
- $name
- );
- $keysArray = explode("']['", $keys);
- return HTML_QuickForm_utils::recursiveBuild($keysArray, $value);
+ $keys = explode('[', str_replace(']', '', $name));
+ $preparedValue = [];
+ CRM_Utils_Array::pathSet($preparedValue, $keys, $value);
+ return $preparedValue;
}
}
}
diff -ruwN _ORIGINAL_/HTML/QuickForm/file.php HTML/QuickForm/file.php
--- _ORIGINAL_/HTML/QuickForm/file.php 2021-08-25 09:24:31.894785793 +1000
+++ HTML/QuickForm/file.php 2021-05-23 06:58:15.329915618 +1000
@@ -70,9 +70,9 @@
* @since 1.0
* @access public
*/
- function HTML_QuickForm_file($elementName=null, $elementLabel=null, $attributes=null)
+ function __construct($elementName=null, $elementLabel=null, $attributes=null)
{
- HTML_QuickForm_input::HTML_QuickForm_input($elementName, $elementLabel, $attributes);
+ parent::__construct($elementName, $elementLabel, $attributes);
$this->setType('file');
} //end constructor
@@ -176,7 +176,8 @@
if ($caller->getAttribute('method') == 'get') {
return PEAR::raiseError('Cannot add a file upload field to a GET method form');
}
- $this->_value = $this->_findValue();
+ $placeholder = array();
+ $this->_value = $this->_findValue($placeholder);
$caller->updateAttributes(array('enctype' => 'multipart/form-data'));
$caller->setMaxFileSize();
break;
@@ -186,7 +187,7 @@
break;
case 'createElement':
$className = get_class($this);
- $this->$className($arg[0], $arg[1], $arg[2]);
+ $this->__construct($arg[0], $arg[1], $arg[2]);
break;
}
return true;
@@ -236,7 +237,7 @@
* @access private
* @return bool true if file has been uploaded, false otherwise
*/
- function _ruleIsUploadedFile($elementValue)
+ static function _ruleIsUploadedFile($elementValue)
{
if ((isset($elementValue['error']) && $elementValue['error'] == 0) ||
(!empty($elementValue['tmp_name']) && $elementValue['tmp_name'] != 'none')) {
@@ -257,7 +258,7 @@
* @access private
* @return bool true if filesize is lower than maxsize, false otherwise
*/
- function _ruleCheckMaxFileSize($elementValue, $maxSize)
+ static function _ruleCheckMaxFileSize($elementValue, $maxSize)
{
if (!empty($elementValue['error']) &&
(UPLOAD_ERR_FORM_SIZE == $elementValue['error'] || UPLOAD_ERR_INI_SIZE == $elementValue['error'])) {
@@ -280,7 +281,7 @@
* @access private
* @return bool true if mimetype is correct, false otherwise
*/
- function _ruleCheckMimeType($elementValue, $mimeType)
+ static function _ruleCheckMimeType($elementValue, $mimeType)
{
if (!HTML_QuickForm_file::_ruleIsUploadedFile($elementValue)) {
return true;
@@ -302,7 +303,7 @@
* @access private
* @return bool true if name matches regex, false otherwise
*/
- function _ruleCheckFileName($elementValue, $regex)
+ static function _ruleCheckFileName($elementValue, $regex)
{
if (!HTML_QuickForm_file::_ruleIsUploadedFile($elementValue)) {
return true;
@@ -333,23 +334,21 @@
if (isset($_FILES[$elementName])) {
return $_FILES[$elementName];
} elseif (false !== ($pos = strpos($elementName, '['))) {
- $base = str_replace(
- array('\\', '\''), array('\\\\', '\\\''),
- substr($elementName, 0, $pos)
- );
- $idx = "['" . str_replace(
- array('\\', '\'', ']', '['), array('\\\\', '\\\'', '', "']['"),
- substr($elementName, $pos + 1, -1)
- ) . "']";
- $props = array('name', 'type', 'size', 'tmp_name', 'error');
- $code = "if (!isset(\$_FILES['{$base}']['name']{$idx})) {\n" .
- " return null;\n" .
- "} else {\n" .
- " \$value = array();\n";
+ $base = substr($elementName, 0, $pos);
+ $idx = explode('][', str_replace(["['", "']", '["', '"]'], ['[', ']', '[', ']'], substr($elementName, $pos + 1, -1)));
+ $idx = array_merge([$base, 'name'], $idx);
+ if (!CRM_Utils_Array::pathIsset($_FILES, $idx)) {
+ return NULL;
+ }
+ else {
+ $props = ['name', 'type', 'size', 'tmp_name', 'error'];
+ $value = [];
foreach ($props as $prop) {
- $code .= " \$value['{$prop}'] = \$_FILES['{$base}']['{$prop}']{$idx};\n";
+ $idx[1] = $prop;
+ $value[$prop] = CRM_Utils_Array::pathGet($_FILES, $idx);
+ }
+ return $value;
}
- return eval($code . " return \$value;\n}\n");
} else {
return null;
}
diff -ruwN _ORIGINAL_/HTML/QuickForm/group.php HTML/QuickForm/group.php
--- _ORIGINAL_/HTML/QuickForm/group.php 2021-08-25 09:24:31.894785793 +1000
+++ HTML/QuickForm/group.php 2021-05-23 06:58:15.329915618 +1000
@@ -97,13 +97,15 @@
* @param bool $appendName (optional)whether to change elements' names to
* the form $groupName[$elementName] or leave
* them as is.
+ * @param mixed $attributes (optional)Either a typical HTML attribute string
+ * or an associative array. Date format is passed along the attributes.
* @since 1.0
* @access public
* @return void
*/
- function HTML_QuickForm_group($elementName=null, $elementLabel=null, $elements=null, $separator=null, $appendName = true)
+ function __construct($elementName=null, $elementLabel=null, $elements=null, $separator=null, $appendName = true, $attributes = null)
{
- $this->HTML_QuickForm_element($elementName, $elementLabel);
+ parent::__construct($elementName, $elementLabel, $attributes);
$this->_type = 'group';
if (isset($elements) && is_array($elements)) {
$this->setElements($elements);
@@ -299,7 +301,7 @@
function toHtml()
{
include_once('HTML/QuickForm/Renderer/Default.php');
- $renderer =& new HTML_QuickForm_Renderer_Default();
+ $renderer = new HTML_QuickForm_Renderer_Default();
$renderer->setElementTemplate('{element}');
$this->accept($renderer);
return $renderer->toHtml();
@@ -442,7 +444,10 @@
if ($this->_appendName) {
$elementName = $element->getName();
if (isset($elementName)) {
- $element->setName($name . '['. (strlen($elementName)? $elementName: $key) .']');
+ $newName = $name . '['. (strlen($elementName)? $elementName: $key) .']';
+ $newID = str_replace(array(']', '['), array('', '_'), $newName);
+ $element->setName($newName);
+ $element->updateAttributes( array( 'id' => $newID ) );
} else {
$element->setName($name);
}
diff -ruwN _ORIGINAL_/HTML/QuickForm/header.php HTML/QuickForm/header.php
--- _ORIGINAL_/HTML/QuickForm/header.php 2021-08-25 09:24:31.894785793 +1000
+++ HTML/QuickForm/header.php 2021-05-23 06:58:15.329915618 +1000
@@ -47,9 +47,9 @@
* @access public
* @return void
*/
- function HTML_QuickForm_header($elementName = null, $text = null)
+ function __construct($elementName = null, $text = null)
{
- $this->HTML_QuickForm_static($elementName, null, $text);
+ parent::__construct($elementName, null, $text);
$this->_type = 'header';
}
diff -ruwN _ORIGINAL_/HTML/QuickForm/hidden.php HTML/QuickForm/hidden.php
--- _ORIGINAL_/HTML/QuickForm/hidden.php 2021-08-25 09:24:31.894785793 +1000
+++ HTML/QuickForm/hidden.php 2021-05-23 06:58:15.329915618 +1000
@@ -52,9 +52,9 @@
* @access public
* @return void
*/
- function HTML_QuickForm_hidden($elementName=null, $value='', $attributes=null)
+ function __construct($elementName=null, $value='', $attributes=null)
{
- HTML_QuickForm_input::HTML_QuickForm_input($elementName, null, $attributes);
+ parent::__construct($elementName, null, $attributes);
$this->setType('hidden');
$this->setValue($value);
} //end constructor
@@ -79,15 +79,15 @@
/**
* Accepts a renderer
*
- * @param HTML_QuickForm_Renderer renderer object
- * @param bool $sc1 unused, for signature compatibility
- * @param bool $sc2 unused, for signature compatibility
+ * @param HTML_QuickForm_Renderer $renderer object
+ * @param bool $required Whether an element is required
+ * @param string $error An error message associated with an element
* @access public
* @return void
*/
- function accept(&$renderer, $sc1 = false, $sc2 = null)
+ function accept(&$renderer, $required=false, $error=null)
{
- $renderer->renderHidden($this);
+ $renderer->renderHidden($this, $required, $error);
} // end func accept
// }}}
diff -ruwN _ORIGINAL_/HTML/QuickForm/hiddenselect.php HTML/QuickForm/hiddenselect.php
--- _ORIGINAL_/HTML/QuickForm/hiddenselect.php 2021-08-25 09:24:31.894785793 +1000
+++ HTML/QuickForm/hiddenselect.php 2021-05-23 06:58:15.329915618 +1000
@@ -56,9 +56,9 @@
* @access public
* @return void
*/
- function HTML_QuickForm_hiddenselect($elementName=null, $elementLabel=null, $options=null, $attributes=null)
+ function __construct($elementName=null, $elementLabel=null, $options=null, $attributes=null)
{
- HTML_QuickForm_element::HTML_QuickForm_element($elementName, $elementLabel, $attributes);
+ parent::__construct($elementName, $elementLabel, $attributes);
$this->_persistantFreeze = true;
$this->_type = 'hiddenselect';
if (isset($options)) {
diff -ruwN _ORIGINAL_/HTML/QuickForm/hierselect.php HTML/QuickForm/hierselect.php
--- _ORIGINAL_/HTML/QuickForm/hierselect.php 2021-08-25 09:24:31.894785793 +1000
+++ HTML/QuickForm/hierselect.php 2021-05-23 06:58:15.329915618 +1000
@@ -1,56 +1,38 @@
<?php
-/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
+/* vim: set expandtab tabstop=4 shiftwidth=4: */
+// +----------------------------------------------------------------------+
+// | PHP version 4.0 |
+// +----------------------------------------------------------------------+
+// | Copyright (c) 1997-2004 The PHP Group |
+// +----------------------------------------------------------------------+
+// | This source file is subject to version 2.0 of the PHP license, |
+// | that is bundled with this package in the file LICENSE, and is |
+// | available at through the world-wide-web at |
+// | http://www.php.net/license/2_02.txt. |
+// | If you did not receive a copy of the PHP license and are unable to |
+// | obtain it through the world-wide-web, please send a note to |
+// | license@php.net so we can mail you a copy immediately. |
+// +----------------------------------------------------------------------+
+// | Authors: Herim Vasquez <vasquezh@iro.umontreal.ca> |
+// | Bertrand Mansion <bmansion@mamasam.com> |
+// +----------------------------------------------------------------------+
+//
+// $Id: hierselect.php,v 1.12 2004/10/20 10:03:49 avb Exp $
-/**
- * Hierarchical select element
- *
- * PHP versions 4 and 5
- *
- * LICENSE: This source file is subject to version 3.01 of the PHP license
- * that is available through the world-wide-web at the following URI:
- * http://www.php.net/license/3_01.txt If you did not receive a copy of
- * the PHP License and are unable to obtain it through the web, please
- * send a note to license@php.net so we can mail you a copy immediately.
- *
- * @category HTML
- * @package HTML_QuickForm
- * @author Herim Vasquez <vasquezh@iro.umontreal.ca>
- * @author Bertrand Mansion <bmansion@mamasam.com>
- * @author Alexey Borzov <avb@php.net>
- * @copyright 2001-2011 The PHP Group
- * @license http://www.php.net/license/3_01.txt PHP License 3.01
- * @version CVS: $Id$
- * @link http://pear.php.net/package/HTML_QuickForm
- */
+require_once('HTML/QuickForm/group.php');
+require_once('HTML/QuickForm/select.php');
/**
- * Class for a group of form elements
- */
-require_once 'HTML/QuickForm/group.php';
-/**
- * Class for <select></select> elements
- */
-require_once 'HTML/QuickForm/select.php';
-/**
- * Static utility methods
- */
-require_once 'HTML/QuickForm/utils.php';
-
-/**
- * Hierarchical select element
- *
* Class to dynamically create two or more HTML Select elements
* The first select changes the content of the second select and so on.
* This element is considered as a group. Selects will be named
* groupName[0], groupName[1], groupName[2]...
*
- * @category HTML
- * @package HTML_QuickForm
* @author Herim Vasquez <vasquezh@iro.umontreal.ca>
* @author Bertrand Mansion <bmansion@mamasam.com>
- * @author Alexey Borzov <avb@php.net>
- * @version Release: 3.2.16
- * @since 3.1
+ * @version 1.0
+ * @since PHP4.04pl1
+ * @access public
*/
class HTML_QuickForm_hierselect extends HTML_QuickForm_group
{
@@ -59,7 +41,42 @@
/**
* Options for all the select elements
*
- * @see setOptions()
+ * Format is a bit more complex as we need to know which options
+ * are related to the ones in the previous select:
+ *
+ * Ex:
+ * // first select
+ * $select1[0] = 'Pop';
+ * $select1[1] = 'Classical';
+ * $select1[2] = 'Funeral doom';
+ *
+ * // second select
+ * $select2[0][0] = 'Red Hot Chil Peppers';
+ * $select2[0][1] = 'The Pixies';
+ * $select2[1][0] = 'Wagner';
+ * $select2[1][1] = 'Strauss';
+ * $select2[2][0] = 'Pantheist';
+ * $select2[2][1] = 'Skepticism';
+ *
+ * // If only need two selects
+ * // - and using the depracated functions
+ * $sel =& $form->addElement('hierselect', 'cds', 'Choose CD:');
+ * $sel->setMainOptions($select1);
+ * $sel->setSecOptions($select2);
+ *
+ * // - and using the new setOptions function
+ * $sel =& $form->addElement('hierselect', 'cds', 'Choose CD:');
+ * $sel->setOptions(array($select1, $select2));
+ *
+ * // If you have a third select with prices for the cds
+ * $select3[0][0][0] = '15.00$';
+ * $select3[0][0][1] = '17.00$';
+ * etc
+ *
+ * // You can now use
+ * $sel =& $form->addElement('hierselect', 'cds', 'Choose CD:');
+ * $sel->setOptions(array($select1, $select2, $select3));
+ *
* @var array
* @access private
*/
@@ -81,6 +98,11 @@
*/
var $_js = '';
+ /**
+ * The javascript array name
+ */
+ var $_jsArrayName = '';
+
// }}}
// {{{ constructor
@@ -96,9 +118,9 @@
* @access public
* @return void
*/
- function HTML_QuickForm_hierselect($elementName=null, $elementLabel=null, $attributes=null, $separator=null)
+ function __construct($elementName=null, $elementLabel=null, $attributes=null, $separator=null)
{
- $this->HTML_QuickForm_element($elementName, $elementLabel, $attributes);
+ parent::__construct($elementName, $elementLabel, null, null, null, $attributes);
$this->_persistantFreeze = true;
if (isset($separator)) {
$this->_separator = $separator;
@@ -114,45 +136,8 @@
* Initialize the array structure containing the options for each select element.
* Call the functions that actually do the magic.
*
- * Format is a bit more complex than for a simple select as we need to know
- * which options are related to the ones in the previous select:
- *
- * Ex:
- * <code>
- * // first select
- * $select1[0] = 'Pop';
- * $select1[1] = 'Classical';
- * $select1[2] = 'Funeral doom';
- *
- * // second select
- * $select2[0][0] = 'Red Hot Chil Peppers';
- * $select2[0][1] = 'The Pixies';
- * $select2[1][0] = 'Wagner';
- * $select2[1][1] = 'Strauss';
- * $select2[2][0] = 'Pantheist';
- * $select2[2][1] = 'Skepticism';
- *
- * // If only need two selects
- * // - and using the deprecated functions
- * $sel =& $form->addElement('hierselect', 'cds', 'Choose CD:');
- * $sel->setMainOptions($select1);
- * $sel->setSecOptions($select2);
- *
- * // - and using the new setOptions function
- * $sel =& $form->addElement('hierselect', 'cds', 'Choose CD:');
- * $sel->setOptions(array($select1, $select2));
- *
- * // If you have a third select with prices for the cds
- * $select3[0][0][0] = '15.00$';
- * $select3[0][0][1] = '17.00$';
- * // etc
- *
- * // You can now use
- * $sel =& $form->addElement('hierselect', 'cds', 'Choose CD:');
- * $sel->setOptions(array($select1, $select2, $select3));
- * </code>
- *
* @param array $options Array of options defining each element
+ *
* @access public
* @return void
*/
@@ -168,12 +153,13 @@
// check if all elements have been created
$totalNbElements = count($this->_options);
for ($i = $this->_nbElements; $i < $totalNbElements; $i ++) {
- $this->_elements[] =& new HTML_QuickForm_select($i, null, array(), $this->getAttributes());
+ $this->_elements[] = new HTML_QuickForm_select($i, null, array(), $this->getAttributes());
$this->_nbElements++;
}
}
$this->_setOptions();
+ $this->_setJS();
} // end func setMainOptions
// }}}
@@ -185,7 +171,6 @@
* @param array $array Options for the first select element
*
* @access public
- * @deprecated Deprecated since release 3.2.2
* @return void
*/
function setMainOptions($array)
@@ -208,7 +193,6 @@
* @param array $array Options for the second select element
*
* @access public
- * @deprecated Deprecated since release 3.2.2
* @return void
*/
function setSecOptions($array)
@@ -223,12 +207,13 @@
// check if all elements have been created
$totalNbElements = 2;
for ($i = $this->_nbElements; $i < $totalNbElements; $i ++) {
- $this->_elements[] =& new HTML_QuickForm_select($i, null, array(), $this->getAttributes());
+ $this->_elements[] = new HTML_QuickForm_select($i, null, array(), $this->getAttributes());
$this->_nbElements++;
}
}
$this->_setOptions();
+ $this->_setJS();
} // end func setSecOptions
// }}}
@@ -242,11 +227,11 @@
*/
function _setOptions()
{
- $arrayKeys = array();
+ $arrayKeys = [];
foreach (array_keys($this->_elements) AS $key) {
if (isset($this->_options[$key])) {
- if ((empty($arrayKeys)) || HTML_QuickForm_utils::recursiveIsset($this->_options[$key], $arrayKeys)) {
- $array = empty($arrayKeys) ? $this->_options[$key] : HTML_QuickForm_utils::recursiveValue($this->_options[$key], $arrayKeys);
+ if ((empty($arrayKeys)) || CRM_Utils_Array::pathIsset($this->_options[$key], $arrayKeys)) {
+ $array = empty($arrayKeys) ? $this->_options[$key] : CRM_Utils_Array::pathGet($this->_options[$key], $arrayKeys);
if (is_array($array)) {
$select =& $this->_elements[$key];
$select->_options = array();
@@ -274,10 +259,10 @@
*/
function setValue($value)
{
- // fix for bug #6766. Hope this doesn't break anything more
- // after bug #7961. Forgot that _nbElements was used in
- // _createElements() called in several places...
- $this->_nbElements = max($this->_nbElements, count($value));
+ // $value could be a string or an array - prior to php 7.2 count handled both, returning 0 for NULL
+ // or an empty array.
+ // https://stackoverflow.com/questions/20257983/why-the-count-function-returns-1-for-false-and-0-for-null
+ $this->_nbElements = is_array($value) ? count($value) : ($value === NULL ? 0 : 1);
parent::setValue($value);
$this->_setOptions();
} // end func setValue
@@ -293,202 +278,196 @@
*/
function _createElements()
{
+ //hack to add id attribute for hier select
+ $attributes = $this->getAttributes();
+ $id = null;
+ if ( isset( $attributes['id'] ) ) {
+ $id = "{$attributes['id']}";
+ }
+
for ($i = 0; $i < $this->_nbElements; $i++) {
- $this->_elements[] =& new HTML_QuickForm_select($i, null, array(), $this->getAttributes());
+ if ( isset( $id ) ) {
+ $attributes['id'] = "{$id}_{$i}";
+ }
+
+ $this->_elements[] = new HTML_QuickForm_select($i, null, array(), $attributes);
}
} // end func _createElements
// }}}
- // {{{ toHtml()
+ // {{{ _setJS()
- function toHtml()
+ /**
+ * Set the JavaScript for each select element (excluding de main one).
+ *
+ * @access private
+ * @return void
+ */
+ function _setJS()
{
- $this->_js = '';
- if (!$this->_flagFrozen) {
- // set the onchange attribute for each element except last
- $keys = array_keys($this->_elements);
- $onChange = array();
- for ($i = 0; $i < count($keys) - 1; $i++) {
- $select =& $this->_elements[$keys[$i]];
- $onChange[$i] = $select->getAttribute('onchange');
- $select->updateAttributes(
- array('onchange' => '_hs_swapOptions(this.form, \'' . $this->_escapeString($this->getName()) . '\', ' . $keys[$i] . ');' . $onChange[$i])
- );
- }
+ static $jsArrayName = null;
- // create the js function to call
- if (!defined('HTML_QUICKFORM_HIERSELECT_EXISTS')) {
- $this->_js .= <<<JAVASCRIPT
-function _hs_findOptions(ary, keys)
-{
- if (ary == undefined) {
- return {};
+ $this->_js = $js = '';
+ if ( ! $jsArrayName ) {
+ $this->_jsArrayName = 'hs_' . preg_replace('/\[|\]/', '_', $this->getName());
+ for ($i = 1; $i < $this->_nbElements; $i++) {
+ $this->_setJSArray($this->_jsArrayName, $this->_options[$i], $js);
}
- var key = keys.shift();
- if (!key in ary) {
- return {};
- } else if (0 == keys.length) {
- return ary[key];
+ $jsArrayName = $this->_jsArrayName;
} else {
- return _hs_findOptions(ary[key], keys);
- }
+ $this->_jsArrayName = $jsArrayName;
}
+ } // end func _setJS
-function _hs_findSelect(form, groupName, selectIndex)
-{
- if (groupName+'['+ selectIndex +']' in form) {
- return form[groupName+'['+ selectIndex +']'];
- } else {
- return form[groupName+'['+ selectIndex +'][]'];
- }
-}
+ // }}}
+ // {{{ _setJSArray()
-function _hs_unescapeEntities(str)
+ /**
+ * Recursively builds the JavaScript array defining the options that a select
+ * element can have.
+ *
+ * @param string $grpName Group Name attribute
+ * @param array $options Select element options
+ * @param string $js JavaScript definition is build using this variable
+ * @param string $optValue The value for the current JavaScript option
+ *
+ * @access private
+ * @return void
+ */
+ function _setJSArray($grpName, $options, &$js, $optValue = '')
{
- var div = document.createElement('div');
- div.innerHTML = str;
- return div.childNodes[0] ? div.childNodes[0].nodeValue : '';
+ static $jsNameCache = array( );
+ if (is_array($options)) {
+ $js = '';
+ // For a hierselect containing 3 elements:
+ // if option 1 has been selected for the 1st element
+ // and option 3 has been selected for the 2nd element,
+ // then the javascript array containing the values to load
+ // on the 3rd element will have the following name: grpName_1_3
+ $name = ($optValue === '') ? $grpName : $grpName.'_'.$optValue;
+ foreach($options AS $k => $v) {
+ $this->_setJSArray($name, $v, $js, $k);
}
-function _hs_replaceOptions(ctl, options)
-{
- var j = 0;
- ctl.options.length = 0;
- for (var i = 0; i < options.values.length; i++) {
- ctl.options[i] = new Option(
- (-1 == String(options.texts[i]).indexOf('&'))? options.texts[i]: _hs_unescapeEntities(options.texts[i]),
- options.values[i], false, false
- );
- }
-}
+ // if $js !== '' add it to the JavaScript
-function _hs_setValue(ctl, value)
-{
- var testValue = {};
- if (value instanceof Array) {
- for (var i = 0; i < value.length; i++) {
- testValue[value[i]] = true;
- }
+ if ( $js !== '' ) {
+ // check if we have already this js in cache, if so reuse it
+ $cacheKey = md5( $js );
+ if ( array_key_exists( $cacheKey, $jsNameCache ) ) {
+ $this->_js .= "$name = {$jsNameCache[$cacheKey]}\n";
} else {
- testValue[value] = true;
- }
- for (var i = 0; i < ctl.options.length; i++) {
- if (ctl.options[i].value in testValue) {
- ctl.options[i].selected = true;
- }
- }
-}
-
-function _hs_swapOptions(form, groupName, selectIndex)
-{
- var hsValue = [];
- for (var i = 0; i <= selectIndex; i++) {
- hsValue[i] = _hs_findSelect(form, groupName, i).value;
- }
-
- _hs_replaceOptions(_hs_findSelect(form, groupName, selectIndex + 1),
- _hs_findOptions(_hs_options[groupName][selectIndex], hsValue));
- if (selectIndex + 1 < _hs_options[groupName].length) {
- _hs_swapOptions(form, groupName, selectIndex + 1);
- }
-}
-
-function _hs_onReset(form, groupNames)
-{
- for (var i = 0; i < groupNames.length; i++) {
- try {
- for (var j = 0; j <= _hs_options[groupNames[i]].length; j++) {
- _hs_setValue(_hs_findSelect(form, groupNames[i], j), _hs_defaults[groupNames[i]][j]);
- if (j < _hs_options[groupNames[i]].length) {
- _hs_replaceOptions(_hs_findSelect(form, groupNames[i], j + 1),
- _hs_findOptions(_hs_options[groupNames[i]][j], _hs_defaults[groupNames[i]].slice(0, j + 1)));
+ $this->_js .= $name." = {\n".$js."\n}\n";
+ $jsNameCache[$cacheKey] = $name;
}
}
- } catch (e) {
- if (!(e instanceof TypeError)) {
- throw e;
- }
+ $js = '';
+ } else {
+ // $js empty means that we are adding the first element to the JavaScript.
+ if ($js != '') {
+ $js .= ",\n";
}
+ $js .= '"'.$optValue.'":'.json_encode($options, JSON_UNESCAPED_UNICODE);
}
}
-function _hs_setupOnReset(form, groupNames)
-{
- setTimeout(function() { _hs_onReset(form, groupNames); }, 25);
-}
+ // }}}
+ // {{{ toHtml()
-function _hs_onReload()
+ /**
+ * Returns Html for the group
+ *
+ * @access public
+ * @return string
+ */
+ function toHtml()
{
- var ctl;
- for (var i = 0; i < document.forms.length; i++) {
- for (var j in _hs_defaults) {
- if (ctl = _hs_findSelect(document.forms[i], j, 0)) {
- for (var k = 0; k < _hs_defaults[j].length; k++) {
- _hs_setValue(_hs_findSelect(document.forms[i], j, k), _hs_defaults[j][k]);
- }
- }
- }
- }
-
- if (_hs_prevOnload) {
- _hs_prevOnload();
- }
-}
-
-var _hs_prevOnload = null;
-if (window.onload) {
- _hs_prevOnload = window.onload;
+ if ($this->_flagFrozen) {
+ $this->_js = '';
+ } else {
+ // set the onchange attribute for each element
+ $keys = array_keys($this->_elements);
+ $nbElements = count($keys);
+ $nbElementsUsingFnc = $nbElements - 1; // last element doesn't need it
+ for ($i = 0; $i < $nbElementsUsingFnc; $i++) {
+ $select =& $this->_elements[$keys[$i]];
+ $select->updateAttributes(
+ array('onChange' => 'swapOptions(this.form, \''.$this->getName().'\', '.$keys[$i].', '.$nbElements.', \''.$this->_jsArrayName.'\');')
+ );
}
-window.onload = _hs_onReload;
-
-var _hs_options = {};
-var _hs_defaults = {};
-JAVASCRIPT;
+ // create the js function to call
+ if (!defined('HTML_QUICKFORM_HIERSELECT_EXISTS')) {
+ $this->_js .= "function swapOptions(frm, grpName, eleIndex, nbElements, arName)\n"
+ ."{\n"
+ ." var n = \"\";\n"
+ ." var ctl;\n\n"
+ ." for (var i = 0; i < nbElements; i++) {\n"
+ ." ctl = frm[grpName+'['+i+']'];\n"
+ ." if (!ctl) {\n"
+ ." ctl = frm[grpName+'['+i+'][]'];\n"
+ ." }\n"
+ ." if (i <= eleIndex) {\n"
+ ." n += \"_\"+ctl.value;\n"
+ ." } else {\n"
+ ." ctl.length = 0;\n"
+ ." }\n"
+ ." }\n\n"
+ ." var t = eval(\"typeof(\"+arName + n +\")\");\n"
+ ." if (t != 'undefined') {\n"
+ ." var the_array = eval(arName+n);\n"
+ ." var j = 0;\n"
+ ." n = eleIndex + 1;\n"
+ ." ctl = frm[grpName+'['+ n +']'];\n"
+ ." if (!ctl) {\n"
+ ." ctl = frm[grpName+'['+ n +'][]'];\n"
+ ." }\n"
+ ." ctl.style.display = 'inline';\n"
+ ." for (var i in the_array) {\n"
+ ." opt = new Option(the_array[i], i, false, false);\n"
+ ." ctl.options[j++] = opt;\n"
+ ." }\n"
+ ." } else {\n"
+ ." n = eleIndex + 1;\n"
+ ." ctl = frm[grpName+'['+n+']'];\n"
+ ." if (!ctl) {\n"
+ ." ctl = frm[grpName+'['+ n +'][]'];\n"
+ ." }\n"
+ ." if (ctl) {\n"
+ ." ctl.style.display = 'none';\n"
+ ." }\n"
+ ." }\n"
+ ." if (eleIndex+1 < nbElements) {\n"
+ ." swapOptions(frm, grpName, eleIndex+1, nbElements, arName);\n"
+ ." }\n"
+ ."}\n";
define('HTML_QUICKFORM_HIERSELECT_EXISTS', true);
}
- // option lists
- $jsParts = array();
- for ($i = 1; $i < $this->_nbElements; $i++) {
- $jsParts[] = $this->_convertArrayToJavascript($this->_prepareOptions($this->_options[$i], $i));
- }
- $this->_js .= "\n_hs_options['" . $this->_escapeString($this->getName()) . "'] = [\n" .
- implode(",\n", $jsParts) .
- "\n];\n";
- // default value; if we don't actually have any values yet just use
- // the first option (for single selects) or empty array (for multiple)
- $values = array();
- foreach (array_keys($this->_elements) as $key) {
- if (is_array($v = $this->_elements[$key]->getValue())) {
- $values[] = count($v) > 1? $v: $v[0];
- } else {
- // XXX: accessing the supposedly private _options array
- $values[] = $this->_elements[$key]->getMultiple() || empty($this->_elements[$key]->_options[0])?
- array():
- $this->_elements[$key]->_options[0]['attr']['value'];
- }
- }
- $this->_js .= "_hs_defaults['" . $this->_escapeString($this->getName()) . "'] = " .
- $this->_convertArrayToJavascript($values) . ";\n";
}
include_once('HTML/QuickForm/Renderer/Default.php');
- $renderer =& new HTML_QuickForm_Renderer_Default();
+ $renderer = new HTML_QuickForm_Renderer_Default();
$renderer->setElementTemplate('{element}');
parent::accept($renderer);
-
- if (!empty($onChange)) {
- $keys = array_keys($this->_elements);
- for ($i = 0; $i < count($keys) - 1; $i++) {
- $this->_elements[$keys[$i]]->updateAttributes(array('onchange' => $onChange[$i]));
- }
+ $result = null;
+ if ( ! empty( $this->_js ) ) {
+ $result .= "<script type=\"text/javascript\">\n//<![CDATA[\n" . $this->_js . "//]]>\n</script>";
}
- return (empty($this->_js)? '': "<script type=\"text/javascript\">\n//<![CDATA[\n" . $this->_js . "//]]>\n</script>") .
+ return $result .
$renderer->toHtml();
} // end func toHtml
// }}}
// {{{ accept()
+ /**
+ * Accepts a renderer
+ *
+ * @param object An HTML_QuickForm_Renderer object
+ * @param bool Whether a group is required
+ * @param string An error message associated with a group
+ * @access public
+ * @return void
+ */
function accept(&$renderer, $required = false, $error = null)
{
$renderer->renderElement($this, $required, $error);
@@ -504,147 +483,10 @@
// matches the main option
return HTML_QuickForm_element::onQuickFormEvent($event, $arg, $caller);
} else {
- $ret = parent::onQuickFormEvent($event, $arg, $caller);
- // add onreset handler to form to properly reset hierselect (see bug #2970)
- if ('addElement' == $event) {
- $onReset = $caller->getAttribute('onreset');
- if (strlen($onReset)) {
- if (strpos($onReset, '_hs_setupOnReset')) {
- $caller->updateAttributes(array('onreset' => str_replace('_hs_setupOnReset(this, [', "_hs_setupOnReset(this, ['" . $this->_escapeString($this->getName()) . "', ", $onReset)));
- } else {
- $caller->updateAttributes(array('onreset' => "var temp = function() { {$onReset} } ; if (!temp()) { return false; } ; if (typeof _hs_setupOnReset != 'undefined') { return _hs_setupOnReset(this, ['" . $this->_escapeString($this->getName()) . "']); } "));
- }
- } else {
- $caller->updateAttributes(array('onreset' => "if (typeof _hs_setupOnReset != 'undefined') { return _hs_setupOnReset(this, ['" . $this->_escapeString($this->getName()) . "']); } "));
- }
- }
- return $ret;
+ return parent::onQuickFormEvent($event, $arg, $caller);
}
} // end func onQuickFormEvent
// }}}
- // {{{ _prepareOptions()
-
- /**
- * Prepares options for JS encoding
- *
- * We need to preserve order of options when adding them via javascript, so
- * cannot use object literal and for/in loop (see bug #16603). Therefore we
- * convert an associative array of options to two arrays of their values
- * and texts. Backport from HTML_QuickForm2.
- *
- * @param array Options array
- * @param int Depth within options array
- * @link http://pear.php.net/bugs/bug.php?id=16603
- * @return array
- * @access private
- */
- function _prepareOptions($ary, $depth)
- {
- if (!is_array($ary)) {
- $ret = $ary;
- } elseif (0 == $depth) {
- $ret = array('values' => array_keys($ary), 'texts' => array_values($ary));
- } else {
- $ret = array();
- foreach ($ary as $k => $v) {
- $ret[$k] = $this->_prepareOptions($v, $depth - 1);
- }
- }
- return $ret;
- }
-
- // }}}
- // {{{ _convertArrayToJavascript()
-
- /**
- * Converts PHP array to its Javascript analog
- *
- * @access private
- * @param array PHP array to convert
- * @return string Javascript representation of the value
- */
- function _convertArrayToJavascript($array)
- {
- if (!is_array($array)) {
- return $this->_convertScalarToJavascript($array);
- } elseif (count($array) && array_keys($array) != range(0, count($array) - 1)) {
- return '{' . implode(',', array_map(
- array($this, '_encodeNameValue'),
- array_keys($array), array_values($array)
- )) . '}';
- } else {
- return '[' . implode(',', array_map(
- array($this, '_convertArrayToJavascript'),
- $array
- )) . ']';
- }
- }
-
- // }}}
- // {{{ _encodeNameValue()
-
- /**
- * Callback for array_map used to generate JS name-value pairs
- *
- * @param mixed
- * @param mixed
- * @return string
- */
- function _encodeNameValue($name, $value)
- {
- return $this->_convertScalarToJavascript((string)$name) . ':'
- . $this->_convertArrayToJavascript($value);
- }
-
- // }}}
- // {{{ _convertScalarToJavascript()
-
- /**
- * Converts PHP's scalar value to its Javascript analog
- *
- * @access private
- * @param mixed PHP value to convert
- * @return string Javascript representation of the value
- */
- function _convertScalarToJavascript($val)
- {
- if (is_bool($val)) {
- return $val ? 'true' : 'false';
- } elseif (is_int($val) || is_double($val)) {
- return $val;
- } elseif (is_string($val)) {
- return "'" . $this->_escapeString($val) . "'";
- } elseif (is_null($val)) {
- return 'null';
- } else {
- // don't bother
- return '{}';
- }
- }
-
- // }}}
- // {{{ _escapeString()
-
- /**
- * Quotes the string so that it can be used in Javascript string constants
- *
- * @access private
- * @param string
- * @return string
- */
- function _escapeString($str)
- {
- return strtr($str,array(
- "\r" => '\r',
- "\n" => '\n',
- "\t" => '\t',
- "'" => "\\'",
- '"' => '\"',
- '\\' => '\\\\'
- ));
- }
-
- // }}}
} // end class HTML_QuickForm_hierselect
?>
\ No newline at end of file
diff -ruwN _ORIGINAL_/HTML/QuickForm/html.php HTML/QuickForm/html.php
--- _ORIGINAL_/HTML/QuickForm/html.php 2021-08-25 09:24:31.894785793 +1000
+++ HTML/QuickForm/html.php 2021-05-23 06:58:15.329915618 +1000
@@ -50,9 +50,9 @@
* @access public
* @return void
*/
- function HTML_QuickForm_html($text = null)
+ function __construct($text = null)
{
- $this->HTML_QuickForm_static(null, null, $text);
+ parent::__construct(null, null, $text);
$this->_type = 'html';
}
diff -ruwN _ORIGINAL_/HTML/QuickForm/image.php HTML/QuickForm/image.php
--- _ORIGINAL_/HTML/QuickForm/image.php 2021-08-25 09:24:31.894785793 +1000
+++ HTML/QuickForm/image.php 2021-05-23 06:58:15.329915618 +1000
@@ -52,9 +52,9 @@
* @access public
* @return void
*/
- function HTML_QuickForm_image($elementName=null, $src='', $attributes=null)
+ function __construct($elementName=null, $src='', $attributes=null)
{
- HTML_QuickForm_input::HTML_QuickForm_input($elementName, null, $attributes);
+ parent::__construct($elementName, null, $attributes);
$this->setType('image');
$this->setSource($src);
} // end class constructor
diff -ruwN _ORIGINAL_/HTML/QuickForm/input.php HTML/QuickForm/input.php
--- _ORIGINAL_/HTML/QuickForm/input.php 2021-08-25 09:24:31.894785793 +1000
+++ HTML/QuickForm/input.php 2021-05-23 06:58:15.329915618 +1000
@@ -52,9 +52,9 @@
* @access public
* @return void
*/
- function HTML_QuickForm_input($elementName=null, $elementLabel=null, $attributes=null)
+ function __construct($elementName=null, $elementLabel=null, $attributes=null)
{
- $this->HTML_QuickForm_element($elementName, $elementLabel, $attributes);
+ parent::__construct($elementName, $elementLabel, $attributes);
} //end constructor
// }}}
diff -ruwN _ORIGINAL_/HTML/QuickForm/link.php HTML/QuickForm/link.php
--- _ORIGINAL_/HTML/QuickForm/link.php 2021-08-25 09:24:31.894785793 +1000
+++ HTML/QuickForm/link.php 2021-05-23 06:58:15.329915618 +1000
@@ -65,9 +65,9 @@
* @return void
* @throws
*/
- function HTML_QuickForm_link($elementName=null, $elementLabel=null, $href=null, $text=null, $attributes=null)
+ function __construct($elementName=null, $elementLabel=null, $href=null, $text=null, $attributes=null)
{
- HTML_QuickForm_element::HTML_QuickForm_element($elementName, $elementLabel, $attributes);
+ parent::__construct($elementName, $elementLabel, $attributes);
$this->_persistantFreeze = false;
$this->_type = 'link';
$this->setHref($href);
diff -ruwN _ORIGINAL_/HTML/QuickForm/Page.php HTML/QuickForm/Page.php
--- _ORIGINAL_/HTML/QuickForm/Page.php 2021-08-25 09:24:31.906785905 +1000
+++ HTML/QuickForm/Page.php 2021-05-23 06:58:15.325915587 +1000
@@ -16,9 +16,9 @@
* @package HTML_QuickForm_Controller
* @author Alexey Borzov <avb@php.net>
* @author Bertrand Mansion <bmansion@mamasam.com>
- * @copyright 2003-2009 The PHP Group
+ * @copyright 2003-2007 The PHP Group
* @license http://www.php.net/license/3_01.txt PHP License 3.01
- * @version SVN: $Id: Page.php 289084 2009-10-02 06:53:09Z avb $
+ * @version CVS: $Id: Page.php,v 1.7 2007/05/18 09:34:18 avb Exp $
* @link http://pear.php.net/package/HTML_QuickForm_Controller
*/
@@ -38,7 +38,7 @@
* @package HTML_QuickForm_Controller
* @author Alexey Borzov <avb@php.net>
* @author Bertrand Mansion <bmansion@mamasam.com>
- * @version Release: 1.0.10
+ * @version Release: 1.0.9
*/
class HTML_QuickForm_Page extends HTML_QuickForm
{
@@ -66,9 +66,9 @@
*
* @access public
*/
- function HTML_QuickForm_Page($formName, $method = 'post', $target = '', $attributes = null)
+ function __construct($formName, $method = 'post', $target = '', $attributes = null)
{
- $this->HTML_QuickForm($formName, $method, '', $target, $attributes);
+ parent::__construct($formName, $method, '', $target, $attributes);
}
@@ -112,10 +112,14 @@
* @param string Name of the action
* @return string "name" attribute for a submit button
*/
- function getButtonName($actionName)
+ function getButtonName($actionName, $subActionName = null)
{
+ if ( $subActionName != null ) {
+ return '_qf_' . $this->getAttribute('id') . '_' . $actionName . '_' . $subActionName;
+ } else {
return '_qf_' . $this->getAttribute('id') . '_' . $actionName;
}
+ }
/**
diff -ruwN _ORIGINAL_/HTML/QuickForm/password.php HTML/QuickForm/password.php
--- _ORIGINAL_/HTML/QuickForm/password.php 2021-08-25 09:24:31.894785793 +1000
+++ HTML/QuickForm/password.php 2021-05-23 06:58:15.329915618 +1000
@@ -53,9 +53,9 @@
* @return void
* @throws
*/
- function HTML_QuickForm_password($elementName=null, $elementLabel=null, $attributes=null)
+ function __construct($elementName=null, $elementLabel=null, $attributes=null)
{
- HTML_QuickForm_input::HTML_QuickForm_input($elementName, $elementLabel, $attributes);
+ parent::__construct($elementName, $elementLabel, $attributes);
$this->setType('password');
} //end constructor
diff -ruwN _ORIGINAL_/HTML/QuickForm/radio.php HTML/QuickForm/radio.php
--- _ORIGINAL_/HTML/QuickForm/radio.php 2021-08-25 09:24:31.894785793 +1000
+++ HTML/QuickForm/radio.php 2021-05-23 06:58:15.329915618 +1000
@@ -64,16 +64,31 @@
* @access public
* @return void
*/
- function HTML_QuickForm_radio($elementName=null, $elementLabel=null, $text=null, $value=null, $attributes=null)
+ function __construct($elementName=null, $elementLabel=null, $text=null, $value=null, $attributes=null)
{
- $this->HTML_QuickForm_element($elementName, $elementLabel, $attributes);
+
+ parent::__construct($elementName, $elementLabel, $attributes);
if (isset($value)) {
$this->setValue($value);
}
$this->_persistantFreeze = true;
$this->setType('radio');
$this->_text = $text;
- $this->_generateId();
+ // $this->_generateId();
+ if ( ! $this->getAttribute('id') ) {
+ //hack to add 'id' for radio
+ static $idTextStr = 1;
+ if (!empty($attributes['id_suffix'])) {
+ $idSuffix = $attributes['id_suffix'];
+ $this->removeAttribute('id_suffix');
+ }
+ else {
+ $idSuffix = $idTextStr;
+ $idTextStr++;
+ }
+
+ $this->updateAttributes( array('id' => CRM_Utils_String::munge( "CIVICRM_QFID_{$value}_{$idSuffix}" ) ) );
+ }
} //end constructor
// }}}
@@ -202,11 +217,13 @@
switch ($event) {
case 'updateValue':
// constant values override both default and submitted ones
- // default values are overriden by submitted
$value = $this->_findValue($caller->_constantValues);
if (null === $value) {
+ // we should retrieve value from submitted values when form is submitted,
+ // else set value from defaults values
+ if ( $caller->isSubmitted( ) ) {
$value = $this->_findValue($caller->_submitValues);
- if (null === $value) {
+ } else {
$value = $this->_findValue($caller->_defaultValues);
}
}
@@ -239,7 +256,10 @@
{
$value = $this->_findValue($submitValues);
if (null === $value) {
- $value = $this->getChecked()? $this->getValue(): null;
+ // fix to return blank value when all radio's are unselected / not selected
+ // always use submitted values rather than defaults
+ //$value = $this->getChecked()? $this->getValue(): null;
+ $value = '';
} elseif ($value != $this->getValue()) {
$value = null;
}
diff -ruwN _ORIGINAL_/HTML/QuickForm/Renderer/Array.php HTML/QuickForm/Renderer/Array.php
--- _ORIGINAL_/HTML/QuickForm/Renderer/Array.php 2021-08-25 09:24:31.890785757 +1000
+++ HTML/QuickForm/Renderer/Array.php 2021-05-23 06:58:15.325915587 +1000
@@ -168,9 +168,9 @@
* @param bool true: render an array of labels to many labels, $key 0 to 'label' and the oterh to "label_$key"
* @access public
*/
- function HTML_QuickForm_Renderer_Array($collectHidden = false, $staticLabels = false)
+ function __construct($collectHidden = false, $staticLabels = false)
{
- $this->HTML_QuickForm_Renderer();
+ parent::__construct();
$this->_collectHidden = $collectHidden;
$this->_staticLabels = $staticLabels;
} // end constructor
@@ -226,12 +226,16 @@
} // end func renderElement
- function renderHidden(&$element)
+ function renderHidden(&$element, $required = FALSE, $error = FALSE)
{
if ($this->_collectHidden) {
+ // add to error array
+ if (!empty($error)) {
+ $this->_ary['errors']['hidden'] = $error;
+ }
$this->_ary['hidden'] .= $element->toHtml() . "\n";
} else {
- $this->renderElement($element, false, null);
+ $this->renderElement($element, $required, $error);
}
} // end func renderHidden
@@ -271,6 +275,12 @@
'required' => $required,
'error' => $error
);
+
+ $id = $element->getAttribute('id');
+ if ( $id ) {
+ $ret['id'] = $id;
+ }
+
// render label(s)
$labels = $element->getLabel();
if (is_array($labels) && $this->_staticLabels) {
diff -ruwN _ORIGINAL_/HTML/QuickForm/Renderer/ArraySmarty.php HTML/QuickForm/Renderer/ArraySmarty.php
--- _ORIGINAL_/HTML/QuickForm/Renderer/ArraySmarty.php 2021-08-25 09:24:31.890785757 +1000
+++ HTML/QuickForm/Renderer/ArraySmarty.php 2021-05-23 06:58:15.325915587 +1000
@@ -136,9 +136,9 @@
* @param bool true: collect all hidden elements into string; false: process them as usual form elements
* @access public
*/
- function HTML_QuickForm_Renderer_ArraySmarty(&$tpl, $staticLabels = false, $collectHidden = true)
+ function __construct(&$tpl, $staticLabels = false, $collectHidden = true)
{
- $this->HTML_QuickForm_Renderer_Array($collectHidden, $staticLabels);
+ parent::__construct($collectHidden, $staticLabels);
$this->_tpl =& $tpl;
} // end constructor
@@ -257,15 +257,14 @@
function _storeArray($elAry)
{
if ($elAry) {
- $sKeys = $elAry['keys'];
+ $keys = explode('][', substr(str_replace(["['", "']", '["', '"]'], ['[', ']', '[', ']'], $elAry['keys']), 1, -1));
unset($elAry['keys']);
// where should we put this element...
if (is_array($this->_currentGroup) && ('group' != $elAry['type'])) {
- $toEval = '$this->_currentGroup' . $sKeys . ' = $elAry;';
+ CRM_Utils_Array::pathSet($this->_currentGroup, $keys, $elAry);
} else {
- $toEval = '$this->_ary' . $sKeys . ' = $elAry;';
+ CRM_Utils_Array::pathSet($this->_ary, $keys, $elAry);
}
- eval($toEval);
}
return;
}
diff -ruwN _ORIGINAL_/HTML/QuickForm/Renderer/Default.php HTML/QuickForm/Renderer/Default.php
--- _ORIGINAL_/HTML/QuickForm/Renderer/Default.php 2021-08-25 09:24:31.890785757 +1000
+++ HTML/QuickForm/Renderer/Default.php 2021-05-23 06:58:15.325915587 +1000
@@ -152,9 +152,9 @@
*
* @access public
*/
- function HTML_QuickForm_Renderer_Default()
+ function __construct()
{
- $this->HTML_QuickForm_Renderer();
+ parent::__construct();
} // end constructor
/**
@@ -291,6 +291,10 @@
*/
function renderElement(&$element, $required, $error)
{
+ // make sure that all elements are id'ed even in a group!
+
+ CRM_Core_Form_Renderer::updateAttributes( $element, $required, $error );
+
if (!$this->_inGroup) {
$html = $this->_prepareTemplate($element->getName(), $element->getLabel(), $required, $error);
$this->_html .= str_replace('{element}', $element->toHtml(), $html);
diff -ruwN _ORIGINAL_/HTML/QuickForm/Renderer/ITDynamic.php HTML/QuickForm/Renderer/ITDynamic.php
--- _ORIGINAL_/HTML/QuickForm/Renderer/ITDynamic.php 2021-08-25 09:24:31.890785757 +1000
+++ HTML/QuickForm/Renderer/ITDynamic.php 2021-05-23 06:58:15.325915587 +1000
@@ -97,9 +97,9 @@
*
* @param HTML_Template_ITX|HTML_Template_Sigma Template object to use
*/
- function HTML_QuickForm_Renderer_ITDynamic(&$tpl)
+ function __construct(&$tpl)
{
- $this->HTML_QuickForm_Renderer();
+ parent::__construct();
$this->_tpl =& $tpl;
$this->_tpl->setCurrentBlock('qf_main_loop');
}
diff -ruwN _ORIGINAL_/HTML/QuickForm/Renderer/ITStatic.php HTML/QuickForm/Renderer/ITStatic.php
--- _ORIGINAL_/HTML/QuickForm/Renderer/ITStatic.php 2021-08-25 09:24:31.890785757 +1000
+++ HTML/QuickForm/Renderer/ITStatic.php 2021-05-23 06:58:15.325915587 +1000
@@ -112,9 +112,9 @@
*
* @param HTML_Template_IT|HTML_Template_Sigma Template object to use
*/
- function HTML_QuickForm_Renderer_ITStatic(&$tpl)
+ function __construct(&$tpl)
{
- $this->HTML_QuickForm_Renderer();
+ parent::__construct();
$this->_tpl =& $tpl;
} // end constructor
diff -ruwN _ORIGINAL_/HTML/QuickForm/Renderer/ObjectFlexy.php HTML/QuickForm/Renderer/ObjectFlexy.php
--- _ORIGINAL_/HTML/QuickForm/Renderer/ObjectFlexy.php 2021-08-25 09:24:31.890785757 +1000
+++ HTML/QuickForm/Renderer/ObjectFlexy.php 2021-05-23 06:58:15.325915587 +1000
@@ -104,9 +104,9 @@
* @param HTML_Template_Flexy template object to use
* @public
*/
- function HTML_QuickForm_Renderer_ObjectFlexy(&$flexy)
+ function __construct(&$flexy)
{
- $this->HTML_QuickForm_Renderer_Object(true);
+ parent::__construct(true);
$this->_obj = new QuickformFlexyForm();
$this->_flexy =& $flexy;
} // end constructor
diff -ruwN _ORIGINAL_/HTML/QuickForm/Renderer/Object.php HTML/QuickForm/Renderer/Object.php
--- _ORIGINAL_/HTML/QuickForm/Renderer/Object.php 2021-08-25 09:24:31.890785757 +1000
+++ HTML/QuickForm/Renderer/Object.php 2021-05-23 06:58:15.325915587 +1000
@@ -92,9 +92,9 @@
* @param bool true: collect all hidden elements
* @access public
*/
- function HTML_QuickForm_Renderer_Object($collecthidden = false)
+ function __construct($collecthidden = false)
{
- $this->HTML_QuickForm_Renderer();
+ parent::__construct();
$this->_collectHidden = $collecthidden;
$this->_obj = new QuickformForm;
}
diff -ruwN _ORIGINAL_/HTML/QuickForm/Renderer/QuickHtml.php HTML/QuickForm/Renderer/QuickHtml.php
--- _ORIGINAL_/HTML/QuickForm/Renderer/QuickHtml.php 2021-08-25 09:24:31.890785757 +1000
+++ HTML/QuickForm/Renderer/QuickHtml.php 2021-05-23 06:58:15.325915587 +1000
@@ -59,9 +59,9 @@
* @access public
* @return void
*/
- function HTML_QuickForm_Renderer_QuickHtml()
+ function __construct()
{
- $this->HTML_QuickForm_Renderer_Default();
+ parent::__construct();
// The default templates aren't used for this renderer
$this->clearAllTemplates();
} // end constructor
diff -ruwN _ORIGINAL_/HTML/QuickForm/Renderer.php HTML/QuickForm/Renderer.php
--- _ORIGINAL_/HTML/QuickForm/Renderer.php 2021-08-25 09:24:31.890785757 +1000
+++ HTML/QuickForm/Renderer.php 2021-05-23 06:58:15.325915587 +1000
@@ -40,7 +40,7 @@
*
* @access public
*/
- function HTML_QuickForm_Renderer()
+ function __construct()
{
} // end constructor
diff -ruwN _ORIGINAL_/HTML/QuickForm/reset.php HTML/QuickForm/reset.php
--- _ORIGINAL_/HTML/QuickForm/reset.php 2021-08-25 09:24:31.894785793 +1000
+++ HTML/QuickForm/reset.php 2021-05-23 06:58:15.329915618 +1000
@@ -52,9 +52,9 @@
* @access public
* @return void
*/
- function HTML_QuickForm_reset($elementName=null, $value=null, $attributes=null)
+ function __construct($elementName=null, $value=null, $attributes=null)
{
- HTML_QuickForm_input::HTML_QuickForm_input($elementName, null, $attributes);
+ parent::__construct($elementName, null, $attributes);
$this->setValue($value);
$this->setType('reset');
} //end constructor
diff -ruwN _ORIGINAL_/HTML/QuickForm/Rule/Required.php HTML/QuickForm/Rule/Required.php
--- _ORIGINAL_/HTML/QuickForm/Rule/Required.php 2021-08-25 09:24:31.890785757 +1000
+++ HTML/QuickForm/Rule/Required.php 2021-05-23 06:58:15.325915587 +1000
@@ -48,7 +48,28 @@
function validate($value, $options = null)
{
if (is_array($value)) {
- return (bool) $value;
+ // check if file type, if so permit empty type
+ $fileType =
+ array_key_exists( 'name', $value ) &&
+ array_key_exists( 'tmp_name', $value );
+ // hack to fix required issue with advcheckbox, but in general if any value is present then
+ // it should pass required check
+ $return = false;
+ foreach ( $value as $k => $v ) {
+ // dont check type field. Safari3 Beta does not set this
+ if ( $fileType && $k == 'type' ) {
+ continue;
+ }
+ if ( is_array($v) ) {
+ if ( $v ) {
+ $return = true;
+ }
+ }
+ elseif ( ( string ) $v != '' ) {
+ $return = true;
+ }
+ }
+ return $return;
} else if ((string)$value == '') {
return false;
}
diff -ruwN _ORIGINAL_/HTML/QuickForm/RuleRegistry.php HTML/QuickForm/RuleRegistry.php
--- _ORIGINAL_/HTML/QuickForm/RuleRegistry.php 2021-08-25 09:24:31.890785757 +1000
+++ HTML/QuickForm/RuleRegistry.php 2021-05-23 06:58:15.329915618 +1000
@@ -54,7 +54,7 @@
* @static
* @return HTML_QuickForm_RuleRegistry
*/
- function &singleton()
+ static function &singleton()
{
static $obj;
if (!isset($obj)) {
@@ -125,7 +125,7 @@
if (!empty($path)) {
include_once($path);
}
- $this->_rules[$class] =& new $class();
+ $this->_rules[$class] = new $class();
}
$this->_rules[$class]->setName($ruleName);
return $this->_rules[$class];
diff -ruwN _ORIGINAL_/HTML/QuickForm/select.php HTML/QuickForm/select.php
--- _ORIGINAL_/HTML/QuickForm/select.php 2021-08-25 09:24:31.894785793 +1000
+++ HTML/QuickForm/select.php 2021-05-23 06:58:15.329915618 +1000
@@ -75,9 +75,9 @@
* @access public
* @return void
*/
- function HTML_QuickForm_select($elementName=null, $elementLabel=null, $options=null, $attributes=null)
+ function __construct($elementName=null, $elementLabel=null, $options=null, $attributes=null)
{
- HTML_QuickForm_element::HTML_QuickForm_element($elementName, $elementLabel, $attributes);
+ parent::__construct($elementName, $elementLabel, $attributes);
$this->_persistantFreeze = true;
$this->_type = 'select';
if (isset($options)) {
@@ -403,7 +403,7 @@
{
if (is_string($conn)) {
require_once('DB.php');
- $dbConn = &DB::connect($conn, true);
+ $dbConn = DB::connect($conn, true);
if (DB::isError($dbConn)) {
return $dbConn;
}
@@ -521,14 +521,16 @@
$value = array();
if (is_array($this->_values)) {
foreach ($this->_values as $key => $val) {
- for ($i = 0, $optCount = count($this->_options); $i < $optCount; $i++) {
- if (0 == strcmp($val, $this->_options[$i]['attr']['value'])) {
- $value[$key] = $this->_options[$i]['text'];
+ if ( $val || is_numeric($val) ) {
+ foreach ($this->_options as $oKey => $oVal ) {
+ if (0 == strcmp($val, $this->_options[$oKey]['attr']['value'])) {
+ $value[$key] = $oVal['text'];
break;
}
}
}
}
+ }
$html = empty($value)? '&nbsp;': join('<br />', $value);
if ($this->_persistantFreeze) {
$name = $this->getPrivateName();
@@ -561,7 +563,9 @@
{
$value = $this->_findValue($submitValues);
if (is_null($value)) {
- $value = $this->getValue();
+ // if value is null, default value is set for advselect
+ // fix for CRM-1431 - kurund
+ //$value = $this->getValue();
} elseif(!is_array($value)) {
$value = array($value);
}
@@ -576,10 +580,19 @@
}
}
} else {
+ //if value is null make it empty array, checked most of
+ // the stuff, value is null for advselect
+ // fix for CRM-1431 - kurund
+ if (is_null($value)) {
+ $cleanValue = array();
+ } else {
$cleanValue = $value;
}
+ }
if (is_array($cleanValue) && !$this->getMultiple()) {
+ if ( isset( $cleanValue[0] ) ) {
return $this->_prepareValue($cleanValue[0], $assoc);
+ }
} else {
return $this->_prepareValue($cleanValue, $assoc);
}
diff -ruwN _ORIGINAL_/HTML/QuickForm/static.php HTML/QuickForm/static.php
--- _ORIGINAL_/HTML/QuickForm/static.php 2021-08-25 09:24:31.894785793 +1000
+++ HTML/QuickForm/static.php 2021-05-23 06:58:15.329915618 +1000
@@ -57,9 +57,9 @@
* @access public
* @return void
*/
- function HTML_QuickForm_static($elementName=null, $elementLabel=null, $text=null)
+ function __construct($elementName=null, $elementLabel=null, $text=null)
{
- HTML_QuickForm_element::HTML_QuickForm_element($elementName, $elementLabel);
+ parent::__construct($elementName, $elementLabel);
$this->_persistantFreeze = false;
$this->_type = 'static';
$this->_text = $text;
diff -ruwN _ORIGINAL_/HTML/QuickForm/submit.php HTML/QuickForm/submit.php
--- _ORIGINAL_/HTML/QuickForm/submit.php 2021-08-25 09:24:31.894785793 +1000
+++ HTML/QuickForm/submit.php 2021-05-23 06:58:15.329915618 +1000
@@ -51,9 +51,9 @@
* @access public
* @return void
*/
- function HTML_QuickForm_submit($elementName=null, $value=null, $attributes=null)
+ function __construct($elementName=null, $value=null, $attributes=null)
{
- HTML_QuickForm_input::HTML_QuickForm_input($elementName, null, $attributes);
+ parent::__construct($elementName, null, $attributes);
$this->setValue($value);
$this->setType('submit');
} //end constructor
diff -ruwN _ORIGINAL_/HTML/QuickForm/textarea.php HTML/QuickForm/textarea.php
--- _ORIGINAL_/HTML/QuickForm/textarea.php 2021-08-25 09:24:31.894785793 +1000
+++ HTML/QuickForm/textarea.php 2021-05-23 06:58:15.329915618 +1000
@@ -62,9 +62,9 @@
* @access public
* @return void
*/
- function HTML_QuickForm_textarea($elementName=null, $elementLabel=null, $attributes=null)
+ function __construct($elementName=null, $elementLabel=null, $attributes=null)
{
- HTML_QuickForm_element::HTML_QuickForm_element($elementName, $elementLabel, $attributes);
+ parent::__construct($elementName, $elementLabel, $attributes);
$this->_persistantFreeze = true;
$this->_type = 'textarea';
} //end constructor
@@ -197,7 +197,7 @@
return $this->_getTabs() .
'<textarea' . $this->_getAttrString($this->_attributes) . '>' .
// because we wrap the form later we don't want the text indented
- preg_replace("/(\r\n|\n|\r)/", '&#010;', htmlspecialchars($this->_value)) .
+ preg_replace("/(\r\n|\n|\r)/", '&#013;&#010;', htmlspecialchars($this->_value)) .
'</textarea>';
}
} //end func toHtml
diff -ruwN _ORIGINAL_/HTML/QuickForm/text.php HTML/QuickForm/text.php
--- _ORIGINAL_/HTML/QuickForm/text.php 2021-08-25 09:24:31.894785793 +1000
+++ HTML/QuickForm/text.php 2021-05-23 06:58:15.329915618 +1000
@@ -53,9 +53,9 @@
* @access public
* @return void
*/
- function HTML_QuickForm_text($elementName=null, $elementLabel=null, $attributes=null)
+ function __construct($elementName=null, $elementLabel=null, $attributes=null)
{
- HTML_QuickForm_input::HTML_QuickForm_input($elementName, $elementLabel, $attributes);
+ parent::__construct($elementName, $elementLabel, $attributes);
$this->_persistantFreeze = true;
$this->setType('text');
} //end constructor
diff -ruwN _ORIGINAL_/HTML/QuickForm/xbutton.php HTML/QuickForm/xbutton.php
--- _ORIGINAL_/HTML/QuickForm/xbutton.php 2021-08-25 09:24:31.894785793 +1000
+++ HTML/QuickForm/xbutton.php 2021-05-23 06:58:15.329915618 +1000
@@ -52,9 +52,9 @@
* @param mixed Either a typical HTML attribute string or an associative array
* @access public
*/
- function HTML_QuickForm_xbutton($elementName = null, $elementContent = null, $attributes = null)
+ function __construct($elementName = null, $elementContent = null, $attributes = null)
{
- $this->HTML_QuickForm_element($elementName, null, $attributes);
+ parent::__construct($elementName, null, $attributes);
$this->setContent($elementContent);
$this->setPersistantFreeze(false);
$this->_type = 'xbutton';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment