diff --git a/.gitmodules b/.gitmodules
new file mode 100644
index 0000000..4f4d135
--- /dev/null
+++ b/.gitmodules
@@ -0,0 +1,3 @@
+[submodule "vendor/symfony/Component/ClassLoader"]
+ path = vendor/symfony/Component/ClassLoader
+ url = https://github.com/symfony/ClassLoader.git
diff --git a/README.md b/README.md
index 6a94004..3b59c1c 100644
--- a/README.md
+++ b/README.md
@@ -5,14 +5,20 @@
```php
validate(json_decode($json), json_decode($schema));
if ($result->valid) {
- die('success!');
+ echo "The supplied JSON validates against the schema.\n";
+} else {
+ echo "JSON does not validate. Violations:\n";
+ foreach ($result->errors as $error) {
+ echo "[{$error['property']}] {$error['message']}\n";
+ }
}
-else {
- die('fail...');
-}
-```
\ No newline at end of file
+```
+
+## Running the tests
+
+ $ git submodule update --init
+ $ phpunit
diff --git a/bootstrap.php b/bootstrap.php
deleted file mode 100644
index aba016a..0000000
--- a/bootstrap.php
+++ /dev/null
@@ -1,5 +0,0 @@
-
- * @author Robert Schönthal
- */
-
-class JsonSchema {
-
- static $errors = array();
- static $formatValidator;
-
- const CHECK_MODE_NORMAL = 1;
- const CHECK_MODE_TYPE_CAST = 2;
- public static $checkMode = self::CHECK_MODE_NORMAL;
-
- /**
- * Validates a php object against a schema. Both the php object and the schema
- * are supposed to be a result of a json_decode call.
- * The validation works as defined by the schema proposal in
- * http://www.json.com/json-schema-proposal/
- *
- * @param StdClass $instance
- * @param StdClass $schema
- * @param JsonFormatValidator $formatValidator an optional class that have methods to validate the format definitions.
- * If this is null, so format validation will not be applied, but if its true, then the validation will throw
- * an error if any format defined on the schema is not supported by the validator.
- * @return unknown
- */
- static public function validate($instance, $schema = null, $formatValidator = null) {
- self::$errors = array();
- self::$formatValidator = null;
-
- if($formatValidator) self::$formatValidator = $formatValidator;
- $res = self::_validate($instance,$schema,false);
- self::$formatValidator = null;
- return $res;
- }
-
- static function _validate($instance,$schema = null,$_changing) {
- // verify passed schema
- if ($schema) {
- self::checkProp($instance,$schema,'','',$_changing);
- }
- // verify "inline" schema
- $propName = '$schema';
- if (!$_changing && isset($instance->$propName)) {
- self::checkProp($instance,$instance->$propName,'','',$_changing);
- }
- // show results
- $obj = new stdClass();
- $obj->valid = ! ((boolean)count(self::$errors));
- $obj->errors = self::$errors;
- return $obj;
- }
-
- static function incrementPath($path,$i) {
- if($path !== '') {
- if(is_int($i)) {
- $path .= '['.$i.']';
- }
- elseif($i == '') {
- $path .= '';
- }
- else {
- $path .= '.'.$i;
- }
- }
- else {
- $path = $i;
- }
- return $path;
- }
-
- static function checkArray($value,$schema,$path,$i,$_changing) {
- //verify items
- if(isset($schema->items)) {
- //tuple typing
- if(is_array($schema->items)) {
- foreach($value as $k=>$v) {
- if(array_key_exists($k,$schema->items)) {
- self::checkProp($v,$schema->items[$k],$path,$k,$_changing);
- }
- else {
- // aditional array properties
- if(array_key_exists('additionalProperties',$schema)) {
- if($schema->additionalProperties === false) {
- self::adderror(
- $path,
- 'The item '.$i.'['.$k.'] is not defined in the objTypeDef and the objTypeDef does not allow additional properties'
- );
- }
- else {
- self::checkProp($v,$schema->additionalProperties,$path,$k,$_changing);
- }
- }
- }
- }//foreach($value as $k=>$v) {
- // treat when we have more schema definitions than values
- for($k = count($value); $k < count($schema->items); $k++) {
- self::checkProp(
- new JsonSchemaUndefined(),
- $schema->items[$k], $path, $k, $_changing
- );
- }
- }
- // just one type definition for the whole array
- else {
- foreach($value as $k=>$v) {
- self::checkProp($v,$schema->items,$path,$k,$_changing);
- }
- }
- }
- // verify number of array items
- if(isset($schema->minItems) && count($value) < $schema->minItems) {
- self::adderror($path,"There must be a minimum of " . $schema->minItems . " in the array");
- }
- if(isset($schema->maxItems) && count($value) > $schema->maxItems) {
- self::adderror($path,"There must be a maximum of " . $schema->maxItems . " in the array");
- }
- }
-
- static function checkProp($value, $schema, $path, $i = '', $_changing = false) {
- if (!is_object($schema)) {
- return;
- }
- $path = self::incrementPath($path,$i);
- // verify readonly
- if($_changing && $schema.readonly) {
- self::adderror($path,'is a readonly field, it can not be changed');
- }
- // I think a schema cant be an array, only the items property
- /*if(is_array($schema)) {
- if(!is_array($value)) {
- return array(array('property'=>$path,'message'=>'An array tuple is required'));
- }
- for($a = 0; $a < count($schema); $a++) {
- self::$errors = array_merge(
- self::$errors,
- self::checkProp($value->$a,$schema->$a,$path,$i,$_changing)
- );
- return self::$errors;
- }
- }*/
- // if it extends another schema, it must pass that schema as well
- if(isset($schema->extends)) {
- self::checkProp($value,$schema->extends,$path,$i,$_changing);
- }
- // verify optional values
- if (is_object($value) && $value instanceOf JsonSchemaUndefined) {
- if ( isset($schema->required) ? !$schema->required : true) {
- self::adderror($path,"is missing and it is not optional");
- }
- }
- // normal verifications
- else {
- self::$errors = array_merge(
- self::$errors,
- self::checkType( isset($schema->type) ? $schema->type : null , $value, $path)
- );
- }
- if(array_key_exists('disallow',$schema)) {
- $errorsBeforeDisallowCheck = self::$errors;
- $response = self::checkType($schema->disallow, $value, $path);
- if(
- ( count($errorsBeforeDisallowCheck) == count(self::$errors) ) &&
- !count($response)
- ) {
- self::adderror($path," disallowed value was matched");
- }
- else {
- self::$errors = $errorsBeforeDisallowCheck;
- }
- }
- //verify the itens on an array and min and max number of items.
- if(is_array($value)) {
- if(
- self::$checkMode == self::CHECK_MODE_TYPE_CAST &&
- $schema->type == 'object'
- ) {
- self::checkObj(
- $value,
- $schema->properties,
- $path,
- isset($schema->additionalProperties) ? $schema->additionalProperties : null,
- $_changing
- );
- }
- self::checkArray($value,$schema,$path,$i,$_changing);
- }
- ############ verificar!
- elseif(isset($schema->properties) && is_object($value)) {
- self::checkObj(
- $value,
- $schema->properties,
- $path,
- isset($schema->additionalProperties) ? $schema->additionalProperties : null,
- $_changing
- );
- }
- // verify a regex pattern
- if( isset($schema->pattern) && is_string($value) && !preg_match('/'.$schema->pattern.'/',$value)) {
- self::adderror($path,"does not match the regex pattern " . $schema->pattern);
- }
- // verify maxLength, minLength, maximum and minimum values
- if( isset($schema->maxLength) && is_string($value) && (strlen($value) > $schema->maxLength)) {
- self::adderror($path,"must be at most " . $schema->maxLength . " characters long");
- }
- if( isset($schema->minLength) && is_string($value) && strlen($value) < $schema->minLength) {
- self::adderror($path,"must be at least " . $schema->minLength . " characters long");
- }
-
- if(
- isset($schema->minimum) &&
- gettype($value) == gettype($schema->minimum) &&
- $value < $schema->minimum
- ) {
- self::adderror($path,"must have a minimum value of " . $schema->minimum);
- }
- if( isset($schema->maximum) && gettype($value) == gettype($schema->maximum) && $value > $schema->maximum) {
- self::adderror($path,"must have a maximum value of " . $schema->maximum);
- }
- // verify enum values
- if(isset($schema->enum)) {
- $found = false;
- foreach($schema->enum as $possibleValue) {
- if($possibleValue == $value) {
- $found = true;
- break;
- }
- }
- if(!$found) {
- self::adderror($path,"does not have a value in the enumeration " . implode(', ',$schema->enum));
- }
- }
- if(
- isset($schema->maxDecimal) &&
- ( ($value * pow(10,$schema->maxDecimal)) != (int)($value * pow(10,$schema->maxDecimal)) )
- ) {
- self::adderror($path,"may only have " . $schema->maxDecimal . " digits of decimal places");
- }
- if( isset($schema->format) && isset(self::$formatValidator) ) {
- $error = self::$formatValidator->validate($value,$schema->format);
- if($error) {
- self::adderror($path,$error);
- }
- }
- }
-
- static function adderror($path,$message) {
- self::$errors[] = array(
- 'property'=>$path,
- 'message'=>$message
- );
- }
-
- /**
- * Take Care: Value is being passed by ref to continue validation with proper format.
- * @return array
- */
- static function checkType($type, &$value, $path) {
- if($type) {
- $wrongType = false;
- if(is_string($type) && $type !== 'any') {
- if($type == 'null') {
- if (!is_null($value)) {
- $wrongType = true;
- }
- }
- else {
- if($type == 'number') {
- if(self::$checkMode == self::CHECK_MODE_TYPE_CAST) {
- $wrongType = !self::checkTypeCast($type,$value);
- }
- elseif(!in_array(gettype($value),array('integer','double'))) {
- $wrongType = true;
- }
- } else{
- if(
- self::$checkMode == self::CHECK_MODE_TYPE_CAST
- && $type == 'integer'
- ) {
- $wrongType = !self::checkTypeCast($type,$value);
- } elseif (
- self::$checkMode == self::CHECK_MODE_TYPE_CAST
- && $type == 'object' && is_array($value)
- ) {
- $wrongType = false;
- } elseif ($type !== gettype($value)) {
- $wrongType = true;
- }
- }
- }
- }
- if($wrongType) {
- return array(
- array(
- 'property'=>$path,
- 'message'=>gettype($value)." value found, but a ".$type." is required"
- )
- );
- }
- // Union Types :: for now, just return the message for the last expected type!!
- if(is_array($type)) {
- $validatedOneType = false;
- $errors = array();
- foreach($type as $tp) {
- $error = self::checkType($tp,$value,$path);
- if(!count($error)) {
- $validatedOneType = true;
- break;
- }
- else {
- $errors[] = $error;
- $errors = $error;
- }
- }
- if(!$validatedOneType) {
- return $errors;
- }
- }
- elseif(is_object($type)) {
- self::checkProp($value,$type,$path);
- }
- }
- return array();
- }
-
- /**
- * Take Care: Value is being passed by ref to continue validation with proper format.
- */
- static function checkTypeCast($type,&$value) {
- switch($type) {
- case 'integer':
- $castValue = (integer)$value;
- break;
- case 'number':
- $castValue = (double)$value;
- break;
- default:
- trigger_error('this method should only be called for the above supported types.');
- break;
- }
- if( (string)$value == (string)$castValue ) {
- $res = true;
- $value = $castValue;
- }
- else {
- $res = false;
- }
- return $res;
- }
-
- static function checkObj($instance, $objTypeDef, $path, $additionalProp,$_changing) {
- if($objTypeDef instanceOf StdClass) {
- if( ! (($instance instanceOf StdClass) || is_array($instance)) ) {
- self::$errors[] = array(
- 'property'=>$path,
- 'message'=>"an object is required"
- );
- }
- foreach($objTypeDef as $i=>$value) {
- $value =
- array_key_exists($i,$instance) ?
- (is_array($instance) ? $instance[$i] : $instance->$i) :
- new JsonSchemaUndefined();
- $propDef = $objTypeDef->$i;
- self::checkProp($value,$propDef,$path,$i,$_changing);
- }
- }
- // additional properties and requires
- foreach($instance as $i=>$value) {
- // verify additional properties, when its not allowed
- if( !isset($objTypeDef->$i) && ($additionalProp === false) && $i !== '$schema' ) {
- self::$errors[] = array(
- 'property'=>$path,
- 'message'=>"The property " . $i . " is not defined in the objTypeDef and the objTypeDef does not allow additional properties"
- );
- }
- // verify requires
- if($objTypeDef && isset($objTypeDef->$i) && isset($objTypeDef->$i->requires)) {
- $requires = $objTypeDef->$i->requires;
- if(!array_key_exists($requires,$instance)) {
- self::$errors[] = array(
- 'property'=>$path,
- 'message'=>"the presence of the property " . $i . " requires that " . $requires . " also be present"
- );
- }
- }
- $value = is_array($instance) ? $instance[$i] : $instance->$i;
-
- // To verify additional properties types.
- if ($objTypeDef && is_object($objTypeDef) && !isset($objTypeDef->$i)) {
- self::checkProp($value,$additionalProp,$path,$i);
- }
- // Verify inner schema definitions
- $schemaPropName = '$schema';
- if (!$_changing && $value && isset($value->$schemaPropName)) {
- self::$errors = array_merge(
- self::$errors,
- checkProp($value,$value->$schemaPropname,$path,$i)
- );
- }
- }
- return self::$errors;
- }
-}
-
-class Dbg {
-
- static public $quietMode = false;
-
- static function includeJqueryJs() {
- echo "";
- }
-
- static function func($print = true, $numStackSteps = 1) {
- $ar = debug_backtrace();
- $ret = '';
-
- for($a = $numStackSteps; $a >= 1; $a--) {
- $line = $ar[$a-1]['line'];
- $step = $ar[$a];
- $ret .= str_repeat(' ',$a).self::showStep($step,$print,$line);
- }
- if($print && !self::$quietMode) echo $ret;
- return $ret;
- }
-
- static function mark($title,$print = true) {
- $ar = debug_backtrace();
- $ret = '';
- $line = $ar[0]['line'];
- $ret = "[MARK]".$title.'(line '.$line.')
';
- if($print && !self::$quietMode) echo $ret;
- return $ret;
- }
-
- static function object($object,$linkTitle = 'object',$varDump = false,$print = true) {
- static $divCount = 0;
- $divCount++;
- $ar = debug_backtrace();
- $ret = '';
- $line = $ar[0]['line'];
- $ret = '[OBJECT]'.$linkTitle.'';
- $ret .= '(line '.$line.')
';
- $ret .= '
';
- if($varDump) {
- ob_start();
- var_dump($object);
- $ret .= ob_get_clean();
- }
- else {
- $ret .= print_r($object,true);
- }
- $ret .= '
';
- if($print && !self::$quietMode) echo $ret;
- return $ret;
- }
-
- static function showStep($step,$print,$line) {
- static $divCount = 0;
- $ret = '[STEP]'.$step['class'] . $step['type'] . $step['function'];
- if(count($step['args'])) {
- $ret .= '(';
- $comma = '';
- $exp = array();
- foreach($step['args'] as $num=>$arg) {
- $divCount++;
- if(in_array(gettype($arg),array('object','array'))) {
- if(is_object($arg)) {
- $type = get_class($arg);
- }
- else {
- $type = gettype($arg);
- }
- $argVal = 'click to see';
- $exp[] =
- ''
- .print_r($arg,true)
- .'
';
- }
- else {
- $type = gettype($arg);
- if($type == 'string') {
- $argVal = "'".$arg."'";
- }
- else {
- $argVal = $arg;
- }
- $argVal = ''.$argVal.'';
- }
- $ret .= $comma.' ' . $type . " " . $argVal;
- $comma = ',';
- }
- $ret .= ') (line '.$line.')
';
- foreach($exp as $text) {
- $ret .= '' . $text . '
';
- }
- }
- return $ret;
- }
-}
-?>
\ No newline at end of file
diff --git a/libs/JsonSchemaUndefined.php b/libs/JsonSchemaUndefined.php
deleted file mode 100644
index 75f8514..0000000
--- a/libs/JsonSchemaUndefined.php
+++ /dev/null
@@ -1,16 +0,0 @@
-
- tests
+ tests
diff --git a/src/JsonSchema/Undefined.php b/src/JsonSchema/Undefined.php
new file mode 100644
index 0000000..a78de31
--- /dev/null
+++ b/src/JsonSchema/Undefined.php
@@ -0,0 +1,16 @@
+, Gradua Networks
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace JsonSchema;
+
+class Undefined
+{
+}
diff --git a/src/JsonSchema/Validator.php b/src/JsonSchema/Validator.php
new file mode 100644
index 0000000..4f87a10
--- /dev/null
+++ b/src/JsonSchema/Validator.php
@@ -0,0 +1,397 @@
+, Gradua Networks
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace JsonSchema;
+
+class Validator
+{
+ public $checkMode = self::CHECK_MODE_NORMAL;
+ private $errors = array();
+
+ const CHECK_MODE_NORMAL = 1;
+ const CHECK_MODE_TYPE_CAST = 2;
+
+ /**
+ * Validates a php object against a schema. Both the php object and the schema
+ * are supposed to be a result of a json_decode call.
+ * The validation works as defined by the schema proposal in
+ * http://json-schema.org
+ *
+ * @param \stdClass $instance
+ * @param \stdClass $schema
+ * @return unknown
+ */
+ public function validate($instance, $schema = null)
+ {
+ $this->errors = array();
+
+ $_changing = false;
+
+ // verify passed schema
+ if ($schema) {
+ $this->checkProp($instance, $schema, '', '', $_changing);
+ }
+ // verify "inline" schema
+ $propName = '$schema';
+ if (!$_changing && isset($instance->$propName)) {
+ $this->checkProp($instance, $instance->$propName, '', '', $_changing);
+ }
+ // show results
+ $obj = new \stdClass();
+ $obj->valid = ! ((boolean)count($this->errors));
+ $obj->errors = $this->errors;
+ return $obj;
+ }
+
+ protected function incrementPath($path, $i)
+ {
+ if ($path !== '') {
+ if (is_int($i)) {
+ $path .= '['.$i.']';
+ } else if ($i == '') {
+ $path .= '';
+ } else {
+ $path .= '.'.$i;
+ }
+ } else {
+ $path = $i;
+ }
+ return $path;
+ }
+
+ protected function checkArray($value, $schema, $path, $i, $_changing)
+ {
+ //verify items
+ if (isset($schema->items)) {
+ //tuple typing
+ if (is_array($schema->items)) {
+ foreach ($value as $k => $v) {
+ if (array_key_exists($k, $schema->items)) {
+ $this->checkProp($v, $schema->items[$k], $path, $k, $_changing);
+ }
+ else {
+ // aditional array properties
+ if (array_key_exists('additionalProperties', $schema)) {
+ if ($schema->additionalProperties === false) {
+ $this->adderror(
+ $path,
+ 'The item '.$i.'['.$k.'] is not defined in the objTypeDef and the objTypeDef does not allow additional properties'
+ );
+ }
+ else {
+ $this->checkProp($v, $schema->additionalProperties, $path, $k, $_changing);
+ }
+ }
+ }
+ }//foreach ($value as $k => $v) {
+ // treat when we have more schema definitions than values
+ for ($k = count($value); $k < count($schema->items); $k++) {
+ $this->checkProp(
+ new Undefined(),
+ $schema->items[$k], $path, $k, $_changing
+ );
+ }
+ }
+ // just one type definition for the whole array
+ else {
+ foreach ($value as $k => $v) {
+ $this->checkProp($v, $schema->items, $path, $k, $_changing);
+ }
+ }
+ }
+ // verify number of array items
+ if (isset($schema->minItems) && count($value) < $schema->minItems) {
+ $this->adderror($path,"There must be a minimum of " . $schema->minItems . " in the array");
+ }
+ if (isset($schema->maxItems) && count($value) > $schema->maxItems) {
+ $this->adderror($path,"There must be a maximum of " . $schema->maxItems . " in the array");
+ }
+ }
+
+ protected function checkProp($value, $schema, $path, $i = '', $_changing = false)
+ {
+ if (!is_object($schema)) {
+ return;
+ }
+ $path = $this->incrementPath($path, $i);
+ // verify readonly
+ if ($_changing && $schema->readonly) {
+ $this->adderror($path,'is a readonly field, it can not be changed');
+ }
+ // I think a schema cant be an array, only the items property
+ /*if (is_array($schema)) {
+ if (!is_array($value)) {
+ return array(array('property' => $path,'message' => 'An array tuple is required'));
+ }
+ for ($a = 0; $a < count($schema); $a++) {
+ $this->errors = array_merge(
+ $this->errors,
+ $this->checkProp($value->$a, $schema->$a, $path, $i, $_changing)
+ );
+ return $this->errors;
+ }
+ }*/
+ // if it extends another schema, it must pass that schema as well
+ if (isset($schema->extends)) {
+ $this->checkProp($value, $schema->extends, $path, $i, $_changing);
+ }
+ // verify required values
+ if (is_object($value) && $value instanceOf Undefined) {
+ if (isset($schema->required) && $schema->required) {
+ $this->adderror($path,"is missing and it is required");
+ }
+ } else {
+ // normal verifications
+ $this->errors = array_merge(
+ $this->errors,
+ $this->checkType(isset($schema->type) ? $schema->type : null , $value, $path)
+ );
+ }
+ if (array_key_exists('disallow', $schema)) {
+ $errorsBeforeDisallowCheck = $this->errors;
+ $response = $this->checkType($schema->disallow, $value, $path);
+ if (
+ ( count($errorsBeforeDisallowCheck) == count($this->errors) ) &&
+ !count($response)
+ ) {
+ $this->adderror($path," disallowed value was matched");
+ }
+ else {
+ $this->errors = $errorsBeforeDisallowCheck;
+ }
+ }
+ //verify the itens on an array and min and max number of items.
+ if (is_array($value)) {
+ if (
+ $this->checkMode == $this::CHECK_MODE_TYPE_CAST &&
+ $schema->type == 'object'
+ ) {
+ $this->checkObj(
+ $value,
+ $schema->properties,
+ $path,
+ isset($schema->additionalProperties) ? $schema->additionalProperties : null,
+ $_changing
+ );
+ }
+ $this->checkArray($value, $schema, $path, $i, $_changing);
+ } else if (isset($schema->properties) && is_object($value)) {
+ ############ verificar!
+ $this->checkObj(
+ $value,
+ $schema->properties,
+ $path,
+ isset($schema->additionalProperties) ? $schema->additionalProperties : null,
+ $_changing
+ );
+ }
+ // verify a regex pattern
+ if (isset($schema->pattern) && is_string($value) && !preg_match('/'.$schema->pattern.'/', $value)) {
+ $this->adderror($path,"does not match the regex pattern " . $schema->pattern);
+ }
+ // verify maxLength, minLength, maximum and minimum values
+ if (isset($schema->maxLength) && is_string($value) && (strlen($value) > $schema->maxLength)) {
+ $this->adderror($path,"must be at most " . $schema->maxLength . " characters long");
+ }
+ if (isset($schema->minLength) && is_string($value) && strlen($value) < $schema->minLength) {
+ $this->adderror($path,"must be at least " . $schema->minLength . " characters long");
+ }
+
+ if (
+ isset($schema->minimum) &&
+ gettype($value) == gettype($schema->minimum) &&
+ $value < $schema->minimum
+ ) {
+ $this->adderror($path,"must have a minimum value of " . $schema->minimum);
+ }
+ if (isset($schema->maximum) && gettype($value) == gettype($schema->maximum) && $value > $schema->maximum) {
+ $this->adderror($path,"must have a maximum value of " . $schema->maximum);
+ }
+ // verify enum values
+ if (isset($schema->enum)) {
+ $found = false;
+ foreach ($schema->enum as $possibleValue) {
+ if ($possibleValue == $value) {
+ $found = true;
+ break;
+ }
+ }
+ if (!$found) {
+ $this->adderror($path,"does not have a value in the enumeration " . implode(', ', $schema->enum));
+ }
+ }
+ if (
+ isset($schema->maxDecimal) &&
+ ( ($value * pow(10, $schema->maxDecimal)) != (int)($value * pow(10, $schema->maxDecimal)) )
+ ) {
+ $this->adderror($path,"may only have " . $schema->maxDecimal . " digits of decimal places");
+ }
+ }
+
+ protected function adderror($path, $message)
+ {
+ $this->errors[] = array(
+ 'property' => $path,
+ 'message' => $message
+ );
+ }
+
+ /**
+ * Take Care: Value is being passed by ref to continue validation with proper format.
+ * @return array
+ */
+ protected function checkType($type, &$value, $path)
+ {
+ if ($type) {
+ $wrongType = false;
+ if (is_string($type) && $type !== 'any') {
+ if ($type == 'null') {
+ if (!is_null($value)) {
+ $wrongType = true;
+ }
+ }
+ else {
+ if ($type == 'number') {
+ if ($this->checkMode == $this::CHECK_MODE_TYPE_CAST) {
+ $wrongType = !$this->checkTypeCast($type, $value);
+ }
+ else if (!in_array(gettype($value), array('integer','double'))) {
+ $wrongType = true;
+ }
+ } else{
+ if (
+ $this->checkMode == $this::CHECK_MODE_TYPE_CAST
+ && $type == 'integer'
+ ) {
+ $wrongType = !$this->checkTypeCast($type, $value);
+ } else if (
+ $this->checkMode == $this::CHECK_MODE_TYPE_CAST
+ && $type == 'object' && is_array($value)
+ ) {
+ $wrongType = false;
+ } else if ($type !== gettype($value)) {
+ $wrongType = true;
+ }
+ }
+ }
+ }
+ if ($wrongType) {
+ return array(
+ array(
+ 'property' => $path,
+ 'message' => gettype($value)." value found, but a ".$type." is required"
+ )
+ );
+ }
+ // Union Types :: for now, just return the message for the last expected type!!
+ if (is_array($type)) {
+ $validatedOneType = false;
+ $errors = array();
+ foreach ($type as $tp) {
+ $error = $this->checkType($tp, $value, $path);
+ if (!count($error)) {
+ $validatedOneType = true;
+ break;
+ } else {
+ $errors[] = $error;
+ $errors = $error;
+ }
+ }
+ if (!$validatedOneType) {
+ return $errors;
+ }
+ } else if (is_object($type)) {
+ $this->checkProp($value, $type, $path);
+ }
+ }
+ return array();
+ }
+
+ /**
+ * Take Care: Value is being passed by ref to continue validation with proper format.
+ */
+ protected function checkTypeCast($type, &$value)
+ {
+ switch ($type) {
+ case 'integer':
+ $castValue = (integer)$value;
+ break;
+ case 'number':
+ $castValue = (double)$value;
+ break;
+ default:
+ trigger_error('this method should only be called for the above supported types.');
+ break;
+ }
+ if ((string)$value == (string)$castValue ) {
+ $res = true;
+ $value = $castValue;
+ } else {
+ $res = false;
+ }
+ return $res;
+ }
+
+ protected function checkObj($instance, $objTypeDef, $path, $additionalProp, $_changing)
+ {
+ if ($objTypeDef instanceOf \stdClass) {
+ if (! (($instance instanceOf \stdClass) || is_array($instance)) ) {
+ $this->errors[] = array(
+ 'property' => $path,
+ 'message' => "an object is required"
+ );
+ }
+ foreach ($objTypeDef as $i => $value) {
+ $value =
+ array_key_exists($i, $instance) ?
+ (is_array($instance) ? $instance[$i] : $instance->$i) :
+ new Undefined();
+ $propDef = $objTypeDef->$i;
+ $this->checkProp($value, $propDef, $path, $i, $_changing);
+ }
+ }
+ // additional properties and requires
+ foreach ($instance as $i => $value) {
+ // verify additional properties, when its not allowed
+ if (!isset($objTypeDef->$i) && ($additionalProp === false) && $i !== '$schema' ) {
+ $this->errors[] = array(
+ 'property' => $path,
+ 'message' => "The property " . $i . " is not defined in the objTypeDef and the objTypeDef does not allow additional properties"
+ );
+ }
+ // verify requires
+ if ($objTypeDef && isset($objTypeDef->$i) && isset($objTypeDef->$i->requires)) {
+ $requires = $objTypeDef->$i->requires;
+ if (!array_key_exists($requires, $instance)) {
+ $this->errors[] = array(
+ 'property' => $path,
+ 'message' => "the presence of the property " . $i . " requires that " . $requires . " also be present"
+ );
+ }
+ }
+ $value = is_array($instance) ? $instance[$i] : $instance->$i;
+
+ // To verify additional properties types.
+ if ($objTypeDef && is_object($objTypeDef) && !isset($objTypeDef->$i)) {
+ $this->checkProp($value, $additionalProp, $path, $i);
+ }
+ // Verify inner schema definitions
+ $schemaPropName = '$schema';
+ if (!$_changing && $value && isset($value->$schemaPropName)) {
+ $this->errors = array_merge(
+ $this->errors,
+ checkProp($value, $value->$schemaPropname, $path, $i)
+ );
+ }
+ }
+ return $this->errors;
+ }
+}
diff --git a/tests/cases/AdditionalPropertiesTest.php b/tests/JsonSchema/Tests/AdditionalPropertiesTest.php
similarity index 93%
rename from tests/cases/AdditionalPropertiesTest.php
rename to tests/JsonSchema/Tests/AdditionalPropertiesTest.php
index 32397d7..3aeb70a 100644
--- a/tests/cases/AdditionalPropertiesTest.php
+++ b/tests/JsonSchema/Tests/AdditionalPropertiesTest.php
@@ -1,5 +1,9 @@
checkMode = $checkMode;
+
+ $result = $validator->validate(json_decode($input), json_decode($schema));
if (array() !== $errors) {
$this->assertEquals($errors, $result->errors, var_export($result, true));
}
$this->assertFalse($result->valid, var_export($result, true));
}
-
+
/**
* @dataProvider getValidTests
*/
public function testValidCases($input, $schema, $checkMode = null)
- {
+ {
if (null === $checkMode) {
- $checkMode = JsonSchema::CHECK_MODE_NORMAL;
+ $checkMode = Validator::CHECK_MODE_NORMAL;
}
-
- JsonSchema::$checkMode = $checkMode;
-
- $result = JsonSchema::validate(json_decode($input), json_decode($schema));
+
+ $validator = new Validator();
+ $validator->checkMode = $checkMode;
+
+ $result = $validator->validate(json_decode($input), json_decode($schema));
$this->assertTrue($result->valid, var_export($result, true));
}
-
+
abstract public function getValidTests();
-
+
abstract public function getInvalidTests();
}
\ No newline at end of file
diff --git a/tests/cases/BasicTypesTest.php b/tests/JsonSchema/Tests/BasicTypesTest.php
similarity index 95%
rename from tests/cases/BasicTypesTest.php
rename to tests/JsonSchema/Tests/BasicTypesTest.php
index 2902629..c226466 100644
--- a/tests/cases/BasicTypesTest.php
+++ b/tests/JsonSchema/Tests/BasicTypesTest.php
@@ -1,12 +1,14 @@
registerNamespace('JsonSchema', __DIR__.'/../src');
+$loader->registerNamespace('JsonSchema\Tests', __DIR__);
+$loader->register();
diff --git a/tests/selenium/SUITEPhpJsJsonSchemaValidator.html b/tests/selenium/SUITEPhpJsJsonSchemaValidator.html
deleted file mode 100644
index 5c9bc01..0000000
--- a/tests/selenium/SUITEPhpJsJsonSchemaValidator.html
+++ /dev/null
@@ -1,33 +0,0 @@
-
-
-
-
-
- Test Suite
-
-
-
-
-
diff --git a/tests/selenium/additionalProperties.html b/tests/selenium/additionalProperties.html
deleted file mode 100644
index 8e59ee0..0000000
--- a/tests/selenium/additionalProperties.html
+++ /dev/null
@@ -1,167 +0,0 @@
-
-
-
-
-
-
-additionalProperties
-
-
-
-
-additionalProperties |
-
-
- open |
- /validator.html |
- |
-
-
- type |
- json |
- { "prop":"1", "additionalProp":"2" } |
-
-
- type |
- schema |
- { "type":"object", "properties":{ "prop":{"type":"string"} } } |
-
-
- click |
- bt-validate-js |
- |
-
-
- waitForTextPresent |
- JSON: |
- |
-
-
- verifyTextPresent |
- JSON: VALID |
- |
-
-
- click |
- bt-validate-php |
- |
-
-
- waitForTextPresent |
- JSON: |
- |
-
-
- verifyTextPresent |
- JSON: VALID |
- |
-
-
- type |
- schema |
- { "type":"object", "properties":{ "prop":{"type":"string"} }, "additionalProperties": false } |
-
-
- click |
- bt-validate-js |
- |
-
-
- waitForTextPresent |
- JSON: |
- |
-
-
- verifyTextPresent |
- JSON: INVALID |
- |
-
-
- click |
- bt-validate-php |
- |
-
-
- waitForTextPresent |
- JSON: |
- |
-
-
- verifyTextPresent |
- JSON: INVALID |
- |
-
-
- type |
- schema |
- { "type":"object", "properties":{ "prop":{"type":"string"} }, "additionalProperties": {"type":"string"} } |
-
-
- click |
- bt-validate-js |
- |
-
-
- waitForTextPresent |
- JSON: |
- |
-
-
- verifyTextPresent |
- JSON: VALID |
- |
-
-
- click |
- bt-validate-php |
- |
-
-
- waitForTextPresent |
- JSON: |
- |
-
-
- verifyTextPresent |
- JSON: VALID |
- |
-
-
- type |
- json |
- { "prop":"1", "additionalProp":2 } |
-
-
- click |
- bt-validate-js |
- |
-
-
- waitForTextPresent |
- JSON: |
- |
-
-
- verifyTextPresent |
- JSON: INVALID |
- |
-
-
- click |
- bt-validate-php |
- |
-
-
- waitForTextPresent |
- JSON: |
- |
-
-
- verifyTextPresent |
- JSON: INVALID |
- |
-
-
-
-
-
diff --git a/tests/selenium/arrays.html b/tests/selenium/arrays.html
deleted file mode 100644
index f4c5b47..0000000
--- a/tests/selenium/arrays.html
+++ /dev/null
@@ -1,152 +0,0 @@
-
-
-
-
-
-
-arrays
-
-
-
-
-arrays |
-
-
- open |
- /validator.html |
- |
-
-
- type |
- json |
- { "array":[1,2,"a"] } |
-
-
- type |
- schema |
- { "type":"object", "properties":{ "array":{"type":"array"} } } |
-
-
- click |
- bt-validate-js |
- |
-
-
- waitForTextPresent |
- JSON |
- |
-
-
- verifyTextPresent |
- JSON: VALID |
- |
-
-
- click |
- bt-validate-php |
- |
-
-
- waitForTextPresent |
- JSON |
- |
-
-
- verifyTextPresent |
- JSON: VALID |
- |
-
-
- type |
- json |
- { "array":[1,2,"a"] } |
-
-
- type |
- schema |
- { "type":"object", "properties":{ "array":{ "type":"array", "items":{"type":"number"} } } } |
-
-
- click |
- bt-validate-js |
- |
-
-
- waitForTextPresent |
- JSON: |
- |
-
-
- verifyTextPresent |
- JSON: INVALID |
- |
-
-
- verifyTextPresent |
- array[2] |
- |
-
-
- click |
- bt-validate-php |
- |
-
-
- waitForTextPresent |
- JSON: |
- |
-
-
- verifyTextPresent |
- JSON: INVALID |
- |
-
-
- verifyTextPresent |
- array[2] |
- |
-
-
- type |
- json |
- { "array":[1,2,null] } |
-
-
- type |
- schema |
- { "type":"object", "properties":{ "array":{ "type":"array", "items":{"type":["number","boolean"]} } } } |
-
-
- click |
- bt-validate-php |
- |
-
-
- waitForTextPresent |
- JSON: |
- |
-
-
- verifyTextPresent |
- NULL value found, but a boolean is required |
- |
-
-
- click |
- bt-validate-js |
- |
-
-
- waitForTextPresent |
- JSON: |
- |
-
-
- verifyTextPresent |
- JSON: INVALID |
- |
-
-
-
-
-
diff --git a/tests/selenium/basicTypes.html b/tests/selenium/basicTypes.html
deleted file mode 100644
index ada02a5..0000000
--- a/tests/selenium/basicTypes.html
+++ /dev/null
@@ -1,62 +0,0 @@
-
-
-
-
-
-
-basicTypes
-
-
-
-
-basicTypes |
-
-
- open |
- /validator.html |
- |
-
-
- type |
- json |
- { "string":"string test", "number":1, "integer":1, "boolean":true, "object":{}, "array":[], "null":null, "any": "string", "any1": 2.6, "any2": 4, "any3": false, "any4": {}, "any5": [], "any6": null } |
-
-
- type |
- schema |
- { "type":"object", "properties":{ "string":{"type":"string"}, "number":{"type":"number"}, "integer":{"type":"integer"}, "boolean":{"type":"boolean"}, "object":{"type":"object"}, "array":{"type":"array"}, "null":{"type":"null"}, "any": {"type":"any"}, "any1": {"type":"any"}, "any2": {"type":"any"}, "any3": {"type":"any"}, "any4": {"type":"any"}, "any5": {"type":"any"}, "any6": {"type":"any"} }, "additionalProperties":false } |
-
-
- click |
- bt-validate-js |
- |
-
-
- waitForTextPresent |
- JSON: |
- |
-
-
- verifyTextPresent |
- JSON: VALID |
- |
-
-
- click |
- bt-validate-php |
- |
-
-
- waitForTextPresent |
- JSON: |
- |
-
-
- verifyTextPresent |
- JSON: VALID |
- |
-
-
-
-
-
diff --git a/tests/selenium/disallow.html b/tests/selenium/disallow.html
deleted file mode 100644
index 202660f..0000000
--- a/tests/selenium/disallow.html
+++ /dev/null
@@ -1,172 +0,0 @@
-
-
-
-
-
-
-disallow
-
-
-
-
-disallow |
-
-
- open |
- /validator.html |
- |
-
-
- type |
- schema |
- { "type":"object", "properties":{ "value":{ "type":"any", "disallow":{"type":"string","pattern":"^xpto"} } } } |
-
-
- type |
- json |
- { "value":" The xpto is weird" } |
-
-
- click |
- bt-validate-js |
- |
-
-
- waitForTextPresent |
- JSON: |
- |
-
-
- verifyTextPresent |
- JSON: VALID |
- |
-
-
- click |
- bt-validate-php |
- |
-
-
- waitForTextPresent |
- JSON: |
- |
-
-
- verifyTextPresent |
- JSON: VALID |
- |
-
-
- type |
- schema |
- { "type":"object", "properties":{ "value":{ "type":"any", "disallow":{"type":"string","pattern":"xpto"} } } } |
-
-
- click |
- bt-validate-js |
- |
-
-
- waitForTextPresent |
- JSON: |
- |
-
-
- verifyTextPresent |
- JSON: INVALID |
- |
-
-
- click |
- bt-validate-php |
- |
-
-
- waitForTextPresent |
- JSON: |
- |
-
-
- verifyTextPresent |
- JSON: INVALID |
- |
-
-
- type |
- schema |
- { "type":"object", "properties":{ "value":{ "type":"any", "disallow":{"type":"null"} } } } |
-
-
- type |
- json |
- { "value":1 } |
-
-
- click |
- bt-validate-js |
- |
-
-
- waitForTextPresent |
- JSON: |
- |
-
-
- verifyTextPresent |
- JSON: VALID |
- |
-
-
- click |
- bt-validate-php |
- |
-
-
- waitForTextPresent |
- JSON: |
- |
-
-
- verifyTextPresent |
- JSON: VALID |
- |
-
-
- type |
- json |
- { "value":null } |
-
-
- click |
- bt-validate-js |
- |
-
-
- waitForTextPresent |
- JSON: |
- |
-
-
- verifyTextPresent |
- JSON: INVALID |
- |
-
-
- click |
- bt-validate-php |
- |
-
-
- waitForTextPresent |
- JSON: |
- |
-
-
- verifyTextPresent |
- JSON: INVALID |
- |
-
-
-
-
-
diff --git a/tests/selenium/enum.html b/tests/selenium/enum.html
deleted file mode 100644
index c3657cc..0000000
--- a/tests/selenium/enum.html
+++ /dev/null
@@ -1,97 +0,0 @@
-
-
-
-
-
-
-enum
-
-
-
-
-enum |
-
-
- open |
- /validator.html |
- |
-
-
- type |
- json |
- { "value":"Morango" } |
-
-
- type |
- schema |
- { "type":"object", "properties":{ "value":{"type":"string","enum":["Abacate","Manga","Pitanga"]} }, "additionalProperties":false } |
-
-
- click |
- bt-validate-js |
- |
-
-
- waitForTextPresent |
- JSON: |
- |
-
-
- verifyTextPresent |
- JSON: INVALID |
- |
-
-
- click |
- bt-validate-php |
- |
-
-
- waitForTextPresent |
- JSON: |
- |
-
-
- verifyTextPresent |
- JSON: INVALID |
- |
-
-
- type |
- json |
- { "value":"Abacate" } |
-
-
- click |
- bt-validate-js |
- |
-
-
- waitForTextPresent |
- JSON: |
- |
-
-
- verifyTextPresent |
- JSON: VALID |
- |
-
-
- click |
- bt-validate-php |
- |
-
-
- waitForTextPresent |
- JSON: |
- |
-
-
- verifyTextPresent |
- JSON: VALID |
- |
-
-
-
-
-
diff --git a/tests/selenium/extends.html b/tests/selenium/extends.html
deleted file mode 100644
index d9fb653..0000000
--- a/tests/selenium/extends.html
+++ /dev/null
@@ -1,132 +0,0 @@
-
-
-
-
-
-
-extends
-
-
-
-
-extends |
-
-
- open |
- /validator.html |
- |
-
-
- type |
- json |
- { "name":"bruno", "age":50 } |
-
-
- type |
- schema |
- { "id": "person", "type": "object", "properties": { "name": { "type": "string" }, "age" : { "type": "integer", "maximum":120 } }, "extends": { "id": "oldPerson", "type": "object", "properties": { "age" : {"minimum":70} } } } |
-
-
- click |
- bt-validate-js |
- |
-
-
- waitForTextPresent |
- JSON: |
- |
-
-
- verifyTextPresent |
- JSON: INVALID |
- |
-
-
- click |
- bt-validate-php |
- |
-
-
- waitForTextPresent |
- JSON: |
- |
-
-
- verifyTextPresent |
- JSON: INVALID |
- |
-
-
- type |
- json |
- { "name":"bruno", "age":80 } |
-
-
- click |
- bt-validate-js |
- |
-
-
- waitForTextPresent |
- JSON: |
- |
-
-
- verifyTextPresent |
- JSON: VALID |
- |
-
-
- click |
- bt-validate-php |
- |
-
-
- waitForTextPresent |
- JSON: |
- |
-
-
- verifyTextPresent |
- JSON: VALID |
- |
-
-
- type |
- json |
- { "name":"bruno", "age":180 } |
-
-
- click |
- bt-validate-js |
- |
-
-
- waitForTextPresent |
- JSON: |
- |
-
-
- verifyTextPresent |
- JSON: INVALID |
- |
-
-
- click |
- bt-validate-php |
- |
-
-
- waitForTextPresent |
- JSON: |
- |
-
-
- verifyTextPresent |
- JSON: INVALID |
- |
-
-
-
-
-
diff --git a/tests/selenium/maxDecimal.html b/tests/selenium/maxDecimal.html
deleted file mode 100644
index 58bc2b5..0000000
--- a/tests/selenium/maxDecimal.html
+++ /dev/null
@@ -1,97 +0,0 @@
-
-
-
-
-
-
-maxDecimal
-
-
-
-
-maxDecimal |
-
-
- open |
- /validator.html |
- |
-
-
- type |
- schema |
- { "type":"object", "properties":{ "value":{"type":"number","maxDecimal":3} } } |
-
-
- type |
- json |
- { "value":5.6333 } |
-
-
- click |
- bt-validate-js |
- |
-
-
- waitForTextPresent |
- JSON: |
- |
-
-
- verifyTextPresent |
- JSON: INVALID |
- |
-
-
- click |
- bt-validate-php |
- |
-
-
- waitForTextPresent |
- JSON: |
- |
-
-
- verifyTextPresent |
- JSON: INVALID |
- |
-
-
- type |
- json |
- { "value":5.633 } |
-
-
- click |
- bt-validate-js |
- |
-
-
- waitForTextPresent |
- JSON: |
- |
-
-
- verifyTextPresent |
- JSON: VALID |
- |
-
-
- click |
- bt-validate-php |
- |
-
-
- waitForTextPresent |
- JSON: |
- |
-
-
- verifyTextPresent |
- JSON: VALID |
- |
-
-
-
-
-
diff --git a/tests/selenium/minItemsMaxItems.html b/tests/selenium/minItemsMaxItems.html
deleted file mode 100644
index 8fbc99e..0000000
--- a/tests/selenium/minItemsMaxItems.html
+++ /dev/null
@@ -1,167 +0,0 @@
-
-
-
-
-
-
-minItemsMaxItems
-
-
-
-
-minItemsMaxItems |
-
-
- open |
- /validator.html |
- |
-
-
- type |
- json |
- { "value":[2] } |
-
-
- type |
- schema |
- { "type":"object", "properties":{ "value":{"type":"array","minItems":2,"maxItems":4} } } |
-
-
- click |
- bt-validate-js |
- |
-
-
- waitForTextPresent |
- JSON: |
- |
-
-
- verifyTextPresent |
- JSON: INVALID |
- |
-
-
- click |
- bt-validate-php |
- |
-
-
- waitForTextPresent |
- JSON: |
- |
-
-
- verifyTextPresent |
- JSON: INVALID |
- |
-
-
- type |
- json |
- { "value":[2,2] } |
-
-
- click |
- bt-validate-js |
- |
-
-
- waitForTextPresent |
- JSON: |
- |
-
-
- verifyTextPresent |
- JSON: VALID |
- |
-
-
- click |
- bt-validate-php |
- |
-
-
- waitForTextPresent |
- JSON: |
- |
-
-
- verifyTextPresent |
- JSON: VALID |
- |
-
-
- type |
- json |
- { "value":[2,2,5,8] } |
-
-
- click |
- bt-validate-js |
- |
-
-
- waitForTextPresent |
- JSON: |
- |
-
-
- verifyTextPresent |
- JSON: VALID |
- |
-
-
- click |
- bt-validate-php |
- |
-
-
- waitForTextPresent |
- JSON: |
- |
-
-
- verifyTextPresent |
- JSON: VALID |
- |
-
-
- type |
- json |
- { "value":[2,2,5,8,5] } |
-
-
- click |
- bt-validate-js |
- |
-
-
- waitForTextPresent |
- JSON: |
- |
-
-
- verifyTextPresent |
- JSON: INVALID |
- |
-
-
- click |
- bt-validate-php |
- |
-
-
- waitForTextPresent |
- JSON: |
- |
-
-
- verifyTextPresent |
- JSON: INVALID |
- |
-
-
-
-
-
diff --git a/tests/selenium/minLengthMaxLength.html b/tests/selenium/minLengthMaxLength.html
deleted file mode 100644
index a630857..0000000
--- a/tests/selenium/minLengthMaxLength.html
+++ /dev/null
@@ -1,167 +0,0 @@
-
-
-
-
-
-
-minLengthMaxLength
-
-
-
-
-minLengthMaxLength |
-
-
- open |
- /validator.html |
- |
-
-
- type |
- json |
- { "value":"w" } |
-
-
- type |
- schema |
- { "type":"object", "properties":{ "value":{"type":"string","minLength":2,"maxLength":4} } } |
-
-
- click |
- bt-validate-js |
- |
-
-
- waitForTextPresent |
- JSON: |
- |
-
-
- verifyTextPresent |
- JSON: INVALID |
- |
-
-
- click |
- bt-validate-php |
- |
-
-
- waitForTextPresent |
- JSON: |
- |
-
-
- verifyTextPresent |
- JSON: INVALID |
- |
-
-
- type |
- json |
- { "value":"wo" } |
-
-
- click |
- bt-validate-js |
- |
-
-
- waitForTextPresent |
- JSON: |
- |
-
-
- verifyTextPresent |
- JSON: VALID |
- |
-
-
- click |
- bt-validate-php |
- |
-
-
- waitForTextPresent |
- JSON: |
- |
-
-
- verifyTextPresent |
- JSON: VALID |
- |
-
-
- type |
- json |
- { "value":"wo7u" } |
-
-
- click |
- bt-validate-js |
- |
-
-
- waitForTextPresent |
- JSON: |
- |
-
-
- verifyTextPresent |
- JSON: VALID |
- |
-
-
- click |
- bt-validate-php |
- |
-
-
- waitForTextPresent |
- JSON: |
- |
-
-
- verifyTextPresent |
- JSON: VALID |
- |
-
-
- type |
- json |
- { "value":"wo7us" } |
-
-
- click |
- bt-validate-js |
- |
-
-
- waitForTextPresent |
- JSON: |
- |
-
-
- verifyTextPresent |
- JSON: INVALID |
- |
-
-
- click |
- bt-validate-php |
- |
-
-
- waitForTextPresent |
- JSON: |
- |
-
-
- verifyTextPresent |
- JSON: INVALID |
- |
-
-
-
-
-
diff --git a/tests/selenium/minimumMaximum.html b/tests/selenium/minimumMaximum.html
deleted file mode 100644
index efb82c8..0000000
--- a/tests/selenium/minimumMaximum.html
+++ /dev/null
@@ -1,167 +0,0 @@
-
-
-
-
-
-
-minimumMaximum
-
-
-
-
-minimumMaximum |
-
-
- open |
- /validator.html |
- |
-
-
- type |
- json |
- { "value":2 } |
-
-
- type |
- schema |
- { "type":"object", "properties":{ "value":{"type":"integer","minimum":4} } } |
-
-
- click |
- bt-validate-js |
- |
-
-
- waitForTextPresent |
- JSON: |
- |
-
-
- verifyTextPresent |
- JSON: INVALID |
- |
-
-
- click |
- bt-validate-php |
- |
-
-
- waitForTextPresent |
- JSON: |
- |
-
-
- verifyTextPresent |
- JSON: INVALID |
- |
-
-
- type |
- json |
- { "value":6 } |
-
-
- click |
- bt-validate-js |
- |
-
-
- waitForTextPresent |
- JSON: |
- |
-
-
- verifyTextPresent |
- JSON: VALID |
- |
-
-
- click |
- bt-validate-php |
- |
-
-
- waitForTextPresent |
- JSON: |
- |
-
-
- verifyTextPresent |
- JSON: VALID |
- |
-
-
- type |
- schema |
- { "type":"object", "properties":{ "value":{"type":"integer","maximum":8} } } |
-
-
- click |
- bt-validate-js |
- |
-
-
- waitForTextPresent |
- JSON: |
- |
-
-
- verifyTextPresent |
- JSON: VALID |
- |
-
-
- click |
- bt-validate-php |
- |
-
-
- waitForTextPresent |
- JSON: |
- |
-
-
- verifyTextPresent |
- JSON: VALID |
- |
-
-
- type |
- json |
- { "value":16 } |
-
-
- click |
- bt-validate-js |
- |
-
-
- waitForTextPresent |
- JSON: |
- |
-
-
- verifyTextPresent |
- JSON: INVALID |
- |
-
-
- click |
- bt-validate-php |
- |
-
-
- waitForTextPresent |
- JSON: |
- |
-
-
- verifyTextPresent |
- JSON: INVALID |
- |
-
-
-
-
-
diff --git a/tests/selenium/numberAndIntegerTypes.html b/tests/selenium/numberAndIntegerTypes.html
deleted file mode 100644
index 3263377..0000000
--- a/tests/selenium/numberAndIntegerTypes.html
+++ /dev/null
@@ -1,172 +0,0 @@
-
-
-
-
-
-
-numberAndIntegerTypes
-
-
-
-
-numberAndIntegerTypes |
-
-
- open |
- /validator.html |
- |
-
-
- type |
- json |
- { "number": 1 } |
-
-
- type |
- schema |
- { "type":"object", "properties":{ "number":{"type":"number"} } } |
-
-
- click |
- bt-validate-js |
- |
-
-
- waitForTextPresent |
- JSON: |
- |
-
-
- verifyTextPresent |
- JSON: VALID |
- |
-
-
- click |
- bt-validate-php |
- |
-
-
- waitForTextPresent |
- JSON: |
- |
-
-
- verifyTextPresent |
- JSON: VALID |
- |
-
-
- type |
- json |
- { "number": 1.4 } |
-
-
- click |
- bt-validate-js |
- |
-
-
- waitForTextPresent |
- JSON: |
- |
-
-
- verifyTextPresent |
- JSON: VALID |
- |
-
-
- click |
- bt-validate-php |
- |
-
-
- waitForTextPresent |
- JSON: |
- |
-
-
- verifyTextPresent |
- JSON: VALID |
- |
-
-
- type |
- schema |
- { "type":"object", "properties":{ "number":{"type":"integer"} } } |
-
-
- type |
- json |
- { "number": 1 } |
-
-
- click |
- bt-validate-js |
- |
-
-
- waitForTextPresent |
- JSON: |
- |
-
-
- verifyTextPresent |
- JSON: VALID |
- |
-
-
- click |
- bt-validate-php |
- |
-
-
- waitForTextPresent |
- JSON: |
- |
-
-
- verifyTextPresent |
- JSON: VALID |
- |
-
-
- type |
- json |
- { "number": 1.4 } |
-
-
- click |
- bt-validate-js |
- |
-
-
- waitForTextPresent |
- JSON: |
- |
-
-
- verifyTextPresent |
- JSON: INVALID |
- |
-
-
- click |
- bt-validate-php |
- |
-
-
- waitForTextPresent |
- JSON: |
- |
-
-
- verifyTextPresent |
- JSON: INVALID |
- |
-
-
-
-
-
diff --git a/tests/selenium/optionalProperty.html b/tests/selenium/optionalProperty.html
deleted file mode 100644
index 3791157..0000000
--- a/tests/selenium/optionalProperty.html
+++ /dev/null
@@ -1,97 +0,0 @@
-
-
-
-
-
-
-optionalProperty
-
-
-
-
-optionalProperty |
-
-
- open |
- /validator.html |
- |
-
-
- type |
- json |
- { "number": "1.4" } |
-
-
- type |
- schema |
- { "type":"object", "properties":{ "number":{"type":"string","optional":false} } } |
-
-
- click |
- bt-validate-js |
- |
-
-
- waitForTextPresent |
- JSON: |
- |
-
-
- verifyTextPresent |
- JSON: VALID |
- |
-
-
- click |
- bt-validate-php |
- |
-
-
- waitForTextPresent |
- JSON: |
- |
-
-
- verifyTextPresent |
- JSON: VALID |
- |
-
-
- type |
- json |
- {} |
-
-
- click |
- bt-validate-js |
- |
-
-
- waitForTextPresent |
- JSON: |
- |
-
-
- verifyTextPresent |
- JSON: INVALID |
- |
-
-
- click |
- bt-validate-php |
- |
-
-
- waitForTextPresent |
- JSON: |
- |
-
-
- verifyTextPresent |
- JSON: INVALID |
- |
-
-
-
-
-
diff --git a/tests/selenium/pattern.html b/tests/selenium/pattern.html
deleted file mode 100644
index 2d60072..0000000
--- a/tests/selenium/pattern.html
+++ /dev/null
@@ -1,132 +0,0 @@
-
-
-
-
-
-
-pattern
-
-
-
-
-pattern |
-
-
- open |
- /validator.html |
- |
-
-
- type |
- json |
- { "value":"Abacates" } |
-
-
- type |
- schema |
- { "type":"object", "properties":{ "value":{"type":"string","pattern":"tes$"} }, "additionalProperties":false } |
-
-
- click |
- bt-validate-js |
- |
-
-
- waitForTextPresent |
- JSON: |
- |
-
-
- verifyTextPresent |
- JSON: VALID |
- |
-
-
- click |
- bt-validate-php |
- |
-
-
- waitForTextPresent |
- JSON: |
- |
-
-
- verifyTextPresent |
- JSON: VALID |
- |
-
-
- type |
- schema |
- { "type":"object", "properties":{ "value":{"type":"string","pattern":"cat"} }, "additionalProperties":false } |
-
-
- click |
- bt-validate-js |
- |
-
-
- waitForTextPresent |
- JSON: |
- |
-
-
- verifyTextPresent |
- JSON: VALID |
- |
-
-
- click |
- bt-validate-php |
- |
-
-
- waitForTextPresent |
- JSON: |
- |
-
-
- verifyTextPresent |
- JSON: VALID |
- |
-
-
- type |
- schema |
- { "type":"object", "properties":{ "value":{"type":"string","pattern":"^cat"} }, "additionalProperties":false } |
-
-
- click |
- bt-validate-js |
- |
-
-
- waitForTextPresent |
- JSON: |
- |
-
-
- verifyTextPresent |
- JSON: INVALID |
- |
-
-
- click |
- bt-validate-php |
- |
-
-
- waitForTextPresent |
- JSON: |
- |
-
-
- verifyTextPresent |
- JSON: INVALID |
- |
-
-
-
-
-
diff --git a/tests/selenium/phpTypeCastMode.html b/tests/selenium/phpTypeCastMode.html
deleted file mode 100644
index b96177d..0000000
--- a/tests/selenium/phpTypeCastMode.html
+++ /dev/null
@@ -1,137 +0,0 @@
-
-
-
-
-
-
-phpTypeCastMode
-
-
-
-
-phpTypeCastMode |
-
-
- open |
- /validator.html |
- |
-
-
- type |
- schema |
- { "type":"object", "properties":{ "a":{"type":"number"} } } |
-
-
- type |
- json |
- { "a":"c" } |
-
-
- click |
- bt-validate-php |
- |
-
-
- waitForTextPresent |
- JSON: |
- |
-
-
- verifyTextPresent |
- JSON: INVALID |
- |
-
-
- click |
- bt-validate-php-type-cast-mode |
- |
-
-
- waitForTextPresent |
- JSON: |
- |
-
-
- verifyTextPresent |
- JSON: INVALID |
- |
-
-
- type |
- json |
- { "a":"9" } |
-
-
- click |
- bt-validate-php |
- |
-
-
- waitForTextPresent |
- JSON: |
- |
-
-
- verifyTextPresent |
- JSON: INVALID |
- |
-
-
- click |
- bt-validate-php-type-cast-mode |
- |
-
-
- waitForTextPresent |
- JSON: |
- |
-
-
- verifyTextPresent |
- JSON: VALID |
- |
-
-
- type |
- schema |
- { "type":"object", "properties":{ "a":{"type":"integer","maximum":8} } } |
-
-
- click |
- bt-validate-php-type-cast-mode |
- |
-
-
- waitForTextPresent |
- JSON: |
- |
-
-
- verifyTextPresent |
- must have a maximum value of 8 |
- |
-
-
- type |
- schema |
- { "type":"object", "properties":{ "a":{"type":"integer","maximum":8.0} } } |
-
-
- click |
- bt-validate-php-type-cast-mode |
- |
-
-
- waitForTextPresent |
- JSON: |
- |
-
-
- verifyTextPresent |
- JSON: VALID |
- |
-
-
-
-
-
diff --git a/tests/selenium/require.html b/tests/selenium/require.html
deleted file mode 100644
index 60dfb98..0000000
--- a/tests/selenium/require.html
+++ /dev/null
@@ -1,97 +0,0 @@
-
-
-
-
-
-
-require
-
-
-
-
-require |
-
-
- open |
- /validator.html |
- |
-
-
- type |
- json |
- { "state":"DF", "city":"BrasÃlia" } |
-
-
- type |
- schema |
- { "type":"object", "properties":{ "state":{"type":"string","optional":true,"requires":"city"}, "city":{"type":"string","optional":true} } } |
-
-
- click |
- bt-validate-js |
- |
-
-
- waitForTextPresent |
- JSON: |
- |
-
-
- verifyTextPresent |
- JSON: VALID |
- |
-
-
- click |
- bt-validate-php |
- |
-
-
- waitForTextPresent |
- JSON: |
- |
-
-
- verifyTextPresent |
- JSON: VALID |
- |
-
-
- type |
- json |
- { "state":"DF" } |
-
-
- click |
- bt-validate-js |
- |
-
-
- waitForTextPresent |
- JSON: |
- |
-
-
- verifyTextPresent |
- JSON: INVALID |
- |
-
-
- click |
- bt-validate-php |
- |
-
-
- waitForTextPresent |
- JSON: |
- |
-
-
- verifyTextPresent |
- JSON: INVALID |
- |
-
-
-
-
-
diff --git a/tests/selenium/selfDefinedSchema.html b/tests/selenium/selfDefinedSchema.html
deleted file mode 100644
index 7143304..0000000
--- a/tests/selenium/selfDefinedSchema.html
+++ /dev/null
@@ -1,102 +0,0 @@
-
-
-
-
-
-
-selfDefinedSchema
-
-
-
-
-selfDefinedSchema |
-
-
- open |
- validator.html |
- |
-
-
- type |
- json |
- { "$schema": { "properties": { "name": { "type": "string" }, "age" : { "type": "integer", "maximum": 125, "optional": true } } }, "name" : "John Doe", "age" : 30, "type" : "object" } |
-
-
- type |
- schema |
- |
-
-
- click |
- bt-validate-js |
- |
-
-
- click |
- bt-validate-js |
- |
-
-
- waitForTextPresent |
- JSON: |
- |
-
-
- verifyTextPresent |
- JSON: VALID |
- |
-
-
- click |
- bt-validate-php |
- |
-
-
- waitForTextPresent |
- JSON: |
- |
-
-
- verifyTextPresent |
- JSON: VALID |
- |
-
-
- type |
- json |
- { "$schema": { "properties": { "name": { "type": "string" }, "age" : { "type": "integer", "maximum": 25, "optional": true } } }, "name" : "John Doe", "age" : 30, "type" : "object" } |
-
-
- click |
- bt-validate-js |
- |
-
-
- waitForTextPresent |
- JSON: |
- |
-
-
- verifyTextPresent |
- JSON: INVALID |
- |
-
-
- click |
- bt-validate-php |
- |
-
-
- waitForTextPresent |
- JSON: |
- |
-
-
- verifyTextPresent |
- JSON: INVALID |
- |
-
-
-
-
-
diff --git a/tests/selenium/tupleTyping.html b/tests/selenium/tupleTyping.html
deleted file mode 100644
index a34aade..0000000
--- a/tests/selenium/tupleTyping.html
+++ /dev/null
@@ -1,267 +0,0 @@
-
-
-
-
-
-
-tupleTyping
-
-
-
-
-tupleTyping |
-
-
- open |
- /validator.html |
- |
-
-
- type |
- json |
- { "tupleTyping":[2,"a"] } |
-
-
- type |
- schema |
- { "type":"object", "properties":{ "tupleTyping":{ "type":"array", "items":[ {"type":"string"}, {"type":"number"} ] } } } |
-
-
- click |
- bt-validate-php |
- |
-
-
- waitForTextPresent |
- JSON: |
- |
-
-
- verifyTextPresent |
- JSON: INVALID |
- |
-
-
- verifyTextPresent |
- tupleTyping[0] |
- |
-
-
- verifyTextPresent |
- tupleTyping[1] |
- |
-
-
- click |
- bt-validate-js |
- |
-
-
- waitForTextPresent |
- JSON: |
- |
-
-
- verifyTextPresent |
- JSON: INVALID |
- |
-
-
- verifyTextPresent |
- tupleTyping[0] |
- |
-
-
- verifyTextPresent |
- tupleTyping[1] |
- |
-
-
- type |
- json |
- { "tupleTyping":["2",2,3] } |
-
-
- type |
- schema |
- { "type":"object", "properties":{ "tupleTyping":{ "type":"array", "items":[ {"type":"string"}, {"type":"number"} ] , "additionalProperties":false } } } |
-
-
- click |
- bt-validate-php |
- |
-
-
- waitForTextPresent |
- JSON: |
- |
-
-
- verifyTextPresent |
- JSON: INVALID |
- |
-
-
- verifyTextPresent |
- tupleTyping[2] |
- |
-
-
- click |
- bt-validate-js |
- |
-
-
- verifyTextPresent |
- JSON: |
- |
-
-
- verifyTextPresent |
- JSON: INVALID |
- |
-
-
- verifyTextPresent |
- tupleTyping[2] |
- |
-
-
- type |
- schema |
- { "type":"object", "properties":{ "tupleTyping":{ "type":"array", "items":[ {"type":"string"}, {"type":"number"} ] , "additionalProperties":{"type":"string"} } } } |
-
-
- click |
- bt-validate-php |
- |
-
-
- waitForTextPresent |
- JSON: |
- |
-
-
- verifyTextPresent |
- JSON: INVALID |
- |
-
-
- verifyTextPresent |
- tupleTyping[2] |
- |
-
-
- click |
- bt-validate-js |
- |
-
-
- verifyTextPresent |
- JSON: |
- |
-
-
- verifyTextPresent |
- JSON: INVALID |
- |
-
-
- verifyTextPresent |
- tupleTyping[2] |
- |
-
-
- type |
- json |
- { "tupleTyping":["2"] } |
-
-
- type |
- schema |
- { "type":"object", "properties":{ "tupleTyping":{ "type":"array", "items":[ {"type":"string"}, {"type":"number"} ] } } } |
-
-
- click |
- bt-validate-js |
- |
-
-
- waitForTextPresent |
- JSON: |
- |
-
-
- verifyTextPresent |
- JSON: INVALID |
- |
-
-
- verifyTextPresent |
- tupleTyping[1] :: is missing and it is not optional |
- |
-
-
- click |
- bt-validate-php |
- |
-
-
- waitForTextPresent |
- JSON: |
- |
-
-
- verifyTextPresent |
- JSON: INVALID |
- |
-
-
- verifyTextPresent |
- tupleTyping[1] :: is missing and it is not optional |
- |
-
-
- type |
- json |
- { "tupleTyping":["2"] } |
-
-
- type |
- schema |
- { "type":"object", "properties":{ "tupleTyping":{ "type":"array", "items":[ {"type":"string"}, {"type":"number","optional":true}, {"type":"number","optional":true} ] } } } |
-
-
- click |
- bt-validate-js |
- |
-
-
- waitForTextPresent |
- JSON: |
- |
-
-
- verifyTextPresent |
- JSON: VALID |
- |
-
-
- click |
- bt-validate-php |
- |
-
-
- waitForTextPresent |
- JSON: |
- |
-
-
- verifyTextPresent |
- JSON: VALID |
- |
-
-
-
-
-
diff --git a/tests/selenium/unionTypes.html b/tests/selenium/unionTypes.html
deleted file mode 100644
index a77d156..0000000
--- a/tests/selenium/unionTypes.html
+++ /dev/null
@@ -1,97 +0,0 @@
-
-
-
-
-
-
-unionTypes
-
-
-
-
-unionTypes |
-
-
- open |
- /validator.html |
- |
-
-
- type |
- json |
- { "stringOrNumber":4.8, "booleanOrNull":false } |
-
-
- type |
- schema |
- { "type":"object", "properties":{ "stringOrNumber":{"type":["string","number"]}, "booleanOrNull":{"type":["boolean","null"]} } } |
-
-
- click |
- bt-validate-js |
- |
-
-
- waitForTextPresent |
- JSON: |
- |
-
-
- verifyTextPresent |
- JSON: VALID |
- |
-
-
- click |
- bt-validate-php |
- |
-
-
- waitForTextPresent |
- JSON: |
- |
-
-
- verifyTextPresent |
- JSON: VALID |
- |
-
-
- type |
- json |
- { "stringOrNumber":4.8, "booleanOrNull":5 } |
-
-
- click |
- bt-validate-js |
- |
-
-
- waitForTextPresent |
- JSON: |
- |
-
-
- verifyTextPresent |
- JSON: INVALID |
- |
-
-
- click |
- bt-validate-php |
- |
-
-
- waitForTextPresent |
- JSON: |
- |
-
-
- verifyTextPresent |
- JSON: INVALID |
- |
-
-
-
-
-
diff --git a/tests/selenium/unionWithNullValue.html b/tests/selenium/unionWithNullValue.html
deleted file mode 100644
index c612689..0000000
--- a/tests/selenium/unionWithNullValue.html
+++ /dev/null
@@ -1,62 +0,0 @@
-
-
-
-
-
-
-unionWithNullValue
-
-
-
-
-unionWithNullValue |
-
-
- open |
- /validator.html |
- |
-
-
- type |
- json |
- { "stringOrNumber":null, "booleanOrNull":null } |
-
-
- type |
- schema |
- { "type":"object", "properties":{ "stringOrNumber":{"type":["string","number"]}, "booleanOrNull":{"type":["boolean","null"]} } } |
-
-
- click |
- bt-validate-js |
- |
-
-
- waitForTextPresent |
- JSON: |
- |
-
-
- verifyTextPresent |
- JSON: INVALID |
- |
-
-
- click |
- bt-validate-php |
- |
-
-
- waitForTextPresent |
- JSON: |
- |
-
-
- verifyTextPresent |
- JSON: INVALID |
- |
-
-
-
-
-
diff --git a/tests/selenium/wrongMessagesFailingTestCase.html b/tests/selenium/wrongMessagesFailingTestCase.html
deleted file mode 100644
index e19ba32..0000000
--- a/tests/selenium/wrongMessagesFailingTestCase.html
+++ /dev/null
@@ -1,72 +0,0 @@
-
-
-
-
-
-
-failingJson
-
-
-
-
-failingJson |
-
-
- open |
- /validator.html |
- |
-
-
- type |
- schema |
- { "type":"object", "properties":{ "stringOrNumber":{"type":["string","number"]}, "booleanOrNull":{"type":["boolean","null"]} } } |
-
-
- type |
- json |
- { "stringOrNumber":4.8, "booleanOrNull":["A","B"] } |
-
-
- click |
- bt-validate-js |
- |
-
-
- waitForTextPresent |
- JSON: |
- |
-
-
- verifyTextPresent |
- array value found, but a null is required |
- |
-
-
- type |
- schema |
- { "type":"object", "properties":{ "stringOrNumber":{"type":["string","number"]}, "booleanOrNull":{"type":["boolean","null"]} } } |
-
-
- type |
- json |
- { "stringOrNumber":4.8, "booleanOrNull":["A","B"] } |
-
-
- click |
- bt-validate-js |
- |
-
-
- waitForTextPresent |
- JSON: |
- |
-
-
- verifyTextPresent |
- array value found, but a null is required |
- |
-
-
-
-
-
diff --git a/vendor/symfony/Component/ClassLoader b/vendor/symfony/Component/ClassLoader
new file mode 160000
index 0000000..1c23c33
--- /dev/null
+++ b/vendor/symfony/Component/ClassLoader
@@ -0,0 +1 @@
+Subproject commit 1c23c336915e4fa11abef2279ee48e7fb660ad8c
diff --git a/webroot/css/interface.css b/webroot/css/interface.css
deleted file mode 100644
index 9cabba4..0000000
--- a/webroot/css/interface.css
+++ /dev/null
@@ -1,17 +0,0 @@
-*{
- font-family: verdana, arial, sans-serif;
-}
-.campo{
- width:550px;
- height:230px;
- background-color:#eee;
-}
-.botao{
- width:300px;
- height:60px;
-}
-.comment{
- background-color:#eee;
- color:#363;
- font-size: .7em;
-}
\ No newline at end of file
diff --git a/webroot/js/functions.js b/webroot/js/functions.js
deleted file mode 100644
index 5b3d3f9..0000000
--- a/webroot/js/functions.js
+++ /dev/null
@@ -1,53 +0,0 @@
-function print_r( array, return_val ) {
- // http://kevin.vanzonneveld.net
- // + original by: Michael White (http://getsprink.com)
- // + improved by: Ben Bryan
- // * example 1: print_r(1, true);
- // * returns 1: 1
-
- var output = "", pad_char = " ", pad_val = 4;
-
- var formatArray = function (obj, cur_depth, pad_val, pad_char) {
- if (cur_depth > 0) {
- cur_depth++;
- }
-
- var base_pad = repeat_char(pad_val*cur_depth, pad_char);
- var thick_pad = repeat_char(pad_val*(cur_depth+1), pad_char);
- var str = "";
-
- if (obj instanceof Array || obj instanceof Object) {
- str += "Array\n" + base_pad + "(\n";
- for (var key in obj) {
- if (obj[key] instanceof Array) {
- str += thick_pad + "["+key+"] => "+formatArray(obj[key], cur_depth+1, pad_val, pad_char);
- } else {
- str += thick_pad + "["+key+"] => " + obj[key] + "\n";
- }
- }
- str += base_pad + ")\n";
- } else if(obj == null || obj == undefined) {
- str = '';
- } else {
- str = obj.toString();
- }
-
- return str;
- };
-
- var repeat_char = function (len, pad_char) {
- var str = "";
- for(var i=0; i < len; i++) {
- str += pad_char;
- };
- return str;
- };
- output = formatArray(array, 0, pad_val, pad_char);
-
- if (return_val !== true) {
- document.write("" + output + "
");
- return true;
- } else {
- return output;
- }
-}
\ No newline at end of file
diff --git a/webroot/js/interface.js b/webroot/js/interface.js
deleted file mode 100644
index 3d84f65..0000000
--- a/webroot/js/interface.js
+++ /dev/null
@@ -1,67 +0,0 @@
-$(document).ready(function(){
- $("#bt-validate-js").click(validateJs);
- $("#bt-validate-php").click(validatePhp);
- $("#bt-validate-php-type-cast-mode").click(validatePhpTypeCastMode);
-});
-
-
-function validatePhpTypeCastMode() {
- validatePhp(true);
-}
-
-function validatePhp(typeCastMode) {
- if(typeCastMode == true) {
- typeCastMode = true;
- }
- else {
- typeCastMode = false;
- }
-
- $('#resultados').html('. . . w o r k i n g . . . ');
- schema = $('#schema').val();
- json = $('#json').val();
-
- $.getJSON(
- "validate.php",
- {"schema":schema,"json":json,"typeCastMode":typeCastMode},
- phpCallback
- );
-}
-
-function phpCallback(json) {
- showResponse(json);
-}
-
-function validateJs() {
- $('#resultados').html('. . . w o r k i n g . . . ');
- jsons = getJsons();
- //alert(print_r(jsons,true));
- if(jsons.schema) {
- validateResponse = JSONSchema.validate(jsons.json,jsons.schema);
- }
- else {
- validateResponse = JSONSchema.validate(jsons.json);
- }
- showResponse(validateResponse);
-}
-
-function getJsons() {
- schema = $('#schema').val();
- json = $('#json').val();
- json = eval( '(' + json + ')' );
- if(schema) {
- schema = eval( '(' + schema + ')' );
- }
- return {"json":json,"schema":schema};
-}
-
-function showResponse(validateResponse) {
- //alert(print_r(validateResponse,true));
- res = ''+'JSON: '+(validateResponse.valid?' VALID':'INVALID')+'
';
- $.each(validateResponse.errors,function(i,item) {
- //alert(print_r(item,true));
- res += '' + item.property + ' :: ' + item.message + '
';
- res += '
";
- });
- $('#resultados').html(res);
-}
\ No newline at end of file
diff --git a/webroot/js/jquery.js b/webroot/js/jquery.js
deleted file mode 100644
index b3b858a..0000000
--- a/webroot/js/jquery.js
+++ /dev/null
@@ -1,11 +0,0 @@
-/*
- * jQuery 1.2.1 - New Wave Javascript
- *
- * Copyright (c) 2007 John Resig (jquery.com)
- * Dual licensed under the MIT (MIT-LICENSE.txt)
- * and GPL (GPL-LICENSE.txt) licenses.
- *
- * $Date: 2007-09-16 23:42:06 -0400 (Sun, 16 Sep 2007) $
- * $Rev: 3353 $
- */
-eval(function(p,a,c,k,e,r){e=function(c){return(c35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('(G(){9(1m E!="W")H w=E;H E=18.15=G(a,b){I 6 7u E?6.5N(a,b):1u E(a,b)};9(1m $!="W")H D=$;18.$=E;H u=/^[^<]*(<(.|\\s)+>)[^>]*$|^#(\\w+)$/;E.1b=E.3A={5N:G(c,a){c=c||U;9(1m c=="1M"){H m=u.2S(c);9(m&&(m[1]||!a)){9(m[1])c=E.4D([m[1]],a);J{H b=U.3S(m[3]);9(b)9(b.22!=m[3])I E().1Y(c);J{6[0]=b;6.K=1;I 6}J c=[]}}J I 1u E(a).1Y(c)}J 9(E.1n(c))I 1u E(U)[E.1b.2d?"2d":"39"](c);I 6.6v(c.1c==1B&&c||(c.4c||c.K&&c!=18&&!c.1y&&c[0]!=W&&c[0].1y)&&E.2h(c)||[c])},4c:"1.2.1",7Y:G(){I 6.K},K:0,21:G(a){I a==W?E.2h(6):6[a]},2o:G(a){H b=E(a);b.4Y=6;I b},6v:G(a){6.K=0;1B.3A.1a.16(6,a);I 6},N:G(a,b){I E.N(6,a,b)},4I:G(a){H b=-1;6.N(G(i){9(6==a)b=i});I b},1x:G(f,d,e){H c=f;9(f.1c==3X)9(d==W)I 6.K&&E[e||"1x"](6[0],f)||W;J{c={};c[f]=d}I 6.N(G(a){L(H b 1i c)E.1x(e?6.R:6,b,E.1e(6,c[b],e,a,b))})},17:G(b,a){I 6.1x(b,a,"3C")},2g:G(e){9(1m e!="5i"&&e!=S)I 6.4n().3g(U.6F(e));H t="";E.N(e||6,G(){E.N(6.3j,G(){9(6.1y!=8)t+=6.1y!=1?6.6x:E.1b.2g([6])})});I t},5m:G(b){9(6[0])E(b,6[0].3H).6u().3d(6[0]).1X(G(){H a=6;1W(a.1w)a=a.1w;I a}).3g(6);I 6},8m:G(a){I 6.N(G(){E(6).6q().5m(a)})},8d:G(a){I 6.N(G(){E(6).5m(a)})},3g:G(){I 6.3z(1q,Q,1,G(a){6.58(a)})},6j:G(){I 6.3z(1q,Q,-1,G(a){6.3d(a,6.1w)})},6g:G(){I 6.3z(1q,P,1,G(a){6.12.3d(a,6)})},50:G(){I 6.3z(1q,P,-1,G(a){6.12.3d(a,6.2q)})},2D:G(){I 6.4Y||E([])},1Y:G(t){H b=E.1X(6,G(a){I E.1Y(t,a)});I 6.2o(/[^+>] [^+>]/.14(t)||t.1g("..")>-1?E.4V(b):b)},6u:G(e){H f=6.1X(G(){I 6.67?E(6.67)[0]:6.4R(Q)});H d=f.1Y("*").4O().N(G(){9(6[F]!=W)6[F]=S});9(e===Q)6.1Y("*").4O().N(G(i){H c=E.M(6,"2P");L(H a 1i c)L(H b 1i c[a])E.1j.1f(d[i],a,c[a][b],c[a][b].M)});I f},1E:G(t){I 6.2o(E.1n(t)&&E.2W(6,G(b,a){I t.16(b,[a])})||E.3m(t,6))},5V:G(t){I 6.2o(t.1c==3X&&E.3m(t,6,Q)||E.2W(6,G(a){I(t.1c==1B||t.4c)?E.2A(a,t)<0:a!=t}))},1f:G(t){I 6.2o(E.1R(6.21(),t.1c==3X?E(t).21():t.K!=W&&(!t.11||E.11(t,"2Y"))?t:[t]))},3t:G(a){I a?E.3m(a,6).K>0:P},7c:G(a){I 6.3t("."+a)},3i:G(b){9(b==W){9(6.K){H c=6[0];9(E.11(c,"24")){H e=c.4Z,a=[],Y=c.Y,2G=c.O=="24-2G";9(e<0)I S;L(H i=2G?e:0,33=2G?e+1:Y.K;i<33;i++){H d=Y[i];9(d.26){H b=E.V.1h&&!d.9V["1Q"].9L?d.2g:d.1Q;9(2G)I b;a.1a(b)}}I a}J I 6[0].1Q.1p(/\\r/g,"")}}J I 6.N(G(){9(b.1c==1B&&/4k|5j/.14(6.O))6.2Q=(E.2A(6.1Q,b)>=0||E.2A(6.2H,b)>=0);J 9(E.11(6,"24")){H a=b.1c==1B?b:[b];E("9h",6).N(G(){6.26=(E.2A(6.1Q,a)>=0||E.2A(6.2g,a)>=0)});9(!a.K)6.4Z=-1}J 6.1Q=b})},4o:G(a){I a==W?(6.K?6[0].3O:S):6.4n().3g(a)},6H:G(a){I 6.50(a).28()},6E:G(i){I 6.2J(i,i+1)},2J:G(){I 6.2o(1B.3A.2J.16(6,1q))},1X:G(b){I 6.2o(E.1X(6,G(a,i){I b.2O(a,i,a)}))},4O:G(){I 6.1f(6.4Y)},3z:G(f,d,g,e){H c=6.K>1,a;I 6.N(G(){9(!a){a=E.4D(f,6.3H);9(g<0)a.8U()}H b=6;9(d&&E.11(6,"1I")&&E.11(a[0],"4m"))b=6.4l("1K")[0]||6.58(U.5B("1K"));E.N(a,G(){H a=c?6.4R(Q):6;9(!5A(0,a))e.2O(b,a)})})}};G 5A(i,b){H a=E.11(b,"1J");9(a){9(b.3k)E.3G({1d:b.3k,3e:P,1V:"1J"});J E.5f(b.2g||b.6s||b.3O||"");9(b.12)b.12.3b(b)}J 9(b.1y==1)E("1J",b).N(5A);I a}E.1k=E.1b.1k=G(){H c=1q[0]||{},a=1,2c=1q.K,5e=P;9(c.1c==8o){5e=c;c=1q[1]||{}}9(2c==1){c=6;a=0}H b;L(;a<2c;a++)9((b=1q[a])!=S)L(H i 1i b){9(c==b[i])6r;9(5e&&1m b[i]==\'5i\'&&c[i])E.1k(c[i],b[i]);J 9(b[i]!=W)c[i]=b[i]}I c};H F="15"+(1u 3D()).3B(),6p=0,5c={};E.1k({8a:G(a){18.$=D;9(a)18.15=w;I E},1n:G(a){I!!a&&1m a!="1M"&&!a.11&&a.1c!=1B&&/G/i.14(a+"")},4a:G(a){I a.2V&&!a.1G||a.37&&a.3H&&!a.3H.1G},5f:G(a){a=E.36(a);9(a){9(18.6l)18.6l(a);J 9(E.V.1N)18.56(a,0);J 3w.2O(18,a)}},11:G(b,a){I b.11&&b.11.27()==a.27()},1L:{},M:G(c,d,b){c=c==18?5c:c;H a=c[F];9(!a)a=c[F]=++6p;9(d&&!E.1L[a])E.1L[a]={};9(b!=W)E.1L[a][d]=b;I d?E.1L[a][d]:a},30:G(c,b){c=c==18?5c:c;H a=c[F];9(b){9(E.1L[a]){2E E.1L[a][b];b="";L(b 1i E.1L[a])1T;9(!b)E.30(c)}}J{2a{2E c[F]}29(e){9(c.53)c.53(F)}2E E.1L[a]}},N:G(a,b,c){9(c){9(a.K==W)L(H i 1i a)b.16(a[i],c);J L(H i=0,48=a.K;i<48;i++)9(b.16(a[i],c)===P)1T}J{9(a.K==W)L(H i 1i a)b.2O(a[i],i,a[i]);J L(H i=0,48=a.K,3i=a[0];i<48&&b.2O(3i,i,3i)!==P;3i=a[++i]){}}I a},1e:G(c,b,d,e,a){9(E.1n(b))b=b.2O(c,[e]);H f=/z-?4I|7T-?7Q|1r|69|7P-?1H/i;I b&&b.1c==4W&&d=="3C"&&!f.14(a)?b+"2T":b},1o:{1f:G(b,c){E.N((c||"").2l(/\\s+/),G(i,a){9(!E.1o.3K(b.1o,a))b.1o+=(b.1o?" ":"")+a})},28:G(b,c){b.1o=c!=W?E.2W(b.1o.2l(/\\s+/),G(a){I!E.1o.3K(c,a)}).66(" "):""},3K:G(t,c){I E.2A(c,(t.1o||t).3s().2l(/\\s+/))>-1}},2k:G(e,o,f){L(H i 1i o){e.R["3r"+i]=e.R[i];e.R[i]=o[i]}f.16(e,[]);L(H i 1i o)e.R[i]=e.R["3r"+i]},17:G(e,p){9(p=="1H"||p=="2N"){H b={},42,41,d=["7J","7I","7G","7F"];E.N(d,G(){b["7C"+6]=0;b["7B"+6+"5Z"]=0});E.2k(e,b,G(){9(E(e).3t(\':3R\')){42=e.7A;41=e.7w}J{e=E(e.4R(Q)).1Y(":4k").5W("2Q").2D().17({4C:"1P",2X:"4F",19:"2Z",7o:"0",1S:"0"}).5R(e.12)[0];H a=E.17(e.12,"2X")||"3V";9(a=="3V")e.12.R.2X="7g";42=e.7e;41=e.7b;9(a=="3V")e.12.R.2X="3V";e.12.3b(e)}});I p=="1H"?42:41}I E.3C(e,p)},3C:G(h,j,i){H g,2w=[],2k=[];G 3n(a){9(!E.V.1N)I P;H b=U.3o.3Z(a,S);I!b||b.4y("3n")==""}9(j=="1r"&&E.V.1h){g=E.1x(h.R,"1r");I g==""?"1":g}9(j.1t(/4u/i))j=y;9(!i&&h.R[j])g=h.R[j];J 9(U.3o&&U.3o.3Z){9(j.1t(/4u/i))j="4u";j=j.1p(/([A-Z])/g,"-$1").2p();H d=U.3o.3Z(h,S);9(d&&!3n(h))g=d.4y(j);J{L(H a=h;a&&3n(a);a=a.12)2w.4w(a);L(a=0;a<2w.K;a++)9(3n(2w[a])){2k[a]=2w[a].R.19;2w[a].R.19="2Z"}g=j=="19"&&2k[2w.K-1]!=S?"2s":U.3o.3Z(h,S).4y(j)||"";L(a=0;a<2k.K;a++)9(2k[a]!=S)2w[a].R.19=2k[a]}9(j=="1r"&&g=="")g="1"}J 9(h.3Q){H f=j.1p(/\\-(\\w)/g,G(m,c){I c.27()});g=h.3Q[j]||h.3Q[f];9(!/^\\d+(2T)?$/i.14(g)&&/^\\d/.14(g)){H k=h.R.1S;H e=h.4v.1S;h.4v.1S=h.3Q.1S;h.R.1S=g||0;g=h.R.71+"2T";h.R.1S=k;h.4v.1S=e}}I g},4D:G(a,e){H r=[];e=e||U;E.N(a,G(i,d){9(!d)I;9(d.1c==4W)d=d.3s();9(1m d=="1M"){d=d.1p(/(<(\\w+)[^>]*?)\\/>/g,G(m,a,b){I b.1t(/^(70|6Z|6Y|9Q|4t|9N|9K|3a|9G|9E)$/i)?m:a+">"+b+">"});H s=E.36(d).2p(),1s=e.5B("1s"),2x=[];H c=!s.1g("<9y")&&[1,"<24>","24>"]||!s.1g("<9w")&&[1,"<6T>","6T>"]||s.1t(/^<(9u|1K|9t|9r|9p)/)&&[1,"<1I>","1I>"]||!s.1g("<4m")&&[2,"<1I><1K>","1K>1I>"]||(!s.1g("<9m")||!s.1g("<9k"))&&[3,"<1I><1K><4m>","4m>1K>1I>"]||!s.1g("<6Y")&&[2,"<1I><1K>1K><6L>","6L>1I>"]||E.V.1h&&[1,"1s<1s>","1s>"]||[0,"",""];1s.3O=c[1]+d+c[2];1W(c[0]--)1s=1s.5p;9(E.V.1h){9(!s.1g("<1I")&&s.1g("<1K")<0)2x=1s.1w&&1s.1w.3j;J 9(c[1]=="<1I>"&&s.1g("<1K")<0)2x=1s.3j;L(H n=2x.K-1;n>=0;--n)9(E.11(2x[n],"1K")&&!2x[n].3j.K)2x[n].12.3b(2x[n]);9(/^\\s/.14(d))1s.3d(e.6F(d.1t(/^\\s*/)[0]),1s.1w)}d=E.2h(1s.3j)}9(0===d.K&&(!E.11(d,"2Y")&&!E.11(d,"24")))I;9(d[0]==W||E.11(d,"2Y")||d.Y)r.1a(d);J r=E.1R(r,d)});I r},1x:G(c,d,a){H e=E.4a(c)?{}:E.5o;9(d=="26"&&E.V.1N)c.12.4Z;9(e[d]){9(a!=W)c[e[d]]=a;I c[e[d]]}J 9(E.V.1h&&d=="R")I E.1x(c.R,"9e",a);J 9(a==W&&E.V.1h&&E.11(c,"2Y")&&(d=="9d"||d=="9a"))I c.97(d).6x;J 9(c.37){9(a!=W){9(d=="O"&&E.11(c,"4t")&&c.12)6G"O 94 93\'t 92 91";c.90(d,a)}9(E.V.1h&&/6C|3k/.14(d)&&!E.4a(c))I c.4p(d,2);I c.4p(d)}J{9(d=="1r"&&E.V.1h){9(a!=W){c.69=1;c.1E=(c.1E||"").1p(/6O\\([^)]*\\)/,"")+(3I(a).3s()=="8S"?"":"6O(1r="+a*6A+")")}I c.1E?(3I(c.1E.1t(/1r=([^)]*)/)[1])/6A).3s():""}d=d.1p(/-([a-z])/8Q,G(z,b){I b.27()});9(a!=W)c[d]=a;I c[d]}},36:G(t){I(t||"").1p(/^\\s+|\\s+$/g,"")},2h:G(a){H r=[];9(1m a!="8P")L(H i=0,2c=a.K;i<2c;i++)r.1a(a[i]);J r=a.2J(0);I r},2A:G(b,a){L(H i=0,2c=a.K;i<2c;i++)9(a[i]==b)I i;I-1},1R:G(a,b){9(E.V.1h){L(H i=0;b[i];i++)9(b[i].1y!=8)a.1a(b[i])}J L(H i=0;b[i];i++)a.1a(b[i]);I a},4V:G(b){H r=[],2f={};2a{L(H i=0,6y=b.K;i<6y;i++){H a=E.M(b[i]);9(!2f[a]){2f[a]=Q;r.1a(b[i])}}}29(e){r=b}I r},2W:G(b,a,c){9(1m a=="1M")a=3w("P||G(a,i){I "+a+"}");H d=[];L(H i=0,4g=b.K;i<4g;i++)9(!c&&a(b[i],i)||c&&!a(b[i],i))d.1a(b[i]);I d},1X:G(c,b){9(1m b=="1M")b=3w("P||G(a){I "+b+"}");H d=[];L(H i=0,4g=c.K;i<4g;i++){H a=b(c[i],i);9(a!==S&&a!=W){9(a.1c!=1B)a=[a];d=d.8M(a)}}I d}});H v=8K.8I.2p();E.V={4s:(v.1t(/.+(?:8F|8E|8C|8B)[\\/: ]([\\d.]+)/)||[])[1],1N:/6w/.14(v),34:/34/.14(v),1h:/1h/.14(v)&&!/34/.14(v),35:/35/.14(v)&&!/(8z|6w)/.14(v)};H y=E.V.1h?"4h":"5h";E.1k({5g:!E.V.1h||U.8y=="8x",4h:E.V.1h?"4h":"5h",5o:{"L":"8w","8v":"1o","4u":y,5h:y,4h:y,3O:"3O",1o:"1o",1Q:"1Q",3c:"3c",2Q:"2Q",8u:"8t",26:"26",8s:"8r"}});E.N({1D:"a.12",8q:"15.4e(a,\'12\')",8p:"15.2I(a,2,\'2q\')",8n:"15.2I(a,2,\'4d\')",8l:"15.4e(a,\'2q\')",8k:"15.4e(a,\'4d\')",8j:"15.5d(a.12.1w,a)",8i:"15.5d(a.1w)",6q:"15.11(a,\'8h\')?a.8f||a.8e.U:15.2h(a.3j)"},G(i,n){E.1b[i]=G(a){H b=E.1X(6,n);9(a&&1m a=="1M")b=E.3m(a,b);I 6.2o(E.4V(b))}});E.N({5R:"3g",8c:"6j",3d:"6g",8b:"50",89:"6H"},G(i,n){E.1b[i]=G(){H a=1q;I 6.N(G(){L(H j=0,2c=a.K;j<2c;j++)E(a[j])[n](6)})}});E.N({5W:G(a){E.1x(6,a,"");6.53(a)},88:G(c){E.1o.1f(6,c)},87:G(c){E.1o.28(6,c)},86:G(c){E.1o[E.1o.3K(6,c)?"28":"1f"](6,c)},28:G(a){9(!a||E.1E(a,[6]).r.K){E.30(6);6.12.3b(6)}},4n:G(){E("*",6).N(G(){E.30(6)});1W(6.1w)6.3b(6.1w)}},G(i,n){E.1b[i]=G(){I 6.N(n,1q)}});E.N(["85","5Z"],G(i,a){H n=a.2p();E.1b[n]=G(h){I 6[0]==18?E.V.1N&&3y["84"+a]||E.5g&&38.33(U.2V["5a"+a],U.1G["5a"+a])||U.1G["5a"+a]:6[0]==U?38.33(U.1G["6n"+a],U.1G["6m"+a]):h==W?(6.K?E.17(6[0],n):S):6.17(n,h.1c==3X?h:h+"2T")}});H C=E.V.1N&&3x(E.V.4s)<83?"(?:[\\\\w*57-]|\\\\\\\\.)":"(?:[\\\\w\\82-\\81*57-]|\\\\\\\\.)",6k=1u 47("^>\\\\s*("+C+"+)"),6i=1u 47("^("+C+"+)(#)("+C+"+)"),6h=1u 47("^([#.]?)("+C+"*)");E.1k({55:{"":"m[2]==\'*\'||15.11(a,m[2])","#":"a.4p(\'22\')==m[2]",":":{80:"im[3]-0",2I:"m[3]-0==i",6E:"m[3]-0==i",3v:"i==0",3u:"i==r.K-1",6f:"i%2==0",6e:"i%2","3v-46":"a.12.4l(\'*\')[0]==a","3u-46":"15.2I(a.12.5p,1,\'4d\')==a","7X-46":"!15.2I(a.12.5p,2,\'4d\')",1D:"a.1w",4n:"!a.1w",7W:"(a.6s||a.7V||15(a).2g()||\'\').1g(m[3])>=0",3R:\'"1P"!=a.O&&15.17(a,"19")!="2s"&&15.17(a,"4C")!="1P"\',1P:\'"1P"==a.O||15.17(a,"19")=="2s"||15.17(a,"4C")=="1P"\',7U:"!a.3c",3c:"a.3c",2Q:"a.2Q",26:"a.26||15.1x(a,\'26\')",2g:"\'2g\'==a.O",4k:"\'4k\'==a.O",5j:"\'5j\'==a.O",54:"\'54\'==a.O",52:"\'52\'==a.O",51:"\'51\'==a.O",6d:"\'6d\'==a.O",6c:"\'6c\'==a.O",2r:\'"2r"==a.O||15.11(a,"2r")\',4t:"/4t|24|6b|2r/i.14(a.11)",3K:"15.1Y(m[3],a).K",7S:"/h\\\\d/i.14(a.11)",7R:"15.2W(15.32,G(1b){I a==1b.T;}).K"}},6a:[/^(\\[) *@?([\\w-]+) *([!*$^~=]*) *(\'?"?)(.*?)\\4 *\\]/,/^(:)([\\w-]+)\\("?\'?(.*?(\\(.*?\\))?[^(]*?)"?\'?\\)/,1u 47("^([:.#]*)("+C+"+)")],3m:G(a,c,b){H d,2b=[];1W(a&&a!=d){d=a;H f=E.1E(a,c,b);a=f.t.1p(/^\\s*,\\s*/,"");2b=b?c=f.r:E.1R(2b,f.r)}I 2b},1Y:G(t,o){9(1m t!="1M")I[t];9(o&&!o.1y)o=S;o=o||U;H d=[o],2f=[],3u;1W(t&&3u!=t){H r=[];3u=t;t=E.36(t);H l=P;H g=6k;H m=g.2S(t);9(m){H p=m[1].27();L(H i=0;d[i];i++)L(H c=d[i].1w;c;c=c.2q)9(c.1y==1&&(p=="*"||c.11.27()==p.27()))r.1a(c);d=r;t=t.1p(g,"");9(t.1g(" ")==0)6r;l=Q}J{g=/^([>+~])\\s*(\\w*)/i;9((m=g.2S(t))!=S){r=[];H p=m[2],1R={};m=m[1];L(H j=0,31=d.K;j<31;j++){H n=m=="~"||m=="+"?d[j].2q:d[j].1w;L(;n;n=n.2q)9(n.1y==1){H h=E.M(n);9(m=="~"&&1R[h])1T;9(!p||n.11.27()==p.27()){9(m=="~")1R[h]=Q;r.1a(n)}9(m=="+")1T}}d=r;t=E.36(t.1p(g,""));l=Q}}9(t&&!l){9(!t.1g(",")){9(o==d[0])d.44();2f=E.1R(2f,d);r=d=[o];t=" "+t.68(1,t.K)}J{H k=6i;H m=k.2S(t);9(m){m=[0,m[2],m[3],m[1]]}J{k=6h;m=k.2S(t)}m[2]=m[2].1p(/\\\\/g,"");H f=d[d.K-1];9(m[1]=="#"&&f&&f.3S&&!E.4a(f)){H q=f.3S(m[2]);9((E.V.1h||E.V.34)&&q&&1m q.22=="1M"&&q.22!=m[2])q=E(\'[@22="\'+m[2]+\'"]\',f)[0];d=r=q&&(!m[3]||E.11(q,m[3]))?[q]:[]}J{L(H i=0;d[i];i++){H a=m[1]=="#"&&m[3]?m[3]:m[1]!=""||m[0]==""?"*":m[2];9(a=="*"&&d[i].11.2p()=="5i")a="3a";r=E.1R(r,d[i].4l(a))}9(m[1]==".")r=E.4X(r,m[2]);9(m[1]=="#"){H e=[];L(H i=0;r[i];i++)9(r[i].4p("22")==m[2]){e=[r[i]];1T}r=e}d=r}t=t.1p(k,"")}}9(t){H b=E.1E(t,r);d=r=b.r;t=E.36(b.t)}}9(t)d=[];9(d&&o==d[0])d.44();2f=E.1R(2f,d);I 2f},4X:G(r,m,a){m=" "+m+" ";H c=[];L(H i=0;r[i];i++){H b=(" "+r[i].1o+" ").1g(m)>=0;9(!a&&b||a&&!b)c.1a(r[i])}I c},1E:G(t,r,h){H d;1W(t&&t!=d){d=t;H p=E.6a,m;L(H i=0;p[i];i++){m=p[i].2S(t);9(m){t=t.7O(m[0].K);m[2]=m[2].1p(/\\\\/g,"");1T}}9(!m)1T;9(m[1]==":"&&m[2]=="5V")r=E.1E(m[3],r,Q).r;J 9(m[1]==".")r=E.4X(r,m[2],h);J 9(m[1]=="["){H g=[],O=m[3];L(H i=0,31=r.K;i<31;i++){H a=r[i],z=a[E.5o[m[2]]||m[2]];9(z==S||/6C|3k|26/.14(m[2]))z=E.1x(a,m[2])||\'\';9((O==""&&!!z||O=="="&&z==m[5]||O=="!="&&z!=m[5]||O=="^="&&z&&!z.1g(m[5])||O=="$="&&z.68(z.K-m[5].K)==m[5]||(O=="*="||O=="~=")&&z.1g(m[5])>=0)^h)g.1a(a)}r=g}J 9(m[1]==":"&&m[2]=="2I-46"){H e={},g=[],14=/(\\d*)n\\+?(\\d*)/.2S(m[3]=="6f"&&"2n"||m[3]=="6e"&&"2n+1"||!/\\D/.14(m[3])&&"n+"+m[3]||m[3]),3v=(14[1]||1)-0,d=14[2]-0;L(H i=0,31=r.K;i<31;i++){H j=r[i],12=j.12,22=E.M(12);9(!e[22]){H c=1;L(H n=12.1w;n;n=n.2q)9(n.1y==1)n.4U=c++;e[22]=Q}H b=P;9(3v==1){9(d==0||j.4U==d)b=Q}J 9((j.4U+d)%3v==0)b=Q;9(b^h)g.1a(j)}r=g}J{H f=E.55[m[1]];9(1m f!="1M")f=E.55[m[1]][m[2]];f=3w("P||G(a,i){I "+f+"}");r=E.2W(r,f,h)}}I{r:r,t:t}},4e:G(b,c){H d=[];H a=b[c];1W(a&&a!=U){9(a.1y==1)d.1a(a);a=a[c]}I d},2I:G(a,e,c,b){e=e||1;H d=0;L(;a;a=a[c])9(a.1y==1&&++d==e)1T;I a},5d:G(n,a){H r=[];L(;n;n=n.2q){9(n.1y==1&&(!a||n!=a))r.1a(n)}I r}});E.1j={1f:G(g,e,c,h){9(E.V.1h&&g.4j!=W)g=18;9(!c.2u)c.2u=6.2u++;9(h!=W){H d=c;c=G(){I d.16(6,1q)};c.M=h;c.2u=d.2u}H i=e.2l(".");e=i[0];c.O=i[1];H b=E.M(g,"2P")||E.M(g,"2P",{});H f=E.M(g,"2t",G(){H a;9(1m E=="W"||E.1j.4T)I a;a=E.1j.2t.16(g,1q);I a});H j=b[e];9(!j){j=b[e]={};9(g.4S)g.4S(e,f,P);J g.7N("43"+e,f)}j[c.2u]=c;6.1Z[e]=Q},2u:1,1Z:{},28:G(d,c,b){H e=E.M(d,"2P"),2L,4I;9(1m c=="1M"){H a=c.2l(".");c=a[0]}9(e){9(c&&c.O){b=c.4Q;c=c.O}9(!c){L(c 1i e)6.28(d,c)}J 9(e[c]){9(b)2E e[c][b.2u];J L(b 1i e[c])9(!a[1]||e[c][b].O==a[1])2E e[c][b];L(2L 1i e[c])1T;9(!2L){9(d.4P)d.4P(c,E.M(d,"2t"),P);J d.7M("43"+c,E.M(d,"2t"));2L=S;2E e[c]}}L(2L 1i e)1T;9(!2L){E.30(d,"2P");E.30(d,"2t")}}},1F:G(d,b,e,c,f){b=E.2h(b||[]);9(!e){9(6.1Z[d])E("*").1f([18,U]).1F(d,b)}J{H a,2L,1b=E.1n(e[d]||S),4N=!b[0]||!b[0].2M;9(4N)b.4w(6.4M({O:d,2m:e}));b[0].O=d;9(E.1n(E.M(e,"2t")))a=E.M(e,"2t").16(e,b);9(!1b&&e["43"+d]&&e["43"+d].16(e,b)===P)a=P;9(4N)b.44();9(f&&f.16(e,b)===P)a=P;9(1b&&c!==P&&a!==P&&!(E.11(e,\'a\')&&d=="4L")){6.4T=Q;e[d]()}6.4T=P}I a},2t:G(d){H a;d=E.1j.4M(d||18.1j||{});H b=d.O.2l(".");d.O=b[0];H c=E.M(6,"2P")&&E.M(6,"2P")[d.O],3q=1B.3A.2J.2O(1q,1);3q.4w(d);L(H j 1i c){3q[0].4Q=c[j];3q[0].M=c[j].M;9(!b[1]||c[j].O==b[1]){H e=c[j].16(6,3q);9(a!==P)a=e;9(e===P){d.2M();d.3p()}}}9(E.V.1h)d.2m=d.2M=d.3p=d.4Q=d.M=S;I a},4M:G(c){H a=c;c=E.1k({},a);c.2M=G(){9(a.2M)a.2M();a.7L=P};c.3p=G(){9(a.3p)a.3p();a.7K=Q};9(!c.2m&&c.65)c.2m=c.65;9(E.V.1N&&c.2m.1y==3)c.2m=a.2m.12;9(!c.4K&&c.4J)c.4K=c.4J==c.2m?c.7H:c.4J;9(c.64==S&&c.63!=S){H e=U.2V,b=U.1G;c.64=c.63+(e&&e.2R||b.2R||0);c.7E=c.7D+(e&&e.2B||b.2B||0)}9(!c.3Y&&(c.61||c.60))c.3Y=c.61||c.60;9(!c.5F&&c.5D)c.5F=c.5D;9(!c.3Y&&c.2r)c.3Y=(c.2r&1?1:(c.2r&2?3:(c.2r&4?2:0)));I c}};E.1b.1k({3W:G(c,a,b){I c=="5Y"?6.2G(c,a,b):6.N(G(){E.1j.1f(6,c,b||a,b&&a)})},2G:G(d,b,c){I 6.N(G(){E.1j.1f(6,d,G(a){E(6).5X(a);I(c||b).16(6,1q)},c&&b)})},5X:G(a,b){I 6.N(G(){E.1j.28(6,a,b)})},1F:G(c,a,b){I 6.N(G(){E.1j.1F(c,a,6,Q,b)})},7x:G(c,a,b){9(6[0])I E.1j.1F(c,a,6[0],P,b)},25:G(){H a=1q;I 6.4L(G(e){6.4H=0==6.4H?1:0;e.2M();I a[6.4H].16(6,[e])||P})},7v:G(f,g){G 4G(e){H p=e.4K;1W(p&&p!=6)2a{p=p.12}29(e){p=6};9(p==6)I P;I(e.O=="4x"?f:g).16(6,[e])}I 6.4x(4G).5U(4G)},2d:G(f){5T();9(E.3T)f.16(U,[E]);J E.3l.1a(G(){I f.16(6,[E])});I 6}});E.1k({3T:P,3l:[],2d:G(){9(!E.3T){E.3T=Q;9(E.3l){E.N(E.3l,G(){6.16(U)});E.3l=S}9(E.V.35||E.V.34)U.4P("5S",E.2d,P);9(!18.7t.K)E(18).39(G(){E("#4E").28()})}}});E.N(("7s,7r,39,7q,6n,5Y,4L,7p,"+"7n,7m,7l,4x,5U,7k,24,"+"51,7j,7i,7h,3U").2l(","),G(i,o){E.1b[o]=G(f){I f?6.3W(o,f):6.1F(o)}});H x=P;G 5T(){9(x)I;x=Q;9(E.V.35||E.V.34)U.4S("5S",E.2d,P);J 9(E.V.1h){U.7f("<7d"+"7y 22=4E 7z=Q "+"3k=//:><\\/1J>");H a=U.3S("4E");9(a)a.62=G(){9(6.2C!="1l")I;E.2d()};a=S}J 9(E.V.1N)E.4B=4j(G(){9(U.2C=="5Q"||U.2C=="1l"){4A(E.4B);E.4B=S;E.2d()}},10);E.1j.1f(18,"39",E.2d)}E.1b.1k({39:G(g,d,c){9(E.1n(g))I 6.3W("39",g);H e=g.1g(" ");9(e>=0){H i=g.2J(e,g.K);g=g.2J(0,e)}c=c||G(){};H f="4z";9(d)9(E.1n(d)){c=d;d=S}J{d=E.3a(d);f="5P"}H h=6;E.3G({1d:g,O:f,M:d,1l:G(a,b){9(b=="1C"||b=="5O")h.4o(i?E("<1s/>").3g(a.40.1p(/<1J(.|\\s)*?\\/1J>/g,"")).1Y(i):a.40);56(G(){h.N(c,[a.40,b,a])},13)}});I 6},7a:G(){I E.3a(6.5M())},5M:G(){I 6.1X(G(){I E.11(6,"2Y")?E.2h(6.79):6}).1E(G(){I 6.2H&&!6.3c&&(6.2Q||/24|6b/i.14(6.11)||/2g|1P|52/i.14(6.O))}).1X(G(i,c){H b=E(6).3i();I b==S?S:b.1c==1B?E.1X(b,G(a,i){I{2H:c.2H,1Q:a}}):{2H:c.2H,1Q:b}}).21()}});E.N("5L,5K,6t,5J,5I,5H".2l(","),G(i,o){E.1b[o]=G(f){I 6.3W(o,f)}});H B=(1u 3D).3B();E.1k({21:G(d,b,a,c){9(E.1n(b)){a=b;b=S}I E.3G({O:"4z",1d:d,M:b,1C:a,1V:c})},78:G(b,a){I E.21(b,S,a,"1J")},77:G(c,b,a){I E.21(c,b,a,"45")},76:G(d,b,a,c){9(E.1n(b)){a=b;b={}}I E.3G({O:"5P",1d:d,M:b,1C:a,1V:c})},75:G(a){E.1k(E.59,a)},59:{1Z:Q,O:"4z",2z:0,5G:"74/x-73-2Y-72",6o:Q,3e:Q,M:S},49:{},3G:G(s){H f,2y=/=(\\?|%3F)/g,1v,M;s=E.1k(Q,s,E.1k(Q,{},E.59,s));9(s.M&&s.6o&&1m s.M!="1M")s.M=E.3a(s.M);9(s.1V=="4b"){9(s.O.2p()=="21"){9(!s.1d.1t(2y))s.1d+=(s.1d.1t(/\\?/)?"&":"?")+(s.4b||"5E")+"=?"}J 9(!s.M||!s.M.1t(2y))s.M=(s.M?s.M+"&":"")+(s.4b||"5E")+"=?";s.1V="45"}9(s.1V=="45"&&(s.M&&s.M.1t(2y)||s.1d.1t(2y))){f="4b"+B++;9(s.M)s.M=s.M.1p(2y,"="+f);s.1d=s.1d.1p(2y,"="+f);s.1V="1J";18[f]=G(a){M=a;1C();1l();18[f]=W;2a{2E 18[f]}29(e){}}}9(s.1V=="1J"&&s.1L==S)s.1L=P;9(s.1L===P&&s.O.2p()=="21")s.1d+=(s.1d.1t(/\\?/)?"&":"?")+"57="+(1u 3D()).3B();9(s.M&&s.O.2p()=="21"){s.1d+=(s.1d.1t(/\\?/)?"&":"?")+s.M;s.M=S}9(s.1Z&&!E.5b++)E.1j.1F("5L");9(!s.1d.1g("8g")&&s.1V=="1J"){H h=U.4l("9U")[0];H g=U.5B("1J");g.3k=s.1d;9(!f&&(s.1C||s.1l)){H j=P;g.9R=g.62=G(){9(!j&&(!6.2C||6.2C=="5Q"||6.2C=="1l")){j=Q;1C();1l();h.3b(g)}}}h.58(g);I}H k=P;H i=18.6X?1u 6X("9P.9O"):1u 6W();i.9M(s.O,s.1d,s.3e);9(s.M)i.5C("9J-9I",s.5G);9(s.5y)i.5C("9H-5x-9F",E.49[s.1d]||"9D, 9C 9B 9A 5v:5v:5v 9z");i.5C("X-9x-9v","6W");9(s.6U)s.6U(i);9(s.1Z)E.1j.1F("5H",[i,s]);H c=G(a){9(!k&&i&&(i.2C==4||a=="2z")){k=Q;9(d){4A(d);d=S}1v=a=="2z"&&"2z"||!E.6S(i)&&"3U"||s.5y&&E.6R(i,s.1d)&&"5O"||"1C";9(1v=="1C"){2a{M=E.6Q(i,s.1V)}29(e){1v="5k"}}9(1v=="1C"){H b;2a{b=i.5s("6P-5x")}29(e){}9(s.5y&&b)E.49[s.1d]=b;9(!f)1C()}J E.5r(s,i,1v);1l();9(s.3e)i=S}};9(s.3e){H d=4j(c,13);9(s.2z>0)56(G(){9(i){i.9q();9(!k)c("2z")}},s.2z)}2a{i.9o(s.M)}29(e){E.5r(s,i,S,e)}9(!s.3e)c();I i;G 1C(){9(s.1C)s.1C(M,1v);9(s.1Z)E.1j.1F("5I",[i,s])}G 1l(){9(s.1l)s.1l(i,1v);9(s.1Z)E.1j.1F("6t",[i,s]);9(s.1Z&&!--E.5b)E.1j.1F("5K")}},5r:G(s,a,b,e){9(s.3U)s.3U(a,b,e);9(s.1Z)E.1j.1F("5J",[a,s,e])},5b:0,6S:G(r){2a{I!r.1v&&9n.9l=="54:"||(r.1v>=6N&&r.1v<9j)||r.1v==6M||E.V.1N&&r.1v==W}29(e){}I P},6R:G(a,c){2a{H b=a.5s("6P-5x");I a.1v==6M||b==E.49[c]||E.V.1N&&a.1v==W}29(e){}I P},6Q:G(r,b){H c=r.5s("9i-O");H d=b=="6K"||!b&&c&&c.1g("6K")>=0;H a=d?r.9g:r.40;9(d&&a.2V.37=="5k")6G"5k";9(b=="1J")E.5f(a);9(b=="45")a=3w("("+a+")");I a},3a:G(a){H s=[];9(a.1c==1B||a.4c)E.N(a,G(){s.1a(3f(6.2H)+"="+3f(6.1Q))});J L(H j 1i a)9(a[j]&&a[j].1c==1B)E.N(a[j],G(){s.1a(3f(j)+"="+3f(6))});J s.1a(3f(j)+"="+3f(a[j]));I s.66("&").1p(/%20/g,"+")}});E.1b.1k({1A:G(b,a){I b?6.1U({1H:"1A",2N:"1A",1r:"1A"},b,a):6.1E(":1P").N(G(){6.R.19=6.3h?6.3h:"";9(E.17(6,"19")=="2s")6.R.19="2Z"}).2D()},1z:G(b,a){I b?6.1U({1H:"1z",2N:"1z",1r:"1z"},b,a):6.1E(":3R").N(G(){6.3h=6.3h||E.17(6,"19");9(6.3h=="2s")6.3h="2Z";6.R.19="2s"}).2D()},6J:E.1b.25,25:G(a,b){I E.1n(a)&&E.1n(b)?6.6J(a,b):a?6.1U({1H:"25",2N:"25",1r:"25"},a,b):6.N(G(){E(6)[E(6).3t(":1P")?"1A":"1z"]()})},9c:G(b,a){I 6.1U({1H:"1A"},b,a)},9b:G(b,a){I 6.1U({1H:"1z"},b,a)},99:G(b,a){I 6.1U({1H:"25"},b,a)},98:G(b,a){I 6.1U({1r:"1A"},b,a)},96:G(b,a){I 6.1U({1r:"1z"},b,a)},95:G(c,a,b){I 6.1U({1r:a},c,b)},1U:G(k,i,h,g){H j=E.6D(i,h,g);I 6[j.3L===P?"N":"3L"](G(){j=E.1k({},j);H f=E(6).3t(":1P"),3y=6;L(H p 1i k){9(k[p]=="1z"&&f||k[p]=="1A"&&!f)I E.1n(j.1l)&&j.1l.16(6);9(p=="1H"||p=="2N"){j.19=E.17(6,"19");j.2U=6.R.2U}}9(j.2U!=S)6.R.2U="1P";j.3M=E.1k({},k);E.N(k,G(c,a){H e=1u E.2j(3y,j,c);9(/25|1A|1z/.14(a))e[a=="25"?f?"1A":"1z":a](k);J{H b=a.3s().1t(/^([+-]=)?([\\d+-.]+)(.*)$/),1O=e.2b(Q)||0;9(b){H d=3I(b[2]),2i=b[3]||"2T";9(2i!="2T"){3y.R[c]=(d||1)+2i;1O=((d||1)/e.2b(Q))*1O;3y.R[c]=1O+2i}9(b[1])d=((b[1]=="-="?-1:1)*d)+1O;e.3N(1O,d,2i)}J e.3N(1O,a,"")}});I Q})},3L:G(a,b){9(E.1n(a)){b=a;a="2j"}9(!a||(1m a=="1M"&&!b))I A(6[0],a);I 6.N(G(){9(b.1c==1B)A(6,a,b);J{A(6,a).1a(b);9(A(6,a).K==1)b.16(6)}})},9f:G(){H a=E.32;I 6.N(G(){L(H i=0;i-8O?r:3I(E.17(6.T,6.1e))||0},3N:G(c,b,e){6.5u=(1u 3D()).3B();6.1O=c;6.2D=b;6.2i=e||6.2i||"2T";6.2v=6.1O;6.4q=6.4i=0;6.4r();H f=6;G t(){I f.2F()}t.T=6.T;E.32.1a(t);9(E.32.K==1){H d=4j(G(){H a=E.32;L(H i=0;i6.Y.2e+6.5u){6.2v=6.2D;6.4q=6.4i=1;6.4r();6.Y.3M[6.1e]=Q;H a=Q;L(H i 1i 6.Y.3M)9(6.Y.3M[i]!==Q)a=P;9(a){9(6.Y.19!=S){6.T.R.2U=6.Y.2U;6.T.R.19=6.Y.19;9(E.17(6.T,"19")=="2s")6.T.R.19="2Z"}9(6.Y.1z)6.T.R.19="2s";9(6.Y.1z||6.Y.1A)L(H p 1i 6.Y.3M)E.1x(6.T.R,p,6.Y.3P[p])}9(a&&E.1n(6.Y.1l))6.Y.1l.16(6.T);I P}J{H n=t-6.5u;6.4i=n/6.Y.2e;6.4q=E.3J[6.Y.3J||(E.3J.5q?"5q":"6B")](6.4i,n,0,1,6.Y.2e);6.2v=6.1O+((6.2D-6.1O)*6.4q);6.4r()}I Q}};E.2j.2F={2R:G(a){a.T.2R=a.2v},2B:G(a){a.T.2B=a.2v},1r:G(a){E.1x(a.T.R,"1r",a.2v)},6z:G(a){a.T.R[a.1e]=a.2v+a.2i}};E.1b.6m=G(){H c=0,3E=0,T=6[0],5t;9(T)8L(E.V){H b=E.17(T,"2X")=="4F",1D=T.12,23=T.23,2K=T.3H,4f=1N&&3x(4s)<8J;9(T.6V){5w=T.6V();1f(5w.1S+38.33(2K.2V.2R,2K.1G.2R),5w.3E+38.33(2K.2V.2B,2K.1G.2B));9(1h){H d=E("4o").17("8H");d=(d=="8G"||E.5g&&3x(4s)>=7)&&2||d;1f(-d,-d)}}J{1f(T.5l,T.5z);1W(23){1f(23.5l,23.5z);9(35&&/^t[d|h]$/i.14(1D.37)||!4f)d(23);9(4f&&!b&&E.17(23,"2X")=="4F")b=Q;23=23.23}1W(1D.37&&!/^1G|4o$/i.14(1D.37)){9(!/^8D|1I-9S.*$/i.14(E.17(1D,"19")))1f(-1D.2R,-1D.2B);9(35&&E.17(1D,"2U")!="3R")d(1D);1D=1D.12}9(4f&&b)1f(-2K.1G.5l,-2K.1G.5z)}5t={3E:3E,1S:c}}I 5t;G d(a){1f(E.17(a,"9T"),E.17(a,"8A"))}G 1f(l,t){c+=3x(l)||0;3E+=3x(t)||0}}})();',62,616,'||||||this|||if|||||||||||||||||||||||||||||||||function|var|return|else|length|for|data|each|type|false|true|style|null|elem|document|browser|undefined||options|||nodeName|parentNode||test|jQuery|apply|css|window|display|push|fn|constructor|url|prop|add|indexOf|msie|in|event|extend|complete|typeof|isFunction|className|replace|arguments|opacity|div|match|new|status|firstChild|attr|nodeType|hide|show|Array|success|parent|filter|trigger|body|height|table|script|tbody|cache|string|safari|start|hidden|value|merge|left|break|animate|dataType|while|map|find|global||get|id|offsetParent|select|toggle|selected|toUpperCase|remove|catch|try|cur|al|ready|duration|done|text|makeArray|unit|fx|swap|split|target||pushStack|toLowerCase|nextSibling|button|none|handle|guid|now|stack|tb|jsre|timeout|inArray|scrollTop|readyState|end|delete|step|one|name|nth|slice|doc|ret|preventDefault|width|call|events|checked|scrollLeft|exec|px|overflow|documentElement|grep|position|form|block|removeData|rl|timers|max|opera|mozilla|trim|tagName|Math|load|param|removeChild|disabled|insertBefore|async|encodeURIComponent|append|oldblock|val|childNodes|src|readyList|multiFilter|color|defaultView|stopPropagation|args|old|toString|is|last|first|eval|parseInt|self|domManip|prototype|getTime|curCSS|Date|top||ajax|ownerDocument|parseFloat|easing|has|queue|curAnim|custom|innerHTML|orig|currentStyle|visible|getElementById|isReady|error|static|bind|String|which|getComputedStyle|responseText|oWidth|oHeight|on|shift|json|child|RegExp|ol|lastModified|isXMLDoc|jsonp|jquery|previousSibling|dir|safari2|el|styleFloat|state|setInterval|radio|getElementsByTagName|tr|empty|html|getAttribute|pos|update|version|input|float|runtimeStyle|unshift|mouseover|getPropertyValue|GET|clearInterval|safariTimer|visibility|clean|__ie_init|absolute|handleHover|lastToggle|index|fromElement|relatedTarget|click|fix|evt|andSelf|removeEventListener|handler|cloneNode|addEventListener|triggered|nodeIndex|unique|Number|classFilter|prevObject|selectedIndex|after|submit|password|removeAttribute|file|expr|setTimeout|_|appendChild|ajaxSettings|client|active|win|sibling|deep|globalEval|boxModel|cssFloat|object|checkbox|parsererror|offsetLeft|wrapAll|dequeue|props|lastChild|swing|handleError|getResponseHeader|results|startTime|00|box|Modified|ifModified|offsetTop|evalScript|createElement|setRequestHeader|ctrlKey|callback|metaKey|contentType|ajaxSend|ajaxSuccess|ajaxError|ajaxStop|ajaxStart|serializeArray|init|notmodified|POST|loaded|appendTo|DOMContentLoaded|bindReady|mouseout|not|removeAttr|unbind|unload|Width|keyCode|charCode|onreadystatechange|clientX|pageX|srcElement|join|outerHTML|substr|zoom|parse|textarea|reset|image|odd|even|before|quickClass|quickID|prepend|quickChild|execScript|offset|scroll|processData|uuid|contents|continue|textContent|ajaxComplete|clone|setArray|webkit|nodeValue|fl|_default|100|linear|href|speed|eq|createTextNode|throw|replaceWith|splice|_toggle|xml|colgroup|304|200|alpha|Last|httpData|httpNotModified|httpSuccess|fieldset|beforeSend|getBoundingClientRect|XMLHttpRequest|ActiveXObject|col|br|abbr|pixelLeft|urlencoded|www|application|ajaxSetup|post|getJSON|getScript|elements|serialize|clientWidth|hasClass|scr|clientHeight|write|relative|keyup|keypress|keydown|change|mousemove|mouseup|mousedown|right|dblclick|resize|focus|blur|frames|instanceof|hover|offsetWidth|triggerHandler|ipt|defer|offsetHeight|border|padding|clientY|pageY|Left|Right|toElement|Bottom|Top|cancelBubble|returnValue|detachEvent|attachEvent|substring|line|weight|animated|header|font|enabled|innerText|contains|only|size|gt|lt|uFFFF|u0128|417|inner|Height|toggleClass|removeClass|addClass|replaceAll|noConflict|insertAfter|prependTo|wrap|contentWindow|contentDocument|http|iframe|children|siblings|prevAll|nextAll|wrapInner|prev|Boolean|next|parents|maxLength|maxlength|readOnly|readonly|class|htmlFor|CSS1Compat|compatMode|compatible|borderTopWidth|ie|ra|inline|it|rv|medium|borderWidth|userAgent|522|navigator|with|concat|1px|10000|array|ig|PI|NaN|400|reverse|fast|600|slow|Function|Object|setAttribute|changed|be|can|property|fadeTo|fadeOut|getAttributeNode|fadeIn|slideToggle|method|slideUp|slideDown|action|cssText|stop|responseXML|option|content|300|th|protocol|td|location|send|cap|abort|colg|cos|tfoot|thead|With|leg|Requested|opt|GMT|1970|Jan|01|Thu|area|Since|hr|If|Type|Content|meta|specified|open|link|XMLHTTP|Microsoft|img|onload|row|borderLeftWidth|head|attributes'.split('|'),0,{}))
diff --git a/webroot/js/jsonschema.js b/webroot/js/jsonschema.js
deleted file mode 100644
index 33dc7f5..0000000
--- a/webroot/js/jsonschema.js
+++ /dev/null
@@ -1,213 +0,0 @@
-/**
- * JSONSchema Validator - Validates JavaScript objects using JSON Schemas
- * (http://www.json.com/json-schema-proposal/)
- *
- * Copyright (c) 2007 Kris Zyp SitePen (www.sitepen.com)
- * Licensed under the MIT (MIT-LICENSE.txt) licence.
-To use the validator call JSONSchema.validate with an instance object and an optional schema object.
-If a schema is provided, it will be used to validate. If the instance object refers to a schema (self-validating),
-that schema will be used to validate and the schema parameter is not necessary (if both exist,
-both validations will occur).
-The validate method will return an array of validation errors. If there are no errors, then an
-empty list will be returned. A validation error will have two properties:
-"property" which indicates which property had the error
-"message" which indicates what the error was
- */
-
-JSONSchema = {
- validate : function(/*Any*/instance,/*Object*/schema) {
- // Summary:
- // To use the validator call JSONSchema.validate with an instance object and an optional schema object.
- // If a schema is provided, it will be used to validate. If the instance object refers to a schema (self-validating),
- // that schema will be used to validate and the schema parameter is not necessary (if both exist,
- // both validations will occur).
- // The validate method will return an object with two properties:
- // valid: A boolean indicating if the instance is valid by the schema
- // errors: An array of validation errors. If there are no errors, then an
- // empty list will be returned. A validation error will have two properties:
- // property: which indicates which property had the error
- // message: which indicates what the error was
- //
- return this._validate(instance,schema,false);
- },
- checkPropertyChange : function(/*Any*/value,/*Object*/schema) {
- // Summary:
- // The checkPropertyChange method will check to see if an value can legally be in property with the given schema
- // This is slightly different than the validate method in that it will fail if the schema is readonly and it will
- // not check for self-validation, it is assumed that the passed in value is already internally valid.
- // The checkPropertyChange method will return the same object type as validate, see JSONSchema.validate for
- // information.
- //
- return this._validate(value,schema,true);
- },
- _validate : function(/*Any*/instance,/*Object*/schema,/*Boolean*/ _changing) {
-
-
- var errors2 = [];
- // validate a value against a property definition
-
- function checkProp(value, schema, path,i) {
- if (typeof schema != 'object') {
- return;
- }
- path += path ? typeof i == 'number' ? '[' + i + ']' : typeof i == 'undefined' ? '' : '.' + i : i;
- function addError(message) {
- errors2.push({property:path,message:message});
- }
- if (_changing && schema.readonly)
- addError("is a readonly field, it can not be changed");
-/*
-if (schema instanceof Array) {
- if (!(value instanceof Array)) {
- return [{property:path,message:"An array tuple is required"}];
- }
- for (i =0; i < schema.length; i++) {
- errors2.concat(checkProp(value[i],schema[i],path,i));
- }
- return errors2;
-}
-*/
- if (schema['extends']) // if it extends another schema, it must pass that schema as well
- checkProp(value,schema['extends'],path,i);
- // validate a value against a type definition
- function checkType(type,value) {
- if (type) {
- if (typeof type == 'string' && type != 'any'
- && (type == 'null' ? value !== null : typeof value != type)
- && !(value instanceof Array && type == 'array')
- && !(type == 'integer' && !(value%1)))
- return [{property:path,message:(typeof value) + " value found, but a " + type + " is required"}];
- if (type instanceof Array) {
- var unionErrors=[];
- for (var j = 0; j < type.length; j++) // a union type
- if (!(unionErrors=checkType(type[j],value)).length)
- break;
- if (unionErrors.length)
- return unionErrors;
- }
- else if (typeof type == 'object') {
- checkProp(value,type,path);
- }
- }
- return [];
- }
-
- //if (value !== null) {
- if (value === undefined) {
- if (!schema.optional)
- addError("is missing and it is not optional");
- }
- else {
- errors2 = errors2.concat(checkType(schema.type,value));
- if (schema.disallow && !checkType(schema.disallow,value).length)
- addError(" disallowed value was matched");
- if (value instanceof Array) {
- if (schema.items) {
- if(schema.items instanceof Array) {
- for (var k = 0,l=value.length; k < l; k++) {
- if(k < schema.items.length) {
- errors2.concat(checkProp(value[k],schema.items[k],path,k));
- }
- else {
- if(schema.additionalProperties !== undefined) {
- if(schema.additionalProperties === false) {
- addError("The item " + i + "[" + k + "] is not defined in the objTypeDef and the objTypeDef does not allow additional properties");
- }
- else {
- errors2.concat(checkProp(value[k],schema.additionalProperties,path,k));
- }
- }
- }
- }
- if(value.length < schema.items.length) {
- for (var k = value.length; k < schema.items.length; k++) {
- errors2.concat(checkProp(undefined,schema.items[k],path,k));
- }
- }
- }
- else {
- for (var i =0,l=value.length; i < l; i++) {
- errors2.concat(checkProp(value[i],schema.items,path,i));
- }
- }
- }
- if (schema.minItems && value.length < schema.minItems) {
- addError("There must be a minimum of " + schema.minItems + " in the array");
- }
- if (schema.maxItems && value.length > schema.maxItems) {
- addError("There must be a maximum of " + schema.maxItems + " in the array");
- }
- }
- else if (schema.properties && typeof value == 'object') {
- errors2.concat(checkObj(value,schema.properties,path,schema.additionalProperties));
- }
- if (schema.pattern && typeof value == 'string' && !value.match(schema.pattern))
- addError("does not match the regex pattern " + schema.pattern);
- if (schema.maxLength && typeof value == 'string' && (value.length > schema.maxLength))
- addError("may only be " + schema.maxLength + " characters long");
- if (schema.minLength && typeof value == 'string' && (value.length < schema.minLength))
- addError("must be at least " + schema.minLength + " characters long");
- if (typeof schema.minimum !== undefined && typeof value == typeof schema.minimum && schema.minimum > value)
- addError("must have a minimum value of " + schema.minimum);
- if (typeof schema.maximum !== undefined && typeof value == typeof schema.maximum && schema.maximum < value)
- addError("must have a maximum value of " + schema.maximum);
- if (schema['enum']) {
- var enumer = schema['enum'];
- var l = enumer.length;
- var found;
- for (var j = 0; j < l; j++)
- if (enumer[j]===value) {
- found=1;
- break;
- }
- if (!found) {
- addError("does not have a value in the enumeration " + enumer.join(", "));
- }
- }
- if (typeof schema.maxDecimal == 'number' && (value * Math.pow(10,schema.maxDecimal))%1) {
- addError("may only have " + schema.maxDecimal + " digits of decimal places");
- }
- }
- //}
-
- }
- // validate an object against a schema
- function checkObj(instance,objTypeDef,path,additionalProp) {
- if (typeof objTypeDef =='object') {
- if (typeof instance != 'object' || instance instanceof Array)
- errors2.push({property:path,message:"an object is required"});
-
- for (var i in objTypeDef)
- if (objTypeDef.hasOwnProperty(i)) {
- var value = instance[i];
- var propDef = objTypeDef[i];
- checkProp(value,propDef,path,i);
- }
- }
- for (var i in instance) {
- if (instance.hasOwnProperty(i) && objTypeDef && !objTypeDef[i] && additionalProp===false)
- errors2.push({property:path,message:(typeof value) + "The property " + i + " is not defined in the objTypeDef and the objTypeDef does not allow additional properties"});
- var requires = objTypeDef && objTypeDef[i] && objTypeDef[i].requires;
- if (requires && !(requires in instance))
- errors2.push({property:path,message:"the presence of the property " + i + " requires that " + requires + " also be present"});
- value = instance[i];
- if (objTypeDef && typeof objTypeDef == 'object' && !(i in objTypeDef))
- checkProp(value,additionalProp,path,i);
-// if (!_changing && value && value.type)
- // errors2 = errors2.concat(checkObj(value,value.type,path + '.' + i));
- if (!_changing && value && value.$schema)
- errors2 = errors2.concat(checkProp(value,value.$schema,path,i));
- }
- return errors2;
- }
- if (schema)
- checkProp(instance,schema,'','')
- if (!_changing && instance.$schema)
- checkProp(instance,instance.$schema,'','');
- return {valid:!errors2.length,errors:errors2};
- }
- /* will add this later
- newFromSchema : function() {
- }
-*/
-}
diff --git a/webroot/tests/validate.php b/webroot/tests/validate.php
deleted file mode 100644
index ea5b2e5..0000000
--- a/webroot/tests/validate.php
+++ /dev/null
@@ -1,30 +0,0 @@
-
\ No newline at end of file
diff --git a/webroot/tests/validator.html b/webroot/tests/validator.html
deleted file mode 100644
index 3f7f8b7..0000000
--- a/webroot/tests/validator.html
+++ /dev/null
@@ -1,50 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- JSON
-
- |
-
- Schema:
-
- |
-
-
-
-
-
-
-...
-
-
\ No newline at end of file