diff -r 5b37998e522e -r 162c1de6545a web/lib/Zend/Service/Technorati/Utils.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/web/lib/Zend/Service/Technorati/Utils.php Fri Mar 11 15:05:35 2011 +0100 @@ -0,0 +1,136 @@ +getMessage(), 0, $e); + } + } + + // allow inly Zend_Uri_Http objects or child classes + if (!($uri instanceof Zend_Uri_Http)) { + /** + * @see Zend_Service_Technorati_Exception + */ + require_once 'Zend/Service/Technorati/Exception.php'; + throw new Zend_Service_Technorati_Exception( + "Invalid URL $uri, only HTTP(S) protocols can be used"); + } + + return $uri; + } + /** + * Parses, validates and returns a valid Zend_Date object + * from given $input. + * + * $input can be either a string, an integer or a Zend_Date object. + * If $input is string or int, it will be provided to Zend_Date as it is. + * If $input is a Zend_Date object, the object instance will be returned. + * + * @param mixed|Zend_Date $input + * @return null|Zend_Date + * @throws Zend_Service_Technorati_Exception + * @static + */ + public static function normalizeDate($input) + { + /** + * @see Zend_Date + */ + require_once 'Zend/Date.php'; + /** + * @see Zend_Locale + */ + require_once 'Zend/Locale.php'; + + // allow null as value and return valid Zend_Date objects + if (($input === null) || ($input instanceof Zend_Date)) { + return $input; + } + + // due to a BC break as of ZF 1.5 it's not safe to use Zend_Date::isDate() here + // see ZF-2524, ZF-2334 + if (@strtotime($input) !== FALSE) { + return new Zend_Date($input); + } else { + /** + * @see Zend_Service_Technorati_Exception + */ + require_once 'Zend/Service/Technorati/Exception.php'; + throw new Zend_Service_Technorati_Exception("'$input' is not a valid Date/Time"); + } + } + + /** + * @todo public static function xpathQueryAndSet() {} + */ + + /** + * @todo public static function xpathQueryAndSetIf() {} + */ + + /** + * @todo public static function xpathQueryAndSetUnless() {} + */ +}