Библиотека для cis, online, cms1

This commit is contained in:
Фёдор Подлеснов 2016-06-29 18:51:32 +03:00
commit 3c2e614d87
269 changed files with 39854 additions and 0 deletions

43
core/form/viewstate.php Normal file
View file

@ -0,0 +1,43 @@
<?php
/**
* http://www.alternateinterior.com/2006/09/a-viewstate-for-php.html
* Óïðàâëåíèå ñîñòîÿíèåì ìåæäó ñòðàíèöàìè
*/
class ViewState // extends Collection
{
private $values = array();
function set($name, $value)
{
$this->values[$name] = $value;
}
function get()
{
$args = func_get_args();
$result = $this->values;
foreach ($args as $name) {
if (!isset($result[$name])) {
return null;
}
$result = $result[$name];
}
return $result;
}
function saveState()
{
return base64_encode(serialize($this->values));
}
function restoreState($value)
{
$this->values = unserialize(base64_decode($value));
}
function export()
{
return $this->values;
}
}