__ __ __ __ _____ _ _ _____ _ _ _ | \/ | \ \ / / | __ \ (_) | | / ____| | | | | | \ / |_ __\ V / | |__) | __ ___ ____ _| |_ ___ | (___ | |__ ___| | | | |\/| | '__|> < | ___/ '__| \ \ / / _` | __/ _ \ \___ \| '_ \ / _ \ | | | | | | |_ / . \ | | | | | |\ V / (_| | || __/ ____) | | | | __/ | | |_| |_|_(_)_/ \_\ |_| |_| |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1 if you need WebShell for Seo everyday contact me on Telegram Telegram Address : @jackleetFor_More_Tools:
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
/**
* utility functions
*
* PHP versions 4 and 5
*
* LICENSE: This source file is subject to version 3.01 of the PHP license
* that is available through the world-wide-web at the following URI:
* http://www.php.net/license/3_01.txt If you did not receive a copy of
* the PHP License and are unable to obtain it through the web, please
* send a note to license@php.net so we can mail you a copy immediately.
*
* @category HTML
* @package HTML_QuickForm
* @author Chuck Burgess <ashnazg@php.net>
* @copyright 2001-2018 The PHP Group
* @license http://www.php.net/license/3_01.txt PHP License 3.01
* @version CVS: $Id$
* @link http://pear.php.net/package/HTML_QuickForm
*/
/**
* Provides a collection of static methods for array manipulation.
*
* (courtesy of CiviCRM project (https://civicrm.org/)
*
* @category HTML
* @package HTML_QuickForm
* @author Chuck Burgess <ashnazg@php.net>
* @version Release: @package_version@
* @since 3.2
*/
class HTML_QuickForm_utils
{
/**
* Get a single value from an array-tree.
*
* @param array $values Ex: ['foo' => ['bar' => 123]].
* @param array $path Ex: ['foo', 'bar'].
* @param mixed $default
* @return mixed Ex 123.
*
* @access public
* @static
*/
static function pathGet($values, $path, $default = NULL) {
foreach ($path as $key) {
if (!is_array($values) || !isset($values[$key])) {
return $default;
}
$values = $values[$key];
}
return $values;
}
/**
* Check if a key isset which may be several layers deep.
*
* This is a helper for when the calling function does not know how many layers deep
* the path array is so cannot easily check.
*
* @param array $values
* @param array $path
* @return bool
*
* @access public
* @static
*/
static function pathIsset($values, $path) {
foreach ($path as $key) {
if (!is_array($values) || !isset($values[$key])) {
return FALSE;
}
$values = $values[$key];
}
return TRUE;
}
/**
* Set a single value in an array tree.
*
* @param array $values Ex: ['foo' => ['bar' => 123]].
* @param array $pathParts Ex: ['foo', 'bar'].
* @param mixed $value Ex: 456.
* @return void
*
* @access public
* @static
*/
static function pathSet(&$values, $pathParts, $value) {
$r = &$values;
$last = array_pop($pathParts);
foreach ($pathParts as $part) {
if (!isset($r[$part])) {
$r[$part] = array();
}
$r = &$r[$part];
}
$r[$last] = $value;
}
/**
* Check if a key isset which may be several layers deep.
*
* This is a helper for when the calling function does not know how many layers deep the
* path array is so cannot easily check.
*
* @param array $array
* @param array $path
* @return bool
*
* @access public
* @static
*/
static function recursiveIsset($array, $path) {
return self::pathIsset($array, $path);
}
/**
* Check if a key isset which may be several layers deep.
*
* This is a helper for when the calling function does not know how many layers deep the
* path array is so cannot easily check.
*
* @param array $array
* @param array $path An array of keys,
* e.g [0, 'bob', 8] where we want to check if $array[0]['bob'][8]
* @param mixed $default Value to return if not found.
* @return bool
*
* @access public
* @static
*/
static function recursiveValue($array, $path, $default = NULL) {
return self::pathGet($array, $path, $default);
}
/**
* Append the value to the array using the key provided.
*
* e.g if value is 'llama' & path is [0, 'email', 'location'] result will be
* [0 => ['email' => ['location' => 'llama']]
*
* @param $path
* @param $value
* @param array $source
* @return array
*
* @access public
* @static
*/
static function recursiveBuild($path, $value, $source = array()) {
self::pathSet($source, $path, $value);
return $source;
}
}
?>
| Name | Type | Size | Permission | Actions |
|---|---|---|---|---|
| Renderer | Folder | 0777 |
|
|
| Rule | Folder | 0777 |
|
|
| DHTMLRulesTableless.php | File | 7.27 KB | 0777 |
|
| Renderer.php | File | 4.51 KB | 0777 |
|
| Rule.php | File | 2.15 KB | 0777 |
|
| RuleRegistry.php | File | 15.2 KB | 0777 |
|
| advcheckbox.php | File | 8.82 KB | 0777 |
|
| autocomplete.php | File | 8.77 KB | 0777 |
|
| button.php | File | 2.95 KB | 0777 |
|
| checkbox.php | File | 7.9 KB | 0777 |
|
| date.php | File | 32.44 KB | 0777 |
|
| element.php | File | 13.23 KB | 0777 |
|
| file.php | File | 11.21 KB | 0777 |
|
| group.php | File | 17.92 KB | 0777 |
|
| header.php | File | 2.45 KB | 0777 |
|
| hidden.php | File | 3.21 KB | 0777 |
|
| hiddenselect.php | File | 4.17 KB | 0777 |
|
| hierselect.php | File | 20.06 KB | 0777 |
|
| html.php | File | 2.45 KB | 0777 |
|
| image.php | File | 3.92 KB | 0777 |
|
| input.php | File | 6.03 KB | 0777 |
|
| link.php | File | 5.41 KB | 0777 |
|
| password.php | File | 3.86 KB | 0777 |
|
| radio.php | File | 7.85 KB | 0777 |
|
| reset.php | File | 2.91 KB | 0777 |
|
| select.php | File | 18.93 KB | 0777 |
|
| static.php | File | 5.38 KB | 0777 |
|
| submit.php | File | 3.1 KB | 0777 |
|
| text.php | File | 3.41 KB | 0777 |
|
| textarea.php | File | 6.19 KB | 0777 |
|
| utils.php | File | 4.52 KB | 0777 |
|
| xbutton.php | File | 4.26 KB | 0777 |
|