├── OOActiveRecordBehavior.php ├── OOUserIdentity.php ├── lib └── Zend │ ├── Http │ ├── UserAgent │ │ ├── Exception.php │ │ ├── Storage │ │ │ ├── Exception.php │ │ │ └── NonPersistent.php │ │ ├── Features │ │ │ ├── Exception.php │ │ │ ├── Adapter.php │ │ │ └── Adapter │ │ │ │ ├── DeviceAtlas.php │ │ │ │ └── TeraWurfl.php │ │ ├── Desktop.php │ │ ├── Email.php │ │ ├── Console.php │ │ ├── Offline.php │ │ ├── Validator.php │ │ ├── Checker.php │ │ ├── Storage.php │ │ ├── Spam.php │ │ ├── Feed.php │ │ ├── Probe.php │ │ ├── Text.php │ │ └── Bot.php │ ├── Exception.php │ └── Client │ │ ├── Exception.php │ │ └── Adapter │ │ ├── Exception.php │ │ ├── Stream.php │ │ └── Interface.php │ ├── Validate │ ├── Exception.php │ ├── Barcode │ │ ├── Ean12.php │ │ ├── Ean13.php │ │ ├── Ean14.php │ │ ├── Ean18.php │ │ ├── Itf14.php │ │ ├── Sscc.php │ │ ├── Upca.php │ │ ├── Gtin12.php │ │ ├── Gtin13.php │ │ ├── Gtin14.php │ │ ├── Leitcode.php │ │ ├── Identcode.php │ │ ├── Planet.php │ │ ├── Postnet.php │ │ ├── Ean2.php │ │ ├── Ean5.php │ │ ├── Code39ext.php │ │ ├── Code93ext.php │ │ ├── Intelligentmail.php │ │ ├── Code25.php │ │ ├── Code25interleaved.php │ │ ├── Ean8.php │ │ ├── Upce.php │ │ ├── AdapterInterface.php │ │ ├── Code39.php │ │ ├── Issn.php │ │ └── Code93.php │ ├── Db │ │ ├── RecordExists.php │ │ └── NoRecordExists.php │ ├── Interface.php │ ├── Hex.php │ ├── Sitemap │ │ ├── Priority.php │ │ ├── Loc.php │ │ ├── Lastmod.php │ │ └── Changefreq.php │ ├── File │ │ ├── NotExists.php │ │ ├── ExcludeExtension.php │ │ └── WordCount.php │ ├── Digits.php │ ├── LessThan.php │ ├── GreaterThan.php │ └── Ccnum.php │ ├── XmlRpc │ ├── Exception.php │ ├── Value │ │ ├── Exception.php │ │ ├── Scalar.php │ │ ├── Nil.php │ │ ├── BigInteger.php │ │ ├── String.php │ │ ├── Double.php │ │ ├── Boolean.php │ │ ├── Integer.php │ │ ├── Base64.php │ │ ├── Array.php │ │ ├── Struct.php │ │ ├── Collection.php │ │ └── DateTime.php │ ├── Server │ │ ├── Exception.php │ │ └── Cache.php │ ├── Client │ │ ├── Exception.php │ │ ├── FaultException.php │ │ ├── HttpException.php │ │ ├── IntrospectException.php │ │ └── ServerProxy.php │ ├── Response │ │ └── Http.php │ ├── Request │ │ ├── Stdin.php │ │ └── Http.php │ └── Generator │ │ ├── XmlWriter.php │ │ └── DomDocument.php │ ├── Uri │ └── Exception.php │ ├── Loader │ ├── Exception.php │ ├── PluginLoader │ │ ├── Exception.php │ │ └── Interface.php │ └── Autoloader │ │ └── Interface.php │ └── Exception.php └── OOCriteria.php /OOActiveRecordBehavior.php: -------------------------------------------------------------------------------- 1 | openerp->getClientCommon()->login(Yii::app()->openerp->database, 21 | $this->username, $this->password); 22 | 23 | if ($uid !== false) { 24 | Yii::app()->session['openerp_user_id'] = $uid; 25 | Yii::app()->session['openerp_user'] = $this->username; 26 | Yii::app()->session['openerp_password'] = $this->password; 27 | $this->errorCode=self::ERROR_NONE; 28 | return true; 29 | } 30 | return false; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /lib/Zend/Http/UserAgent/Exception.php: -------------------------------------------------------------------------------- 1 | $value) { 17 | $this->$name = $value; 18 | } 19 | } 20 | 21 | protected function addValidDomain($ditem) 22 | { 23 | if ($this->domain == null) { 24 | $this->domain = array(); 25 | } 26 | $this->domain[] = $ditem; 27 | } 28 | 29 | public function addDomain(array $ditem) { 30 | if ($ditem[2] !== null) { 31 | $this->addValidDomain($ditem); 32 | } 33 | } 34 | 35 | public function mergeWith($criteria) { 36 | 37 | if ($this->fields !== null && $criteria->fields !== null) { 38 | $this->fields = array_merge($this->fields, $criteria->fields); 39 | } else if ($this->fields === null) { 40 | $this->fields = $criteria->fields; 41 | } 42 | 43 | if ($this->domain !== null && $criteria->domain !== null) { 44 | $this->domain = array_merge($this->domain, $criteria->domain); 45 | } else if ($this->domain === null) { 46 | $this->domain = $criteria->domain; 47 | } 48 | 49 | if ($this->context !== null && $criteria->context !== null) { 50 | $this->context = array_merge($this->context, $criteria->context); 51 | } else if ($this->context === null) { 52 | $this->context = $criteria->context; 53 | } 54 | } 55 | 56 | } 57 | -------------------------------------------------------------------------------- /lib/Zend/Loader/Autoloader/Interface.php: -------------------------------------------------------------------------------- 1 | getEncoding())); 47 | } 48 | 49 | return parent::__toString(); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /lib/Zend/Validate/Barcode/Ean12.php: -------------------------------------------------------------------------------- 1 | _setValue($value); 42 | 43 | $result = $this->_query($value); 44 | if (!$result) { 45 | $valid = false; 46 | $this->_error(self::ERROR_NO_RECORD_FOUND); 47 | } 48 | 49 | return $valid; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /lib/Zend/Validate/Db/NoRecordExists.php: -------------------------------------------------------------------------------- 1 | _setValue($value); 42 | 43 | $result = $this->_query($value); 44 | if ($result) { 45 | $valid = false; 46 | $this->_error(self::ERROR_RECORD_FOUND); 47 | } 48 | 49 | return $valid; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /lib/Zend/Http/UserAgent/Desktop.php: -------------------------------------------------------------------------------- 1 | getGenerator(); 47 | 48 | $generator->openElement('value') 49 | ->openElement($this->_type, $this->_value) 50 | ->closeElement($this->_type) 51 | ->closeElement('value'); 52 | } 53 | } -------------------------------------------------------------------------------- /lib/Zend/Validate/Barcode/Ean2.php: -------------------------------------------------------------------------------- 1 | setCheck(false); 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /lib/Zend/Validate/Barcode/Ean5.php: -------------------------------------------------------------------------------- 1 | setCheck(false); 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /lib/Zend/XmlRpc/Value/Nil.php: -------------------------------------------------------------------------------- 1 | _type = self::XMLRPC_TYPE_NIL; 47 | $this->_value = null; 48 | } 49 | 50 | /** 51 | * Return the value of this object, convert the XML-RPC native nill value into a PHP NULL 52 | * 53 | * @return null 54 | */ 55 | public function getValue() 56 | { 57 | return null; 58 | } 59 | } 60 | 61 | -------------------------------------------------------------------------------- /lib/Zend/Validate/Barcode/Code39ext.php: -------------------------------------------------------------------------------- 1 | setCheck(false); 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /lib/Zend/Validate/Barcode/Code93ext.php: -------------------------------------------------------------------------------- 1 | setCheck(false); 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /lib/Zend/Validate/Barcode/Intelligentmail.php: -------------------------------------------------------------------------------- 1 | setCheck(false); 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /lib/Zend/XmlRpc/Value/BigInteger.php: -------------------------------------------------------------------------------- 1 | _value = $integer->init($value); 46 | $this->_type = self::XMLRPC_TYPE_I8; 47 | } 48 | 49 | /** 50 | * Return bigint value 51 | * 52 | * @return string 53 | */ 54 | public function getValue() 55 | { 56 | return $this->_value; 57 | } 58 | } -------------------------------------------------------------------------------- /lib/Zend/XmlRpc/Value/String.php: -------------------------------------------------------------------------------- 1 | _type = self::XMLRPC_TYPE_STRING; 46 | 47 | // Make sure this value is string and all XML characters are encoded 48 | $this->_value = (string)$value; 49 | } 50 | 51 | /** 52 | * Return the value of this object, convert the XML-RPC native string value into a PHP string 53 | * 54 | * @return string 55 | */ 56 | public function getValue() 57 | { 58 | return (string)$this->_value; 59 | } 60 | } -------------------------------------------------------------------------------- /lib/Zend/Validate/Barcode/Code25.php: -------------------------------------------------------------------------------- 1 | setCheck(false); 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /lib/Zend/Validate/Barcode/Code25interleaved.php: -------------------------------------------------------------------------------- 1 | setCheck(false); 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /lib/Zend/XmlRpc/Value/Double.php: -------------------------------------------------------------------------------- 1 | _type = self::XMLRPC_TYPE_DOUBLE; 48 | $precision = (int)ini_get('precision'); 49 | $formatString = '%1.' . $precision . 'F'; 50 | $this->_value = rtrim(sprintf($formatString, (float)$value), '0'); 51 | } 52 | 53 | /** 54 | * Return the value of this object, convert the XML-RPC native double value into a PHP float 55 | * 56 | * @return float 57 | */ 58 | public function getValue() 59 | { 60 | return (float)$this->_value; 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /lib/Zend/Http/UserAgent/Email.php: -------------------------------------------------------------------------------- 1 | _type = self::XMLRPC_TYPE_BOOLEAN; 49 | // Make sure the value is boolean and then convert it into a integer 50 | // The double convertion is because a bug in the ZendOptimizer in PHP version 5.0.4 51 | $this->_value = (int)(bool)$value; 52 | } 53 | 54 | /** 55 | * Return the value of this object, convert the XML-RPC native boolean value into a PHP boolean 56 | * 57 | * @return bool 58 | */ 59 | public function getValue() 60 | { 61 | return (bool)$this->_value; 62 | } 63 | } -------------------------------------------------------------------------------- /lib/Zend/XmlRpc/Value/Integer.php: -------------------------------------------------------------------------------- 1 | PHP_INT_MAX) { 48 | require_once 'Zend/XmlRpc/Value/Exception.php'; 49 | throw new Zend_XmlRpc_Value_Exception('Overlong integer given'); 50 | } 51 | 52 | $this->_type = self::XMLRPC_TYPE_INTEGER; 53 | $this->_value = (int)$value; // Make sure this value is integer 54 | } 55 | 56 | /** 57 | * Return the value of this object, convert the XML-RPC native integer value into a PHP integer 58 | * 59 | * @return int 60 | */ 61 | public function getValue() 62 | { 63 | return $this->_value; 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /lib/Zend/Validate/Barcode/Ean8.php: -------------------------------------------------------------------------------- 1 | setCheck(false); 63 | } else { 64 | $this->setCheck(true); 65 | } 66 | 67 | return parent::checkLength($value); 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /lib/Zend/Validate/Barcode/Upce.php: -------------------------------------------------------------------------------- 1 | setCheck(false); 63 | } else { 64 | $this->setCheck(true); 65 | } 66 | 67 | return parent::checkLength($value); 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /lib/Zend/Validate/Interface.php: -------------------------------------------------------------------------------- 1 | _type = self::XMLRPC_TYPE_BASE64; 50 | 51 | $value = (string)$value; // Make sure this value is string 52 | if (!$alreadyEncoded) { 53 | $value = base64_encode($value); // We encode it in base64 54 | } 55 | $this->_value = $value; 56 | } 57 | 58 | /** 59 | * Return the value of this object, convert the XML-RPC native base64 value into a PHP string 60 | * We return this value decoded (a normal string) 61 | * 62 | * @return string 63 | */ 64 | public function getValue() 65 | { 66 | return base64_decode($this->_value); 67 | } 68 | } -------------------------------------------------------------------------------- /lib/Zend/XmlRpc/Value/Array.php: -------------------------------------------------------------------------------- 1 | _type = self::XMLRPC_TYPE_ARRAY; 47 | parent::__construct($value); 48 | } 49 | 50 | 51 | /** 52 | * Generate the XML code that represent an array native MXL-RPC value 53 | * 54 | * @return void 55 | */ 56 | protected function _generateXml() 57 | { 58 | $generator = $this->getGenerator(); 59 | $generator->openElement('value') 60 | ->openElement('array') 61 | ->openElement('data'); 62 | 63 | if (is_array($this->_value)) { 64 | foreach ($this->_value as $val) { 65 | $val->generateXml(); 66 | } 67 | } 68 | $generator->closeElement('data') 69 | ->closeElement('array') 70 | ->closeElement('value'); 71 | } 72 | } 73 | 74 | -------------------------------------------------------------------------------- /lib/Zend/Validate/Hex.php: -------------------------------------------------------------------------------- 1 | "Invalid type given. String expected", 45 | self::NOT_HEX => "'%value%' has not only hexadecimal digit characters", 46 | ); 47 | 48 | /** 49 | * Defined by Zend_Validate_Interface 50 | * 51 | * Returns true if and only if $value contains only hexadecimal digit characters 52 | * 53 | * @param string $value 54 | * @return boolean 55 | */ 56 | public function isValid($value) 57 | { 58 | if (!is_string($value) && !is_int($value)) { 59 | $this->_error(self::INVALID); 60 | return false; 61 | } 62 | 63 | $this->_setValue($value); 64 | if (!ctype_xdigit((string) $value)) { 65 | $this->_error(self::NOT_HEX); 66 | return false; 67 | } 68 | 69 | return true; 70 | } 71 | 72 | } 73 | -------------------------------------------------------------------------------- /lib/Zend/Loader/PluginLoader/Interface.php: -------------------------------------------------------------------------------- 1 | _type = self::XMLRPC_TYPE_STRUCT; 47 | parent::__construct($value); 48 | } 49 | 50 | 51 | /** 52 | * Generate the XML code that represent struct native MXL-RPC value 53 | * 54 | * @return void 55 | */ 56 | protected function _generateXML() 57 | { 58 | $generator = $this->getGenerator(); 59 | $generator->openElement('value') 60 | ->openElement('struct'); 61 | 62 | if (is_array($this->_value)) { 63 | foreach ($this->_value as $name => $val) { 64 | /* @var $val Zend_XmlRpc_Value */ 65 | $generator->openElement('member') 66 | ->openElement('name', $name) 67 | ->closeElement('name'); 68 | $val->generateXml(); 69 | $generator->closeElement('member'); 70 | } 71 | } 72 | $generator->closeElement('struct') 73 | ->closeElement('value'); 74 | } 75 | } -------------------------------------------------------------------------------- /lib/Zend/XmlRpc/Value/Collection.php: -------------------------------------------------------------------------------- 1 | $value) { 49 | // If the elements of the given array are not Zend_XmlRpc_Value objects, 50 | // we need to convert them as such (using auto-detection from PHP value) 51 | if (!$value instanceof parent) { 52 | $value = self::getXmlRpcValue($value, self::AUTO_DETECT_TYPE); 53 | } 54 | $this->_value[$key] = $value; 55 | } 56 | } 57 | 58 | 59 | /** 60 | * Return the value of this object, convert the XML-RPC native collection values into a PHP array 61 | * 62 | * @return arary 63 | */ 64 | public function getValue() 65 | { 66 | $values = (array)$this->_value; 67 | foreach ($values as $key => $value) { 68 | /* @var $value Zend_XmlRpc_Value */ 69 | $values[$key] = $value->getValue(); 70 | } 71 | return $values; 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /lib/Zend/Http/UserAgent/Spam.php: -------------------------------------------------------------------------------- 1 | setFeature('images', false, 'product_capability'); 74 | $this->setFeature('iframes', false, 'product_capability'); 75 | $this->setFeature('frames', false, 'product_capability'); 76 | $this->setFeature('javascript', false, 'product_capability'); 77 | return parent::_defineFeatures(); 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /lib/Zend/Http/UserAgent/Feed.php: -------------------------------------------------------------------------------- 1 | setFeature('iframes', false, 'product_capability'); 77 | $this->setFeature('frames', false, 'product_capability'); 78 | $this->setFeature('javascript', false, 'product_capability'); 79 | return parent::_defineFeatures(); 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /lib/Zend/Http/UserAgent/Probe.php: -------------------------------------------------------------------------------- 1 | setFeature('images', false, 'product_capability'); 76 | $this->setFeature('iframes', false, 'product_capability'); 77 | $this->setFeature('frames', false, 'product_capability'); 78 | $this->setFeature('javascript', false, 'product_capability'); 79 | return parent::_defineFeatures(); 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /lib/Zend/XmlRpc/Request/Stdin.php: -------------------------------------------------------------------------------- 1 | _fault = new Zend_XmlRpc_Server_Exception(630); 61 | return; 62 | } 63 | 64 | $xml = ''; 65 | while (!feof($fh)) { 66 | $xml .= fgets($fh); 67 | } 68 | fclose($fh); 69 | 70 | $this->_xml = $xml; 71 | 72 | $this->loadXml($xml); 73 | } 74 | 75 | /** 76 | * Retrieve the raw XML request 77 | * 78 | * @return string 79 | */ 80 | public function getRawRequest() 81 | { 82 | return $this->_xml; 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /lib/Zend/Http/Client/Adapter/Interface.php: -------------------------------------------------------------------------------- 1 | _xmlWriter = new XMLWriter(); 48 | $this->_xmlWriter->openMemory(); 49 | $this->_xmlWriter->startDocument('1.0', $this->_encoding); 50 | } 51 | 52 | 53 | /** 54 | * Open a new XML element 55 | * 56 | * @param string $name XML element name 57 | * @return void 58 | */ 59 | protected function _openElement($name) 60 | { 61 | $this->_xmlWriter->startElement($name); 62 | } 63 | 64 | /** 65 | * Write XML text data into the currently opened XML element 66 | * 67 | * @param string $text XML text data 68 | * @return void 69 | */ 70 | protected function _writeTextData($text) 71 | { 72 | $this->_xmlWriter->text($text); 73 | } 74 | 75 | /** 76 | * Close an previously opened XML element 77 | * 78 | * @param string $name 79 | * @return void 80 | */ 81 | protected function _closeElement($name) 82 | { 83 | $this->_xmlWriter->endElement(); 84 | 85 | return $this; 86 | } 87 | 88 | public function saveXml() 89 | { 90 | $xml = $this->_xmlWriter->flush(false); 91 | return $xml; 92 | } 93 | } 94 | -------------------------------------------------------------------------------- /lib/Zend/Validate/Sitemap/Priority.php: -------------------------------------------------------------------------------- 1 | value 30 | * 31 | * @link http://www.sitemaps.org/protocol.php Sitemaps XML format 32 | * 33 | * @category Zend 34 | * @package Zend_Validate 35 | * @subpackage Sitemap 36 | * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com) 37 | * @license http://framework.zend.com/license/new-bsd New BSD License 38 | */ 39 | class Zend_Validate_Sitemap_Priority extends Zend_Validate_Abstract 40 | { 41 | /** 42 | * Validation key for not valid 43 | * 44 | */ 45 | const NOT_VALID = 'sitemapPriorityNotValid'; 46 | const INVALID = 'sitemapPriorityInvalid'; 47 | 48 | /** 49 | * Validation failure message template definitions 50 | * 51 | * @var array 52 | */ 53 | protected $_messageTemplates = array( 54 | self::NOT_VALID => "'%value%' is no valid sitemap priority", 55 | self::INVALID => "Invalid type given. Numeric string, integer or float expected", 56 | ); 57 | 58 | /** 59 | * Validates if a string is valid as a sitemap priority 60 | * 61 | * @link http://www.sitemaps.org/protocol.php#prioritydef 62 | * 63 | * @param string $value value to validate 64 | * @return boolean 65 | */ 66 | public function isValid($value) 67 | { 68 | if (!is_numeric($value)) { 69 | $this->_error(self::INVALID); 70 | return false; 71 | } 72 | 73 | $this->_setValue($value); 74 | $value = (float) $value; 75 | if ($value < 0 || $value > 1) { 76 | $this->_error(self::NOT_VALID); 77 | return false; 78 | } 79 | 80 | return true; 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /lib/Zend/Validate/Sitemap/Loc.php: -------------------------------------------------------------------------------- 1 | value 35 | * 36 | * @link http://www.sitemaps.org/protocol.php Sitemaps XML format 37 | * 38 | * @category Zend 39 | * @package Zend_Validate 40 | * @subpackage Sitemap 41 | * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com) 42 | * @license http://framework.zend.com/license/new-bsd New BSD License 43 | */ 44 | class Zend_Validate_Sitemap_Loc extends Zend_Validate_Abstract 45 | { 46 | /** 47 | * Validation key for not valid 48 | * 49 | */ 50 | const NOT_VALID = 'sitemapLocNotValid'; 51 | const INVALID = 'sitemapLocInvalid'; 52 | 53 | /** 54 | * Validation failure message template definitions 55 | * 56 | * @var array 57 | */ 58 | protected $_messageTemplates = array( 59 | self::NOT_VALID => "'%value%' is no valid sitemap location", 60 | self::INVALID => "Invalid type given. String expected", 61 | ); 62 | 63 | /** 64 | * Validates if a string is valid as a sitemap location 65 | * 66 | * @link http://www.sitemaps.org/protocol.php#locdef 67 | * 68 | * @param string $value value to validate 69 | * @return boolean 70 | */ 71 | public function isValid($value) 72 | { 73 | if (!is_string($value)) { 74 | $this->_error(self::INVALID); 75 | return false; 76 | } 77 | 78 | $this->_setValue($value); 79 | $result = Zend_Uri::check($value); 80 | if ($result !== true) { 81 | $this->_error(self::NOT_VALID); 82 | return false; 83 | } 84 | 85 | return true; 86 | } 87 | } 88 | -------------------------------------------------------------------------------- /lib/Zend/Validate/File/NotExists.php: -------------------------------------------------------------------------------- 1 | "File '%value%' exists", 47 | ); 48 | 49 | /** 50 | * Defined by Zend_Validate_Interface 51 | * 52 | * Returns true if and only if the file does not exist in the set destinations 53 | * 54 | * @param string $value Real file to check for 55 | * @param array $file File data from Zend_File_Transfer 56 | * @return boolean 57 | */ 58 | public function isValid($value, $file = null) 59 | { 60 | $directories = $this->getDirectory(true); 61 | if (($file !== null) and (!empty($file['destination']))) { 62 | $directories[] = $file['destination']; 63 | } else if (!isset($file['name'])) { 64 | $file['name'] = $value; 65 | } 66 | 67 | foreach ($directories as $directory) { 68 | if (empty($directory)) { 69 | continue; 70 | } 71 | 72 | $check = true; 73 | if (file_exists($directory . DIRECTORY_SEPARATOR . $file['name'])) { 74 | return $this->_throw($file, self::DOES_EXIST); 75 | } 76 | } 77 | 78 | if (!isset($check)) { 79 | return $this->_throw($file, self::DOES_EXIST); 80 | } 81 | 82 | return true; 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /lib/Zend/XmlRpc/Client/ServerProxy.php: -------------------------------------------------------------------------------- 1 | foo->bar->baz()". 28 | * 29 | * @category Zend 30 | * @package Zend_XmlRpc 31 | * @subpackage Client 32 | * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com) 33 | * @license http://framework.zend.com/license/new-bsd New BSD License 34 | */ 35 | class Zend_XmlRpc_Client_ServerProxy 36 | { 37 | /** 38 | * @var Zend_XmlRpc_Client 39 | */ 40 | private $_client = null; 41 | 42 | /** 43 | * @var string 44 | */ 45 | private $_namespace = ''; 46 | 47 | 48 | /** 49 | * @var array of Zend_XmlRpc_Client_ServerProxy 50 | */ 51 | private $_cache = array(); 52 | 53 | 54 | /** 55 | * Class constructor 56 | * 57 | * @param string $namespace 58 | * @param Zend_XmlRpc_Client $client 59 | */ 60 | public function __construct($client, $namespace = '') 61 | { 62 | $this->_namespace = $namespace; 63 | $this->_client = $client; 64 | } 65 | 66 | 67 | /** 68 | * Get the next successive namespace 69 | * 70 | * @param string $name 71 | * @return Zend_XmlRpc_Client_ServerProxy 72 | */ 73 | public function __get($namespace) 74 | { 75 | $namespace = ltrim("$this->_namespace.$namespace", '.'); 76 | if (!isset($this->_cache[$namespace])) { 77 | $this->_cache[$namespace] = new $this($this->_client, $namespace); 78 | } 79 | return $this->_cache[$namespace]; 80 | } 81 | 82 | 83 | /** 84 | * Call a method in this namespace. 85 | * 86 | * @param string $methodN 87 | * @param array $args 88 | * @return mixed 89 | */ 90 | public function __call($method, $args) 91 | { 92 | $method = ltrim("$this->_namespace.$method", '.'); 93 | return $this->_client->call($method, $args); 94 | } 95 | } 96 | -------------------------------------------------------------------------------- /lib/Zend/Exception.php: -------------------------------------------------------------------------------- 1 | _previous = $previous; 48 | } else { 49 | parent::__construct($msg, (int) $code, $previous); 50 | } 51 | } 52 | 53 | /** 54 | * Overloading 55 | * 56 | * For PHP < 5.3.0, provides access to the getPrevious() method. 57 | * 58 | * @param string $method 59 | * @param array $args 60 | * @return mixed 61 | */ 62 | public function __call($method, array $args) 63 | { 64 | if ('getprevious' == strtolower($method)) { 65 | return $this->_getPrevious(); 66 | } 67 | return null; 68 | } 69 | 70 | /** 71 | * String representation of the exception 72 | * 73 | * @return string 74 | */ 75 | public function __toString() 76 | { 77 | if (version_compare(PHP_VERSION, '5.3.0', '<')) { 78 | if (null !== ($e = $this->getPrevious())) { 79 | return $e->__toString() 80 | . "\n\nNext " 81 | . parent::__toString(); 82 | } 83 | } 84 | return parent::__toString(); 85 | } 86 | 87 | /** 88 | * Returns previous Exception 89 | * 90 | * @return Exception|null 91 | */ 92 | protected function _getPrevious() 93 | { 94 | return $this->_previous; 95 | } 96 | } 97 | -------------------------------------------------------------------------------- /lib/Zend/Validate/Sitemap/Lastmod.php: -------------------------------------------------------------------------------- 1 | value 30 | * 31 | * @link http://www.sitemaps.org/protocol.php Sitemaps XML format 32 | * 33 | * @category Zend 34 | * @package Zend_Validate 35 | * @subpackage Sitemap 36 | * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com) 37 | * @license http://framework.zend.com/license/new-bsd New BSD License 38 | */ 39 | class Zend_Validate_Sitemap_Lastmod extends Zend_Validate_Abstract 40 | { 41 | /** 42 | * Regular expression to use when validating 43 | * 44 | */ 45 | const LASTMOD_REGEX = '/^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])(T([0-1][0-9]|2[0-3])(:[0-5][0-9])(:[0-5][0-9])?(\\+|-)([0-1][0-9]|2[0-3]):[0-5][0-9])?$/'; 46 | 47 | /** 48 | * Validation key for not valid 49 | * 50 | */ 51 | const NOT_VALID = 'sitemapLastmodNotValid'; 52 | const INVALID = 'sitemapLastmodInvalid'; 53 | 54 | /** 55 | * Validation failure message template definitions 56 | * 57 | * @var array 58 | */ 59 | protected $_messageTemplates = array( 60 | self::NOT_VALID => "'%value%' is no valid sitemap lastmod", 61 | self::INVALID => "Invalid type given. String expected", 62 | ); 63 | 64 | /** 65 | * Validates if a string is valid as a sitemap lastmod 66 | * 67 | * @link http://www.sitemaps.org/protocol.php#lastmoddef 68 | * 69 | * @param string $value value to validate 70 | * @return boolean 71 | */ 72 | public function isValid($value) 73 | { 74 | if (!is_string($value)) { 75 | $this->_error(self::INVALID); 76 | return false; 77 | } 78 | 79 | $this->_setValue($value); 80 | $result = @preg_match(self::LASTMOD_REGEX, $value); 81 | if ($result != 1) { 82 | $this->_error(self::NOT_VALID); 83 | return false; 84 | } 85 | 86 | return true; 87 | } 88 | } 89 | -------------------------------------------------------------------------------- /lib/Zend/Validate/Digits.php: -------------------------------------------------------------------------------- 1 | "'%value%' must contain only digits", 53 | self::STRING_EMPTY => "'%value%' is an empty string", 54 | self::INVALID => "Invalid type given. String, integer or float expected", 55 | ); 56 | 57 | /** 58 | * Defined by Zend_Validate_Interface 59 | * 60 | * Returns true if and only if $value only contains digit characters 61 | * 62 | * @param string $value 63 | * @return boolean 64 | */ 65 | public function isValid($value) 66 | { 67 | if (!is_string($value) && !is_int($value) && !is_float($value)) { 68 | $this->_error(self::INVALID); 69 | return false; 70 | } 71 | 72 | $this->_setValue((string) $value); 73 | 74 | if ('' === $this->_value) { 75 | $this->_error(self::STRING_EMPTY); 76 | return false; 77 | } 78 | 79 | if (null === self::$_filter) { 80 | require_once 'Zend/Filter/Digits.php'; 81 | self::$_filter = new Zend_Filter_Digits(); 82 | } 83 | 84 | if ($this->_value !== self::$_filter->filter($this->_value)) { 85 | $this->_error(self::NOT_DIGITS); 86 | return false; 87 | } 88 | 89 | return true; 90 | } 91 | } 92 | -------------------------------------------------------------------------------- /lib/Zend/XmlRpc/Generator/DomDocument.php: -------------------------------------------------------------------------------- 1 | _dom->createElement($name); 52 | 53 | $this->_currentElement = $this->_currentElement->appendChild($newElement); 54 | } 55 | 56 | /** 57 | * Write XML text data into the currently opened XML element 58 | * 59 | * @param string $text 60 | */ 61 | protected function _writeTextData($text) 62 | { 63 | $this->_currentElement->appendChild($this->_dom->createTextNode($text)); 64 | } 65 | 66 | /** 67 | * Close an previously opened XML element 68 | * 69 | * Resets $_currentElement to the next parent node in the hierarchy 70 | * 71 | * @param string $name 72 | * @return void 73 | */ 74 | protected function _closeElement($name) 75 | { 76 | if (isset($this->_currentElement->parentNode)) { 77 | $this->_currentElement = $this->_currentElement->parentNode; 78 | } 79 | } 80 | 81 | /** 82 | * Save XML as a string 83 | * 84 | * @return string 85 | */ 86 | public function saveXml() 87 | { 88 | return $this->_dom->saveXml(); 89 | } 90 | 91 | /** 92 | * Initializes internal objects 93 | * 94 | * @return void 95 | */ 96 | protected function _init() 97 | { 98 | $this->_dom = new DOMDocument('1.0', $this->_encoding); 99 | $this->_currentElement = $this->_dom; 100 | } 101 | } -------------------------------------------------------------------------------- /lib/Zend/Validate/Sitemap/Changefreq.php: -------------------------------------------------------------------------------- 1 | value 30 | * 31 | * @link http://www.sitemaps.org/protocol.php Sitemaps XML format 32 | * 33 | * @category Zend 34 | * @package Zend_Validate 35 | * @subpackage Sitemap 36 | * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com) 37 | * @license http://framework.zend.com/license/new-bsd New BSD License 38 | */ 39 | class Zend_Validate_Sitemap_Changefreq extends Zend_Validate_Abstract 40 | { 41 | /** 42 | * Validation key for not valid 43 | * 44 | */ 45 | const NOT_VALID = 'sitemapChangefreqNotValid'; 46 | const INVALID = 'sitemapChangefreqInvalid'; 47 | 48 | /** 49 | * Validation failure message template definitions 50 | * 51 | * @var array 52 | */ 53 | protected $_messageTemplates = array( 54 | self::NOT_VALID => "'%value%' is no valid sitemap changefreq", 55 | self::INVALID => "Invalid type given. String expected", 56 | ); 57 | 58 | /** 59 | * Valid change frequencies 60 | * 61 | * @var array 62 | */ 63 | protected $_changeFreqs = array( 64 | 'always', 'hourly', 'daily', 'weekly', 65 | 'monthly', 'yearly', 'never' 66 | ); 67 | 68 | /** 69 | * Validates if a string is valid as a sitemap changefreq 70 | * 71 | * @link http://www.sitemaps.org/protocol.php#changefreqdef 72 | * 73 | * @param string $value value to validate 74 | * @return boolean 75 | */ 76 | public function isValid($value) 77 | { 78 | if (!is_string($value)) { 79 | $this->_error(self::INVALID); 80 | return false; 81 | } 82 | 83 | $this->_setValue($value); 84 | if (!is_string($value)) { 85 | return false; 86 | } 87 | 88 | if (!in_array($value, $this->_changeFreqs, true)) { 89 | $this->_error(self::NOT_VALID); 90 | return false; 91 | } 92 | 93 | return true; 94 | } 95 | } 96 | -------------------------------------------------------------------------------- /lib/Zend/Http/UserAgent/Storage/NonPersistent.php: -------------------------------------------------------------------------------- 1 | _data); 60 | } 61 | 62 | /** 63 | * Returns the contents of storage 64 | * 65 | * Behavior is undefined when storage is empty. 66 | * 67 | * @throws Zend_Http_UserAgent_Storage_Exception If reading contents from storage is impossible 68 | * @return mixed 69 | */ 70 | public function read() 71 | { 72 | return $this->_data; 73 | } 74 | 75 | /** 76 | * Writes $contents to storage 77 | * 78 | * @param mixed $contents 79 | * @throws Zend_Http_UserAgent_Storage_Exception If writing $contents to storage is impossible 80 | * @return void 81 | */ 82 | public function write($contents) 83 | { 84 | $this->_data = $contents; 85 | } 86 | 87 | /** 88 | * Clears contents from storage 89 | * 90 | * @throws Zend_Http_UserAgent_Storage_Exception If clearing contents from storage is impossible 91 | * @return void 92 | */ 93 | public function clear() 94 | { 95 | $this->_data = null; 96 | } 97 | } 98 | -------------------------------------------------------------------------------- /lib/Zend/Http/UserAgent/Features/Adapter/DeviceAtlas.php: -------------------------------------------------------------------------------- 1 | 0, '1' => 1, '2' => 2, '3' => 3, '4' => 4, '5' => 5, '6' => 6, 58 | '7' => 7, '8' => 8, '9' => 9, 'A' => 10, 'B' => 11, 'C' => 12, 'D' => 13, 59 | 'E' => 14, 'F' => 15, 'G' => 16, 'H' => 17, 'I' => 18, 'J' => 19, 'K' => 20, 60 | 'L' => 21, 'M' => 22, 'N' => 23, 'O' => 24, 'P' => 25, 'Q' => 26, 'R' => 27, 61 | 'S' => 28, 'T' => 29, 'U' => 30, 'V' => 31, 'W' => 32, 'X' => 33, 'Y' => 34, 62 | 'Z' => 35, '-' => 36, '.' => 37, ' ' => 38, '$' => 39, '/' => 40, '+' => 41, 63 | '%' => 42, 64 | ); 65 | 66 | /** 67 | * Constructor 68 | * 69 | * Sets check flag to false. 70 | * 71 | * @return void 72 | */ 73 | public function __construct() 74 | { 75 | $this->setCheck(false); 76 | } 77 | 78 | /** 79 | * Validates the checksum (Modulo 43) 80 | * 81 | * @param string $value The barcode to validate 82 | * @return boolean 83 | */ 84 | protected function _code39($value) 85 | { 86 | $checksum = substr($value, -1, 1); 87 | $value = str_split(substr($value, 0, -1)); 88 | $count = 0; 89 | foreach($value as $char) { 90 | $count += $this->_check[$char]; 91 | } 92 | 93 | $mod = $count % 43; 94 | if ($mod == $this->_check[$checksum]) { 95 | return true; 96 | } 97 | 98 | return false; 99 | } 100 | } 101 | -------------------------------------------------------------------------------- /lib/Zend/Validate/File/ExcludeExtension.php: -------------------------------------------------------------------------------- 1 | "File '%value%' has a false extension", 48 | self::NOT_FOUND => "File '%value%' is not readable or does not exist", 49 | ); 50 | 51 | /** 52 | * Defined by Zend_Validate_Interface 53 | * 54 | * Returns true if and only if the fileextension of $value is not included in the 55 | * set extension list 56 | * 57 | * @param string $value Real file to check for extension 58 | * @param array $file File data from Zend_File_Transfer 59 | * @return boolean 60 | */ 61 | public function isValid($value, $file = null) 62 | { 63 | // Is file readable ? 64 | require_once 'Zend/Loader.php'; 65 | if (!Zend_Loader::isReadable($value)) { 66 | return $this->_throw($file, self::NOT_FOUND); 67 | } 68 | 69 | if ($file !== null) { 70 | $info['extension'] = substr($file['name'], strrpos($file['name'], '.') + 1); 71 | } else { 72 | $info = pathinfo($value); 73 | } 74 | 75 | $extensions = $this->getExtension(); 76 | 77 | if ($this->_case and (!in_array($info['extension'], $extensions))) { 78 | return true; 79 | } else if (!$this->_case) { 80 | $found = false; 81 | foreach ($extensions as $extension) { 82 | if (strtolower($extension) == strtolower($info['extension'])) { 83 | $found = true; 84 | } 85 | } 86 | 87 | if (!$found) { 88 | return true; 89 | } 90 | } 91 | 92 | return $this->_throw($file, self::FALSE_EXTENSION); 93 | } 94 | } 95 | -------------------------------------------------------------------------------- /lib/Zend/XmlRpc/Value/DateTime.php: -------------------------------------------------------------------------------- 1 | _type = self::XMLRPC_TYPE_DATETIME; 64 | 65 | if ($value instanceof Zend_Date) { 66 | $this->_value = $value->toString($this->_isoFormatString); 67 | } elseif ($value instanceof DateTime) { 68 | $this->_value = $value->format($this->_phpFormatString); 69 | } elseif (is_numeric($value)) { // The value is numeric, we make sure it is an integer 70 | $this->_value = date($this->_phpFormatString, (int)$value); 71 | } else { 72 | $timestamp = new DateTime($value); 73 | if ($timestamp === false) { // cannot convert the value to a timestamp 74 | require_once 'Zend/XmlRpc/Value/Exception.php'; 75 | throw new Zend_XmlRpc_Value_Exception('Cannot convert given value \''. $value .'\' to a timestamp'); 76 | } 77 | 78 | $this->_value = $timestamp->format($this->_phpFormatString); // Convert the timestamp to iso8601 format 79 | } 80 | } 81 | 82 | /** 83 | * Return the value of this object as iso8601 dateTime value 84 | * 85 | * @return int As a Unix timestamp 86 | */ 87 | public function getValue() 88 | { 89 | return $this->_value; 90 | } 91 | } 92 | -------------------------------------------------------------------------------- /lib/Zend/Validate/LessThan.php: -------------------------------------------------------------------------------- 1 | "'%value%' is not less than '%max%'" 42 | ); 43 | 44 | /** 45 | * @var array 46 | */ 47 | protected $_messageVariables = array( 48 | 'max' => '_max' 49 | ); 50 | 51 | /** 52 | * Maximum value 53 | * 54 | * @var mixed 55 | */ 56 | protected $_max; 57 | 58 | /** 59 | * Sets validator options 60 | * 61 | * @param mixed|Zend_Config $max 62 | * @return void 63 | */ 64 | public function __construct($max) 65 | { 66 | if ($max instanceof Zend_Config) { 67 | $max = $max->toArray(); 68 | } 69 | 70 | if (is_array($max)) { 71 | if (array_key_exists('max', $max)) { 72 | $max = $max['max']; 73 | } else { 74 | require_once 'Zend/Validate/Exception.php'; 75 | throw new Zend_Validate_Exception("Missing option 'max'"); 76 | } 77 | } 78 | 79 | $this->setMax($max); 80 | } 81 | 82 | /** 83 | * Returns the max option 84 | * 85 | * @return mixed 86 | */ 87 | public function getMax() 88 | { 89 | return $this->_max; 90 | } 91 | 92 | /** 93 | * Sets the max option 94 | * 95 | * @param mixed $max 96 | * @return Zend_Validate_LessThan Provides a fluent interface 97 | */ 98 | public function setMax($max) 99 | { 100 | $this->_max = $max; 101 | return $this; 102 | } 103 | 104 | /** 105 | * Defined by Zend_Validate_Interface 106 | * 107 | * Returns true if and only if $value is less than max option 108 | * 109 | * @param mixed $value 110 | * @return boolean 111 | */ 112 | public function isValid($value) 113 | { 114 | $this->_setValue($value); 115 | if ($this->_max <= $value) { 116 | $this->_error(self::NOT_LESS); 117 | return false; 118 | } 119 | return true; 120 | } 121 | 122 | } 123 | -------------------------------------------------------------------------------- /lib/Zend/Validate/GreaterThan.php: -------------------------------------------------------------------------------- 1 | "'%value%' is not greater than '%min%'", 43 | ); 44 | 45 | /** 46 | * @var array 47 | */ 48 | protected $_messageVariables = array( 49 | 'min' => '_min' 50 | ); 51 | 52 | /** 53 | * Minimum value 54 | * 55 | * @var mixed 56 | */ 57 | protected $_min; 58 | 59 | /** 60 | * Sets validator options 61 | * 62 | * @param mixed|Zend_Config $min 63 | * @return void 64 | */ 65 | public function __construct($min) 66 | { 67 | if ($min instanceof Zend_Config) { 68 | $min = $min->toArray(); 69 | } 70 | 71 | if (is_array($min)) { 72 | if (array_key_exists('min', $min)) { 73 | $min = $min['min']; 74 | } else { 75 | require_once 'Zend/Validate/Exception.php'; 76 | throw new Zend_Validate_Exception("Missing option 'min'"); 77 | } 78 | } 79 | 80 | $this->setMin($min); 81 | } 82 | 83 | /** 84 | * Returns the min option 85 | * 86 | * @return mixed 87 | */ 88 | public function getMin() 89 | { 90 | return $this->_min; 91 | } 92 | 93 | /** 94 | * Sets the min option 95 | * 96 | * @param mixed $min 97 | * @return Zend_Validate_GreaterThan Provides a fluent interface 98 | */ 99 | public function setMin($min) 100 | { 101 | $this->_min = $min; 102 | return $this; 103 | } 104 | 105 | /** 106 | * Defined by Zend_Validate_Interface 107 | * 108 | * Returns true if and only if $value is greater than min option 109 | * 110 | * @param mixed $value 111 | * @return boolean 112 | */ 113 | public function isValid($value) 114 | { 115 | $this->_setValue($value); 116 | 117 | if ($this->_min >= $value) { 118 | $this->_error(self::NOT_GREATER); 119 | return false; 120 | } 121 | return true; 122 | } 123 | 124 | } 125 | -------------------------------------------------------------------------------- /lib/Zend/Validate/File/WordCount.php: -------------------------------------------------------------------------------- 1 | "Too much words, maximum '%max%' are allowed but '%count%' were counted", 50 | self::TOO_LESS => "Too less words, minimum '%min%' are expected but '%count%' were counted", 51 | self::NOT_FOUND => "File '%value%' is not readable or does not exist", 52 | ); 53 | 54 | /** 55 | * Defined by Zend_Validate_Interface 56 | * 57 | * Returns true if and only if the counted words are at least min and 58 | * not bigger than max (when max is not null). 59 | * 60 | * @param string $value Filename to check for word count 61 | * @param array $file File data from Zend_File_Transfer 62 | * @return boolean 63 | */ 64 | public function isValid($value, $file = null) 65 | { 66 | // Is file readable ? 67 | require_once 'Zend/Loader.php'; 68 | if (!Zend_Loader::isReadable($value)) { 69 | return $this->_throw($file, self::NOT_FOUND); 70 | } 71 | 72 | $content = file_get_contents($value); 73 | $this->_count = str_word_count($content); 74 | if (($this->_max !== null) && ($this->_count > $this->_max)) { 75 | return $this->_throw($file, self::TOO_MUCH); 76 | } 77 | 78 | if (($this->_min !== null) && ($this->_count < $this->_min)) { 79 | return $this->_throw($file, self::TOO_LESS); 80 | } 81 | 82 | return true; 83 | } 84 | 85 | /** 86 | * Throws an error of the given type 87 | * 88 | * @param string $file 89 | * @param string $errorType 90 | * @return false 91 | */ 92 | protected function _throw($file, $errorType) 93 | { 94 | if ($file !== null) { 95 | $this->_value = $file['name']; 96 | } 97 | 98 | $this->_error($errorType); 99 | return false; 100 | } 101 | } 102 | -------------------------------------------------------------------------------- /lib/Zend/Validate/Barcode/Issn.php: -------------------------------------------------------------------------------- 1 | _checksum = '_issn'; 80 | } else { 81 | $this->_checksum = '_gtin'; 82 | } 83 | 84 | return parent::checksum($value); 85 | } 86 | 87 | /** 88 | * Validates the checksum () 89 | * ISSN implementation (reversed mod11) 90 | * 91 | * @param string $value The barcode to validate 92 | * @return boolean 93 | */ 94 | protected function _issn($value) 95 | { 96 | $checksum = substr($value, -1, 1); 97 | $values = str_split(substr($value, 0, -1)); 98 | $check = 0; 99 | $multi = 8; 100 | foreach($values as $token) { 101 | if ($token == 'X') { 102 | $token = 10; 103 | } 104 | 105 | $check += ($token * $multi); 106 | --$multi; 107 | } 108 | 109 | $check %= 11; 110 | $check = 11 - $check; 111 | if ($check == $checksum) { 112 | return true; 113 | } else if (($check == 10) && ($checksum == 'X')) { 114 | return true; 115 | } 116 | 117 | return false; 118 | } 119 | } 120 | -------------------------------------------------------------------------------- /lib/Zend/Http/UserAgent/Text.php: -------------------------------------------------------------------------------- 1 | setFeature('images', false, 'product_capability'); 76 | $this->setFeature('iframes', false, 'product_capability'); 77 | $this->setFeature('frames', false, 'product_capability'); 78 | $this->setFeature('javascript', false, 'product_capability'); 79 | return parent::_defineFeatures(); 80 | } 81 | 82 | /** 83 | * Determine supported image formats 84 | * 85 | * @return null 86 | */ 87 | public function getImageFormatSupport() 88 | { 89 | return null; 90 | } 91 | 92 | /** 93 | * Get preferred markup format 94 | * 95 | * @return string 96 | */ 97 | public function getPreferredMarkup() 98 | { 99 | return 'xhtml'; 100 | } 101 | 102 | /** 103 | * Get supported X/HTML markup level 104 | * 105 | * @return int 106 | */ 107 | public function getXhtmlSupportLevel() 108 | { 109 | return 1; 110 | } 111 | 112 | /** 113 | * Does the device support Flash? 114 | * 115 | * @return bool 116 | */ 117 | public function hasFlashSupport() 118 | { 119 | 120 | return false; 121 | } 122 | 123 | /** 124 | * Does the device support PDF? 125 | * 126 | * @return bool 127 | */ 128 | public function hasPdfSupport() 129 | { 130 | return false; 131 | } 132 | } 133 | -------------------------------------------------------------------------------- /lib/Zend/Validate/Ccnum.php: -------------------------------------------------------------------------------- 1 | "'%value%' must contain between 13 and 19 digits", 59 | self::CHECKSUM => "Luhn algorithm (mod-10 checksum) failed on '%value%'" 60 | ); 61 | 62 | public function __construct() 63 | { 64 | trigger_error('Using the Ccnum validator is deprecated in favor of the CreditCard validator'); 65 | } 66 | 67 | /** 68 | * Defined by Zend_Validate_Interface 69 | * 70 | * Returns true if and only if $value follows the Luhn algorithm (mod-10 checksum) 71 | * 72 | * @param string $value 73 | * @return boolean 74 | */ 75 | public function isValid($value) 76 | { 77 | $this->_setValue($value); 78 | 79 | if (null === self::$_filter) { 80 | /** 81 | * @see Zend_Filter_Digits 82 | */ 83 | require_once 'Zend/Filter/Digits.php'; 84 | self::$_filter = new Zend_Filter_Digits(); 85 | } 86 | 87 | $valueFiltered = self::$_filter->filter($value); 88 | 89 | $length = strlen($valueFiltered); 90 | 91 | if ($length < 13 || $length > 19) { 92 | $this->_error(self::LENGTH); 93 | return false; 94 | } 95 | 96 | $sum = 0; 97 | $weight = 2; 98 | 99 | for ($i = $length - 2; $i >= 0; $i--) { 100 | $digit = $weight * $valueFiltered[$i]; 101 | $sum += floor($digit / 10) + $digit % 10; 102 | $weight = $weight % 2 + 1; 103 | } 104 | 105 | if ((10 - $sum % 10) % 10 != $valueFiltered[$length - 1]) { 106 | $this->_error(self::CHECKSUM, $valueFiltered); 107 | return false; 108 | } 109 | 110 | return true; 111 | } 112 | } 113 | -------------------------------------------------------------------------------- /lib/Zend/Http/UserAgent/Bot.php: -------------------------------------------------------------------------------- 1 | _fault = new Zend_XmlRpc_Fault(630); 68 | return; 69 | } 70 | 71 | $this->_xml = $xml; 72 | 73 | $this->loadXml($xml); 74 | } 75 | 76 | /** 77 | * Retrieve the raw XML request 78 | * 79 | * @return string 80 | */ 81 | public function getRawRequest() 82 | { 83 | return $this->_xml; 84 | } 85 | 86 | /** 87 | * Get headers 88 | * 89 | * Gets all headers as key => value pairs and returns them. 90 | * 91 | * @return array 92 | */ 93 | public function getHeaders() 94 | { 95 | if (null === $this->_headers) { 96 | $this->_headers = array(); 97 | foreach ($_SERVER as $key => $value) { 98 | if ('HTTP_' == substr($key, 0, 5)) { 99 | $header = str_replace(' ', '-', ucwords(strtolower(str_replace('_', ' ', substr($key, 5))))); 100 | $this->_headers[$header] = $value; 101 | } 102 | } 103 | } 104 | 105 | return $this->_headers; 106 | } 107 | 108 | /** 109 | * Retrieve the full HTTP request, including headers and XML 110 | * 111 | * @return string 112 | */ 113 | public function getFullRequest() 114 | { 115 | $request = ''; 116 | foreach ($this->getHeaders() as $key => $value) { 117 | $request .= $key . ': ' . $value . "\n"; 118 | } 119 | 120 | $request .= $this->_xml; 121 | 122 | return $request; 123 | } 124 | } 125 | -------------------------------------------------------------------------------- /lib/Zend/Http/UserAgent/Features/Adapter/TeraWurfl.php: -------------------------------------------------------------------------------- 1 | getDeviceCapabilitiesFromRequest(array_change_key_case($request, CASE_UPPER)); 75 | 76 | return self::getAllCapabilities($wurflObj); 77 | } 78 | 79 | /*** 80 | * Builds an array with all capabilities 81 | * 82 | * @param TeraWurfl $wurflObj TeraWurfl object 83 | */ 84 | public static function getAllCapabilities(TeraWurfl $wurflObj) 85 | { 86 | 87 | foreach ($wurflObj->capabilities as $group) { 88 | if (!is_array($group)) { 89 | continue; 90 | } 91 | while (list ($key, $value) = each($group)) { 92 | if (is_bool($value)) { 93 | // to have the same type than the official WURFL API 94 | $features[$key] = ($value ? 'true' : 'false'); 95 | } else { 96 | $features[$key] = $value; 97 | } 98 | } 99 | } 100 | return $features; 101 | } 102 | } 103 | -------------------------------------------------------------------------------- /lib/Zend/Validate/Barcode/Code93.php: -------------------------------------------------------------------------------- 1 | 0, '1' => 1, '2' => 2, '3' => 3, '4' => 4, '5' => 5, '6' => 6, 59 | '7' => 7, '8' => 8, '9' => 9, 'A' => 10, 'B' => 11, 'C' => 12, 'D' => 13, 60 | 'E' => 14, 'F' => 15, 'G' => 16, 'H' => 17, 'I' => 18, 'J' => 19, 'K' => 20, 61 | 'L' => 21, 'M' => 22, 'N' => 23, 'O' => 24, 'P' => 25, 'Q' => 26, 'R' => 27, 62 | 'S' => 28, 'T' => 29, 'U' => 30, 'V' => 31, 'W' => 32, 'X' => 33, 'Y' => 34, 63 | 'Z' => 35, '-' => 36, '.' => 37, ' ' => 38, '$' => 39, '/' => 40, '+' => 41, 64 | '%' => 42, '!' => 43, '"' => 44, '§' => 45, '&' => 46, 65 | ); 66 | 67 | /** 68 | * Constructor 69 | * 70 | * Sets check flag to false. 71 | * 72 | * @return void 73 | */ 74 | public function __construct() 75 | { 76 | $this->setCheck(false); 77 | } 78 | 79 | /** 80 | * Validates the checksum (Modulo CK) 81 | * 82 | * @param string $value The barcode to validate 83 | * @return boolean 84 | */ 85 | protected function _code93($value) 86 | { 87 | $checksum = substr($value, -2, 2); 88 | $value = str_split(substr($value, 0, -2)); 89 | $count = 0; 90 | $length = count($value) % 20; 91 | foreach($value as $char) { 92 | if ($length == 0) { 93 | $length = 20; 94 | } 95 | 96 | $count += $this->_check[$char] * $length; 97 | --$length; 98 | } 99 | 100 | $check = array_search(($count % 47), $this->_check); 101 | $value[] = $check; 102 | $count = 0; 103 | $length = count($value) % 15; 104 | foreach($value as $char) { 105 | if ($length == 0) { 106 | $length = 15; 107 | } 108 | 109 | $count += $this->_check[$char] * $length; 110 | --$length; 111 | } 112 | $check .= array_search(($count % 47), $this->_check); 113 | 114 | if ($check == $checksum) { 115 | return true; 116 | } 117 | 118 | return false; 119 | } 120 | } 121 | --------------------------------------------------------------------------------