public function AddCheck($Url, $PreCheckUrl, $StringToCheck, $IsRegex = false)
 {
     if (Preg_Match("@\\b(https?://)(([0-9a-zA-Z_!~*'().&=+\$%-]+:)?[0-9a-zA-Z_!~*'().&=+\$%-]+\\@)?(([0-9]{1,3}\\.){3}[0-9]{1,3}|([0-9a-zA-Z_!~*'()-]+\\.)*([0-9a-zA-Z][0-9a-zA-Z-]{0,61})?[0-9a-zA-Z]\\.[a-zA-Z]{2,6})(:[0-9]{1,4})?((/[0-9a-zA-Z_!~*'().;?:\\@&=+\$,%#-]+)*/?)@", $Url) == 0) {
         throw new InvalidArgumentException('$Url "' . $Url . '" is not a valid URL.');
     }
     if ($PreCheckUrl !== null && Preg_Match("@\\b(https?://)(([0-9a-zA-Z_!~*'().&=+\$%-]+:)?[0-9a-zA-Z_!~*'().&=+\$%-]+\\@)?(([0-9]{1,3}\\.){3}[0-9]{1,3}|([0-9a-zA-Z_!~*'()-]+\\.)*([0-9a-zA-Z][0-9a-zA-Z-]{0,61})?[0-9a-zA-Z]\\.[a-zA-Z]{2,6})(:[0-9]{1,4})?((/[0-9a-zA-Z_!~*'().;?:\\@&=+\$,%#-]+)*/?)@", $PreCheckUrl) == 0) {
         throw new InvalidArgumentException('$PreCheckUrl "' . $PreCheckUrl . '" is not a valid URL.');
     }
     if (Is_Bool($IsRegex) === false) {
         throw new InvalidArgumentException('$IsRegex "' . $IsRegex . '" is not a boolean.');
     }
     $this->checks[] = array('url' => $Url, 'pre_url' => $PreCheckUrl, 'check' => $StringToCheck, 'is_regex' => $IsRegex);
 }
示例#2
0
<?php

#-------------------------------------------------------------------------------
/** @author Великодный В.В. (Joonte Ltd.) */
/******************************************************************************/
/******************************************************************************/
$__args_list = array('Value', 'TrueValue', 'FalseValue');
/******************************************************************************/
eval(COMP_INIT);
/******************************************************************************/
/******************************************************************************/
if ($TrueValue && $FalseValue) {
    # OK
} else {
    $TrueValue = 'Да';
    $FalseValue = 'Нет';
}
#-------------------------------------------------------------------------------
return Is_Bool($Value) ? $Value : $Value == 'yes' || $Value == '1' ? $TrueValue : $FalseValue;
#-------------------------------------------------------------------------------