Exemple #1
0
 public function isValid($value)
 {
     // this line populates the "%value%" variables in the error messages
     $this->_setValue($value);
     // check format
     if (!Inspekt::isUri($value)) {
         // this line will insert the error message in the list of errors to
         // be returned to the caller
         $this->_error(self::NOT_URI);
         return false;
     }
     return true;
 }
Exemple #2
0
 /**
  * Enter description here...
  *
  * @param unknown_type $key
  * @return unknown
  *
  * @tag validator
  */
 function testUri($key)
 {
     if (!$this->keyExists($key)) {
         return false;
     }
     if (Inspekt::isUri($this->_getValue($key))) {
         return $this->_getValue($key);
     }
     return FALSE;
 }
 /**
  * 
  */
 public function testIsUri9()
 {
     $input = 'http://news.bbc.co.uk/2/hi/middle_east/8277040.stm';
     $this->assertTrue(Inspekt::isUri($input));
 }
Exemple #4
0
<?php

set_include_path(get_include_path() . PATH_SEPARATOR . dirname(dirname(__FILE__)));
require_once 'Inspekt.php';
$URIs = array('//lessthan', 'ftp://*****:*****@123.444.999.12/', 'http://spinaltap.micro.umn.edu/00/Weather/California/Los%lngeles', 'http://funkatron.com/////////12341241', 'http://funkatron.com:12', 'http://funkatron.com:8000/#foo', 'https://funkatron.com', 'https://funkatron.com:42/funky.php?foo[]=bar', 'http://www.w3.org/2001/XMLSchema');
foreach ($URIs as $uri) {
    echo 'Testing ' . $uri . '<br/>';
    $rs = Inspekt::isUri($uri);
    echo "<pre>";
    echo var_dump($rs);
    echo "</pre>\n";
    //echo "<pre>"; echo var_dump(); echo "</pre>\n";
    echo "<hr>";
}
Exemple #5
0
 /**
  * Enter description here...
  *
  * @param string $key
  * @return bool|string
  * @throws Exception
  * @tag validator
  */
 public function testUri($key)
 {
     $value = $this->getValueOrNull($key);
     if (!is_null($value) && Inspekt::isUri($value)) {
         return $value;
     }
     return false;
 }