/**
  * @param string $indexType
  * @param Type $pageType
  * @param array $cacheWarmers
  * @param Maintenance $out
  */
 public function __construct($indexType, $pageType, array $cacheWarmers = array(), Maintenance $out = null)
 {
     parent::__construct($out);
     $this->indexType = $indexType;
     $this->pageType = $pageType;
     $this->cacheWarmers = $cacheWarmers;
 }
 /**
  * @param Index $index
  * @param string $indexType
  * @param int|string $maxShardsPerNode
  * @param Maintenance $out
  */
 public function __construct(Index $index, $indexType, $maxShardsPerNode, Maintenance $out = null)
 {
     parent::__construct($out);
     $this->index = $index;
     $this->indexType = $indexType;
     $this->maxShardsPerNode = $maxShardsPerNode;
 }
Ejemplo n.º 3
0
 public function __construct(Bank $bank)
 {
     parent::__construct($bank);
     $this->mode1 = new Validator17($bank);
     $this->mode1->setWeights(array(1, 2));
     $this->mode2 = new ValidatorC1b($bank);
 }
Ejemplo n.º 4
0
 public function __construct(Bank $bank)
 {
     parent::__construct($bank);
     $this->mode1 = new Validator09($bank);
     $this->mode2 = new Validator06($bank);
     $this->mode2->setWeights(array(2, 3, 4, 5, 6, 7));
 }
Ejemplo n.º 5
0
 public function __construct($params = array())
 {
     parent::__construct($params);
     $this->foreignTable = isset($params['foreignTable']) ? (string) $params['foreignTable'] : '';
     if ($this->foreignTable == '') {
         throw new Exception('Missing or empty foreignTable parameter');
     }
     $this->foreignKeyMapping = array();
     $idx = 0;
     $fkms = isset($params['foreignKeyMapping']) && is_array($params['foreignKeyMapping']) ? $params['foreignKeyMapping'] : array();
     foreach ($fkms as $fkm) {
         $idx++;
         $tp = isset($fkm['type']) ? $this->cleanUpPreparedStatementType((string) $fkm['type']) : 'int';
         if ($tp == false) {
             throw new Exception(sprintf('Invalid type parameter in foreignKeyMapping entry #%d', $idx));
         }
         $local = isset($fkm['local']) ? (string) $fkm['local'] : '';
         if ($local == '') {
             throw new Exception(sprintf('Missing or empty local parameter in foreignKeyMapping entry #%d', $idx));
         }
         $foreign = isset($fkm['foreign']) ? (string) $fkm['foreign'] : '';
         if ($foreign == '') {
             throw new Exception(sprintf('Missing or empty foreign parameter in foreignKeyMapping entry #%d', $idx));
         }
         $this->foreignKeyMapping[] = (object) array('type' => $tp, 'local' => $local, 'foreign' => $foreign);
     }
     if (empty($this->foreignKeyMapping)) {
         throw new Exception('Missing, empty or invalid foreignKeyMapping parameter');
     }
 }
 /**
  * @param Client $client
  * @param string $aliasName
  * @param string $specificIndexName
  * @param bool $startOver
  * @param Maintenance $out
  */
 public function __construct(Client $client, $aliasName, $specificIndexName, $startOver, Maintenance $out = null)
 {
     parent::__construct($out);
     $this->client = $client;
     $this->aliasName = $aliasName;
     $this->specificIndexName = $specificIndexName;
     $this->startOver = $startOver;
 }
Ejemplo n.º 7
0
 public function __construct(Bank $bank)
 {
     parent::__construct($bank);
     $this->mode1 = new Validator20($bank);
     $this->mode1->setWeights(array(2, 3, 4, 5, 6, 7, 8, 9, 3));
     $this->mode2 = new Validator53($bank);
     $this->mode2->setWeights(array(2, 4, 8, 5, 10, 9, 7, 3, 6, 1, 2, 4));
 }
Ejemplo n.º 8
0
 public function __construct($data, $fields = array())
 {
     global $current_language;
     parent::__construct($data, $fields, substr($current_language, 0, 2), 'include/validation/lang');
     foreach ($this->CustomValidations as $validation => $function) {
         $this->addRule($validation, $function, getTranslatedString('INVALID'));
     }
 }
Ejemplo n.º 9
0
 public function __construct(Bank $bank)
 {
     parent::__construct($bank);
     $this->mode1 = new Validator00($bank);
     $this->mode2 = new Validator00($bank);
     $this->mode2->setStart(-3);
     $this->mode2->setChecknumberPosition(-2);
 }
Ejemplo n.º 10
0
 public function __construct($params = array())
 {
     parent::__construct($params);
     $this->valueName = isset($params['valueName']) ? $params['valueName'] : '';
     if ($this->valueName == '') {
         throw new Exception('Missing or empty valueName parameter');
     }
 }
Ejemplo n.º 11
0
 public function __construct(Bank $bank)
 {
     parent::__construct($bank);
     $this->mode1 = new Validator15($bank);
     $this->mode1->setWeights(array(2, 3, 4, 5));
     $this->mode2 = new Validator58($bank);
     $this->mode2->setWeights(array(2, 3, 4, 5, 6, 0, 0, 0, 0));
 }
Ejemplo n.º 12
0
 public function __construct(Bank $bank)
 {
     parent::__construct($bank);
     $this->mode1 = new Validator00($bank);
     $this->mode1->setWeights(array(2, 1));
     $this->mode2 = new Validator01($bank);
     $this->mode2->setWeights(array(3, 7, 1));
 }
Ejemplo n.º 13
0
	/**
	 * Pass each field to be validated as a seperate argument
	 * to the constructor of this object. (an array of elements are ok)
	 */
	function __construct() {
		$Required = func_get_args();
		if( isset($Required[0]) && is_array( $Required[0] ) )
			$Required = $Required[0];
		$this->required = $Required;

		parent::__construct();
	}
Ejemplo n.º 14
0
 public function __construct(Bank $bank)
 {
     parent::__construct($bank);
     $this->mode1 = new Validator75($bank);
     $this->mode2 = new Validator29($bank);
     $this->mode3 = new Validator00($bank);
     $this->mode4 = new Validator09($bank);
 }
Ejemplo n.º 15
0
 public function __construct($x)
 {
     $this->context = stream_context_create(array('http' => array('header' => "User-agent: Mozilla")));
     parent::__construct($x);
     $this->population2010 = str_replace('ё', 'е', @file_get_contents('../parser/population2010.txt'));
     $this->population2012 = str_replace('ё', 'е', @file_get_contents('../parser/population2012.txt'));
     $this->population2013 = str_replace('ё', 'е', @file_get_contents('../parser/population2013.txt'));
     $this->populationFix = str_replace('ё', 'е', @file_get_contents('../parser/populationFix.txt'));
 }
 /**
  * @todo: this constructor takes way too much arguments - refactor
  *
  * @param Index $index
  * @param bool $optimizeIndexForExperimentalHighlighter
  * @param array $availablePlugins
  * @param array $mappingConfig
  * @param Type[] $types Array with type names as key & type object as value
  * @param Maintenance $out
  */
 public function __construct(Index $index, $optimizeIndexForExperimentalHighlighter, array $availablePlugins, array $mappingConfig, array $types, Maintenance $out = null)
 {
     parent::__construct($out);
     $this->index = $index;
     $this->optimizeIndexForExperimentalHighlighter = $optimizeIndexForExperimentalHighlighter;
     $this->availablePlugins = $availablePlugins;
     $this->mappingConfig = $mappingConfig;
     $this->types = $types;
 }
 /**
  * @param boolean $parsleyEnabled
  **/
 public function __construct($constraints = array(), $parsleyEnabled = true, $defaultJS = null)
 {
     parent::__construct();
     $this->parsleyEnabled = $parsleyEnabled;
     $this->defaultJS = $defaultJS !== null ? $defaultJS : $this->config()->get('default_js');
     if (count($constraints)) {
         $this->setConstraints($constraints);
     }
 }
Ejemplo n.º 18
0
 public function __construct($params = array())
 {
     parent::__construct($params);
     $this->table = isset($params['table']) ? (string) $params['table'] : '';
     if ($this->table == '') {
         throw new Exception('Missing or empty table parameter');
     }
     $this->fields = array();
     $idx = 0;
     $flds = isset($params['fields']) && is_array($params['fields']) ? $params['fields'] : array();
     foreach ($flds as $fld) {
         $idx++;
         $tp = isset($fld['type']) ? $this->cleanUpPreparedStatementType((string) $fld['type']) : 'int';
         if ($tp == false) {
             throw new Exception(sprintf('Invalid type parameter in fields entry #%d', $idx));
         }
         $field = isset($fld['field']) ? (string) $fld['field'] : '';
         if ($field == '') {
             throw new Exception(sprintf('Missing or empty field parameter in fields entry #%d', $idx));
         }
         $queryOperator = isset($fld['queryOperator']) ? (string) $fld['queryOperator'] : '=';
         if ($queryOperator == '') {
             throw new Exception(sprintf('Missing or empty queryOperator parameter in fields entry #%d', $idx));
         }
         if (!in_array($queryOperator, self::$ALLOWED_QUERY_OPERATORS)) {
             throw new Exception(sprintf("Invalid queryOperator '%s' in fields entry #%d", $queryOperator, $idx));
         }
         switch ($tp) {
             case 'int':
             case 'float':
             case 'double':
             case 'boolean':
                 if (!in_array($queryOperator, self::$ALLOWED_NUMERIC_QUERY_OPERATORS)) {
                     throw new Exception(sprintf("Invalid queryOperator '%s' for numeric type in fields entry #%d", $queryOperator, $idx));
                 }
                 break;
             case 'string':
                 if (!in_array($queryOperator, self::$ALLOWED_STRING_QUERY_OPERATORS)) {
                     throw new Exception(sprintf("Invalid queryOperator '%s' for string type in fields entry #%d", $queryOperator, $idx));
                 }
                 break;
             case 'binary':
                 if (!in_array($queryOperator, self::$ALLOWED_BINARY_QUERY_OPERATORS)) {
                     throw new Exception(sprintf("Invalid queryOperator '%s' for binary type in fields entry #%d", $queryOperator, $idx));
                 }
                 break;
             default:
                 throw new Exception(sprintf('Unexpected PreparedStatement data type: %s', $fld->type));
         }
         $this->fields[] = (object) array('type' => $tp, 'field' => $field, 'queryOperator' => $queryOperator);
     }
     if (empty($this->fields)) {
         throw new Exception('Missing, empty or invalid fields parameter');
     }
 }
Ejemplo n.º 19
0
 public function __construct(array $options = array())
 {
     if ($iniSize = ini_get('upload_max_filesize')) {
         if (preg_match('@^(\\d+)M$i@', $iniSize, $found)) {
             $this->maxSize = $found[1] * 1024 * 1204;
         } elseif (preg_match('@^(\\d+)K$i@', $iniSize, $found)) {
             $this->maxSize = $found[1] * 1024;
         }
     }
     return parent::__construct($options);
 }
 /**
  * Constructor.
  * @param $symbolic string
  * @param $assocType int
  * @param $assocId int
  */
 function __construct($symbolic, $assocType, $assocId)
 {
     parent::__construct();
     $controlledVocabDao = DAORegistry::getDAO('ControlledVocabDAO');
     $controlledVocab = $controlledVocabDao->getBySymbolic($symbolic, $assocType, $assocId);
     if ($controlledVocab) {
         $this->_acceptedValues = array_keys($controlledVocab->enumerate());
     } else {
         $this->_acceptedValues = array();
     }
 }
Ejemplo n.º 21
0
 /**
  * Constructor.
  * Define values to validate.
  *
  * @param array $data
  * @param string $defaultFilters the default filter list that you want to add 
  */
 function __construct(array $data = null, $defaultFilters = 'strip_tags,trim')
 {
     parent::__construct($data);
     if (!empty($defaultFilters)) {
         $filterList = explode(',', $defaultFilters);
         foreach ($filterList as $filterItem) {
             if (is_callable($filterItem)) {
                 $this->defaultFilters[] = $filterItem;
             }
         }
         $this->filters = $this->defaultFilters;
     }
 }
 /**
  * Pass each field to be validated as a seperate argument to the constructor
  * of this object. (an array of elements are ok).
  */
 public function __construct()
 {
     $required = func_get_args();
     if (isset($required[0]) && is_array($required[0])) {
         $required = $required[0];
     }
     if (!empty($required)) {
         $this->required = ArrayLib::valuekey($required);
     } else {
         $this->required = array();
     }
     parent::__construct();
 }
Ejemplo n.º 23
0
 public function __construct(array $options = [])
 {
     if (empty($options['attributes'])) {
         throw new Exception\BadMethodCallException("Must pass a value as 'attributes' option");
     }
     $this->attributes = $options['attributes'];
     unset($options['attributes']);
     if (!is_array($this->attributes)) {
         throw new Exception\InvalidArgumentException(sprintf("'attributes' option must be an array, %s passed", gettype($this->attributes)));
     }
     parent::__construct($options);
     $this->validateOptions();
 }
Ejemplo n.º 24
0
 public function __construct($params = array())
 {
     parent::__construct($params);
     $this->valueName = isset($params['valueName']) ? $params['valueName'] : '';
     if ($this->valueName == '') {
         throw new Exception('Missing or empty valueName parameter');
     }
     $this->minLength = isset($params['minLength']) ? $params['minLength'] : null;
     $this->maxLength = isset($params['maxLength']) ? $params['maxLength'] : null;
     if ($this->minLength === null && $this->maxLength === null) {
         throw new Exception('Missing minLength and maxLength parameter; at least one is required.');
     }
 }
 /**
  * @param Index $index
  * @param bool $startOver
  * @param string $maxShardsPerNode
  * @param int $shardCount
  * @param string $replicaCount
  * @param int $refreshInterval
  * @param bool $searchAllFields
  * @param AnalysisConfigBuilder $analysisConfigBuilder
  * @param array $mergeSettings
  * @param Maintenance $out
  */
 public function __construct(Index $index, $startOver, $maxShardsPerNode, $shardCount, $replicaCount, $refreshInterval, $searchAllFields, AnalysisConfigBuilder $analysisConfigBuilder, array $mergeSettings, Maintenance $out = null)
 {
     parent::__construct($out);
     $this->index = $index;
     $this->startOver = $startOver;
     $this->maxShardsPerNode = $maxShardsPerNode;
     $this->shardCount = $shardCount;
     $this->replicaCount = $replicaCount;
     $this->refreshInterval = $refreshInterval;
     $this->searchAllFields = $searchAllFields;
     $this->analysisConfigBuilder = $analysisConfigBuilder;
     $this->mergeSettings = $mergeSettings;
 }
Ejemplo n.º 26
0
 public function __construct(Bank $bank)
 {
     parent::__construct($bank);
     $this->validator09 = new Validator09($bank);
     $this->mode1 = new Validator00($bank);
     $this->mode1->setWeights(array(1, 2));
     $this->mode1->setStart(0);
     $this->mode1->setEnd(-2);
     $this->mode2 = new Validator00($bank);
     $this->mode2->setWeights(array(1, 2, 0, 1, 2, 1, 2, 1, 2, 1));
     $this->mode2->setChecknumberPosition(2);
     $this->mode2->setStart(0);
     $this->mode2->setEnd(-1);
     $this->modeMap = array(51 => 1, 55 => 1, 61 => 1, 64 => 1, 65 => 1, 66 => 1, 70 => 1, 88 => 1, 94 => 1, 95 => 1, 52 => 2, 53 => 2, 54 => 2, 62 => 2, 63 => 2, 67 => 2, 68 => 2, 69 => 2, 71 => 2, 72 => 2, 89 => 2, 90 => 2, 92 => 2, 93 => 2, 96 => 2, 97 => 2, 98 => 2, 40 => 3, 50 => 3, 91 => 3, 99 => 3);
 }
Ejemplo n.º 27
0
 public function __construct($params = array())
 {
     parent::__construct($params);
     $this->type = $this->cleanUpPHPType(isset($params['type']) ? strtolower($params['type']) : '');
     if ($this->type === false) {
         throw new Exception('Missing or invalid type parameter');
     }
     if ($this->type == 'string') {
         throw new Exception('Type of "string" is not supported by this Validator');
     }
     $this->valueName = isset($params['valueName']) ? $params['valueName'] : '';
     if ($this->valueName == '') {
         throw new Exception('Missing or empty valueName parameter');
     }
 }
Ejemplo n.º 28
0
 public function __construct($params = array())
 {
     parent::__construct($params);
     $this->type = $this->cleanUpPHPType(isset($params['type']) ? strtolower($params['type']) : '');
     if ($this->type === false) {
         throw new Exception('Missing or invalid type parameter');
     }
     $this->valueName = isset($params['valueName']) ? $params['valueName'] : '';
     if ($this->valueName == '') {
         throw new Exception('Missing or empty valueName parameter');
     }
     $this->validValues = isset($params['validValues']) && is_array($params['validValues']) ? $params['validValues'] : array();
     if (empty($this->validValues)) {
         throw new Exception('Missing or empty validValues parameter');
     }
     $this->caseInsensitive = isset($params['caseInsensitive']) && is_bool($params['caseInsensitive']) ? $params['caseInsensitive'] : false;
 }
Ejemplo n.º 29
0
 public function __construct(Bank $bank)
 {
     parent::__construct($bank);
     $this->validator1 = new Validator06($bank);
     $this->validator1->setWeights(array(2, 3, 4, 5, 6, 7, 8, 0, 0));
     $this->validatorChain = new ValidatorChain($bank);
     $validator2 = new Validator06($bank);
     $validator2->setWeights(array(2, 3, 4, 5, 6, 7, 0, 0, 0));
     $this->validatorChain->addValidator($validator2);
     $validator3 = new Validator06($bank);
     $validator3->setWeights(array(2, 3, 4, 5, 6, 7, 0, 0, 0));
     $validator3->setDivisor(7);
     $this->validatorChain->addValidator($validator3);
     $validator4 = new Validator06($bank);
     $validator4->setWeights(array(2, 3, 4, 5, 6, 7, 0, 0, 0));
     $validator4->setDivisor(10);
     $this->validatorChain->addValidator($validator4);
 }
Ejemplo n.º 30
0
 public function __construct($params = array())
 {
     parent::__construct($params);
     $this->type = $this->cleanUpPHPType(isset($params['type']) ? strtolower($params['type']) : '');
     if ($this->type === false) {
         throw new Exception('Missing or invalid type parameter');
     }
     $this->valueName = isset($params['valueName']) ? $params['valueName'] : '';
     if ($this->valueName == '') {
         throw new Exception('Missing or empty valueName parameter');
     }
     $this->minVal = isset($params['min']) ? $params['min'] : null;
     $this->maxVal = isset($params['max']) ? $params['max'] : null;
     if ($this->minVal === null && $this->maxVal === null) {
         throw new Exception('Missing min and max parameter; at least one is required.');
     }
     $this->caseInsensitive = isset($params['caseInsensitive']) && is_bool($params['caseInsensitive']) ? $params['caseInsensitive'] : false;
 }