Apache/2.4.7 (Ubuntu) Linux sman1baleendah 3.13.0-24-generic #46-Ubuntu SMP Thu Apr 10 19:11:08 UTC 2014 x86_64 uid=33(www-data) gid=33(www-data) groups=33(www-data) safemode : OFF MySQL: ON | Perl: ON | cURL: OFF | WGet: ON > / usr / share / phpmyadmin / libraries / | server ip : 104.21.89.46 your ip : 108.162.241.199 H O M E |
Filename | /usr/share/phpmyadmin/libraries/List.class.php |
Size | 2.82 kb |
Permission | rw-r--r-- |
Owner | root : root |
Create time | 27-Apr-2025 10:12 |
Last modified | 05-Dec-2013 01:44 |
Last accessed | 05-Jul-2025 20:26 |
Actions | edit | rename | delete | download (gzip) |
View | text | code | image |
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* hold the PMA_List base class
*
* @package PhpMyAdmin
*/
if (! defined('PHPMYADMIN')) {
exit;
}
/**
* @todo add caching
* @abstract
* @package PhpMyAdmin
* @since phpMyAdmin 2.9.10
*/
abstract class PMA_List extends ArrayObject
{
/**
* @var mixed empty item
*/
protected $item_empty = '';
public function __construct($array = array(), $flags = 0, $iterator_class = "ArrayIterator")
{
parent::__construct($array, $flags, $iterator_class);
}
/**
* returns item only if there is only one in the list
*
* @return single item
*/
public function getSingleItem()
{
if (count($this) === 1) {
return reset($this);
}
return $this->getEmpty();
}
/**
* defines what is an empty item (0, '', false or null)
*
* @return mixed an empty item
*/
public function getEmpty()
{
return $this->item_empty;
}
/**
* checks if the given db names exists in the current list, if there is
* missing at least one item it returns false otherwise true
*
* @return boolean true if all items exists, otheriwse false
*/
public function exists()
{
$this_elements = $this->getArrayCopy();
foreach (func_get_args() as $result) {
if (! in_array($result, $this_elements)) {
return false;
}
}
return true;
}
/**
* returns HTML <option>-tags to be used inside <select></select>
*
* @param mixed $selected the selected db or true for
* selecting current db
* @param boolean $include_information_schema whether include information schema
*
* @return string HTML option tags
*/
public function getHtmlOptions($selected = '', $include_information_schema = true)
{
if (true === $selected) {
$selected = $this->getDefault();
}
$options = '';
foreach ($this as $each_item) {
if (false === $include_information_schema
&& PMA_is_system_schema($each_item)
) {
continue;
}
$options .= '<option value="' . htmlspecialchars($each_item) . '"';
if ($selected === $each_item) {
$options .= ' selected="selected"';
}
$options .= '>' . htmlspecialchars($each_item) . '</option>' . "\n";
}
return $options;
}
/**
* returns default item
*
* @return string default item
*/
public function getDefault()
{
return $this->getEmpty();
}
/**
* builds up the list
*
* @return void
*/
abstract public function build();
}
?>
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* hold the PMA_List base class
*
* @package PhpMyAdmin
*/
if (! defined('PHPMYADMIN')) {
exit;
}
/**
* @todo add caching
* @abstract
* @package PhpMyAdmin
* @since phpMyAdmin 2.9.10
*/
abstract class PMA_List extends ArrayObject
{
/**
* @var mixed empty item
*/
protected $item_empty = '';
public function __construct($array = array(), $flags = 0, $iterator_class = "ArrayIterator")
{
parent::__construct($array, $flags, $iterator_class);
}
/**
* returns item only if there is only one in the list
*
* @return single item
*/
public function getSingleItem()
{
if (count($this) === 1) {
return reset($this);
}
return $this->getEmpty();
}
/**
* defines what is an empty item (0, '', false or null)
*
* @return mixed an empty item
*/
public function getEmpty()
{
return $this->item_empty;
}
/**
* checks if the given db names exists in the current list, if there is
* missing at least one item it returns false otherwise true
*
* @return boolean true if all items exists, otheriwse false
*/
public function exists()
{
$this_elements = $this->getArrayCopy();
foreach (func_get_args() as $result) {
if (! in_array($result, $this_elements)) {
return false;
}
}
return true;
}
/**
* returns HTML <option>-tags to be used inside <select></select>
*
* @param mixed $selected the selected db or true for
* selecting current db
* @param boolean $include_information_schema whether include information schema
*
* @return string HTML option tags
*/
public function getHtmlOptions($selected = '', $include_information_schema = true)
{
if (true === $selected) {
$selected = $this->getDefault();
}
$options = '';
foreach ($this as $each_item) {
if (false === $include_information_schema
&& PMA_is_system_schema($each_item)
) {
continue;
}
$options .= '<option value="' . htmlspecialchars($each_item) . '"';
if ($selected === $each_item) {
$options .= ' selected="selected"';
}
$options .= '>' . htmlspecialchars($each_item) . '</option>' . "\n";
}
return $options;
}
/**
* returns default item
*
* @return string default item
*/
public function getDefault()
{
return $this->getEmpty();
}
/**
* builds up the list
*
* @return void
*/
abstract public function build();
}
?>