添加 Piwik 到代码库中。
+YUCHENG HU+ git-svn-id: https://svn.code.sf.net/p/hawebs/svn@439 a2543c7e-f6e9-4f8a-8bff-1ffc34733512
This commit is contained in:
@@ -0,0 +1,169 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to [email protected] so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Auth
|
||||
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Auth.php 20096 2010-01-06 02:05:09Z bkarwin $
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* @category Zend
|
||||
* @package Zend_Auth
|
||||
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Auth
|
||||
{
|
||||
/**
|
||||
* Singleton instance
|
||||
*
|
||||
* @var Zend_Auth
|
||||
*/
|
||||
protected static $_instance = null;
|
||||
|
||||
/**
|
||||
* Persistent storage handler
|
||||
*
|
||||
* @var Zend_Auth_Storage_Interface
|
||||
*/
|
||||
protected $_storage = null;
|
||||
|
||||
/**
|
||||
* Singleton pattern implementation makes "new" unavailable
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function __construct()
|
||||
{}
|
||||
|
||||
/**
|
||||
* Singleton pattern implementation makes "clone" unavailable
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function __clone()
|
||||
{}
|
||||
|
||||
/**
|
||||
* Returns an instance of Zend_Auth
|
||||
*
|
||||
* Singleton pattern implementation
|
||||
*
|
||||
* @return Zend_Auth Provides a fluent interface
|
||||
*/
|
||||
public static function getInstance()
|
||||
{
|
||||
if (null === self::$_instance) {
|
||||
self::$_instance = new self();
|
||||
}
|
||||
|
||||
return self::$_instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the persistent storage handler
|
||||
*
|
||||
* Session storage is used by default unless a different storage adapter has been set.
|
||||
*
|
||||
* @return Zend_Auth_Storage_Interface
|
||||
*/
|
||||
public function getStorage()
|
||||
{
|
||||
if (null === $this->_storage) {
|
||||
/**
|
||||
* @see Zend_Auth_Storage_Session
|
||||
*/
|
||||
// require_once 'Zend/Auth/Storage/Session.php';
|
||||
$this->setStorage(new Zend_Auth_Storage_Session());
|
||||
}
|
||||
|
||||
return $this->_storage;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the persistent storage handler
|
||||
*
|
||||
* @param Zend_Auth_Storage_Interface $storage
|
||||
* @return Zend_Auth Provides a fluent interface
|
||||
*/
|
||||
public function setStorage(Zend_Auth_Storage_Interface $storage)
|
||||
{
|
||||
$this->_storage = $storage;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Authenticates against the supplied adapter
|
||||
*
|
||||
* @param Zend_Auth_Adapter_Interface $adapter
|
||||
* @return Zend_Auth_Result
|
||||
*/
|
||||
public function authenticate(Zend_Auth_Adapter_Interface $adapter)
|
||||
{
|
||||
$result = $adapter->authenticate();
|
||||
|
||||
/**
|
||||
* ZF-7546 - prevent multiple succesive calls from storing inconsistent results
|
||||
* Ensure storage has clean state
|
||||
*/
|
||||
if ($this->hasIdentity()) {
|
||||
$this->clearIdentity();
|
||||
}
|
||||
|
||||
if ($result->isValid()) {
|
||||
$this->getStorage()->write($result->getIdentity());
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if and only if an identity is available from storage
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function hasIdentity()
|
||||
{
|
||||
return !$this->getStorage()->isEmpty();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the identity from storage or null if no identity is available
|
||||
*
|
||||
* @return mixed|null
|
||||
*/
|
||||
public function getIdentity()
|
||||
{
|
||||
$storage = $this->getStorage();
|
||||
|
||||
if ($storage->isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return $storage->read();
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears the identity from persistent storage
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function clearIdentity()
|
||||
{
|
||||
$this->getStorage()->clear();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,250 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to [email protected] so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Cache
|
||||
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Cache.php 21974 2010-04-23 17:10:17Z alexander $
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* @package Zend_Cache
|
||||
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
abstract class Zend_Cache
|
||||
{
|
||||
|
||||
/**
|
||||
* Standard frontends
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public static $standardFrontends = array('Core', 'Output', 'Class', 'File', 'Function', 'Page');
|
||||
|
||||
/**
|
||||
* Standard backends
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public static $standardBackends = array('File', 'Sqlite', 'Memcached', 'Apc', 'ZendPlatform',
|
||||
'Xcache', 'TwoLevels', 'ZendServer_Disk', 'ZendServer_ShMem');
|
||||
|
||||
/**
|
||||
* Standard backends which implement the ExtendedInterface
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public static $standardExtendedBackends = array('File', 'Apc', 'TwoLevels', 'Memcached', 'Sqlite');
|
||||
|
||||
/**
|
||||
* Only for backward compatibily (may be removed in next major release)
|
||||
*
|
||||
* @var array
|
||||
* @deprecated
|
||||
*/
|
||||
public static $availableFrontends = array('Core', 'Output', 'Class', 'File', 'Function', 'Page');
|
||||
|
||||
/**
|
||||
* Only for backward compatibily (may be removed in next major release)
|
||||
*
|
||||
* @var array
|
||||
* @deprecated
|
||||
*/
|
||||
public static $availableBackends = array('File', 'Sqlite', 'Memcached', 'Apc', 'ZendPlatform', 'Xcache', 'TwoLevels');
|
||||
|
||||
/**
|
||||
* Consts for clean() method
|
||||
*/
|
||||
const CLEANING_MODE_ALL = 'all';
|
||||
const CLEANING_MODE_OLD = 'old';
|
||||
const CLEANING_MODE_MATCHING_TAG = 'matchingTag';
|
||||
const CLEANING_MODE_NOT_MATCHING_TAG = 'notMatchingTag';
|
||||
const CLEANING_MODE_MATCHING_ANY_TAG = 'matchingAnyTag';
|
||||
|
||||
/**
|
||||
* Factory
|
||||
*
|
||||
* @param mixed $frontend frontend name (string) or Zend_Cache_Frontend_ object
|
||||
* @param mixed $backend backend name (string) or Zend_Cache_Backend_ object
|
||||
* @param array $frontendOptions associative array of options for the corresponding frontend constructor
|
||||
* @param array $backendOptions associative array of options for the corresponding backend constructor
|
||||
* @param boolean $customFrontendNaming if true, the frontend argument is used as a complete class name ; if false, the frontend argument is used as the end of "Zend_Cache_Frontend_[...]" class name
|
||||
* @param boolean $customBackendNaming if true, the backend argument is used as a complete class name ; if false, the backend argument is used as the end of "Zend_Cache_Backend_[...]" class name
|
||||
* @param boolean $autoload if true, there will no // require_once for backend and frontend (usefull only for custom backends/frontends)
|
||||
* @throws Zend_Cache_Exception
|
||||
* @return Zend_Cache_Core|Zend_Cache_Frontend
|
||||
*/
|
||||
public static function factory($frontend, $backend, $frontendOptions = array(), $backendOptions = array(), $customFrontendNaming = false, $customBackendNaming = false, $autoload = false)
|
||||
{
|
||||
if (is_string($backend)) {
|
||||
$backendObject = self::_makeBackend($backend, $backendOptions, $customBackendNaming, $autoload);
|
||||
} else {
|
||||
if ((is_object($backend)) && (in_array('Zend_Cache_Backend_Interface', class_implements($backend)))) {
|
||||
$backendObject = $backend;
|
||||
} else {
|
||||
self::throwException('backend must be a backend name (string) or an object which implements Zend_Cache_Backend_Interface');
|
||||
}
|
||||
}
|
||||
if (is_string($frontend)) {
|
||||
$frontendObject = self::_makeFrontend($frontend, $frontendOptions, $customFrontendNaming, $autoload);
|
||||
} else {
|
||||
if (is_object($frontend)) {
|
||||
$frontendObject = $frontend;
|
||||
} else {
|
||||
self::throwException('frontend must be a frontend name (string) or an object');
|
||||
}
|
||||
}
|
||||
$frontendObject->setBackend($backendObject);
|
||||
return $frontendObject;
|
||||
}
|
||||
|
||||
/**
|
||||
* Frontend Constructor
|
||||
*
|
||||
* @param string $backend
|
||||
* @param array $backendOptions
|
||||
* @param boolean $customBackendNaming
|
||||
* @param boolean $autoload
|
||||
* @return Zend_Cache_Backend
|
||||
*/
|
||||
public static function _makeBackend($backend, $backendOptions, $customBackendNaming = false, $autoload = false)
|
||||
{
|
||||
if (!$customBackendNaming) {
|
||||
$backend = self::_normalizeName($backend);
|
||||
}
|
||||
if (in_array($backend, Zend_Cache::$standardBackends)) {
|
||||
// we use a standard backend
|
||||
$backendClass = 'Zend_Cache_Backend_' . $backend;
|
||||
// security controls are explicit
|
||||
// require_once str_replace('_', DIRECTORY_SEPARATOR, $backendClass) . '.php';
|
||||
} else {
|
||||
// we use a custom backend
|
||||
if (!preg_match('~^[\w]+$~D', $backend)) {
|
||||
Zend_Cache::throwException("Invalid backend name [$backend]");
|
||||
}
|
||||
if (!$customBackendNaming) {
|
||||
// we use this boolean to avoid an API break
|
||||
$backendClass = 'Zend_Cache_Backend_' . $backend;
|
||||
} else {
|
||||
$backendClass = $backend;
|
||||
}
|
||||
if (!$autoload) {
|
||||
$file = str_replace('_', DIRECTORY_SEPARATOR, $backendClass) . '.php';
|
||||
if (!(self::_isReadable($file))) {
|
||||
self::throwException("file $file not found in include_path");
|
||||
}
|
||||
// require_once $file;
|
||||
}
|
||||
}
|
||||
return new $backendClass($backendOptions);
|
||||
}
|
||||
|
||||
/**
|
||||
* Backend Constructor
|
||||
*
|
||||
* @param string $frontend
|
||||
* @param array $frontendOptions
|
||||
* @param boolean $customFrontendNaming
|
||||
* @param boolean $autoload
|
||||
* @return Zend_Cache_Core|Zend_Cache_Frontend
|
||||
*/
|
||||
public static function _makeFrontend($frontend, $frontendOptions = array(), $customFrontendNaming = false, $autoload = false)
|
||||
{
|
||||
if (!$customFrontendNaming) {
|
||||
$frontend = self::_normalizeName($frontend);
|
||||
}
|
||||
if (in_array($frontend, self::$standardFrontends)) {
|
||||
// we use a standard frontend
|
||||
// For perfs reasons, with frontend == 'Core', we can interact with the Core itself
|
||||
$frontendClass = 'Zend_Cache_' . ($frontend != 'Core' ? 'Frontend_' : '') . $frontend;
|
||||
// security controls are explicit
|
||||
// require_once str_replace('_', DIRECTORY_SEPARATOR, $frontendClass) . '.php';
|
||||
} else {
|
||||
// we use a custom frontend
|
||||
if (!preg_match('~^[\w]+$~D', $frontend)) {
|
||||
Zend_Cache::throwException("Invalid frontend name [$frontend]");
|
||||
}
|
||||
if (!$customFrontendNaming) {
|
||||
// we use this boolean to avoid an API break
|
||||
$frontendClass = 'Zend_Cache_Frontend_' . $frontend;
|
||||
} else {
|
||||
$frontendClass = $frontend;
|
||||
}
|
||||
if (!$autoload) {
|
||||
$file = str_replace('_', DIRECTORY_SEPARATOR, $frontendClass) . '.php';
|
||||
if (!(self::_isReadable($file))) {
|
||||
self::throwException("file $file not found in include_path");
|
||||
}
|
||||
// require_once $file;
|
||||
}
|
||||
}
|
||||
return new $frontendClass($frontendOptions);
|
||||
}
|
||||
|
||||
/**
|
||||
* Throw an exception
|
||||
*
|
||||
* Note : for perf reasons, the "load" of Zend/Cache/Exception is dynamic
|
||||
* @param string $msg Message for the exception
|
||||
* @throws Zend_Cache_Exception
|
||||
*/
|
||||
public static function throwException($msg, Exception $e = null)
|
||||
{
|
||||
// For perfs reasons, we use this dynamic inclusion
|
||||
// require_once 'Zend/Cache/Exception.php';
|
||||
throw new Zend_Cache_Exception($msg, 0, $e);
|
||||
}
|
||||
|
||||
/**
|
||||
* Normalize frontend and backend names to allow multiple words TitleCased
|
||||
*
|
||||
* @param string $name Name to normalize
|
||||
* @return string
|
||||
*/
|
||||
protected static function _normalizeName($name)
|
||||
{
|
||||
$name = ucfirst(strtolower($name));
|
||||
$name = str_replace(array('-', '_', '.'), ' ', $name);
|
||||
$name = ucwords($name);
|
||||
$name = str_replace(' ', '', $name);
|
||||
if (stripos($name, 'ZendServer') === 0) {
|
||||
$name = 'ZendServer_' . substr($name, strlen('ZendServer'));
|
||||
}
|
||||
|
||||
return $name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns TRUE if the $filename is readable, or FALSE otherwise.
|
||||
* This function uses the PHP include_path, where PHP's is_readable()
|
||||
* does not.
|
||||
*
|
||||
* Note : this method comes from Zend_Loader (see #ZF-2891 for details)
|
||||
*
|
||||
* @param string $filename
|
||||
* @return boolean
|
||||
*/
|
||||
private static function _isReadable($filename)
|
||||
{
|
||||
if (!$fh = @fopen($filename, 'r', true)) {
|
||||
return false;
|
||||
}
|
||||
@fclose($fh);
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,281 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to [email protected] so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Db
|
||||
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Db.php 20096 2010-01-06 02:05:09Z bkarwin $
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Class for connecting to SQL databases and performing common operations.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Db
|
||||
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Db
|
||||
{
|
||||
|
||||
/**
|
||||
* Use the PROFILER constant in the config of a Zend_Db_Adapter.
|
||||
*/
|
||||
const PROFILER = 'profiler';
|
||||
|
||||
/**
|
||||
* Use the CASE_FOLDING constant in the config of a Zend_Db_Adapter.
|
||||
*/
|
||||
const CASE_FOLDING = 'caseFolding';
|
||||
|
||||
/**
|
||||
* Use the AUTO_QUOTE_IDENTIFIERS constant in the config of a Zend_Db_Adapter.
|
||||
*/
|
||||
const AUTO_QUOTE_IDENTIFIERS = 'autoQuoteIdentifiers';
|
||||
|
||||
/**
|
||||
* Use the ALLOW_SERIALIZATION constant in the config of a Zend_Db_Adapter.
|
||||
*/
|
||||
const ALLOW_SERIALIZATION = 'allowSerialization';
|
||||
|
||||
/**
|
||||
* Use the AUTO_RECONNECT_ON_UNSERIALIZE constant in the config of a Zend_Db_Adapter.
|
||||
*/
|
||||
const AUTO_RECONNECT_ON_UNSERIALIZE = 'autoReconnectOnUnserialize';
|
||||
|
||||
/**
|
||||
* Use the INT_TYPE, BIGINT_TYPE, and FLOAT_TYPE with the quote() method.
|
||||
*/
|
||||
const INT_TYPE = 0;
|
||||
const BIGINT_TYPE = 1;
|
||||
const FLOAT_TYPE = 2;
|
||||
|
||||
/**
|
||||
* PDO constant values discovered by this script result:
|
||||
*
|
||||
* $list = array(
|
||||
* 'PARAM_BOOL', 'PARAM_NULL', 'PARAM_INT', 'PARAM_STR', 'PARAM_LOB',
|
||||
* 'PARAM_STMT', 'PARAM_INPUT_OUTPUT', 'FETCH_LAZY', 'FETCH_ASSOC',
|
||||
* 'FETCH_NUM', 'FETCH_BOTH', 'FETCH_OBJ', 'FETCH_BOUND',
|
||||
* 'FETCH_COLUMN', 'FETCH_CLASS', 'FETCH_INTO', 'FETCH_FUNC',
|
||||
* 'FETCH_GROUP', 'FETCH_UNIQUE', 'FETCH_CLASSTYPE', 'FETCH_SERIALIZE',
|
||||
* 'FETCH_NAMED', 'ATTR_AUTOCOMMIT', 'ATTR_PREFETCH', 'ATTR_TIMEOUT',
|
||||
* 'ATTR_ERRMODE', 'ATTR_SERVER_VERSION', 'ATTR_CLIENT_VERSION',
|
||||
* 'ATTR_SERVER_INFO', 'ATTR_CONNECTION_STATUS', 'ATTR_CASE',
|
||||
* 'ATTR_CURSOR_NAME', 'ATTR_CURSOR', 'ATTR_ORACLE_NULLS',
|
||||
* 'ATTR_PERSISTENT', 'ATTR_STATEMENT_CLASS', 'ATTR_FETCH_TABLE_NAMES',
|
||||
* 'ATTR_FETCH_CATALOG_NAMES', 'ATTR_DRIVER_NAME',
|
||||
* 'ATTR_STRINGIFY_FETCHES', 'ATTR_MAX_COLUMN_LEN', 'ERRMODE_SILENT',
|
||||
* 'ERRMODE_WARNING', 'ERRMODE_EXCEPTION', 'CASE_NATURAL',
|
||||
* 'CASE_LOWER', 'CASE_UPPER', 'NULL_NATURAL', 'NULL_EMPTY_STRING',
|
||||
* 'NULL_TO_STRING', 'ERR_NONE', 'FETCH_ORI_NEXT',
|
||||
* 'FETCH_ORI_PRIOR', 'FETCH_ORI_FIRST', 'FETCH_ORI_LAST',
|
||||
* 'FETCH_ORI_ABS', 'FETCH_ORI_REL', 'CURSOR_FWDONLY', 'CURSOR_SCROLL',
|
||||
* 'ERR_CANT_MAP', 'ERR_SYNTAX', 'ERR_CONSTRAINT', 'ERR_NOT_FOUND',
|
||||
* 'ERR_ALREADY_EXISTS', 'ERR_NOT_IMPLEMENTED', 'ERR_MISMATCH',
|
||||
* 'ERR_TRUNCATED', 'ERR_DISCONNECTED', 'ERR_NO_PERM',
|
||||
* );
|
||||
*
|
||||
* $const = array();
|
||||
* foreach ($list as $name) {
|
||||
* $const[$name] = constant("PDO::$name");
|
||||
* }
|
||||
* var_export($const);
|
||||
*/
|
||||
const ATTR_AUTOCOMMIT = 0;
|
||||
const ATTR_CASE = 8;
|
||||
const ATTR_CLIENT_VERSION = 5;
|
||||
const ATTR_CONNECTION_STATUS = 7;
|
||||
const ATTR_CURSOR = 10;
|
||||
const ATTR_CURSOR_NAME = 9;
|
||||
const ATTR_DRIVER_NAME = 16;
|
||||
const ATTR_ERRMODE = 3;
|
||||
const ATTR_FETCH_CATALOG_NAMES = 15;
|
||||
const ATTR_FETCH_TABLE_NAMES = 14;
|
||||
const ATTR_MAX_COLUMN_LEN = 18;
|
||||
const ATTR_ORACLE_NULLS = 11;
|
||||
const ATTR_PERSISTENT = 12;
|
||||
const ATTR_PREFETCH = 1;
|
||||
const ATTR_SERVER_INFO = 6;
|
||||
const ATTR_SERVER_VERSION = 4;
|
||||
const ATTR_STATEMENT_CLASS = 13;
|
||||
const ATTR_STRINGIFY_FETCHES = 17;
|
||||
const ATTR_TIMEOUT = 2;
|
||||
const CASE_LOWER = 2;
|
||||
const CASE_NATURAL = 0;
|
||||
const CASE_UPPER = 1;
|
||||
const CURSOR_FWDONLY = 0;
|
||||
const CURSOR_SCROLL = 1;
|
||||
const ERR_ALREADY_EXISTS = NULL;
|
||||
const ERR_CANT_MAP = NULL;
|
||||
const ERR_CONSTRAINT = NULL;
|
||||
const ERR_DISCONNECTED = NULL;
|
||||
const ERR_MISMATCH = NULL;
|
||||
const ERR_NO_PERM = NULL;
|
||||
const ERR_NONE = '00000';
|
||||
const ERR_NOT_FOUND = NULL;
|
||||
const ERR_NOT_IMPLEMENTED = NULL;
|
||||
const ERR_SYNTAX = NULL;
|
||||
const ERR_TRUNCATED = NULL;
|
||||
const ERRMODE_EXCEPTION = 2;
|
||||
const ERRMODE_SILENT = 0;
|
||||
const ERRMODE_WARNING = 1;
|
||||
const FETCH_ASSOC = 2;
|
||||
const FETCH_BOTH = 4;
|
||||
const FETCH_BOUND = 6;
|
||||
const FETCH_CLASS = 8;
|
||||
const FETCH_CLASSTYPE = 262144;
|
||||
const FETCH_COLUMN = 7;
|
||||
const FETCH_FUNC = 10;
|
||||
const FETCH_GROUP = 65536;
|
||||
const FETCH_INTO = 9;
|
||||
const FETCH_LAZY = 1;
|
||||
const FETCH_NAMED = 11;
|
||||
const FETCH_NUM = 3;
|
||||
const FETCH_OBJ = 5;
|
||||
const FETCH_ORI_ABS = 4;
|
||||
const FETCH_ORI_FIRST = 2;
|
||||
const FETCH_ORI_LAST = 3;
|
||||
const FETCH_ORI_NEXT = 0;
|
||||
const FETCH_ORI_PRIOR = 1;
|
||||
const FETCH_ORI_REL = 5;
|
||||
const FETCH_SERIALIZE = 524288;
|
||||
const FETCH_UNIQUE = 196608;
|
||||
const NULL_EMPTY_STRING = 1;
|
||||
const NULL_NATURAL = 0;
|
||||
const NULL_TO_STRING = NULL;
|
||||
const PARAM_BOOL = 5;
|
||||
const PARAM_INPUT_OUTPUT = -2147483648;
|
||||
const PARAM_INT = 1;
|
||||
const PARAM_LOB = 3;
|
||||
const PARAM_NULL = 0;
|
||||
const PARAM_STMT = 4;
|
||||
const PARAM_STR = 2;
|
||||
|
||||
/**
|
||||
* Factory for Zend_Db_Adapter_Abstract classes.
|
||||
*
|
||||
* First argument may be a string containing the base of the adapter class
|
||||
* name, e.g. 'Mysqli' corresponds to class Zend_Db_Adapter_Mysqli. This
|
||||
* name is currently case-insensitive, but is not ideal to rely on this behavior.
|
||||
* If your class is named 'My_Company_Pdo_Mysql', where 'My_Company' is the namespace
|
||||
* and 'Pdo_Mysql' is the adapter name, it is best to use the name exactly as it
|
||||
* is defined in the class. This will ensure proper use of the factory API.
|
||||
*
|
||||
* First argument may alternatively be an object of type Zend_Config.
|
||||
* The adapter class base name is read from the 'adapter' property.
|
||||
* The adapter config parameters are read from the 'params' property.
|
||||
*
|
||||
* Second argument is optional and may be an associative array of key-value
|
||||
* pairs. This is used as the argument to the adapter constructor.
|
||||
*
|
||||
* If the first argument is of type Zend_Config, it is assumed to contain
|
||||
* all parameters, and the second argument is ignored.
|
||||
*
|
||||
* @param mixed $adapter String name of base adapter class, or Zend_Config object.
|
||||
* @param mixed $config OPTIONAL; an array or Zend_Config object with adapter parameters.
|
||||
* @return Zend_Db_Adapter_Abstract
|
||||
* @throws Zend_Db_Exception
|
||||
*/
|
||||
public static function factory($adapter, $config = array())
|
||||
{
|
||||
if ($config instanceof Zend_Config) {
|
||||
$config = $config->toArray();
|
||||
}
|
||||
|
||||
/*
|
||||
* Convert Zend_Config argument to plain string
|
||||
* adapter name and separate config object.
|
||||
*/
|
||||
if ($adapter instanceof Zend_Config) {
|
||||
if (isset($adapter->params)) {
|
||||
$config = $adapter->params->toArray();
|
||||
}
|
||||
if (isset($adapter->adapter)) {
|
||||
$adapter = (string) $adapter->adapter;
|
||||
} else {
|
||||
$adapter = null;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Verify that adapter parameters are in an array.
|
||||
*/
|
||||
if (!is_array($config)) {
|
||||
/**
|
||||
* @see Zend_Db_Exception
|
||||
*/
|
||||
// require_once 'Zend/Db/Exception.php';
|
||||
throw new Zend_Db_Exception('Adapter parameters must be in an array or a Zend_Config object');
|
||||
}
|
||||
|
||||
/*
|
||||
* Verify that an adapter name has been specified.
|
||||
*/
|
||||
if (!is_string($adapter) || empty($adapter)) {
|
||||
/**
|
||||
* @see Zend_Db_Exception
|
||||
*/
|
||||
// require_once 'Zend/Db/Exception.php';
|
||||
throw new Zend_Db_Exception('Adapter name must be specified in a string');
|
||||
}
|
||||
|
||||
/*
|
||||
* Form full adapter class name
|
||||
*/
|
||||
$adapterNamespace = 'Zend_Db_Adapter';
|
||||
if (isset($config['adapterNamespace'])) {
|
||||
if ($config['adapterNamespace'] != '') {
|
||||
$adapterNamespace = $config['adapterNamespace'];
|
||||
}
|
||||
unset($config['adapterNamespace']);
|
||||
}
|
||||
|
||||
// Adapter no longer normalized- see http://framework.zend.com/issues/browse/ZF-5606
|
||||
$adapterName = $adapterNamespace . '_';
|
||||
$adapterName .= str_replace(' ', '_', ucwords(str_replace('_', ' ', strtolower($adapter))));
|
||||
|
||||
/*
|
||||
* Load the adapter class. This throws an exception
|
||||
* if the specified class cannot be loaded.
|
||||
*/
|
||||
// if (!class_exists($adapterName)) {
|
||||
// require_once 'Zend/Loader.php';
|
||||
// Zend_Loader::loadClass($adapterName);
|
||||
// }
|
||||
|
||||
/*
|
||||
* Create an instance of the adapter class.
|
||||
* Pass the config to the adapter class constructor.
|
||||
*/
|
||||
$dbAdapter = new $adapterName($config);
|
||||
|
||||
/*
|
||||
* Verify that the object created is a descendent of the abstract adapter type.
|
||||
*/
|
||||
if (! $dbAdapter instanceof Zend_Db_Adapter_Abstract) {
|
||||
/**
|
||||
* @see Zend_Db_Exception
|
||||
*/
|
||||
// require_once 'Zend/Db/Exception.php';
|
||||
throw new Zend_Db_Exception("Adapter class '$adapterName' does not extend Zend_Db_Adapter_Abstract");
|
||||
}
|
||||
|
||||
return $dbAdapter;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,95 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to [email protected] so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend
|
||||
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
||||
/**
|
||||
* @category Zend
|
||||
* @package Zend
|
||||
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Exception extends Exception
|
||||
{
|
||||
/**
|
||||
* @var null|Exception
|
||||
*/
|
||||
private $_previous = null;
|
||||
|
||||
/**
|
||||
* Construct the exception
|
||||
*
|
||||
* @param string $msg
|
||||
* @param int $code
|
||||
* @param Exception $previous
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($msg = '', $code = 0, Exception $previous = null)
|
||||
{
|
||||
if (version_compare(PHP_VERSION, '5.3.0', '<')) {
|
||||
parent::__construct($msg, (int) $code);
|
||||
$this->_previous = $previous;
|
||||
} else {
|
||||
parent::__construct($msg, (int) $code, $previous);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Overloading
|
||||
*
|
||||
* For PHP < 5.3.0, provides access to the getPrevious() method.
|
||||
*
|
||||
* @param string $method
|
||||
* @param array $args
|
||||
* @return mixed
|
||||
*/
|
||||
public function __call($method, array $args)
|
||||
{
|
||||
if ('getprevious' == strtolower($method)) {
|
||||
return $this->_getPrevious();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* String representation of the exception
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
if (version_compare(PHP_VERSION, '5.3.0', '<')) {
|
||||
if (null !== ($e = $this->getPrevious())) {
|
||||
return $e->__toString()
|
||||
. "\n\nNext "
|
||||
. parent::__toString();
|
||||
}
|
||||
}
|
||||
return parent::__toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns previous Exception
|
||||
*
|
||||
* @return Exception|null
|
||||
*/
|
||||
protected function _getPrevious()
|
||||
{
|
||||
return $this->_previous;
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,209 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to [email protected] so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Registry
|
||||
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Registry.php 20096 2010-01-06 02:05:09Z bkarwin $
|
||||
*/
|
||||
|
||||
/**
|
||||
* Generic storage class helps to manage global data.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Registry
|
||||
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Registry extends ArrayObject
|
||||
{
|
||||
/**
|
||||
* Class name of the singleton registry object.
|
||||
* @var string
|
||||
*/
|
||||
private static $_registryClassName = 'Zend_Registry';
|
||||
|
||||
/**
|
||||
* Registry object provides storage for shared objects.
|
||||
* @var Zend_Registry
|
||||
*/
|
||||
private static $_registry = null;
|
||||
|
||||
/**
|
||||
* Retrieves the default registry instance.
|
||||
*
|
||||
* @return Zend_Registry
|
||||
*/
|
||||
public static function getInstance()
|
||||
{
|
||||
if (self::$_registry === null) {
|
||||
self::init();
|
||||
}
|
||||
|
||||
return self::$_registry;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the default registry instance to a specified instance.
|
||||
*
|
||||
* @param Zend_Registry $registry An object instance of type Zend_Registry,
|
||||
* or a subclass.
|
||||
* @return void
|
||||
* @throws Zend_Exception if registry is already initialized.
|
||||
*/
|
||||
public static function setInstance(Zend_Registry $registry)
|
||||
{
|
||||
if (self::$_registry !== null) {
|
||||
// require_once 'Zend/Exception.php';
|
||||
throw new Zend_Exception('Registry is already initialized');
|
||||
}
|
||||
|
||||
self::setClassName(get_class($registry));
|
||||
self::$_registry = $registry;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize the default registry instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected static function init()
|
||||
{
|
||||
self::setInstance(new self::$_registryClassName());
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the class name to use for the default registry instance.
|
||||
* Does not affect the currently initialized instance, it only applies
|
||||
* for the next time you instantiate.
|
||||
*
|
||||
* @param string $registryClassName
|
||||
* @return void
|
||||
* @throws Zend_Exception if the registry is initialized or if the
|
||||
* class name is not valid.
|
||||
*/
|
||||
public static function setClassName($registryClassName = 'Zend_Registry')
|
||||
{
|
||||
if (self::$_registry !== null) {
|
||||
// require_once 'Zend/Exception.php';
|
||||
throw new Zend_Exception('Registry is already initialized');
|
||||
}
|
||||
|
||||
if (!is_string($registryClassName)) {
|
||||
// require_once 'Zend/Exception.php';
|
||||
throw new Zend_Exception("Argument is not a class name");
|
||||
}
|
||||
|
||||
/**
|
||||
* @see Zend_Loader
|
||||
*/
|
||||
// if (!class_exists($registryClassName)) {
|
||||
// require_once 'Zend/Loader.php';
|
||||
// Zend_Loader::loadClass($registryClassName);
|
||||
// }
|
||||
|
||||
self::$_registryClassName = $registryClassName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Unset the default registry instance.
|
||||
* Primarily used in tearDown() in unit tests.
|
||||
* @returns void
|
||||
*/
|
||||
public static function _unsetInstance()
|
||||
{
|
||||
self::$_registry = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* getter method, basically same as offsetGet().
|
||||
*
|
||||
* This method can be called from an object of type Zend_Registry, or it
|
||||
* can be called statically. In the latter case, it uses the default
|
||||
* static instance stored in the class.
|
||||
*
|
||||
* @param string $index - get the value associated with $index
|
||||
* @return mixed
|
||||
* @throws Zend_Exception if no entry is registerd for $index.
|
||||
*/
|
||||
public static function get($index)
|
||||
{
|
||||
$instance = self::getInstance();
|
||||
|
||||
if (!$instance->offsetExists($index)) {
|
||||
// require_once 'Zend/Exception.php';
|
||||
throw new Zend_Exception("No entry is registered for key '$index'");
|
||||
}
|
||||
|
||||
return $instance->offsetGet($index);
|
||||
}
|
||||
|
||||
/**
|
||||
* setter method, basically same as offsetSet().
|
||||
*
|
||||
* This method can be called from an object of type Zend_Registry, or it
|
||||
* can be called statically. In the latter case, it uses the default
|
||||
* static instance stored in the class.
|
||||
*
|
||||
* @param string $index The location in the ArrayObject in which to store
|
||||
* the value.
|
||||
* @param mixed $value The object to store in the ArrayObject.
|
||||
* @return void
|
||||
*/
|
||||
public static function set($index, $value)
|
||||
{
|
||||
$instance = self::getInstance();
|
||||
$instance->offsetSet($index, $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns TRUE if the $index is a named value in the registry,
|
||||
* or FALSE if $index was not found in the registry.
|
||||
*
|
||||
* @param string $index
|
||||
* @return boolean
|
||||
*/
|
||||
public static function isRegistered($index)
|
||||
{
|
||||
if (self::$_registry === null) {
|
||||
return false;
|
||||
}
|
||||
return self::$_registry->offsetExists($index);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a parent ArrayObject with default
|
||||
* ARRAY_AS_PROPS to allow acces as an object
|
||||
*
|
||||
* @param array $array data array
|
||||
* @param integer $flags ArrayObject flags
|
||||
*/
|
||||
public function __construct($array = array(), $flags = parent::ARRAY_AS_PROPS)
|
||||
{
|
||||
parent::__construct($array, $flags);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $index
|
||||
* @returns mixed
|
||||
*
|
||||
* Workaround for http://bugs.php.net/bug.php?id=40442 (ZF-960).
|
||||
*/
|
||||
public function offsetExists($index)
|
||||
{
|
||||
return array_key_exists($index, $this);
|
||||
}
|
||||
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,204 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to [email protected] so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Uri
|
||||
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Uri.php 22083 2010-05-03 18:49:28Z shahar $
|
||||
*/
|
||||
|
||||
/**
|
||||
* Abstract class for all Zend_Uri handlers
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Uri
|
||||
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
abstract class Zend_Uri
|
||||
{
|
||||
/**
|
||||
* Scheme of this URI (http, ftp, etc.)
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $_scheme = '';
|
||||
|
||||
/**
|
||||
* Global configuration array
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
static protected $_config = array(
|
||||
'allow_unwise' => false
|
||||
);
|
||||
|
||||
/**
|
||||
* Return a string representation of this URI.
|
||||
*
|
||||
* @see getUri()
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return $this->getUri();
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience function, checks that a $uri string is well-formed
|
||||
* by validating it but not returning an object. Returns TRUE if
|
||||
* $uri is a well-formed URI, or FALSE otherwise.
|
||||
*
|
||||
* @param string $uri The URI to check
|
||||
* @return boolean
|
||||
*/
|
||||
public static function check($uri)
|
||||
{
|
||||
try {
|
||||
$uri = self::factory($uri);
|
||||
} catch (Exception $e) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return $uri->valid();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new Zend_Uri object for a URI. If building a new URI, then $uri should contain
|
||||
* only the scheme (http, ftp, etc). Otherwise, supply $uri with the complete URI.
|
||||
*
|
||||
* @param string $uri The URI form which a Zend_Uri instance is created
|
||||
* @param string $className The name of the class to use in order to manipulate URI
|
||||
* @throws Zend_Uri_Exception When an empty string was supplied for the scheme
|
||||
* @throws Zend_Uri_Exception When an illegal scheme is supplied
|
||||
* @throws Zend_Uri_Exception When the scheme is not supported
|
||||
* @throws Zend_Uri_Exception When $className doesn't exist or doesn't implements Zend_Uri
|
||||
* @return Zend_Uri
|
||||
* @link http://www.faqs.org/rfcs/rfc2396.html
|
||||
*/
|
||||
public static function factory($uri = 'http', $className = null)
|
||||
{
|
||||
// Separate the scheme from the scheme-specific parts
|
||||
$uri = explode(':', $uri, 2);
|
||||
$scheme = strtolower($uri[0]);
|
||||
$schemeSpecific = isset($uri[1]) === true ? $uri[1] : '';
|
||||
|
||||
if (strlen($scheme) === 0) {
|
||||
// require_once 'Zend/Uri/Exception.php';
|
||||
throw new Zend_Uri_Exception('An empty string was supplied for the scheme');
|
||||
}
|
||||
|
||||
// Security check: $scheme is used to load a class file, so only alphanumerics are allowed.
|
||||
if (ctype_alnum($scheme) === false) {
|
||||
// require_once 'Zend/Uri/Exception.php';
|
||||
throw new Zend_Uri_Exception('Illegal scheme supplied, only alphanumeric characters are permitted');
|
||||
}
|
||||
|
||||
if ($className === null) {
|
||||
/**
|
||||
* Create a new Zend_Uri object for the $uri. If a subclass of Zend_Uri exists for the
|
||||
* scheme, return an instance of that class. Otherwise, a Zend_Uri_Exception is thrown.
|
||||
*/
|
||||
switch ($scheme) {
|
||||
case 'http':
|
||||
// Break intentionally omitted
|
||||
case 'https':
|
||||
$className = 'Zend_Uri_Http';
|
||||
break;
|
||||
|
||||
case 'mailto':
|
||||
// TODO
|
||||
default:
|
||||
// require_once 'Zend/Uri/Exception.php';
|
||||
throw new Zend_Uri_Exception("Scheme \"$scheme\" is not supported");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// if (!class_exists($className)) {
|
||||
// require_once 'Zend/Loader.php';
|
||||
// try {
|
||||
// Zend_Loader::loadClass($className);
|
||||
// } catch (Exception $e) {
|
||||
// require_once 'Zend/Uri/Exception.php';
|
||||
// throw new Zend_Uri_Exception("\"$className\" not found");
|
||||
// }
|
||||
// }
|
||||
|
||||
$schemeHandler = new $className($scheme, $schemeSpecific);
|
||||
|
||||
if (! $schemeHandler instanceof Zend_Uri) {
|
||||
// require_once 'Zend/Uri/Exception.php';
|
||||
throw new Zend_Uri_Exception("\"$className\" is not an instance of Zend_Uri");
|
||||
}
|
||||
|
||||
return $schemeHandler;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the URI's scheme
|
||||
*
|
||||
* @return string|false Scheme or false if no scheme is set.
|
||||
*/
|
||||
public function getScheme()
|
||||
{
|
||||
if (empty($this->_scheme) === false) {
|
||||
return $this->_scheme;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set global configuration options
|
||||
*
|
||||
* @param Zend_Config|array $config
|
||||
*/
|
||||
static public function setConfig($config)
|
||||
{
|
||||
if ($config instanceof Zend_Config) {
|
||||
$config = $config->toArray();
|
||||
} elseif (!is_array($config)) {
|
||||
throw new Zend_Uri_Exception("Config must be an array or an instance of Zend_Config.");
|
||||
}
|
||||
|
||||
foreach ($config as $k => $v) {
|
||||
self::$_config[$k] = $v;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Zend_Uri and its subclasses cannot be instantiated directly.
|
||||
* Use Zend_Uri::factory() to return a new Zend_Uri object.
|
||||
*
|
||||
* @param string $scheme The scheme of the URI
|
||||
* @param string $schemeSpecific The scheme-specific part of the URI
|
||||
*/
|
||||
abstract protected function __construct($scheme, $schemeSpecific = '');
|
||||
|
||||
/**
|
||||
* Return a string representation of this URI.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
abstract public function getUri();
|
||||
|
||||
/**
|
||||
* Returns TRUE if this URI is valid, or FALSE otherwise.
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
abstract public function valid();
|
||||
}
|
||||
@@ -0,0 +1,290 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to [email protected] so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Validate
|
||||
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Validate.php 21340 2010-03-05 15:33:49Z thomas $
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Validate_Interface
|
||||
*/
|
||||
// require_once 'Zend/Validate/Interface.php';
|
||||
|
||||
/**
|
||||
* @category Zend
|
||||
* @package Zend_Validate
|
||||
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Validate implements Zend_Validate_Interface
|
||||
{
|
||||
/**
|
||||
* Validator chain
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $_validators = array();
|
||||
|
||||
/**
|
||||
* Array of validation failure messages
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $_messages = array();
|
||||
|
||||
/**
|
||||
* Default Namespaces
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected static $_defaultNamespaces = array();
|
||||
|
||||
/**
|
||||
* Array of validation failure message codes
|
||||
*
|
||||
* @var array
|
||||
* @deprecated Since 1.5.0
|
||||
*/
|
||||
protected $_errors = array();
|
||||
|
||||
/**
|
||||
* Adds a validator to the end of the chain
|
||||
*
|
||||
* If $breakChainOnFailure is true, then if the validator fails, the next validator in the chain,
|
||||
* if one exists, will not be executed.
|
||||
*
|
||||
* @param Zend_Validate_Interface $validator
|
||||
* @param boolean $breakChainOnFailure
|
||||
* @return Zend_Validate Provides a fluent interface
|
||||
*/
|
||||
public function addValidator(Zend_Validate_Interface $validator, $breakChainOnFailure = false)
|
||||
{
|
||||
$this->_validators[] = array(
|
||||
'instance' => $validator,
|
||||
'breakChainOnFailure' => (boolean) $breakChainOnFailure
|
||||
);
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if and only if $value passes all validations in the chain
|
||||
*
|
||||
* Validators are run in the order in which they were added to the chain (FIFO).
|
||||
*
|
||||
* @param mixed $value
|
||||
* @return boolean
|
||||
*/
|
||||
public function isValid($value)
|
||||
{
|
||||
$this->_messages = array();
|
||||
$this->_errors = array();
|
||||
$result = true;
|
||||
foreach ($this->_validators as $element) {
|
||||
$validator = $element['instance'];
|
||||
if ($validator->isValid($value)) {
|
||||
continue;
|
||||
}
|
||||
$result = false;
|
||||
$messages = $validator->getMessages();
|
||||
$this->_messages = array_merge($this->_messages, $messages);
|
||||
$this->_errors = array_merge($this->_errors, array_keys($messages));
|
||||
if ($element['breakChainOnFailure']) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Defined by Zend_Validate_Interface
|
||||
*
|
||||
* Returns array of validation failure messages
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getMessages()
|
||||
{
|
||||
return $this->_messages;
|
||||
}
|
||||
|
||||
/**
|
||||
* Defined by Zend_Validate_Interface
|
||||
*
|
||||
* Returns array of validation failure message codes
|
||||
*
|
||||
* @return array
|
||||
* @deprecated Since 1.5.0
|
||||
*/
|
||||
public function getErrors()
|
||||
{
|
||||
return $this->_errors;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the set default namespaces
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function getDefaultNamespaces()
|
||||
{
|
||||
return self::$_defaultNamespaces;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets new default namespaces
|
||||
*
|
||||
* @param array|string $namespace
|
||||
* @return null
|
||||
*/
|
||||
public static function setDefaultNamespaces($namespace)
|
||||
{
|
||||
if (!is_array($namespace)) {
|
||||
$namespace = array((string) $namespace);
|
||||
}
|
||||
|
||||
self::$_defaultNamespaces = $namespace;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a new default namespace
|
||||
*
|
||||
* @param array|string $namespace
|
||||
* @return null
|
||||
*/
|
||||
public static function addDefaultNamespaces($namespace)
|
||||
{
|
||||
if (!is_array($namespace)) {
|
||||
$namespace = array((string) $namespace);
|
||||
}
|
||||
|
||||
self::$_defaultNamespaces = array_unique(array_merge(self::$_defaultNamespaces, $namespace));
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true when defaultNamespaces are set
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public static function hasDefaultNamespaces()
|
||||
{
|
||||
return (!empty(self::$_defaultNamespaces));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $value
|
||||
* @param string $classBaseName
|
||||
* @param array $args OPTIONAL
|
||||
* @param mixed $namespaces OPTIONAL
|
||||
* @return boolean
|
||||
* @throws Zend_Validate_Exception
|
||||
*/
|
||||
public static function is($value, $classBaseName, array $args = array(), $namespaces = array())
|
||||
{
|
||||
$namespaces = array_merge((array) $namespaces, self::$_defaultNamespaces, array('Zend_Validate'));
|
||||
$className = ucfirst($classBaseName);
|
||||
try {
|
||||
if (!class_exists($className, false)) {
|
||||
// require_once 'Zend/Loader.php';
|
||||
foreach($namespaces as $namespace) {
|
||||
$class = $namespace . '_' . $className;
|
||||
$file = str_replace('_', DIRECTORY_SEPARATOR, $class) . '.php';
|
||||
if (Zend_Loader::isReadable($file)) {
|
||||
Zend_Loader::loadClass($class);
|
||||
$className = $class;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$class = new ReflectionClass($className);
|
||||
if ($class->implementsInterface('Zend_Validate_Interface')) {
|
||||
if ($class->hasMethod('__construct')) {
|
||||
$keys = array_keys($args);
|
||||
$numeric = false;
|
||||
foreach($keys as $key) {
|
||||
if (is_numeric($key)) {
|
||||
$numeric = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ($numeric) {
|
||||
$object = $class->newInstanceArgs($args);
|
||||
} else {
|
||||
$object = $class->newInstance($args);
|
||||
}
|
||||
} else {
|
||||
$object = $class->newInstance();
|
||||
}
|
||||
|
||||
return $object->isValid($value);
|
||||
}
|
||||
} catch (Zend_Validate_Exception $ze) {
|
||||
// if there is an exception while validating throw it
|
||||
throw $ze;
|
||||
} catch (Exception $e) {
|
||||
// fallthrough and continue for missing validation classes
|
||||
}
|
||||
|
||||
// require_once 'Zend/Validate/Exception.php';
|
||||
throw new Zend_Validate_Exception("Validate class not found from basename '$classBaseName'");
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the maximum allowed message length
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public static function getMessageLength()
|
||||
{
|
||||
// require_once 'Zend/Validate/Abstract.php';
|
||||
return Zend_Validate_Abstract::getMessageLength();
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the maximum allowed message length
|
||||
*
|
||||
* @param integer $length
|
||||
*/
|
||||
public static function setMessageLength($length = -1)
|
||||
{
|
||||
// require_once 'Zend/Validate/Abstract.php';
|
||||
Zend_Validate_Abstract::setMessageLength($length);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the default translation object
|
||||
*
|
||||
* @return Zend_Translate_Adapter|null
|
||||
*/
|
||||
public static function getDefaultTranslator($translator = null)
|
||||
{
|
||||
// require_once 'Zend/Validate/Abstract.php';
|
||||
return Zend_Validate_Abstract::getDefaultTranslator();
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a default translation object for all validation objects
|
||||
*
|
||||
* @param Zend_Translate|Zend_Translate_Adapter|null $translator
|
||||
*/
|
||||
public static function setDefaultTranslator($translator = null)
|
||||
{
|
||||
// require_once 'Zend/Validate/Abstract.php';
|
||||
Zend_Validate_Abstract::setDefaultTranslator($translator);
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,150 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to [email protected] so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Validate
|
||||
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Alnum.php 20442 2010-01-20 15:15:40Z matthew $
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Validate_Abstract
|
||||
*/
|
||||
// require_once 'Zend/Validate/Abstract.php';
|
||||
|
||||
/**
|
||||
* @category Zend
|
||||
* @package Zend_Validate
|
||||
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Validate_Alnum extends Zend_Validate_Abstract
|
||||
{
|
||||
const INVALID = 'alnumInvalid';
|
||||
const NOT_ALNUM = 'notAlnum';
|
||||
const STRING_EMPTY = 'alnumStringEmpty';
|
||||
|
||||
/**
|
||||
* Whether to allow white space characters; off by default
|
||||
*
|
||||
* @var boolean
|
||||
* @deprecated
|
||||
*/
|
||||
public $allowWhiteSpace;
|
||||
|
||||
/**
|
||||
* Alphanumeric filter used for validation
|
||||
*
|
||||
* @var Zend_Filter_Alnum
|
||||
*/
|
||||
protected static $_filter = null;
|
||||
|
||||
/**
|
||||
* Validation failure message template definitions
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $_messageTemplates = array(
|
||||
self::INVALID => "Invalid type given, value should be float, string, or integer",
|
||||
self::NOT_ALNUM => "'%value%' contains characters which are non alphabetic and no digits",
|
||||
self::STRING_EMPTY => "'%value%' is an empty string",
|
||||
);
|
||||
|
||||
/**
|
||||
* Sets default option values for this instance
|
||||
*
|
||||
* @param boolean|Zend_Config $allowWhiteSpace
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($allowWhiteSpace = false)
|
||||
{
|
||||
if ($allowWhiteSpace instanceof Zend_Config) {
|
||||
$allowWhiteSpace = $allowWhiteSpace->toArray();
|
||||
}
|
||||
|
||||
if (is_array($allowWhiteSpace)) {
|
||||
if (array_key_exists('allowWhiteSpace', $allowWhiteSpace)) {
|
||||
$allowWhiteSpace = $allowWhiteSpace['allowWhiteSpace'];
|
||||
} else {
|
||||
$allowWhiteSpace = false;
|
||||
}
|
||||
}
|
||||
|
||||
$this->allowWhiteSpace = (boolean) $allowWhiteSpace;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the allowWhiteSpace option
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function getAllowWhiteSpace()
|
||||
{
|
||||
return $this->allowWhiteSpace;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the allowWhiteSpace option
|
||||
*
|
||||
* @param boolean $allowWhiteSpace
|
||||
* @return Zend_Filter_Alnum Provides a fluent interface
|
||||
*/
|
||||
public function setAllowWhiteSpace($allowWhiteSpace)
|
||||
{
|
||||
$this->allowWhiteSpace = (boolean) $allowWhiteSpace;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Defined by Zend_Validate_Interface
|
||||
*
|
||||
* Returns true if and only if $value contains only alphabetic and digit characters
|
||||
*
|
||||
* @param string $value
|
||||
* @return boolean
|
||||
*/
|
||||
public function isValid($value)
|
||||
{
|
||||
if (!is_string($value) && !is_int($value) && !is_float($value)) {
|
||||
$this->_error(self::INVALID);
|
||||
return false;
|
||||
}
|
||||
|
||||
$this->_setValue($value);
|
||||
|
||||
if ('' === $value) {
|
||||
$this->_error(self::STRING_EMPTY);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (null === self::$_filter) {
|
||||
/**
|
||||
* @see Zend_Filter_Alnum
|
||||
*/
|
||||
// require_once 'Zend/Filter/Alnum.php';
|
||||
self::$_filter = new Zend_Filter_Alnum();
|
||||
}
|
||||
|
||||
self::$_filter->allowWhiteSpace = $this->allowWhiteSpace;
|
||||
|
||||
if ($value != self::$_filter->filter($value)) {
|
||||
$this->_error(self::NOT_ALNUM);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,150 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to [email protected] so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Validate
|
||||
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Alpha.php 20442 2010-01-20 15:15:40Z matthew $
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Validate_Abstract
|
||||
*/
|
||||
// require_once 'Zend/Validate/Abstract.php';
|
||||
|
||||
/**
|
||||
* @category Zend
|
||||
* @package Zend_Validate
|
||||
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Validate_Alpha extends Zend_Validate_Abstract
|
||||
{
|
||||
const INVALID = 'alphaInvalid';
|
||||
const NOT_ALPHA = 'notAlpha';
|
||||
const STRING_EMPTY = 'alphaStringEmpty';
|
||||
|
||||
/**
|
||||
* Whether to allow white space characters; off by default
|
||||
*
|
||||
* @var boolean
|
||||
* @deprecated
|
||||
*/
|
||||
public $allowWhiteSpace;
|
||||
|
||||
/**
|
||||
* Alphabetic filter used for validation
|
||||
*
|
||||
* @var Zend_Filter_Alpha
|
||||
*/
|
||||
protected static $_filter = null;
|
||||
|
||||
/**
|
||||
* Validation failure message template definitions
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $_messageTemplates = array(
|
||||
self::INVALID => "Invalid type given, value should be a string",
|
||||
self::NOT_ALPHA => "'%value%' contains non alphabetic characters",
|
||||
self::STRING_EMPTY => "'%value%' is an empty string"
|
||||
);
|
||||
|
||||
/**
|
||||
* Sets default option values for this instance
|
||||
*
|
||||
* @param boolean|Zend_Config $allowWhiteSpace
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($allowWhiteSpace = false)
|
||||
{
|
||||
if ($allowWhiteSpace instanceof Zend_Config) {
|
||||
$allowWhiteSpace = $allowWhiteSpace->toArray();
|
||||
}
|
||||
|
||||
if (is_array($allowWhiteSpace)) {
|
||||
if (array_key_exists('allowWhiteSpace', $allowWhiteSpace)) {
|
||||
$allowWhiteSpace = $allowWhiteSpace['allowWhiteSpace'];
|
||||
} else {
|
||||
$allowWhiteSpace = false;
|
||||
}
|
||||
}
|
||||
|
||||
$this->allowWhiteSpace = (boolean) $allowWhiteSpace;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the allowWhiteSpace option
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function getAllowWhiteSpace()
|
||||
{
|
||||
return $this->allowWhiteSpace;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the allowWhiteSpace option
|
||||
*
|
||||
* @param boolean $allowWhiteSpace
|
||||
* @return Zend_Filter_Alpha Provides a fluent interface
|
||||
*/
|
||||
public function setAllowWhiteSpace($allowWhiteSpace)
|
||||
{
|
||||
$this->allowWhiteSpace = (boolean) $allowWhiteSpace;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Defined by Zend_Validate_Interface
|
||||
*
|
||||
* Returns true if and only if $value contains only alphabetic characters
|
||||
*
|
||||
* @param string $value
|
||||
* @return boolean
|
||||
*/
|
||||
public function isValid($value)
|
||||
{
|
||||
if (!is_string($value)) {
|
||||
$this->_error(self::INVALID);
|
||||
return false;
|
||||
}
|
||||
|
||||
$this->_setValue($value);
|
||||
|
||||
if ('' === $value) {
|
||||
$this->_error(self::STRING_EMPTY);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (null === self::$_filter) {
|
||||
/**
|
||||
* @see Zend_Filter_Alpha
|
||||
*/
|
||||
// require_once 'Zend/Filter/Alpha.php';
|
||||
self::$_filter = new Zend_Filter_Alpha();
|
||||
}
|
||||
|
||||
self::$_filter->allowWhiteSpace = $this->allowWhiteSpace;
|
||||
|
||||
if ($value !== self::$_filter->filter($value)) {
|
||||
$this->_error(self::NOT_ALPHA);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,217 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to [email protected] so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Validate
|
||||
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Barcode.php 21748 2010-04-03 10:29:56Z thomas $
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Validate_Abstract
|
||||
*/
|
||||
// require_once 'Zend/Validate/Abstract.php';
|
||||
|
||||
/**
|
||||
* @see Zend_Loader
|
||||
*/
|
||||
// require_once 'Zend/Loader.php';
|
||||
|
||||
/**
|
||||
* @category Zend
|
||||
* @package Zend_Validate
|
||||
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Validate_Barcode extends Zend_Validate_Abstract
|
||||
{
|
||||
const INVALID = 'barcodeInvalid';
|
||||
const FAILED = 'barcodeFailed';
|
||||
const INVALID_CHARS = 'barcodeInvalidChars';
|
||||
const INVALID_LENGTH = 'barcodeInvalidLength';
|
||||
|
||||
protected $_messageTemplates = array(
|
||||
self::FAILED => "'%value%' failed checksum validation",
|
||||
self::INVALID_CHARS => "'%value%' contains invalid characters",
|
||||
self::INVALID_LENGTH => "'%value%' should have a length of %length% characters",
|
||||
self::INVALID => "Invalid type given, value should be string",
|
||||
);
|
||||
|
||||
/**
|
||||
* Additional variables available for validation failure messages
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $_messageVariables = array(
|
||||
'length' => '_length'
|
||||
);
|
||||
|
||||
/**
|
||||
* Length for the set subtype
|
||||
*
|
||||
* @var integer
|
||||
*/
|
||||
protected $_length;
|
||||
|
||||
/**
|
||||
* Barcode adapter
|
||||
*
|
||||
* @var Zend_Validate_Barcode_BarcodeAdapter
|
||||
*/
|
||||
protected $_adapter;
|
||||
|
||||
/**
|
||||
* Generates the standard validator object
|
||||
*
|
||||
* @param string|Zend_Config|
|
||||
* Zend_Validate_Barcode_BarcodeAdapter $adapter Barcode adapter to use
|
||||
* @return void
|
||||
* @throws Zend_Validate_Exception
|
||||
*/
|
||||
public function __construct($adapter)
|
||||
{
|
||||
if ($adapter instanceof Zend_Config) {
|
||||
$adapter = $adapter->toArray();
|
||||
}
|
||||
|
||||
$options = null;
|
||||
$checksum = null;
|
||||
if (is_array($adapter)) {
|
||||
if (array_key_exists('options', $adapter)) {
|
||||
$options = $adapter['options'];
|
||||
}
|
||||
|
||||
if (array_key_exists('checksum', $adapter)) {
|
||||
$checksum = $adapter['checksum'];
|
||||
}
|
||||
|
||||
if (array_key_exists('adapter', $adapter)) {
|
||||
$adapter = $adapter['adapter'];
|
||||
} else {
|
||||
// require_once 'Zend/Validate/Exception.php';
|
||||
throw new Zend_Validate_Exception("Missing option 'adapter'");
|
||||
}
|
||||
}
|
||||
|
||||
$this->setAdapter($adapter, $options);
|
||||
if ($checksum !== null) {
|
||||
$this->setChecksum($checksum);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the set adapter
|
||||
*
|
||||
* @return Zend_Validate_Barcode_BarcodeAdapter
|
||||
*/
|
||||
public function getAdapter()
|
||||
{
|
||||
return $this->_adapter;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a new barcode adapter
|
||||
*
|
||||
* @param string|Zend_Validate_Barcode $adapter Barcode adapter to use
|
||||
* @param array $options Options for this adapter
|
||||
* @return void
|
||||
* @throws Zend_Validate_Exception
|
||||
*/
|
||||
public function setAdapter($adapter, $options = null)
|
||||
{
|
||||
$adapter = ucfirst(strtolower($adapter));
|
||||
// require_once 'Zend/Loader.php';
|
||||
if (Zend_Loader::isReadable('Zend/Validate/Barcode/' . $adapter. '.php')) {
|
||||
$adapter = 'Zend_Validate_Barcode_' . $adapter;
|
||||
}
|
||||
|
||||
// if (!class_exists($adapter)) {
|
||||
// Zend_Loader::loadClass($adapter);
|
||||
// }
|
||||
|
||||
$this->_adapter = new $adapter($options);
|
||||
if (!$this->_adapter instanceof Zend_Validate_Barcode_AdapterInterface) {
|
||||
// require_once 'Zend/Validate/Exception.php';
|
||||
throw new Zend_Validate_Exception(
|
||||
"Adapter " . $adapter . " does not implement Zend_Validate_Barcode_AdapterInterface"
|
||||
);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the checksum option
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function getChecksum()
|
||||
{
|
||||
return $this->getAdapter()->getCheck();
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the checksum option
|
||||
*
|
||||
* @param boolean $checksum
|
||||
* @return Zend_Validate_Barcode
|
||||
*/
|
||||
public function setChecksum($checksum)
|
||||
{
|
||||
$this->getAdapter()->setCheck($checksum);
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Defined by Zend_Validate_Interface
|
||||
*
|
||||
* Returns true if and only if $value contains a valid barcode
|
||||
*
|
||||
* @param string $value
|
||||
* @return boolean
|
||||
*/
|
||||
public function isValid($value)
|
||||
{
|
||||
if (!is_string($value)) {
|
||||
$this->_error(self::INVALID);
|
||||
return false;
|
||||
}
|
||||
|
||||
$this->_setValue($value);
|
||||
$adapter = $this->getAdapter();
|
||||
$this->_length = $adapter->getLength();
|
||||
$result = $adapter->checkLength($value);
|
||||
if (!$result) {
|
||||
$this->_error(self::INVALID_LENGTH);
|
||||
return false;
|
||||
}
|
||||
|
||||
$result = $adapter->checkChars($value);
|
||||
if (!$result) {
|
||||
$this->_error(self::INVALID_CHARS);
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($this->getChecksum()) {
|
||||
$result = $adapter->checksum($value);
|
||||
if (!$result) {
|
||||
$this->_error(self::FAILED);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,68 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to [email protected] so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Validate
|
||||
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Ean13.php 18028 2009-09-08 20:52:23Z thomas $
|
||||
*/
|
||||
|
||||
/**
|
||||
* @category Zend
|
||||
* @package Zend_Validate
|
||||
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
interface Zend_Validate_Barcode_AdapterInterface
|
||||
{
|
||||
/**
|
||||
* Checks the length of a barcode
|
||||
*
|
||||
* @param string $value The barcode to check for proper length
|
||||
* @return boolean
|
||||
*/
|
||||
public function checkLength($value);
|
||||
|
||||
/**
|
||||
* Checks for allowed characters within the barcode
|
||||
*
|
||||
* @param string $value The barcode to check for allowed characters
|
||||
* @return boolean
|
||||
*/
|
||||
public function checkChars($value);
|
||||
|
||||
/**
|
||||
* Validates the checksum
|
||||
*
|
||||
* @param string $value The barcode to check the checksum for
|
||||
* @return boolean
|
||||
*/
|
||||
public function checksum($value);
|
||||
|
||||
/**
|
||||
* Returns if barcode uses a checksum
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function getCheck();
|
||||
|
||||
/**
|
||||
* Sets the checksum validation
|
||||
*
|
||||
* @param boolean $check
|
||||
* @return Zend_Validate_Barcode_Adapter Provides fluid interface
|
||||
*/
|
||||
public function setCheck($check);
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to [email protected] so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Validate
|
||||
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id:$
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Validate_Barcode_AdapterAbstract
|
||||
*/
|
||||
// require_once 'Zend/Validate/Barcode/AdapterAbstract.php';
|
||||
|
||||
/**
|
||||
* @category Zend
|
||||
* @package Zend_Validate
|
||||
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Validate_Barcode_Code25 extends Zend_Validate_Barcode_AdapterAbstract
|
||||
{
|
||||
/**
|
||||
* Allowed barcode lengths
|
||||
* @var integer
|
||||
*/
|
||||
protected $_length = -1;
|
||||
|
||||
/**
|
||||
* Allowed barcode characters
|
||||
* @var string
|
||||
*/
|
||||
protected $_characters = '0123456789';
|
||||
|
||||
/**
|
||||
* Checksum function
|
||||
* @var string
|
||||
*/
|
||||
protected $_checksum = '_code25';
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* Sets check flag to false.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->setCheck(false);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to [email protected] so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Validate
|
||||
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id:$
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Validate_Barcode_AdapterAbstract
|
||||
*/
|
||||
// require_once 'Zend/Validate/Barcode/AdapterAbstract.php';
|
||||
|
||||
/**
|
||||
* @category Zend
|
||||
* @package Zend_Validate
|
||||
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Validate_Barcode_Code25interleaved extends Zend_Validate_Barcode_AdapterAbstract
|
||||
{
|
||||
/**
|
||||
* Allowed barcode lengths
|
||||
* @var integer
|
||||
*/
|
||||
protected $_length = 'even';
|
||||
|
||||
/**
|
||||
* Allowed barcode characters
|
||||
* @var string
|
||||
*/
|
||||
protected $_characters = '0123456789';
|
||||
|
||||
/**
|
||||
* Checksum function
|
||||
* @var string
|
||||
*/
|
||||
protected $_checksum = '_code25';
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* Sets check flag to false.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->setCheck(false);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,100 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to [email protected] so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Validate
|
||||
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id:$
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Validate_Barcode_AdapterAbstract
|
||||
*/
|
||||
// require_once 'Zend/Validate/Barcode/AdapterAbstract.php';
|
||||
|
||||
/**
|
||||
* @category Zend
|
||||
* @package Zend_Validate
|
||||
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Validate_Barcode_Code39 extends Zend_Validate_Barcode_AdapterAbstract
|
||||
{
|
||||
/**
|
||||
* Allowed barcode lengths
|
||||
* @var integer
|
||||
*/
|
||||
protected $_length = -1;
|
||||
|
||||
/**
|
||||
* Allowed barcode characters
|
||||
* @var string
|
||||
*/
|
||||
protected $_characters = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ -.$/+%';
|
||||
|
||||
/**
|
||||
* Checksum function
|
||||
* @var string
|
||||
*/
|
||||
protected $_checksum = '_code39';
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $_check = array(
|
||||
'0' => 0, '1' => 1, '2' => 2, '3' => 3, '4' => 4, '5' => 5, '6' => 6,
|
||||
'7' => 7, '8' => 8, '9' => 9, 'A' => 10, 'B' => 11, 'C' => 12, 'D' => 13,
|
||||
'E' => 14, 'F' => 15, 'G' => 16, 'H' => 17, 'I' => 18, 'J' => 19, 'K' => 20,
|
||||
'L' => 21, 'M' => 22, 'N' => 23, 'O' => 24, 'P' => 25, 'Q' => 26, 'R' => 27,
|
||||
'S' => 28, 'T' => 29, 'U' => 30, 'V' => 31, 'W' => 32, 'X' => 33, 'Y' => 34,
|
||||
'Z' => 35, '-' => 36, '.' => 37, ' ' => 38, '$' => 39, '/' => 40, '+' => 41,
|
||||
'%' => 42,
|
||||
);
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* Sets check flag to false.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->setCheck(false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Validates the checksum (Modulo 43)
|
||||
*
|
||||
* @param string $value The barcode to validate
|
||||
* @return boolean
|
||||
*/
|
||||
protected function _code39($value)
|
||||
{
|
||||
$checksum = substr($value, -1, 1);
|
||||
$value = str_split(substr($value, 0, -1));
|
||||
$count = 0;
|
||||
foreach($value as $char) {
|
||||
$count += $this->_check[$char];
|
||||
}
|
||||
|
||||
$mod = $count % 43;
|
||||
if ($mod == $this->_check[$checksum]) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to [email protected] so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Validate
|
||||
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id:$
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Validate_Barcode_AdapterAbstract
|
||||
*/
|
||||
// require_once 'Zend/Validate/Barcode/AdapterAbstract.php';
|
||||
|
||||
/**
|
||||
* @category Zend
|
||||
* @package Zend_Validate
|
||||
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Validate_Barcode_Code39ext extends Zend_Validate_Barcode_AdapterAbstract
|
||||
{
|
||||
/**
|
||||
* Allowed barcode lengths
|
||||
* @var integer
|
||||
*/
|
||||
protected $_length = -1;
|
||||
|
||||
/**
|
||||
* Allowed barcode characters
|
||||
* @var string
|
||||
*/
|
||||
protected $_characters = 128;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* Sets check flag to false.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->setCheck(false);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,120 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to [email protected] so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Validate
|
||||
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id:$
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Validate_Barcode_AdapterAbstract
|
||||
*/
|
||||
// require_once 'Zend/Validate/Barcode/AdapterAbstract.php';
|
||||
|
||||
/**
|
||||
* @category Zend
|
||||
* @package Zend_Validate
|
||||
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Validate_Barcode_Code93 extends Zend_Validate_Barcode_AdapterAbstract
|
||||
{
|
||||
/**
|
||||
* Allowed barcode lengths
|
||||
* @var integer
|
||||
*/
|
||||
protected $_length = -1;
|
||||
|
||||
/**
|
||||
* Allowed barcode characters
|
||||
* @var string
|
||||
*/
|
||||
protected $_characters = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ -.$/+%';
|
||||
|
||||
/**
|
||||
* Checksum function
|
||||
* @var string
|
||||
*/
|
||||
protected $_checksum = '_code93';
|
||||
|
||||
/**
|
||||
* Note that the characters !"§& are only synonyms
|
||||
* @var array
|
||||
*/
|
||||
protected $_check = array(
|
||||
'0' => 0, '1' => 1, '2' => 2, '3' => 3, '4' => 4, '5' => 5, '6' => 6,
|
||||
'7' => 7, '8' => 8, '9' => 9, 'A' => 10, 'B' => 11, 'C' => 12, 'D' => 13,
|
||||
'E' => 14, 'F' => 15, 'G' => 16, 'H' => 17, 'I' => 18, 'J' => 19, 'K' => 20,
|
||||
'L' => 21, 'M' => 22, 'N' => 23, 'O' => 24, 'P' => 25, 'Q' => 26, 'R' => 27,
|
||||
'S' => 28, 'T' => 29, 'U' => 30, 'V' => 31, 'W' => 32, 'X' => 33, 'Y' => 34,
|
||||
'Z' => 35, '-' => 36, '.' => 37, ' ' => 38, '$' => 39, '/' => 40, '+' => 41,
|
||||
'%' => 42, '!' => 43, '"' => 44, '§' => 45, '&' => 46,
|
||||
);
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* Sets check flag to false.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->setCheck(false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Validates the checksum (Modulo CK)
|
||||
*
|
||||
* @param string $value The barcode to validate
|
||||
* @return boolean
|
||||
*/
|
||||
protected function _code93($value)
|
||||
{
|
||||
$checksum = substr($value, -2, 2);
|
||||
$value = str_split(substr($value, 0, -2));
|
||||
$count = 0;
|
||||
$length = count($value) % 20;
|
||||
foreach($value as $char) {
|
||||
if ($length == 0) {
|
||||
$length = 20;
|
||||
}
|
||||
|
||||
$count += $this->_check[$char] * $length;
|
||||
--$length;
|
||||
}
|
||||
|
||||
$check = array_search(($count % 47), $this->_check);
|
||||
$value[] = $check;
|
||||
$count = 0;
|
||||
$length = count($value) % 15;
|
||||
foreach($value as $char) {
|
||||
if ($length == 0) {
|
||||
$length = 15;
|
||||
}
|
||||
|
||||
$count += $this->_check[$char] * $length;
|
||||
--$length;
|
||||
}
|
||||
$check .= array_search(($count % 47), $this->_check);
|
||||
|
||||
if ($check == $checksum) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to [email protected] so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Validate
|
||||
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id:$
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Validate_Barcode_AdapterAbstract
|
||||
*/
|
||||
// require_once 'Zend/Validate/Barcode/AdapterAbstract.php';
|
||||
|
||||
/**
|
||||
* @category Zend
|
||||
* @package Zend_Validate
|
||||
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Validate_Barcode_Code93ext extends Zend_Validate_Barcode_AdapterAbstract
|
||||
{
|
||||
/**
|
||||
* Allowed barcode lengths
|
||||
* @var integer
|
||||
*/
|
||||
protected $_length = -1;
|
||||
|
||||
/**
|
||||
* Allowed barcode characters
|
||||
* @var string
|
||||
*/
|
||||
protected $_characters = 128;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* Sets check flag to false.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->setCheck(false);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to [email protected] so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Validate
|
||||
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Ean13.php 18028 2009-09-08 20:52:23Z thomas $
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Validate_Barcode_AdapterAbstract
|
||||
*/
|
||||
// require_once 'Zend/Validate/Barcode/AdapterAbstract.php';
|
||||
|
||||
/**
|
||||
* @category Zend
|
||||
* @package Zend_Validate
|
||||
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Validate_Barcode_Ean12 extends Zend_Validate_Barcode_AdapterAbstract
|
||||
{
|
||||
/**
|
||||
* Allowed barcode lengths
|
||||
* @var integer
|
||||
*/
|
||||
protected $_length = 12;
|
||||
|
||||
/**
|
||||
* Allowed barcode characters
|
||||
* @var string
|
||||
*/
|
||||
protected $_characters = '0123456789';
|
||||
|
||||
/**
|
||||
* Checksum function
|
||||
* @var string
|
||||
*/
|
||||
protected $_checksum = '_gtin';
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to [email protected] so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Validate
|
||||
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Ean13.php 20096 2010-01-06 02:05:09Z bkarwin $
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Validate_Barcode_AdapterAbstract
|
||||
*/
|
||||
// require_once 'Zend/Validate/Barcode/AdapterAbstract.php';
|
||||
|
||||
/**
|
||||
* @category Zend
|
||||
* @package Zend_Validate
|
||||
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Validate_Barcode_Ean13 extends Zend_Validate_Barcode_AdapterAbstract
|
||||
{
|
||||
/**
|
||||
* Allowed barcode lengths
|
||||
* @var integer
|
||||
*/
|
||||
protected $_length = 13;
|
||||
|
||||
/**
|
||||
* Allowed barcode characters
|
||||
* @var string
|
||||
*/
|
||||
protected $_characters = '0123456789';
|
||||
|
||||
/**
|
||||
* Checksum function
|
||||
* @var string
|
||||
*/
|
||||
protected $_checksum = '_gtin';
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to [email protected] so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Validate
|
||||
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Ean13.php 18028 2009-09-08 20:52:23Z thomas $
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Validate_Barcode_AdapterAbstract
|
||||
*/
|
||||
// require_once 'Zend/Validate/Barcode/AdapterAbstract.php';
|
||||
|
||||
/**
|
||||
* @category Zend
|
||||
* @package Zend_Validate
|
||||
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Validate_Barcode_Ean14 extends Zend_Validate_Barcode_AdapterAbstract
|
||||
{
|
||||
/**
|
||||
* Allowed barcode lengths
|
||||
* @var integer
|
||||
*/
|
||||
protected $_length = 14;
|
||||
|
||||
/**
|
||||
* Allowed barcode characters
|
||||
* @var string
|
||||
*/
|
||||
protected $_characters = '0123456789';
|
||||
|
||||
/**
|
||||
* Checksum function
|
||||
* @var string
|
||||
*/
|
||||
protected $_checksum = '_gtin';
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to [email protected] so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Validate
|
||||
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Ean13.php 18028 2009-09-08 20:52:23Z thomas $
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Validate_Barcode_AdapterAbstract
|
||||
*/
|
||||
// require_once 'Zend/Validate/Barcode/AdapterAbstract.php';
|
||||
|
||||
/**
|
||||
* @category Zend
|
||||
* @package Zend_Validate
|
||||
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Validate_Barcode_Ean18 extends Zend_Validate_Barcode_AdapterAbstract
|
||||
{
|
||||
/**
|
||||
* Allowed barcode lengths
|
||||
* @var integer
|
||||
*/
|
||||
protected $_length = 18;
|
||||
|
||||
/**
|
||||
* Allowed barcode characters
|
||||
* @var string
|
||||
*/
|
||||
protected $_characters = '0123456789';
|
||||
|
||||
/**
|
||||
* Checksum function
|
||||
* @var string
|
||||
*/
|
||||
protected $_checksum = '_gtin';
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user