Библиотека для 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

View file

@ -0,0 +1,34 @@
<?php
require_once 'abstract.php';
/**
* Ïðîâåðêà ôîðìàòà äàòû
*/
class Rule_Count extends Rule_Abstract
{
public $size = 1;
public $max = false;
public function getErrorMsg()
{
return "Êîëè÷åñòâî çàïèñåé äîëæíî áûòü íå ìåííå {$this->size} è íå áîëåå {$this->max}";
}
function not_empty($s) {
return $s != "";
}
public function isValid(Collection $container, $status = null)
{
if (!$this->max) {
$this->max = $this->size;
}
$count = count(array_filter(array_map('trim',
explode(";", $container->get($this->field))), array($this, 'not_empty')));
return $count >= $this->size && $count <= $this->max;
}
}