PDF rausgenommen
This commit is contained in:
161
msd2/tracking/piwik/libs/HTML/QuickForm2/Element/Button.php
Normal file
161
msd2/tracking/piwik/libs/HTML/QuickForm2/Element/Button.php
Normal file
@ -0,0 +1,161 @@
|
||||
<?php
|
||||
/**
|
||||
* Class for <button> elements
|
||||
*
|
||||
* PHP version 5
|
||||
*
|
||||
* LICENSE:
|
||||
*
|
||||
* Copyright (c) 2006-2010, Alexey Borzov <avb@php.net>,
|
||||
* Bertrand Mansion <golgote@mamasam.com>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * The names of the authors may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
|
||||
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* @category HTML
|
||||
* @package HTML_QuickForm2
|
||||
* @author Alexey Borzov <avb@php.net>
|
||||
* @author Bertrand Mansion <golgote@mamasam.com>
|
||||
* @license http://opensource.org/licenses/bsd-license.php New BSD License
|
||||
* @version SVN: $Id: Button.php 300722 2010-06-24 10:15:52Z mansion $
|
||||
* @link http://pear.php.net/package/HTML_QuickForm2
|
||||
*/
|
||||
|
||||
/**
|
||||
* Base class for simple HTML_QuickForm2 elements
|
||||
*/
|
||||
// require_once 'HTML/QuickForm2/Element.php';
|
||||
|
||||
/**
|
||||
* Class for <button> elements
|
||||
*
|
||||
* Note that this element was named 'xbutton' in previous version of QuickForm,
|
||||
* the name 'button' being used for current 'inputbutton' element.
|
||||
*
|
||||
* @category HTML
|
||||
* @package HTML_QuickForm2
|
||||
* @author Alexey Borzov <avb@php.net>
|
||||
* @author Bertrand Mansion <golgote@mamasam.com>
|
||||
* @version Release: @package_version@
|
||||
*/
|
||||
class HTML_QuickForm2_Element_Button extends HTML_QuickForm2_Element
|
||||
{
|
||||
/**
|
||||
* Contains options and data used for the element creation
|
||||
* - content: Content to be displayed between <button></button> tags
|
||||
* @var array
|
||||
*/
|
||||
protected $data = array('content' => '');
|
||||
|
||||
/**
|
||||
* Element's submit value
|
||||
* @var string
|
||||
*/
|
||||
protected $submitValue = null;
|
||||
|
||||
|
||||
public function getType()
|
||||
{
|
||||
return 'button';
|
||||
}
|
||||
|
||||
/**
|
||||
* Buttons can not be frozen
|
||||
*
|
||||
* @param bool Whether element should be frozen or editable. This
|
||||
* parameter is ignored in case of buttons
|
||||
* @return bool Always returns false
|
||||
*/
|
||||
public function toggleFrozen($freeze = null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the contents of the button element
|
||||
*
|
||||
* @param string Button content (HTML to add between <button></button> tags)
|
||||
* @return HTML_QuickForm2_Element_Button
|
||||
*/
|
||||
function setContent($content)
|
||||
{
|
||||
$this->data['content'] = $content;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Button's value cannot be set via this method
|
||||
*
|
||||
* @param mixed Element's value, this parameter is ignored
|
||||
* @return HTML_QuickForm2_Element_Button
|
||||
*/
|
||||
public function setValue($value)
|
||||
{
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the element's value
|
||||
*
|
||||
* The value is only returned if the following is true
|
||||
* - button has 'type' attribute set to 'submit' (or no 'type' attribute)
|
||||
* - the form was submitted by clicking on this button
|
||||
*
|
||||
* This method returns the actual value submitted by the browser. Note that
|
||||
* different browsers submit different values!
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getValue()
|
||||
{
|
||||
if ((empty($this->attributes['type']) || 'submit' == $this->attributes['type']) &&
|
||||
!$this->getAttribute('disabled'))
|
||||
{
|
||||
return $this->applyFilters($this->submitValue);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public function __toString()
|
||||
{
|
||||
return $this->getIndent() . '<button' . $this->getAttributes(true) .
|
||||
'>' . $this->data['content'] . '</button>';
|
||||
}
|
||||
|
||||
public function updateValue()
|
||||
{
|
||||
foreach ($this->getDataSources() as $ds) {
|
||||
if ($ds instanceof HTML_QuickForm2_DataSource_Submit &&
|
||||
null !== ($value = $ds->getValue($this->getName())))
|
||||
{
|
||||
$this->submitValue = $value;
|
||||
return;
|
||||
}
|
||||
}
|
||||
$this->submitValue = null;
|
||||
}
|
||||
}
|
||||
?>
|
503
msd2/tracking/piwik/libs/HTML/QuickForm2/Element/Date.php
Normal file
503
msd2/tracking/piwik/libs/HTML/QuickForm2/Element/Date.php
Normal file
@ -0,0 +1,503 @@
|
||||
<?php
|
||||
/**
|
||||
* Date element
|
||||
*
|
||||
* PHP version 5
|
||||
*
|
||||
* LICENSE:
|
||||
*
|
||||
* Copyright (c) 2006-2009, Alexey Borzov <avb@php.net>,
|
||||
* Bertrand Mansion <golgote@mamasam.com>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * The names of the authors may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
|
||||
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* @category HTML
|
||||
* @package HTML_QuickForm2
|
||||
* @author Alexey Borzov <avb@php.net>
|
||||
* @author Bertrand Mansion <golgote@mamasam.com>
|
||||
* @license http://opensource.org/licenses/bsd-license.php New BSD License
|
||||
* @version SVN: $Id: Date.php 297453 2010-04-04 10:22:39Z mansion $
|
||||
* @link http://pear.php.net/package/HTML_QuickForm2
|
||||
*/
|
||||
|
||||
/**
|
||||
* Base class for HTML_QuickForm2 group of elements
|
||||
*/
|
||||
// require_once 'HTML/QuickForm2/Container/Group.php';
|
||||
/**
|
||||
* Base class for HTML_QuickForm2 select element
|
||||
*/
|
||||
// require_once 'HTML/QuickForm2/Element/Select.php';
|
||||
|
||||
/**
|
||||
* Class for a group of elements used to input dates (and times).
|
||||
*
|
||||
* @category HTML
|
||||
* @package HTML_QuickForm2
|
||||
* @author Alexey Borzov <avb@php.net>
|
||||
* @author Bertrand Mansion <golgote@mamasam.com>
|
||||
* @version Release: @package_version@
|
||||
*/
|
||||
class HTML_QuickForm2_Element_Date extends HTML_QuickForm2_Container_Group
|
||||
{
|
||||
public function getType()
|
||||
{
|
||||
return 'date';
|
||||
}
|
||||
|
||||
/**
|
||||
* Various options to control the element's display.
|
||||
* @var array
|
||||
*/
|
||||
protected $data = array(
|
||||
'language' => 'en',
|
||||
'format' => 'dMY',
|
||||
'minYear' => 2001,
|
||||
'maxYear' => 2010,
|
||||
'addEmptyOption' => false,
|
||||
'emptyOptionValue' => '',
|
||||
'emptyOptionText' => ' ',
|
||||
'optionIncrement' => array('i' => 1, 's' => 1)
|
||||
);
|
||||
|
||||
/**
|
||||
* Class constructor
|
||||
*
|
||||
* The following keys may appear in $data array:
|
||||
* - 'language': date language
|
||||
* - 'format': Format of the date, based on PHP's date() function.
|
||||
* The following characters are currently recognised in format string:
|
||||
* <pre>
|
||||
* D => Short names of days
|
||||
* l => Long names of days
|
||||
* d => Day numbers
|
||||
* M => Short names of months
|
||||
* F => Long names of months
|
||||
* m => Month numbers
|
||||
* Y => Four digit year
|
||||
* y => Two digit year
|
||||
* h => 12 hour format
|
||||
* H => 23 hour format
|
||||
* i => Minutes
|
||||
* s => Seconds
|
||||
* a => am/pm
|
||||
* A => AM/PM
|
||||
* </pre>
|
||||
* - 'minYear': Minimum year in year select
|
||||
* - 'maxYear': Maximum year in year select
|
||||
* - 'addEmptyOption': Should an empty option be added to the top of
|
||||
* each select box?
|
||||
* - 'emptyOptionValue': The value passed by the empty option.
|
||||
* - 'emptyOptionText': The text displayed for the empty option.
|
||||
* - 'optionIncrement': Step to increase the option values by (works for 'i' and 's')
|
||||
*
|
||||
* @param string Element name
|
||||
* @param mixed Attributes (either a string or an array)
|
||||
* @param array Element data (label, options and data used for element creation)
|
||||
*/
|
||||
public function __construct($name = null, $attributes = null, $data = null)
|
||||
{
|
||||
parent::__construct($name, $attributes, $data);
|
||||
|
||||
$locale =& $this->locale[$this->data['language']];
|
||||
$backslash = false;
|
||||
$separators = array();
|
||||
$separator = '';
|
||||
|
||||
for ($i = 0, $length = strlen($this->data['format']); $i < $length; $i++) {
|
||||
$sign = $this->data['format']{$i};
|
||||
if ($backslash) {
|
||||
$backslash = false;
|
||||
$separator .= $sign;
|
||||
} else {
|
||||
$loadSelect = true;
|
||||
switch ($sign) {
|
||||
case 'D':
|
||||
// Sunday is 0 like with 'w' in date()
|
||||
$options = $locale['weekdays_short'];
|
||||
break;
|
||||
case 'l':
|
||||
$options = $locale['weekdays_long'];
|
||||
break;
|
||||
case 'd':
|
||||
$options = $this->createOptionList(1, 31);
|
||||
break;
|
||||
case 'M':
|
||||
$options = $locale['months_short'];
|
||||
array_unshift($options , '');
|
||||
unset($options[0]);
|
||||
break;
|
||||
case 'm':
|
||||
$options = $this->createOptionList(1, 12);
|
||||
break;
|
||||
case 'F':
|
||||
$options = $locale['months_long'];
|
||||
array_unshift($options , '');
|
||||
unset($options[0]);
|
||||
break;
|
||||
case 'Y':
|
||||
$options = $this->createOptionList(
|
||||
$this->data['minYear'],
|
||||
$this->data['maxYear'],
|
||||
$this->data['minYear'] > $this->data['maxYear']? -1: 1
|
||||
);
|
||||
break;
|
||||
case 'y':
|
||||
$options = $this->createOptionList(
|
||||
$this->data['minYear'],
|
||||
$this->data['maxYear'],
|
||||
$this->data['minYear'] > $this->data['maxYear']? -1: 1
|
||||
);
|
||||
array_walk($options, create_function('&$v,$k','$v = substr($v,-2);'));
|
||||
break;
|
||||
case 'h':
|
||||
$options = $this->createOptionList(1, 12);
|
||||
break;
|
||||
case 'g':
|
||||
$options = $this->createOptionList(1, 12);
|
||||
array_walk($options, create_function('&$v,$k', '$v = intval($v);'));
|
||||
break;
|
||||
case 'H':
|
||||
$options = $this->createOptionList(0, 23);
|
||||
break;
|
||||
case 'i':
|
||||
$options = $this->createOptionList(0, 59, $this->data['optionIncrement']['i']);
|
||||
break;
|
||||
case 's':
|
||||
$options = $this->createOptionList(0, 59, $this->data['optionIncrement']['s']);
|
||||
break;
|
||||
case 'a':
|
||||
$options = array('am' => 'am', 'pm' => 'pm');
|
||||
break;
|
||||
case 'A':
|
||||
$options = array('AM' => 'AM', 'PM' => 'PM');
|
||||
break;
|
||||
case 'W':
|
||||
$options = $this->createOptionList(1, 53);
|
||||
break;
|
||||
case '\\':
|
||||
$backslash = true;
|
||||
$loadSelect = false;
|
||||
break;
|
||||
default:
|
||||
$separator .= (' ' == $sign? ' ': $sign);
|
||||
$loadSelect = false;
|
||||
}
|
||||
|
||||
if ($loadSelect) {
|
||||
if (0 < count($this)) {
|
||||
$separators[] = $separator;
|
||||
}
|
||||
$separator = '';
|
||||
// Should we add an empty option to the top of the select?
|
||||
if (!is_array($this->data['addEmptyOption']) && $this->data['addEmptyOption'] ||
|
||||
is_array($this->data['addEmptyOption']) && !empty($this->data['addEmptyOption'][$sign])) {
|
||||
|
||||
// Using '+' array operator to preserve the keys
|
||||
if (is_array($this->data['emptyOptionText']) && !empty($this->data['emptyOptionText'][$sign])) {
|
||||
$options = array($this->data['emptyOptionValue'] => $this->data['emptyOptionText'][$sign]) + $options;
|
||||
} else {
|
||||
$options = array($this->data['emptyOptionValue'] => $this->data['emptyOptionText']) + $options;
|
||||
}
|
||||
}
|
||||
$this->addSelect($sign, $this->getAttributes())->loadOptions($options);
|
||||
}
|
||||
}
|
||||
}
|
||||
$separators[] = $separator . ($backslash? '\\': '');
|
||||
$this->setSeparator($separators);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates an option list containing the numbers from the start number to the end, inclusive
|
||||
*
|
||||
* @param int The start number
|
||||
* @param int The end number
|
||||
* @param int Increment by this value
|
||||
* @return array An array of numeric options.
|
||||
*/
|
||||
protected function createOptionList($start, $end, $step = 1)
|
||||
{
|
||||
for ($i = $start, $options = array(); $start > $end? $i >= $end: $i <= $end; $i += $step) {
|
||||
$options[$i] = sprintf('%02d', $i);
|
||||
}
|
||||
return $options;
|
||||
}
|
||||
|
||||
/**
|
||||
* Trims leading zeros from the (numeric) string
|
||||
*
|
||||
* @param string A numeric string, possibly with leading zeros
|
||||
* @return string String with leading zeros removed
|
||||
*/
|
||||
protected function trimLeadingZeros($str)
|
||||
{
|
||||
if (0 == strcmp($str, $this->data['emptyOptionValue'])) {
|
||||
return $str;
|
||||
}
|
||||
$trimmed = ltrim($str, '0');
|
||||
return strlen($trimmed)? $trimmed: '0';
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Tries to convert the given value to a usable date before setting the
|
||||
* element value
|
||||
* @param int|string|array A timestamp, a string compatible with strtotime()
|
||||
* or an array that fits the element names
|
||||
*/
|
||||
public function setValue($value)
|
||||
{
|
||||
if (empty($value)) {
|
||||
$value = array();
|
||||
} elseif (is_scalar($value)) {
|
||||
if (!is_numeric($value)) {
|
||||
$value = strtotime($value);
|
||||
}
|
||||
// might be a unix epoch, then we fill all possible values
|
||||
$arr = explode('-', date('w-j-n-Y-g-G-i-s-a-A-W', (int)$value));
|
||||
$value = array(
|
||||
'D' => $arr[0],
|
||||
'l' => $arr[0],
|
||||
'd' => $arr[1],
|
||||
'M' => $arr[2],
|
||||
'm' => $arr[2],
|
||||
'F' => $arr[2],
|
||||
'Y' => $arr[3],
|
||||
'y' => $arr[3],
|
||||
'h' => $arr[4],
|
||||
'g' => $arr[4],
|
||||
'H' => $arr[5],
|
||||
'i' => $this->trimLeadingZeros($arr[6]),
|
||||
's' => $this->trimLeadingZeros($arr[7]),
|
||||
'a' => $arr[8],
|
||||
'A' => $arr[9],
|
||||
'W' => $this->trimLeadingZeros($arr[10])
|
||||
);
|
||||
} else {
|
||||
$value = array_map(array($this, 'trimLeadingZeros'), $value);
|
||||
}
|
||||
return parent::setValue($value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the element needs to update its value from form's data sources
|
||||
*
|
||||
* Since the date element also accepts a timestamp as value, the default
|
||||
* group behavior is changed.
|
||||
*/
|
||||
public function updateValue()
|
||||
{
|
||||
$name = $this->getName();
|
||||
foreach ($this->getDataSources() as $ds) {
|
||||
if (null !== ($value = $ds->getValue($name))) {
|
||||
$this->setValue($value);
|
||||
return;
|
||||
}
|
||||
}
|
||||
parent::updateValue();
|
||||
}
|
||||
|
||||
/**
|
||||
* Options in different languages
|
||||
*
|
||||
* Note to potential translators: to avoid encoding problems please send
|
||||
* your translations with "weird" letters encoded as HTML Unicode entities
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $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ärz', 'April', 'Mai', 'Juni', 'Juli', 'Aug', 'Sept', 'Okt', 'Nov', 'Dez'),
|
||||
'months_long' => array ('Januar', 'Februar', 'Mä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év', 'Mar', 'Avr', 'Mai', 'Juin', 'Juil', 'Août', 'Sep', 'Oct', 'Nov', 'Déc'),
|
||||
'months_long' => array ('Janvier', 'Février', 'Mars', 'Avril', 'Mai', 'Juin', 'Juillet', 'Août', 'Septembre', 'Octobre', 'Novembre', 'Décembre')
|
||||
),
|
||||
'hu' => array (
|
||||
'weekdays_short'=> array ('V', 'H', 'K', 'Sze', 'Cs', 'P', 'Szo'),
|
||||
'weekdays_long' => array ('vasárnap', 'hétfő', 'kedd', 'szerda', 'csütörtök', 'péntek', 'szombat'),
|
||||
'months_short' => array ('jan', 'feb', 'márc', 'ápr', 'máj', 'jún', 'júl', 'aug', 'szept', 'okt', 'nov', 'dec'),
|
||||
'months_long' => array ('január', 'február', 'március', 'április', 'május', 'június', 'július', 'augusztus', 'szeptember', 'október', 'november', 'december')
|
||||
),
|
||||
'pl' => array (
|
||||
'weekdays_short'=> array ('Nie', 'Pn', 'Wt', 'Śr', 'Czw', 'Pt', 'Sob'),
|
||||
'weekdays_long' => array ('Niedziela', 'Poniedziałek', 'Wtorek', 'Środa', 'Czwartek', 'Piątek', 'Sobota'),
|
||||
'months_short' => array ('Sty', 'Lut', 'Mar', 'Kwi', 'Maj', 'Cze', 'Lip', 'Sie', 'Wrz', 'Paź', 'Lis', 'Gru'),
|
||||
'months_long' => array ('Styczeń', 'Luty', 'Marzec', 'Kwiecień', 'Maj', 'Czerwiec', 'Lipiec', 'Sierpień', 'Wrzesień', 'Październik', 'Listopad', 'Grudzień')
|
||||
),
|
||||
'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 ('Вс', 'Пн', 'Вт', 'Ср', 'Чт', 'Пт', 'Сб'),
|
||||
'weekdays_long' => array ('Воскресенье', 'Понедельник', 'Вторник', 'Среда', 'Четверг', 'Пятница', 'Суббота'),
|
||||
'months_short' => array ('Янв', 'Фев', 'Мар', 'Апр', 'Май', 'Июн', 'Июл', 'Авг', 'Сен', 'Окт', 'Ноя', 'Дек'),
|
||||
'months_long' => array ('Январь', 'Февраль', 'Март', 'Апрель', 'Май', 'Июнь', 'Июль', 'Август', 'Сентябрь', 'Октябрь', 'Ноябрь', 'Декабрь')
|
||||
),
|
||||
'es' => array (
|
||||
'weekdays_short'=> array ('Dom', 'Lun', 'Mar', 'Mié', 'Jue', 'Vie', 'Sáb'),
|
||||
'weekdays_long' => array ('Domingo', 'Lunes', 'Martes', 'Miércoles', 'Jueves', 'Viernes', 'Sá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øn', 'Man', 'Tir', 'Ons', 'Tor', 'Fre', 'Lør'),
|
||||
'weekdays_long' => array ('Søndag', 'Mandag', 'Tirsdag', 'Onsdag', 'Torsdag', 'Fredag', 'Lø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án', 'Þri', 'Mið', 'Fim', 'Fös', 'Lau'),
|
||||
'weekdays_long' => array ('Sunnudagur', 'Mánudagur', 'Þriðjudagur', 'Miðvikudagur', 'Fimmtudagur', 'Föstudagur', 'Laugardagur'),
|
||||
'months_short' => array ('Jan', 'Feb', 'Mar', 'Apr', 'Maí', 'Jún', 'Júl', 'Ágú', 'Sep', 'Okt', 'Nóv', 'Des'),
|
||||
'months_long' => array ('Janúar', 'Febrúar', 'Mars', 'Apríl', 'Maí', 'Júní', 'Júlí', 'Ágúst', 'September', 'Október', 'Nóvember', 'Desember')
|
||||
),
|
||||
'it' => array (
|
||||
'weekdays_short'=> array ('Dom', 'Lun', 'Mar', 'Mer', 'Gio', 'Ven', 'Sab'),
|
||||
'weekdays_long' => array ('Domenica', 'Lunedì', 'Martedì', 'Mercoledì', 'Giovedì', 'Venerdì', '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', 'Štv', 'Pia', 'Sob'),
|
||||
'weekdays_long' => array ('Nedeža', 'Pondelok', 'Utorok', 'Streda', 'Štvrtok', 'Piatok', 'Sobota'),
|
||||
'months_short' => array ('Jan', 'Feb', 'Mar', 'Apr', 'Máj', 'Jún', 'Júl', 'Aug', 'Sep', 'Okt', 'Nov', 'Dec'),
|
||||
'months_long' => array ('Január', 'Február', 'Marec', 'Apríl', 'Máj', 'Jún', 'Júl', 'August', 'September', 'Október', 'November', 'December')
|
||||
),
|
||||
'cs' => array (
|
||||
'weekdays_short'=> array ('Ne', 'Po', 'Út', 'St', 'Čt', 'Pá', 'So'),
|
||||
'weekdays_long' => array ('Neděle', 'Pondělí', 'Úterý', 'Středa', 'Čtvrtek', 'Pátek', 'Sobota'),
|
||||
'months_short' => array ('Led', 'Úno', 'Bře', 'Dub', 'Kvě', 'Čen', 'Čec', 'Srp', 'Zář', 'Říj', 'Lis', 'Pro'),
|
||||
'months_long' => array ('Leden', 'Únor', 'Březen', 'Duben', 'Květen', 'Červen', 'Červenec', 'Srpen', 'Září', 'Říjen', 'Listopad', 'Prosinec')
|
||||
),
|
||||
'hy' => array (
|
||||
'weekdays_short'=> array ('Կրկ', 'Երկ', 'Երք', 'Չրք', 'Հնգ', 'Ուր', 'Շբթ'),
|
||||
'weekdays_long' => array ('Կիրակի', 'Երկուշաբթի', 'Երեքշաբթի', 'Չորեքշաբթի', 'Հինգշաբթի', 'Ուրբաթ', 'Շաբաթ'),
|
||||
'months_short' => array ('Հնվ', 'Փտր', 'Մրտ', 'Ապր', 'Մյս', 'Հնս', 'Հլս', 'Օգս', 'Սպտ', 'Հկտ', 'Նյմ', 'Դկտ'),
|
||||
'months_long' => array ('Հունվար', 'Փետրվար', 'Մարտ', 'Ապրիլ', 'Մայիս', 'Հունիս', 'Հուլիս', 'Օգոստոս', 'Սեպտեմբեր', 'Հոկտեմբեր', 'Նոյեմբեր', 'Դեկտեմբեր')
|
||||
),
|
||||
'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ühapäev', 'Esmaspäev', 'Teisipäev', 'Kolmapäev', 'Neljapäev', 'Reede', 'Laupäev'),
|
||||
'months_short' => array ('Jaan', 'Veebr', 'Märts', 'Aprill', 'Mai', 'Juuni', 'Juuli', 'Aug', 'Sept', 'Okt', 'Nov', 'Dets'),
|
||||
'months_long' => array ('Jaanuar', 'Veebruar', 'Märts', 'Aprill', 'Mai', 'Juuni', 'Juuli', 'August', 'September', 'Oktoober', 'November', 'Detsember')
|
||||
),
|
||||
'tr' => array (
|
||||
'weekdays_short'=> array ('Paz', 'Pzt', 'Sal', 'Çar', 'Per', 'Cum', 'Cts'),
|
||||
'weekdays_long' => array ('Pazar', 'Pazartesi', 'Salı', 'Çarşamba', 'Perşembe', 'Cuma', 'Cumartesi'),
|
||||
'months_short' => array ('Ock', 'Şbt', 'Mrt', 'Nsn', 'Mys', 'Hzrn', 'Tmmz', 'Ağst', 'Eyl', 'Ekm', 'Ksm', 'Arlk'),
|
||||
'months_long' => array ('Ocak', 'Şubat', 'Mart', 'Nisan', 'Mayıs', 'Haziran', 'Temmuz', 'Ağustos', 'Eylül', 'Ekim', 'Kasım', 'Aralık')
|
||||
),
|
||||
'no' => array (
|
||||
'weekdays_short'=> array ('Søn', 'Man', 'Tir', 'Ons', 'Tor', 'Fre', 'Lør'),
|
||||
'weekdays_long' => array ('Søndag', 'Mandag', 'Tirsdag', 'Onsdag', 'Torsdag', 'Fredag', 'Lø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', 'Ĵaŭ', 'Ven', 'Sab'),
|
||||
'weekdays_long' => array ('Dimanĉo', 'Lundo', 'Mardo', 'Merkredo', 'Ĵaŭdo', 'Vendredo', 'Sabato'),
|
||||
'months_short' => array ('Jan', 'Feb', 'Mar', 'Apr', 'Maj', 'Jun', 'Jul', 'Aŭg', 'Sep', 'Okt', 'Nov', 'Dec'),
|
||||
'months_long' => array ('Januaro', 'Februaro', 'Marto', 'Aprilo', 'Majo', 'Junio', 'Julio', 'Aŭgusto', 'Septembro', 'Oktobro', 'Novembro', 'Decembro')
|
||||
),
|
||||
'ua' => array (
|
||||
'weekdays_short'=> array ('Ндл', 'Пнд', 'Втр', 'Срд', 'Чтв', 'Птн', 'Сбт'),
|
||||
'weekdays_long' => array ('Неділя', 'Понеділок', 'Вівторок', 'Середа', 'Четвер', 'П\'ятниця', 'Субота'),
|
||||
'months_short' => array ('Січ', 'Лют', 'Бер', 'Кві', 'Тра', 'Чер', 'Лип', 'Сер', 'Вер', 'Жов', 'Лис', 'Гру'),
|
||||
'months_long' => array ('Січень', 'Лютий', 'Березень', 'Квітень', 'Травень', 'Червень', 'Липень', 'Серпень', 'Вересень', 'Жовтень', 'Листопад', 'Грудень')
|
||||
),
|
||||
'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 ('ראשון', 'שני', 'שלישי', 'רביעי', 'חמישי', 'שישי', 'שבת'),
|
||||
'weekdays_long' => array ('יום ראשון', 'יום שני', 'יום שלישי', 'יום רביעי', 'יום חמישי', 'יום שישי', 'שבת'),
|
||||
'months_short' => array ('ינואר', 'פברואר', 'מרץ', 'אפריל', 'מאי', 'יוני', 'יולי', 'אוגוסט', 'ספטמבר', 'אוקטובר', 'נובמבר', 'דצמבר'),
|
||||
'months_long' => array ('ינואר', 'פברואר', 'מרץ', 'אפריל', 'מאי', 'יוני', 'יולי', 'אוגוסט', 'ספטמבר', 'אוקטובר', 'נובמבר', 'דצמבר')
|
||||
),
|
||||
'sv' => array (
|
||||
'weekdays_short'=> array ('Sön', 'Mån', 'Tis', 'Ons', 'Tor', 'Fre', 'Lör'),
|
||||
'weekdays_long' => array ('Söndag', 'Måndag', 'Tisdag', 'Onsdag', 'Torsdag', 'Fredag', 'Lö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áb'),
|
||||
'weekdays_long' => array ('Domingo', 'Segunda-feira', 'Terça-feira', 'Quarta-feira', 'Quinta-feira', 'Sexta-feira', 'Sábado'),
|
||||
'months_short' => array ('Jan', 'Fev', 'Mar', 'Abr', 'Mai', 'Jun', 'Jul', 'Ago', 'Set', 'Out', 'Nov', 'Dez'),
|
||||
'months_long' => array ('Janeiro', 'Fevereiro', 'Março', 'Abril', 'Maio', 'Junho', 'Julho', 'Agosto', 'Setembro', 'Outubro', 'Novembro', 'Dezembro')
|
||||
),
|
||||
'tw' => array (
|
||||
'weekdays_short'=> array ('週日','週一', '週二','週三', '週四','週五', '週六'),
|
||||
'weekdays_long' => array ('星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'),
|
||||
'months_short' => array ('一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月'),
|
||||
'months_long' => array ('一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月')
|
||||
),
|
||||
'pt-br' => array (
|
||||
'weekdays_short'=> array ('Dom', 'Seg', 'Ter', 'Qua', 'Qui', 'Sex', 'Sáb'),
|
||||
'weekdays_long' => array ('Domingo', 'Segunda', 'Terça', 'Quarta', 'Quinta', 'Sexta', 'Sábado'),
|
||||
'months_short' => array ('Jan', 'Fev', 'Mar', 'Abr', 'Mai', 'Jun', 'Jul', 'Ago', 'Set', 'Out', 'Nov', 'Dez'),
|
||||
'months_long' => array ('Janeiro', 'Fevereiro', 'Março', 'Abril', 'Maio', 'Junho', 'Julho', 'Agosto', 'Setembro', 'Outubro', 'Novembro', 'Dezembro')
|
||||
),
|
||||
'sr' => array (
|
||||
'weekdays_short'=> array ('Нед', 'Пон', 'Уто', 'Сре', 'Чет', 'Пет', 'Суб'),
|
||||
'weekdays_long' => array ('Недеља', 'Понедељак', 'Уторак', 'Среда', 'Четвртак', 'Петак', 'Субота'),
|
||||
'months_short' => array ('Јан', 'Феб', 'Мар', 'Апр', 'Мај', 'Јун', 'Јул', 'Авг', 'Сеп', 'Окт', 'Нов', 'Дец'),
|
||||
'months_long' => array ('Јануар', 'Фебруар', 'Март', 'Април', 'Мај', 'Јун', 'Јул', 'Август', 'Септембар', 'Октобар', 'Новембар', 'Децембар')
|
||||
),
|
||||
'el' => array (
|
||||
'weekdays_short'=> array ('Δευ', 'Τρί', 'Τετ', 'Πέμ', 'Παρ', 'Σάβ', 'Κυρ'),
|
||||
'weekdays_long' => array ('Δευτέρα', 'Τρίτη', 'Τετάρτη', 'Πέμπτη', 'Παρασκευή', 'Σάββατο', 'Κυριακή'),
|
||||
'months_short' => array ('Ιαν', 'Φεβ', 'Μάρ', 'Απρ', 'Μάϊ', 'Ioύν', 'Ιούλ', 'Αύγ', 'Σεπ', 'Οκτ', 'Νοέ', 'Δεκ'),
|
||||
'months_long' => array ('Ιανουάριος', 'Φεβρουάριος', 'Μάρτιος', 'Απρίλιος', 'Μάϊος', 'Ιούνιος', 'Ioύλιος', 'Αύγουστος', 'Σεπτέμβριος', 'Οκτώβριος', 'Νοέμβριος', 'Δεκέμβριος')
|
||||
)
|
||||
);
|
||||
}
|
||||
?>
|
114
msd2/tracking/piwik/libs/HTML/QuickForm2/Element/Input.php
Normal file
114
msd2/tracking/piwik/libs/HTML/QuickForm2/Element/Input.php
Normal file
@ -0,0 +1,114 @@
|
||||
<?php
|
||||
/**
|
||||
* Base class for <input> elements
|
||||
*
|
||||
* PHP version 5
|
||||
*
|
||||
* LICENSE:
|
||||
*
|
||||
* Copyright (c) 2006-2010, Alexey Borzov <avb@php.net>,
|
||||
* Bertrand Mansion <golgote@mamasam.com>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * The names of the authors may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
|
||||
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* @category HTML
|
||||
* @package HTML_QuickForm2
|
||||
* @author Alexey Borzov <avb@php.net>
|
||||
* @author Bertrand Mansion <golgote@mamasam.com>
|
||||
* @license http://opensource.org/licenses/bsd-license.php New BSD License
|
||||
* @version SVN: $Id: Input.php 300722 2010-06-24 10:15:52Z mansion $
|
||||
* @link http://pear.php.net/package/HTML_QuickForm2
|
||||
*/
|
||||
|
||||
/**
|
||||
* Base class for simple HTML_QuickForm2 elements (not Containers)
|
||||
*/
|
||||
// require_once 'HTML/QuickForm2/Element.php';
|
||||
|
||||
/**
|
||||
* Base class for <input> elements
|
||||
*
|
||||
* @category HTML
|
||||
* @package HTML_QuickForm2
|
||||
* @author Alexey Borzov <avb@php.net>
|
||||
* @author Bertrand Mansion <golgote@mamasam.com>
|
||||
* @version Release: @package_version@
|
||||
*/
|
||||
class HTML_QuickForm2_Element_Input extends HTML_QuickForm2_Element
|
||||
{
|
||||
/**
|
||||
* 'type' attribute should not be changeable
|
||||
* @var array
|
||||
*/
|
||||
protected $watchedAttributes = array('id', 'name', 'type');
|
||||
|
||||
protected function onAttributeChange($name, $value = null)
|
||||
{
|
||||
if ('type' == $name) {
|
||||
throw new HTML_QuickForm2_InvalidArgumentException(
|
||||
"Attribute 'type' is read-only"
|
||||
);
|
||||
}
|
||||
parent::onAttributeChange($name, $value);
|
||||
}
|
||||
|
||||
public function getType()
|
||||
{
|
||||
return $this->attributes['type'];
|
||||
}
|
||||
|
||||
public function setValue($value)
|
||||
{
|
||||
$this->setAttribute('value', $value);
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getValue()
|
||||
{
|
||||
return $this->getAttribute('disabled')? null: $this->applyFilters($this->getAttribute('value'));
|
||||
}
|
||||
|
||||
public function __toString()
|
||||
{
|
||||
if ($this->frozen) {
|
||||
return $this->getFrozenHtml();
|
||||
} else {
|
||||
return '<input' . $this->getAttributes(true) . ' />';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the field's value without HTML tags
|
||||
* @return string
|
||||
*/
|
||||
protected function getFrozenHtml()
|
||||
{
|
||||
$value = $this->getAttribute('value');
|
||||
return (('' != $value)? htmlspecialchars($value, ENT_QUOTES, self::getOption('charset')): ' ') .
|
||||
$this->getPersistentContent();
|
||||
}
|
||||
}
|
||||
?>
|
@ -0,0 +1,99 @@
|
||||
<?php
|
||||
/**
|
||||
* Class for <input type="button" /> elements
|
||||
*
|
||||
* PHP version 5
|
||||
*
|
||||
* LICENSE:
|
||||
*
|
||||
* Copyright (c) 2006-2010, Alexey Borzov <avb@php.net>,
|
||||
* Bertrand Mansion <golgote@mamasam.com>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * The names of the authors may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
|
||||
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* @category HTML
|
||||
* @package HTML_QuickForm2
|
||||
* @author Alexey Borzov <avb@php.net>
|
||||
* @author Bertrand Mansion <golgote@mamasam.com>
|
||||
* @license http://opensource.org/licenses/bsd-license.php New BSD License
|
||||
* @version SVN: $Id: InputButton.php 294057 2010-01-26 21:10:28Z avb $
|
||||
* @link http://pear.php.net/package/HTML_QuickForm2
|
||||
*/
|
||||
|
||||
/**
|
||||
* Base class for <input> elements
|
||||
*/
|
||||
// require_once 'HTML/QuickForm2/Element/Input.php';
|
||||
|
||||
/**
|
||||
* Class for <input type="button" /> elements
|
||||
*
|
||||
* @category HTML
|
||||
* @package HTML_QuickForm2
|
||||
* @author Alexey Borzov <avb@php.net>
|
||||
* @author Bertrand Mansion <golgote@mamasam.com>
|
||||
* @version Release: @package_version@
|
||||
*/
|
||||
class HTML_QuickForm2_Element_InputButton extends HTML_QuickForm2_Element_Input
|
||||
{
|
||||
protected $attributes = array('type' => 'button');
|
||||
|
||||
/**
|
||||
* Buttons can not be frozen
|
||||
*
|
||||
* @param bool Whether element should be frozen or editable. This
|
||||
* parameter is ignored in case of buttons
|
||||
* @return bool Always returns false
|
||||
*/
|
||||
public function toggleFrozen($freeze = null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Button elements cannot have any submit values
|
||||
*
|
||||
* @param mixed Element's value, this parameter is ignored
|
||||
* @return HTML_QuickForm2_Element_InputButton
|
||||
*/
|
||||
public function setValue($value)
|
||||
{
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Button elements cannot have any submit values
|
||||
*
|
||||
* This method always returns null
|
||||
*
|
||||
* return string|null
|
||||
*/
|
||||
public function getValue()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
?>
|
@ -0,0 +1,172 @@
|
||||
<?php
|
||||
/**
|
||||
* Base class for checkboxes and radios
|
||||
*
|
||||
* PHP version 5
|
||||
*
|
||||
* LICENSE:
|
||||
*
|
||||
* Copyright (c) 2006-2010, Alexey Borzov <avb@php.net>,
|
||||
* Bertrand Mansion <golgote@mamasam.com>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * The names of the authors may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
|
||||
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* @category HTML
|
||||
* @package HTML_QuickForm2
|
||||
* @author Alexey Borzov <avb@php.net>
|
||||
* @author Bertrand Mansion <golgote@mamasam.com>
|
||||
* @license http://opensource.org/licenses/bsd-license.php New BSD License
|
||||
* @version SVN: $Id: InputCheckable.php 300722 2010-06-24 10:15:52Z mansion $
|
||||
* @link http://pear.php.net/package/HTML_QuickForm2
|
||||
*/
|
||||
|
||||
/**
|
||||
* Base class for <input> elements
|
||||
*/
|
||||
// require_once 'HTML/QuickForm2/Element/Input.php';
|
||||
|
||||
/**
|
||||
* Base class for <input> elements having 'checked' attribute (checkboxes and radios)
|
||||
*
|
||||
* @category HTML
|
||||
* @package HTML_QuickForm2
|
||||
* @author Alexey Borzov <avb@php.net>
|
||||
* @author Bertrand Mansion <golgote@mamasam.com>
|
||||
* @version Release: @package_version@
|
||||
*/
|
||||
class HTML_QuickForm2_Element_InputCheckable extends HTML_QuickForm2_Element_Input
|
||||
{
|
||||
protected $persistent = true;
|
||||
|
||||
/**
|
||||
* HTML to represent the element in "frozen" state
|
||||
*
|
||||
* Array index "checked" contains HTML for element's "checked" state,
|
||||
* "unchecked" for not checked
|
||||
* @var array
|
||||
*/
|
||||
protected $frozenHtml = array(
|
||||
'checked' => 'On',
|
||||
'unchecked' => 'Off'
|
||||
);
|
||||
|
||||
/**
|
||||
* Contains options and data used for the element creation
|
||||
* - content: Label "glued" to a checkbox or radio
|
||||
* @var array
|
||||
*/
|
||||
protected $data = array('content' => '');
|
||||
|
||||
public function __construct($name = null, $attributes = null, $data = null)
|
||||
{
|
||||
parent::__construct($name, $attributes, $data);
|
||||
// "checked" attribute should be updated on changes to "value" attribute
|
||||
// see bug #15708
|
||||
$this->watchedAttributes[] = 'value';
|
||||
}
|
||||
|
||||
protected function onAttributeChange($name, $value = null)
|
||||
{
|
||||
if ('value' != $name) {
|
||||
return parent::onAttributeChange($name, $value);
|
||||
}
|
||||
if (null === $value) {
|
||||
unset($this->attributes['value'], $this->attributes['checked']);
|
||||
} else {
|
||||
$this->attributes['value'] = $value;
|
||||
$this->updateValue();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the label to be rendered glued to the element
|
||||
*
|
||||
* This label is returned by {@link __toString()} method with the element's
|
||||
* HTML. It is automatically wrapped into the <label> tag.
|
||||
*
|
||||
* @param string
|
||||
* @return HTML_QuickForm2_Element_InputCheckable
|
||||
*/
|
||||
public function setContent($content)
|
||||
{
|
||||
$this->data['content'] = $content;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the label that will be "glued" to element's HTML
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getContent()
|
||||
{
|
||||
return $this->data['content'];
|
||||
}
|
||||
|
||||
|
||||
public function setValue($value)
|
||||
{
|
||||
if ((string)$value == $this->getAttribute('value')) {
|
||||
return $this->setAttribute('checked');
|
||||
} else {
|
||||
return $this->removeAttribute('checked');
|
||||
}
|
||||
}
|
||||
|
||||
public function getValue()
|
||||
{
|
||||
if (!empty($this->attributes['checked']) && empty($this->attributes['disabled'])) {
|
||||
return $this->applyFilters($this->getAttribute('value'));
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public function __toString()
|
||||
{
|
||||
if (0 == strlen($this->data['content'])) {
|
||||
$label = '';
|
||||
} elseif ($this->frozen) {
|
||||
$label = $this->data['content'];
|
||||
} else {
|
||||
$label = '<label for="' . htmlspecialchars(
|
||||
$this->getId(), ENT_QUOTES, self::getOption('charset')
|
||||
) . '">' . $this->data['content'] . '</label>';
|
||||
}
|
||||
return parent::__toString() . $label;
|
||||
}
|
||||
|
||||
public function getFrozenHtml()
|
||||
{
|
||||
if ($this->getAttribute('checked')) {
|
||||
return $this->frozenHtml['checked'] . $this->getPersistentContent();
|
||||
} else {
|
||||
return $this->frozenHtml['unchecked'];
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
@ -0,0 +1,99 @@
|
||||
<?php
|
||||
/**
|
||||
* Class for <input type="checkbox" /> elements
|
||||
*
|
||||
* PHP version 5
|
||||
*
|
||||
* LICENSE:
|
||||
*
|
||||
* Copyright (c) 2006-2010, Alexey Borzov <avb@php.net>,
|
||||
* Bertrand Mansion <golgote@mamasam.com>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * The names of the authors may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
|
||||
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* @category HTML
|
||||
* @package HTML_QuickForm2
|
||||
* @author Alexey Borzov <avb@php.net>
|
||||
* @author Bertrand Mansion <golgote@mamasam.com>
|
||||
* @license http://opensource.org/licenses/bsd-license.php New BSD License
|
||||
* @version SVN: $Id: InputCheckbox.php 294057 2010-01-26 21:10:28Z avb $
|
||||
* @link http://pear.php.net/package/HTML_QuickForm2
|
||||
*/
|
||||
|
||||
/**
|
||||
* Base class for checkboxes and radios
|
||||
*/
|
||||
// require_once 'HTML/QuickForm2/Element/InputCheckable.php';
|
||||
|
||||
/**
|
||||
* Class for <input type="checkbox" /> elements
|
||||
*
|
||||
* @category HTML
|
||||
* @package HTML_QuickForm2
|
||||
* @author Alexey Borzov <avb@php.net>
|
||||
* @author Bertrand Mansion <golgote@mamasam.com>
|
||||
* @version Release: @package_version@
|
||||
*/
|
||||
class HTML_QuickForm2_Element_InputCheckbox extends HTML_QuickForm2_Element_InputCheckable
|
||||
{
|
||||
protected $attributes = array('type' => 'checkbox');
|
||||
|
||||
protected $frozenHtml = array(
|
||||
'checked' => '<tt>[x]</tt>',
|
||||
'unchecked' => '<tt>[ ]</tt>'
|
||||
);
|
||||
|
||||
public function __construct($name = null, $attributes = null, array $data = array())
|
||||
{
|
||||
parent::__construct($name, $attributes, $data);
|
||||
if (!$this->getAttribute('value')) {
|
||||
$this->setAttribute('value', 1);
|
||||
}
|
||||
}
|
||||
|
||||
public function updateValue()
|
||||
{
|
||||
$name = $this->getName();
|
||||
if ('[]' == substr($name, -2)) {
|
||||
$name = substr($name, 0, -2);
|
||||
}
|
||||
foreach ($this->getDataSources() as $ds) {
|
||||
if (null !== ($value = $ds->getValue($name))
|
||||
|| $ds instanceof HTML_QuickForm2_DataSource_Submit
|
||||
) {
|
||||
if (!is_array($value)) {
|
||||
$this->setValue($value);
|
||||
} elseif (in_array($this->getAttribute('value'), array_map('strval', $value), true)) {
|
||||
$this->setAttribute('checked');
|
||||
} else {
|
||||
$this->removeAttribute('checked');
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
268
msd2/tracking/piwik/libs/HTML/QuickForm2/Element/InputFile.php
Normal file
268
msd2/tracking/piwik/libs/HTML/QuickForm2/Element/InputFile.php
Normal file
@ -0,0 +1,268 @@
|
||||
<?php
|
||||
/**
|
||||
* Class for <input type="file" /> elements
|
||||
*
|
||||
* PHP version 5
|
||||
*
|
||||
* LICENSE:
|
||||
*
|
||||
* Copyright (c) 2006-2010, Alexey Borzov <avb@php.net>,
|
||||
* Bertrand Mansion <golgote@mamasam.com>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * The names of the authors may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
|
||||
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* @category HTML
|
||||
* @package HTML_QuickForm2
|
||||
* @author Alexey Borzov <avb@php.net>
|
||||
* @author Bertrand Mansion <golgote@mamasam.com>
|
||||
* @license http://opensource.org/licenses/bsd-license.php New BSD License
|
||||
* @version SVN: $Id: InputFile.php 300722 2010-06-24 10:15:52Z mansion $
|
||||
* @link http://pear.php.net/package/HTML_QuickForm2
|
||||
*/
|
||||
|
||||
/**
|
||||
* Base class for <input> elements
|
||||
*/
|
||||
// require_once 'HTML/QuickForm2/Element/Input.php';
|
||||
|
||||
/**
|
||||
* Class for <input type="file" /> elements
|
||||
*
|
||||
* @category HTML
|
||||
* @package HTML_QuickForm2
|
||||
* @author Alexey Borzov <avb@php.net>
|
||||
* @author Bertrand Mansion <golgote@mamasam.com>
|
||||
* @version Release: @package_version@
|
||||
*/
|
||||
class HTML_QuickForm2_Element_InputFile extends HTML_QuickForm2_Element_Input
|
||||
{
|
||||
/**
|
||||
* Default language for error messages
|
||||
*/
|
||||
const DEFAULT_LANGUAGE = 'en';
|
||||
|
||||
/**
|
||||
* Localized error messages for PHP's file upload errors
|
||||
* @var array
|
||||
*/
|
||||
protected $errorMessages = array(
|
||||
'en' => array(
|
||||
UPLOAD_ERR_INI_SIZE => 'The uploaded file exceeds size permitted by PHP configuration (%d bytes)',
|
||||
UPLOAD_ERR_FORM_SIZE => 'The uploaded file exceeds the MAX_FILE_SIZE directive in HTML form (%d bytes)',
|
||||
UPLOAD_ERR_PARTIAL => 'The file was only partially uploaded',
|
||||
UPLOAD_ERR_NO_TMP_DIR => 'Server error: temporary directory is missing',
|
||||
UPLOAD_ERR_CANT_WRITE => 'Server error: failed to write the file to disk',
|
||||
UPLOAD_ERR_EXTENSION => 'File upload was stopped by extension'
|
||||
),
|
||||
'fr' => array(
|
||||
UPLOAD_ERR_INI_SIZE => 'Le fichier envoyé excède la taille autorisée par la configuration de PHP (%d octets)',
|
||||
UPLOAD_ERR_FORM_SIZE => 'Le fichier envoyé excède la taille de MAX_FILE_SIZE spécifiée dans le formulaire HTML (%d octets)',
|
||||
UPLOAD_ERR_PARTIAL => 'Le fichier n\'a été que partiellement téléchargé',
|
||||
UPLOAD_ERR_NO_TMP_DIR => 'Erreur serveur: le répertoire temporaire est manquant',
|
||||
UPLOAD_ERR_CANT_WRITE => 'Erreur serveur: échec de l\'écriture du fichier sur le disque',
|
||||
UPLOAD_ERR_EXTENSION => 'L\'envoi de fichier est arrêté par l\'extension'
|
||||
),
|
||||
'ru' => array(
|
||||
UPLOAD_ERR_INI_SIZE => 'Размер загруженного файла превосходит максимально разрешённый настройками PHP (%d байт)',
|
||||
UPLOAD_ERR_FORM_SIZE => 'Размер загруженного файла превосходит директиву MAX_FILE_SIZE, указанную в форме (%d байт)',
|
||||
UPLOAD_ERR_PARTIAL => 'Файл был загружен не полностью',
|
||||
UPLOAD_ERR_NO_TMP_DIR => 'Ошибка на сервере: отсутствует каталог для временных файлов',
|
||||
UPLOAD_ERR_CANT_WRITE => 'Ошибка на сервере: не удалось записать файл на диск',
|
||||
UPLOAD_ERR_EXTENSION => 'Загрузка файла была остановлена расширением'
|
||||
)
|
||||
);
|
||||
|
||||
/**
|
||||
* Language to display error messages in
|
||||
* @var string
|
||||
*/
|
||||
protected $language;
|
||||
|
||||
/**
|
||||
* Information on uploaded file, from submit data source
|
||||
* @var array
|
||||
*/
|
||||
protected $value = null;
|
||||
|
||||
protected $attributes = array('type' => 'file');
|
||||
|
||||
|
||||
/**
|
||||
* Class constructor
|
||||
*
|
||||
* Possible keys in $data array are:
|
||||
* - 'language': language to display error messages in, it should either be
|
||||
* already available in the class or provided in 'errorMessages'
|
||||
* - 'errorMessages': an array of error messages with the following format
|
||||
* <pre>
|
||||
* 'language code 1' => array(
|
||||
* UPLOAD_ERR_... => 'message',
|
||||
* ...
|
||||
* UPLOAD_ERR_... => 'message'
|
||||
* ),
|
||||
* ...
|
||||
* 'language code N' => array(
|
||||
* ...
|
||||
* )
|
||||
* </pre>
|
||||
* Note that error messages for UPLOAD_ERR_INI_SIZE and UPLOAD_ERR_FORM_SIZE
|
||||
* may contain '%d' placeholders that will be automatically replaced by the
|
||||
* appropriate size limits. Note also that you don't need to provide messages
|
||||
* for every possible error code in the arrays, you may e.g. override just
|
||||
* one error message for a particular language.
|
||||
*
|
||||
* @param string Element name
|
||||
* @param mixed Attributes (either a string or an array)
|
||||
* @param array Data used to set up error messages for PHP's file
|
||||
* upload errors.
|
||||
*/
|
||||
public function __construct($name = null, $attributes = null, array $data = array())
|
||||
{
|
||||
if (isset($data['errorMessages'])) {
|
||||
// neither array_merge() nor array_merge_recursive will do
|
||||
foreach ($data['errorMessages'] as $lang => $ary) {
|
||||
foreach ($ary as $code => $message) {
|
||||
$this->errorMessages[$lang][$code] = $message;
|
||||
}
|
||||
}
|
||||
unset($data['errorMessages']);
|
||||
}
|
||||
if (!isset($data['language'])) {
|
||||
$this->language = self::DEFAULT_LANGUAGE;
|
||||
} else {
|
||||
$this->language = isset($this->errorMessages[$data['language']])?
|
||||
$data['language']: self::DEFAULT_LANGUAGE;
|
||||
unset($data['language']);
|
||||
}
|
||||
parent::__construct($name, $attributes, $data);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* File upload elements cannot be frozen
|
||||
*
|
||||
* To properly "freeze" a file upload element one has to store the uploaded
|
||||
* file somewhere and store the file info in session. This is way outside
|
||||
* the scope of this class.
|
||||
*
|
||||
* @param bool Whether element should be frozen or editable. This
|
||||
* parameter is ignored in case of file uploads
|
||||
* @return bool Always returns false
|
||||
*/
|
||||
public function toggleFrozen($freeze = null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the information on uploaded file
|
||||
*
|
||||
* @return array|null
|
||||
*/
|
||||
public function getValue()
|
||||
{
|
||||
return $this->value;
|
||||
}
|
||||
|
||||
/**
|
||||
* File upload's value cannot be set here
|
||||
*
|
||||
* @param mixed Value for file element, this parameter is ignored
|
||||
* @return HTML_QuickForm2_Element_InputFile
|
||||
*/
|
||||
public function setValue($value)
|
||||
{
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function updateValue()
|
||||
{
|
||||
foreach ($this->getDataSources() as $ds) {
|
||||
if ($ds instanceof HTML_QuickForm2_DataSource_Submit) {
|
||||
$value = $ds->getUpload($this->getName());
|
||||
if (null !== $value) {
|
||||
$this->value = $value;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
$this->value = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs the server-side validation
|
||||
*
|
||||
* Before the Rules added to the element kick in, the element checks the
|
||||
* error code added to the $_FILES array by PHP. If the code isn't
|
||||
* UPLOAD_ERR_OK or UPLOAD_ERR_NO_FILE then a built-in error message will be
|
||||
* displayed and no further validation will take place.
|
||||
*
|
||||
* @return boolean Whether the element is valid
|
||||
*/
|
||||
protected function validate()
|
||||
{
|
||||
if (strlen($this->error)) {
|
||||
return false;
|
||||
}
|
||||
if (isset($this->value['error']) &&
|
||||
!in_array($this->value['error'], array(UPLOAD_ERR_OK, UPLOAD_ERR_NO_FILE)))
|
||||
{
|
||||
if (isset($this->errorMessages[$this->language][$this->value['error']])) {
|
||||
$errorMessage = $this->errorMessages[$this->language][$this->value['error']];
|
||||
} else {
|
||||
$errorMessage = $this->errorMessages[self::DEFAULT_LANGUAGE][$this->value['error']];
|
||||
}
|
||||
if (UPLOAD_ERR_INI_SIZE == $this->value['error']) {
|
||||
$iniSize = ini_get('upload_max_filesize');
|
||||
$size = intval($iniSize);
|
||||
switch (strtoupper(substr($iniSize, -1))) {
|
||||
case 'G': $size *= 1024;
|
||||
case 'M': $size *= 1024;
|
||||
case 'K': $size *= 1024;
|
||||
}
|
||||
|
||||
} elseif (UPLOAD_ERR_FORM_SIZE == $this->value['error']) {
|
||||
foreach ($this->getDataSources() as $ds) {
|
||||
if ($ds instanceof HTML_QuickForm2_DataSource_Submit) {
|
||||
$size = intval($ds->getValue('MAX_FILE_SIZE'));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
$this->error = isset($size)? sprintf($errorMessage, $size): $errorMessage;
|
||||
return false;
|
||||
}
|
||||
return parent::validate();
|
||||
}
|
||||
|
||||
public function addFilter($callback, array $options = null, $recursive = true)
|
||||
{
|
||||
throw new HTML_QuickForm2_Exception(
|
||||
'InputFile elements do not support filters'
|
||||
);
|
||||
}
|
||||
}
|
||||
?>
|
@ -0,0 +1,82 @@
|
||||
<?php
|
||||
/**
|
||||
* Class for <input type="hidden" /> elements
|
||||
*
|
||||
* PHP version 5
|
||||
*
|
||||
* LICENSE:
|
||||
*
|
||||
* Copyright (c) 2006-2010, Alexey Borzov <avb@php.net>,
|
||||
* Bertrand Mansion <golgote@mamasam.com>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * The names of the authors may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
|
||||
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* @category HTML
|
||||
* @package HTML_QuickForm2
|
||||
* @author Alexey Borzov <avb@php.net>
|
||||
* @author Bertrand Mansion <golgote@mamasam.com>
|
||||
* @license http://opensource.org/licenses/bsd-license.php New BSD License
|
||||
* @version SVN: $Id: InputHidden.php 294057 2010-01-26 21:10:28Z avb $
|
||||
* @link http://pear.php.net/package/HTML_QuickForm2
|
||||
*/
|
||||
|
||||
/**
|
||||
* Base class for <input> elements
|
||||
*/
|
||||
// require_once 'HTML/QuickForm2/Element/Input.php';
|
||||
|
||||
/**
|
||||
* Class for <input type="hidden" /> elements
|
||||
*
|
||||
* @category HTML
|
||||
* @package HTML_QuickForm2
|
||||
* @author Alexey Borzov <avb@php.net>
|
||||
* @author Bertrand Mansion <golgote@mamasam.com>
|
||||
* @version Release: @package_version@
|
||||
*/
|
||||
class HTML_QuickForm2_Element_InputHidden extends HTML_QuickForm2_Element_Input
|
||||
{
|
||||
protected $attributes = array('type' => 'hidden');
|
||||
|
||||
/**
|
||||
* Hidden elements can not be frozen
|
||||
*
|
||||
* @param bool Whether element should be frozen or editable. This
|
||||
* parameter is ignored in case of hidden elements
|
||||
* @return bool Always returns false
|
||||
*/
|
||||
public function toggleFrozen($freeze = null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public function render(HTML_QuickForm2_Renderer $renderer)
|
||||
{
|
||||
$renderer->renderHidden($this);
|
||||
return $renderer;
|
||||
}
|
||||
}
|
||||
?>
|
162
msd2/tracking/piwik/libs/HTML/QuickForm2/Element/InputImage.php
Normal file
162
msd2/tracking/piwik/libs/HTML/QuickForm2/Element/InputImage.php
Normal file
@ -0,0 +1,162 @@
|
||||
<?php
|
||||
/**
|
||||
* Class for <input type="image" /> elements
|
||||
*
|
||||
* PHP version 5
|
||||
*
|
||||
* LICENSE:
|
||||
*
|
||||
* Copyright (c) 2006-2010, Alexey Borzov <avb@php.net>,
|
||||
* Bertrand Mansion <golgote@mamasam.com>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * The names of the authors may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
|
||||
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* @category HTML
|
||||
* @package HTML_QuickForm2
|
||||
* @author Alexey Borzov <avb@php.net>
|
||||
* @author Bertrand Mansion <golgote@mamasam.com>
|
||||
* @license http://opensource.org/licenses/bsd-license.php New BSD License
|
||||
* @version SVN: $Id: InputImage.php 300722 2010-06-24 10:15:52Z mansion $
|
||||
* @link http://pear.php.net/package/HTML_QuickForm2
|
||||
*/
|
||||
|
||||
/**
|
||||
* Base class for <input> elements
|
||||
*/
|
||||
// require_once 'HTML/QuickForm2/Element/Input.php';
|
||||
|
||||
/**
|
||||
* Class for <input type="image" /> elements
|
||||
*
|
||||
* @category HTML
|
||||
* @package HTML_QuickForm2
|
||||
* @author Alexey Borzov <avb@php.net>
|
||||
* @author Bertrand Mansion <golgote@mamasam.com>
|
||||
* @version Release: @package_version@
|
||||
*/
|
||||
class HTML_QuickForm2_Element_InputImage extends HTML_QuickForm2_Element_Input
|
||||
{
|
||||
protected $attributes = array('type' => 'image');
|
||||
|
||||
/**
|
||||
* Coordinates of user click within the image, array contains keys 'x' and 'y'
|
||||
* @var array
|
||||
*/
|
||||
protected $coordinates = null;
|
||||
|
||||
/**
|
||||
* Image buttons can not be frozen
|
||||
*
|
||||
* @param bool Whether element should be frozen or editable. This
|
||||
* parameter is ignored in case of image elements
|
||||
* @return bool Always returns false
|
||||
*/
|
||||
public function toggleFrozen($freeze = null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Image button's value cannot be set via this method
|
||||
*
|
||||
* @param mixed Element's value, this parameter is ignored
|
||||
* @return HTML_QuickForm2_Element_InputImage
|
||||
*/
|
||||
public function setValue($value)
|
||||
{
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the element's value
|
||||
*
|
||||
* The value is only returned if the form was actually submitted and this
|
||||
* image button was clicked. Returns null in all other cases.
|
||||
*
|
||||
* @return array|null An array with keys 'x' and 'y' containing the
|
||||
* coordinates of user click if the image was clicked,
|
||||
* null otherwise
|
||||
*/
|
||||
public function getValue()
|
||||
{
|
||||
return $this->getAttribute('disabled')? null: $this->applyFilters($this->coordinates);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the HTML representation of the element
|
||||
*
|
||||
* The method changes the element's name to foo[bar][] if it was foo[bar]
|
||||
* originally. If it is not done, then one of the click coordinates will be
|
||||
* lost, see {@link http://bugs.php.net/bug.php?id=745}
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
if (false === strpos($this->attributes['name'], '[') ||
|
||||
'[]' == substr($this->attributes['name'], -2))
|
||||
{
|
||||
return parent::__toString();
|
||||
} else {
|
||||
$this->attributes['name'] .= '[]';
|
||||
$html = parent::__toString();
|
||||
$this->attributes['name'] = substr($this->attributes['name'], 0, -2);
|
||||
return $html;
|
||||
}
|
||||
}
|
||||
|
||||
public function updateValue()
|
||||
{
|
||||
foreach ($this->getDataSources() as $ds) {
|
||||
if ($ds instanceof HTML_QuickForm2_DataSource_Submit) {
|
||||
$name = $this->getName();
|
||||
if (false === strpos($name, '[') &&
|
||||
null !== ($value = $ds->getValue($name . '_x')))
|
||||
{
|
||||
$this->coordinates = array(
|
||||
'x' => $value,
|
||||
'y' => $ds->getValue($name . '_y')
|
||||
);
|
||||
return;
|
||||
|
||||
} elseif (false !== strpos($name, '[')) {
|
||||
if ('[]' == substr($name, -2)) {
|
||||
$name = substr($name, 0, -2);
|
||||
}
|
||||
if (null !== ($value = $ds->getValue($name))) {
|
||||
$this->coordinates = array(
|
||||
'x' => $value[0],
|
||||
'y' => $value[1]
|
||||
);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$this->coordinates = null;
|
||||
}
|
||||
}
|
||||
?>
|
@ -0,0 +1,71 @@
|
||||
<?php
|
||||
/**
|
||||
* Class for <input type="password" /> elements
|
||||
*
|
||||
* PHP version 5
|
||||
*
|
||||
* LICENSE:
|
||||
*
|
||||
* Copyright (c) 2006-2010, Alexey Borzov <avb@php.net>,
|
||||
* Bertrand Mansion <golgote@mamasam.com>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * The names of the authors may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
|
||||
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* @category HTML
|
||||
* @package HTML_QuickForm2
|
||||
* @author Alexey Borzov <avb@php.net>
|
||||
* @author Bertrand Mansion <golgote@mamasam.com>
|
||||
* @license http://opensource.org/licenses/bsd-license.php New BSD License
|
||||
* @version SVN: $Id: InputPassword.php 294057 2010-01-26 21:10:28Z avb $
|
||||
* @link http://pear.php.net/package/HTML_QuickForm2
|
||||
*/
|
||||
|
||||
/**
|
||||
* Base class for <input> elements
|
||||
*/
|
||||
// require_once 'HTML/QuickForm2/Element/Input.php';
|
||||
|
||||
/**
|
||||
* Class for <input type="password" /> elements
|
||||
*
|
||||
* @category HTML
|
||||
* @package HTML_QuickForm2
|
||||
* @author Alexey Borzov <avb@php.net>
|
||||
* @author Bertrand Mansion <golgote@mamasam.com>
|
||||
* @version Release: @package_version@
|
||||
*/
|
||||
class HTML_QuickForm2_Element_InputPassword extends HTML_QuickForm2_Element_Input
|
||||
{
|
||||
protected $attributes = array('type' => 'password');
|
||||
|
||||
protected function getFrozenHtml()
|
||||
{
|
||||
$value = $this->getValue();
|
||||
return (('' != $value)? '********': ' ') .
|
||||
$this->getPersistentContent();
|
||||
}
|
||||
}
|
||||
?>
|
@ -0,0 +1,69 @@
|
||||
<?php
|
||||
/**
|
||||
* Class for <input type="radio" /> elements
|
||||
*
|
||||
* PHP version 5
|
||||
*
|
||||
* LICENSE:
|
||||
*
|
||||
* Copyright (c) 2006-2010, Alexey Borzov <avb@php.net>,
|
||||
* Bertrand Mansion <golgote@mamasam.com>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * The names of the authors may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
|
||||
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* @category HTML
|
||||
* @package HTML_QuickForm2
|
||||
* @author Alexey Borzov <avb@php.net>
|
||||
* @author Bertrand Mansion <golgote@mamasam.com>
|
||||
* @license http://opensource.org/licenses/bsd-license.php New BSD License
|
||||
* @version SVN: $Id: InputRadio.php 294057 2010-01-26 21:10:28Z avb $
|
||||
* @link http://pear.php.net/package/HTML_QuickForm2
|
||||
*/
|
||||
|
||||
/**
|
||||
* Base class for checkboxes and radios
|
||||
*/
|
||||
// require_once 'HTML/QuickForm2/Element/InputCheckable.php';
|
||||
|
||||
/**
|
||||
* Class for <input type="radio" /> elements
|
||||
*
|
||||
* @category HTML
|
||||
* @package HTML_QuickForm2
|
||||
* @author Alexey Borzov <avb@php.net>
|
||||
* @author Bertrand Mansion <golgote@mamasam.com>
|
||||
* @version Release: @package_version@
|
||||
*/
|
||||
class HTML_QuickForm2_Element_InputRadio extends HTML_QuickForm2_Element_InputCheckable
|
||||
{
|
||||
protected $attributes = array('type' => 'radio');
|
||||
|
||||
protected $frozenHtml = array(
|
||||
'checked' => '<tt>(x)</tt>',
|
||||
'unchecked' => '<tt>( )</tt>'
|
||||
);
|
||||
}
|
||||
?>
|
@ -0,0 +1,99 @@
|
||||
<?php
|
||||
/**
|
||||
* Class for <input type="reset" /> elements
|
||||
*
|
||||
* PHP version 5
|
||||
*
|
||||
* LICENSE:
|
||||
*
|
||||
* Copyright (c) 2006-2010, Alexey Borzov <avb@php.net>,
|
||||
* Bertrand Mansion <golgote@mamasam.com>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * The names of the authors may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
|
||||
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* @category HTML
|
||||
* @package HTML_QuickForm2
|
||||
* @author Alexey Borzov <avb@php.net>
|
||||
* @author Bertrand Mansion <golgote@mamasam.com>
|
||||
* @license http://opensource.org/licenses/bsd-license.php New BSD License
|
||||
* @version SVN: $Id: InputReset.php 294057 2010-01-26 21:10:28Z avb $
|
||||
* @link http://pear.php.net/package/HTML_QuickForm2
|
||||
*/
|
||||
|
||||
/**
|
||||
* Base class for <input> elements
|
||||
*/
|
||||
// require_once 'HTML/QuickForm2/Element/Input.php';
|
||||
|
||||
/**
|
||||
* Class for <input type="reset" /> elements
|
||||
*
|
||||
* @category HTML
|
||||
* @package HTML_QuickForm2
|
||||
* @author Alexey Borzov <avb@php.net>
|
||||
* @author Bertrand Mansion <golgote@mamasam.com>
|
||||
* @version Release: @package_version@
|
||||
*/
|
||||
class HTML_QuickForm2_Element_InputReset extends HTML_QuickForm2_Element_Input
|
||||
{
|
||||
protected $attributes = array('type' => 'reset');
|
||||
|
||||
/**
|
||||
* Reset buttons can not be frozen
|
||||
*
|
||||
* @param bool Whether element should be frozen or editable. This
|
||||
* parameter is ignored in case of reset buttons
|
||||
* @return bool Always returns false
|
||||
*/
|
||||
public function toggleFrozen($freeze = null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset elements cannot have any submit values
|
||||
*
|
||||
* @param mixed Element's value, this parameter is ignored
|
||||
* @return HTML_QuickForm2_Element_InputReset
|
||||
*/
|
||||
public function setValue($value)
|
||||
{
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset elements cannot have any submit values
|
||||
*
|
||||
* This method always returns null
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getValue()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
?>
|
120
msd2/tracking/piwik/libs/HTML/QuickForm2/Element/InputSubmit.php
Normal file
120
msd2/tracking/piwik/libs/HTML/QuickForm2/Element/InputSubmit.php
Normal file
@ -0,0 +1,120 @@
|
||||
<?php
|
||||
/**
|
||||
* Class for <input type="submit" /> elements
|
||||
*
|
||||
* PHP version 5
|
||||
*
|
||||
* LICENSE:
|
||||
*
|
||||
* Copyright (c) 2006-2010, Alexey Borzov <avb@php.net>,
|
||||
* Bertrand Mansion <golgote@mamasam.com>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * The names of the authors may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
|
||||
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* @category HTML
|
||||
* @package HTML_QuickForm2
|
||||
* @author Alexey Borzov <avb@php.net>
|
||||
* @author Bertrand Mansion <golgote@mamasam.com>
|
||||
* @license http://opensource.org/licenses/bsd-license.php New BSD License
|
||||
* @version SVN: $Id: InputSubmit.php 300722 2010-06-24 10:15:52Z mansion $
|
||||
* @link http://pear.php.net/package/HTML_QuickForm2
|
||||
*/
|
||||
|
||||
/**
|
||||
* Base class for <input> elements
|
||||
*/
|
||||
// require_once 'HTML/QuickForm2/Element/Input.php';
|
||||
|
||||
/**
|
||||
* Class for <input type="submit" /> elements
|
||||
*
|
||||
* @category HTML
|
||||
* @package HTML_QuickForm2
|
||||
* @author Alexey Borzov <avb@php.net>
|
||||
* @author Bertrand Mansion <golgote@mamasam.com>
|
||||
* @version Release: @package_version@
|
||||
*/
|
||||
class HTML_QuickForm2_Element_InputSubmit extends HTML_QuickForm2_Element_Input
|
||||
{
|
||||
protected $attributes = array('type' => 'submit');
|
||||
|
||||
/**
|
||||
* Element's submit value
|
||||
* @var string
|
||||
*/
|
||||
protected $submitValue = null;
|
||||
|
||||
|
||||
/**
|
||||
* Submit buttons can not be frozen
|
||||
*
|
||||
* @param bool Whether element should be frozen or editable. This
|
||||
* parameter is ignored in case of submit elements
|
||||
* @return bool Always returns false
|
||||
*/
|
||||
public function toggleFrozen($freeze = null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Submit's value cannot be set via this method
|
||||
*
|
||||
* @param mixed Element's value, this parameter is ignored
|
||||
* @return HTML_QuickForm2_Element_InputSubmit
|
||||
*/
|
||||
public function setValue($value)
|
||||
{
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the element's value
|
||||
*
|
||||
* The value is only returned if the form was actually submitted and this
|
||||
* submit button was clicked. Returns null in all other cases
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getValue()
|
||||
{
|
||||
return $this->getAttribute('disabled')? null: $this->applyFilters($this->submitValue);
|
||||
}
|
||||
|
||||
public function updateValue()
|
||||
{
|
||||
foreach ($this->getDataSources() as $ds) {
|
||||
if ($ds instanceof HTML_QuickForm2_DataSource_Submit &&
|
||||
null !== ($value = $ds->getValue($this->getName())))
|
||||
{
|
||||
$this->submitValue = $value;
|
||||
return;
|
||||
}
|
||||
}
|
||||
$this->submitValue = null;
|
||||
}
|
||||
}
|
||||
?>
|
@ -0,0 +1,64 @@
|
||||
<?php
|
||||
/**
|
||||
* Class for <input type="text" /> elements
|
||||
*
|
||||
* PHP version 5
|
||||
*
|
||||
* LICENSE:
|
||||
*
|
||||
* Copyright (c) 2006-2010, Alexey Borzov <avb@php.net>,
|
||||
* Bertrand Mansion <golgote@mamasam.com>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * The names of the authors may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
|
||||
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* @category HTML
|
||||
* @package HTML_QuickForm2
|
||||
* @author Alexey Borzov <avb@php.net>
|
||||
* @author Bertrand Mansion <golgote@mamasam.com>
|
||||
* @license http://opensource.org/licenses/bsd-license.php New BSD License
|
||||
* @version SVN: $Id: InputText.php 294057 2010-01-26 21:10:28Z avb $
|
||||
* @link http://pear.php.net/package/HTML_QuickForm2
|
||||
*/
|
||||
|
||||
/**
|
||||
* Base class for <input> elements
|
||||
*/
|
||||
// require_once 'HTML/QuickForm2/Element/Input.php';
|
||||
|
||||
/**
|
||||
* Class for <input type="text" /> elements
|
||||
*
|
||||
* @category HTML
|
||||
* @package HTML_QuickForm2
|
||||
* @author Alexey Borzov <avb@php.net>
|
||||
* @author Bertrand Mansion <golgote@mamasam.com>
|
||||
* @version Release: @package_version@
|
||||
*/
|
||||
class HTML_QuickForm2_Element_InputText extends HTML_QuickForm2_Element_Input
|
||||
{
|
||||
protected $attributes = array('type' => 'text');
|
||||
}
|
||||
?>
|
575
msd2/tracking/piwik/libs/HTML/QuickForm2/Element/Select.php
Normal file
575
msd2/tracking/piwik/libs/HTML/QuickForm2/Element/Select.php
Normal file
@ -0,0 +1,575 @@
|
||||
<?php
|
||||
/**
|
||||
* Classes for <select> elements
|
||||
*
|
||||
* PHP version 5
|
||||
*
|
||||
* LICENSE:
|
||||
*
|
||||
* Copyright (c) 2006-2010, Alexey Borzov <avb@php.net>,
|
||||
* Bertrand Mansion <golgote@mamasam.com>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * The names of the authors may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
|
||||
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* @category HTML
|
||||
* @package HTML_QuickForm2
|
||||
* @author Alexey Borzov <avb@php.net>
|
||||
* @author Bertrand Mansion <golgote@mamasam.com>
|
||||
* @license http://opensource.org/licenses/bsd-license.php New BSD License
|
||||
* @version SVN: $Id: Select.php 300722 2010-06-24 10:15:52Z mansion $
|
||||
* @link http://pear.php.net/package/HTML_QuickForm2
|
||||
*/
|
||||
|
||||
/**
|
||||
* Base class for simple HTML_QuickForm2 elements
|
||||
*/
|
||||
// require_once 'HTML/QuickForm2/Element.php';
|
||||
|
||||
|
||||
/**
|
||||
* Collection of <option>s and <optgroup>s
|
||||
*
|
||||
* This class handles the output of <option> tags. The class is not intended to
|
||||
* be used directly.
|
||||
*
|
||||
* @category HTML
|
||||
* @package HTML_QuickForm2
|
||||
* @author Alexey Borzov <avb@php.net>
|
||||
* @author Bertrand Mansion <golgote@mamasam.com>
|
||||
* @version Release: @package_version@
|
||||
*/
|
||||
class HTML_QuickForm2_Element_Select_OptionContainer extends HTML_Common2
|
||||
implements IteratorAggregate, Countable
|
||||
{
|
||||
/**
|
||||
* List of options and optgroups in this container
|
||||
*
|
||||
* Options are stored as arrays (for performance reasons), optgroups as
|
||||
* instances of Optgroup class.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $options = array();
|
||||
|
||||
/**
|
||||
* Reference to parent <select>'s values
|
||||
* @var array
|
||||
*/
|
||||
protected $values;
|
||||
|
||||
/**
|
||||
* Reference to parent <select>'s possible values
|
||||
* @var array
|
||||
*/
|
||||
protected $possibleValues;
|
||||
|
||||
|
||||
/**
|
||||
* Class constructor
|
||||
*
|
||||
* @param array Reference to values of parent <select> element
|
||||
* @param array Reference to possible values of parent <select> element
|
||||
*/
|
||||
public function __construct(&$values, &$possibleValues)
|
||||
{
|
||||
$this->values =& $values;
|
||||
$this->possibleValues =& $possibleValues;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a new option
|
||||
*
|
||||
* Please note that if you pass 'selected' attribute in the $attributes
|
||||
* parameter then this option's value will be added to <select>'s values.
|
||||
*
|
||||
* @param string Option text
|
||||
* @param string 'value' attribute for <option> tag
|
||||
* @param mixed Additional attributes for <option> tag (either as a
|
||||
* string or as an associative array)
|
||||
*/
|
||||
public function addOption($text, $value, $attributes = null)
|
||||
{
|
||||
if (null === $attributes) {
|
||||
$attributes = array('value' => (string)$value);
|
||||
} else {
|
||||
$attributes = self::prepareAttributes($attributes);
|
||||
if (isset($attributes['selected'])) {
|
||||
// the 'selected' attribute will be set in __toString()
|
||||
unset($attributes['selected']);
|
||||
if (!in_array($value, $this->values)) {
|
||||
$this->values[] = $value;
|
||||
}
|
||||
}
|
||||
$attributes['value'] = (string)$value;
|
||||
}
|
||||
if (!isset($attributes['disabled'])) {
|
||||
$this->possibleValues[(string)$value] = true;
|
||||
}
|
||||
$this->options[] = array('text' => $text, 'attr' => $attributes);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a new optgroup
|
||||
*
|
||||
* @param string 'label' attribute for optgroup tag
|
||||
* @param mixed Additional attributes for <optgroup> tag (either as a
|
||||
* string or as an associative array)
|
||||
* @return HTML_QuickForm2_Element_Select_Optgroup
|
||||
*/
|
||||
public function addOptgroup($label, $attributes = null)
|
||||
{
|
||||
$optgroup = new HTML_QuickForm2_Element_Select_Optgroup(
|
||||
$this->values, $this->possibleValues,
|
||||
$label, $attributes
|
||||
);
|
||||
$this->options[] = $optgroup;
|
||||
return $optgroup;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array of contained options
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getOptions()
|
||||
{
|
||||
return $this->options;
|
||||
}
|
||||
|
||||
public function __toString()
|
||||
{
|
||||
$indentLvl = $this->getIndentLevel();
|
||||
$indent = $this->getIndent() . self::getOption('indent');
|
||||
$linebreak = self::getOption('linebreak');
|
||||
$html = '';
|
||||
$strValues = array_map('strval', $this->values);
|
||||
foreach ($this->options as $option) {
|
||||
if (is_array($option)) {
|
||||
if (in_array($option['attr']['value'], $strValues, true)) {
|
||||
$option['attr']['selected'] = 'selected';
|
||||
}
|
||||
$html .= $indent . '<option' .
|
||||
self::getAttributesString($option['attr']) .
|
||||
'>' . $option['text'] . '</option>' . $linebreak;
|
||||
} elseif ($option instanceof HTML_QuickForm2_Element_Select_OptionContainer) {
|
||||
$option->setIndentLevel($indentLvl + 1);
|
||||
$html .= $option->__toString();
|
||||
}
|
||||
}
|
||||
return $html;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an iterator over contained elements
|
||||
*
|
||||
* @return HTML_QuickForm2_Element_Select_OptionIterator
|
||||
*/
|
||||
public function getIterator()
|
||||
{
|
||||
return new HTML_QuickForm2_Element_Select_OptionIterator($this->options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a recursive iterator over contained elements
|
||||
*
|
||||
* @return RecursiveIteratorIterator
|
||||
*/
|
||||
public function getRecursiveIterator()
|
||||
{
|
||||
return new RecursiveIteratorIterator(
|
||||
new HTML_QuickForm2_Element_Select_OptionIterator($this->options),
|
||||
RecursiveIteratorIterator::SELF_FIRST
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the number of options in the container
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function count()
|
||||
{
|
||||
return count($this->options);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Class representing an <optgroup> tag
|
||||
*
|
||||
* Do not instantiate this class yourself, use
|
||||
* {@link HTML_QuickForm2_Element_Select::addOptgroup()} method
|
||||
*
|
||||
* @category HTML
|
||||
* @package HTML_QuickForm2
|
||||
* @author Alexey Borzov <avb@php.net>
|
||||
* @author Bertrand Mansion <golgote@mamasam.com>
|
||||
* @version Release: @package_version@
|
||||
*/
|
||||
class HTML_QuickForm2_Element_Select_Optgroup
|
||||
extends HTML_QuickForm2_Element_Select_OptionContainer
|
||||
{
|
||||
/**
|
||||
* Class constructor
|
||||
*
|
||||
* @param array Reference to values of parent <select> element
|
||||
* @param array Reference to possible values of parent <select> element
|
||||
* @param string 'label' attribute for optgroup tag
|
||||
* @param mixed Additional attributes for <optgroup> tag (either as a
|
||||
* string or as an associative array)
|
||||
*/
|
||||
public function __construct(&$values, &$possibleValues, $label, $attributes = null)
|
||||
{
|
||||
parent::__construct($values, $possibleValues);
|
||||
$this->setAttributes($attributes);
|
||||
$this->attributes['label'] = (string)$label;
|
||||
}
|
||||
|
||||
public function __toString()
|
||||
{
|
||||
$indent = $this->getIndent();
|
||||
$linebreak = self::getOption('linebreak');
|
||||
return $indent . '<optgroup' . $this->getAttributes(true) . '>' .
|
||||
$linebreak . parent::__toString() . $indent . '</optgroup>' . $linebreak;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements a recursive iterator for options arrays
|
||||
*
|
||||
* @category HTML
|
||||
* @package HTML_QuickForm2
|
||||
* @author Alexey Borzov <avb@php.net>
|
||||
* @author Bertrand Mansion <golgote@mamasam.com>
|
||||
* @version Release: @package_version@
|
||||
*/
|
||||
class HTML_QuickForm2_Element_Select_OptionIterator extends RecursiveArrayIterator
|
||||
implements RecursiveIterator
|
||||
{
|
||||
public function hasChildren()
|
||||
{
|
||||
return $this->current() instanceof HTML_QuickForm2_Element_Select_OptionContainer;
|
||||
}
|
||||
|
||||
public function getChildren()
|
||||
{
|
||||
return new HTML_QuickForm2_Element_Select_OptionIterator(
|
||||
$this->current()->getOptions()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Class representing a <select> element
|
||||
*
|
||||
* @category HTML
|
||||
* @package HTML_QuickForm2
|
||||
* @author Alexey Borzov <avb@php.net>
|
||||
* @author Bertrand Mansion <golgote@mamasam.com>
|
||||
* @version Release: @package_version@
|
||||
*/
|
||||
class HTML_QuickForm2_Element_Select extends HTML_QuickForm2_Element
|
||||
{
|
||||
protected $persistent = true;
|
||||
|
||||
/**
|
||||
* Values for the select element (i.e. values of the selected options)
|
||||
* @var array
|
||||
*/
|
||||
protected $values = array();
|
||||
|
||||
/**
|
||||
* Possible values for select elements
|
||||
*
|
||||
* A value is considered possible if it is present as a value attribute of
|
||||
* some option and that option is not disabled.
|
||||
* @var array
|
||||
*/
|
||||
protected $possibleValues = array();
|
||||
|
||||
|
||||
/**
|
||||
* Object containing options for the <select> element
|
||||
* @var HTML_QuickForm2_Element_Select_OptionContainer
|
||||
*/
|
||||
protected $optionContainer;
|
||||
|
||||
/**
|
||||
* Enable intrinsic validation by default
|
||||
* @var array
|
||||
*/
|
||||
protected $data = array('intrinsic_validation' => true);
|
||||
|
||||
/**
|
||||
* Class constructor
|
||||
*
|
||||
* Select element can understand the following keys in $data parameter:
|
||||
* - 'options': data to populate element's options with. Passed to
|
||||
* {@link loadOptions()} method.
|
||||
* - 'intrinsic_validation': setting this to false will disable
|
||||
* that validation, {@link getValue()} will then return all submit
|
||||
* values, not just those corresponding to options present in the
|
||||
* element. May be useful in AJAX scenarios.
|
||||
*
|
||||
* @param string Element name
|
||||
* @param mixed Attributes (either a string or an array)
|
||||
* @param array Additional element data
|
||||
* @throws HTML_QuickForm2_InvalidArgumentException if junk is given in $options
|
||||
*/
|
||||
public function __construct($name = null, $attributes = null, array $data = array())
|
||||
{
|
||||
$options = isset($data['options'])? $data['options']: array();
|
||||
unset($data['options']);
|
||||
parent::__construct($name, $attributes, $data);
|
||||
$this->loadOptions($options);
|
||||
}
|
||||
|
||||
public function getType()
|
||||
{
|
||||
return 'select';
|
||||
}
|
||||
|
||||
public function __toString()
|
||||
{
|
||||
if ($this->frozen) {
|
||||
return $this->getFrozenHtml();
|
||||
} else {
|
||||
if (empty($this->attributes['multiple'])) {
|
||||
$attrString = $this->getAttributes(true);
|
||||
} else {
|
||||
$this->attributes['name'] .= '[]';
|
||||
$attrString = $this->getAttributes(true);
|
||||
$this->attributes['name'] = substr($this->attributes['name'], 0, -2);
|
||||
}
|
||||
$indent = $this->getIndent();
|
||||
return $indent . '<select' . $attrString . '>' .
|
||||
self::getOption('linebreak') .
|
||||
$this->optionContainer->__toString() .
|
||||
$indent . '</select>';
|
||||
}
|
||||
}
|
||||
|
||||
protected function getFrozenHtml()
|
||||
{
|
||||
if (null === ($value = $this->getValue())) {
|
||||
return ' ';
|
||||
}
|
||||
$valueHash = is_array($value)? array_flip($value): array($value => true);
|
||||
$options = array();
|
||||
foreach ($this->optionContainer->getRecursiveIterator() as $child) {
|
||||
if (is_array($child) && isset($valueHash[$child['attr']['value']]) &&
|
||||
empty($child['attr']['disabled']))
|
||||
{
|
||||
$options[] = $child['text'];
|
||||
}
|
||||
}
|
||||
|
||||
$html = implode('<br />', $options);
|
||||
if ($this->persistent) {
|
||||
$name = $this->attributes['name'] .
|
||||
(empty($this->attributes['multiple'])? '': '[]');
|
||||
// Only use id attribute if doing single hidden input
|
||||
$idAttr = (1 == count($valueHash))? array('id' => $this->getId()): array();
|
||||
foreach ($valueHash as $key => $item) {
|
||||
$html .= '<input type="hidden"' . self::getAttributesString(array(
|
||||
'name' => $name,
|
||||
'value' => $key
|
||||
) + $idAttr) . ' />';
|
||||
}
|
||||
}
|
||||
return $html;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the value of the <select> element
|
||||
*
|
||||
* Please note that the returned value may not necessarily be equal to that
|
||||
* passed to {@link setValue()}. It passes "intrinsic validation" confirming
|
||||
* that such value could possibly be submitted by this <select> element.
|
||||
* Specifically, this method will return null if the elements "disabled"
|
||||
* attribute is set, it will not return values if there are no options having
|
||||
* such a "value" attribute or if such options' "disabled" attribute is set.
|
||||
* It will also only return a scalar value for single selects, mimicking
|
||||
* the common browsers' behaviour.
|
||||
*
|
||||
* @return mixed "value" attribute of selected option in case of single
|
||||
* select, array of selected options' "value" attributes in
|
||||
* case of multiple selects, null if no options selected
|
||||
*/
|
||||
public function getValue()
|
||||
{
|
||||
if (!empty($this->attributes['disabled']) || 0 == count($this->values)
|
||||
|| ($this->data['intrinsic_validation']
|
||||
&& (0 == count($this->optionContainer) || 0 == count($this->possibleValues)))
|
||||
) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$values = array();
|
||||
foreach ($this->values as $value) {
|
||||
if (!$this->data['intrinsic_validation'] || !empty($this->possibleValues[$value])) {
|
||||
$values[] = $value;
|
||||
}
|
||||
}
|
||||
if (0 == count($values)) {
|
||||
return null;
|
||||
} elseif (!empty($this->attributes['multiple'])) {
|
||||
return $this->applyFilters($values);
|
||||
} elseif (1 == count($values)) {
|
||||
return $this->applyFilters($values[0]);
|
||||
} else {
|
||||
// The <select> is not multiple, but several options are to be
|
||||
// selected. At least IE and Mozilla select the last selected
|
||||
// option in this case, we should do the same
|
||||
foreach ($this->optionContainer->getRecursiveIterator() as $child) {
|
||||
if (is_array($child) && in_array($child['attr']['value'], $values)) {
|
||||
$lastValue = $child['attr']['value'];
|
||||
}
|
||||
}
|
||||
return $this->applyFilters($lastValue);
|
||||
}
|
||||
}
|
||||
|
||||
public function setValue($value)
|
||||
{
|
||||
if (is_array($value)) {
|
||||
$this->values = array_values($value);
|
||||
} else {
|
||||
$this->values = array($value);
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads <option>s (and <optgroup>s) for select element
|
||||
*
|
||||
* The method expects a array of options and optgroups:
|
||||
* <pre>
|
||||
* array(
|
||||
* 'option value 1' => 'option text 1',
|
||||
* ...
|
||||
* 'option value N' => 'option text N',
|
||||
* 'optgroup label 1' => array(
|
||||
* 'option value' => 'option text',
|
||||
* ...
|
||||
* ),
|
||||
* ...
|
||||
* )
|
||||
* </pre>
|
||||
* If value is a scalar, then array key is treated as "value" attribute of
|
||||
* <option> and value as this <option>'s text. If value is an array, then
|
||||
* key is treated as a "label" attribute of <optgroup> and value as an
|
||||
* array of <option>s for this <optgroup>.
|
||||
*
|
||||
* If you need to specify additional attributes for <option> and <optgroup>
|
||||
* tags, then you need to use {@link addOption()} and {@link addOptgroup()}
|
||||
* methods instead of this one.
|
||||
*
|
||||
* @param array
|
||||
* @throws HTML_QuickForm2_InvalidArgumentException if junk is given in $options
|
||||
* @return HTML_QuickForm2_Element_Select
|
||||
*/
|
||||
public function loadOptions(array $options)
|
||||
{
|
||||
$this->possibleValues = array();
|
||||
$this->optionContainer = new HTML_QuickForm2_Element_Select_OptionContainer(
|
||||
$this->values, $this->possibleValues
|
||||
);
|
||||
$this->loadOptionsFromArray($this->optionContainer, $options);
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds options from given array into given container
|
||||
*
|
||||
* @param HTML_QuickForm2_Element_Select_OptionContainer options will be
|
||||
* added to this container
|
||||
* @param array options array
|
||||
*/
|
||||
protected function loadOptionsFromArray(
|
||||
HTML_QuickForm2_Element_Select_OptionContainer $container, $options
|
||||
)
|
||||
{
|
||||
foreach ($options as $key => $value) {
|
||||
if (is_array($value)) {
|
||||
$optgroup = $container->addOptgroup($key);
|
||||
$this->loadOptionsFromArray($optgroup, $value);
|
||||
} else {
|
||||
$container->addOption($value, $key);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds a new option
|
||||
*
|
||||
* Please note that if you pass 'selected' attribute in the $attributes
|
||||
* parameter then this option's value will be added to <select>'s values.
|
||||
*
|
||||
* @param string Option text
|
||||
* @param string 'value' attribute for <option> tag
|
||||
* @param mixed Additional attributes for <option> tag (either as a
|
||||
* string or as an associative array)
|
||||
*/
|
||||
public function addOption($text, $value, $attributes = null)
|
||||
{
|
||||
return $this->optionContainer->addOption($text, $value, $attributes);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a new optgroup
|
||||
*
|
||||
* @param string 'label' attribute for optgroup tag
|
||||
* @param mixed Additional attributes for <optgroup> tag (either as a
|
||||
* string or as an associative array)
|
||||
* @return HTML_QuickForm2_Element_Select_Optgroup
|
||||
*/
|
||||
public function addOptgroup($label, $attributes = null)
|
||||
{
|
||||
return $this->optionContainer->addOptgroup($label, $attributes);
|
||||
}
|
||||
|
||||
public function updateValue()
|
||||
{
|
||||
if (!$this->getAttribute('multiple')) {
|
||||
parent::updateValue();
|
||||
} else {
|
||||
$name = $this->getName();
|
||||
foreach ($this->getDataSources() as $ds) {
|
||||
if (null !== ($value = $ds->getValue($name)) ||
|
||||
$ds instanceof HTML_QuickForm2_DataSource_Submit)
|
||||
{
|
||||
$this->setValue(null === $value? array(): $value);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
153
msd2/tracking/piwik/libs/HTML/QuickForm2/Element/Static.php
Normal file
153
msd2/tracking/piwik/libs/HTML/QuickForm2/Element/Static.php
Normal file
@ -0,0 +1,153 @@
|
||||
<?php
|
||||
/**
|
||||
* Class for static elements that only contain text or markup
|
||||
*
|
||||
* PHP version 5
|
||||
*
|
||||
* LICENSE:
|
||||
*
|
||||
* Copyright (c) 2006-2010, Alexey Borzov <avb@php.net>,
|
||||
* Bertrand Mansion <golgote@mamasam.com>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * The names of the authors may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
|
||||
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* @category HTML
|
||||
* @package HTML_QuickForm2
|
||||
* @author Alexey Borzov <avb@php.net>
|
||||
* @author Bertrand Mansion <golgote@mamasam.com>
|
||||
* @license http://opensource.org/licenses/bsd-license.php New BSD License
|
||||
* @version SVN: $Id: Static.php 299206 2010-05-10 10:21:10Z mansion $
|
||||
* @link http://pear.php.net/package/HTML_QuickForm2
|
||||
*/
|
||||
|
||||
/**
|
||||
* Base class for simple HTML_QuickForm2 elements (not Containers)
|
||||
*/
|
||||
// require_once 'HTML/QuickForm2/Element.php';
|
||||
|
||||
/**
|
||||
* Class for static elements that only contain text or markup
|
||||
*
|
||||
* @category HTML
|
||||
* @package HTML_QuickForm2
|
||||
* @author Alexey Borzov <avb@php.net>
|
||||
* @author Bertrand Mansion <golgote@mamasam.com>
|
||||
* @version Release: @package_version@
|
||||
*/
|
||||
class HTML_QuickForm2_Element_Static extends HTML_QuickForm2_Element
|
||||
{
|
||||
|
||||
/**
|
||||
* Contains options and data used for the element creation
|
||||
* - content: Content of the static element
|
||||
* @var array
|
||||
*/
|
||||
protected $data = array('content' => '');
|
||||
|
||||
public function getType()
|
||||
{
|
||||
return 'static';
|
||||
}
|
||||
|
||||
/**
|
||||
* Static element can not be frozen
|
||||
*
|
||||
* @param bool Whether element should be frozen or editable. This
|
||||
* parameter is ignored in case of static elements
|
||||
* @return bool Always returns false
|
||||
*/
|
||||
public function toggleFrozen($freeze = null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the contents of the static element
|
||||
*
|
||||
* @param string Static content
|
||||
* @return HTML_QuickForm2_Element_Static
|
||||
*/
|
||||
function setContent($content)
|
||||
{
|
||||
$this->data['content'] = $content;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the contents of the static element
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function getContent()
|
||||
{
|
||||
return $this->data['content'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Static element's content can also be set via this method
|
||||
*
|
||||
* @param mixed Element's value, this parameter is ignored
|
||||
* @return HTML_QuickForm2_Element_Static
|
||||
*/
|
||||
public function setValue($value)
|
||||
{
|
||||
$this->setContent($value);
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Static elements have no value
|
||||
*
|
||||
* @return null
|
||||
*/
|
||||
public function getValue()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public function __toString()
|
||||
{
|
||||
return $this->getIndent() . $this->data['content'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the element needs to update its value from form's data sources
|
||||
*
|
||||
* Static elements content can be updated with default form values.
|
||||
*/
|
||||
public function updateValue()
|
||||
{
|
||||
foreach ($this->getDataSources() as $ds) {
|
||||
if (!$ds instanceof HTML_QuickForm2_DataSource_Submit &&
|
||||
null !== ($value = $ds->getValue($this->getName())))
|
||||
{
|
||||
$this->setContent($value);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
110
msd2/tracking/piwik/libs/HTML/QuickForm2/Element/Textarea.php
Normal file
110
msd2/tracking/piwik/libs/HTML/QuickForm2/Element/Textarea.php
Normal file
@ -0,0 +1,110 @@
|
||||
<?php
|
||||
/**
|
||||
* Class for <textarea> elements
|
||||
*
|
||||
* PHP version 5
|
||||
*
|
||||
* LICENSE:
|
||||
*
|
||||
* Copyright (c) 2006-2010, Alexey Borzov <avb@php.net>,
|
||||
* Bertrand Mansion <golgote@mamasam.com>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * The names of the authors may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
|
||||
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* @category HTML
|
||||
* @package HTML_QuickForm2
|
||||
* @author Alexey Borzov <avb@php.net>
|
||||
* @author Bertrand Mansion <golgote@mamasam.com>
|
||||
* @license http://opensource.org/licenses/bsd-license.php New BSD License
|
||||
* @version SVN: $Id: Textarea.php 300722 2010-06-24 10:15:52Z mansion $
|
||||
* @link http://pear.php.net/package/HTML_QuickForm2
|
||||
*/
|
||||
|
||||
/**
|
||||
* Base class for simple HTML_QuickForm2 elements
|
||||
*/
|
||||
// require_once 'HTML/QuickForm2/Element.php';
|
||||
|
||||
/**
|
||||
* Class for <textarea> elements
|
||||
*
|
||||
* @category HTML
|
||||
* @package HTML_QuickForm2
|
||||
* @author Alexey Borzov <avb@php.net>
|
||||
* @author Bertrand Mansion <golgote@mamasam.com>
|
||||
* @version Release: @package_version@
|
||||
*/
|
||||
class HTML_QuickForm2_Element_Textarea extends HTML_QuickForm2_Element
|
||||
{
|
||||
protected $persistent = true;
|
||||
|
||||
/**
|
||||
* Value for textarea field
|
||||
* @var string
|
||||
*/
|
||||
protected $value = null;
|
||||
|
||||
public function getType()
|
||||
{
|
||||
return 'textarea';
|
||||
}
|
||||
|
||||
public function setValue($value)
|
||||
{
|
||||
$this->value = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getValue()
|
||||
{
|
||||
return empty($this->attributes['disabled'])? $this->applyFilters($this->value): null;
|
||||
}
|
||||
|
||||
public function __toString()
|
||||
{
|
||||
if ($this->frozen) {
|
||||
return $this->getFrozenHtml();
|
||||
} else {
|
||||
return $this->getIndent() . '<textarea' . $this->getAttributes(true) .
|
||||
'>' . preg_replace("/(\r\n|\n|\r)/", '
', htmlspecialchars(
|
||||
$this->value, ENT_QUOTES, self::getOption('charset')
|
||||
)) . '</textarea>';
|
||||
}
|
||||
}
|
||||
|
||||
public function getFrozenHtml()
|
||||
{
|
||||
$value = htmlspecialchars($this->value, ENT_QUOTES, self::getOption('charset'));
|
||||
if ('off' == $this->getAttribute('wrap')) {
|
||||
$html = $this->getIndent() . '<pre>' . $value .
|
||||
'</pre>' . self::getOption('linebreak');
|
||||
} else {
|
||||
$html = nl2br($value) . self::getOption('linbebreak');
|
||||
}
|
||||
return $html . $this->getPersistentContent();
|
||||
}
|
||||
}
|
||||
?>
|
Reference in New Issue
Block a user