Ejemplo n.º 1
0
        } elseif (strpos($regex, 'Windows XP')) {
            return $regex = "Windows XP";
        } elseif (strpos($regex, 'Macintosh|Mac OS X')) {
            return $regex = "Mac OS X";
        } elseif (strpos($regex, 'Mac_PowerPC')) {
            return $regex = "Mac OS 9";
        } elseif (strpos($regex, 'Linux')) {
            return $regex = "Linux";
        } elseif (strpos($regex, 'Ubuntu Linux')) {
            return $regex = "Linux Ubuntu";
        } elseif (strpos($regex, 'iPhone')) {
            return $regex = "iPhone";
        } elseif (strpos($regex, 'iPod')) {
            return $regex = "iPod";
        } elseif (strpos($regex, 'iPad')) {
            return $regex = "iPad";
        } elseif (strpos($regex, 'Android')) {
            return $regex = "Android";
        } elseif (strpos($regex, 'BlackBerry')) {
            return $regex = "BlackBerry";
        } elseif (strpos($regex, 'WebOS')) {
            return $regex = "Mobile";
        } else {
            return $regex = "Unknown / unsupported operating system";
        }
    }
}
// Build Environment helper
\Toolbox::register('Environment', function () {
    return new Environment();
});
Ejemplo n.º 2
0
        }
        if (is_numeric($input[$field]) && is_numeric($param) && $input[$field] >= $param) {
            return;
        }
        return array('field' => $field, 'value' => $input[$field], 'rule' => __FUNCTION__, 'param' => $param);
    }
    /**
     * Trims whitespace only when the value is a scalar
     *
     * @param mixed $value
     * @return mixed
     */
    private function trimScalar($value)
    {
        if (is_scalar($value)) {
            $value = trim($value);
        }
        return $value;
    }
}
// EOC
Validate::add_validator("matches", function ($field, $input, $param = NULL) {
    if ($field) {
        return;
    }
    return array('field' => $field, 'value' => $input[$field], 'rule' => __FUNCTION__, 'param' => $param);
});
// Build Validation helper
\Toolbox::register('Validate', function () {
    return new Validate();
});