Version.php 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <?php
  2. /**
  3. * Zend Framework
  4. *
  5. * LICENSE
  6. *
  7. * This source file is subject to the new BSD license that is bundled
  8. * with this package in the file LICENSE.txt.
  9. * It is also available through the world-wide-web at this URL:
  10. * http://framework.zend.com/license/new-bsd
  11. * If you did not receive a copy of the license and are unable to
  12. * obtain it through the world-wide-web, please send an email
  13. * to license@zend.com so we can send you a copy immediately.
  14. *
  15. * @category Zend
  16. * @package Zend_Version
  17. * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
  18. * @license http://framework.zend.com/license/new-bsd New BSD License
  19. * @version $Id: Version.php 2504 2011-12-28 07:35:29Z liu21st $
  20. */
  21. /**
  22. * Class to store and retrieve the version of Zend Framework.
  23. *
  24. * @category Zend
  25. * @package Zend_Version
  26. * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
  27. * @license http://framework.zend.com/license/new-bsd New BSD License
  28. */
  29. final class Zend_Version
  30. {
  31. /**
  32. * Zend Framework version identification - see compareVersion()
  33. */
  34. const VERSION = '1.9.5';
  35. /**
  36. * Compare the specified Zend Framework version string $version
  37. * with the current Zend_Version::VERSION of Zend Framework.
  38. *
  39. * @param string $version A version string (e.g. "0.7.1").
  40. * @return boolean -1 if the $version is older,
  41. * 0 if they are the same,
  42. * and +1 if $version is newer.
  43. *
  44. */
  45. public static function compareVersion($version)
  46. {
  47. $version = strtolower($version);
  48. $version = preg_replace('/(\d)pr(\d?)/', '$1a$2', $version);
  49. return version_compare($version, strtolower(self::VERSION));
  50. }
  51. }