Ejemplo n.º 1
0
 protected function mapToType($key, $value)
 {
     $type = $this->getTypeFromKey($key);
     $outValue = $value;
     if (isset($type)) {
         $value = WebUtilities::getInstance()->convertToType($value, $type);
     }
     return $value;
 }
Ejemplo n.º 2
0
 /**
  * On construction the url is parsed into pieces.
  */
 function __construct()
 {
     $util = WebUtilities::getInstance();
     $this->protocol = strpos(strtolower($util->getValue($_SERVER, ServerVariables::PROTOCOL)), Protocols::HTTPS) === FALSE ? Protocols::HTTP : Protocols::HTTPS;
     $this->hostName = $util->getValue($_SERVER, ServerVariables::HTTP_HOST);
     $this->pageName = $util->getValue($_SERVER, ServerVariables::SCRIPT_NAME);
     $this->queryString = $util->getValue($_SERVER, ServerVariables::QUERY_STRING);
     $this->url = $util->getValue($_SERVER, ServerVariables::REQUEST_URI);
     $this->requestMethod = $util->getValue($_SERVER, ServerVariables::REQUEST_METHOD);
     $this->referer = $util->getValue($_SERVER, ServerVariables::HTTP_REFERER);
     $this->webUtil = WebUtilities::getInstance();
 }
Ejemplo n.º 3
0
 private function validateCardCode($cardCode)
 {
     $util = WebUtilities::getInstance();
     $error = null;
     if (!$util->hasValue($cardCode)) {
         $error = $util->getString("errorCreditCardCodeRequired");
     } else {
         if (!preg_match("/^[0-9]{3,4}\$/", $cardCode)) {
             $error = $util->getString("errorCreditCardCodeInvalid");
         }
     }
     return $error;
 }
Ejemplo n.º 4
0
 /**
  * Controller constructor
  *
  * @param Kohva\Scotch\Routers\Router $router the router for the controller
  */
 function __construct($router = null)
 {
     $this->util = WebUtilities::getInstance();
     $this->router = $router;
 }
Ejemplo n.º 5
0
 private function validateRoutingNumber($routingNumber)
 {
     $util = WebUtilities::getInstance();
     $error = null;
     if (!$util->hasValue($routingNumber)) {
         $error = $util->getString("errorRoutingNumberRequired");
     } else {
         if (!preg_match("/^[0-9]{9}\$/", $routingNumber)) {
             $error = $util->getString("errorRoutingNumberInvalid");
         }
     }
     return $error;
 }
Ejemplo n.º 6
0
 function __construct($properties = null)
 {
     $this->util = WebUtilities::getInstance();
 }